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@linaro.org X-Patchwork-Id: 6591561 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4FE979F1C1 for ; Thu, 11 Jun 2015 19:48:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 709C320636 for ; Thu, 11 Jun 2015 19:48:49 +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 825E62055D for ; Thu, 11 Jun 2015 19:48:48 +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 1Z38Qb-0004zI-Ee; Thu, 11 Jun 2015 19:46:17 +0000 Received: from mail-ig0-f171.google.com ([209.85.213.171]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z38QA-0004qM-97 for linux-arm-kernel@lists.infradead.org; Thu, 11 Jun 2015 19:45:51 +0000 Received: by igbhj9 with SMTP id hj9so60401861igb.1 for ; Thu, 11 Jun 2015 12:45:28 -0700 (PDT) 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=lDcC/wkhY1oicGcQ20IIgRVw58x6wNq1yBB2PJX1M34=; b=i5tTvVAoUW/r/3PGlzrqTyrLMSM7Flw7cvdKbk8d3psU2BlXGzeZJgEA5JYO+KvOac lHuDDyaAjoQx/jr//pib9enxTVGIBCpENhokIcJrguhjlkK62nBt/jWPHPEXK8nZW8O7 FBGjSEZ4PTln93T2KwDtWEGcKnU6ZitaoERj8xSvp8PIPjDESBjW2UUGx8T+u3f81q/B HXrdcfnDqiv4QPNTOFLOmUhWYBU6AM/ZziyoZN0tb4Lkr1Q0URg+S2I77i4EV8Pol4iq PCqwB1UeaodpAKN/aXbMBbyCdpbKWO9EESelafUYRuxXuUtqvth1zwuuZZ9sFOo77hy8 fTaA== X-Gm-Message-State: ALoCoQkleHpo/GZCe356QCG933x7Z6Uj/LIpPb4kPM6ZgI51svCPwJtRvz3+LvsZuPTEF4U03xhk 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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150611_124550_399191_D291684B X-CRM114-Status: GOOD ( 10.63 ) X-Spam-Score: 0.7 (/) Cc: patches@linaro.org, linaro-kernel@lists.linaro.org, linaro-acpi@lists.linaro.org 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=-1.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, SUSPICIOUS_RECIPS,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=no 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 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);