Skip to contentSkip to conversation

BIOS SAR Driver for M.2 Intel Modems

PATCH Superseded Shravan S 4 participants 14 messages Jun 11, 2021 – Jun 28, 2021 x86 platform drivers

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Shravan S

author
#0 lore raw

cover BIOS SAR Driver for M.2 Intel Modems

SAR (Specific Absorption Rate) driver is a host driver implemented for Linux or chrome platform to limit the exposure of human body to RF frequency by informing the Intel M.2 modem to regulate the RF power based on SAR data obtained from the sensors captured in the BIOS. ACPI interface exposes this data from the BIOS to SAR driver. The front end application in userspace ( eg: Modem Manager) will interact with SAR driver to obtain information like the device mode (Example: tablets, laptops, etx), Antenna index, baseband index, SAR table index and use available communication like MBIM interface to enable data communication to modem for RF power regulation.

The BIOS gets notified about device mode changes through Sensor Driver. This information is given to a (newly created) WWAN ACPI function driver when there is a device mode change. The driver then uses a _DSM method to retrieve the required information from BIOS. This information is then forwarded/multicast to the User-space using the NETLINK interface. A lookup table is maintained inside the BIOS which suggests the SAR Table index and Antenna Tuner Table Index values for individual device modes.

The SAR parameters to be used on the Modem differs for each Regulatory Mode like FCC, CE and ISED. Hence, the SAR parameters are stored separately in the SMBIOS table in the OEM BIOS, for each of the Regulatory mode. Regulatory modes will be different based on the region and network available in that region.

Hence the entire SAR functionality handling is divided into 2 parts:

• A ACPI function driver implemented that uses a dedicated ACPI node for WWAN device.
sends notifications whenever there is change in Device Mode. (each OEM has different mechanism of updating this DEVICE Mode info). This is notified to User-space applications using the RT-NETLINK interface.
• WWAN Device Service listens for RT-NETLINK messages and routes them to Modem using MBIM.

Shravan S (1):
[x86]: BIOS Dynamic SAR driver for Intel M.2 Modem

 drivers/platform/x86/Kconfig                |  12 +
 drivers/platform/x86/Makefile               |   1 +
 drivers/platform/x86/intel-sar.c            | 589 ++++++++++++++++++++
 include/linux/platform_data/x86/intel-sar.h | 118 ++++
 4 files changed, 720 insertions(+)
 create mode 100644 drivers/platform/x86/intel-sar.c
 create mode 100644 include/linux/platform_data/x86/intel-sar.h

base-commit: cd1245d75ce93b8fd206f4b34eb58bcfe156d5e9

Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/1 : BIOS Dynamic SAR driver for Intel M.2 Modem

---
 drivers/platform/x86/Kconfig                |  12 +
 drivers/platform/x86/Makefile               |   1 +
 drivers/platform/x86/intel-sar.c            | 589 ++++++++++++++++++++
 include/linux/platform_data/x86/intel-sar.h | 118 ++++
 4 files changed, 720 insertions(+)
 create mode 100644 drivers/platform/x86/intel-sar.c
 create mode 100644 include/linux/platform_data/x86/intel-sar.h
drivers/platform/x86/Kconfig +12 -0
index 60592fb88e7a..6dfa89310677 100644
@@ -1313,6 +1313,18 @@ config INTEL_TELEMETRY
 	  directly via debugfs files. Various tools may use
 	  this interface for SoC state monitoring.
 
+config INTEL_SAR
+	tristate "Intel Specific Absorption Rate Driver"
+	depends on ACPI
+	help
+	  This driver limit the exposure of human body to RF frequency by informing
+	  the Intel M.2 modem to regulate the RF power based on SAR data obtained
+	  from the sensorscaptured in the BIOS. ACPI interface exposes this data
+	  from the BIOS to SAR driver. The front end application in userspace
+	  will interact with SAR driver to obtain information like the device mode,
+	  Antenna index,baseband index, SAR table index and use available communication
+	  like MBIM interface to enable data communication to modem for RF power regulation.
+
 endif # X86_PLATFORM_DEVICES
 
 config PMC_ATOM
drivers/platform/x86/Makefile +1 -0
index dcc8cdb95b4d..548ff663c4af 100644
@@ -123,6 +123,7 @@ obj-$(CONFIG_INTEL_SMARTCONNECT)		+= intel-smartconnect.o
 obj-$(CONFIG_INTEL_SPEED_SELECT_INTERFACE)	+= intel_speed_select_if/
 obj-$(CONFIG_INTEL_TURBO_MAX_3)			+= intel_turbo_max_3.o
 obj-$(CONFIG_INTEL_UNCORE_FREQ_CONTROL)		+= intel-uncore-frequency.o
