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 08/14] cris: replace PROP_PTR with PROP_LINK for interrupt vector
Date: Fri, 18 Oct 2019 17:42:06 +0200 [thread overview]
Message-ID: <20191018154212.13458-9-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20191018154212.13458-1-marcandre.lureau@redhat.com>
Instead of using raw interrupt vector pointer, store the associated
CPU with a link property.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
hw/cris/axis_dev88.c | 4 +---
hw/intc/Makefile.objs | 2 +-
hw/intc/etraxfs_pic.c | 18 +++++++-----------
3 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/hw/cris/axis_dev88.c b/hw/cris/axis_dev88.c
index 940c7dd122..cb7b1b58aa 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",
@@ -298,7 +296,7 @@ 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);
+ object_property_set_link(OBJECT(dev), OBJECT(cpu), "cpu", &error_abort);
qdev_init_nofail(dev);
s = SYS_BUS_DEVICE(dev);
sysbus_mmio_map(s, 0, 0x3001c000);
diff --git a/hw/intc/Makefile.objs b/hw/intc/Makefile.objs
index f726d87532..26a3cb36cb 100644
--- a/hw/intc/Makefile.objs
+++ b/hw/intc/Makefile.objs
@@ -5,7 +5,6 @@ common-obj-$(CONFIG_PUV3) += puv3_intc.o
common-obj-$(CONFIG_XILINX) += xilinx_intc.o
common-obj-$(CONFIG_XLNX_ZYNQMP_PMU) += xlnx-pmu-iomod-intc.o
common-obj-$(CONFIG_XLNX_ZYNQMP) += xlnx-zynqmp-ipi.o
-common-obj-$(CONFIG_ETRAXFS) += etraxfs_pic.o
common-obj-$(CONFIG_IMX) += imx_avic.o imx_gpcv2.o
common-obj-$(CONFIG_LM32) += lm32_pic.o
common-obj-$(CONFIG_REALVIEW) += realview_gic.o
@@ -49,3 +48,4 @@ obj-$(CONFIG_ARM_GIC) += arm_gicv3_cpuif.o
obj-$(CONFIG_MIPS_CPS) += mips_gic.o
obj-$(CONFIG_NIOS2) += nios2_iic.o
obj-$(CONFIG_OMPIC) += ompic.o
+obj-$(CONFIG_ETRAXFS) += etraxfs_pic.o
diff --git a/hw/intc/etraxfs_pic.c b/hw/intc/etraxfs_pic.c
index 77f652acec..8065fc757e 100644
--- a/hw/intc/etraxfs_pic.c
+++ b/hw/intc/etraxfs_pic.c
@@ -27,8 +27,7 @@
#include "qemu/module.h"
#include "hw/irq.h"
#include "hw/qdev-properties.h"
-//#include "pc.h"
-//#include "etraxfs.h"
+#include "target/cris/cpu.h"
#define D(x)
@@ -48,10 +47,10 @@ struct etrax_pic
SysBusDevice parent_obj;
MemoryRegion mmio;
- void *interrupt_vector;
qemu_irq parent_irq;
qemu_irq parent_nmi;
uint32_t regs[R_MAX];
+ CRISCPU *cpu;
};
static void pic_update(struct etrax_pic *fs)
@@ -79,9 +78,10 @@ static void pic_update(struct etrax_pic *fs)
}
}
- if (fs->interrupt_vector) {
- /* hack alert: ptr property */
- *(uint32_t*)(fs->interrupt_vector) = vector;
+ if (fs->cpu) {
+ /* hack alert: cpu link property */
+ int32_t *int_vec = &fs->cpu->env.interrupt_vector;
+ *int_vec = (uint32_t)vector;
}
qemu_set_irq(fs->parent_irq, !!vector);
}
@@ -164,7 +164,7 @@ static void etraxfs_pic_init(Object *obj)
}
static Property etraxfs_pic_properties[] = {
- DEFINE_PROP_PTR("interrupt_vector", struct etrax_pic, interrupt_vector),
+ DEFINE_PROP_LINK("cpu", struct etrax_pic, cpu, TYPE_CRIS_CPU, CRISCPU *),
DEFINE_PROP_END_OF_LIST(),
};
@@ -173,10 +173,6 @@ 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 = {
--
2.23.0.606.g08da6496b6
next prev parent reply other threads:[~2019-10-18 15:57 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-18 15:41 [PATCH 00/14] Clean-ups: remove QDEV_PROP_PTR Marc-André Lureau
2019-10-18 15:41 ` [PATCH 01/14] sm501: replace PROP_PTR with PROP_LINK Marc-André Lureau
2019-10-18 16:22 ` Peter Maydell
2019-10-18 16:36 ` Marc-André Lureau
2019-10-18 16:50 ` Peter Maydell
2019-10-18 15:42 ` [PATCH 02/14] vmmouse: " Marc-André Lureau
2019-10-21 10:10 ` Peter Maydell
2019-10-18 15:42 ` [PATCH 03/14] lance: " Marc-André Lureau
2019-10-21 10:05 ` Peter Maydell
2019-10-18 15:42 ` [PATCH 04/14] etraxfs: remove PROP_PTR usage Marc-André Lureau
2019-10-18 15:59 ` Peter Maydell
2019-10-18 16:11 ` Marc-André Lureau
2019-10-18 16:34 ` Peter Maydell
2019-10-21 10:41 ` Peter Maydell
2019-10-18 15:42 ` [PATCH 05/14] dp8393x: replace PROP_PTR with PROP_LINK Marc-André Lureau
2019-10-18 17:49 ` Peter Maydell
2019-10-18 18:14 ` Aleksandar Markovic
2019-10-18 15:42 ` [PATCH 06/14] leon3: " Marc-André Lureau
2019-10-18 17:45 ` Peter Maydell
2019-10-18 15:42 ` [PATCH 07/14] RFC: mips/cps: fix setting saar property Marc-André Lureau
2019-10-18 17:04 ` Philippe Mathieu-Daudé
2019-10-18 17:42 ` Aleksandar Markovic
2019-10-18 15:42 ` Marc-André Lureau [this message]
2019-10-18 17:37 ` [PATCH 08/14] cris: replace PROP_PTR with PROP_LINK for interrupt vector Peter Maydell
2019-10-18 15:42 ` [PATCH 09/14] smbus-eeprom: remove PROP_PTR Marc-André Lureau
2019-10-18 17:20 ` Peter Maydell
2019-10-21 14:52 ` Corey Minyard
2019-10-21 21:28 ` Marc-André Lureau
2019-10-18 15:42 ` [PATCH 10/14] omap-intc: " Marc-André Lureau
2019-10-18 16:55 ` Peter Maydell
2019-10-18 15:42 ` [PATCH 11/14] omap-i2c: " Marc-André Lureau
2019-10-18 16:56 ` Peter Maydell
2019-10-21 15:03 ` Corey Minyard
2019-10-18 15:42 ` [PATCH 12/14] omap-gpio: " Marc-André Lureau
2019-10-18 16:58 ` Peter Maydell
2019-10-18 15:42 ` [PATCH 13/14] qdev: remove PROP_MEMORY_REGION Marc-André Lureau
2019-10-18 16:58 ` Peter Maydell
2019-10-18 15:42 ` [PATCH 14/14] Remove QDEV_PROP_PTR Marc-André Lureau
2019-10-18 16:59 ` Peter Maydell
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=20191018154212.13458-9-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 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).