From nobody Wed Aug 25 10:51:14 2021 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 63D2A1772548 for ; Wed, 25 Aug 2021 10:51:53 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id 4GvjTj1D44z3CYC for ; Wed, 25 Aug 2021 10:51:52 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from [192.168.42.24] (cpc91232-cmbg18-2-0-cust554.5-4.cable.virginm.net [82.2.126.43]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id 124514E755; Wed, 25 Aug 2021 10:51:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fubar.geek.nz; s=mail; t=1629888675; bh=kmIQhQDYDd6qsT079PLM5cTFhHovZi1mCTMaEofYZTQ=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=WZx/HUIGl4gYe0EvJe9lSa4lX9rwbkXLbasBPATtKawWF+okENchU5Yfm6wt55Bdp vpkD3AG2qSkFNqxUV8R/v1I57vsj76nr1eYeuhpBIW8GhylDZ4GP1N96tTip+Qg/9s FFBGrsKXPfVkF6jYmR4aHEbn15CkQu9Y8t3FOZgUlpaLR+gWrbBc3OAxAWW34a8j4n Rb5pnThSC0+rYvwOkxDdl66PuAqi1/o1OUMtxiUw5Wz6Dsce6SHaNJlqXC/IGZiQdk OJ9ZlqTVEsN+Dbi99iq96INMgj4Hrfh53nT/ZawDrSmbLlRodYOXmgk2ILAlO4X7vR 3Ro0s2Fq4hjc2pBpfM9Hxf3vGLdVxn5zVwvs5jmYoU58lPk7E8vgrkEGoM8o/mgh9z 605UFecJrmMmCeKuyyKtrSv5hx2kFscpDtleI4Zhvm718xlIwehKjkZOaQyHP5lQWc zWCRUDyFIGVS6n3bBG9RtPvGhI5CeCHJr7khKW2DafB3Pm+M2U+D5U/wjo6Bvf8g8A 0r7AkQqlrqEfqVdtKN8acZARFM43cxQE94bPuS4Vzr7vXBSb0f4ergkoH4KV4l2Ckn waoexXNz3c3/qyJ1e0WxkC99KzlCYcPSnI6JKbUxCqGiGhWrr5vcxseV5UfI8Oxe4Y 2hEJBiRcjyDhB9bQSMY9Qsgk= Content-Type: text/plain; charset=utf-8 List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: FreeBSD-13.0-CURRENT on Baikal-m(aarch64) SoC From: Andrew Turner In-Reply-To: Date: Wed, 25 Aug 2021 11:51:14 +0100 Cc: Free BSD Content-Transfer-Encoding: quoted-printable Message-Id: <0B22D0E6-2510-4CE8-9DE2-E72EB1BB5665@fubar.geek.nz> References: To: Sleep Walker X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Rspamd-Queue-Id: 4GvjTj1D44z3CYC X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_RCPT(0.00)[]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N > On 25 Aug 2021, at 09:34, Sleep Walker wrote: >=20 > Hi! >=20 > I am trying to add support for the new SoC Baikal-M in FreeBSD. > https://www.baikalelectronics.com/products/338/ > = https://www.cnx-software.com/2021/08/10/desktop-and-all-in-one-arm-linux-c= omputers-launched-with-baikal-m-processor/ >=20 > The system is already starting in multi-user mode, but only one core = out of > eight is detected. > To find out the reason, I slightly changed the code by adding the = output of > the error code. > sys/arm64/arm64/mp_machdep.c > = --------------------------------------------------------------------------= ----------------------------------------------- > printf("Starting CPU %u (%lx)\n", cpuid, target_cpu); > pa =3D pmap_extract(kernel_pmap, (vm_offset_t)mpentry); > err =3D psci_cpu_on(target_cpu, pa, cpuid); >=20 > if (err !=3D PSCI_RETVAL_SUCCESS) { > printf("Starting CPU %u (%lx) psci_cpu_on return = (%d)\n", > cpuid, target_cpu, err); > /* > * Panic here if INVARIANTS are enabled and PSCI failed = to > * start the requested CPU. psci_cpu_on() returns > PSCI_MISSING > * to indicate we are unable to use it to start the = given > CPU. > */ > KASSERT(err =3D=3D PSCI_MISSING || > (mp_quirks & MP_QUIRK_CPULIST) =3D=3D = MP_QUIRK_CPULIST, > ("Failed to start CPU %u (%lx), error %d\n", > cpuid, target_cpu, err)); > pcpu_destroy(pcpup); > kmem_free((vm_offset_t)dpcpu[cpuid - 1], DPCPU_SIZE); > dpcpu[cpuid - 1] =3D NULL; > kmem_free((vm_offset_t)bootstacks[cpuid], PAGE_SIZE); > bootstacks[cpuid] =3D NULL; > mp_ncpus--; > return (false); > } > = --------------------------------------------------------------------------= ------------------------------------------------ > I got the following log > --------------------------------- > Starting CPU 1 (1) > Starting psci_cpu_on(1, f22008c8, 1) > Starting CPU 1 (1) psci_cpu_on return (-9) > Starting CPU 1 (100) > Starting psci_cpu_on(100, f22008c8, 1) > Starting CPU 1 (100) psci_cpu_on return (-9) > Starting CPU 1 (101) > ...... > ---------------------------------- The firmware thinks this address is invalid. =46rom the version of the = Trusted Firmware-A I found it checks if the address is within one of the = three DRAM banks and not within the secure region. These two checks = should pass. It then tries to read the fdt memory node and check if the = address is within one of the regions it provides. It can also file if it = is unable to read this node, or the entry point is not within one of the = memory regions the node describes. Are you able to get a dump of the /memory@80000000 node from the = firmware? e.g. from loader.efi the following commands should work = (assuming it=E2=80=99s passed into loader by the firmware): fdt cd /memory@80000000 fdt prop Andrew