From patchwork Fri Aug 16 00:55:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolin Chen X-Patchwork-Id: 13765327 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 EC7D2C52D7D for ; Fri, 16 Aug 2024 01:02:08 +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=rRBHgCa2fI5PFHtlQ1sEeaKdbsvPnZTX0ZyiiWHSRKk=; b=nWbgYTdvZjPTjybGGBrZ5+4818 mZfm6Lr/nHVAUsxNIKpJ6pnJ1fIrKnvx6Lx3HN4qeWURlZdwlnZBlH5x7h5odnSPYm8/U9oEPuv7L xR0/zp1btPO4HrNHiTxo20QM/K0eoma29FxEUBy/WNf6FlDQFXn1noUL6Qq+Y8yjrubGpfZylNLOd pO1+Vd/SFgNhZ5st/J6Lp5ByaSZNY3yGGVgHrX/iO4MW1CwK0kEcw2TQ1WQa07NiV+CqRaIajcn0+ 1N7m1SBjzsc46wDUXVEGap40oPnwh+F1jkKx4ChgATKPxx7knDsF2KV2lquY0Tk3La6fE+snUAU/D IlLhudwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1selLp-0000000BRqt-3tPZ; Fri, 16 Aug 2024 01:01:58 +0000 Received: from mail-dm3nam02on2060f.outbound.protection.outlook.com ([2a01:111:f403:2405::60f] helo=NAM02-DM3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1selGG-0000000BQST-158s for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 00:56:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IeRX9uBL9Fh7EQTpEF5zSiDb1qDJ2WoDlJBd+k/RI8SkiwLoXuHH0AOj8XLbn7rRYCnzjRcaiiAiE7bGbo3c9lv7CwdZulX5scB19d5fzQrzH/CL6povLh7q3tV1PhWhXhBXse2SKgk8iA4Oo98cm/OrccD4Dd1iGrdQd5HTpc/2xrWM6kPEHtKzRYPWLmfepVmHvv8fHmoAcdv0Ac6k6PZ8hiHZX9FGO8yaWfdJuMw4b5l04bWB4Yj59Wc/bkskba12G9CQP58V5+mjStH+LCjQ6lOGoLhi+H5YQhpvm98avOgZUKZ9UqO/xJ/WJvwRlsoGf5upOTB6cl0GJX7Htg== 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=rRBHgCa2fI5PFHtlQ1sEeaKdbsvPnZTX0ZyiiWHSRKk=; b=Le0Am1flP2PXhySaBsq6BAWecqYWfMSUQQCFI6BRUNIbIFVNYY7wLhbOcnD0uORZ7VQmUz1BkfucpzzMLb0uh1Zd+e5aQ/ckm0aAjTVRHpmXCSLhv28e4oh/02+lZrAI5FzNZdC1Qdq1DQ8yVFs/dzSKKYQgCaZ0jcOI6QT/zB15kmbAc1u3+WksQ5KxQZ54p/BYe5+VD5Z9MPwBIdYmlgwzEUUH5jOw/p+c1GJqw5Xjw4KAAlOhUNdXUf90SsxU8HS/bAcLR94ZomFFpVvG+GdYta8boce8kkNfG20jbTpXIpuxWnfNOU5jO6dvThjfurguRuP/Z09ZJE9KaAI9CA== 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=rRBHgCa2fI5PFHtlQ1sEeaKdbsvPnZTX0ZyiiWHSRKk=; b=i1NuNJGfz0AO1adPegq5l0ATdneOZNHpfPlzI6MDT3HdsN7i0PkOjdCgWb7x1+d/2AJTSCTYvNNcwJG1e0IJE5fH2bWR6ker7KrxB0KrzZO3SO6XH0Hl2cigi3I8ErMEm/+Dv6nzK6M6CUdz90zU2tDRnoi2TBa2TNupj0T3HgFUQvEVu+yI/Bqfe7yiC8Qn6RONOQSEEnP9iiQFHuv4/5InUB4E7WAAHiHSOE60F8O/lJQHdG7XeNh+y0tjAj4Mi/WB1zUpFIn9Xiim0L6BsM7mLQe+bACxxB6RLK4ru5HO1xfTh6U/NeGlUOnSYx4f65tHe2GzLBw11grzcR2HTg== Received: from BN9PR03CA0570.namprd03.prod.outlook.com (2603:10b6:408:138::35) by IA1PR12MB8358.namprd12.prod.outlook.com (2603:10b6:208:3fa::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.17; Fri, 16 Aug 2024 00:56:06 +0000 Received: from BL6PEPF00020E63.namprd04.prod.outlook.com (2603:10b6:408:138:cafe::e8) by BN9PR03CA0570.outlook.office365.com (2603:10b6:408:138::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.33 via Frontend Transport; Fri, 16 Aug 2024 00:56:06 +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 BL6PEPF00020E63.mail.protection.outlook.com (10.167.249.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.8 via Frontend Transport; Fri, 16 Aug 2024 00:56:06 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) 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, 15 Aug 2024 17:55:45 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 15 Aug 2024 17:55:45 -0700 Received: from Asurada-Nvidia.nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Thu, 15 Aug 2024 17:55:44 -0700 From: Nicolin Chen To: CC: , , , , , , , , , Subject: [PATCH v12 07/10] iommu/arm-smmu-v3: Add an arm_smmu_get_iort_node helper Date: Thu, 15 Aug 2024 17:55:28 -0700 Message-ID: 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: BL6PEPF00020E63:EE_|IA1PR12MB8358:EE_ X-MS-Office365-Filtering-Correlation-Id: bb81efb7-1726-4dbd-29ea-08dcbd8e35bb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|376014|36860700013; X-Microsoft-Antispam-Message-Info: 7JWzTaAkRbM6HAt6XR+Ec7t6bLyFRGTsZp/kmPGz6Bnx9jZRd/8kg2sKZCQ/DuT7beb12nMBvERT/KQYVQwgLpMLJJqsmkL11XodLmzzx+SY4Q6maV3e5SrZ7X2L5PXsijRrsdCaq5DteisY85xLbzXTRAJ54yqMEWeNuQhreXg2Qc257PVrNUDtMQ3f/fPGgQa5Hkgj5nPdPI+sLQzGS444G8vmGTl/q6NoaNEmQBxL2gN5itrFTmZ6AMsUlISWMwIC/dQ18Q2l1epEStpvX333kVQ8Ak8crlYnAYMvF8ZGbk3qsZdnnQ/1zR2TV72+yurKNidbW23g09luPDRPQiNm7GimRwbGFjl01Xf/x6IRTZSzg/fyI1cuc/nh1KJq0r1mblzlFZbNvBBiIVxxSdVh6Bqn6sQvpSygNO/dyRSek92OaNz0lcCKuinodx1kU/i4wVhnuURoPzBPLJyKC+SsqYxKKpH7y7FtU594YyFh4u3AYKbrag4Vpj7SDp6m1M/3Jnw5i/xUZ5TNwQNO9G1ZRpxZeUxB4GAuTjdW2n/fQuix+ktzYTw0ahs8/X24g1vuahboJZ6HQXx6N8q+CroYd1Op2QENJ75z2oIak57sUJLm0tkETQr0Pjwwd25Y27O1ubCIQV6FhetvosOWpUvHPOQnF/RkNJ4ev/ac3Yq+9E0bh/yWKEaoWIKcLlbjEOK7rK5B8DWLLPBX9/RdHHoT0FfERBsqpGgsJ8lb5dp3XjzjhzdvPuGZcXqsaUsWaRakqvbHeFk0leg58NpK4Udx6E/byIJIhBEudbdNQ1/tGGkfAWDro0bCVMmtqbb9ghCQiyLsAmsAm4D6/24OONsPUXmJfjWRnPOHLNOKqmRslzrWl+w5zbuN0/ZJrRI9inE9bjnsju8RuJmRurAqfArfRHOZpIysWg0syBn/OFWee9QITDhljQahsQ0rRK4eAx3j3K3/dhM8k3aANLCEl5WB1OVTR8aTGYQWyudgYeUBOrnpa0yNphgCoNFALhMpePzT6kuK6uYaz4K1bM9k1KOfO/VaaOTlawoidXx9Go+thmR6Je6nBX3LEQ/3//+CT5npEkXixB1m/86oz02ZTB9Tpq02vRkVRPo0NSwqU5KraAWP5UXIeM5KVEpQSURko5IkQ0SEnVBrbFza5ve6V201Hyh8KMvG4QPdLiwtJB3h0CGdiqN9MPJthrWejC2xubtfBIZP8eKzGST7MlmkdlQeZoEy2ZMaiHjO8EKBQROij0WCFYiDmNjwBn5N1kbSK9nPkfrHD9sHWRP21nh/cBZbc5CqZhNXZ1kaQw2QansdYqzKSS8vWy/OP+FNRskCOEHdDrjkOIr6Ex+Bx6ziVA22z7OiLyxbN628awDG3gTWqAn6pilHzkaWfqcPZiWQU5FtX5jHiOPfbqo6hAQzw/Q+NnPUxG34zahG4xO9jR0Yc7D8NU9XezxdWv5z0KP9 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)(1800799024)(82310400026)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2024 00:56:06.2044 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bb81efb7-1726-4dbd-29ea-08dcbd8e35bb 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: BL6PEPF00020E63.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8358 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240815_175612_458309_9B2A4F44 X-CRM114-Status: GOOD ( 12.77 ) 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 From: Jason Gunthorpe This will be later used by Tegra241 CMDQV driver too. Signed-off-by: Jason Gunthorpe Signed-off-by: Nicolin Chen --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 5 +---- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 8 ++++++++ 2 files changed, 9 insertions(+), 4 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 e764236a9216..6df3cb0bc406 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -4350,11 +4350,8 @@ static void acpi_smmu_get_options(u32 model, struct arm_smmu_device *smmu) static int arm_smmu_device_acpi_probe(struct platform_device *pdev, struct arm_smmu_device *smmu) { + struct acpi_iort_node *node = arm_smmu_get_iort_node(smmu); struct acpi_iort_smmu_v3 *iort_smmu; - struct device *dev = smmu->dev; - struct acpi_iort_node *node; - - node = *(struct acpi_iort_node **)dev_get_platdata(dev); /* Retrieve SMMUv3 specific data */ iort_smmu = (struct acpi_iort_smmu_v3 *)node->node_data; diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h index 71818f586036..9f5d156b73af 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h @@ -14,6 +14,8 @@ #include #include +struct acpi_iort_node; + /* MMIO registers */ #define ARM_SMMU_IDR0 0x0 #define IDR0_ST_LVL GENMASK(28, 27) @@ -791,6 +793,12 @@ static inline struct arm_smmu_domain *to_smmu_domain(struct iommu_domain *dom) extern struct xarray arm_smmu_asid_xa; extern struct mutex arm_smmu_asid_lock; +static inline struct acpi_iort_node * +arm_smmu_get_iort_node(struct arm_smmu_device *smmu) +{ + return *(struct acpi_iort_node **)dev_get_platdata(smmu->dev); +} + struct arm_smmu_domain *arm_smmu_domain_alloc(void); void arm_smmu_clear_cd(struct arm_smmu_master *master, ioasid_t ssid);