From patchwork Thu Aug 29 22:34:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolin Chen X-Patchwork-Id: 13783993 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 F398CCA0EC7 for ; Thu, 29 Aug 2024 22:38:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding: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=YFPl7DRvp1PI0L8vvlBsH7NoiLE72eQ2ZtecRf7Cldg=; b=N6PHPnhIT5Cuo/kSEjDgH9rHXI n+i5UzFPT7UA/62nlNBBO6lhg74h4ZPLYAxX/UtM1gLlxtavSm36/+V5OnYBqRRLGCGhG+e9Ald28 p9ArwhEZf8ANDbFrNUflK/VqTfp9OSxK3YXGIilaUopa8lnm6vq35QV7RVq9Vpi8E9wnxKWxgEP9A UMU1JqNtmlimsX8XITkXtJNL2Qk83sORQs1eqDEQEVOjfY6jDAmwx9eXtAL+ta5DuHE1w9A5ITmhw xufGMpeyRK2PXaaanKrzkJH+On6pqBEHUte/kKPbAA761u51GrbGNQSPNIByw+51q7JuK+0aXOjVs LzVR6NbA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjnmp-00000003thO-0Fim; Thu, 29 Aug 2024 22:38:39 +0000 Received: from mail-bn8nam11on2061c.outbound.protection.outlook.com ([2a01:111:f403:2414::61c] helo=NAM11-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjnjU-00000003sm9-3LvK for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 22:35:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xFAuTdwyeHlocDuikSk/5WqGx/ie935mGRId/uBbppapg1Kk9m/gfavdPpQQ2NDXmsx2MEsDG4U+0VJEPRqlAA2UjsL4JQHJ9WErk+dhxQIyZsxRGWfZI7Wr5MDFc5jTfZJCWRKixVe4YYyZK4Sp06iPj0LDVfdCZVxJ0WciJtLm/knDsxwJcNxU94JJTS+jp+CE3VlrbeE/rrYYTuhpOIM6jvoyL7tb8KF6OsAiT5sCQj89UtpIqdVHb5ycp+XR+ZX1mb0C8hqeYtHMZXQ0nKVxM1ABGz/5GAyBRYYHKM8yyE+CSTaQkCGNiS8X/PPqXf7BvFxPeU/Ssqd6suoj2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=YFPl7DRvp1PI0L8vvlBsH7NoiLE72eQ2ZtecRf7Cldg=; b=cNRVtblu7JBrVnkDfZ99VhpVgBxGNPIfulo65n7bTn+fgQjl0wybh8Lgt33CXzjk909JYh0VcoNIpamwdYiRPIaiI626ZWZ1E1fU+u7O2x1BTOwLlhEkUDg+7Ekyr0NS6W/BtoaQAnPkOOObOGAD1N9wkpu95asr6pTxOEgCEdtCrzLAftiWY0uw/U5KDCEk8c3RzLhJTjt0WBCsQF9Mfjyr5jhS15hhg5MtcdeVoMwasvs4n8eYdTAxO1tE+LsIbrMQcPlYxKjcY7nDgRsd8YIvtqAaVeXd+6WG5Wst3Rjw79/+sl8m1JF5mnAo/xGroeEfDFp3yN59nNixW9+lkw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=YFPl7DRvp1PI0L8vvlBsH7NoiLE72eQ2ZtecRf7Cldg=; b=iSdVNJV4nMC5vY8X8MRirh8HHFF8YKYFwdfi7dndTFcQ97zKEQmmptQUyEnLhRnd/T1mb+Z6zOhqNANknY5UQeJlG4AibYfVHBvZOY0tosvYVkTvMHGsQUDJGSnVLqFGJ9oILN2GQ9eguFchoP96eupPo/htGqWesGhqHwL5tWpg3TVHJGzlZDITIQG956KdysqvVyTMoU2aUB+dJ4Cd1RPAPTYhgr9EKBEEixtyThkpmcGke7j1ORu6tf4r7AZZzsKpgg4b7SDu6BcfverV8a3+lh777wtO+VLNgUu6mm2VIEbOP1OS6voe5KRMiQ4E3roCWeB+6SQd2Ro5qOj+kg== Received: from CH2PR14CA0023.namprd14.prod.outlook.com (2603:10b6:610:60::33) by IA0PR12MB8906.namprd12.prod.outlook.com (2603:10b6:208:481::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.26; Thu, 29 Aug 2024 22:35:01 +0000 Received: from CH3PEPF0000000B.namprd04.prod.outlook.com (2603:10b6:610:60:cafe::94) by CH2PR14CA0023.outlook.office365.com (2603:10b6:610:60::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.20 via Frontend Transport; Thu, 29 Aug 2024 22:35:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CH3PEPF0000000B.mail.protection.outlook.com (10.167.244.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.13 via Frontend Transport; Thu, 29 Aug 2024 22:35:01 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 29 Aug 2024 15:34:50 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 29 Aug 2024 15:34:49 -0700 Received: from Asurada-Nvidia.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Thu, 29 Aug 2024 15:34:48 -0700 From: Nicolin Chen To: CC: , , , , , , , , , Subject: [PATCH v14 06/10] iommu/arm-smmu-v3: Add acpi_smmu_iort_probe_model for impl Date: Thu, 29 Aug 2024 15:34:35 -0700 Message-ID: <79716299829aeab2e55b8c7932f2634b209bb4d5.1724970714.git.nicolinc@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF0000000B:EE_|IA0PR12MB8906:EE_ X-MS-Office365-Filtering-Correlation-Id: c337b563-99df-466e-4dfd-08dcc87ad221 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: KJfko4SeoIStjMb0R6/fZOIn41zIGid3yCPQxpmdqkq7gJ19biNNgoVrqb23A9pNXNa5HqSHwJSaUtAh24hVj8VQ8+cmti+uI1/CdwF9Mh3a3mTsRf1G5anMXHfkj5MZvcbvcBFyPslPwljfHYS5GlNpY0Acs/lZFMqJUb6y+jU7B0HA6qJWhJNLlydb9yxSV+V+6D7slhutNKVEG853sXuIqW8dn0MM4cmRyCnmPyh5kN/q4TCnKitKr/u9twMLPpfxEVchXxt2sMkG0VtZVKB5AjxSs5jXCTXjTNs+mW0oIvV+uDe4S996cdIJmmE43TSzbJ9eqk4FaVrwRabwUL/OqUGlgOXjat70c6SW57uf4usw+m9qMLy+FwUDnm1fEpwXgBmfTVMYJQaeP+YfPojXotsZfAOl7B1PIJgkn2adJHOFXo6xSNUJ/03zDZxA7pSunn5mYn0Q4qVP8aaX6o1oqOQlfEk4kub+Uqvvb6C/3vkUAp49K2U49Ne2V3eDx+Ey1WjSRL1R4gTG5QZFNg/P0aAtMRO7zpOImoh0jEOOsCiAwjPZ0RpsriwjyNyz9oxj3OtfGI4CzNEkPkgZtOaINGbiaTOUG5PBk5cL2s5QR+KYBa7tHyCexqblYral1eo3TC8+uvckkG5Cmt1Vmv87Cn+sEBmNvENU9+5vq1BpxqWTaSio09UtS1PfpBO4RzgML1fFxLr17aVtObenvisvR6qMQJlPDE1Djp7TSxGeCeEohlC8iVobeKCy9aPdeGAqXbAKWGh3ynCAAGkXpcxwsm0Uhw2tFEhmZwpIxxu3wuDBbWskGlOghgozm39AXa0Wc2YMQPzaLDGLlakgpqk43k1BMmJJdfFV4lXuI9hedztvaWlCCwcNg4cQ3aqIVDNWvJM+PGTiZaGFJ330Nh31mFBIlvaVf5bdZIDWH3Q5DXOMPjJBgYb0pNyri82keev6IVSx6BOaWaQXg3eHHoe1hTT8PhWC+mRC17L7ylKR3sag+y4laaqtxN2QLwc2n41fkstS5TJ8GdaJ79pgXFSltpKl+/7yayPpfbSGIjU6Dh6jmwgY/k8j1t5xfzZDtIP9cHrWe7VXERLR3BBZ/ariTTn7H1GEXdqs0dO3VYmCr9dObTEax4WIxvetU2bT3UScrq3xWKs/Dpw9++cICxGeAxBy/SSXpe6QylV73yFsZP+TCeNj6ALs43fcsOFMPEBqOSU81qHMWke6/SVVbDfJ3ydsbpNOxhzbcYktwOtubVGcnYN9C1vK1I9//KbUY+QIUdg2OkjBxiha3pgObjVvWQAggSL6Uzm0+cd2k+LALkCOgos9gcT1MqXebcJE3JTMgYTaxYT0SHneQl+6CIsWkSK2oDyjdY5n2G1nQD4V6DbD+wRQAdxKMCoCHpV15TndFIIf7sWMJL+eeJrCBasAjCQrvhSgLz3i5AD5W7c+EjQTDim8ib1lWMCBsoNY X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(36860700013)(376014)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2024 22:35:01.5012 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c337b563-99df-466e-4dfd-08dcc87ad221 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH3PEPF0000000B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8906 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240829_153512_936361_965C74A5 X-CRM114-Status: GOOD ( 12.40 ) 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 For model-specific implementation, repurpose the acpi_smmu_get_options() to a wider acpi_smmu_acpi_probe_model(). A new model can add to the list in this new function. Suggested-by: Will Deacon Signed-off-by: Nicolin Chen --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 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 816f5937345a..8b1437240ce5 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -4341,18 +4341,28 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu) } #ifdef CONFIG_ACPI -static void acpi_smmu_get_options(u32 model, struct arm_smmu_device *smmu) +static int acpi_smmu_iort_probe_model(struct acpi_iort_node *node, + struct arm_smmu_device *smmu) { - switch (model) { + struct acpi_iort_smmu_v3 *iort_smmu = + (struct acpi_iort_smmu_v3 *)node->node_data; + + switch (iort_smmu->model) { case ACPI_IORT_SMMU_V3_CAVIUM_CN99XX: smmu->options |= ARM_SMMU_OPT_PAGE0_REGS_ONLY; break; case ACPI_IORT_SMMU_V3_HISILICON_HI161X: smmu->options |= ARM_SMMU_OPT_SKIP_PREFETCH; break; + case ACPI_IORT_SMMU_V3_GENERIC: + break; + default: + dev_err(smmu->dev, "Unknown/unsupported IORT model!\n"); + return -ENXIO; } dev_notice(smmu->dev, "option mask 0x%x\n", smmu->options); + return 0; } static int arm_smmu_device_acpi_probe(struct platform_device *pdev, @@ -4367,8 +4377,6 @@ static int arm_smmu_device_acpi_probe(struct platform_device *pdev, /* Retrieve SMMUv3 specific data */ iort_smmu = (struct acpi_iort_smmu_v3 *)node->node_data; - acpi_smmu_get_options(iort_smmu->model, smmu); - if (iort_smmu->flags & ACPI_IORT_SMMU_V3_COHACC_OVERRIDE) smmu->features |= ARM_SMMU_FEAT_COHERENCY; @@ -4380,7 +4388,7 @@ static int arm_smmu_device_acpi_probe(struct platform_device *pdev, smmu->features |= ARM_SMMU_FEAT_HA; } - return 0; + return acpi_smmu_iort_probe_model(node, smmu); } #else static inline int arm_smmu_device_acpi_probe(struct platform_device *pdev,