Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5533441rwp; Mon, 17 Jul 2023 05:54:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlFogp/R11EfljhFHiMYXv77mSba8gdq11vGHEFa0OIMm501vu49zU6WBK1AUUOIBY05+SVx X-Received: by 2002:a19:f618:0:b0:4fb:74da:989a with SMTP id x24-20020a19f618000000b004fb74da989amr7990717lfe.3.1689598459342; Mon, 17 Jul 2023 05:54:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689598459; cv=pass; d=google.com; s=arc-20160816; b=g0L1HxTr/9mDW0+EM+wvpSfeTMUV1qNaBtgUtgQQoI+n7pgBhbmm2uKpVMcaU/Cjyk Sw8Pvm2mbJslIcygTq5tcnTieYDdbQLPJDuSm+IQDAqzXFRmmo0OzRS2zMqxJEhmEIuc OQ2ABR/vtQqVjZg0tYrhNFihi1lVG32x+6UqcwotE2BhWL8Z4dD8CNaJ7jwlQ75PlEhO shX+94G1Sj58j/vidhOYagoa7mjcZhxy5fuALk6hEyO67NcnnA8Vwwj7lyfNODkeuUT+ o7cTgchcgrbcldDTEsrPSU1akFPi0pipuhHE8p50VQ/zLmabJ3O+h3qHJ9tCD8m+HHcv +hKw== 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-transfer-encoding:content-disposition:references:message-id :subject:cc:to:from:date:dkim-signature; bh=esIpGah8yMx3HJl8dTbgIHHV3UpoD9bop3bNtdBpgms=; fh=uAgfBMYdT9xYq5aKQLfnl9zLsfCNEr6IBP1Gss7vyS8=; b=ApKBgBXeNja143sqK/7eup7GC9J47a6MjyEnBk9/5PM3sQO2ykCzftOFXUQfsO+O1b cFrC5SoQouNawYWKroeDRTEBOn8CZSNvgeTq9q+kfqL92J79RCT/SLOHxCQVJgPYu+fr 0nzBklByCpolkaz4KPAkTJv2T5rhh/UikctH8kt+fYUEM1mFXBF/oegbhs76yfM2kT40 fH6lvq+DHv73c42tSEK7sJbeEzJhl/FLJzNf1Ib4haJNk6SQt1WSfPumq4H62N7ybwUh k2X+AusPz5/MYN86K82sO6H+CIu5ZFKmBtn6gXuPlrnJtJsn0rpKZjAe9Z0u2vh6L0EN b6rg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=XrSeyKqP; 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::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d2-20020a50ea82000000b0052026a148cesi6410417edo.44.2023.07.17.05.53.54; Mon, 17 Jul 2023 05:54:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=XrSeyKqP; 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::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229868AbjGQM33 (ORCPT + 99 others); Mon, 17 Jul 2023 08:29:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229626AbjGQM32 (ORCPT ); Mon, 17 Jul 2023 08:29:28 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2066.outbound.protection.outlook.com [40.107.92.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9D7BE1 for ; Mon, 17 Jul 2023 05:29:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EyqsASYSPSJvlQdGXc2Z7f8VLtjns4Za8YRnbvvUZOFWLC4d69ZVSXAyn67AaY5V2uGftaXwhRi338NT6N8YEprccAz0MIkLXBBvEcn9U4Gjm5Crhi8tm1y3OqVz8KoiDNvj2B1ZgdzczwC2AZVLXNIi4HpRACorpNcy/iFkyjUQBV69rpxS0ldVC3zCY0S/Em/68PAQCOl9S62KMh0LLd75b+Zag2dubf8/Ai+x8yyq5UnlhmcvL117vn+TJJ00JLcky26TGui1N2yRdLh4PxYBWE9MS21nW/w/A59UmE7HNImOWoJN5hzon5RZLNL/u7D/KrpR7GXn7p2y5W8Cig== 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=esIpGah8yMx3HJl8dTbgIHHV3UpoD9bop3bNtdBpgms=; b=jOqSKmZtk/kmTdIoFYetGnQg7x3MkI1ZDvDTIgZRS8CVMzY0RExtB1+NFgvzmwdK0xA92FqZYU6lG93ae4y3Qf4nsrYL+OGbLmryIkd4R75Dfsf4dt2cx+TB2OyhIBq6H0bAaKh91qjwJ2sEaVUOLJjHQfNw50blCDEcJDk/IRBAC2YWmOgiI1uyKbFYRpcy81JRrK1SsNYjvoSxLQYSkwn0/9YSMiQbhev9DsDMkx6vRQNvdeOkMF/fFuNu9gKgWDeGA9hpjt1Y/TykQHD4m4s/jqXbSrDVx2JWJUy+6aEz+hNC2cWvz1EWvxK3Jvfrrik/dlvrmjCi7dLGbmqjAQ== 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=esIpGah8yMx3HJl8dTbgIHHV3UpoD9bop3bNtdBpgms=; b=XrSeyKqPPgVOhcM8XT2z7FAOiHrEVhawHaAaLOXfDyYiFMYf2rOzRBa1XTwjCz9N+4vWh+6YPMUaQdvy0NrQgeLARKimIERstmwoe9gSNo6V5sEhIC3BfR34c23thJ+gTmZACJVMqt56e6o1KdrvtqtCNo/giG1dsJb31rbVOuAklYiRSdw2DHsd7Hu6I6zkMUP1yNJ8+GRHnEcfPjauLo8kmKMEKGB2biSjC4G7gCQaQsKWss7QwbKZQnlF69JyG0cpZ8FYeUdbrWLNEVur5H8Y2mKfq9OBQUEHjH0ivuDFEdyDcshki/fXmE1pxnjd4tlePv4nNP9q7fp7Evbn2w== 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 SA1PR12MB6846.namprd12.prod.outlook.com (2603:10b6:806:25d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.28; Mon, 17 Jul 2023 12:29:24 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::5111:16e8:5afe:1da1]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::5111:16e8:5afe:1da1%6]) with mapi id 15.20.6588.031; Mon, 17 Jul 2023 12:29:24 +0000 Date: Mon, 17 Jul 2023 09:29:21 -0300 From: Jason Gunthorpe To: Michael Shavit Cc: Nicolin Chen , Will Deacon , Robin Murphy , Joerg Roedel , jean-philippe@linaro.org, baolu.lu@linux.intel.com, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 02/13] iommu/arm-smmu-v3: Add smmu_s1_cfg to smmu_master Message-ID: References: <20230621063825.268890-1-mshavit@google.com> <20230621063825.268890-3-mshavit@google.com> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-ClientProxiedBy: SJ0PR03CA0108.namprd03.prod.outlook.com (2603:10b6:a03:333::23) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|SA1PR12MB6846:EE_ X-MS-Office365-Filtering-Correlation-Id: 61d671bb-1a94-41b9-146d-08db86c17427 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wMikb3p10b9G41ulKLgHLQIf7TcvlmhE7tHE7anp4Koe4gz6P234PKGH0GlrcovM8xJ9v5pAKeoTrQY8nU9kO8lf1zum0Iwy5Ai+lUMHJ+dZ5xu5gIYNyE9AUKWYCJCN9CvCLqA9V5tDxoTOa9evRlsi4AWQVUTMIpBXYlgDLFguwfRZeaCTz3H0K4U2pOoUO9mVC+HZ+G16kJzGlZJdEDkr3Uk1cVxX+/B5okwqcDtOYQYk98THeweKwGuaeos5E+Jj2LXn/wlpD435ZxblPbF3Gl59yWEiegOkRsfclB1STEMAPDB0PZcG2oDI++jjg9KwxML8/Mj2kGHhgS4dkDG9Ps4GOY6fTa4vfhrCH17vct7eK0Q+7CasoL0KF76/ZyE5Xqs1g7sFDKyqcL8v0aKPqrttZkziuTHLhLeVewjL/07ybmjaqWGMNLbA2XUMSD4x5OR0M2fpFHLYmPtppnHZckE87h1JCy9jMRm5oeu/ZqQNwlvud7wbhq1MCrGHX/rXGAS5Tm5nAvN4mRvtnHer01mc3mVsS5o28j6W9fYEiO74fJomi5gERxmKUuXcUBugEKkJ1EVac81los0naf5sdLB3KkTMwHvMOxF36eKnUvrPL9fRqpungYvAkUhvL+2DktvSyLvFdL9f1BvdhA== 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:(13230028)(4636009)(366004)(39860400002)(136003)(376002)(346002)(396003)(451199021)(6486002)(6512007)(6666004)(186003)(83380400001)(36756003)(86362001)(2616005)(53546011)(6506007)(26005)(38100700002)(41300700001)(4326008)(66476007)(66946007)(8936002)(8676002)(6916009)(66556008)(5660300002)(316002)(2906002)(478600001)(54906003)(473944003)(414714003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?K3JFQXdtWFp6L29LVEdGR0x0WUdDNGxJRzhnU3M2UUlYRm1BQ3k2WEhtTlRQ?= =?utf-8?B?OUZhTlF5ZTU5d2ZkR2NHUUV5OWlGVE02RGFpaWNObWVFaVkrV0c0b2h1QVFB?= =?utf-8?B?b3FvMVJVbFlDcDRQeWo2SnROVEIvNnhhcXhKaEFnaU1GK1V2dWV6azBWV0Jh?= =?utf-8?B?NE5UQ2p2WDIzWS9xYllRclZwODhpTXZoTnNnQUhVK0ZpSTZqeWxNYlIwWW9z?= =?utf-8?B?WVE3N3dBVUZieHRnQTRjazBHcmlrRE53V2g2SGc3Yi9rMmZKK0hIaXNVZFVa?= =?utf-8?B?Mk5Dc3dLL09QUkUzdGYrZTU3dDNTOUtzenk0bFJqdGZYcy9MNHpZblZld05S?= =?utf-8?B?c0JGOFpNaG1jczVoT0pZdEQxYUQ0ZnZpSVRpMzR3eHlmNW5YUDNxZ2drN3pN?= =?utf-8?B?b2J1NFBNU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ource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2023 12:29:24.0026 (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: b1K69I/pJOG8XUieCW9v6L3Qo9xP7hFjlPHrJLQTgjUdUEmZh8qu51fo23z8QP10 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6846 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, T_SCC_BODY_TEXT_LINE 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 On Mon, Jul 17, 2023 at 06:06:19PM +0800, Michael Shavit wrote: > On Fri, Jul 14, 2023 at 9:21 PM Jason Gunthorpe wrote: > > patch 2 should delete arm_smmu_s1_cfg and just put > > arm_smmu_ctx_desc_cfg directly in the master. arm_smmu_ctx_desc_cfg is > > a weird name for the contex descriptor table, but it is much less > > weird than s1_cfg. As you say s1fmt/s1cdmax are redundant. > > s1fmt is fairly trivial to replace but s1cdmax requires inversing > previous computations. I don't really buy that getting rid of it > simplifies anything, even if it's technically redundant. Then store s1cdmax in the arm_smmu_ctx_desc_cfg and still get rid of arm_smmu_s1_cfg The point is to get rid of "s1_cfg" entirely as language in the driver *because it makes zero sense now*. Prior to your restructuring it was sort of the STE to use for the S1 page table which had an embedded CD. After all this change it isn't realated to a S1 page table anymore at all. > > patch 3 I don't understand, we should not add something called > > s1_cfg/s2_cfg to the master. The master should have > > 'arm_smmu_ctx_desc_cfg cd_table' and 'arm_smmu_domain ste_domain' > > This was simply meant to be a more convenient way of finding the > currently active cdtable from the There is only one (meaningful) choice though, the cdtable is either the master's default CD table or it isn't. You detect that by checking for NULL ste_domain > > My suggestion for patch structure is to start by cleaning up the CD > > table object. Make arm_smmu_ctx_desc_cfg the CD table, remove the > > redudencies, remove arm_s1_cfg, clean the CD table APIs to only use > > 'struct arm_smmu_ctx_desc_cfg *', add the 'ste_domain' to the master, > > and then as the last step just move the arm_smmu_ctx_desc_cfg from the > > iommu_domain to the master. > > > > And that is a nice little series on its own - you end up with a shared > > CD table in the master, and no CD table in any domains. > > I don't entirely buy that refactoring s1_cfg is worth the extra > effort, nor that it should be tied to this patch series. This series > already makes s1_cfg behave as the CD table; whether we want to > entirely get rid of pre-computed data useful for writing an STE sounds > like a separate cleanup. s1_cfg is a terrible name to describe the cd table. Please do the tiny bit extra to get rid of it for clarity. Jason