+obj-$(CONFIG_INTEL_SAR)				+= intel-sar.o
 
 # Intel PMIC / PMC / P-Unit devices
 obj-$(CONFIG_INTEL_BXTWC_PMIC_TMU)	+= intel_bxtwc_tmu.o
drivers/platform/x86/intel-sar.c new file +589 -0

589 lines not on this page · raw message

include/linux/platform_data/x86/intel-sar.h new file +118 -0

118 lines not on this page · raw message

Signature · 1 line
2.17.1
#2 lore raw
In reply to Shravan S
Quoted 22 lines · Shravan S

SAR (Specific Absorption Rate) driver is a host driver implemented for Linux or chrome platform to limit the exposure of human body to RF frequency by informing the Intel M.2 modem to regulate the RF power based on SAR data obtained from the sensors captured in the BIOS. ACPI interface exposes this data from the BIOS to SAR driver. The front end application in userspace ( eg: Modem Manager) will interact with SAR driver to obtain information like the device mode (Example: tablets, laptops, etx), Antenna index, baseband index, SAR table index and use available communication like MBIM interface to enable data communication to modem for RF power regulation.

The BIOS gets notified about device mode changes through Sensor Driver. This information is given to a (newly created) WWAN ACPI function driver when there is a device mode change. The driver then uses a _DSM method to retrieve the required information from BIOS. This information is then forwarded/multicast to the User-space using the NETLINK interface. A lookup table is maintained inside the BIOS which suggests the SAR Table index and Antenna Tuner Table Index values for individual device modes.

The SAR parameters to be used on the Modem differs for each Regulatory Mode like FCC, CE and ISED. Hence, the SAR parameters are stored separately in the SMBIOS table in the OEM BIOS, for each of the Regulatory mode. Regulatory modes will be different based on the region and network available in that region.

Quoted 7 lines

Hence the entire SAR functionality handling is divided into 2 parts:

• A ACPI function driver implemented that uses a dedicated ACPI node for WWAN device.
sends notifications whenever there is change in Device Mode. (each OEM has different mechanism of updating this DEVICE Mode info). This is notified to User-space applications using the RT-NETLINK interface.
• WWAN Device Service listens for RT-NETLINK messages and routes them to Modem using MBIM.

That's a nice feature!
Why is it not a part of some generic subsubsystem under wireless network subsystem?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author
#3 lore raw

Hi Andy,

Why is it not a part of some generic subsystem under wireless network subsystem?

-- This driver is instantiated only when the BIOS on given host exposes ACPI node corresponding to the BIOS SAR. This depends on support of the BIOS SAR feature by given OEM. -- It is agnostic of the wireless technology like WWAN, WiFi and BT. Hence, it is not made specific to any given wireless network subsystem.

Please do let me know if you need more information.

Thanks and Regards,
Shravan S

-----Original Message-----
From: Andy Shevchenko <[email protected]>
Sent: Sunday, June 13, 2021 7:52 PM
To: Shravan, S <[email protected]>
Cc: Hans de Goede <[email protected]>; Mark Gross <[email protected]>; Platform Driver <[email protected]>; An, Sudhakar <[email protected]>
Subject: Re: [PATCH 0/1] [x86] BIOS SAR Driver for M.2 Intel Modems

Quoted 22 lines · Shravan S

SAR (Specific Absorption Rate) driver is a host driver implemented for
Linux or chrome platform to limit the exposure of human body to RF
frequency by informing the Intel M.2 modem to regulate the RF power
based on SAR data obtained from the sensors captured in the BIOS. ACPI
interface exposes this data from the BIOS to SAR driver. The front end
application in userspace ( eg: Modem Manager) will interact with SAR
driver to obtain information like the device mode (Example: tablets,
laptops, etx), Antenna index, baseband index, SAR table index and use available communication like MBIM interface to enable data communication to modem for RF power regulation.

The BIOS gets notified about device mode changes through Sensor
Driver. This information is given to a (newly created) WWAN ACPI function driver when there is a device mode change. The driver then uses a _DSM method to retrieve the required information from BIOS.
This information is then forwarded/multicast to the User-space using the NETLINK interface.
A lookup table is maintained inside the BIOS which suggests the SAR
Table index and Antenna Tuner Table Index values for individual device modes.

The SAR parameters to be used on the Modem differs for each Regulatory Mode like FCC, CE and ISED. Hence, the SAR parameters are stored separately in the SMBIOS table in
the OEM BIOS, for each of the Regulatory mode. Regulatory modes will
be different based on the region and network available in that region.

Quoted 7 lines

Hence the entire SAR functionality handling is divided into 2 parts:

• A ACPI function driver implemented that uses a dedicated ACPI node for WWAN device.
sends notifications whenever there is change in Device Mode. (each OEM has different mechanism of updating this DEVICE Mode info). This is notified to User-space applications using the RT-NETLINK interface.
• WWAN Device Service listens for RT-NETLINK messages and routes them to Modem using MBIM.

