Re: [PATCH v2 6/9] x86: Optimize virt_to_phys() and phys_to_virt()

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

 



On Wed, Apr 27, 2016 at 06:54:22PM +0200, Alexander Gordeev wrote:
> On Wed, Apr 27, 2016 at 03:58:02PM +0200, Andrew Jones wrote:
> > On Wed, Apr 27, 2016 at 03:13:55PM +0200, Alexander Gordeev wrote:
> > > Make use of generic implementations and remove x86
> > > specific virt_to_phys() and phys_to_virt() functions.
> > 
> > I would drop this patch. If x86 needs/wants more stuff from
> > lib/asm-generic/io.h at a later time, then it can be brought
> > in then.
> 
> Will drop it.
> 
> But I do not get your point :) The x86 variants almost duplicate
> the generic ones - so why x86 would not want to bring it?

yes, but a whole file full of stuff is a lot to bring in just to
take advantage of two functions (virt_to_phys/phys_to_virt) that
are likely better off being written more arch-specific sometime
anyway.

thanks,
drew

> 
> > thanks,
> > drew
> > 
> > > 
> > > Cc: Andrew Jones <drjones@xxxxxxxxxx>
> > > Cc: Thomas Huth <thuth@xxxxxxxxxx>
> > > Cc: Radim Krčmář <rkrcmar@xxxxxxxxxx>
> > > Signed-off-by: Alexander Gordeev <agordeev@xxxxxxxxxx>
> > > ---
> > >  lib/asm-generic/io.h |  2 ++
> > >  lib/x86/asm/io.h     | 10 +---------
> > >  lib/x86/asm/page.h   |  3 +++
> > >  3 files changed, 6 insertions(+), 9 deletions(-)
> > > 
> > > diff --git a/lib/asm-generic/io.h b/lib/asm-generic/io.h
> > > index 931415a..3585ac0 100644
> > > --- a/lib/asm-generic/io.h
> > > +++ b/lib/asm-generic/io.h
> > > @@ -165,7 +165,9 @@ static inline unsigned long virt_to_phys(volatile void *address)
> > >  {
> > >  	return __pa((unsigned long)address);
> > >  }
> > > +#endif
> > >  
> > > +#ifndef phys_to_virt
> > >  static inline void *phys_to_virt(unsigned long address)
> > >  {
> > >  	return __va(address);
> > > diff --git a/lib/x86/asm/io.h b/lib/x86/asm/io.h
> > > index 5b901a3..74451d5 100644
> > > --- a/lib/x86/asm/io.h
> > > +++ b/lib/x86/asm/io.h
> > > @@ -40,14 +40,6 @@ static inline void outl(unsigned int value, unsigned short port)
> > >      asm volatile("outl %0, %w1" : : "a"(value), "Nd"(port));
> > >  }
> > >  
> > > -static inline unsigned long virt_to_phys(const void *virt)
> > > -{
> > > -    return (unsigned long)virt;
> > > -}
> > > -
> > > -static inline void *phys_to_virt(unsigned long phys)
> > > -{
> > > -    return (void *)phys;
> > > -}
> > > +#include <asm-generic/io.h>
> > >  
> > >  #endif
> > > diff --git a/lib/x86/asm/page.h b/lib/x86/asm/page.h
> > > index edfe325..a9280ed 100644
> > > --- a/lib/x86/asm/page.h
> > > +++ b/lib/x86/asm/page.h
> > > @@ -24,4 +24,7 @@
> > >  #define	PGDIR_MASK	1023
> > >  #endif
> > >  
> > > +#define __va(x)		((void *)((unsigned long) (x)))
> > > +#define __pa(x)		((unsigned long) (x))
> > > +
> > >  #endif
> > > -- 
> > > 1.8.3.1
> > > 
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe kvm" in
> > > the body of a message to majordomo@xxxxxxxxxxxxxxx
> > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux