From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gerd Hoffmann Subject: Re: [PATCH RFC] qemu: fix hot remove assigned device Date: Wed, 10 Jun 2009 10:49:27 +0200 Message-ID: <4A2F7397.1010909@redhat.com> References: <1244481435-17224-1-git-send-email-weidong.han@intel.com> <200906081538.22186.paul@codesourcery.com> <715D42877B251141A38726ABF5CABF2C054590C496@pdsmsx503.ccr.corp.intel.com> <200906091551.41674.paul@codesourcery.com> <4A2E81A9.4060501@redhat.com> <715D42877B251141A38726ABF5CABF2C054596A9FF@pdsmsx503.ccr.corp.intel.com> <4A2F697D.8070405@redhat.com> <715D42877B251141A38726ABF5CABF2C054596AA31@pdsmsx503.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: "'Avi Kivity'" , "'Paul Brook'" , "'kvm@vger.kernel.org'" To: "Han, Weidong" Return-path: Received: from mx2.redhat.com ([66.187.237.31]:55286 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753260AbZFJIvb (ORCPT ); Wed, 10 Jun 2009 04:51:31 -0400 In-Reply-To: <715D42877B251141A38726ABF5CABF2C054596AA31@pdsmsx503.ccr.corp.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: On 06/10/09 10:31, Han, Weidong wrote: > Avi Kivity wrote: >> Can you check pci_dev->qdev instead of assigned? A little less >> ugly. > > I tried to find an easy and clean way to check it, but I found the > members of struct PCIDevice and DeviceState were not suitable for > this checking, and qdev is not pointer in struct PCIDevice. Well, certain DeviceState pointers (type for example) are set only in case the device was created using the qdev api. I think you certainly should get away without adding a new parameter to pci_unregister_device. Also I've just sent a patch to the qemu-devel fixing the qdev register API for pci devices, allowing to register config space callbacks. Once this is merged you can switch pci passthrough to the new qdev API. cheers, Gerd