From nobody Tue Feb 10 02:02:28 2026 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; 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 ARC-Seal: i=1; a=rsa-sha256; t=1567750537; cv=none; d=zoho.com; s=zohoarc; b=Cz5LxvhM26WV6xZysSsj+vkO+ONqy66M4TLI1bNqX57PDbBXGk+Ed/zFLeEgEkObq48Dw/K23Py5ZPVTpGYxLdg+VVsV4julrWlBD2p3otNl1Wcv52yaVI1YAzRi2ZlakgbNV/YKY8mf17u6Rkj8QFNeVXZn66Gw19d7ozf3s8w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567750537; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=jWgP1ADGwTyurqv6cMs6wlleYyD1So+YWUkeKZjC4dk=; b=kzLLK4h/yOb0hg43hIXA8K2w2U7xglYDx9thAgRfnfQApo+Dz1ilabinTZpPY9MxvQamDUUlrJ5l02K1wqTeoN54vFWFREPavD5vmkhVYnDauGfhwEHBoa69ubl/P3I5ycC+bwz1RU5+OpuXj1i3rnF4H40OXbE8hqC5Dhmth7k= ARC-Authentication-Results: i=1; mx.zoho.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1567750537447699.7466673036112; Thu, 5 Sep 2019 23:15:37 -0700 (PDT) Received: from localhost ([::1]:52408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i67Wx-0006MN-9r for importer@patchew.org; Fri, 06 Sep 2019 02:15:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39943) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i67Sc-0002VW-9w for qemu-devel@nongnu.org; Fri, 06 Sep 2019 02:11:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i67Sb-0003lt-5c for qemu-devel@nongnu.org; Fri, 06 Sep 2019 02:11:06 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:33703) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i67Sb-0003ll-24 for qemu-devel@nongnu.org; Fri, 06 Sep 2019 02:11:05 -0400 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id D637021F83; Fri, 6 Sep 2019 02:11:04 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Fri, 06 Sep 2019 02:11:04 -0400 Received: from alistair-xps-14z.alistair23.me (c-73-93-84-208.hsd1.ca.comcast.net [73.93.84.208]) by mail.messagingengine.com (Postfix) with ESMTPA id 442E0D60062; Fri, 6 Sep 2019 02:11:04 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=jWgP1ADGwTyur qv6cMs6wlleYyD1So+YWUkeKZjC4dk=; b=KTgk318HnOFwWxW9zLfEHoizqPIIQ Z8j4ZBS4UW+am7PefX/sxtT+BufGzRAC4MqwKzLwFn4abMJRklI/KnzTcy3fkh0p ScyZzDdXgdpqYnO+CPVb1/slVaV21LwLp39fgndBU7GmTYWuoL6JOG57L2CW4sfN GXoazKqq1hV4is9GBIbr6ftXkiuqGsf7Y2MV9kVlpUhrOA79SoAjXDKdWEiTrPh0 txISx8SufE1OK/1ltXxxAFfyzXEv03lKMwDuVPWvq04Yl/tCF3SudM1u1E29cxRI 2+hMMrMeVXLg647WUV95Rg2tAW1d+JG/OxJi9pVzswqYe/LZRh6YCcO1g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=jWgP1ADGwTyurqv6cMs6wlleYyD1So+YWUkeKZjC4dk=; b=xs0HuczK SGx+RFxOT+r4UQMivii7PDbY0w9PmY3umMsvG0ZTxqg1AXwf6a57p4fbIrl8lejB lgm/DcB22hcqRPmATvITStd5idHTDJxertXQxmwcEG3CuXLISqYixukeBGaWdvwR DFigbkHyHgkHIg2G09YN9Xa4whfrEp0+leIkOBbrToz2TjQJhkV0FrO5gXMo54rt Te6j6Z6OQhCU7P+DMyOY4Xm9N/YQCOd4qNJgzrSTGENWRMbI9Uw824Wu4OpY1ZBt AxJKHtQ5R1+VN9O0x5JE3x9SNmQo2iGF5aUSVJj0OEksiLVGZb/MtoJ2xK6zlPP9 QHdB7gPKvfcz4g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudejkedgheelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucfkphepjeefrdelfedrkeegrddvtdekne curfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlihhsthgrihhrvdef rdhmvgenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: From: Alistair Francis To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Thu, 5 Sep 2019 23:11:03 -0700 Message-Id: <7e78d043a9ce878166c0dd750844722aa9b54d84.1567750222.git.alistair@alistair23.me> X-Mailer: git-send-email 2.22.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.25 Subject: [Qemu-devel] [PATCH v4 2/6] target/arm: Allow setting M mode entry and sp X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair23@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Add M mode initial entry PC and SP properties. Signed-off-by: Alistair Francis --- target/arm/cpu.c | 52 +++++++++++++++++++++++++++++++++++++++++++----- target/arm/cpu.h | 3 +++ 2 files changed, 50 insertions(+), 5 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 2399c14471..315aa503f6 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -311,6 +311,9 @@ static void arm_cpu_reset(CPUState *s) */ initial_msp =3D ldl_p(rom); initial_pc =3D ldl_p(rom + 4); + } else if (cpu->init_sp || cpu->init_entry) { + initial_msp =3D cpu->init_sp; + initial_pc =3D cpu->init_entry; } else { /* Address zero not covered by a ROM blob, or the ROM blob * is in non-modifiable memory and this is a second reset after @@ -1055,6 +1058,38 @@ static void arm_set_init_svtor(Object *obj, Visitor = *v, const char *name, visit_type_uint32(v, name, &cpu->init_svtor, errp); } =20 +static void arm_get_init_sp(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + ARMCPU *cpu =3D ARM_CPU(obj); + + visit_type_uint32(v, name, &cpu->init_sp, errp); +} + +static void arm_set_init_sp(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + ARMCPU *cpu =3D ARM_CPU(obj); + + visit_type_uint32(v, name, &cpu->init_sp, errp); +} + +static void arm_get_init_entry(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + ARMCPU *cpu =3D ARM_CPU(obj); + + visit_type_uint32(v, name, &cpu->init_entry, errp); +} + +static void arm_set_init_entry(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + ARMCPU *cpu =3D ARM_CPU(obj); + + visit_type_uint32(v, name, &cpu->init_entry, errp); +} + void arm_cpu_post_init(Object *obj) { ARMCPU *cpu =3D ARM_CPU(obj); @@ -1155,19 +1190,26 @@ void arm_cpu_post_init(Object *obj) } } =20 + /* + * M profile: initial value of the SP, entry and Secure VTOR. + * We can't just use a simple DEFINE_PROP_UINT32 for this because we w= ant + * to permit the property to be set after realize. + */ if (arm_feature(&cpu->env, ARM_FEATURE_M_SECURITY)) { object_property_add_link(obj, "idau", TYPE_IDAU_INTERFACE, &cpu->i= dau, qdev_prop_allow_set_link_before_realize, OBJ_PROP_LINK_STRONG, &error_abort); - /* - * M profile: initial value of the Secure VTOR. We can't just use - * a simple DEFINE_PROP_UINT32 for this because we want to permit - * the property to be set after realize. - */ object_property_add(obj, "init-svtor", "uint32", arm_get_init_svtor, arm_set_init_svtor, NULL, NULL, &error_abort); + } else if (arm_feature(&cpu->env, ARM_FEATURE_M)) { + object_property_add(obj, "init-sp", "uint32", + arm_get_init_sp, arm_set_init_sp, + NULL, NULL, &error_abort); + object_property_add(obj, "init-entry", "uint32", + arm_get_init_entry, arm_set_init_entry, + NULL, NULL, &error_abort); } =20 qdev_property_add_static(DEVICE(obj), &arm_cpu_cfgend_property, diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 297ad5e47a..4856d4c36b 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -805,6 +805,9 @@ struct ARMCPU { */ uint32_t psci_conduit; =20 + /* For M, initial value of the entry and SP */ + uint32_t init_sp, init_entry; + /* For v8M, initial value of the Secure VTOR */ uint32_t init_svtor; =20 --=20 2.22.0