mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
* Bulgarian translation update (Alexander) * RTC and PC refactorings (Hervé, Philippe, Sergio) * RTC fix (Marcelo) * More comprehensive MCE logging (Mario) * x86 IGNNE implementation (Paolo) * Microvm machine type (Sergio) * Support for UMONITOR/UMWAIT/TPAUSE (Tao) * Do not use %m in common code (Thomas) * NoNonArchitecturalCoreSharing Hyper-V enlightenment (Vitaly) * getpagesize cleanups (Wei) # gpg: Signature made Sat 26 Oct 2019 14:39:56 BST # gpg: using RSA key BFFBD25F78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full] # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [full] # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini/tags/for-upstream: (39 commits) i386: implement IGNNE target/i386: introduce cpu_set_fpus target/i386: move FERR handling to target/i386 core: replace getpagesize() with qemu_real_host_page_size audio: fix missing break mc146818rtc: always register rtc to rtc list mc146818rtc: Include mc146818rtc_regs.h directly in mc146818rtc.c mc146818rtc: Move RTC_ISA_IRQ definition mc146818rtc: move structure to header file hw/i386/pc: Remove kvm_i386.h include hw/i386/pc: Extract pc_i8259_create() hw/i386/pc: Move gsi_state creation code hw/i386/pc: Extract pc_gsi_create() target/i386: Add support for save/load IA32_UMWAIT_CONTROL MSR x86/cpu: Add support for UMONITOR/UMWAIT/TPAUSE hw/timer/mc146818rtc: Only include qapi-commands-misc on I386 runstate: ignore exit request in finish migrate state checkpatch: suggest qemu_real_host_page_size instead of getpagesize() or sysconf(_SC_PAGESIZE) MAINTAINERS: add microvm related files hw/i386: Introduce the microvm machine type ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -58,3 +58,6 @@
|
||||
[submodule "roms/opensbi"]
|
||||
path = roms/opensbi
|
||||
url = https://git.qemu.org/git/opensbi.git
|
||||
[submodule "roms/qboot"]
|
||||
path = roms/qboot
|
||||
url = https://github.com/bonzini/qboot
|
||||
|
||||
@@ -1275,6 +1275,15 @@ F: include/hw/timer/hpet.h
|
||||
F: include/hw/timer/i8254*
|
||||
F: include/hw/rtc/mc146818rtc*
|
||||
|
||||
microvm
|
||||
M: Sergio Lopez <slp@redhat.com>
|
||||
M: Paolo Bonzini <pbonzini@redhat.com>
|
||||
S: Maintained
|
||||
F: docs/microvm.rst
|
||||
F: hw/i386/microvm.c
|
||||
F: include/hw/i386/microvm.h
|
||||
F: pc-bios/bios-microvm.bin
|
||||
|
||||
Machine core
|
||||
M: Eduardo Habkost <ehabkost@redhat.com>
|
||||
M: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
|
||||
|
||||
+3
-3
@@ -52,7 +52,7 @@
|
||||
/* KVM uses PAGE_SIZE in its definition of KVM_COALESCED_MMIO_MAX. We
|
||||
* need to use the real host PAGE_SIZE, as that's what KVM will use.
|
||||
*/
|
||||
#define PAGE_SIZE getpagesize()
|
||||
#define PAGE_SIZE qemu_real_host_page_size
|
||||
|
||||
//#define DEBUG_KVM
|
||||
|
||||
@@ -507,7 +507,7 @@ static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section,
|
||||
{
|
||||
ram_addr_t start = section->offset_within_region +
|
||||
memory_region_get_ram_addr(section->mr);
|
||||
ram_addr_t pages = int128_get64(section->size) / getpagesize();
|
||||
ram_addr_t pages = int128_get64(section->size) / qemu_real_host_page_size;
|
||||
|
||||
cpu_physical_memory_set_dirty_lebitmap(bitmap, start, pages);
|
||||
return 0;
|
||||
@@ -1841,7 +1841,7 @@ static int kvm_init(MachineState *ms)
|
||||
* even with KVM. TARGET_PAGE_SIZE is assumed to be the minimum
|
||||
* page size for the system though.
|
||||
*/
|
||||
assert(TARGET_PAGE_SIZE <= getpagesize());
|
||||
assert(TARGET_PAGE_SIZE <= qemu_real_host_page_size);
|
||||
|
||||
s->sigmask_len = 8;
|
||||
|
||||
|
||||
@@ -385,6 +385,7 @@ static pa_stream *qpa_simple_new (
|
||||
map.map[5] = PA_CHANNEL_POSITION_REAR_RIGHT;
|
||||
map.map[6] = PA_CHANNEL_POSITION_SIDE_LEFT;
|
||||
map.map[7] = PA_CHANNEL_POSITION_SIDE_RIGHT;
|
||||
break;
|
||||
|
||||
default:
|
||||
dolog("Internal error: unsupported channel count %d\n", ss->channels);
|
||||
|
||||
+1
-1
@@ -304,7 +304,7 @@ size_t host_memory_backend_pagesize(HostMemoryBackend *memdev)
|
||||
#else
|
||||
size_t host_memory_backend_pagesize(HostMemoryBackend *memdev)
|
||||
{
|
||||
return getpagesize();
|
||||
return qemu_real_host_page_size;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ size_t bdrv_opt_mem_align(BlockDriverState *bs)
|
||||
{
|
||||
if (!bs || !bs->drv) {
|
||||
/* page size or 4k (hdd sector size) should be on the safe side */
|
||||
return MAX(4096, getpagesize());
|
||||
return MAX(4096, qemu_real_host_page_size);
|
||||
}
|
||||
|
||||
return bs->bl.opt_mem_alignment;
|
||||
@@ -116,7 +116,7 @@ size_t bdrv_min_mem_align(BlockDriverState *bs)
|
||||
{
|
||||
if (!bs || !bs->drv) {
|
||||
/* page size or 4k (hdd sector size) should be on the safe side */
|
||||
return MAX(4096, getpagesize());
|
||||
return MAX(4096, qemu_real_host_page_size);
|
||||
}
|
||||
|
||||
return bs->bl.min_mem_alignment;
|
||||
|
||||
+5
-4
@@ -327,7 +327,7 @@ static void raw_probe_alignment(BlockDriverState *bs, int fd, Error **errp)
|
||||
{
|
||||
BDRVRawState *s = bs->opaque;
|
||||
char *buf;
|
||||
size_t max_align = MAX(MAX_BLOCKSIZE, getpagesize());
|
||||
size_t max_align = MAX(MAX_BLOCKSIZE, qemu_real_host_page_size);
|
||||
size_t alignments[] = {1, 512, 1024, 2048, 4096};
|
||||
|
||||
/* For SCSI generic devices the alignment is not really used.
|
||||
@@ -1136,13 +1136,14 @@ static void raw_refresh_limits(BlockDriverState *bs, Error **errp)
|
||||
|
||||
ret = sg_get_max_segments(s->fd);
|
||||
if (ret > 0) {
|
||||
bs->bl.max_transfer = MIN(bs->bl.max_transfer, ret * getpagesize());
|
||||
bs->bl.max_transfer = MIN(bs->bl.max_transfer,
|
||||
ret * qemu_real_host_page_size);
|
||||
}
|
||||
}
|
||||
|
||||
raw_probe_alignment(bs, s->fd, errp);
|
||||
bs->bl.min_mem_alignment = s->buf_align;
|
||||
bs->bl.opt_mem_alignment = MAX(s->buf_align, getpagesize());
|
||||
bs->bl.opt_mem_alignment = MAX(s->buf_align, qemu_real_host_page_size);
|
||||
}
|
||||
|
||||
static int check_for_dasd(int fd)
|
||||
@@ -1705,7 +1706,7 @@ static int allocate_first_block(int fd, size_t max_size)
|
||||
size_t write_size = (max_size < MAX_BLOCKSIZE)
|
||||
? BDRV_SECTOR_SIZE
|
||||
: MAX_BLOCKSIZE;
|
||||
size_t max_align = MAX(MAX_BLOCKSIZE, getpagesize());
|
||||
size_t max_align = MAX(MAX_BLOCKSIZE, qemu_real_host_page_size);
|
||||
void *buf;
|
||||
ssize_t n;
|
||||
int ret;
|
||||
|
||||
+1
-1
@@ -160,7 +160,7 @@ void bdrv_refresh_limits(BlockDriverState *bs, Error **errp)
|
||||
bdrv_merge_limits(&bs->bl, &bs->file->bs->bl);
|
||||
} else {
|
||||
bs->bl.min_mem_alignment = 512;
|
||||
bs->bl.opt_mem_alignment = getpagesize();
|
||||
bs->bl.opt_mem_alignment = qemu_real_host_page_size;
|
||||
|
||||
/* Safe default since most protocols use readv()/writev()/etc */
|
||||
bs->bl.max_iov = IOV_MAX;
|
||||
|
||||
+1
-1
@@ -847,7 +847,7 @@ static int parallels_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
}
|
||||
}
|
||||
|
||||
s->bat_dirty_block = 4 * getpagesize();
|
||||
s->bat_dirty_block = 4 * qemu_real_host_page_size;
|
||||
s->bat_dirty_bmap =
|
||||
bitmap_new(DIV_ROUND_UP(s->header_size, s->bat_dirty_block));
|
||||
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ static void qcow2_cache_table_release(Qcow2Cache *c, int i, int num_tables)
|
||||
/* Using MADV_DONTNEED to discard memory is a Linux-specific feature */
|
||||
#ifdef CONFIG_LINUX
|
||||
void *t = qcow2_cache_get_table_addr(c, i);
|
||||
int align = getpagesize();
|
||||
int align = qemu_real_host_page_size;
|
||||
size_t mem_size = (size_t) c->table_size * num_tables;
|
||||
size_t offset = QEMU_ALIGN_UP((uintptr_t) t, align) - (uintptr_t) t;
|
||||
size_t length = QEMU_ALIGN_DOWN(mem_size - offset, align);
|
||||
|
||||
@@ -52,7 +52,7 @@ struct udmabuf_create {
|
||||
static size_t
|
||||
udmabuf_get_size(struct vugbm_buffer *buf)
|
||||
{
|
||||
return ROUND_UP(buf->width * buf->height * 4, getpagesize());
|
||||
return ROUND_UP(buf->width * buf->height * 4, qemu_real_host_page_size);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
||||
@@ -28,3 +28,4 @@
|
||||
CONFIG_ISAPC=y
|
||||
CONFIG_I440FX=y
|
||||
CONFIG_Q35=y
|
||||
CONFIG_MICROVM=y
|
||||
|
||||
@@ -184,6 +184,19 @@ enabled.
|
||||
|
||||
Requires: hv-vpindex, hv-synic, hv-time, hv-stimer
|
||||
|
||||
3.17. hv-no-nonarch-coresharing=on/off/auto
|
||||
===========================================
|
||||
This enlightenment tells guest OS that virtual processors will never share a
|
||||
physical core unless they are reported as sibling SMT threads. This information
|
||||
is required by Windows and Hyper-V guests to properly mitigate SMT related CPU
|
||||
vulnerabilities.
|
||||
When the option is set to 'auto' QEMU will enable the feature only when KVM
|
||||
reports that non-architectural coresharing is impossible, this means that
|
||||
hyper-threading is not supported or completely disabled on the host. This
|
||||
setting also prevents migration as SMT settings on the destination may differ.
|
||||
When the option is set to 'on' QEMU will always enable the feature, regardless
|
||||
of host setup. To keep guests secure, this can only be used in conjunction with
|
||||
exposing correct vCPU topology and vCPU pinning.
|
||||
|
||||
4. Development features
|
||||
========================
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
====================
|
||||
microvm Machine Type
|
||||
====================
|
||||
|
||||
``microvm`` is a machine type inspired by ``Firecracker`` and
|
||||
constructed after its machine model.
|
||||
|
||||
It's a minimalist machine type without ``PCI`` nor ``ACPI`` support,
|
||||
designed for short-lived guests. microvm also establishes a baseline
|
||||
for benchmarking and optimizing both QEMU and guest operating systems,
|
||||
since it is optimized for both boot time and footprint.
|
||||
|
||||
|
||||
Supported devices
|
||||
-----------------
|
||||
|
||||
The microvm machine type supports the following devices:
|
||||
|
||||
- ISA bus
|
||||
- i8259 PIC (optional)
|
||||
- i8254 PIT (optional)
|
||||
- MC146818 RTC (optional)
|
||||
- One ISA serial port (optional)
|
||||
- LAPIC
|
||||
- IOAPIC (with kernel-irqchip=split by default)
|
||||
- kvmclock (if using KVM)
|
||||
- fw_cfg
|
||||
- Up to eight virtio-mmio devices (configured by the user)
|
||||
|
||||
|
||||
Limitations
|
||||
-----------
|
||||
|
||||
Currently, microvm does *not* support the following features:
|
||||
|
||||
- PCI-only devices.
|
||||
- Hotplug of any kind.
|
||||
- Live migration across QEMU versions.
|
||||
|
||||
|
||||
Using the microvm machine type
|
||||
------------------------------
|
||||
|
||||
Machine-specific options
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
It supports the following machine-specific options:
|
||||
|
||||
- microvm.x-option-roms=bool (Set off to disable loading option ROMs)
|
||||
- microvm.pit=OnOffAuto (Enable i8254 PIT)
|
||||
- microvm.isa-serial=bool (Set off to disable the instantiation an ISA serial port)
|
||||
- microvm.pic=OnOffAuto (Enable i8259 PIC)
|
||||
- microvm.rtc=OnOffAuto (Enable MC146818 RTC)
|
||||
- microvm.auto-kernel-cmdline=bool (Set off to disable adding virtio-mmio devices to the kernel cmdline)
|
||||
|
||||
|
||||
Boot options
|
||||
~~~~~~~~~~~~
|
||||
|
||||
By default, microvm uses ``qboot`` as its BIOS, to obtain better boot
|
||||
times, but it's also compatible with ``SeaBIOS``.
|
||||
|
||||
As no current FW is able to boot from a block device using
|
||||
``virtio-mmio`` as its transport, a microvm-based VM needs to be run
|
||||
using a host-side kernel and, optionally, an initrd image.
|
||||
|
||||
|
||||
Running a microvm-based VM
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
By default, microvm aims for maximum compatibility, enabling both
|
||||
legacy and non-legacy devices. In this example, a VM is created
|
||||
without passing any additional machine-specific option, using the
|
||||
legacy ``ISA serial`` device as console::
|
||||
|
||||
$ qemu-system-x86_64 -M microvm \
|
||||
-enable-kvm -cpu host -m 512m -smp 2 \
|
||||
-kernel vmlinux -append "earlyprintk=ttyS0 console=ttyS0 root=/dev/vda" \
|
||||
-nodefaults -no-user-config -nographic \
|
||||
-serial stdio \
|
||||
-drive id=test,file=test.img,format=raw,if=none \
|
||||
-device virtio-blk-device,drive=test \
|
||||
-netdev tap,id=tap0,script=no,downscript=no \
|
||||
-device virtio-net-device,netdev=tap0
|
||||
|
||||
While the example above works, you might be interested in reducing the
|
||||
footprint further by disabling some legacy devices. If you're using
|
||||
``KVM``, you can disable the ``RTC``, making the Guest rely on
|
||||
``kvmclock`` exclusively. Additionally, if your host's CPUs have the
|
||||
``TSC_DEADLINE`` feature, you can also disable both the i8259 PIC and
|
||||
the i8254 PIT (make sure you're also emulating a CPU with such feature
|
||||
in the guest).
|
||||
|
||||
This is an example of a VM with all optional legacy features
|
||||
disabled::
|
||||
|
||||
$ qemu-system-x86_64 \
|
||||
-M microvm,x-option-roms=off,pit=off,pic=off,isa-serial=off,rtc=off \
|
||||
-enable-kvm -cpu host -m 512m -smp 2 \
|
||||
-kernel vmlinux -append "console=hvc0 root=/dev/vda" \
|
||||
-nodefaults -no-user-config -nographic \
|
||||
-chardev stdio,id=virtiocon0 \
|
||||
-device virtio-serial-device \
|
||||
-device virtconsole,chardev=virtiocon0 \
|
||||
-drive id=test,file=test.img,format=raw,if=none \
|
||||
-device virtio-blk-device,drive=test \
|
||||
-netdev tap,id=tap0,script=no,downscript=no \
|
||||
-device virtio-net-device,netdev=tap0
|
||||
@@ -1756,11 +1756,11 @@ long qemu_maxrampagesize(void)
|
||||
#else
|
||||
long qemu_minrampagesize(void)
|
||||
{
|
||||
return getpagesize();
|
||||
return qemu_real_host_page_size;
|
||||
}
|
||||
long qemu_maxrampagesize(void)
|
||||
{
|
||||
return getpagesize();
|
||||
return qemu_real_host_page_size;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2417,7 +2417,7 @@ RAMBlock *qemu_ram_alloc_internal(ram_addr_t size, ram_addr_t max_size,
|
||||
new_block->max_length = max_size;
|
||||
assert(max_size >= size);
|
||||
new_block->fd = -1;
|
||||
new_block->page_size = getpagesize();
|
||||
new_block->page_size = qemu_real_host_page_size;
|
||||
new_block->host = host;
|
||||
if (host) {
|
||||
new_block->flags |= RAM_PREALLOC;
|
||||
|
||||
@@ -128,7 +128,7 @@ void build_legacy_cpu_hotplug_aml(Aml *ctx, MachineState *machine,
|
||||
Aml *one = aml_int(1);
|
||||
MachineClass *mc = MACHINE_GET_CLASS(machine);
|
||||
const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids(machine);
|
||||
PCMachineState *pcms = PC_MACHINE(machine);
|
||||
X86MachineState *x86ms = X86_MACHINE(machine);
|
||||
|
||||
/*
|
||||
* _MAT method - creates an madt apic buffer
|
||||
@@ -236,9 +236,9 @@ void build_legacy_cpu_hotplug_aml(Aml *ctx, MachineState *machine,
|
||||
/* The current AML generator can cover the APIC ID range [0..255],
|
||||
* inclusive, for VCPU hotplug. */
|
||||
QEMU_BUILD_BUG_ON(ACPI_CPU_HOTPLUG_ID_LIMIT > 256);
|
||||
if (pcms->apic_id_limit > ACPI_CPU_HOTPLUG_ID_LIMIT) {
|
||||
if (x86ms->apic_id_limit > ACPI_CPU_HOTPLUG_ID_LIMIT) {
|
||||
error_report("max_cpus is too large. APIC ID of last CPU is %u",
|
||||
pcms->apic_id_limit - 1);
|
||||
x86ms->apic_id_limit - 1);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -315,8 +315,8 @@ void build_legacy_cpu_hotplug_aml(Aml *ctx, MachineState *machine,
|
||||
* ith up to 255 elements. Windows guests up to win2k8 fail when
|
||||
* VarPackageOp is used.
|
||||
*/
|
||||
pkg = pcms->apic_id_limit <= 255 ? aml_package(pcms->apic_id_limit) :
|
||||
aml_varpackage(pcms->apic_id_limit);
|
||||
pkg = x86ms->apic_id_limit <= 255 ? aml_package(x86ms->apic_id_limit) :
|
||||
aml_varpackage(x86ms->apic_id_limit);
|
||||
|
||||
for (i = 0, apic_idx = 0; i < apic_ids->len; i++) {
|
||||
int apic_id = apic_ids->cpus[i].arch_id;
|
||||
|
||||
@@ -92,6 +92,16 @@ config Q35
|
||||
select SMBIOS
|
||||
select FW_CFG_DMA
|
||||
|
||||
config MICROVM
|
||||
bool
|
||||
imply SERIAL_ISA
|
||||
select ISA_BUS
|
||||
select APIC
|
||||
select IOAPIC
|
||||
select I8259
|
||||
select MC146818RTC
|
||||
select VIRTIO_MMIO
|
||||
|
||||
config VTD
|
||||
bool
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
obj-$(CONFIG_KVM) += kvm/
|
||||
obj-y += e820_memory_layout.o multiboot.o
|
||||
obj-y += x86.o
|
||||
obj-y += pc.o
|
||||
obj-$(CONFIG_I440FX) += pc_piix.o
|
||||
obj-$(CONFIG_Q35) += pc_q35.o
|
||||
obj-$(CONFIG_MICROVM) += microvm.o
|
||||
obj-y += fw_cfg.o pc_sysfw.o
|
||||
obj-y += x86-iommu.o
|
||||
obj-$(CONFIG_VTD) += intel_iommu.o
|
||||
|
||||
+17
-12
@@ -361,6 +361,7 @@ static void
|
||||
build_madt(GArray *table_data, BIOSLinker *linker, PCMachineState *pcms)
|
||||
{
|
||||
MachineClass *mc = MACHINE_GET_CLASS(pcms);
|
||||
X86MachineState *x86ms = X86_MACHINE(pcms);
|
||||
const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids(MACHINE(pcms));
|
||||
int madt_start = table_data->len;
|
||||
AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_GET_CLASS(pcms->acpi_dev);
|
||||
@@ -390,7 +391,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, PCMachineState *pcms)
|
||||
io_apic->address = cpu_to_le32(IO_APIC_DEFAULT_ADDRESS);
|
||||
io_apic->interrupt = cpu_to_le32(0);
|
||||
|
||||
if (pcms->apic_xrupt_override) {
|
||||
if (x86ms->apic_xrupt_override) {
|
||||
intsrcovr = acpi_data_push(table_data, sizeof *intsrcovr);
|
||||
intsrcovr->type = ACPI_APIC_XRUPT_OVERRIDE;
|
||||
intsrcovr->length = sizeof(*intsrcovr);
|
||||
@@ -1831,6 +1832,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
|
||||
CrsRangeSet crs_range_set;
|
||||
PCMachineState *pcms = PC_MACHINE(machine);
|
||||
PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(machine);
|
||||
X86MachineState *x86ms = X86_MACHINE(machine);
|
||||
AcpiMcfgInfo mcfg;
|
||||
uint32_t nr_mem = machine->ram_slots;
|
||||
int root_bus_limit = 0xFF;
|
||||
@@ -2103,7 +2105,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
|
||||
* with half of the 16-bit control register. Hence, the total size
|
||||
* of the i/o region used is FW_CFG_CTL_SIZE; when using DMA, the
|
||||
* DMA control register is located at FW_CFG_DMA_IO_BASE + 4 */
|
||||
uint8_t io_size = object_property_get_bool(OBJECT(pcms->fw_cfg),
|
||||
uint8_t io_size = object_property_get_bool(OBJECT(x86ms->fw_cfg),
|
||||
"dma_enabled", NULL) ?
|
||||
ROUND_UP(FW_CFG_CTL_SIZE, 4) + sizeof(dma_addr_t) :
|
||||
FW_CFG_CTL_SIZE;
|
||||
@@ -2336,6 +2338,7 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
|
||||
int srat_start, numa_start, slots;
|
||||
uint64_t mem_len, mem_base, next_base;
|
||||
MachineClass *mc = MACHINE_GET_CLASS(machine);
|
||||
X86MachineState *x86ms = X86_MACHINE(machine);
|
||||
const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids(machine);
|
||||
PCMachineState *pcms = PC_MACHINE(machine);
|
||||
ram_addr_t hotplugabble_address_space_size =
|
||||
@@ -2406,16 +2409,16 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
|
||||
}
|
||||
|
||||
/* Cut out the ACPI_PCI hole */
|
||||
if (mem_base <= pcms->below_4g_mem_size &&
|
||||
next_base > pcms->below_4g_mem_size) {
|
||||
mem_len -= next_base - pcms->below_4g_mem_size;
|
||||
if (mem_base <= x86ms->below_4g_mem_size &&
|
||||
next_base > x86ms->below_4g_mem_size) {
|
||||
mem_len -= next_base - x86ms->below_4g_mem_size;
|
||||
if (mem_len > 0) {
|
||||
numamem = acpi_data_push(table_data, sizeof *numamem);
|
||||
build_srat_memory(numamem, mem_base, mem_len, i - 1,
|
||||
MEM_AFFINITY_ENABLED);
|
||||
}
|
||||
mem_base = 1ULL << 32;
|
||||
mem_len = next_base - pcms->below_4g_mem_size;
|
||||
mem_len = next_base - x86ms->below_4g_mem_size;
|
||||
next_base = mem_base + mem_len;
|
||||
}
|
||||
|
||||
@@ -2634,6 +2637,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
|
||||
{
|
||||
PCMachineState *pcms = PC_MACHINE(machine);
|
||||
PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
|
||||
X86MachineState *x86ms = X86_MACHINE(machine);
|
||||
GArray *table_offsets;
|
||||
unsigned facs, dsdt, rsdt, fadt;
|
||||
AcpiPmInfo pm;
|
||||
@@ -2795,7 +2799,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
|
||||
*/
|
||||
int legacy_aml_len =
|
||||
pcmc->legacy_acpi_table_size +
|
||||
ACPI_BUILD_LEGACY_CPU_AML_SIZE * pcms->apic_id_limit;
|
||||
ACPI_BUILD_LEGACY_CPU_AML_SIZE * x86ms->apic_id_limit;
|
||||
int legacy_table_size =
|
||||
ROUND_UP(tables_blob->len - aml_len + legacy_aml_len,
|
||||
ACPI_BUILD_ALIGN_SIZE);
|
||||
@@ -2885,13 +2889,14 @@ void acpi_setup(void)
|
||||
{
|
||||
PCMachineState *pcms = PC_MACHINE(qdev_get_machine());
|
||||
PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
|
||||
X86MachineState *x86ms = X86_MACHINE(pcms);
|
||||
AcpiBuildTables tables;
|
||||
AcpiBuildState *build_state;
|
||||
Object *vmgenid_dev;
|
||||
TPMIf *tpm;
|
||||
static FwCfgTPMConfig tpm_config;
|
||||
|
||||
if (!pcms->fw_cfg) {
|
||||
if (!x86ms->fw_cfg) {
|
||||
ACPI_BUILD_DPRINTF("No fw cfg. Bailing out.\n");
|
||||
return;
|
||||
}
|
||||
@@ -2922,7 +2927,7 @@ void acpi_setup(void)
|
||||
acpi_add_rom_blob(acpi_build_update, build_state,
|
||||
tables.linker->cmd_blob, "etc/table-loader", 0);
|
||||
|
||||
fw_cfg_add_file(pcms->fw_cfg, ACPI_BUILD_TPMLOG_FILE,
|
||||
fw_cfg_add_file(x86ms->fw_cfg, ACPI_BUILD_TPMLOG_FILE,
|
||||
tables.tcpalog->data, acpi_data_len(tables.tcpalog));
|
||||
|
||||
tpm = tpm_find();
|
||||
@@ -2932,13 +2937,13 @@ void acpi_setup(void)
|
||||
.tpm_version = tpm_get_version(tpm),
|
||||
.tpmppi_version = TPM_PPI_VERSION_1_30
|
||||
};
|
||||
fw_cfg_add_file(pcms->fw_cfg, "etc/tpm/config",
|
||||
fw_cfg_add_file(x86ms->fw_cfg, "etc/tpm/config",
|
||||
&tpm_config, sizeof tpm_config);
|
||||
}
|
||||
|
||||
vmgenid_dev = find_vmgenid_dev();
|
||||
if (vmgenid_dev) {
|
||||
vmgenid_add_fw_cfg(VMGENID(vmgenid_dev), pcms->fw_cfg,
|
||||
vmgenid_add_fw_cfg(VMGENID(vmgenid_dev), x86ms->fw_cfg,
|
||||
tables.vmgenid);
|
||||
}
|
||||
|
||||
@@ -2951,7 +2956,7 @@ void acpi_setup(void)
|
||||
uint32_t rsdp_size = acpi_data_len(tables.rsdp);
|
||||
|
||||
build_state->rsdp = g_memdup(tables.rsdp->data, rsdp_size);
|
||||
fw_cfg_add_file_callback(pcms->fw_cfg, ACPI_BUILD_RSDP_FILE,
|
||||
fw_cfg_add_file_callback(x86ms->fw_cfg, ACPI_BUILD_RSDP_FILE,
|
||||
acpi_build_update, NULL, build_state,
|
||||
build_state->rsdp, rsdp_size, true);
|
||||
build_state->rsdp_mr = NULL;
|
||||
|
||||
+2
-1
@@ -1540,6 +1540,7 @@ static void amdvi_realize(DeviceState *dev, Error **err)
|
||||
X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(dev);
|
||||
MachineState *ms = MACHINE(qdev_get_machine());
|
||||
PCMachineState *pcms = PC_MACHINE(ms);
|
||||
X86MachineState *x86ms = X86_MACHINE(ms);
|
||||
PCIBus *bus = pcms->bus;
|
||||
|
||||
s->iotlb = g_hash_table_new_full(amdvi_uint64_hash,
|
||||
@@ -1568,7 +1569,7 @@ static void amdvi_realize(DeviceState *dev, Error **err)
|
||||
}
|
||||
|
||||
/* Pseudo address space under root PCI bus. */
|
||||
pcms->ioapic_as = amdvi_host_dma_iommu(bus, s, AMDVI_IOAPIC_SB_DEVID);
|
||||
x86ms->ioapic_as = amdvi_host_dma_iommu(bus, s, AMDVI_IOAPIC_SB_DEVID);
|
||||
|
||||
/* set up MMIO */
|
||||
memory_region_init_io(&s->mmio, OBJECT(s), &mmio_mem_ops, s, "amdvi-mmio",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user