Re: [PATCH v3 05/11] arc: mm: Convert to GENERIC_IOREMAP
From: Baoquan He
Date: Thu Oct 13 2022 - 05:51:48 EST
On 10/12/22 at 10:17am, Christophe Leroy wrote:
......
> > -/*
> > - * ioremap with access flags
> > - * Cache semantics wise it is same as ioremap - "forced" uncached.
> > - * However unlike vanilla ioremap which bypasses ARC MMU for addresses in
> > - * ARC hardware uncached region, this one still goes thru the MMU as caller
> > - * might need finer access control (R/W/X)
> > - */
> > -void __iomem *ioremap_prot(phys_addr_t paddr, unsigned long size,
> > - unsigned long flags)
> > +void __iomem *
> > +arch_ioremap(phys_addr_t *paddr, size_t size, unsigned long *prot_val)
> > {
> > - unsigned int off;
> > - unsigned long vaddr;
> > - struct vm_struct *area;
> > - phys_addr_t end;
> > - pgprot_t prot = __pgprot(flags);
> > -
> > - /* Don't allow wraparound, zero size */
> > - end = paddr + size - 1;
> > - if ((!size) || (end < paddr))
> > - return NULL;
> > -
> > /* An early platform driver might end up here */
> > if (!slab_is_available())
> > - return NULL;
> > + return IOMEM_ERR_PTR(-EINVAL);
>
> I think the slab_is_available() check should be done in the generic
> functions. On all architectures SLAB must be available before you can
> use get_vm_area_caller() and vunmap()
Tend to agree.
W/o slab initialized, the get_vm_area_caller() calling definitely will
fail. The arch's early ioremap code could call into this.