From patchwork Mon Dec 5 15:29:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13064690 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E59BAC4332F for ; Mon, 5 Dec 2022 15:31:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232748AbiLEPbO (ORCPT ); Mon, 5 Dec 2022 10:31:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232697AbiLEPan (ORCPT ); Mon, 5 Dec 2022 10:30:43 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2066.outbound.protection.outlook.com [40.107.93.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EE46D77 for ; Mon, 5 Dec 2022 07:29:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f3Gm1RXI+dBS/eisYzReBWlg6nZGhxLyr8vThClascR+/6HXSWjDjTgMNW3ofWAq9ku1L6KaPM8HXFmHbC+k3lXNALjyE1VJZp9zEKCBylIjmJegonwxr7aW6vG5o54Os8iezkSVVKx1QFXxGVqzjX9kCkWgmYHJmKODFhAoMWNvJCmoisZ/+9cXtobSk2jilBei/teVu/E6a0OEPHw8m0D5KEKY4vFemfh9Gr/JELS67GWPjhWybSh7SfK8Tt8+VsSINAFDRLiEVSyLflUlDPbOP4aaQ0V6lFy51H88oOg0brrprvYccuKUZGed75kaDFpAt/vfGlew4EuD+Baj2A== 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=getKzrV833AtV5z8bZjZK1sH4qppWNJPwX0Wthw9mz0=; b=CwnTSrWAu7WSXXjqFDxI5dxqeJIXi7p90xHjTC0ukn+kcl5vDStVji6WZym9vkAqmAvcmXlgbmcKpUMsQGJ81WiBju8rIn/G1R/0lvmT0rSh3sLrLURoiRHFk+lOzDuy6zyfH3LO0gLeiLbHejgTHjPecgBof7AjnwgMLpS6r0xvxgKy316vodTNoSkvYkD4aJazA5C3gOhs3qn/vNe2I/i/crNc1yNZk9w87Qllnfrj7a2dXSY74b2/ih27kVNLwEIYYrO5HnhS4O9tBb3meIdanGkbiRsu1C07dgRtTi1lAn66EjOJQUaINS8ZC3yV4NiHbsiuYY0eE+Xclr1VBQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=getKzrV833AtV5z8bZjZK1sH4qppWNJPwX0Wthw9mz0=; b=NjaJoVwannJEHLKDOj4rM5A4hxBIarAwFe+id7AnKxoojIRqMAILhh5guphx29xRarFrNqKa9TBU/yS6lamDw0MBGWuzDupEo6zXvTroBSSCji2ozlNVh348Nyx1NsQoycw/NtO8hh5S+rUK+kTPRBJO0CfVV8M9Bjn1wVTR6CfvRrqK2EJa6INaA18XyCi3iC3baEDZXDWIrxbcRMLyK+l1/YmfECX5ApmmwmzXl8lNCrAZEt2sbzjoBeSyzAHl0QiaZRHgijP30/PIVh1kwiPcAcXbxut0QnUBEjCxTrBp+/OeUG6g69XsktIrm9Rl+1jeXv06U5GeWrc/1qcVkA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by DM4PR12MB6662.namprd12.prod.outlook.com (2603:10b6:8:bb::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Mon, 5 Dec 2022 15:29:25 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::f8b0:df13:5f8d:12a]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::f8b0:df13:5f8d:12a%9]) with mapi id 15.20.5880.013; Mon, 5 Dec 2022 15:29:25 +0000 From: Jason Gunthorpe To: Alex Williamson , Cornelia Huck , kvm@vger.kernel.org Cc: Christoph Hellwig , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v5 1/5] vfio/pci: Move all the SPAPR PCI specific logic to vfio_pci_core.ko Date: Mon, 5 Dec 2022 11:29:16 -0400 Message-Id: <1-v5-fc5346cacfd4+4c482-vfio_modules_jgg@nvidia.com> In-Reply-To: <0-v5-fc5346cacfd4+4c482-vfio_modules_jgg@nvidia.com> References: X-ClientProxiedBy: BYAPR05CA0030.namprd05.prod.outlook.com (2603:10b6:a03:c0::43) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|DM4PR12MB6662:EE_ X-MS-Office365-Filtering-Correlation-Id: 6b2aef7c-d917-4440-57a9-08dad6d57cba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vTjsYOlfRjBMdM+59R5TxLbdGT7KlQFS8mqgTu8qbxYO63wu/Fk/rr+Yi+uXK25nl/jiC2W+5ObcCjiF3eCmcma7UbZcLu95PeQ0+mbX3e3qOKG4/+eJOj6xppQ/Cf09/C81kbQSJIVHaDDKCTTpNWU30h3aN6nfdVXXqiioGrGSQExShXsOWSLN+fdOrVv+3/eDo4vGHfAojkGwsJhHZbR8so+R9g6jpdUc7eOo/boi021Z1fHaIlQcQ7d5iouegvYu19w/7srBSOw3QYN46nevhW7qKrI3EsX3PVWH38dhsXYqrWBmwKtGNgN8XAGsAlB+NxIRZ31ZM13BpSWBePs1ot+5snMLMfRZzPWVNiQ8HYRpGtRkoRnftb0TIA/EsNgMC6XUNRRuUQiH+qYq9pxrqmlA8WrkX6S9bVbcqGpqbLNykK6tpgx+DpOz37GxEFZYCpT/zn28LBZcuIpua1mCM370slN9YFIzN9FoAYl+X9Gl46Qw7fc3jncbdT/mkOiNQzK4+WjNM5bRNceVYT8pl+AOs8OJ411x8Dnz2PJxiUAxNySqo3iSdztWvD5XjXEv1VHv43BTOIwfu/UQJQfSxZM63MGLDvueODlPpGM7RejTust6S5QjRMTph+KeLDK1PVffippwL6+iCJu4MZWHjXkh9HLig0aIYZqQ5ejWLrDhF4tEdRXgvDjjydWl X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(376002)(39860400002)(396003)(366004)(136003)(346002)(451199015)(66476007)(36756003)(38100700002)(2906002)(41300700001)(4326008)(5660300002)(8936002)(83380400001)(86362001)(478600001)(6666004)(66556008)(2616005)(8676002)(54906003)(110136005)(186003)(316002)(6506007)(6486002)(66946007)(6512007)(26005)(4216001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6DHDf20BAiIeBFOjHGkt1Ql6wkMKpRBi6nuT8yZnG/dvKqZ37nimwiy0ustQrECk6bQbnvBoXRUw461fp26r6iuhnP1TymFUl8glzp8be0T6CAKC4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aGbkal9zYWIp7xJjmmXUPqkFpOf1x6aoU9uNvPDpDmVjwAgwe10OivzwwX51mt8ef4w4AjzpL4GNQqmW/X3A/0fMxh46Sx3sXR3eX/H92XFO5XDiyvCO1XSkALi/r4xBXmfXGWNttcUyOeLDcf4YViACNzLp7x3zSsGQuohUUCKSnfpx1Xs1mn8wpo2jL6VvvtYh6X9RXxKU8xlBOePMHKj6Rg/kljJq/WFL+uhLzjzyi1lrWfH4EiKIXIAFyBWCwtVbrY0XKF6ABAq/AXjhAuM0kvoin3tanxbzOI435lidEkKSwiBf5O4GRuPFNLXanG+9ltCbab/LYzfIWN31zO8jYa7TZy3ulZlByrv71+IFV6ktNxpZwiIkZWBrvOUFnX6ve21TG4347vgGBafkFlyIT X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6b2aef7c-d917-4440-57a9-08dad6d57cba X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Dec 2022 15:29:23.5936 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hBmJcjQRM/4UAtl5hbE9PlAb0xy/vwAjgikiNRtWUKOjYZM09CqRWgZrTmrIkQkR X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6662 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The vfio_spapr_pci_eeh_open/release() functions are one line wrappers around an arch function. Just call them directly. This eliminates some weird exported symbols that don't need to exist. Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe Reviewed-by: Cornelia Huck --- drivers/vfio/pci/vfio_pci_core.c | 11 +++++++++-- drivers/vfio/vfio_spapr_eeh.c | 13 ------------- include/linux/vfio.h | 11 ----------- 3 files changed, 9 insertions(+), 26 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c index badc9d828cac20..c8b8a7a03eae7e 100644 --- a/drivers/vfio/pci/vfio_pci_core.c +++ b/drivers/vfio/pci/vfio_pci_core.c @@ -27,6 +27,9 @@ #include #include #include +#if IS_ENABLED(CONFIG_VFIO_SPAPR_EEH) +#include +#endif #include "vfio_pci_priv.h" @@ -686,7 +689,9 @@ void vfio_pci_core_close_device(struct vfio_device *core_vdev) vdev->sriov_pf_core_dev->vf_token->users--; mutex_unlock(&vdev->sriov_pf_core_dev->vf_token->lock); } - vfio_spapr_pci_eeh_release(vdev->pdev); +#if IS_ENABLED(CONFIG_VFIO_SPAPR_EEH) + eeh_dev_release(vdev->pdev); +#endif vfio_pci_core_disable(vdev); mutex_lock(&vdev->igate); @@ -705,7 +710,9 @@ EXPORT_SYMBOL_GPL(vfio_pci_core_close_device); void vfio_pci_core_finish_enable(struct vfio_pci_core_device *vdev) { vfio_pci_probe_mmaps(vdev); - vfio_spapr_pci_eeh_open(vdev->pdev); +#if IS_ENABLED(CONFIG_VFIO_SPAPR_EEH) + eeh_dev_open(vdev->pdev); +#endif if (vdev->sriov_pf_core_dev) { mutex_lock(&vdev->sriov_pf_core_dev->vf_token->lock); diff --git a/drivers/vfio/vfio_spapr_eeh.c b/drivers/vfio/vfio_spapr_eeh.c index 67f55ac1d459cc..c9d102aafbcd11 100644 --- a/drivers/vfio/vfio_spapr_eeh.c +++ b/drivers/vfio/vfio_spapr_eeh.c @@ -15,19 +15,6 @@ #define DRIVER_AUTHOR "Gavin Shan, IBM Corporation" #define DRIVER_DESC "VFIO IOMMU SPAPR EEH" -/* We might build address mapping here for "fast" path later */ -void vfio_spapr_pci_eeh_open(struct pci_dev *pdev) -{ - eeh_dev_open(pdev); -} -EXPORT_SYMBOL_GPL(vfio_spapr_pci_eeh_open); - -void vfio_spapr_pci_eeh_release(struct pci_dev *pdev) -{ - eeh_dev_release(pdev); -} -EXPORT_SYMBOL_GPL(vfio_spapr_pci_eeh_release); - long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group, unsigned int cmd, unsigned long arg) { diff --git a/include/linux/vfio.h b/include/linux/vfio.h index e7cebeb875dd1a..e8a5a9cdb9067f 100644 --- a/include/linux/vfio.h +++ b/include/linux/vfio.h @@ -231,21 +231,10 @@ int vfio_set_irqs_validate_and_prepare(struct vfio_irq_set *hdr, int num_irqs, int max_irq_type, size_t *data_size); -struct pci_dev; #if IS_ENABLED(CONFIG_VFIO_SPAPR_EEH) -void vfio_spapr_pci_eeh_open(struct pci_dev *pdev); -void vfio_spapr_pci_eeh_release(struct pci_dev *pdev); long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group, unsigned int cmd, unsigned long arg); #else -static inline void vfio_spapr_pci_eeh_open(struct pci_dev *pdev) -{ -} - -static inline void vfio_spapr_pci_eeh_release(struct pci_dev *pdev) -{ -} - static inline long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group, unsigned int cmd, unsigned long arg)