From patchwork Mon Feb 2 12:45:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 5761401 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C9C5BBF440 for ; Mon, 2 Feb 2015 12:52:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DFF38202F2 for ; Mon, 2 Feb 2015 12:52:37 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0938A20123 for ; Mon, 2 Feb 2015 12:52:37 +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 1YIGSF-0002lM-U4; Mon, 02 Feb 2015 12:50:15 +0000 Received: from mail-pa0-f41.google.com ([209.85.220.41]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YIGRO-0008GO-Q1 for linux-arm-kernel@lists.infradead.org; Mon, 02 Feb 2015 12:49:23 +0000 Received: by mail-pa0-f41.google.com with SMTP id kq14so82114346pab.0 for ; Mon, 02 Feb 2015 04:49:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=i5UYdswEFtHrue+0CTwvrAaaAKLLAZk97Kqh4/7t2bw=; b=H6A+HS5pP7H7WUzrQjELeU3PAygHaH/ggL8wsrCqzB5qu+vr4H1WIrXK6VV7PjBOtM /nKQYeH89sr6EeNRlAo6MS2llNDqiBX+ymWtuJcHKRdP8hWYpQcadvGhZFydmtxLOJwK 9oMzOYiHnXTJtosU5wNTDEoG/XSUzys9OVbAQkgNJ+qUkc3wHiEAvcBVBKafrl6nUm6a bE2ZTJMej7SH1OVcTxO+McDiy/s5AmwSUwCMVzSAnYyNEs45MbMuG4x3mSsT0NinfGjj q6e5l2LZ8hdppIdQBM/kXnaEFsTQrtOAmUtHac8RghtvKSc5Nb/uh44nb8J//z3JnTHZ E3dg== X-Gm-Message-State: ALoCoQkQTIDOhOsUffewHhvrzIq8wJMhvtQT1pAKO7LVhgUvoEKNh+wjw5gjftPqGqzFa2/W1BOA X-Received: by 10.66.119.193 with SMTP id kw1mr29752087pab.64.1422881342186; Mon, 02 Feb 2015 04:49:02 -0800 (PST) Received: from localhost ([180.150.157.4]) by mx.google.com with ESMTPSA id fu14sm1960061pad.44.2015.02.02.04.49.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 02 Feb 2015 04:49:01 -0800 (PST) From: Hanjun Guo To: Catalin Marinas , "Rafael J. Wysocki" , Olof Johansson , Arnd Bergmann , Mark Rutland , Grant Likely , Will Deacon Subject: [PATCH v8 09/21] ARM64 / ACPI: Disable ACPI if FADT revision is less than 5.1 Date: Mon, 2 Feb 2015 20:45:37 +0800 Message-Id: <1422881149-8177-10-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1422881149-8177-1-git-send-email-hanjun.guo@linaro.org> References: <1422881149-8177-1-git-send-email-hanjun.guo@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150202_044922_866996_B02209E4 X-CRM114-Status: GOOD ( 15.57 ) X-Spam-Score: -0.7 (/) Cc: Mark Langsdorf , linaro-acpi@lists.linaro.org, wangyijing@huawei.com, Rob Herring , Lorenzo Pieralisi , Timur Tabi , Daniel Lezcano , linux-acpi@vger.kernel.org, Charles.Garcia-Tobin@arm.com, phoenix.liyi@huawei.com, Robert Richter , Jason Cooper , Marc Zyngier , Jon Masters , Mark Brown , Bjorn Helgaas , linux-arm-kernel@lists.infradead.org, Ashwin Chaugule , Graeme Gregory , Randy Dunlap , linux-kernel@vger.kernel.org, Hanjun Guo , suravee.suthikulpanit@amd.com, Sudeep Holla X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 FADT Major.Minor version was introduced in ACPI 5.1, it is the same as ACPI version. In ACPI 5.1, some major gaps are fixed for ARM, such as updates in MADT table for GIC and SMP init, without those updates, we can not get the MPIDR for SMP init, and GICv2/3 related init information, so we can't boot arm64 ACPI properly with table versions predating 5.1. If firmware provides ACPI tables with ACPI version less than 5.1, OS has no way to retrieve the configuration data that is necessary to init SMP boot protocol and the GIC properly, so disable ACPI if we get an FADT table with version less that 5.1. CC: Lorenzo Pieralisi CC: Catalin Marinas CC: Will Deacon Tested-by: Suravee Suthikulpanit Tested-by: Yijing Wang Tested-by: Mark Langsdorf Tested-by: Jon Masters Tested-by: Timur Tabi Signed-off-by: Hanjun Guo --- arch/arm64/kernel/acpi.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c index afe10b4..b9f64ec 100644 --- a/arch/arm64/kernel/acpi.c +++ b/arch/arm64/kernel/acpi.c @@ -13,6 +13,8 @@ * published by the Free Software Foundation. */ +#define pr_fmt(fmt) "ACPI: " fmt + #include #include #include @@ -49,10 +51,32 @@ void __init __acpi_unmap_table(char *map, unsigned long size) early_memunmap(map, size); } +static int __init acpi_parse_fadt(struct acpi_table_header *table) +{ + struct acpi_table_fadt *fadt = (struct acpi_table_fadt *)table; + + /* + * Revision in table header is the FADT Major revision, and there + * is a minor revision of FADT which was introduced by ACPI 5.1, + * we only deal with ACPI 5.1 or newer revision to get GIC and SMP + * boot protocol configuration data, or we will disable ACPI. + */ + if (table->revision > 5 || + (table->revision == 5 && fadt->minor_revision >= 1)) + return 0; + + pr_warn("Unsupported FADT revision %d.%d, should be 5.1+, will disable ACPI\n", + table->revision, fadt->minor_revision); + disable_acpi(); + + return -EINVAL; +} + /* * acpi_boot_table_init() called from setup_arch(), always. * 1. find RSDP and get its address, and then find XSDT * 2. extract all tables and checksums them all + * 3. check ACPI FADT revision * * We can parse ACPI boot-time tables such as MADT after * this function is called. @@ -64,8 +88,16 @@ void __init acpi_boot_table_init(void) return; /* Initialize the ACPI boot-time table parser. */ - if (acpi_table_init()) + if (acpi_table_init()) { + disable_acpi(); + return; + } + + if (acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt)) { + /* disable ACPI if no FADT is found */ disable_acpi(); + pr_err("Can't find FADT\n"); + } } static int __init parse_acpi(char *arg)