summaryrefslogtreecommitdiff
path: root/hw/xen
diff options
context:
space:
mode:
authorRoss Lagerwall <ross.lagerwall@citrix.com>2018-05-14 10:57:46 +0100
committerStefano Stabellini <sstabellini@kernel.org>2018-05-18 11:03:19 -0700
commitdc9e46a29aad8ba5d2fb0871268baa9c7edc0f95 (patch)
tree371427e1fb46bf1a63e5f392546b69ed453a1f06 /hw/xen
parent70c292afdffe9176a3255cc32d723ddd673dab52 (diff)
downloadqemu-dc9e46a29aad8ba5d2fb0871268baa9c7edc0f95.zip
xen_pt: Present the size of 64 bit BARs correctly
The full size of the BAR is stored in the lower PCIIORegion.size. The upper PCIIORegion.size is 0. Calculate the size of the upper half correctly from the lower half otherwise the size read by the guest will be incorrect. Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com> Acked-by: Anthony PERARD <anthony.perard@citrix.com> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
Diffstat (limited to 'hw/xen')
-rw-r--r--hw/xen/xen_pt_config_init.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/hw/xen/xen_pt_config_init.c b/hw/xen/xen_pt_config_init.c
index a3ce33e78b..aee31c62bb 100644
--- a/hw/xen/xen_pt_config_init.c
+++ b/hw/xen/xen_pt_config_init.c
@@ -504,6 +504,8 @@ static int xen_pt_bar_reg_write(XenPCIPassthroughState *s, XenPTReg *cfg_entry,
bar_ro_mask = XEN_PT_BAR_IO_RO_MASK | (r_size - 1);
break;
case XEN_PT_BAR_FLAG_UPPER:
+ assert(index > 0);
+ r_size = d->io_regions[index - 1].size >> 32;
bar_emu_mask = XEN_PT_BAR_ALLF;
bar_ro_mask = r_size ? r_size - 1 : 0;
break;