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 CED9145623;
	Mon, 15 Jul 2024 08:00:43 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 60EC2402B0;
	Mon, 15 Jul 2024 08:00:43 +0200 (CEST)
Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189])
 by mails.dpdk.org (Postfix) with ESMTP id 310F240281
 for <dev@dpdk.org>; Mon, 15 Jul 2024 07:55:13 +0200 (CEST)
Received: from mail.maildlp.com (unknown [172.19.88.105])
 by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4WMrsp6fCSzQlFZ;
 Mon, 15 Jul 2024 13:51:10 +0800 (CST)
Received: from dggpeml500011.china.huawei.com (unknown [7.185.36.84])
 by mail.maildlp.com (Postfix) with ESMTPS id 09BF7140415;
 Mon, 15 Jul 2024 13:55:12 +0800 (CST)
Received: from [10.67.121.193] (10.67.121.193) by
 dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.1.2507.39; Mon, 15 Jul 2024 13:55:11 +0800
Message-ID: <c99eab6e-05b4-4799-aa90-078a3ddbeea4@huawei.com>
Date: Mon, 15 Jul 2024 13:55:11 +0800
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v6 1/2] bus/pci: fix secondary process PCI uio resource
 map problem
Content-Language: en-US
To: Chaoyong He <chaoyong.he@corigine.com>, <dev@dpdk.org>
CC: <oss-drivers@corigine.com>, Zerun Fu <zerun.fu@corigine.com>,
 <mukawa@igel.co.jp>, Long Wu <long.wu@corigine.com>, Peng Zhang
 <peng.zhang@corigine.com>, Anatoly Burakov <anatoly.burakov@intel.com>
References: <20240702021946.4194102-1-chaoyong.he@corigine.com>
 <20240702074007.1547-1-chaoyong.he@corigine.com>
 <20240702074007.1547-2-chaoyong.he@corigine.com>
From: huangdengdui <huangdengdui@huawei.com>
In-Reply-To: <20240702074007.1547-2-chaoyong.he@corigine.com>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Originating-IP: [10.67.121.193]
X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To
 dggpeml500011.china.huawei.com (7.185.36.84)
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


On 2024/7/2 15:40, Chaoyong He wrote:
> From: Zerun Fu <zerun.fu@corigine.com>
> 
> For the primary process, the logic loops all BARs and will skip
> the map of BAR with an invalid physical address (0), also will
> assign 'uio_res->nb_maps' with the real mapped BARs number. But
> for the secondary process, instead of loops all BARs, the logic
> using the 'uio_res->nb_map' as index. If the device uses continuous
> BARs there will be no problem, whereas if it uses discrete BARs,
> it will lead to mapping errors.
> 
> Fix this problem by also loops all BARs and skip the map of BAR
> with an invalid physical address in secondary process.
> 
> Fixes: 9b957f378abf ("pci: merge uio functions for linux and bsd")

Fixes: e6cf7bee1c77 ("bus/pci: fix UIO resource access from secondary process")

> Cc: mukawa@igel.co.jp
> Cc: stable@dpdk.org
> 
> Signed-off-by: Zerun Fu <zerun.fu@corigine.com>
> Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
> Reviewed-by: Long Wu <long.wu@corigine.com>
> Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

Tested-by: Dengdui Huang <huangdengdui@huawei.com>