From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47277) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNfTW-0008UI-K6 for qemu-devel@nongnu.org; Sat, 30 Aug 2014 06:01:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XNfTQ-0002vg-88 for qemu-devel@nongnu.org; Sat, 30 Aug 2014 06:01:38 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:28668) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNfTP-0002uL-Ep for qemu-devel@nongnu.org; Sat, 30 Aug 2014 06:01:32 -0400 From: Date: Sat, 30 Aug 2014 18:00:19 +0800 Message-ID: <1409392827-9372-20-git-send-email-arei.gonglei@huawei.com> In-Reply-To: <1409392827-9372-1-git-send-email-arei.gonglei@huawei.com> References: <1409392827-9372-1-git-send-email-arei.gonglei@huawei.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH v6 19/27] pci-assign: remove bootindex property from qdev to qom List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: chenliang88@huawei.com, weidong.huang@huawei.com, mst@redhat.com, aik@ozlabs.ru, hutao@cn.fujitsu.com, armbru@redhat.com, kraxel@redhat.com, akong@redhat.com, agraf@suse.de, Gonglei , aliguori@amazon.com, ehabkost@redhat.com, luonengjun@huawei.com, peter.huangpeng@huawei.com, hani@linux.com, stefanha@redhat.com, pbonzini@redhat.com, lcapitulino@redhat.com, kwolf@redhat.com, peter.crosthwaite@xilinx.com, imammedo@redhat.com, afaerber@suse.de From: Gonglei Remove bootindex form qdev property to qom, things will continue to work just fine, and we can use qom features which are not supported by qdev property. Signed-off-by: Gonglei --- hw/i386/kvm/pci-assign.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c index 0e6aa8a..a91c23d 100644 --- a/hw/i386/kvm/pci-assign.c +++ b/hw/i386/kvm/pci-assign.c @@ -1850,13 +1850,35 @@ static void assigned_exitfn(struct PCIDevice *pci_dev) free_assigned_device(dev); } +static void assigned_dev_get_bootindex(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ + AssignedDevice *d = DO_UPCAST(AssignedDevice, dev, PCI_DEVICE(obj)); + + get_bootindex(&d->bootindex, v, name, errp); +} + +static void assigned_dev_set_bootindex(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ + AssignedDevice *d = DO_UPCAST(AssignedDevice, dev, PCI_DEVICE(obj)); + set_bootindex(&d->bootindex, v, name, errp); +} + +static void assigned_dev_instance_init(Object *obj) +{ + object_property_add(obj, "bootindex", "int", + assigned_dev_get_bootindex, + assigned_dev_set_bootindex, NULL, NULL, NULL); + object_property_set_int(obj, -1, "bootindex", NULL); +} + static Property assigned_dev_properties[] = { DEFINE_PROP_PCI_HOST_DEVADDR("host", AssignedDevice, host), DEFINE_PROP_BIT("prefer_msi", AssignedDevice, features, ASSIGNED_DEVICE_PREFER_MSI_BIT, false), DEFINE_PROP_BIT("share_intx", AssignedDevice, features, ASSIGNED_DEVICE_SHARE_INTX_BIT, true), - DEFINE_PROP_INT32("bootindex", AssignedDevice, bootindex, -1), DEFINE_PROP_STRING("configfd", AssignedDevice, configfd_name), DEFINE_PROP_END_OF_LIST(), }; @@ -1882,6 +1904,7 @@ static const TypeInfo assign_info = { .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(AssignedDevice), .class_init = assign_class_init, + .instance_init = assigned_dev_instance_init, }; static void assign_register_types(void) -- 1.7.12.4