From patchwork Tue Jan 24 13:50:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shameerali Kolothum Thodi X-Patchwork-Id: 92356 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1721914qgi; Tue, 24 Jan 2017 05:53:12 -0800 (PST) X-Received: by 10.99.238.5 with SMTP id e5mr28333628pgi.49.1485265992749; Tue, 24 Jan 2017 05:53:12 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v5si19224942pgv.254.2017.01.24.05.53.12; Tue, 24 Jan 2017 05:53:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751096AbdAXNxK (ORCPT + 25 others); Tue, 24 Jan 2017 08:53:10 -0500 Received: from szxga01-in.huawei.com ([58.251.152.64]:21957 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750951AbdAXNxI (ORCPT ); Tue, 24 Jan 2017 08:53:08 -0500 Received: from 172.24.1.47 (EHLO szxeml428-hub.china.huawei.com) ([172.24.1.47]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DYH23675; Tue, 24 Jan 2017 21:50:30 +0800 (CST) Received: from [127.0.0.1] (10.203.177.212) by szxeml428-hub.china.huawei.com (10.82.67.183) with Microsoft SMTP Server id 14.3.235.1; Tue, 24 Jan 2017 21:50:20 +0800 Subject: [RFC 3/4] irqchip, gicv3-its: Introduce ACPI generic quirk framework References: <5886266C.3070506@huawei.com> To: , , CC: , , , , , From: Shameerali Kolothum Thodi X-Forwarded-Message-Id: <5886266C.3070506@huawei.com> Message-ID: <58875B94.80100@huawei.com> Date: Tue, 24 Jan 2017 13:50:12 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <5886266C.3070506@huawei.com> X-Originating-IP: [10.203.177.212] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.58875BAE.0313, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 649faa08e45d964b17e7ddb42302f320 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current quirk mechanism is based on the IIDR register. This introduces a ACPI MADT OEM information based erratum support for platforms on which the IIDR registers are not properly populated. Signed-off-by: shameer --- drivers/irqchip/irq-gic-v3-its.c | 62 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) -- 1.9.1 . diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 0a326f6..9fa12b7 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -1858,6 +1858,66 @@ static int __init its_of_probe(struct device_node *node) #ifdef CONFIG_ACPI +struct acpi_madt_its_quirks { + char oem_id[ACPI_OEM_ID_SIZE+1]; + char oem_table_id[ACPI_OEM_TABLE_ID_SIZE+1]; + u32 oem_revision; + u32 its_id; + const char *erratum; +}; + +/*Upadate as per the board OEM ID and TABLE ID*/ +struct acpi_madt_its_quirks acpi_its_quirks[] __initdata = { + +}; + +static void acpi_its_enable_erratum(const char *erratum) +{ + const struct gic_quirk *quirks = its_quirks; + int i = 0; + + for (; quirks->desc; quirks++) { + if ((quirks->erratum) && (!strcmp(quirks->erratum, erratum))) + erratum_workarounds[i++] = quirks; + } +} + +static void __init acpi_its_oem_check(char *oem_id, char *oem_table_id, + u32 oem_revision) +{ + struct acpi_madt_its_quirks *quirks = acpi_its_quirks; + + for (; quirks->erratum; quirks++) { + if (!memcmp(quirks->oem_id, oem_id, ACPI_OEM_ID_SIZE) && + !memcmp(quirks->oem_table_id, oem_table_id, + ACPI_OEM_TABLE_ID_SIZE) && + quirks->oem_revision == oem_revision) { + acpi_its_enable_erratum(quirks->erratum); + } + } +} + +static int __init acpi_parse_madt(struct acpi_table_header *madt_table) +{ + struct acpi_table_madt *table; + + table = (struct acpi_table_madt *)madt_table; + acpi_its_oem_check(table->header.oem_id, + table->header.oem_table_id, table->header.oem_revision); + + return 0; +} + +void __init its_acpi_quirks_enable(u32 its_id) +{ + struct acpi_madt_its_quirks *quirks = acpi_its_quirks; + + for (; quirks->erratum; quirks++) { + if (quirks->its_id == its_id) + acpi_table_parse(ACPI_SIG_MADT, acpi_parse_madt); + } +} + #define ACPI_GICV3_ITS_MEM_SIZE (SZ_128K) static int __init gic_acpi_parse_madt_its(struct acpi_subtable_header *header, @@ -1888,6 +1948,8 @@ static int __init gic_acpi_parse_madt_its(struct acpi_subtable_header *header, goto dom_err; } + its_acpi_quirks_enable(its_entry->translation_id); + err = its_probe_one(&res, dom_handle, NUMA_NO_NODE); if (!err) return 0;