diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2019-11-19 16:31:27 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2019-11-19 16:31:27 +0000 |
commit | 06b43e082c6bdbd5b261b57d5c8e1fe5db6807a9 (patch) | |
tree | 448b1ec00a472622d19df6903a3f22477a1ff5a1 /hw | |
parent | 4b8be65ec5b42027b9b0587955643646d015f2ee (diff) | |
parent | 7a3e29b12f5afe0106a5713bb4db6e23dc66ef91 (diff) |
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
* microvm docs and fixes (Sergio, Liam)
* New processor features for Intel errata (myself, Pawan)
* Kconfig fixes (myself, Thomas)
* Revert mc146818rtc change (myself)
* Deprecate scsi-disk (myself)
* RTC fix (myself, Marcelo)
# gpg: Signature made Tue 19 Nov 2019 09:03:49 GMT
# 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:
mc146818rtc: fix timer interrupt reinjection again
Revert "mc146818rtc: fix timer interrupt reinjection"
scsi: deprecate scsi-disk
hw/i386: Move save_tsc_khz from PCMachineClass to X86MachineClass
docs/microvm.rst: add instructions for shutting down the guest
docs/microvm.rst: fix alignment in "Limitations"
vfio: vfio-pci requires EDID
hw/i386: Fix compiler warning when CONFIG_IDE_ISA is disabled
target/i386: Export TAA_NO bit to guests
target/i386: add PSCHANGE_NO bit for the ARCH_CAPABILITIES MSR
microvm: fix memory leak in microvm_fix_kernel_cmdline
scripts: Detect git worktrees for get_maintainer.pl --git
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/i386/microvm.c | 2 | ||||
-rw-r--r-- | hw/i386/pc.c | 1 | ||||
-rw-r--r-- | hw/i386/pc_piix.c | 8 | ||||
-rw-r--r-- | hw/i386/pc_q35.c | 4 | ||||
-rw-r--r-- | hw/i386/x86.c | 1 | ||||
-rw-r--r-- | hw/rtc/mc146818rtc.c | 79 | ||||
-rw-r--r-- | hw/scsi/scsi-bus.c | 12 | ||||
-rw-r--r-- | hw/scsi/scsi-disk.c | 3 |
8 files changed, 63 insertions, 47 deletions
diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index 8aacd6c8d1..def37e60f7 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -331,6 +331,8 @@ static void microvm_fix_kernel_cmdline(MachineState *machine) fw_cfg_modify_i32(x86ms->fw_cfg, FW_CFG_CMDLINE_SIZE, strlen(cmdline) + 1); fw_cfg_modify_string(x86ms->fw_cfg, FW_CFG_CMDLINE_DATA, cmdline); + + g_free(cmdline); } static void microvm_machine_state_init(MachineState *machine) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 96715f8a3f..ac08e63604 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -2195,7 +2195,6 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) /* BIOS ACPI tables: 128K. Other BIOS datastructures: less than 4K reported * to be used at the moment, 32K should be enough for a while. */ pcmc->acpi_data_size = 0x20000 + 0x8000; - pcmc->save_tsc_khz = true; pcmc->linuxboot_dma_enabled = true; pcmc->pvh_enabled = true; assert(!mc->get_hotplug_handler); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 2aefa3b8df..1bd70d1abb 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -78,7 +78,6 @@ static void pc_init1(MachineState *machine, X86MachineState *x86ms = X86_MACHINE(machine); MemoryRegion *system_memory = get_system_memory(); MemoryRegion *system_io = get_system_io(); - int i; PCIBus *pci_bus; ISABus *isa_bus; PCII440FXState *i440fx_state; @@ -253,7 +252,8 @@ static void pc_init1(MachineState *machine, } #ifdef CONFIG_IDE_ISA else { - for(i = 0; i < MAX_IDE_BUS; i++) { + int i; + for (i = 0; i < MAX_IDE_BUS; i++) { ISADevice *dev; char busname[] = "ide.0"; dev = isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i], @@ -567,10 +567,10 @@ DEFINE_I440FX_MACHINE(v2_6, "pc-i440fx-2.6", NULL, static void pc_i440fx_2_5_machine_options(MachineClass *m) { - PCMachineClass *pcmc = PC_MACHINE_CLASS(m); + X86MachineClass *x86mc = X86_MACHINE_CLASS(m); pc_i440fx_2_6_machine_options(m); - pcmc->save_tsc_khz = false; + x86mc->save_tsc_khz = false; m->legacy_fw_cfg_order = 1; compat_props_add(m->compat_props, hw_compat_2_5, hw_compat_2_5_len); compat_props_add(m->compat_props, pc_compat_2_5, pc_compat_2_5_len); diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index d51f524727..385e5cffb1 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -508,10 +508,10 @@ DEFINE_Q35_MACHINE(v2_6, "pc-q35-2.6", NULL, static void pc_q35_2_5_machine_options(MachineClass *m) { - PCMachineClass *pcmc = PC_MACHINE_CLASS(m); + X86MachineClass *x86mc = X86_MACHINE_CLASS(m); pc_q35_2_6_machine_options(m); - pcmc->save_tsc_khz = false; + x86mc->save_tsc_khz = false; m->legacy_fw_cfg_order = 1; compat_props_add(m->compat_props, hw_compat_2_5, hw_compat_2_5_len); compat_props_add(m->compat_props, pc_compat_2_5, pc_compat_2_5_len); diff --git a/hw/i386/x86.c b/hw/i386/x86.c index fd84b23124..394edc2f72 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -763,6 +763,7 @@ static void x86_machine_class_init(ObjectClass *oc, void *data) mc->get_default_cpu_node_id = x86_get_default_cpu_node_id; mc->possible_cpu_arch_ids = x86_possible_cpu_arch_ids; x86mc->compat_apic_id_mode = false; + x86mc->save_tsc_khz = true; nc->nmi_monitor_handler = x86_nmi; object_class_property_add(oc, X86_MACHINE_MAX_RAM_BELOW_4G, "size", diff --git a/hw/rtc/mc146818rtc.c b/hw/rtc/mc146818rtc.c index ee6bf82b40..74ae74bc5c 100644 --- a/hw/rtc/mc146818rtc.c +++ b/hw/rtc/mc146818rtc.c @@ -168,12 +168,13 @@ static uint32_t rtc_periodic_clock_ticks(RTCState *s) * is just due to period adjustment. */ static void -periodic_timer_update(RTCState *s, int64_t current_time, uint32_t old_period) +periodic_timer_update(RTCState *s, int64_t current_time, uint32_t old_period, bool period_change) { uint32_t period; int64_t cur_clock, next_irq_clock, lost_clock = 0; period = rtc_periodic_clock_ticks(s); + s->period = period; if (!period) { s->irq_coalesced = 0; @@ -189,7 +190,7 @@ periodic_timer_update(RTCState *s, int64_t current_time, uint32_t old_period) * if the periodic timer's update is due to period re-configuration, * we should count the clock since last interrupt. */ - if (old_period) { + if (old_period && period_change) { int64_t last_periodic_clock, next_periodic_clock; next_periodic_clock = muldiv64(s->next_periodic_time, @@ -197,42 +198,41 @@ periodic_timer_update(RTCState *s, int64_t current_time, uint32_t old_period) last_periodic_clock = next_periodic_clock - old_period; lost_clock = cur_clock - last_periodic_clock; assert(lost_clock >= 0); + } + /* + * s->irq_coalesced can change for two reasons: + * + * a) if one or more periodic timer interrupts have been lost, + * lost_clock will be more that a period. + * + * b) when the period may be reconfigured, we expect the OS to + * treat delayed tick as the new period. So, when switching + * from a shorter to a longer period, scale down the missing, + * because the OS will treat past delayed ticks as longer + * (leftovers are put back into lost_clock). When switching + * to a shorter period, scale up the missing ticks since the + * OS handler will treat past delayed ticks as shorter. + */ + if (s->lost_tick_policy == LOST_TICK_POLICY_SLEW) { + uint32_t old_irq_coalesced = s->irq_coalesced; + + lost_clock += old_irq_coalesced * old_period; + s->irq_coalesced = lost_clock / s->period; + lost_clock %= s->period; + if (old_irq_coalesced != s->irq_coalesced || + old_period != s->period) { + DPRINTF_C("cmos: coalesced irqs scaled from %d to %d, " + "period scaled from %d to %d\n", old_irq_coalesced, + s->irq_coalesced, old_period, s->period); + rtc_coalesced_timer_update(s); + } + } else { /* - * s->irq_coalesced can change for two reasons: - * - * a) if one or more periodic timer interrupts have been lost, - * lost_clock will be more that a period. - * - * b) when the period may be reconfigured, we expect the OS to - * treat delayed tick as the new period. So, when switching - * from a shorter to a longer period, scale down the missing, - * because the OS will treat past delayed ticks as longer - * (leftovers are put back into lost_clock). When switching - * to a shorter period, scale up the missing ticks since the - * OS handler will treat past delayed ticks as shorter. + * no way to compensate the interrupt if LOST_TICK_POLICY_SLEW + * is not used, we should make the time progress anyway. */ - if (s->lost_tick_policy == LOST_TICK_POLICY_SLEW) { - uint32_t old_irq_coalesced = s->irq_coalesced; - - s->period = period; - lost_clock += old_irq_coalesced * old_period; - s->irq_coalesced = lost_clock / s->period; - lost_clock %= s->period; - if (old_irq_coalesced != s->irq_coalesced || - old_period != s->period) { - DPRINTF_C("cmos: coalesced irqs scaled from %d to %d, " - "period scaled from %d to %d\n", old_irq_coalesced, - s->irq_coalesced, old_period, s->period); - rtc_coalesced_timer_update(s); - } - } else { - /* - * no way to compensate the interrupt if LOST_TICK_POLICY_SLEW - * is not used, we should make the time progress anyway. - */ - lost_clock = MIN(lost_clock, period); - } + lost_clock = MIN(lost_clock, period); } assert(lost_clock >= 0 && lost_clock <= period); @@ -246,7 +246,7 @@ static void rtc_periodic_timer(void *opaque) { RTCState *s = opaque; - periodic_timer_update(s, s->next_periodic_time, 0); + periodic_timer_update(s, s->next_periodic_time, s->period, false); s->cmos_data[RTC_REG_C] |= REG_C_PF; if (s->cmos_data[RTC_REG_B] & REG_B_PIE) { s->cmos_data[RTC_REG_C] |= REG_C_IRQF; @@ -512,7 +512,7 @@ static void cmos_ioport_write(void *opaque, hwaddr addr, if (update_periodic_timer) { periodic_timer_update(s, qemu_clock_get_ns(rtc_clock), - old_period); + old_period, true); } check_update_timer(s); @@ -551,7 +551,7 @@ static void cmos_ioport_write(void *opaque, hwaddr addr, if (update_periodic_timer) { periodic_timer_update(s, qemu_clock_get_ns(rtc_clock), - old_period); + old_period, true); } check_update_timer(s); @@ -795,6 +795,7 @@ static int rtc_post_load(void *opaque, int version_id) s->offset = 0; check_update_timer(s); } + s->period = rtc_periodic_clock_ticks(s); /* The periodic timer is deterministic in record/replay mode, * so there is no need to update it after loading the vmstate. @@ -804,7 +805,7 @@ static int rtc_post_load(void *opaque, int version_id) uint64_t now = qemu_clock_get_ns(rtc_clock); if (now < s->next_periodic_time || now > (s->next_periodic_time + get_max_clock_jump())) { - periodic_timer_update(s, qemu_clock_get_ns(rtc_clock), 0); + periodic_timer_update(s, qemu_clock_get_ns(rtc_clock), s->period, false); } } diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 359d50d6d0..ad0e7f6d88 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -254,8 +254,18 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk, char *name; DeviceState *dev; Error *err = NULL; + DriveInfo *dinfo; - driver = blk_is_sg(blk) ? "scsi-generic" : "scsi-disk"; + if (blk_is_sg(blk)) { + driver = "scsi-generic"; + } else { + dinfo = blk_legacy_dinfo(blk); + if (dinfo && dinfo->media_cd) { + driver = "scsi-cd"; + } else { + driver = "scsi-hd"; + } + } dev = qdev_create(&bus->qbus, driver); name = g_strdup_printf("legacy[%d]", unit); object_property_add_child(OBJECT(bus), name, OBJECT(dev), NULL); diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 07fb5ebdf1..e44c61eeb4 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -2481,6 +2481,9 @@ static void scsi_disk_realize(SCSIDevice *dev, Error **errp) DriveInfo *dinfo; Error *local_err = NULL; + warn_report("'scsi-disk' is deprecated, " + "please use 'scsi-hd' or 'scsi-cd' instead"); + if (!dev->conf.blk) { scsi_realize(dev, &local_err); assert(local_err); |