From patchwork Tue Jan 9 03:47:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Smita Koralahalli X-Patchwork-Id: 186203 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp1426349dyq; Mon, 8 Jan 2024 19:49:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IHtZOM4OyrD7iF54ZVJP1lLycvG5qe89cKnXlq3lvFWQUs+9YFQ6Ev2t/hgG7Zjn12urSf8 X-Received: by 2002:adf:e2c3:0:b0:336:7be8:e216 with SMTP id d3-20020adfe2c3000000b003367be8e216mr260034wrj.22.1704772181680; Mon, 08 Jan 2024 19:49:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704772181; cv=pass; d=google.com; s=arc-20160816; b=qRErZ3W3dpLVn4Hy4zXpdZCkesUcHCXEKU0+dwyv8BAUpWWZOuiHaYEJQaokCjag9n X4RguvXxY0ectimvTtafKV8X9c+N0SzS11u5GfifC6jMfS5ixJQUCFqqsOhn9yKy2Wpd RW8tw9XUUuO/Z8oipk16B8PIOspmtrai5ffbwCO+JuFqVAkzSt3jNnjgdZTgpw0yvKfq Vm2xT2XzKqDpShH1MyoOoGqbHj90qOnmAJJC2W2CFsafzqG0lPb7TTiZpbZIeh1Y0T6l TwcG2VI3y8dgnlxm+K6Y5eF2pNnA224JGxRu5doKMXBxfAtDgQH+SIMcQB5+FJgKc2BH NY7Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=u+lZ6Hck4PZRU6EFtX0mGE39ZKzSIU72woekA5a9KdU=; fh=7HA2l/MfnzhAD5GUqEJnaW6r0qXu/WIaR7EJpyY5Pdc=; b=tSDMIITwO4bQIpJjNzihEH1gWbeg2F5Zxsfd76Y7BQxK6s6/lwVgo+5tcx5aixlfyu INPRjktTR1z0rHDdjHFd2LX0aGqyoD5547wwaCJTsOMt9fPs4n8e7T3C1oYh3dHusdDQ iWnD/3/6S6sNobhdQx558x4zegh8t07uzFQZjwH6Ml2WpH0H2b1MdYrIOYVa7EXOv8IE WijiV37+PsqVLm/jPN/YTFxwaX/daaUDt0ak3hlwYE8I8XzQ58Twq15LGOA9yeMohRM3 CVb6q8VHgzuS6nKVMDLWk8ZugpxF2xVda22daLiQCLIT+Iaot4BzvnDJ9QhcEXxmwmI0 EYQA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=g8hBj9h2; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-20342-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20342-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id d20-20020a1709063ed400b00a274ed620a7si446766ejj.271.2024.01.08.19.49.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 19:49:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20342-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=g8hBj9h2; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-20342-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20342-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 230A81F243E9 for ; Tue, 9 Jan 2024 03:49:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 53D7D29429; Tue, 9 Jan 2024 03:48:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="g8hBj9h2" Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2068.outbound.protection.outlook.com [40.107.100.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A6386103; Tue, 9 Jan 2024 03:48:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MYlENBw1BCAuJLPpdXtPPApooNkpCMs7DhQx/KfhasU/wWQQWBfE/73YE10yVjcJxFskgiRYV0Stl8GHbXuKoksggcjsDf4CT4Gh3ZflKL48tSw3k2eS8PdvfszQJn/3RIiVaRqHoq9uE5gU4NBTMYsBXbLbv4//xmC4X/WZ4Nj7KAqyorEI3igoMpNgNfFMqxOSgS2eeyDCtnIFVzjzchItZ6iFVV714GYzXYtO6CDIbzVQGTE0onF0L1ygX+JG3pculXMM6q+g0/0zegW07+GuQa7YYz3esG03ZfFf67GrchuheFQ4nsdpGgTEuan8WFaAEcdOIXviI29Kejy/Fw== 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=u+lZ6Hck4PZRU6EFtX0mGE39ZKzSIU72woekA5a9KdU=; b=S2ClJTzjePiiiwFpPLx4ZOZIqU/kGu2VutPRy0l+vF2K7Yem1nDvSmcu7kKLNP1EdeJyvw0/ON6tuLIAaSERWFWzvmTXU2xbSYxEfGE8E94wYsdw7t+71D18LcbiV1KKOuXYqzDaaiNGQoCCee2qVdiAxYAFKbraDaK6zvL7QxSAY8R7o1Jp9aphJPG1ofIXMz9/s+jXO1UtdUYCxs/ZDt37nhVMuDakGWIE2sR7ZWIDgOkxrpsQVHr2qlGBEjIFxbhr+Zsie7f7xsXtEQr/KyjG6S9yV4mb5KBOaW3iQ7QenzFJVi8Wsh5e/RAb6nZMgm1bLgpVnf/QXpfYguV4Rw== 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=u+lZ6Hck4PZRU6EFtX0mGE39ZKzSIU72woekA5a9KdU=; b=g8hBj9h2P3fYnDDqReqlB1SY4t1J7aYqGsLYp4dnnpTPLLa+6LGxPrl823TaGyljTMgkyfF9ifIH4y/9nxY8GE1ehRIL2Fnf7NqwJHlemWdqeK22hEz1FcRPj8ASzIPNmMq7SFCyeDRCEBSeNfhsfaMwdskYXYPBgCanr97eAq4= Received: from BYAPR02CA0027.namprd02.prod.outlook.com (2603:10b6:a02:ee::40) by CYXPR12MB9442.namprd12.prod.outlook.com (2603:10b6:930:e3::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.23; Tue, 9 Jan 2024 03:48:12 +0000 Received: from SJ5PEPF000001D1.namprd05.prod.outlook.com (2603:10b6:a02:ee:cafe::95) by BYAPR02CA0027.outlook.office365.com (2603:10b6:a02:ee::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.23 via Frontend Transport; Tue, 9 Jan 2024 03:48:11 +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 SJ5PEPF000001D1.mail.protection.outlook.com (10.167.242.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7181.12 via Frontend Transport; Tue, 9 Jan 2024 03:48:11 +0000 Received: from ethanolx50f7host.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.34; Mon, 8 Jan 2024 21:48:06 -0600 From: Smita Koralahalli To: , , CC: Ard Biesheuvel , Alison Schofield , Vishal Verma , "Ira Weiny" , Dan Williams , Jonathan Cameron , Yazen Ghannam , Smita Koralahalli Subject: [PATCH v2 1/4] acpi/ghes, cxl: Create a common CXL struct to handle different CXL CPER records Date: Tue, 9 Jan 2024 03:47:52 +0000 Message-ID: <20240109034755.100555-2-Smita.KoralahalliChannabasappa@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240109034755.100555-1-Smita.KoralahalliChannabasappa@amd.com> References: <20240109034755.100555-1-Smita.KoralahalliChannabasappa@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D1:EE_|CYXPR12MB9442:EE_ X-MS-Office365-Filtering-Correlation-Id: 03470624-80b6-47d5-08d5-08dc10c5cd50 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8cijwS1MLX/Z7O/MZyDOG9iMtfxYfZq2ez7p6jdMlN5+PCaPZkiT9Q1X2lBz/NJKsWYc3LlqbGbQt6T2A/gakXZbKwbqJCzlCQzXzOrmQj7iTiYQzlaJ3thKGFB/8QVz6iJAbr0VOzYEc5YXerQRicp2l/6GXwvLA6c9zVZqcX49rCjCTr1VYMAL6nltHl7tk4Yhn7hDDf1kkPCMh6HJFHWLHI2j6FJk75DyDlQBGb76Z5KGPsWkgTGRbKHg4NDRiMS337YJDuaNdLiv2IFVZN3T7rzQC907UM4BsaU7UIw9ZisnvPxMY9wRBntlrzaZPI7M+496fs/8+ULNw3a1D8dXPl2fZ0SXEvNdoQMmklsl1SCTYvZK6IHGOAv2fPFTnc644rTMxoXIzAffPl8iqZU/yrc0XjOrWK3RBrT2hnyfkHL8BUPvVN8NBIlJ9/ilocyJsEVDVjuumjE2JxtA+1Tq4KfoLIlEgWV3ZZ4cYevJhNeePIAQOIoBtkoUMZJ4NVyyDdK+H65L/BEtDcxuToceCZQUdHA5hwaaoDu17bYekXm+TRF8jxeJn49No9ECNiqT6hcYg5PpU1z+CyPQR6+IUGhHQU36AO3v9aR2aOxMRV2WLTuOGROjTe++WOf5pvw6E3hoxBwgw5mnYso+CGjipsV0L5eHlerPaa4yT7f02ST1skRy2WzkGfmhH/85tfx59tca6JblKSMcT4dbJB1UQ/dF4bsZXdrvmgNx4h6bxCVIG5XBARJYLw+SB/orHj1iBgl5MjKdAJxF3hBQog== 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)(346002)(39860400002)(376002)(136003)(230922051799003)(1800799012)(451199024)(82310400011)(64100799003)(186009)(36840700001)(46966006)(40470700004)(2616005)(1076003)(336012)(426003)(26005)(478600001)(6666004)(7696005)(47076005)(36860700001)(83380400001)(41300700001)(5660300002)(8936002)(70206006)(54906003)(110136005)(8676002)(16526019)(4326008)(70586007)(316002)(2906002)(86362001)(356005)(82740400003)(81166007)(36756003)(40460700003)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2024 03:48:11.6600 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 03470624-80b6-47d5-08d5-08dc10c5cd50 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: SJ5PEPF000001D1.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYXPR12MB9442 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787583195094044470 X-GMAIL-MSGID: 1787583195094044470 Currently defined cxl_cper_callback interface between CXL subsystem and GHES module is just confined to handling CXL Component errors only. Extend this callback to process CXL Protocol errors as well. Achieve by defining a new struct cxl_cper_event_info to include cxl_cper_event_rec and other fields of CXL protocol errors which will be defined in future patches. Signed-off-by: Smita Koralahalli --- v2: cxl_cper_rec_data -> cxl_cper_event_info data -> info --- drivers/acpi/apei/ghes.c | 6 +++++- drivers/cxl/pci.c | 8 ++++---- include/linux/cxl-event.h | 6 +++++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index aed465d2fd68..60b615d361d3 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -693,6 +693,10 @@ static cxl_cper_callback cper_callback; static void cxl_cper_post_event(enum cxl_event_type event_type, struct cxl_cper_event_rec *rec) { + struct cxl_cper_event_info info; + + info.rec = *(struct cxl_cper_event_rec *)rec; + if (rec->hdr.length <= sizeof(rec->hdr) || rec->hdr.length > sizeof(*rec)) { pr_err(FW_WARN "CXL CPER Invalid section length (%u)\n", @@ -707,7 +711,7 @@ static void cxl_cper_post_event(enum cxl_event_type event_type, guard(rwsem_read)(&cxl_cper_rw_sem); if (cper_callback) - cper_callback(event_type, rec); + cper_callback(event_type, &info); } int cxl_cper_register_callback(cxl_cper_callback callback) diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c index b14237f824cf..1ad240ead4fd 100644 --- a/drivers/cxl/pci.c +++ b/drivers/cxl/pci.c @@ -972,9 +972,9 @@ static struct pci_driver cxl_pci_driver = { #define CXL_EVENT_HDR_FLAGS_REC_SEVERITY GENMASK(1, 0) static void cxl_cper_event_call(enum cxl_event_type ev_type, - struct cxl_cper_event_rec *rec) + struct cxl_cper_event_info *info) { - struct cper_cxl_event_devid *device_id = &rec->hdr.device_id; + struct cper_cxl_event_devid *device_id = &info->rec.hdr.device_id; struct pci_dev *pdev __free(pci_dev_put) = NULL; enum cxl_event_log_type log_type; struct cxl_dev_state *cxlds; @@ -996,11 +996,11 @@ static void cxl_cper_event_call(enum cxl_event_type ev_type, return; /* Fabricate a log type */ - hdr_flags = get_unaligned_le24(rec->event.generic.hdr.flags); + hdr_flags = get_unaligned_le24(info->rec.event.generic.hdr.flags); log_type = FIELD_GET(CXL_EVENT_HDR_FLAGS_REC_SEVERITY, hdr_flags); cxl_event_trace_record(cxlds->cxlmd, log_type, ev_type, - &uuid_null, &rec->event); + &uuid_null, &info->rec.event); } static int __init cxl_pci_driver_init(void) diff --git a/include/linux/cxl-event.h b/include/linux/cxl-event.h index 17eadee819b6..6ce839c59749 100644 --- a/include/linux/cxl-event.h +++ b/include/linux/cxl-event.h @@ -141,8 +141,12 @@ struct cxl_cper_event_rec { union cxl_event event; } __packed; +struct cxl_cper_event_info { + struct cxl_cper_event_rec rec; +}; + typedef void (*cxl_cper_callback)(enum cxl_event_type type, - struct cxl_cper_event_rec *rec); + struct cxl_cper_event_info *info); #ifdef CONFIG_ACPI_APEI_GHES int cxl_cper_register_callback(cxl_cper_callback callback); From patchwork Tue Jan 9 03:47:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Smita Koralahalli X-Patchwork-Id: 186201 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp1426191dyq; Mon, 8 Jan 2024 19:49:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IGKZ97IhOulk95JTxgmiOTqtjW1j55LG5SaUAJY07659A1gViXt+uOe8MzPikbsQf5MYdLs X-Received: by 2002:a05:600c:470a:b0:40e:3654:29f4 with SMTP id v10-20020a05600c470a00b0040e365429f4mr2327302wmo.32.1704772146869; Mon, 08 Jan 2024 19:49:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704772146; cv=pass; d=google.com; s=arc-20160816; b=bbNThkRwUvWhjnVGMGZzvZ4dOdIzeCQVlU28T2Z1f1E8cOS2b0TuPdvheyRpJ+u4Gr 1x4iW++oWsHfPT070aezvYGMVOF0L3XPxHy62w9zW1B5cmYCg2C7EdzXfLF8UeeF7RLx OI0hDhmlaEmkwiSTEn4PVzOwi7b6Jq+mw4UDkP+Pv75zmIn2ouX8shhYUxALnoWWnuVM OdFU7Y3owOnt3d5oa5jzgGBENz9N4AJVeylU1aOvURH2FxllaKK60utgYojdFWerWSvE xC9YBj/TA1gRUUgXB/ToNLjr9COXeczyE+OHu3igqOYq1zeawHXvOKegbMuJRpgy2cD1 21UQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8k3DGAVpoQzu2sff/o2jzhbFOHaCHfsfIbB115iBXOk=; fh=7HA2l/MfnzhAD5GUqEJnaW6r0qXu/WIaR7EJpyY5Pdc=; b=l04iRvBG2BAVXDIGsZe+CC+AS732DewyCTVEQ0DefDzdnp0Q/lxy2R2doVngVjWIZL fF/MR1ml/spZm47uDuOqWkvl1ak4Bcg6PYW5rHGr5p6YhzCoqD5SiDYPL6QemZ9uOAbv ghkU2OrHucJ01qbbyew4E52aZLpPcoJ0oHi0p57KrMl1SgrkUwN8/G84yFexkj9VqoAd dBrH5FUIj6AfkSLT6MUbUa5vR1XSb4tnDKQylQ9TDr2EXvLw3djmsvr2y3dc0zNHgj3p CXgffw4Mzr1OkImOxJmwiaNImKy8fflL7K1U9/7dQxP3iFeVpJEnF2PkyDScD5mTEmUG q3BQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=z1MGxOFF; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-20340-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20340-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id k21-20020a170906681500b00a28b68a80cbsi457302ejr.1006.2024.01.08.19.49.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 19:49:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20340-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=z1MGxOFF; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-20340-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20340-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 50CB41F243A9 for ; Tue, 9 Jan 2024 03:49:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C1B5922065; Tue, 9 Jan 2024 03:48:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="z1MGxOFF" Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2079.outbound.protection.outlook.com [40.107.92.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1425610A; Tue, 9 Jan 2024 03:48:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RibDTEejnEotLMDlGnnjsXYCjpY1KKIGKxppee83gKwLHliVigftT90PKgDE1vfMUhkxGzF0EG1cN7wIQz4jabA5tubKmeZPt6CGkNDvfHybykUObNfuCFmII4I8FK9Kr69tWGikQ09iqTrapCuSBpRNGxPp7PLiy+G4Q6WkSl+lIqcQeap4zodWz8g5nR13yL8YVI6HdL+IiCjluYwOPY2bALyy3ZRicCtry9vFA5ppiu2OYdhCuCvkY7mGLBrRN0micBqIsGJRkOLP3uhsNcTDPOb50Ebj8OP/7vXq/0AndPIHBICBbCvxXx/52zHKqv0BgwYvEw0zL2JTgX94zw== 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=8k3DGAVpoQzu2sff/o2jzhbFOHaCHfsfIbB115iBXOk=; b=AKm/0a/NmsBuHKK+AnZn0ZE4NsX/PpeEAwDeRNNe+4pLZ9fD6o9cJGG0spMj3fya8ty5Gmr7wZ8XQ95P6NC6P5qK4iUdrZlqrzsZhwwHDHGFg/lCajrX0fvlybsYYIn1G1ceoaN47NM5KMxD74Q+o/VLfbwfaDk8wsc+wM7X/2ZvOuB0QZ4KFbJagfggOd7Dg7Oao9bM4IWQ6VB5RRViQLq7II4qk/7rBohsJDoV9HMwYj5rlweK5HCqsPrgtsuCOFiEYjNDnA9PFNLyPHr6sFxyZB0NWAVg1aPKyxsfxjMFwRuCqQnDb/w46HpnImfYq7E5QX88ndEdtgoGJMjCrg== 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=8k3DGAVpoQzu2sff/o2jzhbFOHaCHfsfIbB115iBXOk=; b=z1MGxOFFmLijET9b7YH3/hOdvodVJ2c3yltwBCQ95pyflal2mdK82keWFZkwVkldb3uC9pqLmwEXCuP23HLXdSmoCTuj6eefWfqI2URH13Sh7mQbrBHLmXBHVu5uJfU7kU+ZyjlHmse7lO6shtwTjiWYFfnmG09Gl+Wt5obLfQU= Received: from BYAPR02CA0006.namprd02.prod.outlook.com (2603:10b6:a02:ee::19) by MN2PR12MB4552.namprd12.prod.outlook.com (2603:10b6:208:24f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.23; Tue, 9 Jan 2024 03:48:13 +0000 Received: from SJ5PEPF000001D1.namprd05.prod.outlook.com (2603:10b6:a02:ee:cafe::4) by BYAPR02CA0006.outlook.office365.com (2603:10b6:a02:ee::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.23 via Frontend Transport; Tue, 9 Jan 2024 03:48:12 +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 SJ5PEPF000001D1.mail.protection.outlook.com (10.167.242.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7181.12 via Frontend Transport; Tue, 9 Jan 2024 03:48:12 +0000 Received: from ethanolx50f7host.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.34; Mon, 8 Jan 2024 21:48:07 -0600 From: Smita Koralahalli To: , , CC: Ard Biesheuvel , Alison Schofield , Vishal Verma , "Ira Weiny" , Dan Williams , Jonathan Cameron , Yazen Ghannam , Smita Koralahalli Subject: [PATCH v2 2/4] efi/cper, cxl: Make definitions and structures global Date: Tue, 9 Jan 2024 03:47:53 +0000 Message-ID: <20240109034755.100555-3-Smita.KoralahalliChannabasappa@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240109034755.100555-1-Smita.KoralahalliChannabasappa@amd.com> References: <20240109034755.100555-1-Smita.KoralahalliChannabasappa@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D1:EE_|MN2PR12MB4552:EE_ X-MS-Office365-Filtering-Correlation-Id: 1de3f251-1605-4364-f025-08dc10c5cdb8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: okBUEisLmZx/0n7PHOINmiq2l8Qr+LCeFa849CeE7ZS+7l80F8OTlXI/opESIAmYHkQ/fe1eEvsbfWCQcRkXkuhxSJNu8bPw/yuOJ8OCzPk0bC2o001sd2wfmYxpbx3wAh1dyNFWb7jVBl2rYmIYQC5JUcaE7hBdCRjnnZMeukrSIN4KMBwO8eFGRDDfi7oUDVSwjeNm0fzoNHUz9QFQ1xXxWfPWwIUmj2DBRNws5PgZIg3+wRwFPIzZW8Clfp5CY/orknmIZnKPjcwR5vPTwBF39t2c1QXRAL8ZW4yyOBJ3XP95SsM8NCpiDMNxsc4EB6Ae2Hdlrgfh4t42fp5q7DUr83A3x6yddopIMWsQp3pKkHAyBbpvpdQvhvUn9nUWX/tpLb6MULG4wZ8dHwtE1RbVqNjdRct9+H98jNwJw15WlOaILrcnkKAEfbZO7wivaJp+JUWgqNnPVJ8YHzwfT+7Q2SflLzEQ0Gq32oVC0rLqqCcZKjIgb5RqEsvQtuTnY5RsFyWaQn+4/R8CKLcwTFab8p8LXsZHBj//ZOmwWXkmT5D4j9Gl4kx+NZ1ZzKCDpBov8COeJIP1R4ZRiKo/vXeXvUivW2qpEpPHFa26ODuyYustC19hZGNLZAFv0KLJ0AhIB/20yX4nIrlhIP44ewmxXlLSMlNB4zbQhmldrkwwLRfDYEd4ftrzOo7wx2G3j7Jo9dyppmozUBCA4msr13dFTtScvSvcNdFcBXaSFoNlJ/WlLZC87aBODOgH8ViO95QEFdVQQE4p9F2E5QU3mQ== 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)(136003)(376002)(346002)(396003)(230922051799003)(1800799012)(451199024)(64100799003)(82310400011)(186009)(40470700004)(36840700001)(46966006)(40460700003)(40480700001)(2906002)(5660300002)(8676002)(41300700001)(8936002)(4326008)(54906003)(36756003)(316002)(70206006)(70586007)(110136005)(478600001)(6666004)(86362001)(336012)(426003)(1076003)(2616005)(7696005)(26005)(16526019)(83380400001)(47076005)(356005)(81166007)(82740400003)(36860700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2024 03:48:12.3943 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1de3f251-1605-4364-f025-08dc10c5cdb8 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: SJ5PEPF000001D1.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4552 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787583158830099597 X-GMAIL-MSGID: 1787583158830099597 In preparation to add tracepoint support, move protocol error UUID definition to a common location and make CXL RAS capability struct global for use across different modules. Signed-off-by: Smita Koralahalli Reviewed-by: Jonathan Cameron Acked-by: Ard Biesheuvel --- v2: No change. --- drivers/firmware/efi/cper_cxl.c | 11 ----------- drivers/firmware/efi/cper_cxl.h | 7 ++----- include/linux/cper.h | 4 ++++ include/linux/cxl-event.h | 11 +++++++++++ 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/drivers/firmware/efi/cper_cxl.c b/drivers/firmware/efi/cper_cxl.c index a55771b99a97..4fd8d783993e 100644 --- a/drivers/firmware/efi/cper_cxl.c +++ b/drivers/firmware/efi/cper_cxl.c @@ -18,17 +18,6 @@ #define PROT_ERR_VALID_DVSEC BIT_ULL(5) #define PROT_ERR_VALID_ERROR_LOG BIT_ULL(6) -/* CXL RAS Capability Structure, CXL v3.0 sec 8.2.4.16 */ -struct cxl_ras_capability_regs { - u32 uncor_status; - u32 uncor_mask; - u32 uncor_severity; - u32 cor_status; - u32 cor_mask; - u32 cap_control; - u32 header_log[16]; -}; - static const char * const prot_err_agent_type_strs[] = { "Restricted CXL Device", "Restricted CXL Host Downstream Port", diff --git a/drivers/firmware/efi/cper_cxl.h b/drivers/firmware/efi/cper_cxl.h index 86bfcf7909ec..6f8c00495708 100644 --- a/drivers/firmware/efi/cper_cxl.h +++ b/drivers/firmware/efi/cper_cxl.h @@ -7,14 +7,11 @@ * Author: Smita Koralahalli */ +#include + #ifndef LINUX_CPER_CXL_H #define LINUX_CPER_CXL_H -/* CXL Protocol Error Section */ -#define CPER_SEC_CXL_PROT_ERR \ - GUID_INIT(0x80B9EFB4, 0x52B5, 0x4DE3, 0xA7, 0x77, 0x68, 0x78, \ - 0x4B, 0x77, 0x10, 0x48) - #pragma pack(1) /* Compute Express Link Protocol Error Section, UEFI v2.10 sec N.2.13 */ diff --git a/include/linux/cper.h b/include/linux/cper.h index c1a7dc325121..2cbf0a93785a 100644 --- a/include/linux/cper.h +++ b/include/linux/cper.h @@ -89,6 +89,10 @@ enum { #define CPER_NOTIFY_DMAR \ GUID_INIT(0x667DD791, 0xC6B3, 0x4c27, 0x8A, 0x6B, 0x0F, 0x8E, \ 0x72, 0x2D, 0xEB, 0x41) +/* CXL Protocol Error Section */ +#define CPER_SEC_CXL_PROT_ERR \ + GUID_INIT(0x80B9EFB4, 0x52B5, 0x4DE3, 0xA7, 0x77, 0x68, 0x78, \ + 0x4B, 0x77, 0x10, 0x48) /* * Flags bits definitions for flags in struct cper_record_header diff --git a/include/linux/cxl-event.h b/include/linux/cxl-event.h index 6ce839c59749..3a41dd5723e8 100644 --- a/include/linux/cxl-event.h +++ b/include/linux/cxl-event.h @@ -141,6 +141,17 @@ struct cxl_cper_event_rec { union cxl_event event; } __packed; +/* CXL RAS Capability Structure, CXL v3.0 sec 8.2.4.16 */ +struct cxl_ras_capability_regs { + u32 uncor_status; + u32 uncor_mask; + u32 uncor_severity; + u32 cor_status; + u32 cor_mask; + u32 cap_control; + u32 header_log[16]; +}; + struct cxl_cper_event_info { struct cxl_cper_event_rec rec; }; From patchwork Tue Jan 9 03:47:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Smita Koralahalli X-Patchwork-Id: 186202 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp1426239dyq; Mon, 8 Jan 2024 19:49:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IFbjfSYz68H5Sh6RE3Y/GkpCdY2xW8LehG3najX1nAHAHvwvMMk7lsLN1QQGKluGrk+edbp X-Received: by 2002:a17:902:dac6:b0:1d4:7687:833f with SMTP id q6-20020a170902dac600b001d47687833fmr6101693plx.33.1704772155180; Mon, 08 Jan 2024 19:49:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704772155; cv=pass; d=google.com; s=arc-20160816; b=DcVl0pctnIwldnVuI4zYU4s7BxoMjWrwxXXdNKOBXl9qXKJoDXKNUtGiO/tcKM/MBo rICYpDvJeyichoAETDs3FixQOXZ4ThLXgblUuBa3Jrr+tyga+36bmyUXWBCtbpLVzDHK NL6OtNfGUHgtd7D9RdrJUZ5oJNOR5Z9izCdAVzeBJ8orKHFqwv+HxQZIm6Vhp/5pwhI0 6Wc3m/C4BBPtYS8VMCpX5HLZTN0UBL2t77IxWQGVmci8JxgHNMqficDWhh/3wPgtBuh/ 7MSitJV/kHgebPiLQULcUQJtWqjWx+Ha7FB1h0CUSvUgINc5asXwiFrtdsu6rYpbSkCA qAYA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xoUtilH3GQrGKCOfbgpzmU0KAYF9juPbA1ck7qdC6n4=; fh=7HA2l/MfnzhAD5GUqEJnaW6r0qXu/WIaR7EJpyY5Pdc=; b=q9bmPr0zDigClpWHepr56V+dQi3yK6NmRuhoVyLIPA5DgybCJgmDXO3nauEtmmjXa+ Vym3cIGR7fDzxHk4MqmxohuzPDCFqYAbBg4eQABEpftJxoV0cWgAH5VirkUCWFQFRpXE dN3suwr8RqjCYaCy58tkmZhRA88N58Z0y/9Qd8h326863wQUNnMM7AgBQzCXtY1iSN8k m593e7bZz3vJTUIpx/Vr+CV0MiH/m6mUAihkOAzWpN5h+zZUmIbp+ocSlciMQCQYzIKq 3jSJCknSzHWOm3kDkeHpEhaUcejBvqMWP2aWztiCPRqLuVv3/JFu0d11wPAxkforsYTv 97yA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=lG00N1UT; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-20341-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20341-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u14-20020a170903124e00b001d3bf26fd7csi845902plh.305.2024.01.08.19.49.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 19:49:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20341-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=lG00N1UT; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-20341-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20341-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E86712852F8 for ; Tue, 9 Jan 2024 03:49:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7BEBC25554; Tue, 9 Jan 2024 03:48:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="lG00N1UT" Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2088.outbound.protection.outlook.com [40.107.223.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B40026106; Tue, 9 Jan 2024 03:48:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R+eLOXEcPMGH4Op7Zrq0fLN4+zaTsZhKsyLsz6YqK7HfvosOoQo1zjFG5l6nHj4YAkqT1CKBfN8DuYCKfGzszCvhuSEbHBm9fL/XCTk9kWO873ZMGr9Sf4ZL+n44QbNjUU1TclpVi4rWHNCO7NT4NG+AMCz0OyU7u0DTzmKowFX/ygJUQtfLhgkE8vbpIjOCt0HelfV44g1sGzhoohHe8efOezH5tzLonHBpx7M1UJVsXtz40nVgy9cBhKW98pkW8a0v+0lnZ9nY01yAOjgkbZ/luxkEuq6cId0aFDxPGf+vl/4UxTnZtXt2WkAmz+3WwjWUjWABGTYNtq7zYfFSXg== 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=xoUtilH3GQrGKCOfbgpzmU0KAYF9juPbA1ck7qdC6n4=; b=mpBblyZ2duIIIyHx2JUo2hzdz9uXdTV+tj7Ek4SQQVfHOSBpPhA1PWPIPlvjP/ayRrCwiCu5w/pGE16IcDERm+EROMzBMy8pLiRRfHkC83JCucVsBUu4ei7G4XyEfvjucNbaOYNQKyZzOhjT9NrdBf5Y9qsvBIe539XHrZtA00QSOayhUhuysmBkKyAkE8BSVe0Ec19Kxr7pJrFKfdO+wb2cu2eK8mjS/vYPfwpBcq2b1aQQvIUX9GoqCNlvi5Oaa3oZvpc3PshLEO+FXorRdCFqI3GW4rXDK+W0a58j37tMaxHz6zBuV/1bI2OW3A9ycAjiH+U+K6zZOT8t6A1t1w== 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=xoUtilH3GQrGKCOfbgpzmU0KAYF9juPbA1ck7qdC6n4=; b=lG00N1UT6EGISudk4SVp7gxFnsObLBJhXGgV3Y+fSb1FNHhC1zEnWY+eQ1Ma0r6yRaQ91IrNPV09P+w/q+f6ZIUkL74k5nRO16VNuxJp6OqoDe9sVZ4hVYj7/f3QB0bhRZfCsx6ObnJbHSQMi1v3m+AlcS5i/29fctADC3lkfQ8= Received: from BYAPR05CA0001.namprd05.prod.outlook.com (2603:10b6:a03:c0::14) by PH0PR12MB5647.namprd12.prod.outlook.com (2603:10b6:510:144::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.21; Tue, 9 Jan 2024 03:48:13 +0000 Received: from SJ5PEPF000001D2.namprd05.prod.outlook.com (2603:10b6:a03:c0:cafe::d8) by BYAPR05CA0001.outlook.office365.com (2603:10b6:a03:c0::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.14 via Frontend Transport; Tue, 9 Jan 2024 03:48:13 +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 SJ5PEPF000001D2.mail.protection.outlook.com (10.167.242.54) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7181.12 via Frontend Transport; Tue, 9 Jan 2024 03:48:13 +0000 Received: from ethanolx50f7host.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.34; Mon, 8 Jan 2024 21:48:07 -0600 From: Smita Koralahalli To: , , CC: Ard Biesheuvel , Alison Schofield , Vishal Verma , "Ira Weiny" , Dan Williams , Jonathan Cameron , Yazen Ghannam , Smita Koralahalli Subject: [PATCH v2 3/4] acpi/ghes, efi/cper: Recognize and process CXL Protocol Errors. Date: Tue, 9 Jan 2024 03:47:54 +0000 Message-ID: <20240109034755.100555-4-Smita.KoralahalliChannabasappa@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240109034755.100555-1-Smita.KoralahalliChannabasappa@amd.com> References: <20240109034755.100555-1-Smita.KoralahalliChannabasappa@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D2:EE_|PH0PR12MB5647:EE_ X-MS-Office365-Filtering-Correlation-Id: 5972f506-ed0c-44a7-277c-08dc10c5ce14 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hMMbs/Dhyj3wdDL0MOld5ssxdYYGRHCfgQm6mqyETiDloWOcSqafpe15nSEx2WDV111y0OeB/RR4NY45V9B9qqd+k7pAVIrOIRawPYhzBqFoSr78K7K8bkwkzLGwnFPLHGdmb+cPZ9eEe9Jcaxof9IRME9VZsZJqhv5DcOpbHvCCmUsnZ2uUSx2A45vjbib8tAk1P2dBKlLOlKC7boZh1FurWHxJdTmAqvyLqwAIp5TMRyXuS5MKg62ZTgpiL+qV2Gnf13Wf+CXeY6g5qGM2SrFcTnMEMab0+b/5cFm9ovuAipTyInNcYvTHjkrDvTEF5PQhHy4e6urQ+jbzSh9IZluejjapYzqOLdNZxkm0tsEBVedbhRFsfwd7TN8JLna9sVIzOCWNC/3nUC9rTz2QxRrJ3RS86HInB/Hc/Z8hCMSQ4V6HlsgwcEjkpa+tt7fgLrY/0upftcjDdsEzbJfavR5R5YkQYW4kGHYTLXvfKD8MZmcLz7Tpc7SeyQydUd3wk1SM99w+KlylORvNtBLEn/7NayBrArTWNn8wGWAKfhDbcx/jj+K4hfY00opj1u647X1FrMsSl4r0qPETElupTblDV9JHnPROzIEXvUyhijl/wZWtcS4Jm4OKChG06DS82nCc6R26MpdV3B1o8D6XTmW1h1A5vCU/3/LEA2e0l38F4LEKw7AgQYlzBk9Kogtlmw9+atqK5CW2sQU9stAJRchbTCMl9IgU6ah1+v+7JgLy3vWGrGhbDQ8ZZu1Fv/fO471tHR8fEDWA1XnwUFcuiuHvF/a2FZCIlVvc6vLx+XYzhWQ6CXxlYa5MI/s3OJ+j 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)(376002)(39860400002)(136003)(396003)(346002)(230922051799003)(230273577357003)(230173577357003)(64100799003)(82310400011)(186009)(451199024)(1800799012)(40470700004)(36840700001)(46966006)(47076005)(81166007)(82740400003)(356005)(36756003)(40480700001)(40460700003)(86362001)(6666004)(7696005)(316002)(8676002)(478600001)(4326008)(54906003)(26005)(336012)(1076003)(16526019)(36860700001)(2616005)(426003)(70586007)(110136005)(70206006)(83380400001)(8936002)(41300700001)(5660300002)(2906002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2024 03:48:13.0390 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5972f506-ed0c-44a7-277c-08dc10c5ce14 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: SJ5PEPF000001D2.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5647 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787583167486287584 X-GMAIL-MSGID: 1787583167486287584 UEFI v2.10 section N.2.13 defines a CPER record for CXL Protocol errors. Add GHES support to detect CXL CPER Protocol record and cache error severity, device_id, serial number and CXL RAS capability struct in struct cxl_cper_event_info. Signed-off-by: Smita Koralahalli --- v2: Change to sub-struct for protocol error specific elemenets. Set serial number unconditionally. Copy entire cxl_ras_capability_regs struct rather than pointer. Calculate error severity in efi/cper and change to enum. --- drivers/acpi/apei/ghes.c | 11 ++++++ drivers/firmware/efi/cper_cxl.c | 68 +++++++++++++++++++++++++++++++++ include/linux/cxl-event.h | 13 +++++++ 3 files changed, 92 insertions(+) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index 60b615d361d3..1d4f3d68a0bc 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -714,6 +714,14 @@ static void cxl_cper_post_event(enum cxl_event_type event_type, cper_callback(event_type, &info); } +void cxl_cper_handle_prot_err(struct acpi_hest_generic_data *gdata) +{ + struct cxl_cper_event_info info; + + if (cxl_cper_handle_prot_err_info(gdata, &info)) + return; +} + int cxl_cper_register_callback(cxl_cper_callback callback) { guard(rwsem_write)(&cxl_cper_rw_sem); @@ -768,6 +776,9 @@ static bool ghes_do_proc(struct ghes *ghes, else if (guid_equal(sec_type, &CPER_SEC_PROC_ARM)) { queued = ghes_handle_arm_hw_error(gdata, sev); } + else if (guid_equal(sec_type, &CPER_SEC_CXL_PROT_ERR)) { + cxl_cper_handle_prot_err(gdata); + } else if (guid_equal(sec_type, &CPER_SEC_CXL_GEN_MEDIA_GUID)) { struct cxl_cper_event_rec *rec = acpi_hest_get_payload(gdata); diff --git a/drivers/firmware/efi/cper_cxl.c b/drivers/firmware/efi/cper_cxl.c index 4fd8d783993e..9b9b8c8f1157 100644 --- a/drivers/firmware/efi/cper_cxl.c +++ b/drivers/firmware/efi/cper_cxl.c @@ -8,6 +8,7 @@ */ #include +#include #include "cper_cxl.h" #define PROT_ERR_VALID_AGENT_TYPE BIT_ULL(0) @@ -44,6 +45,17 @@ enum { USP, /* CXL Upstream Switch Port */ }; +static enum cxl_aer_err_type cper_severity_cxl_aer(int cper_severity) +{ + switch (cper_severity) { + case CPER_SEV_RECOVERABLE: + case CPER_SEV_FATAL: + return CXL_AER_UNCORRECTABLE; + default: + return CXL_AER_CORRECTABLE; + } +} + void cper_print_prot_err(const char *pfx, const struct cper_sec_prot_err *prot_err) { if (prot_err->valid_bits & PROT_ERR_VALID_AGENT_TYPE) @@ -176,3 +188,59 @@ void cper_print_prot_err(const char *pfx, const struct cper_sec_prot_err *prot_e sizeof(cxl_ras->header_log), 0); } } + +int cxl_cper_handle_prot_err_info(struct acpi_hest_generic_data *gdata, + struct cxl_cper_event_info *info) +{ + struct cper_sec_prot_err *prot_err = acpi_hest_get_payload(gdata); + struct cper_cxl_event_devid *device_id = &info->rec.hdr.device_id; + struct cper_cxl_event_sn *dev_serial_num = &info->rec.hdr.dev_serial_num; + size_t size = sizeof(*prot_err) + prot_err->dvsec_len; + + if (!(prot_err->valid_bits & PROT_ERR_VALID_ERROR_LOG)) { + pr_err(FW_WARN "Not a valid protocol error log\n"); + return -EINVAL; + } + + if (!(prot_err->valid_bits & PROT_ERR_VALID_DEVICE_ID)) { + pr_err(FW_WARN "Not a valid Device ID\n"); + return -EINVAL; + } + + /* + * Set device serial number unconditionally. + * + * Print a warning message if it is not valid. The device serial + * number is considered valid for CXL 1.1 device, CXL 2.0 device, + * CXL 2.0 Logical device, or CXL 2.0 Fabric Manager Managed + * Logical Device. + */ + if (!(prot_err->valid_bits & PROT_ERR_VALID_SERIAL_NUMBER) || + prot_err->agent_type > 0x4 || prot_err->agent_type == RCH_DP) + pr_warn(FW_WARN "Not a valid serial number\n"); + + dev_serial_num->lower_dw = prot_err->dev_serial_num.lower_dw; + dev_serial_num->upper_dw = prot_err->dev_serial_num.upper_dw; + + /* + * The device ID or agent address is only valid for CXL 1.1 device, + * CXL 2.0 device, CXL 2.0 Logical device, CXL 2.0 Fabric Manager + * Managed Logical Device, CXL Root Port, CXL Downstream Switch + * Port, or CXL Upstream Switch Port. + */ + if (prot_err->agent_type <= 0x7 && prot_err->agent_type != RCH_DP) { + device_id->segment_num = prot_err->agent_addr.segment; + device_id->bus_num = prot_err->agent_addr.bus; + device_id->device_num = prot_err->agent_addr.device; + device_id->func_num = prot_err->agent_addr.function; + } else { + pr_err(FW_WARN "Not a valid agent type\n"); + return -EINVAL; + } + + info->p_err.cxl_ras = *(struct cxl_ras_capability_regs *)((long)prot_err + size); + + info->p_err.severity = cper_severity_cxl_aer(gdata->error_severity); + + return 0; +} diff --git a/include/linux/cxl-event.h b/include/linux/cxl-event.h index 3a41dd5723e8..08e3979de9a3 100644 --- a/include/linux/cxl-event.h +++ b/include/linux/cxl-event.h @@ -152,13 +152,26 @@ struct cxl_ras_capability_regs { u32 header_log[16]; }; +enum cxl_aer_err_type { + CXL_AER_UNCORRECTABLE, + CXL_AER_CORRECTABLE, +}; + struct cxl_cper_event_info { struct cxl_cper_event_rec rec; + struct cxl_cper_prot_err { + struct cxl_ras_capability_regs cxl_ras; + int severity; + } p_err; }; typedef void (*cxl_cper_callback)(enum cxl_event_type type, struct cxl_cper_event_info *info); +struct acpi_hest_generic_data; +int cxl_cper_handle_prot_err_info(struct acpi_hest_generic_data *gdata, + struct cxl_cper_event_info *info); + #ifdef CONFIG_ACPI_APEI_GHES int cxl_cper_register_callback(cxl_cper_callback callback); int cxl_cper_unregister_callback(cxl_cper_callback callback); From patchwork Tue Jan 9 03:47:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Smita Koralahalli X-Patchwork-Id: 186204 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp1426383dyq; Mon, 8 Jan 2024 19:49:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IGQ0etIlA20mf1LtrvYRln/+DDklaFEwupfvcX0Aq6Bfo7/OEIKYx8YsdfhJkAD73WpFmSt X-Received: by 2002:ac8:5c0f:0:b0:429:a2cd:cf36 with SMTP id i15-20020ac85c0f000000b00429a2cdcf36mr178860qti.14.1704772188419; Mon, 08 Jan 2024 19:49:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704772188; cv=pass; d=google.com; s=arc-20160816; b=wIS33wZ/CTqll5bH+jh4Go2zqyYkc1E6ZmImoHvqvzmmuKtAdV2gNWKKMyY0ELd18C B++ft6bpPtO6ZfCPcNucbu3jcXnqB2NvxBzsIl/2cWBZhWPLCBHBJDHEVVFum69s7z0+ gFUvTRckSwH909HtBhYGAnuRWpHp/GC1c2nlPgwXdKL6cFD4d+H9YBj5KkcF9gOZ+HZQ lemrx02cB+bH+xNcnfjejZ4shFIxiVcj+zs23fw/85HwoPMHAuMMiIi0qCXqbXplkuYZ XEvUeONf003+2eDXrBIz9wl4YG9KWYK1cDuKnNKkXW5ZyQTg2JJEOrgUZdjrgl+Oe7hN K9hA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7D4VDsdPH549mZejIGl9WijLAsxYPD46g+VgR/DNrwU=; fh=7HA2l/MfnzhAD5GUqEJnaW6r0qXu/WIaR7EJpyY5Pdc=; b=g1ZBDPifkIGRBZOOBXZSW89JAeeLBtWq+m4aO1QnJCVH/EFF6w3DKIxXULIF2NwmPL ti64z1wJ+MMmUSRth81UOnCmco2gjTKBM5HXHegCCGobRczvwrJtb2q9Zewv86fd0igF 1wjKFn45pl+gMtKT3xVlWu8SaPpyfOa+CRRlmwf9P6lny0oyjdU0UY1/LNvgF/5Jlqb+ sCEAXNL401NE7uCIPLVpdLcy9juzVHoxqnOLV3Wov/oeJ0Lz1tN7k8PR93KHdMGOcQrx mGBf2GvTNdzUJgoUMPsvwKExNXs14lB3IT9SG02Yw1o2IYGNqHls9IFgTgFu3C2XwF0G 0AhA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=3vyBsHGh; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-20343-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20343-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 9-20020ac85949000000b00423d65135f7si1115615qtz.809.2024.01.08.19.49.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 19:49:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20343-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=3vyBsHGh; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-20343-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20343-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2B77D1C231D8 for ; Tue, 9 Jan 2024 03:49:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A467829CE3; Tue, 9 Jan 2024 03:48:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="3vyBsHGh" Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2082.outbound.protection.outlook.com [40.107.95.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 393DE6138; Tue, 9 Jan 2024 03:48:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CdJFPnFd2ZkTmb29muLeh2kt1CbSdC03PW8jIqX/DHeiZk2opqwcpsTJ89jN3xssCthhW1jSpATVVCnSNMOpK7JRL2V7+14HvtDmU/Lu1XIXl4FAyUbMxQuFMFXanYhEXcCxTHIP6/ZTeBevlK0S9QjEKU/7vf3vB0TTfaT850zSimJGA63thBw0ZsmOoAvDTsasx/mLJBYh36ewYUpA+wcfMgCnEncS7isBp7sBTJ60JDH6u50O8X3G1G3o5uWjQuJr06A6UjJwHxPkAq6t1OXIEI02dloc/YFfSQ2SiLqol//8SKXv99PtgtDtrTc6tNnAMBMEbcbWWpcI1VgprQ== 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=7D4VDsdPH549mZejIGl9WijLAsxYPD46g+VgR/DNrwU=; b=nNILzluqsJdotcGXKYCyafIJk4cGP99EDLkjWY350Vi5lhU2Ai670xD5/WGz234gtTskSt8SRfNTH3hc8s9IJhVivhHm6sVTqfIU5pNKfMj1TVhuPkO5IK8ziiIfQ4ofnWX1onXKxgW1GdtDmrO/Q1OTNnz3gwa5kVWB/FarDw3Y4jDalWklJphRIuvJxx6JwIsY/JJZ3kIEO1L5uieH42snaCzjQxCJYlAnmzxmIQ11UtOWELLnmj6v6ReIERafXnH1yIs/T6g73UW02zLYPqJiDTQ8GCW/NzGx/ngTJ8DapY0lNhe0Ey0YpXMr44plmI3VEbG/F17FZd/NUQJviQ== 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=7D4VDsdPH549mZejIGl9WijLAsxYPD46g+VgR/DNrwU=; b=3vyBsHGhmXYe446s9KxSLK08AbDmsoM2uYfnBEKCvqjJBWPNMa5FrKnUFlGdb59rRh/4uS5i7l5q8gZz2BWOXubV5hRuqoKOEGp4vpcY/cXDuHDIDHqjtahLs92LLPiDvKqyJLszvYq56VWOXk+0Skc3BEWEihF3wlKmB1DH29M= Received: from BYAPR02CA0006.namprd02.prod.outlook.com (2603:10b6:a02:ee::19) by SA3PR12MB8046.namprd12.prod.outlook.com (2603:10b6:806:304::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.23; Tue, 9 Jan 2024 03:48:14 +0000 Received: from SJ5PEPF000001D1.namprd05.prod.outlook.com (2603:10b6:a02:ee:cafe::4) by BYAPR02CA0006.outlook.office365.com (2603:10b6:a02:ee::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.23 via Frontend Transport; Tue, 9 Jan 2024 03:48:13 +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 SJ5PEPF000001D1.mail.protection.outlook.com (10.167.242.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7181.12 via Frontend Transport; Tue, 9 Jan 2024 03:48:13 +0000 Received: from ethanolx50f7host.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.34; Mon, 8 Jan 2024 21:48:07 -0600 From: Smita Koralahalli To: , , CC: Ard Biesheuvel , Alison Schofield , Vishal Verma , "Ira Weiny" , Dan Williams , Jonathan Cameron , Yazen Ghannam , Smita Koralahalli Subject: [PATCH v2 4/4] acpi/ghes, cxl/pci: Trace FW-First CXL Protocol Errors Date: Tue, 9 Jan 2024 03:47:55 +0000 Message-ID: <20240109034755.100555-5-Smita.KoralahalliChannabasappa@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240109034755.100555-1-Smita.KoralahalliChannabasappa@amd.com> References: <20240109034755.100555-1-Smita.KoralahalliChannabasappa@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D1:EE_|SA3PR12MB8046:EE_ X-MS-Office365-Filtering-Correlation-Id: f052e536-862c-458f-84a4-08dc10c5ce70 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YUdAdEXCSWYY58wqfVbeHAVhNRxliHpYEmW+BFGFBX9M0LG6crp4voMYwXbxz42I99Y6/YmMjGy3PAmSn9XUMNRqoIvpG7Oz1cOu37e3WnbLTulbzyP0UDdtjXcmYQoKQohIlmnbBvBWgyIQ5sqC4jb9zA7ZCLwy/lR0NyW7i6OZh4Hf8Ru/ahoJdMRI4FGaApcJ6DhfTez7C0P3dIHuhQqWnfNbPpptfYS4gA5odcwkLdKKdO5hBGsGcRbtl05DW8E54lK0SvPVGfuCH3xsx8FM3JUfpxZlUA6eP7j+rdDwvvyTRFwSf1+qQiLa36dz+YfYREbQNIcSdlL7xMQVmgmtHsrFK1ZNbv40ESFTdRjBSIVqyuAdtqTWe40ktHk8c5eEThjsimKm9H/5icDGBYgEpdJOi4KFxBWWwxO6uKnttE8SshQC2jax+JeWua1cj5yBDXkF/yaqjuzfCwoJrQbFjs9Qstttq5cmn60qqPR+ZlcuEqh6PIm19M+0BZQ2oMm7g1IT78KfrXjWzNtOjb2U1OejYeljlPRUtJthnCPe2zizEv0YWucMdjDxCgEGBvx3ZQHvZmT0+ae/bE2UsAS2l+U+4kuO+UOONlBSev0SM9lfswdP1zV4zM9iToHc1mAyR76brQc0oPtxHV9I83w5QTid84CI7URu3rX7S/9iYJl421WCnMgFVBYuUrP+kR7DrRo7FQ9g7BdPAbjt0BGDjSGIhqq/OaAO4VCAmaXjoj3t/dewPKcSsUJkMRaG7kUWzQdftcKvmZoJftjGaOpaWoLSQgN77vMmPR6l/+PS8TNQLwg3NY2U+yVFcAH9 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)(346002)(39860400002)(376002)(136003)(230273577357003)(230922051799003)(230173577357003)(1800799012)(451199024)(82310400011)(64100799003)(186009)(36840700001)(46966006)(40470700004)(2616005)(1076003)(336012)(426003)(26005)(478600001)(6666004)(7696005)(47076005)(36860700001)(83380400001)(41300700001)(5660300002)(8936002)(70206006)(54906003)(110136005)(8676002)(16526019)(4326008)(70586007)(316002)(2906002)(86362001)(356005)(82740400003)(81166007)(36756003)(40460700003)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2024 03:48:13.6443 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f052e536-862c-458f-84a4-08dc10c5ce70 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: SJ5PEPF000001D1.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB8046 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787583202079803192 X-GMAIL-MSGID: 1787583202079803192 When PCIe AER is in FW-First, OS should process CXL Protocol errors from CPER records. These CPER records obtained from GHES module, will rely on a registered callback to be notified to the CXL subsystem in order to be processed. Call the existing cxl_cper_callback to notify the CXL subsystem on a Protocol error. The defined trace events cxl_aer_uncorrectable_error and cxl_aer_correctable_error currently trace native CXL AER errors. Reuse them to trace FW-First Protocol Errors. Signed-off-by: Smita Koralahalli --- v2: Added warning for serial number check. Moved severity determination to previous patch. --- drivers/acpi/apei/ghes.c | 5 +++++ drivers/cxl/core/pci.c | 29 +++++++++++++++++++++++++++++ drivers/cxl/cxlpci.h | 3 +++ drivers/cxl/pci.c | 5 +++++ include/linux/cxl-event.h | 1 + 5 files changed, 43 insertions(+) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index 1d4f3d68a0bc..4318b602e797 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -716,10 +716,15 @@ static void cxl_cper_post_event(enum cxl_event_type event_type, void cxl_cper_handle_prot_err(struct acpi_hest_generic_data *gdata) { + enum cxl_event_type event_type = CXL_CPER_EVENT_PROT_ERR; struct cxl_cper_event_info info; if (cxl_cper_handle_prot_err_info(gdata, &info)) return; + + guard(rwsem_read)(&cxl_cper_rw_sem); + if (cper_callback) + cper_callback(event_type, &info); } int cxl_cper_register_callback(cxl_cper_callback callback) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index 37e1652afbc7..bde8ebf5e4b3 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -836,6 +836,35 @@ void cxl_setup_parent_dport(struct device *host, struct cxl_dport *dport) } EXPORT_SYMBOL_NS_GPL(cxl_setup_parent_dport, CXL); +void cxl_prot_err_trace_record(struct cxl_dev_state *cxlds, + struct cxl_cper_event_info *info) +{ + struct cper_cxl_event_sn *dev_serial_num = &info->rec.hdr.dev_serial_num; + u32 status, fe; + + if (((u64)dev_serial_num->upper_dw << 32 | + dev_serial_num->lower_dw) != cxlds->serial) + pr_warn("The device serial number in CPER differs or isn't valid\n"); + + if (info->p_err.severity == CXL_AER_CORRECTABLE) { + status = info->p_err.cxl_ras.cor_status & ~info->p_err.cxl_ras.cor_mask; + + trace_cxl_aer_correctable_error(cxlds->cxlmd, status); + } else { + status = info->p_err.cxl_ras.uncor_status & ~info->p_err.cxl_ras.uncor_mask; + + if (hweight32(status) > 1) + fe = BIT(FIELD_GET(CXL_RAS_CAP_CONTROL_FE_MASK, + info->p_err.cxl_ras.cap_control)); + else + fe = status; + + trace_cxl_aer_uncorrectable_error(cxlds->cxlmd, status, fe, + info->p_err.cxl_ras.header_log); + } +} +EXPORT_SYMBOL_NS_GPL(cxl_prot_err_trace_record, CXL); + static void cxl_handle_rdport_cor_ras(struct cxl_dev_state *cxlds, struct cxl_dport *dport) { diff --git a/drivers/cxl/cxlpci.h b/drivers/cxl/cxlpci.h index 0fa4799ea316..216003d4aec1 100644 --- a/drivers/cxl/cxlpci.h +++ b/drivers/cxl/cxlpci.h @@ -93,4 +93,7 @@ void read_cdat_data(struct cxl_port *port); void cxl_cor_error_detected(struct pci_dev *pdev); pci_ers_result_t cxl_error_detected(struct pci_dev *pdev, pci_channel_state_t state); +struct cxl_cper_event_info; +void cxl_prot_err_trace_record(struct cxl_dev_state *cxlds, + struct cxl_cper_event_info *info); #endif /* __CXL_PCI_H__ */ diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c index 1ad240ead4fd..515983e7df10 100644 --- a/drivers/cxl/pci.c +++ b/drivers/cxl/pci.c @@ -995,6 +995,11 @@ static void cxl_cper_event_call(enum cxl_event_type ev_type, if (!cxlds) return; + if (ev_type == CXL_CPER_EVENT_PROT_ERR) { + cxl_prot_err_trace_record(cxlds, info); + return; + } + /* Fabricate a log type */ hdr_flags = get_unaligned_le24(info->rec.event.generic.hdr.flags); log_type = FIELD_GET(CXL_EVENT_HDR_FLAGS_REC_SEVERITY, hdr_flags); diff --git a/include/linux/cxl-event.h b/include/linux/cxl-event.h index 08e3979de9a3..96cc88aa04f3 100644 --- a/include/linux/cxl-event.h +++ b/include/linux/cxl-event.h @@ -113,6 +113,7 @@ enum cxl_event_type { CXL_CPER_EVENT_GEN_MEDIA, CXL_CPER_EVENT_DRAM, CXL_CPER_EVENT_MEM_MODULE, + CXL_CPER_EVENT_PROT_ERR, }; #define CPER_CXL_DEVICE_ID_VALID BIT(0)