Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com, mst@redhat.com, agordeev@redhat.com,
	rkrcmar@redhat.com
Subject: [kvm-unit-tests PATCH 02/11] x86: move io.h to asm
Date: Fri, 15 Jan 2016 17:10:07 +0100	[thread overview]
Message-ID: <1452874216-3087-3-git-send-email-drjones@redhat.com> (raw)
In-Reply-To: <1452874216-3087-1-git-send-email-drjones@redhat.com>

Also throw an '#include "asm-generic/io.h"' at the bottom. Doing
that requires also adding an asm/page.h, and then some changes to
vm.[ch] to integrate with it.

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 lib/x86/{ => asm}/io.h | 8 ++++++++
 lib/x86/asm/page.h     | 1 +
 lib/x86/io.c           | 2 +-
 lib/x86/vm.c           | 7 -------
 lib/x86/vm.h           | 4 +++-
 x86/hyperv.h           | 2 +-
 x86/hyperv_stimer.c    | 2 +-
 x86/hyperv_synic.c     | 2 +-
 x86/init.c             | 2 +-
 x86/svm.c              | 2 +-
 x86/vmx.c              | 2 +-
 x86/vmx_tests.c        | 2 +-
 12 files changed, 20 insertions(+), 16 deletions(-)
 rename lib/x86/{ => asm}/io.h (87%)
 create mode 100644 lib/x86/asm/page.h

diff --git a/lib/x86/io.h b/lib/x86/asm/io.h
similarity index 87%
rename from lib/x86/io.h
rename to lib/x86/asm/io.h
index bd6341c6c103e..19f4dd73ae173 100644
--- a/lib/x86/io.h
+++ b/lib/x86/asm/io.h
@@ -1,6 +1,7 @@
 #ifndef IO_H
 #define IO_H
 
+#define inb inb
 static inline unsigned char inb(unsigned short port)
 {
     unsigned char value;
@@ -8,6 +9,7 @@ static inline unsigned char inb(unsigned short port)
     return value;
 }
 
+#define inw inw
 static inline unsigned short inw(unsigned short port)
 {
     unsigned short value;
@@ -15,6 +17,7 @@ static inline unsigned short inw(unsigned short port)
     return value;
 }
 
+#define inl inl
 static inline unsigned int inl(unsigned short port)
 {
     unsigned int value;
@@ -22,19 +25,24 @@ static inline unsigned int inl(unsigned short port)
     return value;
 }
 
+#define outb outb
 static inline void outb(unsigned char value, unsigned short port)
 {
     asm volatile("outb %b0, %w1" : : "a"(value), "Nd"(port));
 }
 
+#define outw outw
 static inline void outw(unsigned short value, unsigned short port)
 {
     asm volatile("outw %w0, %w1" : : "a"(value), "Nd"(port));
 }
 
+#define outl outl
 static inline void outl(unsigned int value, unsigned short port)
 {
     asm volatile("outl %0, %w1" : : "a"(value), "Nd"(port));
 }
 
+#include "asm-generic/io.h"
+
 #endif
diff --git a/lib/x86/asm/page.h b/lib/x86/asm/page.h
new file mode 100644
index 0000000000000..91a4bc3b7f86e
--- /dev/null
+++ b/lib/x86/asm/page.h
@@ -0,0 +1 @@
+#include "asm-generic/page.h"
diff --git a/lib/x86/io.c b/lib/x86/io.c
index d3b971ef67b0e..d396d42d0535c 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.c b/lib/x86/vm.c
index b820c7def72ab..dfd6d512dc650 100644
--- a/lib/x86/vm.c
+++ b/lib/x86/vm.c
@@ -2,13 +2,6 @@
 #include "vm.h"
 #include "libcflat.h"
 
-#define PAGE_SIZE 4096ul
-#ifdef __x86_64__
-#define LARGE_PAGE_SIZE (512 * PAGE_SIZE)
-#else
-#define LARGE_PAGE_SIZE (1024 * PAGE_SIZE)
-#endif
-
 static void *free = 0;
 static void *vfree_top = 0;
 
diff --git a/lib/x86/vm.h b/lib/x86/vm.h
index 28794d7f26c6b..0d549a810ffb8 100644
--- a/lib/x86/vm.h
+++ b/lib/x86/vm.h
@@ -2,8 +2,8 @@
 #define VM_H
 
 #include "processor.h"
+#include "asm/page.h"
 
-#define PAGE_SIZE 4096ul
 #ifdef __x86_64__
 #define LARGE_PAGE_SIZE (512 * PAGE_SIZE)
 #else
@@ -39,11 +39,13 @@ 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);
 
+#define virt_to_phys virt_to_phys
 static inline unsigned long virt_to_phys(const void *virt)
 {
     return (unsigned long)virt;
 }
 
