From patchwork Mon Feb 26 17:07:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13572528 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 9FB45C48BF6 for ; Mon, 26 Feb 2024 17:09:09 +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=55An+1QY/nQOuNnv8mCWuPfTnvNgF4XRg+b8Gg2VBck=; b=1XOxCT/t96uBvB MprTkf1KyjnK/WeHN33xVbF1ZYHBYC2Cf+gw/raV+2ncENxqfT2N5jWduI2kuaSM97Ogka7KMGmt2 UYbjWcplwNymN2oAuL3duJD2TMRwCq69PfzCzB39nommTrcpHQ7twGgUtg9lnvGh+FhdIrGf/ilSv ZkIlTNsLgj+r4fbdOn2PXzHrgEWSwvrv5pp8dxwyNbyqhXS4pmHj5V2IzN8hQmKIfJFXUB2pstmZ1 SvRADY7XT1OTd0n+w8eDjd0eLI/pJ+DA3Tl4HmLiabdgvWpfzkKoZrlIvLYgOjaSy+9riqDFv7BsI M2l7VV+9kNynraJAb0LA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1reeTC-00000001qMk-2y3y; Mon, 26 Feb 2024 17:08:50 +0000 Received: from mail-dm6nam12on20600.outbound.protection.outlook.com ([2a01:111:f403:2417::600] helo=NAM12-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1reeSE-00000001ph5-08u0 for linux-arm-kernel@lists.infradead.org; Mon, 26 Feb 2024 17:07:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NYKUHTL3p3NCwac3JFBwS0ofHqIAZgNYaWHJkTtctyjmjT9JJjwraD20UK+nV/B1kXSpG585PBIdF20QwyIVAMKUq62ftruJSYXLMXNWvhBNwuKnJUORf42Oa3vulAasbsz7p+jIJ/9fa3h9VEqNH8WuYP97j0E9641yZh8Px3UtEtWYGJCQBSZL180Y/PQ12Z0kZs5UFDwl3GyNx5EiFWJ3bbAmOT12DJho4RYGG3jcYVPEviGLzOGaN08LvrAVaIbuQ+4rs51l1Bu9U6NHFKEgAK2tyF+45fcSbFtjbfJdWdJ1UEq/piSaDTswXoHj7csI1WUHVJG0DLW294APyA== 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=kNhxe6eMYEbii6HPeFDwaMDwArH9oJKo9Sih9qVvjY0=; b=ObP6BxfeS36viyZW12A1E6JjJwna8q4zSjvIPNy4YfA1+JY80XPqgMkXqsscj+iHTUjgpB1MhkIUlX9oPf65to3wFsv7YZHKaS/mGqZTLrpPku6sszk81FlJRdXK0vOgsQANg22eMhDhSMoepTFJ2XGw/t3WvTMUDjxU45ZubWSvL2aN1DRPaeetruJ5y97EsLq3Wo48W/KfxnuqXZ8XHmnZ9eOr6OPkzAMP3x1/hByPTQW+mOo8QhoZIV2GSq7ku50EvorFskU3/UXwxDE/DHUewccVpNDCHalZ50Rs6lsc/DChwCoXRuAsyAujq0NYbqhzB1MDu1So/UVQX0gdnQ== 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=kNhxe6eMYEbii6HPeFDwaMDwArH9oJKo9Sih9qVvjY0=; b=JV1mXfF/zmuMyGVenepl6w1ZEsm5kb3ciYIimFvO2QuR3qDE0Z+eNfsg3oOBNMA2xoollld3OvbjJkCwXL5c6+4MdjedMA1tyeMi2e0FtKi/6Ruxg1q0Caq5XD+pC1G5KI0s/vA783Teo0FcV4PT5lW9sQ+jW3azg4XiI56tdZDNXyuwUTfH170fGoS1FkZ30ofjgM8X/ZJyDDsfQfP/Ox4CMz/Rrhx6tXc2wLNj+x8MjLlXKyg3rypPg0aRQKHEYRS5rCUsU01XfQCkIqBRys8jLXNIxXITNRpoq540QwhW+0u+NfXS/qTdV1kxLAgxdR+qL/MfwH0Sy1uTgBA5AA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DM6PR12MB3849.namprd12.prod.outlook.com (2603:10b6:5:1c7::26) by PH7PR12MB6905.namprd12.prod.outlook.com (2603:10b6:510:1b7::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.33; Mon, 26 Feb 2024 17:07:34 +0000 Received: from DM6PR12MB3849.namprd12.prod.outlook.com ([fe80::2e3e:c7c0:84da:3941]) by DM6PR12MB3849.namprd12.prod.outlook.com ([fe80::2e3e:c7c0:84da:3941%6]) with mapi id 15.20.7316.034; Mon, 26 Feb 2024 17:07:34 +0000 From: Jason Gunthorpe To: iommu@lists.linux.dev, Joerg Roedel , linux-arm-kernel@lists.infradead.org, Robin Murphy , Will Deacon Cc: Lu Baolu , Jean-Philippe Brucker , Joerg Roedel , Moritz Fischer , Moritz Fischer , Michael Shavit , Nicolin Chen , patches@lists.linux.dev, Shameerali Kolothum Thodi , Mostafa Saleh , Zhangfei Gao Subject: [PATCH v6 09/16] iommu/arm-smmu-v3: Pass smmu_domain to arm_enable/disable_ats() Date: Mon, 26 Feb 2024 13:07:20 -0400 Message-ID: <9-v6-96275f25c39d+2d4-smmuv3_newapi_p1_jgg@nvidia.com> In-Reply-To: <0-v6-96275f25c39d+2d4-smmuv3_newapi_p1_jgg@nvidia.com> References: X-ClientProxiedBy: BL0PR1501CA0017.namprd15.prod.outlook.com (2603:10b6:207:17::30) To DM6PR12MB3849.namprd12.prod.outlook.com (2603:10b6:5:1c7::26) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR12MB3849:EE_|PH7PR12MB6905:EE_ X-MS-Office365-Filtering-Correlation-Id: 93b76a7c-207b-43f3-ba86-08dc36ed6a6e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ax8ckTOoNOkpACU/BKr6FKu2mqzm6P+y7zsg557XQU9U5Lj8VCYFsd+zl2ib7h8+UGBrbE96dPdMrj3VcEJRUVx+ynV1a2S0uQCe/hmb0cu+L0U8CKnGaPO9FxnaZ9RN9rkpvgG9u6w4B4fb51HX7p0ahwQcYqL2ki7QaQ6Z+GZIjb8rnkuDieEBC4GxsOenMs8do5FYv+Z2W+KF2sVQf4XXDxdks78MMpRx6IpRfp2u0m0ZV4W0l3nKzcp9HUGDJWBFB9z8ybhkTc3jTr+BbMwiavpao78UVUhr5DWefm9u/M0vuJPjzDG2g26MRKkRtJxcdABqObZg3A5GEgCj5nrsus8k/e0oJhycLT2xgcA1FylH0Ya/MFunPebARV6uxjkfKAJfRvuVJXTaYsvhjSBVZkN+xwTK8Vzzo7gJOU9jVgI/ybNDmxlsczG9kVWNWzhRmZpZown01nZybIeVhikt2HNch9nRosMildGsv9OXjHUsI0hLRShXtPm7/2QqEAWkEAcGKeXloLU2bGOYH03tBSxR8fy1JrnGSmw0EKNed3hZGow2zEJT2z/TrqgmPZsleEE0oswuA1cRJKXigiwEziX3xoxCTDpOOtl1YzOuvhyO3GIOhf7Mkd6jddd3lQeXDYGTJrVc6SUHyo5ptw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB3849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DrEvga3yB0Yuch7uEF1ZLdFPn8nK9gp7lReOGeFNzqlsUkXAOjz6nKls3rsUePJl7gerIcDi9N8bYNqiNhg5ctDhuhlAcagGAndQFtP+C444UfGtZ61CUfdzd48kMGSXGa3tyx7YdBNULNkqsjHW6CvmySfRZoPtuT4gOWLAb75bwUlmNQMmnQb/lXaT02B3tbR/+ddcOAIJOYQqsmLHTQV5/q27WnHCD7mAPupfuXYLYO+TVOuyy5u9spwwHiWHiOhMuXdcvK3KSYt4ThLA4XYuEZAPV4MqFtM+RdOs0raw1iYw9i8CvGzWbaObnQJ92ZxQwV1nh00fUUo9oyBwnIG+wGzC11oHNhk77GRP1wFkM/bB82rTOzESxVSTjoj+hJgojoVtjq3/mXkfIw76jfOetkr7AsKsMf6gVrfaqwVnSHq6ewGx+6MyNlcAavYsyAzJSPMPGkEcy/a+KrT17g3bin+1oX3oWZ8zM/4TjXLJx2Nahxg4/4ADDVRNuPRsGZ79wVK/Q7qYbSM8AUdFIHjRmKwzV+PeY8nmEB6422Yit8Qy9+jGvVnFzEYZg387iGukGfrei08ihyn+eR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 93b76a7c-207b-43f3-ba86-08dc36ed6a6e X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2024 17:07:30.2126 (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: Q9xk8e3TXOIhdrlaPjmkhYTkfSKMeHhcfCxnpQVq56CKyTuIJF/bk4xtmzXsv+hM X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6905 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240226_090750_466630_866CC393 X-CRM114-Status: UNSURE ( 9.53 ) X-CRM114-Notice: Please train this message. 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. Tested-by: Shameer Kolothum Tested-by: Nicolin Chen Tested-by: Moritz Fischer Reviewed-by: Nicolin Chen Reviewed-by: Mostafa Saleh 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 ec05743ee20847..9d36ddecf2ad64 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -2421,12 +2421,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) @@ -2442,10 +2442,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; @@ -2514,7 +2513,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); @@ -2636,7 +2635,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: