All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Corey Minyard" <cminyard@mvista.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"KONRAD Frederic" <frederic.konrad@adacore.com>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"Aleksandar Rikalo" <arikalo@wavecomp.com>,
	"Magnus Damm" <magnus.damm@gmail.com>,
	"Hervé Poussineau" <hpoussin@reactos.org>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Artyom Tarasenko" <atar4qemu@gmail.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Fabien Chouteau" <chouteau@adacore.com>,
	qemu-arm@nongnu.org, "Richard Henderson" <rth@twiddle.net>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	qemu-ppc@nongnu.org,
	"Aleksandar Markovic" <amarkovic@wavecomp.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>
Subject: [PATCH v2 22/28] cris: improve passing PIC interrupt vector to the CPU
Date: Tue, 22 Oct 2019 18:21:31 +0200	[thread overview]
Message-ID: <20191022162137.27161-23-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20191022162137.27161-1-marcandre.lureau@redhat.com>

Instead of accessing cpu interrupt vector directly from PIC, send the
vector value over the qemu_irq.

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/cris/axis_dev88.c  |  4 ----
 hw/intc/etraxfs_pic.c | 26 +-------------------------
 target/cris/cpu.c     |  8 ++++++++
 target/cris/cpu.h     |  1 +
 4 files changed, 10 insertions(+), 29 deletions(-)

diff --git a/hw/cris/axis_dev88.c b/hw/cris/axis_dev88.c
index 940c7dd122..be7760476a 100644
--- a/hw/cris/axis_dev88.c
+++ b/hw/cris/axis_dev88.c
@@ -253,7 +253,6 @@ void axisdev88_init(MachineState *machine)
     const char *kernel_filename = machine->kernel_filename;
     const char *kernel_cmdline = machine->kernel_cmdline;
     CRISCPU *cpu;
-    CPUCRISState *env;
     DeviceState *dev;
     SysBusDevice *s;
     DriveInfo *nand;
@@ -267,7 +266,6 @@ void axisdev88_init(MachineState *machine)
 
     /* init CPUs */
     cpu = CRIS_CPU(cpu_create(machine->cpu_type));
-    env = &cpu->env;
 
     /* allocate RAM */
     memory_region_allocate_system_memory(phys_ram, NULL, "axisdev88.ram",
@@ -297,8 +295,6 @@ void axisdev88_init(MachineState *machine)
 
 
     dev = qdev_create(NULL, "etraxfs,pic");
-    /* FIXME: Is there a proper way to signal vectors to the CPU core?  */
-    qdev_prop_set_ptr(dev, "interrupt_vector", &env->interrupt_vector);
     qdev_init_nofail(dev);
     s = SYS_BUS_DEVICE(dev);
     sysbus_mmio_map(s, 0, 0x3001c000);
diff --git a/hw/intc/etraxfs_pic.c b/hw/intc/etraxfs_pic.c
index 77f652acec..12988c7aa9 100644
--- a/hw/intc/etraxfs_pic.c
+++ b/hw/intc/etraxfs_pic.c
@@ -27,8 +27,6 @@
 #include "qemu/module.h"
 #include "hw/irq.h"
 #include "hw/qdev-properties.h"
-//#include "pc.h"
-//#include "etraxfs.h"
 
 #define D(x)
 
@@ -48,7 +46,6 @@ struct etrax_pic
     SysBusDevice parent_obj;
 
     MemoryRegion mmio;
-    void *interrupt_vector;
     qemu_irq parent_irq;
     qemu_irq parent_nmi;
     uint32_t regs[R_MAX];
@@ -79,11 +76,7 @@ static void pic_update(struct etrax_pic *fs)
         }
     }
 
-    if (fs->interrupt_vector) {
-        /* hack alert: ptr property */
-        *(uint32_t*)(fs->interrupt_vector) = vector;
-    }
-    qemu_set_irq(fs->parent_irq, !!vector);
+    qemu_set_irq(fs->parent_irq, vector);
 }
 
 static uint64_t
@@ -163,28 +156,11 @@ static void etraxfs_pic_init(Object *obj)
     sysbus_init_mmio(sbd, &s->mmio);
 }
 
-static Property etraxfs_pic_properties[] = {
-    DEFINE_PROP_PTR("interrupt_vector", struct etrax_pic, interrupt_vector),
-    DEFINE_PROP_END_OF_LIST(),
-};
-
-static void etraxfs_pic_class_init(ObjectClass *klass, void *data)
-{
-    DeviceClass *dc = DEVICE_CLASS(klass);
-
-    dc->props = etraxfs_pic_properties;
-    /*
-     * Note: pointer property "interrupt_vector" may remain null, thus
-     * no need for dc->user_creatable = false;
-     */
-}
-
 static const TypeInfo etraxfs_pic_info = {
     .name          = TYPE_ETRAX_FS_PIC,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(struct etrax_pic),
     .instance_init = etraxfs_pic_init,
-    .class_init    = etraxfs_pic_class_init,
 };
 
 static void etraxfs_pic_register_types(void)
diff --git a/target/cris/cpu.c b/target/cris/cpu.c
index 7adfd6caf4..6a857f548d 100644
--- a/target/cris/cpu.c
+++ b/target/cris/cpu.c
@@ -147,6 +147,14 @@ static void cris_cpu_set_irq(void *opaque, int irq, int level)
     CPUState *cs = CPU(cpu);
     int type = irq == CRIS_CPU_IRQ ? CPU_INTERRUPT_HARD : CPU_INTERRUPT_NMI;
 
+    if (irq == CRIS_CPU_IRQ) {
+        /*
+         * The PIC passes us the vector for the IRQ as the value it sends
+         * over the qemu_irq line
+         */
+        cpu->env.interrupt_vector = level;
+    }
+
     if (level) {
         cpu_interrupt(cs, type);
     } else {
diff --git a/target/cris/cpu.h b/target/cris/cpu.h
index aba0a66474..a7c2a8e15b 100644
--- a/target/cris/cpu.h
+++ b/target/cris/cpu.h
@@ -34,6 +34,7 @@
 #define CPU_INTERRUPT_NMI       CPU_INTERRUPT_TGT_EXT_3
 
 /* CRUS CPU device objects interrupt lines.  */
+/* PIC passes the vector for the IRQ as the value of it sends over qemu_irq */
 #define CRIS_CPU_IRQ 0
 #define CRIS_CPU_NMI 1
 
-- 
2.23.0.606.g08da6496b6



  parent reply	other threads:[~2019-10-22 16:42 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-22 16:21 [PATCH v2 00/28] Clean-ups: qom-ify serial and remove QDEV_PROP_PTR Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 01/28] chardev: generate an internal id when none given Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 02/28] serial-pci-multi: factor out multi_serial_get_nr_ports Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 03/28] serial: initial qom-ification Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 04/28] serial: register vmsd with DeviceClass Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 05/28] serial: add and set "chardev" property Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 06/28] serial: make SerialMMState actually a different type Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 07/28] serial: add and set "regshift" property Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 08/28] serial: convert irq to qdev gpio properties Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 09/28] serial: add "baudbase" property Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 10/28] serial: add "base" property Marc-André Lureau
2019-10-22 16:31   ` Peter Maydell
2019-10-22 16:42     ` Marc-André Lureau
2019-10-22 16:50       ` Peter Maydell
2019-10-22 16:21 ` [PATCH v2 11/28] serial: realize the serial device Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 12/28] serial: replace serial_exit_core() with unrealize Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 13/28] serial: factor out serial_mm_connect Marc-André Lureau
2019-10-22 16:34   ` Peter Maydell
2019-10-22 16:21 ` [PATCH v2 14/28] sm501: embed the serial device Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 15/28] vmmouse: replace PROP_PTR with PROP_LINK Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 16/28] lance: " Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 17/28] etraxfs: remove PROP_PTR usage Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 18/28] dp8393x: replace PROP_PTR with PROP_LINK Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 19/28] leon3: use qemu_irq framework instead of callback as property Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 20/28] sparc: move PIL irq handling to cpu.c Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 21/28] RFC: mips/cps: fix setting saar property Marc-André Lureau
2019-10-22 16:21 ` Marc-André Lureau [this message]
2019-10-22 16:21 ` [PATCH v2 23/28] smbus-eeprom: remove PROP_PTR Marc-André Lureau
2019-10-22 17:19   ` Peter Maydell
2019-10-22 17:56     ` Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 24/28] omap-intc: " Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 25/28] omap-i2c: " Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 26/28] omap-gpio: " Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 27/28] qdev: remove PROP_MEMORY_REGION Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 28/28] Remove QDEV_PROP_PTR Marc-André Lureau

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=20191022162137.27161-23-marcandre.lureau@redhat.com \
    --to=marcandre.lureau@redhat.com \
    --cc=amarkovic@wavecomp.com \
    --cc=arikalo@wavecomp.com \
    --cc=atar4qemu@gmail.com \
    --cc=aurelien@aurel32.net \
    --cc=berrange@redhat.com \
    --cc=chouteau@adacore.com \
    --cc=cminyard@mvista.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=ehabkost@redhat.com \
    --cc=frederic.konrad@adacore.com \
    --cc=hpoussin@reactos.org \
    --cc=jasowang@redhat.com \
    --cc=magnus.damm@gmail.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rth@twiddle.net \
    /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.