[PATCH kvm-unit-tests 3/5] hyperv: add more test control codes

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

 



Add helpers for the recently added message and event connection test
modes.

Signed-off-by: Roman Kagan <rkagan@xxxxxxxxxxxxx>
---
 x86/hyperv.h |  4 ++++
 x86/hyperv.c | 38 +++++++++++++++++++++++++++++++++-----
 2 files changed, 37 insertions(+), 5 deletions(-)

diff --git a/x86/hyperv.h b/x86/hyperv.h
index 2331325..76a569a 100644
--- a/x86/hyperv.h
+++ b/x86/hyperv.h
@@ -173,6 +173,10 @@ static inline bool hv_time_ref_counter_supported(void)
 void synic_sint_create(u8 sint, u8 vec, bool auto_eoi);
 void synic_sint_set(u8 vcpu, u8 sint);
 void synic_sint_destroy(u8 sint);
+void msg_conn_create(u8 sint, u8 vec, u8 conn_id);
+void msg_conn_destroy(u8 sint, u8 conn_id);
+void evt_conn_create(u8 sint, u8 vec, u8 conn_id);
+void evt_conn_destroy(u8 sint, u8 conn_id);
 
 struct hv_reference_tsc_page {
         uint32_t tsc_sequence;
diff --git a/x86/hyperv.c b/x86/hyperv.c
index 78f5fb5..60f7645 100644
--- a/x86/hyperv.c
+++ b/x86/hyperv.c
@@ -6,11 +6,15 @@ enum {
     HV_TEST_DEV_SINT_ROUTE_CREATE = 1,
     HV_TEST_DEV_SINT_ROUTE_DESTROY,
     HV_TEST_DEV_SINT_ROUTE_SET_SINT,
+    HV_TEST_DEV_MSG_CONN_CREATE,
+    HV_TEST_DEV_MSG_CONN_DESTROY,
+    HV_TEST_DEV_EVT_CONN_CREATE,
+    HV_TEST_DEV_EVT_CONN_DESTROY,
 };
 
-static void synic_ctl(u32 ctl, u32 vcpu_id, u32 sint)
+static void synic_ctl(u32 ctl, u32 vcpu_id, u32 sint, u32 conn_id)
 {
-    outl((ctl << 16)|((vcpu_id) << 8)|sint, 0x3000);
+    outl((conn_id << 24) | (ctl << 16) | (vcpu_id << 8) | sint, 0x3000);
 }
 
 static void sint_enable(u8 sint, u8 vec, bool auto_eoi)
@@ -26,17 +30,41 @@ static void sint_disable(u8 sint)
 
 void synic_sint_create(u8 sint, u8 vec, bool auto_eoi)
 {
-    synic_ctl(HV_TEST_DEV_SINT_ROUTE_CREATE, smp_id(), sint);
+    synic_ctl(HV_TEST_DEV_SINT_ROUTE_CREATE, smp_id(), sint, 0);
     sint_enable(sint, vec, auto_eoi);
 }
 
 void synic_sint_set(u8 vcpu, u8 sint)
 {
-    synic_ctl(HV_TEST_DEV_SINT_ROUTE_SET_SINT, vcpu, sint);
+    synic_ctl(HV_TEST_DEV_SINT_ROUTE_SET_SINT, vcpu, sint, 0);
 }
 
 void synic_sint_destroy(u8 sint)
 {
     sint_disable(sint);
-    synic_ctl(HV_TEST_DEV_SINT_ROUTE_DESTROY, smp_id(), sint);
+    synic_ctl(HV_TEST_DEV_SINT_ROUTE_DESTROY, smp_id(), sint, 0);
+}
+
+void msg_conn_create(u8 sint, u8 vec, u8 conn_id)
+{
+    synic_ctl(HV_TEST_DEV_MSG_CONN_CREATE, smp_id(), sint, conn_id);
+    sint_enable(sint, vec, true);
+}
+
+void msg_conn_destroy(u8 sint, u8 conn_id)
+{
+    sint_disable(sint);
+    synic_ctl(HV_TEST_DEV_MSG_CONN_DESTROY, 0, 0, conn_id);
+}
+
+void evt_conn_create(u8 sint, u8 vec, u8 conn_id)
+{
+    synic_ctl(HV_TEST_DEV_EVT_CONN_CREATE, smp_id(), sint, conn_id);
+    sint_enable(sint, vec, true);
+}
+
+void evt_conn_destroy(u8 sint, u8 conn_id)
+{
+    sint_disable(sint);
+    synic_ctl(HV_TEST_DEV_EVT_CONN_DESTROY, 0, 0, conn_id);
 }
-- 
2.9.4




[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