From: Cornelia Huck Date: Wed, 5 Dec 2018 14:35:03 +0000 (+0100) Subject: vfio-ap: flag as compatible with balloon X-Git-Tag: v3.1.1~71 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=821314aec3e1ca36b00ef04adbfeacf5665ed610;p=thirdparty%2Fqemu.git vfio-ap: flag as compatible with balloon vfio-ap devices do not pin any pages in the host. Therefore, they are compatible with memory ballooning. Flag them as compatible, so both vfio-ap and a balloon can be used simultaneously. Cc: qemu-stable@nongnu.org Acked-by: Christian Borntraeger Tested-by: Tony Krowiak Reviewed-by: Halil Pasic Signed-off-by: Cornelia Huck (cherry picked from commit 1883e8fc8005e9ef452890a075bae98e8c432968) Signed-off-by: Michael Roth --- diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c index 65de952f442..0a25f5e0963 100644 --- a/hw/vfio/ap.c +++ b/hw/vfio/ap.c @@ -104,6 +104,14 @@ static void vfio_ap_realize(DeviceState *dev, Error **errp) vapdev->vdev.name = g_strdup_printf("%s", mdevid); vapdev->vdev.dev = dev; + /* + * vfio-ap devices operate in a way compatible with + * memory ballooning, as no pages are pinned in the host. + * This needs to be set before vfio_get_device() for vfio common to + * handle the balloon inhibitor. + */ + vapdev->vdev.balloon_allowed = true; + ret = vfio_get_device(vfio_group, mdevid, &vapdev->vdev, &local_err); if (ret) { goto out_get_dev_err;