kvm: x86: Establish IRQ0 override control

KVM is forced to disable the IRQ0 override when we run with in-kernel
irqchip but without IRQ routing support of the kernel. Set the fwcfg
value correspondingly. This aligns us with qemu-kvm.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Jan Kiszka 2011-10-15 14:08:26 +02:00
parent 84b058d7df
commit 9b5b76d449
6 changed files with 14 additions and 3 deletions

View File

@ -39,6 +39,7 @@
#include "msi.h" #include "msi.h"
#include "sysbus.h" #include "sysbus.h"
#include "sysemu.h" #include "sysemu.h"
#include "kvm.h"
#include "blockdev.h" #include "blockdev.h"
#include "ui/qemu-spice.h" #include "ui/qemu-spice.h"
#include "memory.h" #include "memory.h"
@ -609,7 +610,7 @@ static void *bochs_bios_init(void)
fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES, (uint8_t *)acpi_tables, fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES, (uint8_t *)acpi_tables,
acpi_tables_len); acpi_tables_len);
fw_cfg_add_bytes(fw_cfg, FW_CFG_IRQ0_OVERRIDE, &irq0override, 1); fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, kvm_allows_irq0_override());
smbios_table = smbios_get_table(&smbios_len); smbios_table = smbios_get_table(&smbios_len);
if (smbios_table) if (smbios_table)

View File

@ -1307,6 +1307,11 @@ int kvm_has_gsi_routing(void)
return kvm_check_extension(kvm_state, KVM_CAP_IRQ_ROUTING); return kvm_check_extension(kvm_state, KVM_CAP_IRQ_ROUTING);
} }
int kvm_allows_irq0_override(void)
{
return !kvm_enabled() || !kvm_irqchip_in_kernel() || kvm_has_gsi_routing();
}
void kvm_setup_guest_memory(void *start, size_t size) void kvm_setup_guest_memory(void *start, size_t size)
{ {
if (!kvm_has_sync_mmu()) { if (!kvm_has_sync_mmu()) {

View File

@ -78,6 +78,11 @@ int kvm_has_many_ioeventfds(void)
return 0; return 0;
} }
int kvm_allows_irq0_override(void)
{
return 1;
}
void kvm_setup_guest_memory(void *start, size_t size) void kvm_setup_guest_memory(void *start, size_t size)
{ {
} }

2
kvm.h
View File

@ -53,6 +53,8 @@ int kvm_has_xcrs(void);
int kvm_has_many_ioeventfds(void); int kvm_has_many_ioeventfds(void);
int kvm_has_gsi_routing(void); int kvm_has_gsi_routing(void);
int kvm_allows_irq0_override(void);
#ifdef NEED_CPU_H #ifdef NEED_CPU_H
int kvm_init_vcpu(CPUState *env); int kvm_init_vcpu(CPUState *env);

View File

@ -102,7 +102,6 @@ extern int vga_interface_type;
extern int graphic_width; extern int graphic_width;
extern int graphic_height; extern int graphic_height;
extern int graphic_depth; extern int graphic_depth;
extern uint8_t irq0override;
extern DisplayType display_type; extern DisplayType display_type;
extern const char *keyboard_layout; extern const char *keyboard_layout;
extern int win2k_install_hack; extern int win2k_install_hack;

1
vl.c
View File

@ -218,7 +218,6 @@ int no_reboot = 0;
int no_shutdown = 0; int no_shutdown = 0;
int cursor_hide = 1; int cursor_hide = 1;
int graphic_rotate = 0; int graphic_rotate = 0;
uint8_t irq0override = 1;
const char *watchdog; const char *watchdog;
QEMUOptionRom option_rom[MAX_OPTION_ROMS]; QEMUOptionRom option_rom[MAX_OPTION_ROMS];
int nb_option_roms; int nb_option_roms;