Re: [RESEND PATCH V3 2/2] riscv: add RISC-V Svpbmt extension supports

From: Wei Fu
Date: Sun Nov 07 2021 - 02:00:14 EST


Hi Christoph,

Great thanks for your review.

On Tue, Nov 2, 2021 at 2:04 PM Christoph Hellwig <hch@xxxxxx> wrote:
>
> 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.

Great thanks for your suggestion, I will change this to inline :-)


>
> > 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.
Thanks , will do this way

>