[dpdk-dev] [PATCH v2 1/4] mem: remove physical address aliases
Kinsella, Ray
mdr at ashroe.eu
Fri Sep 18 16:38:13 CEST 2020
On 17/09/2020 11:41, Thomas Monjalon wrote:
> Remove the deprecated unioned fields phys_addr
> from the structures rte_memseg and rte_memzone.
> They are replaced with the fields iova which are at the same offsets.
>
> Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
> Acked-by: Andrew Rybchenko <arybchenko at solarflare.com>
> Acked-by: Anatoly Burakov <anatoly.burakov at intel.com>
> ---
> doc/guides/rel_notes/release_20_11.rst | 4 ++++
> drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 2 +-
> drivers/common/dpaax/dpaax_iova_table.c | 2 +-
> drivers/compress/qat/qat_comp.c | 2 +-
> drivers/compress/qat/qat_comp_pmd.c | 2 +-
> drivers/crypto/ccp/ccp_dev.c | 2 +-
> drivers/crypto/octeontx/otx_cryptodev_hw_access.c | 2 +-
> drivers/crypto/virtio/virtio_cryptodev.c | 6 +++---
> drivers/net/ice/base/ice_osdep.h | 2 +-
> drivers/net/pfe/base/pfe.h | 2 +-
> lib/librte_eal/include/rte_memory.h | 6 +-----
> lib/librte_eal/include/rte_memzone.h | 6 +-----
> lib/librte_kni/rte_kni.c | 14 +++++++-------
> 13 files changed, 24 insertions(+), 28 deletions(-)
>
> diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
> index b729bdf200..c49e612c43 100644
> --- a/doc/guides/rel_notes/release_20_11.rst
> +++ b/doc/guides/rel_notes/release_20_11.rst
> @@ -84,6 +84,10 @@ API Changes
> Also, make sure to start the actual text at the margin.
> =======================================================
>
> +* mem: Removed the unioned field ``phys_addr`` from
> + the structures ``rte_memseg`` and ``rte_memzone``.
> + The field ``iova`` is remaining from the old unions.
> +
> * mbuf: Removed the unioned field ``refcnt_atomic`` from
> the structures ``rte_mbuf`` and ``rte_mbuf_ext_shared_info``.
> The field ``refcnt`` is remaining from the old unions.
> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
> index 35423df12b..2dd53c63ba 100644
> --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
> +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
> @@ -368,7 +368,7 @@ static phys_addr_t dpaa2_mem_vtop(uint64_t vaddr)
>
> memseg = rte_mem_virt2memseg((void *)(uintptr_t)vaddr, NULL);
> if (memseg)
> - return memseg->phys_addr + RTE_PTR_DIFF(vaddr, memseg->addr);
> + return memseg->iova + RTE_PTR_DIFF(vaddr, memseg->addr);
> return (size_t)NULL;
> }
>
> diff --git a/drivers/common/dpaax/dpaax_iova_table.c b/drivers/common/dpaax/dpaax_iova_table.c
> index 5ba8ed1933..91bee65e7b 100644
> --- a/drivers/common/dpaax/dpaax_iova_table.c
> +++ b/drivers/common/dpaax/dpaax_iova_table.c
> @@ -440,7 +440,7 @@ dpaax_memevent_walk_memsegs(const struct rte_memseg_list *msl __rte_unused,
> void *arg __rte_unused)
> {
> DPAAX_DEBUG("Walking for %p (pa=%"PRIu64") and len %zu",
> - ms->addr, ms->phys_addr, len);
> + ms->addr, ms->iova, len);
> dpaax_iova_table_update(rte_mem_virt2phy(ms->addr), ms->addr, len);
> return 0;
> }
> diff --git a/drivers/compress/qat/qat_comp.c b/drivers/compress/qat/qat_comp.c
> index 9e1fd2fe91..335fd63b98 100644
> --- a/drivers/compress/qat/qat_comp.c
> +++ b/drivers/compress/qat/qat_comp.c
> @@ -957,7 +957,7 @@ static int qat_comp_create_templates(struct qat_comp_xform *qat_xform,
> ICP_QAT_FW_SLICE_XLAT);
>
> comp_req->u1.xlt_pars.inter_buff_ptr =
> - interm_buff_mz->phys_addr;
> + interm_buff_mz->iova;
> }
>
> #if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG
> diff --git a/drivers/compress/qat/qat_comp_pmd.c b/drivers/compress/qat/qat_comp_pmd.c
> index 311e561685..18ecb34ba7 100644
> --- a/drivers/compress/qat/qat_comp_pmd.c
> +++ b/drivers/compress/qat/qat_comp_pmd.c
> @@ -242,7 +242,7 @@ qat_comp_setup_inter_buffers(struct qat_comp_dev_private *comp_dev,
> }
>
> mz_start = (uint8_t *)memzone->addr;
> - mz_start_phys = memzone->phys_addr;
> + mz_start_phys = memzone->iova;
> QAT_LOG(DEBUG, "Memzone %s: addr = %p, phys = 0x%"PRIx64
> ", size required %d, size created %zu",
> inter_buff_mz_name, mz_start, mz_start_phys,
> diff --git a/drivers/crypto/ccp/ccp_dev.c b/drivers/crypto/ccp/ccp_dev.c
> index 7d98b2eb25..664ddc1747 100644
> --- a/drivers/crypto/ccp/ccp_dev.c
> +++ b/drivers/crypto/ccp/ccp_dev.c
> @@ -546,7 +546,7 @@ ccp_add_device(struct ccp_device *dev, int type)
> cmd_q->qsize, SOCKET_ID_ANY);
> cmd_q->qbase_addr = (void *)q_mz->addr;
> cmd_q->qbase_desc = (void *)q_mz->addr;
> - cmd_q->qbase_phys_addr = q_mz->phys_addr;
> + cmd_q->qbase_phys_addr = q_mz->iova;
>
> cmd_q->qcontrol = 0;
> /* init control reg to zero */
> diff --git a/drivers/crypto/octeontx/otx_cryptodev_hw_access.c b/drivers/crypto/octeontx/otx_cryptodev_hw_access.c
> index ce546c2ffe..ee36b0183e 100644
> --- a/drivers/crypto/octeontx/otx_cryptodev_hw_access.c
> +++ b/drivers/crypto/octeontx/otx_cryptodev_hw_access.c
> @@ -556,7 +556,7 @@ otx_cpt_get_resource(const struct rte_cryptodev *dev, uint8_t group,
> }
>
> mem = rz->addr;
> - dma_addr = rz->phys_addr;
> + dma_addr = rz->iova;
> alloc_len = len;
>
> memset(mem, 0, len);
> diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
> index 31a5f1072a..1822f21744 100644
> --- a/drivers/crypto/virtio/virtio_cryptodev.c
> +++ b/drivers/crypto/virtio/virtio_cryptodev.c
> @@ -411,7 +411,7 @@ virtio_crypto_queue_setup(struct rte_cryptodev *dev,
> * and only accepts 32 bit page frame number.
> * Check if the allocated physical memory exceeds 16TB.
> */
> - if ((mz->phys_addr + vq->vq_ring_size - 1)
> + if ((mz->iova + vq->vq_ring_size - 1)
> >> (VIRTIO_PCI_QUEUE_ADDR_SHIFT + 32)) {
> VIRTIO_CRYPTO_INIT_LOG_ERR("vring address shouldn't be "
> "above 16TB!");
> @@ -420,10 +420,10 @@ virtio_crypto_queue_setup(struct rte_cryptodev *dev,
>
> memset(mz->addr, 0, sizeof(mz->len));
> vq->mz = mz;
> - vq->vq_ring_mem = mz->phys_addr;
> + vq->vq_ring_mem = mz->iova;
> vq->vq_ring_virt_mem = mz->addr;
> VIRTIO_CRYPTO_INIT_LOG_DBG("vq->vq_ring_mem(physical): 0x%"PRIx64,
> - (uint64_t)mz->phys_addr);
> + (uint64_t)mz->iova);
> VIRTIO_CRYPTO_INIT_LOG_DBG("vq->vq_ring_virt_mem: 0x%"PRIx64,
> (uint64_t)(uintptr_t)mz->addr);
>
> diff --git a/drivers/net/ice/base/ice_osdep.h b/drivers/net/ice/base/ice_osdep.h
> index 360e435b8d..9a170b5143 100644
> --- a/drivers/net/ice/base/ice_osdep.h
> +++ b/drivers/net/ice/base/ice_osdep.h
> @@ -258,7 +258,7 @@ ice_alloc_dma_mem(__rte_unused struct ice_hw *hw,
>
> mem->size = size;
> mem->va = mz->addr;
> - mem->pa = mz->phys_addr;
> + mem->pa = mz->iova;
> mem->zone = (const void *)mz;
> PMD_DRV_LOG(DEBUG, "memzone %s allocated with physical address: "
> "%"PRIu64, mz->name, mem->pa);
> diff --git a/drivers/net/pfe/base/pfe.h b/drivers/net/pfe/base/pfe.h
> index 72741ba4a8..0a88e98c1b 100644
> --- a/drivers/net/pfe/base/pfe.h
> +++ b/drivers/net/pfe/base/pfe.h
> @@ -414,7 +414,7 @@ static inline phys_addr_t pfe_mem_vtop(uint64_t vaddr)
>
> memseg = rte_mem_virt2memseg((void *)(uintptr_t)vaddr, NULL);
> if (memseg)
> - return memseg->phys_addr + RTE_PTR_DIFF(vaddr, memseg->addr);
> + return memseg->iova + RTE_PTR_DIFF(vaddr, memseg->addr);
>
> return (size_t)NULL;
> }
> diff --git a/lib/librte_eal/include/rte_memory.h b/lib/librte_eal/include/rte_memory.h
> index 65374d53a3..bba9b5300a 100644
> --- a/lib/librte_eal/include/rte_memory.h
> +++ b/lib/librte_eal/include/rte_memory.h
> @@ -43,11 +43,7 @@ extern "C" {
> #define RTE_MEMSEG_FLAG_DO_NOT_FREE (1 << 0)
> /**< Prevent this segment from being freed back to the OS. */
> struct rte_memseg {
> - RTE_STD_C11
> - union {
> - phys_addr_t phys_addr; /**< deprecated - Start physical address. */
> - rte_iova_t iova; /**< Start IO address. */
> - };
> + rte_iova_t iova; /**< Start IO address. */
> RTE_STD_C11
> union {
> void *addr; /**< Start virtual address. */
> diff --git a/lib/librte_eal/include/rte_memzone.h b/lib/librte_eal/include/rte_memzone.h
> index 091c9522f7..5db1210831 100644
> --- a/lib/librte_eal/include/rte_memzone.h
> +++ b/lib/librte_eal/include/rte_memzone.h
> @@ -51,11 +51,7 @@ struct rte_memzone {
> #define RTE_MEMZONE_NAMESIZE 32 /**< Maximum length of memory zone name.*/
> char name[RTE_MEMZONE_NAMESIZE]; /**< Name of the memory zone. */
>
> - RTE_STD_C11
> - union {
> - phys_addr_t phys_addr; /**< deprecated - Start physical address. */
> - rte_iova_t iova; /**< Start IO address. */
> - };
> + rte_iova_t iova; /**< Start IO address. */
> RTE_STD_C11
> union {
> void *addr; /**< Start virtual address. */
> diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c
> index bcf82cc2d5..837d0217d2 100644
> --- a/lib/librte_kni/rte_kni.c
> +++ b/lib/librte_kni/rte_kni.c
> @@ -276,37 +276,37 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool,
> /* TX RING */
> kni->tx_q = kni->m_tx_q->addr;
> kni_fifo_init(kni->tx_q, KNI_FIFO_COUNT_MAX);
> - dev_info.tx_phys = kni->m_tx_q->phys_addr;
> + dev_info.tx_phys = kni->m_tx_q->iova;
>
> /* RX RING */
> kni->rx_q = kni->m_rx_q->addr;
> kni_fifo_init(kni->rx_q, KNI_FIFO_COUNT_MAX);
> - dev_info.rx_phys = kni->m_rx_q->phys_addr;
> + dev_info.rx_phys = kni->m_rx_q->iova;
>
> /* ALLOC RING */
> kni->alloc_q = kni->m_alloc_q->addr;
> kni_fifo_init(kni->alloc_q, KNI_FIFO_COUNT_MAX);
> - dev_info.alloc_phys = kni->m_alloc_q->phys_addr;
> + dev_info.alloc_phys = kni->m_alloc_q->iova;
>
> /* FREE RING */
> kni->free_q = kni->m_free_q->addr;
> kni_fifo_init(kni->free_q, KNI_FIFO_COUNT_MAX);
> - dev_info.free_phys = kni->m_free_q->phys_addr;
> + dev_info.free_phys = kni->m_free_q->iova;
>
> /* Request RING */
> kni->req_q = kni->m_req_q->addr;
> kni_fifo_init(kni->req_q, KNI_FIFO_COUNT_MAX);
> - dev_info.req_phys = kni->m_req_q->phys_addr;
> + dev_info.req_phys = kni->m_req_q->iova;
>
> /* Response RING */
> kni->resp_q = kni->m_resp_q->addr;
> kni_fifo_init(kni->resp_q, KNI_FIFO_COUNT_MAX);
> - dev_info.resp_phys = kni->m_resp_q->phys_addr;
> + dev_info.resp_phys = kni->m_resp_q->iova;
>
> /* Req/Resp sync mem area */
> kni->sync_addr = kni->m_sync_addr->addr;
> dev_info.sync_va = kni->m_sync_addr->addr;
> - dev_info.sync_phys = kni->m_sync_addr->phys_addr;
> + dev_info.sync_phys = kni->m_sync_addr->iova;
>
> kni->pktmbuf_pool = pktmbuf_pool;
> kni->group_id = conf->group_id;
>
Acked-by: Ray Kinsella <mdr at ashroe.eu>
More information about the dev
mailing list