From patchwork Wed Oct 11 00:33:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13416479 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5F7EACD98E4 for ; Wed, 11 Oct 2023 00:34:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gVPknwvrvCTBCoO68X245n2vIHDaOFdsPz7oRbuok88=; b=gm5byqwX/QhtKK PSJivvnuNW2ifuTVVF/S1TjB2SbNHd6HMvQmdwAmBDqZxq17lZZtSLtCdNCCKLx0bsHONWDuu/k6K CnYN25KZbgUuNpHiKfcZhB8bMYjJf8NxR+iJbJtC57xT6iOGocoBkj+5A6vucbFMBpmFur3QJBeg4 LPJmNrLxtCBFT3tViFkPkF9LZR2CU3ZCmEFN/+22BYh15MlwG1Xv0nV5TiuhmFVBV4U0Qv3Oje13p aADog4Bmkw3nKijrXzkypZnjZM4pNPWGiy1E+d46B8a4VXEEraeL2LVCzFtNlGxrNVszMpupSCgRF q8FNcJ+//mzruJWdLaoQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qqNAp-00ERIj-0X; Wed, 11 Oct 2023 00:34:03 +0000 Received: from mail-mw2nam12on20610.outbound.protection.outlook.com ([2a01:111:f400:fe5a::610] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qqNAb-00EQyX-1c for linux-arm-kernel@lists.infradead.org; Wed, 11 Oct 2023 00:33:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WCn7+0jBN63hsa1TMTLy6U+g4v4QqUe/uqP+ep8z1k+ZNlzNbocCeeoKH9iXMtFOBlf0owsECUS2QrJT9a02H6HvDsa1uct90iuLyfpJNnbxWtO5+JRg0QQgsDQSCFhTEGj4QvWY2JQQ3ouyTs8l8I+lMCeowdK88qoZ4KnhP6Qnvx2Gn7rRMf0dzIDgrbq7Vb2EuMMLMv2Pcpfgi5w2PCSEcjE8HoWyloOZxkHyjHJf47EjwrhSdd/ovf+3ENlk6XJfzVJ9d0R79+fk+MPO8IkQ2QN+/yHBmWFvraRLOEf0BJtUa6vZOJqD6rRP9ok77TTzcETaH7Z1NisFYh4w+g== 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=jZd7R7J2PzBAsBBgvft5UKof3LboQwE45ppu9LD7xx8=; b=P/7n7BdEKIOBXbaqgQEk5mmSVdj7X4Ll9h+kHqtbSvg49lPm/QPY2BlQXQUvW50Xq7C82utRJjatF/h1wpMt40xN3pDka8sQgAorxzNxmnPINrFSy5CslSVAlMoCqun2ic5QDYG0ekXdCgtixxks/GjOLQfzv/QElB1wF92l9k2ovXBqp89y9FV0sKLZZB7V82Y2zNiOCzqhhP23V4FKLhfksbVlOQ5y2F3Ygw7Q6U7kCFVqbhBxN44HTYaTyIYgjHSl3T/p9OnRYCf6fTr7sCZY75vkcivNihYI4Csu977aeMS3v0OO3Emh6n1jnOAXsGP9+iMf+3Avdy39GxWaKw== 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=jZd7R7J2PzBAsBBgvft5UKof3LboQwE45ppu9LD7xx8=; b=rvkjAa64KiRSXu+0eFVq+IXRe4rjwqWeKeJTIySmHzBZ6yUBrERw9qQDx68wfHGrgfW7Q35heb+RKHImwbavZIWozHHDRq+2twxQ50BAONA6tVN5pbI5l7E6wfeRCazcYDnl2cwadevNw5uLUT1//c3e586pft7p5Fso6JEY21ix2JQ6lwQthn6KK61yoP6SildHW2GMSILEHVKFNMnwzHQdh1hRgimfwDAsjbreaWCGO04gXRnOy/sFtq68t9CM4rCwcXkK0k4q7KPBHeb3EUf9gerzSECMTWarzU6VdyMC1/UOn2D7+9F2udfOLJhsI3AS8nmrhdVW6RrGLGa+ag== 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 IA1PR12MB6625.namprd12.prod.outlook.com (2603:10b6:208:3a3::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.42; Wed, 11 Oct 2023 00:33:31 +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.032; Wed, 11 Oct 2023 00:33:30 +0000 From: Jason Gunthorpe To: iommu@lists.linux.dev, Joerg Roedel , linux-arm-kernel@lists.infradead.org, Robin Murphy , Will Deacon Cc: Michael Shavit , Nicolin Chen Subject: [PATCH 13/19] iommu/arm-smmu-v3: Pass smmu_domain to arm_enable/disable_ats() Date: Tue, 10 Oct 2023 21:33:19 -0300 Message-ID: <13-v1-e289ca9121be+2be-smmuv3_newapi_p1_jgg@nvidia.com> In-Reply-To: <0-v1-e289ca9121be+2be-smmuv3_newapi_p1_jgg@nvidia.com> References: X-ClientProxiedBy: MN2PR18CA0023.namprd18.prod.outlook.com (2603:10b6:208:23c::28) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|IA1PR12MB6625:EE_ X-MS-Office365-Filtering-Correlation-Id: af7bda9e-f432-42ea-0a63-08dbc9f1af6c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AZo1fjaRDWWOeXlUocvHoPmSw941xPCs6G7oif+VhVSIQKRsT8FbxyN04Q+Hah+6Cj5/bmUufAYTeWRVz05+ljWY+s4EtkcWjbsRZiiezwQOEwlL3GhrJJMVWtnveI7Fao7M34jC/zoS8ZWgfqVLT3SoCkoA9cosfxYc7l3PMLAJ6pNMcMout5jBEbv65iq7jyZBZZrB59gFJR6RGa89/zoHCj2OYc8xd0I34Tc/i3Rap9x9VEwzY0SWFllniUzSIwsoGTbLCqJQsk3EU9p6lufTVPy7MpdfDjfM5YI35AfIMEREc54X3jdMWu4z+rAUr9OF4ltNYLHMx7+Ne15UBD+DkZnVXuwNKNBzwfO6+QTAp9h5agyJiHvNLpeTTYhbsRTyXFjv42OB6k1wMH9dIFulYH9Y8BVy7mZJ/RToYFFoGyJdGGG4CbEEZ3OSj3isxH6mazuuVh+JW0E3UqzwaLHJnh52txkbB7vEdaY756qGarSpc/iYrtguTJVdR55CV8DR3tG37SKFUDNXn/sXNlDe05Qg3C8j6phblPd3IlFeWsuHSwF6r5EK7OBQZOyy 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)(396003)(366004)(376002)(346002)(39860400002)(136003)(230922051799003)(1800799009)(186009)(451199024)(64100799003)(107886003)(6512007)(36756003)(38100700002)(86362001)(26005)(83380400001)(2906002)(6666004)(2616005)(6506007)(478600001)(6486002)(8936002)(8676002)(4326008)(316002)(41300700001)(110136005)(66946007)(66556008)(66476007)(54906003)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HcC807ZwXtDwXU0lsxz/ogCLSdMTBPB0vNBum4EZDXf7yPZtKNiwVRoN82jkwv9+Jvxfem/jbmr1XFyWJTeoHK7XgYENDRrSMjxsceOeovFoEArPfnsDz9UxxjvVst5hjt0LuW36t0MbCdxkDMhnO+rlvNXHRjO9o9VvVRsMc0QrIBz7iJt/o5HqkJ1qxua2C0gjPX0XgkclQoMGh7axFbJSpXxjaNv2zQv82to0ouLanIUqc4eLORBuhbCOywEILE+i7amoQ5EIhCd78wC6bZ6wFAy2wZIvsY2IbZUmp6cyd0tJ7MwJRCyYCHNOBjiFGtt7ZGuMdYYmp08F3HuQYBc08fX5GMQEMe7yaqTYo1lF+S89YDgqBpHiHxkAFPj2Ay0rJaYLk0xOxBjQRW/P/V9XsPOfIHGvUp77dDbRwSZqHVO1560DooeRy31a12EIPwUaX+NXQYBvnzMLQb4iOOve62YH6jneZ+A0IFqc9L/bBBfez62goQWSWrmItp1ZUagGAABxMhqTWdtkua3fOHPadjnDlqMpHdgNFet+F5RGrrzLd4bM+u0QXWD7u5ZkCMHlUnRS14ijPdvtWpSJw4nudAg5KR+Y86VivTRWQCvs94sy5u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ange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2023 00:33:27.1913 (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: HdtRaUDczXEZwCj9unT2w60w6WxjtpaLOS8OdSLWgdNmeUJ8Zi40EmpyZ7JVYsOI X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6625 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231010_173349_548305_EBB27239 X-CRM114-Status: GOOD ( 10.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The caller already has the domain, just pass it in. A following patch will remove master->domain. Signed-off-by: Jason Gunthorpe --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index 540f38bb44873e..34893801d05c73 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -2369,12 +2369,12 @@ static bool arm_smmu_ats_supported(struct arm_smmu_master *master) return dev_is_pci(dev) && pci_ats_supported(to_pci_dev(dev)); } -static void arm_smmu_enable_ats(struct arm_smmu_master *master) +static void arm_smmu_enable_ats(struct arm_smmu_master *master, + struct arm_smmu_domain *smmu_domain) { size_t stu; struct pci_dev *pdev; struct arm_smmu_device *smmu = master->smmu; - struct arm_smmu_domain *smmu_domain = master->domain; /* Don't enable ATS at the endpoint if it's not enabled in the STE */ if (!master->ats_enabled) @@ -2390,10 +2390,9 @@ static void arm_smmu_enable_ats(struct arm_smmu_master *master) dev_err(master->dev, "Failed to enable ATS (STU %zu)\n", stu); } -static void arm_smmu_disable_ats(struct arm_smmu_master *master) +static void arm_smmu_disable_ats(struct arm_smmu_master *master, + struct arm_smmu_domain *smmu_domain) { - struct arm_smmu_domain *smmu_domain = master->domain; - if (!master->ats_enabled) return; @@ -2462,7 +2461,7 @@ static void arm_smmu_detach_dev(struct arm_smmu_master *master) if (!smmu_domain) return; - arm_smmu_disable_ats(master); + arm_smmu_disable_ats(master, smmu_domain); spin_lock_irqsave(&smmu_domain->devices_lock, flags); list_del(&master->domain_head); @@ -2584,7 +2583,7 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) break; } - arm_smmu_enable_ats(master); + arm_smmu_enable_ats(master, smmu_domain); goto out_unlock; out_list_del: