From patchwork Tue Jan 24 10:39:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 9534859 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1B7B66042C for ; Tue, 24 Jan 2017 10:45:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01DEF26AE3 for ; Tue, 24 Jan 2017 10:45:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA9E526C2F; Tue, 24 Jan 2017 10:45:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00 autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B284826AE3 for ; Tue, 24 Jan 2017 10:45:49 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cVybj-0002H3-Lr; Tue, 24 Jan 2017 10:45:47 +0000 Received: from szxga02-in.huawei.com ([119.145.14.65]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cVyaf-0008Q1-Fs for linux-arm-kernel@lists.infradead.org; Tue, 24 Jan 2017 10:44:47 +0000 Received: from 172.24.1.47 (EHLO szxeml428-hub.china.huawei.com) ([172.24.1.47]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DTT06293; Tue, 24 Jan 2017 18:43:33 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by szxeml428-hub.china.huawei.com (10.82.67.183) with Microsoft SMTP Server id 14.3.235.1; Tue, 24 Jan 2017 18:43:20 +0800 From: Hanjun Guo To: Mark Rutland , Marc Zyngier , Will Deacon , Daniel Lezcano Subject: [PATCH 1/2] arm64: arch_timer: acpi: Introduce a generic aquirk framework for erratum Date: Tue, 24 Jan 2017 18:39:50 +0800 Message-ID: <1485254391-51551-2-git-send-email-guohanjun@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1485254391-51551-1-git-send-email-guohanjun@huawei.com> References: <1485254391-51551-1-git-send-email-guohanjun@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.58872FD8.0018, 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: 9142eecde5e5777ecc9115c9b2ed67ee X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170124_024441_942808_2E86D5EB X-CRM114-Status: GOOD ( 12.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lorenzo Pieralisi , "Rafael J. Wysocki" , linuxarm@huawei.com, linux-acpi@vger.kernel.org, Fu Wei , Ding Tianhong , linux-arm-kernel@lists.infradead.org, Hanjun Guo Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hanjun Guo Introduce a general quirk framework for arch timer erratum in ACPI, which use the oem information in GTDT table for platform specific erratums. The struct gtdt_arch_timer_fixup is introduced to record the oem information to match the quirk and handle the erratum. Signed-off-by: Hanjun Guo --- drivers/clocksource/arm_arch_timer.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 2dc571d..80d6f76 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -1146,6 +1146,39 @@ static int __init arch_timer_mem_of_init(struct device_node *np) arch_timer_mem_of_init); #ifdef CONFIG_ACPI_GTDT +struct gtdt_arch_timer_fixup { + char oem_id[ACPI_OEM_ID_SIZE + 1]; + char oem_table_id[ACPI_OEM_TABLE_ID_SIZE + 1]; + u32 oem_revision; + + /* quirk handler for arch timer erratum */ + void (*handler)(void *context); + void *context; +}; + +/* note: this needs to be updated according to the doc of OEM ID + * and TABLE ID for different board. + */ +static struct gtdt_arch_timer_fixup arch_timer_quirks[] __initdata = { +}; + +static void __init arch_timer_acpi_quirks_handler(char *oem_id, + char *oem_table_id, + u32 oem_revision) +{ + struct gtdt_arch_timer_fixup *quirks = arch_timer_quirks; + int i; + + for (i = 0; i < ARRAY_SIZE(arch_timer_quirks); i++, 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) { + if (quirks->handler && quirks->context) + quirks->handler(quirks->context); + } + } +} + static int __init arch_timer_mem_acpi_init(int platform_timer_count) { struct arch_timer_mem *timer_mem; @@ -1182,6 +1215,9 @@ static int __init arch_timer_acpi_init(struct acpi_table_header *table) return -EINVAL; } + arch_timer_acpi_quirks_handler(table->oem_id, table->oem_table_id, + table->oem_revision); + arch_timers_present |= ARCH_TIMER_TYPE_CP15; ret = acpi_gtdt_init(table, &platform_timer_count);