diff options
| author | Rafael J. Wysocki <[email protected]> | 2023-08-25 20:40:50 +0200 | 
|---|---|---|
| committer | Rafael J. Wysocki <[email protected]> | 2023-08-25 20:40:50 +0200 | 
| commit | 9bd0c413b90c6517b4a2fbedb74f50df3421b50c (patch) | |
| tree | 62ca7c12798a192264d159856e81f6041b6409ea /drivers/acpi/processor_core.c | |
| parent | e921f8c8dfc2b6aad4e7b4209c411768e2604c98 (diff) | |
| parent | f6fcf03ce8a9b8c135cf47f4978617bdf2829711 (diff) | |
Merge branch 'acpi-processor'
Merge ACPI processor driver changes for 6.6-rc1:
 - Support obtaining physical CPU ID from MADT on LoongArch (Bibo Mao).
 - Convert ACPI CPU initialization to using _OSC instead of _PDC that
   has been depreceted since 2018 and dropped from the specification in
   ACPI 6.5 (Michal Wilczynski, Rafael Wysocki).
* acpi-processor:
  ACPI: processor: LoongArch: Get physical ID from MADT
  ACPI: processor: Refine messages in acpi_early_processor_control_setup()
  ACPI: processor: Remove acpi_hwp_native_thermal_lvt_osc()
  ACPI: processor: Use _OSC to convey OSPM processor support information
  ACPI: processor: Introduce acpi_processor_osc()
  ACPI: processor: Set CAP_SMP_T_SWCOORD in arch_acpi_set_proc_cap_bits()
  ACPI: processor: Clear C_C2C3_FFH and C_C1_FFH in arch_acpi_set_proc_cap_bits()
  ACPI: processor: Rename ACPI_PDC symbols
  ACPI: processor: Refactor arch_acpi_set_pdc_bits()
  ACPI: processor: Move processor_physically_present() to acpi_processor.c
  ACPI: processor: Move MWAIT quirk out of acpi_processor.c
Diffstat (limited to 'drivers/acpi/processor_core.c')
| -rw-r--r-- | drivers/acpi/processor_core.c | 29 | 
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index d6606a9f2da6..7dd6dbaa98c3 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -132,6 +132,30 @@ static int map_rintc_hartid(struct acpi_subtable_header *entry,  	return -EINVAL;  } +/* + * Retrieve LoongArch CPU physical id + */ +static int map_core_pic_id(struct acpi_subtable_header *entry, +		int device_declaration, u32 acpi_id, phys_cpuid_t *phys_id) +{ +	struct acpi_madt_core_pic *core_pic = +		container_of(entry, struct acpi_madt_core_pic, header); + +	if (!(core_pic->flags & ACPI_MADT_ENABLED)) +		return -ENODEV; + +	/* device_declaration means Device object in DSDT, in LoongArch +	 * system, logical processor acpi_id is required in _UID property +	 * of DSDT table, so we should check device_declaration here +	 */ +	if (device_declaration && (core_pic->processor_id == acpi_id)) { +		*phys_id = core_pic->core_id; +		return 0; +	} + +	return -EINVAL; +} +  static phys_cpuid_t map_madt_entry(struct acpi_table_madt *madt,  				   int type, u32 acpi_id)  { @@ -165,6 +189,9 @@ static phys_cpuid_t map_madt_entry(struct acpi_table_madt *madt,  		} else if (header->type == ACPI_MADT_TYPE_RINTC) {  			if (!map_rintc_hartid(header, type, acpi_id, &phys_id))  				break; +		} else if (header->type == ACPI_MADT_TYPE_CORE_PIC) { +			if (!map_core_pic_id(header, type, acpi_id, &phys_id)) +				break;  		}  		entry += header->length;  	} @@ -216,6 +243,8 @@ static phys_cpuid_t map_mat_entry(acpi_handle handle, int type, u32 acpi_id)  		map_x2apic_id(header, type, acpi_id, &phys_id);  	else if (header->type == ACPI_MADT_TYPE_GENERIC_INTERRUPT)  		map_gicc_mpidr(header, type, acpi_id, &phys_id); +	else if (header->type == ACPI_MADT_TYPE_CORE_PIC) +		map_core_pic_id(header, type, acpi_id, &phys_id);  exit:  	kfree(buffer.pointer);  |