From nobody Sun Apr 27 10:46:19 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 (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1550776149091565.0133753797435;
 Thu, 21 Feb 2019 11:09:09 -0800 (PST)
Received: from localhost ([127.0.0.1]:37012 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1gwtiS-0001Lh-1a
	for importer@patchew.org; Thu, 21 Feb 2019 14:09:04 -0500
Received: from eggs.gnu.org ([209.51.188.92]:52193)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <peter.maydell@linaro.org>) id 1gwtXr-0008Uv-HS
	for qemu-devel@nongnu.org; Thu, 21 Feb 2019 13:58:10 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <peter.maydell@linaro.org>) id 1gwtXp-0007Sr-9a
	for qemu-devel@nongnu.org; Thu, 21 Feb 2019 13:58:07 -0500
Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:41451)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <peter.maydell@linaro.org>)
	id 1gwtXo-0007Pv-SM
	for qemu-devel@nongnu.org; Thu, 21 Feb 2019 13:58:05 -0500
Received: by mail-wr1-x434.google.com with SMTP id n2so19644307wrw.8
	for <qemu-devel@nongnu.org>; Thu, 21 Feb 2019 10:58:02 -0800 (PST)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
	by smtp.gmail.com with ESMTPSA id
	c18sm29065085wre.32.2019.02.21.10.57.59 for <qemu-devel@nongnu.org>
	(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
	Thu, 21 Feb 2019 10:58:00 -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=6DwAcLSaFzva9ACId1E/asTJ9WH92ZHxCzcEEbU6fo4=;
	b=mm/hNaYrCApiTTvGc/kB88zs47nh2Ucoti5Wiik2fxY2Y/a//0Rs4dYQO14uVz6e1d
	lgkQ5NjavUy0azuEXXuqcFRJqVkjqpx+gNL+hFDMdwHh4x7wuaDPtLd5r3/eo8/JJu2L
	EHybT8DyECfGEts9RX6fuvQeL8fSQxdh9owxPmO5hxmihZXDvO1yOhn8fUcBKYGfEcCC
	DKEhl1lebBuubEvtbye7TBEZ7pgTZyUFhVOHzy/w2vhAB0knnw4lHwaNuIJUMSj3U75L
	5zk/1TOsU9hl6DxHr+TLp/Metcqg7b+N+GrDbQaI87m6cgQsqq2NJLlm29QNduAfR0tR
	V7oA==
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=6DwAcLSaFzva9ACId1E/asTJ9WH92ZHxCzcEEbU6fo4=;
	b=qZt8oFJS34YNiQWUBrxOZwbR9c7aQT6YshsXR25GODPaBpsOTSNcHKReiHNh87G4nw
	X+iGQSzdmKWprzLZMnK0KwUmQ+vH45vnZTWvgaQnBAxgPXwQQRmmf5PPCA4J48QsrwQE
	2nUgnV28OZ1WIgX1eY86SsxvNO0G5IB4ETx3DqByxpstYJKoTb6gKxU2whJKj22IpcVb
	+yRGP/0y+BroxqbVRo0R4l/sNhaB4y/oMCMla+h+t362KrE1Xuho/j0f47ner6uTIydh
	LMeod3LzAQEgGC90gnMu1iiQLNKYVdlV3gi4XUEioORxmFl+o9G2jR0NUduXQprG6at/
	zk+g==
X-Gm-Message-State: AHQUAuYyL2WaXZV+jtRFQNE9QpLTaxxXDCQ2Ut3hxmCzMy4npKBdoMI/
	K6l20rX7IRz0nCNLnJqxVAfmJUOFGGk=
X-Google-Smtp-Source: 
 AHgI3IbzRbbG36OQB9TA19XibJc9FQg6RUC6b9tORYVGST3z/k3LsAxnjQ4ikKPBOgEqXCUMdXjcGw==
X-Received: by 2002:adf:fc12:: with SMTP id
 i18mr28307069wrr.201.1550775481089;
	Thu, 21 Feb 2019 10:58:01 -0800 (PST)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Date: Thu, 21 Feb 2019 18:57:33 +0000
Message-Id: <20190221185739.25362-16-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20190221185739.25362-1-peter.maydell@linaro.org>
References: <20190221185739.25362-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::434
Subject: [Qemu-devel] [PULL 15/21] hw/arm/armsse: Allow boards to specify
 init-svtor
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 Musca boards have DAPLink firmware that sets the initial
secure VTOR value (the location of the vector table) differently
depending on the boot mode (from flash, from RAM, etc). Export
the init-svtor as a QOM property of the ARMSSE object so that
the board can change it.

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>
---
 include/hw/arm/armsse.h | 3 +++
 hw/arm/armsse.c         | 8 ++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/include/hw/arm/armsse.h b/include/hw/arm/armsse.h
index 444605b44dc..84879f40dd8 100644
--- a/include/hw/arm/armsse.h
+++ b/include/hw/arm/armsse.h
@@ -48,6 +48,8 @@
  *    if necessary.)
  *  + QOM property "SRAM_ADDR_WIDTH" sets the number of bits used for the
  *    address of each SRAM bank (and thus the total amount of internal SRA=
M)
+ *  + QOM property "init-svtor" sets the initial value of the CPU SVTOR re=
gister
+ *    (where it expects to load the PC and SP from the vector table on res=
et)
  *  + Named GPIO inputs "EXP_IRQ" 0..n are the expansion interrupts for CP=
U 0,
  *    which are wired to its NVIC lines 32 .. n+32
  *  + Named GPIO inputs "EXP_CPU1_IRQ" 0..n are the expansion interrupts f=
or
@@ -204,6 +206,7 @@ typedef struct ARMSSE {
     uint32_t exp_numirq;
     uint32_t mainclk_frq;
     uint32_t sram_addr_width;
+    uint32_t init_svtor;
 } ARMSSE;
=20
 typedef struct ARMSSEInfo ARMSSEInfo;
diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c
index d0207dbabc7..50da41f64c5 100644
--- a/hw/arm/armsse.c
+++ b/hw/arm/armsse.c
@@ -505,11 +505,10 @@ static void armsse_realize(DeviceState *dev, Error **=
errp)
          * the INITSVTOR* registers before powering up the CPUs in any cas=
e,
          * so the hardware's default value doesn't matter. QEMU doesn't em=
ulate
          * the control processor, so instead we behave in the way that the
-         * firmware does. All boards currently known about have firmware t=
hat
-         * sets the INITSVTOR0 and INITSVTOR1 registers to 0x10000000, lik=
e the
-         * IoTKit default. We can make this more configurable if necessary.
+         * firmware does. The initial value is configurable by the board c=
ode
+         * to match whatever its firmware does.
          */
-        qdev_prop_set_uint32(cpudev, "init-svtor", 0x10000000);
+        qdev_prop_set_uint32(cpudev, "init-svtor", s->init_svtor);
         /*
          * Start all CPUs except CPU0 powered down. In real hardware it is
          * a configurable property of the SSE-200 which CPUs start powered=
 up
@@ -1187,6 +1186,7 @@ static Property armsse_properties[] =3D {
     DEFINE_PROP_UINT32("EXP_NUMIRQ", ARMSSE, exp_numirq, 64),
     DEFINE_PROP_UINT32("MAINCLK", ARMSSE, mainclk_frq, 0),
     DEFINE_PROP_UINT32("SRAM_ADDR_WIDTH", ARMSSE, sram_addr_width, 15),
+    DEFINE_PROP_UINT32("init-svtor", ARMSSE, init_svtor, 0x10000000),
     DEFINE_PROP_END_OF_LIST()
 };
=20
--=20
2.20.1