From patchwork Tue Feb 15 03:55:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilkka Koskinen X-Patchwork-Id: 12746487 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 C31E2C433F5 for ; Tue, 15 Feb 2022 03:58:17 +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: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=uh3C6eddPal9DoQqwUgFidCD4+/CfTkcacKqj0CXoe4=; b=HCoxmzOqE6PhE3 QbsewG32TeN9Zt5lRyCMEw4Zj5xVO7aeEkR5AobxUg/EqgmmWtM0cQkxvviBAAjE26lGTv29AiQTY m+LU42ADFJ1uQ7w9Xk9weJ1t4aeg1ZBHIi0FdGpozOp9W0gGyz709z4fNs0Bs97JhynxI0/ZoqXm2 IHIK1G3pocqIiWtXzOVbiGQsbyDrR0pVOPJaBuI4sIm1e2Gy2NRQyfMC2SL9mzK8iPTdS2JLLepBc rURSXD5jwCVnHendFQ1kUUQ9coLT2/BfK1vpsmLqRKqlMJOVu9k+NeP3fqSrTRsGehxybDnp8I0MQ qPIocOUBH+APfR1sDVDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJoxZ-0007SN-0P; Tue, 15 Feb 2022 03:57:01 +0000 Received: from mail-dm6nam10on20713.outbound.protection.outlook.com ([2a01:111:f400:7e88::713] helo=NAM10-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJox9-0007KG-E6 for linux-arm-kernel@lists.infradead.org; Tue, 15 Feb 2022 03:56:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O8OgZLQI5sj64dZpHsVz29g29uOOeNE0aSFfIYRM1VxLUFqd4I7BrHPs3jwLz6Z0W+x+8NFvibz2/emH9zpphdVUT/57ZOJR99K4m9u8PjRyw1N2asv7DmfJiSNQcXaKnLKyiQezH6xfr6gTn5dbj5dK+8GpaXDmI8ualTC/arabntwUqRCrFZMznaf0S90km12Z9OOdggiP2ba7y/Z8cyQ4cJOEOlMnLmj3OOGTwPtjgZKXV2IObqlyhpxiVsz+jImSyNoE8FgdtVPyHNhiVZ3lnCPnoYnCmAZl9FJLMMLeVOcvsd4cNt+KEVL9IELYH3FxKPe0u0vXMpY80+MFCw== 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=PqrHSDdBCY3dbmh2SBmKGwbeRKiZRNsr8GQ9DG1Xaxw=; b=AGmw0tlHqjpYjLGgFBsg4i1qCEV4qkFTCLChvDEefeWsnIILAi1X/7SQajJzhj7fdlaQiWPjK6o3sQSduDU+Ts/DobFZThS6z2A2+ikONvrdx8U6VdCQM7I8zV0zl6djlA6sSHQOOgpK9pAxR40h3CAPVUlYlQmvPNl8+CRyla7GBfbZhUYOfqLKZlxXE5ZPpIoELtBcNDXc6Y4r79XViX2tbKDJKIX2oKj1uY0oknAkdZ2XiKarsN0roUkBHVh8+L4WRBpdmgxjNkteqNyTOd+eeHBkIHA9kYXe2sCWiEC+6I44iCDdp4ShbmHKrryTaaJ6pJccZsh29yI5CteQlg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PqrHSDdBCY3dbmh2SBmKGwbeRKiZRNsr8GQ9DG1Xaxw=; b=J1sY8LkztfwfqaJuR3r6Jd3CtaNjvvElWKE1psliGl3fiTBpW2zszpbtVtIe7VlflH4tlWCXDchFWpnZx5ycrA9vPM/RexBv+GlBmGJiYa8ZdZuzSL5iqNHB/dzZ3WU4Kzccr1+shT+ToDjsQ1Ewo0zrmRm7ncJTgiZuG+lEAWo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from DM5PR0102MB3590.prod.exchangelabs.com (2603:10b6:4:a4::25) by CO6PR01MB7500.prod.exchangelabs.com (2603:10b6:303:147::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.15; Tue, 15 Feb 2022 03:56:29 +0000 Received: from DM5PR0102MB3590.prod.exchangelabs.com ([fe80::e085:6acb:773c:c3e7]) by DM5PR0102MB3590.prod.exchangelabs.com ([fe80::e085:6acb:773c:c3e7%3]) with mapi id 15.20.4975.018; Tue, 15 Feb 2022 03:56:29 +0000 From: Ilkka Koskinen To: lorenzo.pieralisi@arm.com, guohanjun@huawei.com, sudeep.holla@arm.com, rafael@kernel.org, linux@armlinux.org.uk Cc: lenb@kernel.org, robert.moore@intel.com, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, patches@amperecomputing.com, scott@os.amperecomputing.com, darren@os.amperecomputing.com, james.morse@arm.com Subject: [PATCH v5 2/2] ACPI: AGDI: Add support for Arm Generic Diagnostic Dump and Reset device Date: Mon, 14 Feb 2022 19:55:53 -0800 Message-Id: <20220215035553.102315-3-ilkka@os.amperecomputing.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220215035553.102315-1-ilkka@os.amperecomputing.com> References: <20220215035553.102315-1-ilkka@os.amperecomputing.com> X-ClientProxiedBy: CH2PR05CA0061.namprd05.prod.outlook.com (2603:10b6:610:38::38) To DM5PR0102MB3590.prod.exchangelabs.com (2603:10b6:4:a4::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1acd92dd-da69-4261-5a2f-08d9f0372540 X-MS-TrafficTypeDiagnostic: CO6PR01MB7500:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vT/LGWY9XQuBR/5Db+Wzy5S0XGohyWtlc3PGGHzTLe+ETLNWkjCbIutVOZmdzLJuoMkzBhUWePng/WbnSxkFdkiRII1Dy6FUx7bXgHeMqSApqGUacTSE7D9CanWGV1ENWQwQr1FNCsLjD0GEm4XFG2I9vRS48QQoHR0ZzTDHkPRX+jqMBd0kein5jJgiFccD+TtutkSAqF3oOcQenYYamw7b4MpB8mJ91VextAn0/CEto6qEd2aXLwqRYwkgb2wMIvK8YAU7OHUexY99eFyFQgncJ5Qmdrihe3NYi1azg++Ow0vPHIkM8rMCYsLYJBQ/F5WH9l83mS6CQwjX3lrcPWk9uPGZYcC+XSWG9HQhdxBlTrWa+7jiibYAxXB5FkilDynriQzabIIq9EaAEK9+pVQYSXiltgCheSwolct6eW1+9j48o2o34hVkcDItvSP8SbXmFyFzSUU9Fdm67mdprvZ8IRNOCVT25XSSGNBsE8nwknLX8V2PahlKKmhS3OU/KHEU6fpNnFGYxskE7PGy7Lf+qkPzjOAE4RCknO1ei0+yNLdRIPgaiR01vqDJWN6X1UJhvQpR4m8xIhkXnyj7QNf1gI1EP5XyZwMaor4sVkJmw2LGGXJaTqikmzXigjXxkJEu0CGrs6R8RD7y7j2CxiFEYBYo0S27NFeDel2Ux8BRR0+dkeOKvvh3yjGrHhedc0JjhuWqZl283xKZciqprOfMEEkuMtouhMeDXobtCCqZSR+pMvu34FrLPryc6LG3CwqJMQUrO2f8ovwRtbMbjChNUFRcqQ2votkHtGx+DybsUT5lSz9pXubPl0ziP/NR X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR0102MB3590.prod.exchangelabs.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(26005)(8676002)(66946007)(4326008)(66556008)(66476007)(2616005)(316002)(1076003)(2906002)(38350700002)(38100700002)(86362001)(6512007)(5660300002)(7416002)(83380400001)(8936002)(6666004)(6486002)(508600001)(6506007)(966005)(186003)(52116002)(41533002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tU7pCPIeRpempZQDBUFb6MRojDC82Clb1ae9bsaeS7RE4GJf/zZUvrQax5cyo4d2vNElliuBBHw52QGhfy1GAFz2GgCxK+0RJ/uVY97/Xsj//JDJ0x7Xw4uAJqGOaB5VqjiukCvyWkGv1Jqx6o58UqUXRYUGLM0V8rSE19v6+OewHrley4jOD6so3lUjDSE/npS0FibgRSCs0y8e27GG55bCWhyTBmwuXwIfSn0BXsiRGSCNklIIspzcwrXV5rKF0wWfz7cWGQw1SzsWyv+8C9xR40iJ2kkOJgCkgr/IfAdrHVeRz4BBENT4pir0isCyhZfHS43NmNuT4+GgUNJzz2EAyv3VOrddyls+3Eh2QKnr9PSlYto9y1Sp6+Yvk8gyGsLqw+eDSaMi1jtehy8UqwY5Foivvi+8C5ThsRJ2XFIpW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20kpID1/X2t98AkufOu5uafX94NHeqL+F1eZv1AGcwH0tRe0r6heyIPVXQdAFzk1Vtp94Rxz5FctwuEZ+MEY8A28jBDJgH47fvQmabPSEXGdvMFb+K1rmNaBiT/1vkpmFvn4dxNu20puDXRpNPTI0vDWcVd2Td88tusScGNmCTy2DulRjX2wUKkthodtH8N93oAlgojCSaf1JOusF9AKG0CAvmtjm1fCTiCuDOVLVKoqutA== X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1acd92dd-da69-4261-5a2f-08d9f0372540 X-MS-Exchange-CrossTenant-AuthSource: DM5PR0102MB3590.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2022 03:56:29.2696 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PpuHmETDbcbTj5KTqNhfneWrLTTw1WwKWtQV0Zm12I4u3cjU3FiMSelY3UWxa74ZjE01BGPOM7IN1+0c9yuik78suoMj0IC9su3ysziS0yoSmLOcU1vLbXRTTNXpQj8i X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR01MB7500 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220214_195635_512911_1F7C5867 X-CRM114-Status: GOOD ( 17.73 ) 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 ACPI for Arm Components 1.1 Platform Design Document v1.1 [0] specifices Arm Generic Diagnostic Device Interface (AGDI). It allows an admin to issue diagnostic dump and reset via an SDEI event or an interrupt. This patch implements SDEI path. [0] https://developer.arm.com/documentation/den0093/latest/ Signed-off-by: Ilkka Koskinen --- drivers/acpi/arm64/Kconfig | 10 +++++++ drivers/acpi/arm64/Makefile | 1 + drivers/acpi/arm64/agdi.c | 52 +++++++++++++++++++++++++++++++++++++ drivers/acpi/bus.c | 2 ++ include/linux/acpi_agdi.h | 13 ++++++++++ 5 files changed, 78 insertions(+) create mode 100644 drivers/acpi/arm64/agdi.c create mode 100644 include/linux/acpi_agdi.h diff --git a/drivers/acpi/arm64/Kconfig b/drivers/acpi/arm64/Kconfig index 6dba187f4f2e..d4a72835f328 100644 --- a/drivers/acpi/arm64/Kconfig +++ b/drivers/acpi/arm64/Kconfig @@ -8,3 +8,13 @@ config ACPI_IORT config ACPI_GTDT bool + +config ACPI_AGDI + bool "Arm Generic Diagnostic Dump and Reset Device Interface" + depends on ARM_SDE_INTERFACE + help + Arm Generic Diagnostic Dump and Reset Device Interface (AGDI) is + a standard that enables issuing a non-maskable diagnostic dump and + reset command. + + If set, the kernel parses AGDI table and listens for the command. diff --git a/drivers/acpi/arm64/Makefile b/drivers/acpi/arm64/Makefile index 66acbe77f46e..7b9e4045659d 100644 --- a/drivers/acpi/arm64/Makefile +++ b/drivers/acpi/arm64/Makefile @@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only +obj-$(CONFIG_ACPI_AGDI) += agdi.o obj-$(CONFIG_ACPI_IORT) += iort.o obj-$(CONFIG_ACPI_GTDT) += gtdt.o obj-y += dma.o diff --git a/drivers/acpi/arm64/agdi.c b/drivers/acpi/arm64/agdi.c new file mode 100644 index 000000000000..28916650d834 --- /dev/null +++ b/drivers/acpi/arm64/agdi.c @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * This file implements handling of + * Arm Generic Diagnostic Dump and Reset Interface table (AGDI) + * + * Copyright (c) 2022, Ampere Computing LLC + */ + +#define pr_fmt(fmt) "ACPI: AGDI: " fmt + +#include +#include +#include +#include + +static int agdi_sdei_handler(u32 sdei_event, struct pt_regs *regs, void *arg) +{ + nmi_panic(regs, "Arm Generic Diagnostic Dump and Reset SDEI event issued"); + return 0; +} + +void __init acpi_agdi_init(void) +{ + struct acpi_table_agdi *agdi_table; + acpi_status status; + int sdei_event; + + status = acpi_get_table(ACPI_SIG_AGDI, 0, + (struct acpi_table_header **) &agdi_table); + if (ACPI_FAILURE(status)) + return; + + if (agdi_table->flags & ACPI_AGDI_SIGNALING_MODE) { + pr_warn("Interrupt signaling is not supported"); + acpi_put_table((struct acpi_table_header *)agdi_table); + return; + } + + sdei_event = agdi_table->sdei_event; + acpi_put_table((struct acpi_table_header *)agdi_table); + + if (sdei_event_register(sdei_event, agdi_sdei_handler, NULL)) { + pr_err("Failed to register for SDEI event %d", sdei_event); + return; + } + + if (sdei_event_enable(sdei_event)) { + pr_err("Failed to enable SDEI event %d\n", sdei_event); + sdei_event_unregister(sdei_event); + return; + } +} diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index cd374210fb9f..747a7f98fc1b 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -26,6 +26,7 @@ #include #include #endif +#include #include #include #include @@ -1341,6 +1342,7 @@ static int __init acpi_init(void) acpi_debugger_init(); acpi_setup_sb_notify_handler(); acpi_viot_init(); + acpi_agdi_init(); return 0; } diff --git a/include/linux/acpi_agdi.h b/include/linux/acpi_agdi.h new file mode 100644 index 000000000000..f477f0b452fa --- /dev/null +++ b/include/linux/acpi_agdi.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __ACPI_AGDI_H__ +#define __ACPI_AGDI_H__ + +#include + +#ifdef CONFIG_ACPI_AGDI +void __init acpi_agdi_init(void); +#else +static inline void acpi_agdi_init(void) {} +#endif +#endif /* __ACPI_AGDI_H__ */