That's a nice feature!
Why is it not a part of some generic subsubsystem under wireless network subsystem?

--
With Best Regards,
Andy Shevchenko

#4 lore raw

On 14.06.21 13:48, Shravan, S wrote:

Hi,

Quoted 6 lines

Why is it not a part of some generic subsystem under wireless network subsystem?

-- This driver is instantiated only when the BIOS on given host exposes ACPI node corresponding to the BIOS SAR. This depends on support of the BIOS SAR feature by given OEM. -- It is agnostic of the wireless technology like WWAN, WiFi and BT. Hence, it is not made specific to any given wireless network subsystem.

Please do let me know if you need more information.

the problems I see here:

1. the device uapi is very vendor specific
2. its unclear for which air interface is the data really retrieved ?
3. unclear how userland this should really handle in a generic way --> how does it know which device to tune ?
4. does it really need to be (non-portable) ioctls ?

by the way, who hat that funny idea putting such information into acpi in such a weird way ?

--mtx

Signature · 8 lines
---
Hinweis: unverschlüsselte E-Mails können leicht abgehört und manipuliert
werden ! Für eine vertrauliche Kommunikation senden Sie bitte ihren
GPG/PGP-Schlüssel zu.
---
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
[email protected] -- +49-151-27565287
#5 lore raw
Quoted 7 lines · metux IT consult

On 14.06.21 13:48, Shravan, S wrote:

Hi,

Quoted 2 lines

Why is it not a part of some generic subsystem under wireless network subsystem?

Quoted 8 lines
Quoted 4 lines

-- This driver is instantiated only when the BIOS on given host exposes ACPI node corresponding to the BIOS SAR. This depends on support of the BIOS SAR feature by given OEM. -- It is agnostic of the wireless technology like WWAN, WiFi and BT. Hence, it is not made specific to any given wireless network subsystem.

Please do let me know if you need more information.

the problems I see here:

1. the device uapi is very vendor specific

We have a platform profile which is also quite vendor specific, nevertheless we (as upstream) are trying to have points of unifications.

I think this driver should be part of the corresponding profile / network subsystem part and be a one (of the) hardware implementation. Somebody can add more. Users in Linux should have a common ABI for that. And I'm not sure it should not be a netlink based one.

Quoted 8 lines

2. its unclear for which air interface is the data really retrieved ?
3. unclear how userland this should really handle in a generic way

    --> how does it know which device to tune ?

4. does it really need to be (non-portable) ioctls ?

by the way, who hat that funny idea putting such information into acpi in such a weird way ?

I believe its source is a Windows driver and Windows "culture", they simply don't give a crap about anything else and Windows is a product-oriented platform (each product is unique even if 99.9% of the hardware and firmware is the same with twenty more products).

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author
#6 lore raw

Hi,

Response Inline.

-----Original Message-----

Quoted 19 lines

From: Andy Shevchenko <[email protected]>
Sent: Wednesday, June 16, 2021 1:59 AM
To: Enrico Weigelt, metux IT consult <[email protected]>
Cc: Shravan, S <[email protected]>; Hans de Goede <[email protected]>; Mark Gross <[email protected]>; Platform Driver <[email protected]>; An, Sudhakar <[email protected]>
Subject: Re: [PATCH 0/1] [x86] BIOS SAR Driver for M.2 Intel Modems

Quoted 12 lines · metux IT consult

On 14.06.21 13:48, Shravan, S wrote:

Hi,

Quoted 6 lines

Why is it not a part of some generic subsystem under wireless network subsystem?

-- This driver is instantiated only when the BIOS on given host exposes ACPI node corresponding to the BIOS SAR. This depends on support of the BIOS SAR feature by given OEM. -- It is agnostic of the wireless technology like WWAN, WiFi and BT. Hence, it is not made specific to any given wireless network subsystem.

Please do let me know if you need more information.

Quoted 9 lines
Quoted 3 lines

the problems I see here:

1. the device uapi is very vendor specific

We have a platform profile which is also quite vendor specific, nevertheless we (as upstream) are trying to have points of unifications.

I think this driver should be part of the corresponding profile / network subsystem part and be a one (of the) hardware implementation. Somebody can add more. Users in Linux should have a common ABI for that. And I'm not sure it should not be a netlink based one.

[Shravan] This driver is exposing the SAR parameters solely influenced by the current status of the host platform and is not specific to any RF device. Hence it is placed at the path (Platform driver). Also, we have reworked the driver implementation to remove netlink usage. This is replaced with sysfs. Please do have a look and share feedback on the same.

Quoted 1 line
Quoted 1 line

2. its unclear for which air interface is the data really retrieved ?

[Shravan] The initial implementation supports parameters received for WWAN. Subsequently other RF device types (Wifi, BT) will be supported.

