From nobody Sun Feb 05 06:14:05 2023 X-Original-To: uboot@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 4P8fH21Cvsz3mvkB for ; Sun, 5 Feb 2023 06:14:06 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4P8fH15pm9z3D2q for ; Sun, 5 Feb 2023 06:14:05 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675577645; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U336LcqKVhr5uSDFFKRcUEOkL5czJ9kLmPWxxb+lO0I=; b=Wnf8HlEOd34gKzLwfRX0iFa7h988fAJ8V4UJdkQlfdspcHWvtmAdGwr9/kb/h8XVEUYG7F 76Bc2HzjzLv2WXJOLQBz1i336RCIjDfXDa1DSqgtWJMsI5SIB3gcLxoq+AxtEAbyS+or8E 4ARvcWB7wSFZmHeRhPbTtlguwbezMtfDaYZWibVV1PlWXKMc1GKWVhithTFmWQQX26zYhl bRpv6BwMbjCMOZhq3LfbiVJWmgzHwUT1IPq3IUEPHc2PpBQYBekb9NL6kWdfY/bbVZp7NG Ivpr5Y5wQ4KBJwvwIqFiwvZwbbV12KWabPP2DmnA/OFRMC8HtPsjrH6QBPvxSg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675577645; a=rsa-sha256; cv=none; b=h110usif5DGdmTanmnegNu07pnWk1eHSd54bDyh+rtLy3Y8QhesDpvGjkopFoBl0rifvjp sK17h8Gjt0yZFEs29ZhAD+EXm5NZDyypCJYLwWDNuSADtksyiFawaEKmMaRqJow9Aqbij4 6yAmrUt4kUhFqxrEST9j4ZeZeP16f1PB+asIPvAk0bT1rvOVcbIUQVTNkpNFDUsxqza3Rn 2G6M9Ig0XUCtNziGmUS1hrX3Vmi9BQjpjIbw3vKTUBWcVJhbu9fCi8FCTIVgaPijAhI3IZ Q1swsenx+mLHjTCcnUHoXtKKIERlUZKqaO6iKVd3iQnrKkldmoG4PbNvDaanYg== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4P8fH14ssZzkRY for ; Sun, 5 Feb 2023 06:14:05 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 3156E5Ik047144 for ; Sun, 5 Feb 2023 06:14:05 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 3156E5mB047143 for uboot@FreeBSD.org; Sun, 5 Feb 2023 06:14:05 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: uboot@FreeBSD.org Subject: [Bug 269181] sysutils/u-boot-rpi-arm64: RPi4/8G fails to boot: "** Reading file would overwrite reserved memory **" Date: Sun, 05 Feb 2023 06:14:05 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: marklmi26-fbsd@yahoo.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: uboot@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Discussions List-Archive: https://lists.freebsd.org/archives/freebsd-uboot List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-uboot@freebsd.org X-BeenThere: freebsd-uboot@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D269181 --- Comment #2 from Mark Millard --- (In reply to Mark Millard from comment #1) Well, that was not the problem. And the problem is not specific to RPi*'s at all, through they are examples of hitting the issue. I give details of the actual problem later below, but the issue can be worked around by providing a couple of CONFIG_LMB_*'s in the fragments. Using the RPi*'s as examples: # git -C /usr/ports diff sysutils/u-boot-rpi*/files/*fragment | more diff --git a/sysutils/u-boot-rpi-0-w/files/rpi_0_w_fragment b/sysutils/u-boot-rpi-0-w/files/rpi_0_w_fragment index 56ca46fe5f31..7274e7a5f219 100644 --- a/sysutils/u-boot-rpi-0-w/files/rpi_0_w_fragment +++ b/sysutils/u-boot-rpi-0-w/files/rpi_0_w_fragment @@ -1,3 +1,5 @@ CONFIG_OF_EMBED=3Dn CONFIG_OF_BOARD=3Dy CONFIG_API=3Dy +CONFIG_LMB_USE_MAX_REGIONS=3Dy +CONFIG_LMB_MAX_REGIONS=3D64 diff --git a/sysutils/u-boot-rpi-arm64/files/rpi_arm64_fragment b/sysutils/u-boot-rpi-arm64/files/rpi_arm64_fragment index 7a61bd18844a..8cc45d6fd3bc 100644 --- a/sysutils/u-boot-rpi-arm64/files/rpi_arm64_fragment +++ b/sysutils/u-boot-rpi-arm64/files/rpi_arm64_fragment @@ -1,2 +1,4 @@ CONFIG_ENV_FAT_DEVICE_AND_PART=3D"1:1" CONFIG_RPI_EFI_NR_SPIN_PAGES=3D2 +CONFIG_LMB_USE_MAX_REGIONS=3Dy +CONFIG_LMB_MAX_REGIONS=3D64 diff --git a/sysutils/u-boot-rpi/files/rpi_fragment b/sysutils/u-boot-rpi/files/rpi_fragment index 56ca46fe5f31..7274e7a5f219 100644 --- a/sysutils/u-boot-rpi/files/rpi_fragment +++ b/sysutils/u-boot-rpi/files/rpi_fragment @@ -1,3 +1,5 @@ CONFIG_OF_EMBED=3Dn CONFIG_OF_BOARD=3Dy CONFIG_API=3Dy +CONFIG_LMB_USE_MAX_REGIONS=3Dy +CONFIG_LMB_MAX_REGIONS=3D64 diff --git a/sysutils/u-boot-rpi2/files/rpi2_fragment b/sysutils/u-boot-rpi2/files/rpi2_fragment index e5849534639e..05ca226cd650 100644 --- a/sysutils/u-boot-rpi2/files/rpi2_fragment +++ b/sysutils/u-boot-rpi2/files/rpi2_fragment @@ -2,3 +2,5 @@ CONFIG_OF_EMBED=3Dn CONFIG_OF_BOARD=3Dy CONFIG_ARMV7_NONSEC=3Dn CONFIG_EFI_GRUB_ARM32_WORKAROUND=3Dy +CONFIG_LMB_USE_MAX_REGIONS=3Dy +CONFIG_LMB_MAX_REGIONS=3D64 diff --git a/sysutils/u-boot-rpi3/files/rpi3_fragment b/sysutils/u-boot-rpi3/files/rpi3_fragment index 1dbf430f1931..dd8033f49d4e 100644 --- a/sysutils/u-boot-rpi3/files/rpi3_fragment +++ b/sysutils/u-boot-rpi3/files/rpi3_fragment @@ -2,3 +2,5 @@ CONFIG_OF_EMBED=3Dn CONFIG_OF_BOARD=3Dy CONFIG_ENV_FAT_DEVICE_AND_PART=3D"1:1" CONFIG_RPI_EFI_NR_SPIN_PAGES=3D2 +CONFIG_LMB_USE_MAX_REGIONS=3Dy +CONFIG_LMB_MAX_REGIONS=3D64 diff --git a/sysutils/u-boot-rpi4/files/rpi4_fragment b/sysutils/u-boot-rpi4/files/rpi4_fragment index 7a61bd18844a..8cc45d6fd3bc 100644 --- a/sysutils/u-boot-rpi4/files/rpi4_fragment +++ b/sysutils/u-boot-rpi4/files/rpi4_fragment @@ -1,2 +1,4 @@ CONFIG_ENV_FAT_DEVICE_AND_PART=3D"1:1" CONFIG_RPI_EFI_NR_SPIN_PAGES=3D2 +CONFIG_LMB_USE_MAX_REGIONS=3Dy +CONFIG_LMB_MAX_REGIONS=3D64 What this does is avoid a case of lack of initialization tied to lack of either of 2 types of CONFIG_LMB_* use. The details are as follows. lib/lmb.c has: /* This routine called with relocation disabled. */ static long lmb_add_region_flags(struct lmb_region *rgn, phys_addr_t base, phys_size_t size, enum lmb_flags flags) { . . . if (rgn->cnt >=3D rgn->max) return -1; /* Couldn't coalesce the LMB, so add it to the sorted table. */ . . . This code expects rgn->max to always be well defined. But note the lack of initialization of the 2 .max fields for the implicit "#else" case in: void lmb_init(struct lmb *lmb) { #if IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS) lmb->memory.max =3D CONFIG_LMB_MAX_REGIONS; lmb->reserved.max =3D CONFIG_LMB_MAX_REGIONS; #elif defined(CONFIG_LMB_MEMORY_REGIONS) lmb->memory.max =3D CONFIG_LMB_MEMORY_REGIONS; lmb->reserved.max =3D CONFIG_LMB_RESERVED_REGIONS; lmb->memory.region =3D lmb->memory_regions; lmb->reserved.region =3D lmb->reserved_regions; #endif lmb->memory.cnt =3D 0; lmb->reserved.cnt =3D 0; } I've not found other initialization of the 2 .max fields. Presuming I got that right, then for the combination: !IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS) && !defined(CONFIG_LMB_MEMORY_REGIONS) neither .max is initialized. Another possibility is that there should be a #else leading to rejection of the compile (combination invalid): #else #error . . . (In that case CONFIG_LMB_* additions would need to have landed in all the official U-Boot configs/*_defconfig files at some point. Only a small subset of such in 2023.01 of U-Boot.) There was a time when there was: void lmb_init(struct lmb *lmb) { #if IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS) lmb->memory.max =3D CONFIG_LMB_MAX_REGIONS; lmb->reserved.max =3D CONFIG_LMB_MAX_REGIONS; #else lmb->memory.max =3D CONFIG_LMB_MEMORY_REGIONS; lmb->reserved.max =3D CONFIG_LMB_RESERVED_REGIONS; lmb->memory.region =3D lmb->memory_regions; lmb->reserved.region =3D lmb->reserved_regions; #endif lmb->memory.cnt =3D 0; lmb->reserved.cnt =3D 0; } That always provided an initialization of the 2 .max fields if the code compiled. (In this form the #error mentioned earlier would not be needed in order to catch errors. But, as stands, most configs/*_defconfig files would lead to build failure for CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS being undefined.) --=20 You are receiving this mail because: You are the assignee for the bug.=