From patchwork Wed Aug 22 12:32:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 179396 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 716AB2C00A6 for ; Thu, 23 Aug 2012 05:51:31 +1000 (EST) Received: from localhost ([::1]:54091 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4Gxd-0001Z6-Jm for incoming@patchwork.ozlabs.org; Wed, 22 Aug 2012 15:51:29 -0400 Received: from eggs.gnu.org ([208.118.235.92]:55276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4G5V-0003H3-9E for qemu-devel@nongnu.org; Wed, 22 Aug 2012 14:55:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T4G5O-0007lI-FO for qemu-devel@nongnu.org; Wed, 22 Aug 2012 14:55:32 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:24714) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4G5O-0007IO-BA for qemu-devel@nongnu.org; Wed, 22 Aug 2012 14:55:26 -0400 X-IronPort-AV: E=Sophos;i="4.80,809,1344225600"; d="scan'208";a="205943141" Received: from ftlpmailmx01.citrite.net ([10.13.107.65]) by FTLPIPO02.CITRIX.COM with ESMTP/TLS/RC4-MD5; 22 Aug 2012 14:55:25 -0400 Received: from meteora.cam.xci-test.com (10.80.248.22) by smtprelay.citrix.com (10.13.107.65) with Microsoft SMTP Server id 8.3.213.0; Wed, 22 Aug 2012 14:55:25 -0400 From: Julien Grall To: qemu-devel@nongnu.org Date: Wed, 22 Aug 2012 13:32:02 +0100 Message-ID: <0c0e65af87b2e86b62d82565c2e363ddfb8acfc6.1345552068.git.julien.grall@citrix.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.63 Cc: Julien Grall , christian.limpach@gmail.com, Stefano.Stabellini@eu.citrix.com, xen-devel@lists.xen.org Subject: [Qemu-devel] [XEN][RFC PATCH V2 16/17] xl: Fix PCI library 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 Quickly fix for PCI library. For the moment each hotplug PCI are add to QEMU 0. We need to find a best way to specify which qemu handle the PCI. Signed-off-by: Julien Grall --- tools/libxl/libxl_pci.c | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-) diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c index 48986f3..fe02ccd 100644 --- a/tools/libxl/libxl_pci.c +++ b/tools/libxl/libxl_pci.c @@ -834,13 +834,12 @@ static int qemu_pci_add_xenstore(libxl__gc *gc, uint32_t domid, } libxl__qemu_traditional_cmd(gc, domid, "pci-ins"); - rc = libxl__wait_for_device_model(gc, domid, NULL, NULL, + rc = libxl__wait_for_device_model(gc, domid, 0, NULL, NULL, pci_ins_check, state); path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/parameter", domid); vdevfn = libxl__xs_read(gc, XBT_NULL, path); - path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", - domid); + path = libxl__sprintf(gc, "/local/domain/0/dms/%d/state", domid); if ( rc < 0 ) LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "qemu refused to add device: %s", vdevfn); @@ -858,11 +857,13 @@ static int do_pci_add(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, i { libxl_ctx *ctx = libxl__gc_owner(gc); int rc, hvm = 0; + /* FIXME: handle multiple device model */ + libxl_dmid dmid = 0; switch (libxl__domain_type(gc, domid)) { case LIBXL_DOMAIN_TYPE_HVM: hvm = 1; - if (libxl__wait_for_device_model(gc, domid, "running", + if (libxl__wait_for_device_model(gc, domid, dmid, "running", NULL, NULL, NULL) < 0) { return ERROR_FAIL; } @@ -871,7 +872,7 @@ static int do_pci_add(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, i rc = qemu_pci_add_xenstore(gc, domid, pcidev); break; case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN: - rc = libxl__qmp_pci_add(gc, domid, pcidev); + rc = libxl__qmp_pci_add(gc, domid, dmid, pcidev); break; default: return ERROR_INVAL; @@ -1136,7 +1137,7 @@ static int qemu_pci_remove_xenstore(libxl__gc *gc, uint32_t domid, * device-model for function 0 */ if ( !force && (pcidev->vdevfn & 0x7) == 0 ) { libxl__qemu_traditional_cmd(gc, domid, "pci-rem"); - if (libxl__wait_for_device_model(gc, domid, "pci-removed", + if (libxl__wait_for_device_model(gc, domid, 0, "pci-removed", NULL, NULL, NULL) < 0) { LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Device Model didn't respond in time"); /* This depends on guest operating system acknowledging the @@ -1162,6 +1163,8 @@ static int do_pci_remove(libxl__gc *gc, uint32_t domid, libxl_device_pci *assigned; int hvm = 0, rc, num; int stubdomid = 0; + /* FIXME: Handle multiple device model */ + libxl_dmid dmid = 0; assigned = libxl_device_pci_list(ctx, domid, &num); if ( assigned == NULL ) @@ -1178,7 +1181,7 @@ static int do_pci_remove(libxl__gc *gc, uint32_t domid, switch (libxl__domain_type(gc, domid)) { case LIBXL_DOMAIN_TYPE_HVM: hvm = 1; - if (libxl__wait_for_device_model(gc, domid, "running", + if (libxl__wait_for_device_model(gc, domid, dmid, "running", NULL, NULL, NULL) < 0) goto out_fail; @@ -1187,7 +1190,7 @@ static int do_pci_remove(libxl__gc *gc, uint32_t domid, rc = qemu_pci_remove_xenstore(gc, domid, pcidev, force); break; case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN: - rc = libxl__qmp_pci_del(gc, domid, pcidev); + rc = libxl__qmp_pci_del(gc, domid, dmid, pcidev); break; default: rc = ERROR_INVAL;