Quoted 2 lines
Quoted 2 lines

3. unclear how userland this should really handle in a generic way

    --> how does it know which device to tune ?

[Shravan] Userland will configure these parameters on the specific RF device. A Table of SAR parameters is already provisioned on the given RF device. The information retrieved from this driver specifies which index in this table has to be used by the RF device.

Quoted 2 lines
Quoted 2 lines

4. does it really need to be (non-portable) ioctls ?

[Shravan] Usage of IOCTLs have been avoided in the latest patch. This has been replaced with sysfs. Please do have a look and suggest if this concern is addressed.

Quoted 5 lines
Quoted 3 lines

by the way, who hat that funny idea putting such information into acpi in such a weird way ?

I believe its source is a Windows driver and Windows "culture", they simply don't give a crap about anything else and Windows is a product-oriented platform (each product is unique even if 99.9% of the hardware and firmware is the same with twenty more products).

Thanks and Regards,
Shravan S

#7 lore raw

On 23.06.21 16:03, Shravan, S wrote:

Hi,

Quoted 1 line

[Shravan] This driver is exposing the SAR parameters solely influenced by the current status of the host platform and is not specific to any RF device. Hence it is placed at the path (Platform driver).

I'm confused, how could that be not specific to any RF device ? It can only make sense at all, if we know which device certain settings need to be applied to. And even finding reasonable settings highly depends on lots of hardware and environmental specific factors, starting with the frequencies and modulation types, signal routing on the board, shielding characteristics of the machine's case, etc, etc.

By the way: why does it have to be some proprietary ACPI call ?

Why not just publishing some table where the kernel can do the lookup ? And do we have some (simple!) identification of the board/machine, so we can easily override these bios values when necessary ?

Over the last decades I had to learn to *never* trust BIOS vendors with anything more than just starting the kernel, especially not trusting in ACPI tables. And we certainly cant expect people doing field bios upgrades anytime soon, in case some bios vendor actually manages to clean up his dirt and publish some actual fixes.

Seriously, I'd rather try to keep bios out of the loop as much as possible. And if it is involved, let it describe the hardware precisely instead of doing whatever magic logic.

(I need to hold back myself for not starting another rant against ACPI and bios vendors :p)

Quoted 3 lines
Quoted 1 line
Quoted 1 line

2. its unclear for which air interface is the data really retrieved ?

[Shravan] The initial implementation supports parameters received for WWAN. Subsequently other RF device types (Wifi, BT) will be supported.

We still don't know for which individual interface these parameters apply to. I've got machines with multiple WWAN interfaces out in the field.

Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

3. unclear how userland this should really handle in a generic way

     --> how does it know which device to tune ?

[Shravan] Userland will configure these parameters on the specific RF device.

So the user needs to configure it anyways. Why do we have to have that acpi stuff in the first place ? If we're already involving a device specific userland, everything (including the tables) could live entirely in userland - and we would never ever have to touch bios or kernel anymore. (remember: bios upgrades are always a total mess).

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

by the way, who hat that funny idea putting such information into acpi in such a weird way ?

I believe its source is a Windows driver and Windows "culture", they simply don't give a crap about anything else and Windows is a product-oriented platform (each product is unique even if 99.9% of the hardware and firmware is the same with twenty more products).

Okay, and why are you guys (Intel) following such insanity, when this is meant for Linux-based devices like Chrome ?

Sorry, but doing something just because thousands of programming minions in Windoze world (which, from my personal expercience, most of them, at least on driver and firmware side, I have to consider totally incompetent) are doing it that way, really is a bad excuse and has nothing to do with decent engineering.

So, please, let's throw away that arbitrary acpi junk and engineer a technically good solution.

My requirements for such a solution would be:

* the involvement of bios/acpi shall be limited to some exact identification, or even better, formal description of the hardware. (like we do w/ device tree) [*1]
* beyond that, there shall be no need to ever do any bios upgrade, once this data is initially added
* the formal description shall also indentify the which devices are to be tuned
* the OS shall be in full control of everything, no hidden firmware magic at all.
* the solution shall be generic enough so it can be directly applied to *any* similar hardware, no matter what vendor or fw type.

--mtx

[*1] maybe offtopic: I'm actually considering embedding actual DTB into
the bios and leave acpi just as a legacy fallback - yes, seriously.
--
---
Hinweis: unverschlüsselte E-Mails können leicht abgehört und manipuliert werden ! Für eine vertrauliche Kommunikation senden Sie bitte ihren GPG/PGP-Schlüssel zu.
---
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
[email protected] -- +49-151-27565287

#8 lore raw
Quoted 1 line · metux IT consult

On 23.06.21 16:03, Shravan, S wrote:

...

Quoted 5 lines

