qemu-xen: Change prototype for pt_pci_host_read/write
PATCH 1/3 qemu-xen: Change prototype for pt_pci_host_read/write
pt_pci_host_read/write now takes a struct pci_dev*.
--- hw/pass-through.c | 19 +++++++------------ hw/pass-through.h | 5 +++-- hw/pt-graphics.c | 24 +++++++++++++----------- 3 files changed, 23 insertions(+), 25 deletions(-)
hw/pass-through.c +7 -12
@@ -2055,31 +2055,26 @@ static void pci_access_init(void) dpci_infos.pci_access = pci_access; } -u32 pt_pci_host_read (int bus,int dev,int fn,u32 addr,int len) +struct pci_dev *pt_pci_get_dev (int bus,int dev,int fn) { +pci_access_init (); +return pci_get_dev (dpci_infos.pci_access,0 , bus, dev, fn); +} -struct pci_dev *pci_dev; +u32 pt_pci_host_read (struct pci_dev *pci_dev,u32 addr,int len) +{u32 val =-1 ;pci_access_init (); - pci_dev =pci_get_dev (dpci_infos.pci_access,0 , bus, dev, fn); -if ( !pci_dev ) -return 0 ; -pci_read_block (pci_dev, addr, (u8 *) &val, len);return val; } -int pt_pci_host_write (int bus,int dev,int fn,u32 addr,u32 val,int len) +int pt_pci_host_write (struct pci_dev *pci_dev,u32 addr,u32 val,int len) { -struct pci_dev *pci_dev;int ret =0 ;pci_access_init (); - pci_dev =pci_get_dev (dpci_infos.pci_access,0 , bus, dev, fn); -if ( !pci_dev ) -return 0 ; - ret =pci_write_block (pci_dev, addr, (u8 *) &val, len);return ret; }
hw/pass-through.h +3 -2
@@ -406,8 +406,9 @@ static inline pciaddr_t pt_pci_base_addr(pciaddr_t base) }uint8_t pci_intx (struct pt_dev *ptdev); -u32 pt_pci_host_read (int bus,int dev,int fn,u32 addr,int len); -int pt_pci_host_write (int bus,int dev,int fn,u32 addr,u32 val,int len); +struct pci_dev *pt_pci_get_dev (int bus,int dev,int func); +u32 pt_pci_host_read (struct pci_dev *pci_dev,u32 addr,int len); +int pt_pci_host_write (struct pci_dev *pci_dev,u32 addr,u32 val,int len);void intel_pch_init (PCIBus *bus);int register_vga_regions (struct pt_dev *real_device);int unregister_vga_regions (struct pt_dev *real_device);
hw/pt-graphics.c +13 -11
@@ -23,13 +23,14 @@ void intel_pch_init(PCIBus *bus) {uint16_t vid, did;uint8_t rid; +struct pci_dev *pci_dev_1f =pt_pci_get_dev (0 ,0x1f ,0 ); -if ( !gfx_passthru ) +if ( !gfx_passthru || !pci_dev_1f )return ; - vid =pt_pci_host_read (0 ,0x1f ,0 ,0 ,2 ); - did =pt_pci_host_read (0 ,0x1f ,0 ,2 ,2 ); - rid =pt_pci_host_read (0 ,0x1f ,0 ,8 ,1 ); + vid =pt_pci_host_read (pci_dev_1f,PCI_VENDOR_ID ,2 ); + did =pt_pci_host_read (pci_dev_1f,PCI_DEVICE_ID ,2 ); + rid =pt_pci_host_read (pci_dev_1f,PCI_REVISION ,1 );if ( vid ==0x8086 ) pci_bridge_init(bus, PCI_DEVFN(0x1f, 0), vid, did, rid,
@@ -38,6 +39,7 @@ void intel_pch_init(PCIBus *bus)void igd_pci_write (PCIDevice *pci_dev,uint32_t config_addr,uint32_t val,int len) { +struct pci_dev *pci_dev_host_bridge =pt_pci_get_dev (0 ,0 ,0 );assert (pci_dev->devfn ==0x00 );if ( !igd_passthru ) {pci_default_write_config (pci_dev, config_addr, val, len);
@@ -47,7 +49,7 @@ void igd_pci_write(PCIDevice *pci_dev, uint32_t config_addr, uint32_t val, int lswitch (config_addr) {case 0x58 :// PAVPC Offset -pt_pci_host_write (0 ,0 ,0 , config_addr, val, len); +pt_pci_host_write (pci_dev_host_bridge, config_addr, val, len);PT_LOG ("pci_config_write: %x:%x.%x: addr=%x len=%x val=%x\n" ,pci_bus_num (pci_dev->bus),PCI_SLOT (pci_dev->devfn),PCI_FUNC (pci_dev->devfn), config_addr, len, val);
@@ -59,6 +61,7 @@ void igd_pci_write(PCIDevice *pci_dev, uint32_t config_addr, uint32_t val, int luint32_t igd_pci_read (PCIDevice *pci_dev,uint32_t config_addr,int len) { +struct pci_dev *pci_dev_host_bridge =pt_pci_get_dev (0 ,0 ,0 );uint32_t val;assert (pci_dev->devfn ==0x00 );
@@ -77,8 +80,7 @@ uint32_t igd_pci_read(PCIDevice *pci_dev, uint32_t config_addr, int len)case 0x58 :/* SNB: PAVPC Offset */ case 0xa4 :/* SNB: graphics base of stolen memory */ case 0xa8 :/* SNB: base of GTT stolen memory */ - val =pt_pci_host_read (0 ,PCI_SLOT (pci_dev->devfn), -0 , config_addr, len); + val =pt_pci_host_read (pci_dev_host_bridge, config_addr, len);PT_LOG ("pci_config_read: %x:%x.%x: addr=%x len=%x val=%x\n" ,pci_bus_num (pci_dev->bus),PCI_SLOT (pci_dev->devfn),PCI_FUNC (pci_dev->devfn), config_addr, len, val);
@@ -114,8 +116,8 @@ int register_vga_regions(struct pt_dev *real_device) DPCI_ADD_MAPPING);/* 1:1 map ASL Storage register value */ - vendor_id =pt_pci_host_read (0 ,2 ,0 ,0 ,2 ); - igd_opregion =pt_pci_host_read (0 ,2 ,0 ,0xfc ,4 ); + vendor_id =pt_pci_host_read (real_device->pci_dev,0 ,2 ); + igd_opregion =pt_pci_host_read (real_device->pci_dev,0xfc ,4 );if ( (vendor_id ==0x8086 ) && igd_opregion ) { ret |= xc_domain_memory_mapping(xc_handle, domid,
@@ -155,8 +157,8 @@ int unregister_vga_regions(struct pt_dev *real_device)20 , DPCI_REMOVE_MAPPING); - vendor_id =pt_pci_host_read (0 ,2 ,0 ,0 ,2 ); - igd_opregion =pt_pci_host_read (0 ,2 ,0 ,0xfc ,4 ); + vendor_id =pt_pci_host_read (real_device->pci_dev,0 ,2 ); + igd_opregion =pt_pci_host_read (real_device->pci_dev,0xfc ,4 );if ( (vendor_id ==0x8086 ) && igd_opregion ) { ret |= xc_domain_memory_mapping(xc_handle, domid,
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
PATCH 2/3 qemu-xen: Clean pt-graphic, use defined value.
Used defined value for 0x8086 (PCI_VENDOR_ID_INTEL) and some PCI config space offsets.
--- hw/pci.h | 1 + hw/pt-graphics.c | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-)
hw/pci.h +1 -0
@@ -169,6 +169,7 @@ typedef struct PCIIORegion {#define PCI_INTERRUPT_PIN 0x3d/* 8 bits */ #define PCI_MIN_GNT 0x3e/* 8 bits */ #define PCI_MAX_LAT 0x3f/* 8 bits */ +#define PCI_INTEL_OPREGION 0xfc/* 32 bits */ /* Header type 1 (PCI-to-PCI bridges) */ #define PCI_SEC_STATUS 0x1e/* Secondary status register */
hw/pt-graphics.c +6 -6
@@ -32,7 +32,7 @@ void intel_pch_init(PCIBus *bus) did =pt_pci_host_read (pci_dev_1f,PCI_DEVICE_ID ,2 ); rid =pt_pci_host_read (pci_dev_1f,PCI_REVISION ,1 ); -if ( vid ==0x8086 ) +if ( vid ==PCI_VENDOR_ID_INTEL )pci_bridge_init (bus,PCI_DEVFN (0x1f ,0 ), vid, did, rid, pch_map_irq,"intel_bridge_1f" ); }
@@ -117,8 +117,8 @@ int register_vga_regions(struct pt_dev *real_device)/* 1:1 map ASL Storage register value */ vendor_id =pt_pci_host_read (real_device->pci_dev,0 ,2 ); - igd_opregion =pt_pci_host_read (real_device->pci_dev,0xfc ,4 ); -if ( (vendor_id ==0x8086 ) && igd_opregion ) + igd_opregion =pt_pci_host_read (real_device->pci_dev,PCI_INTEL_OPREGION ,4 ); +if ( (vendor_id ==PCI_VENDOR_ID_INTEL ) && igd_opregion ) { ret |= xc_domain_memory_mapping(xc_handle, domid, igd_opregion >> XC_PAGE_SHIFT,
@@ -157,9 +157,9 @@ int unregister_vga_regions(struct pt_dev *real_device)20 , DPCI_REMOVE_MAPPING); - vendor_id =pt_pci_host_read (real_device->pci_dev,0 ,2 ); - igd_opregion =pt_pci_host_read (real_device->pci_dev,0xfc ,4 ); -if ( (vendor_id ==0x8086 ) && igd_opregion ) + vendor_id =pt_pci_host_read (real_device->pci_dev,PCI_VENDOR_ID ,2 ); + igd_opregion =pt_pci_host_read (real_device->pci_dev,PCI_INTEL_OPREGION ,4 ); +if ( (vendor_id ==PCI_VENDOR_ID_INTEL ) && igd_opregion ) { ret |= xc_domain_memory_mapping(xc_handle, domid, igd_opregion >> XC_PAGE_SHIFT,
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
PATCH 3/3 qemu-xen: passthrough, add PT_LOG_DEV
--- hw/pass-through.c | 97 +++++++++++++++++++---------------------------------- hw/pass-through.h | 5 +++ hw/pt-graphics.c | 14 ++++--- 3 files changed, 48 insertions(+), 68 deletions(-)
hw/pass-through.c +35 -62
@@ -1475,37 +1475,30 @@ static void pt_pci_write_config(PCIDevice *d, uint32_t address, uint32_t val,int ret =0 ;#ifdef PT_DEBUG_PCI_CONFIG_ACCESS -PT_LOG ("[%02x:%02x.%x]: address=%04x val=0x%08x len=%d\n" , -pci_bus_num (d->bus),PCI_SLOT (d->devfn),PCI_FUNC (d->devfn), - address, val, len); +PT_LOG_DEV (d,"address=%04x val=0x%08x len=%d\n" , address, val, len);#endif /* check offset range */ if (address >=0xFF ) { -PT_LOG ("Error: Failed to write register with offset exceeding FFh. " -"[%02x:%02x.%x][Offset:%02xh][Length:%d]\n" , -pci_bus_num (d->bus),PCI_SLOT (d->devfn),PCI_FUNC (d->devfn), - address, len); +PT_LOG_DEV (d,"Error: Failed to write register with offset exceeding FFh. " +"[Offset:%02xh][Length:%d]\n" , address, len); goto exit; }/* check write size */ if ((len !=1 ) && (len !=2 ) && (len !=4 )) { -PT_LOG ("Error: Failed to write register with invalid access length. " -"[%02x:%02x.%x][Offset:%02xh][Length:%d]\n" , -pci_bus_num (d->bus),PCI_SLOT (d->devfn),PCI_FUNC (d->devfn), - address, len); +PT_LOG_DEV (d,"Error: Failed to write register with invalid access length. " +"[Offset:%02xh][Length:%d]\n" , address, len); goto exit; }/* check offset alignment */ if (address & (len-1 )) { -PT_LOG ("Error: Failed to write register with invalid access size " -"alignment. [%02x:%02x.%x][Offset:%02xh][Length:%d]\n" , -pci_bus_num (d->bus),PCI_SLOT (d->devfn),PCI_FUNC (d->devfn), +PT_LOG_DEV (d,"Error: Failed to write register with invalid access size " +"alignment. [Offset:%02xh][Length:%d]\n" , address, len); goto exit; }
@@ -1515,10 +1508,8 @@ static void pt_pci_write_config(PCIDevice *d, uint32_t address, uint32_t val,if ((index >=0 ) && (val >0 && val <PT_BAR_ALLF ) && (assigned_device->bases[index].bar_flag ==PT_BAR_FLAG_UNUSED )) { -PT_LOG ("Warning: Guest attempt to set address to unused Base Address " -"Register. [%02x:%02x.%x][Offset:%02xh][Length:%d]\n" , -pci_bus_num (d->bus),PCI_SLOT (d->devfn),PCI_FUNC (d->devfn), - address, len); +PT_LOG_DEV (d,"Warning: Guest attempt to set address to unused Base Address " +"Register. [Offset:%02xh][Length:%d]\n" , address, len); }/* check power state transition flags */
@@ -1537,10 +1528,8 @@ static void pt_pci_write_config(PCIDevice *d, uint32_t address, uint32_t val,if (reg_grp->grp_type ==GRP_TYPE_HARDWIRED ) {/* ignore silently */ -PT_LOG ("Warning: Access to 0 Hardwired register. " -"[%02x:%02x.%x][Offset:%02xh][Length:%d]\n" , -pci_bus_num (d->bus),PCI_SLOT (d->devfn),PCI_FUNC (d->devfn), - address, len); +PT_LOG_DEV (d,"Warning: Access to 0 Hardwired register. " +"[Offset:%02xh][Length:%d]\n" , address, len); goto exit; } }
@@ -1668,30 +1657,24 @@ static uint32_t pt_pci_read_config(PCIDevice *d, uint32_t address, int len)/* check offset range */ if (address >=0xFF ) { -PT_LOG ("Error: Failed to read register with offset exceeding FFh. " -"[%02x:%02x.%x][Offset:%02xh][Length:%d]\n" , -pci_bus_num (d->bus),PCI_SLOT (d->devfn),PCI_FUNC (d->devfn), - address, len); +PT_LOG_DEV (d,"Error: Failed to read register with offset exceeding FFh. " +"[Offset:%02xh][Length:%d]\n" , address, len); goto exit; }/* check read size */ if ((len !=1 ) && (len !=2 ) && (len !=4 )) { -PT_LOG ("Error: Failed to read register with invalid access length. " -"[%02x:%02x.%x][Offset:%02xh][Length:%d]\n" , -pci_bus_num (d->bus),PCI_SLOT (d->devfn),PCI_FUNC (d->devfn), - address, len); +PT_LOG_DEV (d,"Error: Failed to read register with invalid access length. " +"[Offset:%02xh][Length:%d]\n" , address, len); goto exit; }/* check offset alignment */ if (address & (len-1 )) { -PT_LOG ("Error: Failed to read register with invalid access size " -"alignment. [%02x:%02x.%x][Offset:%02xh][Length:%d]\n" , -pci_bus_num (d->bus),PCI_SLOT (d->devfn),PCI_FUNC (d->devfn), - address, len); +PT_LOG_DEV (d,"Error: Failed to read register with invalid access size " +"alignment. [Offset:%02xh][Length:%d]\n" , address, len); goto exit; }
@@ -1803,9 +1786,7 @@ static uint32_t pt_pci_read_config(PCIDevice *d, uint32_t address, int len) exit:#ifdef PT_DEBUG_PCI_CONFIG_ACCESS -PT_LOG ("[%02x:%02x.%x]: address=%04x val=0x%08x len=%d\n" , -pci_bus_num (d->bus),PCI_SLOT (d->devfn),PCI_FUNC (d->devfn), - address, val, len); +PT_LOG_DEV (d,"address=%04x val=0x%08x len=%d\n" , address, val, len);#endif return val;
@@ -2181,9 +2162,8 @@ static void pt_bar_mapping_one(struct pt_dev *ptdev, int bar, int io_enable, ret =pt_chk_bar_overlap (dev->bus, dev->devfn, r_addr, r_size, r->type);if (ret >0 ) -PT_LOG ("Warning: ptdev[%02x:%02x.%x][Region:%d][Address:%08xh]" -"[Size:%08xh] is overlapped.\n" ,pci_bus_num (dev->bus), -PCI_SLOT (dev->devfn),PCI_FUNC (dev->devfn), bar, r_addr, r_size); +PT_LOG_DEV (dev,"Warning: [Region:%d][Address:%08xh]" +"[Size:%08xh] is overlapped.\n" , bar, r_addr, r_size);/* check whether we need to update the mapping or not */ if (r_addr != ptdev->bases[bar].e_physbase)
@@ -2217,9 +2197,8 @@ static int check_power_state(struct pt_dev *ptdev)if (pm_state->req_state != cur_state) { -PT_LOG ("Error: Failed to change power state. " -"[%02x:%02x.%x][requested state:%d][current state:%d]\n" , -pci_bus_num (d->bus),PCI_SLOT (d->devfn),PCI_FUNC (d->devfn), +PT_LOG_DEV (d,"Error: Failed to change power state. " +"[requested state:%d][current state:%d]\n" , pm_state->req_state, cur_state);return -1 ; }
@@ -2379,9 +2358,8 @@ static void pt_config_restore(struct pt_dev *ptdev) }#ifdef PT_DEBUG_PCI_CONFIG_ACCESS -PT_LOG ("[%02x:%02x.%x]: address=%04x val=0x%08x len=%d\n" , -pci_bus_num (d->bus),PCI_SLOT (d->devfn),PCI_FUNC (d->devfn), - real_offset, val, reg->size); +PT_LOG_DEV (d,"address=%04x val=0x%08x len=%d\n" , + real_offset, val, reg->size);#endif ret = pci_write_block(ptdev->pci_dev, real_offset,
@@ -2426,9 +2404,8 @@ static int pt_init_pci_config(struct pt_dev *ptdev)PCIDevice *d = &ptdev->dev;int ret =0 ; -PT_LOG ("Reinitialize PCI configuration registers " -"due to power state transition with internal reset. [%02x:%02x.%x]\n" , -pci_bus_num (d->bus),PCI_SLOT (d->devfn),PCI_FUNC (d->devfn)); +PT_LOG_DEV (d,"Reinitialize PCI configuration registers " +"due to power state transition with internal reset.\n" );/* restore a part of I/O device register */ pt_config_restore (ptdev);
@@ -3493,10 +3470,9 @@ static int pt_bar_reg_write(struct pt_dev *ptdev,if ((last_addr >=0x10000 ) && (cfg_entry->data != (PT_BAR_ALLF & ~bar_ro_mask))) { -PT_LOG ("Warning: Guest attempt to set Base Address " +PT_LOG_DEV (d,"Warning: Guest attempt to set Base Address " "over the 64KB. " -"[%02x:%02x.%x][Offset:%02xh][Address:%08xh][Size:%08xh]\n" , -pci_bus_num (d->bus),PCI_SLOT (d->devfn),PCI_FUNC (d->devfn), +"[Offset:%02xh][Address:%08xh][Size:%08xh]\n" , reg->offset, new_addr, r_size); }/* just remove mapping */
@@ -3509,11 +3485,10 @@ static int pt_bar_reg_write(struct pt_dev *ptdev, {if (cfg_entry->data != (PT_BAR_ALLF & ~bar_ro_mask)) { -PT_LOG ("Warning: Guest attempt to set high MMIO Base Address. " +PT_LOG_DEV (d,"Warning: Guest attempt to set high MMIO Base Address. " "Ignore mapping. " -"[%02x:%02x.%x][Offset:%02xh][High Address:%08xh]\n" , -pci_bus_num (d->bus),PCI_SLOT (d->devfn), -PCI_FUNC (d->devfn), reg->offset, cfg_entry->data); +"[Offset:%02xh][High Address:%08xh]\n" , + reg->offset, cfg_entry->data); }/* clear lower address */ d->io_regions[index-1 ].addr =-1 ;
@@ -3678,9 +3653,8 @@ static int pt_pmcsr_reg_write(struct pt_dev *ptdev,if ((pm_state->req_state !=0 ) && (pm_state->cur_state > pm_state->req_state)) { -PT_LOG ("Error: Invalid power transition. " -"[%02x:%02x.%x][requested state:%d][current state:%d]\n" , -pci_bus_num (d->bus),PCI_SLOT (d->devfn),PCI_FUNC (d->devfn), +PT_LOG_DEV (d,"Error: Invalid power transition. " +"[requested state:%d][current state:%d]\n" , pm_state->req_state, pm_state->cur_state);return 0 ;
@@ -3691,9 +3665,8 @@ static int pt_pmcsr_reg_write(struct pt_dev *ptdev, || ((pm_state->req_state == 2) && !(pm_state->pmc_field & PCI_PM_CAP_D2))) { -PT_LOG ("Error: Invalid power transition. " -"[%02x:%02x.%x][requested state:%d][current state:%d]\n" , -pci_bus_num (d->bus),PCI_SLOT (d->devfn),PCI_FUNC (d->devfn), +PT_LOG_DEV (d,"Error: Invalid power transition. " +"[requested state:%d][current state:%d]\n" , pm_state->req_state, pm_state->cur_state);return 0 ;
hw/pass-through.h +5 -0
@@ -31,8 +31,13 @@#ifdef PT_LOGGING_ENABLED #define PT_LOG(_f, _a...) fprintf(logfile, "%s: " _f, __func__, ##_a) +#define PT_LOG_DEV(_dev, _f, _a...) fprintf(logfile, "%s: [%02x:%02x:%01x] " _f, __func__, \ + pci_bus_num((_dev)->bus), \ + PCI_SLOT((_dev)->devfn), \ + PCI_FUNC((_dev)->devfn), ##_a)#else #define PT_LOG(_f, _a...) +#define PT_LOG_DEV(_dev, _f, _a...)#endif /* Some compilation flags */
hw/pt-graphics.c +8 -6
@@ -50,9 +50,10 @@ void igd_pci_write(PCIDevice *pci_dev, uint32_t config_addr, uint32_t val, int l {case 0x58 :// PAVPC Offset pt_pci_host_write (pci_dev_host_bridge, config_addr, val, len); -PT_LOG ("pci_config_write: %x:%x.%x: addr=%x len=%x val=%x\n" , -pci_bus_num (pci_dev->bus),PCI_SLOT (pci_dev->devfn), -PCI_FUNC (pci_dev->devfn), config_addr, len, val); +#ifdef PT_DEBUG_PCI_CONFIG_ACCESS +PT_LOG_DEV (pci_dev,"addr=%x len=%x val=%x\n" , + config_addr, len, val); +#endif break ;default :pci_default_write_config (pci_dev, config_addr, val, len);
@@ -81,9 +82,10 @@ uint32_t igd_pci_read(PCIDevice *pci_dev, uint32_t config_addr, int len)case 0xa4 :/* SNB: graphics base of stolen memory */ case 0xa8 :/* SNB: base of GTT stolen memory */ val =pt_pci_host_read (pci_dev_host_bridge, config_addr, len); -PT_LOG ("pci_config_read: %x:%x.%x: addr=%x len=%x val=%x\n" , -pci_bus_num (pci_dev->bus),PCI_SLOT (pci_dev->devfn), -PCI_FUNC (pci_dev->devfn), config_addr, len, val); +#ifdef PT_DEBUG_PCI_CONFIG_ACCESS +PT_LOG_DEV (pci_dev,"addr=%x len=%x val=%x\n" , + config_addr, len, val); +#endif break ;default : val =pci_default_read_config (pci_dev, config_addr, len);
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Jean Guyader writes ("[Xen-devel] [PATCH 1/3] qemu-xen: Change prototype for pt_pci_host_read/write"):
Quoted 1 line
pt_pci_host_read/write now takes a struct pci_dev*.
Why ?
Ian.
Quoted 6 lines · Ian Jackson
Jean Guyader writes ("[Xen-devel] [PATCH 1/3] qemu-xen: Change prototype for pt_pci_host_read/write"):
Quoted 1 line
pt_pci_host_read/write now takes a struct pci_dev*.
Why ?
Ian.
I found it more elegant that having to do thing like that:
val = pt_pci_host_read(0, PCI_SLOT(pci_dev->devfn),
0, config_addr, len);pci_dev is already of the right type.
With the old approach you would give a B:D:F to pt_pci_host_read then the function will call to libpci to get a pci_dev from that to do the config space access. In pretty much all the cases we already have a pci_dev, so I figured that we should be using it directly.
Jean
Quoted 11 lines · Jean Guyader
Quoted 6 lines · Ian Jackson
Jean Guyader writes ("[Xen-devel] [PATCH 1/3] qemu-xen: Change prototype for pt_pci_host_read/write"):
Quoted 1 line
pt_pci_host_read/write now takes a struct pci_dev*.
Why ?
Ian.
I found it more elegant that having to do thing like that:
val = pt_pci_host_read(0, PCI_SLOT(pci_dev->devfn), 0, config_addr, len);
Quoted 8 lines
pci_devis already of the right type.With the old approach you would give a B:D:F to
pt_pci_host_readthen the function will call to libpci to get apci_devfrom that to do the config space access. In pretty much all the cases we already have apci_dev, so I figured that we should be using it directly.
Hi Ian,
Any thought about this serie?
Jean
Jean Guyader writes ("Re: [Xen-devel] [PATCH 1/3] qemu-xen: Change prototype for pt_pci_host_read/write"):
Quoted 4 lines
I found it more elegant that having to do thing like that:
val = pt_pci_host_read(0, PCI_SLOT(pci_dev->devfn), 0, config_addr, len);
pci_devis already of the right type.
Right, OK. I have applied all three of your patches.
Ian.