qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 05/11] heathrow: change heathrow_pic_init() to return the heathrow device
Date: Tue, 20 Feb 2018 15:22:18 +1100	[thread overview]
Message-ID: <20180220042218.GM1109@umbus.fritz.box> (raw)
In-Reply-To: <20180219181922.21586-6-mark.cave-ayland@ilande.co.uk>

[-- Attachment #1: Type: text/plain, Size: 4446 bytes --]

On Mon, Feb 19, 2018 at 06:19:16PM +0000, Mark Cave-Ayland wrote:
> This enables the device to be made available during the setup of the Old World
> machine. In order to pass back the previous set of IRQs we temporarily introduce
> a new pic_irqs parameter until it can be removed.
> 
> An additional benefit of this change is that it is also possible to remove the
> pic_mem pointer used for macio by accessing the memory region via sysbus.
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  hw/intc/heathrow_pic.c | 10 ++++++----
>  hw/ppc/mac.h           |  4 ++--
>  hw/ppc/mac_oldworld.c  |  9 +++++----
>  3 files changed, 13 insertions(+), 10 deletions(-)
> 
> diff --git a/hw/intc/heathrow_pic.c b/hw/intc/heathrow_pic.c
> index afe0b08cbb..1cf4db1e79 100644
> --- a/hw/intc/heathrow_pic.c
> +++ b/hw/intc/heathrow_pic.c
> @@ -173,13 +173,15 @@ static void heathrow_reset(DeviceState *d)
>  static void heathrow_init(Object *obj)
>  {
>      HeathrowState *s = HEATHROW(obj);
> +    SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
>  
>      memory_region_init_io(&s->mem, OBJECT(s), &heathrow_ops, s,
>                            "heathrow-pic", 0x1000);
> +    sysbus_init_mmio(sbd, &s->mem);
>  }
>  
> -qemu_irq *heathrow_pic_init(MemoryRegion **pmem,
> -                            int nb_cpus, qemu_irq **irqs)
> +DeviceState *heathrow_pic_init(int nb_cpus, qemu_irq **irqs,
> +                               qemu_irq **pic_irqs)
>  {
>      DeviceState *d;
>      HeathrowState *s;
> @@ -191,9 +193,9 @@ qemu_irq *heathrow_pic_init(MemoryRegion **pmem,
>      /* only 1 CPU */
>      s->irqs = irqs[0];
>  
> -    *pmem = &s->mem;
> +    *pic_irqs = qemu_allocate_irqs(heathrow_set_irq, s, HEATHROW_NUM_IRQS);
>  
> -    return qemu_allocate_irqs(heathrow_set_irq, s, HEATHROW_NUM_IRQS);
> +    return d;
>  }
>  
>  static void heathrow_class_init(ObjectClass *oc, void *data)
> diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h
> index 261b519aa5..5b5fffdff3 100644
> --- a/hw/ppc/mac.h
> +++ b/hw/ppc/mac.h
> @@ -79,8 +79,8 @@ void macio_init(PCIDevice *dev,
>                  MemoryRegion *pic_mem);
>  
>  /* Heathrow PIC */
> -qemu_irq *heathrow_pic_init(MemoryRegion **pmem,
> -                            int nb_cpus, qemu_irq **irqs);
> +DeviceState *heathrow_pic_init(int nb_cpus, qemu_irq **irqs,
> +                               qemu_irq **pic_irqs);
>  
>  /* Grackle PCI */
>  #define TYPE_GRACKLE_PCI_HOST_BRIDGE "grackle-pcihost"
> diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
> index 4401ce5af2..06a61220cb 100644
> --- a/hw/ppc/mac_oldworld.c
> +++ b/hw/ppc/mac_oldworld.c
> @@ -94,11 +94,11 @@ static void ppc_heathrow_init(MachineState *machine)
>      PCIBus *pci_bus;
>      PCIDevice *macio;
>      MACIOIDEState *macio_ide;
> -    DeviceState *dev;
> +    DeviceState *dev, *pic_dev;
> +    SysBusDevice *sbd;
>      BusState *adb_bus;
>      int bios_size, ndrv_size;
>      uint8_t *ndrv_file;
> -    MemoryRegion *pic_mem;
>      uint16_t ppc_boot_device;
>      DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
>      void *fw_cfg;
> @@ -257,7 +257,7 @@ static void ppc_heathrow_init(MachineState *machine)
>          error_report("Only 6xx bus is supported on heathrow machine");
>          exit(1);
>      }
> -    pic = heathrow_pic_init(&pic_mem, 1, heathrow_irqs);
> +    pic_dev = heathrow_pic_init(1, heathrow_irqs, &pic);
>      pci_bus = pci_grackle_init(0xfec00000, pic,
>                                 get_system_memory(),
>                                 get_system_io());
> @@ -280,7 +280,8 @@ static void ppc_heathrow_init(MachineState *machine)
>      qdev_connect_gpio_out(dev, 5, pic[0x0E]); /* IDE-1 */
>      qdev_connect_gpio_out(dev, 6, pic[0x03]); /* IDE-1 DMA */
>      qdev_prop_set_uint64(dev, "frequency", tbfreq);
> -    macio_init(macio, pic_mem);
> +    sbd = SYS_BUS_DEVICE(pic_dev);
> +    macio_init(macio, sysbus_mmio_get_region(sbd, 0));
>  
>      macio_ide = MACIO_IDE(object_resolve_path_component(OBJECT(macio),
>                                                          "ide[0]"));

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2018-02-20  4:22 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-19 18:19 [Qemu-devel] [PATCH 00/11] macio: remove legacy macio_init() function Mark Cave-Ayland
2018-02-19 18:19 ` [Qemu-devel] [PATCH 01/11] macio: embed DBDMA device directly within macio Mark Cave-Ayland
2018-02-20  3:28   ` David Gibson
2018-02-19 18:19 ` [Qemu-devel] [PATCH 02/11] macio: move ESCC device within the macio device Mark Cave-Ayland
2018-02-20  3:28   ` David Gibson
2018-02-19 18:19 ` [Qemu-devel] [PATCH 03/11] heathrow: QOMify heathrow PIC Mark Cave-Ayland
2018-02-20  3:28   ` David Gibson
2018-02-20  4:18     ` Mark Cave-Ayland
2018-02-20  4:39       ` David Gibson
2018-02-19 18:19 ` [Qemu-devel] [PATCH 04/11] heathrow: convert to trace-events Mark Cave-Ayland
2018-02-20  4:20   ` David Gibson
2018-02-20  4:40     ` Mark Cave-Ayland
2018-02-19 18:19 ` [Qemu-devel] [PATCH 05/11] heathrow: change heathrow_pic_init() to return the heathrow device Mark Cave-Ayland
2018-02-20  4:22   ` David Gibson [this message]
2018-02-19 18:19 ` [Qemu-devel] [PATCH 06/11] macio: move macio related structures and defines into separate macio.h file Mark Cave-Ayland
2018-02-20  4:40   ` David Gibson
2018-02-27 23:46   ` Philippe Mathieu-Daudé
2018-02-19 18:19 ` [Qemu-devel] [PATCH 07/11] mac_oldworld: use object link to pass heathrow PIC object to macio Mark Cave-Ayland
2018-02-20  4:42   ` David Gibson
2018-02-19 18:19 ` [Qemu-devel] [PATCH 08/11] openpic: move OpenPIC state and related definitions to openpic.h Mark Cave-Ayland
2018-02-22  2:12   ` David Gibson
2018-02-19 18:19 ` [Qemu-devel] [PATCH 09/11] mac_newworld: use object link to pass OpenPIC object to macio Mark Cave-Ayland
2018-02-22  2:19   ` David Gibson
2018-02-19 18:19 ` [Qemu-devel] [PATCH 10/11] macio: move setting of CUDA timebase frequency to macio_common_realize() Mark Cave-Ayland
2018-02-22  2:24   ` David Gibson
2018-02-19 18:19 ` [Qemu-devel] [PATCH 11/11] macio: remove macio_init() function Mark Cave-Ayland
2018-02-22 14:12 ` [Qemu-devel] [PATCH 00/11] macio: remove legacy " no-reply
2018-02-23 12:11 ` no-reply
2018-02-23 14:51   ` Mark Cave-Ayland
2018-02-28  2:24     ` David Gibson
2018-02-24 17:18 ` no-reply
2018-02-25 15:24 ` no-reply

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=20180220042218.GM1109@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).