From patchwork Thu Nov 16 22:47:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avadhut Naik X-Patchwork-Id: 165960 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp163830vqn; Thu, 16 Nov 2023 14:48:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IFsUMRZJIkag8Za2/Bka+QOqb0af88CLgFFE99MdLUNyTSh+yXH66nY7VgbHNm89blnetjS X-Received: by 2002:aa7:8888:0:b0:68e:3eab:9e18 with SMTP id z8-20020aa78888000000b0068e3eab9e18mr16917048pfe.12.1700174929342; Thu, 16 Nov 2023 14:48:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700174929; cv=pass; d=google.com; s=arc-20160816; b=MNAHYDg8I/s9Pr/RfmGVTh0vsSdXzGvJPokmceSDY/UxpufuaShgMDlzz5khpNSZMP /WMa9V8Yu7c4IjpdyMNYU49xlPuvGQEL3XMeSls/6kZLpnhgIq/+a2YggEU3gE1jBhA9 5AYlUEsGzHo2/q0Q8ieQI2jtiOT31Wm8NS+mKeYFoTJpAL9u6qOHn/i8HEuZifdu5anh 9twuKc3c+fQnQ+TOMPR5vGJm1fJLYBDAhUYU6iE4uX4otr4HksSdOnDelQp86o7Z3pax cQ3AkNBxHjZIYwGpw/XRx2BpMiuHcMKHPa1eqPtmrrsKkofrdTiVCn7r5kI4oSMwSAYR UUqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WHRqq6WgoIFpJOd5l9r4Re2Q9EZwlN1X+/P2QpybI3k=; fh=lCqb0epcnmMKie6kWij55va0cZqOJzoAx+a44+1OOtg=; b=kk3EBL0fWqSx9cnltYYWjsr62V9dRtB4BB7y9Kv7xuMNlmumV5slHl9fOUAjJAuEEH zFxcu0oCAPOyZcIk0Ei09pO+cHjvC4mEj7pUXi1+HJbuF9lrhI4kipLIIzcGTjqXIXir onMZzZLeglbo7HScKXX7h7KixUeqgoRtsVih7H3nLkdEvKlZ6QPE+QlwIPn7ePwTvjVP RO369fVUMHJw3WAOwAw4IEnycTzJNCXxGEIiy2xSFzsLNfvLEtO2gdZ8aTZbpY9pXtby CWfdkgyThru1GI8zPA4bUG/5PZS4id8BEv1c+AO8xsX5RXiuOtGmbIitBsqIsgSgIod7 lqCA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=0KwR39s1; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id p12-20020aa79e8c000000b0068fdb060072si477618pfq.341.2023.11.16.14.48.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 14:48:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=0KwR39s1; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id AD380826624C; Thu, 16 Nov 2023 14:48:41 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345576AbjKPWsB (ORCPT + 30 others); Thu, 16 Nov 2023 17:48:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229745AbjKPWr7 (ORCPT ); Thu, 16 Nov 2023 17:47:59 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2073.outbound.protection.outlook.com [40.107.223.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1FD4120; Thu, 16 Nov 2023 14:47:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ens6hYKL+fwKYDEsULwbtBWrArAczL6jPAyewFiaGpWkrPds0txPLHZPuY0N6cNoYqJq6sgCQqmVA2lLp7/tIRY2IuS9bSbJd/puC16+W9TDgJVKBnpgGc2FE9uZlZeXMFAlhCkMZOFZSj6Q5AEgDvKqaNzktm3afdYrnKdlR4yX+5TXE1AJQbgo2XTIjdGepToq9rB2E77M2GnwJjFU2Xr8rAsU6vGgYntkQd+iF25z/h+r31lX2UJLsyGLzJ0Bsca47BSMMPuh+nNaynq/TYesRwbMzBsB1omkNGKlWWksTj3biVkQIqhCYkXIF6/QV0GXKVK5/erZLKqwtPWcpg== 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=WHRqq6WgoIFpJOd5l9r4Re2Q9EZwlN1X+/P2QpybI3k=; b=Vv5z5yUZeEF4xLN57hovWra7aYewYG9NEnDQKYE7s/Lloq8/9pB/X7fxdG+GleiWYCIZd6T4xpj67YF+FYxLbtOIfJb/lxaq55bMVaFA591NcAqRCEJqbXT+7hFmX7/Hc0GRWC5qY9KnHIBLg6rfBsdAwI6tL7Rhqk4+nfHdd/vOhT/YhazfdIzcvk6KU+3uzs4d3kcpBiztd4Z5fkHjAE/iEGbR4RimapuuISrdFbgMzU6YobhmkOI10Ja0fokoI5hPl/49cXqdhig+ZB03fMOxgE7RMk+5PhirUUx7npCSai+cGKJCWM8VDby4EzsRZK3paBJW7D+tGJtNnuNqJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WHRqq6WgoIFpJOd5l9r4Re2Q9EZwlN1X+/P2QpybI3k=; b=0KwR39s1KwEouxDcUVIMPjScjkq/aSwFQdLexiv9M/jFnGSBPiotwLK39XTg3XCI493IFmyZgwIU5uC+Jj7YslKbT6m9xpmDkGOvjHZVsPlNbGxhLiVKwM2awL1SOZ77ZWc3VcJ28BKq+YPZqEGcvDY5sUANQ7Wgrf8uBUV7HJk= Received: from SA0PR11CA0182.namprd11.prod.outlook.com (2603:10b6:806:1bc::7) by CY5PR12MB6648.namprd12.prod.outlook.com (2603:10b6:930:3e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.17; Thu, 16 Nov 2023 22:47:53 +0000 Received: from SA2PEPF0000150B.namprd04.prod.outlook.com (2603:10b6:806:1bc:cafe::a3) by SA0PR11CA0182.outlook.office365.com (2603:10b6:806:1bc::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.21 via Frontend Transport; Thu, 16 Nov 2023 22:47:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF0000150B.mail.protection.outlook.com (10.167.242.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7002.20 via Frontend Transport; Thu, 16 Nov 2023 22:47:53 +0000 Received: from titanite-d354host.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Thu, 16 Nov 2023 16:47:52 -0600 From: Avadhut Naik To: , CC: , , , , , , , , , Subject: [PATCH v6 1/4] ACPI: APEI: EINJ: Refactor available_error_type_show() Date: Thu, 16 Nov 2023 16:47:22 -0600 Message-ID: <20231116224725.3695952-2-avadhut.naik@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231116224725.3695952-1-avadhut.naik@amd.com> References: <20231116224725.3695952-1-avadhut.naik@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF0000150B:EE_|CY5PR12MB6648:EE_ X-MS-Office365-Filtering-Correlation-Id: f54cde80-c24a-4c00-c6c7-08dbe6f611b7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t3U2odHAVS5UOiZJ7fCX4WIOVeF4MrxCrKqorO4qcSNsMO8CZj5Z9toLpYbZHDM06ak4MytUoIyhTasp572xraOkPvVNAUS+wipHo7luuiRXSPyF6VSoLeXzcuaNcD8N2qCjtskatDFVr+u5DsoGYciegaTc53SwBI8alPgUg4YX+TCX7T8vEZuowldrVnNmZDb4TFcD8mU6MBkRjNOnqDJ7B5w00vSu568bbqQJHSWktFQK84yc7eCjbhMQm4Ig2DQIFev/vyWsxAt5ys5eCwKjwgio6hVDMB0cLrBwDUlCVFayr9Og1JVLQlz7aH4GcD2SCLerkUvkP9QhcIBBetOh8+Gj516TXzO09oGx+KeJc5YyylljFwTr1d5iggR8Vs0aS5OI9asY+iYsRFTg3OXhVKTCowiLu5x/a41hLkYiDqIr/qNrRl+t3v9Y3SkAgd/G7wZUl3798yanI/ESqBeIfSLnXEqsdx5AoTjR6Z8Xypj8igATU4qjDRRWJXVAU1eiL8FwTGSCDVImMOlWoLUA7s4LlXff3Ky7H/U7mmM+mvAWHXeBb/eY2xqHioA5p8fUwNixJV3bB6UyVWAQcEaQt/U8iLJ2gZzwRglaCB8qvzkWfEEOfkS6m7/J7PesT88mMdG+87aChAMDBC6KvIO9cuKXONU7ofAnx+Wr2h+VNQMNTJwtWEwK4e2cb4D/+V8/4noWKcmeNbmgBhO8NDzwg6HJXwXNRoHtyH5+55EMXD+cwhRmGjZi+tJP8GW41ffp6C85x3kzDHVkgCdWZQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(136003)(376002)(39860400002)(396003)(346002)(230922051799003)(82310400011)(1800799009)(186009)(64100799003)(451199024)(36840700001)(40470700004)(46966006)(316002)(47076005)(7696005)(478600001)(6666004)(54906003)(44832011)(5660300002)(1076003)(16526019)(2906002)(336012)(426003)(83380400001)(8936002)(26005)(2616005)(70206006)(110136005)(82740400003)(70586007)(41300700001)(36860700001)(8676002)(4326008)(40480700001)(356005)(81166007)(86362001)(36756003)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2023 22:47:53.6032 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f54cde80-c24a-4c00-c6c7-08dbe6f611b7 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF0000150B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6648 X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 16 Nov 2023 14:48:41 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782762626564742807 X-GMAIL-MSGID: 1782762626564742807 From: Avadhut Naik OSPM can discover the error injection capabilities of the platform by executing GET_ERROR_TYPE error injection action.[1] The action returns a DWORD representing a bitmap of platform supported error injections.[2] The available_error_type_show() function determines the bits set within this DWORD and provides a verbose output, from einj_error_type_string array, through /sys/kernel/debug/apei/einj/available_error_type file. The function however, assumes one to one correspondence between an error's position in the bitmap and its array entry offset. Consequently, some errors like Vendor Defined Error Type fail this assumption and will incorrectly be shown as not supported, even if their corresponding bit is set in the bitmap and they have an entry in the array. Navigate around the issue by converting einj_error_type_string into an array of structures with a predetermined mask for all error types corresponding to their bit position in the DWORD returned by GET_ERROR_TYPE action. The same breaks the aforementioned assumption resulting in all supported error types by a platform being outputted through the above available_error_type file. [1] ACPI specification 6.5, Table 18.25 [2] ACPI specification 6.5, Table 18.30 Suggested-by: Alexey Kardashevskiy Signed-off-by: Avadhut Naik Reviewed-by: Borislav Petkov (AMD) Reviewed-by: Tony Luck --- drivers/acpi/apei/einj.c | 47 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c index 013eb621dc92..506fe319379f 100644 --- a/drivers/acpi/apei/einj.c +++ b/drivers/acpi/apei/einj.c @@ -577,38 +577,39 @@ static u64 error_param2; static u64 error_param3; static u64 error_param4; static struct dentry *einj_debug_dir; -static const char * const einj_error_type_string[] = { - "0x00000001\tProcessor Correctable\n", - "0x00000002\tProcessor Uncorrectable non-fatal\n", - "0x00000004\tProcessor Uncorrectable fatal\n", - "0x00000008\tMemory Correctable\n", - "0x00000010\tMemory Uncorrectable non-fatal\n", - "0x00000020\tMemory Uncorrectable fatal\n", - "0x00000040\tPCI Express Correctable\n", - "0x00000080\tPCI Express Uncorrectable non-fatal\n", - "0x00000100\tPCI Express Uncorrectable fatal\n", - "0x00000200\tPlatform Correctable\n", - "0x00000400\tPlatform Uncorrectable non-fatal\n", - "0x00000800\tPlatform Uncorrectable fatal\n", - "0x00001000\tCXL.cache Protocol Correctable\n", - "0x00002000\tCXL.cache Protocol Uncorrectable non-fatal\n", - "0x00004000\tCXL.cache Protocol Uncorrectable fatal\n", - "0x00008000\tCXL.mem Protocol Correctable\n", - "0x00010000\tCXL.mem Protocol Uncorrectable non-fatal\n", - "0x00020000\tCXL.mem Protocol Uncorrectable fatal\n", +static struct { u32 mask; const char *str; } const einj_error_type_string[] = { + { BIT(0), "Processor Correctable" }, + { BIT(1), "Processor Uncorrectable non-fatal" }, + { BIT(2), "Processor Uncorrectable fatal" }, + { BIT(3), "Memory Correctable" }, + { BIT(4), "Memory Uncorrectable non-fatal" }, + { BIT(5), "Memory Uncorrectable fatal" }, + { BIT(6), "PCI Express Correctable" }, + { BIT(7), "PCI Express Uncorrectable non-fatal" }, + { BIT(8), "PCI Express Uncorrectable fatal" }, + { BIT(9), "Platform Correctable" }, + { BIT(10), "Platform Uncorrectable non-fatal" }, + { BIT(11), "Platform Uncorrectable fatal"}, + { BIT(12), "CXL.cache Protocol Correctable" }, + { BIT(13), "CXL.cache Protocol Uncorrectable non-fatal" }, + { BIT(14), "CXL.cache Protocol Uncorrectable fatal" }, + { BIT(15), "CXL.mem Protocol Correctable" }, + { BIT(16), "CXL.mem Protocol Uncorrectable non-fatal" }, + { BIT(17), "CXL.mem Protocol Uncorrectable fatal" }, }; static int available_error_type_show(struct seq_file *m, void *v) { int rc; - u32 available_error_type = 0; + u32 error_type = 0; - rc = einj_get_available_error_type(&available_error_type); + rc = einj_get_available_error_type(&error_type); if (rc) return rc; for (int pos = 0; pos < ARRAY_SIZE(einj_error_type_string); pos++) - if (available_error_type & BIT(pos)) - seq_puts(m, einj_error_type_string[pos]); + if (error_type & einj_error_type_string[pos].mask) + seq_printf(m, "0x%08x\t%s\n", einj_error_type_string[pos].mask, + einj_error_type_string[pos].str); return 0; } From patchwork Thu Nov 16 22:47:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avadhut Naik X-Patchwork-Id: 165958 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp163742vqn; Thu, 16 Nov 2023 14:48:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IHAiE0lkkCpoyNyT56u7vYQZnUJjvRNxhyhQdhWqjwhD7rdO0z332+MhSb5gO2I5RQuEla7 X-Received: by 2002:a05:6a20:4420:b0:13a:e955:d958 with SMTP id ce32-20020a056a20442000b0013ae955d958mr16079638pzb.7.1700174914085; Thu, 16 Nov 2023 14:48:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700174914; cv=pass; d=google.com; s=arc-20160816; b=rawbQ6YqIugvkGrY25O7SbVud1GykEQUjrPHfsJFfV3Ft7BZyLZzqzLwT6py+1DEhB Yr/gClp/4tH3k+vvjBqk47hEEFzC1F3pUBiGOq3nF2igijQ/SwRwwvg6jjMaX92Aqapf NOS9Qcqzb2PshGRJiSvweFJYQfOnZ5MtOPTMKVxJF6SbaSFMSFhHUbwKpfuPdN4j5ZGJ d/EQzvaTtTAD9hyoaujyswK2sgNgE9q/l9G8pIIHIySBDAr/VqbP8C4pYZwo4IFVgRrT RrWNWDd8jg1w1jp5xRYEslvSpw3Z8XZDbU0Sf8hMX+xgQLbgtEIC8gHAkQdbQaSJ1WqG r9Fg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UO0hxm6JvxciEvPr809e/3EMnrolHbBct1qGifI9wYI=; fh=lCqb0epcnmMKie6kWij55va0cZqOJzoAx+a44+1OOtg=; b=YoS+V8F0+CE4WfqmxfJgEymVMrYwtY0tObrXE0ngRotC7VVN1BZYv84B2oFU4TaJTd 4l1750WvW4CbduBHHaKtepmlUgQxFmT6QNEDL3VQqnbiHGt6ouBDasedB7W9Xj5EPQh3 7rwRT1JWxz03hW62yq+RCy+gkvYzSidr4qszebYmt3Yd5xiWQ6QrcO5cz2WeRfX8uAse Is7kOzIAN7O4f1smhU24s2273ry8TmI0emvTHusTZt2E1Ryi2xJ88nNkyocVpi+W5wqy 6jVpUAcxl23fQ+McrNnFNjuobkkBqAs7MnWtC/xjLqXLCxqQ6RzGU0/xVthkiRwwt0XB w+8g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=0SwmjTai; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id b3-20020a62cf03000000b006c21adbc1cbsi481035pfg.59.2023.11.16.14.48.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 14:48:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=0SwmjTai; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 336FE801DDEB; Thu, 16 Nov 2023 14:48:28 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235036AbjKPWsO (ORCPT + 30 others); Thu, 16 Nov 2023 17:48:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234934AbjKPWsM (ORCPT ); Thu, 16 Nov 2023 17:48:12 -0500 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2069.outbound.protection.outlook.com [40.107.102.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37B1C195; Thu, 16 Nov 2023 14:48:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QuHylthg9/cD5DdAnC12TBCxel6SM+x3Qq3n6TF+0TPSpj11WD7Unu5IT3vrFovCvGLbQQF1Adz9+SJaw+feJb5b+Joy2PYorcwotnZXLQIjviDrTzQGQQMGr9IVS4qhs+3GWuhbOxExbyoBaMIH8tM8dX5i/tXNg1UzzSxrkALixrLqUeopnN67C/DjVBLxhxKUJ1XJSBfJ5P8UQ0CAlbN2FgNQftF4Vy04GnBTj2I4uzSwUSm6g37P4D5kFZAPfiYpuUdfqPpT5WWJNOO9fV+7UfEpWBUvEI6Dh0qG5/RxGsunsEn3I1UEmbuVXlEHW/JKYarcNWC7HtmVQ8veSw== 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=UO0hxm6JvxciEvPr809e/3EMnrolHbBct1qGifI9wYI=; b=cwIVSo2gLM+Sgm6Uhghy9yJh7IGCzM62syCgMYjVcjrMAD8mtmf0J9zwQp7dbpYEJJxNEdYqndRhItvr5sM/HoCBLJojL/ncmMpb2wJ42DI6j6lAN/A9VxGlSC+8LprTKqC/uilfPAXzkE7GI7RsE3sd7dc2v9quqEXn9w25fVY2dbSS8WOIdnN9EFS7nElnEMyYBjG96rQVrh94g0J6hzlV/HvgiL8aAO31i953eI6ChNgzRYmxnS+lC45PAmR5BDonvIUzp4OA+7qwhDXdJkMWHg5303ZmW0Og9JEcxsP+s6TCqp/hs/DxTC/DUl1Q1BI/vrjg2DvBJLBkwAChAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UO0hxm6JvxciEvPr809e/3EMnrolHbBct1qGifI9wYI=; b=0SwmjTaiR/UwVBdLyzSZVr8mK27VbFzhwFeIW2jR9T1XqX1xcxdf5L5CwpJbReeDVZsUF66SzP/WuZcChFR62UCfLKojz51q4FqEPgLyCdLNEqEdnb3N+NSHk2ou/1CbXO5rzgX47b3gdMnEQTjMD+sncPLXhTLsI71S55WMNVA= Received: from SN1PR12CA0052.namprd12.prod.outlook.com (2603:10b6:802:20::23) by PH7PR12MB7162.namprd12.prod.outlook.com (2603:10b6:510:201::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.19; Thu, 16 Nov 2023 22:48:05 +0000 Received: from SA2PEPF00001504.namprd04.prod.outlook.com (2603:10b6:802:20:cafe::7b) by SN1PR12CA0052.outlook.office365.com (2603:10b6:802:20::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31 via Frontend Transport; Thu, 16 Nov 2023 22:48:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF00001504.mail.protection.outlook.com (10.167.242.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7002.20 via Frontend Transport; Thu, 16 Nov 2023 22:48:05 +0000 Received: from titanite-d354host.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Thu, 16 Nov 2023 16:48:03 -0600 From: Avadhut Naik To: , CC: , , , , , , , , , Subject: [PATCH v6 2/4] fs: debugfs: Add write functionality to debugfs blobs Date: Thu, 16 Nov 2023 16:47:23 -0600 Message-ID: <20231116224725.3695952-3-avadhut.naik@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231116224725.3695952-1-avadhut.naik@amd.com> References: <20231116224725.3695952-1-avadhut.naik@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001504:EE_|PH7PR12MB7162:EE_ X-MS-Office365-Filtering-Correlation-Id: 00f46e63-b25b-466c-a4fb-08dbe6f61888 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 61QcDDScPJy84LmFuZ+v+n1FIgVMKNl0mKB0A4tYGh5w25OioomVIXv1aym7r6jGogi1KzdG7VGPmf1npPsN8jMEVZDcbyN2d59ZhaZOI6nhkmfie4aEvdk44UXASl0zocfRxc4JWXkgPE77cRW8lAwbtWUa4LGymmXB3BCzVVEflPtOIQNsl29tM9DzviCrUEutvNPXHns1dh7eeuM1/cggDdyI4DxM0BYrdbX5j5JfvJLDuv7VLAlW/htVoOBitqnJu8MGADkxAPw+lNL4tKfn7TNsFGYGWEd56RCJqsWsZ0rMoBnYQHR7p1NhAL5bDAeLXJeRH/G06IDrYxj3LHxvqPy1Zg6hg0jt9FwiH9xgWWJwmS86r9xauNVn66yX9vuXQ7Rlbgpxv2oaL0BBEXFxY0z0sh80qJwAmtOvxUX/s01nlFDVrB3SJAGvIat5I+KlLuLZU0U0PfO1ZIxjyeoSQjXGT0c/HgBWA0vJCcATXkxHvNv0iuPb469NvhaOvm0cAk8teqRiX4B3tG/Rxhrg1Yvq735kGE5ZnlU+YlI44hdt+VAn6SlgmFLR3m/3U0DUB/zaLVXJsMlG5wCXN//QmDrK56hy0lnX7HCHuehouVu9n6Ih+IBBpovqyIiuijx4RE1uGiIMNUgiTiO4byucqYdv/V6TW1d0q2XFmIoxAsB3M+lho3/2FlrhcPOGAKN0Gz4n6Dr+KS/3jlzId8e6kGrZfUMNPEUlliaW8S+ou+CpCuh4Gb0eyQCuRvOU1T9fwlijgYRqHNIxQeuXrA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(136003)(346002)(376002)(396003)(39860400002)(230922051799003)(64100799003)(186009)(82310400011)(451199024)(1800799009)(46966006)(40470700004)(36840700001)(40480700001)(7696005)(4326008)(2616005)(316002)(1076003)(5660300002)(83380400001)(6666004)(86362001)(2906002)(426003)(336012)(26005)(110136005)(70206006)(70586007)(16526019)(8676002)(82740400003)(54906003)(478600001)(44832011)(8936002)(47076005)(356005)(41300700001)(36756003)(40460700003)(36860700001)(81166007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2023 22:48:05.0383 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 00f46e63-b25b-466c-a4fb-08dbe6f61888 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00001504.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7162 X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 16 Nov 2023 14:48:28 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782762611180782833 X-GMAIL-MSGID: 1782762611180782833 From: Avadhut Naik Currently, debugfs_create_blob() creates read-only debugfs binary blob files. In some cases, however, userspace tools need to write variable length data structures into predetermined memory addresses. An example is when injecting Vendor-defined error types through the einj module. In such cases, the functionality to write to these blob files in debugfs would be desired since the mapping aspect can be handled within the modules with userspace tools only needing to write into the blob files. Implement a write callback to enable writing to these blob files, created in debugfs, by owners only. Signed-off-by: Avadhut Naik Reviewed-by: Alexey Kardashevskiy Reviewed-by: Greg Kroah-Hartman Reviewed-by: Tony Luck --- fs/debugfs/file.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index c45e8c2d62e1..00b834269aad 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c @@ -1008,17 +1008,35 @@ static ssize_t read_file_blob(struct file *file, char __user *user_buf, return r; } +static ssize_t write_file_blob(struct file *file, const char __user *user_buf, + size_t count, loff_t *ppos) +{ + struct debugfs_blob_wrapper *blob = file->private_data; + struct dentry *dentry = F_DENTRY(file); + ssize_t r; + + r = debugfs_file_get(dentry); + if (unlikely(r)) + return r; + r = simple_write_to_buffer(blob->data, blob->size, ppos, user_buf, + count); + + debugfs_file_put(dentry); + return r; +} + static const struct file_operations fops_blob = { .read = read_file_blob, + .write = write_file_blob, .open = simple_open, .llseek = default_llseek, }; /** - * debugfs_create_blob - create a debugfs file that is used to read a binary blob + * debugfs_create_blob - create a debugfs file that is used to read and write + * a binary blob * @name: a pointer to a string containing the name of the file to create. - * @mode: the read permission that the file should have (other permissions are - * masked out) + * @mode: the permission that the file should have * @parent: a pointer to the parent dentry for this file. This should be a * directory dentry if set. If this parameter is %NULL, then the * file will be created in the root of the debugfs filesystem. @@ -1027,7 +1045,7 @@ static const struct file_operations fops_blob = { * * This function creates a file in debugfs with the given name that exports * @blob->data as a binary blob. If the @mode variable is so set it can be - * read from. Writing is not supported. + * read from and written to. * * This function will return a pointer to a dentry if it succeeds. This * pointer must be passed to the debugfs_remove() function when the file is @@ -1042,7 +1060,7 @@ struct dentry *debugfs_create_blob(const char *name, umode_t mode, struct dentry *parent, struct debugfs_blob_wrapper *blob) { - return debugfs_create_file_unsafe(name, mode & 0444, parent, blob, &fops_blob); + return debugfs_create_file_unsafe(name, mode & 0644, parent, blob, &fops_blob); } EXPORT_SYMBOL_GPL(debugfs_create_blob); From patchwork Thu Nov 16 22:47:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avadhut Naik X-Patchwork-Id: 165959 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp163785vqn; Thu, 16 Nov 2023 14:48:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IFzM4m7tYdQj8clnBt3wWZJng6Q9/Fb93hyNQKXy9RdLaurx1r58Xt2Cr3jIb4Pt0p05/bU X-Received: by 2002:a05:6871:8802:b0:1f0:b2a:768a with SMTP id te2-20020a056871880200b001f00b2a768amr19112080oab.8.1700174922437; Thu, 16 Nov 2023 14:48:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700174922; cv=pass; d=google.com; s=arc-20160816; b=Pec/mNq4bMx73XiM+rBsot4vi9y8/eWBAaDC+1p4l79TC9Z56aQJ3WTwffuj5/nEHo r1s4i16sex3p4J2gsgSbjhyT/S5qMug2Sjr0wizyjEAyEnqBGFAxKpx98LhPVn2dM3k2 J7igI+SvjY3ALzLlUH+BGZ2ReQsTDv5yI5aRyqmIb1TYqZ+XfskCcXmEa2AQPcdl36uH HxbRQ+0Zly8ccWbtitmp9DYRsMqsdBuLM+TnsjkOGNeqcTEEl2PeLw9TIv0EBfMaO+uq TG14WF/62ZFYxFdGdCzXG7cHUAGCeccH0272cvJ+y8ddfsvE/sVpda5sA57zNrZTeRpu W1nA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KOX5RPISYjppAYQvIxxGqk3Qer6gDi88WVzjLe0j7KA=; fh=lCqb0epcnmMKie6kWij55va0cZqOJzoAx+a44+1OOtg=; b=dETP0DHH7Hx5zoOam80HzwN/Xqm+5084U+F0Bjn7Z14e9qj65cuYgxCNXiebkyOr6P xrC1FBl1CpMG9G45J12HOLtVX4YT4tniFezF6KpPTl+da9Trfg8sPHjBKvx0xz5AyfuN b0foX9mrSJE9ri5iBc4ZVfA1pe7Pcyma053ob6qYcUXjPKzORZhKjKfCx6Q+bGDiLgPj 4XWnzHH4YMYdj2V8XclJdJ2IA6PqHOQt8uo9LnAYBkUz6b7hh7SAwqPxSN8UCWPLS/fn R2k9DfMiI8EwLmqmKMZHceRRiDuod6MXL4oJ/PgDybzzqOQZZeWrxydDi7ZsgvdSK/j5 RC3w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="Jc/Ddzra"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id f2-20020a631f02000000b005b96af23fe6si404568pgf.284.2023.11.16.14.48.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 14:48:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="Jc/Ddzra"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id F39D5801B9F2; Thu, 16 Nov 2023 14:48:36 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345570AbjKPWsZ (ORCPT + 30 others); Thu, 16 Nov 2023 17:48:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345590AbjKPWsX (ORCPT ); Thu, 16 Nov 2023 17:48:23 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2089.outbound.protection.outlook.com [40.107.243.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1855D50; Thu, 16 Nov 2023 14:48:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ojbzmea4aEXxI/HsiJGFCqbRHa1Zemme9tClKHienE30F+gjLg+bKsMUNf8E9GIPh40RvXofjvK8NhEC2e09R62GQ5bFKReFpK+ARNepD0Xu++zLijQns7/oRPWfcqOUl/k+Yy/vg5XKh5NWmsQTtEWEroQGZixp+vig8ZjVBIupZ/sxOek7qQ4LiXcTtD8bttmcyWorpBXMP/rWF2oZrOKZ2s2UOWckD/uGI5IutJuOfwYnriRpEw0R0YpsQNkA8Q1frE7etY6Nw6a4IKaDv30EMzkqS4DfT+tg+A6ONLreI+PHgOlVwprq9ycMTLmFgOmu+RlCOO0wen00OAwhsA== 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=KOX5RPISYjppAYQvIxxGqk3Qer6gDi88WVzjLe0j7KA=; b=BpR6v6l8B0eWDWQJTywgt+OR6TyQiXCgIqH5v1152dNWhu73syC+fsGzBFmkJOLp8OCg+iQLef+ZZPl+ek/iVdrSfgSnBwGqfoIPwmH8Uyn6ScQcd5vThFL0d01HuVxYENW/jHJ5ZpjTomAez/rNL3P7ZG5vxzIWxKlsGGvIJge6IHB4VsV72mJpRmeHKOjF0OrtKkUBPziz0bHLi3sW9K3NPR8JpOcDJwzAHoPgU1hph5d91MJj1xTO4ksmWgxJsONVeHhJxiRznMIwa54JIzDUI09SFv8axmrKJc1OEHFoxE3ZpFM+4E9LBTHyCvHoajafxli+H51n6TLF5VP5uw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KOX5RPISYjppAYQvIxxGqk3Qer6gDi88WVzjLe0j7KA=; b=Jc/Ddzra48pO8IFeogSvm7DU2huxz9uOqJQlq2H4SyN6o2Vgb5JzSlfYf6NhQW+/37O9b7wKf2xQcPlXcnBhCrUiSBZ0gFWOf4+Hn61xi35YIT6Onf2lnR3cZsdrrFJOn1RyxklKkJr2ztYBDQtziY6ujzFeHudX/LPvZRQ05BY= Received: from SA1PR02CA0007.namprd02.prod.outlook.com (2603:10b6:806:2cf::18) by CY8PR12MB7490.namprd12.prod.outlook.com (2603:10b6:930:91::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.23; Thu, 16 Nov 2023 22:48:16 +0000 Received: from SA2PEPF00001509.namprd04.prod.outlook.com (2603:10b6:806:2cf:cafe::44) by SA1PR02CA0007.outlook.office365.com (2603:10b6:806:2cf::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.21 via Frontend Transport; Thu, 16 Nov 2023 22:48:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF00001509.mail.protection.outlook.com (10.167.242.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7002.20 via Frontend Transport; Thu, 16 Nov 2023 22:48:16 +0000 Received: from titanite-d354host.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Thu, 16 Nov 2023 16:48:15 -0600 From: Avadhut Naik To: , CC: , , , , , , , , , Subject: [PATCH v6 3/4] platform/chrome: cros_ec_debugfs: Fix permissions for panicinfo Date: Thu, 16 Nov 2023 16:47:24 -0600 Message-ID: <20231116224725.3695952-4-avadhut.naik@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231116224725.3695952-1-avadhut.naik@amd.com> References: <20231116224725.3695952-1-avadhut.naik@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001509:EE_|CY8PR12MB7490:EE_ X-MS-Office365-Filtering-Correlation-Id: 2fbae639-fb9c-4fca-6b72-08dbe6f61f4b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: w1nfrFkF992WjjJ2ZUOVkjd5AnFH1AG5rlQbg15A+zQt4DnMGjvuQQDCK/yReXR81pEXdyog6+F+DuPBkJ8sTa5lq2JTB9h40PFjlLSUGjnwfTbhh+tx5CMixJsFNNByYHMM9YMGudRhJBG9TfKV2YihLcWJYLhBaxyegabWpViULhSqcseZn2v4j5T4Z3eQQWTDBibuT2ZwgVgWQNElaDvqvAUStBD0ymqcCYF++lki9xHYHWxzC3MCnt8BF5IqLWc1Y4geZ/vZiv1SHAJhu0kPcEKbDXjQa8lEISRIh5kpcSRyCrbKBpyzHOrRn/BZXiRCDoyy3Gmq+iX2uDAdy2XOLvkvlQ268OHhRq+z5/cr2Z5qrdCslvqYvZMgMyPdxVAGQiKiv2+vKtbl21fLs8Of/+ibCHZhIsqEfoEPYy7aTJC1rhLh9txDZ0ILlVsuxPyPfclnprewKdPcTK3xrZTYoVxc1oe7RayFs5Q7YhfdC//1IVXIw9ke+zSyn7XfZ7+h1j3UsjgJMfS3Y8IBycibB5rFkSy0pDnZmI9rloyu4WCxGCKrpp2xqxFPhAN18ZshFtd7pkqD0lY5AZfLIXlHNYzWS7bttzFEOOM9E0c0vcs+qhxNU9KuUD8qruSP/sVF4ZltedCj0LpMTw5aYOQRqeSza61IRp04HTVd6beFyVtspo90PP9GtHdDFmBGx9oRyL3B+9RaNURaV9NgyzfXiJwXlqyExWNi1PMSG5bc2qDpyjHs3qxf9ob1IKJTrqbAyx+SVEj4454wE60sIw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(346002)(136003)(396003)(376002)(230922051799003)(64100799003)(1800799009)(82310400011)(186009)(451199024)(46966006)(40470700004)(36840700001)(36756003)(41300700001)(2906002)(356005)(47076005)(81166007)(83380400001)(86362001)(5660300002)(82740400003)(336012)(426003)(26005)(16526019)(40480700001)(2616005)(1076003)(316002)(44832011)(54906003)(7696005)(70586007)(6666004)(36860700001)(70206006)(110136005)(4326008)(40460700003)(8936002)(8676002)(478600001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2023 22:48:16.3968 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2fbae639-fb9c-4fca-6b72-08dbe6f61f4b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00001509.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7490 X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 16 Nov 2023 14:48:37 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782762619554813347 X-GMAIL-MSGID: 1782762619554813347 From: Avadhut Naik The debugfs_create_blob() function has been used to create read-only binary blobs in debugfs. The function filters out permissions, other than S_IRUSR, S_IRGRP and S_IROTH, provided while creating the blobs. The very behavior though is being changed through previous patch in the series (fs: debugfs: Add write functionality to debugfs blobs) which makes the binary blobs writable by owners. Thus, all permissions provided while creating the blobs, except S_IRUSR,S_IWUSR, S_IRGRP, S_IROTH, will be filtered by debugfs_create_blob(). As such, rectify the permissions of panicinfo file since the S_IFREG flag was anyways being filtered out by debugfs_create_blob(). Moreover, the very flag will always be set be set for the panicinfo file through __debugfs_create_file(). Signed-off-by: Avadhut Naik Reviewed-by: Greg Kroah-Hartman Reviewed-by: Tony Luck --- drivers/platform/chrome/cros_ec_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_ec_debugfs.c b/drivers/platform/chrome/cros_ec_debugfs.c index 091fdc154d79..6bf6f0e7b597 100644 --- a/drivers/platform/chrome/cros_ec_debugfs.c +++ b/drivers/platform/chrome/cros_ec_debugfs.c @@ -454,7 +454,7 @@ static int cros_ec_create_panicinfo(struct cros_ec_debugfs *debug_info) debug_info->panicinfo_blob.data = data; debug_info->panicinfo_blob.size = ret; - debugfs_create_blob("panicinfo", S_IFREG | 0444, debug_info->dir, + debugfs_create_blob("panicinfo", 0444, debug_info->dir, &debug_info->panicinfo_blob); return 0; From patchwork Thu Nov 16 22:47:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avadhut Naik X-Patchwork-Id: 165961 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp163907vqn; Thu, 16 Nov 2023 14:48:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IG07eWZNLtIrWlsSR1Bdx/v/0Ys2D8X0LvwtvCJUolBLRbeoB7OIFvbz7roDBzTFiJgtulM X-Received: by 2002:a05:6830:3147:b0:6d6:5382:159c with SMTP id c7-20020a056830314700b006d65382159cmr13943514ots.24.1700174938626; Thu, 16 Nov 2023 14:48:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700174938; cv=pass; d=google.com; s=arc-20160816; b=dXhNUDhulMSFJpawFC8bZhVwscIR6TbqPp209w4ProGySl8Sm2hzzi0tdf7KjpY6V1 BQ/ab2A+M3HrNG9AhkvgFNwPeD3zIQ+Ccfn9SgELdIeJ7sy7/cNrBovv0xQ3zDseVu+B x0VqLz/S2oczPr3mt5/3pPfzUbRXYKf7y1iXgYug9kyQSZWZ/P4nkwWJm7YlTQmifcDD YoA48U7Bm4JeU18OViIgJWjL9WXpuz1S5HM/YdmTTQosydkmhWA3fDM2HFvzpr3lRRf/ WbrdCvWv1sa3FIRWc854oTLKCUR0VaYKHVwYbhOElWBNCxh+WvGdpcEIVvNbzwW6dRXw Djfw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=omJlRKVfpieNt846Bar2DR6ki/tbXKN+YptVuZleYX0=; fh=lCqb0epcnmMKie6kWij55va0cZqOJzoAx+a44+1OOtg=; b=DtHvwBchX3rb0XyBHo0U+c1U5leNrOPOAjxb7iHIB9TnEkEZADP5sxPHcvda+RzUCB azsLxxi74xGWWeCWst2elS15EfZx6ryAujyBluVmvXNTn9Sroh8q4ZhLqs8E637uCZI4 EciM3/ZtleqzRbBBKKalYAk5ndETpelsa92tKUVPYA2NFXNJCxd29Y/eabfiEzkx5lPF AMV9ypu4v5lJp5ZfY73LYUpK6Eh2AQI6KSuW+Hm679sN1bNNcZxzEpn7/vHqVp1vg8zr LvlKFU5mA3cfTg13w+AjpLp7vVEdi4z7KPJ73Z6HExFmFtdjClj1W48sSn809m9q6UW1 nNLg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=r1Ga0GcJ; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id b1-20020a6567c1000000b005bd42f6085fsi450877pgs.344.2023.11.16.14.48.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 14:48:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=r1Ga0GcJ; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 3E6FE8093D4A; Thu, 16 Nov 2023 14:48:56 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345532AbjKPWsi (ORCPT + 30 others); Thu, 16 Nov 2023 17:48:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234605AbjKPWsf (ORCPT ); Thu, 16 Nov 2023 17:48:35 -0500 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB90DD67; Thu, 16 Nov 2023 14:48:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YtaehLBqPOiwavEvCkKEn1b1lLY6MG9j0tjTtUZqFsA65x5pB4pzywbX4q4I10H2rwUzLu+E7+LiDS8Ew0eMn49x/34sE0eRaLtOaWf9ulNfkUaWAq43Hra637CulHP+Rg2uAyy2KQshSN8C0oWYsc13ZqFmXkylFsXb1usr25rTh2sJxkJZGiCxBpXdqQuptZWWKpZ5jtsYvlVI46LUiA9p0XEA9PYkf2dzptcyums6cHG+6AkITBnFBSNKDWmH7p/+F36ZtGbeDaP0XEH0PAKUFWAtlOT+uASS6w7eJxZ0QE2PBdbw9JmMdLXVZuXuVg5NycwDMJfvyJ79lkc+9A== 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=omJlRKVfpieNt846Bar2DR6ki/tbXKN+YptVuZleYX0=; b=iDt02Fl4RYmdgj6NH6F1mzYLc9KNKRkjoeQaG10mHuxK3b69HoiECETvYz9I2cEPShNKNzgquBCgt/AeQStVICtTP1T/bg31XEDkGwa2TJB8ydW1uQQCIXZcBQQ+jKQtW9MckwcComjKfE8JCMgB9GOKDXHykoUluvNQJxnisq/1w4C/5mi4F3JhH6eX81TTDB959Y31rG5pGq6GK+kNY8AGQxk+I3pmTl9VcrSKxnfRlGPyNmYtnoCLhYYwSjuEhCwzgJ0k453CG9L6FJ5+vFWhAqEgDgwGjkboqdUshOdss8NO1WlwE2IX/8J+jpiIzQqmQuogN8a9fKVP7yMHDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=omJlRKVfpieNt846Bar2DR6ki/tbXKN+YptVuZleYX0=; b=r1Ga0GcJOspXEh7PVcA3SEL6VXOJfrqK0BFbZMZYNyMWDJ30XkwTUjXKxIVSSckuGxw8f9jVeoOcpq38Ml+sAirX5Uc1nFgY62tbVEVuo0sKQ9WraSRFzYGXbIFI0/TlyVftOA+PqtqwoM9m+2EfhrLdpJw165IFrVp9z6qAq3Q= Received: from SN7PR04CA0016.namprd04.prod.outlook.com (2603:10b6:806:f2::21) by PH0PR12MB8097.namprd12.prod.outlook.com (2603:10b6:510:295::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.17; Thu, 16 Nov 2023 22:48:28 +0000 Received: from SA2PEPF00001505.namprd04.prod.outlook.com (2603:10b6:806:f2:cafe::66) by SN7PR04CA0016.outlook.office365.com (2603:10b6:806:f2::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.21 via Frontend Transport; Thu, 16 Nov 2023 22:48:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF00001505.mail.protection.outlook.com (10.167.242.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7002.20 via Frontend Transport; Thu, 16 Nov 2023 22:48:28 +0000 Received: from titanite-d354host.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Thu, 16 Nov 2023 16:48:26 -0600 From: Avadhut Naik To: , CC: , , , , , , , , , Subject: [PATCH v6 4/4] ACPI: APEI: EINJ: Add support for vendor defined error types Date: Thu, 16 Nov 2023 16:47:25 -0600 Message-ID: <20231116224725.3695952-5-avadhut.naik@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231116224725.3695952-1-avadhut.naik@amd.com> References: <20231116224725.3695952-1-avadhut.naik@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001505:EE_|PH0PR12MB8097:EE_ X-MS-Office365-Filtering-Correlation-Id: 35063208-6ac0-4c8e-ede7-08dbe6f62659 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YiPJzN9+0S3RT6wKR17wkIlzkVv54xebIoAVbb7AG7ySJdvGIzd6LShWJXJLh1DwMzc6zgZmn1HMWtelTRJ1c93G2Pb0GPK49AhfVijC+CfHneUQ0L7IJoCsagafpo4Z3Mrwxk+pqEjDWBmTd9u7y33Xg0u+jO3qT5Admf6JOFhmfKVEXtZgBK6sXozuQFhN3bmGJGYEvoUs3sMHz6C3iLKSMsDX5aAYiLZHAzvwaaXz1Z2INsSmebOCY5n/YyqlC/1cVCwhAfdDy50MLayIM7dO7HDsTtVtRfE/AibQRM1H35PDXUByBByMudo4550hjPsl/6/EEfwihPtR3unrcrmosj6Kq+NE1erOTVX8iN/pwPerQJDt/q2BTrteEMcJKV1pzamvqhkddVzA30eH9tpoGdzkpaMvMl9ytu3gOwhFxfJj0z+6D4Lkdu5AuaXGVM13mX8i+3C9WJMiRUNBJNjPBaCol3yO9PEKbyaDPkI6/5GH+IkxhQ8oHNaEfFTEM7BoJrAIqtzrFjynqLYuaBNWhCcY389K5kbQ9B01XinjYiv1i/h9Yoxrf2XyhctHbrgvez/2j/ICk72L7C1wD6L9FIGWVfSpR3sQ7Wq0DLBXqIT0wlGf4bSnmxjplfr8PRUcIMFh+b6YHlqbzmzeEgmN/zX5EYbOXBZZxICD6ctE5KS9aiOav2ZhtqMtNoR/01t7NneaN+RmE9WE628+aI+BRNFdg5tBLNi/p5TmRD0X4C4lXFdcXNDb6ORT2wDKcVvWmpgL1j3KD5qDI7K13w== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(396003)(136003)(376002)(39860400002)(346002)(230922051799003)(1800799009)(186009)(64100799003)(82310400011)(451199024)(40470700004)(36840700001)(46966006)(2616005)(426003)(336012)(40460700003)(1076003)(82740400003)(8936002)(26005)(16526019)(478600001)(4326008)(36756003)(44832011)(8676002)(86362001)(41300700001)(5660300002)(110136005)(70586007)(70206006)(54906003)(316002)(2906002)(36860700001)(7696005)(47076005)(40480700001)(356005)(81166007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2023 22:48:28.2203 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 35063208-6ac0-4c8e-ede7-08dbe6f62659 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00001505.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB8097 X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 16 Nov 2023 14:48:56 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782762636384376595 X-GMAIL-MSGID: 1782762636384376595 From: Avadhut Naik Vendor-Defined Error types are supported by the platform apart from standard error types if bit 31 is set in the output of GET_ERROR_TYPE Error Injection Action.[1] While the errors themselves and the length of their associated "OEM Defined data structure" might vary between vendors, the physical address of this structure can be computed through vendor_extension and length fields of "SET_ERROR_TYPE_WITH_ADDRESS" and "Vendor Error Type Extension" Structures respectively.[2][3] Currently, however, the einj module only computes the physical address of Vendor Error Type Extension Structure. Neither does it compute the physical address of OEM Defined structure nor does it establish the memory mapping required for injecting Vendor-defined errors. Consequently, userspace tools have to establish the very mapping through /dev/mem, nopat kernel parameter and system calls like mmap/munmap initially before injecting Vendor-defined errors. Circumvent the issue by computing the physical address of OEM Defined data structure and establishing the required mapping with the structure. Create a new file "oem_error", if the system supports Vendor-defined errors, to export this mapping, through debugfs_create_blob(). Userspace tools can then populate their respective OEM Defined structure instances and just write to the file as part of injecting Vendor-defined Errors. Similarly, the tools can also read from the file if the system firmware provides some information through the OEM defined structure after error injection. [1] ACPI specification 6.5, section 18.6.4 [2] ACPI specification 6.5, Table 18.31 [3] ACPI specification 6.5, Table 18.32 Suggested-by: Yazen Ghannam Signed-off-by: Avadhut Naik Reviewed-by: Tony Luck Reviewed-by: Borislav Petkov (AMD) --- drivers/acpi/apei/einj.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c index 506fe319379f..89fb9331c611 100644 --- a/drivers/acpi/apei/einj.c +++ b/drivers/acpi/apei/einj.c @@ -73,6 +73,7 @@ static u32 notrigger; static u32 vendor_flags; static struct debugfs_blob_wrapper vendor_blob; +static struct debugfs_blob_wrapper vendor_errors; static char vendor_dev[64]; /* @@ -182,6 +183,21 @@ static int einj_timedout(u64 *t) return 0; } +static void get_oem_vendor_struct(u64 paddr, int offset, + struct vendor_error_type_extension *v) +{ + unsigned long vendor_size; + u64 target_pa = paddr + offset + sizeof(struct vendor_error_type_extension); + + vendor_size = v->length - sizeof(struct vendor_error_type_extension); + + if (vendor_size) + vendor_errors.data = acpi_os_map_memory(target_pa, vendor_size); + + if (vendor_errors.data) + vendor_errors.size = vendor_size; +} + static void check_vendor_extension(u64 paddr, struct set_error_type_with_address *v5param) { @@ -194,6 +210,7 @@ static void check_vendor_extension(u64 paddr, v = acpi_os_map_iomem(paddr + offset, sizeof(*v)); if (!v) return; + get_oem_vendor_struct(paddr, offset, v); sbdf = v->pcie_sbdf; sprintf(vendor_dev, "%x:%x:%x.%x vendor_id=%x device_id=%x rev_id=%x\n", sbdf >> 24, (sbdf >> 16) & 0xff, @@ -596,6 +613,7 @@ static struct { u32 mask; const char *str; } const einj_error_type_string[] = { { BIT(15), "CXL.mem Protocol Correctable" }, { BIT(16), "CXL.mem Protocol Uncorrectable non-fatal" }, { BIT(17), "CXL.mem Protocol Uncorrectable fatal" }, + { BIT(31), "Vendor Defined Error Types" }, }; static int available_error_type_show(struct seq_file *m, void *v) @@ -768,6 +786,10 @@ static int __init einj_init(void) einj_debug_dir, &vendor_flags); } + if (vendor_errors.size) + debugfs_create_blob("oem_error", 0600, einj_debug_dir, + &vendor_errors); + pr_info("Error INJection is initialized.\n"); return 0; @@ -793,6 +815,8 @@ static void __exit einj_exit(void) sizeof(struct einj_parameter); acpi_os_unmap_iomem(einj_param, size); + if (vendor_errors.size) + acpi_os_unmap_memory(vendor_errors.data, vendor_errors.size); } einj_exec_ctx_init(&ctx); apei_exec_post_unmap_gars(&ctx);