ehci-sysbus: Attach DMA context.
PATCH 1/1 ehci-sysbus: Attach DMA context.
This was left as NULL on the initial merge due to debate on the mailing list on how to handle DMA contexts for sysbus devices. Patch 9e11908f12f92e31ea94dc2a4c962c836cba9f2a was later merged to fix OHCI. This is the, equivalent fix for sysbus EHCI.
--- hw/usb/hcd-ehci-sysbus.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
hw/usb/hcd-ehci-sysbus.c +1 -0
@@ -45,6 +45,7 @@ static int usb_ehci_sysbus_initfn(SysBusDevice *dev) s->capsbase =0x100 ; s->opregbase =0x140 ; + s->dma = &dma_context_memory;usb_ehci_initfn (s,DEVICE (dev));sysbus_init_irq (dev, &s->irq);
Signature · 1 line
1.7.0.4
Quoted 4 lines · Peter Crosthwaite
This was left as NULL on the initial merge due to debate on the mailing list on how to handle DMA contexts for sysbus devices. Patch
9e11908f12f92e31ea94dc2a4c962c836cba9f2awas later merged to fix OHCI. This is the, equivalent fix for sysbus EHCI.
I have also found this issue, but it's not the cause that xilinx ehci can't work with usb-storage disk. Do you have any update for xilinx ehci?
Quoted 2 lines
Signed-off-by Peter Crosthwaite <[email protected]>
Liming Wang
Quoted 20 lines
---
hw/usb/hcd-ehci-sysbus.c| 1 +1 files changed, 1 insertions(+), 0 deletions(-)hw/usb/hcd-ehci-sysbus.c +1
-0@@ -45,6 +45,7 @@ static int usb_ehci_sysbus_initfn(SysBusDevice *dev) s->capsbase =0x100 ; s->opregbase =0x140 ; + s->dma = &dma_context_memory;usb_ehci_initfn (s,DEVICE (dev));sysbus_init_irq (dev, &s->irq);Signature · 1 line
1.7.0.4
Quoted 10 lines · walimis
Quoted 4 lines · Peter Crosthwaite
This was left as NULL on the initial merge due to debate on the mailing list on how to handle DMA contexts for sysbus devices. Patch
9e11908f12f92e31ea94dc2a4c962c836cba9f2awas later merged to fix OHCI. This is the, equivalent fix for sysbus EHCI.I have also found this issue, but it's not the cause that xilinx ehci can't work with usb-storage disk. Do you have any update for xilinx ehci?
Hi Liming,
I haven't got around to looking into that one yet unfortunately. No updates just yet - ill let you know if it resolves. It could very well be a Linux bug as well so it needs to be investigated from both sides of the fence.
Quoted 5 lines
Quoted 2 lines
Signed-off-by Peter Crosthwaite <[email protected]>Tested-by Liming Wang <[email protected]>
Thanks.
Regards,
Peter
Quoted 23 lines
Liming Wang
Quoted 20 lines
---
hw/usb/hcd-ehci-sysbus.c| 1 +1 files changed, 1 insertions(+), 0 deletions(-)hw/usb/hcd-ehci-sysbus.c +1
-1@@ -45,6 +45,7 @@ static int usb_ehci_sysbus_initfn(SysBusDevice *dev) s->capsbase =0x100 ; s->opregbase =0x140 ; + s->dma = &dma_context_memory;usb_ehci_initfn (s,DEVICE (dev));sysbus_init_irq (dev, &s->irq); --1.7.0.4
Quoted 12 lines · Peter Crosthwaite
Quoted 10 lines · walimis
Quoted 4 lines · Peter Crosthwaite
This was left as NULL on the initial merge due to debate on the mailing list on how to handle DMA contexts for sysbus devices. Patch
9e11908f12f92e31ea94dc2a4c962c836cba9f2awas later merged to fix OHCI. This is the, equivalent fix for sysbus EHCI.I have also found this issue, but it's not the cause that xilinx ehci can't work with usb-storage disk. Do you have any update for xilinx ehci?
Quoted 6 lines
Hi Liming,
I haven't got around to looking into that one yet unfortunately. No updates just yet - ill let you know if it resolves. It could very well be a Linux bug as well so it needs to be investigated from both sides of the fence.
As said in another mail, I found that the root cause is that xilinx_zynq has two EHCI controller. If we use usb-storage disk, the disk will be attached to the second EHCI controller, which the kernel uses the first EHCI controller by default.
For now, qemu doesn't support two EHCI controller, could we remove the second EHCI from xilinx_zynq?
Liming Wang
Quoted 35 lines
Quoted 6 lines
Quoted 3 lines
Signed-off-by Peter Crosthwaite <[email protected]>Tested-by Liming Wang <[email protected]>Thanks.
Regards,
PeterQuoted 23 lines
Liming Wang
Quoted 20 lines
---
hw/usb/hcd-ehci-sysbus.c| 1 +1 files changed, 1 insertions(+), 0 deletions(-)hw/usb/hcd-ehci-sysbus.c +1
-1@@ -45,6 +45,7 @@ static int usb_ehci_sysbus_initfn(SysBusDevice *dev) s->capsbase =0x100 ; s->opregbase =0x140 ; + s->dma = &dma_context_memory;usb_ehci_initfn (s,DEVICE (dev));sysbus_init_irq (dev, &s->irq); --1.7.0.4
Hi,
Quoted 4 lines
As said in another mail, I found that the root cause is that
xilinx_zynqhas two EHCI controller. If we use usb-storage disk, the disk will be attached to the second EHCI controller, which the kernel uses the first EHCI controller by default.
For the linux kernel it shouldn't matter where the usb stick is connected. Assuming it finds both ehci controllers. Does it?
Quoted 2 lines
For now, qemu doesn't support two EHCI controller, could we remove the second EHCI from
xilinx_zynq?
Two controllers should work just fine. I'd suggest to find the root cause instead of doctoring like this. ehci + usb core are fine with two controllers & busses, maybe the arch plumbing (device tree?) misses something so the linux kernel doesn't find the second ehci controller.
cheers,
Gerd
Quoted 9 lines · Gerd Hoffmann
Hi,
Quoted 4 lines
As said in another mail, I found that the root cause is that
xilinx_zynqhas two EHCI controller. If we use usb-storage disk, the disk will be attached to the second EHCI controller, which the kernel uses the first EHCI controller by default.For the linux kernel it shouldn't matter where the usb stick is connected. Assuming it finds both ehci controllers. Does it?
The default device tree of linux kernel has only the first ehci controller support, so the kernel can't detect the second controller.
But the usb-storage disk is attached to the second controller, so that the disk is failed to be detected by the linux kernel.
Quoted 5 lines
Quoted 3 lines
For now, qemu doesn't support two EHCI controller, could we remove the second EHCI from
xilinx_zynq?Two controllers should work just fine. I'd suggest to find the root
Yes, they work fine separately, but I don't know how to use them at the same time (I mean both controller have device attached) as I have mentioned in the another mail.
Liming Wang
Quoted 7 lines
cause instead of doctoring like this. ehci + usb core are fine with two controllers & busses, maybe the arch plumbing (device tree?) misses something so the linux kernel doesn't find the second ehci controller.
cheers,
Gerd
Hi Liming, Gerd,
Quoted 8 lines · walimis
Quoted 7 lines · Gerd Hoffmann
Hi,
Quoted 4 lines
As said in another mail, I found that the root cause is that
xilinx_zynqhas two EHCI controller. If we use usb-storage disk, the disk will be attached to the second EHCI controller, which the kernel uses the first EHCI controller by default.
I am using a device tree driven kernel with this:
ps7_usb_0: ps7-usb@e0002000 {
compatible = "xlnx,ps7-usb-1.00.a";
dr_mode = "host";
interrupt-parent = <&ps7_scugic_0>;
interrupts = < 0 21 0 >;
phy_type = "ulpi";
reg = < 0xe0002000 0x1000 >;
xlnx,usb-reset = <0xffffffff>;
} ;
ps7_usb_1: ps7-usb@e0003000 {
compatible = "xlnx,ps7-usb-1.00.a";
dr_mode = "host";
interrupt-parent = <&ps7_scugic_0>;
interrupts = < 0 44 0 >;
phy_type = "ulpi";
reg = < 0xe0003000 0x1000 >;
xlnx,usb-reset = <0xffffffff>;
} ;And it now works for me, device successfully attaches to second controller:
| usb 2-1: New USB device found, idVendor=46f4, idProduct=0001 | usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 | usb 2-1: Product: QEMU USB HARDDRIVE | usb 2-1: Manufacturer: QEMU | usb 2-1: SerialNumber: 1-1
Quoted 3 lines
Quoted 2 lines
For the linux kernel it shouldn't matter where the usb stick is connected. Assuming it finds both ehci controllers. Does it?
Gerd,
Is there any documentation out there on how to tell QEMU on command line which EHCI you want your usb-storage to attach to?
Quoted 10 lines
The default device tree of linux kernel has only the first ehci controller support, so the kernel can't detect the second controller.
But the usb-storage disk is attached to the second controller, so that the disk is failed to be detected by the linux kernel.Quoted 4 lines
Quoted 3 lines
For now, qemu doesn't support two EHCI controller, could we remove the second EHCI from
xilinx_zynq?
Prefer not. Just need a better kernel and DTB. This was definitely broken for me recently, but I have pulled patches in my kernel, so I think this has been fixed by the Xilinx kernel devels.
Regards,
Peter
Quoted 16 lines
Quoted 1 line
Two controllers should work just fine. I'd suggest to find the root
Yes, they work fine separately, but I don't know how to use them at the same time (I mean both controller have device attached) as I have mentioned in the another mail.
Liming Wang
Quoted 7 lines
cause instead of doctoring like this. ehci + usb core are fine with two controllers & busses, maybe the arch plumbing (device tree?) misses something so the linux kernel doesn't find the second ehci controller.
cheers,
Gerd
Quoted 33 lines · Peter Crosthwaite
Hi Liming, Gerd,
Quoted 8 lines · walimis
Quoted 7 lines · Gerd Hoffmann
Hi,
Quoted 4 lines
As said in another mail, I found that the root cause is that
xilinx_zynqhas two EHCI controller. If we use usb-storage disk, the disk will be attached to the second EHCI controller, which the kernel uses the first EHCI controller by default.I am using a device tree driven kernel with this:
ps7_usb_0: ps7-usb@e0002000 { compatible = "xlnx,ps7-usb-1.00.a"; dr_mode = "host"; interrupt-parent = <&ps7_scugic_0>; interrupts = < 0 21 0 >; phy_type = "ulpi"; reg = < 0xe0002000 0x1000 >; xlnx,usb-reset = <0xffffffff>; } ; ps7_usb_1: ps7-usb@e0003000 { compatible = "xlnx,ps7-usb-1.00.a"; dr_mode = "host"; interrupt-parent = <&ps7_scugic_0>; interrupts = < 0 44 0 >; phy_type = "ulpi"; reg = < 0xe0003000 0x1000 >; xlnx,usb-reset = <0xffffffff>; } ;
Quoted 1 line
And it now works for me, device successfully attaches to second controller:
OK, that's good.
Quoted 23 lines
| usb 2-1: New USB device found, idVendor=46f4, idProduct=0001 | usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 | usb 2-1: Product: QEMU USB HARDDRIVE | usb 2-1: Manufacturer: QEMU | usb 2-1: SerialNumber: 1-1Quoted 3 lines
Quoted 2 lines
For the linux kernel it shouldn't matter where the usb stick is connected. Assuming it finds both ehci controllers. Does it?
Gerd,
Is there any documentation out there on how to tell QEMU on command line which EHCI you want your usb-storage to attach to?
Quoted 7 lines
The default device tree of linux kernel has only the first ehci controller support, so the kernel can't detect the second controller.
But the usb-storage disk is attached to the second controller, so that the disk is failed to be detected by the linux kernel.Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
For now, qemu doesn't support two EHCI controller, could we remove the second EHCI from
xilinx_zynq?Prefer not. Just need a better kernel and DTB. This was definitely broken for me recently, but I have pulled patches in my kernel, so I think this has been fixed by the Xilinx kernel devels.
OK, no problem.
Regards,
Liming Wang
Quoted 20 lines
Regards,
PeterQuoted 16 lines
Quoted 1 line
Two controllers should work just fine. I'd suggest to find the root
Yes, they work fine separately, but I don't know how to use them at the same time (I mean both controller have device attached) as I have mentioned in the another mail.
Liming Wang
Quoted 7 lines
cause instead of doctoring like this. ehci + usb core are fine with two controllers & busses, maybe the arch plumbing (device tree?) misses something so the linux kernel doesn't find the second ehci controller.
cheers,
Gerd
Hi,
Quoted 4 lines
Gerd,
Is there any documentation out there on how to tell QEMU on command line which EHCI you want your usb-storage to attach to?
docs/usb2.txt has some examples, although those are pc-centric where the ehci is created on the command line. The problem with zynx is that both ehci controllers get the same (default) name so picking one by name doesn't work.
Guess we haver to figure a way to explicitly name those devices (so the busses are named too), especially in case a board has two identical ones. Maybe sysbus_create_simple needs an additional argument or a sysbus_create_simple_with_id variant.
cheers,
Gerd
Hi Gerd, Liming,
Quoted 12 lines · Gerd Hoffmann
Hi,
Quoted 4 lines
Gerd,
Is there any documentation out there on how to tell QEMU on command line which EHCI you want your usb-storage to attach to?
docs/usb2.txthas some examples, although those are pc-centric where the ehci is created on the command line. The problem with zynx is that both ehci controllers get the same (default) name so picking one by name doesn't work.
Quoted 5 lines
Guess we haver to figure a way to explicitly name those devices (so the busses are named too), especially in case a board has two identical ones. Maybe
sysbus_create_simpleneeds an additional argument or asysbus_create_simple_with_idvariant.
Ive taken a more manual approach and just used the manual qdev_create() flow first to get up and running:
hw/xilinx_zynq.c +16 -0
@@ -162,12 +162,28 @@ static void zynq_init(QEMUMachineInitArgs *args) pic[n] =qdev_get_gpio_in (dev, n); } + dev =qdev_create (NULL ,"xlnx.ps7-usb" ); + dev->id ="zynq-usb-0" ; +qdev_init_nofail (dev); + busdev =sysbus_from_qdev (dev); +sysbus_mmio_map (busdev,0 ,0xE0002000 ); +sysbus_connect_irq (busdev,0 , pic[53 -IRQ_OFFSET ]); + + dev =qdev_create (NULL ,"xlnx.ps7-usb" ); + dev->id ="zynq-usb-1" ; + busdev =sysbus_from_qdev (dev); +qdev_init_nofail (dev); +sysbus_mmio_map (busdev,0 ,0xE0003000 ); +sysbus_connect_irq (busdev,0 , pic[76 -IRQ_OFFSET ]); +zynq_init_spi_flashes (0xE0006000 , pic[58 -IRQ_OFFSET ], false);zynq_init_spi_flashes (0xE0007000 , pic[81 -IRQ_OFFSET ], false);zynq_init_spi_flashes (0xE000D000 , pic[51 -IRQ_OFFSET ], true); +#if 0 sysbus_create_simple ("xlnx,ps7-usb" ,0xE0002000 , pic[53 -IRQ_OFFSET ]);sysbus_create_simple ("xlnx,ps7-usb" ,0xE0003000 , pic[76 -IRQ_OFFSET ]); +#endif
This works and gives the two USBs different names, and I can attach to each on command lines using bus=zynq-usb-0.0 and bus=zynq-usb-0.1.
We can probably now think about a more palatable way to do this, perhaps your sysbus_create_simple_id() approach.
Regards,
Peter
Quoted 4 lines
cheers,
Gerd
Quoted 4 lines · Peter Crosthwaite
This was left as NULL on the initial merge due to debate on the mailing list on how to handle DMA contexts for sysbus devices. Patch
9e11908f12f92e31ea94dc2a4c962c836cba9f2awas later merged to fix OHCI. This is the, equivalent fix for sysbus EHCI.
Patch added to usb patch queue.
thanks,
Gerd