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: 7096941 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6A3ED9F32B for ; Sun, 30 Aug 2015 09:20:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A4CF420721 for ; Sun, 30 Aug 2015 09:20:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C51082071E for ; Sun, 30 Aug 2015 09:20:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753249AbbH3JU1 (ORCPT ); Sun, 30 Aug 2015 05:20:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50513 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751714AbbH3JU1 (ORCPT ); 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 Cc: pbonzini@redhat.com, kvm@vger.kernel.org, Gonglei , Markus Armbruster Subject: [PATCH RFC 2/3] pci-testdev: add subregion 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 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;