From patchwork Wed Aug 23 13:44:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 9917423 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CED1960327 for ; Wed, 23 Aug 2017 13:47:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0A0328989 for ; Wed, 23 Aug 2017 13:47:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2F602898C; Wed, 23 Aug 2017 13:47:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2F2EF28989 for ; Wed, 23 Aug 2017 13:47:14 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dkVxm-0004Mn-Cp; Wed, 23 Aug 2017 13:44:54 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dkVxk-0004MY-6Y for xen-devel@lists.xenproject.org; Wed, 23 Aug 2017 13:44:52 +0000 Received: from [85.158.139.211] by server-7.bemta-5.messagelabs.com id 02/C5-02176-3D68D995; Wed, 23 Aug 2017 13:44:51 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprIIsWRWlGSWpSXmKPExsXitHRDpO7Ftrm RBv+eW1t83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBlnfvxiLJggU3F452vWBsZN4l2MnBwSAv4S /8+9YAWx2QR0JC7O3cnWxcjBISKgInF7r0EXIxcHs8BrRolJd36ygdQICzhLvJzXwgJiswioS uz6cQIszitgKbF63QZmiJl6Em8nvmCEiAtKnJz5BKyeWUBTonX7b3YIW16ieetssHohAUWJ/n kP2CYw8sxC0jILScssJC0LGJlXMWoUpxaVpRbpGprrJRVlpmeU5CZm5ugaGpjq5aYWFyemp+Y kJhXrJefnbmIEBg8DEOxgvHja8xCjJAeTkiivps7cSCG+pPyUyozE4oz4otKc1OJDjDIcHEoS vIGtQDnBotT01Iq0zBxgGMOkJTh4lER4I0DSvMUFibnFmekQqVOMuhwdM35+YxJiycvPS5US5 50JUiQAUpRRmgc3AhZTlxhlpYR5GYGOEuIpSC3KzSxBlX/FKM7BqCTMux5kCk9mXgncpldARz ABHTHpxByQI0oSEVJSDYxu3lOLnfI0vnbNejn/sp72mUvxTTNX1Lefq1HONG5wVZr7RrP9YMp 5x6orzbzPr+yokc0piGr6eaapZW3V88DXbWrVp19rPtax6r5YevP0Rs+cRbKRF65WRSsJ2P71 484OWvW1KSIgNHLOtGAT1Y0+76a/av4yYenaiqNJi7mdGHbzLomSSlRiKc5INNRiLipOBACMW cbkpAIAAA== X-Env-Sender: prvs=401e59dfb=roger.pau@citrix.com X-Msg-Ref: server-12.tower-206.messagelabs.com!1503495888!72230231!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 59346 invoked from network); 23 Aug 2017 13:44:49 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-12.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 23 Aug 2017 13:44:49 -0000 X-IronPort-AV: E=Sophos;i="5.41,417,1498521600"; d="scan'208";a="436562177" From: Roger Pau Monne To: Date: Wed, 23 Aug 2017 14:44:25 +0100 Message-ID: <20170823134425.73792-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.11.0 (Apple Git-81) MIME-Version: 1.0 Cc: Wei Liu , Andrew Cooper , Ian Jackson , Chris Gilbert , Jan Beulich , Roger Pau Monne Subject: [Xen-devel] [PATCH v2] hvmloader: add fields for SMBIOS 2.4 compliance X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP The version of SMBIOS set in the entry point is 2.4, however several structures are missing fields required by 2.4. Fix this by adding the missing fields, this is based on the documents found at the DMTF site [0]. Most fields are set to 0 (undefined/not specified), except for the cache related handlers that need to be initialized to 0xffff in order to signal that the information is not provided. [0] https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.1.1.pdf Signed-off-by: Roger Pau Monné Reported by: Chris Gilbert Reviewed-by: Wei Liu --- Cc: Jan Beulich Cc: Andrew Cooper Cc: Ian Jackson Cc: Wei Liu Cc: Chris Gilbert --- It seems like the code in smbios likes to initialize everything to 0, but I don't see the value in that since the struct is already memset to 0. --- Changes since v1: - Add the contained elements array. --- tools/firmware/hvmloader/smbios.c | 3 +++ tools/firmware/hvmloader/smbios_types.h | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/tools/firmware/hvmloader/smbios.c b/tools/firmware/hvmloader/smbios.c index 210c7b0d35..2c1da7b38e 100644 --- a/tools/firmware/hvmloader/smbios.c +++ b/tools/firmware/hvmloader/smbios.c @@ -608,6 +608,9 @@ smbios_type_4_init( p->status = 0x41; /* socket populated, CPU enabled */ p->upgrade = 0x01; /* other */ + p->l1_cache_handle = 0xffff; /* No cache information structure provided. */ + p->l2_cache_handle = 0xffff; /* No cache information structure provided. */ + p->l3_cache_handle = 0xffff; /* No cache information structure provided. */ start += sizeof(struct smbios_type_4); diff --git a/tools/firmware/hvmloader/smbios_types.h b/tools/firmware/hvmloader/smbios_types.h index e924f819b3..acb63e2fe9 100644 --- a/tools/firmware/hvmloader/smbios_types.h +++ b/tools/firmware/hvmloader/smbios_types.h @@ -92,6 +92,13 @@ struct smbios_type_2 { uint8_t serial_number_str; } __attribute__ ((packed)); +/* System Enclosure - Contained Elements */ +struct smbios_contained_element { + uint8_t type; + uint8_t minimum; + uint8_t maximum; +} __attribute__ ((packed)); + /* SMBIOS type 3 - System Enclosure */ struct smbios_type_3 { struct smbios_structure_header header; @@ -104,6 +111,12 @@ struct smbios_type_3 { uint8_t power_supply_state; uint8_t thermal_state; uint8_t security_status; + uint32_t oem_specific; + uint8_t height; + uint8_t number_of_power_cords; + uint8_t contained_element_count; + uint8_t contained_element_length; + struct smbios_contained_element contained_elements[]; } __attribute__ ((packed)); /* SMBIOS type 4 - Processor Information */ @@ -121,6 +134,12 @@ struct smbios_type_4 { uint16_t current_speed; uint8_t status; uint8_t upgrade; + uint16_t l1_cache_handle; + uint16_t l2_cache_handle; + uint16_t l3_cache_handle; + uint8_t serial_number_str; + uint8_t asset_tag_str; + uint8_t part_number_str; } __attribute__ ((packed)); /* SMBIOS type 11 - OEM Strings */ @@ -158,6 +177,11 @@ struct smbios_type_17 { uint8_t bank_locator_str; uint8_t memory_type; uint16_t type_detail; + uint16_t speed; + uint8_t manufacturer_str; + uint8_t serial_number_str; + uint8_t asset_tag_str; + uint8_t part_number_str; } __attribute__ ((packed)); /* SMBIOS type 19 - Memory Array Mapped Address */