Skip to contentSkip to conversation

libxl: bind virtual bdf to physical bdf after device assignment

PATCH New Wei Wang 1 participant 1 message Sep 26, 2012

lore
Share & tools
lore

Wei Wang

author
#0 lore raw

PATCH v6 1/1 libxl: bind virtual bdf to physical bdf after device assignment

From 307dec80d03b1a7ec7048e35ca9da2f9ec942066 Mon Sep 17 00:00:00 2001
From: Wei Wang <[email protected]>
Date: Wed, 26 Sep 2012 11:47:55 +0200
Subject: [PATCH 5/6] libxl: bind virtual bdf to physical bdf after device assignment

---
 tools/libxl/libxl_pci.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
tools/libxl/libxl_pci.c +9 -1
index ff447e7..ecd5e2b 100644
@@ -858,8 +858,9 @@ static int do_pci_add(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, i
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int rc, hvm = 0;
+    libxl_domain_type type = libxl__domain_type(gc, domid);
 
-    switch (libxl__domain_type(gc, domid)) {
+    switch (type) {
     case LIBXL_DOMAIN_TYPE_HVM:
         hvm = 1;
         if (libxl__wait_for_device_model(gc, domid, "running",
@@ -960,6 +961,13 @@ out:
             LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_assign_device failed");
             return ERROR_FAIL;
         }
+        if (type == LIBXL_DOMAIN_TYPE_HVM) {
+            rc = xc_domain_bind_pt_bdf(ctx->xch, domid, 0, pcidev->vdevfn, pcidev->domain, pcidev_encode_bdf(pcidev));
+            if ( rc ) {
+                LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_domain_bind_pt_bdf failed");
+                return ERROR_FAIL;
+            }
+        }
     }
 
     if (!starting)
Signature · 1 line
1.7.4

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel