Page MenuHomeFreeBSD

arm64, qoriq_therm: configure the number of sites base don SoC
ClosedPublic

Authored by bz on Jul 9 2022, 12:33 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 22, 7:56 AM
Unknown Object (File)
Wed, Apr 17, 3:07 PM
Unknown Object (File)
Thu, Apr 11, 8:02 AM
Unknown Object (File)
Thu, Apr 11, 8:02 AM
Unknown Object (File)
Thu, Apr 11, 8:02 AM
Unknown Object (File)
Thu, Apr 11, 8:02 AM
Unknown Object (File)
Thu, Apr 11, 8:01 AM
Unknown Object (File)
Wed, Apr 10, 11:47 AM

Details

Summary

Configure the number of sites (sensors) based on SoC.
This work was based on mmel's initial work at:
https://github.com/strejda/freebsd/commit/914e3f0098b090cb5c1492b0d24992012c5c553b

MFC after: 2 weeks

Test Plan

Tested on Ten64 (LS1088):

soctherm0: <QorIQ temperature sensors> mem 0x1f80000-0x1f8ffff irq 6 on simplebus0
soctherm0: Found thermal sensor #0 site0: 'core-cluster'
soctherm0: Found thermal sensor #1 site1: 'soc'
# sysctl -N hw.temperature
hw.temperature.core-cluster
hw.temperature.soc

The real problem that made me look is that reading times out but I figured leaving
this a self-contained change is probably wise.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bz requested review of this revision.Jul 9 2022, 12:33 AM
sys/arm64/qoriq/qoriq_therm.c
438

this should be sc->ntsensors as well

Replace a hardcoded 7 likely coming from LX2160a (0..6) with the number of sites we discovered.

I'm so sorry, but NACK.
This is the wrong way. A thermal sensor is not a thermal zone - > one sensor can be part of multiple zones, and one zone can consist of multiple sensors. The zone is a property of the board/case, while the sensor is (mostly) a property of the SOC. We should not mix them.
Moreover an in this case, since the sensors are located on the SoC, there is no reason why we should not hardcode its name (and number of sensors) directly in the driver.

I have a piece ready to implement general thermal sensors and a thermal zone framework (including power/clock management), but I don't have time to finish it right now.
The tsensor[1] part can be pushed I thing, but tzones[2] needs a lot more love to be committable.
[1] https://github.com/strejda/freebsd/commit/7b759b34953e003a29c2d1572b6bbf16e73298c6 and https://github.com/strejda/freebsd/commit/914e3f0098b090cb5c1492b0d24992012c5c553b
[2] https://github.com/strejda/freebsd/commit/f5cea16e881a37efe9a0f2c37350e9541ec4a934

In D35759#811543, @mmel wrote:

I'm so sorry, but NACK.
This is the wrong way.

I understand but with the lack of the framework to do it the other way round made me creative enough as the multiple timeouts for reading the other sensors are quite annoying. And frankly, we do so in nvidia as well I thought (but maybe I am wrong).

A thermal sensor is not a thermal zone - > one sensor can be part of multiple zones, and one zone can consist of multiple sensors. The zone is a property of the board/case, while the sensor is (mostly) a property of the SOC. We should not mix them.
Moreover an in this case, since the sensors are located on the SoC, there is no reason why we should not hardcode its name (and number of sensors) directly in the driver.

So building up an array per Soc would be better even if the information is already duplicated in device tree (just the other way round)?

I have a piece ready to implement general thermal sensors and a thermal zone framework (including power/clock management), but I don't have time to finish it right now.
The tsensor[1] part can be pushed I thing, but tzones[2] needs a lot more love to be committable.
[1] https://github.com/strejda/freebsd/commit/7b759b34953e003a29c2d1572b6bbf16e73298c6 and https://github.com/strejda/freebsd/commit/914e3f0098b090cb5c1492b0d24992012c5c553b
[2] https://github.com/strejda/freebsd/commit/f5cea16e881a37efe9a0f2c37350e9541ec4a934

YEAH! Well, let's go for that then; I'll have a look. Thanks!

bz planned changes to this revision.Jul 10 2022, 6:15 PM

Taking this step-by-step.

I went ahead and 1st used
https://github.com/strejda/freebsd/commit/914e3f0098b090cb5c1492b0d24992012c5c553b
as the inspiration and manually configred the sensor/sites per SoC.
I filled in pretty much all I could think of and find.

This seems to be the path of least resistance for the moment until we'll have the full framework.

If this is okay, I'll also update D35764.

bz retitled this revision from arm64, qoriq_therm: try to detect site number and names from device tree to arm64, qoriq_therm: configure the number of sites base don SoC.Jul 14 2022, 10:51 PM
bz edited the summary of this revision. (Show Details)

Perfect, many thanks for cooperation.

This revision is now accepted and ready to land.Jul 16 2022, 6:52 AM