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: 44130 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 36A792070C for ; Mon, 2 Feb 2015 12:49:31 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id r20sf18198439wiv.2 for ; Mon, 02 Feb 2015 04:49:29 -0800 (PST) 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:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=GV+9cxqRFlMl3B8jp3vCR5wcZO4xiEiZSLYNxaRgAPQ=; b=a6fEp48TzIHlHIfFstUoqouwTCidKOeebFDtfd4GUYYFjVx8Sj7jXFk+7YcJP4y6Pa NB8So6e023AvrputcSgI2iV2cvpCckrW9PedLyzj5DtYCCQcjYetP5BsR2RbTdgGu8e0 LHqfdsfRfu49V5dh1Uy1FddSQqPcEYGJu3cVTV3h1h0ZVy2GhUjyZxa4ysUywGmF9m2v y/XGtkI9dWEB3yzAk056i9cPy5eL3HXjGh9Fzv6wwZQPkW4XqJiANJ8lK84J9cAmKk1o fNHms7BdNK9I8v/+nqPZOMp7WwAGQB2K9mJ0ut5oVmJBfH1Mc36yv/pA0FhLG3qWSF7M EwkA== X-Gm-Message-State: ALoCoQll8NRgbME8mNv5ZTuHrLGZR17DywHCgllceZLNrm3b4sjK9/MeZy7o6gyblHAwmhdf3zqn X-Received: by 10.194.204.201 with SMTP id la9mr2351636wjc.6.1422881367172; Mon, 02 Feb 2015 04:49:27 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.13 with SMTP id n13ls642225laa.80.gmail; Mon, 02 Feb 2015 04:49:27 -0800 (PST) X-Received: by 10.112.132.2 with SMTP id oq2mr19177494lbb.11.1422881366978; Mon, 02 Feb 2015 04:49:26 -0800 (PST) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id 4si16831382laj.116.2015.02.02.04.49.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Feb 2015 04:49:26 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by mail-la0-f41.google.com with SMTP id gm9so40469539lab.0 for ; Mon, 02 Feb 2015 04:49:26 -0800 (PST) X-Received: by 10.112.180.135 with SMTP id do7mr18964794lbc.23.1422881366874; Mon, 02 Feb 2015 04:49:26 -0800 (PST) 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.35.133 with SMTP id h5csp1273381lbj; Mon, 2 Feb 2015 04:49:25 -0800 (PST) X-Received: by 10.70.18.196 with SMTP id y4mr5950853pdd.27.1422881364371; Mon, 02 Feb 2015 04:49:24 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b4si7498856pde.178.2015.02.02.04.49.23; Mon, 02 Feb 2015 04:49:24 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755541AbbBBMtN (ORCPT + 29 others); Mon, 2 Feb 2015 07:49:13 -0500 Received: from mail-pa0-f52.google.com ([209.85.220.52]:53765 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932695AbbBBMtC (ORCPT ); Mon, 2 Feb 2015 07:49:02 -0500 Received: by mail-pa0-f52.google.com with SMTP id kx10so81965289pab.11 for ; Mon, 02 Feb 2015 04:49:02 -0800 (PST) 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 Cc: Lorenzo Pieralisi , Graeme Gregory , Sudeep Holla , Jon Masters , Jason Cooper , Marc Zyngier , Bjorn Helgaas , Daniel Lezcano , Mark Brown , Rob Herring , Robert Richter , Randy Dunlap , Charles.Garcia-Tobin@arm.com, phoenix.liyi@huawei.com, Timur Tabi , Ashwin Chaugule , suravee.suthikulpanit@amd.com, Mark Langsdorf , wangyijing@huawei.com, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, Hanjun Guo , Lorenzo Pieralisi 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> 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: hanjun.guo@linaro.org 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.41 as permitted sender) smtp.mail=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: , 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)