From patchwork Fri Oct 13 15:56:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 115781 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp887916qgn; Fri, 13 Oct 2017 08:57:59 -0700 (PDT) X-Received: by 10.98.161.24 with SMTP id b24mr1792107pff.297.1507910279380; Fri, 13 Oct 2017 08:57:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507910279; cv=none; d=google.com; s=arc-20160816; b=nWREP5ncHxZJ641ULUPmjn8CuW1pL/SJ7hMK7IjaDjuuHi1Rk1b0bsLnVrerv4EJWC beCQco6IiydEkHXI99x1Gy0WHOISLmjqV8iK/cgSAgWK6UL8JbutpYi/A2v+auKKjq6a t7S04PWs04cF96zvBaOBkaVQ9d30oW8XUiCbN1TCVZVDjIUdTDOPKHWVlMMgr0EGBpI0 96cFUTTGvP+eqCsW9dXN7/224Z6kFEj7blTPJc4NIujrYVsQxNceiqFoLphLwZr/3WlN 7xnNPzcvdT3OLp7bNiYdb38sQJjJbkRDEsRY0JuPDYoFPeBxDCdjhr5AZ0OowvIShj7q z83g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=MmKOl5SAc5SB6evwTPYxNICjnstxUP7IIORre6iFlwI=; b=y3TXaDhmm0+XsbU2/xzc2GprZTqtxH/k6aGVtDkFsQAdzdLHOLqia94W4tE27TYJsw V/MuvVzt7o9CfCi2xGzXSQIpfZG0XrT7VDRXZIRUHeSeMSGR/kRUnBYNWg9s7CfspWHP D3TEFbDdoAtnMqe/JP6vbNGsM7ewpCNqqr37ENDxtG0YsxzrRtOoDlsVwd+lQBNMMKpg dhzou8lH2uVxrWSugWZSRDg48UocD/Z/XypRaW0KepDOaUl8Qo2g21BbqxjweM9br9WP iw9wLlTtvQjEPCYcStwPb2E3/G+rxmdPpLkO6YjZkRzqVBk9AecaAoEicMTTfOIQELmp ibNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Cq3E2/Pg; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n8si794263plk.532.2017.10.13.08.57.59; Fri, 13 Oct 2017 08:57:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Cq3E2/Pg; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751092AbdJMP56 (ORCPT + 6 others); Fri, 13 Oct 2017 11:57:58 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:46475 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751011AbdJMP56 (ORCPT ); Fri, 13 Oct 2017 11:57:58 -0400 Received: by mail-wm0-f46.google.com with SMTP id m72so22406402wmc.1 for ; Fri, 13 Oct 2017 08:57:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5MZeF5H0kxfAkUgudBaKRgw2g16JWJEnv8PWhghXnhE=; b=Cq3E2/Pg0OcAgHU6cWxduVAl8XUrC5AfFWPrX39ezVT7DFPIIkU2J9acuMB9gvl5W1 /nx7w0mwfZEa6iPn9XmYdu47KNw/V7phCgWgxYxQNUeFs/zMIPuKqr9KFGwX3rz6Yn3J bGgmgynxWsDWGRr/izXZ61v1GWDfCyZ3ynKLU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5MZeF5H0kxfAkUgudBaKRgw2g16JWJEnv8PWhghXnhE=; b=SV9XqmIIF/QLqC5qJ8LxVQCd6eO2ZkJqdjOPAmhMkYQ3ojjtoH2ybcFFNovoG4LTKb lcnZ6R/vGfjnF3GI5E67ywk7CyGV1CqDkT3jr13WuTddUK3/JsxnHyfQTFDv4MDByNdL W0rC+NkMqFVrzzPLwyBVmx84H8+h7W/uWLNkXmIPpa9Wu/M89qs6JAMVpc0uBL599i3Q bstaX2Mzp4jxAPwUsi7Ae68EegUqY/WQlT4PT6dsxpvGWTVjFpJNlbO9FhqRDG33PRqc U2kKdN81EIdw9evI8ARpWKmXpXb+x7uzT08JtnEPw3UxzZn4DMW2vJCvK0xemhGxaSO2 G9Yg== X-Gm-Message-State: AMCzsaUd1hTdsZ67BQH86yYfJtj1Yepbcl7G1hw5u5RKmo7fEGWN3lA6 2D6n1O6EMwK+ZLqb8RYqUNA2fQ== X-Google-Smtp-Source: ABhQp+RYKY2LYYLrIdvHoQu8Hb9RADCQWeZDft4PSUjal3Qll6mla3YULYjvNSfPaR4JZVvutrUteQ== X-Received: by 10.28.28.138 with SMTP id c132mr1779678wmc.48.1507910276928; Fri, 13 Oct 2017 08:57:56 -0700 (PDT) Received: from localhost.localdomain ([154.146.29.151]) by smtp.gmail.com with ESMTPSA id l19sm1636046wre.26.2017.10.13.08.57.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Oct 2017 08:57:56 -0700 (PDT) From: Ard Biesheuvel To: marc.zyngier@arm.com, robin.murphy@arm.com Cc: linux-arm-kernel@lists.infradead.org, daniel.thompson@Linaro.org, leif.lindholm@linaro.org, graeme.gregory@linaro.org, catalin.marinas@arm.com, will.deacon@arm.com, devicetree@vger.kernel.org, robh+dt@kernel.org, Ard Biesheuvel Subject: [PATCH v4 2/3] drivers/irqchip: gic: make quirks matching conditional on init return value Date: Fri, 13 Oct 2017 16:56:06 +0100 Message-Id: <20171013155607.5211-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171013155607.5211-1-ard.biesheuvel@linaro.org> References: <20171013155607.5211-1-ard.biesheuvel@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org As it turns out, the IIDR is not sufficient to distinguish between GICv3 implementations when it comes to enabling quirks. So update the prototype of the init() hook to return a bool, and interpret a 'false' return value as no match, in which case the 'enabling workaround' log message should not be printed. Signed-off-by: Ard Biesheuvel --- drivers/irqchip/irq-gic-common.c | 5 +++-- drivers/irqchip/irq-gic-common.h | 2 +- drivers/irqchip/irq-gic-v3-its.c | 12 +++++++++--- 3 files changed, 13 insertions(+), 6 deletions(-) -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/irqchip/irq-gic-common.c b/drivers/irqchip/irq-gic-common.c index 9ae71804b5dd..30017df5b54c 100644 --- a/drivers/irqchip/irq-gic-common.c +++ b/drivers/irqchip/irq-gic-common.c @@ -40,8 +40,9 @@ void gic_enable_quirks(u32 iidr, const struct gic_quirk *quirks, for (; quirks->desc; quirks++) { if (quirks->iidr != (quirks->mask & iidr)) continue; - quirks->init(data); - pr_info("GIC: enabling workaround for %s\n", quirks->desc); + if (quirks->init(data)) + pr_info("GIC: enabling workaround for %s\n", + quirks->desc); } } diff --git a/drivers/irqchip/irq-gic-common.h b/drivers/irqchip/irq-gic-common.h index 205e5fddf6da..3919cd7c5285 100644 --- a/drivers/irqchip/irq-gic-common.h +++ b/drivers/irqchip/irq-gic-common.h @@ -23,7 +23,7 @@ struct gic_quirk { const char *desc; - void (*init)(void *data); + bool (*init)(void *data); u32 iidr; u32 mask; }; diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 891de07fd4cc..c34f21c7a38e 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -2728,28 +2728,34 @@ static int its_force_quiescent(void __iomem *base) } } -static void __maybe_unused its_enable_quirk_cavium_22375(void *data) +static bool __maybe_unused its_enable_quirk_cavium_22375(void *data) { struct its_node *its = data; /* erratum 22375: only alloc 8MB table size */ its->device_ids = 0x14; /* 20 bits, 8MB */ its->flags |= ITS_FLAGS_WORKAROUND_CAVIUM_22375; + + return true; } -static void __maybe_unused its_enable_quirk_cavium_23144(void *data) +static bool __maybe_unused its_enable_quirk_cavium_23144(void *data) { struct its_node *its = data; its->flags |= ITS_FLAGS_WORKAROUND_CAVIUM_23144; + + return true; } -static void __maybe_unused its_enable_quirk_qdf2400_e0065(void *data) +static bool __maybe_unused its_enable_quirk_qdf2400_e0065(void *data) { struct its_node *its = data; /* On QDF2400, the size of the ITE is 16Bytes */ its->ite_size = 16; + + return true; } static const struct gic_quirk its_quirks[] = {