* [PATCH v4 1/3] usb/uhci: Misc clean up
2021-10-14 17:32 [PATCH v4 0/3] hw/usb/vt82c686-uhci-pci: Use ISA instead of PCI interrupts BALATON Zoltan
2021-10-14 17:32 ` [PATCH v4 3/3] " BALATON Zoltan
2021-10-14 17:32 ` [PATCH v4 2/3] usb/uhci: Replace pci_set_irq with qemu_set_irq BALATON Zoltan
@ 2021-10-14 17:32 ` BALATON Zoltan
2021-10-14 17:43 ` Philippe Mathieu-Daudé
2021-10-18 12:15 ` [PATCH v4 0/3] hw/usb/vt82c686-uhci-pci: Use ISA instead of PCI interrupts Gerd Hoffmann
3 siblings, 1 reply; 6+ messages in thread
From: BALATON Zoltan @ 2021-10-14 17:32 UTC (permalink / raw)
To: qemu-devel; +Cc: Huacai Chen, Gerd Hoffmann, Philippe M-D
Fix a comment for coding style so subsequent patch will not get
checkpatch error and simplify and shorten uhci_update_irq().
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
hw/usb/hcd-uhci.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index 0cb02a6432..c557566ec2 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -290,7 +290,7 @@ static UHCIAsync *uhci_async_find_td(UHCIState *s, uint32_t td_addr)
static void uhci_update_irq(UHCIState *s)
{
- int level;
+ int level = 0;
if (((s->status2 & 1) && (s->intr & (1 << 2))) ||
((s->status2 & 2) && (s->intr & (1 << 3))) ||
((s->status & UHCI_STS_USBERR) && (s->intr & (1 << 0))) ||
@@ -298,8 +298,6 @@ static void uhci_update_irq(UHCIState *s)
(s->status & UHCI_STS_HSERR) ||
(s->status & UHCI_STS_HCPERR)) {
level = 1;
- } else {
- level = 0;
}
pci_set_irq(&s->dev, level);
}
@@ -1170,8 +1168,7 @@ void usb_uhci_common_realize(PCIDevice *dev, Error **errp)
pci_conf[PCI_CLASS_PROG] = 0x00;
/* TODO: reset value should be 0. */
- pci_conf[USB_SBRN] = USB_RELEASE_1; // release number
-
+ pci_conf[USB_SBRN] = USB_RELEASE_1; /* release number */
pci_config_set_interrupt_pin(pci_conf, u->info.irq_pin + 1);
if (s->masterbus) {
--
2.21.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v4 0/3] hw/usb/vt82c686-uhci-pci: Use ISA instead of PCI interrupts
@ 2021-10-14 17:32 BALATON Zoltan
2021-10-14 17:32 ` [PATCH v4 3/3] " BALATON Zoltan
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: BALATON Zoltan @ 2021-10-14 17:32 UTC (permalink / raw)
To: qemu-devel; +Cc: Huacai Chen, Gerd Hoffmann, Philippe M-D
v4 splits up the single patch into a series
BALATON Zoltan (3):
usb/uhci: Misc clean up
usb/uhci: Replace pci_set_irq with qemu_set_irq
hw/usb/vt82c686-uhci-pci: Use ISA instead of PCI interrupts
hw/usb/hcd-uhci.c | 11 +++++------
hw/usb/hcd-uhci.h | 2 +-
hw/usb/vt82c686-uhci-pci.c | 12 ++++++++++++
3 files changed, 18 insertions(+), 7 deletions(-)
--
2.21.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v4 2/3] usb/uhci: Replace pci_set_irq with qemu_set_irq
2021-10-14 17:32 [PATCH v4 0/3] hw/usb/vt82c686-uhci-pci: Use ISA instead of PCI interrupts BALATON Zoltan
2021-10-14 17:32 ` [PATCH v4 3/3] " BALATON Zoltan
@ 2021-10-14 17:32 ` BALATON Zoltan
2021-10-14 17:32 ` [PATCH v4 1/3] usb/uhci: Misc clean up BALATON Zoltan
2021-10-18 12:15 ` [PATCH v4 0/3] hw/usb/vt82c686-uhci-pci: Use ISA instead of PCI interrupts Gerd Hoffmann
3 siblings, 0 replies; 6+ messages in thread
From: BALATON Zoltan @ 2021-10-14 17:32 UTC (permalink / raw)
To: qemu-devel; +Cc: Huacai Chen, Gerd Hoffmann, Philippe M-D
Instead of using pci_set_irq, store the irq in the device state and
use it explicitly so variants having different interrupt handling can
use their own.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
hw/usb/hcd-uhci.c | 4 +++-
hw/usb/hcd-uhci.h | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index c557566ec2..7201cd0ae7 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -31,6 +31,7 @@
#include "hw/usb/uhci-regs.h"
#include "migration/vmstate.h"
#include "hw/pci/pci.h"
+#include "hw/irq.h"
#include "hw/qdev-properties.h"
#include "qapi/error.h"
#include "qemu/timer.h"
@@ -299,7 +300,7 @@ static void uhci_update_irq(UHCIState *s)
(s->status & UHCI_STS_HCPERR)) {
level = 1;
}
- pci_set_irq(&s->dev, level);
+ qemu_set_irq(s->irq, level);
}
static void uhci_reset(DeviceState *dev)
@@ -1170,6 +1171,7 @@ void usb_uhci_common_realize(PCIDevice *dev, Error **errp)
/* TODO: reset value should be 0. */
pci_conf[USB_SBRN] = USB_RELEASE_1; /* release number */
pci_config_set_interrupt_pin(pci_conf, u->info.irq_pin + 1);
+ s->irq = pci_allocate_irq(dev);
if (s->masterbus) {
USBPort *ports[NB_PORTS];
diff --git a/hw/usb/hcd-uhci.h b/hw/usb/hcd-uhci.h
index e61d8fcb19..1f8ee04186 100644
--- a/hw/usb/hcd-uhci.h
+++ b/hw/usb/hcd-uhci.h
@@ -60,7 +60,7 @@ typedef struct UHCIState {
uint32_t frame_bandwidth;
bool completions_only;
UHCIPort ports[NB_PORTS];
-
+ qemu_irq irq;
/* Interrupts that should be raised at the end of the current frame. */
uint32_t pending_int_mask;
--
2.21.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v4 3/3] hw/usb/vt82c686-uhci-pci: Use ISA instead of PCI interrupts
2021-10-14 17:32 [PATCH v4 0/3] hw/usb/vt82c686-uhci-pci: Use ISA instead of PCI interrupts BALATON Zoltan
@ 2021-10-14 17:32 ` BALATON Zoltan
2021-10-14 17:32 ` [PATCH v4 2/3] usb/uhci: Replace pci_set_irq with qemu_set_irq BALATON Zoltan
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: BALATON Zoltan @ 2021-10-14 17:32 UTC (permalink / raw)
To: qemu-devel; +Cc: Huacai Chen, Gerd Hoffmann, Philippe M-D
This device is part of a superio/ISA bridge chip and IRQs from it are
routed to an ISA interrupt set by the Interrupt Line PCI config
register. Implement this in a vt82c686-uhci-pci specific irq handler.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
hw/usb/vt82c686-uhci-pci.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/hw/usb/vt82c686-uhci-pci.c b/hw/usb/vt82c686-uhci-pci.c
index b109c21603..e70e739409 100644
--- a/hw/usb/vt82c686-uhci-pci.c
+++ b/hw/usb/vt82c686-uhci-pci.c
@@ -1,6 +1,16 @@
#include "qemu/osdep.h"
+#include "hw/irq.h"
#include "hcd-uhci.h"
+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) {
+ qemu_set_irq(isa_get_irq(NULL, irq), level);
+ }
+}
+
static void usb_uhci_vt82c686b_realize(PCIDevice *dev, Error **errp)
{
UHCIState *s = UHCI(dev);
@@ -14,6 +24,8 @@ static void usb_uhci_vt82c686b_realize(PCIDevice *dev, Error **errp)
pci_set_long(pci_conf + 0xc0, 0x00002000);
usb_uhci_common_realize(dev, errp);
+ object_unref(s->irq);
+ s->irq = qemu_allocate_irq(uhci_isa_set_irq, s, 0);
}
static UHCIInfo uhci_info[] = {
--
2.21.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v4 1/3] usb/uhci: Misc clean up
2021-10-14 17:32 ` [PATCH v4 1/3] usb/uhci: Misc clean up BALATON Zoltan
@ 2021-10-14 17:43 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-10-14 17:43 UTC (permalink / raw)
To: BALATON Zoltan, qemu-devel; +Cc: Huacai Chen, Gerd Hoffmann
On 10/14/21 19:32, BALATON Zoltan wrote:
> Fix a comment for coding style so subsequent patch will not get
> checkpatch error and simplify and shorten uhci_update_irq().
>
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
> hw/usb/hcd-uhci.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v4 0/3] hw/usb/vt82c686-uhci-pci: Use ISA instead of PCI interrupts
2021-10-14 17:32 [PATCH v4 0/3] hw/usb/vt82c686-uhci-pci: Use ISA instead of PCI interrupts BALATON Zoltan
` (2 preceding siblings ...)
2021-10-14 17:32 ` [PATCH v4 1/3] usb/uhci: Misc clean up BALATON Zoltan
@ 2021-10-18 12:15 ` Gerd Hoffmann
3 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2021-10-18 12:15 UTC (permalink / raw)
To: BALATON Zoltan; +Cc: Huacai Chen, qemu-devel, Philippe M-D
On Thu, Oct 14, 2021 at 07:32:26PM +0200, BALATON Zoltan wrote:
> v4 splits up the single patch into a series
>
> BALATON Zoltan (3):
> usb/uhci: Misc clean up
> usb/uhci: Replace pci_set_irq with qemu_set_irq
> hw/usb/vt82c686-uhci-pci: Use ISA instead of PCI interrupts
>
> hw/usb/hcd-uhci.c | 11 +++++------
> hw/usb/hcd-uhci.h | 2 +-
> hw/usb/vt82c686-uhci-pci.c | 12 ++++++++++++
> 3 files changed, 18 insertions(+), 7 deletions(-)
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-10-18 12:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-14 17:32 [PATCH v4 0/3] hw/usb/vt82c686-uhci-pci: Use ISA instead of PCI interrupts BALATON Zoltan
2021-10-14 17:32 ` [PATCH v4 3/3] " BALATON Zoltan
2021-10-14 17:32 ` [PATCH v4 2/3] usb/uhci: Replace pci_set_irq with qemu_set_irq BALATON Zoltan
2021-10-14 17:32 ` [PATCH v4 1/3] usb/uhci: Misc clean up BALATON Zoltan
2021-10-14 17:43 ` Philippe Mathieu-Daudé
2021-10-18 12:15 ` [PATCH v4 0/3] hw/usb/vt82c686-uhci-pci: Use ISA instead of PCI interrupts Gerd Hoffmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).