From patchwork Thu Mar 28 19:34:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 161333 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1122565jan; Thu, 28 Mar 2019 12:34:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqynhOl87btbwpYtVLoZgr7yl08JrtxfoVRutue/Avli0emFebOwg//E7RBAC/XUOv/hOvjf X-Received: by 2002:a17:902:3f83:: with SMTP id a3mr42399599pld.6.1553801695762; Thu, 28 Mar 2019 12:34:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553801695; cv=none; d=google.com; s=arc-20160816; b=LDLMndPGNSvUP4GkHsyLkPbKTlzNVB2UNoNdoLdq2jMLFNILbST4yAaUIWWVLF98q8 S2NUsEzcFEUYx+qxwV+Mp/eW8Yd/X6J8eprsnk4sUSVzlklGmBwtCPP7UcOL3mBFIlsY OJ9adKggFM6xZdOC4CbAUV8pQScj4VaAIKmxu/GOFOtuNLs6XgvJEWNcFk5uyVXkkdZg bRPqJicHKKCxpsOLekOyFz/soehvH7cfgvz1oCdpS0llenCmwmXvwOhMR2Z6+flWYoOu QHl9/UIm5rcW7FwDtkduRcRx2nf/UFATIYZpAhLwuBkodsHsWw+VISDZ1Qvr+S4HQv4K yXTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BLhZJfqzPBQPaOfw6+hXJCxqv7TmfGdAb1ivjJuJyjA=; b=dV8tLhLdFMiwkTsyzPiwVYTPTeDUu9/gcOa9Xh9pvDLdfBWGZ49NNIJE9PCLJX75VR W3ybvZnRlfUGchCOD/Tpk7lZllLmcN8RqCjWDl6S3sHutlaiKEjyDEPu+aNrZMvJp/sx /pNQNSsjAp4Sz0sRxdwbaSF9J6HCFjha3fkpnupOuC1s/rQUeEeK6pLOpg8aEP88l5Dd +RBYxNLjil7OO+hGJuqmoXybsygN1wV0kH/hIo/0J5NHtGMYPFcJb8KQbC8EowCJD5UW QhlWue0wiJTuUxI694MFV+mZhbLsOHQdKfFzgWMGkPCwsBEe4i2pZ3W4Il2obrtCMZd9 SeaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MWPZv7J6; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-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 w7si21069172pgs.155.2019.03.28.12.34.55; Thu, 28 Mar 2019 12:34:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-efi-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=MWPZv7J6; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-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 S1726195AbfC1Tey (ORCPT + 3 others); Thu, 28 Mar 2019 15:34:54 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:54869 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726491AbfC1Tep (ORCPT ); Thu, 28 Mar 2019 15:34:45 -0400 Received: by mail-wm1-f66.google.com with SMTP id f3so50503wmj.4 for ; Thu, 28 Mar 2019 12:34:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BLhZJfqzPBQPaOfw6+hXJCxqv7TmfGdAb1ivjJuJyjA=; b=MWPZv7J6oPHLFpXOfSZPgQsHD4lk1Ew1EFrZb4EvnJPQrkQweJ5QKwXNSYAUFsWm4G qvvoRChx5c+Xo71Hw4slvs2orT5RxOZLxX+0gvRisUe590glKi3J6HYDMbGM+myrZM5B uV8Be09ACwfaXSyTBOF2E/B52k25wrzumpZfhIRXFf4lL5dNk2cXczXwttNRQV8zBXkD bYZtiIQPjGB1FXi06Gdg99bncrmAkki7uTXWDPOdST/OsAeHkeSbVli2Zgy61ZUGyyve 10q3U0nQrRJQ7OlW3akOZ3Ic3pN6MdKh/wiOw1hUBaygeVaeuldnyrk4NWBITbK0tDU7 Q+Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BLhZJfqzPBQPaOfw6+hXJCxqv7TmfGdAb1ivjJuJyjA=; b=EzSoWKm5+QoOxGSjHxFUj1EPEkRiiGoK88mkrlNIyfmOiRFsEsImgYnlQ2AVw4h65d frZQje6P0TIXONpQoXVuRpFADLkTQCi6oqUqWszA+rtX4wMhL/LwClEr4NRKQxFWJ6mY iCuAfToyQQEz7pAR3teQehCYoUBgDg14jYrcNMr5JKneXs8hfiYcgMgzKzxOdRcMzrzu wOj4guSH1vPC3EmWvxfDTCI/iWdnU14Kck5l31YvW7Pq7CIkshlsh27D7Knsjhm5tMKv iFOnFnjaweP21qQnVWQdLrfTtKlp2ispMKq+lJz2xs4/svGId3xgojR9SYyYHuAULV87 YsRQ== X-Gm-Message-State: APjAAAUAt1m2EzxGQfVH+17gOTifkLKkhEBLW78hh+Xkntf748fLdpz8 Unl9SgAcmHYUAyZjIa40OegaXK6brCno3w== X-Received: by 2002:a1c:2b41:: with SMTP id r62mr1046476wmr.94.1553801683104; Thu, 28 Mar 2019 12:34:43 -0700 (PDT) Received: from sudo.home ([2a01:cb1d:112:6f00:dd62:8a50:1468:989d]) by smtp.gmail.com with ESMTPSA id d6sm27739186wrx.62.2019.03.28.12.34.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Mar 2019 12:34:42 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Robert Richter , Ard Biesheuvel , linux-kernel@vger.kernel.org, Jean Delvare Subject: [PATCH 4/5] efi: Unify dmi setup code over architectures arm/arm64, ia64 and x86 Date: Thu, 28 Mar 2019 20:34:28 +0100 Message-Id: <20190328193429.21373-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190328193429.21373-1-ard.biesheuvel@linaro.org> References: <20190328193429.21373-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org From: Robert Richter All architectures (arm/arm64, ia64 and x86) do the same here, so unify the code. Note: We do not need to call dump_stack_set_arch_desc() in case of !dmi_available. Both strings, dmi_ids_string and dump_stack_arch_ desc_str are initialized zero and thus nothing would change. Signed-off-by: Robert Richter Reviewed-by: Jean Delvare Signed-off-by: Ard Biesheuvel --- arch/ia64/kernel/setup.c | 4 +--- arch/x86/kernel/setup.c | 6 ++---- drivers/firmware/dmi_scan.c | 28 +++++++++++++++------------- drivers/firmware/efi/arm-runtime.c | 7 ++----- include/linux/dmi.h | 8 ++------ 5 files changed, 22 insertions(+), 31 deletions(-) -- 2.20.1 diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c index 583a3746d70b..c9cfa760cd57 100644 --- a/arch/ia64/kernel/setup.c +++ b/arch/ia64/kernel/setup.c @@ -1058,9 +1058,7 @@ check_bugs (void) static int __init run_dmi_scan(void) { - dmi_scan_machine(); - dmi_memdev_walk(); - dmi_set_dump_stack_arch_desc(); + dmi_setup(); return 0; } core_initcall(run_dmi_scan); diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 3d872a527cd9..3773905cd2c1 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -1005,13 +1005,11 @@ void __init setup_arch(char **cmdline_p) if (efi_enabled(EFI_BOOT)) efi_init(); - dmi_scan_machine(); - dmi_memdev_walk(); - dmi_set_dump_stack_arch_desc(); + dmi_setup(); /* * VMware detection requires dmi to be available, so this - * needs to be done after dmi_scan_machine(), for the boot CPU. + * needs to be done after dmi_setup(), for the boot CPU. */ init_hypervisor_platform(); diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index 099d83e4e910..fae2d5c43314 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c @@ -416,11 +416,8 @@ static void __init save_mem_devices(const struct dmi_header *dm, void *v) nr++; } -void __init dmi_memdev_walk(void) +static void __init dmi_memdev_walk(void) { - if (!dmi_available) - return; - if (dmi_walk_early(count_mem_devices) == 0 && dmi_memdev_nr) { dmi_memdev = dmi_alloc(sizeof(*dmi_memdev) * dmi_memdev_nr); if (dmi_memdev) @@ -614,7 +611,7 @@ static int __init dmi_smbios3_present(const u8 *buf) return 1; } -void __init dmi_scan_machine(void) +static void __init dmi_scan_machine(void) { char __iomem *p, *q; char buf[32]; @@ -769,15 +766,20 @@ static int __init dmi_init(void) subsys_initcall(dmi_init); /** - * dmi_set_dump_stack_arch_desc - set arch description for dump_stack() + * dmi_setup - scan and setup DMI system information * - * Invoke dump_stack_set_arch_desc() with DMI system information so that - * DMI identifiers are printed out on task dumps. Arch boot code should - * call this function after dmi_scan_machine() if it wants to print out DMI - * identifiers on task dumps. + * Scan the DMI system information. This setups DMI identifiers + * (dmi_system_id) for printing it out on task dumps and prepares + * DIMM entry information (dmi_memdev_info) from the SMBIOS table + * for using this when reporting memory errors. */ -void __init dmi_set_dump_stack_arch_desc(void) +void __init dmi_setup(void) { + dmi_scan_machine(); + if (!dmi_available) + return; + + dmi_memdev_walk(); dump_stack_set_arch_desc("%s", dmi_ids_string); } @@ -841,7 +843,7 @@ static bool dmi_is_end_of_table(const struct dmi_system_id *dmi) * returns non zero or we hit the end. Callback function is called for * each successful match. Returns the number of matches. * - * dmi_scan_machine must be called before this function is called. + * dmi_setup must be called before this function is called. */ int dmi_check_system(const struct dmi_system_id *list) { @@ -871,7 +873,7 @@ EXPORT_SYMBOL(dmi_check_system); * Walk the blacklist table until the first match is found. Return the * pointer to the matching entry or NULL if there's no match. * - * dmi_scan_machine must be called before this function is called. + * dmi_setup must be called before this function is called. */ const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list) { diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c index 4a0dfe4ab829..e2ac5fa5531b 100644 --- a/drivers/firmware/efi/arm-runtime.c +++ b/drivers/firmware/efi/arm-runtime.c @@ -162,14 +162,11 @@ void efi_virtmap_unload(void) static int __init arm_dmi_init(void) { /* - * On arm64/ARM, DMI depends on UEFI, and dmi_scan_machine() needs to + * On arm64/ARM, DMI depends on UEFI, and dmi_setup() needs to * be called early because dmi_id_init(), which is an arch_initcall * itself, depends on dmi_scan_machine() having been called already. */ - dmi_scan_machine(); - dmi_memdev_walk(); - if (dmi_available) - dmi_set_dump_stack_arch_desc(); + dmi_setup(); return 0; } core_initcall(arm_dmi_init); diff --git a/include/linux/dmi.h b/include/linux/dmi.h index c46fdb36700b..8de8c4f15163 100644 --- a/include/linux/dmi.h +++ b/include/linux/dmi.h @@ -102,9 +102,7 @@ const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list); extern const char * dmi_get_system_info(int field); extern const struct dmi_device * dmi_find_device(int type, const char *name, const struct dmi_device *from); -extern void dmi_scan_machine(void); -extern void dmi_memdev_walk(void); -extern void dmi_set_dump_stack_arch_desc(void); +extern void dmi_setup(void); extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp); extern int dmi_get_bios_year(void); extern int dmi_name_in_vendors(const char *str); @@ -122,9 +120,7 @@ static inline int dmi_check_system(const struct dmi_system_id *list) { return 0; static inline const char * dmi_get_system_info(int field) { return NULL; } static inline const struct dmi_device * dmi_find_device(int type, const char *name, const struct dmi_device *from) { return NULL; } -static inline void dmi_scan_machine(void) { return; } -static inline void dmi_memdev_walk(void) { } -static inline void dmi_set_dump_stack_arch_desc(void) { } +static inline void dmi_setup(void) { } static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp) { if (yearp)