[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 03/66] dma: keep a device alive while it has SGL
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 03/66] dma: keep a device alive while it has SGLists |
Date: |
Thu, 04 Jul 2013 18:00:32 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 |
Il 04/07/2013 17:51, Jan Kiszka ha scritto:
>> > diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
>> > index 16d6356..65e6680 100644
>> > --- a/hw/usb/hcd-ehci.c
>> > +++ b/hw/usb/hcd-ehci.c
>> > @@ -1245,7 +1245,7 @@ static int ehci_init_transfer(EHCIPacket *p)
>> > cpage = get_field(p->qtd.token, QTD_TOKEN_CPAGE);
>> > bytes = get_field(p->qtd.token, QTD_TOKEN_TBYTES);
>> > offset = p->qtd.bufptr[0] & ~QTD_BUFPTR_MASK;
>> > - qemu_sglist_init(&p->sgl, 5, p->queue->ehci->as);
>> > + qemu_sglist_init(&p->sgl, DEVICE(p->queue->ehci), 5,
>> > p->queue->ehci->as);
> I was just testing this from your current git tree, and it causes
>
> qemu/hw/usb/hcd-ehci.c:1248:ehci_init_transfer: Object 0x7f3eb39c6500 is
> not an instance of type device
>
> when booting a q35 machine (as it pulls in EHCI). The cast is obviously
> wrong, but I didn't spot yet what is required instead.
EHCIState and AHCIDevice are not qdev structs. You need to go
through the bus to get the DeviceState. But I had fixed this once...
/me checks
Yes, I had fixed it at the same time I fixed Andreas's requested
BUS(). I thought I had fixed it _before_ posting this patch first.
Pulling in the "Reviewed-by"s (as I just replied to the cover
letter) also pulled in the right version of the patch. So it
should be fixed _now_ in git (commit c7086b4a).
I tested both AHCI and EHCI and they work.
(BTW, Andreas, I'll do a SCSI_BUS pass over hw/scsi when I
have some time).
Paolo
git diff mirror/address@hidden iommu-for-anthony
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index bae484a..97eddec 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -650,6 +650,8 @@ static int ahci_populate_sglist(AHCIDevice *ad, QEMUSGList
*sglist, int offset)
int off_idx = -1;
int off_pos = -1;
int tbl_entry_size;
+ IDEBus *bus = &ad->port;
+ BusState *qbus = BUS(bus);
if (!sglist_alloc_hint) {
DPRINTF(ad->port_no, "no sg list given by guest: 0x%08x\n", opts);
@@ -691,7 +693,7 @@ static int ahci_populate_sglist(AHCIDevice *ad, QEMUSGList
*sglist, int offset)
goto out;
}
- qemu_sglist_init(sglist, DEVICE(ad->hba), (sglist_alloc_hint -
off_idx),
+ qemu_sglist_init(sglist, qbus->parent, (sglist_alloc_hint - off_idx),
ad->hba->as);
qemu_sglist_add(sglist, le64_to_cpu(tbl[off_idx].addr + off_pos),
le32_to_cpu(tbl[off_idx].flags_size) + 1 - off_pos);
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index cdc932b..67e4b24 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -1241,11 +1241,13 @@ static int ehci_init_transfer(EHCIPacket *p)
{
uint32_t cpage, offset, bytes, plen;
dma_addr_t page;
+ USBBus *bus = &p->queue->ehci->bus;
+ BusState *qbus = BUS(bus);
cpage = get_field(p->qtd.token, QTD_TOKEN_CPAGE);
bytes = get_field(p->qtd.token, QTD_TOKEN_TBYTES);
offset = p->qtd.bufptr[0] & ~QTD_BUFPTR_MASK;
- qemu_sglist_init(&p->sgl, DEVICE(p->queue->ehci), 5, p->queue->ehci->as);
+ qemu_sglist_init(&p->sgl, qbus->parent, 5, p->queue->ehci->as);
while (bytes > 0) {
if (cpage > 4) {
- [Qemu-devel] [PULL 00/66] Memory API changes for 1.6: ownership, I/O ports, RCU preparation, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 04/66] adlib: replace register_ioport*, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 05/66] applesmc: replace register_ioport*, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 06/66] wdt_ib700: replace register_ioport*, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 07/66] i82374: replace register_ioport*, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 08/66] prep: replace register_ioport*, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 09/66] vt82c686: replace register_ioport*, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 10/66] Privatize register_ioport_read/write, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 11/66] isa: implement isa_is_ioport_assigned via memory_region_find, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 12/66] vmware-vga: Accept unaligned I/O accesses, Paolo Bonzini, 2013/07/04