From patchwork Tue Nov 28 00:55:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Neri X-Patchwork-Id: 841921 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3ym4yV1GK8z9s4s; Tue, 28 Nov 2017 11:57:38 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1eJUDO-0002SC-OE; Tue, 28 Nov 2017 00:57:34 +0000 Received: from mga01.intel.com ([192.55.52.88]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1eJUDM-0002Rw-E9 for fwts-devel@lists.ubuntu.com; Tue, 28 Nov 2017 00:57:32 +0000 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Nov 2017 16:57:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,466,1505804400"; d="scan'208";a="180899125" Received: from voyager.sc.intel.com ([10.3.52.139]) by fmsmga005.fm.intel.com with ESMTP; 27 Nov 2017 16:57:30 -0800 From: Ricardo Neri To: Alex Hung , Colin Ian King Subject: [PATCH] acpi: madt: only inspect Local APIC/x2APIC/SAPIC tables if enabled Date: Mon, 27 Nov 2017 16:55:54 -0800 Message-Id: <1511830554-6602-1-git-send-email-ricardo.neri-calderon@linux.intel.com> X-Mailer: git-send-email 2.7.4 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bin Song , fwts-devel@lists.ubuntu.com MIME-Version: 1.0 Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" The Advanced Configuration and Power Interface (ACPI) specification version 6.2 Errata A in sections 5.2.12.2, 5.2.12.10 and 5.2.12.12 states that "when a processor is not present, the Processor Local APIC/x2APIC/ SAPIC information is either not reported or flagged as disabled." This implies that it is possible for firmware implementations to include Local APIC/SAPIC/x2APIC tables for non-existent processors provided that they are disabled. Thus, only test these tables if they have the Enable flag set. Otherwise, skip the test. Also, print a message to record the fact that these tables exist but are not tested. Signed-off-by: Ricardo Neri Reported-by: Bin Song Acked-by: Alex Hung Acked-by: Ivan Hu Acked-by: Colin Ian King --- src/acpi/madt/madt.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/acpi/madt/madt.c b/src/acpi/madt/madt.c index 3bbaf2f..f997a5f 100644 --- a/src/acpi/madt/madt.c +++ b/src/acpi/madt/madt.c @@ -546,6 +546,13 @@ static int madt_local_apic(fwts_framework *fw, fwts_acpi_madt_processor_local_apic *lapic = (fwts_acpi_madt_processor_local_apic *)data; + /* only test table if enabled */ + if (!(lapic->flags & 0x1)) { + fwts_skipped(fw, "MADT %s is disabled. Skipping test.", + madt_sub_names[hdr->type]); + goto out; + } + madt_find_processor_uid(fw, lapic->acpi_processor_id, "LAPIC"); if (lapic->flags & 0xfffffffe) @@ -561,6 +568,7 @@ static int madt_local_apic(fwts_framework *fw, "reserved and properly set to zero.", madt_sub_names[hdr->type]); +out: return (hdr->length - sizeof(fwts_acpi_madt_sub_table_header)); } @@ -780,6 +788,7 @@ static int madt_local_sapic(fwts_framework *fw, * initial boot state. */ + if (hdr->length != (strlen(lsapic->uid_string) + 16)) fwts_failed(fw, LOG_LEVEL_MEDIUM, "MADTLSAPICLength", @@ -792,6 +801,13 @@ static int madt_local_sapic(fwts_framework *fw, "MADT %s table length (%d) is correct.", madt_sub_names[hdr->type], hdr->length); + /* only continue testing table if enabled */ + if (!(lsapic->flags & 0x1)) { + fwts_skipped(fw, "MADT %s is disabled. Skipping test.", + madt_sub_names[hdr->type]); + goto out; + } + /* * There are three values that need to be checked for a valid * processor UID: the ACPI processor ID, the UID value, and the UID @@ -878,6 +894,7 @@ static int madt_local_sapic(fwts_framework *fw, "MADT %s UID string is an ASCII string.", madt_sub_names[hdr->type]); +out: return (hdr->length - sizeof(fwts_acpi_madt_sub_table_header)); } @@ -952,6 +969,13 @@ static int madt_local_x2apic(fwts_framework *fw, fwts_acpi_madt_local_x2apic *lx2apic = (fwts_acpi_madt_local_x2apic *)data; + /* only test table if enabled */ + if (!(lx2apic->flags & 0x1)) { + fwts_skipped(fw, "MADT %s is disabled. Skipping test.", + madt_sub_names[hdr->type]); + goto out; + } + if (lx2apic->reserved) fwts_failed(fw, LOG_LEVEL_MEDIUM, "MADTLX2APICReservedNonZero", @@ -980,6 +1004,7 @@ static int madt_local_x2apic(fwts_framework *fw, madt_find_processor_uid(fw, lx2apic->processor_uid, "X2APIC"); +out: return (hdr->length - sizeof(fwts_acpi_madt_sub_table_header)); }