From patchwork Thu Mar 19 07:02:02 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sheng Yang X-Patchwork-Id: 13018 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n2J72QOd022507 for ; Thu, 19 Mar 2009 07:02:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757094AbZCSHCW (ORCPT ); Thu, 19 Mar 2009 03:02:22 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757142AbZCSHCW (ORCPT ); Thu, 19 Mar 2009 03:02:22 -0400 Received: from mga14.intel.com ([143.182.124.37]:18348 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757094AbZCSHCV (ORCPT ); Thu, 19 Mar 2009 03:02:21 -0400 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga102.ch.intel.com with ESMTP; 19 Mar 2009 00:02:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.38,388,1233561600"; d="scan'208";a="121867812" Received: from syang10-desktop.sh.intel.com (HELO syang10-desktop) ([10.239.13.189]) by azsmga001.ch.intel.com with ESMTP; 19 Mar 2009 00:02:04 -0700 Received: from yasker by syang10-desktop with local (Exim 4.69) (envelope-from ) id 1LkCGQ-0004M3-Js; Thu, 19 Mar 2009 15:02:02 +0800 From: Sheng Yang To: Avi Kivity Cc: kvm@vger.kernel.org, Sheng Yang Subject: [PATCH] kvm: Move device capability init earlier Date: Thu, 19 Mar 2009 15:02:02 +0800 Message-Id: <1237446122-16721-1-git-send-email-sheng@linux.intel.com> X-Mailer: git-send-email 1.5.6.3 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org For if assign_irq() is called before capability init, it don't know device support MSI or not for the first time calling. So it won't enable MSI2INTx... Signed-off-by: Sheng Yang --- qemu/hw/device-assignment.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/qemu/hw/device-assignment.c b/qemu/hw/device-assignment.c index 2ee0e47..b7f9fa6 100644 --- a/qemu/hw/device-assignment.c +++ b/qemu/hw/device-assignment.c @@ -1149,6 +1149,11 @@ struct PCIDevice *init_assigned_device(AssignedDevInfo *adev, PCIBus *bus) pci_init(pacc); dev->pdev = pci_get_dev(pacc, 0, adev->bus, adev->dev, adev->func); + if (pci_enable_capability_support(pci_dev, 0, NULL, + assigned_device_pci_cap_write_config, + assigned_device_pci_cap_init) < 0) + goto assigned_out; + /* assign device to guest */ r = assign_device(adev); if (r < 0) @@ -1159,11 +1164,6 @@ struct PCIDevice *init_assigned_device(AssignedDevInfo *adev, PCIBus *bus) if (r < 0) goto assigned_out; - if (pci_enable_capability_support(pci_dev, 0, NULL, - assigned_device_pci_cap_write_config, - assigned_device_pci_cap_init) < 0) - goto assigned_out; - /* intercept MSI-X entry page in the MMIO */ if (dev->cap.available & ASSIGNED_DEVICE_CAP_MSIX) if (assigned_dev_register_msix_mmio(dev))