Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4850365rdh; Wed, 29 Nov 2023 12:29:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IH3QoBAJRXOq7Xr+RkijUS5CsDgjnQ1wBAgFvddPwX1qNEIV8MOJEOgX7xjCIBHqNoC3ggs X-Received: by 2002:a05:6a20:d909:b0:18a:59d5:1154 with SMTP id jd9-20020a056a20d90900b0018a59d51154mr19910982pzb.31.1701289753676; Wed, 29 Nov 2023 12:29:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701289753; cv=pass; d=google.com; s=arc-20160816; b=jUAAdE9nmNmMCC+PD+rckwvAFDNli/0DvN7Vt+xL2WEN+0PASQZ2wH1W5JEYyEbOtc 6Fa9f1UR1AuZCBKh/kp73RFhXNB2qs8cjeIEkgCjtuLUGRr+XYg++Hjcv5sUCSB0P0V5 OWa/ITR6FBM7L6gpArPfmZVVjMSigCiGFdZ15YGFLc3XIuH5kcL44Ykxe0aMEBIh5uJr eJIWcsWm8e9oodNONWz9+qnTAF+C/ntzeo6UgH0SoMFCZfEFvmP5QsEYKWbcaEXbtLgw N0egnMQKMZFMJsQBgqXvqFJ+p7gbjKGWqUWYWrrpIwvxL3xzhqxb0gGphKuDhoIm/IPo rBHQ== 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=arfC5HOCyr9RCk5j/wf2IJQF2IhmzSKw7EojVsax6qM=; fh=mz5QG6NCZDzlWIGIimZMfP2nAtOfXpxtZg78m7qqDKQ=; b=o3GLCMJ/uSRLqyQmLvdiGE0+24ESsw2slmF8e6Pu+paLBq1cXc34v/G0jsRbA52BBv hdlnMY3EWG/jBZ7cFmiYCse5CcvWvSlyM0Cxd5YqHXjGlTc9IOSUaDt0BCc8M+nveuqK 8Kbk5O4IdnW//aFifx+13fY7n9w2McE4ERFQFz0+xAd/ng8KnyrpBd+7gHdk+Nrk7AN2 HvovnV8lVUcJmzfm03+5pYnGwC22Ts4CJCMAW3bgvW/9tP/PvlfBQKlHqdK+sAb7CdPJ uCvrugbwk+bvFNGURs4d9PFcu7UTueX/Lzw9tNu2ppAgoqXkx5Ey2FKv5NpZNMeO7FYp Q+1g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=Ukzfligb; 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 q5-20020a056a00084500b006bf2ef1717csi15277506pfk.255.2023.11.29.12.29.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 12:29:13 -0800 (PST) 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=Ukzfligb; 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 41C338041953; Wed, 29 Nov 2023 12:29:11 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233879AbjK2U2v (ORCPT + 99 others); Wed, 29 Nov 2023 15:28:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232601AbjK2U2t (ORCPT ); Wed, 29 Nov 2023 15:28:49 -0500 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14DB3D7F for ; Wed, 29 Nov 2023 12:28:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k3KJqrlYFpuIvO2xdeWgBgak2JggwK3sQJWqhvBP0hSVLAxa0lHZzvDc0d6YMq8kVGQEnPoZgNBXVt3ai4xAKJqYOgcPd9Gqz4951CViF8dsoS0eeAt2bUeeTm5vUq1HiXQ4IjvPnzWsq6+/NnoEDIOh9cYxhIc4T9EoBKYIUetFx90E5cWUnOhuzNpsvGKxBa17RXr0yqVdPCrW+lSasGmGnrw2ihP6NKMyFIaA6nbucdw3+C5Z9/+utO19pnfcAv44zI2DcWaShZWKHVwwThLe6dyPGexQ+5ZFsfasd2d/hjg0MX0ITUtzFZQgqQfF/fW+GYFJ8P2ZzAXm5nchaQ== 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=arfC5HOCyr9RCk5j/wf2IJQF2IhmzSKw7EojVsax6qM=; b=PXpKh1kIRsx8BAokOzNKdPiY+6rRMOhNwA+Ks/jUc+qw2iy5khx+yUZqTELVQYjbJKNPIzXLjvBJ3gF3jWKL9iT1SksTxR0cEuW9Bd9Qvacn3scmLmLsc4fQaaAwy1tCdL+B+IBQKbQzYTDmTUVnQfNG4S+SGL3p78vV3sl8ndOqi+ax1c1FomrOnZBkOKY4BM4NA74PhwM/sOokVfuy/H2aXeBjci4gTsBqom5leHKlnLHpLVixC4gXFQ/f4zypNuS+j6FbwMKo9DFWB90l4Uy3Rkd2j/qPtYUNne+b38uKyFylOpeH39VdSZGQIXy71HOy9iPn+ecs7E8mIkDHVQ== 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=arfC5HOCyr9RCk5j/wf2IJQF2IhmzSKw7EojVsax6qM=; b=UkzfligbpfuWfWH2Cmt0rjvIi6D4tP3OwpiNnh/rnJjYk0CpIdZ+hDiNF9Q4cR8NcP2tvJiigT2attM4EyepfGjMTHqb4Un4fXkIyGfQZR3zauNeuW/oh2kBYlotetadzB5TqKMeagodrX0ndCZgVHn/udMjtW7WcjlrPl4b8y2icU+0/oihIy7fTRcEi7tKegLnM7zceK0ejG1yS33qGc/t8MzzGs1UESC4nqfBr4KtEXUb66RufuemoLSbyLXcn0dxsxZNJdYkajgU+VYVbyZJD847Xb3LMJC0Ki0MRGkfQKlKBLQ7ZueSieRPTxAaZN2Tg6gFzUaq8+rpZd23Cw== 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 MN6PR12MB8541.namprd12.prod.outlook.com (2603:10b6:208:47a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.22; Wed, 29 Nov 2023 20:28:53 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::60d4:c1e3:e1aa:8f93]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::60d4:c1e3:e1aa:8f93%4]) with mapi id 15.20.7046.015; Wed, 29 Nov 2023 20:28:53 +0000 Date: Wed, 29 Nov 2023 16:28:51 -0400 From: Jason Gunthorpe To: Lu Baolu Cc: Joerg Roedel , Will Deacon , Robin Murphy , Kevin Tian , iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/5] iommu/vt-d: Add support for static identity domain Message-ID: <20231129202851.GG436702@nvidia.com> References: <20231120112944.142741-1-baolu.lu@linux.intel.com> <20231120112944.142741-5-baolu.lu@linux.intel.com> <20231129202615.GN1312390@ziepe.ca> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231129202615.GN1312390@ziepe.ca> X-ClientProxiedBy: SA0PR11CA0176.namprd11.prod.outlook.com (2603:10b6:806:1bb::31) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|MN6PR12MB8541:EE_ X-MS-Office365-Filtering-Correlation-Id: cc0a2993-f3be-4fb9-6432-08dbf119cda2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CRzVLtKacyaLM18uWY1jaepo28ZCZqIbuHMLmDS+BwhJnr45FE5uCj6W4YZso/3rIHXFiy9BXXyrWpGZgFuTIeQPyASGv2/jmq98cJsvC+SRqk1cjsGT2K+QS+YJHTFBA9WSwdMs0uo27N35LLTcZ0iCjP0QgmnB1qhqNvjp7CvygQakpwXDPcyilMGY7dZenNEaYIVnr/czT1KdrTdJRjl8DPinVNXv3hnUe8TXrvTp//arxAHfUSOwx6qGNK8+LRwRtbZaM+r6QmOIJRm4nPMVGmkGvf0lotWZ9X8RwMBrPL8+4e5/BXspwTBQOj+yU9y5i0ny1029DIoLV/bhTWnM2UjOKRz3kn1Pi6TapEgA3V4fdkad7iLFhoeXCL+jianI1vt2qT0sLgfLil3DJqpJAtAoIilwAIFD75M2UhFANWAW9WL19dPdJQWe4m4dWdH/iBR+YTqKvotpt7UFuE0F8nqfDs+Ue6XpUj90d4Oo0/CYTwLBL+p3Rl/28qGhM+z/zL9t7mP7bzEWVWH+31zGtmrmEBoJspID/n6yhkvtVLEHVN9YWvIp+zqXF9xUYwDfpikwWqx2KeoufLhFJgmBhUCbS6+f8CyjRPzMSCMP6DcytDLQJScMoZV4Z2sRY7R2E7Cn4Z4Cy52CBY2RZMQQ8IuZw0C6lL6+vvxDbsc= 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)(346002)(136003)(396003)(366004)(39860400002)(376002)(230922051799003)(186009)(1800799012)(451199024)(64100799003)(6916009)(66946007)(66556008)(54906003)(66476007)(316002)(8936002)(8676002)(4326008)(478600001)(6486002)(36756003)(41300700001)(5660300002)(4744005)(86362001)(2906002)(33656002)(38100700002)(2616005)(1076003)(6506007)(26005)(83380400001)(6512007)(202311291699003)(27376004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?koLiAOgpS/jjU57/H6hSuOOe8JB8FQKed3i3uSJP1mboeDPppxfRqC8hCy4B?= =?us-ascii?Q?GQc7HQD74xFAckYeCqqh/cgRxX+Ws4ekHS5Xs9Hi6/bwWaPfOWHGdg27pKDL?= =?us-ascii?Q?juYAVpy1o3d0bIwUehhFIUQ88i2EBgt95sh8ST0HSuaYoijqw+nHVF7xkvzz?= =?us-ascii?Q?somCHrpJEf4IouU4MItlbVlLOcbSFYZC7EzVy4CVk52QFpJr1f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v+QL+3ACw4US+UqFYW05jRfB38Qg2Wiw5XAUsxBLRmxnjcobVmRzh?= =?us-ascii?Q?mFjDq8iyQGAEcfdjUjrIO4lFYZTRt7VluVPGhNuWwUyU4n9mDE42ZQLL+XTE?= =?us-ascii?Q?pJVBal/Hl0aw7rIcvCf1MRuT8lvHHhUgJ6zEQ4KLSAPXoZ2V62vgh4QXrfYp?= =?us-ascii?Q?Z+GLeIUQ4Y0f1fr3qEdEWA5yasg/YeUETX/9FsjKRH87XopxfXiBCXRUU1SQ?= =?us-ascii?Q?kowsouQdURZ1dP02GRZq3LmqU0pYN0ySkQrsKDAuNb/cTE8Jij1y0w/h8UsD?= =?us-ascii?Q?WG/z9lHD/PLE44TFbbALBTOdHZBb/vf4pPK5KiogfEuGoCcZTwcq1rakIPAq?= =?us-ascii?Q?bfIDwV6U1OyP9P4gOGDfNpIXqNtOoq/dxqPmQNPteps8b5+AYHGVD+0vZ201?= =?us-ascii?Q?NvsIaIfu/aOiYKGZLQwE0Z85nwLkX7g16VeUmBtXRBWooU7CAAEGo9KFjt/K?= =?us-ascii?Q?3pD/5+WAoYi7V0a7dF/LKcCfwN+6CMDkSOfYSA5r?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: cc0a2993-f3be-4fb9-6432-08dbf119cda2 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2023 20:28:53.1538 (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: GwROXKCyqbaWWeJYBLgXId+7VpuW1Y+iLLcRUMxqdT2ReWAKoQmShkUpxuXKjx6D X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR12MB8541 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,T_SCC_BODY_TEXT_LINE 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]); Wed, 29 Nov 2023 12:29:11 -0800 (PST) On Wed, Nov 29, 2023 at 04:26:15PM -0400, Jason Gunthorpe wrote: > On Mon, Nov 20, 2023 at 07:29:43PM +0800, Lu Baolu wrote: > > > @@ -2311,6 +2316,13 @@ static int device_def_domain_type(struct device *dev) > > return IOMMU_DOMAIN_IDENTITY; > > } > > > > + /* > > + * Hardware does not support the passthrough translation mode. > > + * Always use a dynamaic mapping domain. > > + */ > > + if (!ecap_pass_through(iommu->ecap)) > > + return IOMMU_DOMAIN_DMA; > > + > > Doesn't this return from def_domain_type completely prevent using an > identity domain? > > I thought the point of this was to allow the identity domain but have > it be translating? I suppose the answer is the next patch deletes that stuff. I would probably have structured this in the other order, first add this hunk and say that old HW is being de-supported. Remove all the now-dead code creating the 1:1 page table, then refactor the remainder to create the global static. Jason