Skip to content

Commit 0651ab9

Browse files
pierregondoisrafaeljw
authored andcommitted
ACPI: CPPC: Check _OSC for flexible address space
ACPI 6.2 Section 6.2.11.2 'Platform-Wide OSPM Capabilities': Starting with ACPI Specification 6.2, all _CPC registers can be in PCC, System Memory, System IO, or Functional Fixed Hardware address spaces. OSPM support for this more flexible register space scheme is indicated by the “Flexible Address Space for CPPC Registers” _OSC bit Otherwise (cf ACPI 6.1, s8.4.7.1.1.X), _CPC registers must be in: - PCC or Functional Fixed Hardware address space if defined - SystemMemory address space (NULL register) if not defined Add the corresponding _OSC bit and check it when parsing _CPC objects. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 514ff1b commit 0651ab9

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

drivers/acpi/bus.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,20 @@ bool osc_sb_apei_support_acked;
278278
bool osc_pc_lpi_support_confirmed;
279279
EXPORT_SYMBOL_GPL(osc_pc_lpi_support_confirmed);
280280

281+
/*
282+
* ACPI 6.2 Section 6.2.11.2 'Platform-Wide OSPM Capabilities':
283+
* Starting with ACPI Specification 6.2, all _CPC registers can be in
284+
* PCC, System Memory, System IO, or Functional Fixed Hardware address
285+
* spaces. OSPM support for this more flexible register space scheme is
286+
* indicated by the “Flexible Address Space for CPPC Registers” _OSC bit.
287+
*
288+
* Otherwise (cf ACPI 6.1, s8.4.7.1.1.X), _CPC registers must be in:
289+
* - PCC or Functional Fixed Hardware address space if defined
290+
* - SystemMemory address space (NULL register) if not defined
291+
*/
292+
bool osc_cpc_flexible_adr_space_confirmed;
293+
EXPORT_SYMBOL_GPL(osc_cpc_flexible_adr_space_confirmed);
294+
281295
/*
282296
* ACPI 6.4 Operating System Capabilities for USB.
283297
*/
@@ -321,6 +335,8 @@ static void acpi_bus_osc_negotiate_platform_control(void)
321335
}
322336
#endif
323337

338+
capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_CPC_FLEXIBLE_ADR_SPACE;
339+
324340
if (IS_ENABLED(CONFIG_SCHED_MC_PRIO))
325341
capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_CPC_DIVERSE_HIGH_SUPPORT;
326342

@@ -366,6 +382,8 @@ static void acpi_bus_osc_negotiate_platform_control(void)
366382
capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_PCLPI_SUPPORT;
367383
osc_sb_native_usb4_support_confirmed =
368384
capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_NATIVE_USB4_SUPPORT;
385+
osc_cpc_flexible_adr_space_confirmed =
386+
capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_CPC_FLEXIBLE_ADR_SPACE;
369387
}
370388

371389
kfree(context.ret.pointer);

drivers/acpi/cppc_acpi.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,11 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
736736
if (gas_t->address) {
737737
void __iomem *addr;
738738

739+
if (!osc_cpc_flexible_adr_space_confirmed) {
740+
pr_debug("Flexible address space capability not supported\n");
741+
goto out_free;
742+
}
743+
739744
addr = ioremap(gas_t->address, gas_t->bit_width/8);
740745
if (!addr)
741746
goto out_free;
@@ -758,6 +763,10 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
758763
gas_t->address);
759764
goto out_free;
760765
}
766+
if (!osc_cpc_flexible_adr_space_confirmed) {
767+
pr_debug("Flexible address space capability not supported\n");
768+
goto out_free;
769+
}
761770
} else {
762771
if (gas_t->space_id != ACPI_ADR_SPACE_FIXED_HARDWARE || !cpc_ffh_supported()) {
763772
/* Support only PCC, SystemMemory, SystemIO, and FFH type regs. */

include/linux/acpi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,13 +574,15 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context);
574574
#define OSC_SB_OSLPI_SUPPORT 0x00000100
575575
#define OSC_SB_CPC_DIVERSE_HIGH_SUPPORT 0x00001000
576576
#define OSC_SB_GENERIC_INITIATOR_SUPPORT 0x00002000
577+
#define OSC_SB_CPC_FLEXIBLE_ADR_SPACE 0x00004000
577578
#define OSC_SB_NATIVE_USB4_SUPPORT 0x00040000
578579
#define OSC_SB_PRM_SUPPORT 0x00200000
579580

580581
extern bool osc_sb_apei_support_acked;
581582
extern bool osc_pc_lpi_support_confirmed;
582583
extern bool osc_sb_native_usb4_support_confirmed;
583584
extern bool osc_sb_cppc_not_supported;
585+
extern bool osc_cpc_flexible_adr_space_confirmed;
584586

585587
/* USB4 Capabilities */
586588
#define OSC_USB_USB3_TUNNELING 0x00000001

0 commit comments

Comments
 (0)