Re: Some SSDT tables are not loading with kernel >= 5.12

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Tue, Jun 08, 2021 at 11:50:15AM +0200, Hans de Goede wrote:
> Hi,
> 
> On 6/7/21 9:18 PM, Hans de Goede wrote:
> > Hi,
> > 
> > On 6/7/21 6:08 PM, Mika Westerberg wrote:
> >> Hi,
> >>
> >> Tried now on ADL-P and TGL systems and the _OSC still works properly.
> >>
> >> Thanks Hans for fixing!
> >>
> >> Feel free to add my Tested-by.
> > 
> > Thank you for testing, unfortunately so far from the comments here:
> > 
> > https://bugzilla.kernel.org/show_bug.cgi?id=213023
> > 
> > it seems that my patch does not help resolve the issues caused
> > by commit 719e1f561afb ("ACPI: Execute platform _OSC also with query
> > bit clear"), where as reverting that commit does resolve them :|
> > 
> > Does anyone have any other ideas how to fix this ?
> 
> The reporter who has done the bisect has commented out the new/second
> _OSC call and that fixes things for them. So I've written a new fix
> (attached), note just as before this is untested ATM.
> 
> Mika, if you can test this one (it replaces the previous one)
> on machines with native USB4 support to check those don't regress then
> that would be great.

I can test it sure, but first let's try to understand what the problem is :)

> I've asked the various reporters from the 2 bugzilla's for this to also
> test this new patch. I'll let you know how that goes.

The _OSC on at least one of the affected platforms look like this:

    If ((Arg0 == ToUUID ("0811b06e-4a27-44f9-8d60-3cbbc22e7b48") /* Platform-wide Capabilities */))
    {
	If ((Arg1 == One))
	{
	    OSCP = CAP0 /* \_SB_._OSC.CAP0 */
	    If ((CAP0 & 0x04))
	    {
		OSCO = 0x04
		If (((SGMD & 0x0F) != 0x02))
		{
		    If ((RTD3 == Zero))
		    {
			CAP0 &= 0x3B
			STS0 |= 0x10
		    }
		}
	    }
	}
	Else
	{
	    STS0 &= 0xFFFFFF00
	    STS0 |= 0x0A
	}
    }
    Else
    {
	STS0 &= 0xFFFFFF00
	STS0 |= 0x06
    }

Probably it is fine to call it several times but the issue is with the mask
that it does:

    CAP0 &= 0x3B

This clears out the upper bits. I think this is actually a BIOS bug as it ends
up clearing OSC_SB_PCLPI_SUPPORT which is probably not intented, and that seems
to cause skipping of the LPI tables or something like that.

The alternative is to pass the original caps to the second _OSC call. I think
this is safe too. While looking at the code, I found a couple of other issues
that should be fixed with the below hack patch.

What do you think about this approach?

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index be7da23fad76..80ff81bb668b 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -290,7 +290,7 @@ static void acpi_bus_osc_negotiate_platform_control(void)
 	struct acpi_osc_context context = {
 		.uuid_str = sb_uuid_str,
 		.rev = 1,
-		.cap.length = 8,
+		.cap.length = sizeof(capbuf),
 		.cap.pointer = capbuf,
 	};
 	acpi_handle handle;
@@ -330,32 +330,21 @@ static void acpi_bus_osc_negotiate_platform_control(void)
 	if (ACPI_FAILURE(acpi_run_osc(handle, &context)))
 		return;
 
-	capbuf_ret = context.ret.pointer;
-	if (context.ret.length <= OSC_SUPPORT_DWORD) {
-		kfree(context.ret.pointer);
-		return;
-	}
+	kfree(context.ret.pointer);
 
-	/*
-	 * Now run _OSC again with query flag clear and with the caps
-	 * supported by both the OS and the platform.
-	 */
+	/* Now run _OSC again with query flag clear */
 	capbuf[OSC_QUERY_DWORD] = 0;
-	capbuf[OSC_SUPPORT_DWORD] = capbuf_ret[OSC_SUPPORT_DWORD];
-	kfree(context.ret.pointer);
 
 	if (ACPI_FAILURE(acpi_run_osc(handle, &context)))
 		return;
 
 	capbuf_ret = context.ret.pointer;
-	if (context.ret.length > OSC_SUPPORT_DWORD) {
-		osc_sb_apei_support_acked =
-			capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_APEI_SUPPORT;
-		osc_pc_lpi_support_confirmed =
-			capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_PCLPI_SUPPORT;
-		osc_sb_native_usb4_support_confirmed =
-			capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_NATIVE_USB4_SUPPORT;
-	}
+	osc_sb_apei_support_acked =
+		capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_APEI_SUPPORT;
+	osc_pc_lpi_support_confirmed =
+		capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_PCLPI_SUPPORT;
+	osc_sb_native_usb4_support_confirmed =
+		capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_NATIVE_USB4_SUPPORT;
 
 	kfree(context.ret.pointer);
 }



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux