From patchwork Wed Jan 14 15:04:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 43125 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f200.google.com (mail-we0-f200.google.com [74.125.82.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8C3CF240B9 for ; Wed, 14 Jan 2015 15:11:53 +0000 (UTC) Received: by mail-we0-f200.google.com with SMTP id u56sf5178762wes.3 for ; Wed, 14 Jan 2015 07:11:52 -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=pGiXTPeP+oP6hmHWHwep4m481Uyo495riDPnJ9OeXzg=; b=HD2duuIJnNsxUTn5CjXpnqmnQTZiKrT3ARMqZLnG1Vr+Ih8l4bYmC1FCnNAJ2aGMNo mgiArMj536IltnR5CfF+m6QhR6AsFswvnQgjYUgUsQFyoG7mNw+rnanfyS9PvE3YCct2 yizlfB3y0PQnPS8OkeaFNYh1rXyCIvUluLp3BtdF+pUR87rWMHLdKM5hcYJkEMHPtpk5 P337KZ2Ld1/OhwXwuNUNHpdKCa64DlhYMckrGZzrSNi7fbwgiIFpeJHE3FrkUOXt4M5A Pnw9jOA6llW7PECglM6wA0pnxK3kFSkc79e6vjR8jSduDP1XRDkRCRgwWOJ7D/Ayhco3 KQxg== X-Gm-Message-State: ALoCoQnwnYopoQh2btsMWQUnvh5ti8iOP3vV7ajPwCCKNg80wd2niWpZN6YsBBDGQR+U51xKfwng X-Received: by 10.180.93.165 with SMTP id cv5mr709978wib.6.1421248312601; Wed, 14 Jan 2015 07:11:52 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.225 with SMTP id i1ls129746lae.19.gmail; Wed, 14 Jan 2015 07:11:52 -0800 (PST) X-Received: by 10.152.238.1 with SMTP id vg1mr4419067lac.83.1421248312420; Wed, 14 Jan 2015 07:11:52 -0800 (PST) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id rx8si27539075lbb.33.2015.01.14.07.11.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 14 Jan 2015 07:11:52 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by mail-lb0-f181.google.com with SMTP id l4so8406844lbv.12 for ; Wed, 14 Jan 2015 07:11:52 -0800 (PST) X-Received: by 10.112.90.170 with SMTP id bx10mr4391801lbb.69.1421248312310; Wed, 14 Jan 2015 07:11:52 -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.9.200 with SMTP id c8csp1727566lbb; Wed, 14 Jan 2015 07:11:51 -0800 (PST) X-Received: by 10.66.121.230 with SMTP id ln6mr6508961pab.82.1421248310468; Wed, 14 Jan 2015 07:11:50 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id lw5si31210469pdb.42.2015.01.14.07.11.49; Wed, 14 Jan 2015 07:11:50 -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 S1753736AbbANPHq (ORCPT + 28 others); Wed, 14 Jan 2015 10:07:46 -0500 Received: from mail-pd0-f170.google.com ([209.85.192.170]:48827 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753679AbbANPHm (ORCPT ); Wed, 14 Jan 2015 10:07:42 -0500 Received: by mail-pd0-f170.google.com with SMTP id v10so10262239pde.1 for ; Wed, 14 Jan 2015 07:07:41 -0800 (PST) X-Received: by 10.66.254.68 with SMTP id ag4mr6374653pad.39.1421248061263; Wed, 14 Jan 2015 07:07:41 -0800 (PST) Received: from localhost (119.81.172.112-static.reverse.softlayer.com. [119.81.172.112]) by mx.google.com with ESMTPSA id bj11sm20044240pdb.1.2015.01.14.07.07.39 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 14 Jan 2015 07:07:40 -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 , Mark Brown , Rob Herring , Robert Richter , Randy Dunlap , Charles.Garcia-Tobin@arm.com, phoenix.liyi@huawei.com, Timur Tabi , suravee.suthikulpanit@amd.com, 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 Subject: [PATCH v7 07/17] ARM64 / ACPI: Disable ACPI if FADT revision is less than 5.1 Date: Wed, 14 Jan 2015 23:04:55 +0800 Message-Id: <1421247905-3749-8-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1421247905-3749-1-git-send-email-hanjun.guo@linaro.org> References: <1421247905-3749-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.217.181 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 will be messed up with those information and have no way to init smp and GIC, so disable ACPI if we get an FADT table with version less that 5.1. Tested-by: Suravee Suthikulpanit Tested-by: Yijing Wang Signed-off-by: Hanjun Guo --- arch/arm64/kernel/acpi.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c index 39a1655..4177758 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 arm boot flags, 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,13 @@ 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)) + pr_err("Can't find FADT or error happened during parsing FADT\n"); } static int __init parse_acpi(char *arg)