From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7pJQ-00015T-Tx for qemu-devel@nongnu.org; Wed, 24 Jun 2015 14:22:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z7pJN-0007KP-Oc for qemu-devel@nongnu.org; Wed, 24 Jun 2015 14:22:16 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49915 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7pJN-0007KC-IT for qemu-devel@nongnu.org; Wed, 24 Jun 2015 14:22:13 -0400 Message-ID: <558AF554.8040203@suse.de> Date: Wed, 24 Jun 2015 20:22:12 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH qom v3 3/4] arm: boot: Use cpu_set_pc() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite , qemu-devel@nongnu.org, peter.maydell@linaro.org Cc: edgar.iglesias@gmail.com, Peter Crosthwaite Am 24.06.2015 um 05:19 schrieb Peter Crosthwaite: > Use cpu_set_pc() across the board for setting program counters. This > removes instances of system level code having to reach into the CPU > env. >=20 > Reviewed-by: Peter Maydell > Reviewed-by: Andreas F=C3=A4rber > Signed-off-by: Peter Crosthwaite > --- > Changed since v2: > Add () to fn names in commit msg > Drop error argument > Changed since v1: > Lease thumb masking in boot.c > --- > hw/arm/boot.c | 19 +++++++------------ > 1 file changed, 7 insertions(+), 12 deletions(-) Any objection to avoiding repeated casts as follows? --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -168,9 +168,11 @@ static void default_write_secondary(ARMCPU *cpu, static void default_reset_secondary(ARMCPU *cpu, const struct arm_boot_info *info) { + CPUState *cs =3D CPU(cpu); + address_space_stl_notdirty(&address_space_memory, info->smp_bootreg_addr, 0, MEMTXATTRS_UNSPECIFIED, NULL); - cpu_set_pc(CPU(cpu), info->smp_loader_start); + cpu_set_pc(cs, info->smp_loader_start); } static inline bool have_dtb(const struct arm_boot_info *info) @@ -443,10 +445,11 @@ fail: static void do_cpu_reset(void *opaque) { ARMCPU *cpu =3D opaque; + CPUState *cs =3D CPU(cpu); CPUARMState *env =3D &cpu->env; const struct arm_boot_info *info =3D env->boot_info; - cpu_reset(CPU(cpu)); + cpu_reset(cs); if (info) { if (!info->is_linux) { /* Jump to the entry point. */ @@ -456,7 +459,7 @@ static void do_cpu_reset(void *opaque) env->thumb =3D info->entry & 1; entry &=3D 0xfffffffe; } - cpu_set_pc(CPU(cpu), entry); + cpu_set_pc(cs, entry); } else { /* If we are booting Linux then we need to check whether we = are * booting into secure or non-secure state and adjust the st= ate @@ -486,8 +489,8 @@ static void do_cpu_reset(void *opaque) } } - if (CPU(cpu) =3D=3D first_cpu) { - cpu_set_pc(CPU(cpu), info->loader_start); + if (cs =3D=3D first_cpu) { + cpu_set_pc(cs, info->loader_start); if (!have_dtb(info)) { if (old_param) { Regards, Andreas --=20 SUSE Linux GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Felix Imend=C3=B6rffer, Jane Smithard, Dilip Upmanyu, Graham Norton; = HRB 21284 (AG N=C3=BCrnberg)