From nobody Sat Jan 29 15:12:58 2022 X-Original-To: freebsd-riscv@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 C12051987F2C for ; Sat, 29 Jan 2022 15:13:32 +0000 (UTC) (envelope-from jakob@alvermark.net) Received: from out.alvermark.net (out.alvermark.net [185.34.136.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4JmHs76J7Bz3hwn; Sat, 29 Jan 2022 15:13:31 +0000 (UTC) (envelope-from jakob@alvermark.net) Received: from c-e841235c.06-431-73746f70.bbcust.telenor.se ([92.35.65.232] helo=mail.alvermark.net) by out.alvermark.net with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91 (FreeBSD)) (envelope-from ) id 1nDpPo-000KVd-7L; Sat, 29 Jan 2022 16:13:24 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=alvermark.net; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: From:References:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=bVeMWXCgTHiKhd18CHigSeafTg7ZsWGDYrOY4mIPLbU=; b=EUPBhSl6ULr1HMrslaUxCEQvOL IyWLhEUPwR7/VVxVU8vi65tqvCf6r/r1Bie1vPod4rKUYSDAn32Y7WzjlBeCpuYeZmzHe7UZPSWGv 5sR9Vm0F9P71fXVIsWINNnjteuWd4pozds5Hb4jfq8LZ9eMkG3mxaUZ1SYl80ZQNOaisYfg10O40S 5qez0QXVHUxLsl+HduMn7bykg4PxqObGe6Ebi/KI7JXzPoDlfxD5xblF1a66wfsaLGl6cdxNea8n7 eowKnwSMzRLlvfoYUNRlsu1HXTUpul61Zz6+qjPkUODlXPQgZkgXe9KsnZKMWw1eUCAXy/XaO1lVm 0Ie65YOg==; Received: from [192.168.67.27] by mail.alvermark.net with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91 (FreeBSD)) (envelope-from ) id 1nDpPO-000PzN-H4; Sat, 29 Jan 2022 16:12:58 +0100 Message-ID: <18b735fb-fd36-daad-9ee7-974ff1955400@alvermark.net> Date: Sat, 29 Jan 2022 16:12:58 +0100 List-Id: FreeBSD on the RISC-V instruction set architecture List-Archive: https://lists.freebsd.org/archives/freebsd-riscv List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-riscv@freebsd.org X-BeenThere: freebsd-riscv@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: Sipeed Lichee RV (Allwinner D1) Content-Language: en-US To: Mitchell Horne , freebsd-riscv@FreeBSD.org References: <5a74bd6d-4000-c413-02e2-33608f9ae683@freebsd.org> From: Jakob Alvermark In-Reply-To: <5a74bd6d-4000-c413-02e2-33608f9ae683@freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4JmHs76J7Bz3hwn X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=alvermark.net header.s=x header.b=EUPBhSl6; dmarc=none; spf=pass (mx1.freebsd.org: domain of jakob@alvermark.net designates 185.34.136.138 as permitted sender) smtp.mailfrom=jakob@alvermark.net X-Spamd-Result: default: False [-3.49 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[alvermark.net:s=x]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:185.34.136.138]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[alvermark.net: no valid DMARC record]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[alvermark.net:+]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_SHORT(-0.99)[-0.991]; MLMMJ_DEST(0.00)[freebsd-riscv]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:34971, ipnet:185.34.136.0/23, country:IT]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-ThisMailContainsUnwantedMimeParts: N On 1/28/22 16:29, Mitchell Horne wrote: > On 1/19/22 18:05, Jakob Alvermark wrote: >> >> On 1/19/22 17:24, Mitchell Horne wrote: >>> >>> >>> On 1/17/22 15:02, Jakob Alvermark wrote: >>>> Hi, >>>> >>>> >>>> With RISC-V SBCs now coming down in price, I got curios and got >>>> myself a Lichee RV (with the dock). >>>> >>>> https://linux-sunxi.org/Sipeed_Lichee_RV >>>> >>>> The instructions here, https://linux-sunxi.org/Allwinner_Nezha >>>> along with some patching got me a working U-boot. >>>> >>>> Cross-building and putting together and image for and SD card got >>>> me this far: >>>> >> >>>> Loading kernel... >>>> /boot/kernel/kernel text=0x609ddc text=0x133abc data=0xf4420 >>>> data=0xb54+0x1d73e4 syms=[0x8+0xcd188+0x8+0xee5ae] >>>> Loading configured modules... >>>> can't find '/etc/hostid' >>>> can't find '/boot/entropy' >>>> Using DTB provided by EFI at 0x47ef5000. >>>> Kernel entry at 0x56a0002e... >>>> Kernel args: (null) >>>> >>>> ----- >>>> >>>> And here it stops forĀ  ~16 seconds then restarts, that's the >>>> watchdog resetting it. >>>> >>>> So where do I go from here? >>>> >>> Hi Jakob, >>> >>> Looks like it bails somewhere in the initial kernel setup, before >>> the first output to the console. This is a wide range, so it's >>> difficult to say exactly where things are going wrong. >>> >>> I will say that generally FreeBSD is not expected to work on the D1; >>> as far as I know you are the first to try it. This hardware has some >>> quirks requiring special support, which we are entirely lacking. >>> Specifically, there is one related to virtual memory management, >>> which requires custom (spec-breaking) bits in the page tables to be >>> set, to properly specify the attributes of physical and device >>> memory. This _may_ have something to do with why it is failing where >>> it is. It would take a motivated party to add the support required >>> for this SoC, and I'm not aware of anyone currently taking this on. >>> This board has caused some headaches in Linux-land for the same >>> reasons, but there are more hands to do the work there. I just want >>> to set the expectations properly :) >>> >>> If you wanted to debug this further, you might rebuild the kernel >>> after adding 'options EARLY_PRINTF' to the config file, as this >>> should enable a couple early outputs and narrow down the search >>> slightly. >> >> >> Hi Mitchell, >> >> >> I did not expect it to work. But it would be nice if it did. >> >> I have a long experience with FreeBSD and I have played around with a >> couple of different ARM-boards, but I'm not very experienced with >> kernel hacking. >> >> I built a kernel with EARLY_PRINTF, but it did not give me any more >> output... >> >> Is there anything else I could try? >> > > Yes, I missed an important detail: the required uart driver is missing > from the kernel. Please add 'device uart_snps' to the kernel config as > well, and see if this results in any output. Hi, I tried that, but sadly it did not make any difference. I looked at what they have done in Linux, and this commit seems to have some interesting bits: https://github.com/smaeul/linux/commit/c1bc61cee73e236c3cd69fe6c998b7f80c654263#diff-4f4bb4eea826b523d76ddb1c539dad5685a0e7fd7cc8f1089a0493efd0e8e5b8 Jakob