]> www.infradead.org Git - users/dwmw2/qemu.git/commit
hw/xen: Set XenBackendInstance in the XenDevice before realizing it xenfv-net-3
authorDavid Woodhouse <dwmw@amazon.co.uk>
Sun, 12 Nov 2023 21:49:21 +0000 (16:49 -0500)
committerDavid Woodhouse <dwmw2@infradead.org>
Mon, 8 Jan 2024 13:50:17 +0000 (13:50 +0000)
commit94febc37ee7b8e3564c4c6f631cd17508715e99b
treeb16cd21c8887e6012d031a0044f604d9d80b1ee3
parent084570ab5b00a14a674e05f325c709e6536b6f71
hw/xen: Set XenBackendInstance in the XenDevice before realizing it

This allows a XenDevice implementation to know whether it was created
by QEMU, or merely discovered in XenStore after the toolstack created
it. This will allow us to create frontend/backend nodes only when we
should, rather than unconditionally attempting to overwrite them from
a driver domain which doesn't have privileges to do so.

As an added benefit, it also means we no longer have to call the
xen_backend_set_device() function from the device models immediately
after calling qdev_realize_and_unref(). Even though we could make
the argument that it's safe to do so, and the pointer to the unreffed
device *will* actually still be valid, it still made my skin itch to
look at it.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
hw/block/xen-block.c
hw/char/xen_console.c
hw/net/xen_nic.c
hw/xen/xen-backend.c
hw/xen/xen-bus.c
include/hw/xen/xen-backend.h
include/hw/xen/xen-bus.h