From patchwork Sun Aug 30 09:20:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 512199 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 59F3A14018C for ; Sun, 30 Aug 2015 19:21:52 +1000 (AEST) Received: from localhost ([::1]:57780 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZVyoA-0007WN-I3 for incoming@patchwork.ozlabs.org; Sun, 30 Aug 2015 05:21:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZVymt-0005h5-3t for qemu-devel@nongnu.org; Sun, 30 Aug 2015 05:20:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZVymq-0000q0-18 for qemu-devel@nongnu.org; Sun, 30 Aug 2015 05:20:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42587) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZVymp-0000pw-JR for qemu-devel@nongnu.org; Sun, 30 Aug 2015 05:20:27 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 277B22B51AA; Sun, 30 Aug 2015 09:20:27 +0000 (UTC) Received: from redhat.com (ovpn-116-40.ams2.redhat.com [10.36.116.40]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id t7U9KNeZ025942; Sun, 30 Aug 2015 05:20:24 -0400 Date: Sun, 30 Aug 2015 12:20:17 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1440926395-23540-3-git-send-email-mst@redhat.com> References: <1440926395-23540-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1440926395-23540-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: pbonzini@redhat.com, Gonglei , Markus Armbruster , kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH RFC 2/3] pci-testdev: add subregion 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 Make mmio a subregion of the BAR. This will allow mapping rom within the same BAR down the road. Signed-off-by: Michael S. Tsirkin --- hw/misc/pci-testdev.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/misc/pci-testdev.c b/hw/misc/pci-testdev.c index 6edc1cd..94141a3 100644 --- a/hw/misc/pci-testdev.c +++ b/hw/misc/pci-testdev.c @@ -83,6 +83,7 @@ typedef struct PCITestDevState { /*< public >*/ MemoryRegion mmio; + MemoryRegion mbar; MemoryRegion portio; IOTest *tests; int current; @@ -248,9 +249,13 @@ static void pci_testdev_realize(PCIDevice *pci_dev, Error **errp) memory_region_init_io(&d->mmio, OBJECT(d), &pci_testdev_mmio_ops, d, "pci-testdev-mmio", IOTEST_MEMSIZE * 2); + memory_region_init(&d->mbar, OBJECT(d), + "pci-testdev-mmio", IOTEST_MEMSIZE * 2); memory_region_init_io(&d->portio, OBJECT(d), &pci_testdev_pio_ops, d, "pci-testdev-portio", IOTEST_IOSIZE * 2); - pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &d->mmio); + + memory_region_add_subregion_overlap(&d->mbar, 0, &d->mmio, 1 /* prio */); + pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &d->mbar); pci_register_bar(pci_dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &d->portio); d->current = -1;