From patchwork Fri Mar 4 05:22:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilkka Koskinen X-Patchwork-Id: 12768482 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 DF2D8C433EF for ; Fri, 4 Mar 2022 05:24:47 +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=dh+irOexomDiAYT8fu1QDXYzutqa4BYpTqvvQl79HUE=; b=BfG/rMaAcsD45M HaUculJTXZ5zz82J2CJDhtGpDZu5F4h5ikDFt8NqS8JxqF+YSu4POFN0zUijPep6Y720xCKDSTeLl 0gTi3EB0q4vcGxKRGj4hCjF3IukIt1wEcTKR35qDlxtYwojQtAcj6+GPHWbIlvc/5CAYvsYVqrdXh U3w0ZB5B1lPrG39uZ1wdFO9rqTFmeFCtMJqW9oAsK8lLx0Tg2TXepieg72u1hiVWQBpXKZ8KiCyzf LGBdndsliVJNDj/8AjRtysjXH7Bv4iv0373xDLC4g0J7qzuLhBmpRDPSteJj24dqUBBC3S/vDcijs GXNjXaZCoAz0eNEgMaEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nQ0Pe-008W9u-M3; Fri, 04 Mar 2022 05:23:34 +0000 Received: from mail-mw2nam08on20706.outbound.protection.outlook.com ([2a01:111:f400:7e8c::706] helo=NAM04-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nQ0PT-008W6i-9R for linux-arm-kernel@lists.infradead.org; Fri, 04 Mar 2022 05:23:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WT502SxKkPJxN5o61VOS5ROVg4Pv+o/jpzwarx1/Wcu0+kWX5Sx02wgmus2AqphxVsz1YMJZvm8PmklCMEqr2ORZKgT7woCXg9K63t6t74HTf7W/gaqK9/wgtNUyd6r5QEfeB5KKVRAtgNAjIEwqDBOqDyM56AABXdxdjSkuK+wSkoLX99ig/CRDyiUerja7PNxSrhd69HmhdX1FlHTct0h9NCOCL132noRyuTyPFyjusbJ+sNtpb1Zx/SPZg/cGbdpJu/4Es5pnCSw6z6ISoJTLHufER26udD/NZQ6+mDH8OSuZ99W9g3RBMnpMmQmdUqcj1esU7fmrj6T/tDSK1A== 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=6mfWXihvszlFOIpsJH3Q772oo+mschXSOeDO1eSG5H4=; b=QYgNErm+dzVpCPRULrE61db38uZTWlAzY0YJRX1/uhzr62uri0DvDTNrqGd3k/dDSE2WoQc5uknSbmeeTEps2FVS6QSTTnutl3jikwQS07rmHScZNhfWhkovUi2P8xXbh+8P303huVc6Q0BAvjlCgvvJy7aothWzHZCNKRtW5IQEuSqWFgRsVFmT+d2VKndpF5tvYXAW1rjcPf2l0RBt3deqeYamORFa8BtIhnQLAqJAR7UtDjk4u6Q8TGP0pOXAKgDaCDYVq5ymkPjguwWVQJDqYPlUIY6uUhRHezxUeW4Uv8oPAfnmUza7ielGw2DpZN1aSUdjNOQzy5yqE4tUaw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; 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=6mfWXihvszlFOIpsJH3Q772oo+mschXSOeDO1eSG5H4=; b=gXPt/73GJg7I/QxhPdxUjsaqOe1ddFHcYjym0UJkekNU8ItYjVPv77hLTNEW5taSJPc34B2ixiP0oHUTOyHTxGrj9xI7lfcNvPWR34sbr5EDymixv7nI9wLOQ7X/0iG6HsBO+faYlJJ/sZU5R8qbJlqzwPP2t8QKA6cdshXoagM= 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 BL3PR01MB6898.prod.exchangelabs.com (2603:10b6:208:355::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.13; Fri, 4 Mar 2022 05:23:17 +0000 Received: from DM5PR0102MB3590.prod.exchangelabs.com ([fe80::181b:1522:26bc:c243]) by DM5PR0102MB3590.prod.exchangelabs.com ([fe80::181b:1522:26bc:c243%4]) with mapi id 15.20.5017.026; Fri, 4 Mar 2022 05:23:17 +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, james.morse@arm.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 Subject: [PATCH v5 RESEND 2/2] ACPI: AGDI: Add support for Arm Generic Diagnostic Dump and Reset device Date: Thu, 3 Mar 2022 21:22:41 -0800 Message-Id: <20220304052241.151946-3-ilkka@os.amperecomputing.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220304052241.151946-1-ilkka@os.amperecomputing.com> References: <20220304052241.151946-1-ilkka@os.amperecomputing.com> X-ClientProxiedBy: CH2PR12CA0006.namprd12.prod.outlook.com (2603:10b6:610:57::16) To DM5PR0102MB3590.prod.exchangelabs.com (2603:10b6:4:a4::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1411cbf3-20a6-4983-839b-08d9fd9f1657 X-MS-TrafficTypeDiagnostic: BL3PR01MB6898:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cdVSu1thxOOAdRgNd3IcrV34oFzUuZF4QEJc/SzpEGTHGoGxpEhGwQElJlt56B37sxbFdUDj7JXkUsgV2zbwtoYmkCphxQr1cQzTQBZoObAn31MQJJ3VgG0iLl0pnvxbwTvqDNws5Fgela6wELVErePoZiGkhp8RxtVrw7DKP5SL+4ujMjjUEI+kvZvJgqYZESSUrf+xMIsLW8PSZAOe1BZl1enLMbhIWNVo09KZiGIig8wR+g2BjO8ZM8Ov9ZcNqHjYwfedZmLI/bHPGiqnuIpDVYpWammM1FeX9ow0G49oSDjmcHcTfbHbeX1oddlq8i8jTw2+i7GpkWfaTT2IRrtXGQJMBLauxx1W4lwOn4cC80ni7IiKeKzVauULpguWblNzndtZFZ9Ws5G82zsiE/WtdQVv65xwR7fC5HMSUa/ss0qra1r9qWLbtQZWuOd/z9DoIXbC1uuCSBjDLKa222d9ZsWJ6Da7eTZvNWZQCkNd4VyFkLzyUDxpbIwrfHgTNhBYcw2Hy9tovWrASeWjnZaDH8bMK8+/HVp6OppCuwnyNBDxSnxQJW3YC9tGbMn5F8Z3/c2IwLHqGn9KwqLQuHlyTsl07r2C9CUSR4t1uq0PAx/iz9iq7EB6AsNYmgit88JwdEn2ZNf0N96Pf1mthRgPyAG41Ng67gJq+aNKRloorGsC6WpTnUp5NWQnBtW2dbAs/5Jdpa8t/DfttqsVUWu1rEzXuzStw5A4jXjPQhRKVGDhKGkK8251m9Hs3s4kkzXQ9ZNZMqEuK1vIptVFcr4monH2p/3J2xCKJY/lbaWqxes++cR6IEigf2IR/0RV 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)(8936002)(316002)(966005)(6486002)(66476007)(66556008)(8676002)(4326008)(2906002)(26005)(1076003)(7416002)(86362001)(508600001)(6666004)(66946007)(107886003)(6512007)(52116002)(6506007)(38100700002)(38350700002)(2616005)(186003)(5660300002)(83380400001)(41533002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 13Gp9uWQZMnkiB5EzmfB3R7+mHwbzlAZx3iAAS0uBrOPWZTWyvkj7fHcsBWPWfei4kAd00QjW1TLYvE+DpnOhya3p2JLOW/2vAPsnaYDX//H1enE9ab0R8/2u9kz97eajx5UgFB0xPfP/4MzNPqltUOlRCJycD+wWCTOvi4wN7tSNGtVB+AG4Fb994qc0wqfxwwyjrX+LwarzQ7B5jcnavg7KCLL73alq9by8I9rSBsY3B+pWSzhXLLRPtsnMKq2rsmN9sk7dRMqmUptK0LUuC/NmbIGaYCrD+GvIhwaKr7RtQcq9y9RGwAsB3hChySDOUuoZrMOTQ6wbUb1VdoHeECgveqeJkq6tBaYMmmQjudD7kObOgda9v6oitmhd359k8+uCd25QH5VwpDqxmri7hrgX2EDFxpeUtWamNm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mrgZ0OqqJpejRPYdFjTLvo7xErOgRw04QmPHy/Bb+HegZ1glT4FYhcA3DD6ALYDdGX0zbnsgF7vTq65Z5+afEaBSp1llLQ/M+68pcSJIHP8g7/oFKGcGIrCmiA/8H61e0Qum2eoa50B/EliNs3l2MolAoycXB68h8KTuNbR+Tl2nHwNrGm4deXw1zDVZqv9kJsqJHSkXA592hD9LU4jUFIpjoS6BCRDx0STL25XLYl+SkK+8AYHS/FM66Q== X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1411cbf3-20a6-4983-839b-08d9fd9f1657 X-MS-Exchange-CrossTenant-AuthSource: DM5PR0102MB3590.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Mar 2022 05:23:16.9378 (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: iQs4xIjGKeO4OFrF5fAGvN+nSrtiDFLZTY6raeI/utWB0OnlfPiQJIFRiesqj3ur3AHK6AaKtRGi9Z74nUcoI0aitmTaYzRzeDb/lGQ5wzGnW5oRLu8Cmh2o2a4hFNOn X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR01MB6898 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220303_212323_361323_57FF4394 X-CRM114-Status: GOOD ( 18.19 ) 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 Reported-by: kernel test robot --- 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 eaa511fc9c66..87b93f4df0cf 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -26,6 +26,7 @@ #include #include #endif +#include #include #include #include @@ -1386,6 +1387,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__ */