summary refs log tree commit diff stats
path: root/hw/ide/qdev.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2011-05-19 10:58:19 +0200
committerKevin Wolf <kwolf@redhat.com>2011-06-15 14:36:16 +0200
commitd353fb72f59cd0e1f67baf773e74719cda761a89 (patch)
tree994311cabf1fd896af097c7165fa4176b991c09c /hw/ide/qdev.c
parent4e1e00515e2522bbae98a0653ea2692ec20851ac (diff)
downloadfocaccia-qemu-d353fb72f59cd0e1f67baf773e74719cda761a89.tar.gz
focaccia-qemu-d353fb72f59cd0e1f67baf773e74719cda761a89.zip
ide: add TRIM support
Add support for TRIM sub function of the data set management command,
and wire it up to the qemu discard infrastructure.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/ide/qdev.c')
-rw-r--r--hw/ide/qdev.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index 3f9dc89c6d..d9b8f24bb5 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -125,6 +125,11 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind)
     const char *serial;
     DriveInfo *dinfo;
 
+    if (dev->conf.discard_granularity && dev->conf.discard_granularity != 512) {
+        error_report("discard_granularity must be 512 for ide");
+        return -1;
+    }
+
     serial = dev->serial;
     if (!serial) {
         /* try to fall back to value set with legacy -drive serial=... */