ACPI: add "auto" to acpi_enforce_resources
Subsystems (5)
Luca Tettamanti
maintainerPATCH 1/1 ACPI: add "auto" to acpi_enforce_resources
(This is an improved version of my earlier patch, I've reworked deviced detection to simply check for the desired HID)
The following patch adds "auto" option to "acpi_enforce_resource"; this value is also the new default.
"auto" enforces strict resource checking - disallowing access by native drivers to IO ports and memory regions claimed by ACPI firmware - when a device with a known ACPI driver is found (currently only ASUS ATK0110 is checked), and reverts to lax checking otherwise.
The patch is mainly aimed to block native hwmon drivers from touching monitoring chips that ACPI thinks it own.
---
New revision, now it simply checks the HID.
Documentation/kernel-parameters.txt | 19 ++++++++++++++++ drivers/acpi/osl.c | 41 +++++++++++++++++++++++++++++++++--- 2 files changed, 57 insertions(+), 3 deletions(-)
Documentation/kernel-parameters.txt +19 -0
@@ -258,6 +258,25 @@ to assume that this machine's pmtimer latches its value and always returns good values. + acpi_enforce_resources= [ACPI] + { strict, auto, lax, no } + Check for resource conflicts between native drivers + and ACPI OperationRegions (SystemIO and System Memory + only). IO ports and memory declared in ACPI might be + used by the ACPI subsystem in arbitrary AML code and + can interfere with legacy drivers. + strict: access to resources claimed by ACPI is denied; + legacy drivers trying to access reserved resources + will fail to load. + auto (default): try and detect ACPI devices with known + ACPI drivers; escalates the setting to "strict" if such + a device is found, otherwise behaves like "lax". + lax: access to resources claimed by ACPI is allowed; + legacy drivers trying to access reserved resources + will load and a warning message is logged. + no: ACPI OperationRegions are not marked as reserved, + no further checks are performed. + agp= [AGP] { off | try_unsupported } off: disable AGP support
drivers/acpi/osl.c +38 -3
68 lines not on this page · raw message
Luca
Signature · 3 lines
La vasca da bagno fu inventata nel 1850, il telefono nel 1875. Se fossi vissuto nel 1850, avrei potuto restare in vasca per 25 anni senza sentir squillare il telefono
Quoted 10 lines · Luca Tettamanti
(This is an improved version of my earlier patch, I've reworked deviced detection to simply check for the desired HID)
The following patch adds "auto" option to "
acpi_enforce_resource"; this value is also the new default.
"auto" enforces strict resource checking - disallowing access by native drivers to IO ports and memory regions claimed by ACPI firmware - when a device with a known ACPI driver is found (currently only ASUS ATK0110 is checked), and reverts to lax checking otherwise.
Quoted 4 lines
The patch is mainly aimed to block native hwmon drivers from touching monitoring chips that ACPI thinks it own.
Signed-off-by Luca Tettamanti <[email protected]>
This looks very good!
ACPI team, any chance we can get this in the mainline?
We want to add a driver (for the asus atk0110 ACPI interface) to the hwmon subsys which talks to hwmon IC's through ACPI, but before we can do that we must make sure that potentially conflicting native IC drivers do not load.
Thanks & Regards,
Hans
Quoted 116 lines
---
New revision, now it simply checks the HID.Documentation/kernel-parameters.txt | 19 ++++++++++++++++ drivers/acpi/osl.c | 41 +++++++++++++++++++++++++++++++++--- 2 files changed, 57 insertions(+), 3 deletions(-)Index:
b/Documentation/kernel-parameters.txt
===================================================================Documentation/kernel-parameters.txt +19
-0@@ -258,6 +258,25 @@ to assume that this machine's pmtimer latches its value and always returns good values. + acpi_enforce_resources= [ACPI] + { strict, auto, lax, no } + Check for resource conflicts between native drivers + and ACPI OperationRegions (SystemIO and System Memory + only). IO ports and memory declared in ACPI might be + used by the ACPI subsystem in arbitrary AML code and + can interfere with legacy drivers. + strict: access to resources claimed by ACPI is denied; + legacy drivers trying to access reserved resources + will fail to load. + auto (default): try and detect ACPI devices with known + ACPI drivers; escalates the setting to "strict" if such + a device is found, otherwise behaves like "lax". + lax: access to resources claimed by ACPI is allowed; + legacy drivers trying to access reserved resources + will load and a warning message is logged. + no: ACPI OperationRegions are not marked as reserved, + no further checks are performed. + agp= [AGP] { off | try_unsupported } off: disable AGP supportIndex:
b/drivers/acpi/osl.c
===================================================================drivers/acpi/osl.c +38
-3@@ -1063,7 +1063,10 @@* in arbitrary AML code and can interfere with legacy drivers. * acpi_enforce_resources= can be set to: * -* - strict (2) +* - auto (2) +* -> detect possible conflicts with ACPI drivers and switch to +* strict if needed, otherwise act like lax +* - strict (3) * -> further driver trying to access the resources will not load * - lax (default) (1) * -> further driver trying to access the resources will load, but you @@ -1073,11 +1076,12 @@* -> ACPI Operation Region resources will not be registered * */ -#define ENFORCE_RESOURCES_STRICT 2 +#define ENFORCE_RESOURCES_STRICT 3 +#define ENFORCE_RESOURCES_AUTO 2#define ENFORCE_RESOURCES_LAX 1#define ENFORCE_RESOURCES_NO 0 -static unsigned int acpi_enforce_resources =ENFORCE_RESOURCES_LAX ; +static unsigned int acpi_enforce_resources =ENFORCE_RESOURCES_AUTO ;static int __init acpi_enforce_resources_setup (char *str) {@@ -1086,6 +1090,8 @@if (!strcmp ("strict" , str)) acpi_enforce_resources =ENFORCE_RESOURCES_STRICT ; +else if (!strcmp ("auto" , str)) + acpi_enforce_resources =ENFORCE_RESOURCES_AUTO ;else if (!strcmp ("lax" , str)) acpi_enforce_resources =ENFORCE_RESOURCES_LAX ;else if (!strcmp ("no" , str))@@ -1096,6 +1102,35 @@__setup ("acpi_enforce_resources=" , acpi_enforce_resources_setup); +static acpi_status acpi_detect_asus_atk_cb (acpi_handle obj_handle, +u32 nesting_level,void *context,void **return_value) +{ + *((bool *)return_value) = true; +return AE_CTRL_TERMINATE ; +} + +static int __init acpi_detect_asus_atk (void ) +{ +acpi_status ret; +bool found = false; + +if (acpi_enforce_resources !=ENFORCE_RESOURCES_AUTO ) +return 0 ; + + ret =acpi_get_devices ("ATK0110" , acpi_detect_asus_atk_cb, +NULL , (void **)&found); + +if (ret ==AE_OK && found) { +printk (KERN_DEBUG "Asus ATK0110 interface detected: " +"enforcing resource checking.\n" ); + acpi_enforce_resources =ENFORCE_RESOURCES_STRICT ; + }else + acpi_enforce_resources =ENFORCE_RESOURCES_LAX ; + +return 0 ; +} +fs_initcall (acpi_detect_asus_atk); +/* Check for resource conflicts between ACPI OperationRegions and native * drivers */ int acpi_check_resource_conflict (struct resource *res)Luca
Quoted 10 lines · On Sunday 25 January 2009 22:05:20 Luca Tettamanti wrote:
(This is an improved version of my earlier patch, I've reworked deviced detection to simply check for the desired HID)
The following patch adds "auto" option to "
acpi_enforce_resource"; this value is also the new default.
"auto" enforces strict resource checking - disallowing access by native drivers to IO ports and memory regions claimed by ACPI firmware - when a device with a known ACPI driver is found (currently only ASUS ATK0110 is checked), and reverts to lax checking otherwise.
Quoted 2 lines
The patch is mainly aimed to block native hwmon drivers from touching monitoring chips that ACPI thinks it own.
Having this in the core ACPI code is ugly.
Either this should be more generic (instead of hardcoded "ATK0110" device, use a list to add further specific thermal ACPI drivers). Hmm, maybe it's only ASUS violating the spec? Thinkpads seem to read out extra thermal data from EC and shouldn't interfere with hwmon drivers. hp-wmi seem to read hdd temp through wmi, don't know whether this could interfere with hwmon, I expect not? Are there other known, model specific ACPI devices, accessing thermal IOs directly which could interfere with hwmon, then it might be worth it.
If not, on these ASUS there should be a specific hwmon driver interfering with the ATK0110 device?
Can't you just add:
interfering_hwmon_driver.c:
#ifdef ACPI
acpi_search_for_ATK0110(){
/* put code from below in here */
}#endif
interfering_hwmon_driver_init/add(){
...
#ifdef ACPI
if (!acpi_disabled)
if (acpi_search_for_ATK0110()) {
printk ("Do not use this hwmon driver, use asus_acpi to read the "
"extra sensor.\n");
return -1;
else
err = acpi_check_resource_conflict(&res);
}#endif
Thomas
Quoted 118 lines
Signed-off-by Luca Tettamanti <[email protected]>---
New revision, now it simply checks the HID.Documentation/kernel-parameters.txt | 19 ++++++++++++++++ drivers/acpi/osl.c | 41+++++++++++++++++++++++++++++++++--- 2 files changed, 57 insertions(+), 3 deletions(-)
Index:
b/Documentation/kernel-parameters.txt
===================================================================
---a/Documentation/kernel-parameters.txt2009-01-17 21:22:49.218882286
+0100 +++b/Documentation/kernel-parameters.txt2009-01-21
23:25:41.262478018 +0100 @@ -258,6 +258,25 @@Documentation/kernel-parameters.txt +19
-0to assume that this machine's pmtimer latches its value and always returns good values. + acpi_enforce_resources= [ACPI] + { strict, auto, lax, no } + Check for resource conflicts between native drivers + and ACPI OperationRegions (SystemIO and System Memory + only). IO ports and memory declared in ACPI might be + used by the ACPI subsystem in arbitrary AML code and + can interfere with legacy drivers. + strict: access to resources claimed by ACPI is denied; + legacy drivers trying to access reserved resources + will fail to load. + auto (default): try and detect ACPI devices with known + ACPI drivers; escalates the setting to "strict" if such + a device is found, otherwise behaves like "lax". + lax: access to resources claimed by ACPI is allowed; + legacy drivers trying to access reserved resources + will load and a warning message is logged. + no: ACPI OperationRegions are not marked as reserved, + no further checks are performed. + agp= [AGP] { off | try_unsupported } off: disable AGP supportIndex:
b/drivers/acpi/osl.c
===================================================================drivers/acpi/osl.c +38
-3@@ -1063,7 +1063,10 @@* in arbitrary AML code and can interfere with legacy drivers. * acpi_enforce_resources= can be set to: * -* - strict (2) +* - auto (2) +* -> detect possible conflicts with ACPI drivers and switch to +* strict if needed, otherwise act like lax +* - strict (3) * -> further driver trying to access the resources will not load * - lax (default) (1) * -> further driver trying to access the resources will load, but you @@ -1073,11 +1076,12 @@* -> ACPI Operation Region resources will not be registered * */ -#define ENFORCE_RESOURCES_STRICT 2 +#define ENFORCE_RESOURCES_STRICT 3 +#define ENFORCE_RESOURCES_AUTO 2#define ENFORCE_RESOURCES_LAX 1#define ENFORCE_RESOURCES_NO 0 -static unsigned int acpi_enforce_resources =ENFORCE_RESOURCES_LAX ; +static unsigned int acpi_enforce_resources =ENFORCE_RESOURCES_AUTO ;static int __init acpi_enforce_resources_setup (char *str) {@@ -1086,6 +1090,8 @@if (!strcmp ("strict" , str)) acpi_enforce_resources =ENFORCE_RESOURCES_STRICT ; +else if (!strcmp ("auto" , str)) + acpi_enforce_resources =ENFORCE_RESOURCES_AUTO ;else if (!strcmp ("lax" , str)) acpi_enforce_resources =ENFORCE_RESOURCES_LAX ;else if (!strcmp ("no" , str))@@ -1096,6 +1102,35 @@__setup ("acpi_enforce_resources=" , acpi_enforce_resources_setup); +static acpi_status acpi_detect_asus_atk_cb (acpi_handle obj_handle, +u32 nesting_level,void *context,void **return_value) +{ + *((bool *)return_value) = true; +return AE_CTRL_TERMINATE ; +} + +static int __init acpi_detect_asus_atk (void ) +{ +acpi_status ret; +bool found = false; + +if (acpi_enforce_resources !=ENFORCE_RESOURCES_AUTO ) +return 0 ; + + ret =acpi_get_devices ("ATK0110" , acpi_detect_asus_atk_cb, +NULL , (void **)&found); + +if (ret ==AE_OK && found) { +printk (KERN_DEBUG "Asus ATK0110 interface detected: " +"enforcing resource checking.\n" ); + acpi_enforce_resources =ENFORCE_RESOURCES_STRICT ; + }else + acpi_enforce_resources =ENFORCE_RESOURCES_LAX ; + +return 0 ; +} +fs_initcall (acpi_detect_asus_atk); +/* Check for resource conflicts between ACPI OperationRegions and native * drivers */ int acpi_check_resource_conflict (struct resource *res)Luca
Luca Tettamanti
maintainerQuoted 11 lines · Thomas Renninger
Quoted 10 lines · On Sunday 25 January 2009 22:05:20 Luca Tettamanti wrote:
(This is an improved version of my earlier patch, I've reworked deviced detection to simply check for the desired HID)
The following patch adds "auto" option to "
acpi_enforce_resource"; this value is also the new default.
"auto" enforces strict resource checking - disallowing access by native drivers to IO ports and memory regions claimed by ACPI firmware - when a device with a known ACPI driver is found (currently only ASUS ATK0110 is checked), and reverts to lax checking otherwise.
Quoted 4 lines
Quoted 2 lines
The patch is mainly aimed to block native hwmon drivers from touching monitoring chips that ACPI thinks it own.
Having this in the core ACPI code is ugly.
I think we all agree :-)
Quoted 3 lines
Either this should be more generic (instead of hardcoded "ATK0110" device, use a list to add further specific thermal ACPI drivers). Hmm, maybe it's only ASUS violating the spec?
ASUS it's not actually violating any spec...
Quoted 2 lines
Thinkpads seem to read out extra thermal
data from EC and shouldn't interfere with hwmon drivers.
The point is that there is only 1 physical sensor, which both ACPI and a native driver want to drive; transaction on SMBus to read the sensor are usually in the form "select bank" + "read" and the sequence is *not* atomic. In ASUS case the IO ports are correctly reserved by the firmware, but (historically) this wasn't taken into account. Aside from ASUS the problem is generic since there are two drivers poking at the same hardware; for example there are reports of native drivers interfering with normal TZ polling (see [1]). The EC does not make any difference, since a native driver would speak directly to the monitoring chip, effectively by-passing the EC.
Now, in principle "strict" is the correct behaviour for the resource checking code, but it would break many working setups leaving the users without any kind of hw monitoring. The "auto" hack is meant to force the users to migrate to the ACPI driver...
Quoted 3 lines
Are there other known, model specific ACPI devices, accessing thermal IOs directly which could interfere with hwmon, then it might be worth it.
Right now "auto" is ASUS-specific because *I* know that there any many different native drivers that works on various boards (and I wrote the the ACPI driver...); At least eeepc and (some?) thinkpads have ACPI hwmon capabilities but I don't know whether there are native drivers available or not (but they could be "blacklisted" preemptively like ASUS ATK).
Luca
[1] http://www.lm-sensors.org/ticket/2072 and:
http://thread.gmane.org/gmane.linux.drivers.sensors/12359
Quoted 17 lines · On Thursday 29 January 2009 16:16:38 Luca Tettamanti wrote:
Quoted 11 lines · Thomas Renninger
Quoted 10 lines · On Sunday 25 January 2009 22:05:20 Luca Tettamanti wrote:
(This is an improved version of my earlier patch, I've reworked deviced detection to simply check for the desired HID)
The following patch adds "auto" option to "
acpi_enforce_resource"; this value is also the new default.
"auto" enforces strict resource checking - disallowing access by native drivers to IO ports and memory regions claimed by ACPI firmware - when a device with a known ACPI driver is found (currently only ASUS ATK0110 is checked), and reverts to lax checking otherwise.Quoted 4 lines
Quoted 2 lines
The patch is mainly aimed to block native hwmon drivers from touching monitoring chips that ACPI thinks it own.
Having this in the core ACPI code is ugly.
Quoted 7 lines
I think we all agree :-)
Quoted 3 lines
Either this should be more generic (instead of hardcoded "ATK0110" device, use a list to add further specific thermal ACPI drivers). Hmm, maybe it's only ASUS violating the spec?
ASUS it's not actually violating any spec...
They have to export the temperature through a thermal ACPI device, not through the ASUS specific ATK0110 device. This is what I mean whether there might be other vendor specific ACPI devices violating the spec (by providing temperature read functionality which should be done through the generic thermal ACPI device).
Quoted 8 lines
Quoted 2 lines
Thinkpads seem to read out extra thermal
data from EC and shouldn't interfere with hwmon drivers.The point is that there is only 1 physical sensor, which both ACPI and a native driver want to drive; transaction on SMBus to read the sensor are usually in the form "select bank" + "read" and the sequence is *not* atomic. In ASUS case the IO ports are correctly reserved by the firmware, but (historically) this wasn't taken into account.
I know about this problem.
Quoted 3 lines
Aside from ASUS the problem is generic since there are two drivers poking at the same hardware; for example there are reports of native drivers interfering with normal TZ polling (see [1])
Yes, this is even worse as the check that you want to add will not catch it. Looking a bit through ASUS DSDTs this seem to be common on most of them. I put some example DSDT code of a recent M2A-VM-HDMI workstation at the end.
Quoted 8 lines
The EC does not
make any difference, since a native driver would speak directly to the monitoring chip, effectively by-passing the EC.
Now, in principle "strict" is the correct behaviour for the resource checking code, but it would break many working setups leaving the users without any kind of hw monitoring. The "auto" hack is meant to force the users to migrate to the ACPI driver...
Quoted 7 lines
Quoted 3 lines
Are there other known, model specific ACPI devices, accessing thermal IOs directly which could interfere with hwmon, then it might be worth it.
Right now "auto" is ASUS-specific because *I* know that there any many different native drivers that works on various boards (and I wrote the the ACPI driver...);
Hmm, grep -r ATK0110 drivers/platform/x86 in latest ACPI test tree is empty, can you give me a pointer to a recent version of your driver.
Quoted 4 lines
At least eeepc and (some?) thinkpads have ACPI
hwmon capabilities but I don't know whether there are native drivers available or not (but they could be "blacklisted" preemptively like ASUS ATK).
I expect that ASUS only will interfere with specific hwmon driver(s)? So why don't you move the check into the hwmon driver and make it not load on these systems?
It's still ugly, but IMO better than to pollute the ACPI core.
Here some thermal DSDT parts of a recent ASUS machine:
The temperature exported through the generic thermal ACPI device:
OperationRegion (IP, SystemIO, 0x022D, 0x02)
Field (IP, ByteAcc, NoLock, Preserve)
{
INDX, 8,
DAT0, 8
}
Method (SBYT, 2, NotSerialized)
{
Store (Arg0, INDX)
Store (Arg1, DAT0)
}
Method (GBYT, 1, NotSerialized)
{
Store (Arg0, INDX)
Store (DAT0, Local0)
Return (Local0)
}Method (_TMP, 0, NotSerialized)
{
/* makes use of RTMP which uses GBYT and SBYT to actually read
the temp
*/
}There is another RTMP function in ATK0110 (do you use that?) The other RTMP in ATK0110 seem to use this IO area to read out the temperatures (MBTE and TSR1, for mainboard and CPU temp?):
OperationRegion (HWRE, SystemIO, 0x022D, 0x02)
Field (HWRE, ByteAcc, NoLock, Preserve)
{
HIDX, 8,
HDAT, 8
}
IndexField (HIDX, HDAT, ByteAcc, NoLock, Preserve)
{
Offset (0x0B),
FD11, 3,
FD12, 3,
FD13, 1,
Offset (0x0C),
Offset (0x0D),
FAN1, 8,
FAN2, 8,
Offset (0x18),
FEN1, 8,
FEN2, 8,
Offset (0x20),
VCOR, 8,
V33V, 8,
Offset (0x23),
V50V, 8,
V12V, 8,
Offset (0x29),
TSR1, 8,
MBTE, 8,
Offset (0x80),
FAN3, 8,
FEN3, 8
}Can the hwmon people identify which hwmon driver is used for above devices and the ATK0110 check be inserted there.
On the M2A-VM-HDMI machine where DSDT extracts from above are, running libsensors I get:
Driver `it87' (should be inserted):
Detects correctly:
* ISA bus, address 0x228
Chip `ITE IT8716F Super IO Sensors' (confidence: 9)
Driver `to-be-written' (should be inserted):
Detects correctly:
* Chip `AMD K10 thermal sensors' (confidence: 9)
If this is an ASUS only problem with very specific thermal sensors, better add the quirk at the specific sensor driver.
If this is something general, then maybe you can convince Len to add something to the ACPI core, but this should be more generic then.
Thomas
PS: I just realize that in ATK0110 the same thermal device (IO port 0x22D) is used as in the generic ACPI device (_TMP). So it looks like your asus thermal driver will not only interfere with the hwmon driver, but with the ACPI thermal driver itself.
Quoted 11 lines · Thomas Renninger
Quoted 4 lines
Quoted 3 lines
Either this should be more generic (instead of hardcoded "ATK0110" device, use a list to add further specific thermal ACPI drivers). Hmm, maybe it's only ASUS violating the spec?
ASUS it's not actually violating any spec...
They have to export the temperature through a thermal ACPI device, not through the ASUS specific ATK0110 device. This is what I mean whether there might be other vendor specific ACPI devices violating the spec (by providing temperature read functionality which should be done through the generic thermal ACPI device).
hwmon IC's monitor far more then just temperatures, ASUS is doing the right thing here by providing an ACPI interface to also read voltages and fan speeds, so that these can be read in a way that does not interfere with the ACPI code.
And although even their interface does not expose the full functionality of the hwmon IC's, it is much much better then what the thermal ACPI code gives us.
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Thinkpads seem to read out extra thermal
data from EC and shouldn't interfere with hwmon drivers.The point is that there is only 1 physical sensor, which both ACPI and a native driver want to drive; transaction on SMBus to read the sensor are usually in the form "select bank" + "read" and the sequence is *not* atomic. In ASUS case the IO ports are correctly reserved by the firmware, but (historically) this wasn't taken into account.
Quoted 7 lines
I know about this problem.
Quoted 3 lines
Aside from ASUS the problem is generic since there are two drivers poking at the same hardware; for example there are reports of native drivers interfering with normal TZ polling (see [1])
Yes, this is even worse as the check that you want to add will not catch it.
Ack, so the proper solution would be to just make the acpi_enforce_resources strict by default, but this may cause lack of functionality for some user who are currently using native drivers for hwmon features. Which is why I (hwmon subsytem contributor and Jean Delvare (i2c and (ex)hwmon subsystem maintainer) proposed this auto setting as a compromise. I'm fine with changing the default to strict, AFAIK Jean prefers the auto setting.
<snip>
Quoted 5 lines
Quoted 4 lines
At least eeepc and (some?) thinkpads have ACPI
hwmon capabilities but I don't know whether there are native drivers available or not (but they could be "blacklisted" preemptively like ASUS ATK).I expect that ASUS only will interfere with specific hwmon driver(s)?
Yes only those used on their motherboards, and given the wide range of motherboard ASUS produces and they offer the ATK0110 interface on almost all of them, it pretty much comes down to "all hwmon and smbus drivers", although I'm sure if we look we can find exceptions.
Quoted 4 lines
So why don't you move the check into the hwmon driver and make it not load on these systems?
It's still ugly, but IMO better than to pollute the ACPI core.
Because we do not want to do this in a zillion places when it should be done in only one. The right solution is to make acpi_enforce_resources strict the default, the auto setting is meant as a slow migration path to that right solution, as doing that right now probably will cause lots of complaints.
Actually, the really right solution would be for the ACPI subsystem to actually claim all the resources using the regular resource tracking so that drivers who want to check for resource conflicts with ACPI do not have to explicitly call acpi_check_resource_conflict() (and friends), but instead will get an error when trying to claim the resources from the regular resource system. However chances are this will break things on quite a lot of systems, still it would be the right thing to do in the end IMHO.
<snip>
Quoted 3 lines
If this is an ASUS only problem with very specific thermal sensors, better add the quirk at the specific sensor driver.
It is neither ASUS specific, not is it limited to specific hwmon IC's, these are not thermal sensors, they are capable of monitoring far more then just temperature, which is why the ACPI thermal device interface is insufficient.
Quoted 4 lines
PS: I just realize that in ATK0110 the same thermal device (IO port
0x22D) is used as in the generic ACPI device (_TMP). So it looks like your asus thermal driver will not only interfere with the hwmon driver, but with the ACPI thermal driver itself.
I would expect the ACPI code to take care of any conflicts between the various interfaces it offers itself. And if it is unsafe to call multiple ACPI methods at the same time, I would expect the ACPI core to fix this.
Also note that the above paragraph actually advocates in favour of making some kind of change to acpi_enforce_resources. Proposal, what if we change the auto setting to not only mean "strict" when an ATK0110 interface is present, but also when the ACPI thermal zone interface is present ?
Thanks & Regards,
Hans
Quoted 83 lines · Hans de Goede
Quoted 11 lines · Thomas Renninger
Quoted 4 lines
Quoted 3 lines
Either this should be more generic (instead of hardcoded "ATK0110" device, use a list to add further specific thermal ACPI drivers). Hmm, maybe it's only ASUS violating the spec?
ASUS it's not actually violating any spec...
They have to export the temperature through a thermal ACPI device, not through the ASUS specific ATK0110 device. This is what I mean whether there might be other vendor specific ACPI devices violating the spec (by providing temperature read functionality which should be done through the generic thermal ACPI device).
hwmon IC's monitor far more then just temperatures, ASUS is doing the right thing here by providing an ACPI interface to also read voltages and fan speeds, so that these can be read in a way that does not interfere with the ACPI code.
And although even their interface does not expose the full functionality of the hwmon IC's, it is much much better then what the thermal ACPI code gives us.
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Thinkpads seem to read out extra thermal
data from EC and shouldn't interfere with hwmon drivers.The point is that there is only 1 physical sensor, which both ACPI and a native driver want to drive; transaction on SMBus to read the sensor are usually in the form "select bank" + "read" and the sequence is *not* atomic. In ASUS case the IO ports are correctly reserved by the firmware, but (historically) this wasn't taken into account.
Quoted 7 lines
I know about this problem.
Quoted 3 lines
Aside from ASUS the problem is generic since there are two drivers poking at the same hardware; for example there are reports of native drivers interfering with normal TZ polling (see [1])
Yes, this is even worse as the check that you want to add will not catch it.
Ack, so the proper solution would be to just make the
acpi_enforce_resourcesstrict by default, but this may cause lack of functionality for some user who are currently using native drivers for hwmon features. Which is why I (hwmon subsytem contributor and Jean Delvare (i2c and (ex)hwmon subsystem maintainer) proposed this auto setting as a compromise. I'm fine with changing the default to strict, AFAIK Jean prefers the auto setting.<snip>
Quoted 5 lines
Quoted 4 lines
At least eeepc and (some?) thinkpads have ACPI
hwmon capabilities but I don't know whether there are native drivers available or not (but they could be "blacklisted" preemptively like ASUS ATK).I expect that ASUS only will interfere with specific hwmon driver(s)?
Yes only those used on their motherboards, and given the wide range of motherboard ASUS produces and they offer the ATK0110 interface on almost all of them, it pretty much comes down to "all hwmon and smbus drivers", although I'm sure if we look we can find exceptions.
Quoted 4 lines
So why don't you move the check into the hwmon driver and make it not load on these systems?
It's still ugly, but IMO better than to pollute the ACPI core.Because we do not want to do this in a zillion places when it should be done in only one. The right solution is to make
acpi_enforce_resourcesstrict the default, the auto setting is meant as a slow migration path to that right solution, as doing that right now probably will cause lots of complaints.Actually, the really right solution would be for the ACPI subsystem to actually claim all the resources using the regular resource tracking so that drivers who want to check for resource conflicts with ACPI do not have to explicitly call
acpi_check_resource_conflict()(and friends), but instead will get an error when trying to claim the resources from the regular resource system. However chances are this will break things on quite a lot of systems, still it would be the right thing to do in the end IMHO.<snip>
Quoted 3 lines
If this is an ASUS only problem with very specific thermal sensors, better add the quirk at the specific sensor driver.
It is neither ASUS specific, not is it limited to specific hwmon IC's, these are not thermal sensors, they are capable of monitoring far more then just temperature, which is why the ACPI thermal device interface is insufficient.
Quoted 8 lines
Quoted 4 lines
PS: I just realize that in ATK0110 the same thermal device (IO port
0x22D) is used as in the generic ACPI device (_TMP). So it looks like your asus thermal driver will not only interfere with the hwmon driver, but with the ACPI thermal driver itself.I would expect the ACPI code to take care of any conflicts between the various interfaces it offers itself. And if it is unsafe to call multiple ACPI methods at the same time, I would expect the ACPI core to fix this.
For the records, I second everything Hans wrote above.
Quoted 4 lines
Also note that the above paragraph actually advocates in favour of making some kind of change to
acpi_enforce_resources. Proposal, what if we change the auto setting to not only mean "strict" when an ATK0110 interface is present, but also when the ACPI thermal zone interface is present ?
I expect problems if you do that without any exception. There are a number of desktop motherboards out there with pretty broken TZ implementations. To mention just one, my Jetway K8M8MS motherboard has a TZ which reports 9 degrees C all the time. I disassembled the DSDT to find out that the code is incorrect and they are reading a configuration register instead of the temperature register. Apparently customers didn't care at all, as this was never fixed. I reported to Jetway but didn't get any answer.
More generally, the ACPI thermal zone doesn't provide a tenth of the functionality of native hardware monitoring drivers on desktop and server systems. So switching to strict when a thermal zone is found would be as painful as switching to strict unconditionally, in that it will cause a loss of functionality for many users out there. Whoever does this will first have to become the i2c maintainer and the hwmon maintainer, and then take all the flames. That won't be me for sure.
Thanks,
Signature · 1 line
Jean Delvare
Quoted 56 lines · On Thursday 29 January 2009 19:58:00 Hans de Goede wrote:
Quoted 4 lines · Thomas Renninger
Quoted 4 lines
Quoted 3 lines
Either this should be more generic (instead of hardcoded "ATK0110" device, use a list to add further specific thermal ACPI drivers). Hmm, maybe it's only ASUS violating the spec?
Quoted 8 lines
Quoted 1 line
ASUS it's not actually violating any spec...
They have to export the temperature through a thermal ACPI device, not through the ASUS specific ATK0110 device. This is what I mean whether there might be other vendor specific ACPI devices violating the spec (by providing temperature read functionality which should be done through the generic thermal ACPI device).
hwmon IC's monitor far more then just temperatures, ASUS is doing the right thing here by providing an ACPI interface to also read voltages and fan speeds, so that these can be read in a way that does not interfere with the ACPI code.
And although even their interface does not expose the full functionality of the hwmon IC's, it is much much better then what the thermal ACPI code gives us.
Quoted 9 lines
Quoted 8 lines
Quoted 2 lines
Thinkpads seem to read out extra thermal
data from EC and shouldn't interfere with hwmon drivers.The point is that there is only 1 physical sensor, which both ACPI and a native driver want to drive; transaction on SMBus to read the sensor are usually in the form "select bank" + "read" and the sequence is *not* atomic. In ASUS case the IO ports are correctly reserved by the firmware, but (historically) this wasn't taken into account.
Quoted 8 lines
I know about this problem.
Quoted 3 lines
Aside from ASUS the problem is generic since there are two drivers poking at the same hardware; for example there are reports of native drivers interfering with normal TZ polling (see [1])
Yes, this is even worse as the check that you want to add will not catch it.
Ack, so the proper solution would be to just make the
acpi_enforce_resourcesstrict by default, but this may cause lack of functionality for some user who are currently using native drivers for hwmon features. Which is why I (hwmon subsytem contributor and Jean Delvare (i2c and (ex)hwmon subsystem maintainer) proposed this auto setting as a compromise. I'm fine with changing the default to strict, AFAIK Jean prefers the auto setting.<snip>
Quoted 5 lines
Quoted 4 lines
At least eeepc and (some?) thinkpads have ACPI
hwmon capabilities but I don't know whether there are native drivers available or not (but they could be "blacklisted" preemptively like ASUS ATK).
Quoted 6 lines
Quoted 1 line
I expect that ASUS only will interfere with specific hwmon driver(s)?
Yes only those used on their motherboards, and given the wide range of motherboard ASUS produces and they offer the ATK0110 interface on almost all of them, it pretty much comes down to "all hwmon and smbus drivers", although I'm sure if we look we can find exceptions.
I thought it may only be one specific hwmon driver which could interfere on ASUS boards with the ATK0110 device. I agree that it would not make sense to cluster all hwmon drivers.
The problem is similar to the video backlight switching problem (legacy drivers vs preferred generic ACPI video driver) where you also must know which driver to take before module loading time.
I hoped to be able to come up with something more clever or say a nicer solution or at least a short discussion. But I also have no better idea. Maybe all such code should end up in a drivers/acpi/quirks.c file at some time, similar to other places in the kernel.
I think it's time for Len looking at this. I wonder whether he will take this patch or why he won't.
This is an ugly problem which unfortunately needs an ugly fix/check.
This code snippet should be part of your ATK0110 driver then and not submitted/committed standalone?
Please take me into CC the next time you submit your asus-laptop/acpi driver, I like to have a look at it and can also give it a test.
Quoted 30 lines
Quoted 3 lines
So why don't you move the check into the hwmon driver and make it not load on these systems?
It's still ugly, but IMO better than to pollute the ACPI core.Because we do not want to do this in a zillion places when it should be done in only one. The right solution is to make
acpi_enforce_resourcesstrict the default, the auto setting is meant as a slow migration path to that right solution, as doing that right now probably will cause lots of complaints.Actually, the really right solution would be for the ACPI subsystem to actually claim all the resources using the regular resource tracking so that drivers who want to check for resource conflicts with ACPI do not have to explicitly call
acpi_check_resource_conflict()(and friends), but instead will get an error when trying to claim the resources from the regular resource system. However chances are this will break things on quite a lot of systems, still it would be the right thing to do in the end IMHO.<snip>
Quoted 2 lines
If this is an ASUS only problem with very specific thermal sensors, better add the quirk at the specific sensor driver.
It is neither ASUS specific, not is it limited to specific hwmon IC's, these are not thermal sensors, they are capable of monitoring far more then just temperature, which is why the ACPI thermal device interface is insufficient.
Quoted 8 lines
Quoted 4 lines
PS: I just realize that in ATK0110 the same thermal device (IO port
0x22D) is used as in the generic ACPI device (_TMP). So it looks like your asus thermal driver will not only interfere with the hwmon driver, but with the ACPI thermal driver itself.I would expect the ACPI code to take care of any conflicts between the various interfaces it offers itself. And if it is unsafe to call multiple ACPI methods at the same time, I would expect the ACPI core to fix this.
Yes. ACPI can easily make sure that not several resources are accessed at the same time. It's the ACPI vs native OS code where this is so hard.
Thomas
Quoted 4 lines
Also note that the above paragraph actually advocates in favour of making some kind of change to
acpi_enforce_resources. Proposal, what if we change the auto setting to not only mean "strict" when an ATK0110 interface is present, but also when the ACPI thermal zone interface is present ?
Luca Tettamanti
maintainerQuoted 8 lines · Thomas Renninger
I thought it may only be one specific hwmon driver which could interfere on ASUS boards with the ATK0110 device. I agree that it would not make sense to cluster all hwmon drivers.
The problem is similar to the video backlight switching problem (legacy drivers vs preferred generic ACPI video driver) where you also must know which driver to take before module loading time.
Quoted 8 lines
I hoped to be able to come up with something more clever or say a nicer solution or at least a short discussion. But I also have no better idea. Maybe all such code should end up in a
drivers/acpi/quirks.cfile at some time, similar to other places in the kernel.I think it's time for Len looking at this. I wonder whether he will take this patch or why he won't.
This is an ugly problem which unfortunately needs an ugly fix/check.
I've rewritten the patch, the idea behind it is still the same but the solution is more generic. The code checks a list of DMI entries and (optionally) a HID for each entry; if the DMI data matches and the HID (if not NULL) is found then resource checking is set to strict, otherwise it falls back to lax.
---
Just RFC, it's still UNTESTED...
drivers/acpi/osl.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 76 insertions(+), 3 deletions(-)
drivers/acpi/osl.c +76 -3
@@ -1063,7 +1063,10 @@ __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup);* in arbitrary AML code and can interfere with legacy drivers. * acpi_enforce_resources= can be set to: * -* - strict (2) +* - auto (2) +* -> detect possible conflicts with ACPI drivers and switch to +* strict if needed, otherwise act like lax +* - strict (3) * -> further driver trying to access the resources will not load * - lax (default) (1) * -> further driver trying to access the resources will load, but you
@@ -1073,11 +1076,12 @@ __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup);* -> ACPI Operation Region resources will not be registered * */ -#define ENFORCE_RESOURCES_STRICT 2 +#define ENFORCE_RESOURCES_STRICT 3 +#define ENFORCE_RESOURCES_AUTO 2#define ENFORCE_RESOURCES_LAX 1#define ENFORCE_RESOURCES_NO 0 -static unsigned int acpi_enforce_resources =ENFORCE_RESOURCES_LAX ; +static unsigned int acpi_enforce_resources =ENFORCE_RESOURCES_AUTO ;static int __init acpi_enforce_resources_setup (char *str) {
@@ -1086,6 +1090,8 @@ static int __init acpi_enforce_resources_setup(char *str)if (!strcmp ("strict" , str)) acpi_enforce_resources =ENFORCE_RESOURCES_STRICT ; +else if (!strcmp ("auto" , str)) + acpi_enforce_resources =ENFORCE_RESOURCES_AUTO ;else if (!strcmp ("lax" , str)) acpi_enforce_resources =ENFORCE_RESOURCES_LAX ;else if (!strcmp ("no" , str))
@@ -1096,6 +1102,73 @@ static int __init acpi_enforce_resources_setup(char *str)__setup ("acpi_enforce_resources=" , acpi_enforce_resources_setup); +static acpi_status acpi_res_quick_check_hid_cb (acpi_handle obj_handle, +u32 nesting_level,void *context,void **return_value) +{ + *((bool *)return_value) = true; +return AE_CTRL_TERMINATE ; +} + +static int acpi_res_quick_check_hid (const struct dmi_system_id *d) +{ +acpi_status ret; +bool found = false; +char *hid; + +if (!d->driver_data) + goto strict; + + hid = d->driver_data; + ret =acpi_get_devices (hid, acpi_res_quick_check_hid_cb, +NULL , (void **)&found); + +if (ret ==AE_OK && found) + goto strict; + +return 0 ; +strict: +printk (KERN_DEBUG "ACPI: detected %s system: " +"enforcing strict resource checking\n" , d->ident); +return 1 ; +} + +/* The following systems have ACPI drivers that might overlap the +* functionality of native drivers (mostly in hwmon subsys). If +* acpi_enforce_resources is set to auto the following table is +* used to enforce strict checking in matching systems, in order +* to avoid conflicts. +* Note that driver_data and the acpi_res_quick_check_hid callback +* are used to further refine the match, checking for the presence +* of the given HID (driver_data) in the DSDT. Both fields are +* optional for DMI-only rules. +*/ +static const struct dmi_system_id resource_quirks[] = { + { + .ident ="Asus" , + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"ASUSTeK Computer" ), + }, + .driver_data ="ATK0110" , + .callback = acpi_res_quick_check_hid, + }, + { } +}; + +static int __init acpi_apply_resource_quirk (void ) +{ +if (acpi_enforce_resources !=ENFORCE_RESOURCES_AUTO ) +return 0 ; + +dmi_check_system (resource_quirks); + +if (acpi_enforce_resources ==ENFORCE_RESOURCES_AUTO ) +/* This system is not listed, fallback to 'lax' */ + acpi_enforce_resources =ENFORCE_RESOURCES_LAX ; + +return 0 ; +} +fs_initcall (acpi_apply_resource_quirk); +/* Check for resource conflicts between ACPI OperationRegions and native * drivers */ int acpi_check_resource_conflict (struct resource *res)
Luca
Signature · 2 lines
Mi piace avere amici rispettabili; Mi piace essere il peggiore della compagnia.
Hi Luca,
Quoted 29 lines · Luca Tettamanti
I've rewritten the patch, the idea behind it is still the same but the solution is more generic. The code checks a list of DMI entries and (optionally) a HID for each entry; if the DMI data matches and the HID (if not NULL) is found then resource checking is set to strict, otherwise it falls back to lax.
---
Just RFC, it's still UNTESTED...drivers/acpi/osl.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 76 insertions(+), 3 deletions(-)drivers/acpi/osl.c +4
-1@@ -1063,7 +1063,10 @@ __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup);* in arbitrary AML code and can interfere with legacy drivers. * acpi_enforce_resources= can be set to: * -* - strict (2) +* - auto (2) +* -> detect possible conflicts with ACPI drivers and switch to +* strict if needed, otherwise act like lax +* - strict (3) * -> further driver trying to access the resources will not load * - lax (default) (1) * -> further driver trying to access the resources will load, but you
drivers/acpi/osl.c __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup); · line 1082
Quoted 8 lines
drivers/acpi/osl.c +2
-1@@ -1073,11 +1076,12 @@ __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup);* -> ACPI Operation Region resources will not be registered * */ -#define ENFORCE_RESOURCES_STRICT 2 +#define ENFORCE_RESOURCES_STRICT 3 +#define ENFORCE_RESOURCES_AUTO 2#define ENFORCE_RESOURCES_LAX 1#define ENFORCE_RESOURCES_NO 0
I don't see any reason to change ENFORCE_RESOURCES_STRICT from 2 to 3. Just add ENFORCE_RESOURCES_AUTO as 3 and that's it, makes your patch smaller.
Quoted 36 lines
drivers/acpi/osl.c +20
-1-static unsigned int acpi_enforce_resources =ENFORCE_RESOURCES_LAX ; +static unsigned int acpi_enforce_resources =ENFORCE_RESOURCES_AUTO ;static int __init acpi_enforce_resources_setup (char *str) {@@ -1086,6 +1090,8 @@ static int __init acpi_enforce_resources_setup(char *str)if (!strcmp ("strict" , str)) acpi_enforce_resources =ENFORCE_RESOURCES_STRICT ; +else if (!strcmp ("auto" , str)) + acpi_enforce_resources =ENFORCE_RESOURCES_AUTO ;else if (!strcmp ("lax" , str)) acpi_enforce_resources =ENFORCE_RESOURCES_LAX ;else if (!strcmp ("no" , str))@@ -1096,6 +1102,73 @@ static int __init acpi_enforce_resources_setup(char *str)__setup ("acpi_enforce_resources=" , acpi_enforce_resources_setup); +static acpi_status acpi_res_quick_check_hid_cb (acpi_handle obj_handle, +u32 nesting_level,void *context,void **return_value) +{ + *((bool *)return_value) = true; +return AE_CTRL_TERMINATE ; +} + +static int acpi_res_quick_check_hid (const struct dmi_system_id *d) +{ +acpi_status ret; +bool found = false; +char *hid; + +if (!d->driver_data) + goto strict; + + hid = d->driver_data;
drivers/acpi/osl.c static int __init acpi_enforce_resources_setup(char *str) · line 1131
Quoted 10 lines
drivers/acpi/osl.c +10
-0+ ret =acpi_get_devices (hid, acpi_res_quick_check_hid_cb, +NULL , (void **)&found); + +if (ret ==AE_OK && found) + goto strict; + +return 0 ; +strict: +printk (KERN_DEBUG "ACPI: detected %s system: " +"enforcing strict resource checking\n" , d->ident);
Should be pr_debug().
Quoted 4 lines
drivers/acpi/osl.c +4
-0+return 1 ; +} + +/* The following systems have ACPI drivers that might overlap the
drivers/acpi/osl.c static int __init acpi_enforce_resources_setup(char *str) · line 1145
Quoted 10 lines
drivers/acpi/osl.c +10
-0+* functionality of native drivers (mostly in hwmon subsys). If +* acpi_enforce_resources is set to auto the following table is +* used to enforce strict checking in matching systems, in order +* to avoid conflicts. +* Note that driver_data and the acpi_res_quick_check_hid callback +* are used to further refine the match, checking for the presence +* of the given HID (driver_data) in the DSDT. Both fields are +* optional for DMI-only rules. +*/ +static const struct dmi_system_id resource_quirks[] = {
You must include <linux/dmi.h> for this.
I think it's better to tag this structure as __initdata than const, so that it is cleaned up after initialization. Then I guess you can also tag acpi_res_quick_check_hid_cb() and acpi_res_quick_check_hid() as __init so the runtime memory overhead is zero.
Quoted 19 lines
drivers/acpi/osl.c +19
-0+ { + .ident = "Asus", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer"), + }, + .driver_data = "ATK0110", + .callback = acpi_res_quick_check_hid, + }, + { } +}; + +static int __init acpi_apply_resource_quirk (void ) +{ +if (acpi_enforce_resources !=ENFORCE_RESOURCES_AUTO ) +return 0 ; + +dmi_check_system (resource_quirks); + +if (acpi_enforce_resources ==ENFORCE_RESOURCES_AUTO )
drivers/acpi/osl.c static int __init acpi_enforce_resources_setup(char *str) · line 1174
Quoted 10 lines
drivers/acpi/osl.c +7
-0+/* This system is not listed, fallback to 'lax' */ + acpi_enforce_resources =ENFORCE_RESOURCES_LAX ; + +return 0 ; +} +fs_initcall (acpi_apply_resource_quirk); +/* Check for resource conflicts between ACPI OperationRegions and native * drivers */ int acpi_check_resource_conflict (struct resource *res)
Otherwise it looks good to me, pretty clean and flexible. Good work!
Signature · 1 line
Jean Delvare
Luca Tettamanti
maintainerQuoted 20 lines · Jean Delvare
Quoted 19 lines · Luca Tettamanti
drivers/acpi/osl.c +4
-2@@ -1063,7 +1063,10 @@ __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup);* in arbitrary AML code and can interfere with legacy drivers. * acpi_enforce_resources= can be set to: * -* - strict (2) +* - auto (2) +* -> detect possible conflicts with ACPI drivers and switch to +* strict if needed, otherwise act like lax +* - strict (3) * -> further driver trying to access the resources will not load * - lax (default) (1) * -> further driver trying to access the resources will load, but you @@ -1073,11 +1076,12 @@ __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup);* -> ACPI Operation Region resources will not be registered * */ -#define ENFORCE_RESOURCES_STRICT 2
Quoted 8 lines
drivers/acpi/osl.c __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup); · line 1082
Quoted 4 lines
drivers/acpi/osl.c +2
-0+#define ENFORCE_RESOURCES_STRICT 3 +#define ENFORCE_RESOURCES_AUTO 2#define ENFORCE_RESOURCES_LAX 1#define ENFORCE_RESOURCES_NO 0I don't see any reason to change
ENFORCE_RESOURCES_STRICTfrom 2 to 3. Just addENFORCE_RESOURCES_AUTOas 3 and that's it, makes your patch smaller.
There's an unspoken reason ;-) The options are ordered by "strictness", I was experimenting with an API to export the parameter, in order to move the code to a separate quirk file. Since it's not relevant in this patch I'll back out the change.
Quoted 14 lines
Quoted 14 lines
drivers/acpi/osl.c +14
-0+static int acpi_res_quick_check_hid (const struct dmi_system_id *d) +{ +acpi_status ret; +bool found = false; +char *hid; + +if (!d->driver_data) + goto strict; + + hid = d->driver_data; + ret =acpi_get_devices (hid, acpi_res_quick_check_hid_cb, +NULL , (void **)&found); + +if (ret ==AE_OK && found)
Quoted 8 lines
drivers/acpi/osl.c static int __init acpi_enforce_resources_setup(char *str) · line 1131
Quoted 6 lines
drivers/acpi/osl.c +6
-0+ goto strict; + +return 0 ; +strict: +printk (KERN_DEBUG "ACPI: detected %s system: " +"enforcing strict resource checking\n" , d->ident);Should be
pr_debug().
Actually I was considering raising the level to info, it might make easier to explain to the users why they cannot load their favorite driver anymore.
Quoted 8 lines
Quoted 8 lines
drivers/acpi/osl.c +8
-0+return 1 ; +} + +/* The following systems have ACPI drivers that might overlap the +* functionality of native drivers (mostly in hwmon subsys). If +* acpi_enforce_resources is set to auto the following table is +* used to enforce strict checking in matching systems, in order +* to avoid conflicts.
Quoted 8 lines
Quoted 6 lines
+ * Note that
driver_dataand theacpi_res_quick_check_hidcallback
+ * are used to further refine the match, checking for the presence
+ * of the given HID (driver_data) in the DSDT. Both fields are
+ * optional for DMI-only rules.
+ */
+static const structdmi_system_idresource_quirks[] = {You must include <
linux/dmi.h> for this.
Right, it's included indirectly from somewhere...
Quoted 4 lines
I think it's better to tag this structure as
__initdatathan const, so that it is cleaned up after initialization. Then I guess you can also tagacpi_res_quick_check_hid_cb()andacpi_res_quick_check_hid()as__initso the runtime memory overhead is zero.
Ok, will do.
Luca
PATCH 1/2 RFC: ACPI: Interface for ACPI drivers to place quirk code which gets executed early
Hi,
Quoted 30 lines · On Monday 02 February 2009 12:38:24 Luca Tettamanti wrote:
Quoted 20 lines · Jean Delvare
Quoted 19 lines · Luca Tettamanti
drivers/acpi/osl.c +0
-0@@ -1063,7 +1063,10 @@ __setup("acpi_wake_gpes_always_on",
acpi_wake_gpes_always_on_setup); * in arbitrary AML code and can interfere with legacy drivers. * acpi_enforce_resources= can be set to:
*- * - strict (2) + * - auto (2)+ * -> detect possible conflicts with ACPI drivers and switch to
+ * strict if needed, otherwise act like lax
+ * - strict (3)
* -> further driver trying to access the resources will not load
* - lax (default) (1)
* -> further driver trying to access the resources will load, but
you @@ -1073,11 +1076,12 @@ __setup("acpi_wake_gpes_always_on",acpi_wake_gpes_always_on_setup); * -> ACPI Operation Region
resources will not be registered *
*/
-#defineENFORCE_RESOURCES_STRICT2Quoted 8 lines
drivers/acpi/osl.c
Quoted 4 lines
drivers/acpi/osl.c +2
-0+#define ENFORCE_RESOURCES_STRICT 3 +#define ENFORCE_RESOURCES_AUTO 2#define ENFORCE_RESOURCES_LAX 1#define ENFORCE_RESOURCES_NO 0I don't see any reason to change
ENFORCE_RESOURCES_STRICTfrom 2 to 3. Just addENFORCE_RESOURCES_AUTOas 3 and that's it, makes your patch smaller.
Quoted 4 lines
There's an unspoken reason ;-) The options are ordered by "strictness", I was experimenting with an API to export the parameter, in order to move the code to a separate quirk file. Since it's not relevant in this patch I'll back out the change.
I am still running an fsck as I filled up the fs I worked on to 100%, which takes hours for the 300G partition. I hope I didn't mess up something, due to the full fs, but I do not want to wait until tomorrow, you already might want to have a look at this.
These two patches are tested on a ASUS machine and worked as expected, but probably may still need some cleanup.
There is the problem that the quirks are not executed for devices which are not present. But this is due to the poor ACPI hotplug design, which hopefully will be reworked at some time.
Both are against Len's latest ACPI git test branch.
Len, if you like these, tell me and I am going to make them check_patch clean and I will send them again.
Thanks,
Thomas
---
ACPI: Interface for ACPI drivers to place quirk code which gets executed early
Some ACPI drivers need ACPI namespace info before the driver is actually loaded.
Best examples are legacy vs ACPI driver competitors like ATK0110 vs hwmon drivers and the generic ACPI video driver vs laptop drivers. There may also pop up other examples in the future where this interface will become convenient.
drivers/acpi/Makefile +1 -0
@@ -59,3 +59,4 @@ obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o obj-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o obj-$(CONFIG_ACPI_SBS) += sbshc.o obj-$(CONFIG_ACPI_SBS) += sbs.o +obj-y += quirks.o
drivers/acpi/acpi.h new file +8 -0
@@ -0,0 +1,8 @@ +#ifndef _LINUX_LOCAL_ACPI_H +#define _LINUX_LOCAL_ACPI_H + +#include <linux/init.h> + +void __init acpi_device_quirks (void ); + +#endif /* _LINUX_LOCAL_ACPI_H */
drivers/acpi/quirks.c new file +73 -0
73 lines not on this page · raw message
drivers/acpi/scan.c +3 -0
@@ -10,6 +10,7 @@#include <linux/kthread.h> #include <acpi/acpi_drivers.h> +#include "acpi.h" #define _COMPONENT ACPI_BUS_COMPONENTACPI_MODULE_NAME ("scan" );
@@ -1562,6 +1563,8 @@ static int __init acpi_scan_init(void)if (result)acpi_device_unregister (acpi_root,ACPI_BUS_REMOVAL_NORMAL ); +else +acpi_device_quirks (); Done:return result;