From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 02B451B26F for ; Mon, 6 Nov 2017 02:42:17 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 97FB820C05; Sun, 5 Nov 2017 20:42:16 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Sun, 05 Nov 2017 20:42:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=r9nt8GOsEud/XP Te74Q/UY7DXz4tEPJ+4zZq2v8aeM8=; b=g6GkkgZ9V7OnzCIClQjvaoGooFYQa7 XyJGDtT+AApxVBUaLo4mU33XHX4e9pqwO/cqdp7K3AUORXMWinVYPrUDJpGXzsGz 6UKd6FLmM+VaChC9Oih7nTvHpShVqbvFcS99W5IMwlWjbBdigCcvPy08m0dLxDm2 HZe5tXIDXfy6c= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=r9nt8GOsEud/XPTe74Q/UY7DXz4tEPJ+4zZq2v8aeM8=; b=CQdK7i71 ELUDlfu8IGHZDNmJHOucY9wHvpr6pLYcCBQDS/sBFJY2sw/Kbiw0qS/7dpnfKx9a 98eQtb1vXQS9bt6nx6T67wcpr5dco1J8DUiNFTwNIiVrAE0e8O/tYfp+oCO6HN3A sa0Nc0T3wnjGZplfXULexWwNIOOHzZQcnc9QPRrFNH+CYLDph0AwaGhthIiZ1Lvp yzM0O/goI8Al9mUE9ddxDZUceJTNx4qjxXQZIl70+Ad6EEU2eH01QhMO3sW3WoaV LdlfDLxkTLCzllHESUzoqmtvp+ivt9FTYUa3g9F2nAKv6bUrR3aZxD733TH+O3pQ 0eJ0t4U+R78Bcg== X-ME-Sender: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 9C3CE2494B; Sun, 5 Nov 2017 20:42:15 -0500 (EST) From: Thomas Monjalon To: Santosh Shukla Cc: olivier.matz@6wind.com, sergio.gonzalez.monroy@intel.com, anatoly.burakov@intel.com, dev@dpdk.org Date: Mon, 6 Nov 2017 02:41:33 +0100 Message-Id: <20171106014141.13266-8-thomas@monjalon.net> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171106014141.13266-1-thomas@monjalon.net> References: <20170814151537.29454-1-santosh.shukla@caviumnetworks.com> <20171106014141.13266-1-thomas@monjalon.net> Subject: [dpdk-dev] [PATCH v4 07/15] memzone: rename address from physical to IOVA X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Nov 2017 01:42:17 -0000 The struct rte_memzone field .phys_addr is renamed to .iova. The deprecated name is kept in an anonymous union to avoid breaking the API. Signed-off-by: Thomas Monjalon --- drivers/crypto/qat/qat_qp.c | 2 +- drivers/net/bnx2x/bnx2x.c | 2 +- drivers/net/bnx2x/bnx2x_rxtx.c | 6 +-- drivers/net/bnxt/bnxt_ethdev.c | 4 +- drivers/net/bnxt/bnxt_ring.c | 4 +- drivers/net/bnxt/bnxt_vnic.c | 2 +- drivers/net/cxgbe/sge.c | 2 +- drivers/net/e1000/em_rxtx.c | 4 +- drivers/net/e1000/igb_rxtx.c | 4 +- drivers/net/ena/base/ena_plat_dpdk.h | 4 +- drivers/net/enic/enic_main.c | 6 +-- drivers/net/fm10k/fm10k_ethdev.c | 4 +- drivers/net/i40e/i40e_ethdev.c | 2 +- drivers/net/i40e/i40e_fdir.c | 2 +- drivers/net/i40e/i40e_rxtx.c | 8 +-- drivers/net/ixgbe/ixgbe_rxtx.c | 4 +- drivers/net/liquidio/lio_rxtx.c | 6 +-- drivers/net/nfp/nfp_net.c | 4 +- drivers/net/qede/base/bcm_osal.c | 10 ++-- drivers/net/qede/qede_fdir.c | 2 +- drivers/net/sfc/sfc.c | 2 +- drivers/net/thunderx/nicvf_ethdev.c | 6 +-- drivers/net/virtio/virtio_ethdev.c | 8 +-- drivers/net/vmxnet3/vmxnet3_ethdev.c | 8 +-- drivers/net/vmxnet3/vmxnet3_rxtx.c | 4 +- lib/librte_eal/common/eal_common_memzone.c | 6 +-- lib/librte_eal/common/include/rte_memzone.h | 6 ++- lib/librte_mempool/rte_mempool.c | 4 +- test/test/test_memzone.c | 80 ++++++++++++++--------------- 29 files changed, 105 insertions(+), 101 deletions(-) diff --git a/drivers/crypto/qat/qat_qp.c b/drivers/crypto/qat/qat_qp.c index 814ba17a9..94aeb9f63 100644 --- a/drivers/crypto/qat/qat_qp.c +++ b/drivers/crypto/qat/qat_qp.c @@ -373,7 +373,7 @@ qat_queue_create(struct rte_cryptodev *dev, struct qat_queue *queue, } queue->base_addr = (char *)qp_mz->addr; - queue->base_phys_addr = qp_mz->phys_addr; + queue->base_phys_addr = qp_mz->iova; if (qat_qp_check_queue_alignment(queue->base_phys_addr, queue_size_bytes)) { PMD_DRV_LOG(ERR, "Invalid alignment on queue create " diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index 44222af2f..6b4526b18 100644 --- a/drivers/net/bnx2x/bnx2x.c +++ b/drivers/net/bnx2x/bnx2x.c @@ -184,7 +184,7 @@ bnx2x_dma_alloc(struct bnx2x_softc *sc, size_t size, struct bnx2x_dma *dma, PMD_DRV_LOG(ERR, "DMA alloc failed for %s", msg); return -ENOMEM; } - dma->paddr = (uint64_t) z->phys_addr; + dma->paddr = (uint64_t) z->iova; dma->vaddr = z->addr; PMD_DRV_LOG(DEBUG, "%s: virt=%p phys=%" PRIx64, msg, dma->vaddr, dma->paddr); diff --git a/drivers/net/bnx2x/bnx2x_rxtx.c b/drivers/net/bnx2x/bnx2x_rxtx.c index c72067f6f..99d7d285c 100644 --- a/drivers/net/bnx2x/bnx2x_rxtx.c +++ b/drivers/net/bnx2x/bnx2x_rxtx.c @@ -108,7 +108,7 @@ bnx2x_dev_rx_queue_setup(struct rte_eth_dev *dev, bnx2x_rx_queue_release(rxq); return -ENOMEM; } - fp->rx_desc_mapping = rxq->rx_ring_phys_addr = (uint64_t)dma->phys_addr; + fp->rx_desc_mapping = rxq->rx_ring_phys_addr = (uint64_t)dma->iova; rxq->rx_ring = (uint64_t*)dma->addr; memset((void *)rxq->rx_ring, 0, dma_size); @@ -154,7 +154,7 @@ bnx2x_dev_rx_queue_setup(struct rte_eth_dev *dev, PMD_RX_LOG(ERR, "RCQ alloc failed"); return -ENOMEM; } - fp->rx_comp_mapping = rxq->cq_ring_phys_addr = (uint64_t)dma->phys_addr; + fp->rx_comp_mapping = rxq->cq_ring_phys_addr = (uint64_t)dma->iova; rxq->cq_ring = (union eth_rx_cqe*)dma->addr; /* Link the CQ chain pages. */ @@ -289,7 +289,7 @@ bnx2x_dev_tx_queue_setup(struct rte_eth_dev *dev, bnx2x_tx_queue_release(txq); return -ENOMEM; } - fp->tx_desc_mapping = txq->tx_ring_phys_addr = (uint64_t)tz->phys_addr; + fp->tx_desc_mapping = txq->tx_ring_phys_addr = (uint64_t)tz->iova; txq->tx_ring = (union eth_tx_bd_types *) tz->addr; memset(txq->tx_ring, 0, tsize); diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 9dc3901e1..ccd50a704 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -2847,7 +2847,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) return -ENOMEM; } memset(mz->addr, 0, mz->len); - mz_phys_addr = mz->phys_addr; + mz_phys_addr = mz->iova; if ((unsigned long)mz->addr == mz_phys_addr) { RTE_LOG(WARNING, PMD, "Memzone physical address same as virtual.\n"); @@ -2882,7 +2882,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) return -ENOMEM; } memset(mz->addr, 0, mz->len); - mz_phys_addr = mz->phys_addr; + mz_phys_addr = mz->iova; if ((unsigned long)mz->addr == mz_phys_addr) { RTE_LOG(WARNING, PMD, "Memzone physical address same as virtual.\n"); diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c index efec2048e..b196dd1e3 100644 --- a/drivers/net/bnxt/bnxt_ring.c +++ b/drivers/net/bnxt/bnxt_ring.c @@ -172,7 +172,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx, return -ENOMEM; } memset(mz->addr, 0, mz->len); - mz_phys_addr = mz->phys_addr; + mz_phys_addr = mz->iova; if ((unsigned long)mz->addr == mz_phys_addr) { RTE_LOG(WARNING, PMD, "Memzone physical address same as virtual.\n"); @@ -231,7 +231,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx, rx_ring->bd = ((char *)mz->addr + ag_ring_start); rx_ring_info->ag_desc_ring = (struct rx_prod_pkt_bd *)rx_ring->bd; - rx_ring->bd_dma = mz->phys_addr + ag_ring_start; + rx_ring->bd_dma = mz->iova + ag_ring_start; rx_ring_info->ag_desc_mapping = rx_ring->bd_dma; rx_ring->mem_zone = (const void *)mz; diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c index cbcf9920a..937ad6570 100644 --- a/drivers/net/bnxt/bnxt_vnic.c +++ b/drivers/net/bnxt/bnxt_vnic.c @@ -192,7 +192,7 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp) if (!mz) return -ENOMEM; } - mz_phys_addr = mz->phys_addr; + mz_phys_addr = mz->iova; if ((unsigned long)mz->addr == mz_phys_addr) { RTE_LOG(WARNING, PMD, "Memzone physical address same as virtual.\n"); diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c index 33f7f0bc2..9f915158a 100644 --- a/drivers/net/cxgbe/sge.c +++ b/drivers/net/cxgbe/sge.c @@ -1318,7 +1318,7 @@ static void *alloc_ring(size_t nelem, size_t elem_size, if (metadata) *(void **)metadata = s; - *phys = (uint64_t)tz->phys_addr; + *phys = (uint64_t)tz->iova; return tz->addr; } diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c index d4d5fe6e1..32ca9202a 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -1289,7 +1289,7 @@ eth_em_tx_queue_setup(struct rte_eth_dev *dev, txq->port_id = dev->data->port_id; txq->tdt_reg_addr = E1000_PCI_REG_ADDR(hw, E1000_TDT(queue_idx)); - txq->tx_ring_phys_addr = tz->phys_addr; + txq->tx_ring_phys_addr = tz->iova; txq->tx_ring = (struct e1000_data_desc *) tz->addr; PMD_INIT_LOG(DEBUG, "sw_ring=%p hw_ring=%p dma_addr=0x%"PRIx64, @@ -1416,7 +1416,7 @@ eth_em_rx_queue_setup(struct rte_eth_dev *dev, rxq->rdt_reg_addr = E1000_PCI_REG_ADDR(hw, E1000_RDT(queue_idx)); rxq->rdh_reg_addr = E1000_PCI_REG_ADDR(hw, E1000_RDH(queue_idx)); - rxq->rx_ring_phys_addr = rz->phys_addr; + rxq->rx_ring_phys_addr = rz->iova; rxq->rx_ring = (struct e1000_rx_desc *) rz->addr; PMD_INIT_LOG(DEBUG, "sw_ring=%p hw_ring=%p dma_addr=0x%"PRIx64, diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index 8eee44e46..4590179e6 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -1553,7 +1553,7 @@ eth_igb_tx_queue_setup(struct rte_eth_dev *dev, txq->port_id = dev->data->port_id; txq->tdt_reg_addr = E1000_PCI_REG_ADDR(hw, E1000_TDT(txq->reg_idx)); - txq->tx_ring_phys_addr = tz->phys_addr; + txq->tx_ring_phys_addr = tz->iova; txq->tx_ring = (union e1000_adv_tx_desc *) tz->addr; /* Allocate software ring */ @@ -1690,7 +1690,7 @@ eth_igb_rx_queue_setup(struct rte_eth_dev *dev, } rxq->rdt_reg_addr = E1000_PCI_REG_ADDR(hw, E1000_RDT(rxq->reg_idx)); rxq->rdh_reg_addr = E1000_PCI_REG_ADDR(hw, E1000_RDH(rxq->reg_idx)); - rxq->rx_ring_phys_addr = rz->phys_addr; + rxq->rx_ring_phys_addr = rz->iova; rxq->rx_ring = (union e1000_adv_rx_desc *) rz->addr; /* Allocate software ring. */ diff --git a/drivers/net/ena/base/ena_plat_dpdk.h b/drivers/net/ena/base/ena_plat_dpdk.h index 71a8c1e22..accecf518 100644 --- a/drivers/net/ena/base/ena_plat_dpdk.h +++ b/drivers/net/ena/base/ena_plat_dpdk.h @@ -191,7 +191,7 @@ typedef uint64_t dma_addr_t; mz = rte_memzone_reserve(z_name, size, SOCKET_ID_ANY, 0); \ memset(mz->addr, 0, size); \ virt = mz->addr; \ - phys = mz->phys_addr; \ + phys = mz->iova; \ handle = mz; \ } while (0) #define ENA_MEM_FREE_COHERENT(dmadev, size, virt, phys, handle) \ @@ -209,7 +209,7 @@ typedef uint64_t dma_addr_t; mz = rte_memzone_reserve(z_name, size, node, 0); \ memset(mz->addr, 0, size); \ virt = mz->addr; \ - phys = mz->phys_addr; \ + phys = mz->iova; \ } while (0) #define ENA_MEM_ALLOC_NODE(dmadev, size, virt, node, dev_node) \ diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index f2e06e8d8..3a2a8d182 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -283,7 +283,7 @@ void enic_init_vnic_resources(struct enic *enic) 0 /* cq_entry_enable */, 1 /* cq_message_enable */, 0 /* interrupt offset */, - (u64)enic->wq[index].cqmsg_rz->phys_addr); + (u64)enic->wq[index].cqmsg_rz->iova); } vnic_intr_init(&enic->intr, @@ -362,7 +362,7 @@ enic_alloc_consistent(void *priv, size_t size, } vaddr = rz->addr; - *dma_handle = (dma_addr_t)rz->phys_addr; + *dma_handle = (dma_addr_t)rz->iova; mze = rte_malloc("enic memzone entry", sizeof(struct enic_memzone_entry), 0); @@ -395,7 +395,7 @@ enic_free_consistent(void *priv, rte_spinlock_lock(&enic->memzone_list_lock); LIST_FOREACH(mze, &enic->memzone_list, entries) { if (mze->rz->addr == vaddr && - mze->rz->phys_addr == dma_handle) + mze->rz->iova == dma_handle) break; } if (mze == NULL) { diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 7e52a2c9e..2d05a4669 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -1893,7 +1893,7 @@ fm10k_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id, return -ENOMEM; } q->hw_ring = mz->addr; - q->hw_ring_phys_addr = mz->phys_addr; + q->hw_ring_phys_addr = mz->iova; /* Check if number of descs satisfied Vector requirement */ if (!rte_is_power_of_2(nb_desc)) { @@ -2053,7 +2053,7 @@ fm10k_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id, return -ENOMEM; } q->hw_ring = mz->addr; - q->hw_ring_phys_addr = mz->phys_addr; + q->hw_ring_phys_addr = mz->iova; /* * allocate memory for the RS bit tracker. Enough slots to hold the diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index bcd9ef1a6..c2c477e31 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -3842,7 +3842,7 @@ i40e_allocate_dma_mem_d(__attribute__((unused)) struct i40e_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, diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index a95a2c9ed..3d7170d53 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -265,7 +265,7 @@ i40e_fdir_setup(struct i40e_pf *pf) goto fail_mem; } pf->fdir.prg_pkt = mz->addr; - pf->fdir.dma_addr = mz->phys_addr; + pf->fdir.dma_addr = mz->iova; pf->fdir.match_counter_index = I40E_COUNTER_INDEX_FDIR(hw->pf_id); PMD_DRV_LOG(INFO, "FDIR setup successfully, with programming queue %u.", diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 904d37f08..943e1c1c2 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -1823,7 +1823,7 @@ i40e_dev_rx_queue_setup(struct rte_eth_dev *dev, /* Zero all the descriptors in the ring. */ memset(rz->addr, 0, ring_size); - rxq->rx_ring_phys_addr = rz->phys_addr; + rxq->rx_ring_phys_addr = rz->iova; rxq->rx_ring = (union i40e_rx_desc *)rz->addr; len = (uint16_t)(nb_desc + RTE_PMD_I40E_RX_MAX_BURST); @@ -2161,7 +2161,7 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev *dev, txq->vsi = vsi; txq->tx_deferred_start = tx_conf->tx_deferred_start; - txq->tx_ring_phys_addr = tz->phys_addr; + txq->tx_ring_phys_addr = tz->iova; txq->tx_ring = (struct i40e_tx_desc *)tz->addr; /* Allocate software ring */ @@ -2695,7 +2695,7 @@ i40e_fdir_setup_tx_resources(struct i40e_pf *pf) txq->reg_idx = pf->fdir.fdir_vsi->base_queue; txq->vsi = pf->fdir.fdir_vsi; - txq->tx_ring_phys_addr = tz->phys_addr; + txq->tx_ring_phys_addr = tz->iova; txq->tx_ring = (struct i40e_tx_desc *)tz->addr; /* * don't need to allocate software ring and reset for the fdir @@ -2751,7 +2751,7 @@ i40e_fdir_setup_rx_resources(struct i40e_pf *pf) rxq->reg_idx = pf->fdir.fdir_vsi->base_queue; rxq->vsi = pf->fdir.fdir_vsi; - rxq->rx_ring_phys_addr = rz->phys_addr; + rxq->rx_ring_phys_addr = rz->iova; rxq->rx_ring = (union i40e_rx_desc *)rz->addr; /* diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 37bb57bf9..daaf02dab 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -2599,7 +2599,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, else txq->tdt_reg_addr = IXGBE_PCI_REG_ADDR(hw, IXGBE_TDT(txq->reg_idx)); - txq->tx_ring_phys_addr = tz->phys_addr; + txq->tx_ring_phys_addr = tz->iova; txq->tx_ring = (union ixgbe_adv_tx_desc *) tz->addr; /* Allocate software ring */ @@ -2901,7 +2901,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev, IXGBE_PCI_REG_ADDR(hw, IXGBE_RDH(rxq->reg_idx)); } - rxq->rx_ring_phys_addr = rz->phys_addr; + rxq->rx_ring_phys_addr = rz->iova; rxq->rx_ring = (union ixgbe_adv_rx_desc *) rz->addr; /* diff --git a/drivers/net/liquidio/lio_rxtx.c b/drivers/net/liquidio/lio_rxtx.c index 773dfd30a..71099e146 100644 --- a/drivers/net/liquidio/lio_rxtx.c +++ b/drivers/net/liquidio/lio_rxtx.c @@ -172,7 +172,7 @@ lio_alloc_info_buffer(struct lio_device *lio_dev, if (droq->info_mz == NULL) return NULL; - droq->info_list_dma = droq->info_mz->phys_addr; + droq->info_list_dma = droq->info_mz->iova; droq->info_alloc_size = droq->info_mz->len; droq->info_base_addr = (size_t)droq->info_mz->addr; @@ -222,7 +222,7 @@ lio_init_droq(struct lio_device *lio_dev, uint32_t q_no, return -1; } - droq->desc_ring_dma = droq->desc_ring_mz->phys_addr; + droq->desc_ring_dma = droq->desc_ring_mz->iova; droq->desc_ring = (struct lio_droq_desc *)droq->desc_ring_mz->addr; lio_dev_dbg(lio_dev, "droq[%d]: desc_ring: virt: 0x%p, dma: %lx\n", @@ -734,7 +734,7 @@ lio_init_instr_queue(struct lio_device *lio_dev, return -1; } - iq->base_addr_dma = iq->iq_mz->phys_addr; + iq->base_addr_dma = iq->iq_mz->iova; iq->base_addr = (uint8_t *)iq->iq_mz->addr; iq->max_count = num_descs; diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index 8c1c1f0b2..7f1a026ac 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -1562,7 +1562,7 @@ nfp_net_rx_queue_setup(struct rte_eth_dev *dev, } /* Saving physical and virtual addresses for the RX ring */ - rxq->dma = (uint64_t)tz->phys_addr; + rxq->dma = (uint64_t)tz->iova; rxq->rxds = (struct nfp_net_rx_desc *)tz->addr; /* mbuf pointers array for referencing mbufs linked to RX descriptors */ @@ -1718,7 +1718,7 @@ nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, txq->txq_flags = tx_conf->txq_flags; /* Saving physical and virtual addresses for the TX ring */ - txq->dma = (uint64_t)tz->phys_addr; + txq->dma = (uint64_t)tz->iova; txq->txds = (struct nfp_net_tx_desc *)tz->addr; /* mbuf pointers array for referencing mbufs linked to TX descriptors */ diff --git a/drivers/net/qede/base/bcm_osal.c b/drivers/net/qede/base/bcm_osal.c index e3a2cb452..fe42f3256 100644 --- a/drivers/net/qede/base/bcm_osal.c +++ b/drivers/net/qede/base/bcm_osal.c @@ -144,12 +144,12 @@ void *osal_dma_alloc_coherent(struct ecore_dev *p_dev, *phys = 0; return OSAL_NULL; } - *phys = mz->phys_addr; + *phys = mz->iova; ecore_mz_mapping[ecore_mz_count++] = mz; DP_VERBOSE(p_dev, ECORE_MSG_SP, "Allocated dma memory size=%zu phys=0x%lx" " virt=%p core=%d\n", - mz->len, (unsigned long)mz->phys_addr, mz->addr, core_id); + mz->len, (unsigned long)mz->iova, mz->addr, core_id); return mz->addr; } @@ -182,12 +182,12 @@ void *osal_dma_alloc_coherent_aligned(struct ecore_dev *p_dev, *phys = 0; return OSAL_NULL; } - *phys = mz->phys_addr; + *phys = mz->iova; ecore_mz_mapping[ecore_mz_count++] = mz; DP_VERBOSE(p_dev, ECORE_MSG_SP, "Allocated aligned dma memory size=%zu phys=0x%lx" " virt=%p core=%d\n", - mz->len, (unsigned long)mz->phys_addr, mz->addr, core_id); + mz->len, (unsigned long)mz->iova, mz->addr, core_id); return mz->addr; } @@ -196,7 +196,7 @@ void osal_dma_free_mem(struct ecore_dev *p_dev, dma_addr_t phys) uint16_t j; for (j = 0 ; j < ecore_mz_count; j++) { - if (phys == ecore_mz_mapping[j]->phys_addr) { + if (phys == ecore_mz_mapping[j]->iova) { DP_VERBOSE(p_dev, ECORE_MSG_SP, "Free memzone %s\n", ecore_mz_mapping[j]->name); rte_memzone_free(ecore_mz_mapping[j]); diff --git a/drivers/net/qede/qede_fdir.c b/drivers/net/qede/qede_fdir.c index f8d60f5c5..da6364ee5 100644 --- a/drivers/net/qede/qede_fdir.c +++ b/drivers/net/qede/qede_fdir.c @@ -172,7 +172,7 @@ qede_config_cmn_fdir_filter(struct rte_eth_dev *eth_dev, } /* configure filter with ECORE_SPQ_MODE_EBLOCK */ rc = ecore_configure_rfs_ntuple_filter(p_hwfn, NULL, - (dma_addr_t)mz->phys_addr, + (dma_addr_t)mz->iova, pkt_len, fdir_filter->action.rx_queue, 0, add); diff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c index 390823a8c..1c1274067 100644 --- a/drivers/net/sfc/sfc.c +++ b/drivers/net/sfc/sfc.c @@ -61,7 +61,7 @@ sfc_dma_alloc(const struct sfc_adapter *sa, const char *name, uint16_t id, return ENOMEM; } - esmp->esm_addr = mz->phys_addr; + esmp->esm_addr = mz->iova; if (esmp->esm_addr == RTE_BAD_PHYS_ADDR) { (void)rte_memzone_free(mz); return EFAULT; diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 24ac3f98d..ea561395b 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -605,7 +605,7 @@ nicvf_qset_cq_alloc(struct rte_eth_dev *dev, struct nicvf *nic, memset(rz->addr, 0, ring_size); - rxq->phys = rz->phys_addr; + rxq->phys = rz->iova; rxq->desc = rz->addr; rxq->qlen_mask = desc_cnt - 1; @@ -629,7 +629,7 @@ nicvf_qset_sq_alloc(struct rte_eth_dev *dev, struct nicvf *nic, memset(rz->addr, 0, ring_size); - sq->phys = rz->phys_addr; + sq->phys = rz->iova; sq->desc = rz->addr; sq->qlen_mask = desc_cnt - 1; @@ -663,7 +663,7 @@ nicvf_qset_rbdr_alloc(struct rte_eth_dev *dev, struct nicvf *nic, memset(rz->addr, 0, ring_size); - rbdr->phys = rz->phys_addr; + rbdr->phys = rz->iova; rbdr->tail = 0; rbdr->next_tail = 0; rbdr->desc = rz->addr; diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index a8ae788d8..c6756ed3f 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -428,10 +428,10 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx) memset(mz->addr, 0, mz->len); - vq->vq_ring_mem = mz->phys_addr; + vq->vq_ring_mem = mz->iova; vq->vq_ring_virt_mem = mz->addr; PMD_INIT_LOG(DEBUG, "vq->vq_ring_mem: 0x%" PRIx64, - (uint64_t)mz->phys_addr); + (uint64_t)mz->iova); PMD_INIT_LOG(DEBUG, "vq->vq_ring_virt_mem: 0x%" PRIx64, (uint64_t)(uintptr_t)mz->addr); @@ -476,13 +476,13 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx) txvq->port_id = dev->data->port_id; txvq->mz = mz; txvq->virtio_net_hdr_mz = hdr_mz; - txvq->virtio_net_hdr_mem = hdr_mz->phys_addr; + txvq->virtio_net_hdr_mem = hdr_mz->iova; } else if (queue_type == VTNET_CQ) { cvq = &vq->cq; cvq->vq = vq; cvq->mz = mz; cvq->virtio_net_hdr_mz = hdr_mz; - cvq->virtio_net_hdr_mem = hdr_mz->phys_addr; + cvq->virtio_net_hdr_mem = hdr_mz->iova; memset(cvq->virtio_net_hdr_mz->addr, 0, PAGE_SIZE); hw->cvq = cvq; diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 9037d80c4..0fce5d953 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -484,7 +484,7 @@ vmxnet3_dev_configure(struct rte_eth_dev *dev) memset(mz->addr, 0, mz->len); hw->shared = mz->addr; - hw->sharedPA = mz->phys_addr; + hw->sharedPA = mz->iova; /* * Allocate a memzone for Vmxnet3_RxQueueDesc - Vmxnet3_TxQueueDesc @@ -505,7 +505,7 @@ vmxnet3_dev_configure(struct rte_eth_dev *dev) hw->tqd_start = (Vmxnet3_TxQueueDesc *)mz->addr; hw->rqd_start = (Vmxnet3_RxQueueDesc *)(hw->tqd_start + hw->num_tx_queues); - hw->queueDescPA = mz->phys_addr; + hw->queueDescPA = mz->iova; hw->queue_desc_len = (uint16_t)size; if (dev->data->dev_conf.rxmode.mq_mode == ETH_MQ_RX_RSS) { @@ -521,7 +521,7 @@ vmxnet3_dev_configure(struct rte_eth_dev *dev) memset(mz->addr, 0, mz->len); hw->rss_conf = mz->addr; - hw->rss_confPA = mz->phys_addr; + hw->rss_confPA = mz->iova; } return 0; @@ -569,7 +569,7 @@ vmxnet3_dev_setup_memreg(struct rte_eth_dev *dev) } memset(mz->addr, 0, mz->len); hw->memRegs = mz->addr; - hw->memRegsPA = mz->phys_addr; + hw->memRegsPA = mz->iova; } num = hw->num_rx_queues; diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index 01c85f138..aac23d845 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -979,7 +979,7 @@ vmxnet3_dev_tx_queue_setup(struct rte_eth_dev *dev, /* cmd_ring initialization */ ring->base = mz->addr; - ring->basePA = mz->phys_addr; + ring->basePA = mz->iova; /* comp_ring initialization */ comp_ring->base = ring->base + ring->size; @@ -1090,7 +1090,7 @@ vmxnet3_dev_rx_queue_setup(struct rte_eth_dev *dev, /* cmd_ring0 initialization */ ring0->base = mz->addr; - ring0->basePA = mz->phys_addr; + ring0->basePA = mz->iova; /* cmd_ring1 initialization */ ring1->base = ring0->base + ring0->size; diff --git a/lib/librte_eal/common/eal_common_memzone.c b/lib/librte_eal/common/eal_common_memzone.c index ab681101b..ea072a25b 100644 --- a/lib/librte_eal/common/eal_common_memzone.c +++ b/lib/librte_eal/common/eal_common_memzone.c @@ -251,7 +251,7 @@ memzone_reserve_aligned_thread_unsafe(const char *name, size_t len, mcfg->memzone_cnt++; snprintf(mz->name, sizeof(mz->name), "%s", name); - mz->phys_addr = rte_malloc_virt2iova(mz_addr); + mz->iova = rte_malloc_virt2iova(mz_addr); mz->addr = mz_addr; mz->len = (requested_len == 0 ? elem->size : requested_len); mz->hugepage_sz = elem->ms->hugepage_sz; @@ -391,10 +391,10 @@ rte_memzone_dump(FILE *f) for (i=0; imemzone[i].addr == NULL) break; - fprintf(f, "Zone %u: name:<%s>, phys:0x%"PRIx64", len:0x%zx" + fprintf(f, "Zone %u: name:<%s>, IO:0x%"PRIx64", len:0x%zx" ", virt:%p, socket_id:%"PRId32", flags:%"PRIx32"\n", i, mcfg->memzone[i].name, - mcfg->memzone[i].phys_addr, + mcfg->memzone[i].iova, mcfg->memzone[i].len, mcfg->memzone[i].addr, mcfg->memzone[i].socket_id, diff --git a/lib/librte_eal/common/include/rte_memzone.h b/lib/librte_eal/common/include/rte_memzone.h index 1d0827f46..6f0ba1829 100644 --- a/lib/librte_eal/common/include/rte_memzone.h +++ b/lib/librte_eal/common/include/rte_memzone.h @@ -78,7 +78,11 @@ struct rte_memzone { #define RTE_MEMZONE_NAMESIZE 32 /**< Maximum length of memory zone name.*/ char name[RTE_MEMZONE_NAMESIZE]; /**< Name of the memory zone. */ - phys_addr_t phys_addr; /**< Start physical address. */ + RTE_STD_C11 + union { + phys_addr_t phys_addr; /**< deprecated - Start physical address. */ + rte_iova_t iova; /**< Start IO address. */ + }; RTE_STD_C11 union { void *addr; /**< Start virtual address. */ diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index f62054e23..aad3294ed 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -601,7 +601,7 @@ rte_mempool_populate_default(struct rte_mempool *mp) if (mp->flags & MEMPOOL_F_NO_PHYS_CONTIG) paddr = RTE_BAD_PHYS_ADDR; else - paddr = mz->phys_addr; + paddr = mz->iova; if (rte_eal_has_hugepages()) ret = rte_mempool_populate_phys(mp, mz->addr, @@ -1213,7 +1213,7 @@ rte_mempool_dump(FILE *f, struct rte_mempool *mp) fprintf(f, "mempool <%s>@%p\n", mp->name, mp); fprintf(f, " flags=%x\n", mp->flags); fprintf(f, " pool=%p\n", mp->pool_data); - fprintf(f, " phys_addr=0x%" PRIx64 "\n", mp->mz->phys_addr); + fprintf(f, " iova=0x%" PRIx64 "\n", mp->mz->iova); fprintf(f, " nb_mem_chunks=%u\n", mp->nb_mem_chunks); fprintf(f, " size=%"PRIu32"\n", mp->size); fprintf(f, " populated_size=%"PRIu32"\n", mp->populated_size); diff --git a/test/test/test_memzone.c b/test/test/test_memzone.c index 7ae31cf74..c9394c4a2 100644 --- a/test/test/test_memzone.c +++ b/test/test/test_memzone.c @@ -78,7 +78,7 @@ /* Test if memory overlaps: return 1 if true, or 0 if false. */ static int -is_memory_overlap(phys_addr_t ptr1, size_t len1, phys_addr_t ptr2, size_t len2) +is_memory_overlap(rte_iova_t ptr1, size_t len1, rte_iova_t ptr2, size_t len2) { if (ptr2 >= ptr1 && (ptr2 - ptr1) < len1) return 1; @@ -510,7 +510,7 @@ test_memzone_aligned(void) printf("Unable to reserve 64-byte aligned memzone!\n"); return -1; } - if ((memzone_aligned_32->phys_addr & RTE_CACHE_LINE_MASK) != 0) + if ((memzone_aligned_32->iova & RTE_CACHE_LINE_MASK) != 0) return -1; if (((uintptr_t) memzone_aligned_32->addr & RTE_CACHE_LINE_MASK) != 0) return -1; @@ -521,7 +521,7 @@ test_memzone_aligned(void) printf("Unable to reserve 128-byte aligned memzone!\n"); return -1; } - if ((memzone_aligned_128->phys_addr & 127) != 0) + if ((memzone_aligned_128->iova & 127) != 0) return -1; if (((uintptr_t) memzone_aligned_128->addr & 127) != 0) return -1; @@ -532,7 +532,7 @@ test_memzone_aligned(void) printf("Unable to reserve 256-byte aligned memzone!\n"); return -1; } - if ((memzone_aligned_256->phys_addr & 255) != 0) + if ((memzone_aligned_256->iova & 255) != 0) return -1; if (((uintptr_t) memzone_aligned_256->addr & 255) != 0) return -1; @@ -543,7 +543,7 @@ test_memzone_aligned(void) printf("Unable to reserve 512-byte aligned memzone!\n"); return -1; } - if ((memzone_aligned_512->phys_addr & 511) != 0) + if ((memzone_aligned_512->iova & 511) != 0) return -1; if (((uintptr_t) memzone_aligned_512->addr & 511) != 0) return -1; @@ -554,7 +554,7 @@ test_memzone_aligned(void) printf("Unable to reserve 1024-byte aligned memzone!\n"); return -1; } - if ((memzone_aligned_1024->phys_addr & 1023) != 0) + if ((memzone_aligned_1024->iova & 1023) != 0) return -1; if (((uintptr_t) memzone_aligned_1024->addr & 1023) != 0) return -1; @@ -563,35 +563,35 @@ test_memzone_aligned(void) /* check that zones don't overlap */ printf("check overlapping\n"); - if (is_memory_overlap(memzone_aligned_32->phys_addr, memzone_aligned_32->len, - memzone_aligned_128->phys_addr, memzone_aligned_128->len)) + if (is_memory_overlap(memzone_aligned_32->iova, memzone_aligned_32->len, + memzone_aligned_128->iova, memzone_aligned_128->len)) return -1; - if (is_memory_overlap(memzone_aligned_32->phys_addr, memzone_aligned_32->len, - memzone_aligned_256->phys_addr, memzone_aligned_256->len)) + if (is_memory_overlap(memzone_aligned_32->iova, memzone_aligned_32->len, + memzone_aligned_256->iova, memzone_aligned_256->len)) return -1; - if (is_memory_overlap(memzone_aligned_32->phys_addr, memzone_aligned_32->len, - memzone_aligned_512->phys_addr, memzone_aligned_512->len)) + if (is_memory_overlap(memzone_aligned_32->iova, memzone_aligned_32->len, + memzone_aligned_512->iova, memzone_aligned_512->len)) return -1; - if (is_memory_overlap(memzone_aligned_32->phys_addr, memzone_aligned_32->len, - memzone_aligned_1024->phys_addr, memzone_aligned_1024->len)) + if (is_memory_overlap(memzone_aligned_32->iova, memzone_aligned_32->len, + memzone_aligned_1024->iova, memzone_aligned_1024->len)) return -1; - if (is_memory_overlap(memzone_aligned_128->phys_addr, memzone_aligned_128->len, - memzone_aligned_256->phys_addr, memzone_aligned_256->len)) + if (is_memory_overlap(memzone_aligned_128->iova, memzone_aligned_128->len, + memzone_aligned_256->iova, memzone_aligned_256->len)) return -1; - if (is_memory_overlap(memzone_aligned_128->phys_addr, memzone_aligned_128->len, - memzone_aligned_512->phys_addr, memzone_aligned_512->len)) + if (is_memory_overlap(memzone_aligned_128->iova, memzone_aligned_128->len, + memzone_aligned_512->iova, memzone_aligned_512->len)) return -1; - if (is_memory_overlap(memzone_aligned_128->phys_addr, memzone_aligned_128->len, - memzone_aligned_1024->phys_addr, memzone_aligned_1024->len)) + if (is_memory_overlap(memzone_aligned_128->iova, memzone_aligned_128->len, + memzone_aligned_1024->iova, memzone_aligned_1024->len)) return -1; - if (is_memory_overlap(memzone_aligned_256->phys_addr, memzone_aligned_256->len, - memzone_aligned_512->phys_addr, memzone_aligned_512->len)) + if (is_memory_overlap(memzone_aligned_256->iova, memzone_aligned_256->len, + memzone_aligned_512->iova, memzone_aligned_512->len)) return -1; - if (is_memory_overlap(memzone_aligned_256->phys_addr, memzone_aligned_256->len, - memzone_aligned_1024->phys_addr, memzone_aligned_1024->len)) + if (is_memory_overlap(memzone_aligned_256->iova, memzone_aligned_256->len, + memzone_aligned_1024->iova, memzone_aligned_1024->len)) return -1; - if (is_memory_overlap(memzone_aligned_512->phys_addr, memzone_aligned_512->len, - memzone_aligned_1024->phys_addr, memzone_aligned_1024->len)) + if (is_memory_overlap(memzone_aligned_512->iova, memzone_aligned_512->len, + memzone_aligned_1024->iova, memzone_aligned_1024->len)) return -1; return 0; } @@ -601,9 +601,9 @@ check_memzone_bounded(const char *name, uint32_t len, uint32_t align, uint32_t bound) { const struct rte_memzone *mz; - phys_addr_t bmask; + rte_iova_t bmask; - bmask = ~((phys_addr_t)bound - 1); + bmask = ~((rte_iova_t)bound - 1); if ((mz = rte_memzone_reserve_bounded(name, len, SOCKET_ID_ANY, 0, align, bound)) == NULL) { @@ -612,7 +612,7 @@ check_memzone_bounded(const char *name, uint32_t len, uint32_t align, return -1; } - if ((mz->phys_addr & ((phys_addr_t)align - 1)) != 0) { + if ((mz->iova & ((rte_iova_t)align - 1)) != 0) { printf("%s(%s): invalid phys addr alignment\n", __func__, mz->name); return -1; @@ -631,8 +631,8 @@ check_memzone_bounded(const char *name, uint32_t len, uint32_t align, return -1; } - if ((mz->phys_addr & bmask) != - ((mz->phys_addr + mz->len - 1) & bmask)) { + if ((mz->iova & bmask) != + ((mz->iova + mz->len - 1) & bmask)) { printf("%s(%s): invalid memzone boundary %u crossed\n", __func__, mz->name, bound); return -1; @@ -787,11 +787,11 @@ test_memzone(void) /* check cache-line alignments */ printf("check alignments and lengths\n"); - if ((memzone1->phys_addr & RTE_CACHE_LINE_MASK) != 0) + if ((memzone1->iova & RTE_CACHE_LINE_MASK) != 0) return -1; - if ((memzone2->phys_addr & RTE_CACHE_LINE_MASK) != 0) + if ((memzone2->iova & RTE_CACHE_LINE_MASK) != 0) return -1; - if (memzone3 != NULL && (memzone3->phys_addr & RTE_CACHE_LINE_MASK) != 0) + if (memzone3 != NULL && (memzone3->iova & RTE_CACHE_LINE_MASK) != 0) return -1; if ((memzone1->len & RTE_CACHE_LINE_MASK) != 0 || memzone1->len == 0) return -1; @@ -806,16 +806,16 @@ test_memzone(void) /* check that zones don't overlap */ printf("check overlapping\n"); - if (is_memory_overlap(memzone1->phys_addr, memzone1->len, - memzone2->phys_addr, memzone2->len)) + if (is_memory_overlap(memzone1->iova, memzone1->len, + memzone2->iova, memzone2->len)) return -1; if (memzone3 != NULL && - is_memory_overlap(memzone1->phys_addr, memzone1->len, - memzone3->phys_addr, memzone3->len)) + is_memory_overlap(memzone1->iova, memzone1->len, + memzone3->iova, memzone3->len)) return -1; if (memzone3 != NULL && - is_memory_overlap(memzone2->phys_addr, memzone2->len, - memzone3->phys_addr, memzone3->len)) + is_memory_overlap(memzone2->iova, memzone2->len, + memzone3->iova, memzone3->len)) return -1; printf("check socket ID\n"); -- 2.14.2