* [PATCH 0/2] Move Fuloong2e PCI IRQ mapping to board code
@ 2023-01-05 15:44 Bernhard Beschow
2023-01-05 15:44 ` [PATCH 1/2] hw/pci-host/bonito: Inline pci_register_root_bus() Bernhard Beschow
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Bernhard Beschow @ 2023-01-05 15:44 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Huacai Chen, Jiaxun Yang,
Bernhard Beschow
This is a follow-up on [1] '[PATCH 0/8] hw/pci-host/bonito: Housekeeping' which
resolves a coupling of the Bonito north bridge with the Fuloong2e machine.
Since [2] '[PATCH v2 0/3] Decouple INTx-to-LNKx routing from south bridges' is
already in the mips-next queue this cleanup can now be done.
[1] https://patchew.org/QEMU/20230105130710.49264-1-philmd@linaro.org/
[2] https://patchew.org/QEMU/20221120150550.63059-1-shentey@gmail.com/
Based-on: <20221120150550.63059-1-shentey@gmail.com>
"[PATCH v2 0/3] Decouple INTx-to-LNKx routing from south bridges"
Based-on: <20230105130710.49264-1-philmd@linaro.org>
"[PATCH 0/8] hw/pci-host/bonito: Housekeeping"
Bernhard Beschow (2):
hw/pci-host/bonito: Inline pci_register_root_bus()
hw/pci-host/bonito: Map PCI IRQs in board code
include/hw/pci-host/bonito.h | 2 ++
hw/mips/fuloong2e.c | 22 ++++++++++++++++++++++
hw/pci-host/bonito.c | 31 ++++---------------------------
3 files changed, 28 insertions(+), 27 deletions(-)
--
2.39.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] hw/pci-host/bonito: Inline pci_register_root_bus()
2023-01-05 15:44 [PATCH 0/2] Move Fuloong2e PCI IRQ mapping to board code Bernhard Beschow
@ 2023-01-05 15:44 ` Bernhard Beschow
2023-01-05 15:44 ` [PATCH 2/2] hw/pci-host/bonito: Map PCI IRQs in board code Bernhard Beschow
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Bernhard Beschow @ 2023-01-05 15:44 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Huacai Chen, Jiaxun Yang,
Bernhard Beschow
pci_bonito_map_irq() is board-specific but has to be implemented in the
north bridge because pci_register_root_bus() wants a pci_map_irq_fn.
Inline pci_register_root_bus() so we can move pci_bonito_map_irq() to
board code in the next step.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
hw/pci-host/bonito.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index ca5fa2a155..0ec437a623 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -631,10 +631,11 @@ static void bonito_host_realize(DeviceState *dev, Error **errp)
sysbus_init_irq(SYS_BUS_DEVICE(dev), &bs->irq);
memory_region_init(&bs->pci_mem, OBJECT(dev), "pci.mem", BONITO_PCIHI_SIZE);
- phb->bus = pci_register_root_bus(dev, "pci",
- pci_bonito_set_irq, pci_bonito_map_irq,
- dev, &bs->pci_mem, get_system_io(),
- PCI_DEVFN(5, 0), 32, TYPE_PCI_BUS);
+
+ phb->bus = pci_root_bus_new(dev, "pci", &bs->pci_mem, get_system_io(),
+ PCI_DEVFN(5, 0), TYPE_PCI_BUS);
+ pci_bus_irqs(phb->bus, pci_bonito_set_irq, dev, 32);
+ pci_bus_map_irqs(phb->bus, pci_bonito_map_irq);
for (size_t i = 0; i < 3; i++) {
char *name = g_strdup_printf("pci.lomem%zu", i);
--
2.39.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] hw/pci-host/bonito: Map PCI IRQs in board code
2023-01-05 15:44 [PATCH 0/2] Move Fuloong2e PCI IRQ mapping to board code Bernhard Beschow
2023-01-05 15:44 ` [PATCH 1/2] hw/pci-host/bonito: Inline pci_register_root_bus() Bernhard Beschow
@ 2023-01-05 15:44 ` Bernhard Beschow
2023-01-05 16:32 ` [PATCH 0/2] Move Fuloong2e PCI IRQ mapping to " Philippe Mathieu-Daudé
2023-10-16 9:05 ` Philippe Mathieu-Daudé
3 siblings, 0 replies; 7+ messages in thread
From: Bernhard Beschow @ 2023-01-05 15:44 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Huacai Chen, Jiaxun Yang,
Bernhard Beschow
PCI IRQ mapping is board specific, as could be seen by
pci_bonito_map_irq(). So move it to board code and rename it.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
include/hw/pci-host/bonito.h | 2 ++
hw/mips/fuloong2e.c | 22 ++++++++++++++++++++++
hw/pci-host/bonito.c | 24 ------------------------
3 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/include/hw/pci-host/bonito.h b/include/hw/pci-host/bonito.h
index b8ecf7870a..5ed0b48d51 100644
--- a/include/hw/pci-host/bonito.h
+++ b/include/hw/pci-host/bonito.h
@@ -12,6 +12,8 @@
#include "qom/object.h"
+#define BONITO_IRQ_BASE 32
+
#define TYPE_BONITO_PCI_HOST_BRIDGE "Bonito-pcihost"
OBJECT_DECLARE_SIMPLE_TYPE(BonitoState, BONITO_PCI_HOST_BRIDGE)
diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c
index f41e19dc3f..7ac5940741 100644
--- a/hw/mips/fuloong2e.c
+++ b/hw/mips/fuloong2e.c
@@ -200,6 +200,27 @@ static void main_cpu_reset(void *opaque)
}
}
+/* Map the original irq (0~3) to bonito irq (16~47, but 16~31 are unused) */
+static int pci_fuloong2e_map_irq(PCIDevice *pci_dev, int irq_num)
+{
+ int slot;
+
+ slot = PCI_SLOT(pci_dev->devfn);
+
+ switch (slot) {
+ case 5: /* FULOONG2E_VIA_SLOT, SouthBridge, IDE, USB, ACPI, AC97, MC97 */
+ return irq_num % 4 + BONITO_IRQ_BASE;
+ case 6: /* FULOONG2E_ATI_SLOT, VGA */
+ return 4 + BONITO_IRQ_BASE;
+ case 7: /* FULOONG2E_RTL_SLOT, RTL8139 */
+ return 5 + BONITO_IRQ_BASE;
+ case 8 ... 12: /* PCI slot 1 to 4 */
+ return (slot - 8 + irq_num) + 6 + BONITO_IRQ_BASE;
+ default: /* Unknown device, don't do any translation */
+ return irq_num;
+ }
+}
+
/* Network support */
static void network_init(PCIBus *pci_bus)
{
@@ -297,6 +318,7 @@ static void mips_fuloong2e_init(MachineState *machine)
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, env->irq[2]);
pci_bus = PCI_BUS(qdev_get_child_bus(dev, "pci"));
+ pci_bus_map_irqs(pci_bus, pci_fuloong2e_map_irq);
/* South bridge -> IP5 */
pci_dev = pci_create_simple_multifunction(pci_bus,
diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index 0ec437a623..ad1ca7e454 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -548,8 +548,6 @@ static const MemoryRegionOps bonito_spciconf_ops = {
.endianness = DEVICE_NATIVE_ENDIAN,
};
-#define BONITO_IRQ_BASE 32
-
static void pci_bonito_set_irq(void *opaque, int irq_num, int level)
{
BonitoState *s = opaque;
@@ -567,27 +565,6 @@ static void pci_bonito_set_irq(void *opaque, int irq_num, int level)
}
}
-/* map the original irq (0~3) to bonito irq (16~47, but 16~31 are unused) */
-static int pci_bonito_map_irq(PCIDevice *pci_dev, int irq_num)
-{
- int slot;
-
- slot = PCI_SLOT(pci_dev->devfn);
-
- switch (slot) {
- case 5: /* FULOONG2E_VIA_SLOT, SouthBridge, IDE, USB, ACPI, AC97, MC97 */
- return irq_num % 4 + BONITO_IRQ_BASE;
- case 6: /* FULOONG2E_ATI_SLOT, VGA */
- return 4 + BONITO_IRQ_BASE;
- case 7: /* FULOONG2E_RTL_SLOT, RTL8139 */
- return 5 + BONITO_IRQ_BASE;
- case 8 ... 12: /* PCI slot 1 to 4 */
- return (slot - 8 + irq_num) + 6 + BONITO_IRQ_BASE;
- default: /* Unknown device, don't do any translation */
- return irq_num;
- }
-}
-
static void bonito_reset_hold(Object *obj)
{
PCIBonitoState *s = PCI_BONITO(obj);
@@ -635,7 +612,6 @@ static void bonito_host_realize(DeviceState *dev, Error **errp)
phb->bus = pci_root_bus_new(dev, "pci", &bs->pci_mem, get_system_io(),
PCI_DEVFN(5, 0), TYPE_PCI_BUS);
pci_bus_irqs(phb->bus, pci_bonito_set_irq, dev, 32);
- pci_bus_map_irqs(phb->bus, pci_bonito_map_irq);
for (size_t i = 0; i < 3; i++) {
char *name = g_strdup_printf("pci.lomem%zu", i);
--
2.39.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] Move Fuloong2e PCI IRQ mapping to board code
2023-01-05 15:44 [PATCH 0/2] Move Fuloong2e PCI IRQ mapping to board code Bernhard Beschow
2023-01-05 15:44 ` [PATCH 1/2] hw/pci-host/bonito: Inline pci_register_root_bus() Bernhard Beschow
2023-01-05 15:44 ` [PATCH 2/2] hw/pci-host/bonito: Map PCI IRQs in board code Bernhard Beschow
@ 2023-01-05 16:32 ` Philippe Mathieu-Daudé
2023-10-15 13:02 ` Bernhard Beschow
2023-10-16 9:05 ` Philippe Mathieu-Daudé
3 siblings, 1 reply; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-05 16:32 UTC (permalink / raw)
To: Bernhard Beschow, qemu-devel; +Cc: Huacai Chen, Jiaxun Yang
On 5/1/23 16:44, Bernhard Beschow wrote:
> Bernhard Beschow (2):
> hw/pci-host/bonito: Inline pci_register_root_bus()
> hw/pci-host/bonito: Map PCI IRQs in board code
>
> include/hw/pci-host/bonito.h | 2 ++
> hw/mips/fuloong2e.c | 22 ++++++++++++++++++++++
> hw/pci-host/bonito.c | 31 ++++---------------------------
> 3 files changed, 28 insertions(+), 27 deletions(-)
>
Series:
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] Move Fuloong2e PCI IRQ mapping to board code
2023-01-05 16:32 ` [PATCH 0/2] Move Fuloong2e PCI IRQ mapping to " Philippe Mathieu-Daudé
@ 2023-10-15 13:02 ` Bernhard Beschow
0 siblings, 0 replies; 7+ messages in thread
From: Bernhard Beschow @ 2023-10-15 13:02 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel; +Cc: Huacai Chen, Jiaxun Yang
Am 5. Januar 2023 16:32:16 UTC schrieb "Philippe Mathieu-Daudé" <philmd@linaro.org>:
>On 5/1/23 16:44, Bernhard Beschow wrote:
>
>> Bernhard Beschow (2):
>> hw/pci-host/bonito: Inline pci_register_root_bus()
>> hw/pci-host/bonito: Map PCI IRQs in board code
>>
>> include/hw/pci-host/bonito.h | 2 ++
>> hw/mips/fuloong2e.c | 22 ++++++++++++++++++++++
>> hw/pci-host/bonito.c | 31 ++++---------------------------
>> 3 files changed, 28 insertions(+), 27 deletions(-)
>>
>
>Series:
>Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Ping
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] Move Fuloong2e PCI IRQ mapping to board code
2023-01-05 15:44 [PATCH 0/2] Move Fuloong2e PCI IRQ mapping to board code Bernhard Beschow
` (2 preceding siblings ...)
2023-01-05 16:32 ` [PATCH 0/2] Move Fuloong2e PCI IRQ mapping to " Philippe Mathieu-Daudé
@ 2023-10-16 9:05 ` Philippe Mathieu-Daudé
2025-02-17 20:22 ` Bernhard Beschow
3 siblings, 1 reply; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-10-16 9:05 UTC (permalink / raw)
To: Bernhard Beschow, qemu-devel; +Cc: Huacai Chen, Jiaxun Yang
On 5/1/23 16:44, Bernhard Beschow wrote:
> Bernhard Beschow (2):
> hw/pci-host/bonito: Inline pci_register_root_bus()
> hw/pci-host/bonito: Map PCI IRQs in board code
Thanks, queued to mips-next.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] Move Fuloong2e PCI IRQ mapping to board code
2023-10-16 9:05 ` Philippe Mathieu-Daudé
@ 2025-02-17 20:22 ` Bernhard Beschow
0 siblings, 0 replies; 7+ messages in thread
From: Bernhard Beschow @ 2025-02-17 20:22 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel; +Cc: Huacai Chen, Jiaxun Yang
Am 16. Oktober 2023 09:05:00 UTC schrieb "Philippe Mathieu-Daudé" <philmd@linaro.org>:
>On 5/1/23 16:44, Bernhard Beschow wrote:
>
>> Bernhard Beschow (2):
>> hw/pci-host/bonito: Inline pci_register_root_bus()
>> hw/pci-host/bonito: Map PCI IRQs in board code
>
>Thanks, queued to mips-next.
Ping. I think it's not merged into master yet, is it?
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-02-17 20:23 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-05 15:44 [PATCH 0/2] Move Fuloong2e PCI IRQ mapping to board code Bernhard Beschow
2023-01-05 15:44 ` [PATCH 1/2] hw/pci-host/bonito: Inline pci_register_root_bus() Bernhard Beschow
2023-01-05 15:44 ` [PATCH 2/2] hw/pci-host/bonito: Map PCI IRQs in board code Bernhard Beschow
2023-01-05 16:32 ` [PATCH 0/2] Move Fuloong2e PCI IRQ mapping to " Philippe Mathieu-Daudé
2023-10-15 13:02 ` Bernhard Beschow
2023-10-16 9:05 ` Philippe Mathieu-Daudé
2025-02-17 20:22 ` Bernhard Beschow
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).