Message ID | b29f31c8cbdb2b7d90443eae522a88218eb639ee.1689666760.git-series.apopple@nvidia.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> 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 87ABBEB64DA for <linux-arm-kernel@archiver.kernel.org>; Wed, 19 Jul 2023 06:27:18 +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=7bYzXP5GUkJYk8NxkDJy3oM57+Cqh/dtYsM8w7ugO1w=; b=B4dhDk1ssTOE6M 9Q6l12GBO0scjWGJqUrOg0TloyMSG0kVuiIohsqouLmyCWy7L/yrgMM4iLPXwd0GSMn2YbtVB6R+X 4j/qgTJFHLnLfkvUYZG3MYo2wmZNkHbEWFz/OkgsI1CsfCAqLj3Lr6UAEtwLphR/h4sIuQBfUzHEl qmiGRoknSxobe+dADDurQhhTrvHdSi/w0iGDgoIreei3CCnNaUbnVjaZPJqOzF4czP2dBi+TxfuEJ ANaUssIyhDIXzVGj3gHK1Y9F/Kuggfy2VwiyP1GfUDLe43TFcC9ADEt9h2UsUPKVf9zfm7pFi+IKn K13EOpy2ziH7NeoJwzkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qM0eJ-005jKq-0u; Wed, 19 Jul 2023 06:26:59 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qM0eI-005jJw-28 for linux-arm-kernel@bombadil.infradead.org; Wed, 19 Jul 2023 06:26:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=WvW9mlxbGnKVcvKQfEGVo3jXEFbWzwdMBMfBGVX5oxk=; b=iVG90u4R27PCnyfR73MfO/LKOm EAGHqi4spDmY6KWRE6z14qAMo9VGOIqeq4V829mcM8adGCatC/J9OGvr8xPYxchpV2Ctj/EuaBEa6 fAHQi+vLj+o1C5RFetLT6qOl8TrPATtJ2si6Q91PDpjZ2QW1zEpdWL4fYxxJwMv7nQggqzYPQHSBr VYpY/V3HCrywdr/VyI34tmQHGHAHVmxLQHELF1wHBaSis/mg4gz/CmseNiNt4+0FQxeNWh95cnBWO kIfQuFiDM50tcZFX09vgT4cBXnAa2jGwA5i8ESVATvanqdXoAqr0uyXxr9QD8ABYbUICRRf6L6ugW Q0BON4sQ==; Received: from mail-mw2nam12on20618.outbound.protection.outlook.com ([2a01:111:f400:fe5a::618] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qLfbQ-00BHx7-0z for linux-arm-kernel@lists.infradead.org; Tue, 18 Jul 2023 07:58:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GwgrfyfDFouK5vcOkm1Ayk/e5XN+JiyxqVYckZfJmTIxrk9IrfKgAa4Wgpct84lo6wJtAzDZZf12zqv28UKFVEn0b/LKbO2pDj0/0vzIR+4UGNMmclQ8qIpNteJojT62/4qzS5sOPHjkxIMzbXpqaWvDUZ4wgPtIbD/E8eeQM756i5YAGZuJcbIMXhfJIHlyUAhPL6YNSJwxeTytQ5BV2EGQax6Ei3UU+HuhPeNulWhPk8gmWN6eMgvCj2mmxrHHqfuusY1hFXDxyLjJxBkrWMOaJbWeojIINosha4oNknjcK1tTvIQjdjt5aMM99IeLryr+SouarZBw41EygG3gsQ== 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=WvW9mlxbGnKVcvKQfEGVo3jXEFbWzwdMBMfBGVX5oxk=; b=DzUxocAfd9pQmzItZHuz4+WD60roqofXkDKMbXahTdaq/2ur65SNGToC8nS2Vq+6qfQ5ic/7iU0+5fOAS/wVJTE4p3XXRZi4Oko683x+xm+UU86/AjYmwfAdLcSgrphz2K7vUwhMTfaHlM1ViIstUmmBjYEQD3eDY6r8CoGVVng4de2M3Ahc/jm+XeifxZBIQB8vzo7G8NlAuCsYz2Oet785oMWmmPXU46ZTdDDRIgg/p8AFsDqx2/qOBI6B0d978UrzAw9wWOe/F9czJv8i2FIx0zLdSkscbQOSZWUqKHZG4BtnKaiNS/SrCD8P+MHJ/sXeqbfsrB1ogKugfKXEbA== 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=WvW9mlxbGnKVcvKQfEGVo3jXEFbWzwdMBMfBGVX5oxk=; b=j4QKh8qvouPOodSoSRdkI9ECVmRu7kWz4KJDJgA9XgDTpH9ZZziW/0zse1CnGXC5R9xGKTa6u3Wgq7Oef3amzElF5ruewt+woyuMN4kSU6KsaaBlYdu88CBc6z3LzG0Ow2qXb1M/DEpdNa1k7Fu+WMS3ZafvKqQHWQfXIuCcNh4ULk1Wx3kgkxBzFTSVOZxGocDP347xSVzKaG6Y9xN3DzSNTU0kM9EG/iUUR+Llbdqo/kUI6tDDhDTRCR/08c2XPNz9ohRw7CgAo8ewMzRxK3birVl0IW7B/w75kcbQNZHV/KjcsyOF5t81r+AL7U0Z806QA3m+vXFrztPa7eSqIw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB3176.namprd12.prod.outlook.com (2603:10b6:a03:134::26) by PH7PR12MB8180.namprd12.prod.outlook.com (2603:10b6:510:2b6::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.32; Tue, 18 Jul 2023 07:56:51 +0000 Received: from BYAPR12MB3176.namprd12.prod.outlook.com ([fe80::cd5e:7e33:c2c9:fb74]) by BYAPR12MB3176.namprd12.prod.outlook.com ([fe80::cd5e:7e33:c2c9:fb74%7]) with mapi id 15.20.6588.031; Tue, 18 Jul 2023 07:56:51 +0000 From: Alistair Popple <apopple@nvidia.com> To: akpm@linux-foundation.org Cc: ajd@linux.ibm.com, catalin.marinas@arm.com, fbarrat@linux.ibm.com, iommu@lists.linux.dev, jgg@ziepe.ca, jhubbard@nvidia.com, kevin.tian@intel.com, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au, nicolinc@nvidia.com, npiggin@gmail.com, robin.murphy@arm.com, seanjc@google.com, will@kernel.org, x86@kernel.org, zhi.wang.linux@gmail.com, Alistair Popple <apopple@nvidia.com> Subject: [PATCH 2/4] arm64/smmu: Use TLBI ASID when invalidating entire range Date: Tue, 18 Jul 2023 17:56:16 +1000 Message-Id: <b29f31c8cbdb2b7d90443eae522a88218eb639ee.1689666760.git-series.apopple@nvidia.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <cover.b4454f7f3d0afbfe1965e8026823cd50a42954b4.1689666760.git-series.apopple@nvidia.com> References: <cover.b4454f7f3d0afbfe1965e8026823cd50a42954b4.1689666760.git-series.apopple@nvidia.com> X-ClientProxiedBy: SY2PR01CA0008.ausprd01.prod.outlook.com (2603:10c6:1:14::20) To BYAPR12MB3176.namprd12.prod.outlook.com (2603:10b6:a03:134::26) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR12MB3176:EE_|PH7PR12MB8180:EE_ X-MS-Office365-Filtering-Correlation-Id: fec065b8-87e4-41a7-3db5-08db87648bb2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vgdPwCgZpHpmWC+WVz0BXYPPiLMbjm/lQZC+2D5Mux7CQVoo3EzakekiJz3A0FxDW7FKT9FbqrPTkN9l5XDsCuxZvqb+6aM5iX5HsWx0cBPLOfiQcwPIqwQoW6CaxCLdpyUeRNJIWEyoJ1g0reLt9gHrffd032DzlCqG7mXxIFoXI6krZ+01xiwhnPkQovU++ZyohHYX+VUYVfsYRKx4ZQ85qsggzsLXeowsRPvSRLJMzD5TxN3k73HBQR8+6Ajqp7IpjbIvb1JtT4rqzAuaEp6/2xiwc1Bi7+formeo9OwlAmf8R2y58Gpldfa4cYpd33F9hiK2HJiig3T9jnjJ1Vwxk8oG3T9XoLhLuF+zgdIeXRLRmd9wQqfA2OxIqD9Jxd/dlaZy7NxihTYLMYu2jw5F2HqITns20cdSy/iMjZInxkxxz6i71rA2Fzi/KBzoD6nNbxPrWYx8bevqpV6xMiqnAflJjL3cz/9i9gdVgrdoRgxvT8HrfJfV9aauVdYcel1AtGSRZm13cy8BF5Czo/EYMkaOdnEoUqrJBqeKISuR1ts1mGVYmYEqAFCa9qS0 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB3176.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(366004)(136003)(346002)(376002)(396003)(451199021)(86362001)(38100700002)(36756003)(66899021)(66946007)(478600001)(5660300002)(26005)(41300700001)(107886003)(8676002)(186003)(6506007)(6512007)(8936002)(7416002)(2906002)(66556008)(2616005)(6916009)(83380400001)(6666004)(316002)(4326008)(6486002)(66476007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4ivI5Nh+TWpV9Ru7dx/obF7K3a+hCLeW3c88V29AFcawzcX21qU2Jrhx6Wl0EVyg7I520/ZslZiy+M3SH+GKEWyq1g8PZgdCpeL8RNkV7+Ze4NJMPkcsnMVd6L2DMhrebLPOm06Z76shc3hw9HO49QGlTcXAUCs6UsCg1WenOiM8bSLkmxhZdI0qIHPUCyJ+fxW/JEo/Y6R/Zmw+Zst3od0qA/pfN2iujKpJDaxXkxHOtTeaA8rMpUZy7A4G79TMNz72B1oCkFgoEzAFE6CY9AVb8Pra5eROJI4RKZ33deGnRpajVib57FleyrThVXfqUR33GgAbI5lkWVB3WSYwDEgJw534UO/dbm6ZCfpHJJbk9d+HfJp3Bhvms3hWD7nyHdZsSJwne9dGSi6vLfK2GkgGds7KP+x0wneeS7pUURPsLow4X6h595991zZTYwE/ZRuMxXKR8rRT+Lwgh/B63EoWPsxXfKvYlApcs5O3Fkd0egqzTVWgtKOsLcjNtoEIFIaAPyEvfVcbF+aJ3cfljMgRutzJzL6OHeFT/CpsZSmgWEQhJoItXXiwP3xUMa7TXYqLTMlq664O82xO8N/VGmBh1LV2Xr9jPMClVmRDJbqahgz7PQZZUMNu4a750VVqc5sr6njmU3UrhJ5kdDQ4HBLjLC7rPdx1dJvL7jaRcd+HF7FrxNaUUUqg8NmbWX/+KISycHVJHNuJwdQGjMAcxhWeMkCFENoeiCdc6FTunZvpE87ux4QsO55vWBdAbReRTAvyRnHhQj/klZP9jvi41dcTfMYYFZpya4vrPWyuy93wRaZop0iYYrl33pcN+Hb4TvcMtgo3jY6OodaAYDVpzB2MSaB1TXaVVDW2ikFHm1ku6VCeBsU4hFiq4L+/DvNLgP6m3RYYdF9K6oGpXZahjriejGKU/q1NkYbgrNJBVfLrRwiXeUxLwaTgwS2KEspmDGs+T9dTwL6DDQoWwdaRGtbt1EjFziW3mbPafpXi+UrMvA1iC4kaVC/oRKE7CwnDKyfPqa8OoBZoonZgcZXmqmn5Ldjp0qdOalNpFTKndddYRA1+6bsBn5UebLy10EU/0QgofhX8XdUoEwIfeisEGijCYSujen5RqUlgl4tE7gI+HwgNpyXFtuIeU3rlVz6fE5JafbYEoLegKZ4wqPh4wl+tFjhUJViP+p9EBxVNWfyp4qQO3LQT3LtTfSBjGuiqyCTEzRBbK7NvWUJVBwqTLl8p9UHiw7OXNkWT+ypWGxMS+0XaR3/j5e/7bqJnJqgZEK+ejuMmsAoT9vJpO7wEbRmys/SOUUXi7AZuARPi3Qwt6EeQ0lZ1nn9PaQ2QqEGDh/nk6LCcB0/FK1KIN6JagORHjEp1wloneUCOd9xsfcn3DCNNa4mMXfRuV9En7I2drw8yczH3Sbat6jTsq5qRL8tPMVOXrm/Rlmm31G+L/+X5eyLhjZ6dfVET/ZxzPmsKfC4RFao0uTSvTyJSfBGe6O56PoBt1weo4OSPbSuLjC07wCFjSGsvorJqp5PwXnmPwkWs31tAA//wSA8uDXuO1n65oGgHPa6998pGSavh8btwalzh1cYVLeWmDLIa69du X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: fec065b8-87e4-41a7-3db5-08db87648bb2 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB3176.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2023 07:56:51.4227 (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: Y9rU02Z0uYoTdnuqMaRaCs67nnBgD5xEtuSoqXDfN5XFrwkkA8zdSOcxLsZpfeLX5lCANncgBsdSMYMMdRALsQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB8180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230718_085836_563160_4D0042F8 X-CRM114-Status: GOOD ( 15.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
Invalidate secondary IOMMU TLB on permission upgrade
|
expand
|
diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c index aa63cff..dbc812a 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c @@ -201,10 +201,20 @@ static void arm_smmu_mm_arch_invalidate_secondary_tlbs(struct mmu_notifier *mn, * range. So do a simple translation here by calculating size correctly. */ size = end - start; + if (size == ULONG_MAX) + size = 0; + + if (!(smmu_domain->smmu->features & ARM_SMMU_FEAT_BTM)) { + if (!size) + arm_smmu_tlb_inv_asid(smmu_domain->smmu, + smmu_mn->cd->asid); + else + arm_smmu_tlb_inv_range_asid(start, size, + smmu_mn->cd->asid, + PAGE_SIZE, false, + smmu_domain); + } - if (!(smmu_domain->smmu->features & ARM_SMMU_FEAT_BTM)) - arm_smmu_tlb_inv_range_asid(start, size, smmu_mn->cd->asid, - PAGE_SIZE, false, smmu_domain); arm_smmu_atc_inv_domain(smmu_domain, mm->pasid, start, size); }
The ARM SMMU has a specific command for invalidating the TLB for an entire ASID. Currently this is used for the IO_PGTABLE API but not for ATS when called from the MMU notifier. The current implementation of notifiers does not attempt to invalidate such a large address range, instead walking each VMA and invalidating each range individually during mmap removal. However in future SMMU TLB invalidations are going to be sent as part of the normal flush_tlb_*() kernel calls. To better deal with that add handling to use TLBI ASID when invalidating the entire address space. Signed-off-by: Alistair Popple <apopple@nvidia.com> --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)