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: 53878 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id F0372218E3 for ; Fri, 18 Sep 2015 14:14:39 +0000 (UTC) Received: by lagj9 with SMTP id j9sf20221774lag.0 for ; Fri, 18 Sep 2015 07:14:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=dq4uq0/TPzyiwoD1mwXTx05IOb9MY1VDJbcdcPEYJNQ=; b=AMo4LiiDTP5JdNv2ImvxwxtSVFRF7f5k8Mt41zbJ/V+J8LoSaTOa3Oa/SAK/5jGTM9 CGzad85bj7zNHmzB/feaFjMvGqjb4QRPZMG4BFFhkM/gcXdS8HevhO7Z+qmE+2MkLUqn IZzyA8MpfEwjS80yhzE1cKOfwlp5B7jZ3LJYj4rmmWw+deWqPZhNnPZUab5yNVVOixWF 5NbaUX67IxnEFISktlIhvELOttTJ25PD2gtPGxSNPW1HCwgkIQAVvQVQsb8nZy0ZM7w9 ebdF3NVMHHpnLavKzgsv5RcNv0VGLTFkO/DgABfFoH1rFR3+UJeeC4Znv9UT9UsSfzBN eKYA== X-Gm-Message-State: ALoCoQkVTZvGsK+LC/RYzbmnMspnFiIbHlHcU/TuwCB1vv/UrCWo9ppZv/d/Zsm1hZzE0SXOZKt3 X-Received: by 10.194.118.65 with SMTP id kk1mr938199wjb.5.1442585678887; Fri, 18 Sep 2015 07:14:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.166 with SMTP id w6ls241632lae.10.gmail; Fri, 18 Sep 2015 07:14:38 -0700 (PDT) X-Received: by 10.112.136.170 with SMTP id qb10mr3330058lbb.34.1442585678598; Fri, 18 Sep 2015 07:14:38 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id g4si6236937lam.95.2015.09.18.07.14.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Sep 2015 07:14:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by lagj9 with SMTP id j9so31707728lag.2 for ; Fri, 18 Sep 2015 07:14:38 -0700 (PDT) X-Received: by 10.152.236.12 with SMTP id uq12mr3280136lac.35.1442585678357; Fri, 18 Sep 2015 07:14:38 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp320452lbq; Fri, 18 Sep 2015 07:14:37 -0700 (PDT) X-Received: by 10.50.23.80 with SMTP id k16mr14376181igf.62.1442585677382; Fri, 18 Sep 2015 07:14:37 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 16si6945806ion.57.2015.09.18.07.14.36; Fri, 18 Sep 2015 07:14:37 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753868AbbIROOf (ORCPT + 30 others); Fri, 18 Sep 2015 10:14:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44114 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753671AbbIROOd (ORCPT ); Fri, 18 Sep 2015 10:14:33 -0400 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 Cc: Ard Biesheuvel , Matt Fleming , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Mark Salter 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: msalter@redhat.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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) {