All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: xen-devel@lists.xenproject.org
Cc: "Wei Liu" <wei.liu2@citrix.com>,
	"Ian Jackson" <ian.jackson@eu.citrix.com>,
	"Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
Subject: [PATCH v2 3/4] libxl: don't try to manipulate json config for stubdomain
Date: Tue, 15 Jan 2019 16:36:30 +0100	[thread overview]
Message-ID: <70950a67b4d81d138fd002cf02bcbb8fd96f83d0.1547566486.git-series.marmarek@invisiblethingslab.com> (raw)
In-Reply-To: <cover.f56cb3033143af6e9a0aeeaf33eb912fa5761983.1547566486.git-series.marmarek@invisiblethingslab.com>
In-Reply-To: <cover.f56cb3033143af6e9a0aeeaf33eb912fa5761983.1547566486.git-series.marmarek@invisiblethingslab.com>

Stubdomain do not have it's own config file - its configuration is
derived from target domains. Do not try to manipulate it when attaching
PCI device.

This bug prevented starting HVM with stubdomain and PCI passthrough
device attached.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 tools/libxl/libxl_pci.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
index 1bde537..e974f55 100644
--- a/tools/libxl/libxl_pci.c
+++ b/tools/libxl/libxl_pci.c
@@ -152,14 +152,18 @@ static int libxl__device_pci_add_xenstore(libxl__gc *gc, uint32_t domid, libxl_d
     GCNEW(device);
     libxl__device_from_pcidev(gc, domid, pcidev, device);
 
-    lock = libxl__lock_domain_userdata(gc, domid);
-    if (!lock) {
-        rc = ERROR_LOCK_FAIL;
-        goto out;
-    }
+    /* Stubdomain config is derived from its target domain, it doesn't have
+       its own file */
+    if (!libxl_is_stubdom(CTX, domid, NULL)) {
+        lock = libxl__lock_domain_userdata(gc, domid);
+        if (!lock) {
+            rc = ERROR_LOCK_FAIL;
+            goto out;
+        }
 
-    rc = libxl__get_domain_configuration(gc, domid, &d_config);
-    if (rc) goto out;
+        rc = libxl__get_domain_configuration(gc, domid, &d_config);
+        if (rc) goto out;
+    }
 
     device_add_domain_config(gc, &d_config, &libxl__pcidev_devtype,
                              &pcidev_saved);
@@ -171,8 +175,10 @@ static int libxl__device_pci_add_xenstore(libxl__gc *gc, uint32_t domid, libxl_d
         rc = libxl__xs_transaction_start(gc, &t);
         if (rc) goto out;
 
-        rc = libxl__set_domain_configuration(gc, domid, &d_config);
-        if (rc) goto out;
+        if (lock) {
+            rc = libxl__set_domain_configuration(gc, domid, &d_config);
+            if (rc) goto out;
+        }
 
         libxl__xs_writev(gc, t, be_path, libxl__xs_kvs_of_flexarray(gc, back));
 
-- 
git-series 0.9.1

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

  parent reply	other threads:[~2019-01-15 15:37 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-15 15:36 [PATCH v2 0/4] Fix PCI passthrough for HVM with stubdomain Marek Marczykowski-Górecki
2019-01-15 15:36 ` [PATCH v2 1/4] libxl: do not attach xen-pciback to HVM domain, if stubdomain is in use Marek Marczykowski-Górecki
2019-01-16 16:47   ` Roger Pau Monné
2019-01-16 17:00     ` Marek Marczykowski-Górecki
2019-01-17  9:21       ` Roger Pau Monné
2019-01-17 13:32         ` Marek Marczykowski-Górecki
2019-01-15 15:36 ` [PATCH v2 2/4] libxl: attach PCI device to qemu only after setting pciback/pcifront Marek Marczykowski-Górecki
2019-01-17 10:29   ` Roger Pau Monné
2019-01-26  2:24     ` Marek Marczykowski-Górecki
2019-01-15 15:36 ` Marek Marczykowski-Górecki [this message]
2019-01-17 10:44   ` [PATCH v2 3/4] libxl: don't try to manipulate json config for stubdomain Roger Pau Monné
2019-01-15 15:36 ` [PATCH v2 4/4] xen/x86: Allow stubdom access to irq created for msi Marek Marczykowski-Górecki
2019-01-16  9:21   ` Roger Pau Monné
2019-01-16 10:52     ` Marek Marczykowski-Górecki
2019-01-16 12:20       ` Roger Pau Monné
     [not found]         ` <94C5C3AC020000F30063616D@prv1-mh.provo.novell.com>
2019-01-16 12:57           ` Jan Beulich
2019-01-16 13:07             ` Roger Pau Monné
2019-01-16 13:49         ` Marek Marczykowski-Górecki
2019-01-17  8:57           ` Roger Pau Monné
     [not found]             ` <FB0C9893020000480063616D@prv1-mh.provo.novell.com>
2019-01-17 11:52               ` Jan Beulich
2019-01-17 11:56                 ` Roger Pau Monné
2019-01-17 12:20                   ` Jan Beulich
2019-01-17 12:32                     ` Roger Pau Monné
     [not found]                       ` <21B633D80200008F0063616D@prv1-mh.provo.novell.com>
2019-01-17 13:12                         ` Jan Beulich
2019-01-25 19:43       ` Marek Marczykowski-Górecki
2019-01-25 20:04         ` Marek Marczykowski-Górecki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=70950a67b4d81d138fd002cf02bcbb8fd96f83d0.1547566486.git-series.marmarek@invisiblethingslab.com \
    --to=marmarek@invisiblethingslab.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.