WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] [PATCH 5 of 9] PoC: libxc+ocaml: add interface to detect PV dr

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 5 of 9] PoC: libxc+ocaml: add interface to detect PV drivers in HVM guests
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Tue, 11 Jan 2011 10:55:53 +0000
Cc: gianni.tedesco@xxxxxxxxxx, zheng.li@xxxxxxxxxxxxx
Delivery-date: Tue, 11 Jan 2011 03:45:38 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1294743348@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1294743348@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.5.2
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1294742832 0
# Node ID 4370aef36fb02c95dbe5e6ca96dba69a4faa7d62
# Parent  ed965d81449dfc17452ca8eeea515bc7d073e404
PoC: libxc+ocaml: add interface to detect PV drivers in HVM guests

Required by xapi.

Taken from xen-api-libs.hg/xc and adjusted for upstream libxc+ocaml.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r ed965d81449d -r 4370aef36fb0 tools/libxc/xc_misc.c
--- a/tools/libxc/xc_misc.c     Tue Jan 11 10:47:12 2011 +0000
+++ b/tools/libxc/xc_misc.c     Tue Jan 11 10:47:12 2011 +0000
@@ -629,6 +629,26 @@ int xc_hvm_inject_trap(
     return rc;
 }
 
+int xc_hvm_check_pvdriver(xc_interface *xch, unsigned int domid)
+{
+    int ret;
+    unsigned long irq = 0;
+    xc_domaininfo_t info;
+
+    ret = xc_domain_getinfolist(xch, domid, 1, &info);
+    if (ret != 1) {
+        PERROR("domain getinfo failed");
+        return -1;
+    }
+
+    if (!info.flags & XEN_DOMINF_hvm_guest) {
+        ERROR("domain is not hvm");
+        return -1;
+    }
+    xc_get_hvm_param(xch, domid, HVM_PARAM_CALLBACK_IRQ, &irq);
+    return irq;
+}
+
 /*
  * Local variables:
  * mode: C
diff -r ed965d81449d -r 4370aef36fb0 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Tue Jan 11 10:47:12 2011 +0000
+++ b/tools/libxc/xenctrl.h     Tue Jan 11 10:47:12 2011 +0000
@@ -1439,6 +1439,8 @@ int xc_hvm_inject_trap(
     xc_interface *xch, domid_t dom, int vcpu, uint32_t trap, uint32_t 
error_code, 
     uint64_t cr2);
 
+int xc_hvm_check_pvdriver(xc_interface *xch, unsigned int domid);
+
 /*
  *  LOGGING AND ERROR REPORTING
  */
diff -r ed965d81449d -r 4370aef36fb0 tools/ocaml/libs/xc/xc.ml
--- a/tools/ocaml/libs/xc/xc.ml Tue Jan 11 10:47:12 2011 +0000
+++ b/tools/ocaml/libs/xc/xc.ml Tue Jan 11 10:47:12 2011 +0000
@@ -241,6 +241,10 @@ external domain_deassign_device: handle 
 external domain_test_assign_device: handle -> domid -> (int * int * int * int) 
-> bool
        = "stub_xc_domain_test_assign_device"
 
+(** check if some hvm domain got pv driver or not *)
+external hvm_check_pvdriver: handle -> domid -> bool
+       = "stub_xc_hvm_check_pvdriver"
+
 external version: handle -> version = "stub_xc_version_version"
 external version_compile_info: handle -> compile_info
        = "stub_xc_version_compile_info"
diff -r ed965d81449d -r 4370aef36fb0 tools/ocaml/libs/xc/xc.mli
--- a/tools/ocaml/libs/xc/xc.mli        Tue Jan 11 10:47:12 2011 +0000
+++ b/tools/ocaml/libs/xc/xc.mli        Tue Jan 11 10:47:12 2011 +0000
@@ -158,6 +158,8 @@ external domain_deassign_device: handle 
 external domain_test_assign_device: handle -> domid -> (int * int * int * int) 
-> bool
        = "stub_xc_domain_test_assign_device"
 
+external hvm_check_pvdriver : handle -> domid -> bool
+  = "stub_xc_hvm_check_pvdriver"
 external version : handle -> version = "stub_xc_version_version"
 external version_compile_info : handle -> compile_info
   = "stub_xc_version_compile_info"
diff -r ed965d81449d -r 4370aef36fb0 tools/ocaml/libs/xc/xc_stubs.c
--- a/tools/ocaml/libs/xc/xc_stubs.c    Tue Jan 11 10:47:12 2011 +0000
+++ b/tools/ocaml/libs/xc/xc_stubs.c    Tue Jan 11 10:47:12 2011 +0000
@@ -1112,6 +1112,17 @@ static uint32_t pci_dev_to_bdf(int domai
        return bdf;
 }
 
+CAMLprim value stub_xc_hvm_check_pvdriver(value xch, value domid)
+{
+       CAMLparam2(xch, domid);
+       int ret;
+
+       ret = xc_hvm_check_pvdriver(_H(xch), _D(domid));
+       if (ret < 0)
+               failwith_xc(_H(xch));
+       CAMLreturn(Val_bool(ret));
+}
+
 CAMLprim value stub_xc_domain_test_assign_device(value xch, value domid, value 
desc)
 {
        CAMLparam3(xch, domid, desc);

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

<Prev in Thread] Current Thread [Next in Thread>