acpi/processor: sanitize _OSC/_PDC capabilities for Xen dom0
authorRoger Pau Monne <roger.pau@citrix.com>
Wed, 8 Nov 2023 21:25:15 +0000 (16:25 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Nov 2023 17:19:57 +0000 (17:19 +0000)
commit32ca78deedce610f28a85174a86429d66e1e0e02
tree12d16e7b7424ab3926af0e6b4f81928de7e32bdb
parent065ae2ec2b8af7c959fad1533620b83835d71c20
acpi/processor: sanitize _OSC/_PDC capabilities for Xen dom0

commit bfa993b355d33a438a746523e7129391c8664e8a upstream.

The Processor capability bits notify ACPI of the OS capabilities, and
so ACPI can adjust the return of other Processor methods taking the OS
capabilities into account.

When Linux is running as a Xen dom0, the hypervisor is the entity
in charge of processor power management, and hence Xen needs to make
sure the capabilities reported by _OSC/_PDC match the capabilities of
the driver in Xen.

Introduce a small helper to sanitize the buffer when running as Xen
dom0.

When Xen supports HWP, this serves as the equivalent of commit
a21211672c9a ("ACPI / processor: Request native thermal interrupt
handling via _OSC") to avoid SMM crashes.  Xen will set bit
ACPI_PROC_CAP_COLLAB_PROC_PERF (bit 12) in the capability bits and the
_OSC/_PDC call will apply it.

[ jandryuk: Mention Xen HWP's need.  Support _OSC & _PDC ]
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
Reviewed-by: Michal Wilczynski <michal.wilczynski@intel.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Link: https://lore.kernel.org/r/20231108212517.72279-1-jandryuk@gmail.com
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/include/asm/acpi.h
arch/x86/include/asm/xen/hypervisor.h
drivers/xen/pcpu.c