linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@gmail.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	Zhang Rui <rui.zhang@intel.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Amit Kucheria <amitk@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Frank Rowand <frowand.list@gmail.com>,
	linux-pm@vger.kernel.org
Subject: Re: Hook up a PCIe device into the thermal framework
Date: Fri, 15 Jan 2021 09:49:40 +0100	[thread overview]
Message-ID: <CAHKzcEPcw_6XSQ5hqbgxAKY9P0MOeRo68WoWyRo27gp-FCw68g@mail.gmail.com> (raw)
In-Reply-To: <20210114205142.GA2021118@bjorn-Precision-5520>

Hi,

> > topology that DT modification will not work and still I have no device
> > node.
>
> I'm absolutely not a DT expert, but I assume that a thermal zone would
> be associated with some resource fixed by the platform, such as a fan,
> so I would think a thermal zone would have to be described in terms of
> the platform physical topology, not the PCI device type.

The thermal zone needs a temperature sensor device to read out
temperature and also some cooling devices which are mapped to specific
zone trips.
In a below scenario, when TZ hists the wifi_allert0 trip it will run
the fan but if the temp still rises it will try to dissipate the heat
by running some actions within wifi adapter eg. switch off some
antennas.

[...]
wifi_thermal: wifi-thermal {
    thermal-sensors = <&wifi_device>;
    trips {
        wifi_alert0: wifi-alert0 {
            temperature = <90000>;
            hysteresis = <5000>;
            type = "active";
        };

        wifi_alert1: wifi-alert1 {
            temperature = <110000>;
            hysteresis = <5000>;
            type = "passive";
        };

        cooling-maps {
            map0 {
                 trip = <&wifi_alert0>;
                 cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
            };
            map1 {
                 trip = <&wifi_alert1>;
                 cooling-device = <&wifi_device THERMAL_NO_LIMIT
THERMAL_NO_LIMIT>;
            };
        };
};
[...]

My problem is not a cooling method but the binding of the PCI device
(it has a thermal sensor) with the thermal zone

    thermal-sensors = <&wifi_device>;     // wifi_devcie does not
exist until I will statically define it under PCI controller

The point here is that defining wifi_device under the controller I
need to reflect the PCI topology. Which is fair as DT should reflect
the HW connection. Even if I define a wifi_device anywhere in DT and
assuming the PCI core will search whole DT and not only subnodes of
the controller/bridge/switch here likely comes another problem. What
should be the key to search for the device node? PCI addresses devices
by bus:device: function and this is known after PCI scan.

To me seems that so far no one found a good way to handle thermal
within PCI devices, so some drivers statically create TZ and handle it
within the driver. This way, unfortunately, we lose the flexibility of
thermal control from a system-wide perspective. WiFi adapter is not
aware of the fan for example.

/Waldek

      reply	other threads:[~2021-01-15  8:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-14 17:04 Hook up a PCIe device into the thermal framework Waldemar Rymarkiewicz
2021-01-14 20:51 ` Bjorn Helgaas
2021-01-15  8:49   ` Waldemar Rymarkiewicz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHKzcEPcw_6XSQ5hqbgxAKY9P0MOeRo68WoWyRo27gp-FCw68g@mail.gmail.com \
    --to=waldemar.rymarkiewicz@gmail.com \
    --cc=amitk@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=frowand.list@gmail.com \
    --cc=helgaas@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=rui.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).