From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5FCADA052A; Wed, 27 Jan 2021 16:34:18 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4080B140E88; Wed, 27 Jan 2021 16:34:18 +0100 (CET) Received: from out0-135.mail.aliyun.com (out0-135.mail.aliyun.com [140.205.0.135]) by mails.dpdk.org (Postfix) with ESMTP id E0FBD140E84 for ; Wed, 27 Jan 2021 16:34:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alibaba-inc.com; s=default; t=1611761652; h=Subject:To:From:Message-ID:Date:MIME-Version:Content-Type; bh=8ake5l87B/YZ8+6Tt140KVuJcji+ftrzU6U04E1mAZU=; b=IemRWlVT57eEGopnsNQ85cc87UeUjVXco1uqlcSEw7ywZgVGKJ3t0G1IRoRDiMwEirS8FEkRzEi/DycX2XgJSEQtHN94T60AUCGyymI329m1uJC/fit/KW0qSaOPRW7uyoVrMxq2BeuGFIZ8QSnv/aMaNptmafxS1rKFutH1WtY= X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R161e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=ay29a033018047203; MF=huawei.xhw@alibaba-inc.com; NM=1; PH=DS; RN=8; SR=0; TI=SMTPD_---.JR9PKmQ_1611761651; Received: from 30.43.72.77(mailfrom:huawei.xhw@alibaba-inc.com fp:SMTPD_---.JR9PKmQ_1611761651) by smtp.aliyun-inc.com(127.0.0.1); Wed, 27 Jan 2021 23:34:12 +0800 To: Ferruh Yigit Cc: dev@dpdk.org, maxime.coquelin@redhat.com, anatoly.burakov@intel.com, david.marchand@redhat.com, zhihong.wang@intel.com, chenbo.xia@intel.com, grive@u256.net References: <68ecd941-9c56-4de7-fae2-2ad15bdfd81a@alibaba-inc.com> <1603381885-88819-1-git-send-email-huawei.xhw@alibaba-inc.com> <1603381885-88819-3-git-send-email-huawei.xhw@alibaba-inc.com> <820d8f58-0a88-e9bc-e86e-6876f7f5f50f@intel.com> From: "=?UTF-8?B?6LCi5Y2O5LyfKOatpOaXtuatpOWIu++8iQ==?=" Message-ID: <1626e90c-137c-2adf-5652-d766342b077c@alibaba-inc.com> Date: Wed, 27 Jan 2021 23:34:07 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <820d8f58-0a88-e9bc-e86e-6876f7f5f50f@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH v5 2/3] PCI: support MMIO in rte_pci_ioport_map/unap/read/write X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 2021/1/27 18:40, Ferruh Yigit wrote: > On 10/22/2020 4:51 PM, 谢华伟(此时此刻) wrote: >> From: "huawei.xhw" >> >> If IO BAR, we get PIO address. >> If MMIO BAR, we get mapped virtual address. >> We distinguish PIO and MMIO by their address like how kernel does. >> ioread/write8/16/32 is provided to access PIO/MMIO. >> BTW, for virtio on arch other than x86, BAR flag indicates PIO but is >> mapped. >> >> Signed-off-by: huawei.xhw > > <...> > >> @@ -408,15 +403,30 @@ >>           &end_addr, &flags) < 0) >>           goto error; >>   -    if (!(flags & IORESOURCE_IO)) { >> -        RTE_LOG(ERR, EAL, "%s(): bar resource other than IO is not >> supported\n", __func__); >> +    if (flags & IORESOURCE_IO) { >> +        iobar = 1; >> +        base = (unsigned long)phys_addr; >> +        RTE_LOG(INFO, EAL, "%s(): PIO BAR %08lx detected\n", >> __func__, base); >> +    } else if (flags & IORESOURCE_MEM) { >> +        iobar = 0; >> +        base = (unsigned long)dev->mem_resource[bar].addr; > > Hi Huawei, > > At this stage, to have a valid 'addr' it should be already mmap'ed, > can you please provide the call stack when it is set/mmaped, to > confirm it will be always valid at this point? > > Thanks, > ferruh #0  pci_uio_map_resource_by_index (dev=0x420c700, res_idx=0, uio_res=0x1003b19c0, map_idx=0) at ../drivers/bus/pci/linux/pci_uio.c:286 #1  0x000000000095f047 in pci_uio_map_resource (dev=0x420c700) at ../drivers/bus/pci/pci_common_uio.c:112 #2  0x000000000095f645 in rte_pci_map_device (dev=0x420c700) at ../drivers/bus/pci/linux/pci.c:81 #3  0x000000000174b5b9 in virtio_read_caps (dev=0x420c700, hw=0x1003b2d80) at ../drivers/net/virtio/virtio_pci.c:574 #4  0x000000000174baf9 in vtpci_init (dev=0x420c700, hw=0x1003b2d80) at ../drivers/net/virtio/virtio_pci.c:697 #5  0x0000000001743c84 in eth_virtio_dev_init (eth_dev=0x3461e40 ) at ../drivers/net/virtio/virtio_ethdev.c:1954