From patchwork Thu Mar 8 17:15:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 145595 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A8815B6FA1 for ; Fri, 9 Mar 2012 04:36:13 +1100 (EST) Received: from localhost ([::1]:53987 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5gwt-0005VN-Lk for incoming@patchwork.ozlabs.org; Thu, 08 Mar 2012 12:16:19 -0500 Received: from eggs.gnu.org ([208.118.235.92]:40859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5gwX-0004qS-Lg for qemu-devel@nongnu.org; Thu, 08 Mar 2012 12:16:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S5gwV-0004rY-8M for qemu-devel@nongnu.org; Thu, 08 Mar 2012 12:15:57 -0500 Received: from mail-iy0-f173.google.com ([209.85.210.173]:47906) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5gwV-0004n5-02 for qemu-devel@nongnu.org; Thu, 08 Mar 2012 12:15:55 -0500 Received: by mail-iy0-f173.google.com with SMTP id j26so1015616iaf.4 for ; Thu, 08 Mar 2012 09:15:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references; bh=zAwyYqCznpBe4keDBz8uBHBUa09BX4LIJL+8HZOYlZM=; b=u6luOOEQD3rpyOjEJlFD8Q3ef/t3LmJQSEPowzUiMQHa0J3ABfhQ1l0o9w0b8nCGbY y8Z3NQc5R+/vpToo4HJuOqASS//1lq/l7jF11fvqxWbIjaWGT3+HhCNg+25pZxeTGGmG zCGWgXF7U0k35HsWr8u46XXmg+ARFo6CTD+Y1EhLb10dujP8J/bUV7JSn33KaURPDIqA c5rzhC0edBAqhZFqRD1TYUrxkW9xVc7dgj0r9FRuE1bPtaaY9t1G/XjhZ5JesGdqaHpb mebf/tZ0hx/BxYgRt3XSeUefA3TODX6rVprNRHJm2/pxv9/vMyqu45EvyI5s8EXu22w0 +YFw== Received: by 10.50.217.163 with SMTP id oz3mr18384944igc.6.1331226954202; Thu, 08 Mar 2012 09:15:54 -0800 (PST) Received: from yakj.usersys.redhat.com (93-34-182-16.ip50.fastwebnet.it. [93.34.182.16]) by mx.google.com with ESMTPS id s3sm2123819igw.17.2012.03.08.09.15.52 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 08 Mar 2012 09:15:53 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 8 Mar 2012 18:15:12 +0100 Message-Id: <1331226917-6658-13-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1331226917-6658-1-git-send-email-pbonzini@redhat.com> References: <1331226917-6658-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.210.173 Subject: [Qemu-devel] [RFC PATCH 12/17] ide/scsi: turn on discard X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Turn on discard support in the device models by default, with compatibility properties for older machine types. Signed-off-by: Paolo Bonzini --- block.h | 4 +- hw/pc_piix.c | 224 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 226 insertions(+), 2 deletions(-) diff --git a/block.h b/block.h index aa224d3..1a8fd2d 100644 --- a/block.h +++ b/block.h @@ -449,9 +449,9 @@ 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_BIT("discard_zeroes_data", _state, \ - _conf.discard_zeroes_data, 0, false), \ + _conf.discard_zeroes_data, 0, true), \ DEFINE_PROP_INT32("discard_granularity", _state, \ - _conf.discard_granularity, 0) + _conf.discard_granularity, -1) #endif diff --git a/hw/pc_piix.c b/hw/pc_piix.c index 6c5c40f..0356424 100644 --- a/hw/pc_piix.c +++ b/hw/pc_piix.c @@ -381,6 +381,38 @@ static QEMUMachine pc_machine_v1_0 = { .max_cpus = 255, .compat_props = (GlobalProperty[]) { { + .driver = "ide-drive", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "ide-drive", + .property = "discard_zeroes_data", + .value = "off", + }, { + .driver = "ide-hd", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "ide-hd", + .property = "discard_zeroes_data", + .value = "off", + }, { + .driver = "scsi-disk", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "scsi-disk", + .property = "discard_zeroes_data", + .value = "off", + }, { + .driver = "scsi-hd", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "scsi-hd", + .property = "discard_zeroes_data", + .value = "off", + }, { .driver = "pc-sysfw", .property = "rom_only", .value = stringify(1), @@ -400,6 +432,38 @@ static QEMUMachine pc_machine_v0_15 = { .max_cpus = 255, .compat_props = (GlobalProperty[]) { { + .driver = "ide-drive", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "ide-drive", + .property = "discard_zeroes_data", + .value = "off", + }, { + .driver = "ide-hd", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "ide-hd", + .property = "discard_zeroes_data", + .value = "off", + }, { + .driver = "scsi-disk", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "scsi-disk", + .property = "discard_zeroes_data", + .value = "off", + }, { + .driver = "scsi-hd", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "scsi-hd", + .property = "discard_zeroes_data", + .value = "off", + }, { .driver = "pc-sysfw", .property = "rom_only", .value = stringify(1), @@ -419,6 +483,38 @@ static QEMUMachine pc_machine_v0_14 = { .max_cpus = 255, .compat_props = (GlobalProperty[]) { { + .driver = "ide-drive", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "ide-drive", + .property = "discard_zeroes_data", + .value = "off", + }, { + .driver = "ide-hd", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "ide-hd", + .property = "discard_zeroes_data", + .value = "off", + }, { + .driver = "scsi-disk", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "scsi-disk", + .property = "discard_zeroes_data", + .value = "off", + }, { + .driver = "scsi-hd", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "scsi-hd", + .property = "discard_zeroes_data", + .value = "off", + }, { .driver = "qxl", .property = "revision", .value = stringify(2), @@ -463,6 +559,38 @@ static QEMUMachine pc_machine_v0_13 = { .max_cpus = 255, .compat_props = (GlobalProperty[]) { { + .driver = "ide-drive", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "ide-drive", + .property = "discard_zeroes_data", + .value = "off", + }, { + .driver = "ide-hd", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "ide-hd", + .property = "discard_zeroes_data", + .value = "off", + }, { + .driver = "scsi-disk", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "scsi-disk", + .property = "discard_zeroes_data", + .value = "off", + }, { + .driver = "scsi-hd", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "scsi-hd", + .property = "discard_zeroes_data", + .value = "off", + }, { .driver = "virtio-9p-pci", .property = "vectors", .value = stringify(0), @@ -519,6 +647,38 @@ static QEMUMachine pc_machine_v0_12 = { .max_cpus = 255, .compat_props = (GlobalProperty[]) { { + .driver = "ide-drive", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "ide-drive", + .property = "discard_zeroes_data", + .value = "off", + }, { + .driver = "ide-hd", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "ide-hd", + .property = "discard_zeroes_data", + .value = "off", + }, { + .driver = "scsi-disk", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "scsi-disk", + .property = "discard_zeroes_data", + .value = "off", + }, { + .driver = "scsi-hd", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "scsi-hd", + .property = "discard_zeroes_data", + .value = "off", + }, { .driver = "virtio-serial-pci", .property = "max_ports", .value = stringify(1), @@ -579,6 +739,38 @@ static QEMUMachine pc_machine_v0_11 = { .max_cpus = 255, .compat_props = (GlobalProperty[]) { { + .driver = "ide-drive", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "ide-drive", + .property = "discard_zeroes_data", + .value = "off", + }, { + .driver = "ide-hd", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "ide-hd", + .property = "discard_zeroes_data", + .value = "off", + }, { + .driver = "scsi-disk", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "scsi-disk", + .property = "discard_zeroes_data", + .value = "off", + }, { + .driver = "scsi-hd", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "scsi-hd", + .property = "discard_zeroes_data", + .value = "off", + }, { .driver = "virtio-blk-pci", .property = "vectors", .value = stringify(0), @@ -647,6 +839,38 @@ static QEMUMachine pc_machine_v0_10 = { .max_cpus = 255, .compat_props = (GlobalProperty[]) { { + .driver = "ide-drive", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "ide-drive", + .property = "discard_zeroes_data", + .value = "off", + }, { + .driver = "ide-hd", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "ide-hd", + .property = "discard_zeroes_data", + .value = "off", + }, { + .driver = "scsi-disk", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "scsi-disk", + .property = "discard_zeroes_data", + .value = "off", + }, { + .driver = "scsi-hd", + .property = "discard_granularity", + .value = stringify(0), + }, { + .driver = "scsi-hd", + .property = "discard_zeroes_data", + .value = "off", + }, { .driver = "virtio-blk-pci", .property = "class", .value = stringify(PCI_CLASS_STORAGE_OTHER),