Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp1831862rdf; Sun, 5 Nov 2023 16:35:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IHRjuY/3B906xOrU3Dl17W4LfVDguiQUsLp2UwJqnYzM1k90XXNZmUw7ifQJQnoTLfLRph6 X-Received: by 2002:a81:9a86:0:b0:5ae:a8ac:ed6a with SMTP id r128-20020a819a86000000b005aea8aced6amr8563235ywg.2.1699230936245; Sun, 05 Nov 2023 16:35:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699230936; cv=none; d=google.com; s=arc-20160816; b=j4zk0O/tXwlO+BtZdP6Mng4hprNbzK9deTyciy/z8/MU6qLlGqkRwcTXlrh1TeQ+8w uOT6pXcas0oMRjQTRdDIHEnjVNJ6IT47JGdaAGLUF/isPvrLHfu9Xpi8KDka0/7e8p+q 2IuNkX4ZMbLLBSEhbLCFY2JXp8N6B2ohatclfZ/5D157j7uJRak+dLMUO4eM+d+Hp+lP h/s/ZOze60YrGKe0QEzWxCFXuypM4AAe1rWygOtsGZkWYKqBsyNPC89qSd35n42J3LHU 1K34zFe40zQdESeGw8cq8sjgFyL1jPoG62ETCkK6rnAJ5n2e6n8XzbZAyomH622RgsZ1 Gs0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=3xq+5DOBB1dI8DqvWcQNMKQaktWNVBj4yETwIhzumWk=; fh=Tzt8cmT0lHn2U0WJXl3e9S1DAigPuoSmJ7cAuLdSFDI=; b=TcTFEuolXYIORtk4qJi/E0CK6scOp8vI7uVk+GmFbqYh/e0KKmOr2XgU4FlHpaqRYx dLGMuwijw/Hyqaocpzy4KHIsqaaAA1ngQPNQ2EnVsyL4hl8jC5mjilPMPmxLazjIgRHl b3yh5OcVuZJAbcejicXEJ5ZYq0wMJCUL+juo/+kRQ+OaHoABZyjPC2kqU1ZHWDaleJDx U3cFdYMV6AzGpluAVqh5h/YqZsbsg/v5Ywxfd0SfrDK8DCL8O89+OSvBOwuXI14fheEO 8pYJObVxry1uuiPjqYUYxH2r9hrJ1aHOGrHl3GN0gz7AokIBD34/MZmy+QkL6rWxHfZn sF7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=0JPNS52j; dkim=neutral (no key) header.i=@linutronix.de header.b=BXxWrGSa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id y17-20020a056a00191100b006be0f482c0fsi7080560pfi.63.2023.11.05.16.35.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Nov 2023 16:35:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=0JPNS52j; dkim=neutral (no key) header.i=@linutronix.de header.b=BXxWrGSa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 623E2806006D; Sun, 5 Nov 2023 16:35:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229981AbjKFAd5 (ORCPT + 99 others); Sun, 5 Nov 2023 19:33:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230155AbjKFA3K (ORCPT ); Sun, 5 Nov 2023 19:29:10 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AC35E0; Sun, 5 Nov 2023 16:29:07 -0800 (PST) Date: Mon, 06 Nov 2023 00:28:55 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1699230545; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3xq+5DOBB1dI8DqvWcQNMKQaktWNVBj4yETwIhzumWk=; b=0JPNS52jezPkRhpIsy+sdBlsR+IxydmPcv9GQDN1nWmSgceikJeXdzfCk5HitlyMZ5Pt/g Gu9ZS4jh9qtp8mJzm9zTrs7Mssum+B1T8B8cGcKFtD/ScDJo+uGiecu8AkJnW3oQ47XM0F lJzu5tcGUt8kFuxdxepbj5TzhXo4pdo8tQ2etZcbqaLfGnHJXaxB7XJxcoscGTEZOEu69y fMbEsZVfusnHak4y5+27SPHytdz2I+Y5sF8SEvt1akTEJuwB9H5jPJkyUgOeI6KcQBVuvU YlHLN4GuBQL/aOB0dzwG7Cx0ksvXdubXB1iA06TC+eXINYL5v5Urs6QZKaLMEg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1699230545; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3xq+5DOBB1dI8DqvWcQNMKQaktWNVBj4yETwIhzumWk=; b=BXxWrGSaNdoEmZsMCeYZdHtbMthhI1C7qtnSN4G8oUkrs9YV+dGDuPb/uHt9HTx3klkfw4 n3IfdX6P7IrYPPDA== From: "tip-bot2 for Fang Xiang" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/urgent] irqchip/gic-v3-its: Flush ITS tables correctly in non-coherent GIC designs Cc: Marc Zyngier , Fang Xiang , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231030083256.4345-1-fangxiang3@xiaomi.com> References: <20231030083256.4345-1-fangxiang3@xiaomi.com> MIME-Version: 1.0 Message-ID: <169923053565.3135.5315727184274747802.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sun, 05 Nov 2023 16:35:33 -0800 (PST) The following commit has been merged into the irq/urgent branch of tip: Commit-ID: d3badb15613c14dd35d3495b1dde5c90fcd616dd Gitweb: https://git.kernel.org/tip/d3badb15613c14dd35d3495b1dde5c90fcd616dd Author: Fang Xiang AuthorDate: Mon, 30 Oct 2023 16:32:56 +08:00 Committer: Thomas Gleixner CommitterDate: Mon, 06 Nov 2023 01:16:33 +01:00 irqchip/gic-v3-its: Flush ITS tables correctly in non-coherent GIC designs In non-coherent GIC designs, the ITS tables must be flushed before writing to the GITS_BASER registers, otherwise the ITS could read dirty tables, which results in unpredictable behavior. Flush the tables right at the begin of its_setup_baser() to prevent that. [ tglx: Massage changelog ] Fixes: a8707f553884 ("irqchip/gic-v3: Add Rockchip 3588001 erratum workaround") Suggested-by: Marc Zyngier Signed-off-by: Fang Xiang Signed-off-by: Thomas Gleixner Reviewed-by: Marc Zyngier Link: https://lore.kernel.org/r/20231030083256.4345-1-fangxiang3@xiaomi.com --- drivers/irqchip/irq-gic-v3-its.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index a8c89df..9a7a742 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -2379,12 +2379,12 @@ retry_baser: break; } + if (!shr) + gic_flush_dcache_to_poc(base, PAGE_ORDER_TO_SIZE(order)); + its_write_baser(its, baser, val); tmp = baser->val; - if (its->flags & ITS_FLAGS_FORCE_NON_SHAREABLE) - tmp &= ~GITS_BASER_SHAREABILITY_MASK; - if ((val ^ tmp) & GITS_BASER_SHAREABILITY_MASK) { /* * Shareability didn't stick. Just use @@ -2394,10 +2394,9 @@ retry_baser: * non-cacheable as well. */ shr = tmp & GITS_BASER_SHAREABILITY_MASK; - if (!shr) { + if (!shr) cache = GITS_BASER_nC; - gic_flush_dcache_to_poc(base, PAGE_ORDER_TO_SIZE(order)); - } + goto retry_baser; } @@ -2609,6 +2608,11 @@ static int its_alloc_tables(struct its_node *its) /* erratum 24313: ignore memory access type */ cache = GITS_BASER_nCnB; + if (its->flags & ITS_FLAGS_FORCE_NON_SHAREABLE) { + cache = GITS_BASER_nC; + shr = 0; + } + for (i = 0; i < GITS_BASER_NR_REGS; i++) { struct its_baser *baser = its->tables + i; u64 val = its_read_baser(its, baser);