From nobody Sun Dec 25 02:55:10 2022 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 4Nfls72rKhz1HwWS for ; Sun, 25 Dec 2022 02:55:23 +0000 (UTC) (envelope-from hiroo.ono@gmail.com) Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Nfls65Mm3z3sjF for ; Sun, 25 Dec 2022 02:55:22 +0000 (UTC) (envelope-from hiroo.ono@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=dmI4yhOM; spf=pass (mx1.freebsd.org: domain of hiroo.ono@gmail.com designates 2607:f8b0:4864:20::431 as permitted sender) smtp.mailfrom=hiroo.ono@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pf1-x431.google.com with SMTP id c7so5522545pfc.12 for ; Sat, 24 Dec 2022 18:55:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :reply-to:in-reply-to:references:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=ZU0OVwnYeccp0t9WoxmDgpzCkursM/mY30INCDNwlGw=; b=dmI4yhOMG0hSunTZbZMFREVGK1q+/lUenxGQh08cbTwKwSHaeaZDjgNj5eMUlBVvq8 +YIT+kefkKW90B9WHUpROl3miHhPkJ2b7ptOOvCmJnG5T388BFy/NcKmh8tXq7TqH6Y6 AUp2rVoiwf2bo3DQcBc029lVQF9icarWIAIJ1uxkZr+KuisYO7BmjME4LJHo0WemO+jq hTbZoW6CP1jkOR3+HOukdamGGhFdo+v//f/Dz+5BZfYIgGTHy17RWvUZqPr94YyS7559 Q7sojKR/DoSemXyPz3U8w0P632PZaBi+rpoAlfhQVVfhdrCkis/FgNaXg+trSpgranaM Z/KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :reply-to:in-reply-to:references:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ZU0OVwnYeccp0t9WoxmDgpzCkursM/mY30INCDNwlGw=; b=tDDqVgmpVadV63KJTLHbMjdB28FDSCLFWqGBb9a0ph74czuQSUvW+4ov7cCTDiOaZX QqPmRaQX8ZqKgvCCzDdOYMriFFWcWSbrGNWCkR/5vfkqdnHOjbKTnH155CrzShfNthst xkpLWhU0u6onp1GBman+tqIz+bn/hsgZ+AXJvkt07aqT/VvLDztqs0lEgWCJgDx6wJiH ouGNQH/xQWo52U4am+jENYiJa8Sov4qNp6kVSoqXJzIEiTFv0Edw2AsEQynD2uQybWKC k/AS5BfJxakMk8QSZtM866G5y3EyTrsuU2Xw5AojRPRDAaDJwBV8YiUsvvSFc3Y4WjKz w8/A== X-Gm-Message-State: AFqh2koEwlGmjPlqAVACj3IS4fEBxP6epFioYwwjyQDKsHnfNPokHnqR vwqy1nFj6RnwqWLSO+Ekxw1l6BOkIwWjq+vlSOmnD079mIc= X-Google-Smtp-Source: AMrXdXuDYlsfgm6uX4zjXwmbcnva2XT8/TL/X2BGTztoXG7UTdr0smtVKEF7j53hPBWtjm1uKFs119XvL4jQ+W1zDHU= X-Received: by 2002:a63:571d:0:b0:478:d3a8:6ba5 with SMTP id l29-20020a63571d000000b00478d3a86ba5mr649631pgb.619.1671936921467; Sat, 24 Dec 2022 18:55:21 -0800 (PST) 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 References: In-Reply-To: Reply-To: hiroo.ono+freebsd@gmail.com From: =?UTF-8?B?SGlyb28gT25vICjlsI/ph47lr5vnlJ8p?= Date: Sun, 25 Dec 2022 11:55:10 +0900 Message-ID: Subject: Re: Still did not succeed to boot on Lenovo Yoga C630 To: Warner Losh Cc: Mark Millard , freebsd-arm@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.31 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998]; NEURAL_HAM_LONG(-0.85)[-0.848]; NEURAL_SPAM_SHORT(0.54)[0.536]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; MIME_GOOD(-0.10)[text/plain]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; HAS_REPLYTO(0.00)[hiroo.ono+freebsd@gmail.com]; FREEMAIL_REPLYTO(0.00)[gmail.com]; MLMMJ_DEST(0.00)[freebsd-arm@freebsd.org]; PREVIOUSLY_DELIVERED(0.00)[freebsd-arm@freebsd.org]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::431:from]; TO_MATCH_ENVRCPT_SOME(0.00)[]; ARC_NA(0.00)[]; RCVD_TLS_LAST(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; REPLYTO_ADDR_EQ_FROM(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DKIM_TRACE(0.00)[gmail.com:+]; MIME_TRACE(0.00)[0:+]; TAGGED_FROM(0.00)[freebsd]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FREEMAIL_ENVFROM(0.00)[gmail.com]; FREEMAIL_CC(0.00)[yahoo.com,freebsd.org] X-Rspamd-Queue-Id: 4Nfls65Mm3z3sjF X-Spamd-Bar: -- X-ThisMailContainsUnwantedMimeParts: N Equivalent change by Allan Jude is under review. https://reviews.freebsd.org/D37766 I have already tried this change, but it did not succeeded for me. https://reviews.freebsd.org/D37765 2022=E5=B9=B412=E6=9C=8824=E6=97=A5(=E5=9C=9F) 22:18 Hiroo Ono (=E5=B0=8F= =E9=87=8E=E5=AF=9B=E7=94=9F) : > > Sorry again. > The patch is needed for > * stand/efi/loader/arch/arm64/start.S > * stand/efi/loader/arch/arm64/ldscript.arm64 > * stand/efi/loader/Makefile > > I forgot the last one. I remade the patch for three. > > 2022=E5=B9=B412=E6=9C=8824=E6=97=A5(=E5=9C=9F) 22:11 Hiroo Ono (=E5=B0=8F= =E9=87=8E=E5=AF=9B=E7=94=9F) : > > > > 2022=E5=B9=B412=E6=9C=8824=E6=97=A5(=E5=9C=9F) 10:35 Hiroo Ono (=E5=B0= =8F=E9=87=8E=E5=AF=9B=E7=94=9F) : > > > > > > > I run other arm64 machines w/o issue with the current code. > > > > > > Yes, Qualcomm's snapdragon is weird. I saw Linux people complain abou= t > > > it somewhere... Wanted to know before I bought this Yoga C630. > > > > > > 2022=E5=B9=B412=E6=9C=8824=E6=97=A5(=E5=9C=9F) 10:03 Warner Losh : > > > > > > > > > > > > > > > > On Fri, Dec 23, 2022 at 5:49 PM Hiroo Ono (=E5=B0=8F=E9=87=8E=E5=AF= =9B=E7=94=9F) wrote: > > > >> > > > >> The current status of FreeBSD 14-current on Lenovo Yoga C630 is as= follows: > > > >> > > > >> 1) Merging from OpenBSD's loader code made the loader boot apart = from > > > >> 3 points (#2 to 4 ). > > > >> 2) when comconsole->c_init() runs the 2nd time, it seems to freez= e. > > > >> (might be C630 specific) > > > >> 3) SetVirtualAddressMap() in efi_do_vmap() freezes. (might also > > > >> affect other snapdragon systems like Microsoft Arm Developer Kit) > > > >> 4) The kernel is kicked but does not start. > > > >> > > > >> 1) is quite straightforward. What needs to be changed is > > > >> stand/efi/loader/arch/arm64/start.S. > > > > > > > > > > > > Can you share what needs to be done? To my eye, we don't need any c= hanges, so it would be good to know what you've had to do exactly. > > > > > > Attached is the diff to start.S. There are 3 points. > > > 1) The loader has to be aligned to 4kb. > > > 2) Proper characteristic value should be in the PE header. > > > 3) .text and .data segment have to be separate. > > > > > > It is from OpenBSD: > > > https://github.com/openbsd/src/blob/master/sys/arch/arm64/stand/efibo= ot/start.S > > > > Sorry patch to ldscript.arm64 was missing. > > I am going to test your serial patch now. > > > > > > > >> For 2), I do not know what to do. Currently, I commented out > > > >> comconsole from struct console *consoles[] in stand/efi/loader/con= f.c > > > >> as a workaround. Maybe, I should write a fault handler that helps > > > >> returning from the fault. > > > > > > > > > > > > There were problems with this with HyperV on aarch64 too. > > > > > > > > Something like > > > > diff --git a/stand/efi/loader/efiserialio.c b/stand/efi/loader/efis= erialio.c > > > > index 8b3f8e83e0b3..54ee39096685 100644 > > > > --- a/stand/efi/loader/efiserialio.c > > > > +++ b/stand/efi/loader/efiserialio.c > > > > @@ -261,11 +261,11 @@ comc_probe(struct console *sc) > > > > if (comc_port =3D=3D NULL) > > > > return; > > > > } > > > > - comc_port->baudrate =3D COMSPEED; > > > > + comc_port->baudrate =3D 0; > > > > comc_port->ioaddr =3D 0; /* default port *= / > > > > - comc_port->databits =3D 8; /* 8,n,1 */ > > > > - comc_port->parity =3D NoParity; /* 8,n,1 */ > > > > - comc_port->stopbits =3D OneStopBit; /* 8,n,1 */ > > > > + comc_port->databits =3D 0; /* 8,n,1 */ > > > > + comc_port->parity =3D 0; /* 8,n,1 */ > > > > + comc_port->stopbits =3D 0; /* 8,n,1 */ > > > > comc_port->ignore_cd =3D 1; /* ignore cd */ > > > > comc_port->rtsdtr_off =3D 0; /* rts-dtr is on = */ > > > > comc_port->sio =3D NULL; > > > > > > > > was needed. Possibly the following would be better: > > > > > > > > diff --git a/stand/efi/loader/efiserialio.c b/stand/efi/loader/efis= erialio.c > > > > index 8b3f8e83e0b3..54ee39096685 100644 > > > > --- a/stand/efi/loader/efiserialio.c > > > > +++ b/stand/efi/loader/efiserialio.c > > > > @@ -494,8 +494,7 @@ comc_setup(void) > > > > return (false); > > > > > > > > status =3D comc_port->sio->SetAttributes(comc_port->sio, > > > > - comc_port->baudrate, 0, 0, comc_port->parity, > > > > - comc_port->databits, comc_port->stopbits); > > > > + 0, 0, 0, 0, 0, 0); > > > > if (EFI_ERROR(status)) > > > > return (false); > > > >