Over the last decades I had to learn to *never* trust BIOS vendors with anything more than just starting the kernel, especially not trusting in ACPI tables. And we certainly cant expect people doing field bios upgrades anytime soon, in case some bios vendor actually manages to clean up his dirt and publish some actual fixes.

But this is not the issue of ACPI, right? Maybe you should stream the energy to complain and file bugs against vendors who do not know how to cook ACPI?

Quoted 3 lines

Seriously, I'd rather try to keep bios out of the loop as much as possible. And if it is involved, let it describe the hardware precisely instead of doing whatever magic logic.

Isn't it applicable to all firmwares? Have you tried to avoid wireless firmwares (rhetorical question)? My point is that we have to live with that fortunately or unfortunately.

Quoted 2 lines

(I need to hold back myself for not starting another rant against ACPI and bios vendors :p)

As I said, look into the root cause, while I admit that the ACPI spec is easy to abuse / misinterpret (in some cases).

...

Quoted 14 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

3. unclear how userland this should really handle in a generic way

     --> how does it know which device to tune ?

[Shravan] Userland will configure these parameters on the specific RF device.

So the user needs to configure it anyways. Why do we have to have that acpi stuff in the first place ? If we're already involving a device specific userland, everything (including the tables) could live entirely in userland - and we would never ever have to touch bios or kernel anymore. (remember: bios upgrades are always a total mess).

Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

by the way, who hat that funny idea putting such information into acpi in such a weird way ?

Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

I believe its source is a Windows driver and Windows "culture", they simply don't give a crap about anything else and Windows is a product-oriented platform (each product is unique even if 99.9% of the hardware and firmware is the same with twenty more products).

Okay, and why are you guys (Intel) following such insanity, when this is meant for Linux-based devices like Chrome ?

I haven't got it. How do you deduct that it's solely for Chrome? Even I'm puzzled with this Yet Another Not So Portable Idea. And above is my speculation about the roots of it. I can't explain it any other way.

Quoted 8 lines

Sorry, but doing something just because thousands of programming minions in Windoze world (which, from my personal expercience, most of them, at least on driver and firmware side, I have to consider totally incompetent) are doing it that way, really is a bad excuse and has nothing to do with decent engineering.

So, please, let's throw away that arbitrary acpi junk and engineer a technically good solution.

ACPI has nothing to do with any solution to be "junk". If one doesn't know how to cook it, it doesn't prevent them from cooking it in a better way.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#9 lore raw
Quoted 3 lines · Andy Shevchenko

But this is not the issue of ACPI, right? Maybe you should stream the energy to complain and file bugs against vendors who do not know how to cook ACPI?

It's an issue of the acpi ecosystem. Mostly the fault of individual hw vendors that invent weird ways to abuse it for things it never had been designed. We're here talking with some (representative of some) hw vendor.

By the way: this actually isn't an issue of these specific intel modems at all, but the mainboards where some of these could plugged into. At that point I wonder why we don't hear a word from these guys, it would be their duty.

Quoted 2 lines

Isn't it applicable to all firmwares? Have you tried to avoid wireless firmwares (rhetorical question)?

It depends. Firmware for external controllers (which is loaded by the kernel) is an entirely different area. I wish we wouldn't need to care about it, but it's better us doing that of board or bios vendors, and we have reasonabley well methods to cope with it.

Quoted 2 lines

My point is that we have to live with
that fortunately or unfortunately.

It seems that the whole thing is still under development (even sounds like for now only one company using it in their closed devices), so we might still have the chance to prevent another nightmare.

Quoted 5 lines
Quoted 2 lines

(I need to hold back myself for not starting another rant against ACPI and bios vendors :p)

As I said, look into the root cause, while I admit that the ACPI spec is easy to abuse / misinterpret (in some cases).

Yes, and it's used for things it wasn't designed for. Actually, I claim it was a bad idea in the first place - device tree already has been there and the superior solution when acpi brought upon us. And even after that, there way plenty time to introduce a hybrid solution to add in device tree and leave the old acpi stuff as legacy. This actually would have been pretty easy to do so.

Yes, ACPI received several useful improvements over the time, but still very incomplete (anything but well thought), and ... voila ... it's even embedding pieces of device tree, so it becomes somewhat more useful. (but still in quite weird ways). At that point I really wonder why we're not directly using DT ?

One of the major problems at this point is board vendors treating vital information of device / board composition as some kind of black magic, instead of just giving us a precise description how things are wired up.

Quoted 1 line

I haven't got it. How do you deduct that it's solely for Chrome?

He mentioned in one of the mails. At least it sounded that Chrome devices are currently the only ones that actually use it.

Quoted 6 lines
Quoted 2 lines

So, please, let's throw away that arbitrary acpi junk and engineer a technically good solution.

ACPI has nothing to do with any solution to be "junk". If one doesn't know how to cook it, it doesn't prevent them from cooking it in a better way.

