CPUs Control device(\\_SB.PCI0) register interface for the x86 arch is IO port based and existing CPUs AML code assumes _CRS objects would evaluate to a system resource which describes IO Port address. But on ARM arch CPUs control device(\\_SB.PRES) register interface is memory-mapped hence _CRS object should evaluate to system resource which describes memory-mapped base address. Update build CPUs AML function to accept both IO/MEMORY region spaces and accordingly update the _CRS object. Co-developed-by: Keqian Zhu <zhukeqian1@huawei.com> Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com> Signed-off-by: Salil Mehta <salil.mehta@huawei.com> Reviewed-by: Gavin Shan <gshan@redhat.com> Tested-by: Vishnu Pajjuri <vishnu@os.amperecomputing.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Tested-by: Xianglai Li <lixianglai@loongson.cn> Tested-by: Miguel Luis <miguel.luis@oracle.com> Reviewed-by: Shaoqin Huang <shahuang@redhat.com> Tested-by: Zhao Liu <zhao1.liu@intel.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Message-Id: <20240716111502.202344-6-salil.mehta@huawei.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
		
			
				
	
	
		
			79 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			79 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/*
 | 
						|
 * QEMU ACPI hotplug utilities
 | 
						|
 *
 | 
						|
 * Copyright (C) 2016 Red Hat Inc
 | 
						|
 *
 | 
						|
 * Authors:
 | 
						|
 *   Igor Mammedov <imammedo@redhat.com>
 | 
						|
 *
 | 
						|
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 | 
						|
 * See the COPYING file in the top-level directory.
 | 
						|
 */
 | 
						|
#ifndef ACPI_CPU_H
 | 
						|
#define ACPI_CPU_H
 | 
						|
 | 
						|
#include "qapi/qapi-types-acpi.h"
 | 
						|
#include "hw/qdev-core.h"
 | 
						|
#include "hw/acpi/acpi.h"
 | 
						|
#include "hw/acpi/aml-build.h"
 | 
						|
#include "hw/boards.h"
 | 
						|
#include "hw/hotplug.h"
 | 
						|
 | 
						|
#define ACPI_CPU_HOTPLUG_REG_LEN 12
 | 
						|
 | 
						|
typedef struct AcpiCpuStatus {
 | 
						|
    CPUState *cpu;
 | 
						|
    uint64_t arch_id;
 | 
						|
    bool is_inserting;
 | 
						|
    bool is_removing;
 | 
						|
    bool fw_remove;
 | 
						|
    uint32_t ost_event;
 | 
						|
    uint32_t ost_status;
 | 
						|
} AcpiCpuStatus;
 | 
						|
 | 
						|
typedef struct CPUHotplugState {
 | 
						|
    MemoryRegion ctrl_reg;
 | 
						|
    uint32_t selector;
 | 
						|
    uint8_t command;
 | 
						|
    uint32_t dev_count;
 | 
						|
    AcpiCpuStatus *devs;
 | 
						|
} CPUHotplugState;
 | 
						|
 | 
						|
void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev,
 | 
						|
                      CPUHotplugState *cpu_st, DeviceState *dev, Error **errp);
 | 
						|
 | 
						|
void acpi_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
 | 
						|
                                CPUHotplugState *cpu_st,
 | 
						|
                                DeviceState *dev, Error **errp);
 | 
						|
 | 
						|
void acpi_cpu_unplug_cb(CPUHotplugState *cpu_st,
 | 
						|
                        DeviceState *dev, Error **errp);
 | 
						|
 | 
						|
void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,
 | 
						|
                         CPUHotplugState *state, hwaddr base_addr);
 | 
						|
 | 
						|
typedef struct CPUHotplugFeatures {
 | 
						|
    bool acpi_1_compatible;
 | 
						|
    bool has_legacy_cphp;
 | 
						|
    bool fw_unplugs_cpu;
 | 
						|
    const char *smi_path;
 | 
						|
} CPUHotplugFeatures;
 | 
						|
 | 
						|
typedef void (*build_madt_cpu_fn)(int uid, const CPUArchIdList *apic_ids,
 | 
						|
                                  GArray *entry, bool force_enabled);
 | 
						|
 | 
						|
void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
 | 
						|
                    build_madt_cpu_fn build_madt_cpu, hwaddr base_addr,
 | 
						|
                    const char *res_root,
 | 
						|
                    const char *event_handler_method,
 | 
						|
                    AmlRegionSpace rs);
 | 
						|
 | 
						|
void acpi_cpu_ospm_status(CPUHotplugState *cpu_st, ACPIOSTInfoList ***list);
 | 
						|
 | 
						|
extern const VMStateDescription vmstate_cpu_hotplug;
 | 
						|
#define VMSTATE_CPU_HOTPLUG(cpuhp, state) \
 | 
						|
    VMSTATE_STRUCT(cpuhp, state, 1, \
 | 
						|
                   vmstate_cpu_hotplug, CPUHotplugState)
 | 
						|
 | 
						|
#endif
 |