From patchwork Sat Aug 24 00:10:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolin Chen X-Patchwork-Id: 1976315 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=jVqpK0LF; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=linux-tegra+bounces-3424-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WrHR46rfzz1yXd for ; Sat, 24 Aug 2024 10:11:12 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0BD9F283BC9 for ; Sat, 24 Aug 2024 00:11:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2161AA35; Sat, 24 Aug 2024 00:11:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="jVqpK0LF" X-Original-To: linux-tegra@vger.kernel.org Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2050.outbound.protection.outlook.com [40.107.223.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D5F6382; Sat, 24 Aug 2024 00:11:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724458268; cv=fail; b=hR2JMPwzraCegrKFgoAC8+Ujg0IjjEcOG5GI+bDqLroWgmLl11zL/9AoWpyEDts5Og3YemzKdGLI7tH4eyzkKaOXC8BrXhUncoQwzRh65MSMXHktF+CapdqAJfDswKRwQBKBcvXR59WiPcw1842xdyHzxRrqtIT/+CuB8YbsFCE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724458268; c=relaxed/simple; bh=pwxy9JEJMM1Ol+xFDHipUT5EDbpzPP9f2b2Dh5y3AuI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fTKWOIxjl+0Rtlsf5L+TnF2tgLG0/psfBVdTP4qb+wjsNMgY/2Mp6h7LceutNFJ3TvjJdO4ojfkr+c379P41tFHCGmpO6AH2MEjA9y4WakPDQOFKo/BdH89uzRXhDGTQUK7rxEV4ItRyopwiiNTUXym1qvGFX69oeexSbRQRUFc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=jVqpK0LF; arc=fail smtp.client-ip=40.107.223.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CPAoQefNPQ/QuE2HEaWAiN2WtZxuhpltSvGrg7IJC3fKUW3PCushfqkipce5ass313mvAx3SefcHyiwiWHNRKR+p+h9vVjSWYT3FdUkEjR6lF7NIJYDiVbGjNIIbnWm159h/TPO2MH+z2R8cA1W17ZhCL6GeBvCRfuwK1Jd4rZPu0lavtrX7W2y79dLYJIAn5f96b8Bp3IdJq2ZxTG0N6BuPS1attn8RA1WWc9dbm7XhrfKGz8o0GKPWdB1BK2bRq3OkBmql9hUjXV5Xnyo6lQ20t8VKRluwzYSMVJ09mbf+/z3GqvQpt/UjAPtWokzDBslkuohWET0FPllK7OBzHw== 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=aY6fh2MFt5hgzoQfbDXuDfJ6rJkTSoVCDuPW8XVeu6U=; b=G6I8Zkj7vc8UfqcviYTm7F2FP1J6jC3b3kp+rh5zqy64rJ90RkSSiwxdbhZa5yG9kU0sH3Q40MvN2fdF8VVEvJmewmEDT4WM4ac7xZ22qOnYfqqFauR9C9JxuN2+qbhCXkl6TJ2PGn7qty3lpRs/VEFvazK8QauBmM4pkDxvCAiNprTz/nlZYkJNxOHWnMIJCPjs4lvKuuA2xDa1J6fGG8KpwihUpguw+DOgzGwuskhc78DO6TTBqrzIMVfJqCLIkUNB9GEXawAofFR5eij8EE46Dsv88XW8S3/avOxGvA/dmGq/q9bbR7CMPW4WIFGXSn22stiygQsT9wTaSLJasQ== 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=aY6fh2MFt5hgzoQfbDXuDfJ6rJkTSoVCDuPW8XVeu6U=; b=jVqpK0LFfiJ1ivyTKxPbVKLUv4xmpN79fI4WyEpMI3oEFV1sdW8dlwAMDhHH8Ahk/MmdkBBHNlkuBbf3WuX5v96gbVMMEZCURm4y9uABSsp7Uymb6i1B2TIOmpUghM38VRSkpY599Gy5RZUGHuJXXtbdAtiPJZFXOYVfK48k7C4VKLvlGk8HIrbfyt4O1Dzguq4QqwT0g/DlvRCP/LbyrXO+hVqr/VqHa3ic6sl0UFxWVBd/0IzbaOh2dzxLM2gxfyinr94II+WXzp2pif9emmLpn7G2lIOpMOkfU5tJoqxhWlrlZHUS02+xRKuDFmxuOYGIlc2mSKVk6n92HsvdTw== Received: from CH2PR18CA0044.namprd18.prod.outlook.com (2603:10b6:610:55::24) by PH7PR12MB5709.namprd12.prod.outlook.com (2603:10b6:510:1e0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.19; Sat, 24 Aug 2024 00:11:03 +0000 Received: from CH1PEPF0000AD76.namprd04.prod.outlook.com (2603:10b6:610:55:cafe::1a) by CH2PR18CA0044.outlook.office365.com (2603:10b6:610:55::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.21 via Frontend Transport; Sat, 24 Aug 2024 00:11:03 +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 CH1PEPF0000AD76.mail.protection.outlook.com (10.167.244.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.11 via Frontend Transport; Sat, 24 Aug 2024 00:11:03 +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; Fri, 23 Aug 2024 17:10:50 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) 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; Fri, 23 Aug 2024 17:10:49 -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; Fri, 23 Aug 2024 17:10:49 -0700 From: Nicolin Chen To: CC: , , , , , , , , , Subject: [PATCH v13 02/10] iommu/arm-smmu-v3: Pass in cmdq pointer to arm_smmu_cmdq_build_sync_cmd Date: Fri, 23 Aug 2024 17:10:36 -0700 Message-ID: <50bd0237e8399496955c2db2c8fde5bb0c564343.1724453781.git.nicolinc@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-tegra@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000AD76:EE_|PH7PR12MB5709:EE_ X-MS-Office365-Filtering-Correlation-Id: 29a31f22-d23f-44b5-b54c-08dcc3d13dd0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|36860700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NjnuY9CVoJga4yd4BCSKW0q+VUyhtMlmBS7YlzRG/gj94oTUe/Qt2eHkfvublqevWRrlwJUuj2w+us2038Nr1PPJB9UVwiKY9VuCFjSqK/tkVrNrv0l8BXIwZ28i+GD0Z0F5xZjiFxsmBU8SCJ5o8OMgMndjDuxz1hYMdVZK/VEzu2ibTq9Z/SbYyUnEsS6HDLpQXqrsCl0tviT2jj92FJeiP9UmJLVmWYQhIryMrLTL5pey6whfArT16q/Tb/30OMZIcNFJu+9lRZIJ1fNyYiAz/jFHrUBWpcRic2CJnNNrC4pR7NkikOkejUTUF+bskhlvEGxhB810kzE/6E/Lil2EhCnfaxy0RZaN3FHCWNYk0nvF9nsL7rayulza7/0RfSWqWNTfBrWqU/Is/uhhqL5OvUOTxUwVV6 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)(82310400026)(1800799024)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2024 00:11:03.0874 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 29a31f22-d23f-44b5-b54c-08dcc3d13dd0 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: CH1PEPF0000AD76.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5709 The CMDQV extension on NVIDIA Tegra241 SoC only supports CS_NONE in the CS field of CMD_SYNC, v.s. standard SMMU CMDQ. Pass in the cmdq pointer directly, so the function can identify a different cmdq implementation. Reviewed-by: Jason Gunthorpe Signed-off-by: Nicolin Chen --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 10 ++++++---- 1 file changed, 6 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 ebd1a808a2cc..43ce8b9a517f 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -352,8 +352,9 @@ static struct arm_smmu_cmdq *arm_smmu_get_cmdq(struct arm_smmu_device *smmu) } static void arm_smmu_cmdq_build_sync_cmd(u64 *cmd, struct arm_smmu_device *smmu, - struct arm_smmu_queue *q, u32 prod) + struct arm_smmu_cmdq *cmdq, u32 prod) { + struct arm_smmu_queue *q = &cmdq->q; struct arm_smmu_cmdq_ent ent = { .opcode = CMDQ_OP_CMD_SYNC, }; @@ -371,7 +372,7 @@ static void arm_smmu_cmdq_build_sync_cmd(u64 *cmd, struct arm_smmu_device *smmu, } static void __arm_smmu_cmdq_skip_err(struct arm_smmu_device *smmu, - struct arm_smmu_queue *q) + struct arm_smmu_cmdq *cmdq) { static const char * const cerror_str[] = { [CMDQ_ERR_CERROR_NONE_IDX] = "No error", @@ -379,6 +380,7 @@ static void __arm_smmu_cmdq_skip_err(struct arm_smmu_device *smmu, [CMDQ_ERR_CERROR_ABT_IDX] = "Abort on command fetch", [CMDQ_ERR_CERROR_ATC_INV_IDX] = "ATC invalidate timeout", }; + struct arm_smmu_queue *q = &cmdq->q; int i; u64 cmd[CMDQ_ENT_DWORDS]; @@ -427,7 +429,7 @@ static void __arm_smmu_cmdq_skip_err(struct arm_smmu_device *smmu, static void arm_smmu_cmdq_skip_err(struct arm_smmu_device *smmu) { - __arm_smmu_cmdq_skip_err(smmu, &smmu->cmdq.q); + __arm_smmu_cmdq_skip_err(smmu, &smmu->cmdq); } /* @@ -790,7 +792,7 @@ static int arm_smmu_cmdq_issue_cmdlist(struct arm_smmu_device *smmu, arm_smmu_cmdq_write_entries(cmdq, cmds, llq.prod, n); if (sync) { prod = queue_inc_prod_n(&llq, n); - arm_smmu_cmdq_build_sync_cmd(cmd_sync, smmu, &cmdq->q, prod); + arm_smmu_cmdq_build_sync_cmd(cmd_sync, smmu, cmdq, prod); queue_write(Q_ENT(&cmdq->q, prod), cmd_sync, CMDQ_ENT_DWORDS); /*