I've been referring about this specific way to put it into acpi. Indeed acpi could be used to do it in a sane way, but this would look very differently then. I would declare any way of putting this into acpi functions as junk - a clean solution would be giving a precise description of the hardware itself, a purely declarative approach, that is independent of the actual baseband module.

--mtx

Signature · 8 lines
---
Hinweis: unverschlüsselte E-Mails können leicht abgehört und manipuliert
werden ! Für eine vertrauliche Kommunikation senden Sie bitte ihren
GPG/PGP-Schlüssel zu.
---
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
[email protected] -- +49-151-27565287
#10 lore raw
In reply to Shravan S

Hi Shravan,

Quoted 16 lines · Shravan S

SAR (Specific Absorption Rate) driver is a host driver implemented for Linux or chrome platform to limit the exposure of human body to RF frequency by informing the Intel M.2 modem to regulate the RF power based on SAR data obtained from the sensors captured in the BIOS. ACPI interface exposes this data from the BIOS to SAR driver. The front end application in userspace ( eg: Modem Manager) will interact with SAR driver to obtain information like the device mode (Example: tablets, laptops, etx), Antenna index, baseband index, SAR table index and use available communication like MBIM interface to enable data communication to modem for RF power regulation.

The BIOS gets notified about device mode changes through Sensor Driver. This information is given to a (newly created) WWAN ACPI function driver when there is a device mode change. The driver then uses a _DSM method to retrieve the required information from BIOS. This information is then forwarded/multicast to the User-space using the NETLINK interface. A lookup table is maintained inside the BIOS which suggests the SAR Table index and Antenna Tuner Table Index values for individual device modes.

Quoted 4 lines

The SAR parameters to be used on the Modem differs for each Regulatory Mode like FCC, CE and ISED. Hence, the SAR parameters are stored separately in the SMBIOS table in the OEM BIOS, for each of the Regulatory mode. Regulatory modes will be different based on the region and network available in that region.

If I'm reading the above correct then this code is really doing 2 things in 1 driver:

1. Listening to some sensors, which readings may impact the maximum amount of tx power which the modem may use. What kind of sensors are these ? Currently chrome-os based devices are using iio for proximity sensors, with specific labels added to each sensor to tell userspace that they indicate a human is close to one of the antennas:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/Documentation/ABI/testing/sysfs-bus-iio?id=6505dfab33c519368e54ae7f3ea1bf4d9916fdc5

Would it be possible to use this standardized userspace interface for your use case ?

2. Exporting a table with various information from the BIOS tables to userspace. We do probably need a new userspace API for this, but I'm not sure netlink is the right answer here.

Maybe just use a binary sysfs attribute under /sys/bus/platform/devices/INTC1092:00 ?
That will make the interface non-generic, but I assume that the table contents are going to be Intel specific anyways so that should be fine. This will also allow simply exporting the table without the kernel needing to parse it.

Using netlink is highly unusual for a driver living under platform/drivers/x86; and if you really want to use netlink for this then you should first define a generic protocol which is also going to work for other vendors' modems, which is impossible ATM because we don't know yet what other vendor's modems will need...

Regards,

Hans

Quoted 23 lines

Hence the entire SAR functionality handling is divided into 2 parts:

• A ACPI function driver implemented that uses a dedicated ACPI node for WWAN device.
sends notifications whenever there is change in Device Mode. (each OEM has different mechanism of updating this DEVICE Mode info). This is notified to User-space applications using the RT-NETLINK interface.
• WWAN Device Service listens for RT-NETLINK messages and routes them to Modem using MBIM.

Shravan S (1):
[x86]: BIOS Dynamic SAR driver for Intel M.2 Modem

 drivers/platform/x86/Kconfig                |  12 +
 drivers/platform/x86/Makefile               |   1 +
 drivers/platform/x86/intel-sar.c            | 589 ++++++++++++++++++++
 include/linux/platform_data/x86/intel-sar.h | 118 ++++
 4 files changed, 720 insertions(+)
 create mode 100644 drivers/platform/x86/intel-sar.c
 create mode 100644 include/linux/platform_data/x86/intel-sar.h

base-commit: cd1245d75ce93b8fd206f4b34eb58bcfe156d5e9

#11 lore raw

Hi,

Quoted 49 lines · Hans de Goede

Hi Shravan,

Quoted 16 lines · Shravan S

SAR (Specific Absorption Rate) driver is a host driver implemented for Linux or chrome platform to limit the exposure of human body to RF frequency by informing the Intel M.2 modem to regulate the RF power based on SAR data obtained from the sensors captured in the BIOS. ACPI interface exposes this data from the BIOS to SAR driver. The front end application in userspace ( eg: Modem Manager) will interact with SAR driver to obtain information like the device mode (Example: tablets, laptops, etx), Antenna index, baseband index, SAR table index and use available communication like MBIM interface to enable data communication to modem for RF power regulation.

