From patchwork Wed Dec 6 17:28:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13482106 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 994F6C4167B for ; Wed, 6 Dec 2023 17:29:44 +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=VIFMKBOt0oekVmBGXDJLU5+3mWl41K5iXg1ySW9upAk=; b=NWdZbD3nsoVyZj 7UpNqT00uIVPPLHg6dN4Z4uGj34XPLW2Do1HIJYMTV0Nhjz+GNbrlADHYO2v2Gyd79zn878qYnNzL waXsYFIHbfIRa/NMkzh94x0DV1LNqGlh3dhMPnRa6weOF67iqyTIsDM2QWZdOpanr4sEIgkCvVTW9 07gJ4euEhRLzMKk1sWkRsW5lSg42glm+a4EXbesDcTk2Wx/L97fwNXxHfy50WZTbD2ph6Re2OWVhM JMsz7bq6C1/OGSPe2+7atltNYooRlz+RAN/x1WZbCocNcC/cFW1UQw/rw0YBoLw6ITYGBIdOH0Ubj yNkJmsPlM/4OmyQeAmqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAvhu-00AtkJ-30; Wed, 06 Dec 2023 17:29:10 +0000 Received: from mail-dm6nam11on20609.outbound.protection.outlook.com ([2a01:111:f400:7eaa::609] helo=NAM11-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAvhb-00AtIR-28 for linux-arm-kernel@lists.infradead.org; Wed, 06 Dec 2023 17:28:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FnaykiL+3V0CzPouXW8rypeDadb7UwXS+onhhrc+kHFTcQu9BSpcYjg5kgRkXdH2sf4qKSolKl3RFsvOU5m9xS/oXl8+a2qItlWJRuvkPGA/sFKQWbl/8oY4gAK6DlHSnyWdMpFqzFfn3EuxJk/mviEzzbUCInBShhxIDyZdjYYjxTSAG2WMfRxfcxYrgrLLckdbSeHEiHAyMRkcKpqkXftQFucrZDDs96EzpGTds250WuvkW+RHN/2Suzc8Jr/rA0TGysg9beJHeKcw1gIbIxFP3iNTdnbe+KQGRtQh0OmdV7R5bMi60zSx/jqHl1A65yf40kM8mRAPaKE+3FHkJA== 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=xDzepfs9lFCdgqCgl6iQJZ3Z0CSeZIsWdVTnV/y9GA4=; b=EXrhXzUqVYhzb6uWcHKm7dueNoqb4zfCjWQtupC66cORQpda3RHB3/ZFAIVfTv4gQj/NkORib78rOeYzrCXAP6cJN4zgfoY7vk9fRfuoZ2ioynYQFy+rqIJrYx3XRUFEGn3Rz3JOA69n1f9yGTJCjrZJzQnr35ncPNEMTK0yzYKy1U5jTHBQub47hrYyAScASvDoFiUWmctyXaKvf/ozUkO4/Wcnl2fFu4lxyJ9t1o6TVh/3DMTxB5d3QBMpzIrWOxSw7E9bmZthwN/s4/88v9qpjJqsuCB19H+9PL8I6rpbDU07k0fdrcDw9F6hJ/4K0/OFsUY115ZgOG5OE6NPfA== 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=xDzepfs9lFCdgqCgl6iQJZ3Z0CSeZIsWdVTnV/y9GA4=; b=QV78DX+SceRPJcA1u5kpgSQGYyr2ORdLw4XPKgR12gmOqM1IgPUmW/WBwzHIUSpbsRH8uCGF+XUP29q0VG4LTv7vV6Wuj9v+UOYzC9NLOF72itVgnw+ffyYFmHpeN1Tnvb+wDPRvzvuLNE8huqaCOzH7A/iE+RBd/Lmy0o8inTJM8n5QVK+GKYI1IyCh4KdqV7/5jt/C9sexqZFPZcegkx9fccCR7kAge8HFkzCSzsThhbeAH4vLYlNoezSRtcmQa1kK8GSKTkBbI5CvdPnixxS16LaOpFIyM8FzkbygE6qbiyBrhQVAViyBnvo65iZdephiZUhHPd+Ol8xC1DFdqA== 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 CY8PR12MB7364.namprd12.prod.outlook.com (2603:10b6:930:50::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.25; Wed, 6 Dec 2023 17:28:38 +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.034; Wed, 6 Dec 2023 17:28:38 +0000 From: Jason Gunthorpe To: iommu@lists.linux.dev, Joerg Roedel , linux-arm-kernel@lists.infradead.org, Robin Murphy , Will Deacon Cc: Eric Auger , Jean-Philippe Brucker , Moritz Fischer , Michael Shavit , Nicolin Chen , patches@lists.linux.dev, Shameerali Kolothum Thodi Subject: [PATCH v3 03/27] iommu/arm-smmu-v3: Do not ATC invalidate the entire domain Date: Wed, 6 Dec 2023 13:28:09 -0400 Message-ID: <3-v3-9083a9368a5c+23fb-smmuv3_newapi_p2_jgg@nvidia.com> In-Reply-To: <0-v3-9083a9368a5c+23fb-smmuv3_newapi_p2_jgg@nvidia.com> References: X-ClientProxiedBy: BL0PR1501CA0024.namprd15.prod.outlook.com (2603:10b6:207:17::37) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|CY8PR12MB7364:EE_ X-MS-Office365-Filtering-Correlation-Id: 60f13c85-ad6d-45fb-707e-08dbf680c614 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EvUj6DwVkhYM538no2SmmWC57KtSSLptmAvN0K9O651gZX8bpZBWWc3pnEZ4si/pK2CCk2gsCMdiZZKMsXzEVAAppVNmT7utIaZ9fM23p7pmHQEWxjqsRlt2SkG6jgGoEhq/kt4/pw5HtGn6IWIghHxWLcaLUVdn4rw2+2RTPf2RGMml6NLQvr2UM01J3X+gph7gdHp7H8ABrS/A0DpjEBvruj+RsAgUpxue9bfv5ioiuzu7ThBbY8GhNf63AfiFNSr4puYPYLU53dRxomJKEPN19K+30j9pktClAsCN0QOUsYd+9zS10TIms0D6AMBfmTHDkJh03vnZhZGwtPXkMa8VOnUPrNNA/ylAg1JM+tYo0Tfm+3yzPGkrMWDAU7Gij+DDuILqB2Y7FJ4bDJmOxbvTYQhL5PVM9KpNagJdMlY8manssCdG9cTt2WyqzxGoBPeJP9tAoX87Xrs4hhwjYC7FFaH4QBtTFw5f8g0fH6hIGd10FwDrUw+hYxRob7aSFemhHv95opF2wUERIm4493C5mu2GXszedFI4pCs6ioOIRCF+NJW5xAdWdJ/bixmd8P+Ij10wJYa8PH+lmEPwjbZgpANOm0+Gti8b8vX65x0= 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)(366004)(346002)(396003)(39860400002)(376002)(136003)(230922051799003)(64100799003)(1800799012)(451199024)(186009)(8936002)(8676002)(4326008)(2906002)(38100700002)(83380400001)(7416002)(41300700001)(36756003)(86362001)(5660300002)(6666004)(26005)(6512007)(66556008)(6486002)(478600001)(2616005)(66946007)(110136005)(54906003)(66476007)(6506007)(316002)(4216001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yKOxg5zv/0eYxFz3TIti8zS3Le4Zs0XjsF8FV5m8aBMaaC2Acm2MV7PrbH+umIHtQO2Jfq4S4Z7bMcaBzBb16QwZdw6h7HJ3lhlW0wBVbOqOUpi+5nZARwmgAzeUJMlpwAF0ZpMQ54As4piB+R4V9Ur5FscZPICnJU5YKrlmKuPLLPkA9+aOE2YvPY0Sg/JTnj9dvrbk46v/MmVfQ7+V0pACFBYJir93rjTOhO5LiHAYs2Sm7R0fyifSnEzqjrHeZF/SYL48GjOpaSE2PXqEOCRkMZV/jWtSWx1oZTNFj8+sE8IIYjXPg6S8Rvdvvt+5Hpj9J0zzJx2XW5njGMZHPi4EFHi9Nw5z8CmSQObe1vnBQZeTafhYXkfW5Y0x/HrVhtRXMxCYNLEPDtsbXvoQ9+9uVcDiNFgyuxv9Ui4LOXPJ5nKhQlJFmxjLsXxhzTJUEqxeZiYWYvgKFj8XDgY3Pc1c1qDzxYZk73b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SLlvLWCdPDi9OhKT43U22cy48JobHYaWkjKZ6mPgROSnf X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 60f13c85-ad6d-45fb-707e-08dbf680c614 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2023 17:28:34.3872 (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: jfpuS48qIyimOQbC9H7PT3crChRYEgjs9+5CUF5mp0cvh+kr6XIqeRJMerdaD96R X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7364 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231206_092851_719088_ACBB2720 X-CRM114-Status: GOOD ( 10.99 ) 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 At this point we know which master we are going to change the PCI config on, this is the only device we need to invalidate. Switch arm_smmu_atc_inv_domain() for arm_smmu_atc_inv_master(). Signed-off-by: Jason Gunthorpe --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 0f3bbc4a2addc8..39e010c838b1c2 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -2416,7 +2416,10 @@ static void arm_smmu_enable_ats(struct arm_smmu_master *master, pdev = to_pci_dev(master->dev); atomic_inc(&smmu_domain->nr_ats_masters); - arm_smmu_atc_inv_domain(smmu_domain, IOMMU_NO_PASID, 0, 0); + /* + * ATC invalidation of PASID 0 causes the entire ATC to be flushed. + */ + arm_smmu_atc_inv_master(master); if (pci_enable_ats(pdev, stu)) dev_err(master->dev, "Failed to enable ATS (STU %zu)\n", stu); }