Commit 23919ddf authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/aperard/tags/pull-xen-20190827' into staging



Xen queue

* Fixes for xen-bus and exit cleanup.
* Build fix.

# gpg: Signature made Tue 27 Aug 2019 14:31:10 BST
# 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-20190827:
  xen-bus: Avoid rewriting identical values to xenstore
  xen-bus: Fix backend state transition on device reset
  xen: cleanup IOREQ server on exit
  xen: Fix ring.h header

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents dac03af5 705be570
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1247,6 +1247,8 @@ static void xen_exit_notifier(Notifier *n, void *data)
{
    XenIOState *state = container_of(n, XenIOState, exit);

    xen_destroy_ioreq_server(xen_domid, state->ioservid);

    xenevtchn_close(state->xce_handle);
    xs_daemon_close(state->xenstore);
}
+27 −7
Original line number Diff line number Diff line
@@ -516,6 +516,23 @@ static void xen_device_backend_set_online(XenDevice *xendev, bool online)
    xen_device_backend_printf(xendev, "online", "%u", online);
}

/*
 * Tell from the state whether the frontend is likely alive,
 * i.e. it will react to a change of state of the backend.
 */
static bool xen_device_state_is_active(enum xenbus_state state)
{
    switch (state) {
    case XenbusStateInitWait:
    case XenbusStateInitialised:
    case XenbusStateConnected:
    case XenbusStateClosing:
        return true;
    default:
        return false;
    }
}

static void xen_device_backend_changed(void *opaque)
{
    XenDevice *xendev = opaque;
@@ -539,11 +556,11 @@ static void xen_device_backend_changed(void *opaque)

    /*
     * If the toolstack (or unplug request callback) has set the backend
     * state to Closing, but there is no active frontend (i.e. the
     * state is not Connected) then set the backend state to Closed.
     * state to Closing, but there is no active frontend then set the
     * backend state to Closed.
     */
    if (xendev->backend_state == XenbusStateClosing &&
        xendev->frontend_state != XenbusStateConnected) {
        !xen_device_state_is_active(state)) {
        xen_device_backend_set_state(xendev, XenbusStateClosed);
    }

@@ -681,7 +698,8 @@ int xen_device_frontend_scanf(XenDevice *xendev, const char *key,
}

static void xen_device_frontend_set_state(XenDevice *xendev,
                                          enum xenbus_state state)
                                          enum xenbus_state state,
                                          bool publish)
{
    const char *type = object_get_typename(OBJECT(xendev));

@@ -693,8 +711,10 @@ static void xen_device_frontend_set_state(XenDevice *xendev,
                                    xs_strstate(state));

    xendev->frontend_state = state;
    if (publish) {
        xen_device_frontend_printf(xendev, "state", "%u", state);
    }
}

static void xen_device_frontend_changed(void *opaque)
{
@@ -709,7 +729,7 @@ static void xen_device_frontend_changed(void *opaque)
        state = XenbusStateUnknown;
    }

    xen_device_frontend_set_state(xendev, state);
    xen_device_frontend_set_state(xendev, state, false);

    if (state == XenbusStateInitialising &&
        xendev->backend_state == XenbusStateClosed &&
@@ -1152,7 +1172,7 @@ static void xen_device_realize(DeviceState *dev, Error **errp)
    xen_device_frontend_printf(xendev, "backend-id", "%u",
                               xenbus->backend_id);

    xen_device_frontend_set_state(xendev, XenbusStateInitialising);
    xen_device_frontend_set_state(xendev, XenbusStateInitialising, true);

    xendev->exit.notify = xen_device_exit;
    qemu_add_exit_notifier(&xendev->exit);
+7 −6
Original line number Diff line number Diff line
@@ -33,6 +33,13 @@
 * - standard integers types (uint8_t, uint16_t, etc)
 * They are provided by stdint.h of the standard headers.
 *
 * Before using the different macros, you need to provide the following
 * macros:
 * - xen_mb()  a memory barrier
 * - xen_rmb() a read memory barrier
 * - xen_wmb() a write memory barrier
 * Example of those can be found in xenctrl.h.
 *
 * In addition, if you intend to use the FLEX macros, you also need to
 * provide the following, before invoking the FLEX macros:
 * - size_t
@@ -42,12 +49,6 @@
 * and grant_table.h from the Xen public headers.
 */

#if __XEN_INTERFACE_VERSION__ < 0x00030208
#define xen_mb()  mb()
#define xen_rmb() rmb()
#define xen_wmb() wmb()
#endif

typedef unsigned int RING_IDX;

/* Round a 32-bit unsigned constant down to the nearest power of two. */