From patchwork Wed Dec 26 13:45:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 208170 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 285782C00BD for ; Thu, 27 Dec 2012 00:46:21 +1100 (EST) Received: from localhost ([::1]:39411 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnrJL-0002GH-9c for incoming@patchwork.ozlabs.org; Wed, 26 Dec 2012 08:46:19 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52761) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnrJ9-0002Cg-6t for qemu-devel@nongnu.org; Wed, 26 Dec 2012 08:46:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TnrJ8-0003DR-2y for qemu-devel@nongnu.org; Wed, 26 Dec 2012 08:46:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:63292) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnrJ7-0003DB-Rp for qemu-devel@nongnu.org; Wed, 26 Dec 2012 08:46:06 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qBQDk4wu005826 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 26 Dec 2012 08:46:04 -0500 Received: from dhcp-1-237.tlv.redhat.com (dhcp-4-26.tlv.redhat.com [10.35.4.26]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qBQDk4se021050; Wed, 26 Dec 2012 08:46:04 -0500 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id CD1F818D418; Wed, 26 Dec 2012 15:46:03 +0200 (IST) From: Gleb Natapov To: Anthony Liguori Date: Wed, 26 Dec 2012 15:45:50 +0200 Message-Id: <0a2a59d35cbabf63c91340a1c62038e3e60538c1.1356529549.git.gleb@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org, 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 From: Xudong Hao Enable 64 bits bar emulation. Test pass with the current seabios which already support 64bit pci bars. Signed-off-by: Xudong Hao Reviewed-by: Alex Williamson Signed-off-by: Gleb Natapov --- hw/kvm/pci-assign.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/hw/kvm/pci-assign.c b/hw/kvm/pci-assign.c index e80dad0..addc205 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, @@ -632,7 +637,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; }