]> 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>
Thu, 1 Feb 2024 16:03:28 +0000 (16:03 +0000)
commitcaab50cdc1399844eac28e133d36466a950bf1d6
tree057aba127895939472f40c235c8a3ebb07c78e08
parent5dd46ce02ca69c65582e62eba9e3bbce8e2a4e22
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