On Fri, Apr 29, 2016 at 01:38:00PM +0200, Alexander Gordeev wrote: > Make x86 consistent with other architectures and put > IO specific defines to lib/x86/asm/io.h > > Cc: Andrew Jones <drjones@xxxxxxxxxx> > Cc: Thomas Huth <thuth@xxxxxxxxxx> > Cc: Radim Krčmář <rkrcmar@xxxxxxxxxx> > Signed-off-by: Alexander Gordeev <agordeev@xxxxxxxxxx> > --- > lib/x86/{ => asm}/io.h | 14 ++++++++++++-- > lib/x86/asm/pci.h | 2 +- > lib/x86/io.c | 2 +- > lib/x86/vm.h | 11 +---------- > x86/eventinj.c | 7 +------ > x86/hyperv.c | 1 + > x86/hyperv.h | 1 - > x86/hyperv_stimer.c | 1 - > x86/hyperv_synic.c | 1 - > x86/init.c | 2 +- > x86/svm.c | 1 - > x86/vmexit.c | 1 - > x86/vmx.c | 1 - > x86/vmx_tests.c | 1 - > 14 files changed, 18 insertions(+), 28 deletions(-) > rename lib/x86/{ => asm}/io.h (79%) Assuming x86 (both 32-bit and 64-bit) have been at least compile tested with all these patches one at a time, i.e. no individual patch breaks the build, even temporarily in between patches. Then, Reviewed-by: Andrew Jones <drjones@xxxxxxxxxx> > > diff --git a/lib/x86/io.h b/lib/x86/asm/io.h > similarity index 79% > rename from lib/x86/io.h > rename to lib/x86/asm/io.h > index bd6341c..c944df4 100644 > --- a/lib/x86/io.h > +++ b/lib/x86/asm/io.h > @@ -1,5 +1,5 @@ > -#ifndef IO_H > -#define IO_H > +#ifndef _ASM_X86_IO_H_ > +#define _ASM_X86_IO_H_ > > static inline unsigned char inb(unsigned short port) > { > @@ -37,4 +37,14 @@ 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; > +} > + > #endif > diff --git a/lib/x86/asm/pci.h b/lib/x86/asm/pci.h > index 4ec20e1..cddde41 100644 > --- a/lib/x86/asm/pci.h > +++ b/lib/x86/asm/pci.h > @@ -7,7 +7,7 @@ > */ > #include "libcflat.h" > #include "pci.h" > -#include "x86/io.h" > +#include "x86/asm/io.h" > > static inline uint32_t pci_config_read(pcidevaddr_t dev, uint8_t reg) > { > diff --git a/lib/x86/io.c b/lib/x86/io.c > index d3b971e..d396d42 100644 > --- a/lib/x86/io.c > +++ b/lib/x86/io.c > @@ -1,6 +1,6 @@ > #include "libcflat.h" > #include "smp.h" > -#include "io.h" > +#include "asm/io.h" > #ifndef USE_SERIAL > #define USE_SERIAL > #endif > diff --git a/lib/x86/vm.h b/lib/x86/vm.h > index 72f84e6..6a4384f 100644 > --- a/lib/x86/vm.h > +++ b/lib/x86/vm.h > @@ -3,6 +3,7 @@ > > #include "processor.h" > #include "asm/page.h" > +#include "asm/io.h" > > void setup_vm(); > > @@ -27,14 +28,4 @@ unsigned long *install_large_page(unsigned long *cr3,unsigned long phys, > void *virt); > unsigned long *install_page(unsigned long *cr3, unsigned long phys, void *virt); > > -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; > -} > - > #endif > diff --git a/x86/eventinj.c b/x86/eventinj.c > index 57c2a2d..84dfe71 100644 > --- a/x86/eventinj.c > +++ b/x86/eventinj.c > @@ -16,11 +16,6 @@ static inline void io_delay(void) > { > } > > -static inline void outl(int addr, int val) > -{ > - asm volatile ("outl %1, %w0" : : "d" (addr), "a" (val)); > -} > - > void apic_self_ipi(u8 v) > { > apic_icr_write(APIC_DEST_SELF | APIC_DEST_PHYSICAL | APIC_DM_FIXED | > @@ -32,7 +27,7 @@ void apic_self_nmi(void) > apic_icr_write(APIC_DEST_PHYSICAL | APIC_DM_NMI | APIC_INT_ASSERT, 0); > } > > -#define flush_phys_addr(__s) outl(0xe4, __s) > +#define flush_phys_addr(__s) outl(__s, 0xe4) > #define flush_stack() do { \ > int __l; \ > flush_phys_addr(virt_to_phys(&__l)); \ > diff --git a/x86/hyperv.c b/x86/hyperv.c > index 824773d..2511aa2 100644 > --- a/x86/hyperv.c > +++ b/x86/hyperv.c > @@ -1,4 +1,5 @@ > #include "hyperv.h" > +#include "asm/io.h" > > static void synic_ctl(u8 ctl, u8 vcpu_id, u8 sint) > { > diff --git a/x86/hyperv.h b/x86/hyperv.h > index faf931b..434a933 100644 > --- a/x86/hyperv.h > +++ b/x86/hyperv.h > @@ -3,7 +3,6 @@ > > #include "libcflat.h" > #include "processor.h" > -#include "io.h" > > #define HYPERV_CPUID_FEATURES 0x40000003 > > diff --git a/x86/hyperv_stimer.c b/x86/hyperv_stimer.c > index bf2e429..9a971ef 100644 > --- a/x86/hyperv_stimer.c > +++ b/x86/hyperv_stimer.c > @@ -5,7 +5,6 @@ > #include "vm.h" > #include "apic.h" > #include "desc.h" > -#include "io.h" > #include "smp.h" > #include "atomic.h" > #include "hyperv.h" > diff --git a/x86/hyperv_synic.c b/x86/hyperv_synic.c > index 6e08894..4bd07c3 100644 > --- a/x86/hyperv_synic.c > +++ b/x86/hyperv_synic.c > @@ -5,7 +5,6 @@ > #include "vm.h" > #include "apic.h" > #include "desc.h" > -#include "io.h" > #include "smp.h" > #include "atomic.h" > #include "hyperv.h" > diff --git a/x86/init.c b/x86/init.c > index 344dc1c..f47d671 100644 > --- a/x86/init.c > +++ b/x86/init.c > @@ -1,6 +1,6 @@ > #include "libcflat.h" > #include "apic.h" > -#include "io.h" > +#include "asm/io.h" > > #define KBD_CCMD_READ_OUTPORT 0xD0 /* read output port */ > #define KBD_CCMD_WRITE_OUTPORT 0xD1 /* write output port */ > diff --git a/x86/svm.c b/x86/svm.c > index 934b2ae..401ff6c 100644 > --- a/x86/svm.c > +++ b/x86/svm.c > @@ -6,7 +6,6 @@ > #include "vm.h" > #include "smp.h" > #include "types.h" > -#include "io.h" > > /* for the nested page table*/ > u64 *pml4e; > diff --git a/x86/vmexit.c b/x86/vmexit.c > index 9e04975..db7dbd8 100644 > --- a/x86/vmexit.c > +++ b/x86/vmexit.c > @@ -6,7 +6,6 @@ > #include "x86/vm.h" > #include "x86/desc.h" > #include "x86/acpi.h" > -#include "x86/io.h" > > struct test { > void (*func)(void); > diff --git a/x86/vmx.c b/x86/vmx.c > index 6618008..411ed32 100644 > --- a/x86/vmx.c > +++ b/x86/vmx.c > @@ -35,7 +35,6 @@ > #include "vmx.h" > #include "msr.h" > #include "smp.h" > -#include "io.h" > > u64 *vmxon_region; > struct vmcs *vmcs_root; > diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c > index 71c571c..e83c8a2 100644 > --- a/x86/vmx_tests.c > +++ b/x86/vmx_tests.c > @@ -7,7 +7,6 @@ > #include "msr.h" > #include "processor.h" > #include "vm.h" > -#include "io.h" > #include "fwcfg.h" > #include "isr.h" > #include "apic.h" > -- > 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