[kvm-unit-tests RFC PATCH 08/10] x86: apic: Access registers using proper MMIO access

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

 



This is a draft and incomplete implementation

Cc: Radim Krčmář <rkrcmar@xxxxxxxxxx>
Signed-off-by: Alexander Gordeev <agordeev@xxxxxxxxxx>
---
 lib/x86/apic.c | 7 +++++++
 lib/x86/apic.h | 2 ++
 lib/x86/vm.c   | 2 ++
 3 files changed, 11 insertions(+)

diff --git a/lib/x86/apic.c b/lib/x86/apic.c
index c6022acef829..4b52b5b39051 100644
--- a/lib/x86/apic.c
+++ b/lib/x86/apic.c
@@ -202,3 +202,10 @@ void mask_pic_interrupts(void)
     outb(0xff, 0x21);
     outb(0xff, 0xa1);
 }
+
+void ioremap_apic(void)
+{
+    g_apic   = ioremap((unsigned long)g_apic,   PAGE_SIZE);
+    g_ioapic = ioremap((unsigned long)g_ioapic, PAGE_SIZE);
+}
+
diff --git a/lib/x86/apic.h b/lib/x86/apic.h
index 192268c8a2d4..9e0bb2fecfee 100644
--- a/lib/x86/apic.h
+++ b/lib/x86/apic.h
@@ -41,4 +41,6 @@ uint32_t apic_id(void);
 int enable_x2apic(void);
 void reset_apic(void);
 
+void ioremap_apic(void);
+
 #endif
diff --git a/lib/x86/vm.c b/lib/x86/vm.c
index c1448d7a2766..b3d547a2a7f1 100644
--- a/lib/x86/vm.c
+++ b/lib/x86/vm.c
@@ -1,6 +1,7 @@
 #include "fwcfg.h"
 #include "vm.h"
 #include "libcflat.h"
+#include "apic.h"
 
 static void *free = 0;
 static void *vfree_top = 0;
@@ -156,6 +157,7 @@ void setup_vm()
     end_of_memory = fwcfg_get_u64(FW_CFG_RAM_SIZE);
     free_memory(&edata, end_of_memory - (unsigned long)&edata);
     setup_mmu(end_of_memory);
+    ioremap_apic();
 }
 
 void *vmalloc(unsigned long size)
-- 
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



[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