From patchwork Tue Jun 12 09:12:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zihan Yang X-Patchwork-Id: 928195 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lyoYr0RB"; dkim-atps=neutral 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 414khP6NBrz9s1B for ; Tue, 12 Jun 2018 19:13:39 +1000 (AEST) Received: from localhost ([::1]:53987 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSfMr-0004Jb-2W for incoming@patchwork.ozlabs.org; Tue, 12 Jun 2018 05:13:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSfMU-0004JG-Hn for qemu-devel@nongnu.org; Tue, 12 Jun 2018 05:13:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSfMQ-0006Ks-Gx for qemu-devel@nongnu.org; Tue, 12 Jun 2018 05:13:10 -0400 Received: from mail-pf0-x229.google.com ([2607:f8b0:400e:c00::229]:37512) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fSfMQ-0006KI-9r for qemu-devel@nongnu.org; Tue, 12 Jun 2018 05:13:06 -0400 Received: by mail-pf0-x229.google.com with SMTP id y5-v6so10861739pfn.4 for ; Tue, 12 Jun 2018 02:13:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=FgatFMueILTFtBlHxBKaTiYYPcMPgCdLwgCX6t+Tks8=; b=lyoYr0RBI0C8TmBEXdmIIswjKY96mOQFPRgjsNcIhxti0AF27m+B9EBpLH+RC52Z4v WBJlQRqrRMSQZb0gv/+/BulVJRZxIBI3iOHZqYzuN9Zh5vrrzEItYcERKkxJdaXEWKU9 m5kDJXNa5IXWxIGkEnFVwAV15KuJ+bacY6N4+exC2A6kO/7tKjZ3O/cAUZ6cfi18ibaS /lwq2FnMasGm5UQP/PTmHT/mZLmwJpO8rfNXLQPMUJ5IPKl6Ae7i+IREakoHJbFNszba dcgQW1ib7OhkwZFSSDwxgT3q3LR4Z/jivMsw66QG4cc0piku6NbunO4v/HEtI1LKQ02p EDRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=FgatFMueILTFtBlHxBKaTiYYPcMPgCdLwgCX6t+Tks8=; b=Jfj3/j94/owWA2THhyEOeCRvniAWchbT/P3WSOAZ/KVXXe63mdZheBSmivpUD8cEka fMvA+1mkhpKciYC1w98nzGtpUTF0vgKp1cy00bna9I2wDOTD7ddROHttgRh90XBPKml9 UFw3YtW5KQhgCmBYiYk4b0hGtih3tVctlirgzdBVHeBLKuQasCQPw9p7wFavlT5To+KT mHkwFQZHxf6FS+jQiLvwzv1sQ24Dni39ui1c5kqfZKWRGT9uqtJGjNSeZajoQv0jqmI3 XhCImQpgR+iLHEUHqP60ey7zVcDoqXXKC8tczOv4hQkrPHfygfNxb0MxHs01p6KCYfp3 oYOQ== X-Gm-Message-State: APt69E3CXAX2ZnbetRr0A/5jG7vPXyXZc/2sLVyIv16z8Pa2RyH5viUW fiRILnpeu5RCYzIH9tUuZW4TuA== X-Google-Smtp-Source: ADUXVKI3jrCQ/b+/LTO+IkBrWrDNKpiBwX8UkvEzsru8K/k3FhmyjKmuUBBfsCghhmmGjePCFJN0hw== X-Received: by 2002:a63:b305:: with SMTP id i5-v6mr2503503pgf.370.1528794784798; Tue, 12 Jun 2018 02:13:04 -0700 (PDT) Received: from localhost.localdomain ([141.101.152.11]) by smtp.gmail.com with ESMTPSA id c19-v6sm975989pfn.182.2018.06.12.02.13.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Jun 2018 02:13:03 -0700 (PDT) From: Zihan Yang To: qemu-devel@nongnu.org Date: Tue, 12 Jun 2018 17:12:35 +0800 Message-Id: <1528794755-6229-1-git-send-email-whois.zihan.yang@gmail.com> X-Mailer: git-send-email 2.7.4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::229 Subject: [Qemu-devel] [RFC v2 0/3] pci_expander_brdige: Put pxb-pcie host bridge into separate pci domain X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zihan Yang Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Hi all, after some delay, here is the v2 version of putting pxb host bridge into separate pci domain. Currently only q35 host bridge is allocated an item in MCFG table, all pxb host bridges stay within pci domain 0. This series of patches put each pxb host bridge in separate pci domain, allocating a new MCFG table item for it. Users can configure whether to put pxb host bridge into separate domain or just leave it in pci domain 0 by passing parameter sep_domain(bool) and domain_nr(uint32_t), they can also specify the maximum desired bus numbers to reduce MCFG space cost, for example, -device pxb-pcie,id=bridge3,bus="pcie.0",sep_domain=on,domain_nr=1,max_bus=130 Then this pxb-pcie host bridge is placed at pci domain 1, and only reserve (130+1)=131 buses, which is much smaller than the default 256 buses. The pxb host does not have an mch in it, as q35 host already has one. All pxb host bridges just serve as expander bridges in QEMU, which makes them a little simpler than q35 host bridge. There are some things remaining TODO. For example, deal with the pci data write to pxb host bridges, but that will need some work in SeaBIOS, which I am starting soon. Also, we might need to limit the number of pci domains in case it exceeds the bit limit of physical address when EPT is enabled. v2 <- v1: - Allow user to configure whether to put pxb-pcie into seperate domain - Add AML description part of each host bridge - Modify the location of MCFG space to between RAM hotplug and pci hole64 Zihan Yang (3): pci_expander_bridge: add type TYPE_PXB_PCIE_HOST acpi-build: allocate mcfg for pxb-pcie host bridges acpi-build: describe new pci domain in AML hw/i386/acpi-build.c | 162 ++++++++++++++++++++-------- hw/i386/pc.c | 14 ++- hw/pci-bridge/pci_expander_bridge.c | 142 +++++++++++++++++++++++- hw/pci-host/q35.c | 2 + hw/pci/pci.c | 9 +- include/hw/i386/pc.h | 1 + include/hw/pci-bridge/pci_expander_bridge.h | 6 ++ include/hw/pci-host/q35.h | 1 + include/hw/pci/pci_host.h | 2 +- 9 files changed, 285 insertions(+), 54 deletions(-) create mode 100644 include/hw/pci-bridge/pci_expander_bridge.h