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 X-Spam-Level: X-Spam-Status: No, score=-10.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45D84C4346E for ; Thu, 24 Sep 2020 08:08:35 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DC6FF212CC for ; Thu, 24 Sep 2020 08:08:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="151aSRiA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DC6FF212CC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:References:In-Reply-To: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=BeemkY1Ie8XRwDp8YulcvmyOf7e3Xsc0WQRhtChviB0=; b=151aSRiAl3khZTnYQXnW7ZBUH M7NN7/xX0euwuchFAXfU/dvbY4VkAkCtlV8poJDHvR03R7Y470j0DrtYeTRlZXbSXOOBpEDPEGJd2 YExmSYfwia25oZr83iFqAmhoHWdDiRvBdz7jUJMQjuc4s1P4Cr6NcZYO4bwWW7XvMoK5vyNl3pvE3 OqKbjolbwV7d3kvZD1ZMyXvwsdC7G5c0o7S5wzOPrAYTv69y6QhTY3LROxGGJPf8U9FVqRTG2DNxd hWXodB9VshVdnDwYX2mG1UI9S04tTL7xzBQiR+OJeVWGwia88BC5rUlaH9vTa80iovqhQ1giwuFWR EHy2rCNSg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLMHR-0000U3-Fp; Thu, 24 Sep 2020 08:07:05 +0000 Received: from relay10.mail.gandi.net ([217.70.178.230]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLMHO-0000TO-Q3 for linux-arm-kernel@lists.infradead.org; Thu, 24 Sep 2020 08:07:04 +0000 Received: from localhost (lfbn-lyo-1-1913-90.w90-65.abo.wanadoo.fr [90.65.92.90]) (Authenticated sender: gregory.clement@bootlin.com) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 348B2240008; Thu, 24 Sep 2020 08:06:58 +0000 (UTC) From: Gregory CLEMENT To: Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] ARM: mvebu: drop pointless check for coherency_base In-Reply-To: <20200916105654.19784-1-ardb@kernel.org> References: <20200916105654.19784-1-ardb@kernel.org> Date: Thu, 24 Sep 2020 10:06:58 +0200 Message-ID: <87v9g3ha3h.fsf@BL-laptop> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200924_040703_332632_548DDCC5 X-CRM114-Status: GOOD ( 20.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , Sebastian Hesselbarth , Ard Biesheuvel , Thomas Petazzoni , Jason Cooper 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 Hi Ard, > The MMU off code path in ll_get_coherency_base() attempts to decide > whether the coherency fabric is mapped by testing the value of > coherency_base, which carries its virtual address if its mapped, and > 0x0 otherwise. > > However, what the code actually does is take the virtual address of > the coherency_base symbol, and compare it with 0x0, which are never > equal, and so the branch is never taken. In fact, with the MMU off, > dereferencing the VA of coherency_base is not possible to begin with, > nor can its value be relied upon with the MMU off since it is not > cleaned to the Dcache as is done with coherency_phys_base in > armada_370_coherency_init(). > > Instead, the value of coherency_phys_base is returned, which results > in the correct behavior since it will be 0x0 as well if the coherency > fabric is not mapped, and it is accessible with the MMU off. So just > drop the comparison and the branch. Thanks for this patch. I needed to refresh my memories about this subject and I agree with your explanation. I applied it on mvebu/fixes. Gregory > > Fixes: 30cdef97107370a7 ("ARM: mvebu: make the coherency_ll.S functions work with no coherency fabric") > Cc: Thomas Petazzoni > Cc: Jason Cooper > Cc: Andrew Lunn > Cc: Gregory CLEMENT > Cc: Sebastian Hesselbarth > Signed-off-by: Ard Biesheuvel > --- > Found by accident. Build tested only. > > arch/arm/mach-mvebu/coherency_ll.S | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/arch/arm/mach-mvebu/coherency_ll.S b/arch/arm/mach-mvebu/coherency_ll.S > index 2d962fe48821..a3a64bf97250 100644 > --- a/arch/arm/mach-mvebu/coherency_ll.S > +++ b/arch/arm/mach-mvebu/coherency_ll.S > @@ -35,13 +35,8 @@ ENTRY(ll_get_coherency_base) > > /* > * MMU is disabled, use the physical address of the coherency > - * base address. However, if the coherency fabric isn't mapped > - * (i.e its virtual address is zero), it means coherency is > - * not enabled, so we return 0. > + * base address, (or 0x0 if the coherency fabric is not mapped) > */ > - ldr r1, =coherency_base > - cmp r1, #0 > - beq 2f > adr r1, 3f > ldr r3, [r1] > ldr r1, [r1, r3] > -- > 2.17.1 > -- Gregory Clement, Bootlin Embedded Linux and Kernel engineering http://bootlin.com _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel