From: Shashi Mallela <shashi.mallela@linaro.org>
To: peter.maydell@linaro.org, leif@nuviainc.com, rad@semihalf.com,
mst@redhat.com, imammedo@redhat.com
Cc: eric.auger@redhat.com, qemu-arm@nongnu.org,
qemu-devel@nongnu.org, narmstrong@baylibre.com
Subject: [PATCH v8 07/10] hw/arm/sbsa-ref: add ITS support in SBSA GIC
Date: Thu, 12 Aug 2021 12:53:38 -0400 [thread overview]
Message-ID: <20210812165341.40784-8-shashi.mallela@linaro.org> (raw)
In-Reply-To: <20210812165341.40784-1-shashi.mallela@linaro.org>
Included creation of ITS as part of SBSA platform GIC
initialization.
Signed-off-by: Shashi Mallela <shashi.mallela@linaro.org>
---
hw/arm/sbsa-ref.c | 79 ++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 75 insertions(+), 4 deletions(-)
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
index c1629df603..feadae2f33 100644
--- a/hw/arm/sbsa-ref.c
+++ b/hw/arm/sbsa-ref.c
@@ -34,7 +34,7 @@
#include "hw/boards.h"
#include "hw/ide/internal.h"
#include "hw/ide/ahci_internal.h"
-#include "hw/intc/arm_gicv3_common.h"
+#include "hw/intc/arm_gicv3_its_common.h"
#include "hw/loader.h"
#include "hw/pci-host/gpex.h"
#include "hw/qdev-properties.h"
@@ -58,12 +58,26 @@
#define ARCH_TIMER_NS_EL1_IRQ 14
#define ARCH_TIMER_NS_EL2_IRQ 10
+/*
+ * Enumeration of the possible values of sbsa-ref version
+ * property. These are arbitrary QEMU-internal values.
+ * values are :-
+ * DEFAULT = without ITS memory map
+ * SBSA_GIC_ITS = with ITS memory map between distributor & redistributor
+ * regions. This is the current version supported.
+ */
+typedef enum SbsaRefVersion {
+ SBSA_DEFAULT,
+ SBSA_ITS,
+} SbsaRefVersion;
+
enum {
SBSA_FLASH,
SBSA_MEM,
SBSA_CPUPERIPHS,
SBSA_GIC_DIST,
SBSA_GIC_REDIST,
+ SBSA_GIC_ITS,
SBSA_SECURE_EC,
SBSA_GWDT,
SBSA_GWDT_REFRESH,
@@ -91,6 +105,7 @@ struct SBSAMachineState {
void *fdt;
int fdt_size;
int psci_conduit;
+ SbsaRefVersion version;
DeviceState *gic;
PFlashCFI01 *flash[2];
};
@@ -105,8 +120,11 @@ static const MemMapEntry sbsa_ref_memmap[] = {
[SBSA_SECURE_MEM] = { 0x20000000, 0x20000000 },
/* Space reserved for CPU peripheral devices */
[SBSA_CPUPERIPHS] = { 0x40000000, 0x00040000 },
+ /* GIC components reserved space Start */
[SBSA_GIC_DIST] = { 0x40060000, 0x00010000 },
- [SBSA_GIC_REDIST] = { 0x40080000, 0x04000000 },
+ [SBSA_GIC_ITS] = { 0x40070000, 0x00020000 },
+ [SBSA_GIC_REDIST] = { 0x400B0000, 0x04000000 },
+ /* GIC components reserved space End */
[SBSA_SECURE_EC] = { 0x50000000, 0x00001000 },
[SBSA_GWDT_REFRESH] = { 0x50010000, 0x00001000 },
[SBSA_GWDT_CONTROL] = { 0x50011000, 0x00001000 },
@@ -377,7 +395,20 @@ static void create_secure_ram(SBSAMachineState *sms,
memory_region_add_subregion(secure_sysmem, base, secram);
}
-static void create_gic(SBSAMachineState *sms)
+static void create_its(SBSAMachineState *sms)
+{
+ DeviceState *dev;
+
+ dev = qdev_new(TYPE_ARM_GICV3_ITS);
+ SysBusDevice *s = SYS_BUS_DEVICE(dev);
+
+ object_property_set_link(OBJECT(dev), "parent-gicv3", OBJECT(sms->gic),
+ &error_abort);
+ sysbus_realize_and_unref(s, &error_fatal);
+ sysbus_mmio_map(s, 0, sbsa_ref_memmap[SBSA_GIC_ITS].base);
+}
+
+static void create_gic(SBSAMachineState *sms, MemoryRegion *mem)
{
unsigned int smp_cpus = MACHINE(sms)->smp.cpus;
SysBusDevice *gicbusdev;
@@ -404,6 +435,10 @@ static void create_gic(SBSAMachineState *sms)
qdev_prop_set_uint32(sms->gic, "len-redist-region-count", 1);
qdev_prop_set_uint32(sms->gic, "redist-region-count[0]", redist0_count);
+ object_property_set_link(OBJECT(sms->gic), "sysmem", OBJECT(mem),
+ &error_fatal);
+ qdev_prop_set_bit(sms->gic, "has-lpi", true);
+
gicbusdev = SYS_BUS_DEVICE(sms->gic);
sysbus_realize_and_unref(gicbusdev, &error_fatal);
sysbus_mmio_map(gicbusdev, 0, sbsa_ref_memmap[SBSA_GIC_DIST].base);
@@ -450,6 +485,7 @@ static void create_gic(SBSAMachineState *sms)
sysbus_connect_irq(gicbusdev, i + 3 * smp_cpus,
qdev_get_gpio_in(cpudev, ARM_CPU_VFIQ));
}
+ create_its(sms);
}
static void create_uart(const SBSAMachineState *sms, int uart,
@@ -755,7 +791,7 @@ static void sbsa_ref_init(MachineState *machine)
create_secure_ram(sms, secure_sysmem);
- create_gic(sms);
+ create_gic(sms, sysmem);
create_uart(sms, SBSA_UART, sysmem, serial_hd(0));
create_uart(sms, SBSA_SECURE_UART, secure_sysmem, serial_hd(1));
@@ -825,10 +861,39 @@ sbsa_ref_get_default_cpu_node_id(const MachineState *ms, int idx)
return idx % ms->numa_state->num_nodes;
}
+static char *sbsa_get_version(Object *obj, Error **errp)
+{
+ SBSAMachineState *sms = SBSA_MACHINE(obj);
+
+ switch (sms->version) {
+ case SBSA_DEFAULT:
+ return g_strdup("default");
+ case SBSA_ITS:
+ return g_strdup("sbsaits");
+ default:
+ g_assert_not_reached();
+ }
+}
+
+static void sbsa_set_version(Object *obj, const char *value, Error **errp)
+{
+ SBSAMachineState *sms = SBSA_MACHINE(obj);
+
+ if (!strcmp(value, "sbsaits")) {
+ sms->version = SBSA_ITS;
+ } else if (!strcmp(value, "default")) {
+ sms->version = SBSA_DEFAULT;
+ } else {
+ error_setg(errp, "Invalid version value");
+ error_append_hint(errp, "Valid values are default, sbsaits.\n");
+ }
+}
+
static void sbsa_ref_instance_init(Object *obj)
{
SBSAMachineState *sms = SBSA_MACHINE(obj);
+ sms->version = SBSA_ITS;
sbsa_flash_create(sms);
}
@@ -850,6 +915,12 @@ static void sbsa_ref_class_init(ObjectClass *oc, void *data)
mc->possible_cpu_arch_ids = sbsa_ref_possible_cpu_arch_ids;
mc->cpu_index_to_instance_props = sbsa_ref_cpu_index_to_props;
mc->get_default_cpu_node_id = sbsa_ref_get_default_cpu_node_id;
+
+ object_class_property_add_str(oc, "version", sbsa_get_version,
+ sbsa_set_version);
+ object_class_property_set_description(oc, "version",
+ "Set the Version type. "
+ "Valid values are default & sbsaits");
}
static const TypeInfo sbsa_ref_info = {
--
2.27.0
next prev parent reply other threads:[~2021-08-12 17:02 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-12 16:53 [PATCH v8 00/10] GICv3 LPI and ITS feature implementation Shashi Mallela
2021-08-12 16:53 ` [PATCH v8 01/10] hw/intc: GICv3 ITS initial framework Shashi Mallela
2021-08-12 16:53 ` [PATCH v8 02/10] hw/intc: GICv3 ITS register definitions added Shashi Mallela
2021-08-12 16:53 ` [PATCH v8 03/10] hw/intc: GICv3 ITS command queue framework Shashi Mallela
2021-08-12 16:53 ` [PATCH v8 04/10] hw/intc: GICv3 ITS Command processing Shashi Mallela
2021-08-13 7:51 ` Neil Armstrong
2021-08-12 16:53 ` [PATCH v8 05/10] hw/intc: GICv3 ITS Feature enablement Shashi Mallela
2021-08-12 16:53 ` [PATCH v8 06/10] hw/intc: GICv3 redistributor ITS processing Shashi Mallela
2021-08-19 13:21 ` Peter Maydell
2021-08-12 16:53 ` Shashi Mallela [this message]
2021-08-19 13:27 ` [PATCH v8 07/10] hw/arm/sbsa-ref: add ITS support in SBSA GIC Peter Maydell
2021-08-23 15:05 ` shashi.mallela
2021-09-02 12:42 ` Leif Lindholm
2021-09-02 12:51 ` Peter Maydell
2021-09-03 12:01 ` Leif Lindholm
2021-09-03 12:09 ` Peter Maydell
2021-09-23 16:00 ` Peter Maydell
2021-10-15 12:23 ` Leif Lindholm
2021-11-09 13:43 ` Peter Maydell
2021-11-09 20:42 ` Leif Lindholm
2021-11-09 21:21 ` Peter Maydell
2021-11-09 22:52 ` Leif Lindholm
2021-11-11 16:55 ` Peter Maydell
2021-11-11 18:21 ` Leif Lindholm
2021-08-12 16:53 ` [PATCH v8 08/10] tests/data/acpi/virt: Add IORT files for ITS Shashi Mallela
2021-08-19 13:21 ` Peter Maydell
2021-08-12 16:53 ` [PATCH v8 09/10] hw/arm/virt: add ITS support in virt GIC Shashi Mallela
2021-08-12 16:53 ` [PATCH v8 10/10] tests/data/acpi/virt: Update IORT files for ITS Shashi Mallela
2021-08-19 13:22 ` 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=20210812165341.40784-8-shashi.mallela@linaro.org \
--to=shashi.mallela@linaro.org \
--cc=eric.auger@redhat.com \
--cc=imammedo@redhat.com \
--cc=leif@nuviainc.com \
--cc=mst@redhat.com \
--cc=narmstrong@baylibre.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rad@semihalf.com \
/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).