From patchwork Sun Mar 24 12:28:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13600805 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 A9287CD11BF for ; Sun, 24 Mar 2024 12:21: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:Cc:To:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=PHE2B4XH2bPhduW5sjOx50udsIcxKoix4f3GbEBowrQ=; b=3tuO7f0opWOmfE+Y5LxXIlsMMv WSvaOYG1NJaCtym/wrIZh3fxw0tDoAvI0F7AMaQZq2n/GWfDk2O6yzjbhe+VdqJ24lsq995csryYU uWYxf77iBRfQsKytZby9iWMnGzNje1ikCCELXfeJW7iHhvoBhagbUfh977Db6NMw6qHwYBDIxz7hd cwSDzwQVGVGO7kjZUcbo4LsGokQcafQVmY/nQzZHoTV4F6YZ1xo/qihjqvWJ0/oIqSr8tNyk5InFO P4pTbx1KA1h5hblhqj91hULx68YhT0rXKVU4jhhLtDcy3eEGPz488ba9aPg4PLcOVatIgciZgo61J j9Mok7vQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1roMqf-0000000CXBg-2Tsq; Sun, 24 Mar 2024 12:21:13 +0000 Received: from mail-db8eur05on2062d.outbound.protection.outlook.com ([2a01:111:f400:7e1a::62d] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1roMqW-0000000CX5K-3fSV for linux-arm-kernel@lists.infradead.org; Sun, 24 Mar 2024 12:21:07 +0000 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 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) 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?q?ELAwe7FXrRk0wt6qt9vhnU+gW5b2?= =?utf-8?q?dzW67TVHmHO+5WiuN6VWoP8favIEmDGfc88IQ/69mIPWjCWsNo+b8tPUfw61QbOBW?= =?utf-8?q?/T7k3FbtHnsTb0gE5+mnwn+PJMNDP1DfDZN+gV7pWNe8q54qwSqKkyIKGad+CEeUG?= =?utf-8?q?AtEmVikbT7h0Q+MHzWYgBzblktbJ8PXRNLdyljIDjjrIeLN0EBEDaI5tPKcW1iQvB?= =?utf-8?q?/J/dhAMsdF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6XhvXVocXMm+veWhYl782+lpgUz5g83Vvav9wXPxweq427EAsR4WjEv5/LzC?= =?utf-8?q?3hPGmBCHmRxZ0TdNg0WxHwIX9JtdUfZknP6RcrNcDdFTIp+Z7PbdCOmwuTclZBa0v?= =?utf-8?q?wt7wyV+25TeeQN2MkmiywbtHbHHDCLRNTn2tsa6f2JotN7iLR02vgUr9YNkTCf6yV?= =?utf-8?q?0G8XBJmOKKYdsWiysR9Pa7kWPRD7KUJRDEtKxW9XDdIikhjoX9Y6NRGXbK5d7eSxq?= =?utf-8?q?7kqnzSePJCuosOH/ZeohbO0jKeCIxlCeA4fYJo0UzEFpO907+cBsoSQ4Za5goYxUE?= =?utf-8?q?Y84a0DDpNLhOiOaoaD2I7v1YFXRvMbccYhPtWXbLNBlMQVrTubnecYk9x/FSq2Yba?= =?utf-8?q?fQIADat41R+hwSmU6ymnr3gBwyuXfHRUNfDnVWqpj27ZZJT0+OlWL9k+yvTY4VjXo?= =?utf-8?q?MeXcgFkiU/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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240324_052105_025472_CD1BE1A9 X-CRM114-Status: GOOD ( 15.42 ) 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: 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 { From patchwork Sun Mar 24 12:28:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13600806 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 0DEAAC47DD9 for ; Sun, 24 Mar 2024 12:21:27 +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:Cc:To:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=sdtEs/nP72+N9wk3+cbtVrQ0Ithdyx6+x0a2O/mR5bY=; b=aubsNPG8ukf7kgA0CNtFmq6RWX neCraT57Sfyo7IHJL6UrML3gINIY0qd3Z2lAjHVXT6IuQCPgT7LJiwkdeF0Q1e5ghefQTK8waoVQG azUfwjKxrlOcJ6dn/md308WX2ppW8cqIrX3g8Foxl+sNHkq1ixvjQMydZ4nDhpzma2VATe7v4xRm1 ZsTI1dBC1ncCDJvlFDNw9llFBBpWfiRN6wKXSW9mR8B9adcHZ6sjOdVdQ9gSFK9Ti1Bvv0Q+Ov+5L tMaKcykSHaee/wZeDQiFarNWmxyZQdfxdjCNWupfTBFVfDZ/krL3MZ0fcNclgzdFXW7H8+FHYmzWK XTsi2H3w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1roMqg-0000000CXC5-2vNE; Sun, 24 Mar 2024 12:21:14 +0000 Received: from mail-db8eur05on2062d.outbound.protection.outlook.com ([2a01:111:f400:7e1a::62d] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1roMqa-0000000CX5K-0v6W for linux-arm-kernel@lists.infradead.org; Sun, 24 Mar 2024 12:21:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I5L9oSyPkiKvwj+OTtW5qYGsoR0pJMRIYMpaBRKoyFuwW2pF/7WnfQtf0kvTxxX4i8KtKoZ0PaC9RrMzCKuJSj1Fuq9Pe5wMsTXjfRfkOy8dzEujPd3vIhSz2SXCb7QdBo0hS2/apfbkADbT7gA9vS9WQg6DtNYuN2eldJdjsX3gF/qIr7NmXjnOQU3VW0NQJiMfsklJNnRpNJer6ZJ7n4UHSVMbDaDrGKsm902YjUVJGazIXbJgqtL1HGk6LwR8gnpQaTG7Yhkqqnu4dH/TpTWiu2u0ga/GMk2OzWF/lM78TP3XdXzvkiPljAYRFrH5saENH5oPsZvHydtd+31EOw== 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=hOwCuYkFF0fYO9+0nm0XCNTfTQzLrl7RfVsdE3jpL6E=; b=YsWZwxN4NlQTwee+PopFcRIzg1/61zo5jDbcrwtjK2JOoW8qWRvTCKZQEvxCTdgqVplDPqvkAkGPsf184XGWFV8dS3gSOI3AA7asq2doRrSmPV3PNYeCJKq3umV/F1128PXaw2y1vTooVBkKkY+kid42RC+qFi3/Vc9PoygQshhGx4lbaGKrXL4s/vGY+Qod+BLPXmSS507eRfgEZmdJu46/LZ/xqmSRxUR9er3NGWnwqOOBaZaDZnBioYjqrJtgBv3WVxhR14gFonN13ZosMxL/AWhIxGe9d5gRPfus73z1DtzSfQEWoTIi5c3a5ZoGY5z9C+7dQH0ArCagfqGv7w== 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=hOwCuYkFF0fYO9+0nm0XCNTfTQzLrl7RfVsdE3jpL6E=; b=U5ttUKYDyaEIF3E55hAPjAMPGOId5X+6s1jeJDONUyAWyheTXtTy7lGxoXTB8KQfeCdXQyidEEdpefcQDpsMVbUlKlpf911yttpoFLOUCKufNGEpFa3Uhn7frqS3Ko+CK7NJygE0HskoKiRFUcLjd6xo1dkXQpNN7PdicGgIsrk= 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:54 +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:54 +0000 From: "Peng Fan (OSS)" Date: Sun, 24 Mar 2024 20:28:59 +0800 Subject: [PATCH 2/3] genirq/msi: cache the last msi msg Message-Id: <20240324-smmu-v3-v1-2-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=669; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=Z30mdWFv6IBqp2Tk95bfFcpL7OYDH1rSMcqs7FsQUCo=; b=/wUm2gJPn0ot5bNtIIHlM/mCiO9O7bw953Zuap8UfaLYd8V+cxWY8ZrFyc4CvO0yGvPFqlm2Z Wug38brm/g+CFUcoJMS3ekFwldWnHBz2NN4KpUPnqkPdVewjiLdjS2u 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) 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: cf2eb52b-d023-4e2e-ca2b-08dc4bfcd9f8 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: LvJMpD5XCs1pPYio9ip/73s5KS4LIxdDcs/HvI1uQI+hdxWcqHsEzdzHpE6HIGr9x6qV+fayTDoMrXENpzLqfi71/c4Jz/K9y7JLum1qxQqP+tx52TRups04UCe+ezSUCw3SWnrsgyArjqHiTXmfRiWBG4IR/0GViMyJjlRYt4yorOwAeempDTEShYxC57UV7LYSnjVJ2IbZRyBFR3Pcm4q2fKUfXx8gekUqDzGv5Ey8cxaJOXn0Lbn6ZX7dl3F9sGRgYGE2f0c81lJoUiXJNu2JMrP2cC4+u0s/0uyZsgZfIcpnbiS69IX/MJnLjDWiqB/GUXjM1PLtkbMUawftZbMa0KwnWoxGXs6J88Zgh1WmMAbce6JVou1KuJz12r0f762VEz7hBr0/pov981VCgquoXBq6Y/NFNWH0TdkzzNwb19L4qq03TmXusqcQnsV7LxZqFeLQ2dEavq9X4vFygK0C3MtDlI6Fxs60ieLPBEAk3BdzgdZ01k24IsInRHptwop7wHfKkdZA6sMdknR7NJxyv98JB3kmb16l5bvK/qKNuBSwzmmoG5TxMZENkidVriJrnWiG1FFVAjHKFwfD7XR6U+B5+J6yR66HNAp5P3ndAOlG+20VJPZjg4q+EQgch5k5sOqT11iH6xtkTzFBJmqwTx94NcgENZejF291zwqkSdUgh5EAoO9+8QRjv0ntDQwf8s/r4ZAvDYWWBKnA62PvNdsW4QUVX9SXojSTZbk= 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?q?5wMbwpPslS8PKYRt5NLkMR5SlwUQ?= =?utf-8?q?M8tN/19QQh5RA8fSw3SSFig11ZqjtyKfK0KZAo5/OMzPpzpXICvBdCqh9siisdk7G?= =?utf-8?q?7eicoPehehrqfm9p9APtnTjx8r5XohIfky1p1eyUhqbeOlo+is3Si5IsVTEkOVvuA?= =?utf-8?q?PXPPqkPP6Gok08Bw2lX1Lk1ElwPZLdyjmYLlTFyTPRKx0tnYkwqRVeAvCwKwyu/mM?= =?utf-8?q?u2IfXHlFMR41nUaA5db50Ckj+eAU0bD5vakFPZtlmmX/weCor7mhWHq1R6xUlL9by?= =?utf-8?q?2JGvUsaGD4a1ZurxKwHBDngmBPHvY6dcD2TJv+pPT2qj0jIaEN8rPLZKIAeo/P+PY?= =?utf-8?q?CYqlos/GzZKv3RFR+LUzHCfA3m6NG+1LMvnnIU/sYOOa6g0TtArMN5LKJQgimS6Pc?= =?utf-8?q?k8kChPBhh9J+rKTELdaBO4cIeYNal9SYZ1jy86XVyk0YJsTmlAPe3ddAi7v+RJ9zG?= =?utf-8?q?yKqlId4gHItoCaErdGpnoYnG165UoGnDw2u8JvygM7N8I9abEIpa4X8oXDCfPVPOK?= =?utf-8?q?+bwIrFpVtPMHXJ+yBa7X9ihnk9sTCZ2tKU3wqbg9MtRVyjxTq7aywCLUOrLZQzFB2?= =?utf-8?q?xvuUA2ID6icQnHyrKiaeBzLISpH3MYmHJLyyHB5v8FUbKm2OuXzos5tmsN/mUeXVp?= =?utf-8?q?1Jl9Nn8IdA8yFz4Oe0L//U2uqE2hvdp16H3ITWZouH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exchange-CrossTenant-Network-Message-Id: cf2eb52b-d023-4e2e-ca2b-08dc4bfcd9f8 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:54.1508 (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: fEzt/NaWpsXtQQGSwBuqcmyz+QqrHu3GBV3kLBJi1pg4vXAK2A28sHlr8nr8NG5ovHBqs5P+vk/xub61Gsyecg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB9901 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240324_052108_464425_CF61914D X-CRM114-Status: UNSURE ( 9.55 ) X-CRM114-Notice: Please train this message. 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: Peng Fan Cache the last msi msg which will be used for ARM SMMU V3 resume Signed-off-by: Peng Fan --- kernel/irq/msi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c index f90952ebc494..9d7e0a675089 100644 --- a/kernel/irq/msi.c +++ b/kernel/irq/msi.c @@ -617,6 +617,9 @@ static unsigned int msi_domain_get_hwsize(struct device *dev, unsigned int domid static inline void irq_chip_write_msi_msg(struct irq_data *data, struct msi_msg *msg) { + struct msi_desc *desc = irq_data_get_msi_desc(data); + + desc->msg = *msg; data->chip->irq_write_msi_msg(data, msg); } From patchwork Sun Mar 24 12:29:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13600807 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 2FB8ACD11DD for ; Sun, 24 Mar 2024 12:21:27 +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:Cc:To:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Tp6oJ9YtCtOOcBW5E96hL6hYzwyXqEIafLT1U9xka+s=; b=r4ms0orASoB1Vi2qX+medxQAMd BlOZYrcX4deZTaYPC2Bh38BRZueP7iqpXRxLvVFGIGA+KJ6V4Vewl+K5zIlJBL2vyXWbM2RvF6tYS 9IQqNscKt67RT7/Wu40DW0cawR0sfaEMy1FOB2P7ojBiad7BYFwscHQt+BtNguJAlF3tw9UUYQWWw yd7+yoqlwLOUOqw32UvV2HfC7HG/gqXUmj9clSm1ge5vtWCErD83w/F5xGwgRtbqVwLMOB1wqI2Lz dpeuZ+Um20BiOGyg4n5qiRZK6IYfKWIgqWyVYjiXptFYijvG6Yh/WwOuHNLRg6VJlm9YLyGIYVTTU FL7p1Clw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1roMqi-0000000CXDB-47SH; Sun, 24 Mar 2024 12:21:17 +0000 Received: from mail-db8eur05on2062d.outbound.protection.outlook.com ([2a01:111:f400:7e1a::62d] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1roMqc-0000000CX5K-1ZLc for linux-arm-kernel@lists.infradead.org; Sun, 24 Mar 2024 12:21:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TLb3H0vDf3V0thM6p380iCjhw6zJT6RQ2VC1oZTC9HwyJ8d5QiONn2Oi1VtaYvLgsDU83Y81mxpgYTcc635meQHzh5cufb4RvNnBhPs9JbmKXKheyuoA1OaIo9FrPIxZon71etM6mixeCvcYH4krHvTLdDAswqwtg9nwXZHvoJm4sNDObj0C3Ajysm40u3vf5QLI396Yns5r/DEJ5jUPPS/5LdHXIXlberbsCnLcm3ayPmolpUdYZ6oiX7bI0M6CNtEGghCVdRK4VmSFKY5tfZSrkM69QKxyi/jpP0S2Qc7hRsK5hpZfQw47NF8/v09MJ787gyKi7fYjlo4XVWBtwQ== 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=qSBBP8CdkRt26BWQnEn0Twnx5706NESRFGp7EcaHaUU=; b=itQGpBekUwekhdfcuY/Z0S8L79SKdJQx5cbDM+L+Gychuk64U929lg5fpvL+HmejXLj2EQMWhetx0btSZZRnpAL+RANEiICepk0QaXG5IEVVBTMU4+YKOWhVsOelV4h2Tj9Hnnl3kgMSo1SIyQ32BWad67I+b44iKheTgZH2Q4RwxyPfuQQOXc7H1mWAq+nmlMFpFfBnBPo3U2qBZcw03tbPpR4UHIynDJAha2+Z6Xc1rFbxRfOGs82jKhoS5UZ8b8v9duDS+cYgjyqnElVKG/YPQPGLxGGyMFb6VUsiEy0JwQlpQ5jPtJgfSwI5LZfE8s9dvA/S8yRhpgEG9/bXog== 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=qSBBP8CdkRt26BWQnEn0Twnx5706NESRFGp7EcaHaUU=; b=VdyJAsNvtnZipZdR/9LnxouoYjStzer8lMGCaGkXnUvEnCc+aTuGLwK72z3ltJ1nEcuFKYU4udwhpKUNbgGx3rtwEy4WIrOIIHuRBkQl6jfvW30yLnvuI2hBGD+tiftl9vpXvZuPzk7WONOXqZv5RndhikbDyyJItgSu6kH7InU= 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:57 +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:57 +0000 From: "Peng Fan (OSS)" Date: Sun, 24 Mar 2024 20:29:00 +0800 Subject: [PATCH 3/3] iommu/arm-smmu-v3: support suspend/resume Message-Id: <20240324-smmu-v3-v1-3-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=4688; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=GiSd4PlTexX48iZrMpUZF0JbBWkoDDMT3nVKob6ALg0=; b=Qw1qNbRzkiQXnGwnSyX4pIUbPqNQ+Aqr0AQUC1bi66PWMtK0gor0N4PGwcC4SOnugOY6F4ikt w95Ia4FqP/ZAr5L4tw8jvUhfY9eLH6pR31cONXOtIWJhWquCksA4kjg 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) 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: 0c4dc8a9-8c4c-418d-92d6-08dc4bfcdbee 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: qbSN8UJVE/j0W3BcbLbZzXAMmXmn0i+6BuhfLJxNNiB0tFftNS3BLRVChqFTQOq8LFO3Fo71ddekqFRXhkTK8jn2qdCZhpzGktGhQHqkmt3m+DzWodh0gO3VsBHhdWqjks5+J0ZWYnzghW6ZuVvkojVEoIxRGCKUEFxXt7toFf0VxAMGRx8Ekx3sDB8rnTFuAIYTvbSDh5E0OHMTl5LpmU4aK0O8WDQqI7hiEVwxEWVvpzg0uY/65b46JQi0nA2ibUtnAVPYNrdCcnOOYwI1ApwbgeFQjRyzA9r/EIjLosDTD6pTTdHhasO3ryJ2Jv55sLy7g3BHd3+CWWgWkCZFxeI2WusaA8Sja7RUwT99e5r8LaAp1u8SW9JeBBfxkw+TAN+3Wb+46cbqjWehc7owVMhFT5qeo5Ino3xECsCUUKBlcAXXvNhG+PMeHgrCGu7uHNyzAAWG8zk74k7JBW5c+xjIc1QlObw50pxnKK15NkGPEPfgDxevywbSM/qSRetrDeONe+9s5ReqfWUkDThGqiO3ej0kbWwuXD0QAUyh149Wnr5N6PgspgbedS0noNbOIame82E3HlzPUv1PstFQ2HIk/HtQoy74fQEiDiIiI1jiw9DizY+6kYW1taKEdGN9AHZchbkRo0mRfcKTGqX3omlZdqZJzlrk5anwrYKG2VcD32aFcftePWOH4iiKGE11ScEX7Gi8rhAwWZduRBkR9g== 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?q?/xs2dMA3aRDe1AaKR2jSqVsv9XP0?= =?utf-8?q?je32Tc3wE+VuvphFKa1t3d6lqCC7CHZdqFUeSNPT5Rf92nY/N5zgvXp8cl5fB8om8?= =?utf-8?q?biqzUm1QClKoN0J/okxT5ermC0T2FXi80xQ1vt18luo0wzVKttlFCznzyhd3SLjMH?= =?utf-8?q?KGnUd0PHfw6nYbzya57k8rcKv5aweRfSvgp9zb58D83YoYrJyyXtosyam3ScTM/Yf?= =?utf-8?q?eeVcJv5XAQ5UsTTL2lQ/9ZC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/A553pfn4QNRwTcVVfnBXlox62Rg?= =?utf-8?q?JPl5XZJRdkkLDtsLQVA7XR5KUtH3WBFPksJlKf/o5XWqOayRdELW8J0fGeFanWWji?= =?utf-8?q?8XfK532uveLlWOUlE7QIjF6/TrIOG7Btd5envGR39KLHBIZZw/9wLB5l6KfB+lJRv?= =?utf-8?q?s+06ybNZJzOkGBRfl8bR61jZCvTaSz7LRgynJwjRwzS5tsZng027yuhF/bf+tGhGo?= =?utf-8?q?TGvXTlbdl3PVi2FbmoY/1WSbktPZ73a11Io671gXodFwqV9dRpotST+0ed/D/7c7h?= =?utf-8?q?LHVs1y7uJCM5TZvX2lZEFFzALbbnXTbJ8+J/CjrA+0Dx5UViGmJ0zKkWTNebgUXJu?= =?utf-8?q?iyaXNxOKWmXBBPcrYqrVcRyJ1xt1D18WTTmSD4H555ImGzzxofX/PMzagKaXvD3NZ?= =?utf-8?q?0ujysUSuOJL9?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c4dc8a9-8c4c-418d-92d6-08dc4bfcdbee 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:57.4250 (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: s9/e38xJbknM2qqmXUpu0i/uYfs9dzOI0vXhCzH/hX3alae8DbLEMZOX1JWka3ccylgXJzjIIbl3q1BKjEIsGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB9901 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240324_052110_749391_C337DDF7 X-CRM114-Status: GOOD ( 16.78 ) 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: Peng Fan smmu maybe power-gated, and the registers are cleared. So need to restore its registers with arm_smmu_device_reset and resume the msi interrupt settings in resume callback. Signed-off-by: Peng Fan --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 71 ++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 7 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 a8a569573c2f..2bfe4b3d0ba1 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -3396,6 +3396,36 @@ static void arm_smmu_setup_msis(struct arm_smmu_device *smmu) devm_add_action(dev, arm_smmu_free_msis, dev); } +static void arm_smmu_resume_unique_irqs(struct arm_smmu_device *smmu) +{ + struct device *dev = smmu->dev; + struct msi_desc *desc; + struct msi_msg msg; + + if (!dev->msi.domain) + return; + + desc = irq_get_msi_desc(smmu->evtq.q.irq); + if (desc) { + get_cached_msi_msg(smmu->evtq.q.irq, &msg); + arm_smmu_write_msi_msg(desc, &msg); + } + + desc = irq_get_msi_desc(smmu->gerr_irq); + if (desc) { + get_cached_msi_msg(smmu->gerr_irq, &msg); + arm_smmu_write_msi_msg(desc, &msg); + } + + if (smmu->features & ARM_SMMU_FEAT_PRI) { + desc = irq_get_msi_desc(smmu->priq.q.irq); + if (desc) { + get_cached_msi_msg(smmu->priq.q.irq, &msg); + arm_smmu_write_msi_msg(desc, &msg); + } + } +} + static void arm_smmu_setup_unique_irqs(struct arm_smmu_device *smmu) { int irq, ret; @@ -3442,7 +3472,7 @@ static void arm_smmu_setup_unique_irqs(struct arm_smmu_device *smmu) } } -static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu) +static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu, bool resume) { int ret, irq; u32 irqen_flags = IRQ_CTRL_EVTQ_IRQEN | IRQ_CTRL_GERROR_IRQEN; @@ -3456,7 +3486,7 @@ static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu) } irq = smmu->combined_irq; - if (irq) { + if (irq && !resume) { /* * Cavium ThunderX2 implementation doesn't support unique irq * lines. Use a single irq line for all the SMMUv3 interrupts. @@ -3468,8 +3498,12 @@ static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu) "arm-smmu-v3-combined-irq", smmu); if (ret < 0) dev_warn(smmu->dev, "failed to enable combined irq\n"); - } else - arm_smmu_setup_unique_irqs(smmu); + } else { + if (resume) + arm_smmu_resume_unique_irqs(smmu); + else + arm_smmu_setup_unique_irqs(smmu); + } if (smmu->features & ARM_SMMU_FEAT_PRI) irqen_flags |= IRQ_CTRL_PRIQ_IRQEN; @@ -3494,7 +3528,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) +static int arm_smmu_device_reset(struct arm_smmu_device *smmu, bool resume) { int ret; u32 reg, enables; @@ -3602,7 +3636,7 @@ static int arm_smmu_device_reset(struct arm_smmu_device *smmu) } } - ret = arm_smmu_setup_irqs(smmu); + ret = arm_smmu_setup_irqs(smmu, resume); if (ret) { dev_err(smmu->dev, "failed to setup irqs\n"); return ret; @@ -4086,7 +4120,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); + ret = arm_smmu_device_reset(smmu, false); if (ret) return ret; @@ -4124,12 +4158,34 @@ static void arm_smmu_device_shutdown(struct platform_device *pdev) arm_smmu_device_disable(smmu); } +static int __maybe_unused arm_smmu_suspend(struct device *dev) +{ + struct arm_smmu_device *smmu = dev_get_drvdata(dev); + + arm_smmu_device_disable(smmu); + + return 0; +} + +static int __maybe_unused arm_smmu_resume(struct device *dev) +{ + struct arm_smmu_device *smmu = dev_get_drvdata(dev); + + arm_smmu_device_reset(smmu, true); + + return 0; +} + static const struct of_device_id arm_smmu_of_match[] = { { .compatible = "arm,smmu-v3", }, { }, }; MODULE_DEVICE_TABLE(of, arm_smmu_of_match); +static const struct dev_pm_ops arm_smmu_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(arm_smmu_suspend, arm_smmu_resume) +}; + static void arm_smmu_driver_unregister(struct platform_driver *drv) { arm_smmu_sva_notifier_synchronize(); @@ -4141,6 +4197,7 @@ static struct platform_driver arm_smmu_driver = { .name = "arm-smmu-v3", .of_match_table = arm_smmu_of_match, .suppress_bind_attrs = true, + .pm = &arm_smmu_pm_ops, }, .probe = arm_smmu_device_probe, .remove_new = arm_smmu_device_remove,