The BIOS gets notified about device mode changes through Sensor Driver. This information is given to a (newly created) WWAN ACPI function driver when there is a device mode change. The driver then uses a _DSM method to retrieve the required information from BIOS. This information is then forwarded/multicast to the User-space using the NETLINK interface. A lookup table is maintained inside the BIOS which suggests the SAR Table index and Antenna Tuner Table Index values for individual device modes.

Quoted 4 lines

The SAR parameters to be used on the Modem differs for each Regulatory Mode like FCC, CE and ISED. Hence, the SAR parameters are stored separately in the SMBIOS table in the OEM BIOS, for each of the Regulatory mode. Regulatory modes will be different based on the region and network available in that region.

If I'm reading the above correct then this code is really doing 2 things in 1 driver:

1. Listening to some sensors, which readings may impact the maximum amount of tx power which the modem may use. What kind of sensors are these ? Currently chrome-os based devices are using iio for proximity sensors, with specific labels added to each sensor to tell userspace that they indicate a human is close to one of the antennas:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/Documentation/ABI/testing/sysfs-bus-iio?id=6505dfab33c519368e54ae7f3ea1bf4d9916fdc5

Would it be possible to use this standardized userspace interface for your use case ?

2. Exporting a table with various information from the BIOS tables to userspace. We do probably need a new userspace API for this, but I'm not sure netlink is the right answer here.

Maybe just use a binary sysfs attribute under /sys/bus/platform/devices/INTC1092:00 ?
That will make the interface non-generic, but I assume that the table contents are going to be Intel specific anyways so that should be fine. This will also allow simply exporting the table without the kernel needing to parse it.

Quoted 6 lines

Using netlink is highly unusual for a driver living under platform/drivers/x86; and if you really want to use netlink for this then you should first define a generic protocol which is also going to work for other vendors' modems, which is impossible ATM because we don't know yet what other vendor's modems will need...

Some more remarks from a quick look at the code, I see that besides a netlink interface you are also creating a chardev and doing ioctls on that.

That is really not good, it seems that the userspace API for this needs to be completely redesigned. Using both netlink and ioctls at the same time not acceptable.

Also you seem to create the chardev and netlink and module-load time, rather then from the sar_add() probe function. Which means that they will also be created on laptops which don't have an INTC1092 ACPI device at all, again not good.

Please drop the sar_init() and sar_exit() functions and use module_platform_driver to have module_init / exit register / unregister the driver and have them only do that, everything else should be done from the platform_driver probe function.

Also you use "sar" for a lot of identifiers in the driver, but that is very generic where as this is a highly Intel specific driver; and likely in the future even newer Intel modems may use a different driver, so please replace the sar prefix with something more specific, e.g. "intc1092"

Regards,

Hans

author
#12 lore raw

Hi,

Thank you for the feedback. Responses Inline.

-----Original Message-----

Quoted 6 lines

From: Hans de Goede <[email protected]>
Sent: Thursday, June 17, 2021 8:06 PM
To: Shravan, S <[email protected]>; [email protected]; [email protected]
Cc: An, Sudhakar <[email protected]>
Subject: Re: [PATCH 0/1] [x86] BIOS SAR Driver for M.2 Intel Modems

Quoted 42 lines

Hi,

Quoted 39 lines · Hans de Goede

Hi Shravan,

Quoted 16 lines · Shravan S

SAR (Specific Absorption Rate) driver is a host driver implemented
for Linux or chrome platform to limit the exposure of human body to
RF frequency by informing the Intel M.2 modem to regulate the RF
power based on SAR data obtained from the sensors captured in the
BIOS. ACPI interface exposes this data from the BIOS to SAR driver.
The front end application in userspace ( eg: Modem Manager) will
interact with SAR driver to obtain information like the device mode
(Example: tablets, laptops, etx), Antenna index, baseband index, SAR table index and use available communication like MBIM interface to enable data communication to modem for RF power regulation.

The BIOS gets notified about device mode changes through Sensor
Driver. This information is given to a (newly created) WWAN ACPI function driver when there is a device mode change. The driver then uses a _DSM method to retrieve the required information from BIOS.
This information is then forwarded/multicast to the User-space using the NETLINK interface.
A lookup table is maintained inside the BIOS which suggests the SAR
Table index and Antenna Tuner Table Index values for individual device modes.

Quoted 4 lines

The SAR parameters to be used on the Modem differs for each Regulatory Mode like FCC, CE and ISED. Hence, the SAR parameters are stored separately in the SMBIOS table
in the OEM BIOS, for each of the Regulatory mode. Regulatory modes
will be different based on the region and network available in that region.

If I'm reading the above correct then this code is really doing 2 things in 1 driver:

