pci.c (7d3660e79830a069f1848bb4fa1cdf8f666424fb) pci.c (aff92b828647839b956dfa647a18b3ce10058e6a)
1/*
2 * vfio based device assignment support
3 *
4 * Copyright Red Hat, Inc. 2012
5 *
6 * Authors:
7 * Alex Williamson <alex.williamson@redhat.com>
8 *

--- 2775 unchanged lines hidden (view full) ---

2784 if (strcmp(vbasedev_iter->name, vdev->vbasedev.name) == 0) {
2785 error_setg(errp, "device is already attached");
2786 vfio_put_group(group);
2787 goto error;
2788 }
2789 }
2790
2791 /*
1/*
2 * vfio based device assignment support
3 *
4 * Copyright Red Hat, Inc. 2012
5 *
6 * Authors:
7 * Alex Williamson <alex.williamson@redhat.com>
8 *

--- 2775 unchanged lines hidden (view full) ---

2784 if (strcmp(vbasedev_iter->name, vdev->vbasedev.name) == 0) {
2785 error_setg(errp, "device is already attached");
2786 vfio_put_group(group);
2787 goto error;
2788 }
2789 }
2790
2791 /*
2792 * Mediated devices *might* operate compatibly with memory ballooning, but
2792 * Mediated devices *might* operate compatibly with discarding of RAM, but
2793 * we cannot know for certain, it depends on whether the mdev vendor driver
2794 * stays in sync with the active working set of the guest driver. Prevent
2795 * the x-balloon-allowed option unless this is minimally an mdev device.
2796 */
2797 tmp = g_strdup_printf("%s/subsystem", vdev->vbasedev.sysfsdev);
2798 subsys = realpath(tmp, NULL);
2799 g_free(tmp);
2800 is_mdev = subsys && (strcmp(subsys, "/sys/bus/mdev") == 0);
2801 free(subsys);
2802
2803 trace_vfio_mdev(vdev->vbasedev.name, is_mdev);
2804
2793 * we cannot know for certain, it depends on whether the mdev vendor driver
2794 * stays in sync with the active working set of the guest driver. Prevent
2795 * the x-balloon-allowed option unless this is minimally an mdev device.
2796 */
2797 tmp = g_strdup_printf("%s/subsystem", vdev->vbasedev.sysfsdev);
2798 subsys = realpath(tmp, NULL);
2799 g_free(tmp);
2800 is_mdev = subsys && (strcmp(subsys, "/sys/bus/mdev") == 0);
2801 free(subsys);
2802
2803 trace_vfio_mdev(vdev->vbasedev.name, is_mdev);
2804
2805 if (vdev->vbasedev.balloon_allowed && !is_mdev) {
2805 if (vdev->vbasedev.ram_block_discard_allowed && !is_mdev) {
2806 error_setg(errp, "x-balloon-allowed only potentially compatible "
2807 "with mdev devices");
2808 vfio_put_group(group);
2809 goto error;
2810 }
2811
2812 ret = vfio_get_device(group, vdev->vbasedev.name, &vdev->vbasedev, errp);
2813 if (ret) {

--- 337 unchanged lines hidden (view full) ---

3151 DEFINE_PROP_BIT("x-vga", VFIOPCIDevice, features,
3152 VFIO_FEATURE_ENABLE_VGA_BIT, false),
3153 DEFINE_PROP_BIT("x-req", VFIOPCIDevice, features,
3154 VFIO_FEATURE_ENABLE_REQ_BIT, true),
3155 DEFINE_PROP_BIT("x-igd-opregion", VFIOPCIDevice, features,
3156 VFIO_FEATURE_ENABLE_IGD_OPREGION_BIT, false),
3157 DEFINE_PROP_BOOL("x-no-mmap", VFIOPCIDevice, vbasedev.no_mmap, false),
3158 DEFINE_PROP_BOOL("x-balloon-allowed", VFIOPCIDevice,
2806 error_setg(errp, "x-balloon-allowed only potentially compatible "
2807 "with mdev devices");
2808 vfio_put_group(group);
2809 goto error;
2810 }
2811
2812 ret = vfio_get_device(group, vdev->vbasedev.name, &vdev->vbasedev, errp);
2813 if (ret) {

--- 337 unchanged lines hidden (view full) ---

3151 DEFINE_PROP_BIT("x-vga", VFIOPCIDevice, features,
3152 VFIO_FEATURE_ENABLE_VGA_BIT, false),
3153 DEFINE_PROP_BIT("x-req", VFIOPCIDevice, features,
3154 VFIO_FEATURE_ENABLE_REQ_BIT, true),
3155 DEFINE_PROP_BIT("x-igd-opregion", VFIOPCIDevice, features,
3156 VFIO_FEATURE_ENABLE_IGD_OPREGION_BIT, false),
3157 DEFINE_PROP_BOOL("x-no-mmap", VFIOPCIDevice, vbasedev.no_mmap, false),
3158 DEFINE_PROP_BOOL("x-balloon-allowed", VFIOPCIDevice,
3159 vbasedev.balloon_allowed, false),
3159 vbasedev.ram_block_discard_allowed, false),
3160 DEFINE_PROP_BOOL("x-no-kvm-intx", VFIOPCIDevice, no_kvm_intx, false),
3161 DEFINE_PROP_BOOL("x-no-kvm-msi", VFIOPCIDevice, no_kvm_msi, false),
3162 DEFINE_PROP_BOOL("x-no-kvm-msix", VFIOPCIDevice, no_kvm_msix, false),
3163 DEFINE_PROP_BOOL("x-no-geforce-quirks", VFIOPCIDevice,
3164 no_geforce_quirks, false),
3165 DEFINE_PROP_BOOL("x-no-kvm-ioeventfd", VFIOPCIDevice, no_kvm_ioeventfd,
3166 false),
3167 DEFINE_PROP_BOOL("x-no-vfio-ioeventfd", VFIOPCIDevice, no_vfio_ioeventfd,

--- 77 unchanged lines hidden ---
3160 DEFINE_PROP_BOOL("x-no-kvm-intx", VFIOPCIDevice, no_kvm_intx, false),
3161 DEFINE_PROP_BOOL("x-no-kvm-msi", VFIOPCIDevice, no_kvm_msi, false),
3162 DEFINE_PROP_BOOL("x-no-kvm-msix", VFIOPCIDevice, no_kvm_msix, false),
3163 DEFINE_PROP_BOOL("x-no-geforce-quirks", VFIOPCIDevice,
3164 no_geforce_quirks, false),
3165 DEFINE_PROP_BOOL("x-no-kvm-ioeventfd", VFIOPCIDevice, no_kvm_ioeventfd,
3166 false),
3167 DEFINE_PROP_BOOL("x-no-vfio-ioeventfd", VFIOPCIDevice, no_vfio_ioeventfd,

--- 77 unchanged lines hidden ---