Re: [PATCH 02/11] mm: ioremap: fixup the physical address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/04/22 at 06:02pm, Alexander Gordeev wrote:
> On Mon, Aug 01, 2022 at 10:40:20PM +0800, Baoquan He wrote:
> > This is a preparation patch, no functionality change.
> 
> There is, please see below.
> 
> > @@ -3,11 +3,17 @@
> >  #include <linux/mm.h>
> >  #include <linux/io.h>
> >  
> > -void __iomem *ioremap_allowed(phys_addr_t phys_addr, size_t size, unsigned long prot)
> > +void __iomem *
> > +ioremap_allowed(phys_addr_t *paddr, size_t size, unsigned long *prot_val)
> >  {
> > -	unsigned long last_addr = phys_addr + size - 1;
> > +	unsigned long last_addr, offset, phys_addr = *paddr;
> >  	int ret = -EINVAL;
> >  
> > +	offset = phys_addr & (~PAGE_MASK);
> > +	phys_addr -= offset;
> 
> FWIW, phys_addr &= PAGE_MASK looks much more usual.
> 
> > @@ -11,13 +11,20 @@
> >  #include <linux/io.h>
> >  #include <linux/export.h>
> >  
> > -void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
> > +void __iomem *ioremap_prot(phys_addr_t paddr, size_t size,
> >  			   unsigned long prot)
> >  {
> >  	unsigned long offset, vaddr;
> > -	phys_addr_t last_addr;
> > +	phys_addr_t last_addr, phys_addr = paddr;
> >  	struct vm_struct *area;
> >  	void __iomem *base;
> > +	unsigned long prot_val = prot;
> 
> Why prot_val is needed?
> 
> > +	base = ioremap_allowed(&phys_addr, size, &prot_val);
> > +	if (IS_ERR(base))
> > +		return NULL;
> > +	else if (base)
> > +		return base;
> 
> By moving ioremap_allowed() here you allow it to be called
> before the wrap-around check, including architectures that
> do not do fixups.
> 
> And now ioremap_allowed() semantics, prototype and name turn
> less than obvious. Why not introduce a separate fixup callback?

I finally renamed ioremap_allowed()/iounmap_allowed() to arch_ioremap()
and arch_iounmap(). I didn't introduce a separate fixup callback, and
have added more explanation to log of patch 1~2, please check that.





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux