diff options
Diffstat (limited to 'hw')
-rw-r--r-- | hw/acpi/ich9.c | 4 | ||||
-rw-r--r-- | hw/char/cadence_uart.c | 15 | ||||
-rw-r--r-- | hw/char/virtio-serial-bus.c | 14 | ||||
-rw-r--r-- | hw/i386/pc_piix.c | 13 | ||||
-rw-r--r-- | hw/virtio/vhost-user.c | 6 |
5 files changed, 31 insertions, 21 deletions
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index e7d6c77..7b14bbb 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -232,11 +232,11 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, acpi_gpe_init(&pm->acpi_regs, ICH9_PMIO_GPE0_LEN); memory_region_init_io(&pm->io_gpe, OBJECT(lpc_pci), &ich9_gpe_ops, pm, - "apci-gpe0", ICH9_PMIO_GPE0_LEN); + "acpi-gpe0", ICH9_PMIO_GPE0_LEN); memory_region_add_subregion(&pm->io, ICH9_PMIO_GPE0_STS, &pm->io_gpe); memory_region_init_io(&pm->io_smi, OBJECT(lpc_pci), &ich9_smi_ops, pm, - "apci-smi", 8); + "acpi-smi", 8); memory_region_add_subregion(&pm->io, ICH9_PMIO_SMI_EN, &pm->io_smi); pm->irq = sci_irq; diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c index dbbc167..a5736cb 100644 --- a/hw/char/cadence_uart.c +++ b/hw/char/cadence_uart.c @@ -175,8 +175,10 @@ static void uart_send_breaks(UartState *s) { int break_enabled = 1; - qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_BREAK, - &break_enabled); + if (s->chr) { + qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_BREAK, + &break_enabled); + } } static void uart_parameters_setup(UartState *s) @@ -227,7 +229,9 @@ static void uart_parameters_setup(UartState *s) packet_size += ssp.data_bits + ssp.stop_bits; s->char_tx_time = (get_ticks_per_sec() / ssp.speed) * packet_size; - qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp); + if (s->chr) { + qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp); + } } static int uart_can_receive(void *opaque) @@ -295,6 +299,7 @@ static gboolean cadence_uart_xmit(GIOChannel *chan, GIOCondition cond, /* instant drain the fifo when there's no back-end */ if (!s->chr) { s->tx_count = 0; + return FALSE; } if (!s->tx_count) { @@ -375,7 +380,9 @@ static void uart_read_rx_fifo(UartState *s, uint32_t *c) *c = s->rx_fifo[rx_rpos]; s->rx_count--; - qemu_chr_accept_input(s->chr); + if (s->chr) { + qemu_chr_accept_input(s->chr); + } } else { *c = 0; } diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index 07bebc0..23123b7 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -797,10 +797,18 @@ static void add_port(VirtIOSerial *vser, uint32_t port_id) static void remove_port(VirtIOSerial *vser, uint32_t port_id) { VirtIOSerialPort *port; - unsigned int i; - i = port_id / 32; - vser->ports_map[i] &= ~(1U << (port_id % 32)); + /* + * Don't mark port 0 removed -- we explicitly reserve it for + * backward compat with older guests, ensure a virtconsole device + * unplug retains the reservation. + */ + if (port_id) { + unsigned int i; + + i = port_id / 32; + vser->ports_map[i] &= ~(1U << (port_id % 32)); + } port = find_port_by_id(vser, port_id); /* diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 2dccb34..ec8ccdb 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -386,19 +386,10 @@ static void pc_init_pci_1_2(MachineState *machine) pc_init_pci(machine); } -/* PC init function for pc-0.10 to pc-0.13, and reused by xenfv */ +/* PC init function for pc-0.10 to pc-0.13 */ static void pc_init_pci_no_kvmclock(MachineState *machine) { - has_pci_info = false; - has_acpi_build = false; - smbios_defaults = false; - gigabyte_align = false; - smbios_legacy_mode = true; - has_reserved_memory = false; - option_rom_has_mr = true; - rom_file_has_mr = false; - x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI); - enable_compat_apic_id_mode(); + pc_compat_1_2(machine); pc_init1(machine, 1, 0); } diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 38e5806..4e88d9c 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -216,7 +216,11 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request, case VHOST_SET_MEM_TABLE: for (i = 0; i < dev->mem->nregions; ++i) { struct vhost_memory_region *reg = dev->mem->regions + i; - fd = qemu_get_ram_fd(reg->guest_phys_addr); + ram_addr_t ram_addr; + + assert((uintptr_t)reg->userspace_addr == reg->userspace_addr); + qemu_ram_addr_from_host((void *)(uintptr_t)reg->userspace_addr, &ram_addr); + fd = qemu_get_ram_fd(ram_addr); if (fd > 0) { msg.memory.regions[fd_num].userspace_addr = reg->userspace_addr; msg.memory.regions[fd_num].memory_size = reg->memory_size; |