[RFC PATCH V4 1/6] riscv: pgtable: Add custom protection_map init

Guo Ren guoren at kernel.org
Wed Sep 15 16:52:09 PDT 2021


Hi Christoph,

On Wed, Sep 15, 2021 at 3:46 PM Christoph Hellwig <hch at lst.de> wrote:
>
> On Sat, Sep 11, 2021 at 05:21:34PM +0800, guoren at kernel.org wrote:
> > From: Guo Ren <guoren at linux.alibaba.com>
> >
> > Some RISC-V CPU vendors have defined their own PTE attributes to
> > solve non-coherent DMA bus problems. That makes _P/SXXX definitions
> > contain global variables which could be initialized at the early
> > boot stage before setup_vm. The patch prevents compile errors.
>
> That sounds way to nice for someone who deliberatly ignores the
> specification and should definitively not go into the kernel
> commit log like this.
Okay. In the next version, I will optimize the wording.

>
> > This patch is similar to 316d097c4cd4  (x86/pti: Filter at
> > vma->vm_page_prot population) which give a choice for arch custom
> > implementation.
>
> How?  To me it looks like a bad duplication of such functionality in
> a way that totally breaks abstractions.  architectures really do not
> have any business changing protection_map.
D1's _P/SXXX definintion is different from riscv standard spec to get
non-coherency supported. It sets the highest bits and current spec
must keep zero. So we using a global variable struct in the _P/SXXX
definition to let vendors init their own _P/SXXX values during
bootstrap that is very early stage before setup_vm().


-- 
Best Regards
 Guo Ren

ML: https://lore.kernel.org/linux-csky/



More information about the linux-riscv mailing list