[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211102060424.GA27015@lst.de>
Date: Tue, 2 Nov 2021 07:04:24 +0100
From: Christoph Hellwig <hch@....de>
To: Wei Fu <wefu@...hat.com>
Cc: Christoph Hellwig <hch@...radead.org>,
Anup Patel <anup.patel@....com>,
Atish Patra <atish.patra@....com>,
Palmer Dabbelt <palmerdabbelt@...gle.com>, guoren@...nel.org,
christoph.muellner@...ll.eu,
Philipp Tomsich <philipp.tomsich@...ll.eu>,
Christoph Hellwig <hch@....de>,
Liu Shaohua <liush@...winnertech.com>,
Wei Wu (吴伟) <lazyparser@...il.com>,
Drew Fustini <drew@...gleboard.org>,
linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
taiten.peng@...onical.com, aniket.ponkshe@...onical.com,
heinrich.schuchardt@...onical.com, gordan.markus@...onical.com,
guoren@...ux.alibaba.com, Arnd Bergmann <arnd@...db.de>,
Chen-Yu Tsai <wens@...e.org>,
Maxime Ripard <maxime@...no.tech>,
Daniel Lustig <dlustig@...dia.com>,
Greg Favor <gfavor@...tanamicro.com>,
Andrea Mondelli <andrea.mondelli@...wei.com>,
Jonathan Behrens <behrensj@....edu>,
Xinhaoqu <xinhaoqu@...wei.com>,
Bill Huffman <huffman@...ence.com>,
Nick Kossifidis <mick@....forth.gr>,
Allen Baum <allen.baum@...erantotech.com>,
Josh Scheid <jscheid@...tanamicro.com>,
Richard Trauben <rtrauben@...il.com>
Subject: Re: [RESEND PATCH V3 2/2] riscv: add RISC-V Svpbmt extension
supports
On Mon, Oct 25, 2021 at 10:49:11PM +0800, Wei Fu wrote:
> > > + >> _PAGE_PFN_SHIFT);
> >
> > > static inline unsigned long _pmd_pfn(pmd_t pmd)
> > > {
> > > - return pmd_val(pmd) >> _PAGE_PFN_SHIFT;
> > > + return (pmd_val(pmd) & _PAGE_CHG_MASK) >> _PAGE_PFN_SHIFT;
> > > }
> >
> > The "(pud_val(pud) & _PAGE_CHG_MASK) >> _PAGE_PFN_SHIFT" expression begs
> > for readable and well-documented helper.
>
> How about these:
> #define _chg_of_pmd(pmd) (pmd_val(pmd) & _PAGE_CHG_MASK)
> #define _chg_of_pud(pud) (pud_val(pud) & _PAGE_CHG_MASK)
I'd use inline functions instead of macros if possible, but otherwise
yes.
> How about :
>
> extern unsigned long _svpbmt_mask
> extern unsigned long _svpbmt_mt_pma
> extern unsigned long _svpbmt_mt_nc
> extern unsigned long _svpbmt_mt_io
>
> #define _PAGE_MT_MASK _svpbmt_mask
> #define _PAGE_MT_PMA _svpbmt_mt_pma
> #define _PAGE_MT_NC _svpbmt_mt_nc
> #define _PAGE_MT_IO _svpbmt_mt_io
Looks much better.
Powered by blists - more mailing lists