From patchwork Fri Nov 2 05:38:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hao, Xudong" X-Patchwork-Id: 196485 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 9E1DB2C0359 for ; Fri, 2 Nov 2012 16:34:00 +1100 (EST) Received: from localhost ([::1]:37700 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU9tG-0003Ak-P8 for incoming@patchwork.ozlabs.org; Fri, 02 Nov 2012 01:33:58 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40155) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU9t5-0003AW-P6 for qemu-devel@nongnu.org; Fri, 02 Nov 2012 01:33:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TU9t4-0003wC-BQ for qemu-devel@nongnu.org; Fri, 02 Nov 2012 01:33:47 -0400 Received: from mga09.intel.com ([134.134.136.24]:50657) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU9t4-0003ux-57 for qemu-devel@nongnu.org; Fri, 02 Nov 2012 01:33:46 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 01 Nov 2012 22:33:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,696,1344236400"; d="scan'208";a="214290417" Received: from xhao-dev.sh.intel.com (HELO localhost.localdomain) ([10.239.48.48]) by orsmga001.jf.intel.com with ESMTP; 01 Nov 2012 22:33:43 -0700 From: Xudong Hao To: qemu-devel@nongnu.org Date: Fri, 2 Nov 2012 13:38:22 +0800 Message-Id: <1351834702-25937-2-git-send-email-xudong.hao@intel.com> X-Mailer: git-send-email 1.5.5 In-Reply-To: <1351834702-25937-1-git-send-email-xudong.hao@intel.com> References: <1351834702-25937-1-git-send-email-xudong.hao@intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.24 Cc: Xudong Hao , avi@redhat.com, kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH 2/2] qemu-kvm/pci-assign: 64 bits bar emulation 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 Enable 64 bits bar emulation. Signed-off-by: Xudong Hao --- hw/kvm/pci-assign.c | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/hw/kvm/pci-assign.c b/hw/kvm/pci-assign.c index 05b93d9..f1f8d1e 100644 --- a/hw/kvm/pci-assign.c +++ b/hw/kvm/pci-assign.c @@ -46,6 +46,7 @@ #define IORESOURCE_IRQ 0x00000400 #define IORESOURCE_DMA 0x00000800 #define IORESOURCE_PREFETCH 0x00002000 /* No side effects */ +#define IORESOURCE_MEM_64 0x00100000 //#define DEVICE_ASSIGNMENT_DEBUG @@ -442,9 +443,13 @@ static int assigned_dev_register_regions(PCIRegion *io_regions, /* handle memory io regions */ if (cur_region->type & IORESOURCE_MEM) { - int t = cur_region->type & IORESOURCE_PREFETCH - ? PCI_BASE_ADDRESS_MEM_PREFETCH - : PCI_BASE_ADDRESS_SPACE_MEMORY; + int t = PCI_BASE_ADDRESS_SPACE_MEMORY; + if (cur_region->type & IORESOURCE_PREFETCH) { + t |= PCI_BASE_ADDRESS_MEM_PREFETCH; + } + if (cur_region->type & IORESOURCE_MEM_64) { + t |= PCI_BASE_ADDRESS_MEM_TYPE_64; + } /* map physical memory */ pci_dev->v_addrs[i].u.r_virtbase = mmap(NULL, cur_region->size, @@ -468,8 +473,8 @@ static int assigned_dev_register_regions(PCIRegion *io_regions, (cur_region->base_addr & 0xFFF); if (cur_region->size & 0xFFF) { - error_report("PCI region %d at address 0x%" PRIx64 " has " - "size 0x%" PRIx64 ", which is not a multiple of " + error_report("PCI region %d at address 0lx%" PRIx64 " has " + "size 0lx%" PRIx64 ", which is not a multiple of " "4K. You might experience some performance hit " "due to that.", i, cur_region->base_addr, cur_region->size); @@ -638,7 +643,8 @@ again: rp->valid = 0; rp->resource_fd = -1; size = end - start + 1; - flags &= IORESOURCE_IO | IORESOURCE_MEM | IORESOURCE_PREFETCH; + flags &= IORESOURCE_IO | IORESOURCE_MEM | IORESOURCE_PREFETCH + | IORESOURCE_MEM_64; if (size == 0 || (flags & ~IORESOURCE_PREFETCH) == 0) { continue; }