Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3635505ybg; Fri, 25 Oct 2019 06:55:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFaHI/k/yJHIdo0zERGRsIdfThvdTBam7BEneKvHYcUYJ8X0SlFePODxbsvJGkL8iqJPTe X-Received: by 2002:a17:906:e296:: with SMTP id gg22mr3685328ejb.211.1572011749575; Fri, 25 Oct 2019 06:55:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572011749; cv=none; d=google.com; s=arc-20160816; b=WIWgSZ1spPQweUeNRq0lrgUkNhX/Mx1ZZjdequBD824FpDt1KlZA3LkFayla3yq7SH zqIMpev43ZAt780cEaNGWr6dnd40dVSXQKl+13UQO5t2AgtrMW9LOKUdHfCyaZYc40Jz gANHAyEiMor7A5hz/I3qCif/IAOIRgpyIxfDIsKWX67WUjspCHq4EeEO6wlMGWYFLsxm 9hb7rOwM91SyFOBnqnYBw0+o/gNvEMrJI4JfckSFKgrISIprv0a9Z5ng5322E+0vs88G +hCJq95NhsT0ZhwiLz2iHIY0AVH/BqIdMhuslCtpCE2/dVEbY8BWTIGF7IqmpQBLeq1k tgcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=UcBPcAPMYq3ql7XZolJWjM40KQcfZi7nEuSg4RQDIuc=; b=skx/1YJ//2XZzysnxQMvCfRVDEnKV4Ksy1IcTvSivg4/SlYICZ+5tvBl9Hq+g+4LzC j9IF1zOSOkUQPFasTnGQweuuCvENtCu/ki7V17L3zOYJcjjTeRC0Z6p7/GesXLc7jslO UjM8UNpMfHTPmO/BjLezfPpDdjWc9laVjJK3uYKRGsP/6gSHYnd350tFWWMSgqWHUOjD PE6nDfnCRldZqaNI5+Qtdqz/kC9EhUYMVSjCjKFB+94vWlOxopDvr4WrMCYEh/kxZwdW MssEVbkRylIkrZTcPevUKaTOOXK8rsDQd54UkLBV7QuO+aX0u45t1+vo4CKhyt/7UBA7 JplA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ouz4PbLg; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 13si1417270edw.357.2019.10.25.06.55.25; Fri, 25 Oct 2019 06:55:49 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ouz4PbLg; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502332AbfJXNJR (ORCPT + 99 others); Thu, 24 Oct 2019 09:09:17 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:40667 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730867AbfJXNJQ (ORCPT ); Thu, 24 Oct 2019 09:09:16 -0400 Received: by mail-lf1-f66.google.com with SMTP id i15so11660240lfo.7 for ; Thu, 24 Oct 2019 06:09:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=UcBPcAPMYq3ql7XZolJWjM40KQcfZi7nEuSg4RQDIuc=; b=Ouz4PbLg3SeM/SRzKwbpYWtMvLrdJ6nOXnWQL0oUQhHWeGv2Mw58FeTuy/DJXAzYZ3 +CGlc91Gh/uDfemb2YnBDYRG4mREUzJ26nWAuYs1id0BVvBF4PKggM4GaRcnWpVoGpVT 41TqNQx9bbMIK7CxLzbB9PwKXWq4IIEx/oy8U3BBUTeO0s+Tw+7S7QsaJfQfcpzbSC8N PSSgzAXE5chQDW2RsAPMrmAsBSXpM/9+FyW7vIYG9iQXXiUTn+9EzpNJ0f3jbj/dZk51 h+c6HNv46YaTCOw1eXDjFT1HqVBIGHAtTqYVqJTmv/Gk2l2Ao9PUPU7+S4jvenhE/Tzg 8xUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=UcBPcAPMYq3ql7XZolJWjM40KQcfZi7nEuSg4RQDIuc=; b=EyKxaBTtAGaPe6mGqwEyMLA+SKzr3UhyBg4LPRW4LPSfcCu+HfWcTSCQ9AlNp+u944 aJeFZlvPosdi/p/bAOAA6lTpzqQZjNwOIHoT3B7MVVpYTAiRWXS8+F1jZ3ZR8UiWXLXe ebTZUUQAxWaK6nzKiZeV4muClXGQhjHzWVWWUae6FrF/ghO6thNKqOBNCoMraZ1BSFPv fb/1/2XirAmR8ainu1YMjyNX3EgO3G2ydCJjwXouGu24BXohR13v2sErltRfejify46s vCuk7L6zq1PbljkbOBIeCIy0KCppL+detlvIr5olFrzs/fJtBOCvMOgfsN0kr+yA4Jp+ 7xig== X-Gm-Message-State: APjAAAVEvIRGtdw3vHZ7ZFksSNS9coF47+k3Kk293dwOmmvjMYtIaD/J 2rcVi+B7kfMYOwUV/CmMpavVfUrM8ePIUAMoodY= X-Received: by 2002:ac2:4345:: with SMTP id o5mr11786215lfl.60.1571922554635; Thu, 24 Oct 2019 06:09:14 -0700 (PDT) MIME-Version: 1.0 References: <20191024093716.49420-1-steven.price@arm.com> <20191024093716.49420-8-steven.price@arm.com> In-Reply-To: <20191024093716.49420-8-steven.price@arm.com> From: Zong Li Date: Thu, 24 Oct 2019 21:09:03 +0800 Message-ID: Subject: Re: [PATCH v13 07/22] riscv: mm: Add p?d_leaf() definitions To: Steven Price Cc: linux-mm@kvack.org, Mark Rutland , Peter Zijlstra , Catalin Marinas , Dave Hansen , "H. Peter Anvin" , linux-riscv@lists.infradead.org, Will Deacon , "Liang, Kan" , Alexandre Ghiti , x86@kernel.org, Ingo Molnar , Palmer Dabbelt , Albert Ou , Arnd Bergmann , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Borislav Petkov , Andy Lutomirski , Paul Walmsley , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Linux Kernel Mailing List , James Morse , Andrew Morton Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Steven Price =E6=96=BC 2019=E5=B9=B410=E6=9C=8824=E6= =97=A5 =E9=80=B1=E5=9B=9B =E4=B8=8B=E5=8D=885:40=E5=AF=AB=E9=81=93=EF=BC=9A > > walk_page_range() is going to be allowed to walk page tables other than > those of user space. For this it needs to know when it has reached a > 'leaf' entry in the page tables. This information is provided by the > p?d_leaf() functions/macros. > > For riscv a page is a leaf page when it has a read, write or execute bit > set on it. > > CC: Palmer Dabbelt > CC: Albert Ou > CC: linux-riscv@lists.infradead.org > Reviewed-by: Alexandre Ghiti > Acked-by: Paul Walmsley # for arch/riscv > Signed-off-by: Steven Price > --- > arch/riscv/include/asm/pgtable-64.h | 7 +++++++ > arch/riscv/include/asm/pgtable.h | 7 +++++++ > 2 files changed, 14 insertions(+) > > diff --git a/arch/riscv/include/asm/pgtable-64.h b/arch/riscv/include/asm= /pgtable-64.h > index 74630989006d..4c4d2c65ba6c 100644 > --- a/arch/riscv/include/asm/pgtable-64.h > +++ b/arch/riscv/include/asm/pgtable-64.h > @@ -43,6 +43,13 @@ static inline int pud_bad(pud_t pud) > return !pud_present(pud); > } > > +#define pud_leaf pud_leaf > +static inline int pud_leaf(pud_t pud) > +{ > + return pud_present(pud) && > + (pud_val(pud) & (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC)); > +} > + > static inline void set_pud(pud_t *pudp, pud_t pud) > { > *pudp =3D pud; > diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pg= table.h > index 7255f2d8395b..3aa972dda75a 100644 > --- a/arch/riscv/include/asm/pgtable.h > +++ b/arch/riscv/include/asm/pgtable.h > @@ -130,6 +130,13 @@ static inline int pmd_bad(pmd_t pmd) > return !pmd_present(pmd); > } > > +#define pmd_leaf pmd_leaf > +static inline int pmd_leaf(pmd_t pmd) > +{ > + return pmd_present(pmd) && > + (pmd_val(pmd) & (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC)); > +} > + > static inline void set_pmd(pmd_t *pmdp, pmd_t pmd) > { > *pmdp =3D pmd; > -- > 2.20.1 > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv It's good to me. Reviewed-by: Zong Li