From: Alexander Graf <agraf@suse.de>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, david@gibson.dropbear.id.au
Subject: Re: [Qemu-devel] [PATCH v2 1/3] spapr: proper qdevification
Date: Thu, 07 Jul 2011 16:10:51 +0200 [thread overview]
Message-ID: <4E15BE6B.4000101@suse.de> (raw)
In-Reply-To: <1306403566-31597-2-git-send-email-pbonzini@redhat.com>
On 05/26/2011 11:52 AM, Paolo Bonzini wrote:
> Right now the spapr devices cannot be instantiated with -device,
> because the IRQs need to be passed to the spapr_*_create functions.
> Do this instead in the bus's init wrapper.
>
> This is particularly important with the conversion from scsi-disk
> to scsi-{cd,hd} that Markus made. After his patches, if you
> specify a scsi-cd device attached to an if=none drive, the default
> VSCSI controller will not be created and, without qdevification,
> you will not be able to add yours.
>
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> Cc: Alexander Graf<agraf@suse.de>
> Cc: David Gibson<david@gibson.dropbear.id.au>
> ---
> hw/spapr.c | 15 +++++----------
> hw/spapr.h | 6 ++++++
> hw/spapr_llan.c | 7 +------
> hw/spapr_vio.c | 5 +++++
> hw/spapr_vio.h | 13 ++++---------
> hw/spapr_vscsi.c | 8 +-------
> hw/spapr_vty.c | 8 +-------
> 7 files changed, 23 insertions(+), 39 deletions(-)
>
> diff --git a/hw/spapr.c b/hw/spapr.c
> index 109b774..07b2165 100644
> --- a/hw/spapr.c
> +++ b/hw/spapr.c
> @@ -298,7 +298,6 @@ static void ppc_spapr_init(ram_addr_t ram_size,
> long kernel_size, initrd_size, fw_size;
> long pteg_shift = 17;
> char *filename;
> - int irq = 16;
>
> spapr = qemu_malloc(sizeof(*spapr));
> cpu_ppc_hypercall = emulate_spapr_hypercall;
> @@ -360,15 +359,14 @@ static void ppc_spapr_init(ram_addr_t ram_size,
> /* Set up VIO bus */
> spapr->vio_bus = spapr_vio_bus_init();
>
> - for (i = 0; i< MAX_SERIAL_PORTS; i++, irq++) {
> + for (i = 0; i< MAX_SERIAL_PORTS; i++) {
> if (serial_hds[i]) {
> spapr_vty_create(spapr->vio_bus, SPAPR_VTY_BASE_ADDRESS + i,
> - serial_hds[i], xics_find_qirq(spapr->icp, irq),
> - irq);
> + serial_hds[i]);
> }
> }
>
> - for (i = 0; i< nb_nics; i++, irq++) {
> + for (i = 0; i< nb_nics; i++) {
> NICInfo *nd =&nd_table[i];
>
> if (!nd->model) {
> @@ -376,8 +374,7 @@ static void ppc_spapr_init(ram_addr_t ram_size,
> }
>
> if (strcmp(nd->model, "ibmveth") == 0) {
> - spapr_vlan_create(spapr->vio_bus, 0x1000 + i, nd,
> - xics_find_qirq(spapr->icp, irq), irq);
> + spapr_vlan_create(spapr->vio_bus, 0x1000 + i, nd);
> } else {
> fprintf(stderr, "pSeries (sPAPR) platform does not support "
> "NIC model '%s' (only ibmveth is supported)\n",
> @@ -387,9 +384,7 @@ static void ppc_spapr_init(ram_addr_t ram_size,
> }
>
> for (i = 0; i<= drive_get_max_bus(IF_SCSI); i++) {
> - spapr_vscsi_create(spapr->vio_bus, 0x2000 + i,
> - xics_find_qirq(spapr->icp, irq), irq);
> - irq++;
> + spapr_vscsi_create(spapr->vio_bus, 0x2000 + i);
> }
>
> if (kernel_filename) {
> diff --git a/hw/spapr.h b/hw/spapr.h
> index b52133a..4130c13 100644
> --- a/hw/spapr.h
> +++ b/hw/spapr.h
> @@ -278,6 +278,12 @@ void spapr_register_hypercall(target_ulong opcode, spapr_hcall_fn fn);
> target_ulong spapr_hypercall(CPUState *env, target_ulong opcode,
> target_ulong *args);
>
> +static inline qemu_irq *spapr_find_qirq(sPAPREnvironment *spapr,
> + int irq_num)
> +{
> + return xics_find_qirq(spapr->icp, irq_num);
> +}
> +
This breaks with current HEAD. I've added a fix to my tree:
diff --git a/hw/spapr.h b/hw/spapr.h
index 4130c13..a725d4a 100644
--- a/hw/spapr.h
+++ b/hw/spapr.h
@@ -1,6 +1,8 @@
#if !defined(__HW_SPAPR_H__)
#define __HW_SPAPR_H__
+#include "hw/xics.h"
+
struct VIOsPAPRBus;
struct icp_state;
@@ -278,7 +280,7 @@ void spapr_register_hypercall(target_ulong opcode,
spapr_hcall_fn fn);
target_ulong spapr_hypercall(CPUState *env, target_ulong opcode,
target_ulong *args);
-static inline qemu_irq *spapr_find_qirq(sPAPREnvironment *spapr,
+static inline qemu_irq spapr_find_qirq(sPAPREnvironment *spapr,
int irq_num)
{
return xics_find_qirq(spapr->icp, irq_num);
Alex
next prev parent reply other threads:[~2011-07-07 14:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-26 9:52 [Qemu-devel] [PATCH v2 0/3] spapr qdevification Paolo Bonzini
2011-05-26 9:52 ` [Qemu-devel] [PATCH v2 1/3] spapr: proper qdevification Paolo Bonzini
2011-07-07 14:10 ` Alexander Graf [this message]
2011-05-26 9:52 ` [Qemu-devel] [PATCH v2 2/3] spapr: prepare for qdevification of irq Paolo Bonzini
2011-05-26 9:52 ` [Qemu-devel] [PATCH v2 3/3] spapr: make irq customizable via qdev Paolo Bonzini
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=4E15BE6B.4000101@suse.de \
--to=agraf@suse.de \
--cc=david@gibson.dropbear.id.au \
--cc=pbonzini@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.