Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp3954809ybh; Tue, 6 Aug 2019 04:08:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqwBfewXpTCiBHcDuWsbNtptSLdzsCidUFGAnhBv2Zvj81dIOWLxQzK6meDgqbxTXx9f6XiY X-Received: by 2002:a17:902:12d:: with SMTP id 42mr2504340plb.187.1565089697731; Tue, 06 Aug 2019 04:08:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565089697; cv=none; d=google.com; s=arc-20160816; b=ZrvqKLwnvX1TkbnZjJYeno+n+riqqHuT6ZVfrnP6C6HsfiWOkng7cDJbHRgWbUvb/N 9+7qtts5a2BiFO9/JiiAW13NkX84MrHcF+vxQP6WMP3Ev55Z7He4jdX9Sb9gBPs7rfKI xkVSapmhNhLVY8e++qYIFimF1hp6GbilWnhPZBNO76JkZUCgTPoaCOkDXO5G/upVUL94 fcDSxIO6o25N7xG6qcUsVSlJXpQOLfRQ9RQLXwdtH7FLvNbbIK1gA/77SifqJWoqJVBm RTUFW7xOSlS+QBJ6cPq2cXLWDSpMZZnOi/q8sHLAFeg+qR9f1kO6QQEs3FFXfnvR98jC I5MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=bAdQ/YZE+SjlpmAPUPAoRZYMouHbyFm93q14PaxePyQ=; b=PJuBtMqFWAzTVjfdHIQ5xc3RS7/qRA1bKNG1qJ7kxEEF23LYhk6zSUIl9DA1PMJM/G ELXQ4yWQwEW4gIHxsFM0oNUFstiQDcACSG8NgetdnvOo1sZ9XUtg713qYN2s2CxBzOdi ERXDgxq8pNvVN+K/60xFn9LAHjsLTskMeG6v1NCTZ8763fiwKLvOL22gRAkhPYX2cINX /E3YxdghjKUE6AQH/5C5Hsu/VqJyR8x0Ddb/D6FURor0zZue1Kms3ZEpTWHMgjOAqGc+ EDtenGEOb5OsaE6wiGw1n9M7KXh1EA4+y5oyFuP60bhmMU3hudM0w+YbJ8Lg/r5yJNNj Ft+Q== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q9si12608896pgm.409.2019.08.06.04.08.01; Tue, 06 Aug 2019 04:08:17 -0700 (PDT) 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 S1731093AbfHFLHT (ORCPT + 99 others); Tue, 6 Aug 2019 07:07:19 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:59130 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728845AbfHFLHT (ORCPT ); Tue, 6 Aug 2019 07:07:19 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 5EE1996E0A4ABC13A6C9; Tue, 6 Aug 2019 19:07:16 +0800 (CST) Received: from [127.0.0.1] (10.202.227.238) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.439.0; Tue, 6 Aug 2019 19:07:06 +0800 Subject: Re: [PATCH v2 12/12] irqchip/gic-v3: Add quirks for HIP06/07 invalid GICD_TYPER erratum 161010803 To: Marc Zyngier , Thomas Gleixner , "Jason Cooper" , Julien Thierry , Rob Herring References: <20190806100121.240767-1-maz@kernel.org> <20190806100121.240767-13-maz@kernel.org> CC: Shameerali Kolothum Thodi , "Lokesh Vutla" , , From: John Garry Message-ID: <5f8808f9-ca91-db68-042f-97dfcbe75508@huawei.com> Date: Tue, 6 Aug 2019 12:07:00 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <20190806100121.240767-13-maz@kernel.org> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.227.238] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/08/2019 11:01, Marc Zyngier wrote: > It looks like the HIP06/07 SoCs have extra bits in their GICD_TYPER > registers, which confuse the GICv3.1 code (these systems appear to > expose ESPIs while they actually don't). > > Detect these systems as early as possible and wipe the fields that > should be RES0 in the register. > thanks, Tested-by: John Garry > Signed-off-by: Marc Zyngier > --- > Documentation/arm64/silicon-errata.rst | 2 + > drivers/irqchip/irq-gic-v3.c | 54 +++++++++++++++++++++----- > 2 files changed, 46 insertions(+), 10 deletions(-) > > diff --git a/Documentation/arm64/silicon-errata.rst b/Documentation/arm64/silicon-errata.rst > index 3e57d09246e6..17ea3fecddaa 100644 > --- a/Documentation/arm64/silicon-errata.rst > +++ b/Documentation/arm64/silicon-errata.rst > @@ -115,6 +115,8 @@ stable kernels. > +----------------+-----------------+-----------------+-----------------------------+ > | Hisilicon | Hip0{6,7} | #161010701 | N/A | > +----------------+-----------------+-----------------+-----------------------------+ > +| Hisilicon | Hip0{6,7} | #161010803 | N/A | > ++----------------+-----------------+-----------------+-----------------------------+ > | Hisilicon | Hip07 | #161600802 | HISILICON_ERRATUM_161600802 | > +----------------+-----------------+-----------------+-----------------------------+ > | Hisilicon | Hip08 SMMU PMCG | #162001800 | N/A | > diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c > index 334a10d9dbfb..bee141613b67 100644 > --- a/drivers/irqchip/irq-gic-v3.c > +++ b/drivers/irqchip/irq-gic-v3.c > @@ -1441,6 +1441,46 @@ static bool gic_enable_quirk_msm8996(void *data) > return true; > } > > +static bool gic_enable_quirk_hip06_07(void *data) > +{ > + struct gic_chip_data *d = data; > + > + /* > + * HIP06 GICD_IIDR clashes with GIC-600 product number (despite > + * not being an actual ARM implementation). The saving grace is > + * that GIC-600 doesn't have ESPI, so nothing to do in that case. > + * HIP07 doesn't even have a proper IIDR, and still pretends to > + * have ESPI. In both cases, put them right. > + */ > + if (d->rdists.gicd_typer & GICD_TYPER_ESPI) { > + /* Zero both ESPI and the RES0 field next to it... */ > + d->rdists.gicd_typer &= ~GENMASK(9, 8); > + return true; > + } > + > + return false; > +} > + > +static const struct gic_quirk gic_quirks[] = { > + { > + .desc = "GICv3: Qualcomm MSM8996 broken firmware", > + .compatible = "qcom,msm8996-gic-v3", > + .init = gic_enable_quirk_msm8996, > + }, > + { > + .desc = "GICv3: HIP06 erratum 161010803", > + .iidr = 0x0204043b, > + .init = gic_enable_quirk_hip06_07, > + }, > + { > + .desc = "GICv3: HIP07 erratum 161010803", > + .iidr = 0x00000000, > + .init = gic_enable_quirk_hip06_07, > + }, > + { > + } > +}; > + > static void gic_enable_nmi_support(void) > { > int i; > @@ -1494,6 +1534,10 @@ static int __init gic_init_bases(void __iomem *dist_base, > */ > typer = readl_relaxed(gic_data.dist_base + GICD_TYPER); > gic_data.rdists.gicd_typer = typer; > + > + gic_enable_quirks(readl_relaxed(gic_data.dist_base + GICD_IIDR), > + gic_quirks, &gic_data); > + > pr_info("%d SPIs implemented\n", GIC_LINE_NR - 32); > pr_info("%d Extended SPIs implemented\n", GIC_ESPI_NR); > gic_data.domain = irq_domain_create_tree(handle, &gic_irq_domain_ops, > @@ -1676,16 +1720,6 @@ static void __init gic_of_setup_kvm_info(struct device_node *node) > gic_set_kvm_info(&gic_v3_kvm_info); > } > > -static const struct gic_quirk gic_quirks[] = { > - { > - .desc = "GICv3: Qualcomm MSM8996 broken firmware", > - .compatible = "qcom,msm8996-gic-v3", > - .init = gic_enable_quirk_msm8996, > - }, > - { > - } > -}; > - > static int __init gic_of_init(struct device_node *node, struct device_node *parent) > { > void __iomem *dist_base; >