1. Listening to some sensors, which readings may impact the maximum amount of tx power which the modem may use. What kind of sensors are these ? Currently chrome-os based devices are using iio for proximity sensors, with specific labels added to each sensor to tell userspace that they indicate a human is close to one of the antennas:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/com
mit/Documentation/ABI/testing/sysfs-bus-iio?id=6505dfab33c519368e54ae7 f3ea1bf4d9916fdc5

Would it be possible to use this standardized userspace interface for your use case ?

[Shravan] Proximity sensors can work in scenarios where there is no other sources of information which can alter the sar handling. OEMs have given feedback that the device mode (tablet mode/laptop mode/clamshell etc) also play a part in SAR handling. Hence this has to be aggregated with the proximity sensor information. Also such an aggregation is specific to given host platform. As a consequence, this is best realized within an entity like embedded controller available on the host platform. This new driver exposes such aggregated SAR parameters that needs to be configured on specific RF device.

Quoted 12 lines
Quoted 12 lines

2. Exporting a table with various information from the BIOS tables to userspace. We do probably need a new userspace API for this, but I'm not sure netlink is the right answer here.

Maybe just use a binary sysfs attribute under /sys/bus/platform/devices/INTC1092:00 ?
That will make the interface non-generic, but I assume that the table contents are going to be Intel specific anyways so that should be fine. This will also allow simply exporting the table without the kernel needing to parse it.

Quoted 5 lines
Quoted 5 lines

Using netlink is highly unusual for a driver living under platform/drivers/x86; and if you really want to use netlink for this then you should first define a generic protocol which is also going to work for other vendors' modems, which is impossible ATM because we don't know yet what other vendor's modems will need...

[Shravan] As per your suggestion we are switching to the sysfs interface to expose this information.
We have reworked the driver implemetation with the latest patch to remove the usage of netlink which should address this concern. Please do have a look at the latest patch to confirm the same.

Quoted 2 lines

Some more remarks from a quick look at the code, I see that besides a netlink interface you are also creating a chardev and doing ioctls on that. That is really not good, it seems that the userspace API for this needs to be completely redesigned. Using both netlink and ioctls at the same time not acceptable.

[Shravan] With the latest patch we have removed the IOCTL interface and switched to sysfs mode of communictaion to and from userspace.

Quoted 2 lines

Also you seem to create the chardev and netlink and module-load time, rather then from the sar_add() probe function. Which means that they will also be created on laptops which don't have an INTC1092 ACPI device at all, again not good. Please drop the sar_init() and sar_exit() functions and use module_platform_driver to have module_init / exit register / unregister the driver and have them only do that, everything else should be done from the platform_driver probe function.

[Shravan] The latest patch addresses this concern. Please do confirm.

Quoted 1 line

Also you use "sar" for a lot of identifiers in the driver, but that is very generic where as this is a highly Intel specific driver; and likely in the future even newer Intel modems may use a different driver, so please replace the sar prefix with something more specific, e.g. "intc1092"

[Shravan] Based on the feedback sar_device_table name has been changed from "sar" to "intc1092" on the latest patch V2. Please let us know if these changes addresses this concern.

Thanks and Regards,
Shravan S

#13 lore raw

On 23.06.21 16:12, Shravan, S wrote:

Hi,

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

1. Listening to some sensors, which readings may impact the maximum amount of tx power which the modem may use. What kind of sensors are these ? Currently chrome-os based devices are using iio for proximity sensors, with specific labels added to each sensor to tell userspace that they indicate a human is close to one of the antennas:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/com
mit/Documentation/ABI/testing/sysfs-bus-iio?id=6505dfab33c519368e54ae7 f3ea1bf4d9916fdc5

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

Would it be possible to use this standardized userspace interface for your use case ?

[Shravan] Proximity sensors can work in scenarios where there is no other sources of information which can alter the sar handling. OEMs have given feedback that the device mode (tablet mode/laptop mode/clamshell etc) also play a part in SAR handling. Hence this has to be aggregated with the proximity sensor information. Also such an aggregation is specific to given host platform. As a consequence, this is best realized within an entity like embedded controller available on the host platform. This new driver exposes such aggregated SAR parameters that needs to be configured on specific RF device.

Since this is totally hardware specific and doesn't even tell us which radio interface this is about - why do we have to have this incomplete stuff in acpi and the kernel in the first place ? As things are right now, this can be completely done in userspace, including the tables.

It would be different if acpi tables could give us some precise and generic hardware description, so we could handle this in a generic way and userland wouldn't even have to care about it.

--mtx

Signature · 8 lines
---
Hinweis: unverschlüsselte E-Mails können leicht abgehört und manipuliert
werden ! Für eine vertrauliche Kommunikation senden Sie bitte ihren
GPG/PGP-Schlüssel zu.
---
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
[email protected] -- +49-151-27565287