All of lore.kernel.org
 help / color / mirror / Atom feed
From: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
To: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Oleksandr Tyshchenko <Oleksandr_Tyshchenko@epam.com>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Anthony Perard <anthony.perard@citrix.com>,
	Paul Durrant <paul@xen.org>, Kevin Wolf <kwolf@redhat.com>,
	Hanna Reitz <hreitz@redhat.com>,
	"open list:X86 Xen CPUs" <xen-devel@lists.xenproject.org>,
	"open list:Block layer core" <qemu-block@nongnu.org>
Subject: [PATCH v1 1/7] xen-block: Do not write frontend nodes
Date: Fri, 10 Nov 2023 20:42:21 +0000	[thread overview]
Message-ID: <20231110204207.2927514-2-volodymyr_babchuk@epam.com> (raw)
In-Reply-To: <20231110204207.2927514-1-volodymyr_babchuk@epam.com>

From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>

The PV backend running in other than Dom0 domain (non toolstack domain)
is not allowed to write frontend nodes. The more, the backend does not
need to do that at all, this is purely toolstack/xl devd business.

I do not know for what reason the backend does that here, this is not really
needed, probably it is just a leftover and all xen_device_frontend_printf()
instances should go away completely.

Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
---
 hw/block/xen-block.c | 11 +++++++----
 hw/xen/xen-bus.c     |  2 +-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c
index a07cd7eb5d..dc4d477c22 100644
--- a/hw/block/xen-block.c
+++ b/hw/block/xen-block.c
@@ -221,6 +221,7 @@ static void xen_block_realize(XenDevice *xendev, Error **errp)
     XenBlockVdev *vdev = &blockdev->props.vdev;
     BlockConf *conf = &blockdev->props.conf;
     BlockBackend *blk = conf->blk;
+    XenBus *xenbus = XEN_BUS(qdev_get_parent_bus(DEVICE(xendev)));
 
     if (vdev->type == XEN_BLOCK_VDEV_TYPE_INVALID) {
         error_setg(errp, "vdev property not set");
@@ -280,10 +281,12 @@ static void xen_block_realize(XenDevice *xendev, Error **errp)
 
     xen_device_backend_printf(xendev, "info", "%u", blockdev->info);
 
-    xen_device_frontend_printf(xendev, "virtual-device", "%lu",
-                               vdev->number);
-    xen_device_frontend_printf(xendev, "device-type", "%s",
-                               blockdev->device_type);
+    if (xenbus->backend_id == 0) {
+        xen_device_frontend_printf(xendev, "virtual-device", "%lu",
+                                   vdev->number);
+        xen_device_frontend_printf(xendev, "device-type", "%s",
+                                   blockdev->device_type);
+    }
 
     xen_device_backend_printf(xendev, "sector-size", "%u",
                               conf->logical_block_size);
diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c
index ece8ec40cd..06d5192aca 100644
--- a/hw/xen/xen-bus.c
+++ b/hw/xen/xen-bus.c
@@ -1048,7 +1048,7 @@ static void xen_device_realize(DeviceState *dev, Error **errp)
     xen_device_backend_set_online(xendev, true);
     xen_device_backend_set_state(xendev, XenbusStateInitWait);
 
-    if (!xen_device_frontend_exists(xendev)) {
+    if (!xen_device_frontend_exists(xendev) && xenbus->backend_id == 0) {
         xen_device_frontend_printf(xendev, "backend", "%s",
                                    xendev->backend_path);
         xen_device_frontend_printf(xendev, "backend-id", "%u",
-- 
2.42.0


  reply	other threads:[~2023-11-10 21:35 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-10 20:42 [PATCH v1 0/7] xen-arm: add support for virtio-pci Volodymyr Babchuk
2023-11-10 20:42 ` Volodymyr Babchuk [this message]
2023-11-11 10:55   ` [PATCH v1 1/7] xen-block: Do not write frontend nodes David Woodhouse
2023-11-11 13:43     ` Andrew Cooper
2023-11-11 20:18       ` David Woodhouse
2023-11-11 21:51         ` Andrew Cooper
2023-11-11 22:22           ` David Woodhouse
2023-11-14 21:32             ` Volodymyr Babchuk
2023-11-14 21:54               ` David Woodhouse
2023-11-12 20:29   ` Paul Durrant
2023-11-10 20:42 ` [PATCH v1 3/7] xen: xenstore: add possibility to preserve owner Volodymyr Babchuk
2023-11-11 11:01   ` David Woodhouse
2023-11-12 21:18     ` David Woodhouse
2023-11-13 13:02       ` Volodymyr Babchuk
2023-11-13 13:00     ` Volodymyr Babchuk
2023-11-12 20:43   ` Paul Durrant
2023-11-10 20:42 ` [PATCH v1 2/7] xen-bus: Do not destroy frontend/backend directories Volodymyr Babchuk
2023-11-12 21:57   ` David Woodhouse
2023-11-10 20:42 ` [PATCH v1 6/7] xen_arm: Set mc->max_cpus to GUEST_MAX_VCPUS in xen_arm_init() Volodymyr Babchuk
2023-11-10 20:42 ` [PATCH v1 4/7] xen_pvdev: Do not assume Dom0 when creating a directrory Volodymyr Babchuk
2023-11-12 21:12   ` David Woodhouse
2023-11-15  0:22     ` Volodymyr Babchuk
2023-11-10 20:42 ` [PATCH v1 5/7] xen-bus: Set offline if backend's state is XenbusStateClosed Volodymyr Babchuk
2023-11-11 11:42   ` David Woodhouse
2023-11-12 20:37   ` Paul Durrant
2023-11-10 20:42 ` [PATCH v1 7/7] xen_arm: Add basic virtio-pci support Volodymyr Babchuk
2023-11-12 22:11   ` David Woodhouse
2023-11-13 12:01     ` Volodymyr Babchuk

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=20231110204207.2927514-2-volodymyr_babchuk@epam.com \
    --to=volodymyr_babchuk@epam.com \
    --cc=Oleksandr_Tyshchenko@epam.com \
    --cc=anthony.perard@citrix.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=paul@xen.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sstabellini@kernel.org \
    --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.