Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp986222pxp; Wed, 16 Mar 2022 23:32:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKCSewnyGxvB+Knc2gNCu7LrNBrlnrVeX2bFdDu6xhO1YSgP4y2OWfUGhYWecbVX9U5sfS X-Received: by 2002:a05:6a00:1796:b0:4f7:1cad:d5b0 with SMTP id s22-20020a056a00179600b004f71cadd5b0mr3288938pfg.70.1647498771591; Wed, 16 Mar 2022 23:32:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647498771; cv=none; d=google.com; s=arc-20160816; b=zATcTRuUOzSKd87cXnNEpxhRXAYsXRSukl7zJopy6gT56mqC1ddtP8qD3Zw+UbLvJK 9X8vB3bhSezBRGOH3MZzLFLcd+IyhngxCVINlnsXQxfZEyipS5RSezVlqMhEXqudkxt7 NrcXFEc8N/4SdCLOUDKx6xLwk1tcGkWvY+dMCzVlTvv+MdEF5uIkAKQGMYzYpM1EpIII TqpzNWyymd7QqD2xFY+eMkky59yjj+Ks7rHhi0IcoxmaDnMXHxZlneb4M/kFmubPVap3 E2ksznrJiG2beqcZBbraay+MUo1iXtxW/cyzaU+SHgUEWVEwtkCOab8IRaKaVQ5n3heN yahA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=XfJSXEzYacQI/l/AlAV7ySJGIzqrWYn0N7u7NTyY1MM=; b=UfoK2hZ5NZ5yWgQawCmfHDa1pKUxlM5meKWleh0+JJ8HqF2aA2LcdovKuEbN1Cnpy4 +p0Rr8Y5vzmlbfvvQVd8JuF4zlCM9XQpH9jq9p+jmqiIFilQBlvaqoxZCjLn2LF1l+bl vPYFvnobGdC80YbffpJD2TgYn4b+DAy6McPXJ4QZt2hCbc0S2FCALEnfbqcCJvxdXteh wrzFGWOJYLKrKcAYzyzeS33EDkH45uwVF+5gGLKFTA6lel2fgIu9rpKzHzIf0cqMxRUF 90AAFg3ivNVc58zqp0bp5vKGHN3fh8+be5nLRFAcg3Z9kwUBlETFAMQv0KPNIzW+bufu 1IuQ== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id j8-20020a17090276c800b00153563a372csi3723463plt.45.2022.03.16.23.32.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 23:32:51 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 266457E5A3; Wed, 16 Mar 2022 22:18:08 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233796AbiCPOxP (ORCPT + 99 others); Wed, 16 Mar 2022 10:53:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356936AbiCPOw7 (ORCPT ); Wed, 16 Mar 2022 10:52:59 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 243885F4C6; Wed, 16 Mar 2022 07:51:45 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E14A81476; Wed, 16 Mar 2022 07:51:44 -0700 (PDT) Received: from slackpad.lan (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 030303F7D7; Wed, 16 Mar 2022 07:51:43 -0700 (PDT) Date: Wed, 16 Mar 2022 14:51:02 +0000 From: Andre Przywara To: Marc Zyngier Cc: linux-kernel@vger.kernel.org, Lorenzo Pieralisi , Thomas Gleixner , Eric Auger , stable@vger.kernel.org Subject: Re: [PATCH 1/3] irqchip/gic-v3: Fix GICR_CTLR.RWP polling Message-ID: <20220316145102.28ad0a74@slackpad.lan> In-Reply-To: <20220315165034.794482-2-maz@kernel.org> References: <20220315165034.794482-1-maz@kernel.org> <20220315165034.794482-2-maz@kernel.org> Organization: Arm Ltd. X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.31; x86_64-slackware-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 15 Mar 2022 16:50:32 +0000 Marc Zyngier wrote: > It turns out that our polling of RWP is totally wrong when checking > for it in the redistributors, as we test the *distributor* bit index, > whereas it is a different bit number in the RDs... Oopsie boo. > > This is embarassing. Not only because it is wrong, but also because > it took *8 years* to notice the blunder... Indeed, I wonder why we didn't see issues before. I guess it's either the UWP bit at position GICR_CTLR[31] having a similar implementation, or the MMIO access alone providing enough delay for the writes to finish. Anyway: > Just fix the damn thing. > > Fixes: 021f653791ad ("irqchip: gic-v3: Initial support for GICv3") > Signed-off-by: Marc Zyngier > Cc: stable@vger.kernel.org Reviewed-by: Andre Przywara Cheers, Andre > --- > drivers/irqchip/irq-gic-v3.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c > index 5e935d97207d..736163d36b13 100644 > --- a/drivers/irqchip/irq-gic-v3.c > +++ b/drivers/irqchip/irq-gic-v3.c > @@ -206,11 +206,11 @@ static inline void __iomem *gic_dist_base(struct irq_data *d) > } > } > > -static void gic_do_wait_for_rwp(void __iomem *base) > +static void gic_do_wait_for_rwp(void __iomem *base, u32 bit) > { > u32 count = 1000000; /* 1s! */ > > - while (readl_relaxed(base + GICD_CTLR) & GICD_CTLR_RWP) { > + while (readl_relaxed(base + GICD_CTLR) & bit) { > count--; > if (!count) { > pr_err_ratelimited("RWP timeout, gone fishing\n"); > @@ -224,13 +224,13 @@ static void gic_do_wait_for_rwp(void __iomem *base) > /* Wait for completion of a distributor change */ > static void gic_dist_wait_for_rwp(void) > { > - gic_do_wait_for_rwp(gic_data.dist_base); > + gic_do_wait_for_rwp(gic_data.dist_base, GICD_CTLR_RWP); > } > > /* Wait for completion of a redistributor change */ > static void gic_redist_wait_for_rwp(void) > { > - gic_do_wait_for_rwp(gic_data_rdist_rd_base()); > + gic_do_wait_for_rwp(gic_data_rdist_rd_base(), GICR_CTLR_RWP); > } > > #ifdef CONFIG_ARM64