From patchwork Thu Jul 2 23:48:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Stone X-Patchwork-Id: 50606 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7B8EA214B3 for ; Thu, 2 Jul 2015 23:48:58 +0000 (UTC) Received: by lagx9 with SMTP id x9sf23521985lag.2 for ; Thu, 02 Jul 2015 16:48:57 -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=Iy0eplskVVSFeKFZIexKXLLul3l5N+iOVw5c6ExQgxY=; b=Bd+qsOACckVbixh37J0Ln9DXcaDRuS2gFlnJK2dPUlXUw6nFjQcHpM5iKMBGonsH5z i+UBXGna+HM2we1+w9kr2zjHzJ7mJYzOM5oLNTMN3OfbbTemoVmAAsoonLl+77tEUsll lxYDhPJmNhiIkKMNe8yNIG/vAQsksnDsMFA9vx8qGZwR9CV3swvq9gCGpvRXYMTZv33z y6CILxo3DwXR4HFFCzmdZsUNX/nh/ggpeLch8HtmrQ4C0gMPqkRlYKsyg+AUzqMPXALw 73bQmWaOornXxCClqTE39/BGG2NNtKv2EZpgdkzSx1LIX9iS2+1GxbJ9zOs5W2IYoCnH Dn6Q== X-Gm-Message-State: ALoCoQmHo2In8fm9ByKqBjUDkikiiVeEZpAD9V0QlVvifwQbbl2ru2c2aUXDqnswhqkhvcB2MnUB X-Received: by 10.180.90.106 with SMTP id bv10mr5920766wib.6.1435880937482; Thu, 02 Jul 2015 16:48:57 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.9 with SMTP id ku9ls385991lac.37.gmail; Thu, 02 Jul 2015 16:48:57 -0700 (PDT) X-Received: by 10.152.115.199 with SMTP id jq7mr32892354lab.113.1435880937196; Thu, 02 Jul 2015 16:48:57 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id xd3si5712995lbb.166.2015.07.02.16.48.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jul 2015 16:48:57 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by lagx9 with SMTP id x9so70705479lag.1 for ; Thu, 02 Jul 2015 16:48:57 -0700 (PDT) X-Received: by 10.152.26.163 with SMTP id m3mr33106744lag.86.1435880937110; Thu, 02 Jul 2015 16:48:57 -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 hn6csp794461lbb; Thu, 2 Jul 2015 16:48:56 -0700 (PDT) X-Received: by 10.50.30.9 with SMTP id o9mr18801501igh.36.1435880932661; Thu, 02 Jul 2015 16:48:52 -0700 (PDT) Received: from mail-ig0-f175.google.com (mail-ig0-f175.google.com. [209.85.213.175]) by mx.google.com with ESMTPS id e75si7158293ioj.105.2015.07.02.16.48.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jul 2015 16:48:52 -0700 (PDT) Received-SPF: pass (google.com: domain of al.stone@linaro.org designates 209.85.213.175 as permitted sender) client-ip=209.85.213.175; Received: by igcsj18 with SMTP id sj18so175120136igc.1 for ; Thu, 02 Jul 2015 16:48:52 -0700 (PDT) X-Received: by 10.42.113.133 with SMTP id c5mr14753495icq.67.1435880931878; Thu, 02 Jul 2015 16:48:51 -0700 (PDT) Received: from fidelio.ahs3.com (c-50-134-239-249.hsd1.co.comcast.net. [50.134.239.249]) by smtp.googlemail.com with ESMTPSA id h2sm6550906igv.2.2015.07.02.16.48.49 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jul 2015 16:48:50 -0700 (PDT) From: Al Stone To: linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: rjw@rjwysocki.net, lenb@kernel.org, catalin.marinas@arm.com, will.deacon@arm.com, tglx@linutronix.de, jason@lakedaemon.net, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, linaro-kernel@lists.linaro.org, patches@linaro.org Subject: [PATCH v3 2/3] ACPI / ARM64: add BAD_MADT_GICC_ENTRY() macro Date: Thu, 2 Jul 2015 17:48:35 -0600 Message-Id: <1435880916-2153-3-git-send-email-al.stone@linaro.org> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1435880916-2153-1-git-send-email-al.stone@linaro.org> References: <1435880916-2153-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.215.46 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: , 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. This code is being added to an arm64 header file since that is currently the only architecture using the GICC subtable of the MADT. As a GIC is specific to ARM, it is also unlikely the subtable will be used elsewhere. Fixes: aeb823bbacc2 (ACPICA: ACPI 6.0: Add changes for FADT table.) Signed-off-by: Al Stone --- arch/arm64/include/asm/acpi.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index 39248d3..a3c26a4 100644 --- a/arch/arm64/include/asm/acpi.h +++ b/arch/arm64/include/asm/acpi.h @@ -19,6 +19,17 @@ #include #include +/* Macros for consistency checks of the GICC subtable of MADT */ +#define ACPI_MADT_GICC_51_LENGTH 76 +#define ACPI_MADT_GICC_60_LENGTH 80 + +#define BAD_MADT_GICC_ENTRY(entry, end) ( \ + (!entry) || (unsigned long)entry + sizeof(*entry) > end || \ + ((ACPI_FADT_SPEC_VERSION == ACPI_FADT_SPEC_VERSION_51) && \ + (entry->header.length != ACPI_MADT_GICC_51_LENGTH)) || \ + ((ACPI_FADT_SPEC_VERSION == ACPI_FADT_SPEC_VERSION_60) && \ + (entry->header.length != ACPI_MADT_GICC_60_LENGTH))) + /* Basic configuration for ACPI */ #ifdef CONFIG_ACPI /* ACPI table mapping after acpi_gbl_permanent_mmap is set */