diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6bcf2fdadd..b228820b5f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1760,6 +1760,7 @@ qemuBuildDiskDeviceProps(const virDomainDef *def,
unsigned int bootindex = 0;
unsigned int logical_block_size = disk->blockio.logical_block_size;
unsigned int physical_block_size = disk->blockio.physical_block_size;
+ unsigned int discard_granularity = disk->blockio.discard_granularity;
g_autoptr(virJSONValue) wwn = NULL;
g_autofree char *serial = NULL;
virTristateSwitch removable = VIR_TRISTATE_SWITCH_ABSENT;
@@ -1939,6 +1940,7 @@ qemuBuildDiskDeviceProps(const virDomainDef *def,
"p:bootindex", bootindex,
"p:logical_block_size", logical_block_size,
"p:physical_block_size", physical_block_size,
+ "p:discard_granularity", discard_granularity,
"A:wwn", &wwn,
"p:rotation_rate", disk->rotation_rate,
"S:vendor", disk->vendor,
diff --git a/tests/qemuxml2argvdata/disk-blockio.x86_64-latest.args b/tests/qemuxml2argvdata/disk-blockio.x86_64-latest.args
index 7270613573..15f31ae60d 100644
--- a/tests/qemuxml2argvdata/disk-blockio.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/disk-blockio.x86_64-latest.args
@@ -32,7 +32,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-device '{"driver":"ide-cd","bus":"ide.0","unit":1,"drive":"libvirt-2-format","id":"ide0-0-1"}' \
-blockdev '{"driver":"file","filename":"/tmp/idedisk.img","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
--device '{"driver":"ide-hd","bus":"ide.0","unit":2,"drive":"libvirt-1-format","id":"ide0-0-2","bootindex":1,"logical_block_size":512,"physical_block_size":512}' \
+-device '{"driver":"ide-hd","bus":"ide.0","unit":2,"drive":"libvirt-1-format","id":"ide0-0-2","bootindex":1,"logical_block_size":512,"physical_block_size":512,"discard_granularity":4096}' \
-audiodev '{"id":"audio1","driver":"none"}' \
-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x2"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
diff --git a/tests/qemuxml2argvdata/disk-blockio.xml b/tests/qemuxml2argvdata/disk-blockio.xml
index 170728371f..84943719d4 100644
--- a/tests/qemuxml2argvdata/disk-blockio.xml
+++ b/tests/qemuxml2argvdata/disk-blockio.xml
@@ -23,7 +23,7 @@