Received: by 10.213.65.68 with SMTP id h4csp2119340imn; Sun, 8 Apr 2018 20:10:59 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/kTUZwsBcKytWwbvrQMHJnTRHFYGesFfKjkLkVqgzNLqOtCtMpt1dDIqfqMO4tZrBliruw X-Received: by 10.99.95.22 with SMTP id t22mr24439680pgb.315.1523243372477; Sun, 08 Apr 2018 20:09:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243372; cv=none; d=google.com; s=arc-20160816; b=wcXDNM/g2XzXgP8X7mB8725+sBtSeMkK8qdVJf2y/Y/Rtk8qPnXag/Xlof5PMEXmP3 D7osXJYb0i2Pse0C4VEEzCAlmw+JUtlMvLNRf5nC4z84zJ/F/1HzKfABAK+oFfy6J02c 1BHBKrzKtFvNeVSyIhTo8nTQ9sJYKx0OyrUzb63+jGj9xWTlDAwtyYfOoppNvkaNTU3A ItVZPijVlfdIZXInoMka94yvy+sYYJL9ucDFgVwS26haVyMpte2m4NOvNP8Yb4/wKXiR NDE7s8U+YCgNY21h9ZeM3xMPXWOU7bAkNqBI5XNE1zVnK6PynzwxP4mOHn4T/N8pWuCD l4tA== 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=LhgDMcyASgoIhIh9f9KMXBuv0pcPadmFb0LXuTcs7/Q=; b=0LQNi12VxFMONRFtKZxldWLk0hEvWPUx0puI6Y/TX1yX6HL4eWOkvX1+K8/FI3DFaL DTLFbjuT0CIl6mD2W++0PJZGEUPM7wwsh+C7Ww0dkcE4SetDD+MDLNUwIEbmBExmYWD6 uSY3tUMhgJrAqWB6gQlw187cWUxmfpGHM8chl3N4KLb9VsMZlItnLmp/1aQGxsmUGaa7 GGXLZn68XvyASK/fjmMwPosIPWrF92cY/173qL0CJ8MrTeWn7MEDRYz7TQ493p1GfOAb U8ozNK4d+WVdoBpaCGV+Hepb3Z0g/uR8kn2Mwf/Aoi0xtpO5rmT20PRTgOIKt5i3WtHv RLRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Wf42+jCW; 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 r6-v6si13052544pls.527.2018.04.08.20.08.55; Sun, 08 Apr 2018 20:09:32 -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=Wf42+jCW; 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 S932700AbeDIBbe (ORCPT + 98 others); Sun, 8 Apr 2018 21:31:34 -0400 Received: from mail-sn1nam02on0132.outbound.protection.outlook.com ([104.47.36.132]:23728 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756608AbeDIAfw (ORCPT ); Sun, 8 Apr 2018 20:35:52 -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=LhgDMcyASgoIhIh9f9KMXBuv0pcPadmFb0LXuTcs7/Q=; b=Wf42+jCWwmFKlwCgufqqe7GpNfLKox4ZIEAB1etFdGmdSa6i+Iiq4dUVEBop4pgxPRX+XcGcdQqZL0a3x3KPe0hgxRIXA8OeJEz7r+fpWasE6X+N5mdBTYsK1jiqx3gH4X0letbHjJgOa0b7KLPhKJh1g12XTvLy3Pwl+gG56m0= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0725.namprd21.prod.outlook.com (10.167.107.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:35:49 +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:35:49 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Jean Delvare , Sasha Levin Subject: [PATCH AUTOSEL for 4.4 039/162] firmware: dmi_scan: Look for SMBIOS 3 entry point first Thread-Topic: [PATCH AUTOSEL for 4.4 039/162] firmware: dmi_scan: Look for SMBIOS 3 entry point first Thread-Index: AQHTz5mj22jjL0ZvXEudKeYVveElPw== Date: Mon, 9 Apr 2018 00:28:11 +0000 Message-ID: <20180409002738.163941-39-alexander.levin@microsoft.com> References: <20180409002738.163941-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002738.163941-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;DM5PR2101MB0725;7:kFs05iw6Ks0JJSIO3lmAO64kFH1i4ecrvVLwvR8fbRJUoR2gYErGFCd+SJMkRg07GeYfmCAMP3ofrt0c1jpq/xM3FX5OK9yOWwf2S3sddZARyDjbkhS+ZlKBqTDVOsggWzUnzxN8yWlbT/cV7jejM36sMNAg6Me8c4uq6YaTTNE+VjqgDSa6w7Ll7EuFo8gQaFMDeUNEM+LEc03X4ehU6gjEy80btMXCgHg1UYCTHnbGKTFgeVBbD3eJjmefk1ha;20:6qDBTsZhCAbGVvwQLUODEMmV3x86zru7SXHeoL/kRififbjB8hSR2isyiAiN2S03exRb8eKs6ZwNw6MK2DSZppnQmv44yx3xW5NLfX+YL82BwplGOgJclW5GYD4LdU8ijjCW0UThi3v7g8CGsJki7+2+fYazmVypwXqClNoC+nw= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: cdaca739-6a9d-4923-ad3a-08d59db1d7e0 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0725; x-ms-traffictypediagnostic: DM5PR2101MB0725: 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)(10201501046)(3231221)(944501327)(52105095)(93006095)(93001095)(3002001)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB0725;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0725; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39860400002)(396003)(376002)(39380400002)(346002)(366004)(189003)(199004)(86612001)(102836004)(5660300001)(14454004)(476003)(68736007)(11346002)(66066001)(446003)(99286004)(76176011)(486006)(10090500001)(3660700001)(110136005)(305945005)(106356001)(316002)(105586002)(3280700002)(59450400001)(3846002)(10290500003)(6116002)(22452003)(6506007)(2616005)(1076002)(7736002)(54906003)(478600001)(2900100001)(2501003)(5250100002)(8936002)(25786009)(81156014)(8676002)(6666003)(6436002)(4326008)(26005)(6512007)(6486002)(81166006)(107886003)(53936002)(2906002)(86362001)(186003)(97736004)(36756003)(72206003)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0725;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: V1qW7pQIwOvEHqgqgnjPNQXdB8Ljywust7/20vUliDuT/EVkgE7u0/WXNXJzVDCztehAozSx9G4iogru7+2Egzy7Tnazsrnw22OtoQ6zRUVPnPBC4Z3Qz+1pdTcAC24Eh1mqeF3T5WAbxFlrTQEo1R5YI3s8uKdu5/wH4KANWBYZVqFyGBbEbhssK6ywHGQCur+ajvR1sOr+d4CbfDC6PeaZ2V3tfMUkKqGuNxOpnD0iFkgwhf6es8Ft1MTRVptjENi2u/xSB1L2Wjlgu8LaP9SylSTKiV0muuiDJkS2oQ8C91nq2Awakx6DM5zKsRuzHzbw4310kFTpctfbr1DiyodfuZavk129Ov71vyBvLpbLZXnDV1TXjlibnptgS0c+olm7lSS68r6VyMNuJRyVAngxvjZPwTleL91hnL8jK04= 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: cdaca739-6a9d-4923-ad3a-08d59db1d7e0 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:28:11.1455 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0725 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 0e08e665f715..f1d4881dd2fc 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c @@ -626,6 +626,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 @@ -636,7 +651,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