From patchwork Fri May 4 05:59:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 134943 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp436930lji; Thu, 3 May 2018 23:01:21 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq/1BWPAb6hmjIwaWx9eR3+q0nNfe8w5HiiipvlU6AOIKmHpQrx44ly/93IBaR2a/xN4THN X-Received: by 2002:a17:902:b28:: with SMTP id 37-v6mr26358739plq.207.1525413681374; Thu, 03 May 2018 23:01:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525413681; cv=none; d=google.com; s=arc-20160816; b=xvjqN7N5ui7hZ5UK0KqGb3tLvPDFBwVoqFb3vjYLFu0ODlkk5CsfKQeK3IB7chUNgF ajEaPTo35Ywe2/SexqXnC/+dNGNfRC4Ma+Z9f5iCe1n1G/sBTNL4Bq4ytwu7bH/d0kt7 vsbAKXvEDGF+HhVmYL4pazfh8ul2iYXVkjzNvwSPXANz/5gXA/zTwIFwaDlXLunapydZ QftPKYG2nXKOa5NN3LoaRBGwVZ/IeuMaIjYGD9oCAJ7LNyGxRzIqzlC+7QtD2rlAoMy+ Dc8aVDf8wJPlArrAjiugRYXvFVAErYqqGySjtDMVJOTNIeCv16yQSSt3ZhK10xBIkMoJ RzcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=JDm3m7UDbVG4KfgQDEMlrfbGxlvkzv6SW44wCJUrqT0=; b=qnjEbHSedH9Njj83xHKxVyzOXcS5BsjvywMFNGykIOXtbwKRrdOkd42Zs7MXAeErrv rdwOIKQZ/ptOZW4tmMfFsExp2Jjb1b0KWbo+r7HL5Oxk77nr1XKuuf97ohSDEEoK8+M1 5tGOyz2zrYgxaHvrOLXpifDHPzivUJSUF+3SDJHC4V1FQlde/jOzJQuBu0Q9VxYl6qbH xW5ymtjsi1vJJAZ44tcPfGKnyGb1/6SY69v9UHnzV04McXPNZ+LGI/ehraUduld1UCz7 Xi2Ozh/EaRBMgYWREvvbRjlt8NFddTom1SW3y84zGmRMAJfemUYJdbKuXcI68np4ypqk l7cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kQlJ5Nti; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b7-v6si16062119pla.345.2018.05.03.23.01.21; Thu, 03 May 2018 23:01:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kQlJ5Nti; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751587AbeEDGBR (ORCPT + 29 others); Fri, 4 May 2018 02:01:17 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:40741 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751404AbeEDGBO (ORCPT ); Fri, 4 May 2018 02:01:14 -0400 Received: by mail-wr0-f196.google.com with SMTP id v60-v6so19766678wrc.7 for ; Thu, 03 May 2018 23:01:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JDm3m7UDbVG4KfgQDEMlrfbGxlvkzv6SW44wCJUrqT0=; b=kQlJ5NtiI0axBLnvn193kYvFVvye4KEL8Qc19zMeZzLE9GmUnRGwTa+O4CDXkAL6Iz dhQ0ppe7diW09xrb6Fp/Hen7CIS1+0Nk797nB/HNpNUOxy5naiUGvfFv8VL6qH9MdEKV LC5oNVf5Edh6gYyS++0LDZ8/Wa0T9A6qmEQ90= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JDm3m7UDbVG4KfgQDEMlrfbGxlvkzv6SW44wCJUrqT0=; b=kVfMAVoOjOtHFwAqQUtlymjU/LBNIobl8B43F7OuCyUZC2J1qnqy6YMX3JK6l79Juv z1eRy0VwvuAY89S+fFl+gAl56v07MIpELyhziBw+eTGHDbNiBGJEMz1w+8IhjXnI/nL9 W2iMmqe5tW9fvUDPOtJdTt5h0NwaZJhbiEyP6KFz+sBst4YW1dl8pet7/Eis+gyZ4NuH 4D5bLjQsQJg1O4/gVU0CWGM2pBe0K7peblydxiLobPdQCoWdrOZCqpHVg+NTOkw+s2N6 woljNxHcXL416a++y+Cjr7YmIDEDjO0E4eGvQsAQTRQY4t4nqvSwg3WdEPCGsRYj8hzJ tiEQ== X-Gm-Message-State: ALQs6tBlgfmKwmUKyfbLyUj1nSOL5WauIfme5HxN4q37UmdPskugnrsv Jc39mjqou4sm2GR9LSG+DJ0yRA== X-Received: by 2002:adf:b18d:: with SMTP id q13-v6mr19265272wra.276.1525413672982; Thu, 03 May 2018 23:01:12 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id i30-v6sm32411863wra.38.2018.05.03.23.01.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 May 2018 23:01:12 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Yazen Ghannam , Ard Biesheuvel , linux-kernel@vger.kernel.org Subject: [PATCH 06/17] efi: Decode UEFI-defined IA32/X64 Error Structure GUIDs Date: Fri, 4 May 2018 07:59:52 +0200 Message-Id: <20180504060003.19618-7-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180504060003.19618-1-ard.biesheuvel@linaro.org> References: <20180504060003.19618-1-ard.biesheuvel@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yazen Ghannam For easier handling, match the known IA32/X64 error structure GUIDs to enums. Also, print out the name of the matching Error Structure Type. Only print the GUID for unknown types. GUIDs taken from UEFI 2.7 section N.2.4.2.1 IA32/X64 Processor Error Information Structure. Signed-off-by: Yazen Ghannam Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/cper-x86.c | 47 +++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) -- 2.17.0 diff --git a/drivers/firmware/efi/cper-x86.c b/drivers/firmware/efi/cper-x86.c index e0633a103fcf..5438097b93ac 100644 --- a/drivers/firmware/efi/cper-x86.c +++ b/drivers/firmware/efi/cper-x86.c @@ -11,17 +11,53 @@ #define VALID_CPUID_INFO BIT_ULL(1) #define VALID_PROC_ERR_INFO_NUM(bits) (((bits) & GENMASK_ULL(7, 2)) >> 2) +#define INFO_ERR_STRUCT_TYPE_CACHE \ + GUID_INIT(0xA55701F5, 0xE3EF, 0x43DE, 0xAC, 0x72, 0x24, 0x9B, \ + 0x57, 0x3F, 0xAD, 0x2C) +#define INFO_ERR_STRUCT_TYPE_TLB \ + GUID_INIT(0xFC06B535, 0x5E1F, 0x4562, 0x9F, 0x25, 0x0A, 0x3B, \ + 0x9A, 0xDB, 0x63, 0xC3) +#define INFO_ERR_STRUCT_TYPE_BUS \ + GUID_INIT(0x1CF3F8B3, 0xC5B1, 0x49a2, 0xAA, 0x59, 0x5E, 0xEF, \ + 0x92, 0xFF, 0xA6, 0x3C) +#define INFO_ERR_STRUCT_TYPE_MS \ + GUID_INIT(0x48AB7F57, 0xDC34, 0x4f6c, 0xA7, 0xD3, 0xB0, 0xB5, \ + 0xB0, 0xA7, 0x43, 0x14) + #define INFO_VALID_CHECK_INFO BIT_ULL(0) #define INFO_VALID_TARGET_ID BIT_ULL(1) #define INFO_VALID_REQUESTOR_ID BIT_ULL(2) #define INFO_VALID_RESPONDER_ID BIT_ULL(3) #define INFO_VALID_IP BIT_ULL(4) +enum err_types { + ERR_TYPE_CACHE = 0, + ERR_TYPE_TLB, + ERR_TYPE_BUS, + ERR_TYPE_MS, + N_ERR_TYPES +}; + +static enum err_types cper_get_err_type(const guid_t *err_type) +{ + if (guid_equal(err_type, &INFO_ERR_STRUCT_TYPE_CACHE)) + return ERR_TYPE_CACHE; + else if (guid_equal(err_type, &INFO_ERR_STRUCT_TYPE_TLB)) + return ERR_TYPE_TLB; + else if (guid_equal(err_type, &INFO_ERR_STRUCT_TYPE_BUS)) + return ERR_TYPE_BUS; + else if (guid_equal(err_type, &INFO_ERR_STRUCT_TYPE_MS)) + return ERR_TYPE_MS; + else + return N_ERR_TYPES; +} + void cper_print_proc_ia(const char *pfx, const struct cper_sec_proc_ia *proc) { int i; struct cper_ia_err_info *err_info; char newpfx[64]; + u8 err_type; if (proc->validation_bits & VALID_LAPIC_ID) printk("%sLocal APIC_ID: 0x%llx\n", pfx, proc->lapic_id); @@ -38,8 +74,15 @@ void cper_print_proc_ia(const char *pfx, const struct cper_sec_proc_ia *proc) for (i = 0; i < VALID_PROC_ERR_INFO_NUM(proc->validation_bits); i++) { printk("%sError Information Structure %d:\n", pfx, i); - printk("%sError Structure Type: %pUl\n", newpfx, - &err_info->err_type); + err_type = cper_get_err_type(&err_info->err_type); + printk("%sError Structure Type: %s\n", newpfx, + err_type < ARRAY_SIZE(cper_proc_error_type_strs) ? + cper_proc_error_type_strs[err_type] : "unknown"); + + if (err_type >= N_ERR_TYPES) { + printk("%sError Structure Type: %pUl\n", newpfx, + &err_info->err_type); + } if (err_info->validation_bits & INFO_VALID_CHECK_INFO) { printk("%sCheck Information: 0x%016llx\n", newpfx,