[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 6/6] hw/usb/vt82c686-uhci-pci: Optimise itq handler
From: |
BALATON Zoltan |
Subject: |
[PATCH 6/6] hw/usb/vt82c686-uhci-pci: Optimise itq handler |
Date: |
Mon, 18 Oct 2021 15:27:32 +0200 |
Cache the pointer to PCI function 0 (ISA bridge, that this device has
to use for IRQs) in the state struct and use that in the interrupt
handler to avoid needing to look up function 0 at every interrupt
which can be expensive.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
hw/usb/hcd-uhci.h | 1 +
hw/usb/vt82c686-uhci-pci.c | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/usb/hcd-uhci.h b/hw/usb/hcd-uhci.h
index c85ab7868e..ac4e912a3f 100644
--- a/hw/usb/hcd-uhci.h
+++ b/hw/usb/hcd-uhci.h
@@ -44,6 +44,7 @@ typedef struct UHCIPort {
typedef struct UHCIState {
PCIDevice dev;
+ PCIDevice *func0; /* used when part of a superio chip */
MemoryRegion io_bar;
USBBus bus; /* Note unused when we're a companion controller */
uint16_t cmd; /* cmd register */
diff --git a/hw/usb/vt82c686-uhci-pci.c b/hw/usb/vt82c686-uhci-pci.c
index 0bf2b72ff0..c500936af9 100644
--- a/hw/usb/vt82c686-uhci-pci.c
+++ b/hw/usb/vt82c686-uhci-pci.c
@@ -8,7 +8,7 @@ static void uhci_isa_set_irq(void *opaque, int irq_num, int
level)
UHCIState *s = opaque;
uint8_t irq = pci_get_byte(s->dev.config + PCI_INTERRUPT_LINE);
if (irq > 0 && irq < 15) {
- via_isa_set_irq(pci_get_function_0(&s->dev), irq, level);
+ via_isa_set_irq(s->func0, irq, level);
}
}
@@ -25,6 +25,7 @@ static void usb_uhci_vt82c686b_realize(PCIDevice *dev, Error
**errp)
pci_set_long(pci_conf + 0xc0, 0x00002000);
usb_uhci_common_realize(dev, errp);
+ s->func0 = pci_get_function_0(&s->dev);
object_unref(s->irq);
s->irq = qemu_allocate_irq(uhci_isa_set_irq, s, 0);
}
--
2.21.4
- [PATCH 0/6] hw/usb/vt82c686-uhci-pci: Use ISA instead of PCI interrupts, BALATON Zoltan, 2021/10/18
- [PATCH 1/6] via-ide: Avoid expensive operations in irq handler, BALATON Zoltan, 2021/10/18
- [PATCH 3/6] usb/uhci: Disallow user creating a vt82c686-uhci-pci device, BALATON Zoltan, 2021/10/18
- [PATCH 4/6] usb/uhci: Replace pci_set_irq with qemu_set_irq, BALATON Zoltan, 2021/10/18
- [PATCH 6/6] hw/usb/vt82c686-uhci-pci: Optimise itq handler,
BALATON Zoltan <=
- [PATCH 2/6] usb/uhci: Misc clean up, BALATON Zoltan, 2021/10/18
- [PATCH 5/6] hw/usb/vt82c686-uhci-pci: Use ISA instead of PCI interrupts, BALATON Zoltan, 2021/10/18