From patchwork Fri Sep 18 14:14:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Salter X-Patchwork-Id: 7216591 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 154409F6DA for ; Fri, 18 Sep 2015 14:16:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 261DD207E6 for ; Fri, 18 Sep 2015 14:16:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4C226206E7 for ; Fri, 18 Sep 2015 14:16:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZcwRJ-0001QK-1H; Fri, 18 Sep 2015 14:15:01 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZcwRB-0001AJ-R1 for linux-arm-kernel@lists.infradead.org; Fri, 18 Sep 2015 14:14:54 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 1C3DE8E700; Fri, 18 Sep 2015 14:14:33 +0000 (UTC) Received: from deneb.redhat.com.localdomain (ovpn-113-192.phx2.redhat.com [10.3.113.192]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t8IEEW74030908; Fri, 18 Sep 2015 10:14:32 -0400 From: Mark Salter To: Catalin Marinas , Will Deacon Subject: [PATCH] arm64: dmi: initialize DMI earlier in boot Date: Fri, 18 Sep 2015 10:14:26 -0400 Message-Id: <1442585666-14093-1-git-send-email-msalter@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150918_071454_111720_50C7B952 X-CRM114-Status: GOOD ( 13.30 ) X-Spam-Score: -6.9 (------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Salter , Matt Fleming , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, DMI initialization takes place in a core initcall. This limits how early in boot the kernel can make DMI-based decisions about firmware/hardware quirks. This patch moves DMI initialization to setup_arch() so that DMI info is available before initcalls run. Signed-off-by: Mark Salter --- arch/arm64/include/asm/dmi.h | 19 ++++++++++++++++--- arch/arm64/kernel/efi.c | 15 --------------- arch/arm64/kernel/setup.c | 5 +++++ 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/arch/arm64/include/asm/dmi.h b/arch/arm64/include/asm/dmi.h index 69d37d8..e6389fd 100644 --- a/arch/arm64/include/asm/dmi.h +++ b/arch/arm64/include/asm/dmi.h @@ -16,16 +16,29 @@ #include #include +#include /* * According to section 2.3.6 of the UEFI spec, the firmware should not * request a virtual mapping for configuration tables such as SMBIOS. * This means we have to map them before use. */ -#define dmi_early_remap(x, l) ioremap_cache(x, l) -#define dmi_early_unmap(x, l) iounmap(x) +static inline __init void __iomem *dmi_early_remap(resource_size_t addr, + unsigned long size) +{ + return (__force void __iomem *)early_memremap(addr, size); +} + +#define dmi_early_unmap(x, l) early_memunmap((__force void *)(x), l) #define dmi_remap(x, l) ioremap_cache(x, l) #define dmi_unmap(x) iounmap(x) -#define dmi_alloc(l) kzalloc(l, GFP_KERNEL) + +static inline __init void *dmi_alloc(size_t len) +{ + void *ptr = __va(memblock_alloc(len, sizeof(long))); + + memset(ptr, 0, len); + return ptr; +} #endif diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index 7939667..b9e6afb 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -12,7 +12,6 @@ */ #include -#include #include #include #include @@ -413,20 +412,6 @@ static int __init arm64_enable_runtime_services(void) } early_initcall(arm64_enable_runtime_services); -static int __init arm64_dmi_init(void) -{ - /* - * On arm64, DMI depends on UEFI, and dmi_scan_machine() 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(); - if (dmi_available) - dmi_set_dump_stack_arch_desc(); - return 0; -} -core_initcall(arm64_dmi_init); - static void efi_set_pgd(struct mm_struct *mm) { if (mm == &init_mm) diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index dc9eb5f..200c2e9 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -436,6 +437,10 @@ void __init setup_arch(char **cmdline_p) relocate_initrd(); request_standard_resources(); + dmi_scan_machine(); + if (dmi_available) + dmi_set_dump_stack_arch_desc(); + early_ioremap_reset(); if (acpi_disabled) {