From nobody Sat Dec 24 13:11:30 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 4NfPZm402tz1LqVS for ; Sat, 24 Dec 2022 13:11:44 +0000 (UTC) (envelope-from hiroo.ono@gmail.com) Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) (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 4NfPZl5lqrz4Mhj for ; Sat, 24 Dec 2022 13:11:43 +0000 (UTC) (envelope-from hiroo.ono@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=Q9WNgEOU; spf=pass (mx1.freebsd.org: domain of hiroo.ono@gmail.com designates 2607:f8b0:4864:20::630 as permitted sender) smtp.mailfrom=hiroo.ono@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pl1-x630.google.com with SMTP id d7so7184629pll.9 for ; Sat, 24 Dec 2022 05:11:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=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=hX/dRxKz1LwuyA5V/TbUeuj753BmlFUQ89+05nbqv5s=; b=Q9WNgEOUtIa/NHx6GtW7ff4DMAw6Bnjtba111mMyW2n7sE1aU9qbVWB8DYCz5GyMOY HE1C41FPfhWJ9nRLg6UTmWP6tnDCKwtE8fQIUhalCdrVvP47DHODM3b/OJxxj3ge2sVL S26U7r3jOaWYSKWxiUjEAkO7kz6zDv85pVAZOAZM+ecic68dZ4O0/IwnzmmBrnla+vPn pDe/c9eKqXn5m8u0KV+rCfgIbKWvHSqksnyWZhvtHP6j3evaW+b78V+6CqMr+ptFXzeG 6YdmV2dNQ0YMvt61Zb4peG49yTnAaXEvNbtE2BCA6yxnwCaSgHd8mvZtnpmk4YFI98X0 byYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=hX/dRxKz1LwuyA5V/TbUeuj753BmlFUQ89+05nbqv5s=; b=de9F72ngF1LzMmJjaNU7tl9H1LJf9C738kHiM60/svJKKx0m8b54SE5N+qycAcanCR LXxO4biOOkaOx59jQfziJO5aZ/yPYJhr+1AQfHfjSHEY/JeNrcl+0vTPx7L/ERKth/qi meXB+K2Xdd3YFmJrSGfcCpjl/kPoJCKfxXaytiGdHDACOHXhyWMAY/N2JTD9U0v/r95R 1r88yEvjrYqpRIkZ6QwQEos4OsLRWB9uN6x1Ws9CXY8fzYA9MgMNXZpaD+H5C6yf4pS1 6UIsce3/0HqMzFi36rR/P+QgeYNX++ijE0RsQfB8EkFChzbaXT/fEfGqbrPIH7vl0OJR lOmg== X-Gm-Message-State: AFqh2kqGvKKTbctUvZ8EBSDZaLQ3oAe4VUj5tV4fZk6Kv8KLDY9/CBbd pFMt3ZAO5KpvcomMxrMw1KAIFGz9sxjb2XBIatU= X-Google-Smtp-Source: AMrXdXtiFLMc/lfJiQv1verkGMV0y/YCueW0XUmplyy+CdcoLF2OJvFa4XZMz35gGHDUK6S0YvB/hG6qphJ2O6erCQU= X-Received: by 2002:a17:903:2616:b0:189:e07f:933d with SMTP id jd22-20020a170903261600b00189e07f933dmr869400plb.7.1671887502582; Sat, 24 Dec 2022 05:11:42 -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: Sat, 24 Dec 2022 22:11:30 +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: multipart/mixed; boundary="000000000000b2a68705f092a4bc" X-Spamd-Result: default: False [-1.25 / 15.00]; MIME_BASE64_TEXT_BOGUS(1.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-0.999]; NEURAL_SPAM_SHORT(0.65)[0.653]; 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_BASE64_TEXT(0.10)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain]; RCPT_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; 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::630:from]; TO_MATCH_ENVRCPT_SOME(0.00)[]; ARC_NA(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; RCVD_COUNT_TWO(0.00)[2]; REPLYTO_ADDR_EQ_FROM(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; HAS_ATTACHMENT(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; RCVD_TLS_LAST(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; MIME_TRACE(0.00)[0:+,1:+,2:+]; 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: 4NfPZl5lqrz4Mhj X-Spamd-Bar: - X-ThisMailContainsUnwantedMimeParts: N --000000000000b2a68705f092a4bc Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 about > 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 fol= lows: > >> > >> 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 freeze. > >> (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 chang= es, 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/efiboot/s= tart.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/conf.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/efiseria= lio.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/efiseria= lio.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); > > --000000000000b2a68705f092a4bc Content-Type: text/plain; charset="US-ASCII"; name="stand_ldscript.diff.txt" Content-Disposition: attachment; filename="stand_ldscript.diff.txt" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lc1ym6580 ZGlmZiAtLWdpdCBhL3N0YW5kL2VmaS9sb2FkZXIvYXJjaC9hcm02NC9sZHNjcmlwdC5hcm02NCBi L3N0YW5kL2VmaS9sb2FkZXIvYXJjaC9hcm02NC9sZHNjcmlwdC5hcm02NAppbmRleCBkMGVkMzIw YTMxOWMuLjhhYmY0MTA0MjczZSAxMDA2NDQKLS0tIGEvc3RhbmQvZWZpL2xvYWRlci9hcmNoL2Fy bTY0L2xkc2NyaXB0LmFybTY0CisrKyBiL3N0YW5kL2VmaS9sb2FkZXIvYXJjaC9hcm02NC9sZHNj cmlwdC5hcm02NApAQCAtMTYsNyArMTYsOSBAQCBTRUNUSU9OUwogICAgICooLmdudS53YXJuaW5n KQogICAgICooLnBsdCkKICAgfSA9MHhENDIwMDAwMAotICAuID0gQUxJR04oMTYpOworICAuID0g QUxJR04oNDA5Nik7CisgIF9ldGV4dCA9IC47CisgIF9fZGF0YV9zdGFydCA9IC47CiAgIC5kYXRh CQk6IHsKICAgICAqKC5yb2RhdGEgLnJvZGF0YS4qIC5nbnUubGlua29uY2Uuci4qKQogICAgICoo LnJvZGF0YTEpCkBAIC03NywxMCArNzksMTEgQEAgU0VDVElPTlMKICAgLnJlbG9jCTogeyAqKC5y ZWxvYykgfQogICAuID0gQUxJR04oMTYpOwogICAuZHluc3ltCTogeyAqKC5keW5zeW0pIH0KKyAg LmR5bnN0cgk6IHsgKiguZHluc3RyKSB9CiAgIF9lZGF0YSA9IC47CisgIF9fZGF0YV9zaXplID0g LiAtIF9fZGF0YV9zdGFydDsKIAogICAvKiBVbnVzZWQgc2VjdGlvbnMgKi8KICAgLmludGVycAk6 IHsgKiguaW50ZXJwKSB9Ci0gIC5keW5zdHIJOiB7ICooLmR5bnN0cikgfQogICAuaGFzaAkJOiB7 ICooLmhhc2gpIH0KIH0K --000000000000b2a68705f092a4bc--