aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2013-02-26 07:44:39 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2013-02-26 07:44:39 -0600
commit864a556e9a800116a305f10fbb714268ca7e9bc3 (patch)
treec9e5fdc33d2a1be16446c7504106b4f128e3d0cd /hw
parent9a1d7f00efd4b69f051d4223a70ca91af0ccb19d (diff)
parentbf3caa3dc17552b323cec6831301a22cfc98ecd5 (diff)
Merge remote-tracking branch 'kwolf/for-anthony' into staging
# By Paolo Bonzini (7) and others # Via Kevin Wolf * kwolf/for-anthony: (22 commits) pc: add compatibility machine types for 1.4 blockdev: enable discard by default qemu-nbd: add --discard option blockdev: add discard suboption to -drive block: implement BDRV_O_UNMAP block: complete all IOs before .bdrv_truncate coroutine: trim down nesting level in perf_nesting test coroutine: move pooling to common code qemu-iotests: Test qcow2 image creation options qemu-iotests: Add qemu-img compare test qemu-img: Add compare subcommand qemu-img: Add "Quiet mode" option block: Add synchronous wrapper for bdrv_co_is_allocated_above block: refuse negative iops and bps values block: use Error in do_check_io_limits() qcow2: support compressed clusters in BlockFragInfo qemu-img: add compressed clusters to BlockFragInfo qemu-img: fix missing space in qemu-img check output qcow2: record fragmentation statistics during check qcow2: introduce check_refcounts_l1/l2() flags ...
Diffstat (limited to 'hw')
-rw-r--r--hw/block-common.h2
-rw-r--r--hw/ide/qdev.c5
-rw-r--r--hw/pc.h31
-rw-r--r--hw/pc_piix.c18
-rw-r--r--hw/pc_q35.c19
-rw-r--r--hw/scsi-disk.c13
6 files changed, 78 insertions, 10 deletions
diff --git a/hw/block-common.h b/hw/block-common.h
index bb808f7f56..dd115320c9 100644
--- a/hw/block-common.h
+++ b/hw/block-common.h
@@ -50,7 +50,7 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf)
DEFINE_PROP_UINT32("opt_io_size", _state, _conf.opt_io_size, 0), \
DEFINE_PROP_INT32("bootindex", _state, _conf.bootindex, -1), \
DEFINE_PROP_UINT32("discard_granularity", _state, \
- _conf.discard_granularity, 0)
+ _conf.discard_granularity, -1)
#define DEFINE_BLOCK_CHS_PROPERTIES(_state, _conf) \
DEFINE_PROP_UINT32("cyls", _state, _conf.cyls, 0), \
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index c436b38bcb..fd06da7003 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -143,7 +143,10 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind)
IDEBus *bus = DO_UPCAST(IDEBus, qbus, dev->qdev.parent_bus);
IDEState *s = bus->ifs + dev->unit;
- if (dev->conf.discard_granularity && dev->conf.discard_granularity != 512) {
+ if (dev->conf.discard_granularity == -1) {
+ dev->conf.discard_granularity = 512;
+ } else if (dev->conf.discard_granularity &&
+ dev->conf.discard_granularity != 512) {
error_report("discard_granularity must be 512 for ide");
return -1;
}
diff --git a/hw/pc.h b/hw/pc.h
index fbcf43d717..da1b102ef1 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -187,4 +187,35 @@ void pc_system_firmware_init(MemoryRegion *rom_memory);
int e820_add_entry(uint64_t, uint64_t, uint32_t);
+#define PC_COMPAT_1_4 \
+ {\
+ .driver = "scsi-hd",\
+ .property = "discard_granularity",\
+ .value = stringify(0),\
+ },{\
+ .driver = "scsi-cd",\
+ .property = "discard_granularity",\
+ .value = stringify(0),\
+ },{\
+ .driver = "scsi-disk",\
+ .property = "discard_granularity",\
+ .value = stringify(0),\
+ },{\
+ .driver = "ide-hd",\
+ .property = "discard_granularity",\
+ .value = stringify(0),\
+ },{\
+ .driver = "ide-cd",\
+ .property = "discard_granularity",\
+ .value = stringify(0),\
+ },{\
+ .driver = "ide-drive",\
+ .property = "discard_granularity",\
+ .value = stringify(0),\
+ },{\
+ .driver = "virtio-blk-pci",\
+ .property = "discard_granularity",\
+ .value = stringify(0),\
+ }
+
#endif
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index 0af436cfaf..aa9cc81a2d 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -294,8 +294,8 @@ static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
}
#endif
-static QEMUMachine pc_i440fx_machine_v1_4 = {
- .name = "pc-i440fx-1.4",
+static QEMUMachine pc_i440fx_machine_v1_5 = {
+ .name = "pc-i440fx-1.5",
.alias = "pc",
.desc = "Standard PC (i440FX + PIIX, 1996)",
.init = pc_init_pci,
@@ -304,7 +304,20 @@ static QEMUMachine pc_i440fx_machine_v1_4 = {
DEFAULT_MACHINE_OPTIONS,
};
+static QEMUMachine pc_i440fx_machine_v1_4 = {
+ .name = "pc-i440fx-1.4",
+ .desc = "Standard PC (i440FX + PIIX, 1996)",
+ .init = pc_init_pci,
+ .max_cpus = 255,
+ .compat_props = (GlobalProperty[]) {
+ PC_COMPAT_1_4,
+ { /* end of list */ }
+ },
+ DEFAULT_MACHINE_OPTIONS,
+};
+
#define PC_COMPAT_1_3 \
+ PC_COMPAT_1_4, \
{\
.driver = "usb-tablet",\
.property = "usb_version",\
@@ -679,6 +692,7 @@ static QEMUMachine xenfv_machine = {
static void pc_machine_init(void)
{
+ qemu_register_machine(&pc_i440fx_machine_v1_5);
qemu_register_machine(&pc_i440fx_machine_v1_4);
qemu_register_machine(&pc_machine_v1_3);
qemu_register_machine(&pc_machine_v1_2);
diff --git a/hw/pc_q35.c b/hw/pc_q35.c
index 6f5ff8dcae..e22fb9891d 100644
--- a/hw/pc_q35.c
+++ b/hw/pc_q35.c
@@ -209,8 +209,8 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
}
}
-static QEMUMachine pc_q35_machine = {
- .name = "pc-q35-1.4",
+static QEMUMachine pc_q35_machine_v1_5 = {
+ .name = "pc-q35-1.5",
.alias = "q35",
.desc = "Standard PC (Q35 + ICH9, 2009)",
.init = pc_q35_init,
@@ -218,9 +218,22 @@ static QEMUMachine pc_q35_machine = {
DEFAULT_MACHINE_OPTIONS,
};
+static QEMUMachine pc_q35_machine_v1_4 = {
+ .name = "pc-q35-1.4",
+ .desc = "Standard PC (Q35 + ICH9, 2009)",
+ .init = pc_q35_init,
+ .max_cpus = 255,
+ .compat_props = (GlobalProperty[]) {
+ PC_COMPAT_1_4,
+ { /* end of list */ }
+ },
+ DEFAULT_MACHINE_OPTIONS,
+};
+
static void pc_q35_machine_init(void)
{
- qemu_register_machine(&pc_q35_machine);
+ qemu_register_machine(&pc_q35_machine_v1_5);
+ qemu_register_machine(&pc_q35_machine_v1_4);
}
machine_init(pc_q35_machine_init);
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 28e75bbf5b..d41158693e 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -41,9 +41,11 @@ do { printf("scsi-disk: " fmt , ## __VA_ARGS__); } while (0)
#include <scsi/sg.h>
#endif
-#define SCSI_DMA_BUF_SIZE 131072
-#define SCSI_MAX_INQUIRY_LEN 256
-#define SCSI_MAX_MODE_LEN 256
+#define SCSI_DMA_BUF_SIZE 131072
+#define SCSI_MAX_INQUIRY_LEN 256
+#define SCSI_MAX_MODE_LEN 256
+
+#define DEFAULT_DISCARD_GRANULARITY 4096
typedef struct SCSIDiskState SCSIDiskState;
@@ -2059,6 +2061,11 @@ static int scsi_initfn(SCSIDevice *dev)
return -1;
}
+ if (s->qdev.conf.discard_granularity == -1) {
+ s->qdev.conf.discard_granularity =
+ MAX(s->qdev.conf.logical_block_size, DEFAULT_DISCARD_GRANULARITY);
+ }
+
if (!s->version) {
s->version = g_strdup(qemu_get_version());
}