From nobody Thu Apr 17 15:25:02 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Authentication-Results: mx.zohomail.com;
	dkim=fail;
	spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted
 sender)  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=fail(p=none dis=none)  header.from=linaro.org
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1549037555716575.797968887631;
 Fri, 1 Feb 2019 08:12:35 -0800 (PST)
Received: from localhost ([127.0.0.1]:57306 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1gpbQb-0003Ra-Ko
	for importer@patchew.org; Fri, 01 Feb 2019 11:12:29 -0500
Received: from eggs.gnu.org ([209.51.188.92]:58783)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <peter.maydell@linaro.org>) id 1gpbLv-0007yj-ER
	for qemu-devel@nongnu.org; Fri, 01 Feb 2019 11:07:41 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <peter.maydell@linaro.org>) id 1gpbLl-0003RG-Bb
	for qemu-devel@nongnu.org; Fri, 01 Feb 2019 11:07:33 -0500
Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:32774)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <peter.maydell@linaro.org>)
	id 1gpbLd-0003IM-OL
	for qemu-devel@nongnu.org; Fri, 01 Feb 2019 11:07:23 -0500
Received: by mail-wr1-x443.google.com with SMTP id a16so2066272wrv.0
	for <qemu-devel@nongnu.org>; Fri, 01 Feb 2019 08:07:03 -0800 (PST)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
	by smtp.gmail.com with ESMTPSA id n6sm2847250wmk.9.2019.02.01.08.07.01
	for <qemu-devel@nongnu.org>
	(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
	Fri, 01 Feb 2019 08:07:01 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
	h=from:to:subject:date:message-id:in-reply-to:references:mime-version
	:content-transfer-encoding;
	bh=bGl4lL391XdkOpdLoo3dPlboZpnD58pYyNCu5TdL5Jc=;
	b=PnbStVZuz6SkCHWKbQEFBSmOlmNwbEbYApGas05t7S8ENGuq6eiO+ASvlxC3XqiYfz
	MKDa7BTBt4SKpGmPqSaddA0B6IflIsQ9xO+oPkN5OtuvU3QBuVdfamrqZeemO8SR8gUy
	8rWIVnYrX7ViEHaDWkssFyzf/4X9O44Vh/aRI=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
	:references:mime-version:content-transfer-encoding;
	bh=bGl4lL391XdkOpdLoo3dPlboZpnD58pYyNCu5TdL5Jc=;
	b=s8aiFVwbJCE7TT4ec1ReV99sOcezn1ioscsyCQO1SV/9I5ASZMpl3N+EqHgfvrazKf
	95SxvFx/9V7ID0sna50rTuWGPzPln3im0zvB3zXhqbv1wLqPmcEutIg7oHe5TG1nVrt6
	aLJW0C0nl0fUk1N5Ro1nWXrxj+lYcYr6MSRqvreFF6CKY0ZtWN3Uy8oZh3BTvDQCs+C0
	f6wV9rY9RFpDHP1i/KHxYEASvYvY5NtgRC5rLgngumycV0QT8rWdDscnkygzgOQ4G8oM
	qYwKxdfO8v3taCkO58EiOt51/dIQAwmewKcqmNu1AlLsUh/IFcuuFOY/Pl9pUCuiyzm4
	4dsQ==
X-Gm-Message-State: AJcUukeL6Ue5R+A11j/kBS7h04i2nIcNWT8L2cte6jTW7FCPrRrbDsf4
	qsiygT65W7uH3w14MzUE3NWSNQKX6L2hiw==
X-Google-Smtp-Source: 
 ALg8bN5AO6hq7ujTqyVqEzq0jzB+V0LBt2TaVYpx8Ip84WbWu8KXoS1LYnJdkGs5EHnYgyj4mN/dCQ==
X-Received: by 2002:adf:91c3:: with SMTP id 61mr37927544wri.324.1549037222384;
	Fri, 01 Feb 2019 08:07:02 -0800 (PST)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Date: Fri,  1 Feb 2019 16:06:11 +0000
Message-Id: <20190201160653.13829-6-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20190201160653.13829-1-peter.maydell@linaro.org>
References: <20190201160653.13829-1-peter.maydell@linaro.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2a00:1450:4864:20::443
Subject: [Qemu-devel] [PULL 05/47] hw/arm/iotkit: Rename IoTKit to ARMSSE
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
	<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/qemu-devel/>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
	<mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: fail (Header signature does not verify)

The Arm IoTKit was effectively the forerunner of a series of
subsystems for embedded SoCs, named the SSE-050, SSE-100 and SSE-200:
https://developer.arm.com/products/system-design/subsystems
These are generally quite similar, though later iterations have
extra devices that earlier ones do not.

We want to add a model of the SSE-200, which means refactoring the
IoTKit code into an abstract base class and subclasses (using the
same design that the bcm283x SoC and Aspeed SoC family
implementations do). As a first step, rename the IoTKit struct and
QOM macros to ARMSSE, which is what we're going to name the base
class. We temporarily retain TYPE_IOTKIT to avoid changing the
code that instantiates a TYPE_IOTKIT device here and then changing
it back again when it is re-introduced as a subclass.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daud=C3=A9 <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20190121185118.18550-5-peter.maydell@linaro.org
---
 include/hw/arm/iotkit.h | 22 ++++++++++-----
 hw/arm/iotkit.c         | 59 +++++++++++++++++++++--------------------
 hw/arm/mps2-tz.c        |  2 +-
 3 files changed, 47 insertions(+), 36 deletions(-)

diff --git a/include/hw/arm/iotkit.h b/include/hw/arm/iotkit.h
index 3a8ee639085..9701738ec75 100644
--- a/include/hw/arm/iotkit.h
+++ b/include/hw/arm/iotkit.h
@@ -1,5 +1,5 @@
 /*
- * ARM IoT Kit
+ * ARM SSE (Subsystems for Embedded): IoTKit
  *
  * Copyright (c) 2018 Linaro Limited
  * Written by Peter Maydell
@@ -9,7 +9,10 @@
  * (at your option) any later version.
  */
=20
-/* This is a model of the Arm IoT Kit which is documented in
+/*
+ * This is a model of the Arm "Subsystems for Embedded" family of
+ * hardware, which include the IoT Kit and the SSE-050, SSE-100 and
+ * SSE-200. Currently we model only the Arm IoT Kit which is documented in
  * http://infocenter.arm.com/help/index.jsp?topic=3D/com.arm.doc.ecm060125=
6/index.html
  * It contains:
  *  a Cortex-M33
@@ -71,8 +74,15 @@
 #include "hw/or-irq.h"
 #include "hw/core/split-irq.h"
=20
-#define TYPE_IOTKIT "iotkit"
-#define IOTKIT(obj) OBJECT_CHECK(IoTKit, (obj), TYPE_IOTKIT)
+#define TYPE_ARMSSE "iotkit"
+#define ARMSSE(obj) OBJECT_CHECK(ARMSSE, (obj), TYPE_ARMSSE)
+
+/*
+ * For the moment TYPE_IOTKIT is a synonym for TYPE_ARMSSE (and the
+ * latter's underlying name is left as "iotkit"); in a later
+ * commit it will become a subclass of TYPE_ARMSSE.
+ */
+#define TYPE_IOTKIT TYPE_ARMSSE
=20
 /* We have an IRQ splitter and an OR gate input for each external PPC
  * and the 2 internal PPCs
@@ -80,7 +90,7 @@
 #define NUM_EXTERNAL_PPCS (IOTS_NUM_AHB_EXP_PPC + IOTS_NUM_APB_EXP_PPC)
 #define NUM_PPCS (NUM_EXTERNAL_PPCS + 2)
=20
-typedef struct IoTKit {
+typedef struct ARMSSE {
     /*< private >*/
     SysBusDevice parent_obj;
=20
@@ -131,6 +141,6 @@ typedef struct IoTKit {
     MemoryRegion *board_memory;
     uint32_t exp_numirq;
     uint32_t mainclk_frq;
-} IoTKit;
+} ARMSSE;
=20
 #endif
diff --git a/hw/arm/iotkit.c b/hw/arm/iotkit.c
index 8742200fb42..9360053184e 100644
--- a/hw/arm/iotkit.c
+++ b/hw/arm/iotkit.c
@@ -1,5 +1,5 @@
 /*
- * Arm IoT Kit
+ * Arm SSE (Subsystems for Embedded): IoTKit
  *
  * Copyright (c) 2018 Linaro Limited
  * Written by Peter Maydell
@@ -24,7 +24,7 @@
 /* Create an alias region of @size bytes starting at @base
  * which mirrors the memory starting at @orig.
  */
-static void make_alias(IoTKit *s, MemoryRegion *mr, const char *name,
+static void make_alias(ARMSSE *s, MemoryRegion *mr, const char *name,
                        hwaddr base, hwaddr size, hwaddr orig)
 {
     memory_region_init_alias(mr, NULL, name, &s->container, orig, size);
@@ -41,18 +41,18 @@ static void irq_status_forwarder(void *opaque, int n, i=
nt level)
=20
 static void nsccfg_handler(void *opaque, int n, int level)
 {
-    IoTKit *s =3D IOTKIT(opaque);
+    ARMSSE *s =3D ARMSSE(opaque);
=20
     s->nsccfg =3D level;
 }
=20
-static void iotkit_forward_ppc(IoTKit *s, const char *ppcname, int ppcnum)
+static void iotkit_forward_ppc(ARMSSE *s, const char *ppcname, int ppcnum)
 {
     /* Each of the 4 AHB and 4 APB PPCs that might be present in a
-     * system using the IoTKit has a collection of control lines which
+     * system using the ARMSSE has a collection of control lines which
      * are provided by the security controller and which we want to
-     * expose as control lines on the IoTKit device itself, so the
-     * code using the IoTKit can wire them up to the PPCs.
+     * expose as control lines on the ARMSSE device itself, so the
+     * code using the ARMSSE can wire them up to the PPCs.
      */
     SplitIRQ *splitter =3D &s->ppc_irq_splitter[ppcnum];
     DeviceState *iotkitdev =3D DEVICE(s);
@@ -91,7 +91,7 @@ static void iotkit_forward_ppc(IoTKit *s, const char *ppc=
name, int ppcnum)
     g_free(name);
 }
=20
-static void iotkit_forward_sec_resp_cfg(IoTKit *s)
+static void iotkit_forward_sec_resp_cfg(ARMSSE *s)
 {
     /* Forward the 3rd output from the splitter device as a
      * named GPIO output of the iotkit object.
@@ -107,7 +107,7 @@ static void iotkit_forward_sec_resp_cfg(IoTKit *s)
=20
 static void iotkit_init(Object *obj)
 {
-    IoTKit *s =3D IOTKIT(obj);
+    ARMSSE *s =3D ARMSSE(obj);
     int i;
=20
     memory_region_init(&s->container, obj, "iotkit-container", UINT64_MAX);
@@ -175,20 +175,20 @@ static void iotkit_init(Object *obj)
=20
 static void iotkit_exp_irq(void *opaque, int n, int level)
 {
-    IoTKit *s =3D IOTKIT(opaque);
+    ARMSSE *s =3D ARMSSE(opaque);
=20
     qemu_set_irq(s->exp_irqs[n], level);
 }
=20
 static void iotkit_mpcexp_status(void *opaque, int n, int level)
 {
-    IoTKit *s =3D IOTKIT(opaque);
+    ARMSSE *s =3D ARMSSE(opaque);
     qemu_set_irq(s->mpcexp_status_in[n], level);
 }
=20
 static void iotkit_realize(DeviceState *dev, Error **errp)
 {
-    IoTKit *s =3D IOTKIT(dev);
+    ARMSSE *s =3D ARMSSE(dev);
     int i;
     MemoryRegion *mr;
     Error *err =3D NULL;
@@ -215,9 +215,9 @@ static void iotkit_realize(DeviceState *dev, Error **er=
rp)
      * devices exist in both address spaces but with hard-wired security
      * permissions that will cause the CPU to fault for non-secure accesse=
s.
      *
-     * The IoTKit has an IDAU (Implementation Defined Access Unit),
+     * The ARMSSE has an IDAU (Implementation Defined Access Unit),
      * which specifies hard-wired security permissions for different
-     * areas of the physical address space. For the IoTKit IDAU, the
+     * areas of the physical address space. For the ARMSSE IDAU, the
      * top 4 bits of the physical address are the IDAU region ID, and
      * if bit 28 (ie the lowest bit of the ID) is 0 then this is an NS
      * region, otherwise it is an S region.
@@ -239,7 +239,7 @@ static void iotkit_realize(DeviceState *dev, Error **er=
rp)
      * 0x20000000..0x2007ffff  32KB FPGA block RAM
      * 0x30000000..0x3fffffff  alias of 0x20000000..0x2fffffff
      * 0x40000000..0x4000ffff  base peripheral region 1
-     * 0x40010000..0x4001ffff  CPU peripherals (none for IoTKit)
+     * 0x40010000..0x4001ffff  CPU peripherals (none for ARMSSE)
      * 0x40020000..0x4002ffff  system control element peripherals
      * 0x40080000..0x400fffff  base peripheral region 2
      * 0x50000000..0x5fffffff  alias of 0x40000000..0x4fffffff
@@ -306,8 +306,8 @@ static void iotkit_realize(DeviceState *dev, Error **er=
rp)
     qdev_connect_gpio_out_named(dev_secctl, "nsc_cfg", 0, s->nsc_cfg_in);
=20
     /* The sec_resp_cfg output from the security controller must be split =
into
-     * multiple lines, one for each of the PPCs within the IoTKit and one
-     * that will be an output from the IoTKit to the system.
+     * multiple lines, one for each of the PPCs within the ARMSSE and one
+     * that will be an output from the ARMSSE to the system.
      */
     object_property_set_int(OBJECT(&s->sec_resp_splitter), 3,
                             "num-lines", &err);
@@ -475,7 +475,7 @@ static void iotkit_realize(DeviceState *dev, Error **er=
rp)
=20
     /* 0x40010000 .. 0x4001ffff: private CPU region: unused in IoTKit */
=20
-    /* 0x40020000 .. 0x4002ffff : IoTKit system control peripheral region =
*/
+    /* 0x40020000 .. 0x4002ffff : ARMSSE system control peripheral region =
*/
     /* Devices behind APB PPC1:
      *   0x4002f000: S32K timer
      */
@@ -558,7 +558,7 @@ static void iotkit_realize(DeviceState *dev, Error **er=
rp)
                        qdev_get_gpio_in(DEVICE(&s->nmi_orgate), 0));
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->s32kwatchdog), 0, 0x5002e000);
=20
-    /* 0x40080000 .. 0x4008ffff : IoTKit second Base peripheral region */
+    /* 0x40080000 .. 0x4008ffff : ARMSSE second Base peripheral region */
=20
     qdev_prop_set_uint32(DEVICE(&s->nswatchdog), "wdogclk-frq", s->mainclk=
_frq);
     object_property_set_bool(OBJECT(&s->nswatchdog), true, "realized", &er=
r);
@@ -678,7 +678,7 @@ static void iotkit_realize(DeviceState *dev, Error **er=
rp)
      * Expose our container region to the board model; this corresponds
      * to the AHB Slave Expansion ports which allow bus master devices
      * (eg DMA controllers) in the board model to make transactions into
