From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark McLoughlin Subject: Re: [PATCH 5/6] kvm: qemu: deassign device from guest Date: Fri, 13 Feb 2009 08:14:45 +0000 Message-ID: <1234512885.3644.1.camel@blaa> References: <715D42877B251141A38726ABF5CABF2C01959AFDD7@pdsmsx503.ccr.corp.intel.com> Reply-To: Mark McLoughlin Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: "'Avi Kivity'" , "'kvm@vger.kernel.org'" To: "Han, Weidong" Return-path: Received: from mx2.redhat.com ([66.187.237.31]:36030 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750800AbZBMIOt (ORCPT ); Fri, 13 Feb 2009 03:14:49 -0500 In-Reply-To: <715D42877B251141A38726ABF5CABF2C01959AFDD7@pdsmsx503.ccr.corp.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: On Fri, 2009-02-13 at 14:58 +0800, Han, Weidong wrote: > +static void deassign_device(AssignedDevInfo *adev) > +{ > + struct kvm_assigned_pci_dev assigned_dev_data; > + AssignedDevice *dev = adev->assigned_dev; > + int r; > + > + memset(&assigned_dev_data, 0, sizeof(assigned_dev_data)); > + assigned_dev_data.assigned_dev_id = > + calc_assigned_dev_id(dev->h_busnr, dev->h_devfn); >>From here: > + assigned_dev_data.busnr = dev->h_busnr; > + assigned_dev_data.devfn = dev->h_devfn; > + > +#ifdef KVM_CAP_IOMMU > + /* We always enable the IOMMU if present > + * (or when not disabled on the command line) > + */ > + r = kvm_check_extension(kvm_context, KVM_CAP_IOMMU); > + if (r && !adev->disable_iommu) > + assigned_dev_data.flags |= KVM_DEV_ASSIGN_ENABLE_IOMMU; > +#endif to here. As, I said, these lines should not be needed and the ioctl should be fixed like so: - if (assigned_dev->flags & KVM_DEV_ASSIGN_ENABLE_IOMMU) + if (match->flags & KVM_DEV_ASSIGN_ENABLE_IOMMU) kvm_deassign_device(kvm, match); Cheers, Mark.