From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id AB35DA052A;
	Tue, 26 Jan 2021 13:31:02 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 23914141481;
	Tue, 26 Jan 2021 13:31:02 +0100 (CET)
Received: from out0-155.mail.aliyun.com (out0-155.mail.aliyun.com
 [140.205.0.155])
 by mails.dpdk.org (Postfix) with ESMTP id 8637A14141D
 for <dev@dpdk.org>; Tue, 26 Jan 2021 13:31:00 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=alibaba-inc.com; s=default;
 t=1611664258; h=Subject:From:To:Message-ID:Date:MIME-Version:Content-Type;
 bh=QC62UIMz+cQdvnzH8eAUYqZrcR/z1jcAs9pXJ0h7dRs=;
 b=GScd5DDoecAYpo/zP08tGtwK26p4YjsoDWPfQ+/fAeUzBBApNg0HHCrO+qmOYMzn4oph+np2xZpmX3mXP/R/6crgADU777STPXazdsxHow0Gl/a+63IRuFWG/MXoEx+gC7bcsFbEVrkALU3sbHqNYAF6bQqgGkv29opYQTazNaM=
X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R151e4; CH=green; DM=||false|;
 DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=ay29a033018047190;
 MF=huawei.xhw@alibaba-inc.com; NM=1; PH=DS; RN=9; SR=0;
 TI=SMTPD_---.JQZFxRN_1611664257; 
Received: from 30.43.72.133(mailfrom:huawei.xhw@alibaba-inc.com
 fp:SMTPD_---.JQZFxRN_1611664257) by smtp.aliyun-inc.com(127.0.0.1);
 Tue, 26 Jan 2021 20:30:57 +0800
From: "=?UTF-8?B?6LCi5Y2O5LyfKOatpOaXtuatpOWIu++8iQ==?="
 <huawei.xhw@alibaba-inc.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>, ferruh.yigit@intel.com
Cc: dev@dpdk.org, anatoly.burakov@intel.com, david.marchand@redhat.com,
 zhihong.wang@intel.com, chenbo.xia@intel.com, grive@u256.net,
 "Xueming(Steven) Li" <xuemingl@nvidia.com>
References: <68ecd941-9c56-4de7-fae2-2ad15bdfd81a@alibaba-inc.com>
 <1603381885-88819-1-git-send-email-huawei.xhw@alibaba-inc.com>
 <1603381885-88819-4-git-send-email-huawei.xhw@alibaba-inc.com>
 <fb903a81-a032-3300-29f9-218164fe8e56@redhat.com>
 <e5d7e73e-58c8-4820-85f4-ee9a8e90064f@redhat.com>
 <18871462-4d25-302a-2716-99ebec65c3ac@alibaba-inc.com>
 <e24f7bfd-e071-0b51-bbc9-21e0b61a69cf@redhat.com>
 <40e0702d-7847-9dc3-1904-03a7b8e92c2e@alibaba-inc.com>
 <3c83a06d-c757-e470-441b-a8b7f496a953@redhat.com>
 <9b614cce-8e41-9ed6-a648-fbbe3fc14807@alibaba-inc.com>
Message-ID: <2d3d225c-0645-7a8b-9f26-e8e9d91cea9a@alibaba-inc.com>
Date: Tue, 26 Jan 2021 20:30:52 +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: <9b614cce-8e41-9ed6-a648-fbbe3fc14807@alibaba-inc.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Content-Language: en-US
Subject: Re: [dpdk-dev] [PATCH v5 3/3] PCI: don't use vfio ioctl call to
 access PIO resource
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>


On 2021/1/22 15:25, chris wrote:
>
> On 2021/1/21 23:38, Maxime Coquelin wrote:
>>> Do you mean we apply or abandon patch 3? I am both OK. The first
>>> priority to me is to enable MMIO bar support.
>> OK, so yes, I think we should abandon patch 2 and patch 3.
>> For patch 1, it looks valid to me, but I'll let Ferruh decide.
>>
>> For your device, if my understanding is correct, what we need to do is
>> to support MMIO for legacy devices. Correct?
> yes.
>> If so, the change should be in virtio_pci.c. In vtpci_init(), after
>> modern detection has failed, we should check the the BAR is PIO or MMIO
>> based on the flag. the result can be saved in struct virtio_pci_dev.
>>
>>
>> We would introduce new wrappers like vtpci_legacy_read,
>> vtpci_legacy_write that would either call rte_pci_ioport_read,
>> rte_pci_ioport_read in case of PIO, or rte_read32, rte_write32 in case
>> of MMIO.
>
> There are two choices.
>
> 1, apply patch 2.
>
>     IO/MMIO port are mapped and accessed using the same API. Kernel is 
> doing in the same way like the following.
>
>             io_addr = pci_iomap
>
>                 get PIO directly or ioremap
>
>             iowrite16/32(val, io_addr + offset)
>
> I think applying patch 2 is a correct choice. It is a fix. Driver had 
> better not know if bar is PIO or MMIO.  ioport in ioport_xx API means 
> IO, not PIO.
>
> Btw, it only affects virtio PMD,  not that intrusive.
>
>  2, virtio specific change to enable MMIO support.
>
> Comparing with choice 1, i feels it is not that clean and pretty.
>
>>
>> It is not too late for this release, as the change will not be that
>> intrusive. But if you prepare such patch, please base it on top of my
>> virtio rework series; To make it easier to you, I added it to the dpdk-
>> next-virtio tree:
>> https://git.dpdk.org/next/dpdk-next-virtio/log/?h=virtio_pmd_rework_v2
>>
Hi Maxime:

Decision on patch 2?

I still think current patch 2 is cleaner.

Thanks,  huawei


>> Maxime
>>