diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2016-06-08 14:45:28 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2016-06-08 14:45:28 +0100 |
commit | c503a855992caa8c8f12e4509829490cdfc1af00 (patch) | |
tree | cc7242cf83a9baf3c98a6afbb0c0a76f979126bd /hw | |
parent | 6ed5546fa7bf12c5b87ef76bafb86e1d77ed6e85 (diff) | |
parent | 99a9a52a23bd9c256a783b4509990c21c6635c7d (diff) | |
download | qemu-c503a855992caa8c8f12e4509829490cdfc1af00.zip |
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
* max-ram-below-4g improvement (Gerd)
* escc fix (xiaoqiang)
* ESP fix (Prasad)
* scsi-disk tweaks/fix (me)
* Makefile dependency fixes (me)
* PKGVERSION improvement (Fam)
* -vnc man improvement (Robert)
# gpg: Signature made Tue 07 Jun 2016 18:06:22 BST
# gpg: using RSA key 0xBFFBD25F78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg: aka "Paolo Bonzini <pbonzini@redhat.com>"
* remotes/bonzini/tags/for-upstream:
vnc: list the 'to' parameter of '-vnc' in the qemu man page
scsi-disk: add missing break
Makefile: Derive "PKGVERSION" from "git describe" by default
Makefile: add dependency on scripts/hxtool
Makefile: add dependency on scripts/make_device_config.sh
Makefile: add dependency on scripts/create_config
Makefile: Add a "FORCE" target
scsi: megasas: null terminate bios version buffer
scsi: mark TYPE_SCSI_DISK_BASE as abstract
scsi: esp: check TI buffer index before read/write
hw/char: QOM'ify escc.c (fix)
pc: allow raising low memory via max-ram-below-4g option
tests: Rename tests/Makefile to tests/Makefile.include
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/char/escc.c | 12 | ||||
-rw-r--r-- | hw/i386/pc.c | 2 | ||||
-rw-r--r-- | hw/i386/pc_piix.c | 61 | ||||
-rw-r--r-- | hw/scsi/esp.c | 20 | ||||
-rw-r--r-- | hw/scsi/megasas.c | 1 | ||||
-rw-r--r-- | hw/scsi/scsi-disk.c | 2 |
6 files changed, 59 insertions, 39 deletions
diff --git a/hw/char/escc.c b/hw/char/escc.c index 8e6a7df465..31a5f902f9 100644 --- a/hw/char/escc.c +++ b/hw/char/escc.c @@ -989,18 +989,13 @@ static void escc_init1(Object *obj) SysBusDevice *dev = SYS_BUS_DEVICE(obj); unsigned int i; - s->chn[0].disabled = s->disabled; - s->chn[1].disabled = s->disabled; for (i = 0; i < 2; i++) { sysbus_init_irq(dev, &s->chn[i].irq); s->chn[i].chn = 1 - i; - s->chn[i].clock = s->frequency / 2; } s->chn[0].otherchn = &s->chn[1]; s->chn[1].otherchn = &s->chn[0]; - memory_region_init_io(&s->mmio, obj, &escc_mem_ops, s, "escc", - ESCC_SIZE << s->it_shift); sysbus_init_mmio(dev, &s->mmio); } @@ -1009,8 +1004,15 @@ static void escc_realize(DeviceState *dev, Error **errp) ESCCState *s = ESCC(dev); unsigned int i; + s->chn[0].disabled = s->disabled; + s->chn[1].disabled = s->disabled; + + memory_region_init_io(&s->mmio, OBJECT(dev), &escc_mem_ops, s, "escc", + ESCC_SIZE << s->it_shift); + for (i = 0; i < 2; i++) { if (s->chn[i].chr) { + s->chn[i].clock = s->frequency / 2; qemu_chr_add_handlers(s->chn[i].chr, serial_can_receive, serial_receive1, serial_event, &s->chn[i]); } diff --git a/hw/i386/pc.c b/hw/i386/pc.c index b8e8933a51..7198ed533c 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1886,7 +1886,7 @@ static void pc_machine_initfn(Object *obj) pc_machine_get_hotplug_memory_region_size, NULL, NULL, NULL, &error_abort); - pcms->max_ram_below_4g = 1ULL << 32; /* 4G */ + pcms->max_ram_below_4g = 0xe0000000; /* 3.5G */ object_property_add(obj, PC_MACHINE_MAX_RAM_BELOW_4G, "size", pc_machine_get_max_ram_below_4g, pc_machine_set_max_ram_below_4g, diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index a6a6604722..14dd0cc774 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -86,29 +86,46 @@ static void pc_init1(MachineState *machine, MemoryRegion *rom_memory; ram_addr_t lowmem; - /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory). - * If it doesn't, we need to split it in chunks below and above 4G. - * In any case, try to make sure that guest addresses aligned at - * 1G boundaries get mapped to host addresses aligned at 1G boundaries. - * For old machine types, use whatever split we used historically to avoid - * breaking migration. - */ - if (machine->ram_size >= 0xe0000000) { - lowmem = pcmc->gigabyte_align ? 0xc0000000 : 0xe0000000; - } else { - lowmem = 0xe0000000; - } - - /* Handle the machine opt max-ram-below-4g. It is basically doing - * min(qemu limit, user limit). + /* + * Calculate ram split, for memory below and above 4G. It's a bit + * complicated for backward compatibility reasons ... + * + * - Traditional split is 3.5G (lowmem = 0xe0000000). This is the + * default value for max_ram_below_4g now. + * + * - Then, to gigabyte align the memory, we move the split to 3G + * (lowmem = 0xc0000000). But only in case we have to split in + * the first place, i.e. ram_size is larger than (traditional) + * lowmem. And for new machine types (gigabyte_align = true) + * only, for live migration compatibility reasons. + * + * - Next the max-ram-below-4g option was added, which allowed to + * reduce lowmem to a smaller value, to allow a larger PCI I/O + * window below 4G. qemu doesn't enforce gigabyte alignment here, + * but prints a warning. + * + * - Finally max-ram-below-4g got updated to also allow raising lowmem, + * so legacy non-PAE guests can get as much memory as possible in + * the 32bit address space below 4G. + * + * Examples: + * qemu -M pc-1.7 -m 4G (old default) -> 3584M low, 512M high + * qemu -M pc -m 4G (new default) -> 3072M low, 1024M high + * qemu -M pc,max-ram-below-4g=2G -m 4G -> 2048M low, 2048M high + * qemu -M pc,max-ram-below-4g=4G -m 3968M -> 3968M low (=4G-128M) */ - if (lowmem > pcms->max_ram_below_4g) { - lowmem = pcms->max_ram_below_4g; - if (machine->ram_size - lowmem > lowmem && - lowmem & ((1ULL << 30) - 1)) { - error_report("Warning: Large machine and max_ram_below_4g(%"PRIu64 - ") not a multiple of 1G; possible bad performance.", - pcms->max_ram_below_4g); + lowmem = pcms->max_ram_below_4g; + if (machine->ram_size >= pcms->max_ram_below_4g) { + if (pcmc->gigabyte_align) { + if (lowmem > 0xc0000000) { + lowmem = 0xc0000000; + } + if (lowmem & ((1ULL << 30) - 1)) { + error_report("Warning: Large machine and max_ram_below_4g " + "(%" PRIu64 ") not a multiple of 1G; " + "possible bad performance.", + pcms->max_ram_below_4g); + } } } diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index 591c8172d5..3adb685177 100644 --- a/hw/scsi/esp.c +++ b/hw/scsi/esp.c @@ -400,19 +400,17 @@ uint64_t esp_reg_read(ESPState *s, uint32_t saddr) trace_esp_mem_readb(saddr, s->rregs[saddr]); switch (saddr) { case ESP_FIFO: - if (s->ti_size > 0) { + if ((s->rregs[ESP_RSTAT] & STAT_PIO_MASK) == 0) { + /* Data out. */ + qemu_log_mask(LOG_UNIMP, "esp: PIO data read not implemented\n"); + s->rregs[ESP_FIFO] = 0; + esp_raise_irq(s); + } else if (s->ti_rptr < s->ti_wptr) { s->ti_size--; - if ((s->rregs[ESP_RSTAT] & STAT_PIO_MASK) == 0) { - /* Data out. */ - qemu_log_mask(LOG_UNIMP, - "esp: PIO data read not implemented\n"); - s->rregs[ESP_FIFO] = 0; - } else { - s->rregs[ESP_FIFO] = s->ti_buf[s->ti_rptr++]; - } + s->rregs[ESP_FIFO] = s->ti_buf[s->ti_rptr++]; esp_raise_irq(s); } - if (s->ti_size == 0) { + if (s->ti_rptr == s->ti_wptr) { s->ti_rptr = 0; s->ti_wptr = 0; } @@ -456,7 +454,7 @@ void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val) } else { trace_esp_error_fifo_overrun(); } - } else if (s->ti_size == TI_BUFSZ - 1) { + } else if (s->ti_wptr == TI_BUFSZ - 1) { trace_esp_error_fifo_overrun(); } else { s->ti_size++; diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c index cc66d36186..a9ffc32682 100644 --- a/hw/scsi/megasas.c +++ b/hw/scsi/megasas.c @@ -773,6 +773,7 @@ static int megasas_ctrl_get_info(MegasasState *s, MegasasCmd *cmd) ptr = memory_region_get_ram_ptr(&pci_dev->rom); memcpy(biosver, ptr + 0x41, 31); + biosver[31] = 0; memcpy(info.image_component[1].name, "BIOS", 4); memcpy(info.image_component[1].version, biosver, strlen((const char *)biosver)); diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index ab7cf9cbf8..188196990e 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -2740,6 +2740,7 @@ static int32_t scsi_block_dma_command(SCSIRequest *req, uint8_t *buf) /* 10-byte CDB. */ r->cdb1 = req->cmd.buf[1]; r->group_number = req->cmd.buf[6]; + break; case 4: /* 12-byte CDB. */ r->cdb1 = req->cmd.buf[1]; @@ -2842,6 +2843,7 @@ static const TypeInfo scsi_disk_base_info = { .class_init = scsi_disk_base_class_initfn, .instance_size = sizeof(SCSIDiskState), .class_size = sizeof(SCSIDiskClass), + .abstract = true, }; #define DEFINE_SCSI_DISK_PROPERTIES() \ |