Xen queue
* xen-block, the Xen PV backend, now handles resize. * configure cleanup. * xen-bus fix. -----BEGIN PGP SIGNATURE----- iQFOBAABCgA4FiEE+AwAYwjiLP2KkueYDPVXL9f7Va8FAlxYHv0aHGFudGhvbnku cGVyYXJkQGNpdHJpeC5jb20ACgkQDPVXL9f7Va/eNggA7+BEVvd8algSlGz4L9hQ 5t0rL/Tvd9q5i5N34cnlIUSr59U6f0+QtiX0c/FQThn6ItbTvLwqW+vK8R2jcYee GRenH792FQtkjldN2KaWopT9qyHbowjwAIfPEP2MpW2LZGYYsviNkivvsfwEHWwo RTVCAR6RYM+q7CERNVD0xxHdjZQ5/A4xOPDOjCnSWyg6MNxwFHZv7anZFT8ZlH/Z h8uPBP41cknuVWPzZz3JTZqv5oJCfCNPYxOX6Zs1AYl/yyoLja/JiM85SOxfQttY wGLbXrCxGTdnB40obNceNRdwY9w9/xXnCYglLXzitmnBUPPuuHt34aPaS4MMBGnc xg== =n2fc -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/aperard/tags/pull-xen-20190204' into staging Xen queue * xen-block, the Xen PV backend, now handles resize. * configure cleanup. * xen-bus fix. # gpg: Signature made Mon 04 Feb 2019 11:16:13 GMT # gpg: using RSA key F80C006308E22CFD8A92E7980CF5572FD7FB55AF # gpg: issuer "anthony.perard@citrix.com" # gpg: Good signature from "Anthony PERARD <anthony.perard@gmail.com>" [marginal] # gpg: aka "Anthony PERARD <anthony.perard@citrix.com>" [marginal] # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 5379 2F71 024C 600F 778A 7161 D8D5 7199 DF83 42C8 # Subkey fingerprint: F80C 0063 08E2 2CFD 8A92 E798 0CF5 572F D7FB 55AF * remotes/aperard/tags/pull-xen-20190204: xen-block: handle resize callback xen: fix xen-bus state model to allow frontend re-connection configure: Don't add Xen's libs to LDFLAGS configure: xen: Stop build-testing for xc_domain_create Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
f3b4d5ca67
20
configure
vendored
20
configure
vendored
@ -2359,7 +2359,6 @@ if test "$xen" != "no" ; then
|
|||||||
fi
|
fi
|
||||||
QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)"
|
QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)"
|
||||||
libs_softmmu="$($pkg_config --libs $xen_pc) $libs_softmmu"
|
libs_softmmu="$($pkg_config --libs $xen_pc) $libs_softmmu"
|
||||||
LDFLAGS="$($pkg_config --libs $xen_pc) $LDFLAGS"
|
|
||||||
else
|
else
|
||||||
|
|
||||||
xen_libs="-lxenstore -lxenctrl -lxenguest"
|
xen_libs="-lxenstore -lxenctrl -lxenguest"
|
||||||
@ -2474,7 +2473,6 @@ int main(void) {
|
|||||||
xenforeignmemory_handle *xfmem;
|
xenforeignmemory_handle *xfmem;
|
||||||
xenevtchn_handle *xe;
|
xenevtchn_handle *xe;
|
||||||
xengnttab_handle *xg;
|
xengnttab_handle *xg;
|
||||||
xen_domain_handle_t handle;
|
|
||||||
xengnttab_grant_copy_segment_t* seg = NULL;
|
xengnttab_grant_copy_segment_t* seg = NULL;
|
||||||
|
|
||||||
xs_daemon_open();
|
xs_daemon_open();
|
||||||
@ -2484,7 +2482,6 @@ int main(void) {
|
|||||||
xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
|
xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
|
||||||
xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
|
xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
|
||||||
xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
|
xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
|
||||||
xc_domain_create(xc, 0, handle, 0, NULL, NULL);
|
|
||||||
|
|
||||||
xfmem = xenforeignmemory_open(0, 0);
|
xfmem = xenforeignmemory_open(0, 0);
|
||||||
xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
|
xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
|
||||||
@ -2526,7 +2523,6 @@ int main(void) {
|
|||||||
xenforeignmemory_handle *xfmem;
|
xenforeignmemory_handle *xfmem;
|
||||||
xenevtchn_handle *xe;
|
xenevtchn_handle *xe;
|
||||||
xengnttab_handle *xg;
|
xengnttab_handle *xg;
|
||||||
xen_domain_handle_t handle;
|
|
||||||
|
|
||||||
xs_daemon_open();
|
xs_daemon_open();
|
||||||
|
|
||||||
@ -2535,7 +2531,6 @@ int main(void) {
|
|||||||
xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
|
xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
|
||||||
xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
|
xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
|
||||||
xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
|
xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
|
||||||
xc_domain_create(xc, 0, handle, 0, NULL, NULL);
|
|
||||||
|
|
||||||
xfmem = xenforeignmemory_open(0, 0);
|
xfmem = xenforeignmemory_open(0, 0);
|
||||||
xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
|
xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
|
||||||
@ -2553,21 +2548,6 @@ EOF
|
|||||||
then
|
then
|
||||||
xen_ctrl_version=40701
|
xen_ctrl_version=40701
|
||||||
xen=yes
|
xen=yes
|
||||||
elif
|
|
||||||
cat > $TMPC <<EOF &&
|
|
||||||
#include <xenctrl.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
int main(void) {
|
|
||||||
xc_interface *xc = NULL;
|
|
||||||
xen_domain_handle_t handle;
|
|
||||||
xc_domain_create(xc, 0, handle, 0, NULL, NULL);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
compile_prog "" "$xen_libs"
|
|
||||||
then
|
|
||||||
xen_ctrl_version=40700
|
|
||||||
xen=yes
|
|
||||||
|
|
||||||
# Xen 4.6
|
# Xen 4.6
|
||||||
elif
|
elif
|
||||||
|
@ -50,7 +50,6 @@ struct XenBlockDataPlane {
|
|||||||
unsigned int nr_ring_ref;
|
unsigned int nr_ring_ref;
|
||||||
void *sring;
|
void *sring;
|
||||||
int64_t file_blk;
|
int64_t file_blk;
|
||||||
int64_t file_size;
|
|
||||||
int protocol;
|
int protocol;
|
||||||
blkif_back_rings_t rings;
|
blkif_back_rings_t rings;
|
||||||
int more_work;
|
int more_work;
|
||||||
@ -189,7 +188,7 @@ static int xen_block_parse_request(XenBlockRequest *request)
|
|||||||
request->req.seg[i].first_sect + 1) * dataplane->file_blk;
|
request->req.seg[i].first_sect + 1) * dataplane->file_blk;
|
||||||
request->size += len;
|
request->size += len;
|
||||||
}
|
}
|
||||||
if (request->start + request->size > dataplane->file_size) {
|
if (request->start + request->size > blk_getlength(dataplane->blk)) {
|
||||||
error_report("error: access beyond end of file");
|
error_report("error: access beyond end of file");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
@ -638,7 +637,6 @@ XenBlockDataPlane *xen_block_dataplane_create(XenDevice *xendev,
|
|||||||
dataplane->xendev = xendev;
|
dataplane->xendev = xendev;
|
||||||
dataplane->file_blk = conf->logical_block_size;
|
dataplane->file_blk = conf->logical_block_size;
|
||||||
dataplane->blk = conf->blk;
|
dataplane->blk = conf->blk;
|
||||||
dataplane->file_size = blk_getlength(dataplane->blk);
|
|
||||||
|
|
||||||
QLIST_INIT(&dataplane->inflight);
|
QLIST_INIT(&dataplane->inflight);
|
||||||
QLIST_INIT(&dataplane->freelist);
|
QLIST_INIT(&dataplane->freelist);
|
||||||
|
@ -126,6 +126,7 @@ xen_block_realize(const char *type, uint32_t disk, uint32_t partition) "%s d%up%
|
|||||||
xen_block_connect(const char *type, uint32_t disk, uint32_t partition) "%s d%up%u"
|
xen_block_connect(const char *type, uint32_t disk, uint32_t partition) "%s d%up%u"
|
||||||
xen_block_disconnect(const char *type, uint32_t disk, uint32_t partition) "%s d%up%u"
|
xen_block_disconnect(const char *type, uint32_t disk, uint32_t partition) "%s d%up%u"
|
||||||
xen_block_unrealize(const char *type, uint32_t disk, uint32_t partition) "%s d%up%u"
|
xen_block_unrealize(const char *type, uint32_t disk, uint32_t partition) "%s d%up%u"
|
||||||
|
xen_block_size(const char *type, uint32_t disk, uint32_t partition, int64_t sectors) "%s d%up%u %"PRIi64
|
||||||
xen_disk_realize(void) ""
|
xen_disk_realize(void) ""
|
||||||
xen_disk_unrealize(void) ""
|
xen_disk_unrealize(void) ""
|
||||||
xen_cdrom_realize(void) ""
|
xen_cdrom_realize(void) ""
|
||||||
|
@ -144,6 +144,38 @@ static void xen_block_unrealize(XenDevice *xendev, Error **errp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void xen_block_set_size(XenBlockDevice *blockdev)
|
||||||
|
{
|
||||||
|
const char *type = object_get_typename(OBJECT(blockdev));
|
||||||
|
XenBlockVdev *vdev = &blockdev->props.vdev;
|
||||||
|
BlockConf *conf = &blockdev->props.conf;
|
||||||
|
int64_t sectors = blk_getlength(conf->blk) / conf->logical_block_size;
|
||||||
|
XenDevice *xendev = XEN_DEVICE(blockdev);
|
||||||
|
|
||||||
|
trace_xen_block_size(type, vdev->disk, vdev->partition, sectors);
|
||||||
|
|
||||||
|
xen_device_backend_printf(xendev, "sectors", "%"PRIi64, sectors);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void xen_block_resize_cb(void *opaque)
|
||||||
|
{
|
||||||
|
XenBlockDevice *blockdev = opaque;
|
||||||
|
XenDevice *xendev = XEN_DEVICE(blockdev);
|
||||||
|
enum xenbus_state state = xen_device_backend_get_state(xendev);
|
||||||
|
|
||||||
|
xen_block_set_size(blockdev);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Mimic the behaviour of Linux xen-blkback and re-write the state
|
||||||
|
* to trigger the frontend watch.
|
||||||
|
*/
|
||||||
|
xen_device_backend_printf(xendev, "state", "%u", state);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const BlockDevOps xen_block_dev_ops = {
|
||||||
|
.resize_cb = xen_block_resize_cb,
|
||||||
|
};
|
||||||
|
|
||||||
static void xen_block_realize(XenDevice *xendev, Error **errp)
|
static void xen_block_realize(XenDevice *xendev, Error **errp)
|
||||||
{
|
{
|
||||||
XenBlockDevice *blockdev = XEN_BLOCK_DEVICE(xendev);
|
XenBlockDevice *blockdev = XEN_BLOCK_DEVICE(xendev);
|
||||||
@ -180,7 +212,7 @@ static void xen_block_realize(XenDevice *xendev, Error **errp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!blkconf_apply_backend_options(conf, blockdev->info & VDISK_READONLY,
|
if (!blkconf_apply_backend_options(conf, blockdev->info & VDISK_READONLY,
|
||||||
false, errp)) {
|
true, errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,6 +229,7 @@ static void xen_block_realize(XenDevice *xendev, Error **errp)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
blk_set_dev_ops(conf->blk, &xen_block_dev_ops, blockdev);
|
||||||
blk_set_guest_block_size(conf->blk, conf->logical_block_size);
|
blk_set_guest_block_size(conf->blk, conf->logical_block_size);
|
||||||
|
|
||||||
if (conf->discard_granularity > 0) {
|
if (conf->discard_granularity > 0) {
|
||||||
@ -215,9 +248,8 @@ static void xen_block_realize(XenDevice *xendev, Error **errp)
|
|||||||
|
|
||||||
xen_device_backend_printf(xendev, "sector-size", "%u",
|
xen_device_backend_printf(xendev, "sector-size", "%u",
|
||||||
conf->logical_block_size);
|
conf->logical_block_size);
|
||||||
xen_device_backend_printf(xendev, "sectors", "%"PRIi64,
|
|
||||||
blk_getlength(conf->blk) /
|
xen_block_set_size(blockdev);
|
||||||
conf->logical_block_size);
|
|
||||||
|
|
||||||
blockdev->dataplane =
|
blockdev->dataplane =
|
||||||
xen_block_dataplane_create(xendev, conf, blockdev->props.iothread);
|
xen_block_dataplane_create(xendev, conf, blockdev->props.iothread);
|
||||||
|
@ -547,16 +547,11 @@ static void xen_device_backend_changed(void *opaque)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If a backend is still 'online' then its state should be cycled
|
* If a backend is still 'online' then we should leave it alone but,
|
||||||
* back round to InitWait in order for a new frontend instance to
|
* if a backend is not 'online', then the device should be destroyed
|
||||||
* connect. This may happen when, for example, a frontend driver is
|
* once the state is Closed.
|
||||||
* re-installed or updated.
|
|
||||||
* If a backend is not 'online' then the device should be destroyed.
|
|
||||||
*/
|
*/
|
||||||
if (xendev->backend_online &&
|
if (!xendev->backend_online &&
|
||||||
xendev->backend_state == XenbusStateClosed) {
|
|
||||||
xen_device_backend_set_state(xendev, XenbusStateInitWait);
|
|
||||||
} else if (!xendev->backend_online &&
|
|
||||||
(xendev->backend_state == XenbusStateClosed ||
|
(xendev->backend_state == XenbusStateClosed ||
|
||||||
xendev->backend_state == XenbusStateInitialising ||
|
xendev->backend_state == XenbusStateInitialising ||
|
||||||
xendev->backend_state == XenbusStateInitWait ||
|
xendev->backend_state == XenbusStateInitWait ||
|
||||||
@ -715,6 +710,17 @@ static void xen_device_frontend_changed(void *opaque)
|
|||||||
|
|
||||||
xen_device_frontend_set_state(xendev, state);
|
xen_device_frontend_set_state(xendev, state);
|
||||||
|
|
||||||
|
if (state == XenbusStateInitialising &&
|
||||||
|
xendev->backend_state == XenbusStateClosed &&
|
||||||
|
xendev->backend_online) {
|
||||||
|
/*
|
||||||
|
* The frontend is re-initializing so switch back to
|
||||||
|
* InitWait.
|
||||||
|
*/
|
||||||
|
xen_device_backend_set_state(xendev, XenbusStateInitWait);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (xendev_class->frontend_changed) {
|
if (xendev_class->frontend_changed) {
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user