[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 45/54] xhci: fix & cleanup msi.
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 45/54] xhci: fix & cleanup msi. |
Date: |
Thu, 6 Sep 2012 09:12:46 +0200 |
Drop custom write_config function which isn't needed any more.
Make the msi property a bit property so it accepts 'on' & 'off'.
Enable MSI by default.
TODO: add compat property to disable on old machine types.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb/hcd-xhci.c | 27 +++++++++------------------
1 files changed, 9 insertions(+), 18 deletions(-)
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index e08312e..e1d5d2a 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -386,7 +386,7 @@ struct XHCIState {
/* properties */
uint32_t numports_2;
uint32_t numports_3;
- uint32_t msi;
+ uint32_t flags;
/* Operational Registers */
uint32_t usbcmd;
@@ -435,6 +435,10 @@ typedef struct XHCIEvRingSeg {
uint32_t rsvd;
} XHCIEvRingSeg;
+enum xhci_flags {
+ XHCI_FLAG_USE_MSI = 1,
+};
+
static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid,
unsigned int epid);
static void xhci_event(XHCIState *xhci, XHCIEvent *event);
@@ -617,7 +621,7 @@ static void xhci_irq_update(XHCIState *xhci)
level = 1;
}
- if (xhci->msi && msi_enabled(&xhci->pci_dev)) {
+ if (msi_enabled(&xhci->pci_dev)) {
if (level) {
trace_usb_xhci_irq_msi(0);
msi_notify(&xhci->pci_dev, 0);
@@ -2859,32 +2863,20 @@ static int usb_xhci_initfn(struct PCIDevice *dev)
ret = pcie_cap_init(&xhci->pci_dev, 0xa0, PCI_EXP_TYPE_ENDPOINT, 0);
assert(ret >= 0);
- if (xhci->msi) {
- ret = msi_init(&xhci->pci_dev, 0x70, 1, true, false);
- assert(ret >= 0);
+ if (xhci->flags & (1 << XHCI_FLAG_USE_MSI)) {
+ msi_init(&xhci->pci_dev, 0x70, MAXINTRS, true, false);
}
return 0;
}
-static void xhci_write_config(PCIDevice *dev, uint32_t addr, uint32_t val,
- int len)
-{
- XHCIState *xhci = DO_UPCAST(XHCIState, pci_dev, dev);
-
- pci_default_write_config(dev, addr, val, len);
- if (xhci->msi) {
- msi_write_config(dev, addr, val, len);
- }
-}
-
static const VMStateDescription vmstate_xhci = {
.name = "xhci",
.unmigratable = 1,
};
static Property xhci_properties[] = {
- DEFINE_PROP_UINT32("msi", XHCIState, msi, 0),
+ DEFINE_PROP_BIT("msi", XHCIState, flags, XHCI_FLAG_USE_MSI, true),
DEFINE_PROP_UINT32("p2", XHCIState, numports_2, 4),
DEFINE_PROP_UINT32("p3", XHCIState, numports_3, 4),
DEFINE_PROP_END_OF_LIST(),
@@ -2904,7 +2896,6 @@ static void xhci_class_init(ObjectClass *klass, void
*data)
k->class_id = PCI_CLASS_SERIAL_USB;
k->revision = 0x03;
k->is_express = 1;
- k->config_write = xhci_write_config;
}
static TypeInfo xhci_info = {
--
1.7.1
- [Qemu-devel] [PATCH 37/54] xhci: add trace_usb_xhci_ep_set_dequeue, (continued)
- [Qemu-devel] [PATCH 37/54] xhci: add trace_usb_xhci_ep_set_dequeue, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 33/54] xhci: move device lookup into xhci_setup_packet, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 09/54] ehci: Properly report completed but not yet processed packets to the guest, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 36/54] xhci: trace cc codes in cleartext, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 38/54] xhci: fix runtime write tracepoint, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 31/54] xhci: rip out background transfer code, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 42/54] usb3: superspeed endpoint companion, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 34/54] xhci: implement mfindex, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 35/54] xhci: iso xfer support, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 47/54] xhci: add msix support, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 45/54] xhci: fix & cleanup msi.,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 48/54] xhci: move register update into xhci_intr_raise, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 46/54] xhci: rework interrupt handling, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 50/54] xhci: prepare xhci_runtime_{read, write} for multiple interrupters, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 49/54] xhci: add XHCIInterrupter, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 54/54] xhci: allow bytewise capability register reads, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 29/54] Better name usb braille device, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 22/54] usb-redir: Move to core packet id and queue handling, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 51/54] xhci: pick target interrupter, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 53/54] xhci: kill xhci_mem_{read, write} dispatcher functions, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 32/54] xhci: drop buffering, Gerd Hoffmann, 2012/09/06