Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1560234lqo; Sun, 12 May 2024 07:51:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUsNIdjC20vVLmnZfRku7KqnGPZWB/DQO8mS3inIOc+/V4xX2pIUo0Z3sG1PZYbFt550oRHioo6gvTbZ6/cOjXhM3QUCEet0t81XjVoFg== X-Google-Smtp-Source: AGHT+IEwdU0EMyzu1J1UzgjQO6GNWpX15hiRO73iMhkO2VDKVjOlB6akslK8CsZpfDtSytHom1cs X-Received: by 2002:a05:6402:13d3:b0:572:b83e:e062 with SMTP id 4fb4d7f45d1cf-57332686076mr10441093a12.3.1715525512421; Sun, 12 May 2024 07:51:52 -0700 (PDT) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5733c351da5si4157636a12.481.2024.05.12.07.51.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 07:51:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-176904-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=lB9YQAqz; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-176904-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176904-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 057581F21F06 for ; Sun, 12 May 2024 14:51:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8E1F52E84E; Sun, 12 May 2024 14:51:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="lB9YQAqz" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2043.outbound.protection.outlook.com [40.107.236.43]) (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 E6D861C683; Sun, 12 May 2024 14:51:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.43 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715525503; cv=fail; b=opgVCeeW2eADQo3Td5exFmYX5CGZJ1FYS7S1FTpdGxdXW4K9XFkQST84rz930uoh7im4Y0xEFM+1i7c/rjttiKnSUXPHHpDHs5LqsYDmrnnG3f2rs+eftrmqhyvmKqoE2GOEc+7BZ6zmsEGlecUYr1Hculdp9UkrOXqYQuQ6cug= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715525503; c=relaxed/simple; bh=PdhSWGpuy5ZEKWm4gSxkl3+Pl03pVB22H/jNI9UeVjY=; h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=h4DNyxa286QT1kxyFGDzCisJ221rvjNRibvgCaFAWHDekiKNlaJccTFIKRZRCJEJhWCuOpKT3t4TBdZDjBnTNinLcGBIgGOiJpwUziRcYVuoWu26kOLF2RyLahIw5xSsj7W5SRQ2huwUybyBBAJd96Pf9sPAKSWoFmc9PsbrmaM= 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=lB9YQAqz; arc=fail smtp.client-ip=40.107.236.43 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=YAu4uFJoLp/AyY1m3cbyCLtmzN+jKI3G2aMKe4uKfYENqsTNXEiKcZ0ZeoESFaIYpxasYaWVTDsHHsuX1ns4OmjytBfD6mwes7EBrtn5lRgne/I3DLLg63iFP6mAtz6RAXJh8nyAP1fdDcMSe4riU1vu5v7jrulDdsAqyBnckYlkVi4yIcKL62g8F1QNEkq1lxEY//JbTZVQ4j48WWXDj5tiNeGzDaa6zzGIEq7xAbQat6nV9rx7J2809GC/XOWTHBx78pN7sUtc21tLEmEiLx8c345S4P5gGKMtZnV+9p+N24hZoiI0dzfEiXGXmBgNPlDjMwhHGLt182p1T0NYQA== 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=nJEK71XfV+cv8btD+D/W7LLRXI7zaqEU7iBnzG/Rkls=; b=eArt7RmqQaqgMrWOGmhr7+VTMMaScgn8iPtc5kZAR7+z8qWjA5Di7GBfafwkG0PqLUQ3eXFNNAiP87BcYA5GiOMFuIBwLyyG+wEfwd5olnIwRbbmWGnG7FWZdEnTGNWZQh8cSomeGpn2tnre/w/xOgI6uUBrdhvnr+6FgZAI8lWPnaE+tIPgP4wKhHg+VftD0T0NeB7oEd8mlyHfiXcuaQ9CG8GHEM6EMVbo3Aw8e9nVnLLZ4AiguNiBEggfugSoWBqfPOpAtGaR4YWePFZ7hKnYEyzPilVOIAXtqFRodZhPyfVnSc5qk0kS2OLX13qTRn31nIksTApmIlhpXsgRNA== 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=nJEK71XfV+cv8btD+D/W7LLRXI7zaqEU7iBnzG/Rkls=; b=lB9YQAqzIY8RMdngCwUUHpgASR8OP/9I1uAx8BFOvGXLZ50vXCMBZPyQfUdg36F/XmbnQoxwiHIIif+mLgckzK4KYBnZPfbu/mq30hYwNHoQwsLVrpBVaTL57Jyszrli6Uls1klsa675kZDr9wXGUOtHTPmnj1UjjxtCm1D51igjPeOQqUQtC/TnJVSTdB9OTqYw7YeqOIRdBHijl96E/6wDx8q9MZDo65YbxegsFbZf5aLWqe+5gpes/Grq+jDaBd84OjOtX/IYS7/45rpGck3/IldtKsMpo+WJDxX/5x+owfpR8+2GkGwqWporf0PsPFFIRDgFJ9qLvqb/CW3pIg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DM6PR12MB3849.namprd12.prod.outlook.com (2603:10b6:5:1c7::26) by IA1PR12MB7615.namprd12.prod.outlook.com (2603:10b6:208:428::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.54; Sun, 12 May 2024 14:51:38 +0000 Received: from DM6PR12MB3849.namprd12.prod.outlook.com ([fe80::c296:774b:a5fc:965e]) by DM6PR12MB3849.namprd12.prod.outlook.com ([fe80::c296:774b:a5fc:965e%4]) with mapi id 15.20.7544.052; Sun, 12 May 2024 14:51:38 +0000 Date: Sun, 12 May 2024 11:51:31 -0300 From: Jason Gunthorpe To: Nicolin Chen Cc: will@kernel.org, robin.murphy@arm.com, kevin.tian@intel.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, yi.l.liu@intel.com, 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 07/14] iommufd: Add viommu set/unset_dev_id ops Message-ID: References: <6e57d7b5aa1705bdd547b1cd2aca93d3bf70dfa4.1712978212.git.nicolinc@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6e57d7b5aa1705bdd547b1cd2aca93d3bf70dfa4.1712978212.git.nicolinc@nvidia.com> X-ClientProxiedBy: BY5PR04CA0006.namprd04.prod.outlook.com (2603:10b6:a03:1d0::16) To DM6PR12MB3849.namprd12.prod.outlook.com (2603:10b6:5:1c7::26) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR12MB3849:EE_|IA1PR12MB7615:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b4a1418-3920-4d9a-efba-08dc72930741 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|7416005|1800799015|366007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?5VlnQj/TcBC7JL2QbImCPrQYsuTDlk0hN4+8mXXjiBdZawAusHzbiyUjjYEU?= =?us-ascii?Q?Gmps+pTczHa/z2PSZ4eO716OKKmelAEOqCDY5fXMb3JTSdNUWU4BpvnYV4SO?= =?us-ascii?Q?XnZDc8vkrWqeJNvJhHZ5ugCK80QeOi2DwvxsPvlTkV5iGG8nXscquo6gYQsu?= =?us-ascii?Q?Vp2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= =?us-ascii?Q?OxviWIayOwrL0JI4n7QR9wrRl87Ab5gUEF7jGkyxiPmOnOeX1Kb/lfk1gpFK?= =?us-ascii?Q?3tb1ju2Zg6T86ukw6TxgaK92pXKggMw42JW2xM0jfakAaG+tTTO9tkdnSjof?= =?us-ascii?Q?EXgAlqBB8kyRUxQmLDmMVt2FYQhIEWjP3lv29KuII4m6Yz64C/FKJfmsriv3?= =?us-ascii?Q?E76R8wNlzzJsWiG6oSJeqDOWn0TAjn9KderLRlXW1w=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB3849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(7416005)(1800799015)(366007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?RtonTzpwzDJ24qy1cJ7iuMT5QRcJhhlAfqrJuZaeD2N8mP28INlCnrgAu+GF?= =?us-ascii?Q?2TywhUwsNMTLppO7tflc8OFdHUOmJrvYSjnbfNxRUDsGpCHtoKroMn6qp7F4?= =?us-ascii?Q?6Ko73ROWPGkOD2BLLfOkGZpZwQiUdJeviyZ4SKuCMhSJ1R5gutAMhkhbuWaJ?= =?us-ascii?Q?HhL0wL9AtN3k10j5sbAuJCNnxBhq2e4RXUK6e025yP/Bqxi6LrjzkQ9wBngD?= =?us-ascii?Q?RZcs6heJU3wrQGUd+JByvlVggZiECwI/0CmhkaAcge8oT251WpjrollPcx3y?= =?us-ascii?Q?9wQS4elCdjGGjVwKnghLSzsI87xtbadv0EN+3t+7qmmlWoPT11ciYaZ85cNq?= =?us-ascii?Q?e7Jmfi39kKCn7xs9XaauDdga8sBJkHsVdcw+6MQKVV2CzPHOSxhJLO3SGXW+?= =?us-ascii?Q?DTOiRnznZYnX4uBA7FbXCHX9ZIz83cOnkgBFTLSfk/9anXvp9A/R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OqqyNJcGR2/D21hOVocltCZypKlYH?= =?us-ascii?Q?9VyIXHnG1N8o9hhAqkbjxt2R1maZRtODoacrV3Dfw388zHkq17e9f8fyb3RL?= =?us-ascii?Q?ECV896a3pDUq2mrfRppSkmMLanJOpKibtm719Uwl3fny4Puy09X3NL05nMIo?= =?us-ascii?Q?wYtzmSn0WhjYyK3OjQKbmNGnMcq+0j84Ov1ptFNMauOHZiKZxZpWNed2Vz0g?= =?us-ascii?Q?udiFaI9py1sgrmaAfA8AVyFDCTwRAMHzq4rlgugh?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b4a1418-3920-4d9a-efba-08dc72930741 X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2024 14:51:38.8778 (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: 5uPqpa3jKkr34pAp/sQOnz4IvSJnlsjJVGnmi8/zQicoOomP9XTasyOjQ/JRyfuf X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7615 On Fri, Apr 12, 2024 at 08:47:04PM -0700, Nicolin Chen wrote: > @@ -94,9 +94,13 @@ struct iommufd_viommu { > * struct iommufd_viommu_ops - viommu specific operations > * @free: Free all driver-specific parts of an iommufd_viommu. The memory > * of the entire viommu will be free-ed by iommufd core > + * @set/unset_dev_id: set/unset a user space virtual id for a device > */ > struct iommufd_viommu_ops { > void (*free)(struct iommufd_viommu *viommu); > + int (*set_dev_id)(struct iommufd_viommu *viommu, > + struct device *dev, u64 dev_id); > + void (*unset_dev_id)(struct iommufd_viommu *viommu, struct > device *dev); Actually, looking at this more closely, why doesn't the core pass in dev_id to unset_dev_id? Not doing so seems like it will crease a bunch of unnecessary work for the driver. Jason