From: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Subject: Should pcie-pci-bridge use 32-bit non-prefetchable memory?
Date: Mon, 11 Sep 2023 12:17:13 +0200 [thread overview]
Message-ID: <6a0b9345-a447-4cf9-ba9a-88c420e7ab79@linaro.org> (raw)
I am working on aarch64/sbsa-ref machine so people can have virtual
machine to test their OS against something reminding standards compliant
system.
One of tools I use is BSA ACS (Base System Architecture - Architecture
Compliance Suite) [1] written by Arm. It runs set of tests to check does
system conforms to BSA specification.
1. https://github.com/ARM-software/bsa-acs
To run tests I use my "boot-sbsa-ref.sh" script [2] which allows me to
run exactly same setup each time.
2. https://github.com/hrw/sbsa-ref-status/blob/main/boot-sbsa-ref.sh
Since we have ITS support in whole stack (qemu, tf-a, edk2) I use
overcomplicated PCIe setup:
-device igb
-device pcie-root-port,id=root_port_for_switch1,chassis=0,slot=0
-device x3130-upstream,id=upstream_port1,bus=root_port_for_switch1
-device xio3130-downstream,id=downstream_port1,bus=upstream_port1,chassis=1,slot=0
-device ac97,bus=downstream_port1
-device pcie-root-port,id=root_port_for_nvme1,chassis=2,slot=0
-device nvme,serial=deadbeef,bus=root_port_for_nvme1
-device pcie-root-port,id=root_port_for_igb,chassis=3,slot=0
-device igb,bus=root_port_for_igb
-device pcie-root-port,id=root_port_for_xhci,chassis=4,slot=0
-device qemu-xhci,bus=root_port_for_xhci
-device pcie-root-port,id=root_port_for_rng,chassis=5,slot=0
-device virtio-rng-pci,bus=root_port_for_rng
-device pcie-root-port,id=root_port_for_pci,chassis=6,slot=0
-device pcie-pci-bridge,id=pci,bus=root_port_for_pci
-device es1370,bus=pci,addr=9
-device e1000,bus=pci,addr=10
-device pxb-pcie,id=pxb1,bus_nr=1
-device pcie-root-port,id=root_port_for_ahci,bus=pxb1,chassis=10,slot=0
-device ahci,bus=root_port_for_ahci
BSA ACS test 841 checks do Type-1 PCIe devices have 32-bit
non-prefetchable memory. And fails on pcie-pci-bridge:
Operating System View:
841 : NP type-1 PCIe supp 32-bit only START
BDF - 0x400
BDF - 0x500
BDF - 0x600
BDF - 0x700
BDF - 0x800
BDF - 0x900
BDF - 0x10000
BDF - 0x30000
Skipping Non Type-1 headers
BDF - 0x40000
Skipping Non Type-1 headers
BDF - 0x50000
Skipping Non Type-1 headers
BDF - 0x60000
Skipping Non Type-1 headers
BDF - 0x70000
NP type-1 pcie is not 32-bit mem type
Failed on PE - 0
PCI_MM_04
Checkpoint -- 1 : Result: FAIL
0x70000 is pcie-pci-bridge card.
I opened issue for BSA ACS [3] and asked where the problem is.
3. https://github.com/ARM-software/bsa-acs/issues/197
Got quote from BSA (Arm Base System Architecture) [4]
chapter E.2 PCI Express Memory Space:
> When PCI Express memory space is mapped as normal memory, the system
> must support unaligned accesses to that region.
> PCI Type 1 headers, used in PCI-to-PCI bridges, and therefore in root
> ports and switches, have to be programmed with the address space
> resources claimed by the given bridge.
> For non-prefetchable (NP) memory, Type 1 headers only support 32-bit
> addresses. This implies that endpoints on the other end of a
> PCI-to-PCI bridge only support 32-bit NP BARs
4. https://developer.arm.com/documentation/den0094/latest/
I looked at code and tried to switch pcie-pci-bridge to 32-bit:
------------------------------------------------------------------------
diff --git a/hw/pci-bridge/pcie_pci_bridge.c b/hw/pci-bridge/pcie_pci_bridge.c
index 2301b2ca0b..45199d2fa0 100644
--- a/hw/pci-bridge/pcie_pci_bridge.c
+++ b/hw/pci-bridge/pcie_pci_bridge.c
@@ -82,7 +82,7 @@ static void pcie_pci_bridge_realize(PCIDevice *d, Error **errp)
}
}
pci_register_bar(d, 0, PCI_BASE_ADDRESS_SPACE_MEMORY |
- PCI_BASE_ADDRESS_MEM_TYPE_64, &pcie_br->shpc_bar);
+ PCI_BASE_ADDRESS_MEM_TYPE_32, &pcie_br->shpc_bar);
return;
msi_error:
------------------------------------------------------------------------
With it, test 841 passes.
The difference in "lspci -vvvv" output suggests that this region address
was 32-bit in both cases:
- Region 0: Memory at 81c00000 (64-bit, non-prefetchable) [size=256]
+ Region 0: Memory at 81c00000 (32-bit, non-prefetchable) [size=256]
Any ideas how to continue from here?
next reply other threads:[~2023-09-11 10:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-11 10:17 Marcin Juszkiewicz [this message]
2023-09-11 11:32 ` Should pcie-pci-bridge use 32-bit non-prefetchable memory? Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6a0b9345-a447-4cf9-ba9a-88c420e7ab79@linaro.org \
--to=marcin.juszkiewicz@linaro.org \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).