Received: from eggs.gnu.org ([2001:4830:134:3::10]:58661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaUWt-0008Jm-Ei for qemu-devel@nongnu.org; Mon, 29 Feb 2016 15:34:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aaUWq-0004xe-6f for qemu-devel@nongnu.org; Mon, 29 Feb 2016 15:34:55 -0500 Received: from zose-mta03.web4all.fr ([185.49.20.44]:48358) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaUWp-0004xW-TG for qemu-devel@nongnu.org; Mon, 29 Feb 2016 15:34:52 -0500 References: <4499d69ec1326c07481e9d8178e64b63f9748706.1454967766.git.jcd@tribudubois.net> <56C38B52.7080904@tribudubois.net> <56C398FA.8010204@tribudubois.net> <56C62EDA.3010307@tribudubois.net> <56C6B707.8040001@tribudubois.net> From: Jean-Christophe DUBOIS Message-ID: <56D4AB67.6080506@tribudubois.net> Date: Mon, 29 Feb 2016 21:34:47 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 7/9] i.MX: Add i.MX6 SOC implementation. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers , Peter Crosthwaite Le 29/02/2016 18:58, Peter Maydell a =C3=A9crit : > On 19 February 2016 at 06:32, Jean-Christophe DUBOIS > wrote: >> If I set has_el3 to false, I can boot the 4 cores without problem. Wit= h >> has_el3 set to true (default value) I am getting the above behavior (b= oot OK >> in uniprocessor mode, and misbehaving if -smp >=3D 2). > I worked out why this happens -- it's because the secondary CPUs and > the primary disagree about whether they're booting in Secure mode. > You can either: > (1) have the board code say "boot the primary in Secure mode": > --- a/hw/arm/sabrelite.c > +++ b/hw/arm/sabrelite.c > @@ -85,6 +85,7 @@ static void sabrelite_init(MachineState *machine) > sabrelite_binfo.kernel_cmdline =3D machine->kernel_cmdline; > sabrelite_binfo.initrd_filename =3D machine->initrd_filename; > sabrelite_binfo.nb_cpus =3D smp_cpus; > + sabrelite_binfo.secure_boot =3D true; > sabrelite_binfo.write_secondary_boot =3D sabrelite_write_secondar= y; > sabrelite_binfo.secondary_cpu_reset_hook =3D sabrelite_reset_seco= ndary; > > or (2) have the code in imx6_src.c tell the secondaries that > they should start in non-secure mode: > > --- a/hw/misc/imx6_src.c > +++ b/hw/misc/imx6_src.c > @@ -144,6 +144,7 @@ static void imx6_src_cpu_on(uint32_t cpuid, > uint32_t entry, uint32_t context_id) > > target_cpu->env.regs[0] =3D context_id; > target_cpu->env.thumb =3D entry & 1; > + target_cpu->env.cp15.scr_el3 |=3D SCR_NS; > > target_cpu_class->set_pc(target_cpu_state, entry); > } > > If you do either of these then the system will boot the kernel that > you sent the link to. Thanks Peter, It does work. > > To answer the question of "which of these is the correct thing to do" > we need to look at what the real hardware does when it's running Linux: > does it run Linux in Secure or Nonsecure? i.MX6 is definitively able to boot in secure/trustzone mode (there are=20 some demo out there about it) so I guess it might be booting in secure mo= de. > > thanks > -- PMM >