From patchwork Mon Aug 1 06:51:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 107681 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4C3CCB70B2 for ; Mon, 1 Aug 2011 16:51:24 +1000 (EST) Received: from localhost ([::1]:57290 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QnmLR-0000dv-5K for incoming@patchwork.ozlabs.org; Mon, 01 Aug 2011 02:51:21 -0400 Received: from eggs.gnu.org ([140.186.70.92]:49946) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QnmLK-0000di-WC for qemu-devel@nongnu.org; Mon, 01 Aug 2011 02:51:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QnmLI-0000kS-3k for qemu-devel@nongnu.org; Mon, 01 Aug 2011 02:51:14 -0400 Received: from ozlabs.org ([203.10.76.45]:56618) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QnmLH-0000kA-PA; Mon, 01 Aug 2011 02:51:12 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 93B3DB70BC; Mon, 1 Aug 2011 16:51:07 +1000 (EST) From: David Gibson To: qemu-devel@nongnu.org Date: Mon, 1 Aug 2011 16:51:02 +1000 Message-Id: <1312181462-29889-1-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 1.7.5.4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 203.10.76.45 Cc: qemu-trivial@nongnu.org Subject: [Qemu-devel] [PATCH] Correctly assign PCI domain numbers 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 qemu already almost supports PCI domains; that is, several entirely independent PCI host bridges on the same machine. However, a bug in pci_bus_new_inplace() means that every host bridge gets assigned domain number zero and so can't be properly distinguished. This patch fixes the bug, giving each new host bridge a new domain number. Signed-off-by: David Gibson --- hw/pci.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 36db58b..2b4aecb 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -262,6 +262,8 @@ int pci_find_domain(const PCIBus *bus) return -1; } +static int pci_next_domain; /* = 0 */ + void pci_bus_new_inplace(PCIBus *bus, DeviceState *parent, const char *name, MemoryRegion *address_space, @@ -274,7 +276,8 @@ void pci_bus_new_inplace(PCIBus *bus, DeviceState *parent, /* host bridge */ QLIST_INIT(&bus->child); - pci_host_bus_register(0, bus); /* for now only pci domain 0 is supported */ + + pci_host_bus_register(pci_next_domain++, bus); vmstate_register(NULL, -1, &vmstate_pcibus, bus); }