From patchwork Wed Feb 15 13:04:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupesh Sharma X-Patchwork-Id: 9574009 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5C38F601D8 for ; Wed, 15 Feb 2017 13:15:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 450D528487 for ; Wed, 15 Feb 2017 13:15:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38CC028490; Wed, 15 Feb 2017 13:15:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_SORBS_SPAM autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7102F28487 for ; Wed, 15 Feb 2017 13:14:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=TrJla0dmBXLS9qwCY8QaDp2l0n52gVScTknrNuDCwVk=; b=FVFWwmi3Yx1HBNwd8cyFaYdecJ slg2mSaZClupDrwGQTfEwl2fIiM5/WsfPBaum4bk39iMAwymdW+CaHgupLlnSQHJt6O124CZs4Mcb vz03sdp1l69Qygm6xQSu5yeE4no/XDCDOL8NnbFzM477r6NsXqErPfQX6wZvwDENuq7odxRp6JzO+ diQdhW8BDWNWBWOHJW8sZMTw1y9ooYQwtLJIpVo69Hjz6S1/SwvTDZTxzgDk0hXPh1KnOs5w1RV2P WFkFTdA6AiKXoHP0pYC2hO+3+/yRhO5zUVOtdYu9FBWGr0niLy8Jf6cW9+wOcKRpal3+moqvxTFfk 1lWdtnlA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cdzQ9-0006Gm-Cr; Wed, 15 Feb 2017 13:14:57 +0000 Received: from mail-qk0-f178.google.com ([209.85.220.178]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cdzPq-0005i8-H2 for linux-arm-kernel@lists.infradead.org; Wed, 15 Feb 2017 13:14:42 +0000 Received: by mail-qk0-f178.google.com with SMTP id 11so150010390qkl.3 for ; Wed, 15 Feb 2017 05:14:18 -0800 (PST) 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=g8Jvfz3U6HiN8lVh4ST2S4CKoU/FWnpSkZ3ShyjsIfw=; b=RJPedAeVpKDQCNiSUGMRab87gL2+h8NwDpnBuBBQKR9R7Y76ReX74z8CqbDQKtiGu3 0rU9zN4i0xnWL0XccM+JjcTu3aAWOIWSp+7qgDGEIvKWwJwAjgwtD16otQKS7FKTqjEY m6yWmMmS6kOYuAdmf8exKs267rkc44n9QGJPzBZEiRe8taUppBRG9KEzbUEFq1lmXWTl Q6mZSHfe8Yyqqtl0J3nGRbhMicuCLephglflgUWAFPQgKQ1+xd5upD5MyRqsLc8D1FTr Hr0JRA0QJWbu/1vGW0qkipGjh6r4k1l3xQhCESKX2Wlyu0ykNRQ2PFuUS50e6KQyDLu9 wRKw== X-Gm-Message-State: AMke39mRj+tmzfXodtYLf41veJP2LJoxUuI9lI7v30Zp4UdY2Q1WbTgPhtMe0xGev5u52pca X-Received: by 10.55.16.91 with SMTP id a88mr18145681qkh.66.1487163965479; Wed, 15 Feb 2017 05:06:05 -0800 (PST) Received: from localhost ([122.177.25.230]) by smtp.gmail.com with ESMTPSA id q145sm2275751qke.37.2017.02.15.05.06.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Feb 2017 05:06:04 -0800 (PST) From: Bhupesh Sharma To: linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-acpi@vger.kernel.org Subject: [PATCH 2/2] bgrt: Make ACPI BGRT parsing code common for ARCHs Date: Wed, 15 Feb 2017 18:34:52 +0530 Message-Id: <1487163892-27701-3-git-send-email-bhsharma@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487163892-27701-1-git-send-email-bhsharma@redhat.com> References: <1487163892-27701-1-git-send-email-bhsharma@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170215_051438_808235_0638B51E X-CRM114-Status: GOOD ( 16.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Ard Biesheuvel , Matt Fleming , Bhupesh Sharma , Will Deacon , leif.lindholm@linaro.org, sai.praneeth.prakhya@intel.com, nicstange@gmail.com, pjones@redhat.com, Thomas Gleixner , Dan Williams , bhupesh.linux@gmail.com, Dave Young , Ingo Molnar MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch (2) of a patchset containing (2) patches, allows the ACPI BGRT table parsing code to be invoked in a similar fashion accross x86 and AARCH64 ARCHs (which can be later easily extended for other ARCHs which support ACPI tables in future). The approach has been tested on QEMU based VMs for both x86 and AARCH64. Cc: Ard Biesheuvel Cc: Ingo Molnar Cc: Matt Fleming Cc: Dan Williams Cc: Dave Young Cc: Thomas Gleixner Cc: Mark Rutland Cc: Will Deacon Signed-off-by: Bhupesh Sharma --- arch/arm64/kernel/acpi.c | 3 +++ arch/x86/kernel/acpi/boot.c | 6 ------ drivers/acpi/Kconfig | 2 +- drivers/acpi/bgrt.c | 6 ++++++ include/linux/efi-bgrt.h | 2 ++ 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c index 64d9cbd6..e25c11e 100644 --- a/arch/arm64/kernel/acpi.c +++ b/arch/arm64/kernel/acpi.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -233,6 +234,8 @@ void __init acpi_boot_table_init(void) early_init_dt_scan_chosen_stdout(); } else { parse_spcr(earlycon_init_is_deferred); + if (IS_ENABLED(CONFIG_ACPI_BGRT)) + acpi_table_parse(ACPI_SIG_BGRT, acpi_parse_bgrt); } } diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 7ff007e..4a6ee24 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -1558,12 +1558,6 @@ int __init early_acpi_boot_init(void) return 0; } -static int __init acpi_parse_bgrt(struct acpi_table_header *table) -{ - efi_bgrt_init(table); - return 0; -} - int __init acpi_boot_init(void) { /* those are executed after early-quirks are executed */ diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 83e5f7e..dad02c0 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -440,7 +440,7 @@ config ACPI_CUSTOM_METHOD config ACPI_BGRT bool "Boottime Graphics Resource Table support" - depends on EFI && X86 + depends on EFI && (X86 || ARM64) help This driver adds support for exposing the ACPI Boottime Graphics Resource Table, which allows the operating system to obtain diff --git a/drivers/acpi/bgrt.c b/drivers/acpi/bgrt.c index ca28aa57..df1c629 100644 --- a/drivers/acpi/bgrt.c +++ b/drivers/acpi/bgrt.c @@ -81,6 +81,12 @@ static struct attribute_group bgrt_attribute_group = { .bin_attrs = bgrt_bin_attributes, }; +int __init acpi_parse_bgrt(struct acpi_table_header *table) +{ + efi_bgrt_init(table); + return 0; +} + static int __init bgrt_init(void) { int ret; diff --git a/include/linux/efi-bgrt.h b/include/linux/efi-bgrt.h index 2fd3993..33640cd 100644 --- a/include/linux/efi-bgrt.h +++ b/include/linux/efi-bgrt.h @@ -6,6 +6,7 @@ #ifdef CONFIG_ACPI_BGRT void efi_bgrt_init(struct acpi_table_header *table); +int __init acpi_parse_bgrt(struct acpi_table_header *table); /* The BGRT data itself; only valid if bgrt_image != NULL. */ extern size_t bgrt_image_size; @@ -14,6 +15,7 @@ extern struct acpi_table_bgrt bgrt_tab; #else /* !CONFIG_ACPI_BGRT */ static inline void efi_bgrt_init(struct acpi_table_header *table) {} +static inline int __init acpi_parse_bgrt(struct acpi_table_header *table) {} #endif /* !CONFIG_ACPI_BGRT */