-     * devices in the IoTKit.
+     * devices in the ARMSSE.
      */
     sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->container);
=20
@@ -688,11 +688,12 @@ static void iotkit_realize(DeviceState *dev, Error **=
errp)
 static void iotkit_idau_check(IDAUInterface *ii, uint32_t address,
                               int *iregion, bool *exempt, bool *ns, bool *=
nsc)
 {
-    /* For IoTKit systems the IDAU responses are simple logical functions
+    /*
+     * For ARMSSE systems the IDAU responses are simple logical functions
      * of the address bits. The NSC attribute is guest-adjustable via the
      * NSCCFG register in the security controller.
      */
-    IoTKit *s =3D IOTKIT(ii);
+    ARMSSE *s =3D ARMSSE(ii);
     int region =3D extract32(address, 28, 4);
=20
     *ns =3D !(region & 1);
@@ -707,22 +708,22 @@ static const VMStateDescription iotkit_vmstate =3D {
     .version_id =3D 1,
     .minimum_version_id =3D 1,
     .fields =3D (VMStateField[]) {
-        VMSTATE_UINT32(nsccfg, IoTKit),
+        VMSTATE_UINT32(nsccfg, ARMSSE),
         VMSTATE_END_OF_LIST()
     }
 };
=20
 static Property iotkit_properties[] =3D {
-    DEFINE_PROP_LINK("memory", IoTKit, board_memory, TYPE_MEMORY_REGION,
+    DEFINE_PROP_LINK("memory", ARMSSE, board_memory, TYPE_MEMORY_REGION,
                      MemoryRegion *),
-    DEFINE_PROP_UINT32("EXP_NUMIRQ", IoTKit, exp_numirq, 64),
-    DEFINE_PROP_UINT32("MAINCLK", IoTKit, mainclk_frq, 0),
+    DEFINE_PROP_UINT32("EXP_NUMIRQ", ARMSSE, exp_numirq, 64),
+    DEFINE_PROP_UINT32("MAINCLK", ARMSSE, mainclk_frq, 0),
     DEFINE_PROP_END_OF_LIST()
 };
=20
 static void iotkit_reset(DeviceState *dev)
 {
-    IoTKit *s =3D IOTKIT(dev);
+    ARMSSE *s =3D ARMSSE(dev);
=20
     s->nsccfg =3D 0;
 }
@@ -740,9 +741,9 @@ static void iotkit_class_init(ObjectClass *klass, void =
*data)
 }
=20
 static const TypeInfo iotkit_info =3D {
-    .name =3D TYPE_IOTKIT,
+    .name =3D TYPE_ARMSSE,
     .parent =3D TYPE_SYS_BUS_DEVICE,
-    .instance_size =3D sizeof(IoTKit),
+    .instance_size =3D sizeof(ARMSSE),
     .instance_init =3D iotkit_init,
     .class_init =3D iotkit_class_init,
     .interfaces =3D (InterfaceInfo[]) {
diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c
index 82b1d020a58..5824335b4fb 100644
--- a/hw/arm/mps2-tz.c
+++ b/hw/arm/mps2-tz.c
@@ -66,7 +66,7 @@ typedef struct {
 typedef struct {
     MachineState parent;
=20
-    IoTKit iotkit;
+    ARMSSE iotkit;
     MemoryRegion psram;
     MemoryRegion ssram[3];
     MemoryRegion ssram1_m;
--=20
2.20.1