From patchwork Mon Aug 12 15:04:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 171091 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp2953096ily; Mon, 12 Aug 2019 08:05:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqwejN8FGaTHxzlWfIUkIv6zBscVmJ7U7P50lus8PrIcT3Kkkx9WFumDDbxAl+q+dAQLXD1c X-Received: by 2002:a17:90a:bb8a:: with SMTP id v10mr24057539pjr.78.1565622332840; Mon, 12 Aug 2019 08:05:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565622332; cv=none; d=google.com; s=arc-20160816; b=ahsIGnOQD2TDlCrsDgjFQhefEahAYU1bDSDjHUa3rjgOJQyss0kRCxDxFlfMjNXIwa eRbW5Y+2zf5vT98gcVXhk3XX78UK9Y9MKI4r5Z6Hk0H396HZhXA/qzDmx3+ZiLq5EE8V 1QQ0eCu/FNYMC40P0vL8aqyQRvsH4G5gIc2hGXrumFhy7SwX8TpXz0Fl5n4hDTejQfrc +Rx2dboBp1bOQww5ZP8PIvhlsHDyjmmbAiJPyKyZTO3FyEXEkweLt7bxy45lPW63OIpD 8wr8uXA2ol7itVKDJerdA5Z0wLFu5NL73Tds3SR2Wu2RLgmyvGqeBXZSBFhpu4iyDat+ yBqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=Z3sLGJ9Y6NSuUVoK4Ad/f3JwEEVat2vLXpskef4Wjpw=; b=0yLFY2dTas0d4vYn/GHhMdGmVatqWYps/lekEzSosWVfI9afyHyd93Dkd7tArqvqDm GFGscVbBhiSTePKzUqX7P8V6gCFIyEa9u4KgXoDBWszhBYMdwyLoATREhATar1P/XAO+ ow8umrjiKiV+3UldLtmRzosGN4RzzQ6cQtGK8LSuq3COHnYJcDmeZaU23SdreQSoAQJh FWTROHc3XzO4qYKhWwal4/4Ty1IC6lqTfXFtAzNIBZflRwqaQo2ecyMhvo/ZbinVggtJ 8xboHZ1oaDi48OrccdcC1OdaPvp9w6bTOhxAXUgcjyVWOgTEkUOTnNdnfWRncwSkvFN4 yQJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uUtpswhj; 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=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 b34si8454016plc.19.2019.08.12.08.05.32; Mon, 12 Aug 2019 08:05: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=@linaro.org header.s=google header.b=uUtpswhj; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727666AbfHLPFP (ORCPT + 28 others); Mon, 12 Aug 2019 11:05:15 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:52269 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727146AbfHLPFM (ORCPT ); Mon, 12 Aug 2019 11:05:12 -0400 Received: by mail-wm1-f67.google.com with SMTP id s3so12503722wms.2 for ; Mon, 12 Aug 2019 08:05:11 -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; bh=Z3sLGJ9Y6NSuUVoK4Ad/f3JwEEVat2vLXpskef4Wjpw=; b=uUtpswhjcXonrclDX2pzC/OLlMB8CR4jdNsbVCyyJfbFyBbMWg+0Aew0YrDSAbgynn UBHZ5qxiR/FLZ0Ct92Vg9vySGyIMlp0Yt/g4bYii5IWID7ZLPf+RyFBRXZAedOHhY3f1 x8kbYQmk9C1++IuCm9gK2XiUkD/aqYVIN9apkB5giAeUyZKNaA/0ZJXRkq79Y5kkKhE4 1SGL8XBz3c2V4QL0D7Qs4FM7A3jQbeESD3X1qiLoi9x1D7WoWNGemRbTg5N+WEtmjXeP zpXj0JUd+0iUU29AgEne7VQpoPzhKcNXb81u+/xT9VS4QG/w5s0GItw7dh6fJS+Hrplh PIyQ== 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; bh=Z3sLGJ9Y6NSuUVoK4Ad/f3JwEEVat2vLXpskef4Wjpw=; b=pKH9ltWlhDQBxpeIeftIlSmGTIGs7v12UAFPqUkW/sy25oW6PcstYGGaWhy+F4HF41 0T7OIYQyODZiRqx2h9qA/jkDTGa2YbiwioyEKmcJ8+uF3k5NPRRcX2WSVFOFRFLcjp7b z42FRmXlyD3qO9lE2aImSEcz7M3AI+fWOGHSfEdZbTsh/NmTufjl997PcnxpFZHz06eV /EsLKMW/hJXUD37rx90IOTGs6Nd9k7uh6TZLkvaslfBTK4y9FoNx5N2fQo/zgc+6rsKx Me9bHnXGHzYQKSG9U3qh4IWfXcndjpmvTeO4/fiQxsEHpZZVgq8BC/IMRUsX+S0ouS42 Ru1A== X-Gm-Message-State: APjAAAXe9YxU3aYb21xYRCBcjp22+8ZDcyCbskGSkVxHSyq3aUI9vaNd k8psHrqvLKBLcbxCnKOmLMoLKQ== X-Received: by 2002:a1c:4c06:: with SMTP id z6mr3789211wmf.47.1565622310553; Mon, 12 Aug 2019 08:05:10 -0700 (PDT) Received: from localhost.localdomain ([2a02:587:a407:da00:1c0e:f938:89a1:8e17]) by smtp.gmail.com with ESMTPSA id h97sm31027269wrh.74.2019.08.12.08.05.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Aug 2019 08:05:09 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, James Morse , Mario Limonciello , Narendra K , Xiaofei Tan Subject: [PATCH 2/5] efi/x86: move UV_SYSTAB handling into arch/x86 Date: Mon, 12 Aug 2019 18:04:49 +0300 Message-Id: <20190812150452.27983-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190812150452.27983-1-ard.biesheuvel@linaro.org> References: <20190812150452.27983-1-ard.biesheuvel@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The SGI UV UEFI machines are tightly coupled to the x86 architecture so there is no need to keep any awareness of its existence in the generic EFI layer, especially since we already have the infrastructure to handle arch-specific configuration tables, and were even already using it to some extent. Signed-off-by: Ard Biesheuvel --- arch/x86/include/asm/uv/uv.h | 4 +++- arch/x86/platform/efi/efi.c | 6 ++++-- arch/x86/platform/uv/bios_uv.c | 10 ++++++---- drivers/firmware/efi/efi.c | 1 - include/linux/efi.h | 1 - 5 files changed, 13 insertions(+), 9 deletions(-) -- 2.17.1 diff --git a/arch/x86/include/asm/uv/uv.h b/arch/x86/include/asm/uv/uv.h index e60c45fd3679..6bc6d89d8e2a 100644 --- a/arch/x86/include/asm/uv/uv.h +++ b/arch/x86/include/asm/uv/uv.h @@ -12,10 +12,12 @@ struct mm_struct; #ifdef CONFIG_X86_UV #include +extern unsigned long uv_systab_phys; + extern enum uv_system_type get_uv_system_type(void); static inline bool is_early_uv_system(void) { - return !((efi.uv_systab == EFI_INVALID_TABLE_ADDR) || !efi.uv_systab); + return uv_systab_phys && uv_systab_phys != EFI_INVALID_TABLE_ADDR; } extern int is_uv_system(void); extern int is_uv_hubless(void); diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 8d9be97a5607..9866a3584765 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c @@ -59,7 +59,7 @@ static efi_system_table_t efi_systab __initdata; static efi_config_table_type_t arch_tables[] __initdata = { #ifdef CONFIG_X86_UV - {UV_SYSTEM_TABLE_GUID, "UVsystab", &efi.uv_systab}, + {UV_SYSTEM_TABLE_GUID, "UVsystab", &uv_systab_phys}, #endif {NULL_GUID, NULL, NULL}, }; @@ -74,7 +74,9 @@ static const unsigned long * const efi_tables[] = { &efi.boot_info, &efi.hcdp, &efi.uga, - &efi.uv_systab, +#ifdef CONFIG_X86_UV + &uv_systab_phys, +#endif &efi.fw_vendor, &efi.runtime, &efi.config_table, diff --git a/arch/x86/platform/uv/bios_uv.c b/arch/x86/platform/uv/bios_uv.c index 7c69652ffeea..c2ee31953372 100644 --- a/arch/x86/platform/uv/bios_uv.c +++ b/arch/x86/platform/uv/bios_uv.c @@ -14,6 +14,8 @@ #include #include +unsigned long uv_systab_phys __ro_after_init = EFI_INVALID_TABLE_ADDR; + struct uv_systab *uv_systab; static s64 __uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, @@ -185,13 +187,13 @@ EXPORT_SYMBOL_GPL(uv_bios_set_legacy_vga_target); void uv_bios_init(void) { uv_systab = NULL; - if ((efi.uv_systab == EFI_INVALID_TABLE_ADDR) || - !efi.uv_systab || efi_runtime_disabled()) { + if ((uv_systab_phys == EFI_INVALID_TABLE_ADDR) || + !uv_systab_phys || efi_runtime_disabled()) { pr_crit("UV: UVsystab: missing\n"); return; } - uv_systab = ioremap(efi.uv_systab, sizeof(struct uv_systab)); + uv_systab = ioremap(uv_systab_phys, sizeof(struct uv_systab)); if (!uv_systab || strncmp(uv_systab->signature, UV_SYSTAB_SIG, 4)) { pr_err("UV: UVsystab: bad signature!\n"); iounmap(uv_systab); @@ -203,7 +205,7 @@ void uv_bios_init(void) int size = uv_systab->size; iounmap(uv_systab); - uv_systab = ioremap(efi.uv_systab, size); + uv_systab = ioremap(uv_systab_phys, size); if (!uv_systab) { pr_err("UV: UVsystab: ioremap(%d) failed!\n", size); return; diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index cbdbdbc8f9eb..4dfd873373bd 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -43,7 +43,6 @@ struct efi __read_mostly efi = { .boot_info = EFI_INVALID_TABLE_ADDR, .hcdp = EFI_INVALID_TABLE_ADDR, .uga = EFI_INVALID_TABLE_ADDR, - .uv_systab = EFI_INVALID_TABLE_ADDR, .fw_vendor = EFI_INVALID_TABLE_ADDR, .runtime = EFI_INVALID_TABLE_ADDR, .config_table = EFI_INVALID_TABLE_ADDR, diff --git a/include/linux/efi.h b/include/linux/efi.h index 60a6242765d8..171bb1005a10 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -988,7 +988,6 @@ extern struct efi { unsigned long boot_info; /* boot info table */ unsigned long hcdp; /* HCDP table */ unsigned long uga; /* UGA table */ - unsigned long uv_systab; /* UV system table */ unsigned long fw_vendor; /* fw_vendor */ unsigned long runtime; /* runtime table */ unsigned long config_table; /* config tables */