From nobody Sat May 10 07:31:10 2025 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) client-ip=80.81.252.135; envelope-from=seabios-bounces@seabios.org; helo=mail.coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1503013050789220.67732169158376; Thu, 17 Aug 2017 16:37:30 -0700 (PDT) Received: from [127.0.0.1] (helo=ra.coresystems.de) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1diUJ3-0004Ea-Mo; Fri, 18 Aug 2017 01:34:29 +0200 Received: from mail-lf0-f67.google.com ([209.85.215.67]) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.86_2) (envelope-from ) id 1diUIt-0004CC-Br for seabios@seabios.org; Fri, 18 Aug 2017 01:34:28 +0200 Received: by mail-lf0-f67.google.com with SMTP id t128so5267186lff.3 for ; Thu, 17 Aug 2017 16:37:02 -0700 (PDT) Received: from localhost.localdomain ([93.185.28.201]) by smtp.gmail.com with ESMTPSA id y1sm903381lja.86.2017.08.17.16.36.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Aug 2017 16:36:59 -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:in-reply-to:references; bh=h1yPE9eBZSUca05TC9pJ4nos5MzKvesSIR78xQEMu2w=; b=r1rFPNNM9YLbAdw/O/IzIOGR40HVsh2wGwycD+K9P3z2ZUJoFCQQJaUBPQD2kODkDK 9XGhMGyniBy/oAaZHru44Jczy+VcTbCIvRO3L8TFM+ZKWvCicnMjtHj1RvOHBDMPBO2w Nv4i7sIcKMQBLWo92ysPoN2I9Xk25GaO+dtq+SsC8hRAotb93GH5latjJi+HdkpGQ1kN MDfO3eMc6wJMninEutXsXJ0qKixHibozKTdiAkUmhKoRM1X34nlSnHwMuk7PCfmtLRA9 INlRhUPnETb0Y5ZGoARX0rr7uzooU3cv8YSf32UD/LXrtOOBW3EA7Ou6o4wyxncHMDAx bFgw== 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:in-reply-to :references; bh=h1yPE9eBZSUca05TC9pJ4nos5MzKvesSIR78xQEMu2w=; b=bf5Ej47AqtLMqLU+n3b6QMbzRXMTZAqIQqKyfc69xbonzUfyBJu0SFGQaR+GwVjNsP LS6NvXpvyfVKjBAwgJruqTjtOSZsOeKt2m+pjrp7CYlZhJKCudhY+6CqUTNeKVOkGmoq kuo+mZvaqYn1J0ZjTIpMu3cJYtWYwnZCUzMbye05Pd4WuC6CH5GyCCpZPOJ2IROPZdr0 51mlJmmzZ8ftViptIefUUrLLIKILSTkWE/nUoVjGyDB25fr7Dj89CBTYr8Xe0Zc5ayP4 uMWRBpAHqKoijTI6LRuJEPa5bfNWTNJZLZl+yUVl9WCYgOVwj3/9EUsMTMZ1KMTFk2cH 8gQw== X-Gm-Message-State: AHYfb5hkmg1qxsmy/oaiVgEvzhaU+cDvu2REUN6FaFrSaw4XC9t/4DgY nIpA12/+INf/3I+C5hM= X-Received: by 10.46.77.208 with SMTP id c77mr3119166ljd.92.1503013020439; Thu, 17 Aug 2017 16:37:00 -0700 (PDT) From: Aleksandr Bezzubikov To: qemu-devel@nongnu.org Date: Fri, 18 Aug 2017 02:36:50 +0300 Message-Id: <1503013010-11500-5-git-send-email-zuban32s@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503013010-11500-1-git-send-email-zuban32s@gmail.com> References: <1503013010-11500-1-git-send-email-zuban32s@gmail.com> X-Spam-Score: -1.0 (-) Subject: [SeaBIOS] [PATCH v7 4/4] docs: update documentation considering PCIE-PCI bridge X-BeenThere: seabios@seabios.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SeaBIOS mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marcel@redhat.com, seabios@seabios.org, lersek@redhat.com, mst@redhat.com MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: seabios-bounces@seabios.org Sender: "SeaBIOS" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aleksandr Bezzubikov Reviewed-by: Laszlo Ersek Reviewed-by: Marcel Apfelbaum --- docs/pcie.txt | 49 ++++++++++---------- docs/pcie_pci_bridge.txt | 114 +++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 140 insertions(+), 23 deletions(-) create mode 100644 docs/pcie_pci_bridge.txt diff --git a/docs/pcie.txt b/docs/pcie.txt index 5bada24..76b85ec 100644 --- a/docs/pcie.txt +++ b/docs/pcie.txt @@ -46,7 +46,7 @@ Place only the following kinds of devices directly on the= Root Complex: (2) PCI Express Root Ports (ioh3420), for starting exclusively PCI Exp= ress hierarchies. =20 - (3) DMI-PCI Bridges (i82801b11-bridge), for starting legacy PCI + (3) PCI Express to PCI Bridge (pcie-pci-bridge), for starting legacy P= CI hierarchies. =20 (4) Extra Root Complexes (pxb-pcie), if multiple PCI Express Root Buses @@ -55,18 +55,18 @@ Place only the following kinds of devices directly on t= he Root Complex: pcie.0 bus -----------------------------------------------------------------------= ----- | | | | - ----------- ------------------ ------------------ -------------- - | PCI Dev | | PCIe Root Port | | DMI-PCI Bridge | | pxb-pcie | - ----------- ------------------ ------------------ -------------- + ----------- ------------------ ------------------- -------------- + | PCI Dev | | PCIe Root Port | | PCIe-PCI Bridge | | pxb-pcie | + ----------- ------------------ ------------------- -------------- =20 2.1.1 To plug a device into pcie.0 as a Root Complex Integrated Endpoint u= se: -device [,bus=3Dpcie.0] 2.1.2 To expose a new PCI Express Root Bus use: -device pxb-pcie,id=3Dpcie.1,bus_nr=3Dx[,numa_node=3Dy][,addr=3D= z] - Only PCI Express Root Ports and DMI-PCI bridges can be connected - to the pcie.1 bus: + PCI Express Root Ports and PCI Express to PCI bridges can be + connected to the pcie.1 bus: -device ioh3420,id=3Droot_port1[,bus=3Dpcie.1][,chassis=3Dx][,sl= ot=3Dy][,addr=3Dz] \ - -device i82801b11-bridge,id=3Ddmi_pci_bridge1,bus=3Dpcie.1 + -device pcie-pci-bridge,id=3Dpcie_pci_bridge1,bus=3Dpcie.1 =20 =20 2.2 PCI Express only hierarchy @@ -130,24 +130,24 @@ Notes: Legacy PCI devices can be plugged into pcie.0 as Integrated Endpoints, but, as mentioned in section 5, doing so means the legacy PCI device in question will be incapable of hot-unplugging. -Besides that use DMI-PCI Bridges (i82801b11-bridge) in combination -with PCI-PCI Bridges (pci-bridge) to start PCI hierarchies. +Besides that use PCI Express to PCI Bridges (pcie-pci-bridge) in +combination with PCI-PCI Bridges (pci-bridge) to start PCI hierarchies. =20 -Prefer flat hierarchies. For most scenarios a single DMI-PCI Bridge +Prefer flat hierarchies. For most scenarios a single PCI Express to PCI Br= idge (having 32 slots) and several PCI-PCI Bridges attached to it (each supporting also 32 slots) will support hundreds of legacy devices. -The recommendation is to populate one PCI-PCI Bridge under the DMI-PCI Bri= dge -until is full and then plug a new PCI-PCI Bridge... +The recommendation is to populate one PCI-PCI Bridge under the +PCI Express to PCI Bridge until is full and then plug a new PCI-PCI Bridge= ... =20 pcie.0 bus ---------------------------------------------- | | - ----------- ------------------ - | PCI Dev | | DMI-PCI BRIDGE | - ---------- ------------------ + ----------- ------------------- + | PCI Dev | | PCIe-PCI Bridge | + ----------- ------------------- | | ------------------ ------------------ - | PCI-PCI Bridge | | PCI-PCI Bridge | ... + | PCI-PCI Bridge | | PCI-PCI Bridge | ------------------ ------------------ | | ----------- ----------- @@ -157,11 +157,11 @@ until is full and then plug a new PCI-PCI Bridge... 2.3.1 To plug a PCI device into pcie.0 as an Integrated Endpoint use: -device [,bus=3Dpcie.0] 2.3.2 Plugging a PCI device into a PCI-PCI Bridge: - -device i82801b11-bridge,id=3Ddmi_pci_bridge1[,bus=3Dpcie.0] = \ - -device pci-bridge,id=3Dpci_bridge1,bus=3Ddmi_pci_bridge1[,chassis_n= r=3Dx][,addr=3Dy] \ + -device pcie-pci-bridge,id=3Dpcie_pci_bridge1[,bus=3Dpcie.0] \ + -device pci-bridge,id=3Dpci_bridge1,bus=3Dpcie_pci_bridge1[,chassis_= nr=3Dx][,addr=3Dy] \ -device ,bus=3Dpci_bridge1[,addr=3Dx] Note that 'addr' cannot be 0 unless shpc=3Doff parameter is passed to - the PCI Bridge. + the PCI Bridge/PCI Express to PCI Bridge. =20 3. IO space issues =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D @@ -219,14 +219,16 @@ do not support hot-plug, so any devices plugged into = Root Complexes cannot be hot-plugged/hot-unplugged: (1) PCI Express Integrated Endpoints (2) PCI Express Root Ports - (3) DMI-PCI Bridges + (3) PCI Express to PCI Bridges (4) pxb-pcie =20 Be aware that PCI Express Downstream Ports can't be hot-plugged into an existing PCI Express Upstream Port. =20 -PCI devices can be hot-plugged into PCI-PCI Bridges. The PCI hot-plug is A= CPI -based and can work side by side with the PCI Express native hot-plug. +PCI devices can be hot-plugged into PCI Express to PCI and PCI-PCI Bridges. +The PCI hot-plug into PCI-PCI bridge is ACPI based, whereas hot-plug into +PCI Express to PCI bridges is SHPC-based. They both can work side by side = with +the PCI Express native hot-plug. =20 PCI Express devices can be natively hot-plugged/hot-unplugged into/from PCI Express Root Ports (and PCI Express Downstream Ports). @@ -234,10 +236,11 @@ PCI Express Root Ports (and PCI Express Downstream Po= rts). 5.1 Planning for hot-plug: (1) PCI hierarchy Leave enough PCI-PCI Bridge slots empty or add one - or more empty PCI-PCI Bridges to the DMI-PCI Bridge. + or more empty PCI-PCI Bridges to the PCI Express to PCI Bridge. =20 For each such PCI-PCI Bridge the Guest Firmware is expected to res= erve 4K IO space and 2M MMIO range to be used for all devices behind it. + Appropriate PCI capability is designed, see pcie_pci_bridge.txt. =20 Because of the hard IO limit of around 10 PCI Bridges (~ 40K space) per system don't use more than 9 PCI-PCI Bridges, leaving 4K for t= he diff --git a/docs/pcie_pci_bridge.txt b/docs/pcie_pci_bridge.txt new file mode 100644 index 0000000..5a4203f --- /dev/null +++ b/docs/pcie_pci_bridge.txt @@ -0,0 +1,114 @@ +Generic PCI Express to PCI Bridge +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D + +Description +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +PCIE-to-PCI bridge is a new method for legacy PCI +hierarchies creation on Q35 machines. + +Previously Intel DMI-to-PCI bridge was used for this purpose. +But due to its strict limitations - no support of hot-plug, +no cross-platform and cross-architecture support - a new generic +PCIE-to-PCI bridge should now be used for any legacy PCI device usage +with PCI Express machine. + +This generic PCIE-PCI bridge is a cross-platform device, +can be hot-plugged into appropriate root port (requires additional actions, +see 'PCIE-PCI bridge hot-plug' section), +and supports devices hot-plug into the bridge itself +(with some limitations, see below). + +Hot-plug of legacy PCI devices into the bridge +is provided by bridge's built-in Standard hot-plug Controller. +Though it still has some limitations, see below. + +PCIE-PCI bridge hot-plug +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Guest OSes require extra efforts to enable PCIE-PCI bridge hot-plug. +Motivation - now on init any PCI Express root port which doesn't have +any device plugged in, has no free buses reserved to provide any of them +to a hot-plugged devices in future. + +To solve this problem we reserve additional buses on a firmware level. +Currently only SeaBIOS is supported. +The way of bus number to reserve delivery is special +Red Hat vendor-specific PCI capability, added to the root port +that is planned to have PCIE-PCI bridge hot-plugged in. + +Capability layout (defined in include/hw/pci/pci_bridge.h): + + uint8_t id; Standard PCI capability header field + uint8_t next; Standard PCI capability header field + uint8_t len; Standard PCI vendor-specific capability header field + + uint8_t type; Red Hat vendor-specific capability type + List of currently existing types: + RESOURCE_RESERVE =3D 1 + + + uint32_t bus_res; Minimum number of buses to reserve + + uint64_t io; IO space to reserve + uint32_t mem Non-prefetchable memory to reserve + + At most one of the following two fields may be set to a value + different from -1: + uint32_t mem_pref_32; Prefetchable memory to reserve (32-bit MMIO) + uint64_t mem_pref_64; Prefetchable memory to reserve (64-bit MMIO) + +If any reservation field is -1 then this kind of reservation is not +needed and must be ignored by firmware. + +At the moment this capability is used only in QEMU generic PCIe root port +(-device pcie-root-port). Capability construction function takes all reser= vation +fields values from corresponding device properties. By default all of them= are +set to -1 to leave root port's default behavior unchanged. + +Usage +=3D=3D=3D=3D=3D +A detailed command line would be: + +[qemu-bin + storage options] \ +-m 2G \ +-device pcie-root-port,bus=3Dpcie.0,id=3Drp1 \ +-device pcie-root-port,bus=3Dpcie.0,id=3Drp2 \ +-device pcie-root-port,bus=3Dpcie.0,id=3Drp3,bus-reserve=3D1 \ +-device pcie-pci-bridge,id=3Dbr1,bus=3Drp1 \ +-device pcie-pci-bridge,id=3Dbr2,bus=3Drp2 \ +-device e1000,bus=3Dbr1,addr=3D8 + +Then in monitor it's OK to execute next commands: +device_add pcie-pci-bridge,id=3Dbr3,bus=3Drp3 \ +device_add e1000,bus=3Dbr2,addr=3D1 \ +device_add e1000,bus=3Dbr3,addr=3D1 + +Here you have: + (1) Cold-plugged: + - Root ports: 1 QEMU generic root port with the capability mentioned a= bove, + 2 QEMU generic root ports without this capability; + - 2 PCIE-PCI bridges plugged into 2 different root ports; + - e1000 plugged into the first bridge. + (2) Hot-plugged: + - PCIE-PCI bridge, plugged into QEMU generic root port; + - 2 e1000 cards, one plugged into the cold-plugged PCIE-PCI bridge, + another plugged into the hot-plugged bridge. + +Limitations +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +The PCIE-PCI bridge can be hot-plugged only into pcie-root-port that +has proper 'bus-reserve' property value to provide secondary bus for the +hot-plugged bridge. + +Windows 7 and older versions don't support hot-plug devices into the PCIE-= PCI bridge. +To enable device hot-plug into the bridge on Linux there're 3 ways: +1) Build shpchp module with this patch http://www.spinics.net/lists/linux-= pci/msg63052.html +2) Use kernel 4.14+ where the patch mentioned above is already merged. +3) Set 'msi' property to off - this forces the bridge to use legacy INTx, + which allows the bridge to notify the OS about hot-plug event without = having + BUSMASTER set. + +Implementation +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +The PCIE-PCI bridge is based on PCI-PCI bridge, but also accumulates PCI E= xpress +features as a PCI Express device (is_express=3D1). + --=20 2.7.4 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios