Message ID | 20230915045423.31630-2-nipun.gupta@amd.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp969446vqi; Fri, 15 Sep 2023 04:25:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFMGMR2dPh7/lziWBHafWl0kY2FdMC84QnBAsaM8RKcEOY85M3kimOw1i/Q6T2qowZxOPvI X-Received: by 2002:a05:6870:610c:b0:1ba:bb13:d007 with SMTP id s12-20020a056870610c00b001babb13d007mr1406013oae.5.1694777116284; Fri, 15 Sep 2023 04:25:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1694777116; cv=pass; d=google.com; s=arc-20160816; b=QBEeZMn8gxh3p8kIwjEcgRhYUsFYDtzpQgoUMjl97hocqKoLfMBkv5PcwPUgaLlnKI TGaB8BDdXGrQAwXYAYnqflBNBL9qspbVma45x0lpSsWFGKSFX5zcvn189YcIdC0AeRLA NsdnqZoTyJsUWOk+5tyliNgnLttOPE0q/z8BxcqKpRKNlYxB6oD83vG/hkCkPJpWgjSz mRtTYTG4ywJDqFm2yXKHnnNPXKr4OHYOgsUH5xsRtHq18RT4NOpcWVg4qdVWw6TsJEFa 7qk55G/xqhpTc6abded9p3/Zf1b093x1Q+X8jaDBUsxWbcBqxoDxCACp8waZ7Ofqa4uF 0VTw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=qqyDlYkLguiypuhViCXOm5TpvHK3PjOwSh0lLfq6OJU=; fh=u0RzIGyOF4RNUxxiywAXX9SKZez48D6UhwtRfYwn0/A=; b=Jwsgrxs8VxU6SkM/4pT+YZ154IEvaC6z4Di+KS3pZUSlUJpf91bkMgGzXlvMd9IF+V ZWDX+NqINUE+TPGsSZ/O4AZdCkBWVXKj/Bt91LYcb8h3xM5XIXOMhYENCZq+NATE32k+ sbBCOXC7Uhsj+RCvbXUf9SMd/LWFVjeLJFLGyZoRmHDWRaB3CggKUcX7UmAAhQiN+U93 MW71FEsEhKO4pgaHdDmFkPeBrOI83WsKhiXJxywmw1unsIXeICV1VbKTqCi/v/A+K36z cnqzFXFTHzBJchuM5saANGBztcmE+E5yl+lbizIA7Z71kG6IGz216maXr46m3K7OcI4B lGaw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=NjW5vCAs; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id o25-20020a635a19000000b005652a295669si3104865pgb.490.2023.09.15.04.25.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 04:25:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=NjW5vCAs; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 301F0837EA4A; Thu, 14 Sep 2023 21:55:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229593AbjIOEzY (ORCPT <rfc822;pwkd43@gmail.com> + 33 others); Fri, 15 Sep 2023 00:55:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229554AbjIOEzV (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 15 Sep 2023 00:55:21 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2067.outbound.protection.outlook.com [40.107.223.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB4812710 for <linux-kernel@vger.kernel.org>; Thu, 14 Sep 2023 21:55:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K5W3yDl6tqEnOj68EpaVfuj1vyKc75xxGOe2Ov7HBsYmuCl8UTkTmbFS65Yd90s/Gmq5C4BhnYlGmmvivwVIjJ+kUOCi0sEN9gRktO1j13KehkbZnuzpsWfQx/f58r160UuFFRQOEJRw1uFahT/ObNy0nTI0rzUqzo5d7bAY+CUS4mg4rdxnN30K4TrPQBiSGWgTMidH2cid5N2EgnOLsvOsEgXb0NBRIBve6mr3BE/69iPQ5MmXtCoeXnpZa2U1Kr6ZSA9crM5+4RFy4JWKtp2uHFen/tS4Ghl8bidvevmWn/gIU3a04kPiygjRR4y5lyOUhyDeXtuWLNQAwS/PxQ== 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=qqyDlYkLguiypuhViCXOm5TpvHK3PjOwSh0lLfq6OJU=; b=Z8TuXzbr+pSob2lpzL1va/zKw9c3LiVHEm4Kq9RzLU2mg74057MUkF5CzcE2iGwHoi3s9FNXTAd5jDtlZMUdT8abLHqGSUDVLMihK4rBAjSdtiBNTuX6AkXKHPOf79b1fkNOVjxN1ER8+xUQHUz1z2h0005fxGnrQGsX1MYYeiwU0Iafp9EMCVV9oo3ZB2w/7pVAKZGjE9USV0Zc9o2+LCexXCdEWx0d/zGE7ppS7Kt8EMsdXaU1bU7w30y4sUTiIEs69e/V48eh2AepNlTIPnpvYZL6JLWnxiBqY+YyEKLskHmiQMDCfQzs/0EJQ+SjssGOOxTrDXm6JDr5t0J6/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linuxfoundation.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); 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=qqyDlYkLguiypuhViCXOm5TpvHK3PjOwSh0lLfq6OJU=; b=NjW5vCAsCsSLnwkyIzJD3VVdcVRlxSHYIEZowspZ+j9Qj6JfPfEGUH0hroARFtIKRRjBwAtwirpiTzawl13Yc5U7DulYk3uuIa+Ugcc9YybicWynzlhvqeHiOTdYPaQL1TV+HzThwV4JHG68odGlrSPhqyp6Tf70j1yEI/mmHN8= Received: from MW4PR03CA0118.namprd03.prod.outlook.com (2603:10b6:303:b7::33) by SA3PR12MB8761.namprd12.prod.outlook.com (2603:10b6:806:312::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.30; Fri, 15 Sep 2023 04:55:07 +0000 Received: from CO1PEPF000044F7.namprd21.prod.outlook.com (2603:10b6:303:b7:cafe::a6) by MW4PR03CA0118.outlook.office365.com (2603:10b6:303:b7::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21 via Frontend Transport; Fri, 15 Sep 2023 04:55:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1PEPF000044F7.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.20 via Frontend Transport; Fri, 15 Sep 2023 04:55:06 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 14 Sep 2023 23:55:02 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 14 Sep 2023 21:55:02 -0700 Received: from xhdipdslab41.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Thu, 14 Sep 2023 23:54:59 -0500 From: Nipun Gupta <nipun.gupta@amd.com> To: <gregkh@linuxfoundation.org>, <alex.williamson@redhat.com>, <linux-kernel@vger.kernel.org> CC: <git@amd.com>, <pieter.jansen-van-vuuren@amd.com>, <nikhil.agarwal@amd.com>, <michal.simek@amd.com>, <abhijit.gangurde@amd.com>, <srivatsa@csail.mit.edu>, Nipun Gupta <nipun.gupta@amd.com>, Shubham Rohila <shubham.rohila@amd.com> Subject: [PATCH v8 2/3] vfio: add bus master feature to device feature ioctl Date: Fri, 15 Sep 2023 10:24:22 +0530 Message-ID: <20230915045423.31630-2-nipun.gupta@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230915045423.31630-1-nipun.gupta@amd.com> References: <20230915045423.31630-1-nipun.gupta@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F7:EE_|SA3PR12MB8761:EE_ X-MS-Office365-Filtering-Correlation-Id: f44eed17-aad6-48b7-91e7-08dbb5a7ee57 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LehUsQFVC1wXdi59RhpAHo7AykBsRcvh5DLvB/fk3SbYaR6ydZjozV44Y7IrgyEfqEMRH3vKp9yDktUgEQi5bIdGoVLKKGOQhox7MUox3CRZ6RIytv6olTraY99KB8i04Sd6bzpR0QtH6n7GhnNJCur7Xsclo1Q7Xy1jjUY+bH5vLJx/vqRyOQJGDgRG7vCnZHLlzquOr0epBtEJfKd++M30mdVwUeaxMuV1/hIShbumhL06YUSC9BiIchiDWSawQsrc9BOiyQ2s8+4ZjhUjyqS6wRnskL9BQrEuOhcgZo8311ebBcUTfuADBJMYEZGUX93UywxONmdWAcCJalVwileq5vV+zt/FI1ZRDs/eLlKWkSV2I0Ul5jiNNOSD+ODfyyzBkYGzvWXK8m2ZygEUWdfhaneFPonsyyqXQm0/r/E7akJ7wabUho7bFj/J87ikyqyAsCmKWtIXgPO1sRdn2Jc4KsPJ3PtkjlOCV0dgx5+miUSla5VG1Vxb59tJ6G5+8svc8fappMj71fFvZ+JBoCokATfDJ3N9g5ZvVRGpv6m2H/ENcys2OJZQyG2/aI/ldyvjEDvGRgW6TyIST29ojEmQlhGlMCzCmPNm602TsgdrIYsytM+GHgcd+ZHtKXLZvNISz0ba9KbDsbun6tge42s6t3BaPsjh2PD+UvxPhzsM1xNMeYEQqcETW7jvaME+BRq3QPpWhLPKdlqwu2dWYTaxON2F7hIWWdFAQqpAkAfRGc/PBwKnXh03dv6B0JJ3yd+/uSr8kNEVmxwZwAYWAA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(346002)(396003)(136003)(376002)(186009)(1800799009)(451199024)(82310400011)(40470700004)(46966006)(36840700001)(82740400003)(5660300002)(70206006)(81166007)(356005)(6666004)(70586007)(36860700001)(86362001)(40460700003)(47076005)(40480700001)(478600001)(426003)(26005)(44832011)(41300700001)(1076003)(83380400001)(8936002)(36756003)(4326008)(2616005)(8676002)(54906003)(110136005)(316002)(2906002)(336012)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 04:55:06.4220 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f44eed17-aad6-48b7-91e7-08dbb5a7ee57 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044F7.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB8761 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 14 Sep 2023 21:55:30 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777102609524487439 X-GMAIL-MSGID: 1777102609524487439 |
Series |
[v8,1/3] cdx: add support for bus mastering
|
|
Commit Message
Gupta, Nipun
Sept. 15, 2023, 4:54 a.m. UTC
add bus mastering control to VFIO_DEVICE_FEATURE IOCTL. The VFIO user can use this feature to enable or disable the Bus Mastering of a device bound to VFIO. Co-developed-by: Shubham Rohila <shubham.rohila@amd.com> Signed-off-by: Shubham Rohila <shubham.rohila@amd.com> Signed-off-by: Nipun Gupta <nipun.gupta@amd.com> --- Changes v7->v8: - None Changes v6->v7: - None Changes v5->v6: - Updated description of VFIO_DEVICE_FEATURE_BUS_MASTER IOCTL - Used 0 for clear and 1 for set bus master operation Changes in v5: - This patch is newly added which proposes a new flag VFIO_DEVICE_FEATURE_BUS_MASTER in VFIO_DEVICE_FEATURE IOCTL. include/uapi/linux/vfio.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h index 20c804bdc09c..6858cd80d597 100644 --- a/include/uapi/linux/vfio.h +++ b/include/uapi/linux/vfio.h @@ -1287,6 +1287,27 @@ struct vfio_device_feature_mig_data_size { #define VFIO_DEVICE_FEATURE_MIG_DATA_SIZE 9 +/** + * Upon VFIO_DEVICE_FEATURE_SET, set or clear the BUS mastering for the device + * based on the operation specified in op flag. + * + * The functionality is incorporated for devices that needs bus master control, + * but the in-band device interface lacks the support. Consequently, it is not + * applicable to PCI devices, as bus master control for PCI devices is managed + * in-band through the configuration space. At present, this feature is supported + * only for CDX devices. + * When the device's BUS MASTER setting is configured as CLEAR, it will result in + * blocking all incoming DMA requests from the device. On the other hand, configuring + * the device's BUS MASTER setting as SET (enable) will grant the device the + * capability to perform DMA to the host memory. + */ +struct vfio_device_feature_bus_master { + __u32 op; +#define VFIO_DEVICE_FEATURE_CLEAR_MASTER 0 /* Clear Bus Master */ +#define VFIO_DEVICE_FEATURE_SET_MASTER 1 /* Set Bus Master */ +}; +#define VFIO_DEVICE_FEATURE_BUS_MASTER 10 + /* -------- API for Type1 VFIO IOMMU -------- */ /**