From: Artyom Tarasenko <atar4qemu@gmail.com>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 04/15] sun4u: remove pci_ebus_init() function
Date: Fri, 17 Nov 2017 15:38:36 +0100 [thread overview]
Message-ID: <CACXAS8AuunBiKzZwr-+hUfKeCnG0ea2h47XN6y3dQSgW2AtCdg@mail.gmail.com> (raw)
In-Reply-To: <1510926167-23326-5-git-send-email-mark.cave-ayland@ilande.co.uk>
On Fri, Nov 17, 2017 at 2:42 PM, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
> This is initialisation that should really take place in the ebus realize
> function. As part of this we also rework the ebus IRQ mapping so that
> instead of having to pass in the array of pbm_irqs, we obtain a reference
> to them by looking up the APB device during ebus realize.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Artyom Tarasenko <atar4qemu@gmail.com>
> ---
> hw/pci-host/apb.c | 4 +---
> hw/sparc64/sun4u.c | 29 ++++++++++++++---------------
> include/hw/pci-host/apb.h | 3 +--
> 3 files changed, 16 insertions(+), 20 deletions(-)
>
> diff --git a/hw/pci-host/apb.c b/hw/pci-host/apb.c
> index f743a4e..b0f80f6 100644
> --- a/hw/pci-host/apb.c
> +++ b/hw/pci-host/apb.c
> @@ -614,8 +614,7 @@ static void apb_pci_bridge_realize(PCIDevice *dev, Error **errp)
>
> PCIBus *pci_apb_init(hwaddr special_base,
> hwaddr mem_base,
> - qemu_irq *ivec_irqs, PCIBus **busA, PCIBus **busB,
> - qemu_irq **pbm_irqs)
> + qemu_irq *ivec_irqs, PCIBus **busA, PCIBus **busB)
> {
> DeviceState *dev;
> SysBusDevice *s;
> @@ -646,7 +645,6 @@ PCIBus *pci_apb_init(hwaddr special_base,
> memory_region_init(&d->pci_mmio, OBJECT(s), "pci-mmio", 0x100000000ULL);
> memory_region_add_subregion(get_system_memory(), mem_base, &d->pci_mmio);
>
> - *pbm_irqs = d->pbm_irqs;
> d->ivec_irqs = ivec_irqs;
>
> pci_create_simple(phb->bus, 0, "pbm-pci");
> diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
> index 63b4aaa..f3203ea 100644
> --- a/hw/sparc64/sun4u.c
> +++ b/hw/sparc64/sun4u.c
> @@ -230,21 +230,11 @@ static void isa_irq_handler(void *opaque, int n, int level)
> }
>
> /* EBUS (Eight bit bus) bridge */
> -static ISABus *
> -pci_ebus_init(PCIDevice *pci_dev, qemu_irq *irqs)
> -{
> - qemu_irq *isa_irq;
> - ISABus *isa_bus;
> -
> - isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(pci_dev), "isa.0"));
> - isa_irq = qemu_allocate_irqs(isa_irq_handler, irqs, 16);
> - isa_bus_irqs(isa_bus, isa_irq);
> - return isa_bus;
> -}
> -
> static void ebus_realize(PCIDevice *pci_dev, Error **errp)
> {
> EbusState *s = EBUS(pci_dev);
> + APBState *apb;
> + qemu_irq *isa_irq;
>
> s->isa_bus = isa_bus_new(DEVICE(pci_dev), get_system_memory(),
> pci_address_space_io(pci_dev), errp);
> @@ -253,6 +243,15 @@ static void ebus_realize(PCIDevice *pci_dev, Error **errp)
> return;
> }
>
> + apb = APB_DEVICE(object_resolve_path_type("", TYPE_APB, NULL));
> + if (!apb) {
> + error_setg(errp, "unable to locate APB PCI host bridge");
> + return;
> + }
> +
> + isa_irq = qemu_allocate_irqs(isa_irq_handler, apb->pbm_irqs, 16);
> + isa_bus_irqs(s->isa_bus, isa_irq);
> +
> pci_dev->config[0x04] = 0x06; // command = bus master, pci mem
> pci_dev->config[0x05] = 0x00;
> pci_dev->config[0x06] = 0xa0; // status = fast back-to-back, 66MHz, no error
> @@ -443,7 +442,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
> PCIDevice *ebus, *pci_dev;
> ISABus *isa_bus;
> SysBusDevice *s;
> - qemu_irq *ivec_irqs, *pbm_irqs;
> + qemu_irq *ivec_irqs;
> DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
> DriveInfo *fd[MAX_FD];
> DeviceState *dev;
> @@ -462,7 +461,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
>
> ivec_irqs = qemu_allocate_irqs(sparc64_cpu_set_ivec_irq, cpu, IVEC_MAX);
> pci_bus = pci_apb_init(APB_SPECIAL_BASE, APB_MEM_BASE, ivec_irqs, &pci_busA,
> - &pci_busB, &pbm_irqs);
> + &pci_busB);
>
> /* Only in-built Simba PBMs can exist on the root bus, slot 0 on busA is
> reserved (leaving no slots free after on-board devices) however slots
> @@ -474,7 +473,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
> ebus = pci_create_multifunction(pci_busA, PCI_DEVFN(1, 0), true, TYPE_EBUS);
> qdev_init_nofail(DEVICE(ebus));
>
> - isa_bus = pci_ebus_init(ebus, pbm_irqs);
> + isa_bus = EBUS(ebus)->isa_bus;
>
> i = 0;
> if (hwdef->console_serial_base) {
> diff --git a/include/hw/pci-host/apb.h b/include/hw/pci-host/apb.h
> index 5d39c03..35d7d5a 100644
> --- a/include/hw/pci-host/apb.h
> +++ b/include/hw/pci-host/apb.h
> @@ -91,6 +91,5 @@ typedef struct PBMPCIBridge {
>
> PCIBus *pci_apb_init(hwaddr special_base,
> hwaddr mem_base,
> - qemu_irq *ivec_irqs, PCIBus **bus2, PCIBus **bus3,
> - qemu_irq **pbm_irqs);
> + qemu_irq *ivec_irqs, PCIBus **bus2, PCIBus **bus3);
> #endif
> --
> 1.7.10.4
>
--
Regards,
Artyom Tarasenko
SPARC and PPC PReP under qemu blog: http://tyom.blogspot.com/search/label/qemu
next prev parent reply other threads:[~2017-11-17 14:39 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-17 13:42 [Qemu-devel] [PATCH 00/15] sun4u: tidy-up CPU, APB and ebus Mark Cave-Ayland
2017-11-17 13:42 ` [Qemu-devel] [PATCH 01/15] apb: move QOM macros and typedefs from apb.c to apb.h Mark Cave-Ayland
2017-11-17 14:24 ` Artyom Tarasenko
2017-11-17 15:40 ` Mark Cave-Ayland
2017-11-17 19:55 ` Artyom Tarasenko
2017-11-20 0:52 ` Philippe Mathieu-Daudé
2017-11-17 13:42 ` [Qemu-devel] [PATCH 02/15] sun4u: ebus QOMify tidy-up Mark Cave-Ayland
2017-11-17 18:02 ` Philippe Mathieu-Daudé
2017-11-17 13:42 ` [Qemu-devel] [PATCH 03/15] sun4u: move ISABus inside of EBusState Mark Cave-Ayland
2017-11-17 14:53 ` Artyom Tarasenko
2017-11-17 15:46 ` Mark Cave-Ayland
2017-11-17 19:58 ` Artyom Tarasenko
2017-11-19 14:53 ` Philippe Mathieu-Daudé
2017-11-17 13:42 ` [Qemu-devel] [PATCH 04/15] sun4u: remove pci_ebus_init() function Mark Cave-Ayland
2017-11-17 14:38 ` Artyom Tarasenko [this message]
2017-11-20 0:37 ` Philippe Mathieu-Daudé
2017-11-17 13:42 ` [Qemu-devel] [PATCH 05/15] sun4u: move initialisation of all ISABus devices into ebus_realize() Mark Cave-Ayland
2017-11-20 0:47 ` Philippe Mathieu-Daudé
2017-11-20 22:45 ` Mark Cave-Ayland
2017-11-17 13:42 ` [Qemu-devel] [PATCH 06/15] apb: APB QOMify tidy-up Mark Cave-Ayland
2017-11-20 0:48 ` Philippe Mathieu-Daudé
2017-11-17 13:42 ` [Qemu-devel] [PATCH 07/15] apb: return APBState from pci_apb_init() rather then PCIBus Mark Cave-Ayland
2017-11-17 19:08 ` Philippe Mathieu-Daudé
2017-11-17 13:42 ` [Qemu-devel] [PATCH 08/15] apb: use gpios to wire up the apb device to the SPARC CPU IRQs Mark Cave-Ayland
2017-11-20 17:41 ` Philippe Mathieu-Daudé
2017-11-17 13:42 ` [Qemu-devel] [PATCH 09/15] apb: move the two secondary PCI bridges objects into APBState Mark Cave-Ayland
2017-11-17 14:41 ` Artyom Tarasenko
2017-11-20 0:56 ` Philippe Mathieu-Daudé
2017-11-17 13:42 ` [Qemu-devel] [PATCH 10/15] apb: remove pci_apb_init() and instantiate APB device using qdev Mark Cave-Ayland
2017-11-17 14:37 ` Artyom Tarasenko
2017-11-20 17:51 ` Philippe Mathieu-Daudé
2017-11-20 22:50 ` Mark Cave-Ayland
2017-11-17 13:42 ` [Qemu-devel] [PATCH 11/15] apb: split pci_pbm_map_irq() into separate functions for bus A and bus B Mark Cave-Ayland
2017-11-17 14:33 ` Artyom Tarasenko
2017-11-19 11:06 ` Mark Cave-Ayland
2017-12-17 11:09 ` Mark Cave-Ayland
2017-12-19 7:56 ` Artyom Tarasenko
2017-12-19 9:27 ` Mark Cave-Ayland
2017-12-19 9:29 ` Artyom Tarasenko
2017-11-17 13:42 ` [Qemu-devel] [PATCH 12/15] ebus: wire up OBIO interrupts to APB pbm via qdev GPIOs Mark Cave-Ayland
2017-11-17 14:28 ` Artyom Tarasenko
2017-11-20 1:02 ` Philippe Mathieu-Daudé
2017-11-20 22:47 ` Mark Cave-Ayland
2017-11-17 13:42 ` [Qemu-devel] [PATCH 13/15] apb: replace OBIO interrupt numbers in pci_pbmA_map_irq() with constants Mark Cave-Ayland
2017-11-17 14:26 ` Artyom Tarasenko
2017-11-20 1:03 ` Philippe Mathieu-Daudé
2017-11-17 13:42 ` [Qemu-devel] [PATCH 14/15] sparc64: introduce trace-events for hw/sparc64 Mark Cave-Ayland
2017-11-17 14:36 ` Artyom Tarasenko
2017-11-19 15:14 ` Philippe Mathieu-Daudé
2017-11-20 22:43 ` Mark Cave-Ayland
2017-11-17 13:42 ` [Qemu-devel] [PATCH 15/15] sun4u: switch from EBUS_DPRINTF() macro to trace-events Mark Cave-Ayland
2017-11-17 19:10 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CACXAS8AuunBiKzZwr-+hUfKeCnG0ea2h47XN6y3dQSgW2AtCdg@mail.gmail.com \
--to=atar4qemu@gmail.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).