qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
	Alexander Graf <agraf@suse.de>
Subject: Re: [Qemu-devel] [PATCH 02/28] openpic: remove dead code to make a PCI device version
Date: Fri, 27 Jan 2012 00:57:44 +0100	[thread overview]
Message-ID: <4F21E878.4070203@suse.de> (raw)
In-Reply-To: <1327433600-7403-3-git-send-email-aliguori@us.ibm.com>

Am 24.01.2012 20:32, schrieb Anthony Liguori:
> bus is always NULL so the code in this if clause is dead (and therefore
> untested).
> 
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> ---
>  hw/openpic.c      |   30 +++---------------------------
>  hw/openpic.h      |    2 +-
>  hw/ppc_newworld.c |    2 +-
>  3 files changed, 5 insertions(+), 29 deletions(-)
> 
> diff --git a/hw/openpic.c b/hw/openpic.c
> index 22fc275..280b7a9 100644
> --- a/hw/openpic.c
> +++ b/hw/openpic.c
> @@ -1181,41 +1181,17 @@ static void openpic_irq_raise(openpic_t *opp, int n_CPU, IRQ_src_t *src)
>      qemu_irq_raise(opp->dst[n_CPU].irqs[OPENPIC_OUTPUT_INT]);
>  }
>  
> -qemu_irq *openpic_init (PCIBus *bus, MemoryRegion **pmem, int nb_cpus,
> +qemu_irq *openpic_init (MemoryRegion **pmem, int nb_cpus,
>                          qemu_irq **irqs, qemu_irq irq_out)

Here a reindentation (space) would've been nice.

>  {
>      openpic_t *opp;
> -    uint8_t *pci_conf;
>      int i, m;
>  
>      /* XXX: for now, only one CPU is supported */
>      if (nb_cpus != 1)
>          return NULL;
> -    if (bus) {
> -        opp = (openpic_t *)pci_register_device(bus, "OpenPIC", sizeof(openpic_t),
> -                                               -1, NULL, NULL);
> -        pci_conf = opp->pci_dev.config;
> -        pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_IBM);
> -        pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_IBM_OPENPIC2);
> -        pci_config_set_class(pci_conf, PCI_CLASS_SYSTEM_OTHER); // FIXME?
> -        pci_conf[0x3d] = 0x00; // no interrupt pin

I'm not too fond of losing PCI device infos from dead code, but
registering an unused PCIDeviceInfo doesn't seem right either...

AFAIU this function implements a PCI and a non-PCI version of the
device. The PCI version is unused and is now being ripped out.

> -
> -        memory_region_init_io(&opp->mem, &openpic_ops, opp, "openpic", 0x40000);
> -#if 0 // Don't implement ISU for now
> -        opp_io_memory = cpu_register_io_memory(openpic_src_read,
> -                                               openpic_src_write, NULL
> -                                               DEVICE_NATIVE_ENDIAN);
> -        cpu_register_physical_memory(isu_base, 0x20 * (EXT_IRQ + 2),
> -                                     opp_io_memory);
> -#endif
> -
> -        /* Register I/O spaces */
> -        pci_register_bar(&opp->pci_dev, 0,
> -                         PCI_BASE_ADDRESS_SPACE_MEMORY, &opp->mem);
> -    } else {
> -        opp = g_malloc0(sizeof(openpic_t));
> -        memory_region_init_io(&opp->mem, &openpic_ops, opp, "openpic", 0x40000);
> -    }
> +    opp = g_malloc0(sizeof(openpic_t));

Ugh. But just moved around.
(More non-qdev'ified code lurking in that file.)

> +    memory_region_init_io(&opp->mem, &openpic_ops, opp, "openpic", 0x40000);
>  
>      //    isu_base &= 0xFFFC0000;
>      opp->nb_cpus = nb_cpus;
> diff --git a/hw/openpic.h b/hw/openpic.h
> index 715f084..8556030 100644
> --- a/hw/openpic.h
> +++ b/hw/openpic.h
> @@ -11,7 +11,7 @@ enum {
>      OPENPIC_OUTPUT_NB,
>  };
>  
> -qemu_irq *openpic_init (PCIBus *bus, MemoryRegion **pmem, int nb_cpus,
> +qemu_irq *openpic_init (MemoryRegion **pmem, int nb_cpus,
>                          qemu_irq **irqs, qemu_irq irq_out);

Space.

>  qemu_irq *mpic_init (MemoryRegion *address_space, target_phys_addr_t base,
>                       int nb_cpus, qemu_irq **irqs, qemu_irq irq_out);
> diff --git a/hw/ppc_newworld.c b/hw/ppc_newworld.c
> index a746c9c..506187b 100644
> --- a/hw/ppc_newworld.c
> +++ b/hw/ppc_newworld.c
> @@ -311,7 +311,7 @@ static void ppc_core99_init (ram_addr_t ram_size,
>              exit(1);
>          }
>      }
> -    pic = openpic_init(NULL, &pic_mem, smp_cpus, openpic_irqs, NULL);
> +    pic = openpic_init(&pic_mem, smp_cpus, openpic_irqs, NULL);
>      if (PPC_INPUT(env) == PPC_FLAGS_INPUT_970) {
>          /* 970 gets a U3 bus */
>          pci_bus = pci_pmac_u3_init(pic, get_system_memory(), get_system_io());

Anyway, to keep moving forward,

Reviewed-by: Andreas Färber <afaerber@suse.de>

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  reply	other threads:[~2012-01-27  0:00 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-24 19:32 [Qemu-devel] [PATCH v3 0/28] qom: add QEMU Object Model type hierarchy to qdev Anthony Liguori
2012-01-24 19:32 ` [Qemu-devel] [PATCH 01/28] macio: convert " Anthony Liguori
2012-01-26 23:17   ` [Qemu-devel] [PATCH] macio: Convert " Andreas Färber
2012-03-06 22:56     ` Alexander Graf
2012-01-24 19:32 ` [Qemu-devel] [PATCH 02/28] openpic: remove dead code to make a PCI device version Anthony Liguori
2012-01-26 23:57   ` Andreas Färber [this message]
2012-01-24 19:32 ` [Qemu-devel] [PATCH 03/28] pci: call reset unconditionally Anthony Liguori
2012-01-25 12:42   ` Michael S. Tsirkin
2012-01-25 13:28     ` Anthony Liguori
2012-01-24 19:32 ` [Qemu-devel] [PATCH 04/28] qom: add the base Object class (v2) Anthony Liguori
2012-01-25 21:30   ` Andreas Färber
2012-01-25 21:37     ` Anthony Liguori
2012-01-26  7:43       ` Paolo Bonzini
2012-01-27 15:05       ` Andreas Färber
2012-01-27 15:42         ` Anthony Liguori
2012-01-27 15:43           ` Andreas Färber
2012-01-24 19:32 ` [Qemu-devel] [PATCH 05/28] qdev: integrate with QEMU Object Model (v2) Anthony Liguori
2012-01-24 19:32 ` [Qemu-devel] [PATCH 06/28] qdev: move qdev->info to class Anthony Liguori
2012-01-24 19:32 ` [Qemu-devel] [PATCH 07/28] qdev: don't access name through info Anthony Liguori
2012-01-24 19:33 ` [Qemu-devel] [PATCH 08/28] qdev: use a wrapper to access reset and promote reset to a class method Anthony Liguori
2012-01-24 19:33 ` [Qemu-devel] [PATCH 09/28] qdev: add a interface to register subclasses Anthony Liguori
2012-01-24 19:33 ` [Qemu-devel] [PATCH 10/28] qdev: add class_init to DeviceInfo Anthony Liguori
2012-01-24 19:33 ` [Qemu-devel] [PATCH 11/28] qdev: prepare source tree for code conversion Anthony Liguori
2012-01-26 17:35   ` [Qemu-devel] [PATCH 1/3] es1370: Drop dead code Andreas Färber
2012-01-26 17:35     ` [Qemu-devel] [PATCH 2/3] marvell_88w8618_audio: Use DEFINE_PROP_* macros Andreas Färber
2012-01-26 17:35     ` [Qemu-devel] [PATCH 3/3] qdev: prepare source tree for code conversion Andreas Färber
2012-01-24 19:33 ` [Qemu-devel] [PATCH 12/28] isa: pic: convert to QEMU Object Model Anthony Liguori
2012-01-24 19:33 ` [Qemu-devel] [PATCH 13/28] usb: " Anthony Liguori
2012-01-24 19:33 ` [Qemu-devel] [PATCH 14/28] ccid: " Anthony Liguori
2012-01-24 19:33 ` [Qemu-devel] [PATCH 15/28] ssi: " Anthony Liguori
2012-01-24 19:33 ` [Qemu-devel] [PATCH 16/28] i2c: rename i2c_slave -> I2CSlave Anthony Liguori
2012-01-24 19:33 ` [Qemu-devel] [PATCH 17/28] i2c: smbus: convert to QEMU Object Model Anthony Liguori
2012-01-24 19:33 ` [Qemu-devel] [PATCH 18/28] hda-codec: " Anthony Liguori
2012-01-24 19:33 ` [Qemu-devel] [PATCH 19/28] ide: " Anthony Liguori
2012-01-24 19:33 ` [Qemu-devel] [PATCH 20/28] scsi: " Anthony Liguori
2012-01-24 19:33 ` [Qemu-devel] [PATCH 21/28] spapr: convert to QEMU Object Model (v2) Anthony Liguori
2012-01-24 19:33 ` [Qemu-devel] [PATCH 22/28] virtio-serial: convert to QEMU Object Model Anthony Liguori
2012-01-24 19:59   ` Amit Shah
2012-01-24 20:13     ` Anthony Liguori
2012-01-24 19:33 ` [Qemu-devel] [PATCH 23/28] unin_pci: Clean up qdev names Anthony Liguori
2012-01-24 19:33 ` [Qemu-devel] [PATCH 24/28] unin_pci: Drop duplicate busdev Anthony Liguori
2012-01-24 19:33 ` [Qemu-devel] [PATCH 25/28] unin_pci: Drop unused reset handler Anthony Liguori
2012-01-24 19:33 ` [Qemu-devel] [PATCH 26/28] pci: convert to QEMU Object Model Anthony Liguori
2012-01-25 12:41   ` Michael S. Tsirkin
2012-01-25 13:34     ` Anthony Liguori
2012-01-24 19:33 ` [Qemu-devel] [PATCH 27/28] sysbus: apic: ioapic: " Anthony Liguori
2012-01-24 20:01   ` Jan Kiszka
2012-01-24 20:21     ` Anthony Liguori
2012-01-24 21:01       ` Jan Kiszka
2012-01-24 21:11         ` Anthony Liguori
2012-01-24 21:31           ` Jan Kiszka
2012-01-24 21:53             ` Anthony Liguori
2012-01-24 22:06               ` Jan Kiszka
2012-01-24 23:03                 ` Anthony Liguori
2012-01-25  8:33                   ` Andreas Färber
2012-01-25 12:09                     ` Avi Kivity
2012-01-25 13:02                     ` Paul Brook
2012-01-25 14:25                     ` Anthony Liguori
2012-01-25  8:37                   ` Jan Kiszka
2012-01-25 10:15                     ` Paolo Bonzini
2012-01-25 10:27                       ` Jan Kiszka
2012-01-25 11:15                         ` Paolo Bonzini
2012-01-25 14:00                     ` Anthony Liguori
2012-01-25 14:23                       ` Jan Kiszka
2012-01-25 14:40                         ` Anthony Liguori
2012-01-25 15:18                           ` Andreas Färber
2012-01-25 15:34                           ` Eric Blake
2012-01-24 19:33 ` [Qemu-devel] [PATCH 28/28] virtio-s390: " Anthony Liguori
2012-01-24 23:13 ` [Qemu-devel] [PATCH v3 0/28] qom: add QEMU Object Model type hierarchy to qdev Peter Maydell
2012-01-24 23:16   ` Anthony Liguori
2012-01-25 18:31 ` Blue Swirl
2012-01-25 19:43   ` Anthony Liguori
2012-01-25 20:09     ` Blue Swirl
2012-01-27 17:34 ` Anthony Liguori

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=4F21E878.4070203@suse.de \
    --to=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=aliguori@us.ibm.com \
    --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).