2 * Copyright (c) 2019 Red Hat, Inc.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2 or later, as published by the Free Software Foundation.
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * You should have received a copy of the GNU General Public License along with
14 * this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "qemu-common.h"
21 #include "exec/hwaddr.h"
22 #include "qemu/notify.h"
24 #include "hw/i386/topology.h"
25 #include "hw/boards.h"
27 #include "hw/isa/isa.h"
28 #include "hw/i386/ioapic.h"
36 /* TSC rate migration: */
38 /* Enables contiguous-apic-ID mode */
39 bool compat_apic_id_mode
;
48 /* Pointers to devices and objects: */
52 GMappedFile
*initrd_mapped_file
;
54 /* RAM information (sizes, addresses, configuration): */
55 ram_addr_t below_4g_mem_size
, above_4g_mem_size
;
57 /* CPU and apic information: */
58 bool apic_xrupt_override
;
59 unsigned apic_id_limit
;
67 * Address space used by IOAPIC device. All IOAPIC interrupts
68 * will be translated to MSI messages in the address space.
70 AddressSpace
*ioapic_as
;
73 #define X86_MACHINE_SMM "smm"
74 #define X86_MACHINE_ACPI "acpi"
76 #define TYPE_X86_MACHINE MACHINE_TYPE_NAME("x86")
77 #define X86_MACHINE(obj) \
78 OBJECT_CHECK(X86MachineState, (obj), TYPE_X86_MACHINE)
79 #define X86_MACHINE_GET_CLASS(obj) \
80 OBJECT_GET_CLASS(X86MachineClass, obj, TYPE_X86_MACHINE)
81 #define X86_MACHINE_CLASS(class) \
82 OBJECT_CLASS_CHECK(X86MachineClass, class, TYPE_X86_MACHINE)
84 void init_topo_info(X86CPUTopoInfo
*topo_info
, const X86MachineState
*x86ms
);
86 uint32_t x86_cpu_apic_id_from_index(X86MachineState
*pcms
,
87 unsigned int cpu_index
);
89 void x86_cpu_new(X86MachineState
*pcms
, int64_t apic_id
, Error
**errp
);
90 void x86_cpus_init(X86MachineState
*pcms
, int default_cpu_version
);
91 CpuInstanceProperties
x86_cpu_index_to_props(MachineState
*ms
,
93 int64_t x86_get_default_cpu_node_id(const MachineState
*ms
, int idx
);
94 const CPUArchIdList
*x86_possible_cpu_arch_ids(MachineState
*ms
);
96 void x86_bios_rom_init(MemoryRegion
*rom_memory
, bool isapc_ram_fw
);
98 void x86_load_linux(X86MachineState
*x86ms
,
102 bool linuxboot_dma_enabled
);
104 bool x86_machine_is_smm_enabled(X86MachineState
*x86ms
);
105 bool x86_machine_is_acpi_enabled(X86MachineState
*x86ms
);
107 /* Global System Interrupts */
109 #define GSI_NUM_PINS IOAPIC_NUM_PINS
111 typedef struct GSIState
{
112 qemu_irq i8259_irq
[ISA_NUM_IRQS
];
113 qemu_irq ioapic_irq
[IOAPIC_NUM_PINS
];
116 qemu_irq
x86_allocate_cpu_irq(void);
117 void gsi_handler(void *opaque
, int n
, int level
);
118 void ioapic_init_gsi(GSIState
*gsi_state
, const char *parent_name
);