From patchwork Fri Oct 13 15:56:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 115780 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp887858qgn; Fri, 13 Oct 2017 08:57:56 -0700 (PDT) X-Received: by 10.101.80.7 with SMTP id f7mr1711498pgo.408.1507910276106; Fri, 13 Oct 2017 08:57:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507910276; cv=none; d=google.com; s=arc-20160816; b=QmT7gb3U7r7qsOf+xDrJLrmMx1JsbCP0oW5JpGt+pRayD5L9kbO+AonlkNRDhWd+gq 0Qp0DiaZSU8ttBuBD6Mrrm1Xc65PukCcHNbHbiifRv1dT+8kNJWuGYXmt4i1LBka+oJi nFWdIWVXg65K93TqruIscx25WUv01XrNiB85g2XgpqglYtpeV7Ivk4QWj+G83Do3qeEO FS6Sp/C1VphuDbS/gRnW3mdJBzoQus4XGHhd01MC068nudNeijgjQ7YAQQKdeQK9M8JW fm8lOU2V8uhHihdui5TLRU1NPry+b4QK8yas6dUUJjVOBdBj1cZ1X9FEvL793V7K1A5o 5Yew== 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=EQu7PFLjrq2GiEHpKuuMmsW9JiqjM6AT0EmeueAqLhg=; b=isbsU4yZ2VB8qAQ0JH+AVFdOzscSS2ZKMirh+GLp6txtf+ZSdX+xcmxbqC8yBy8SiB SDycGYNEbMdtgjZwxY9f6/IDHn5a2OJLNeSSlDgv6m+wOLRwVq7nD1w3f1dR7iHNtNn7 QnPX0JqiGtzvP/YnOuvef4BcRHPHFi6iWH/ur8C4tvyEIDTdwsWqM+xI6xNO+NKdoJkr xH7ZnOqrFdEsJcBbSCEEs1z7M/2jZEFUzPOcHQDgDBH/Ddu233M7kVcS+mUcCAsYgNcO +umIreGqPiIo/tlCR4EZ2+KdQrvFMOx2DaWn0sxpO7cAFE0fY2pAzvXQq2Lo/KHGJYgb MuzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=HY3JEgg1; 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.55; Fri, 13 Oct 2017 08:57:56 -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=HY3JEgg1; 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 S1751040AbdJMP5z (ORCPT + 6 others); Fri, 13 Oct 2017 11:57:55 -0400 Received: from mail-wr0-f176.google.com ([209.85.128.176]:53976 "EHLO mail-wr0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750973AbdJMP5y (ORCPT ); Fri, 13 Oct 2017 11:57:54 -0400 Received: by mail-wr0-f176.google.com with SMTP id y44so1371063wry.10 for ; Fri, 13 Oct 2017 08:57:54 -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=hcoqsPVs5C7Pd8/M04kFqx7qMm95VJSP1qF5aCHerpw=; b=HY3JEgg1CQ66MpEB0OtrjfLPB6nkesoTd4N0OE4LpVJzg9zrUkHHr9Wb1op3A5HCSU D3gBIlvLkUou0tdbPG5lkd4DGbFZBz7H9PWlFQabbfkPvUrY8BLCrf3jhRUg+3jHonph UCePjQN+QyvIzKhQ65rthR4uPLm6CHBl1G9yU= 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=hcoqsPVs5C7Pd8/M04kFqx7qMm95VJSP1qF5aCHerpw=; b=C2bMqjB3iYjxhqLRFlIyY6ndsqCVbJ18eoLXPPcCQri05LZaTrBLhoW25RXFpLJjuq xohXtVQyAkx1uhWjGnDYQPm22Nw4fD+fVQyGeV30TY820VWic09my2t74691s3HNjMzn 4yH4Ojlz7SXJz3eY6a+zCQj6DB/MS6tpoUcX0m/zw64u0eFpycFZD/+o2B7EUuDlhcgZ ngXeXn1XUFHTXeg2ohwv9VD8u8xYyZ49HqvzN9gSThJow2ZW0EaBY6p1wbps0jdWA/A6 TcA8zGICtgqi1PNYCaiypX29LdJ8Myb9es35mVIrrq1fzRtnOabtnFqWbFnIc4+xooPl oHFA== X-Gm-Message-State: AMCzsaUmiYnEbO+3FygHViRKCFKaosEi0v6sgw0vqaAeZZH7X9Jm1fv7 PI4HRMZF4gjamRSAevTQ7F6UvrBSnww= X-Google-Smtp-Source: AOwi7QAB5pQsk9aTN+wGZs0nBitee7CGhVke/dApnvaQMdmlHulCABq4r/ggzrlER0OgnhJ861eytA== X-Received: by 10.223.172.242 with SMTP id o105mr1690568wrc.242.1507910273724; Fri, 13 Oct 2017 08:57:53 -0700 (PDT) Received: from localhost.localdomain ([154.146.29.151]) by smtp.gmail.com with ESMTPSA id l19sm1636046wre.26.2017.10.13.08.57.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Oct 2017 08:57:52 -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 1/3] drivers/irqchip: gicv3: probe device ID space before quirks handling Date: Fri, 13 Oct 2017 16:56:05 +0100 Message-Id: <20171013155607.5211-2-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 Before adding another SoC whose device ID space deviates from the value presented in the GIC ID registers, let's slightly refactor the code so that the ID registers are probed before that quirks handling executes. This allows us to move the device ID override into the quirk handler itself. Signed-off-by: Ard Biesheuvel --- drivers/irqchip/irq-gic-v3-its.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 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-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index e8d89343d613..891de07fd4cc 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -1650,23 +1650,14 @@ static void its_free_tables(struct its_node *its) static int its_alloc_tables(struct its_node *its) { - u64 typer = gic_read_typer(its->base + GITS_TYPER); - u32 ids = GITS_TYPER_DEVBITS(typer); u64 shr = GITS_BASER_InnerShareable; u64 cache = GITS_BASER_RaWaWb; u32 psz = SZ_64K; int err, i; - if (its->flags & ITS_FLAGS_WORKAROUND_CAVIUM_22375) { - /* - * erratum 22375: only alloc 8MB table size - * erratum 24313: ignore memory access type - */ - cache = GITS_BASER_nCnB; - ids = 0x14; /* 20 bits, 8MB */ - } - - its->device_ids = ids; + if (its->flags & ITS_FLAGS_WORKAROUND_CAVIUM_22375) + /* erratum 24313: ignore memory access type */ + cache = GITS_BASER_nCnB; for (i = 0; i < GITS_BASER_NR_REGS; i++) { struct its_baser *baser = its->tables + i; @@ -2741,6 +2732,8 @@ static void __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; } @@ -2942,6 +2935,7 @@ static int __init its_probe_one(struct resource *res, its->base = its_base; its->phys_base = res->start; its->ite_size = GITS_TYPER_ITT_ENTRY_SIZE(typer); + its->device_ids = GITS_TYPER_DEVBITS(typer); its->is_v4 = !!(typer & GITS_TYPER_VLPIS); if (its->is_v4) { if (!(typer & GITS_TYPER_VMOVP)) {