xhci: fix & cleanup msi.
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 <kraxel@redhat.com>
This commit is contained in:
parent
79b40459ba
commit
c5e9b02dee
|
@ -386,7 +386,7 @@ struct XHCIState {
|
||||||
/* properties */
|
/* properties */
|
||||||
uint32_t numports_2;
|
uint32_t numports_2;
|
||||||
uint32_t numports_3;
|
uint32_t numports_3;
|
||||||
uint32_t msi;
|
uint32_t flags;
|
||||||
|
|
||||||
/* Operational Registers */
|
/* Operational Registers */
|
||||||
uint32_t usbcmd;
|
uint32_t usbcmd;
|
||||||
|
@ -435,6 +435,10 @@ typedef struct XHCIEvRingSeg {
|
||||||
uint32_t rsvd;
|
uint32_t rsvd;
|
||||||
} XHCIEvRingSeg;
|
} XHCIEvRingSeg;
|
||||||
|
|
||||||
|
enum xhci_flags {
|
||||||
|
XHCI_FLAG_USE_MSI = 1,
|
||||||
|
};
|
||||||
|
|
||||||
static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid,
|
static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid,
|
||||||
unsigned int epid);
|
unsigned int epid);
|
||||||
static void xhci_event(XHCIState *xhci, XHCIEvent *event);
|
static void xhci_event(XHCIState *xhci, XHCIEvent *event);
|
||||||
|
@ -617,7 +621,7 @@ static void xhci_irq_update(XHCIState *xhci)
|
||||||
level = 1;
|
level = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xhci->msi && msi_enabled(&xhci->pci_dev)) {
|
if (msi_enabled(&xhci->pci_dev)) {
|
||||||
if (level) {
|
if (level) {
|
||||||
trace_usb_xhci_irq_msi(0);
|
trace_usb_xhci_irq_msi(0);
|
||||||
msi_notify(&xhci->pci_dev, 0);
|
msi_notify(&xhci->pci_dev, 0);
|
||||||
|
@ -2857,32 +2861,20 @@ static int usb_xhci_initfn(struct PCIDevice *dev)
|
||||||
ret = pcie_cap_init(&xhci->pci_dev, 0xa0, PCI_EXP_TYPE_ENDPOINT, 0);
|
ret = pcie_cap_init(&xhci->pci_dev, 0xa0, PCI_EXP_TYPE_ENDPOINT, 0);
|
||||||
assert(ret >= 0);
|
assert(ret >= 0);
|
||||||
|
|
||||||
if (xhci->msi) {
|
if (xhci->flags & (1 << XHCI_FLAG_USE_MSI)) {
|
||||||
ret = msi_init(&xhci->pci_dev, 0x70, 1, true, false);
|
msi_init(&xhci->pci_dev, 0x70, MAXINTRS, true, false);
|
||||||
assert(ret >= 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
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 = {
|
static const VMStateDescription vmstate_xhci = {
|
||||||
.name = "xhci",
|
.name = "xhci",
|
||||||
.unmigratable = 1,
|
.unmigratable = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
static Property xhci_properties[] = {
|
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("p2", XHCIState, numports_2, 4),
|
||||||
DEFINE_PROP_UINT32("p3", XHCIState, numports_3, 4),
|
DEFINE_PROP_UINT32("p3", XHCIState, numports_3, 4),
|
||||||
DEFINE_PROP_END_OF_LIST(),
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
|
@ -2902,7 +2894,6 @@ static void xhci_class_init(ObjectClass *klass, void *data)
|
||||||
k->class_id = PCI_CLASS_SERIAL_USB;
|
k->class_id = PCI_CLASS_SERIAL_USB;
|
||||||
k->revision = 0x03;
|
k->revision = 0x03;
|
||||||
k->is_express = 1;
|
k->is_express = 1;
|
||||||
k->config_write = xhci_write_config;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static TypeInfo xhci_info = {
|
static TypeInfo xhci_info = {
|
||||||
|
|
Loading…
Reference in a new issue