# HG changeset patch # User Keir Fraser # Date 1194427276 0 # Node ID 11dcbf74edf23adc3baca6330408a1f85de8094d # Parent b544448502a40d510d3ee678c85e7db6b9f9474c 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 -r b544448502a4 -r 11dcbf74edf2 tools/ioemu/hw/pass-through.c --- a/tools/ioemu/hw/pass-through.c Wed Nov 07 09:13:48 2007 +0000 +++ b/tools/ioemu/hw/pass-through.c Wed Nov 07 09:21:16 2007 +0000 @@ -127,9 +127,10 @@ void pt_iomem_map(PCIDevice *d, int i, u 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, u /* 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 -r b544448502a4 -r 11dcbf74edf2 tools/ioemu/hw/pass-through.h --- a/tools/ioemu/hw/pass-through.h Wed Nov 07 09:13:48 2007 +0000 +++ b/tools/ioemu/hw/pass-through.h Wed Nov 07 09:21:16 2007 +0000 @@ -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 {