Linux-ACPI Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] x86: ignore unspecified bit positions in the ACPI global lock field
@ 2020-03-05 12:24 Jan Engelhardt
  2020-03-14  9:46 ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Engelhardt @ 2020-03-05 12:24 UTC (permalink / raw)
  To: linux-acpi; +Cc: jengelh

The value in "new" is constructed from "old" such that all bits defined
as reserved by the ACPI spec[1] are left untouched. But if those bits
do not happen to be all zero, "new < 3" will not evaluate to true.

The firmware of the laptop(s) Medion MD63490 / Akoya P15648 comes with
garbage inside the "FACS" ACPI table. The starting value is
old=0x4944454d, therefore new=0x4944454e, which is >= 3. Mask off
the reserved bits.

[1] https://uefi.org/sites/default/files/resources/ACPI_6_2.pdf

References: https://bugzilla.kernel.org/show_bug.cgi?id=206553
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
---
 arch/x86/kernel/acpi/boot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 04205ce127a1..f9e84a0e2fa2 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -1740,7 +1740,7 @@ int __acpi_acquire_global_lock(unsigned int *lock)
 		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
 		val = cmpxchg(lock, old, new);
 	} while (unlikely (val != old));
-	return (new < 3) ? -1 : 0;
+	return ((new & 0x3) < 3) ? -1 : 0;
 }
 
 int __acpi_release_global_lock(unsigned int *lock)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86: ignore unspecified bit positions in the ACPI global lock field
  2020-03-05 12:24 [PATCH] x86: ignore unspecified bit positions in the ACPI global lock field Jan Engelhardt
@ 2020-03-14  9:46 ` Rafael J. Wysocki
  2020-03-19 10:46   ` Jan Engelhardt
  0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2020-03-14  9:46 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: linux-acpi

On Thursday, March 5, 2020 1:24:25 PM CET Jan Engelhardt wrote:
> The value in "new" is constructed from "old" such that all bits defined
> as reserved by the ACPI spec[1] are left untouched. But if those bits
> do not happen to be all zero, "new < 3" will not evaluate to true.
> 
> The firmware of the laptop(s) Medion MD63490 / Akoya P15648 comes with
> garbage inside the "FACS" ACPI table. The starting value is
> old=0x4944454d, therefore new=0x4944454e, which is >= 3. Mask off
> the reserved bits.
> 
> [1] https://uefi.org/sites/default/files/resources/ACPI_6_2.pdf
> 
> References: https://bugzilla.kernel.org/show_bug.cgi?id=206553
> Signed-off-by: Jan Engelhardt <jengelh@inai.de>
> ---
>  arch/x86/kernel/acpi/boot.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
> index 04205ce127a1..f9e84a0e2fa2 100644
> --- a/arch/x86/kernel/acpi/boot.c
> +++ b/arch/x86/kernel/acpi/boot.c
> @@ -1740,7 +1740,7 @@ int __acpi_acquire_global_lock(unsigned int *lock)
>  		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
>  		val = cmpxchg(lock, old, new);
>  	} while (unlikely (val != old));
> -	return (new < 3) ? -1 : 0;
> +	return ((new & 0x3) < 3) ? -1 : 0;
>  }
>  
>  int __acpi_release_global_lock(unsigned int *lock)
> 

Applied as 5.7 material, thanks!





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86: ignore unspecified bit positions in the ACPI global lock field
  2020-03-14  9:46 ` Rafael J. Wysocki
@ 2020-03-19 10:46   ` Jan Engelhardt
  2020-03-19 12:22     ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Engelhardt @ 2020-03-19 10:46 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-acpi


On Saturday 2020-03-14 10:46, Rafael J. Wysocki wrote:
>On Thursday, March 5, 2020 1:24:25 PM CET Jan Engelhardt wrote:
>> The value in "new" is constructed from "old" such that all bits defined
>> as reserved by the ACPI spec[1] are left untouched. But if those bits
>> do not happen to be all zero, "new < 3" will not evaluate to true.
>> 
>> The firmware of the laptop(s) Medion MD63490 / Akoya P15648 comes with
>> garbage inside the "FACS" ACPI table. The starting value is
>> old=0x4944454d, therefore new=0x4944454e, which is >= 3. Mask off
>> the reserved bits.
>> 
>> -	return (new < 3) ? -1 : 0;
>> +	return ((new & 0x3) < 3) ? -1 : 0;
>
>Applied as 5.7 material, thanks!

Would it make sense to funnel this into the upcoming 5.6?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86: ignore unspecified bit positions in the ACPI global lock field
  2020-03-19 10:46   ` Jan Engelhardt
@ 2020-03-19 12:22     ` Rafael J. Wysocki
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2020-03-19 12:22 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: linux-acpi

On Thursday, March 19, 2020 11:46:13 AM CET Jan Engelhardt wrote:
> 
> On Saturday 2020-03-14 10:46, Rafael J. Wysocki wrote:
> >On Thursday, March 5, 2020 1:24:25 PM CET Jan Engelhardt wrote:
> >> The value in "new" is constructed from "old" such that all bits defined
> >> as reserved by the ACPI spec[1] are left untouched. But if those bits
> >> do not happen to be all zero, "new < 3" will not evaluate to true.
> >> 
> >> The firmware of the laptop(s) Medion MD63490 / Akoya P15648 comes with
> >> garbage inside the "FACS" ACPI table. The starting value is
> >> old=0x4944454d, therefore new=0x4944454e, which is >= 3. Mask off
> >> the reserved bits.
> >> 
> >> -	return (new < 3) ? -1 : 0;
> >> +	return ((new & 0x3) < 3) ? -1 : 0;
> >
> >Applied as 5.7 material, thanks!
> 
> Would it make sense to funnel this into the upcoming 5.6?
> 

It's been marked for -stable, so it will get into 5.6.y early.

Hopefully, it will get some extra test coverage before that.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-05 12:24 [PATCH] x86: ignore unspecified bit positions in the ACPI global lock field Jan Engelhardt
2020-03-14  9:46 ` Rafael J. Wysocki
2020-03-19 10:46   ` Jan Engelhardt
2020-03-19 12:22     ` Rafael J. Wysocki

Linux-ACPI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-acpi/0 linux-acpi/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-acpi linux-acpi/ https://lore.kernel.org/linux-acpi \
		linux-acpi@vger.kernel.org
	public-inbox-index linux-acpi

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-acpi


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git