Received: by 10.223.185.116 with SMTP id b49csp3912481wrg; Mon, 26 Feb 2018 08:06:52 -0800 (PST) X-Google-Smtp-Source: AH8x2269MjEyRc5b0xRvcs08qPi5bgYzLvmUsmE2UE9ZAv4lLEQICdE+acjthmsIZYo+gPP35sno X-Received: by 10.101.93.17 with SMTP id e17mr8807740pgr.281.1519661212435; Mon, 26 Feb 2018 08:06:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519661212; cv=none; d=google.com; s=arc-20160816; b=WwJjvU0z8MTBLx8X6eVM1vnKyxErFyTs7kl0I8HQy3/ErV2ma9so1T7ZmctSthp792 G6Cqs+/AFegZAUJkQXndh7U0kAm4SBlpl9NEpOM8ye4eTSB2HeJfBVdseDUD7DbgocX4 fLwhpbGtldaIOMgyPh92nWGOs1BdAG03MUZ66cWekGdjk835AWkVxZj074Dyor1YlclL M8/q/lZEUQHoeufpd2G+FlXPvfN1uvyQwcYg94bCOFcJCxJVjcT20tkVMddkGPwycSts GZL1f5+2136/UwSOGgBHr72wVgFTcNBJPDKvOVTjNocfNMJbMrduYqawY6ixOC8kHgWJ FrcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=Rkdc4i1yXOLRDiFqBjNwRs7xSNL/QQEHoud8qUnQ1r8=; b=Dp+UoguS28Itw4KEQGgU2ojIIcTENVQlRM20lePV9sSCxNk9HmEtuX1yrqTOCEqmJ9 z5M8eN2pHJoDoegpjQibr+myoRc/7buh1751rISPdkA764XwlvBEtUMWAwPfeLM601f3 762h12bt01dla0oP4ytsCfPy0WGQX34Nf7cWGGAsLAWPyrmCUVQPhnFNqimxaxnUlBMd cOcDLGqHHNcE5ujCoVSqx7Hpku3NQZVgjcQKBWPoAa/EkT/yY5bkLMZQ94eaZ1fVxE7s h1HU7D0IasvfzOwz99W4970q8qA1u0EUELg2sJI+IIjIDXhK1OqD8iJl7BsZAQjiu1UF MHXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JrusxlL6; 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 l4-v6si7166193pln.121.2018.02.26.08.06.32; Mon, 26 Feb 2018 08:06:52 -0800 (PST) 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=JrusxlL6; 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 S1752137AbeBZQEg (ORCPT + 99 others); Mon, 26 Feb 2018 11:04:36 -0500 Received: from mail-io0-f194.google.com ([209.85.223.194]:38472 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751845AbeBZQEf (ORCPT ); Mon, 26 Feb 2018 11:04:35 -0500 Received: by mail-io0-f194.google.com with SMTP id g21so17739236ioj.5 for ; Mon, 26 Feb 2018 08:04:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Rkdc4i1yXOLRDiFqBjNwRs7xSNL/QQEHoud8qUnQ1r8=; b=JrusxlL6fpoxkPh3+ewFZ3cfmnOykehbz05CTMi4Fc1DCQc/wrJmzWcCPhIIMNDiu0 AtIp+7YD5oYfyLKM0cfxEfAqHgREBaZ+OhOdk6/OVVIzcD8fF8/eOBhfF4ijDzCb9NCE zzcz1kQ/gWIJFfZXcZCiq9w3mM+96etXdpjkE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Rkdc4i1yXOLRDiFqBjNwRs7xSNL/QQEHoud8qUnQ1r8=; b=hPD6I8YWhOWHRFSVc5l4x2lfxcTA9kpORIRmvnI+hDcHZ7Xy1chHbMh7dHz/m6GhuA njqXblt1+46o4phurp8KrYU1ZKcoulvkYaRdBLpLP1e/Xi7VZSfYpPyu6pI1KCLqZDjg jbZl7vMTSIno6BGVwep1ERhvedLHpeJMvEl+tIAKP/9Jk+G/RilsBznHZ/M95ISIe+8V B3bpGXFspXzKAPffDHj4KnQc3xyG+WQ0sjzr9F+HZch8JCfjOPwrMaL0NVVE2LfcPVui m8LOGIx27XHLLO1MMyB7g2iWi8EeVSyuuAuewDzS0jCb2bKn0PPG/FdOgY5t5HZ/3ByB 72Bg== X-Gm-Message-State: APf1xPCxL4TpGnxXebGPEsIPv/Co9nW2x36D3kau9reWe/W8wY1PwW0q dnYrNfha1nfYRHHVUujFm6FqEp3VwduikfEtqNylYg== X-Received: by 10.107.56.69 with SMTP id f66mr12257186ioa.170.1519661074349; Mon, 26 Feb 2018 08:04:34 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.138.209 with HTTP; Mon, 26 Feb 2018 08:04:33 -0800 (PST) In-Reply-To: References: <20180223200333.6410-1-Yazen.Ghannam@amd.com> <20180223200333.6410-4-Yazen.Ghannam@amd.com> From: Ard Biesheuvel Date: Mon, 26 Feb 2018 16:04:33 +0000 Message-ID: Subject: Re: [PATCH 3/8] efi: Decode IA32/X64 Processor Error Info Structure To: "Ghannam, Yazen" Cc: "linux-efi@vger.kernel.org" , Linux Kernel Mailing List , Borislav Petkov , "the arch/x86 maintainers" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26 February 2018 at 16:00, Ghannam, Yazen wrote: >> -----Original Message----- >> From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org] >> Sent: Saturday, February 24, 2018 11:40 AM >> To: Ghannam, Yazen >> Cc: linux-efi@vger.kernel.org; Linux Kernel Mailing List > kernel@vger.kernel.org>; Borislav Petkov ; the arch/x86 >> maintainers >> Subject: Re: [PATCH 3/8] efi: Decode IA32/X64 Processor Error Info Structure >> > ... >> > >> > diff --git a/drivers/firmware/efi/cper-x86.c b/drivers/firmware/efi/cper- >> x86.c >> > index b50ee3cdf637..9d608f742c98 100644 >> > --- a/drivers/firmware/efi/cper-x86.c >> > +++ b/drivers/firmware/efi/cper-x86.c >> > @@ -4,15 +4,28 @@ >> > >> > #include >> > >> > +#define INDENT_SP " " >> > + >> > /* >> > * We don't need a "CPER_IA" prefix since these are all locally defined. >> > * This will save us a lot of line space. >> > */ >> > #define VALID_LAPIC_ID BIT_ULL(0) >> > #define VALID_CPUID_INFO BIT_ULL(1) >> > +#define VALID_PROC_ERR_INFO_NUM(bits) ((bits & GENMASK_ULL(7, 2)) >> >> 2) >> > + >> >> Parens around 'bits' please >> > > Like this? > > #define VALID_PROC_ERR_INFO_NUM(bits) (((bits) & GENMASK_ULL(7, 2)) >> 2) > Yes. Your code currently does not pass expressions into these, but it is good form to use parens here to make them future proof > I'll do the same for the others. > Cheers >> > +#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) >> > >> > 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]; >> > + >> > printk("%sValidation Bits: 0x%016llx\n", pfx, proc->validation_bits); >> > >> > if (proc->validation_bits & VALID_LAPIC_ID) >> > @@ -23,4 +36,44 @@ void cper_print_proc_ia(const char *pfx, const struct >> cper_sec_proc_ia *proc) >> > print_hex_dump(pfx, "", DUMP_PREFIX_OFFSET, 16, 4, proc- >> >cpuid, >> > sizeof(proc->cpuid), 0); >> > } >> > + >> > + snprintf(newpfx, sizeof(newpfx), "%s%s", pfx, INDENT_SP); >> > + >> > + err_info = (struct cper_ia_err_info *)(proc + 1); >> > + 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); >> > + >> >> The indentation is a bit awkward here. Could you please align followup >> lines with the character following the ( on the first line? >> > > Yes, will do. > >> > + printk("%sValidation Bits: 0x%016llx\n", >> > + newpfx, err_info->validation_bits); >> > + >> > + if (err_info->validation_bits & INFO_VALID_CHECK_INFO) { >> > + printk("%sCheck Information: 0x%016llx\n", newpfx, >> > + err_info->check_info); >> > + } >> > + >> > + if (err_info->validation_bits & INFO_VALID_TARGET_ID) { >> > + printk("%sTarget Identifier: 0x%016llx\n", >> > + newpfx, err_info->target_id); >> > + } >> > + >> > + if (err_info->validation_bits & INFO_VALID_REQUESTOR_ID) { >> > + printk("%sRequestor Identifier: 0x%016llx\n", >> > + newpfx, err_info->requestor_id); >> > + } >> > + >> > + if (err_info->validation_bits & INFO_VALID_RESPONDER_ID) { >> > + printk("%sResponder Identifier: 0x%016llx\n", >> > + newpfx, err_info->responder_id); >> > + } >> > + >> > + if (err_info->validation_bits & INFO_VALID_IP) { >> > + printk("%sInstruction Pointer: 0x%016llx\n", >> > + newpfx, err_info->ip); >> > + } >> > + >> > + err_info++; >> > + } >> > } >> > -- >> > 2.14.1 >> >