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

[Xen-devel] [PATCH v3 05/16] x86: PIT emulation is common to both PV and HVM



Move the file to x86 common code and change its name to emul-i8254.c.

Put HVM only code under CONFIG_HVM or is_hvm_domain.

Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
v3: remove some CONFIG_HVMs, rely on DCE
v2: move the whole file.
---
 xen/arch/x86/Makefile                      |  1 +
 xen/arch/x86/{hvm/i8254.c => emul-i8254.c} | 18 +++++++++++++-----
 xen/arch/x86/hvm/Makefile                  |  1 -
 3 files changed, 14 insertions(+), 6 deletions(-)
 rename xen/arch/x86/{hvm/i8254.c => emul-i8254.c} (97%)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 2f2ad3adfd..162b0b94c0 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -27,6 +27,7 @@ obj-y += domain.o
 obj-bin-y += dom0_build.init.o
 obj-y += domain_page.o
 obj-y += e820.o
+obj-y += emul-i8254.o
 obj-y += extable.o
 obj-y += flushtlb.o
 obj-$(CONFIG_CRASH_DEBUG) += gdbstub.o
diff --git a/xen/arch/x86/hvm/i8254.c b/xen/arch/x86/emul-i8254.c
similarity index 97%
rename from xen/arch/x86/hvm/i8254.c
rename to xen/arch/x86/emul-i8254.c
index b8ec56f8d3..7f1ded2623 100644
--- a/xen/arch/x86/hvm/i8254.c
+++ b/xen/arch/x86/emul-i8254.c
@@ -379,6 +379,7 @@ static uint32_t pit_ioport_read(struct PITState *pit, 
uint32_t addr)
     return ret;
 }
 
+#ifdef CONFIG_HVM
 void pit_stop_channel0_irq(PITState *pit)
 {
     if ( !has_vpit(current->domain) )
@@ -438,6 +439,7 @@ static int pit_load(struct domain *d, hvm_domain_context_t 
*h)
 }
 
 HVM_REGISTER_SAVE_RESTORE(PIT, pit_save, pit_load, 1, HVMSR_PER_DOM);
+#endif
 
 void pit_reset(struct domain *d)
 {
@@ -448,9 +450,12 @@ void pit_reset(struct domain *d)
     if ( !has_vpit(d) )
         return;
 
-    TRACE_0D(TRC_HVM_EMUL_PIT_STOP_TIMER);
-    destroy_periodic_time(&pit->pt0);
-    pit->pt0.source = PTSRC_isa;
+    if ( is_hvm_domain(d) )
+    {
+        TRACE_0D(TRC_HVM_EMUL_PIT_STOP_TIMER);
+        destroy_periodic_time(&pit->pt0);
+        pit->pt0.source = PTSRC_isa;
+    }
 
     spin_lock(&pit->lock);
 
@@ -490,8 +495,11 @@ void pit_deinit(struct domain *d)
     if ( !has_vpit(d) )
         return;
 
-    TRACE_0D(TRC_HVM_EMUL_PIT_STOP_TIMER);
-    destroy_periodic_time(&pit->pt0);
+    if ( is_hvm_domain(d) )
+    {
+        TRACE_0D(TRC_HVM_EMUL_PIT_STOP_TIMER);
+        destroy_periodic_time(&pit->pt0);
+    }
 }
 
 /* the intercept action for PIT DM retval:0--not handled; 1--handled */  
diff --git a/xen/arch/x86/hvm/Makefile b/xen/arch/x86/hvm/Makefile
index 5bd38f633f..5e04bc1429 100644
--- a/xen/arch/x86/hvm/Makefile
+++ b/xen/arch/x86/hvm/Makefile
@@ -10,7 +10,6 @@ obj-y += grant_table.o
 obj-y += hpet.o
 obj-y += hvm.o
 obj-y += hypercall.o
-obj-y += i8254.o
 obj-y += intercept.o
 obj-y += io.o
 obj-y += ioreq.o
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.