From patchwork Tue Oct 17 16:55:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 116151 Delivered-To: patch@linaro.org Received: by 10.80.163.170 with SMTP id s39csp1444767edb; Tue, 17 Oct 2017 09:56:14 -0700 (PDT) X-Received: by 10.99.133.200 with SMTP id u191mr11705603pgd.426.1508259374255; Tue, 17 Oct 2017 09:56:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508259374; cv=none; d=google.com; s=arc-20160816; b=ZGOt0JKsPxoBcjJ7+vC6mpMBTu6xB7SbX4fN6UmU3BDHPBRwlBltHbSVfytAkgpiOL b51HBLh5ZfLEBkw1QgMq9Fe0MV8AvZDg0RzqRbWPEXqyMzMCAlSxrifxS+OBg6RJ77mk 5nO+Hnl/ZnhGxzGibXuN9TLQ5N5bu7ln7xdTIa7V4iVjhUAw7+L3bGNPfaXv8PRLO8RG aAoftGTTqN3cYD0X18qWFgkXkcM5qgto68hShQakQWuegAO4VhJImWaB6fBUw5zKpp2d EdNHZ5LJ3i4z5fIUbU18Vid2eCrCanwhLgV+ai/OSqLqKjlsbaFwKseh5pXmI2Smkc2C WsKQ== 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=R/B1dDRSEuPAyNgTBP4AGGWSi+jp8McIyrkM35BVJZ9M1gzQ5q/hUKKtb91jROCB8K pemCX9HDh2HdUTVxzdqV6EFTpDnXsJ/P0WuaUj0k1ZbzoA15Q7MffNcqhocLRFksUZ4w umBfmuWzgqBExFrGSgBVucnTWD/9mwqYyl21N74K/+IVI0W+giiEuZDSlW+/Ot3P6uOS k3fyvUQdu1831fHWvhXrDPe3YmcGfzCEpvH5oyrL78XvgW1nkLpgjEFnkSeFByZK/j6E GTSMoADPWmbr19ttEGJFxvIwftQQ9JdVHVfNCVm6J7R8+sRydfQHK0g84aMhaFsm87c9 q0gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=jkEXYxcS; 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 i72si6128715pfe.165.2017.10.17.09.56.14; Tue, 17 Oct 2017 09:56:14 -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=jkEXYxcS; 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 S934143AbdJQQ4N (ORCPT + 6 others); Tue, 17 Oct 2017 12:56:13 -0400 Received: from mail-wm0-f52.google.com ([74.125.82.52]:56355 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934082AbdJQQ4M (ORCPT ); Tue, 17 Oct 2017 12:56:12 -0400 Received: by mail-wm0-f52.google.com with SMTP id l68so5224596wmd.5 for ; Tue, 17 Oct 2017 09:56:11 -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=jkEXYxcSdkJv4lmqUe46G1mT6pbLRk4X16ah272ad5nWiSePR9O7oQhECfvQnVcwmM iqipsU8xJvzqlwTujeCCvxBenBDiL6W+4bqQbiwwhekxFClzKf+HTXiFfe2CZH3LCnes f9Mm3b4oCYaVjpaN95XM2xz5j5QUYQ5cSVvCU= 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=ovfA1JBtcafDYdwEyPqsSfGWeRg3kYPjIZ2is+VdqHLnPdyKfMS23BZD7hSVJ+eYIn G7xz7QVjDqEHKRBdH21MDBrVcc2uWmQPkNHrknUhmxX/YnEJ8uqgzWHbTfKLipBfzMSm FK4DPRdMmMfIlEr29DcuF80vxf1R9G9Vn6zLuMKWtQeBJDTzqymUKBp+8I5YEshfHD/V VZykzr9kwQ4XfT4hT3FzT8X+/b/zjAt/ymokRopTY345QLGDnfhAyplGnnqpmDcbj3RU QRQwcr3nDWL8ZAsqUprDe2rph9aS6GvdSPhEblJP/Fulx+0EgTcIFo7rElvQAlDIBC3t +C6Q== X-Gm-Message-State: AMCzsaU++0F9UGnuzc/epFf7L/ApvubVs4dPhCpu2B2cjz6o6/v8DnAm 11s0FUd/PThOlQUfnLwqV279XQ== X-Google-Smtp-Source: ABhQp+QlilykbueSwicJCD7EOB+yOWoDuUECWsGkRpGL/uPd/6C0Ev+288QIxCaX3kYJaRuoNmadHQ== X-Received: by 10.28.105.76 with SMTP id e73mr4476735wmc.116.1508259371002; Tue, 17 Oct 2017 09:56:11 -0700 (PDT) Received: from localhost.localdomain ([154.144.50.139]) by smtp.gmail.com with ESMTPSA id y84sm5854517wmg.43.2017.10.17.09.56.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Oct 2017 09:56:09 -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 v5 2/3] drivers/irqchip: gic: make quirks matching conditional on init return value Date: Tue, 17 Oct 2017 17:55:55 +0100 Message-Id: <20171017165556.30250-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171017165556.30250-1-ard.biesheuvel@linaro.org> References: <20171017165556.30250-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[] = {