Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4820698pxb; Tue, 28 Sep 2021 05:01:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxB3PUv2rDOU4o9iwnU6FBk1SQb3pmIj0JhXwOP60o7YmzI1QA/mtZJAcsjgPtNaJsx4J89 X-Received: by 2002:a05:6402:288f:: with SMTP id eg15mr7085566edb.356.1632830473852; Tue, 28 Sep 2021 05:01:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1632830473; cv=pass; d=google.com; s=arc-20160816; b=R+KUOvNn8PGbe3umEAIMzFmqqUDuutBQcjV4uOp61QHfJXghD660J9zX/EEYs0XZ4v o0zfvSJAfLWKXbwLtsjotF/L0MJ485H3zXK4mhTMduXhS/hEqFPVz+KWIhi60ZPOVKK6 9z7rhePEljsP9YR+4z6GV5tz+g4j7qBbfG+yJSb4ft4oF7ovDP/rk2ZeA4fSfppxU7Ps kEecUi7C5jzzXPvR3IVcw2v1yktlDTzsKIeXKMfZzUatpcqMjDpAsPvjeaWhShl0i0Bn 0nVmOg5qkH1Qh1g5vRHOj8tCo6xCqeQMmm0s2UreqpcvY5VDsdyuWtKf7s6F70OHc8py jnQA== 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=pzZRnPVdaF0ONfJD0FJ6HXHyt0yoWvrHBT384oR8Jns=; b=YIlQmT1/wJ2n7HTAW0ttNdIQbBvv+Wmhn4v3Pujgnmo3T4nqIQI1sO+4yMTn+rcQ50 rkLwN5Qi+6A6eO+h2l190EIfhMzOxhQdXuY8aHzLOgALaw28NUfTVADE7fUOatxFIDX4 DSKv+FTPheSqLjmt/+p0hzSGXtuTpC6JyGHA/Eo24Sl5ek+WYopW9Mlzbj0dmaTLmYot bh6MFiWeFNvWywdB1uMerQtJKapYNjVWouP8csmNHqgZq2s4W0ZNGk7Ru0/nxg8djkok qDy8OXKMiE6yf9zqsCGaJSMylQkUmbq8kOX7862sHPvZB9wGQepxQhOqh9S98B1TU7bb Arjg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=kHvzgFbD; 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.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z17si22526101edm.510.2021.09.28.05.00.45; Tue, 28 Sep 2021 05:01:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=kHvzgFbD; 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.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240478AbhI1L7e (ORCPT + 99 others); Tue, 28 Sep 2021 07:59:34 -0400 Received: from mail-bn8nam08on2076.outbound.protection.outlook.com ([40.107.100.76]:10720 "EHLO NAM04-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S240400AbhI1L7d (ORCPT ); Tue, 28 Sep 2021 07:59:33 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gcpz1iWRL3fEaepAAYm/tj2ewphyKqGj3ilYagebEuzFhjyiUDqZME0oEM/fL1q/ghzlo11OC5y1oSNVLjTuq5nkOVwa1slbgQY9fqOs41nvJ3VkKci2MBzbQBC0MsIo4t9JlSAgR3A3oIvJyWlMi0LRGsFxVBRIE1Phjnb1SvKOvd8vRD0fcbneElpsJ6tw35fgpFbm0XSHLBRfHq64HsU9rkmVUk88dYicEi73I8D3XTkIiYQZi+x60FK/c2i35B+hk7ma9s83EGUVZOLXQTVW9uoN379rfvxRX+MmultaNznJa5djx0EZ2DhDwK4dg8sDl4bYb7PlZ8GeLDNbMg== 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; bh=pzZRnPVdaF0ONfJD0FJ6HXHyt0yoWvrHBT384oR8Jns=; b=j8wkQuaXiL5bghQC03NxVj9buTI0joIOfehFsUQ32EdXyRmLrfOsQr/oMlP5JkbPb95Xag4cvblQ2zSt5gMK+CRBuvRlMsl+Yts33SnPnPPEYxIQN73M4fXJ1SJ0Jr0K0pePHo1odP4j+tAA0jrL2AHUY8+YXWdIp7EG37HhDrGvSRNqW+yKITjcGSk+6H/8gzyi7jnkNNgD/6wbtBU8WE01EkBfYEXrONmf2iXK+E+xaU+lM2BorwhgiqoCSbZjjDlKM4GmPGIg6y9kVfIOu430DfG1MpYgfd+76d03ow43A0cIpRjrfXdzGuL1oO2UK3R78mBEvs8LPhcqJ7WCkg== 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=pzZRnPVdaF0ONfJD0FJ6HXHyt0yoWvrHBT384oR8Jns=; b=kHvzgFbDRMELx9TP3+qufG5GF7UjBCfAFWQ0jHnhpUEElWB0yLWkt0oPEsOzi3q3DSklxu+8axeLd3zoYe3X0TEW8sHdPEca6wtcMAggoqfX53Dy6UmOKA6McKqSHlQvbc58GzoyDzza9OeJA9igJMn3XQn8bZVLjs7hXMzLcXEG80hqywWFhfrN3QBRuQN9sh+cIU3PWhBJqE86KpH9smOlGZlAfOMF3dRz/0lEtZnKFTf/5OwNmNiBUen1GBxWVnUYGiDLJsFki5NT3fHFgVOjTfiFDS+KXJ616Jp4bZIsNVlSZky1N+spNX72xcFkTspyMrLwZkXIO1KeCbO/zA== Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB5506.namprd12.prod.outlook.com (2603:10b6:208:1cb::22) by BL1PR12MB5094.namprd12.prod.outlook.com (2603:10b6:208:312::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.15; Tue, 28 Sep 2021 11:57:52 +0000 Received: from BL0PR12MB5506.namprd12.prod.outlook.com ([fe80::e8af:232:915e:2f95]) by BL0PR12MB5506.namprd12.prod.outlook.com ([fe80::e8af:232:915e:2f95%8]) with mapi id 15.20.4544.022; Tue, 28 Sep 2021 11:57:52 +0000 Date: Tue, 28 Sep 2021 08:57:51 -0300 From: Jason Gunthorpe To: "Tian, Kevin" Cc: "Liu, Yi L" , "alex.williamson@redhat.com" , "hch@lst.de" , "jasowang@redhat.com" , "joro@8bytes.org" , "jean-philippe@linaro.org" , "parav@mellanox.com" , "lkml@metux.net" , "pbonzini@redhat.com" , "lushenming@huawei.com" , "eric.auger@redhat.com" , "corbet@lwn.net" , "Raj, Ashok" , "yi.l.liu@linux.intel.com" , "Tian, Jun J" , "Wu, Hao" , "Jiang, Dave" , "jacob.jun.pan@linux.intel.com" , "kwankhede@nvidia.com" , "robin.murphy@arm.com" , "kvm@vger.kernel.org" , "iommu@lists.linux-foundation.org" , "dwmw2@infradead.org" , "linux-kernel@vger.kernel.org" , "baolu.lu@linux.intel.com" , "david@gibson.dropbear.id.au" , "nicolinc@nvidia.com" Subject: Re: [RFC 06/20] iommu: Add iommu_device_init[exit]_user_dma interfaces Message-ID: <20210928115751.GK964074@nvidia.com> References: <20210919063848.1476776-1-yi.l.liu@intel.com> <20210919063848.1476776-7-yi.l.liu@intel.com> <20210921170943.GS327412@nvidia.com> <20210922123931.GI327412@nvidia.com> <20210927150928.GA1517957@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: BLAPR03CA0130.namprd03.prod.outlook.com (2603:10b6:208:32e::15) To BL0PR12MB5506.namprd12.prod.outlook.com (2603:10b6:208:1cb::22) MIME-Version: 1.0 Received: from mlx.ziepe.ca (142.162.113.129) by BLAPR03CA0130.namprd03.prod.outlook.com (2603:10b6:208:32e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.14 via Frontend Transport; Tue, 28 Sep 2021 11:57:52 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1mVBk7-006x12-Bj; Tue, 28 Sep 2021 08:57:51 -0300 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eda9f959-26ef-482a-21b9-08d982773341 X-MS-TrafficTypeDiagnostic: BL1PR12MB5094: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3968; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cHl/COD5haPHvcVJWyFz/oOxuc4qHz6Ev2JfScfXMVkJDJQR4cJJ2f/vWh4krl1iwDA4Mgz81JyqdBF70Tdii51qtIieJNDBqxIXLWHCwOgJr+68keIygR9h5d6Ui5C76K4WS7ZjiHhDnBsSh/Sc+/G6zwBxcQKozLO1mJoqz8ubsqnc+CKt9hdw4a7dITT5yoSuoNcRTdSE/H2IL37eZauxJOCO6rv/5n4hTShviEW0XFzw+JbU2LQ1uQbU+pPbgBG6tzTjCjtYIIS9+6AaNjk4Nx2UMzHPQS6UFsu985pREDPKtbljVIbAxafqZHFeDI+mn9m8AGzLzEKLPSyXh8z6tmGPyeRYrQFTXfcg+Y0P9xe1KumAk4LeHvJuHBRkp4s7IJH4RI0LE9RrK++DD6g+5x2hpXVQMkrY5F+wvK4buW0a2A7/Pv+l6iT6Y/bqYFxAf9b/Vj/iqFZlupKogt+KjdegCu9oTptW4btbPr/zlKsUBlOjYMejcGf6ZL9+oMDYpysYcrY/CMyoOgbgtVlP3CdhnWlLkTK2CR6WzLR1APWTSihCiwLfYyeTayYISVZ96H8SQwTGB2GM3TiSN2QAH3qj/myAyWwG0LMrJm2VxXTHd7ySwmYXAU6sXyk9VQYue3oI/toQRWR47qPX2evV4peoq2GOIUB90Fu4TEkzI3yH44tk0BEPSjNGVMGA5rhCs5wHVEMBCkrc728Dbw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB5506.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(426003)(66476007)(9746002)(8676002)(38100700002)(316002)(9786002)(66556008)(8936002)(2616005)(107886003)(1076003)(54906003)(66946007)(86362001)(26005)(7416002)(4744005)(6916009)(508600001)(186003)(33656002)(5660300002)(36756003)(2906002)(4326008)(27376004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?agddrfMPxWsa3SXNME758HxHUm4BCVYfKZuxHL66Ep/RcImbNrvDYe1h2Lqx?= =?us-ascii?Q?t6FE/JuWhpfbSOeRJ85n6tGjL+IuM+/piM1/ZYHpKFhQXZUbYzHph3fvuUAi?= =?us-ascii?Q?4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zc9r?= =?us-ascii?Q?pK9J7HrDIMG3zLKkD4yLeicPrt5WeEOlg/hnnixJceiOruKNvObdB4N3K3Ey?= =?us-ascii?Q?sqjt/jV+TUfp63mXU+FQcHLkah2w4GchGTiZeZxF4lzFt7EIDeSkJtsTJBmB?= =?us-ascii?Q?WSJApOhoFJ9e8USxKDzzU5MeYxSTOTeDU6zMvQadYUZA/XyRRTIBJPRavvBf?= =?us-ascii?Q?fXzRitQvuTc4QgWYWpec+M9+NINHB66KQ5QOB70t0YowJwkLxK8IWfUKb8nG?= =?us-ascii?Q?i4XqkVV+X/fuWr9wCNxsJ6IdgNJStASNau5gWbx/bxEpiK1oSPJTuiK0FGbp?= =?us-ascii?Q?+7YwfxAbfCksClAEnpkmXRh8?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: eda9f959-26ef-482a-21b9-08d982773341 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB5506.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2021 11:57:52.5228 (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: 2PeZtLW8N/aJZ68m+l01JxbNlgHxoPdgZ5kxIz/qgW+L1GDSiop8VNYAYbCCGZFy X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5094 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 28, 2021 at 07:30:41AM +0000, Tian, Kevin wrote: > > Also, don't call it "hint", there is nothing hinty about this, it has > > definitive functional impacts. > > possibly dma_mode (too broad?) or dma_usage You just need a flag to specify if the driver manages DMA ownership itself, or if it requires the driver core to setup kernel ownership DMA_OWNER_KERNEL DMA_OWNER_DRIVER_CONTROLLED ? There is a bool 'suprress_bind_attrs' already so it could be done like this: bool suppress_bind_attrs:1; /* If set the driver must call iommu_XX as the first action in probe() */ bool suppress_dma_owner:1; Which is pretty low cost. Jason