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
- Many fixes from the floor as usual - New "edu" device (v1->v2: fix 32-bit compilation) - Disabling HLE and RTM on Haswell & Broadwell - kvm_stat updates - Added --enable-modules to Travis, in preparation for switching the default # gpg: Signature made Mon 26 Jan 2015 11:44:40 GMT using RSA key ID 78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # 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: kvm_stat: Add RESET support for perf event ioctl target-i386: Disable HLE and RTM on Haswell & Broadwell sparse: Fix build with sparse on .S files exec: fix madvise of NULL pointer .travis.yml: Add "--enable-modules" apic: do not dereference pointer before it is checked for NULL kvm_stat: Print errno when syscall to perf_event_open() fails kvm_stat: Update exit reasons to the latest defintion kvm_stat: Add aarch64 support hw: misc, add educational driver vmstate: accept QEMUTimer in VMSTATE_TIMER*, add VMSTATE_TIMER_PTR* qemu-timer: introduce timer_deinit qemu-timer: add timer_init and timer_init_ns/us/ms target-i386: make xmm_regs 512-bit wide target-i386: use vmstate_offset_sub_array for AVX registers tests/multiboot: Add test for modules multiboot: Fix offset of bootloader name tests/multiboot: Update reference output pc: fix KVM features in pc-1.3 and earlier machine types Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -98,3 +98,6 @@ matrix:
|
||||
EXTRA_PKGS="liblttng-ust-dev liburcu-dev"
|
||||
EXTRA_CONFIG="--enable-trace-backends=ust"
|
||||
compiler: gcc
|
||||
- env: TARGETS=i386-softmmu,x86_64-softmmu
|
||||
EXTRA_CONFIG="--enable-modules"
|
||||
compiler: gcc
|
||||
|
||||
@@ -599,6 +599,11 @@ F: hw/net/opencores_eth.c
|
||||
|
||||
Devices
|
||||
-------
|
||||
EDU
|
||||
M: Jiri Slaby <jslaby@suse.cz>
|
||||
S: Maintained
|
||||
F: hw/misc/edu.c
|
||||
|
||||
IDE
|
||||
M: Kevin Wolf <kwolf@redhat.com>
|
||||
M: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
@@ -4938,6 +4938,7 @@ echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
|
||||
echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
|
||||
if test "$sparse" = "yes" ; then
|
||||
echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
|
||||
echo "CPP := REAL_CC=\"\$(CPP)\" cgcc" >> $config_host_mak
|
||||
echo "CXX := REAL_CC=\"\$(CXX)\" cgcc" >> $config_host_mak
|
||||
echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
|
||||
echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
|
||||
|
||||
@@ -32,3 +32,4 @@ CONFIG_PCI_TESTDEV=y
|
||||
CONFIG_NVME_PCI=y
|
||||
CONFIG_SD=y
|
||||
CONFIG_SDHCI=y
|
||||
CONFIG_EDU=y
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
|
||||
EDU device
|
||||
==========
|
||||
|
||||
Copyright (c) 2014-2015 Jiri Slaby
|
||||
|
||||
This document is licensed under the GPLv2 (or later).
|
||||
|
||||
This is an educational device for writing (kernel) drivers. Its original
|
||||
intention was to support the Linux kernel lectures taught at the Masaryk
|
||||
University. Students are given this virtual device and are expected to write a
|
||||
driver with I/Os, IRQs, DMAs and such.
|
||||
|
||||
The devices behaves very similar to the PCI bridge present in the COMBO6 cards
|
||||
developed under the Liberouter wings. Both PCI device ID and PCI space is
|
||||
inherited from that device.
|
||||
|
||||
Command line switches:
|
||||
-device edu[,dma_mask=mask]
|
||||
|
||||
dma_mask makes the virtual device work with DMA addresses with the given
|
||||
mask. For educational purposes, the device supports only 28 bits (256 MiB)
|
||||
by default. Students shall set dma_mask for the device in the OS driver
|
||||
properly.
|
||||
|
||||
PCI specs
|
||||
---------
|
||||
|
||||
PCI ID: 1234:11e8
|
||||
|
||||
PCI Region 0:
|
||||
I/O memory, 1 MB in size. Users are supposed to communicate with the card
|
||||
through this memory.
|
||||
|
||||
MMIO area spec
|
||||
--------------
|
||||
|
||||
Only size == 4 accesses are allowed for addresses < 0x80. size == 4 or
|
||||
size == 8 for the rest.
|
||||
|
||||
0x00 (RO) : identification (0xRRrr00edu)
|
||||
RR -- major version
|
||||
rr -- minor version
|
||||
|
||||
0x04 (RW) : card liveness check
|
||||
It is a simple value inversion (~ C operator).
|
||||
|
||||
0x08 (RW) : factorial computation
|
||||
The stored value is taken and factorial of it is put back here.
|
||||
This happens only after factorial bit in the status register (0x20
|
||||
below) is cleared.
|
||||
|
||||
0x20 (RW) : status register, bitwise OR
|
||||
0x01 -- computing factorial (RO)
|
||||
0x80 -- raise interrupt 0x01 after finishing factorial computation
|
||||
|
||||
0x24 (RO) : interrupt status register
|
||||
It contains values which raised the interrupt (see interrupt raise
|
||||
register below).
|
||||
|
||||
0x60 (WO) : interrupt raise register
|
||||
Raise an interrupt. The value will be put to the interrupt status
|
||||
register (using bitwise OR).
|
||||
|
||||
0x64 (WO) : interrupt acknowledge register
|
||||
Clear an interrupt. The value will be cleared from the interrupt
|
||||
status register. This needs to be done from the ISR to stop
|
||||
generating interrupts.
|
||||
|
||||
0x80 (RW) : DMA source address
|
||||
Where to perform the DMA from.
|
||||
|
||||
0x88 (RW) : DMA destination address
|
||||
Where to perform the DMA to.
|
||||
|
||||
0x90 (RW) : DMA transfer count
|
||||
The size of the area to perform the DMA on.
|
||||
|
||||
0x98 (RW) : DMA command register, bitwise OR
|
||||
0x01 -- start transfer
|
||||
0x02 -- direction (0: from RAM to EDU, 1: from EDU to RAM)
|
||||
0x04 -- raise interrupt 0x100 after finishing the DMA
|
||||
|
||||
IRQ controller
|
||||
--------------
|
||||
An IRQ is generated when written to the interrupt raise register. The value
|
||||
appears in interrupt status register when the interrupt is raised and has to
|
||||
be written to the interrupt acknowledge register to lower it.
|
||||
|
||||
DMA controller
|
||||
--------------
|
||||
One has to specify, source, destination, size, and start the transfer. One
|
||||
4096 bytes long buffer at offset 0x40000 is available in the EDU device. I.e.
|
||||
one can perform DMA to/from this space when programmed properly.
|
||||
|
||||
Example of transferring a 100 byte block to and from the buffer using a given
|
||||
PCI address 'addr':
|
||||
addr -> DMA source address
|
||||
0x40000 -> DMA destination address
|
||||
100 -> DMA transfer count
|
||||
1 -> DMA command register
|
||||
while (DMA command register & 1)
|
||||
;
|
||||
|
||||
0x40000 -> DMA source address
|
||||
addr+100 -> DMA destination address
|
||||
100 -> DMA transfer count
|
||||
3 -> DMA command register
|
||||
while (DMA command register & 1)
|
||||
;
|
||||
@@ -1386,12 +1386,13 @@ static ram_addr_t ram_block_add(RAMBlock *new_block, Error **errp)
|
||||
cpu_physical_memory_set_dirty_range(new_block->offset,
|
||||
new_block->used_length);
|
||||
|
||||
qemu_ram_setup_dump(new_block->host, new_block->max_length);
|
||||
qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_HUGEPAGE);
|
||||
qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_DONTFORK);
|
||||
|
||||
if (kvm_enabled()) {
|
||||
kvm_setup_guest_memory(new_block->host, new_block->max_length);
|
||||
if (new_block->host) {
|
||||
qemu_ram_setup_dump(new_block->host, new_block->max_length);
|
||||
qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_HUGEPAGE);
|
||||
qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_DONTFORK);
|
||||
if (kvm_enabled()) {
|
||||
kvm_setup_guest_memory(new_block->host, new_block->max_length);
|
||||
}
|
||||
}
|
||||
|
||||
return new_block->offset;
|
||||
|
||||
+1
-1
@@ -166,7 +166,7 @@ const VMStateDescription vmstate_ich9_pm = {
|
||||
VMSTATE_UINT16(acpi_regs.pm1.evt.sts, ICH9LPCPMRegs),
|
||||
VMSTATE_UINT16(acpi_regs.pm1.evt.en, ICH9LPCPMRegs),
|
||||
VMSTATE_UINT16(acpi_regs.pm1.cnt.cnt, ICH9LPCPMRegs),
|
||||
VMSTATE_TIMER(acpi_regs.tmr.timer, ICH9LPCPMRegs),
|
||||
VMSTATE_TIMER_PTR(acpi_regs.tmr.timer, ICH9LPCPMRegs),
|
||||
VMSTATE_INT64(acpi_regs.tmr.overflow_time, ICH9LPCPMRegs),
|
||||
VMSTATE_GPE_ARRAY(acpi_regs.gpe.sts, ICH9LPCPMRegs),
|
||||
VMSTATE_GPE_ARRAY(acpi_regs.gpe.en, ICH9LPCPMRegs),
|
||||
|
||||
+1
-1
@@ -285,7 +285,7 @@ static const VMStateDescription vmstate_acpi = {
|
||||
VMSTATE_UINT16(ar.pm1.evt.en, PIIX4PMState),
|
||||
VMSTATE_UINT16(ar.pm1.cnt.cnt, PIIX4PMState),
|
||||
VMSTATE_STRUCT(apm, PIIX4PMState, 0, vmstate_apm, APMState),
|
||||
VMSTATE_TIMER(ar.tmr.timer, PIIX4PMState),
|
||||
VMSTATE_TIMER_PTR(ar.tmr.timer, PIIX4PMState),
|
||||
VMSTATE_INT64(ar.tmr.overflow_time, PIIX4PMState),
|
||||
VMSTATE_STRUCT(ar.gpe, PIIX4PMState, 2, vmstate_gpe, ACPIGPE),
|
||||
VMSTATE_STRUCT_TEST(
|
||||
|
||||
+1
-1
@@ -306,7 +306,7 @@ static const VMStateDescription vmstate_stellaris_gptm = {
|
||||
VMSTATE_UINT32_ARRAY(match_prescale, gptm_state, 2),
|
||||
VMSTATE_UINT32(rtc, gptm_state),
|
||||
VMSTATE_INT64_ARRAY(tick, gptm_state, 2),
|
||||
VMSTATE_TIMER_ARRAY(timer, gptm_state, 2),
|
||||
VMSTATE_TIMER_PTR_ARRAY(timer, gptm_state, 2),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
+1
-1
@@ -791,7 +791,7 @@ static const VMStateDescription vmstate_fdc_result_timer = {
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_TIMER(result_timer, FDCtrl),
|
||||
VMSTATE_TIMER_PTR(result_timer, FDCtrl),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
@@ -520,7 +520,7 @@ static const VMStateDescription vmstate_cadence_uart = {
|
||||
VMSTATE_UINT32(rx_count, UartState),
|
||||
VMSTATE_UINT32(tx_count, UartState),
|
||||
VMSTATE_UINT32(rx_wpos, UartState),
|
||||
VMSTATE_TIMER(fifo_trigger_handle, UartState),
|
||||
VMSTATE_TIMER_PTR(fifo_trigger_handle, UartState),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
+2
-2
@@ -730,7 +730,7 @@ const VMStateDescription vmstate_serial_fifo_timeout_timer = {
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_TIMER(fifo_timeout_timer, SerialState),
|
||||
VMSTATE_TIMER_PTR(fifo_timeout_timer, SerialState),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
@@ -763,7 +763,7 @@ const VMStateDescription vmstate_serial_poll = {
|
||||
.minimum_version_id = 1,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_INT32(poll_msl, SerialState),
|
||||
VMSTATE_TIMER(modem_status_poll, SerialState),
|
||||
VMSTATE_TIMER_PTR(modem_status_poll, SerialState),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
+1
-1
@@ -214,7 +214,7 @@ const VMStateDescription vmstate_ptimer = {
|
||||
VMSTATE_INT64(period, ptimer_state),
|
||||
VMSTATE_INT64(last_event, ptimer_state),
|
||||
VMSTATE_INT64(next_event, ptimer_state),
|
||||
VMSTATE_TIMER(timer, ptimer_state),
|
||||
VMSTATE_TIMER_PTR(timer, ptimer_state),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
+1
-1
@@ -286,7 +286,7 @@ static const VMStateDescription vmstate_pl330 = {
|
||||
PL330Queue),
|
||||
VMSTATE_STRUCT(write_queue, PL330State, 0, vmstate_pl330_queue,
|
||||
PL330Queue),
|
||||
VMSTATE_TIMER(timer, PL330State),
|
||||
VMSTATE_TIMER_PTR(timer, PL330State),
|
||||
VMSTATE_UINT32(inten, PL330State),
|
||||
VMSTATE_UINT32(int_status, PL330State),
|
||||
VMSTATE_UINT32(ev_status, PL330State),
|
||||
|
||||
+9
-7
@@ -156,6 +156,7 @@ int load_multiboot(FWCfgState *fw_cfg,
|
||||
MultibootState mbs;
|
||||
uint8_t bootinfo[MBI_SIZE];
|
||||
uint8_t *mb_bootinfo_data;
|
||||
uint32_t cmdline_len;
|
||||
|
||||
/* Ok, let's see if it is a multiboot image.
|
||||
The header is 12x32bit long, so the latest entry may be 8192 - 48. */
|
||||
@@ -258,27 +259,28 @@ int load_multiboot(FWCfgState *fw_cfg,
|
||||
mbs.offset_mbinfo = mbs.mb_buf_size;
|
||||
|
||||
/* Calculate space for cmdlines, bootloader name, and mb_mods */
|
||||
mbs.mb_buf_size += strlen(kernel_filename) + 1;
|
||||
mbs.mb_buf_size += strlen(kernel_cmdline) + 1;
|
||||
mbs.mb_buf_size += strlen(bootloader_name) + 1;
|
||||
cmdline_len = strlen(kernel_filename) + 1;
|
||||
cmdline_len += strlen(kernel_cmdline) + 1;
|
||||
if (initrd_filename) {
|
||||
const char *r = initrd_filename;
|
||||
mbs.mb_buf_size += strlen(r) + 1;
|
||||
cmdline_len += strlen(r) + 1;
|
||||
mbs.mb_mods_avail = 1;
|
||||
while (*(r = get_opt_value(NULL, 0, r))) {
|
||||
mbs.mb_mods_avail++;
|
||||
r++;
|
||||
}
|
||||
mbs.mb_buf_size += MB_MOD_SIZE * mbs.mb_mods_avail;
|
||||
}
|
||||
|
||||
mbs.mb_buf_size += cmdline_len;
|
||||
mbs.mb_buf_size += MB_MOD_SIZE * mbs.mb_mods_avail;
|
||||
mbs.mb_buf_size += strlen(bootloader_name) + 1;
|
||||
|
||||
mbs.mb_buf_size = TARGET_PAGE_ALIGN(mbs.mb_buf_size);
|
||||
|
||||
/* enlarge mb_buf to hold cmdlines, bootloader, mb-info structs */
|
||||
mbs.mb_buf = g_realloc(mbs.mb_buf, mbs.mb_buf_size);
|
||||
mbs.offset_cmdlines = mbs.offset_mbinfo + mbs.mb_mods_avail * MB_MOD_SIZE;
|
||||
mbs.offset_bootloader = mbs.offset_cmdlines + strlen(kernel_filename) + 1
|
||||
+ strlen(kernel_cmdline) + 1;
|
||||
mbs.offset_bootloader = mbs.offset_cmdlines + cmdline_len;
|
||||
|
||||
if (initrd_filename) {
|
||||
char *next_initrd, not_last;
|
||||
|
||||
+6
-2
@@ -328,6 +328,10 @@ static void pc_compat_2_2(MachineState *machine)
|
||||
x86_cpu_compat_set_features("Haswell", FEAT_1_ECX, 0, CPUID_EXT_RDRAND);
|
||||
x86_cpu_compat_set_features("Broadwell", FEAT_1_ECX, 0, CPUID_EXT_F16C);
|
||||
x86_cpu_compat_set_features("Broadwell", FEAT_1_ECX, 0, CPUID_EXT_RDRAND);
|
||||
x86_cpu_compat_set_features("Haswell", FEAT_7_0_EBX,
|
||||
CPUID_7_0_EBX_HLE | CPUID_7_0_EBX_RTM, 0);
|
||||
x86_cpu_compat_set_features("Broadwell", FEAT_7_0_EBX,
|
||||
CPUID_7_0_EBX_HLE | CPUID_7_0_EBX_RTM, 0);
|
||||
}
|
||||
|
||||
static void pc_compat_2_1(MachineState *machine)
|
||||
@@ -406,7 +410,7 @@ static void pc_compat_1_3(MachineState *machine)
|
||||
static void pc_compat_1_2(MachineState *machine)
|
||||
{
|
||||
pc_compat_1_3(machine);
|
||||
x86_cpu_compat_kvm_no_autoenable(FEAT_KVM, KVM_FEATURE_PV_EOI);
|
||||
x86_cpu_compat_kvm_no_autoenable(FEAT_KVM, 1 << KVM_FEATURE_PV_EOI);
|
||||
}
|
||||
|
||||
static void pc_init_pci_2_2(MachineState *machine)
|
||||
@@ -483,7 +487,7 @@ static void pc_init_isa(MachineState *machine)
|
||||
if (!machine->cpu_model) {
|
||||
machine->cpu_model = "486";
|
||||
}
|
||||
x86_cpu_compat_kvm_no_autoenable(FEAT_KVM, KVM_FEATURE_PV_EOI);
|
||||
x86_cpu_compat_kvm_no_autoenable(FEAT_KVM, 1 << KVM_FEATURE_PV_EOI);
|
||||
enable_compat_apic_id_mode();
|
||||
pc_init1(machine, 0, 1);
|
||||
}
|
||||
|
||||
@@ -307,6 +307,10 @@ static void pc_compat_2_2(MachineState *machine)
|
||||
x86_cpu_compat_set_features("Haswell", FEAT_1_ECX, 0, CPUID_EXT_RDRAND);
|
||||
x86_cpu_compat_set_features("Broadwell", FEAT_1_ECX, 0, CPUID_EXT_F16C);
|
||||
x86_cpu_compat_set_features("Broadwell", FEAT_1_ECX, 0, CPUID_EXT_RDRAND);
|
||||
x86_cpu_compat_set_features("Haswell", FEAT_7_0_EBX,
|
||||
CPUID_7_0_EBX_HLE | CPUID_7_0_EBX_RTM, 0);
|
||||
x86_cpu_compat_set_features("Broadwell", FEAT_7_0_EBX,
|
||||
CPUID_7_0_EBX_HLE | CPUID_7_0_EBX_RTM, 0);
|
||||
}
|
||||
|
||||
static void pc_compat_2_1(MachineState *machine)
|
||||
|
||||
+1
-1
@@ -455,7 +455,7 @@ static const VMStateDescription vmstate_lm_kbd = {
|
||||
VMSTATE_UINT16_ARRAY(pwm.file, LM823KbdState, 256),
|
||||
VMSTATE_UINT8(pwm.faddr, LM823KbdState),
|
||||
VMSTATE_BUFFER(pwm.addr, LM823KbdState),
|
||||
VMSTATE_TIMER_ARRAY(pwm.tm, LM823KbdState, 3),
|
||||
VMSTATE_TIMER_PTR_ARRAY(pwm.tm, LM823KbdState, 3),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
@@ -177,13 +177,14 @@ bool apic_next_timer(APICCommonState *s, int64_t current_time)
|
||||
|
||||
void apic_init_reset(DeviceState *dev)
|
||||
{
|
||||
APICCommonState *s = APIC_COMMON(dev);
|
||||
APICCommonClass *info = APIC_COMMON_GET_CLASS(s);
|
||||
APICCommonState *s;
|
||||
APICCommonClass *info;
|
||||
int i;
|
||||
|
||||
if (!s) {
|
||||
if (!dev) {
|
||||
return;
|
||||
}
|
||||
s = APIC_COMMON(dev);
|
||||
s->tpr = 0;
|
||||
s->spurious_vec = 0xff;
|
||||
s->log_dest = 0;
|
||||
@@ -208,6 +209,7 @@ void apic_init_reset(DeviceState *dev)
|
||||
}
|
||||
s->timer_expiry = -1;
|
||||
|
||||
info = APIC_COMMON_GET_CLASS(s);
|
||||
if (info->reset) {
|
||||
info->reset(s);
|
||||
}
|
||||
|
||||
@@ -450,7 +450,7 @@ static const VMStateDescription vmstate_nvic = {
|
||||
VMSTATE_UINT32(systick.control, nvic_state),
|
||||
VMSTATE_UINT32(systick.reload, nvic_state),
|
||||
VMSTATE_INT64(systick.tick, nvic_state),
|
||||
VMSTATE_TIMER(systick.timer, nvic_state),
|
||||
VMSTATE_TIMER_PTR(systick.timer, nvic_state),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user