Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2144245lqp; Sun, 24 Mar 2024 05:21:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVqNKXKxprXZSfWqb/QKfWEZyF8chYe5YMLbzC/2cJX9ZLyZOf2kZEY1aEAdOGZj1IrLPUaQCIP1ebWRH6yl7W6uOXFZkNmOlvwZ0XfTg== X-Google-Smtp-Source: AGHT+IHz+ye7JOtZMj7G/L+QXLnWGCR4U7EkMTn7gB78J2atXNOsst/cf/wbAZ8fk0nL7coZiZ8c X-Received: by 2002:a50:a69e:0:b0:56b:b278:d57b with SMTP id e30-20020a50a69e000000b0056bb278d57bmr2812120edc.16.1711282872610; Sun, 24 Mar 2024 05:21:12 -0700 (PDT) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id et3-20020a056402378300b0056be4689a55si1578471edb.160.2024.03.24.05.21.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 05:21:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-112665-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b="QF/pYych"; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-112665-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112665-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 0E4201F2149B for ; Sun, 24 Mar 2024 12:21:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0C31D17C6D; Sun, 24 Mar 2024 12:20:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="QF/pYych" Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2043.outbound.protection.outlook.com [40.107.20.43]) (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 D027117BB6 for ; Sun, 24 Mar 2024 12:20:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.43 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711282856; cv=fail; b=FJsjNrCm/N5RwF+kH4yjZDAGKiHPRJ2FdMr67BnbWoULoSV6bX7aS6+4fw+qNJad/ohTce1EOPl8HJqm5PthVMZvSl7R/hTkQzcuIGjV23c3J9hyYy+FElVvn6Dfp9KD5dvwqKVDkdO4MWt2wv1+tnx2Avdi27nXSPXpYHkrpGw= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711282856; c=relaxed/simple; bh=HjUdViZkXBbjVp2mpk6+DXghHax2mAjMFtiSbRX18OA=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=JvuqccAIjhUFJnS3+hKX8dANO2ovVQ8LqhicuB5HCLaRoXUp6UsVB9hhxnfmmwkJQ6rcLkWq7neeJn2nhizb0F2EUO4TINFqinTMaw3ROGc9ETaS2g5fDKIrH3RfUO5dQ1boxe3lEAH1efK+NBjAegwkgGeKaQcSkQ7hWq3EoOM= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=QF/pYych; arc=fail smtp.client-ip=40.107.20.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hDOlp35AzeiFy19SKvkufR7udgqDgl8UEbDz3wx170GRiSFM36RlS52j1P90reQOL4JDTGDw/SB92GOfc5nW0435K74NRFfql5U39jLyZGpPNLC6bYq6Ucd4h5XXhRlN2vhNzq+zcAbGnavO3zdjHDBUYtRhRwTJO+8zb8c20H7ymCoVqtQE7MV+rat2WU8VYAnLoU/LOSnIgefYteQ1edvyctPU0IFPEVzb0NqvVKa7PNN4I172NzIqCarMiKlbtqqSl9k53ijgd1rvNLxMfrfsExPrrcY3UaMqQyh5UWP5kOllgcApwJzhnFv8SAYEB8sWqXgsCPs3RgCGkVDFGg== 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=eWUwpvRdGYCbTQ05mtW1+fJhbr7iX8XIT4j6BO/zlBo=; b=FiA7wFyY6U3XeJ8PSkTzA4c9maSRm2kUlGWfF9GcG3nL9xADIOfA0O/VaHKL8zvuyBXyp6sR6GFVmkDcpjSEkcQVIqkVNX+ePY+2mNUIyYGqc5Tl/cBF+XmUAwZ+xSw4oaZlP4oph8A+uOn4/6QfcJiE0yGrui8j7wDIV3cSlpHC0CZFo05ov0r3smiOY9P5Mqrr9wp3u+6NIv80yyWznIJrGNy6rwYv+Em2bIfMWANzTKUE+FsK58D9ThtkUbYbKfdlcYOucIg+UcTTfapOa+zcJgfTXu1EghU7DqHzkyCUIq30ByasGdi7bIaLl7OX2oCiklAKN/M4mhpLAz2Ubw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eWUwpvRdGYCbTQ05mtW1+fJhbr7iX8XIT4j6BO/zlBo=; b=QF/pYychNBHzYZPGI04RDa/1/si8qQekkxmM2i5Us50Q8WO4H2DNV46ANBjNjDjDBWHndzplfX4ZdKBfp4iHTV9Q9xK1BLmyHM5vH65pukvCFla69cN0nz+1aJdE8NlNswgAHVC/a0cMWvPg8AfW0W/jlUln2N74cD9BMEXFEqA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by GVXPR04MB9901.eurprd04.prod.outlook.com (2603:10a6:150:113::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.30; Sun, 24 Mar 2024 12:20:50 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d%4]) with mapi id 15.20.7386.037; Sun, 24 Mar 2024 12:20:50 +0000 From: "Peng Fan (OSS)" Date: Sun, 24 Mar 2024 20:28:58 +0800 Subject: [PATCH 1/3] iommu/arm-smmu-v3: save bypass in smmu device structure Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240324-smmu-v3-v1-1-11bc96e156a5@nxp.com> References: <20240324-smmu-v3-v1-0-11bc96e156a5@nxp.com> In-Reply-To: <20240324-smmu-v3-v1-0-11bc96e156a5@nxp.com> To: Will Deacon , Robin Murphy , Joerg Roedel , Thomas Gleixner , Marc Zyngier Cc: Bixuan Cui , linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Peng Fan X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1711283345; l=2466; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=J39T/x6ksIZycb9izGpKSZJk900zTRqTi3UlHlbNKMA=; b=FXwmzpUlEcqcqb3b81GkB7JiZ8q1e2dNd0NH4VvaEmA223U+lJv8QeeGfZ4t5UZAO8XFHFIBJ zhceHUMlvJeCkYMAWUrcIz/dPamU6LbqZB6EBuRh8fKXTLE4vmjeRxk X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI2PR01CA0017.apcprd01.prod.exchangelabs.com (2603:1096:4:191::19) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|GVXPR04MB9901:EE_ X-MS-Office365-Filtering-Correlation-Id: 16573211-9a32-4ffa-3b8e-08dc4bfcd802 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 66kgUotgW3Bi09kAgdEfoNUcpn06q0ATX23ued8yNrdW4KLDHxm6Kyi5TeWa0MmEnMsEPZl/bLH5pram3fr3gMGeXIr+TO/LvK5gK8e5pV2LrfF3SKvF0AEWSsRU/J4fATo8Tr35gBvmcQJk1iBhDJfHwPeM2jZ7uxRYEHM7qbPZzmro3NCAWkY3NaODGVUUWd40wXaSWXfXa2VjK9/nRMNp1e4Hj0zBMyfp90TT9wHWCeLDodDhdz4AEfKQO6Vg3bZeRnrL78gjy5xtdC06neG4zorA7EouYPGEP8TI8qHzZrja248zvJeskxIHeJCrwJfEU+GS7Yhah65hi8eInWxtkU/Q9OmWHFvsFAJ6GW9yTuwDsf5dNLXY6+usnf9AigAYVQzhcjnuZOc6EePxtkB9/S9eBIBb3YNxzYEKbhCAnIHFWs4ltehpMhhCBWGacouW+TJ1Z+uDyMsKNPcE947faYj+pC5oz6mrMklhrDXtGNJA01UXONXvXUGnQYnkr32DM0XDPCltkERwihVobXtbMAlZHgxupQVQPT4M+xBDPGvu7N/eqxsLImKwg0SAu977/f0UIUQJEakwds/dYvLHfKOOrJpzASA6M9srq8GGo8+yaaq22rRNYa9ylC2neh0kgP2IoZ3OEmPqMAjnBWtnrVsFj/WTRe+Sz6cfFa8pdVzZoyyftpZol/igYV+3DiUGQ/SOIq8OPaNa62+0hx4rw3/nD6NVAezwJgc0G1o= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(52116005)(1800799015)(376005)(366007)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RUxBd2U3RlhyUmswd3Q2cXQ5dmhuVStnVzViMmR6VzY3VFZIbUhPKzVXaXVO?= =?utf-8?B?NlZXb1A4ZmF2SUVtREdmYzg4SVEvNjltSVBXakNXc05vK2I4dFBVZnc2MVFi?= =?utf-8?B?T0J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Q0l4bENlQTRmWUpvMFV6RUZwTzkw?= =?utf-8?B?NytjQnNvU1E0WmE1Z29ZeFVFWTg0YTBERHBOTGhPaU9hb2FEMkk3djFZRlhS?= =?utf-8?B?dk1iY2NZaFB0V1hiTE5CbE1RVnJUdWJuZWNZazl4L0ZTcTJZYmFmUUlBRGF0?= =?utf-8?B?NDFSK2h3U21VNnltbnIzZ0J3eXVYZkhSVU5mRG5WV3FwajI3WlpKVDArT2xX?= =?utf-8?Q?L9k+yvTY4VjXoMeXcgFkiU/8/?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 16573211-9a32-4ffa-3b8e-08dc4bfcd802 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2024 12:20:50.8729 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3I0VKA7sFfPj7R7KPzZnw6/hNSqYxOoGkYm/F3GP+FhqEhkAcHn+hk3XuR+R9vdfemAZ44CzOF18eJ5WBMqUwg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB9901 From: Peng Fan 'bypass' will be used in smmu resume function, so need to save its value for future usage. Signed-off-by: Peng Fan --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 9 ++++----- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 1 + 2 files changed, 5 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 5ed036225e69..a8a569573c2f 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -3494,7 +3494,7 @@ static int arm_smmu_device_disable(struct arm_smmu_device *smmu) return ret; } -static int arm_smmu_device_reset(struct arm_smmu_device *smmu, bool bypass) +static int arm_smmu_device_reset(struct arm_smmu_device *smmu) { int ret; u32 reg, enables; @@ -3612,7 +3612,7 @@ static int arm_smmu_device_reset(struct arm_smmu_device *smmu, bool bypass) enables &= ~(CR0_EVTQEN | CR0_PRIQEN); /* Enable the SMMU interface, or ensure bypass */ - if (!bypass || disable_bypass) { + if (!smmu->bypass || disable_bypass) { enables |= CR0_SMMUEN; } else { ret = arm_smmu_update_gbpa(smmu, 0, GBPA_ABORT); @@ -4007,7 +4007,6 @@ static int arm_smmu_device_probe(struct platform_device *pdev) resource_size_t ioaddr; struct arm_smmu_device *smmu; struct device *dev = &pdev->dev; - bool bypass; smmu = devm_kzalloc(dev, sizeof(*smmu), GFP_KERNEL); if (!smmu) @@ -4023,7 +4022,7 @@ static int arm_smmu_device_probe(struct platform_device *pdev) } /* Set bypass mode according to firmware probing result */ - bypass = !!ret; + smmu->bypass = !!ret; /* Base address */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -4087,7 +4086,7 @@ static int arm_smmu_device_probe(struct platform_device *pdev) arm_smmu_rmr_install_bypass_ste(smmu); /* Reset the device */ - ret = arm_smmu_device_reset(smmu, bypass); + ret = arm_smmu_device_reset(smmu); if (ret) return ret; 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 23baf117e7e4..97064a6aa87c 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h @@ -683,6 +683,7 @@ struct arm_smmu_device { struct rb_root streams; struct mutex streams_mutex; + bool bypass; }; struct arm_smmu_stream { -- 2.37.1