From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 95742C25B47 for ; Fri, 27 Oct 2023 03:10:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=eMFCHdx56ZLMScbO/CpJLlkY/bVJAZ/36XcVgH7SlwE=; b=ueN6w0GFgtzEfo 3woYlOzEEjnxi61ehWu4U5LM0Wp5FCm2N9qVu2FQxF49X8Cnc+2/rCvVexYzjk4ETm7sJdT9ydINK dglG08fTnDHNqbWrnSb2IeJbeTKXxCOuW3xrEjWZcfK7YQC1EqRusYQy9mHaigGSfK9e+ATSbyTPz cxELXRGyOK3DORmeZUmWkin1QSj7a7Tz6QaszqIz2M1pEEksr/z/n42kDPSyfOmKGq36nIMnhh4yU Ben0b6BCmCLDMcWB/4TKBGSMLZyijdoFSKhlxAW7XSa77aC7S/nf3M1WV8CnRUo7q9G2wahbLU61n nsRGYC0ROaBj8Ph+Wytg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qwDF2-00FUT9-0r; Fri, 27 Oct 2023 03:10:32 +0000 Received: from outboundhk.mxmail.xiaomi.com ([207.226.244.122]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qwDEz-00FUSM-2T for linux-arm-kernel@lists.infradead.org; Fri, 27 Oct 2023 03:10:31 +0000 X-IronPort-AV: E=Sophos;i="6.03,255,1694707200"; d="scan'208";a="94522298" From: Fang Xiang To: , , , CC: Subject: [PATCH v2] irqchip/gic-v3-its: Flush ITS tables before writing GITS_BASER registers in non-coherent GIC designs. Date: Fri, 27 Oct 2023 11:10:07 +0800 Message-ID: <20231027031007.2088-1-fangxiang3@xiaomi.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.237.8.22] X-ClientProxiedBy: BJ-MBX02.mioffice.cn (10.237.8.122) To BJ-MBX15.mioffice.cn (10.237.8.135) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231026_201029_978387_E76F18C3 X-CRM114-Status: GOOD ( 12.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In non-coherent GIC design, ITS tables should be clean and flushed to the PoV of the ITS before writing GITS_BASER registers. And hoist the quirked non-shareable attributes earlier to save effort in tables setup. Signed-off-by: Fang Xiang Link to v1: https://lore.kernel.org/all/20231026020116.4238-1-fangxiang3@xiaomi.com/ v1 -> v2: - Flush ITS tables before writing GITS_BASER registers - Hoist the quirked non-shareable attributes earlier --- 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 75a2dd550625..d76d44ea2de1 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -2379,12 +2379,12 @@ static int its_setup_baser(struct its_node *its, struct its_baser *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 @@ static int its_setup_baser(struct its_node *its, struct its_baser *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); -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel