Skip to contentSkip to conversation

USB EHCI patch for 0.14.0?

DISCUSSION Erik Rull 3 participants 4 messages Mar 8, 2011 – Jun 6, 2011

Subsystems (2)
lore
Share & tools
lore

Erik Rull

author
#0 lore raw

Hi all,

I've found a usb ehci patch here in the mailing list (begin of january) but it does not fit for 0.14.0.

Is there an updated patch for the latest qemu-kvm version?

Thanks a lot.

Best regards,

Erik

#1 lore raw
Quoted 4 lines · Erik Rull

Hi all,

I've found a usb ehci patch here in the mailing list (begin of january) but it does not fit for 0.14.0.

That was from me and prior work on ehci.

Quoted 2 lines

Is there an updated patch for the latest qemu-kvm version?

Try the attached,

David

Quoted 11 lines

Thanks a lot.

Best regards,

Erik

Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Makefile.objs +1 -1
index 3ec7121..24ca955 100644
@@ -192,7 +192,7 @@ hw-obj-$(CONFIG_PARALLEL) += parallel.o
 #hw-obj-$(CONFIG_PCSPK) += pcspk.o
 hw-obj-$(CONFIG_PCKBD) += pckbd.o
 hw-obj-$(CONFIG_USB_UHCI) += usb-uhci.o
-hw-obj-$(CONFIG_USB_OHCI) += usb-ohci.o
+hw-obj-$(CONFIG_USB_EHCI) += usb-ehci.o
 hw-obj-$(CONFIG_FDC) += fdc.o
 # needs fixes for cpu hotplug, so moved to Makefile.target:
 # hw-obj-$(CONFIG_ACPI) += acpi.o acpi_piix4.o
Makefile.target +1 -1
index 23367eb..27ac32a 100644
@@ -242,7 +242,7 @@ obj-i386-$(CONFIG_KVM_DEVICE_ASSIGNMENT) += device-assignment.o
 obj-ia64-y += ide.o pckbd.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
 obj-ia64-y += fdc.o mc146818rtc.o serial.o i8259.o ipf.o
 obj-ia64-y += cirrus_vga.o parallel.o acpi.o piix_pci.o
-obj-ia64-y += usb-uhci.o
+obj-ia64-y += usb-uhci.o usb-ehci.o
 obj-ia64-$(CONFIG_KVM_DEVICE_ASSIGNMENT) += device-assignment.o
 
 # shared objects
default-configs/i386-softmmu.mak +2 -0
index 3e0eddf..02f0389 100644
@@ -10,6 +10,8 @@ CONFIG_PARALLEL=y
 CONFIG_I8254=y
 CONFIG_PCSPK=y
 CONFIG_PCKBD=y
+CONFIG_USB_UHCI=y
+CONFIG_USB_EHCI=y
 CONFIG_FDC=y
 CONFIG_ACPI=y
 CONFIG_APM=y
default-configs/pci.mak +1 -0
index 0471efb..22bd350 100644
@@ -3,6 +3,7 @@ CONFIG_VIRTIO_PCI=y
 CONFIG_VIRTIO=y
 CONFIG_USB_UHCI=y
 CONFIG_USB_OHCI=y
+CONFIG_USB_EHCI=y
 CONFIG_NE2000_PCI=y
 CONFIG_EEPRO100_PCI=y
 CONFIG_PCNET_PCI=y
hw/pc_piix.c +5 -1
index babfe21..2af9a0e 100644
@@ -28,6 +28,7 @@
 #include "pci.h"
 #include "usb-uhci.h"
 #include "usb-ohci.h"
+#include "usb-ehci.h"
 #include "net.h"
 #include "boards.h"
 #include "ide.h"
@@ -178,8 +179,11 @@ static void pc_init1(ram_addr_t ram_size,
     pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device,
                  idebus[0], idebus[1], floppy_controller, rtc_state);
 
+    //  TODO the piix3 does not have EHCI - looks like ICH4
+    //  was first southbridge to support it.
     if (pci_enabled && usb_enabled) {
         usb_uhci_piix3_init(pci_bus, piix3_devfn + 2);
+        usb_ehci_init(pci_bus, piix3_devfn + 3);
     }
 
     if (pci_enabled && acpi_enabled) {
@@ -189,7 +193,7 @@ static void pc_init1(ram_addr_t ram_size,
         cmos_s3 = qemu_allocate_irqs(pc_cmos_set_s3_resume, rtc_state, 1);
         smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1);
         /* TODO: Populate SPD eeprom data.  */
-        smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
+        smbus = piix4_pm_init(pci_bus, piix3_devfn + 4, 0xb100,
                               isa_reserve_irq(9), *cmos_s3, *smi_irq,
                               kvm_enabled());
         for (i = 0; i < 8; i++) {
hw/pci_ids.h +1 -0
index ea3418c..d9457ed 100644
@@ -100,6 +100,7 @@
 #define PCI_VENDOR_ID_INTEL              0x8086
 #define PCI_DEVICE_ID_INTEL_82441        0x1237
 #define PCI_DEVICE_ID_INTEL_82801AA_5    0x2415
+#define PCI_DEVICE_ID_INTEL_82801D       0x24CD
 #define PCI_DEVICE_ID_INTEL_ESB_9        0x25ab
 #define PCI_DEVICE_ID_INTEL_82371SB_0    0x7000
 #define PCI_DEVICE_ID_INTEL_82371SB_1    0x7010
hw/usb-bus.c +94 -19

174 lines not on this page · raw message

hw/usb-ehci.c new file +2086 -0

2,086 lines not on this page · raw message

hw/usb-ehci.h new file +8 -0
new file mode 100644
index 0000000..ba087a0
@@ -0,0 +1,8 @@
+#ifndef QEMU_USB_EHCI_H
+#define QEMU_USB_EHCI_H
+
+#include "qemu-common.h"
+
+void usb_ehci_init(PCIBus *bus, int devfn);
+
+#endif
hw/usb-msd.c +1 -1
index 76f5b02..48508ef 100644
@@ -579,7 +579,7 @@ static USBDevice *usb_msd_init(const char *filename)
     }
 
     /* create guest device */
-    dev = usb_create(NULL /* FIXME */, "usb-storage");
+    dev = usb_create_v2("usb-storage");
     if (!dev) {
         return NULL;
     }
hw/usb-net.c +1 -1
index bf51bb3..8e67edd 100644
@@ -1405,7 +1405,7 @@ static USBDevice *usb_net_init(const char *cmdline)
         return NULL;
     }
 
-    dev = usb_create(NULL /* FIXME */, "usb-net");
+    dev = usb_create_v1("usb-net");
     if (!dev) {
         return NULL;
     }
