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 3CD8143215 for ; Fri, 27 Oct 2023 14:50:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 32D2D427E9; Fri, 27 Oct 2023 14:50:44 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2041.outbound.protection.outlook.com [40.107.92.41]) by mails.dpdk.org (Postfix) with ESMTP id C489E402E4; Fri, 27 Oct 2023 14:50:41 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lnAdlGn22yxqnSf25k/OI2u36c15Gf4G76NsYw12sMWuynxnSTHsVz5v05+S/QNuN2yMmVv6aysBSPEqlXKzojCkY0UldQaEFHxWWtUgzmAuH0ugBvQFWHwjEgdnoC/KuVST38u4ZVgmqzYr5hfMCWVniSdu/cfZb2EKkdLnmifqg/tyiPp6AY0ijzr3080nAz2dhxXjxDkeOhETkUG3W2KvB3ZjzYhaSaK4V4RWjgmJdHvgw0glm252jMOUJpXfXnr3kxnvZ5EsNkRYK6t3oUpnJDIssP6EzT+J8vxtZm8DhjwQEK+/uecwxgnReMRBNlKbFeAShrUfTQJWMK+EkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Wk4uE4JWpVKMiO8WCAJoy7ZTUJpAstANj7pBXMmeP0Y=; b=JpwkY2fKttiJwP14rSZ8hBlPrxHCsK0AnOmdaVZSqHgX73JI6bmykA8TdQEftLlrlBfEkxxx3l5tXSwqyWU9FNmwePa9QBIaRRYC2u036Pj3i3D4gxTmY3L+Z0Atm385DlyKrba3F97rO5s4uS7xL/m+GRNgBOEgJ/91rXV/k0os6iY5Z7O3WNgALExSY0N56aT5KNS0IKts6LpwdrRQLp+V6KRfM8s/IAgPxHV2eyOdOD1/2kCYdOKyI/GDmaAXDkBgGK8rmG4sh55m7ZE8U3xbxil7jPawiDlTpY+yssHseCKtCtLCr1D0uOYKzhr6SNoB3m6xIasYbx9UQwfhrQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Wk4uE4JWpVKMiO8WCAJoy7ZTUJpAstANj7pBXMmeP0Y=; b=gVsCiakNiJeXSP6HEcTrquWQuRsW+mDGDRB8IG3qlL9j1Fk2zAu4st9O8Bmqx7F8e9+y5DTzOwaRP/f2voCRDAK17QRmK0nTctbEi/GGvQEHLpjilReZGdrp9ue1P//1h/jSfhFyIhp+qjKQjVwXbTVdguys1ikA2VVa+KWHIDY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH3PR12MB8308.namprd12.prod.outlook.com (2603:10b6:610:131::8) by PH7PR12MB6810.namprd12.prod.outlook.com (2603:10b6:510:1b4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.19; Fri, 27 Oct 2023 12:50:39 +0000 Received: from CH3PR12MB8308.namprd12.prod.outlook.com ([fe80::1ff1:d311:1f3a:5b42]) by CH3PR12MB8308.namprd12.prod.outlook.com ([fe80::1ff1:d311:1f3a:5b42%7]) with mapi id 15.20.6933.019; Fri, 27 Oct 2023 12:50:39 +0000 Message-ID: <8e98db9b-190f-45eb-928b-f618cbb03bd6@amd.com> Date: Fri, 27 Oct 2023 18:20:30 +0530 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5] bus/pci: fix legacy device IO port map in secondary process Content-Language: en-US To: Wenwu Ma , anatoly.burakov@intel.com, dev@dpdk.org Cc: david.marchand@redhat.com, maxime.coquelin@redhat.com, linglix.chen@intel.com, stable@dpdk.org References: <20230807015820.1329972-1-wenwux.ma@intel.com> <20231024020021.116278-1-wenwux.ma@intel.com> From: "Gupta, Nipun" In-Reply-To: <20231024020021.116278-1-wenwux.ma@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BMXPR01CA0096.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:54::36) To CH3PR12MB8308.namprd12.prod.outlook.com (2603:10b6:610:131::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR12MB8308:EE_|PH7PR12MB6810:EE_ X-MS-Office365-Filtering-Correlation-Id: 3c1bae7f-8c82-4843-240a-08dbd6eb527a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iEHWI0F99RGaAO7ihr46HCU4aP3v8apvlS2VcHozZ0HiLIjazaBuj7hNwkehdUCcBM9/69ZMPijzLvty0aC/+lRMddMF+ZuZ2lKmXZrVOpDfbUwZDCfd22GOoSwHN3ylgFMUm0A43kW/Yq4AX70GUOiHgsi7o5v4DsiHuaNRMNip1fUd41m6Ik1tqLqvF+psvTk618dj6I54RNelV4b9LgdK+9/j5Zd9Ylff0vP5V8FR9StBjZcgXJEDQQFONGdvU+9S+qmMwVaUtoC77DpJjV4+BTjOEcRwsFN9o6Rf4HEUqD6e5AOqufmFVb5rQlVZD1JIXwNcwrXhz2vwQDUnuxt8WiEEf8c801DDhPDmY6KKoyaJty6DGoVOh+nQlhkxr26KPQ6HSctJpPXtZs61IxXcX39Qkv7H0fw7LhQQR+q7SLmEtSYtJdt5M++CzVtX1XY8TMk/qQt17bM17k1XTSk8ydoIYyPdkiBA0x0b9ne8FhjpXV60FnYn4+vUOBs6gTN+IkcXhjjnA+6KdMz+qeEGI0UA/RAACGL2cSAV4QFvsy0m9Cwgjmh8y1SBIJKD61AH875cVXTW03HkPia6KcIMgHjyaOa+Mc4KURZdfRtpjnxW7+BysZYuBndfG4tp35gygEFBwJ3xuIjkkued3Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH3PR12MB8308.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(396003)(346002)(376002)(136003)(39860400002)(230922051799003)(64100799003)(451199024)(186009)(1800799009)(31686004)(2906002)(5660300002)(36756003)(26005)(4326008)(38100700002)(8936002)(8676002)(41300700001)(83380400001)(6512007)(66946007)(316002)(2616005)(66476007)(66556008)(6506007)(478600001)(53546011)(6666004)(31696002)(6486002)(86362001)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MmVaTXBnemhCZFNrZGlkdTFZTEF3RVYyT3MxZFFaQ1MvU1NER2dSUzdxaE9H?= =?utf-8?B?SzNJVGNCYmw1TGZlaVlCVW82VHVwNER3TlFBV1ZEWFppT0hZRGd0S3YzL0Ny?= =?utf-8?B?OGQ5L2M5SXZkMkVsTEowYWxhdDJ0UjlKL3lkRzZ6N0k3eHRhazVmaytPbXIy?= =?utf-8?B?Smt0cmVFVEdZckVTSExnTVRIZFJSdUMzUFlIZm1ZRHBXRHpKOHA5MGlUaUVC?= =?utf-8?B?aWlrVUpwZzhCcFBKSVhWM1ZtU2tMZi9mYllpbWVqOFJ4dVY5b2lHTEg4Um9r?= =?utf-8?B?SGJ2eG1PM1RPL2xDVTFPaEpCYmZnY3RjcllucStiVmpjVVluQUJCQzRHWVFI?= =?utf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RvzGtakxnd?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3c1bae7f-8c82-4843-240a-08dbd6eb527a X-MS-Exchange-CrossTenant-AuthSource: CH3PR12MB8308.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 12:50:39.5992 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NQtTZdbPiazsVrgGxA0EcO/8cfV0WQ9sEFjaPLOOwchQlj07dRXYqS+8xJp6Q3MR X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6810 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On 10/24/2023 7:30 AM, Wenwu Ma wrote: > When doing IO port mapping for legacy device in secondary process, the > region information is missing, so, we need to refill it. > > Fixes: 4b741542ecde ("bus/pci: avoid depending on private kernel value") > Cc: stable@dpdk.org > > Signed-off-by: Wenwu Ma > --- > v5: > - adding checks to vfio setup > v4: > - adjusting commit log > v3: > - adjusting variable settings > v2: > - add release of device in pci_vfio_ioport_unmap > > --- > drivers/bus/pci/linux/pci_vfio.c | 52 ++++++++++++++++++++++++++++++-- > 1 file changed, 50 insertions(+), 2 deletions(-) > > diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c > index 3f3201daf2..a1f7cc2421 100644 > --- a/drivers/bus/pci/linux/pci_vfio.c > +++ b/drivers/bus/pci/linux/pci_vfio.c > @@ -1230,6 +1230,36 @@ pci_vfio_ioport_map(struct rte_pci_device *dev, int bar, > return -1; > } > > + if (rte_eal_process_type() == RTE_PROC_SECONDARY) { > + struct vfio_device_info device_info = { .argsz = sizeof(device_info) }; > + char pci_addr[PATH_MAX]; > + int vfio_dev_fd; > + struct rte_pci_addr *loc = &dev->addr; > + /* store PCI address string */ > + snprintf(pci_addr, sizeof(pci_addr), PCI_PRI_FMT, > + loc->domain, loc->bus, loc->devid, loc->function); > + > + vfio_dev_fd = rte_intr_dev_fd_get(dev->intr_handle); > + if (vfio_dev_fd < 0) > + return -1; > + > + if (vfio_dev_fd == 0) { > + if (rte_vfio_setup_device(rte_pci_get_sysfs_path(), pci_addr, > + &vfio_dev_fd, &device_info)) > + return -1; > + > + /* we need save vfio_dev_fd, so it can be used during release */ > + if (rte_intr_dev_fd_set(dev->intr_handle, vfio_dev_fd)) > + return -1; > + } else { > + if (ioctl(vfio_dev_fd, VFIO_DEVICE_GET_INFO, &device_info)) > + return -1; > + } Code upto here is to get device info, IMO we should have a separate API for this in VFIO layer which can be used from any driver, rather than being limited here. This can go into a new API like rte_vfio_get_device_info() in eal_vfio.c. Thanks, Nipun