Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp344902lqb; Thu, 23 May 2024 23:03:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXc+hqTasYkjUpWjhjqerFG/ukZZk9lGhVVV9LlQCF7HLOURA/CIUamj4uqFebzARdt6xp2gUPU+DR39czvJboe+xN5BEnQWbdJANvbqA== X-Google-Smtp-Source: AGHT+IGoncinmHOEatWdOu+7p7Tl5GoS+feZGYr0ASOtvaZO9YlkPKZycDz85MkWWVjox9Rv+MI9 X-Received: by 2002:a54:439a:0:b0:3d1:b36e:43b9 with SMTP id 5614622812f47-3d1b36e4a73mr962973b6e.53.1716530622013; Thu, 23 May 2024 23:03:42 -0700 (PDT) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-794abd604f1si82085085a.767.2024.05.23.23.03.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 23:03:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188348-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=naajt1yb; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-188348-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188348-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A6F721C20CF8 for ; Fri, 24 May 2024 06:03:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5DE09127E38; Fri, 24 May 2024 06:03:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="naajt1yb" Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2082.outbound.protection.outlook.com [40.107.244.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9313F22331; Fri, 24 May 2024 06:03:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.82 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716530613; cv=fail; b=E/vuGxtkSbqTadIz8uKIRItOZgv8Yp3txMAIYbizVRclCvQe4ZrTC/XfMa6mslT1ZBkva79YTmQ58kbMSLBQAtwqDuNweniGX3caXrqq3gQX/wjXuFsDcnMLvDsjtykebPR5ocDkfZ9fcvgndJ0BoR4CRtyyAQJPiySRUf/cGso= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716530613; c=relaxed/simple; bh=9x+cUq2iZpGSEyE43loUE9ZUzEXFIu0T3Q+GPMXxwNc=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LIP6/z+Ju1Ey4TgxL6D7iZt3LndAu5IQGkJWCVB7NW77JcTKQ0kLeuKp3Ab6taxrFVka9FvN4x6EwlJ8lriR5qZdIajqgURJBD9Yu+G0iOfFqxfB3iBcQwGfofG5v9Ec41NwFuQ1bOZPWa6IW7vG8PYY3/9DOg4NocEFmeZroS4= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=naajt1yb; arc=fail smtp.client-ip=40.107.244.82 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YKH+Q+Bo6ZBV9PZxVIHzeiRr32E6DAMUPoSWiY5O4O4497xZp22+GR/bMns9Ezaka0jYFCmWGDsW0mt9N0P+yllqXA+XjZl0s9o6sD0tPcwyGI7Sz0V+tBmgvF36dpNFU06exeknbKN+ci1k2zNvkkpEMiYPsuUaqEF/UTz8zi2hWJ1+Uw4OR+ntILMfiuqk6dHrGDoUTZCcLysgqwoejYKVsXEj9XO/P9Od6DHvzs8ySdWbzT0p4NrU8/TY8KCYF+d9Wtze6npc8oVlLfxBnAXy0Wmv0eSkSScAfPssbvbWhsDrbsGpHJL8oynYZqtqeqKTN55h6sOwLtDg+vrQoQ== 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=ef+2mRRG73lFHbdWJHp0LGQmdCBz434lS9vvUK6BpQI=; b=UHgId3lUNkYEzK9jesN+omCDkgnejkCp7uU50lxW8J9G7OcLqebgCkP4gNvguhbVL0dmfZ9qszn8BdeODRsmGHZnygqKZgEO7WJh/gGajjztsubJP/Y4sZvID6LpJrtmBc+QP1XhxxqTmT2OW7xu1VZhx4wvWf28ljf34IWqt4Lz+sWnuhkgnn+A2GOty3C/yJmSUW+zxO7c3AMj73zG38JCLXBRHzJG6X9OOltyewb/FZvbKhX0jPw+DH7eWDdfzlBwhc38N33J/toRvIBRnVO/P8h4lsff/Y0zIdplZCQJxNvIxs7eydu0l4/mM2lmI9FkAYxip5M3ZurKUXjfTA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=ef+2mRRG73lFHbdWJHp0LGQmdCBz434lS9vvUK6BpQI=; b=naajt1ybsHZ/NhBFObWXZuOVEToWUZo7GLmXn3pcvGbEiXwSjau0p1u81Z7aBITRxB3nziHSWnuj5NamFRKK1YQ6COkBBU3bnnZEIr7+BQqIYw2XDQjzDX8Lr1DIcoVpeMZZeDs56cuwvpRZpcus9zFcNWT2B5JRhlf8xM7YxDcWGwtNad+sxvcaVLxHH36Hibod6MiA3kaAOIb31gjavM5ynLV5Y3pzIPnbQUY9hF0WTHMthP05o9E/n9SUWJbdm4GtgpnFz4sGHy/4B4f98OcFmC+mgK63vhN0krJlDeEcfn9XJGYKRXTih6LmuTRmcSR1f4kDvnIGbK/oTy6Vsw== Received: from DS7PR05CA0003.namprd05.prod.outlook.com (2603:10b6:5:3b9::8) by LV8PR12MB9153.namprd12.prod.outlook.com (2603:10b6:408:185::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.22; Fri, 24 May 2024 06:03:27 +0000 Received: from DS3PEPF000099DB.namprd04.prod.outlook.com (2603:10b6:5:3b9:cafe::ee) by DS7PR05CA0003.outlook.office365.com (2603:10b6:5:3b9::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.19 via Frontend Transport; Fri, 24 May 2024 06:03:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by DS3PEPF000099DB.mail.protection.outlook.com (10.167.17.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.14 via Frontend Transport; Fri, 24 May 2024 06:03:27 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 23 May 2024 23:03:23 -0700 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 23 May 2024 23:03:22 -0700 Received: from nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4 via Frontend Transport; Thu, 23 May 2024 23:03:19 -0700 Date: Thu, 23 May 2024 23:03:17 -0700 From: Nicolin Chen To: "Tian, Kevin" CC: Jason Gunthorpe , "will@kernel.org" , "robin.murphy@arm.com" , "suravee.suthikulpanit@amd.com" , "joro@8bytes.org" , "linux-kernel@vger.kernel.org" , "iommu@lists.linux.dev" , "linux-arm-kernel@lists.infradead.org" , "linux-tegra@vger.kernel.org" , "Liu, Yi L" , "eric.auger@redhat.com" , "vasant.hegde@amd.com" , "jon.grimm@amd.com" , "santosh.shukla@amd.com" , "Dhaval.Giani@amd.com" , "shameerali.kolothum.thodi@huawei.com" Subject: Re: [PATCH RFCv1 12/14] iommufd: Add IOMMUFD_OBJ_VQUEUE and IOMMUFD_CMD_VQUEUE_ALLOC Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099DB:EE_|LV8PR12MB9153:EE_ X-MS-Office365-Filtering-Correlation-Id: 0ca6a3c2-0375-4743-865a-08dc7bb73aaa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|82310400017|36860700004|7416005|1800799015|376005; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?7ZV9Z85+QIj02zzcuhaDd3Rj/8K4W8e/rb1MwuSJ+pPxO2BoAl+ogKKU1Qrk?= =?us-ascii?Q?+zok5IKl44+5i12K2W5mV+8rUExTvuWDy5S0A/0LkyznfNXiIN1yw+yV4IjS?= =?us-ascii?Q?sua4CP4LaXtTCk7Wt4avbvA7fgeSVjLHQH5X9xGVFbpwKgpjTGRGYG2xYZKH?= =?us-ascii?Q?jmCaR6xIAw2lXQVOul9LboIiQiCJyobWAcwp2A1xzPJq7cIRY0K8uvCZ5Iy0?= =?us-ascii?Q?qXTmW4b5FQkWdHJyMiUwcItuOExb3L/1Gv7xuYMEHOrqjJNnQsT4ucBgrBjz?= =?us-ascii?Q?yj3Dfxj22sdljbfgIMIkQj9xjTC2HZbO7c+lWuKkMkSxGfHLAlBKGHAFK2HE?= =?us-ascii?Q?pfguo2Hr7dyKUxkQ0FNoqq+MC0U9dYVKOkJE6L8n0IUdwvvn0Ju0S5AvIUII?= =?us-ascii?Q?L3NqIh73vJlxDVpT4UMWkEikF2vUKBTqFlwyiZJhqT0AXoNzU/Ab5JZvm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Ae92emEBRfYLhngOjQNtDDBXh6RcqykazRH9MB?= =?us-ascii?Q?9OsiP2CkYKq0XCOjG7nnsvwaaf09?= X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230031)(82310400017)(36860700004)(7416005)(1800799015)(376005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2024 06:03:27.1847 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0ca6a3c2-0375-4743-865a-08dc7bb73aaa X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099DB.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9153 On Fri, May 24, 2024 at 05:26:50AM +0000, Tian, Kevin wrote: > External email: Use caution opening links or attachments > > > > From: Nicolin Chen > > Sent: Friday, May 24, 2024 12:42 PM > > > > On Thu, May 23, 2024 at 06:57:15AM +0000, Tian, Kevin wrote: > > > > From: Jason Gunthorpe > > > > Sent: Sunday, May 12, 2024 11:02 PM > > > > > > > > On Fri, Apr 12, 2024 at 08:47:09PM -0700, Nicolin Chen wrote: > > > > > > > > > +/** > > > > > + * struct iommu_vqueue_alloc - ioctl(IOMMU_VQUEUE_ALLOC) > > > > > + * @size: sizeof(struct iommu_vqueue_alloc) > > > > > + * @flags: Must be 0 > > > > > + * @viommu_id: viommu ID to associate the virtual queue with > > > > > + * @out_vqueue_id: The ID of the new virtual queue > > > > > + * @data_type: One of enum iommu_vqueue_data_type > > > > > + * @data_len: Length of the type specific data > > > > > + * @data_uptr: User pointer to the type specific data > > > > > + * > > > > > + * Allocate an virtual queue object for driver-specific HW-accelerated > > > > queue > > > > > + */ > > > > > + > > > > > +struct iommu_vqueue_alloc { > > > > > + __u32 size; > > > > > + __u32 flags; > > > > > + __u32 viommu_id; > > > > > + __u32 out_vqueue_id; > > > > > + __u32 data_type; > > > > > + __u32 data_len; > > > > > + __aligned_u64 data_uptr; > > > > > > > > Some of the iommus will want an IPA here not a user pointer. I think > > > > it is fine API wise, we'd just add a flag to indicate data_uptr is an > > > > IPA. > > > > > > > > > > Presumably each driver will create its own type data which can > > > include any IPA field as vcmdq_base in this patch? > > > > You mean putting a base address field in this common vqueue > > structure? Hmm, I think we could, assuming every queue must > > have a set of base and size info in the guest level. > > > > We could, but my original point was just that it's confusing to > change the meaning of data_uptr. Let's stick it to be driver defined > data and any driver-specific IPA field is defined in that data. Oh, that's copied from IOMMU_HWPT_ALLOC: * @data_uptr: User pointer to the type specific data And it actually makes sense to me to be "type specific" since a driver (AMD VIOMMU for example) might have two different vqueue types (invalidation queue v.s. fault queue)? Thanks Nicolin