From: Oleksandr Andrushchenko <andr2000@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: julien@xen.org, sstabellini@kernel.org,
oleksandr_tyshchenko@epam.com, volodymyr_babchuk@epam.com,
Artem_Mygaiev@epam.com, roger.pau@citrix.com, jbeulich@suse.com,
andrew.cooper3@citrix.com, george.dunlap@citrix.com,
paul@xen.org, bertrand.marquis@arm.com, rahul.singh@arm.com,
Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Subject: [PATCH v6 2/7] xen/arm: add pci-domain for disabled devices
Date: Fri, 5 Nov 2021 08:33:21 +0200 [thread overview]
Message-ID: <20211105063326.939843-3-andr2000@gmail.com> (raw)
In-Reply-To: <20211105063326.939843-1-andr2000@gmail.com>
From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
If a PCI host bridge device is present in the device tree, but is
disabled, then its PCI host bridge driver was not instantiated.
This results in the failure of the pci_get_host_bridge_segment()
and the following panic during Xen start:
(XEN) Device tree generation failed (-22).
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) Could not set up DOM0 guest OS
(XEN) ****************************************
Fix this by adding "linux,pci-domain" property for all device tree nodes
which have "pci" device type, so we know which segments will be used by
the guest for which bridges.
Fixes: 4cfab4425d39 ("xen/arm: Add linux,pci-domain property for hwdom if not available.")
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
---
New in v6
---
xen/arch/arm/domain_build.c | 15 ++++++++++++++-
xen/arch/arm/pci/pci-host-common.c | 2 +-
xen/include/asm-arm/pci.h | 8 ++++++++
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 491f5e2c316e..f7fcb1400c19 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -753,9 +753,22 @@ static int __init write_properties(struct domain *d, struct kernel_info *kinfo,
{
uint16_t segment;
+ /*
+ * The node doesn't have "linux,pci-domain" property and it is
+ * possible that:
+ * - Xen only has drivers for a part of the host bridges
+ * - some host bridges are disabled
+ * Make sure we insert the correct "linux,pci-domain" property
+ * in any case, so we know which segments will be used
+ * by Linux for which bridges.
+ */
res = pci_get_host_bridge_segment(node, &segment);
if ( res < 0 )
- return res;
+ {
+ segment = pci_get_new_domain_nr();
+ printk(XENLOG_DEBUG "Assigned segment %d to %s\n",
+ segment, node->full_name);
+ }
res = fdt_property_cell(kinfo->fdt, "linux,pci-domain", segment);
if ( res )
diff --git a/xen/arch/arm/pci/pci-host-common.c b/xen/arch/arm/pci/pci-host-common.c
index d8cbaaaba654..47104b22b221 100644
--- a/xen/arch/arm/pci/pci-host-common.c
+++ b/xen/arch/arm/pci/pci-host-common.c
@@ -137,7 +137,7 @@ void pci_add_host_bridge(struct pci_host_bridge *bridge)
list_add_tail(&bridge->node, &pci_host_bridges);
}
-static int pci_get_new_domain_nr(void)
+int pci_get_new_domain_nr(void)
{
return atomic_inc_return(&domain_nr);
}
diff --git a/xen/include/asm-arm/pci.h b/xen/include/asm-arm/pci.h
index 81273e0d87ac..c20eba643d86 100644
--- a/xen/include/asm-arm/pci.h
+++ b/xen/include/asm-arm/pci.h
@@ -108,6 +108,8 @@ static always_inline bool is_pci_passthrough_enabled(void)
void arch_pci_init_pdev(struct pci_dev *pdev);
+int pci_get_new_domain_nr(void);
+
#else /*!CONFIG_HAS_PCI*/
struct arch_pci_dev { };
@@ -128,5 +130,11 @@ static inline int pci_get_host_bridge_segment(const struct dt_device_node *node,
return -EINVAL;
}
+static inline int pci_get_new_domain_nr(void)
+{
+ ASSERT_UNREACHABLE();
+ return -1;
+}
+
#endif /*!CONFIG_HAS_PCI*/
#endif /* __ARM_PCI_H__ */
--
2.25.1
next prev parent reply other threads:[~2021-11-05 6:33 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-05 6:33 [PATCH v6 0/7] PCI devices passthrough on Arm, part 2 Oleksandr Andrushchenko
2021-11-05 6:33 ` [PATCH v6 1/7] xen/arm: rename DEVICE_PCI to DEVICE_PCI_HOSTBRIDGE Oleksandr Andrushchenko
2021-11-16 18:26 ` Julien Grall
2021-11-05 6:33 ` Oleksandr Andrushchenko [this message]
2021-11-16 18:48 ` [PATCH v6 2/7] xen/arm: add pci-domain for disabled devices Julien Grall
2021-11-17 6:56 ` Oleksandr Andrushchenko
2021-11-17 21:33 ` Julien Grall
2021-11-18 7:13 ` Oleksandr Andrushchenko
2021-11-22 15:29 ` Julien Grall
2021-11-22 16:23 ` Oleksandr Andrushchenko
2021-11-22 17:17 ` Julien Grall
2021-11-23 6:31 ` Oleksandr Andrushchenko
2021-11-23 16:05 ` Julien Grall
2021-11-23 16:44 ` Oleksandr Andrushchenko
2021-11-23 17:15 ` Julien Grall
2021-11-24 6:54 ` Oleksandr Andrushchenko
2021-11-05 6:33 ` [PATCH v6 3/7] xen/arm: setup MMIO range trap handlers for hardware domain Oleksandr Andrushchenko
2021-11-09 9:20 ` Oleksandr Andrushchenko
2021-11-16 19:12 ` Julien Grall
2021-11-18 7:27 ` Oleksandr Andrushchenko
2021-11-18 10:46 ` Oleksandr Andrushchenko
2021-11-22 17:36 ` Julien Grall
2021-11-23 6:58 ` Oleksandr Andrushchenko
2021-11-23 16:12 ` Julien Grall
2021-11-23 16:41 ` Oleksandr Andrushchenko
2021-11-23 16:58 ` Julien Grall
2021-11-24 7:22 ` Oleksandr Andrushchenko
2021-11-05 6:33 ` [PATCH v6 4/7] xen/arm: do not map PCI ECAM and MMIO space to Domain-0's p2m Oleksandr Andrushchenko
2021-11-23 16:42 ` Julien Grall
2021-11-24 7:42 ` Oleksandr Andrushchenko
2021-11-05 6:33 ` [PATCH v6 5/7] xen/arm: do not map IRQs and memory for disabled devices Oleksandr Andrushchenko
2021-11-16 19:22 ` Julien Grall
2021-11-18 6:59 ` Oleksandr Andrushchenko
2021-11-22 19:31 ` Julien Grall
2021-11-23 7:23 ` Oleksandr Andrushchenko
2021-11-05 6:33 ` [PATCH v6 6/7] xen/arm: process pending vPCI map/unmap operations Oleksandr Andrushchenko
2021-11-05 7:40 ` Jan Beulich
2021-11-17 21:26 ` Julien Grall
2021-11-05 6:33 ` [PATCH v6 7/7] xen/arm: do not use void pointer in pci_host_common_probe Oleksandr Andrushchenko
2021-11-17 11:12 ` Rahul Singh
2021-11-17 21:45 ` Julien Grall
2021-11-18 7:34 ` Oleksandr Andrushchenko
2021-11-22 17:48 ` Julien Grall
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=20211105063326.939843-3-andr2000@gmail.com \
--to=andr2000@gmail.com \
--cc=Artem_Mygaiev@epam.com \
--cc=andrew.cooper3@citrix.com \
--cc=bertrand.marquis@arm.com \
--cc=george.dunlap@citrix.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=oleksandr_andrushchenko@epam.com \
--cc=oleksandr_tyshchenko@epam.com \
--cc=paul@xen.org \
--cc=rahul.singh@arm.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=volodymyr_babchuk@epam.com \
--cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.