From patchwork Mon Oct 17 18:38:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13009265 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 A33FFC4332F for ; Mon, 17 Oct 2022 18:38:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230483AbiJQSio (ORCPT ); Mon, 17 Oct 2022 14:38:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230208AbiJQSil (ORCPT ); Mon, 17 Oct 2022 14:38:41 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2057.outbound.protection.outlook.com [40.107.243.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE62072B70 for ; Mon, 17 Oct 2022 11:38:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KlGnutFFYqFcwlLtIDBHZ7kfBcnfrqLQuNlYMbcltbUq7zPPpTCHBEag4LpomMJU2AOP8anmQ4yKYsafubr4ypIe5yE8I1q62nrPXTk2gfVjWvWi4s4C1CSknTWGyWEtDlq9jlAEKDRKPKbHrcfFPAhCjStmwJia2TvA3/sTejn8FbDkPgqT8Y9X2+gbnT384pcLwqcDRgYx7Vcc8Ca2142DshY5r0AchSz0Yzz19OpVRlfNFkdOS30O4JnQ7sJXJNf3mN8Ro5X+SrweXgU+iFsunsLyTEFK6kuehVRmKWS/MGmwD+DCPiGaB9fUgjYYLPy2/GcD/Nm8tpA2WxG/Vg== 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=FmnOqlYICPCmAzE9NnZx3nqYYZxpsBMsbeSjayipXgI=; b=j8TrJDQWtMRriQr2s2P/+R/cgt5nrA2Ew3BT3Hh3EOVaNS5kHXkTPf3d01bwckiGyNoo2AB+NTMKnWnVvSkaDcS7kZHqXjW0LlZ8QK2ysbCMoFDIXCZC8uUCjFvbqTW6wp/0h+EgIXLjXhMHObYpl6YF7dbuS7WAl7QTAG2vpHAd+vuZmwOZV5vKF8K1Tthecw9KgZpDRn9oQP3ghbdOhuLZ20gNlFybSutwBtSfHeGnRSiOuzIwus2M49XUB9sj+oCgQonAHUb9Rt8e0r8ifm9KqEH6eN/mkizjS/Gww9MZ/ZMDnQ6OzKGooTeMmQYXBTRpPO4Dhdu1HvttGUHDiw== 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=FmnOqlYICPCmAzE9NnZx3nqYYZxpsBMsbeSjayipXgI=; b=ZDZj5y2S0DwQ9UVAyaOoR60HeWA4b/mJsawGp7ibzfGenxRrIHlzKlPkvDUkMEE39WM0bOmhnnlBky2Pvdmukw8xespUKdNpelnN/+V/kXbrgYTT8GE95Qi1UJrLS8JSPbtbLaoANewDedBTtOd8G+2b8UIaajbc26olz+Gs2utN+BG+r+gfGiRCbrOiTsIHqBClANHKg4FH/MRDt2hq8k2uCM1Sv1VQx9QnMLRUFugEZ0zCnQcggqFkPq0tQmBdnD7mAGOKQLxiFSmHgDdMo4dCVOY+AcxmH0uAVKBUWH/d1zLyp7PXrZU0ceC1d1VUvdwW4cEDM1XlBdRR/S9zYw== 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 PH7PR12MB7161.namprd12.prod.outlook.com (2603:10b6:510:200::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30; Mon, 17 Oct 2022 18:38:36 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::7a81:a4e4:bb9c:d1de]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::7a81:a4e4:bb9c:d1de%6]) with mapi id 15.20.5723.033; Mon, 17 Oct 2022 18:38:36 +0000 From: Jason Gunthorpe To: Alex Williamson , Cornelia Huck , kvm@vger.kernel.org Subject: [PATCH v3 1/5] vfio/pci: Move all the SPAPR PCI specific logic to vfio_pci_core.ko Date: Mon, 17 Oct 2022 15:38:29 -0300 Message-Id: <1-v3-8db96837cdf9+784-vfio_modules_jgg@nvidia.com> In-Reply-To: <0-v3-8db96837cdf9+784-vfio_modules_jgg@nvidia.com> References: X-ClientProxiedBy: MN2PR10CA0010.namprd10.prod.outlook.com (2603:10b6:208:120::23) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|PH7PR12MB7161:EE_ X-MS-Office365-Filtering-Correlation-Id: bdb09dd4-ead3-4389-b2e8-08dab06ecc4c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B86mGf8RXTAy6l4Oa1f9vUbGuYMLKEscv1tIxchqJpEptBNvaigRoR4z80LEge6YEc8fD6UiJcOYQ7/TmPqLVNHs78m37fFQQs77hm3IaA8d83gFkTxJcV9veOf0xFE7WBPtvxQ18faHpJW/dm+ECjGgSsnbf5sQI6vwwzBPFfgIfaY2+YcFWCqDN3Pl8IkBa576/1ffoBaZ8XiOfPSmPI77G9K0V6jHhjH+QQXThuyQIAFW2+EJF6cCxme3V/YrP97R9b15M+JPiQB3zteUidYuUTSqDxuHjjEjign9cKRy8IdmoRe42aUKtGT72PIDU4aCNszoAx0C6sBL+n97oS+hfJboOOOPtcXsX1LNW3ov2grEKx5xGnk7AXakK2Ib2kH5T48cDo2Mj41fpQlgztE2YantGk4qhrcV/fx37J90iVxGWagoUifv6IbLMVZ/Sc4CbfEvyG3TOuNaehOOc3GqUt4i7uu2w0zWXikm0K9xmgljFAKMz4HZTMaUZdBK0IzaUeMPxZ3eCHshMjNN83MAlV/YelcFmapMgzDcRTRmfc2yV51M3/4NUjpQadC1bEMAiL0gu8HaDDzEuyvAZ9EO1NwMirk8d7ZYU0LnlvgklCdyfp2Di6byjn11sG/TsjZoacxQHCUj+iF+cAJA1JaYSHNR6uUlgiTOlIT2wIftrifQ6Fq52IJkPRDorCSjYL9Bc4Wc5Hp0vaGYogb0BhAmkfryGN408wLpoK5KcwcMsaR62Q2PP3F6EDjrQh46 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)(39860400002)(366004)(346002)(136003)(396003)(376002)(451199015)(316002)(110136005)(186003)(36756003)(2616005)(6506007)(2906002)(8936002)(26005)(86362001)(41300700001)(83380400001)(6512007)(6666004)(66946007)(66556008)(66476007)(5660300002)(8676002)(6486002)(478600001)(38100700002)(4216001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +uTOz0TUKEpeBIRPcpBj6VxjUAH+R9Ph6cmg4si2iBBiLVaOFVWryO9odg7cXnF0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opWIeUXjc3yRbjRBVId3GqoKEGxqEdnM59pEgAt8+ZfYuj97w7OCkiZPC3wOvfA1cTcCU/Er33TXrgngQYgiYfU12A3/D6Cects6RFoXM3k4KMkS5v7jSOtVljM9Y+fVnyMA8AWgKnEQ40FkGN69//UCV6X6Ht7Tw5f8PbIxYLjwM9A0gxoZeVsp4KudqDnm9llkaY1CDAH48BhwGX2IaZeOq2YsSl22UrhNygsRauh4A4N3JdOCA1XZzjPsGe3AaG9KF6GPPJX0nSgT4zpRIKhbHrJszjCmpQPhohyRuNMwDdahOBqCRk1s5NMrms5lBKRaHByZV5ODoGLnRpdYC8EB8kiDLwL0V2DkWUiHa8UgihNGxLPEIjMh5qyszdAsvaYfTOSXM3tWFlCtmD8WlVdowsCG8dyLIUa0svh2Fp3btfXNeqjx/cY= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: bdb09dd4-ead3-4389-b2e8-08dab06ecc4c X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2022 18:38:34.9003 (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: 9s0RCnQAsX4O5Tgpx0yg9cPybJWdX7kGP8wCBA6DNe774/E/Q6t2DUl6APIghjoD X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7161 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 and move them into vfio_pci_priv.h. This eliminates some weird exported symbols that don't need to exist. Signed-off-by: Jason Gunthorpe Reviewed-by: Christoph Hellwig --- drivers/vfio/pci/vfio_pci_core.c | 11 +++++++++-- drivers/vfio/pci/vfio_pci_priv.h | 1 - drivers/vfio/vfio_spapr_eeh.c | 13 ------------- include/linux/vfio.h | 11 ----------- 4 files changed, 9 insertions(+), 27 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/pci/vfio_pci_priv.h b/drivers/vfio/pci/vfio_pci_priv.h index 5e4fa69aee16c1..13c0858eb5df28 100644 --- a/drivers/vfio/pci/vfio_pci_priv.h +++ b/drivers/vfio/pci/vfio_pci_priv.h @@ -100,5 +100,4 @@ static inline bool vfio_pci_is_vga(struct pci_dev *pdev) { return (pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA; } - #endif 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) From patchwork Mon Oct 17 18:38:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13009266 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 D5AC3C43217 for ; Mon, 17 Oct 2022 18:38:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230453AbiJQSip (ORCPT ); Mon, 17 Oct 2022 14:38:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230354AbiJQSil (ORCPT ); Mon, 17 Oct 2022 14:38:41 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2057.outbound.protection.outlook.com [40.107.243.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D6C572B4E for ; Mon, 17 Oct 2022 11:38:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ByJr3HSljoQuizPBCcJPxhLpwrg87B/h2lqUgRaDpljRDhv4ydEDlXqpd0YllwINkDfP6FeT/2cuWpHDOFDIxTzOryEEuM2WOMJUcZF1P/kn/xCtUR7csi4LRo2vGZkRuPw2F8TkiSJaoJW3Oes5qP1VFha1ovQFJdQF/dXAWUE+bIVvHqI3qgJANHh6K/7zlxAHkXvYOsIxCRsAl2U5V6RblCofRr5+YQU3vGuuIN+cuBwDGB4xmCksWbcqDVMHkZcWor1ObkkEB1mujq2rl0movYQVXZQa0btsmUU9XjC8NUA2k9BA6n1YEql5hAtjfHVwLl3r7PtQhpR3lu2f3A== 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=vfHsPSYnmz3e+lf6pEPiH2QlwvBho+C+pQWIXK0M5iQ=; b=abySBY00LH0hwuMX4jHi71zAh1F3VleUIM/2YmgA6U43wL/3uV8sg6LYY0wm2L1EvfJKZlrmfyBeZDVwPcVFfjv7S/09kDyW9N6N9KCgXcVKRChPP17dFXLA8HbQ2Wd9LCi/VbRtQFfpyxpw13tHs+CkMP/PdDkTRzzj1zrt43R5jviNAcac11z1ExunIYo8+4f6Z/KsvMXqfDyIwwmM9zw7a3r6sOIPIDpV9MY0LKQQ+hQRafoV8HHhq2umKCpI9FJAjkAklpPOUs2FEc1Pz4jWR1rcS+JTE9eOwv3790zbkfgPX9OtOFp8iuu2Hnq/eg0aTM9WadMggrD6M9Y3nw== 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=vfHsPSYnmz3e+lf6pEPiH2QlwvBho+C+pQWIXK0M5iQ=; b=gwLaiMpMJve0+IlEuV1nwGdFQVqEwX+a+nZqq0JsrdoIflqtgOn6Hgnj5tC0in5YyrMSk+yshWKxJoFRhhD/UJOULn+Lc1MqR4lefvf1L1XUVhOPveMbqIxNLYA0ZkX6iGDrbxomLL3houd2VoiKaWXIbT6d8NtIEnrXu2N4vjtohJJqWAO2v+Ke5NuQ0AecwDmkdTm2i/Yw1W2hv17Xhavdl4kIYUNi2XybPmv61UaYTOvz7Hyuvs40N/WhWD0lLqMWSC5eH4Ww/qzeC8Cg19vEk+bGd7Yh9VH+9CCr7YAvmtuQf/MkRH9Q2+HZMPD5Ei4EZkGEXwmlL3+OJTObGQ== 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 PH7PR12MB7161.namprd12.prod.outlook.com (2603:10b6:510:200::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30; Mon, 17 Oct 2022 18:38:37 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::7a81:a4e4:bb9c:d1de]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::7a81:a4e4:bb9c:d1de%6]) with mapi id 15.20.5723.033; Mon, 17 Oct 2022 18:38:36 +0000 From: Jason Gunthorpe To: Alex Williamson , Cornelia Huck , kvm@vger.kernel.org Subject: [PATCH v3 2/5] vfio/spapr: Move VFIO_CHECK_EXTENSION into tce_iommu_ioctl() Date: Mon, 17 Oct 2022 15:38:30 -0300 Message-Id: <2-v3-8db96837cdf9+784-vfio_modules_jgg@nvidia.com> In-Reply-To: <0-v3-8db96837cdf9+784-vfio_modules_jgg@nvidia.com> References: X-ClientProxiedBy: BL1PR13CA0435.namprd13.prod.outlook.com (2603:10b6:208:2c3::20) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|PH7PR12MB7161:EE_ X-MS-Office365-Filtering-Correlation-Id: 533056b6-da66-447d-7d65-08dab06ecce0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I0uq5D8Yd5uLQq5wbjqc07h0p8LvsNqukk16Y0PPwTgY1DqfKOXr/fKuB3vistP8p3/0ISMpGE+4gM32FZwUe1U5QHwRycxz0bNJMeR2VuX1PYUUyiu3sd5Mh2E1aI0NXcEf5pTuZKrmzw48/7m1gNgfAkWF3d/WXDZwcDO+nivmo1zuf3nwdYiGS6Ek7SEMCyfJF0CMIW+0pQxNzRDDKKlxWmHMEz8AE7Af4a3ASEH4OgxxzqoUIwx1Q/MaAJwAdQKpznz5uLdWtgQmCqhE3Mh92rzaV/HrCULqHCIJBRVMCE42cK1PZxPEGXQ29XfIxNcSGIycHbvd94I5bPrds7L+J/ySz32TBkzGJQQlkUFTZ8BiR0Ff9ucuUOSAby7Qk6VsEYYBV2PwZQ4weRENOUjIdkR4hdpW7d3F2OCu/owfG7p+kzUzjAsIZarmMhy5Pd5mVosqpJ7k+MpK2vpP9YtuoXpE6dOpphoHac93aOryQldxIwsqHFvZndaLvLHypi6rJsH8jFPHCOTGs1YYc3q9cCbJL5TLkxRAgFQVll1PGWZWO/BP0KT0egWMK3Lq+VK0xmmDWd21rBlIxE7poqbhscm2mVHm6ikbnZRoNsWw/tXfXflwWxg+Ym3uJa4uZvlyZrIGxGVVxhXBSFu790uKXzQ5zPpNCKb88gtRDXRAy6Qi60Yojy8RgZSbOE/mn9ivMzWYb/ePxBUel24cZ/pZnncZcABeK7LjNzRsoJ6OHDMu0rmyiktZeSTRPfWF 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)(39860400002)(366004)(346002)(136003)(396003)(376002)(451199015)(316002)(110136005)(186003)(36756003)(2616005)(6506007)(2906002)(8936002)(26005)(86362001)(41300700001)(83380400001)(6512007)(6666004)(66946007)(66556008)(66476007)(5660300002)(8676002)(6486002)(478600001)(38100700002)(4216001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: x4DsRJ0SRp/+qI6R2kCdYyUjXvhrmGfha65vsbfMdP56BZ9J0AicCSryiQTgneJxB8T9xj06s/V0a3WfDvpHhjMsr2wrPwO0PNKhKYp4ePruRW70THjElyl1DV0Bl7tvkLcddi/XGGgwxjP3ux282VKxfoBdVLc+AsSg5ST9p2i60QRUKJs4QpxutEnGDP//w/cC2zqI7GJpDe1my0pzKASPZfHF1YH7EYXfloH3FOtgUql8c8r9g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CloV31OL7g6ou9tCs19+fu2PWulFOQ8iXPCG/cjoEceyzXU6jXGW1Jag3BN34JDXrXHY28kvxEcHduft1tJiqqbUD+XxpXIJsJxyPRyeCkA2wGcRkrzHsQ/lGhAQbjdGwd6FYDphaBIEnwwpbtjDCrLeGPxdxePAvfgRNuQymZKivH5TKiwxHOyit10cM4WRRiruuxqBZaL4RmRUJa4iZJqQkCVqGZELRr4HbfGAD01YviqloI40s= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 533056b6-da66-447d-7d65-08dab06ecce0 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2022 18:38:35.7907 (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: ExxIw7eaQLCE6FSEwIZyl1Z6OMcDxpx9qYjOJCLa2wCTD9u3d8vpKvdIWoHUGENC X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7161 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The PPC64 kconfig is a bit of a rats nest, but it turns out that if CONFIG_SPAPR_TCE_IOMMU is on then EEH must be too: config SPAPR_TCE_IOMMU bool "sPAPR TCE IOMMU Support" depends on PPC_POWERNV || PPC_PSERIES select IOMMU_API help Enables bits of IOMMU API required by VFIO. The iommu_ops is not implemented as it is not necessary for VFIO. config PPC_POWERNV select FORCE_PCI config PPC_PSERIES select FORCE_PCI config EEH bool depends on (PPC_POWERNV || PPC_PSERIES) && PCI default y So, just open code the call to eeh_enabled() into tce_iommu_ioctl(). Signed-off-by: Jason Gunthorpe Reviewed-by: Christoph Hellwig Reviewed-by: Philippe Mathieu-Daudé --- drivers/vfio/vfio_iommu_spapr_tce.c | 10 ++++------ drivers/vfio/vfio_spapr_eeh.c | 6 ------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c index 169f07ac162d9c..73cec2beae70b1 100644 --- a/drivers/vfio/vfio_iommu_spapr_tce.c +++ b/drivers/vfio/vfio_iommu_spapr_tce.c @@ -785,14 +785,12 @@ static long tce_iommu_ioctl(void *iommu_data, switch (arg) { case VFIO_SPAPR_TCE_IOMMU: case VFIO_SPAPR_TCE_v2_IOMMU: - ret = 1; - break; + return 1; + case VFIO_EEH: + return eeh_enabled(); default: - ret = vfio_spapr_iommu_eeh_ioctl(NULL, cmd, arg); - break; + return 0; } - - return (ret < 0) ? 0 : ret; } /* diff --git a/drivers/vfio/vfio_spapr_eeh.c b/drivers/vfio/vfio_spapr_eeh.c index c9d102aafbcd11..221b1b637e18b0 100644 --- a/drivers/vfio/vfio_spapr_eeh.c +++ b/drivers/vfio/vfio_spapr_eeh.c @@ -24,12 +24,6 @@ long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group, long ret = -EINVAL; switch (cmd) { - case VFIO_CHECK_EXTENSION: - if (arg == VFIO_EEH) - ret = eeh_enabled() ? 1 : 0; - else - ret = 0; - break; case VFIO_EEH_PE_OP: pe = eeh_iommu_group_to_pe(group); if (!pe) From patchwork Mon Oct 17 18:38:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13009263 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 39D3EC433FE for ; Mon, 17 Oct 2022 18:38:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229973AbiJQSij (ORCPT ); Mon, 17 Oct 2022 14:38:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230470AbiJQSii (ORCPT ); Mon, 17 Oct 2022 14:38:38 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2057.outbound.protection.outlook.com [40.107.243.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B2247295E for ; Mon, 17 Oct 2022 11:38:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ls1Ij6atkaPxD62oJN60/Y2oYAlh6saLckKYb1dN0+FeJ1djs/8W1F9UowEpkBUlYZ2Za/A2vf1+qn2pb+TasjPpD0GpY/rXL53dfCGtRbSdM0sTdheR2BYEzYehiwRg/2a/kspmhcdX7P5FFjxLhSJedNiYFEdFeoY2/dUyPYmw/nyxnI/aq3ZLxK5ox7I+/luAMdJqEbMyjeyUbg0hS23+2cFf3ROjVzp+HRUq0wSBLxUp+UwG6+q1jkAsocwhwr2f+J15+4VsQY1N0nNPKbqa7S7HSG2gWlPI2uqANIVm3gxajYLHaUetvkKsh/oooRJP75+zU1ln7FxcDVaf9A== 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=JhOkLzteOvM6q9h/O72bsPqcOOuUZxFpO728bW9AZ8k=; b=FM9p7LVYq2zYlN1GnUlSU7vabhGwozwmj4arAVcdMeOq8RaK98GFerkGG3yxINsQeUSUTUX4vW4otYNqyETpY1B9dctZvGm7Y5vT7YAUgAdIJ5CIdah2kyG/qsv5kC89rNE2grj+MHVIm2CjDf4MUan1+YLK9lPkkmlaMaN/uOPDleUE4TUeQSON+3v2yColk5wfYiHhErTroU1kvTmIpzrXzEKHRN9CVaboWGJj123JG8fjKC3uoo1f92LPj7ev4lXBsqpCy11TUrFrMSlCK8cxkBanlKfAwCXf8l5Tt3jhTgq6AL/UCmUWe0c+hdjbSbRae7N7+mRhZyCLsbzkHQ== 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=JhOkLzteOvM6q9h/O72bsPqcOOuUZxFpO728bW9AZ8k=; b=IUM848gL2+VmrCrG9/rICF0e+7oUdlpssBCzleBBlDbfO0weN3AeVAt+gsLr2EI5CgsGBXi8jTRFtfFNYiiQlKCC73uuWC3OnKAF6PwWCa8YMsKWgLuAFxqB9TFDvTbBuvCppY0eLm5LkMKgcHdTM44ClOQiybEYuJ57z1XmWayjQdlZeKX1sWh8Pw75XlSa7NMLZbRUFG4/dNJOlMiFZR378QdpLbe4NckM70s/KbCbH1hSL7wjlpfkfyBcmxMLXiw328HNNc6Sl0NzR+cZmBtiUuXGofSj7a36Lej3hZFlpPWiWwt6kZPu1JrU/kZIqzQCgNY8HHUDkgRhdEm/Fw== 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 PH7PR12MB7161.namprd12.prod.outlook.com (2603:10b6:510:200::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30; Mon, 17 Oct 2022 18:38:35 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::7a81:a4e4:bb9c:d1de]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::7a81:a4e4:bb9c:d1de%6]) with mapi id 15.20.5723.033; Mon, 17 Oct 2022 18:38:34 +0000 From: Jason Gunthorpe To: Alex Williamson , Cornelia Huck , kvm@vger.kernel.org Subject: [PATCH v3 3/5] vfio: Move vfio_spapr_iommu_eeh_ioctl into vfio_iommu_spapr_tce.c Date: Mon, 17 Oct 2022 15:38:31 -0300 Message-Id: <3-v3-8db96837cdf9+784-vfio_modules_jgg@nvidia.com> In-Reply-To: <0-v3-8db96837cdf9+784-vfio_modules_jgg@nvidia.com> References: X-ClientProxiedBy: MN2PR10CA0011.namprd10.prod.outlook.com (2603:10b6:208:120::24) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|PH7PR12MB7161:EE_ X-MS-Office365-Filtering-Correlation-Id: 232d46c7-73e7-4261-29d5-08dab06ecc43 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Zlxm88V8iaYH9nb1hkrryx2JFO+sLabkxjLDt7TQvWju4r6W5F+f6umgK6bx5Pk3VxlyFnzRP324McKhOrpKyZfxHmt4CJ/YAINaPt3AwERd03J2CRnirPZ3Tef1+4MmKxSYuUwLI8wfe3EH9XUgH2ZgJO4/RPTFm+qwXk0vaSl3NOMsomNDSu/BuuMmKbiOVFaliagEbt3iH5rgWKVicDQEX955OgKK60T9yn1kprD5/non2i3QNX7xG80MUzS9KZYBmXX3dwg9YVzFHQw90ylMGVgYGB/RRip/zvtGpmLE/qI9aowzU78/wErf+jdLsIvum5gDRZ06be7fK5MuVM/ygHCvhT0ET6DThDsujRcLrkAaQNfyt2LpTscw6ij5FUpXhjby4+XObWcTI9AUy8sqZF2vKYHxaFJx9HWuLtTlrb9sesiz2k9biVb5rr06ZDSWWuSXj/UicGUa4YC4OiWMnAb0wuJkxWdoFywb2DRPkXTaSVpIuwveKuU8QweAnv+COpZcz3fyxLLGSjAEA8BxkAa/kyX4KJsXs9h2R0UghQX76ozc/GlzPRZRhNTBI8cqlrzMy/bVnWmbZdZtDqWUgjjaNyprwNCujQrT5XlGIov2LTQmAuasjbTl84xttMCyM1wHQJ9vDwf6zqkKo5mh9X4eEHg5NcpUeaJm9hkP/fpIgKIFEhjWwFE+wozxlKHEX6A7b5r0MXDlW0HicEwbmFYJfzFfq+llPSfBkFkmZWpDcyf5dTCMrcvXV1ti 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)(39860400002)(366004)(346002)(136003)(396003)(376002)(451199015)(316002)(110136005)(186003)(36756003)(2616005)(6506007)(2906002)(8936002)(26005)(86362001)(41300700001)(83380400001)(6512007)(6666004)(66946007)(66556008)(66476007)(5660300002)(8676002)(6486002)(478600001)(38100700002)(4216001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ObBtbJrJut4oy+aseYZHGD7rUhJiXRbweptDkixfJKZs//+idBBn9+8J9SOgFlmCVTWtw905gZ+co3/CZMfNaXC4lcVIfAT+0oEdyjnxfUuJhU0G34ffh2BpA/M94I/Xc3rSFv1QU/77Vx5BtEKjybKTrDA/Hs0RSDVl+jfAP9vD3SoPDXNJxCujTUbawOCYrfsDcEz2ZtrpJrckBm07CaCFG/xbozYDkPSRv0L15vE3swQjsfjuj+4MdFdTKQFcpJybOTgXgZdGNdIIJzt3YPgRK1vdhMslGQnsvHjAu6NAx0ft20wTk0csAVXhXEliTl1crWSq7ElKJbpiQ68THHm1SFnZnsoJ/BYX57MZ5BZXGDiVZANhulrTWLjdb84n8/UvY4oygxyV5Afa2P3FNVAGm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3Yl+rDbVnN7TVxj4dEWy3nlXXPkPof6vq3yx8BqwWG/vNi4dTTgolm7bazfWVdM2OmAbk7/zmS2OW5xQw9S7nQZyqan80k= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 232d46c7-73e7-4261-29d5-08dab06ecc43 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2022 18:38:34.8222 (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: /8xeY9ZNvvW1dY4+PJCggxUNtJSG6eIfiy4Cf5NXlyKC5YedVKgc3b3hFPK1D/T7 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7161 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org As with the previous patch EEH is always enabled if SPAPR_TCE_IOMMU, so move this last bit of code into the main module. Now that this function only processes VFIO_EEH_PE_OP remove a level of indenting as well, it is only called by a case statement that already checked VFIO_EEH_PE_OP. This eliminates an unnecessary module and SPAPR code in a global header. Signed-off-by: Jason Gunthorpe Reviewed-by: Christoph Hellwig --- drivers/vfio/Makefile | 1 - drivers/vfio/vfio_iommu_spapr_tce.c | 65 ++++++++++++++++++++- drivers/vfio/vfio_spapr_eeh.c | 88 ----------------------------- include/linux/vfio.h | 12 ---- 4 files changed, 63 insertions(+), 103 deletions(-) delete mode 100644 drivers/vfio/vfio_spapr_eeh.c diff --git a/drivers/vfio/Makefile b/drivers/vfio/Makefile index b693a1169286f8..50b8e8e3fb10dd 100644 --- a/drivers/vfio/Makefile +++ b/drivers/vfio/Makefile @@ -10,7 +10,6 @@ vfio-y += vfio_main.o \ obj-$(CONFIG_VFIO_VIRQFD) += vfio_virqfd.o obj-$(CONFIG_VFIO_IOMMU_TYPE1) += vfio_iommu_type1.o obj-$(CONFIG_VFIO_IOMMU_SPAPR_TCE) += vfio_iommu_spapr_tce.o -obj-$(CONFIG_VFIO_SPAPR_EEH) += vfio_spapr_eeh.o obj-$(CONFIG_VFIO_PCI) += pci/ obj-$(CONFIG_VFIO_PLATFORM) += platform/ obj-$(CONFIG_VFIO_MDEV) += mdev/ diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c index 73cec2beae70b1..3ea0e7b75c2455 100644 --- a/drivers/vfio/vfio_iommu_spapr_tce.c +++ b/drivers/vfio/vfio_iommu_spapr_tce.c @@ -773,6 +773,68 @@ static long tce_iommu_create_default_window(struct tce_container *container) return ret; } +static long vfio_spapr_ioctl_eeh_pe_op(struct iommu_group *group, + unsigned long arg) +{ + struct eeh_pe *pe; + struct vfio_eeh_pe_op op; + unsigned long minsz; + long ret = -EINVAL; + + pe = eeh_iommu_group_to_pe(group); + if (!pe) + return -ENODEV; + + minsz = offsetofend(struct vfio_eeh_pe_op, op); + if (copy_from_user(&op, (void __user *)arg, minsz)) + return -EFAULT; + if (op.argsz < minsz || op.flags) + return -EINVAL; + + switch (op.op) { + case VFIO_EEH_PE_DISABLE: + ret = eeh_pe_set_option(pe, EEH_OPT_DISABLE); + break; + case VFIO_EEH_PE_ENABLE: + ret = eeh_pe_set_option(pe, EEH_OPT_ENABLE); + break; + case VFIO_EEH_PE_UNFREEZE_IO: + ret = eeh_pe_set_option(pe, EEH_OPT_THAW_MMIO); + break; + case VFIO_EEH_PE_UNFREEZE_DMA: + ret = eeh_pe_set_option(pe, EEH_OPT_THAW_DMA); + break; + case VFIO_EEH_PE_GET_STATE: + ret = eeh_pe_get_state(pe); + break; + case VFIO_EEH_PE_RESET_DEACTIVATE: + ret = eeh_pe_reset(pe, EEH_RESET_DEACTIVATE, true); + break; + case VFIO_EEH_PE_RESET_HOT: + ret = eeh_pe_reset(pe, EEH_RESET_HOT, true); + break; + case VFIO_EEH_PE_RESET_FUNDAMENTAL: + ret = eeh_pe_reset(pe, EEH_RESET_FUNDAMENTAL, true); + break; + case VFIO_EEH_PE_CONFIGURE: + ret = eeh_pe_configure(pe); + break; + case VFIO_EEH_PE_INJECT_ERR: + minsz = offsetofend(struct vfio_eeh_pe_op, err.mask); + if (op.argsz < minsz) + return -EINVAL; + if (copy_from_user(&op, (void __user *)arg, minsz)) + return -EFAULT; + + ret = eeh_pe_inject_err(pe, op.err.type, op.err.func, + op.err.addr, op.err.mask); + break; + default: + ret = -EINVAL; + } + return ret; +} + static long tce_iommu_ioctl(void *iommu_data, unsigned int cmd, unsigned long arg) { @@ -1044,8 +1106,7 @@ static long tce_iommu_ioctl(void *iommu_data, ret = 0; list_for_each_entry(tcegrp, &container->group_list, next) { - ret = vfio_spapr_iommu_eeh_ioctl(tcegrp->grp, - cmd, arg); + ret = vfio_spapr_ioctl_eeh_pe_op(tcegrp->grp, arg); if (ret) return ret; } diff --git a/drivers/vfio/vfio_spapr_eeh.c b/drivers/vfio/vfio_spapr_eeh.c deleted file mode 100644 index 221b1b637e18b0..00000000000000 --- a/drivers/vfio/vfio_spapr_eeh.c +++ /dev/null @@ -1,88 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * EEH functionality support for VFIO devices. The feature is only - * available on sPAPR compatible platforms. - * - * Copyright Gavin Shan, IBM Corporation 2014. - */ - -#include -#include -#include -#include - -#define DRIVER_VERSION "0.1" -#define DRIVER_AUTHOR "Gavin Shan, IBM Corporation" -#define DRIVER_DESC "VFIO IOMMU SPAPR EEH" - -long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group, - unsigned int cmd, unsigned long arg) -{ - struct eeh_pe *pe; - struct vfio_eeh_pe_op op; - unsigned long minsz; - long ret = -EINVAL; - - switch (cmd) { - case VFIO_EEH_PE_OP: - pe = eeh_iommu_group_to_pe(group); - if (!pe) - return -ENODEV; - - minsz = offsetofend(struct vfio_eeh_pe_op, op); - if (copy_from_user(&op, (void __user *)arg, minsz)) - return -EFAULT; - if (op.argsz < minsz || op.flags) - return -EINVAL; - - switch (op.op) { - case VFIO_EEH_PE_DISABLE: - ret = eeh_pe_set_option(pe, EEH_OPT_DISABLE); - break; - case VFIO_EEH_PE_ENABLE: - ret = eeh_pe_set_option(pe, EEH_OPT_ENABLE); - break; - case VFIO_EEH_PE_UNFREEZE_IO: - ret = eeh_pe_set_option(pe, EEH_OPT_THAW_MMIO); - break; - case VFIO_EEH_PE_UNFREEZE_DMA: - ret = eeh_pe_set_option(pe, EEH_OPT_THAW_DMA); - break; - case VFIO_EEH_PE_GET_STATE: - ret = eeh_pe_get_state(pe); - break; - case VFIO_EEH_PE_RESET_DEACTIVATE: - ret = eeh_pe_reset(pe, EEH_RESET_DEACTIVATE, true); - break; - case VFIO_EEH_PE_RESET_HOT: - ret = eeh_pe_reset(pe, EEH_RESET_HOT, true); - break; - case VFIO_EEH_PE_RESET_FUNDAMENTAL: - ret = eeh_pe_reset(pe, EEH_RESET_FUNDAMENTAL, true); - break; - case VFIO_EEH_PE_CONFIGURE: - ret = eeh_pe_configure(pe); - break; - case VFIO_EEH_PE_INJECT_ERR: - minsz = offsetofend(struct vfio_eeh_pe_op, err.mask); - if (op.argsz < minsz) - return -EINVAL; - if (copy_from_user(&op, (void __user *)arg, minsz)) - return -EFAULT; - - ret = eeh_pe_inject_err(pe, op.err.type, op.err.func, - op.err.addr, op.err.mask); - break; - default: - ret = -EINVAL; - } - } - - return ret; -} -EXPORT_SYMBOL_GPL(vfio_spapr_iommu_eeh_ioctl); - -MODULE_VERSION(DRIVER_VERSION); -MODULE_LICENSE("GPL v2"); -MODULE_AUTHOR(DRIVER_AUTHOR); -MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/include/linux/vfio.h b/include/linux/vfio.h index e8a5a9cdb9067f..bd9faaab85de18 100644 --- a/include/linux/vfio.h +++ b/include/linux/vfio.h @@ -231,18 +231,6 @@ int vfio_set_irqs_validate_and_prepare(struct vfio_irq_set *hdr, int num_irqs, int max_irq_type, size_t *data_size); -#if IS_ENABLED(CONFIG_VFIO_SPAPR_EEH) -long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group, unsigned int cmd, - unsigned long arg); -#else -static inline long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group, - unsigned int cmd, - unsigned long arg) -{ - return -ENOTTY; -} -#endif /* CONFIG_VFIO_SPAPR_EEH */ - /* * IRQfd - generic */ From patchwork Mon Oct 17 18:38:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13009268 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 AD1F2C433FE for ; Mon, 17 Oct 2022 18:38:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230520AbiJQSis (ORCPT ); Mon, 17 Oct 2022 14:38:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230110AbiJQSio (ORCPT ); Mon, 17 Oct 2022 14:38:44 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2048.outbound.protection.outlook.com [40.107.243.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D6C072FD3 for ; Mon, 17 Oct 2022 11:38:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XGiXu/OQSQiR12Hd2558Segbyg9G5rF9kJK664WcvmmTQKXxeuKWV9ioRdFHkbsz/QKKxFBMErT2H8iPrs1neZrxR1o6TW82WFOyFHUFynRUhoy3Ah1eO3Y3ux+fjnz+ABomO5gm6Cnqx8b1kUqTmAiWE2GcmfWAPnqeAcUpyYwwzyB70tsiyGS3ZKuiyrHLu05OqAFPRHqj3Erw8Bl2RvgLMZRymMmzbv48ND0AG8dfPN9hdhO2Kyvm0oxri0gk/k9LGRv16d4d8olt+sBHa9dNlzeLnpaxjMhQy3mToRF4j2IxQ8Ew7B69q7nTySMNqPtXXUboK3BwI6HoHsaT9w== 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=ssUwQKateaRIOZY0rEuKN0gVaI/OrWKnhxHdl6RkhAc=; b=cJNVpfpUuGTzKnyelMEDcmPjTAVqLFnXywfsdux4XiBLmokqOncd6InnoLKGXtZfth4NnAXe8L2vYcaNrPjeb26jQBsfXaLcc01DUk0Tj6p0S6lmv1s+axhW2clMRdcq2D8VRgVAEwqniV2f0wNJWiyldCeCY3nxwgZ3LbayBuXX1Og+/4umViOdlP1CCDidz5nzuEUXA4kj1UHYklfr6lsbPiKD2X88GnxI5mxyyjPY/nLkaMf741u4NXPjT614wxXFZ5U955o3PQ/Wxbk3B/GgoWTE1lIKtt2GnzIQpKUJpLJ8xwuHdiazLWSe5YwgqUcNM5uepgw9mvk8mr0QTQ== 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=ssUwQKateaRIOZY0rEuKN0gVaI/OrWKnhxHdl6RkhAc=; b=c7fSm9YNiBtfvAygGJm7Z1nmXTo1q9twxUjegSMeeo4PDbmmR4zMPIdl2i8tuyqDshkraJIUpZX6dQbvUxChJ4HbO5APipgPjK85fd32l561ITP+HCCASdeQlRd/3shS+BkTXo/rGEozbfCo67MQ43fCegT8KDdM1ieJLPoKwozLrZCM68hJvu+GMFx7GgxmeYwiDFw7OhiCuU5rYjXPtKoSXtySV6CJwrpneXGaCylDT559Nggd7s+X3ONyf0fGsVFJgT+pS+q0AhWAkF9H512bGA+bHjCIwy6Af4hSWhwFATDCc/wh97Qd1xXK04DvuSDhW+j+B1nGhLphPUlHtQ== 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 PH7PR12MB7161.namprd12.prod.outlook.com (2603:10b6:510:200::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30; Mon, 17 Oct 2022 18:38:37 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::7a81:a4e4:bb9c:d1de]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::7a81:a4e4:bb9c:d1de%6]) with mapi id 15.20.5723.033; Mon, 17 Oct 2022 18:38:37 +0000 From: Jason Gunthorpe To: Alex Williamson , Cornelia Huck , kvm@vger.kernel.org Subject: [PATCH v3 4/5] vfio: Remove CONFIG_VFIO_SPAPR_EEH Date: Mon, 17 Oct 2022 15:38:32 -0300 Message-Id: <4-v3-8db96837cdf9+784-vfio_modules_jgg@nvidia.com> In-Reply-To: <0-v3-8db96837cdf9+784-vfio_modules_jgg@nvidia.com> References: X-ClientProxiedBy: BL1PR13CA0155.namprd13.prod.outlook.com (2603:10b6:208:2bd::10) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|PH7PR12MB7161:EE_ X-MS-Office365-Filtering-Correlation-Id: aab6a85b-5da0-4548-0655-08dab06eccea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZEHsxUGp+3JtlgEiiQO8WXHngyVI703JgoIYDQGVWr8BOwJSfxsvqN277xepedJhpJv9e6ztDHKqXhuTAaOXZw1Z7gyNRwRrcNDpdS7AbNUewlJ2wuE09DqBRByfdCVIxFn5IpILf62J3mCiPhwdexw5HY3/0qeMFAZcWyHZN3FOcKfi6PtOCIhMX6HjPQZTGuyqp9S2+wuK83wuqXaHRdxD22ClUdtBC5htTM45jeVWT7n7qMI0ssiyR2UwbMZJSMBV5lYMeUTeRDszBeLfc6iwTugJll3GFl2SEOX2ryYG8GoLBdXN+38z6q6UZwFP+VOlybyVoS14OGYHixiRC4CJTmsbpL7HyXH7Je0QwnlAnFEJyqK0oifONhUN6by3KqwxPBhBgDc1IHkuE8khVM3Mx7PAL9UrBY7sLTN+YZyjO8xTI7muu18/QNobzdKrTd5z+PXdNTOIeRR+ovv3pP2ojIav7oGA534OBQ7DxeNiAfL1SCpqjjLa/wlINpljjG5CFjMuwdpxBFGAPbQvJqqZEHvgeebflwLIWffcTcdrQ10JT+RxAA/k11eMp9Z4Q2Qi+4qZ++2TNF89XxmTpz7/gFXBkdgHQ42FB7TsarY1E2+PljicEO6W/zFP6PWj9d3pkykl91yygj0Wr8ZLEMv4shZ33T32JccVjLVKpPMMJkK1UX70tOca+eKslNFyPpQEhayeYFGeWBWqWCSIAKmo2it08lxoiTnHB0HGqd7CPMVy3mdySDhNxMVTGtiH 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)(39860400002)(366004)(346002)(136003)(396003)(376002)(451199015)(316002)(110136005)(186003)(36756003)(2616005)(6506007)(2906002)(8936002)(26005)(86362001)(41300700001)(83380400001)(6512007)(6666004)(66946007)(66556008)(66476007)(5660300002)(8676002)(6486002)(478600001)(38100700002)(4216001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ykJofLIfG9Ta9phZgS7A2e3pzVbMb28LxEiGbkhRyStZUHf5WCUnldpKv+Ge3hIihO5+LACs28mvxDVv/HgEJNvoIk0bCFfc1BStdi1ZZAmDUFfiAt6e313oE//ZRa1VqKcKxK8JHLV7G8Q9cufqzvGmlgMMyzQA9fqonyxoeJXgZUxLdoHcUwmJ4bl73DLuITThJxrmusfgyMWXXpyT3CRwORoiMDQZWXvQ6Po+GD1zf1hTxLIviF6YDw7qbPszOCYhuOhgzjaBeKdEUznIJpkgbDTIxK3y49RO9J3/e1USuF2ZrXB7jASogizKofP5I92F0QqwRJ6Ci2/F54ZRXhZB40EdWN3P4GUG2JiwKGSbJE8Gcc4UNmXIMPITXotlMg5Gp/Q4hPYB3VdgiUbT9nCJ7VHhp5HiOQnehevMHoj3j/DsiE4zM8AI2y0qnZkFa4k24nXrSz0+oXlgM01U8OgBmStHRQwkRUz6svbUdNNh0LGfKdtU+ZInSDOenq2Iwzda4lJDYmF0LfvNaLTvPtr560FcqYwf7uN0Y728WVndyrWGdD1tw54+8kNMxhLXPaQ/6cINr6heO4bGkiPOwoXH5L8v1GcXvmus64V9E9IM9KYxYBjvRaRw4RKeV076bVKPSjoWsHG/rcfzsUsm4Sdb1aVj515vqSupC5JUHKRKKOwI8X7EEWLBHyKQiyfeZV/HkiZxNXMF+LgRNfIYK5kypz/5aY3maRUUvRVjSWkNZ0xgUFCIWnnI9qaaHC9VahCzRy2Hoc5A6RSmikIUEUsBZMSosgMIN3rvnY1kL4La/qkOHLj0Q5vggcE9yQytijFqEz44ybsdNWYQnKyt7ebYLTDxu1gvQzwUUZdkzrPQZIsK6GBdsBLoNu2GsjCRBYsm30kTMxgZfzbPB7c/proE/xnaoBz+o9srwTp8cTUcRbZdUd+AqPOfwhxq2MbGxDvnMe7MjGHSx12Zy4CHB69ikrroneYW4hfraOGyK9KXayRjin41kzP8y4gqdragbAutkMD1mheISG9unbu8qmRy1CHo+74SJwK9c1Zge4c5e8vSzIoY/zoMPl6exqOgCATRNYReK7p1HIu1+Kdaz7zI82vM5oj+9japX4eleKITS2quVo7nLCvC8IPlodrDWcPjIwOOW5XqbU1CdORCb5O42IjouE+J+iMwVcVB24eJyXM4SIXwFy9UcyRNsZ6p+lz0UoWrJGU9iN5qYnCuLJIhzXFmSL3FfN9e/S7Fo4kbDRZprETkj24B2Lb/llJLAbIitPxqRYJ9hYr8Ywhz1Y120LPIYSV9TmX54b7GBT7NV0yl0RCBktt3XUKh5ntRbRu0zHCYbpdESc/IcCx5KubCN1+c1cJZqGyHWGX9yYvjlqU267x9I8LvgnewUdFWzn1+O10WKr7HBqKNQo6ky6VEvp+tGdcfgJyz39RJB/VY0aur5yMUx/icOQoYbk2Un+q0r3QdWGOgEtXqvEnljm0ZmTRgxtgolQ07iOqjlYlHVyMRuMdwQxmUog6mE73XDZAnNfuR5+1v+FP6+sFRPlZVrpVpEcna8WJR2uiw1DM= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: aab6a85b-5da0-4548-0655-08dab06eccea X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2022 18:38:35.8532 (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: xlcfKbFvdjGg2FjpuzvFmYsydgTgGDkZH+5qY3A4Hv3l/PVlPlfYI/+yo+WDlqbj X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7161 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org We don't need a kconfig symbol for this, just directly test CONFIG_EEH in the one remaining place that needs it. Signed-off-by: Jason Gunthorpe --- drivers/vfio/Kconfig | 5 ----- drivers/vfio/pci/vfio_pci_core.c | 6 +++--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/vfio/Kconfig b/drivers/vfio/Kconfig index 86c381ceb9a1e9..d25b91adfd64cd 100644 --- a/drivers/vfio/Kconfig +++ b/drivers/vfio/Kconfig @@ -20,11 +20,6 @@ config VFIO_IOMMU_SPAPR_TCE depends on SPAPR_TCE_IOMMU default VFIO -config VFIO_SPAPR_EEH - tristate - depends on EEH && VFIO_IOMMU_SPAPR_TCE - default VFIO - config VFIO_VIRQFD tristate select EVENTFD diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c index c8b8a7a03eae7e..6fe6b27475b75a 100644 --- a/drivers/vfio/pci/vfio_pci_core.c +++ b/drivers/vfio/pci/vfio_pci_core.c @@ -27,7 +27,7 @@ #include #include #include -#if IS_ENABLED(CONFIG_VFIO_SPAPR_EEH) +#if IS_ENABLED(CONFIG_EEH) && IS_ENABLED(CONFIG_VFIO_IOMMU_SPAPR_TCE) #include #endif @@ -689,7 +689,7 @@ 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); } -#if IS_ENABLED(CONFIG_VFIO_SPAPR_EEH) +#if IS_ENABLED(CONFIG_EEH) && IS_ENABLED(CONFIG_VFIO_IOMMU_SPAPR_TCE) eeh_dev_release(vdev->pdev); #endif vfio_pci_core_disable(vdev); @@ -710,7 +710,7 @@ 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); -#if IS_ENABLED(CONFIG_VFIO_SPAPR_EEH) +#if IS_ENABLED(CONFIG_EEH) && IS_ENABLED(CONFIG_VFIO_IOMMU_SPAPR_TCE) eeh_dev_open(vdev->pdev); #endif From patchwork Mon Oct 17 18:38:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13009264 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 578E9C43217 for ; Mon, 17 Oct 2022 18:38:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230450AbiJQSim (ORCPT ); Mon, 17 Oct 2022 14:38:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229660AbiJQSij (ORCPT ); Mon, 17 Oct 2022 14:38:39 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2057.outbound.protection.outlook.com [40.107.243.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 771EE72B4E for ; Mon, 17 Oct 2022 11:38:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TDeBZrDhNXsWJQULeHkZtEN72LQ3nUVlgXKcECatOSPkDINGTLd96fysirWO5/SUnIhslm9gtEO+UHZrj1kxAnsh36M6s5rWCJ8m6tADYw7S2+GeaHMwzpM9EE50dx3aRt+XL+0fZK52SUBxXSwB4znmpkOlBGxoZYTPN0pr1ngoi3FVZxpZFc9V6ZLpoRgEnpJV1VE4Dglakc5lu6y7NkbSPotnpz7s7UFsZmP7szZO4xMSNwQKwBimFdlubXv2d7w1sY6adAZGmtiKKYXhEI3eIIeRE7LoadiYmK6BLCkheBg2wWn3VXtnGTX/bhBDwVl0tR0f7Ug6z13RVowHOw== 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=2ZBbkWTKB0ZcjrSPTBUdegxvLI/TAYHEVOKvHsM7EX0=; b=b60C8WGXgHLbHU/wyqIMiQ++51UDv/3RSpOtMaZCmORqIFyGanuaDztpI7IF8GvZ8tZcIOCHMhHMYJqh5mZeGqBmZw+aZlEDc1jifp10PoxW47cTfiu6zA1m6VaVwhUkai6SXZL9NOxLQtlFeGnsOboSglrg1hzY0pkrhme/hvRgLEwcIJAT9r6Jyo/KzS7oCkUhGkgFmULT/KDsqDuGdyZJlmAGys4S23arEI6yy3UmV0PkUVi6X23sw1mHDSymtqzKvQQTohN844KcejAiKnvdayAjnWT+lI+KNOKINdcSqytsCXFD4ctJ7cwFV0sKNr0zDt7zFzAddQoodjLDBQ== 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=2ZBbkWTKB0ZcjrSPTBUdegxvLI/TAYHEVOKvHsM7EX0=; b=FWRbO+6CnIailLEGEm32sl57suxWvxdj8PMS04bVx/CItIVkwTO/hWJqYcJQXbqctm8A1DTZ965icnIny3t/a03HGt1kK0zILrdYU6+KN6TlQCBZrhkPKUHvIOtFwRBAYphLa1Osz/bKmZZyET38dibIhojdKog6n7Xrh4ojQ3bzZcABlnsRtiEx1WceQCwLbdqf1EqWLAeL3TXTbLhm/Nnzbtd+MVLRK3SE9vvjpaLyCh9HRhTdjXhpkN/ylu+JFh8O/I7RJylbLR2rd6kJVdjXT+i7Kxd8Dwi9LajyBpHPpEzDcL/iwavYX12SxKAMtpuEfTiHXeHAGoxLjfpkZw== 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 PH7PR12MB7161.namprd12.prod.outlook.com (2603:10b6:510:200::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30; Mon, 17 Oct 2022 18:38:36 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::7a81:a4e4:bb9c:d1de]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::7a81:a4e4:bb9c:d1de%6]) with mapi id 15.20.5723.033; Mon, 17 Oct 2022 18:38:35 +0000 From: Jason Gunthorpe To: Alex Williamson , Cornelia Huck , kvm@vger.kernel.org Subject: [PATCH v3 5/5] vfio: Fold vfio_virqfd.ko into vfio.ko Date: Mon, 17 Oct 2022 15:38:33 -0300 Message-Id: <5-v3-8db96837cdf9+784-vfio_modules_jgg@nvidia.com> In-Reply-To: <0-v3-8db96837cdf9+784-vfio_modules_jgg@nvidia.com> References: X-ClientProxiedBy: BL1PR13CA0169.namprd13.prod.outlook.com (2603:10b6:208:2bd::24) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|PH7PR12MB7161:EE_ X-MS-Office365-Filtering-Correlation-Id: 3854594c-a89b-4e26-c790-08dab06ecc40 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DciQb37WhMlfK0hsETFPlKutw54vbzqJy0+bfFVjwL/ih89Fyz5U0yhj1FS4pwuL0YUVea+FbbGiSumYo2gur70pwiD0AUnucDD1ptDCxw1hf/EWKEcwiVMoRStBiKerOwiov855ZwQI4SNbR1wGCqgAZoD+/5AL7nCVuF/jXkqkKuOje38iaoWlMzxT8aYYUjsZPKHoJaUmlqq7pgLq/lC6wLADszUi4vUrCMp8pxV3A8PCKEtPeA/hO0zAmQtTeQ2iFNijA1uRTYPhLQZtnRo94CcYtcvdKQ6qHFfknqcr6/ov7p2lgtMtzKkOLA2BbEgF0tCCWE1XjT7W8iPFJ77Pk0X3/JcJ4jKTJav99JWHLncSq0AqDOI4iIPQo8em7vJgX77lSw51JDTiL8fCOXWOKsBplw5VcdlGqYRvq8zQ1hxNOReO1+n3byIQUYA/OEbi9dEVjjtb1em1osNGs+/KTbaAVhHMyBDeCn/4FBShJ83JdL1bqruYeYOsgfyZjvEr5FM4pHx5ld6Y7UCZJE6Fn11FbZdKXMlfgP1EcCr3DcbKwpQinTMko67Y9hpzBYRfNP/3BtEAXDZnoadlILAZM9a291Pm3aYJU/BriS4na2akgYfXRW5h15nYSyPyicXzaxmeJFmzdeacfYRBVTrHpQsWOQiMYajwhYR/QGFfdJ6NxlUAMAkYL5JVvblo0xUmYzSOl4EBS4rTrMFPLud5rONu6vI4U2CLOnT5jXhoJk5Hp1f9SDLmrnuaBi5s 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)(39860400002)(366004)(346002)(136003)(396003)(376002)(451199015)(316002)(110136005)(186003)(36756003)(2616005)(6506007)(2906002)(8936002)(26005)(86362001)(41300700001)(83380400001)(6512007)(66946007)(66556008)(66476007)(5660300002)(8676002)(6486002)(478600001)(38100700002)(4216001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: L+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165574kWDn+3I2IyAaIwUCXU9ltVPFjO8eSZ2i2dDFjvjzSHV4eK9dRkgErx5W4Ch4+IEC8Hz4ixrEG8NF3WOgBdSLoNo92tIThGquZvRK39DAMRAvIASXoIBSbdsXWYpPiIVS+1K8U+OHcWrpnxeiw6QoeztpxAzDcSY5oQThFHcqt6U7MWUrL0Iq9YC88R9SfwbcPreSJkfi0DgzcQo3mPL8/mTfbFZUh8FA7S8PzadxbrYfGQ2a5KdugsEKgI5k+3J1XQl8VPKZeIVbed4tbWYcUBECCGbJjJu27819XexPxurTQ3+I0S8ib4Z2HZWfOqKtOhdSPPtkYeMP9uyDKinanxbnwylpCdTaMsNISKZecY+65nYNeU4pWUdoY8FGuHGq/lu27IZRXnlorNZs5ErAWZiKP/vB73GBiQxqYN9496Ctf7teOCuKQqRQzLsCWFma3Cp/clB2jl4R3Sg3oIpOgQZdQmbHfjXGlgGasBMc+t+8w= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3854594c-a89b-4e26-c790-08dab06ecc40 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2022 18:38:34.8378 (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: K9QBI4ZDPZiSuq6Jhme8CgUETLqMjm/7tH6in6OmPdIMrhXr+nd7CPjkVToB7lKd X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7161 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org This is only 1.8k, putting it in its own module is not really necessary. The kconfig infrastructure is still there to completely remove it for systems that are trying for small footprint. Put it in the main vfio.ko module now that kbuild can support multiple .c files. Signed-off-by: Jason Gunthorpe --- drivers/vfio/Kconfig | 2 +- drivers/vfio/Makefile | 4 +--- drivers/vfio/vfio.h | 13 +++++++++++++ drivers/vfio/vfio_main.c | 7 +++++++ drivers/vfio/virqfd.c | 17 +++-------------- 5 files changed, 25 insertions(+), 18 deletions(-) diff --git a/drivers/vfio/Kconfig b/drivers/vfio/Kconfig index d25b91adfd64cd..0b8d53f63c7e5c 100644 --- a/drivers/vfio/Kconfig +++ b/drivers/vfio/Kconfig @@ -21,7 +21,7 @@ config VFIO_IOMMU_SPAPR_TCE default VFIO config VFIO_VIRQFD - tristate + bool select EVENTFD default n diff --git a/drivers/vfio/Makefile b/drivers/vfio/Makefile index 50b8e8e3fb10dd..0721ed4831c92f 100644 --- a/drivers/vfio/Makefile +++ b/drivers/vfio/Makefile @@ -1,13 +1,11 @@ # SPDX-License-Identifier: GPL-2.0 -vfio_virqfd-y := virqfd.o - obj-$(CONFIG_VFIO) += vfio.o vfio-y += vfio_main.o \ iova_bitmap.o \ container.o +vfio-$(CONFIG_VFIO_VIRQFD) += virqfd.o -obj-$(CONFIG_VFIO_VIRQFD) += vfio_virqfd.o obj-$(CONFIG_VFIO_IOMMU_TYPE1) += vfio_iommu_type1.o obj-$(CONFIG_VFIO_IOMMU_SPAPR_TCE) += vfio_iommu_spapr_tce.o obj-$(CONFIG_VFIO_PCI) += pci/ diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h index bcad54bbab08c4..a7113b4baaa242 100644 --- a/drivers/vfio/vfio.h +++ b/drivers/vfio/vfio.h @@ -124,6 +124,19 @@ long vfio_container_ioctl_check_extension(struct vfio_container *container, int __init vfio_container_init(void); void vfio_container_cleanup(void); +#if IS_ENABLED(CONFIG_VFIO_VIRQFD) +int __init vfio_virqfd_init(void); +void vfio_virqfd_exit(void); +#else +static inline int __init vfio_virqfd_init(void) +{ + return 0; +} +static inline void vfio_virqfd_exit(void) +{ +} +#endif + #ifdef CONFIG_VFIO_NOIOMMU extern bool vfio_noiommu __read_mostly; #else diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c index 2d168793d4e1ce..97d7b88c8fe1f4 100644 --- a/drivers/vfio/vfio_main.c +++ b/drivers/vfio/vfio_main.c @@ -1814,6 +1814,10 @@ static int __init vfio_init(void) if (ret) return ret; + ret = vfio_virqfd_init(); + if (ret) + goto err_virqfd; + /* /dev/vfio/$GROUP */ vfio.class = class_create(THIS_MODULE, "vfio"); if (IS_ERR(vfio.class)) { @@ -1844,6 +1848,8 @@ static int __init vfio_init(void) class_destroy(vfio.class); vfio.class = NULL; err_group_class: + vfio_virqfd_exit(); +err_virqfd: vfio_container_cleanup(); return ret; } @@ -1858,6 +1864,7 @@ static void __exit vfio_cleanup(void) class_destroy(vfio.device_class); vfio.device_class = NULL; class_destroy(vfio.class); + vfio_virqfd_exit(); vfio_container_cleanup(); vfio.class = NULL; xa_destroy(&vfio_device_set_xa); diff --git a/drivers/vfio/virqfd.c b/drivers/vfio/virqfd.c index 414e98d82b02e5..497a17b3786568 100644 --- a/drivers/vfio/virqfd.c +++ b/drivers/vfio/virqfd.c @@ -12,15 +12,12 @@ #include #include #include - -#define DRIVER_VERSION "0.1" -#define DRIVER_AUTHOR "Alex Williamson " -#define DRIVER_DESC "IRQFD support for VFIO bus drivers" +#include "vfio.h" static struct workqueue_struct *vfio_irqfd_cleanup_wq; static DEFINE_SPINLOCK(virqfd_lock); -static int __init vfio_virqfd_init(void) +int __init vfio_virqfd_init(void) { vfio_irqfd_cleanup_wq = create_singlethread_workqueue("vfio-irqfd-cleanup"); @@ -30,7 +27,7 @@ static int __init vfio_virqfd_init(void) return 0; } -static void __exit vfio_virqfd_exit(void) +void vfio_virqfd_exit(void) { destroy_workqueue(vfio_irqfd_cleanup_wq); } @@ -216,11 +213,3 @@ void vfio_virqfd_disable(struct virqfd **pvirqfd) flush_workqueue(vfio_irqfd_cleanup_wq); } EXPORT_SYMBOL_GPL(vfio_virqfd_disable); - -module_init(vfio_virqfd_init); -module_exit(vfio_virqfd_exit); - -MODULE_VERSION(DRIVER_VERSION); -MODULE_LICENSE("GPL v2"); -MODULE_AUTHOR(DRIVER_AUTHOR); -MODULE_DESCRIPTION(DRIVER_DESC);