[PATCH v2 4/4] xen: Disable PCI on qemuarm with Xen


Bertrand Marquis
 

Remove the pci node from the qemu device tree when runqemu is used with
xen-qemuboot.

Linux is ending up in an infinite loop when trying to access PCI
configuration space when running on top of Xen on arm32.
As we do not need or support any of the devices on PCI on arm32 at the
moment, just remove the node from the device tree generated by qemu.

The problem does not appear at the moment without Xen and it is unclear
why it is with Xen.
This will be investigated but in the meantime provide a working
configuration for users.

Signed-off-by: Bertrand Marquis <bertrand.marquis@...>
---
classes/qemuboot-xen-dtb.bbclass | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

diff --git a/classes/qemuboot-xen-dtb.bbclass b/classes/qemuboot-xen-dtb.=
bbclass
index d43d23a..1f17a86 100644
--- a/classes/qemuboot-xen-dtb.bbclass
+++ b/classes/qemuboot-xen-dtb.bbclass
@@ -63,6 +63,21 @@ write_lops_xen_section() {
EOF
}
=20
+write_lop_rm_pci() {
+ cat <<EOF >"$1"
+/dts-v1/;
+/ {
+ compatible =3D "system-device-tree-v1";
+ lops {
+ lop_1 {
+ compatible =3D "system-device-tree-v1,lop,modify";
+ modify =3D "/pcie@10000000::";
+ };
+ };
+};
+EOF
+}
+
write_lop_add_to_xen_cmdline() {
EXTRA_XEN_BOOTARGS=3D"$2"
cat <<EOF >"$1"
@@ -135,6 +150,13 @@ generate_xen_qemuboot_dtb() {
write_lop_add_to_xen_cmdline "${B}/lop-xen-cmdline.dts" \
"${QB_XEN_CMDLINE_EXTRA}"
=20
+ # On Qemu Arm32, Dom0 accessing PCI config space ends up in an
+ # infinite loop. Remove pci node from the device tree
+ if [ "${MACHINE}" =3D "qemuarm" ]; then
+ write_lop_rm_pci "${B}/lop-rm-pci.dts"
+ LOP_MODULE_ARGS=3D"${LOP_MODULE_ARGS} -i ${B}/lop-rm-pci.dts"
+ fi
+
if [ -z "${QB_XEN_DOMAIN_MODULES}" ]; then
bbwarn "No domain modules: please set QB_XEN_DOMAIN_MODULES"
fi
--=20
2.25.1


Christopher Clark
 

On Tue, May 10, 2022 at 8:35 AM Bertrand Marquis
<bertrand.marquis@...> wrote:

Remove the pci node from the qemu device tree when runqemu is used with
xen-qemuboot.

Linux is ending up in an infinite loop when trying to access PCI
configuration space when running on top of Xen on arm32.
As we do not need or support any of the devices on PCI on arm32 at the
moment, just remove the node from the device tree generated by qemu.

The problem does not appear at the moment without Xen and it is unclear
why it is with Xen.
This will be investigated but in the meantime provide a working
configuration for users.

Signed-off-by: Bertrand Marquis <bertrand.marquis@...>
Thanks for this - my review is from inspecting the patch applied; I
have yet to test it but there's no need to hold this back with
positive reports now from Bruce and Bertrand.

Reviewed-by: Christopher Clark <christopher.w.clark@...>

thanks,

Christopher

---
classes/qemuboot-xen-dtb.bbclass | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

diff --git a/classes/qemuboot-xen-dtb.bbclass b/classes/qemuboot-xen-dtb.bbclass
index d43d23a..1f17a86 100644
--- a/classes/qemuboot-xen-dtb.bbclass
+++ b/classes/qemuboot-xen-dtb.bbclass
@@ -63,6 +63,21 @@ write_lops_xen_section() {
EOF
}

+write_lop_rm_pci() {
+ cat <<EOF >"$1"
+/dts-v1/;
+/ {
+ compatible = "system-device-tree-v1";
+ lops {
+ lop_1 {
+ compatible = "system-device-tree-v1,lop,modify";
+ modify = "/pcie@10000000::";
+ };
+ };
+};
+EOF
+}
+
write_lop_add_to_xen_cmdline() {
EXTRA_XEN_BOOTARGS="$2"
cat <<EOF >"$1"
@@ -135,6 +150,13 @@ generate_xen_qemuboot_dtb() {
write_lop_add_to_xen_cmdline "${B}/lop-xen-cmdline.dts" \
"${QB_XEN_CMDLINE_EXTRA}"

+ # On Qemu Arm32, Dom0 accessing PCI config space ends up in an
+ # infinite loop. Remove pci node from the device tree
+ if [ "${MACHINE}" = "qemuarm" ]; then
+ write_lop_rm_pci "${B}/lop-rm-pci.dts"
+ LOP_MODULE_ARGS="${LOP_MODULE_ARGS} -i ${B}/lop-rm-pci.dts"
+ fi
+
if [ -z "${QB_XEN_DOMAIN_MODULES}" ]; then
bbwarn "No domain modules: please set QB_XEN_DOMAIN_MODULES"
fi
--
2.25.1




Bertrand Marquis
 

Hi Christopher,

On 18 May 2022, at 01:14, Christopher Clark <christopher.w.clark@...> wrote:

On Tue, May 10, 2022 at 8:35 AM Bertrand Marquis
<bertrand.marquis@...> wrote:

Remove the pci node from the qemu device tree when runqemu is used with
xen-qemuboot.

Linux is ending up in an infinite loop when trying to access PCI
configuration space when running on top of Xen on arm32.
As we do not need or support any of the devices on PCI on arm32 at the
moment, just remove the node from the device tree generated by qemu.

The problem does not appear at the moment without Xen and it is unclear
why it is with Xen.
This will be investigated but in the meantime provide a working
configuration for users.

Signed-off-by: Bertrand Marquis <bertrand.marquis@...>
Thanks for this - my review is from inspecting the patch applied; I
have yet to test it but there's no need to hold this back with
positive reports now from Bruce and Bertrand.

Reviewed-by: Christopher Clark <christopher.w.clark@...>
Thanks and I agree.

This is an hack but I think it is better at the moment to have something running and I will create a task on my side to investigate this in the future.

Cheers
Bertrand


thanks,

Christopher

---
classes/qemuboot-xen-dtb.bbclass | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

diff --git a/classes/qemuboot-xen-dtb.bbclass b/classes/qemuboot-xen-dtb.bbclass
index d43d23a..1f17a86 100644
--- a/classes/qemuboot-xen-dtb.bbclass
+++ b/classes/qemuboot-xen-dtb.bbclass
@@ -63,6 +63,21 @@ write_lops_xen_section() {
EOF
}

+write_lop_rm_pci() {
+ cat <<EOF >"$1"
+/dts-v1/;
+/ {
+ compatible = "system-device-tree-v1";
+ lops {
+ lop_1 {
+ compatible = "system-device-tree-v1,lop,modify";
+ modify = "/pcie@10000000::";
+ };
+ };
+};
+EOF
+}
+
write_lop_add_to_xen_cmdline() {
EXTRA_XEN_BOOTARGS="$2"
cat <<EOF >"$1"
@@ -135,6 +150,13 @@ generate_xen_qemuboot_dtb() {
write_lop_add_to_xen_cmdline "${B}/lop-xen-cmdline.dts" \
"${QB_XEN_CMDLINE_EXTRA}"

+ # On Qemu Arm32, Dom0 accessing PCI config space ends up in an
+ # infinite loop. Remove pci node from the device tree
+ if [ "${MACHINE}" = "qemuarm" ]; then
+ write_lop_rm_pci "${B}/lop-rm-pci.dts"
+ LOP_MODULE_ARGS="${LOP_MODULE_ARGS} -i ${B}/lop-rm-pci.dts"
+ fi
+
if [ -z "${QB_XEN_DOMAIN_MODULES}" ]; then
bbwarn "No domain modules: please set QB_XEN_DOMAIN_MODULES"
fi
--
2.25.1




Bruce Ashfield
 

On Tue, May 17, 2022 at 8:14 PM Christopher Clark
<christopher.w.clark@...> wrote:

On Tue, May 10, 2022 at 8:35 AM Bertrand Marquis
<bertrand.marquis@...> wrote:

Remove the pci node from the qemu device tree when runqemu is used with
xen-qemuboot.

Linux is ending up in an infinite loop when trying to access PCI
configuration space when running on top of Xen on arm32.
As we do not need or support any of the devices on PCI on arm32 at the
moment, just remove the node from the device tree generated by qemu.

The problem does not appear at the moment without Xen and it is unclear
why it is with Xen.
This will be investigated but in the meantime provide a working
configuration for users.

Signed-off-by: Bertrand Marquis <bertrand.marquis@...>
Thanks for this - my review is from inspecting the patch applied; I
have yet to test it but there's no need to hold this back with
positive reports now from Bruce and Bertrand.

Reviewed-by: Christopher Clark <christopher.w.clark@...>

thanks,
Everything is merged to master and kirkstone.

Bruce

Christopher

---
classes/qemuboot-xen-dtb.bbclass | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

diff --git a/classes/qemuboot-xen-dtb.bbclass b/classes/qemuboot-xen-dtb.bbclass
index d43d23a..1f17a86 100644
--- a/classes/qemuboot-xen-dtb.bbclass
+++ b/classes/qemuboot-xen-dtb.bbclass
@@ -63,6 +63,21 @@ write_lops_xen_section() {
EOF
}

+write_lop_rm_pci() {
+ cat <<EOF >"$1"
+/dts-v1/;
+/ {
+ compatible = "system-device-tree-v1";
+ lops {
+ lop_1 {
+ compatible = "system-device-tree-v1,lop,modify";
+ modify = "/pcie@10000000::";
+ };
+ };
+};
+EOF
+}
+
write_lop_add_to_xen_cmdline() {
EXTRA_XEN_BOOTARGS="$2"
cat <<EOF >"$1"
@@ -135,6 +150,13 @@ generate_xen_qemuboot_dtb() {
write_lop_add_to_xen_cmdline "${B}/lop-xen-cmdline.dts" \
"${QB_XEN_CMDLINE_EXTRA}"

+ # On Qemu Arm32, Dom0 accessing PCI config space ends up in an
+ # infinite loop. Remove pci node from the device tree
+ if [ "${MACHINE}" = "qemuarm" ]; then
+ write_lop_rm_pci "${B}/lop-rm-pci.dts"
+ LOP_MODULE_ARGS="${LOP_MODULE_ARGS} -i ${B}/lop-rm-pci.dts"
+ fi
+
if [ -z "${QB_XEN_DOMAIN_MODULES}" ]; then
bbwarn "No domain modules: please set QB_XEN_DOMAIN_MODULES"
fi
--
2.25.1





--
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II


Bertrand Marquis
 

Hi Bruce,

On 18 May 2022, at 18:59, Bruce Ashfield <bruce.ashfield@...> wrote:

On Tue, May 17, 2022 at 8:14 PM Christopher Clark
<christopher.w.clark@...> wrote:

On Tue, May 10, 2022 at 8:35 AM Bertrand Marquis
<bertrand.marquis@...> wrote:

Remove the pci node from the qemu device tree when runqemu is used with
xen-qemuboot.

Linux is ending up in an infinite loop when trying to access PCI
configuration space when running on top of Xen on arm32.
As we do not need or support any of the devices on PCI on arm32 at the
moment, just remove the node from the device tree generated by qemu.

The problem does not appear at the moment without Xen and it is unclear
why it is with Xen.
This will be investigated but in the meantime provide a working
configuration for users.

Signed-off-by: Bertrand Marquis <bertrand.marquis@...>
Thanks for this - my review is from inspecting the patch applied; I
have yet to test it but there's no need to hold this back with
positive reports now from Bruce and Bertrand.

Reviewed-by: Christopher Clark <christopher.w.clark@...>

thanks,
Everything is merged to master and kirkstone.
Great, thanks a lot :-)

Cheers
Bertrand


Bruce

Christopher

---
classes/qemuboot-xen-dtb.bbclass | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

diff --git a/classes/qemuboot-xen-dtb.bbclass b/classes/qemuboot-xen-dtb.bbclass
index d43d23a..1f17a86 100644
--- a/classes/qemuboot-xen-dtb.bbclass
+++ b/classes/qemuboot-xen-dtb.bbclass
@@ -63,6 +63,21 @@ write_lops_xen_section() {
EOF
}

+write_lop_rm_pci() {
+ cat <<EOF >"$1"
+/dts-v1/;
+/ {
+ compatible = "system-device-tree-v1";
+ lops {
+ lop_1 {
+ compatible = "system-device-tree-v1,lop,modify";
+ modify = "/pcie@10000000::";
+ };
+ };
+};
+EOF
+}
+
write_lop_add_to_xen_cmdline() {
EXTRA_XEN_BOOTARGS="$2"
cat <<EOF >"$1"
@@ -135,6 +150,13 @@ generate_xen_qemuboot_dtb() {
write_lop_add_to_xen_cmdline "${B}/lop-xen-cmdline.dts" \
"${QB_XEN_CMDLINE_EXTRA}"

+ # On Qemu Arm32, Dom0 accessing PCI config space ends up in an
+ # infinite loop. Remove pci node from the device tree
+ if [ "${MACHINE}" = "qemuarm" ]; then
+ write_lop_rm_pci "${B}/lop-rm-pci.dts"
+ LOP_MODULE_ARGS="${LOP_MODULE_ARGS} -i ${B}/lop-rm-pci.dts"
+ fi
+
if [ -z "${QB_XEN_DOMAIN_MODULES}" ]; then
bbwarn "No domain modules: please set QB_XEN_DOMAIN_MODULES"
fi
--
2.25.1





--
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II