Advertisement
Guest User

vfio-igd skylake patch adapted for v2.8.0

a guest
Jan 4th, 2017
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.21 KB | None | 0 0
  1. diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c
  2. index 811eecd..6fdb3d4 100644
  3. --- a/hw/vfio/pci-quirks.c
  4. +++ b/hw/vfio/pci-quirks.c
  5. @@ -1041,6 +1041,7 @@ static int igd_gen(VFIOPCIDevice *vdev)
  6.  typedef struct VFIOIGDQuirk {
  7.      struct VFIOPCIDevice *vdev;
  8.      uint32_t index;
  9. +    uint32_t bdsm;
  10.  } VFIOIGDQuirk;
  11.  
  12.  #define IGD_GMCH 0x50 /* Graphics Control Register */
  13. @@ -1304,7 +1305,7 @@ static void vfio_igd_quirk_data_write(void *opaque, hwaddr addr,
  14.                           "BIOS reserved stolen memory.  Unsupported BIOS?");
  15.              }
  16.  
  17. -            val = base | (data & ((1 << 20) - 1));
  18. +            val = data - igd->bdsm + base;
  19.          } else {
  20.              val = 0; /* upper 32bits of pte, we only enable below 4G PTEs */
  21.          }
  22. @@ -1503,6 +1504,8 @@ static void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)
  23.      igd = quirk->data = g_malloc0(sizeof(*igd));
  24.      igd->vdev = vdev;
  25.      igd->index = ~0;
  26. +    igd->bdsm = vfio_pci_read_config(&vdev->pdev, IGD_BDSM, 4);
  27. +    igd->bdsm &= ~((1 << 20) - 1); /* 1MB aligned */
  28.  
  29.      memory_region_init_io(&quirk->mem[0], OBJECT(vdev), &vfio_igd_index_quirk,
  30.                            igd, "vfio-igd-index-quirk", 4);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement