Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp278255rdg; Tue, 10 Oct 2023 09:58:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IERzCWBB29E6cUzB4GMBkeC+z/owGGtiVNZPXfPMDZLY/RG4KbSnKEeRK2nXswgqUKwK4qN X-Received: by 2002:a17:902:ecd1:b0:1c0:cbaf:6930 with SMTP id a17-20020a170902ecd100b001c0cbaf6930mr21041734plh.54.1696957139037; Tue, 10 Oct 2023 09:58:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696957139; cv=pass; d=google.com; s=arc-20160816; b=EysMsgAuux11VzqX2CwyC8SG7fh4w5er17DpTgSY98PPWJYRVgkzJ9LOz+2Et1OUES NjWtVsj8FKFkOMpkmsTn4i+yiaIlXYdlvR3VpE5gRwvmFdozz0SOhMOIJuNL0MxCXUbE Q6BxS8ngK619jmh1pI+KlfEDNVlZY1nB7jCQdKKRQnHoa3SjPGSRdnLoM2lM3gNfkvZ+ uy5yd2J9tJvMbQSRwHmXo1k3SB83/LQ5ZmYOaRBJxVExq8aj2wFE/RWo0PZ1i2rfJH/e yJmdE8smfSnriRKnzWtdKz9a4cYD0hH7ku/H6DQpxOFHj2vVEbIHDXXHcZpazJKRQABB 6rtw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=pnMOg4+4nnDBbVWOUOCD8dD1tIrbCfW6ORtABwWKxY0=; fh=mp6ZRZA4LRKdRSDcmzl6ujmp+qmwc3FjQgVN4/c0rcA=; b=q6EdwgQ2UVZcHMRO6O2uzzA+Qpew33WEmqsPxTLV0bXM6G/aKs9P0Erb5GQYRtWQnS 7z8CK9oX2PIDn+UYU0Wt8Ps5HEodA3/O/kI7w8TXu33eHwhKXxELpJdp8v9+bTHU9KIo 2riAdRpKc/Hr1ynJbZbRQcoetm9WzxDECWbsrd0DbzP+9Ya5fs64/V3YIC4jTPsGhDs2 HL4tABPILzlHxhH6j0NqW7q0VVW7dL5QHP8+Oo6dCoNOG1qRyn4ps3dM39AFcN+QU4KP uMeC+GmN3hbD81IL4czITyhuPquqgJIT4H+DsxhVaGjc+4BM7pn51cZQsrch6wZIegT1 HFvQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=Ew5BjMZN; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id f4-20020a170902684400b001c72325d6f4si11830009pln.605.2023.10.10.09.58.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 09:58:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=Ew5BjMZN; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 0555C808E468; Tue, 10 Oct 2023 09:58:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233553AbjJJQ6v (ORCPT + 99 others); Tue, 10 Oct 2023 12:58:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232809AbjJJQ6t (ORCPT ); Tue, 10 Oct 2023 12:58:49 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2059.outbound.protection.outlook.com [40.107.212.59]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E787797; Tue, 10 Oct 2023 09:58:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y0RqTt93KMDgM5afofNRLmhRuSPA/bwlFYESam66iUB1Jj5QYXQbeU+k5dRgdP57XxW9Inpw4RzfTQcW72tRxAH99pzXzPngPikIANtmt+MfMbHNOda+9fs0ycXXc79HXaFclhlVIWoX1UbZlriN6oXqjC+s6kFm2IlS0wEemOuAdze4yvvYwRSuw5M3Puhqdmv9Z3byz9HGLvIkp5LLnAF3lKl0nzEhmiTDLgHBL4xO4BKGLM9xidTbToMGnF/mKaE8RZDdz7X4rwvHgLPxW9kke4GMKGxgM8jyagpUFQ+M+qGvQPjInvr+N4YAADSxDppj4FCX+Um/6Th9f32YkQ== 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=pnMOg4+4nnDBbVWOUOCD8dD1tIrbCfW6ORtABwWKxY0=; b=mqT8o8fnSYijh2k81u9DgT/ownXYUKvtF58MWKemfhRfgDprdP/ZGJgUTyc5/92ivkyhCqFozKzV10dFc/OczjP1fMKb/wXd8exGnxSULVMae7f4Vij+YBdKk2IwaHNrwFF4CFpXx8pC3fHYd1LimYKc1pNOZoFAZbMgIPL0y9+ZxUby2i33ksBeYspuoLlwykt6DzSzHhahN//4T59nnOpZu1SkyVZW/FJoAACXq1TKb6fzEFc5UsQ99RyYWTc21/mFYILiXRUhP8A+nubaMZDwkZCxq3nkDkcuAXumS+6PGTHWaWB0d8QvKFFPSCAEsPp8bvc3xL2S3Zq+poVWhg== 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=pnMOg4+4nnDBbVWOUOCD8dD1tIrbCfW6ORtABwWKxY0=; b=Ew5BjMZNf9b2G62Hfaz7rIqc+YIvKT/UH+bkb3+b+GoWqsrKYnZ42GSgM9pHTA5w+qMc1KGY+Uuj99g2YBqxrGmuDsz0Hl2/AideC1wkflzDLSaLuTxsVQfu7Xx5cX7cMNQH0ONA9CRn9M2Uvsa387lUlFC/AR8X/JGlOG/nzM+Vaw0v32N9IUvGUhTsx0uOmCXysBg8ZUZemtqpQGuZSImyQFitHC2HAczk7Tdzlhm4a6jGGY0shaintYfN8MWBhlJJhFXZWpna5Vc/BF0CDJCWvj8RGiXcaznUfSVatemGDew9DIi9X6JLPpnhZXTf9EojnsJ/u3Y4Z8r5p435/A== 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 PH0PR12MB8800.namprd12.prod.outlook.com (2603:10b6:510:26f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.36; Tue, 10 Oct 2023 16:58:46 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::3f66:c2b6:59eb:78c2]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::3f66:c2b6:59eb:78c2%6]) with mapi id 15.20.6863.032; Tue, 10 Oct 2023 16:58:46 +0000 Date: Tue, 10 Oct 2023 13:58:44 -0300 From: Jason Gunthorpe To: Yi Liu Cc: joro@8bytes.org, alex.williamson@redhat.com, kevin.tian@intel.com, robin.murphy@arm.com, baolu.lu@linux.intel.com, cohuck@redhat.com, eric.auger@redhat.com, nicolinc@nvidia.com, kvm@vger.kernel.org, mjrosato@linux.ibm.com, chao.p.peng@linux.intel.com, yi.y.sun@linux.intel.com, peterx@redhat.com, jasowang@redhat.com, shameerali.kolothum.thodi@huawei.com, lulu@redhat.com, suravee.suthikulpanit@amd.com, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, zhenzhong.duan@intel.com, joao.m.martins@oracle.com Subject: Re: [PATCH v4 01/17] iommu: Add hwpt_type with user_data for domain_alloc_user op Message-ID: <20231010165844.GQ3952@nvidia.com> References: <20230921075138.124099-1-yi.l.liu@intel.com> <20230921075138.124099-2-yi.l.liu@intel.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230921075138.124099-2-yi.l.liu@intel.com> X-ClientProxiedBy: MN2PR10CA0003.namprd10.prod.outlook.com (2603:10b6:208:120::16) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|PH0PR12MB8800:EE_ X-MS-Office365-Filtering-Correlation-Id: 992a9407-2c61-4ee4-5757-08dbc9b22a84 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8QuXDnzXys2vhHRg3Qey3h31AzqXFpFIMju85AIHZNyO9+6BH73AI9ACE4INq41D0XLhnZuIvWu3mA8ZzUflNw5hypyIJ3KGY87e8VROdi3xUqOmgkQO/5bgaBgVjraQLb3BB7PJUHo4qe5MXwMzRtSaUSiEhisulzA5WkSj6spcxTB3D1yqMgFg25ykzudSSgdRUolhKYBnPnPg2jzhqGCqyHdud0ohN19Nb+Dj5WHnofNvZcL8WJ5WimXV2NIj3oIZHYnWGuKkOOUEkt0RmwNhB/HcNdE7ryTH4GvJZ+1NS8bIbI0a3Ublp8ruWKxIDgAHH9GAwaGUzaGBbyHm6gTsvmlIp42KV6fmaEHPYcPpFMLC1udsCuTdJN9LRRoJJxtyBaEEzcTmhzQTKqBpkJfkhmk/vfOOoAItqdO0BwNlXChvt/2SNNitq2s5QpizgXjhd0+DXaUABxEhoJsq7q+8+WGFKgYouWcRPThvvMXrdSuNzbIr9rmuzv5HgzM+gw2h4K3F2UQ9iN2bLGQNBC3CmaDjD9EjqXdce2FH2nKO0VSJeUtMVYbPdVUtL9n6 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:(13230031)(376002)(396003)(39860400002)(136003)(366004)(346002)(230922051799003)(64100799003)(186009)(1800799009)(451199024)(1076003)(26005)(2616005)(6512007)(8676002)(6862004)(8936002)(2906002)(478600001)(4326008)(6506007)(66946007)(66556008)(66476007)(5660300002)(6486002)(41300700001)(316002)(38100700002)(86362001)(36756003)(33656002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?1kDT+GYpDBgjxAjqAl/ZrMLdyHAjgM3mtQ0NSY3bqV8Bgzy22P9Jq+9Z0P9F?= =?us-ascii?Q?PPT3D6acwNhXW+KhLscJdLoikfUPCKWwYGTw14CHewvtSre6a3k+TLHuYlg+?= =?us-ascii?Q?P2Z0UCn67aKU+xAhC/2dxwrjzUb1OakmPhXKUhEaoB64pz5VD5FcQhHxShIC?= =?us-ascii?Q?GGWkbo593hsg9OjgXrCPsJH6rsMc1sueVcmGD5stW2Oc6PW28xOVH5J1MIhV?= =?us-ascii?Q?lFH//yKTjNBANcESuslIrObuZ9iT1xjNqwGFxeXIMwljccD2R7UFUFvUB18s?= =?us-ascii?Q?KiaqUEMMRU6HuizrdJruEGEVpA+VUwD7ovWcsRwx3t20vhx95QkYjEo41YOR?= =?us-ascii?Q?PvZ2mAcKVvM7c77kfWn/mgkj+jQmFTujwDXaYXHNA5v7YnKVSmqJA1pyW2h+?= =?us-ascii?Q?+9t16RwHZjlkrOrGXPROIOJqwmIS6T/eODDtQLyUeYPAHXzA5mpBCLfC/eFc?= =?us-ascii?Q?SAfbyQDqvN3hempGBILNsRK2TuUICadYeLLB4aB726q3HZC5C3PYaPc2Tr4J?= =?us-ascii?Q?K6w5AXzhy2H0HIIV1TuooEdgo+E/i4oG1jmd6tpqnxKUqV1HFQrwqSoFcGvn?= =?us-ascii?Q?cRrfZNPNJgA+MsIaQQ3Nwvm2iBnCjZd39W/9XtIBdLLwgTLRQoCOf9qNoGLL?= =?us-ascii?Q?7RJ267u2uBPfrOuF00DamkPs/GF6bErY+RMm7xJUCG52GghAZSBDOsRWc0aP?= =?us-ascii?Q?tfGsyRbYQyCfCGZx5YJcpT2hYtygZFEsbos6lJgluM1BhN2kyvnYnzlzyRR3?= =?us-ascii?Q?b9c70jVkoakydcwFy7mrsnapIg2D9vifEEio19kAfVVkn5SELon4+ri/QSMw?= =?us-ascii?Q?nr7Dda1++kngao8GrMD8sUjB+NQ/8TtqETwvfgErQAt99h9T8tRy0Fj8zVjs?= =?us-ascii?Q?CbkbFYl7RShZhpaC+065fEPfDev5JEkbOSVrTYT1UaIuiQ7ZNr+9HihddJm1?= =?us-ascii?Q?HXbyMNah1SYa5uwvpalFEFwhcwYngJNdpqXqg/H+pRdNmL/wh1pZIve67Xix?= =?us-ascii?Q?IayCJoSZCkQ2yiSvNYVtdKLT/RbshxnxY20OncknxUIdShpHZWjkucoqEiTO?= =?us-ascii?Q?wBH/QO+4On3+uAfCGZ811u5c+4g97GQ9lANfRRtAuYpwUhUaXXj1I0jV0MCq?= =?us-ascii?Q?yQsgg1XOlG2jstDNk4pRvrWOI2HjeHhznljpGJkA0lYUtt0kYoMwTS7K1mvz?= =?us-ascii?Q?6l15JRog6gHdVswroQ8lvbT0aey9mM6lRPiY+x94HRb0gEMtlRbnxL/ygnXy?= =?us-ascii?Q?LJ/NiILi/N8/2WBBcQjGXYTcjLklWVFq05ljvpCAz7aD5ix9tDhlmR4nioT4?= =?us-ascii?Q?zQgNlIng7gBBHcCWsXWDQyxgpn1muyP17UJZ4JlSzHwpySwP87QUP/nkVfoG?= =?us-ascii?Q?3yMrLdnwh29lmKbx9w/BHEy3dcdZYT+MoiNX4z1+ai1OVriZOljeIsog2yfc?= =?us-ascii?Q?v0RdL+Y2mW/YKRvtCT7toNuaHGRVWgAU0nLnQU41ExRzGfoHQ5LFUYKGJKKu?= =?us-ascii?Q?s1aqbj5fNduW39XXGQ/U+41wKoLObfJd0QwC8Mq59oHMeUITE656Pmsri88/?= =?us-ascii?Q?Wl4+BjBY/w8hxPz0uAnXwKgIZOw9EM+aymruZAz3?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 992a9407-2c61-4ee4-5757-08dbc9b22a84 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2023 16:58:45.9185 (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: U+ripi4TUimpiu01ycSBW39AOUBMQCtuHG63Jw6nkkA69OVY7MgiTJpvP90gvmJu X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB8800 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 10 Oct 2023 09:58:58 -0700 (PDT) On Thu, Sep 21, 2023 at 12:51:22AM -0700, Yi Liu wrote: > diff --git a/include/linux/iommu.h b/include/linux/iommu.h > index 660dc1931dc9..12e12e5563e6 100644 > --- a/include/linux/iommu.h > +++ b/include/linux/iommu.h > @@ -14,6 +14,7 @@ > #include > #include > #include > +#include Oh we should definately avoid doing that! Maybe this is a good moment to start a new header file exclusively for iommu drivers and core subsystem to include? include/linux/iommu-driver.h ? Put iommu_copy_user_data() and struct iommu_user_data in there Avoid this include in this file. > #define IOMMU_READ (1 << 0) > #define IOMMU_WRITE (1 << 1) > @@ -227,6 +228,41 @@ struct iommu_iotlb_gather { > bool queued; > }; > > +/** > + * struct iommu_user_data - iommu driver specific user space data info > + * @uptr: Pointer to the user buffer for copy_from_user() > + * @len: The length of the user buffer in bytes > + * > + * A user space data is an uAPI that is defined in include/uapi/linux/iommufd.h > + * Both @uptr and @len should be just copied from an iommufd core uAPI structure > + */ > +struct iommu_user_data { > + void __user *uptr; > + size_t len; > +}; Put the "hwpt_type" in here and just call it type Jason