From: Keir Fraser Date: Wed, 7 Nov 2007 09:21:16 +0000 (+0000) Subject: HVM device passthru: Correct PCI_EXP_DEVCTL_FLR X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14786^2~8 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=78a146f3c3dc9c4b563e6cfed16a31a085a89859;p=xen.git HVM device passthru: Correct PCI_EXP_DEVCTL_FLR This patch corrects PCI_EXP_DEVCTL_FLR so that function level reset will be really executed, and also replaces some magic numbers with macros. Signed-off-by: Anthony Xu Signed-off-by: Weidong Han --- diff --git a/tools/ioemu/hw/pass-through.c b/tools/ioemu/hw/pass-through.c index 7dd9588ba0..8645faa29d 100644 --- a/tools/ioemu/hw/pass-through.c +++ b/tools/ioemu/hw/pass-through.c @@ -127,9 +127,10 @@ void pt_iomem_map(PCIDevice *d, int i, uint32_t e_phys, uint32_t e_size, if ( !first_map ) { /* Remove old mapping */ - ret = xc_domain_memory_mapping(xc_handle, domid, old_ebase >> 12, - assigned_device->bases[i].access.maddr >> 12, - (e_size+0xFFF) >> 12, + ret = xc_domain_memory_mapping(xc_handle, domid, + old_ebase >> PAGE_SHIFT, + assigned_device->bases[i].access.maddr >> PAGE_SHIFT, + (e_size+PAGE_MASK) >> PAGE_SHIFT, DPCI_REMOVE_MAPPING); if ( ret != 0 ) { @@ -140,9 +141,9 @@ void pt_iomem_map(PCIDevice *d, int i, uint32_t e_phys, uint32_t e_size, /* Create new mapping */ ret = xc_domain_memory_mapping(xc_handle, domid, - assigned_device->bases[i].e_physbase >> 12, - assigned_device->bases[i].access.maddr >> 12, - (e_size+0xFFF) >> 12, + assigned_device->bases[i].e_physbase >> PAGE_SHIFT, + assigned_device->bases[i].access.maddr >> PAGE_SHIFT, + (e_size+PAGE_MASK) >> PAGE_SHIFT, DPCI_ADD_MAPPING); if ( ret != 0 ) PT_LOG("Error: create new mapping failed!\n"); diff --git a/tools/ioemu/hw/pass-through.h b/tools/ioemu/hw/pass-through.h index 42f7b52d74..b05527330a 100644 --- a/tools/ioemu/hw/pass-through.h +++ b/tools/ioemu/hw/pass-through.h @@ -40,7 +40,7 @@ /* Misc PCI constants that should be moved to a separate library :) */ #define PCI_CONFIG_SIZE (256) #define PCI_EXP_DEVCAP_FLR (1 << 28) -#define PCI_EXP_DEVCTL_FLR (0x1b) +#define PCI_EXP_DEVCTL_FLR (1 << 15) #define PCI_BAR_ENTRIES (6) struct pt_region {