Received: by 10.213.65.68 with SMTP id h4csp2119881imn; Sun, 8 Apr 2018 20:11:47 -0700 (PDT) X-Google-Smtp-Source: AIpwx48tXHoQfnsU00hI/gp4wu3tRAUFM82GYEn2VZWEdIGX4vKriot/+c1Pco1YxdtXuPwG/WNs X-Received: by 2002:a17:902:a701:: with SMTP id w1-v6mr36490465plq.109.1523243507926; Sun, 08 Apr 2018 20:11:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243507; cv=none; d=google.com; s=arc-20160816; b=yNGx4rgvlam61ex89Kn2fnJ20sJoUMFZ/pBOUP00MUVgUCHqMXgMRXl8ThG9GhpdDs ueEQFpEtIQxmVMzmyiuJERBfWyKBHqd1u8Ox0bMg1XZNZru/Sdzs39KU8f3pWsVQfGEb 0XMwLReViS/c6h+zuD05hTdzbxl9+Tr4yye2gFveaRQ3bEPctjAvtK9DVs78cehYiW9r QLoRd4bmdXsX0osQ2fflj/nThL3eeEG6/zm90SO9+8BDS/tN1T+xkDK4VGVV5xgtYX3L 96R/6cbaXX+LBUh0/bCq1F9ADP+CLTNILDx+ksrdjdmVFq2l/+0BYPczC0Rhnmr+fe2d nyOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=uVfZjqFd8XwtPCM9hz7ZCM0CvuJSF7Bqwcv0Rb/x5Yk=; b=eCkdHmj4KxV5D/oW+37O/aDmw0QqLhIlUKh9pztvHfr8ZIOQqZEv1/E39waLfH8yTz /V2iSIfshWfmBv7q9qKk/4wWRBf11BAV3M2Ken8ID6RLsiVZzfZn+MygmUR8rDCfSWHz AD4JdqpS22OHN1jj8c/5es/5n+biavvc36sPrcQWIKEOJJqc5mJgGkAItLnLUt9gSdBt 0LbTprt4VleAEASeYveSuM5VpWCdIY75Z4TV8K9a1hipSDLKoKstQTMBgOOrTZVPnB83 Qmh8fnGxxFOi29H1Twmqhm/nojc1f6xpOrCTn2/r0lQD2Rmmx9DZkHtpsxXQqs/6I1XU OIOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=dX7eQNmx; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h7-v6si14979457pln.648.2018.04.08.20.11.11; Sun, 08 Apr 2018 20:11:47 -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=@microsoft.com header.s=selector1 header.b=dX7eQNmx; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757956AbeDIC3f (ORCPT + 99 others); Sun, 8 Apr 2018 22:29:35 -0400 Received: from mail-bn3nam01on0096.outbound.protection.outlook.com ([104.47.33.96]:38912 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755862AbeDIA2g (ORCPT ); Sun, 8 Apr 2018 20:28:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=uVfZjqFd8XwtPCM9hz7ZCM0CvuJSF7Bqwcv0Rb/x5Yk=; b=dX7eQNmxCL2lkX8pXt4QSIWfQDD88D+dbeBtSc2lwI2BeDop7OAhuNGan+KRIH6VAIRfy18ZRH4sjUIm0R9I4UD7nroVP5UTqSjkutksWdcXavy3esDfq28Aj0dZtdUiTc3Ohl4FtRuzO3cvTWe3yWXTLZ5No+vbQg3R1IsLTrs= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0807.namprd21.prod.outlook.com (10.167.110.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.3; Mon, 9 Apr 2018 00:28:29 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:28:29 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Jean Delvare , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 077/293] firmware: dmi_scan: Look for SMBIOS 3 entry point first Thread-Topic: [PATCH AUTOSEL for 4.9 077/293] firmware: dmi_scan: Look for SMBIOS 3 entry point first Thread-Index: AQHTz5kKWdI6Q2i5GUOJsPM905/1IA== Date: Mon, 9 Apr 2018 00:23:54 +0000 Message-ID: <20180409002239.163177-77-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB0807;7:aver8n/GiLpLwPoEMQtM2m0AvqZESEre81tB7ZLCVutJUCOFSTwQvJ8Z4A7hVJ838eNBCl4UDJ1HP8Ds7TB5F0cpPF1al0MplaSu0GR6fOb7/pjTSfnmVIcCUZIcfB8g0MYDSL5P5Sajd6G4hMLqPJl1STT75YyPpnD0lcyoamFAX4b6CoKBIeP3dAPP7l/L7fQnaUxumk6ceWWXWEsghygIXDqAGSa0Mh6sQ2I6iQAWJUNk89MhD/RtKaJ7vpSs;20:Ia3i3bSSG7p+nl2lrKKxhHg3Yu7TFdEwG/HMIlbm1Qr6uxeY6ORsZc9yEjrwtYHW96ficaAute85qFtdTS1NGQzHOUBUwpMXKUcxHk5qzNXPag2ZkRclboQx0aLZMn7eUvYq72ejIRHP0BwryRdb60RNBlkE7n7gPEDrtUPsHA4= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 89190751-6f8d-4790-b4d9-08d59db0d148 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0807; x-ms-traffictypediagnostic: DM5PR2101MB0807: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231221)(944501327)(52105095)(3002001)(6055026)(61426038)(61427038)(6041310)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB0807;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0807; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39380400002)(39860400002)(396003)(366004)(376002)(346002)(199004)(189003)(14454004)(4326008)(54906003)(25786009)(53936002)(2900100001)(1076002)(3280700002)(6486002)(186003)(2616005)(68736007)(110136005)(11346002)(10090500001)(6116002)(107886003)(3846002)(36756003)(8676002)(72206003)(22452003)(66066001)(26005)(6512007)(478600001)(3660700001)(81156014)(86362001)(81166006)(86612001)(7736002)(305945005)(8936002)(10290500003)(6436002)(105586002)(6666003)(316002)(59450400001)(76176011)(5660300001)(476003)(106356001)(2906002)(6506007)(446003)(2501003)(99286004)(5250100002)(486006)(102836004)(97736004)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0807;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: r5AjRJSJjbx86f0Y4ibS7UN4cwyTv9Q5liS/Lm7mWw/C8G4SkFhqnTukRFc10EJVHcDaUWShJWHbMLodHR2TK5Ocvkqoc+3dkEFnzkpawy0w8ad0raiNqF2jSK2QEOOSiixGj72gHO8aGPWb22WFBuXwck4HE/i3Jbt+Yryu20maHA4NTnKvE28CbMT7LnQ69EQe7pOzHZ1npsufNwd3M4HozYI84iBfA9IYMmHBcFFPkD5FdpD9GIN7XB6GgijvxGk21t2exlCBAyN/3xH9zxQk34Dft+CaUIh60fwbhhqBkh3YaXWm21N3u1VVkfBoXEnjnRR6x4I9LwIqVahLWbKorgz1c+TMYtKt2k2rskMss9JoH6VY5xjZHrxEGe/6xTh29wATBSBoSvtZRlxqL2Hd1QOLCxUSW4NmUpc/aOw= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 89190751-6f8d-4790-b4d9-08d59db0d148 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:23:54.4093 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0807 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jean Delvare [ Upstream commit c9aba14362a6eec583819ec8f4b872c1816f5cbe ] Since version 3.0.0 of the SMBIOS specification, there can be multiple entry points in memory, pointing to one or two DMI tables. If both a 32-bit ("_SM_") entry point and a 64-bit ("_SM3_") entry point are present, the specification requires that the latter points to a table which is a super-set of the table pointed to by the former. Therefore we should give preference to the 64-bit ("_SM3_") entry point. However, currently the code is picking the first valid entry point it finds. Per specification, we should look for a 64-bit ("_SM3_") entry point first, and if we can't find any, look for a 32-bit ("_SM_" or "_DMI_") entry point. Modify the code to do that. Signed-off-by: Jean Delvare Signed-off-by: Sasha Levin --- drivers/firmware/dmi_scan.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index 88bebe1968b7..8590f94de9dc 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c @@ -648,6 +648,21 @@ void __init dmi_scan_machine(void) if (p =3D=3D NULL) goto error; =20 + /* + * Same logic as above, look for a 64-bit entry point + * first, and if not found, fall back to 32-bit entry point. + */ + memcpy_fromio(buf, p, 16); + for (q =3D p + 16; q < p + 0x10000; q +=3D 16) { + memcpy_fromio(buf + 16, q, 16); + if (!dmi_smbios3_present(buf)) { + dmi_available =3D 1; + dmi_early_unmap(p, 0x10000); + goto out; + } + memcpy(buf, buf + 16, 16); + } + /* * Iterate over all possible DMI header addresses q. * Maintain the 32 bytes around q in buf. On the @@ -658,7 +673,7 @@ void __init dmi_scan_machine(void) memset(buf, 0, 16); for (q =3D p; q < p + 0x10000; q +=3D 16) { memcpy_fromio(buf + 16, q, 16); - if (!dmi_smbios3_present(buf) || !dmi_present(buf)) { + if (!dmi_present(buf)) { dmi_available =3D 1; dmi_early_unmap(p, 0x10000); goto out; --=20 2.15.1