Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3576308yba; Mon, 29 Apr 2019 05:05:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7MIYEgKnnNU0terWucZFBbtlnbvuks8hD0TeqaUipvjpYdJVSrY0t97mNtgmH2P3c5qQL X-Received: by 2002:a63:d803:: with SMTP id b3mr30254866pgh.267.1556539528085; Mon, 29 Apr 2019 05:05:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556539528; cv=none; d=google.com; s=arc-20160816; b=JVzUfZNTrHTXilRfKoZQpO0J/3irjMJuSimGGsicmOP1gyfbvXpy8SvsIKG39GvUvE nNb3wRkXbRqOfMZsA33e4aODF0nEkzk1iCw4WvbjnY75ejYARPMxnLzvSCu/EyWK8bKU DRGH3A5dfm+OhNGKM4gVK3H0F2FtePrUuTVtfW0wa4znXu0DIbxP/CbnpXfT5gIH+L5W F+Jo/Df5OUaVGtMFbO1pcZZRekpkIG2SMp5LW1PkYohFti373Hw78upfDhBJi8+17263 a0tkbv2/T4r3cf7H1OjLuCIeK1t34yss1EbekeCweg4qDCCI10iUZg+Qumdc0FZE+RWp yaOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=LfbfcCd4V5baDAFIexcYGLHohvMIq6kR68PUdA0YX1g=; b=J6rPQX4JMDhQHu2BruFRQthYs63vhzVjRyI0m/9GJ2vriu33ow6GnuuImVB6eA2UAQ 2hVRpZgHX6aOAqVR4Q6duZ1GanukRDMT1l6l/YZiLGuORcBOzKts7mx/tKIcMHO7ENOq rk/UPePoZBotdJfB1RXgcyZulNoVhByQ/yttKT4u+MWHdExk+6E8R2ktx535rnCv/Ahy 4KNqliB4A9lY4k/zd010OdhgTpQYruD1Nt4ZSEFPXqvPPa4wuADSlI2i0HsKEdcUJWXn a+U7BYZiu3+x+/wxBAaE4kde1+2R+erROJ8txGpH85ss1ORe0fpXnXTJYldoq8eXttv2 Ze5A== 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 n3si30371065pgq.202.2019.04.29.05.05.12; Mon, 29 Apr 2019 05:05:28 -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 S1728198AbfD2MDu (ORCPT + 99 others); Mon, 29 Apr 2019 08:03:50 -0400 Received: from gate.crashing.org ([63.228.1.57]:41194 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727986AbfD2MDu (ORCPT ); Mon, 29 Apr 2019 08:03:50 -0400 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id x3TC3N75019409; Mon, 29 Apr 2019 07:03:23 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id x3TC3MCq019406; Mon, 29 Apr 2019 07:03:22 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Mon, 29 Apr 2019 07:03:22 -0500 From: Segher Boessenkool To: Christophe Leroy Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Serge Belyshev , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] powerpc/32s: fix BATs setting with CONFIG_STRICT_KERNEL_RWX Message-ID: <20190429120322.GP8599@gate.crashing.org> References: <3a21c6f19637847e6ed080186a834ede619f3849.1556528569.git.christophe.leroy@c-s.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3a21c6f19637847e6ed080186a834ede619f3849.1556528569.git.christophe.leroy@c-s.fr> User-Agent: Mutt/1.4.2.3i Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Acked-by: Segher Boessenkool (But see comments below.) On Mon, Apr 29, 2019 at 09:08:09AM +0000, Christophe Leroy wrote: > diff --git a/arch/powerpc/mm/ppc_mmu_32.c b/arch/powerpc/mm/ppc_mmu_32.c > index bf1de3ca39bc..37cf2af98f6a 100644 > --- a/arch/powerpc/mm/ppc_mmu_32.c > +++ b/arch/powerpc/mm/ppc_mmu_32.c > @@ -101,7 +101,7 @@ static int find_free_bat(void) > static unsigned int block_size(unsigned long base, unsigned long top) > { > unsigned int max_size = (cpu_has_feature(CPU_FTR_601) ? 8 : 256) << 20; > - unsigned int base_shift = (fls(base) - 1) & 31; > + unsigned int base_shift = (ffs(base) - 1) & 31; > unsigned int block_shift = (fls(top - base) - 1) & 31; The code is quite confusing now... Add a comment, or improve it? Segher