ehci: save device pointer in EHCIState
PATCH 1/1 ehci: save device pointer in EHCIState
We'll need a pointer to the actual pci/sysbus device, stick a pointer to it into the EHCIState struct.
https://bugzilla.redhat.com/show_bug.cgi?id=1005495
--- hw/usb/hcd-ehci.c | 3 ++- hw/usb/hcd-ehci.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
hw/usb/hcd-ehci.c +2 -1
@@ -1486,7 +1486,7 @@ static int ehci_process_itd(EHCIState *ehci,return -1 ; } -qemu_sglist_init (&ehci->isgl,DEVICE (ehci),2 , ehci->as); +qemu_sglist_init (&ehci->isgl, ehci->device,2 , ehci->as);if (off + len >4096 ) {/* transfer crosses page border */ uint32_t len2 = off + len -4096 ;
@@ -2529,6 +2529,7 @@ void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp) s->frame_timer =timer_new_ns (QEMU_CLOCK_VIRTUAL , ehci_frame_timer, s); s->async_bh =qemu_bh_new (ehci_frame_timer, s); + s->device = dev;qemu_register_reset (ehci_reset, s);qemu_add_vm_change_state_handler (usb_ehci_vm_state_change, s);
hw/usb/hcd-ehci.h +1 -0
@@ -255,6 +255,7 @@ typedef QTAILQ_HEAD(EHCIQueueHead, EHCIQueue) EHCIQueueHead;struct EHCIState {USBBus bus; +DeviceState *device;qemu_irq irq;MemoryRegion mem;AddressSpace *as;
Signature · 1 line
1.8.3.1
Hi,
Quoted 4 lines · Gerd Hoffmann
We'll need a pointer to the actual pci/sysbus device, stick a pointer to it into the EHCIState struct.
Looks like we've been working on exactly the same bug at the same time, but we've come up with slightly different solutions.
If we're going to go this way (which seems the best), you should also modify the qemu_sglist_init call in ehci_init_transfer for consistency, and drop the bus and qbus variable declarations at the top of the functions as those will be unused then.
Regards,
Hans
Quoted 10 lines · Hans de Goede
Hi,
Quoted 4 lines · Gerd Hoffmann
We'll need a pointer to the actual pci/sysbus device, stick a pointer to it into the EHCIState struct.
Looks like we've been working on exactly the same bug at the same time, but we've come up with slightly different solutions.
Yep, and then "git send-email" exactly the same minute ;)
Quoted 5 lines
If we're going to go this way (which seems the best), you should also modify the
qemu_sglist_initcall inehci_init_transferfor consistency, and drop the bus and qbus variable declarations at the top of the functions as those will be unused then.
Makes sense indeed. Done, v2 sent.
cheers,
Gerd