lkml.org 
[lkml]   [2021]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.

\
 
 \ /
  Last update: 2021-11-02 07:05    [W:0.065 / U:0.404 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site