Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp982345rdg; Fri, 13 Oct 2023 07:04:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHmYjvrpSmIqnEmua90AbM5xih4Z2BHQlSO/Y7mIR89OZVluepHBx3IQLq88wTJR9A+8S4o X-Received: by 2002:a05:6a20:e11c:b0:15c:b907:9d6e with SMTP id kr28-20020a056a20e11c00b0015cb9079d6emr359377pzb.6.1697205865361; Fri, 13 Oct 2023 07:04:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697205865; cv=pass; d=google.com; s=arc-20160816; b=Ncd1HrgrgquoxqRbKMcrqivxaADcE/+stIIMS2VJNuw+6dYNi4UrcII1MXY6QX7SVz ZbkoRiswYB1EktC8Bxlt++uSgOhTaMs7Z3j4MdlSVD8tJjyNJxCJmH+2QS2KoC9vtNXn D3ILZctZB/78exj1w8CVhV7c7nfN4W4hZccq6955/b2aJUIjhZojdOZc403EVeQOYjTA j6+Rb2Rg5LWqmoNqHLQCwRnL4uPZLundQu7auRs8QDGnjh7PMLoA1BbdM4zVKdOMOZz1 y/0O7dhuxK2KJvpFYm4TZleo7sPfVF5zOR54MnuBXjrfX4XyJcbbsjJNNGwAwSBRKZOa byqA== 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=aM5mqRHNuoiBybh6+M/0F+mRF9Ta9oF/jn9jea0dqcw=; fh=/P5p8Y+7Bn1/IKAVXZKPnmCvfyPRDV1RrAyBNL2CtKw=; b=OrDcffR4Zl+TStmGNdHYukenIlWjxobRGY5ZAlVdp0o/Ukz1lhX9GCXUJMLjC8zOjM /3eHm4CXjEu2h4F2WwZm2aPhPDm5pxhUS7MFu+gbgqhJOeA4cXD3chMvybTeiaRASOMM ki15+NnHfUwBu8wgs/ZzGbZoJCUYV/e55ZhDUr700A4qP4nAYM3V7h6lB1a7aFhxIe1e us8emMv19O7UM+Bfd9Y3nVmVJPw1/dNvFoHT0ZSuXjABa991yURlgEsPHhaE6+uphAqX 8/Az8m8EvlXTz1eynb8TMDwNkbP5yBUHh21/Hw4QcqWPAfW+NPqCgzQ2gXI1ojZSwPTl S1MA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=gINvxmIF; 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:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id e24-20020a633718000000b0057c313b17bbsi1844587pga.125.2023.10.13.07.04.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 07:04:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=gINvxmIF; 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:2 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 agentk.vger.email (Postfix) with ESMTP id DE27E81B5D18; Fri, 13 Oct 2023 07:04:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232014AbjJMOEE (ORCPT + 99 others); Fri, 13 Oct 2023 10:04:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229688AbjJMOEC (ORCPT ); Fri, 13 Oct 2023 10:04:02 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2066.outbound.protection.outlook.com [40.107.223.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1625BD; Fri, 13 Oct 2023 07:04:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MsQaYWNgxGtdSWsa3o9vz5j9GgO0omISMvIKkNeVXisJghtrHBKhOCWXadWT0GICkCUc+55mhdBcjHtPxzcQ6HNvvueIvd+ckRWkgwAib5DzZs6IjfVo9C1kViDfg7mQWw3OvIf2Y7Vu2lvFCGn4VNJ2gS4xX4mhMBljtoVZT/pxtvphr98f8Mw+KQz47/JbeOxiLDDhCixFQJGEqLPC6RdZTKgXMPJIRay9z+zOFelyYnDWnbz40k7bAM1weKfHaZi+DtNX1jn+v4JugIi51RXnmTiV23Ztj8mRJGf9oA+nqoxVGRFdgfASDMzJP2aM+Tff/7WHSPFr67vlnENCtg== 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=aM5mqRHNuoiBybh6+M/0F+mRF9Ta9oF/jn9jea0dqcw=; b=Fk4iBRkFIW/pkWexlnG5f6tgsbYlIKMXn9magTB7bqmLX0/B6U4ihkxSGm+Tb1IoIcUJNcEF7mDoFFXf/6WSOjNJ/PuTdJW/a3VEjdTJBdjYcBdiRUXPnDJ/RO97fz0odz9V1XatNw4Okbmy0XDR3zjuseIFVUGUlUM53XHPg4Hhreh75R8+S8sTN/kTHqFakkW1Z+vF7rgTzMe38kq0LjyGxLRzFFdYEdgdzpZDcUSOYCL/WkSfepkKJ9LE5TNO9Ao8jJ83Ou0q2hSFPHOVjMjOr1DOIUk3um4/uRb8zl43dMZx/RaYIujKnZUIA+7GTqWbC/W04UYocytEkz1TTQ== 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=aM5mqRHNuoiBybh6+M/0F+mRF9Ta9oF/jn9jea0dqcw=; b=gINvxmIF26Fgf9xlvHHgemfjNTJtfGRX+SQ75Fb5Hfs9sVdvAildCYNsSXRHpcE8QvjKR3LSNZ8dNctHNwRyhTg/SyGGxe5MnSwlPBLQ0B0kHp3f3ex602er8XEfukaKTnl36tIzMfxTP7SWBIAE34J4mG6eT02m7yf1wBgMDYEZjnINyq6TosS677jCMrNtTjvFiSRK5Zx1XhA3UinrX5cZGLRvslidaWsDgU45t8/McCWuAnPadmMTIcoKPGd5t6QCmRVnWZtWMlIzrpQd2JyD1wl/khfW/VnGsM6j8nCidJ7GlB6WYNihRmRf9RlGf59GoKCbDNA7RP+SOEvN/w== 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 BY5PR12MB4856.namprd12.prod.outlook.com (2603:10b6:a03:1d5::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.45; Fri, 13 Oct 2023 14:03:58 +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.046; Fri, 13 Oct 2023 14:03:58 +0000 Date: Fri, 13 Oct 2023 11:03:57 -0300 From: Jason Gunthorpe To: Nicolin Chen Cc: Yi Liu , 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, 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: <20231013140357.GQ3952@nvidia.com> References: <20230921075138.124099-1-yi.l.liu@intel.com> <20230921075138.124099-2-yi.l.liu@intel.com> <20231010165844.GQ3952@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: MN2PR19CA0034.namprd19.prod.outlook.com (2603:10b6:208:178::47) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|BY5PR12MB4856:EE_ X-MS-Office365-Filtering-Correlation-Id: 51549654-a768-4b4b-87ce-08dbcbf53ec4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6AHfwyENaWjG50SHwi6VkRbc7OWw6UUvhvFVr1xpPYdwI64Rtc3OK2bRwdqU2WfXvC0sYH0a2KO3ia/AVNMXZs0fjPmniiKcihYeqoZ3wtDTLqanrvQOhZtg1PBCkE7Cg2cryRYQEZomNXkYYcydlJ6gKP6IumXeV5xEnqZWoDzvtCHG3zrznj4RCsNTpcazReP/AvvTPs+a1ebrY6tVqhZvqv8n9jzt4DZ/iibP/nN4gKQsjgpAOP+gyoaqMbeIWcgJuoVJ7+OzbB7TwdWEaMLQreoUzizZPa1j4EE/QlPZt4+WFsH4qcazVTKLoRPirz5snt+6N4HaUFWMHDav8NqaOp9dOJM5MvIhF14qJxUvoyKHy+uwYZ5yaucQfBSsfFN7Ke6o5xf2859EXNpnnUSJAE+goP7wMLEnG7HgvSe0SO9Pg66ueQFZCPzKd2K9uQItTCa4iTTEkAW7zo+i48IOv17nrvUIyHw2rGdjhEOM//DubT55L7UCjYy/Pv1l3gJxNHlU9e5rSChu2v2tiOQMLTjpYX2XXR55xYrfyMJmk0/JL+VWT/C+3nDmB9Yl 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)(366004)(136003)(396003)(346002)(39860400002)(376002)(230922051799003)(186009)(1800799009)(451199024)(64100799003)(83380400001)(316002)(6636002)(8676002)(38100700002)(6862004)(8936002)(33656002)(86362001)(37006003)(36756003)(4326008)(66556008)(66476007)(66946007)(6506007)(2906002)(41300700001)(7416002)(2616005)(6512007)(6486002)(1076003)(5660300002)(478600001)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?qRtn/FVolHxLM5Dlxcge27x+dEi45NR4EyoufFw812iMfn2A61ICWiy2us9t?= =?us-ascii?Q?q+X9Nz7+WBx1CIDZMQ4xAkvCvFuQFNNG6SEFK7DTtOyqliCNeQif3wtBQzxZ?= =?us-ascii?Q?MzvEL4965R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JkAQXAoEt+NXCeB?= =?us-ascii?Q?fKdJ3zOFjP0YJqPsUFvtH97BXq0knDemtFwWX7XIpWUngd+GjJz+0sqI7el2?= =?us-ascii?Q?UC32TPBjgElGSDZs5tAxPZgGt+ng0HMMJb//dKtWafynHgvlLVXGcYubXPSM?= =?us-ascii?Q?bKEvyFnaS97tEK2G4CgV4z29G2DJt2OxKV6b3HiVyCV1vlbxwSjU/XDR8EMx?= =?us-ascii?Q?c0brgDkQIRAoUN6aip5lN0ZlyI0cMJhVrjv32vzsHLr9KvSXTv6nZesSwS7c?= =?us-ascii?Q?10at5WxGev84vKDkeachUb+eDprPWMct7+iMRyrWP7Of2d0vELePCUAhBAq2?= =?us-ascii?Q?X0sTk8UKoKvyhOFKRrHNvjRGuiFfgywt3GV/0mwhU+cdcxMMR1pZn8Dr06g4?= =?us-ascii?Q?alKEcFiUtZmsxfzfAX9IuZZvRVXPlvQFPyD2p6i3KwYnjwVtXd/wf9fl4+f0?= =?us-ascii?Q?pLxFy/VaYiM0Ol9c62/zGWmyq3P+U7vGF79KbqatAWiFaF9m3pNDPsh20CIq?= =?us-ascii?Q?hP7Al2egs1RoC6ijb1sI6EDKzkT8RzgXE0XVXyGAWuU03oQaAg0CFTUBXlnG?= =?us-ascii?Q?h3IQUkFzYWcDeqHfUec=3D?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 51549654-a768-4b4b-87ce-08dbcbf53ec4 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2023 14:03:58.4761 (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: 7fxvEC2YTHlYQGfYc8mjdSUFGhDix+4WaATE4r6NksFRcj7O/g46ephe6p36Sqn0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4856 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 agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Fri, 13 Oct 2023 07:04:19 -0700 (PDT) On Thu, Oct 12, 2023 at 05:34:58PM -0700, Nicolin Chen wrote: > On Tue, Oct 10, 2023 at 01:58:44PM -0300, Jason Gunthorpe wrote: > > 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. > > By looking closer, it seems that we included the uapi header for: > + struct iommu_domain *(*domain_alloc_user)(struct device *dev, u32 flags, > + enum iommu_hwpt_data_type data_type, > + struct iommu_domain *parent, > + const struct iommu_user_data *user_data); > > So we could drop the include, and instead add this next to structs: > +enum iommu_hwpt_data_type; > > Then it's not that necessary to have a new header? We could mark a > section of "driver exclusively functions" in iommu.h, I think. Yeah, OK, though I still have a desire to split this header.. (though can you really forward declare enums and then pass it by value?) Jason