Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2040385rda; Tue, 24 Oct 2023 10:24:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGrkuRjgKIWJ389fvx6+5oBlxBUIYW2yHcEsgy6C7uw3OpaF9l3hkMJcx9HF2FUXUaKuroW X-Received: by 2002:a17:903:650:b0:1ca:87a1:cdf1 with SMTP id kh16-20020a170903065000b001ca87a1cdf1mr9850874plb.27.1698168258101; Tue, 24 Oct 2023 10:24:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698168258; cv=pass; d=google.com; s=arc-20160816; b=f+ituYDxqOBKyWqSOrztFIOEUbR/4jHxYYXAG3+LyrpQIsbUvRr1JPWwAATHvYmJ06 wbjx0Fspx5X1/gZrZGkgUoqUK/Hgkj7jPjvaDKRFdObRqyZpD1omw03W44WZve5ePnwN v6rGtqfC5fpXoyo4VFuBIV5w3ppC3XOhYGyZogET4YPGPTkMItGa9uiIwfIopgM8DbAz laAB1UOafPNyizaQDTblPubZSZaJoYkn/vI6KDxD3kn1Mg+E7Gk9ubCdx0oTzbefnIjO /XD9CUDhIL5oeOG82e5I4rE1RcE7Y18dOcM7paeTRD0mf33kjJrsfdUdT2FA006sBKKs KmKg== 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=cQegSCm8eLJixrnEgPA+k31n3gtvgSNjagbXujerQrY=; fh=mp6ZRZA4LRKdRSDcmzl6ujmp+qmwc3FjQgVN4/c0rcA=; b=0a3OUDOpqHVkzTM5F50ZC1vswcAVNvIoLBsS5yVkwbsueorlF2YnF/z6pViBg0+3nn bptdT2LzycU/UPK9FDe021tuaNWxQznVrEUkTxgVMCJR3CeQCpKAfTWbhlwkC7+vY4Qk e3sdJln+RwS7mLUg7BVTRAjaahcEIMvFvMH8WVwLU+9Vf9m5oYAh1TswnUUQ/z288yIf Ktc9pY2xlGrFn88GuhgJEng3+KQWGQpFRRlZOARxIwWgvRl673Y/1wmqs/EJk1CApHAs qmReYwHo7VUF6awT8GsNAkX9xwRXwuW407AeSBbJHq2EGV0AHnt5Wk5Bu/Id9Z/twfJT 4IzA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b="O/d5Oo2L"; 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 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id l20-20020a170903005400b001ca86fa1e1csi8219562pla.484.2023.10.24.10.24.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 10:24:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b="O/d5Oo2L"; 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 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id A07CD80279EF; Tue, 24 Oct 2023 10:24:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229830AbjJXRXv (ORCPT + 99 others); Tue, 24 Oct 2023 13:23:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229743AbjJXRXt (ORCPT ); Tue, 24 Oct 2023 13:23:49 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2056.outbound.protection.outlook.com [40.107.244.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7508128; Tue, 24 Oct 2023 10:23:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JeoMB2650Y+p27zTpioPhwkBJrSVfRhBwHzp/kT0yWdfyUokmuLlA9IIjLazyhI/SB/d1Jg7ol5Hz4tltH5Tstxo+yMzFkXgQi3QmkZh0+4FResdJuUHM2sVsgOrPWytsrUbaeABoQ9C3TcIHR0GTvxUPAjVkKwNmJgTS1PZ470DAeQwt4WkV0yvBL3MovpoDIDsDn1BKFA7HVORzadbU0wKm5d9jxChswFOjDLfFliZJ9BU38gLgiuxyAQpAbY5jNG97LG7VaR0TZpJr+EQ/L/+1iTnc+E0tm3wPPPjYTng3roqHpB5V1sNAwa77iwvPWvybuSX3tGOTPhreZEWEw== 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=cQegSCm8eLJixrnEgPA+k31n3gtvgSNjagbXujerQrY=; b=H78ZyQhq1hu1drb9vGufwQiZVV1tRRlvBeHcMAlsiNgkOCG7n7hEwsnysixvOuLr/YQjF7/NCjqkyrs50bvP6lKDXWMxynr3L9fzHMp69793F7VTeldrEciqGSSh+Ezeu1VFJeIN9UdVvbmSCt4wq2efagDhP+ZHg+TQpMmr4U+jbz8iBhtlJEAf4sSuN8ha9xjnlkeZbrNaQy/mvvDvucn8yf2BInW3F7RlS3VUGXXN3AizBRa/CQNKs/2bH7/GnOPj3dPutTq04ZdETSe1AkjmgStwQlIOxqGZyde/gbF3a4gYYBR4rcsmaMkpX4DUKl6exMspmXDuGb3QHCFa6Q== 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=cQegSCm8eLJixrnEgPA+k31n3gtvgSNjagbXujerQrY=; b=O/d5Oo2LHuMsCmM8pmx4hS9GDWV7UcAUsDBgU2RaLVI8FgElfn4qEY3/JXdMUi373N8PLMCIfIheTxGsg3F5NHk1quOT6dQdQrjlv6niHux4irPvAzpmdYyvMtxKWxGfXaN/Z37yH11pn/qh9rGY2RlhHPK6/UDhY7gUMEV8sWr8tZeBlSK3Qi+P3ozQC+1iroG8SIr0jJ+LCKruwdjWAfWu/tfqIQyUpNTJdoDk2BC3y7ByB8ZMnLjestE3WvnSu4P1U43ST5H67ONs2TwXIXpoWOd3lxSQMllQ+oGHomsED834nZ6bxLeifG+neN52kl76D+fsgIOtZOJNW0zK5Q== 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 MW3PR12MB4444.namprd12.prod.outlook.com (2603:10b6:303:5c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.31; Tue, 24 Oct 2023 17:23:45 +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.6886.034; Tue, 24 Oct 2023 17:23:45 +0000 Date: Tue, 24 Oct 2023 14:23:43 -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 v6 02/10] iommu: Pass in parent domain with user_data to domain_alloc_user op Message-ID: <20231024172343.GP3952@nvidia.com> References: <20231024150609.46884-1-yi.l.liu@intel.com> <20231024150609.46884-3-yi.l.liu@intel.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231024150609.46884-3-yi.l.liu@intel.com> X-ClientProxiedBy: SN7PR18CA0025.namprd18.prod.outlook.com (2603:10b6:806:f3::29) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|MW3PR12MB4444:EE_ X-MS-Office365-Filtering-Correlation-Id: 77066647-f96d-48c5-d276-08dbd4b5f9cf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YrkGjcPZ8oPNvFLnuk0S9Sn0MJQXdaqcIL6SejvO4JvP5bzj3Kig5xVQr4XV5MQyyvONU+guqGFmNboFaCFjicZ6qC9Y154bo3Ab8eNT/nWlnxAm3659bWOlg8WcZlcEegBDB5ylpC8b3m7u5Esc6O/FM2C4am/AMmgl06CVrRfEYqgvaD3aVlgN0EAo88HX3kH7s91f+7sPMfrXgTDzOXvUSnbq/9vPlBZrIhFPf28dQ8Z7jxNjcuhaNnV/FoVZuT1jXHCIcPqoNM1I0YcI8+W+dFVCMwNlZU62QqE7ei3D8JiEp9Jiez4M57xhRD8IFoA1cF67GaX5i/CSYM4XAfj+CxDq8T/FU4s9BNAka6wbw9ziyGwxWklFhhMKOJiiI3xxp0+uJqtr+JF4/nZgIbXGwRm6SQbIj0Jy53yrQkDp+F7yXh33WDON1M2AxIzcEv+2Vu4bN/AAvo81Z3dIBVVigwoCJqytB5C1kog5XNY46tfa1AffY/OzX5YnCDyXgs4OUzAplLWRCh05+0tlJ4wzY7dmYoqb/0dUv2suLtDUnA4pUv428sz5VRgGgftp 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)(39860400002)(366004)(136003)(396003)(346002)(230922051799003)(64100799003)(186009)(451199024)(1800799009)(26005)(38100700002)(2906002)(5660300002)(86362001)(41300700001)(7416002)(36756003)(8936002)(8676002)(33656002)(4326008)(6916009)(6506007)(478600001)(1076003)(66946007)(316002)(66476007)(66556008)(2616005)(83380400001)(6512007)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?SCAzC31R/3p/rtI8mKlTIlyzZ0M8MP6OWoxZK2i5VwYx/JW9Qv+e1k9XM1PO?= =?us-ascii?Q?YadtoHCVhGKrikHIMQR7ARF73w2c2CK1LYFLOzS9ltvL6i8PH0Rc6BAzvrhY?= =?us-ascii?Q?LrwPUEG+alGDMSKZFBvw0EVc8/jMrF9NsOOyXTe2G+41EU4fs9aC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/dhzuebTaX6ycGAb5F3iBbEY9P8l4YPON?= =?us-ascii?Q?8nxJMwnsqh0s6G9tt1CcxWM0PdaVzMlRJWy4ZmXxGyTIcgPKbIz9m70d7HpP?= =?us-ascii?Q?8XrmHKVxubUeYkiqIQkiOBAXhs/MOf5laKpDEIBItoorrZIfJ5u5Vz2i7ihs?= =?us-ascii?Q?A2jLwiH1XSHBvavAja8Nrf+9yraM+VIRoWaXc+SbErTdgJLJD4M1bPyLc2zW?= =?us-ascii?Q?XmtCpyPN47oBmrpSakngg2eKNFKKYmmU+6t2vVtfx6rr2fHkunGXtA+LHWtx?= =?us-ascii?Q?ZNUWh7ZPmpzJJ+ZbrmriTFfOOWntMX2o77W8/fsZGwiHrjfXRIY/CHNuv0vG?= =?us-ascii?Q?RWBGXsrOSXQCMt9OBrH4YHPIhFj8QWYpMO1JpIVa90yd/uyjB1dPT/BXbaEB?= =?us-ascii?Q?2i+8jVW6xPZzaBtwu/7WDRQ25GoVwY8mYjBisTNzVCA+V8MW++GHW0bIoOEQ?= =?us-ascii?Q?oMfDR1eu3rqO4TW1WUh6rGx9oFBgMfu4x7h9lVE/6wqpLwU6+tyiLO+JIkAK?= =?us-ascii?Q?wooz5Ort2H53VQ/qv2KxUdKy+g+LtJYz7HPdP7sG?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 77066647-f96d-48c5-d276-08dbd4b5f9cf X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2023 17:23:45.0549 (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: G3ypnoF9pgkaD/tr9k5px15cgRET6WpHXS4A8q7gjRr5AiitEYNBNEo4DZzwFwzc X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4444 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Tue, 24 Oct 2023 10:24:15 -0700 (PDT) On Tue, Oct 24, 2023 at 08:06:01AM -0700, Yi Liu wrote: > domain_alloc_user op already accepts user flags for domain allocation, add > a parent domain pointer and a driver specific user data support as well. > > Add a struct iommu_user_data as a bundle of data_ptr/data_len/type from an > iommufd core uAPI structure. Make the user data opaque to the core, since > a userspace driver must match the kernel driver. In the future, if drivers > share some common parameter, there would be a generic parameter as well. > > Define an enum iommu_hwpt_data_type (with IOMMU_HWPT_DATA_NONE type) for > iommu drivers to add their own driver specific user data per hw_pagetable. > > Signed-off-by: Lu Baolu > Co-developed-by: Nicolin Chen > Signed-off-by: Nicolin Chen > Signed-off-by: Yi Liu > --- > drivers/iommu/intel/iommu.c | 7 ++++++- > drivers/iommu/iommufd/hw_pagetable.c | 3 ++- > drivers/iommu/iommufd/selftest.c | 7 ++++++- > include/linux/iommu.h | 27 ++++++++++++++++++++++++--- > include/uapi/linux/iommufd.h | 8 ++++++++ > 5 files changed, 46 insertions(+), 6 deletions(-) This patch should be immediately before "iommufd: Add a nested HW pagetable object" Since it is basically preperation for that patch > diff --git a/include/uapi/linux/iommufd.h b/include/uapi/linux/iommufd.h > index c44eecf5d318..fccc6315a520 100644 > --- a/include/uapi/linux/iommufd.h > +++ b/include/uapi/linux/iommufd.h > @@ -361,6 +361,14 @@ enum iommufd_hwpt_alloc_flags { > IOMMU_HWPT_ALLOC_DIRTY_TRACKING = 1 << 1, > }; > > +/** > + * enum iommu_hwpt_data_type - IOMMU HWPT Data Type > + * @IOMMU_HWPT_DATA_NONE: no data > + */ > +enum iommu_hwpt_data_type { > + IOMMU_HWPT_DATA_NONE, > +}; > + And this hunk should go in "iommufd: Add a nested HW pagetable object" With the rest of the uapi Jason