+#define phys_to_virt phys_to_virt
 static inline void *phys_to_virt(unsigned long phys)
 {
     return (void *)phys;
diff --git a/x86/hyperv.h b/x86/hyperv.h
index faf931bb4373e..628c08b5b565b 100644
--- a/x86/hyperv.h
+++ b/x86/hyperv.h
@@ -3,7 +3,7 @@
 
 #include "libcflat.h"
 #include "processor.h"
-#include "io.h"
+#include "asm/io.h"
 
 #define HYPERV_CPUID_FEATURES                   0x40000003
 
diff --git a/x86/hyperv_stimer.c b/x86/hyperv_stimer.c
index 767459e55cc0b..0031835b44a9f 100644
--- a/x86/hyperv_stimer.c
+++ b/x86/hyperv_stimer.c
@@ -5,10 +5,10 @@
 #include "vm.h"
 #include "apic.h"
 #include "desc.h"
-#include "io.h"
 #include "smp.h"
 #include "atomic.h"
 #include "hyperv.h"
+#include "asm/io.h"
 
 #define MAX_CPUS 4
 
diff --git a/x86/hyperv_synic.c b/x86/hyperv_synic.c
index 6e088944be1f2..dee4ec373a760 100644
--- a/x86/hyperv_synic.c
+++ b/x86/hyperv_synic.c
@@ -5,10 +5,10 @@
 #include "vm.h"
 #include "apic.h"
 #include "desc.h"
-#include "io.h"
 #include "smp.h"
 #include "atomic.h"
 #include "hyperv.h"
+#include "asm/io.h"
 
 #define MAX_CPUS 4
 
diff --git a/x86/init.c b/x86/init.c
index 344dc1c0b234e..f47d671e62a85 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 1046ddf73732f..d659ae8aafefd 100644
--- a/x86/svm.c
+++ b/x86/svm.c
@@ -6,7 +6,7 @@
 #include "vm.h"
 #include "smp.h"
 #include "types.h"
-#include "io.h"
+#include "asm/io.h"
 
 /* for the nested page table*/
 u64 *pml4e;
diff --git a/x86/vmx.c b/x86/vmx.c
index 3fa1a735881f7..56edb2f9086b2 100644
--- a/x86/vmx.c
+++ b/x86/vmx.c
@@ -35,7 +35,7 @@
 #include "vmx.h"
 #include "msr.h"
 #include "smp.h"
-#include "io.h"
+#include "asm/io.h"
 
 u64 *vmxon_region;
 struct vmcs *vmcs_root;
diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 451fdd75d24e1..8b055086c7d60 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -7,7 +7,7 @@
 #include "msr.h"
 #include "processor.h"
 #include "vm.h"
-#include "io.h"
+#include "asm/io.h"
 #include "fwcfg.h"
 #include "isr.h"
 #include "apic.h"
-- 
2.4.3


  parent reply	other threads:[~2016-01-15 16:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-15 16:10 [kvm-unit-tests PATCH 00/11] share pci-testdev with the framework Andrew Jones
2016-01-15 16:10 ` [kvm-unit-tests PATCH 01/11] asm-generic: add portio accessors to io.h Andrew Jones
2016-01-15 16:10 ` Andrew Jones [this message]
2016-01-15 16:10 ` [kvm-unit-tests PATCH 03/11] x86: use common portio accessors from io.h Andrew Jones
2016-01-15 16:10 ` [kvm-unit-tests PATCH 04/11] x86: pci.h: remove useless include Andrew Jones
2016-01-15 16:10 ` [kvm-unit-tests PATCH 05/11] x86: mov pci.h to asm Andrew Jones
2016-01-15 16:10 ` [kvm-unit-tests PATCH 06/11] x86: move x86/pci to the common lib Andrew Jones
2016-01-15 16:27   ` Andrew Jones
2016-01-15 16:10 ` [kvm-unit-tests PATCH 07/11] x86: share pci-testdev hdr in " Andrew Jones
2016-01-15 16:10 ` [kvm-unit-tests PATCH 08/11] lib/pci: make PCIDEVADDR_INVALID truly invalid Andrew Jones
2016-01-15 16:10 ` [kvm-unit-tests PATCH 09/11] lib: add linux dir for kernel uapi headers Andrew Jones
2016-01-15 16:10 ` [kvm-unit-tests PATCH 10/11] Revert "arm/arm64: import include/uapi/linux/psci.h" Andrew Jones
2016-01-15 16:10 ` [kvm-unit-tests PATCH 11/11] lib/linux: import pci_regs.h Andrew Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452874216-3087-3-git-send-email-drjones@redhat.com \
    --to=drjones@redhat.com \
    --cc=agordeev@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox