From patchwork Tue Nov 13 02:47:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 198532 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 ADE7D2C00B1 for ; Tue, 13 Nov 2012 14:16:59 +1100 (EST) Received: from localhost ([::1]:37442 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TY6Wp-0003F0-4r for incoming@patchwork.ozlabs.org; Mon, 12 Nov 2012 21:47:07 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58680) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TY6VR-0000Lr-EM for qemu-devel@nongnu.org; Mon, 12 Nov 2012 21:45:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TY6VO-0003ul-CT for qemu-devel@nongnu.org; Mon, 12 Nov 2012 21:45:41 -0500 Received: from ozlabs.org ([2402:b800:7003:1:1::1]:49514) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TY6VN-0003tu-TX for qemu-devel@nongnu.org; Mon, 12 Nov 2012 21:45:38 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 040F62C00C4; Tue, 13 Nov 2012 13:45:28 +1100 (EST) From: David Gibson To: agraf@suse.de Date: Tue, 13 Nov 2012 13:47:00 +1100 Message-Id: <1352774820-22804-13-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1352774820-22804-1-git-send-email-david@gibson.dropbear.id.au> References: <1352774820-22804-1-git-send-email-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2402:b800:7003:1:1::1 Cc: Alexey Kardashevskiy , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, David Gibson Subject: [Qemu-devel] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges 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: Alexey Kardashevskiy In future (with VFIO) we will have multiple PCI host bridges on pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we derive these from the pci domain number, but the whole notion of domain numbers on the qemu side is bogus and in any case they're not actually uniquely allocated at this point. This patch, therefore uses a simple sequence counter to generate unique LIOBNs for PCI host bridges. Signed-off-by: Alexey Kardashevskiy Signed-off-by: David Gibson --- hw/spapr_pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/spapr_pci.c b/hw/spapr_pci.c index 3c5b855..f6544d7 100644 --- a/hw/spapr_pci.c +++ b/hw/spapr_pci.c @@ -521,6 +521,7 @@ static int spapr_phb_init(SysBusDevice *s) char *namebuf; int i; PCIBus *bus; + static int phbnum; sphb->dtbusname = g_strdup_printf("pci@%" PRIx64, sphb->buid); namebuf = alloca(strlen(sphb->dtbusname) + 32); @@ -572,7 +573,7 @@ static int spapr_phb_init(SysBusDevice *s) PCI_DEVFN(0, 0), PCI_NUM_PINS); phb->bus = bus; - sphb->dma_liobn = SPAPR_PCI_BASE_LIOBN | (pci_find_domain(bus) << 16); + sphb->dma_liobn = SPAPR_PCI_BASE_LIOBN | (++phbnum << 16); sphb->dma_window_start = 0; sphb->dma_window_size = 0x40000000; sphb->dma = spapr_tce_new_dma_context(sphb->dma_liobn, sphb->dma_window_size);