From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.3616.1599853717604881388 for ; Fri, 11 Sep 2020 12:48:38 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: jeremy.linton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D248F1063; Fri, 11 Sep 2020 12:48:34 -0700 (PDT) Received: from [192.168.122.166] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 955C03F73C; Fri, 11 Sep 2020 12:48:34 -0700 (PDT) Subject: Re: [PATCH] Platform/RaspberryPi4: Correct thermal offset To: Pete Batard , devel@edk2.groups.io Cc: leif@nuviainc.com, awarkentin@vmware.com, ard.biesheuvel@arm.com References: <20200909231100.213015-1-jeremy.linton@arm.com> <45629083-0365-609b-a777-71062a15f0dd@akeo.ie> From: "Jeremy Linton" Message-ID: <5907930d-1490-9200-b094-4cd8e3770fe3@arm.com> Date: Fri, 11 Sep 2020 14:48:34 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <45629083-0365-609b-a777-71062a15f0dd@akeo.ie> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable Hi, On 9/11/20 1:13 PM, Pete Batard wrote: > It might be worth sourcing public documentation, if you have any,=20 > indicating where these numeric values ultimately come from (the offset=20 > for absolute zero is easy to figure out, but the rest, not so much). I'm only privy to things that can be found with a google search. So at the moment I'm not aware of proper first party documentation on=20 the thermal sensor. So=20 https://elixir.bootlin.com/linux/v5.9-rc4/source/arch/arm/boot/dts/bcm271= 1.dtsi#L413=20 gives us the base+slope values (410040, 487). Given the linux the units=20 are in 1/1000h C, the remainder of the calculation is to adjust to 1/10th= K. There is also=20 https://www.raspberrypi.org/documentation/hardware/raspberrypi/frequency-= management.md There is also a bit of documentation around "temp_limit" https://www.raspberrypi.org/documentation/configuration/config-txt/overcl= ocking.md Which names 80-85C as the region that the cores should be throttled and=20 some other thermal recommendations. Finally, various mentions of the AVS (beyond the official document=20 naming the int, but not the base address despite it being in the DT) in=20 commit messages/etc help to clarify things, but none are particularly=20 helpful on their own. >=20 > Apart from that: >=20 > On 2020.09.10 00:11, Jeremy Linton wrote: >> The current mainline DT indicates that the thermal offset >> on the rpi is 410040 rather than the 419949 being used. >> This means our temp calculation is offset nearly 10C higher >> when running in ACPI mode vs DT. >> >> Signed-off-by: Jeremy Linton >> --- >> =C2=A0 Platform/RaspberryPi/AcpiTables/Dsdt.asl | 2 +- >> =C2=A0 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/Platform/RaspberryPi/AcpiTables/Dsdt.asl=20 >> b/Platform/RaspberryPi/AcpiTables/Dsdt.asl >> index 2b9e8211cf..d116f965e1 100644 >> --- a/Platform/RaspberryPi/AcpiTables/Dsdt.asl >> +++ b/Platform/RaspberryPi/AcpiTables/Dsdt.asl >> @@ -269,7 +269,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "RPIFDN",=20 >> "RPI", 2) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Fie= ld (TEMS, DWordAcc, NoLock, Preserve) { >> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 TMPS, 32 >> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } >> >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return (((4199= 49 - ((TMPS & 0x3ff) * 487)) / 100) + 2732); >> >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return (((4100= 40 - ((TMPS & 0x3ff) * 487)) / 100) + 2732); >> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } >> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Method (_SCP, 3= ) { }=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 // receive cooling policy=20 >> from OS >> >> >=20 > Reviewed-by: Pete Batard