]> www.infradead.org Git - users/dwmw2/qemu.git/commit
hw/xen: Set XenBackendInstance in the XenDevice before realizing it
authorDavid Woodhouse <dwmw@amazon.co.uk>
Sun, 12 Nov 2023 21:49:21 +0000 (16:49 -0500)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Fri, 26 Jan 2024 17:15:17 +0000 (17:15 +0000)
commitea1d896cd0b6c0051f96fbe2ba6b6b3b344a8c33
tree47729e047dacfc5f4b30953f4d38e44bbcdc2dce
parent45258f81b17746eb0b598c840c0ee8be7609b6d7
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