From owner-freebsd-arm@freebsd.org Tue Aug 11 20:57:11 2020 Return-Path: Delivered-To: freebsd-arm@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 055CE3B7070 for ; Tue, 11 Aug 2020 20:57:11 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic313-14.consmr.mail.bf2.yahoo.com (sonic313-14.consmr.mail.bf2.yahoo.com [74.6.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BR4s200NSz42wk for ; Tue, 11 Aug 2020 20:57:09 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: Hp_UhJ8VM1nITslkTgEV5H93evW52TzcQwDHUrvoTrj5DcoaOW9r_7MsVaMMxAE 9RrCLr_9uxMajr74lswvbcUtlQIBo9lV_Oot5cOMgMS58k9WO0nY6ZNcYSKG5otkqoyjok7_xuy2 NjFJ82HkEvLk.S9KziuYj1VA4YLpr8UOxA9hrBvWJnBglFTpe6wdYsyq2yWGQFcX2XocbjMTllaP KeXEaSf5hxFEss9hha46UU3oz8wuPzeEahA_Y.DQ41TOadUFDV.w9sORO8nzKMNKWePa_Nil_p6y jjOMP5hnywa8nkeJQ488STrfjasuHvt0RQjY7GiqOWdjpNFcurfqxsp_yA86Kr3KEWFBMx9XZoqQ yMl.W7AcwyO9c_uTt_rsrw2PvXwtgh_zs2QUX6pJW8JmrPTqBY7U6JFJcMfoybtn2gjQvOrOdVWo K4CvLdlUnTAFl4pJc0BLPY.vF1Vu3T0Rz8Moy0D3yzR.PRJt_nw_PKEP2nKOMHKCWm.cL0_weKvC 3XJTuFYromZwevrLnFqzVMUwlxnXIsdfgZXtHKFHnLCRA6LLCaBjuQHkqb0AyBE2euoFV0966ziF F7zlaQB1p6NJAg0LdibdIk28H7Em1OhuDx2I1G6UzwFnLSAzlDCGFwNQJAw26C6CO7bdkvrXmmGE MYRMuoSNx6zDmKg96vLkLb1rL.a9mdpZu6AJr.ZXJWrV5HSiJ7Tqen8LChiazB3xLATDYX3vCnXf MepaF7IcRKYojjkaG6S2KoRJYzP7nw4N3gnH05um0XWFf71rzQDoYCaxpZCRaxXp5suyONcghYxO 03JwWl5H8OyaaDE_afBUWzHoyv8tiaJqbvNxauP0o4XFqK7UmaHAjulC8zMeaigazmML5BEc81uc bCoFTBo6N5ITlESDtkcbZe7w22Ikm87fNZAAcA9qzfOXIXGJ6OhJ_r_o3Zy1DYH07UVNGM72kfVg N0_fQaOl7FHnkr5Gd89qwgMB2P.HNg.R1xQf8eEOALn9OBxwsd4eeYF7gzNYvcD_zm1sexCoYbNV O1EDLJxmJbaHyommA1SgVWRPwUJQofhXJv_FpK42ItHSvuSCMd_B7.pnEhSA.8.qSgluhGgbwNYF EPBYnh1C1EY80FtsXKqT3gEp5hQG6PhqBsxjBpCZgB16UsWf1143IQnSzsulAHqXoxCChIe9N7yV SWIlDzrXKreU3XK2hAM0zKyp0Y8fsHVvsud.fN.SxwAE.i8inj_6y0eI_DhQ0GSbaZH1Ozd4x1Kh 64SUDYJujMJRT2sN5r_nomLjPmf_WB1bF4qcwCD7OwwSAFti8PH4mRtaC.Z4sI521M99XgMidt08 D.VAOWoNmVuwqENFR1ElBqTcD0n7bm10ip5FLOmiK5HDJWNYH.c74KPaTCv3cuexpZhaDECwfAj_ IJec2HNBWpVokdAlcESNiFlSFBOV5_KWRFjH6Ivw0321RHmKJUR19EhMPgJWafSl75ISVPg-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.bf2.yahoo.com with HTTP; Tue, 11 Aug 2020 20:57:09 +0000 Received: by smtp425.mail.bf1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 49c6d330bcfeba439dfa4775ca0fd097; Tue, 11 Aug 2020 20:57:08 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) Subject: Re: RPi4B only allocates 1GB instead of 4GB From: Mark Millard In-Reply-To: <20200811194713.GA54090@lion.0xfce3.net> Date: Tue, 11 Aug 2020 13:57:06 -0700 Cc: freebsd-arm@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <40AFD587-9BC9-457E-8DB4-F33E78861614@yahoo.com> References: <20200811194713.GA54090@lion.0xfce3.net> To: Gordon Bergling X-Mailer: Apple Mail (2.3608.120.23.2.1) X-Rspamd-Queue-Id: 4BR4s200NSz42wk X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.62 / 15.00]; RCVD_TLS_LAST(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; RWL_MAILSPIKE_POSSIBLE(0.00)[74.6.133.124:from]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; NEURAL_HAM_LONG(-1.01)[-1.008]; NEURAL_HAM_MEDIUM(-1.04)[-1.044]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[yahoo.com:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[74.6.133.124:from]; NEURAL_HAM_SHORT(-1.07)[-1.066]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:26101, ipnet:74.6.128.0/21, country:US]; RCVD_COUNT_TWO(0.00)[2]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim] X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Aug 2020 20:57:11 -0000 On 2020-Aug-11, at 12:47, Gordon Bergling wrote: > I am currently working on an issue [1] of FreeBSD regarding the memory = allocation > on the RPi4B. I have a 4GB model running a very recent version of = -CURRENT, > but FreeBSD only recognizes 1GB instead of the installed 4GB of = memory. >=20 > I spent some time today looking through the general determination of = physical=20 > memory in FreeBSD in sys/vm/vm_phys.c, but my initial try to simply = the issue > by building a kernel without NUMA support wasn't that successful. >=20 > The next part I was thinking about was the firmware -> kernel = interface, lets > say UEFI vs. 'plain u-boot'. But after the study of information I = found on the > net, that is a far different story, compared to read C-sources. >=20 > Has anyone a RPi4 or RPi4B with memory !=3D 1GB, who could verify that = issue? >=20 > I found some information on a chinese website where somebody posted a = dmesg > output of FreeBSD 13-CURRENT on an RPi4B (8 GB version) where the = memory > allocation was correct. >=20 I've access to both 4 GiBYTe and 8 GiByte RPi4B's. I've had no trouble with RAM size being recognized at any time. As stands, I've got head -r363590 in use. But, be warned, FreeBSD does not correctly handle DMA for > 3 GiByte yet. The only stable environment I've had for FreeBSD has been UEFI/ACPI with the selection to limit RAM to 3 GiBytes. For 4 GiByte+ I would have various 4K pages written to the USB SSD that had the wrong content. Copying a huge file and then diffing the copies seemed to be guaranteed to fail. (I generally picked "huge" to be more than then amount of RAM.) Both UEFI/ACPI and u-boot for this. I'll note that I do some cross-checking by also running NetBSD (also via UEFI/ACPI). In that context I've had no troubles with allowing the actual RAM size. For the FreeBSD UEFI/ACPI boots, I use a USB Ethernet device, not the built in. The built-in and the sdcard slot are ignored still for the UEFI/ACPI context. (They work on NetBSD.) =46rom your dmesg report: Type Physical Virtual #Pages Attr Reserved 000000000000 0 00000002 WB=20 ConventionalMemory 000000002000 2000 00007ef0 WB=20 BootServicesData 000007ef2000 7ef2000 0000001c WB=20 ConventionalMemory 000007f0e000 7f0e000 00029f81 WB=20 BootServicesData 000031e8f000 31e8f000 00000001 WB=20 LoaderData 000031e90000 31e90000 00008001 WB=20 LoaderCode 000039e91000 39e91000 000000aa WB=20 Reserved 000039f3b000 39f3b000 00000007 WB=20 BootServicesData 000039f42000 39f42000 00000001 WB=20 Reserved 000039f43000 39f43000 00000002 WB=20 RuntimeServicesData 000039f45000 39f45000 00000001 WB RUNTIME Reserved 000039f46000 39f46000 00000001 WB=20 BootServicesData 000039f47000 39f47000 00000002 WB=20 RuntimeServicesData 000039f49000 39f49000 00000002 WB RUNTIME LoaderData 000039f4b000 39f4b000 00001405 WB=20 RuntimeServicesCode 00003b350000 3b350000 00000010 WB RUNTIME LoaderData 00003b360000 3b360000 000000a0 WB=20 MemoryMappedIO 0000fe100000 fe100000 00000001 RUNTIME Physical memory chunk(s): 0x00002000 - 0x39f3afff, 927 MB ( 237369 pages) 0x39f42000 - 0x39f42fff, 0 MB ( 1 pages) 0x39f45000 - 0x39f45fff, 0 MB ( 1 pages) 0x39f47000 - 0x3b34ffff, 20 MB ( 5129 pages) 0x3b360000 - 0x3b3fffff, 0 MB ( 160 pages) Excluded memory regions: 0x00000000 - 0x00001fff, 0 MB ( 2 pages) NoAlloc=20 0x32000000 - 0x33392fff, 19 MB ( 5011 pages) NoAlloc=20 0x39f3b000 - 0x39f41fff, 0 MB ( 7 pages) NoAlloc=20 0x39f43000 - 0x39f46fff, 0 MB ( 4 pages) NoAlloc=20 0x39f49000 - 0x39f4afff, 0 MB ( 2 pages) NoAlloc=20 0x3b350000 - 0x3b35ffff, 0 MB ( 16 pages) NoAlloc=20 0x3e513000 - 0x3ebebfff, 6 MB ( 1753 pages) NoAlloc=20 0xfe100000 - 0xfe100fff, 0 MB ( 1 pages) NoAlloc=20 That means that nothing later in FreeBSD is going to see more RAM. May be u-boot or UEFI can report the amount of RAM it finds? If it is 1 GiByte at such an early stage, later stages are not likely to find more. If UEFI/ACPI finds 1 GiByte, a NetBSD test would likely agree. (Same type of staging issue.) =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)