From patchwork Thu Jun 11 19:45:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Stone X-Patchwork-Id: 49770 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 82D202460E for ; Thu, 11 Jun 2015 19:45:31 +0000 (UTC) Received: by lagh7 with SMTP id h7sf4941885lag.2 for ; Thu, 11 Jun 2015 12:45:30 -0700 (PDT) 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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=lDcC/wkhY1oicGcQ20IIgRVw58x6wNq1yBB2PJX1M34=; b=LsNstcdOIO4+o5bguSQ9JnycznHOhxFwtUqNnqWOQ84CjZ0+RHqh0vn3PRjIN588Nk goYsE3aPfKaTleSfgRsNPM1EEnUJFaBLW/ngFTrsfRQdq/b2ARg2nHZIKmsfWji7Xosz E5/e4WJLsiCNPOjrUddRlObYrJVNMOFnDUVJWzPPJr5rqhwTv15gjt60+9Khv9EELcBZ zFsn+IWlMf/FSj2IOKtddW/KY+Wdg10VnD9wpiFMI6N+wtcr763MgUcFihNa6iwsiS1q s3r0dPVzKsYX8EzLvZc6pvQ9Xdv/XgdWgZu21yuyAaUwAu9sdOOgzYmHikmfPok1awHQ qLLg== X-Gm-Message-State: ALoCoQncxHqsE7cIXHLejcni6cp7ywNR+wpFjNUGpwbyEwrvfXmTNbhXRn37iev8KPDoCmnaV9Ll X-Received: by 10.152.19.161 with SMTP id g1mr10116654lae.8.1434051930589; Thu, 11 Jun 2015 12:45:30 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.70 with SMTP id le6ls484670lac.50.gmail; Thu, 11 Jun 2015 12:45:30 -0700 (PDT) X-Received: by 10.112.186.35 with SMTP id fh3mr11641330lbc.82.1434051930430; Thu, 11 Jun 2015 12:45:30 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id k5si1471571lbd.83.2015.06.11.12.45.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jun 2015 12:45:30 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbbqq2 with SMTP id qq2so8605296lbb.3 for ; Thu, 11 Jun 2015 12:45:30 -0700 (PDT) X-Received: by 10.112.41.196 with SMTP id h4mr11707005lbl.36.1434051930261; Thu, 11 Jun 2015 12:45:30 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp49802lbb; Thu, 11 Jun 2015 12:45:29 -0700 (PDT) X-Received: by 10.50.93.69 with SMTP id cs5mr37540491igb.4.1434051929333; Thu, 11 Jun 2015 12:45:29 -0700 (PDT) Received: from mail-ie0-f177.google.com (mail-ie0-f177.google.com. [209.85.223.177]) by mx.google.com with ESMTPS id t4si7203892igr.45.2015.06.11.12.45.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jun 2015 12:45:29 -0700 (PDT) Received-SPF: pass (google.com: domain of al.stone@linaro.org designates 209.85.223.177 as permitted sender) client-ip=209.85.223.177; Received: by iesa3 with SMTP id a3so11524120ies.2 for ; Thu, 11 Jun 2015 12:45:28 -0700 (PDT) X-Received: by 10.107.18.92 with SMTP id a89mr14083966ioj.14.1434051928583; Thu, 11 Jun 2015 12:45:28 -0700 (PDT) Received: from fidelio.ahs3.com (c-50-134-239-249.hsd1.co.comcast.net. [50.134.239.249]) by mx.google.com with ESMTPSA id z195sm1009685iod.33.2015.06.11.12.45.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jun 2015 12:45:27 -0700 (PDT) From: al.stone@linaro.org To: linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: linaro-acpi@lists.linaro.org, patches@linaro.org, linaro-kernel@lists.linaro.org Subject: [PATCH 2/3] ACPI: add BAD_MADT_GICC_ENTRY() macro Date: Thu, 11 Jun 2015 13:45:10 -0600 Message-Id: <1434051911-14665-3-git-send-email-al.stone@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1434051911-14665-1-git-send-email-al.stone@linaro.org> References: <1434051911-14665-1-git-send-email-al.stone@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: al.stone@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.169 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Al Stone The BAD_MADT_ENTRY() macro is designed to work for all of the subtables of the MADT. In the ACPI 5.1 version of the spec, the struct for the GICC subtable (struct acpi_madt_generic_interrupt) is 76 bytes long; in ACPI 6.0, the struct is 80 bytes long. But, there is only one definition in ACPICA for this struct -- and that is the 6.0 version. Hence, when BAD_MADT_ENTRY() compares the struct size to the length in the GICC subtable, it fails if 5.1 structs are in use, and there are systems in the wild that have them. This patch adds the BAD_MADT_GICC_ENTRY() that checks the GICC subtable only, accounting for the difference in specification versions that are possible. The BAD_MADT_ENTRY() will continue to work as is for all other MADT subtables. Signed-off-by: Al Stone Reviewed-by: Hanjun Guo Reviewed-by: Graeme Gregory CC: Rafael J. Wysocki CC: Len Brown --- include/linux/acpi.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 33ed313..8a83f91 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -127,6 +127,13 @@ static inline void acpi_initrd_override(void *data, size_t size) (!entry) || (unsigned long)entry + sizeof(*entry) > end || \ ((struct acpi_subtable_header *)entry)->length < sizeof(*entry)) +#define BAD_MADT_GICC_ENTRY(entry, end) ( \ + (!entry) || (unsigned long)entry + sizeof(*entry) > end || \ + ((ACPI_FADT_SPEC_VERSION == ACPI_SPEC_VERSION(5,1)) && \ + (entry->header.length != 76)) || \ + ((ACPI_FADT_SPEC_VERSION == ACPI_SPEC_VERSION(6,0)) && \ + (entry->header.length != 80))) + char * __acpi_map_table (unsigned long phys_addr, unsigned long size); void __acpi_unmap_table(char *map, unsigned long size); int early_acpi_boot_init(void);