hw/usb-ohci.c +1 -1
index 09ea0b6..b5c9f86 100644
@@ -1696,7 +1696,7 @@ static void usb_ohci_init(OHCIState *ohci, DeviceState *dev,
 
     ohci->name = dev->info->name;
 
-    usb_bus_new(&ohci->bus, dev);
+    usb_bus_new_v1(&ohci->bus, dev);
     ohci->num_ports = num_ports;
     for (i = 0; i < num_ports; i++) {
         usb_register_port(&ohci->bus, &ohci->rhport[i].port, ohci, i, &ohci_port_ops,
hw/usb-serial.c +2 -2
index 6763d52..a476ccf 100644
@@ -535,7 +535,7 @@ static USBDevice *usb_serial_init(const char *filename)
     if (!cdrv)
         return NULL;
 
-    dev = usb_create(NULL /* FIXME */, "usb-serial");
+    dev = usb_create_v1("usb-serial");
     if (!dev) {
         return NULL;
     }
@@ -558,7 +558,7 @@ static USBDevice *usb_braille_init(const char *unused)
     if (!cdrv)
         return NULL;
 
-    dev = usb_create(NULL /* FIXME */, "usb-braille");
+    dev = usb_create_v1("usb-braille");
     qdev_prop_set_chr(&dev->qdev, "chardev", cdrv);
     qdev_init_nofail(&dev->qdev);
 
hw/usb-uhci.c +1 -1
index b384e1d..c2d4f7a 100644
@@ -1127,7 +1127,7 @@ static int usb_uhci_common_initfn(UHCIState *s)
     pci_conf[PCI_INTERRUPT_PIN] = 4; // interrupt pin 3
     pci_conf[0x60] = 0x10; // release number
 
-    usb_bus_new(&s->bus, &s->dev.qdev);
+    usb_bus_new_v1(&s->bus, &s->dev.qdev);
     for(i = 0; i < NB_PORTS; i++) {
         usb_register_port(&s->bus, &s->ports[i].port, s, i, &uhci_port_ops,
                           USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
hw/usb.h +7 -3
index d3d755d..282e700 100644
@@ -341,18 +341,22 @@ struct USBBus {
     int busnr;
     int nfree;
     int nused;
+    int version;
     QTAILQ_HEAD(, USBPort) free;
     QTAILQ_HEAD(, USBPort) used;
     QTAILQ_ENTRY(USBBus) next;
 };
 
-void usb_bus_new(USBBus *bus, DeviceState *host);
-USBBus *usb_bus_find(int busnr);
+void usb_bus_new_v1(USBBus *bus, DeviceState *host);
+void usb_bus_new_v2(USBBus *bus, DeviceState *host);
+USBBus *usb_bus_find_version(int version);
 void usb_qdev_register(USBDeviceInfo *info);
 void usb_qdev_register_many(USBDeviceInfo *info);
-USBDevice *usb_create(USBBus *bus, const char *name);
+USBDevice *usb_create_v1(const char *name);
+USBDevice *usb_create_v2(const char *name);
 USBDevice *usb_create_simple(USBBus *bus, const char *name);
 USBDevice *usbdevice_create(const char *cmdline);
+int usb_bus_migrate_v1(USBDevice *dev);
 void usb_register_port(USBBus *bus, USBPort *port, void *opaque, int index,
                        USBPortOps *ops, int speedmask);
 void usb_port_location(USBPort *downstream, USBPort *upstream, int portnr);
monitor.c +1 -0
index fdbf9f3..c1f4d17 100644
@@ -25,6 +25,7 @@
 #include "hw/hw.h"
 #include "hw/qdev.h"
 #include "hw/usb.h"
+#include "hw/usb-ehci.h"
 #include "hw/pcmcia.h"
 #include "hw/pc.h"
 #include "hw/pci.h"
usb-bsd.c +1 -1
index abcb60c..7038024 100644
@@ -362,7 +362,7 @@ USBDevice *usb_host_device_open(const char *devname)
         goto fail_dfd;
     }
 
-    d = usb_create(NULL /* FIXME */, "usb-host");
+    d = usb_create_v1("usb-host");
     dev = DO_UPCAST(USBHostDevice, dev, d);
 
     if (dev_info.udi_speed == 1) {
usb-linux.c +81 -54

208 lines not on this page · raw message

#2 lore raw

Hi David,

Quoted 8 lines · David Ahern
Quoted 4 lines · Erik Rull

Hi all,

I've found a usb ehci patch here in the mailing list (begin of january) but it does not fit for 0.14.0.

Quoted 6 lines

That was from me and prior work on ehci.

Quoted 2 lines

Is there an updated patch for the latest qemu-kvm version?

Try the attached,

I also wanted to give EHCI support a try. Unfortunately your patch does not apply to current qemu-kvm git clone. Changes in hw/pc_piix.c and usb-linux.c make the patch fail. I was able to fix most rejects by hand, but the last reject in usb-linux.c is beyond my knowledge. I'd really appreciate if you could find the time to post a patch that applies to the current git clone.

Thank you very much in advance.
André

#3 lore raw
Quoted 9 lines · André Weidemann

I also wanted to give EHCI support a try. Unfortunately your patch does not apply to current qemu-kvm git clone. Changes in hw/pc_piix.c and usb-linux.c make the patch fail. I was able to fix most rejects by hand, but the last reject in usb-linux.c is beyond my knowledge. I'd really appreciate if you could find the time to post a patch that applies to the current git clone.

Thank you very much in advance.
André

Looks like the merge of qemu.git into qemu-kvm.git on June 2nd picked up ehci from qemu. It was committed last week or so. You should not need an external patch now.

David