Bug 191511 - _DSW compliance - HP Skylake an000na (Star Wars edition)
Summary: _DSW compliance - HP Skylake an000na (Star Wars edition)
Status: CLOSED DOCUMENTED
Alias: None
Product: ACPI
Classification: Unclassified
Component: BIOS (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Lv Zheng
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-30 11:14 UTC by Adam Pigg
Modified: 2017-07-04 01:36 UTC (History)
1 user (show)

See Also:
Kernel Version: 4.9.0
Subsystem:
Regression: No
Bisected commit-id:


Attachments
dmesg output (63.14 KB, text/plain)
2017-01-03 18:54 UTC, Adam Pigg
Details
adpidump output (845.48 KB, text/plain)
2017-01-03 18:55 UTC, Adam Pigg
Details

Description Adam Pigg 2016-12-30 11:14:00 UTC
The following errors are present when booting on my HP Skylake an000na (Star Wars edition) laptop:
[    4.008500] ACPI BIOS Error (bug): \_SB.PCI0.RP07.PXSX._DSW: Insufficient arguments - ASL declared 1, ACPI requires 3 (20160831/nsarguments-181)
[    4.009394] ACPI BIOS Error (bug): \_SB.PCI0.RP09.PXSX._DSW: Insufficient arguments - ASL declared 1, ACPI requires 3 (20160831/nsarguments-181)
[    4.093630] ACPI BIOS Error (bug): \_SB.PCI0.RP09.PXSX._DSW: Insufficient arguments - ASL declared 1, ACPI requires 3 (20160831/nsarguments-181)

Im not sure what the consequences of these are.
Comment 1 Lv Zheng 2017-01-03 02:02:16 UTC
_DSM is device specific.
In ACPI spec, it is:

9.1.1 _DSM (Device Specific Method)
This optional object is a control method that enables devices to provide device specific control functions that are consumed by the device driver.
Arguments: (4)
Arg0 – A Buffer containing a UUID
Arg1 – An Integer containing the Revision ID
Arg2 – An Integer containing the Function Index
Arg3 – A Package that contains function-specific arguments

This is quite like a BIOS bug according to the information above.

But it seems ACPICA requires _DSM to be 4 arguments:
    {{"_DSM",   METHOD_4ARGS (ACPI_TYPE_BUFFER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_PACKAGE),
                METHOD_RETURNS (ACPI_RTYPE_ALL)}}, /* Must return a value, but it can be of any type */
And the error message indicates that ACPICA requires 3 arguments.

So I need to ask:
1. Which kernel are you using?
2. Please upload the acpidump and full dmesg boot log here.

Thanks
Lv
Comment 2 Adam Pigg 2017-01-03 08:28:38 UTC
This is with 4.9.  I didn't notice these errors in 4.8 but I can't guarantee that without installing it again.  I will upload the logs this evening.
Comment 3 Adam Pigg 2017-01-03 18:54:58 UTC
Created attachment 249931 [details]
dmesg output
Comment 4 Adam Pigg 2017-01-03 18:55:16 UTC
Created attachment 249941 [details]
adpidump output
Comment 5 Lv Zheng 2017-01-04 02:09:01 UTC
(In reply to Adam Pigg from comment #2)
> This is with 4.9.  I didn't notice these errors in 4.8 but I can't guarantee
> that without installing it again.  I will upload the logs this evening.

My fault.
It's _DSW, not _DSM.
There should be 3 arguments for it:
Arguments: (3)
Arg0 – An Integer that contains the device wake capability control
0 – Disable the device’s wake capabilities
1 – Enable the device’s wake capabilities
Arg1 – An Integer that contains the target system state (0-4)
Arg2 – An Integer that contains the target device state
0 – The device will remain in state D0
1 – The device will be placed in either state D0 or D1
2 – The device will be placed in either state D0, D1, or D2
3 – The device will be placed in either state D0, D1, D2, or D3
Return Value:
None

And decompiled ASL shows:
	Line 8882:                 Method (_DSW, 1, NotSerialized)  // _DSW: Device Sleep Wake
	Line 8882:                 Method (_DSW, 1, NotSerialized)  // _DSW: Device Sleep Wake
	Line 9461:                 Method (_DSW, 1, NotSerialized)  // _DSW: Device Sleep Wake
	Line 9461:                 Method (_DSW, 1, NotSerialized)  // _DSW: Device Sleep Wake

So this is really a BIOS problem.
I suggest you to contact vendor to correct it.

Thanks and best regards
Lv
Comment 6 Adam Pigg 2017-01-04 22:42:54 UTC
Im not exactly confident about getting a fix from HP, on the grounds im sure they will only support Win10.  Ive posted on the support forum here http://h30434.www3.hp.com/t5/Notebook-Software-and-How-To-Questions/HP-star-wars-an000na-faulty-BIOS-uefi-ACPI-implementation/td-p/5922133.

Is there any possible work-arounds that can be done in the kernel?  In the past ive had workarounds created for a buggy Toshiba acpi.

The laptop suffers from bug https://bugzilla.kernel.org/show_bug.cgi?id=108801 where it doesnt correctly sleep (sometimes reboots when going to sleep) could this be related?
Comment 7 Lv Zheng 2017-01-05 05:30:49 UTC
Yes, we can provide workaround.
But it is better to have some proofs about Windows behavior.
For example,
You need to get amli working for your Windows.
And capture the amli log to prove that 1 argument _DSW(s) are correctly evaluated by Windows AML interpreter.

Otherwise, skipping sanity checks would be used by malicious software to create security holes via Linux ACPI support.

Thanks
Lv
Comment 8 Lv Zheng 2017-01-05 05:31:29 UTC
As you wishes.
Re-open it and wait for amli proofs.

Thanks
Lv
Comment 9 Adam Pigg 2017-01-27 20:27:59 UTC
Hi

Can you give any guidance on getting the AMLI log?

I have got windows running, with WinDbg, and enabled kernel debugging by turning off secure boot.

I can get the amli commands up, but they don't work, eg:

lkd> !amli dl
AMLI_DBGERR: failed to to get the address of ACPI!gDebugger

lkd> !amli set traceon
AMLI_DBGERR: failed to to get the address of ACPI!gDebugger 0
AMLI_DBGERR: failed to to get the address of ACPI!gdwfAMLIInit 0

Thanks
Comment 10 Lv Zheng 2017-03-14 06:30:31 UTC
You need to install a checked build windows.
Otherwise AMLi is not available.
See this page:
https://msdn.microsoft.com/en-us/library/windows/hardware/ff551079(v=vs.85).aspx

At least you need to obtain the checked build acpi.sys to replace your platform one.
Comment 11 Lv Zheng 2017-03-14 06:33:27 UTC
Then in AMLi session, you need to find a way to trigger _DSW execution and save the _DSW execution log from AMLi window.
The log could explain the way Windows executes the _DSW (converts wrong argument or not) and then we can add similar support in Linux.
Comment 12 Lv Zheng 2017-03-14 06:40:08 UTC
(In reply to Lv Zheng from comment #10)
> You need to install a checked build windows.
> Otherwise AMLi is not available.
> See this page:
> https://msdn.microsoft.com/en-us/library/windows/hardware/ff551079(v=vs.85).
> aspx
> 
> At least you need to obtain the checked build acpi.sys to replace your
> platform one.

If you have DDK experiences, comparing to the "free build" which are installed on your normal Windows clones, "checked build" of kernel modules means linking against the core kernel modules that have debugging symbols/logs enabled. And such checked build core modules surely can therefore contain special debugging facilities that are not released in the "free build".
Comment 13 Adam Pigg 2017-03-14 08:03:42 UTC
That looks like it will be a fun undertaking!

In the mean time, i found references to another hp model with the same issue.

http://h30434.www3.hp.com/t5/Notebook-Boot-and-Lockup/Cannot-power-on-more-than-once-without-removing-battery/td-p/5664659

Also, i wondered, would the symantics of a single argument not be the same as the obsoleted _PSW method that DSW replaces?
Comment 14 Zhang Rui 2017-03-27 07:11:25 UTC
ping...
Comment 15 Lv Zheng 2017-03-29 07:48:32 UTC
> Also, i wondered, would the symantics of a single argument not be the same as
> the obsoleted _PSW method that DSW replaces?

I can only find the following from the spec, which doesn't say Arg1 & 2 are optional:

Compatibility Note: The _PSW method is deprecated in ACPI 3.0. The _DSW method should be used instead. OSPM will only use the _PSW method if OSPM does not support _DSW or if the _DSW method is not present.

Changing ACPICA to adopt this should be very easy.
However is there any progress of validated Windows behaviors?

Thanks
Lv
Comment 16 Adam Pigg 2017-03-29 07:58:01 UTC
No progress on windows behaviour.  TBH, i think its out of my skill range, ive no experience in windows driver development/debugging, i stick to desktop and mobile apps! :)

What i meant about the arguments, is that DSW obsoletes PSW, and the first argument of each is the same (enable/disable wake capability).  So, in the case where an invalid implementation of DSW like mine only expects one argument, is it safe to assume the implementation should jst do the same as a call to PSW?
Comment 17 Lv Zheng 2017-03-31 05:15:43 UTC
There is no such exception in predefined methods over so many years.
And there are no spec statements mentioning an optional arguments of the predefined control methods.

So I'm not sure if ACPICA can be changed without knowing Windows behavior.
Let's close this bug as documented.
You can re-open it if you had more useful information.
Comment 18 Adam Pigg 2017-03-31 06:22:30 UTC
Ok, there don't seem to be any side effects (what does acpica do in this situation?) Since kernel 4.10 I've had no issues sleeping/resuming, before that it would routinely reboot after resuming, but its worked 100% for weeks now.

Note You need to log in before you can comment on or make changes to this bug.