Message ID | 2-v3-9083a9368a5c+23fb-smmuv3_newapi_p2_jgg@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 A6C7CC10DC1 for <linux-arm-kernel@archiver.kernel.org>; Wed, 6 Dec 2023 17:29:25 +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=7gt322HILBZKKtFsKZNvvHq9I4V+qvSZYN81B2dlMz4=; b=vwQKdbqour7idy h37XEpd4fuMy9yuIcO6dzNpoyLDGV3a+0e8fOPNiAfzaOgE2i+mYEnVyvT0F+j5KHSvpPGmSJezmz HpE4IwqIJuRhRblbCPLWXm5XrIgVP07Xxio3fj0YTCZh0O/GPR07ZP1FEHjQd2bfd+sQo2zOVmHkb UDT1oODNuD/rmI+T2AD+X6heqWeP2fCgc7VuZM6rDZDj5V2iwau8bCKJ8NRS7XZTeadeCmVxjN2AW 5+/PoFSNmMgSfJgco2vzh7F29ZFfmKmYDhe21xRDbnlM85nZVMI9zzU08cbFG8bw9032Y2VTN0DUp gC8xsftQD8vgxOsE1ZAQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAvhU-00AtHa-1B; Wed, 06 Dec 2023 17:28:44 +0000 Received: from mail-mw2nam12on20617.outbound.protection.outlook.com ([2a01:111:f400:fe5a::617] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAvhQ-00AtFo-2Z for linux-arm-kernel@lists.infradead.org; Wed, 06 Dec 2023 17:28:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wlfr4zzzuDxq6CYMIgdHBR7VC7tCpS0vIy7GFvBOIfqVzAaFqQIoBb8vYwlY1/Ma+R2b7glkFKJEYWmuc+leOKsGfvSaFynq+Brm5TGP+pszqfWZZz3DdBHaoCmnihHX0aPXzHlHXNjCw8BD08riAWuTO30GRJignvn63dOf4QwbpzacWVW0Yyc/Uy44hf4smeMwUfz3yBZtT6nB6St349kjR8BvGybEE9QsGfr4hdfUCDNVFgZ+dVDpFR3bWJyVvbyRGGz0FZUdpjsR12JNhP6IlcLmbSxVcAc755JS94mFaW4rVRUctLgk96+4lkx8kWiw5k8CMRRqFN0zUrnReQ== 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=HoDRRFaLriAMSIcRQb75wliv4+EcjymP+iY+ayLldZ8=; b=UONre6jOmXRHgRb4z/UiVvBa4c5IVRDn23bgKfbosdhwSCdqOCG493XAAoLTS52R3WpOu/ruErqYr4mmiYFKOeVbpUY6XDuOFQQNJCT+XprK6AxEKtcgpRY3Xbz8SVwkwDIY/HvvpofnA6jYc/oHFY1wxQ4G4tacNevPAvBL3HAIGfaDuDOXGlcz+2CvLuDqo8x6swRk2U2bQB6BIb3U8C/TCxOIRRApCB0rX2aAzV4o6JK1UBAuRGieEUY8/e9oQKn2U1Kp35elIRx6/aSX2CV3BCEKYOeGLGgwWKUlsR0+usEsSnZxH+hdvt0c7ljAJcQOT9HKJOw7kmHRfQ3JjQ== 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=HoDRRFaLriAMSIcRQb75wliv4+EcjymP+iY+ayLldZ8=; b=BlpPdMcueNdZWObCDJFqk7S5in6grPD8yY2cBTlm+6WotfBdvOBr4MfcMNDHroJR7a1x/O2bq/+XvgZhLWHm9zAeRXLGpXUd+gXmFI/V+WHZDIOD60Kgta7DZQESqsWYsEqcXo5VAZaySTnWdzdxIzrxn9abpvBpDSQSxS50Ro3+nRQ+sa5kOyaZPi2ExXbgbuFREOu+eyhDHHTi/o6hAbgdvaIN9LQN52tzy1HCcOAK1ywZ5A10G0MdZhgyk97JSBWtjrCaPONlEKVHeUt9tDwUUB2crErP/5AG7gPRtZNkoNwBBnzYC5w/6R/F7UhbU/Sj87P7Bo14+iw1ba7+tQ== 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 SJ2PR12MB8806.namprd12.prod.outlook.com (2603:10b6:a03:4d0::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.25; Wed, 6 Dec 2023 17:28:33 +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:33 +0000 From: Jason Gunthorpe <jgg@nvidia.com> To: iommu@lists.linux.dev, Joerg Roedel <joro@8bytes.org>, linux-arm-kernel@lists.infradead.org, Robin Murphy <robin.murphy@arm.com>, Will Deacon <will@kernel.org> Cc: Eric Auger <eric.auger@redhat.com>, Jean-Philippe Brucker <jean-philippe@linaro.org>, Moritz Fischer <mdf@kernel.org>, Michael Shavit <mshavit@google.com>, Nicolin Chen <nicolinc@nvidia.com>, patches@lists.linux.dev, Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com> Subject: [PATCH v3 02/27] iommu/arm-smmu-v3: Do not allow a SVA domain to be set on the wrong PASID Date: Wed, 6 Dec 2023 13:28:08 -0400 Message-ID: <2-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: BL1P223CA0022.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:2c4::27) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|SJ2PR12MB8806:EE_ X-MS-Office365-Filtering-Correlation-Id: 179b6efb-2903-4646-d6b9-08dbf680c5b9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CGFGZ2cK2KnG1laqQ5jp5O95UDFPZ5jGKx21/fMV9CEOtL/UZ02Hn1plfWZfEJrgjF25U62rb4aah4485wFwnFxgUT9C26AIIy26+kpanAgjNEUxraNRWdkPWMTXWU9CCg/+IBbOdbq3EW956DBuGsh5nVpg/AB1milMHPjPTX2+zZZp7+BGz9/faOtDXWA6522QC1L8OqtA7Y6JcxCfP17Khdj95cysccZsPxUO6AlVucgNJoU8HS8H6MpsUBSzPLB7oj9NZxgMB/dDagKBQ1QAbfFgjZ6Mx/Lpw44TRR2paDDFpa/7aBpYxSGgYuqOAVzmuT5QceEpZ8F0yEE5LOpAQ1W7v/tQeupItl76yWi9EpFgMLXnFQtr7Z3cwjaSUszhKxNnEL/b5qVE0q/JfTKjClkpkUPZvIu0umt2dopQ8QCpJM4mj5cANoKEcHLp8unGx6x5j4qSMAu867t27XDlorOmvHUTqDDEJivbPVegU24M7RrIkHvZ2YxAQPxLALKFSCidXLSN/ZYpPFlQMcZ0hvaxm6MYewaW/bxWNXfuJ4mNAvVGTvwI+UgIl+kKzW03tmhdQnmY+1cuxyFipLB01eoA6HpTJXf6F1EsbTk= 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)(376002)(396003)(346002)(136003)(39860400002)(230922051799003)(186009)(1800799012)(64100799003)(451199024)(41300700001)(6512007)(4326008)(83380400001)(2616005)(38100700002)(8676002)(6506007)(8936002)(6666004)(4744005)(86362001)(2906002)(6486002)(478600001)(316002)(110136005)(36756003)(66476007)(66556008)(66946007)(54906003)(26005)(5660300002)(7416002)(4216001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DytV0HXlFmJR0zC4HVyJqE0WIK2e512TwdoWFOGdlGpd4re8ikp/AiSxuJaNEPL3viYakMsrOvE4C9KoAnapwP8o589qfGhR7t8IXs55pwKfuzxKxIx99hAogcW2wVxh4RVe0yoRleD0W8pG+YPZ95iagEUcDGDR6+Usepb2CbO5f6LQ9Glo1dQlMabkEJeRkyUtnMIEGcebGZPJjn5ofpTREHEzRtVrn5U6Uo5hOYmRX8WkhrQibzWSFlUqbh7A1CghahoYZ538rktRMZ51181DIyDsh6X08eUTE2tSxgOdANMoKH1RoHUobdfktJ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ruwgedEeyjCxOoyku+/2R3Gd3ucF5PTfswH533PZXDPB6sT0scvJxoCXOoU7FsXnivkmn0659A+IELl4Zt8H0d171lOMloon2VGgPgKadLvUw1q1ZsTTrXjepchS9P5yDw8AgEOCnF7tmZQQoBtQufpAaUsxjuPpr5dze2wV5h6M79sN+93Wlgghq X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 179b6efb-2903-4646-d6b9-08dbf680c5b9 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:33.8018 (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: g2HPnxKWMGVfAyFyfXE8J/r2F/m3pe7SUg9H1Y1QD9B4yH+VVw3H2y7fQFBvXz91 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8806 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231206_092840_836693_F6B2CD6B X-CRM114-Status: GOOD ( 10.15 ) 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 |
Update SMMUv3 to the modern iommu API (part 2/3)
|
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 bd0566381c58a9..ee3d148aafa26b 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 @@ -585,6 +585,9 @@ static int arm_smmu_sva_set_dev_pasid(struct iommu_domain *domain, int ret = 0; struct mm_struct *mm = domain->mm; + if (mm->pasid != id) + return -EINVAL; + mutex_lock(&sva_lock); ret = __arm_smmu_sva_bind(dev, mm); mutex_unlock(&sva_lock);
The SVA code is wired to assume that the SVA is programmed onto the mm->pasid. The current core code always does this, so it is fine. Add a check for clarity. Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 3 +++ 1 file changed, 3 insertions(+)