Skip to contentSkip to conversation

Add support for the PCI host bridge device-tree node creation.

PATCH Superseded Herve Codina 3 participants 8 messages Dec 9, 2024 – Dec 24, 2024

Subsystems (2)

v5 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v5 cover Add support for the PCI host bridge device-tree node creation.

Hi,

This series adds support for creating a device-tree node for the PCI host bridge on non device-tree based system.

Creating device-tree nodes for PCI devices and PCI-PCI bridges already exists upstream. It was added in commit 407d1a51921e ("PCI: Create device tree node for bridge"). Created device-tree nodes need a parent node to be attached to. For the first level devices, on device-tree based system, this parent node (i.e. the PCI host bridge) is described in the base device-tree. The PCI bus related to this bridge (PCI root bus) inherit of the PCI host bridge device-tree node.

The LAN966x PCI device driver, available since commit 185686beb464 ("misc: Add support for LAN966x PCI device"), relies on this feature.

On system where the base hardware is not described by a device-tree, the PCI host bridge to which first level created PCI devices need to be attach to does not exist. This is the case for instance on ACPI described systems such as x86.

This series goal is to handle this case.

In order to have the PCI host bridge device-tree node available even on x86, this top level node is created (if not already present) based on information computed by the PCI core. It follows the same mechanism as the one used for PCI devices device-tree node creation.

As for device-tree based system, the PCI root bus handled by the PCI host bridge inherit of this created node.

In order to have this feature available, a number of changes are needed:
- Patch 1 and 2: Introduce and use device_{add,remove}_of_node(). This function will also be used in the root PCI bus node creation.

- Patch 3 and 4: Improve existing functions to reuse them in the root PCI bus node creation.

- Patch 5: The PCI host bridge device-tree node creation itself.

With those modifications, the LAN966x PCI device is working on x86 systems and all device-tree kunit tests (including the of_unittest_pci_node test) pass successfully with the following command:

  qemu-system-x86_64 -machine q35 -nographic \
    -kernel arch/x86_64/boot/bzImage --append console=ttyS0 \
    -device pcie-root-port,port=0x10,chassis=9,id=pci.9,bus=pcie.0,multifunction=on,addr=0x3 \
    -device pcie-root-port,port=0x11,chassis=10,id=pci.10,bus=pcie.0,addr=0x3.0x1 \
    -device x3130-upstream,id=pci.11,bus=pci.9,addr=0x0 \
    -device xio3130-downstream,port=0x0,chassis=11,id=pci.12,bus=pci.11,multifunction=on,addr=0x0 \
    -device i82801b11-bridge,id=pci.13,bus=pcie.0,addr=0x4 \
    -device pci-bridge,chassis_nr=14,id=pci.14,bus=pci.13,addr=0x0 \
    -device pci-testdev,bus=pci.12,addr=0x0

Compare to previous iteration, this v5 series mainly:
- Use dev_warn() instead for WARN() in device_add_of_node()
- Use dev_err() in of_pci_make_host_bridge_node()
- Remove a patch already applied

Best regards,
Hervé Codina

Changes v4 -> v5
v4: https://lore.kernel.org/lkml/[email protected]/

- Patch 1
Use dev_warn() instead of WARN()

- Patches 2 to 4
No changes

- Patch 5 (v4 patch 6)
Use dev_err()
Fix a typo in commit log

Patch removed in v5
- Patch 5 in v4
Already applied

Changes v3 -> v4
v3: https://lore.kernel.org/lkml/[email protected]/

Rebase on top of v6.13-rc1

- Patches 1 to 6
No changes

Changes v2 -> v3
v2: https://lore.kernel.org/lkml/[email protected]/

- Patch 5
Fix commit log.
Use 2 for #size-cells.

- Patches 1 to 4 and 6
No changes

Changes v1 -> v2
v1: https://lore.kernel.org/lkml/[email protected]/

- Patch 1
Remove Cc: stable

- Patch 2
Remove Fixup tag and Cc: stable

- Patches 3 and 4
No changes

- Patch 5
Add #address-cells/#size-cells in the empty root DT node instead of updating default values for x86.
Update commit log and commit title.

- Patch 6
Create device-tree node for the PCI host bridge and reuse it for the PCI root bus. Rename functions accordingly.
Use "pci" instead of "pci-root" for the PCI host bridge node name. Use "res->start - windows->offset" for the PCI bus addresses. Update commit log and commit title.

Herve Codina (5):
driver core: Introduce device_{add,remove}_of_node()
PCI: of: Use device_{add,remove}_of_node() to attach of_node to
existing device
PCI: of_property: Add support for NULL pdev in of_pci_set_address()
PCI: of_property: Constify parameter in of_pci_get_addr_flags()
PCI: of: Create device-tree PCI host bridge node

 drivers/base/core.c       |  54 ++++++++++++++++++
 drivers/pci/of.c          |  98 +++++++++++++++++++++++++++++++-
 drivers/pci/of_property.c | 114 ++++++++++++++++++++++++++++++++++++--
 drivers/pci/pci.h         |   6 ++
 drivers/pci/probe.c       |   2 +
 drivers/pci/remove.c      |   2 +
 include/linux/device.h    |   2 +
 7 files changed, 271 insertions(+), 7 deletions(-)
Signature · 1 line
2.47.0
#1 lore raw

PATCH v5 1/5 driver core: Introduce device_{add,remove}_of_node()

An of_node can be set to a device using device_set_node(). This function cannot prevent any of_node and/or fwnode overwrites.

When adding an of_node on an already present device, the following operations need to be done:
- Attach the of_node if no of_node were already attached
- Attach the of_node as a fwnode if no fwnode were already attached

This is the purpose of device_add_of_node(). device_remove_of_node() reverts the operations done by device_add_of_node().

---
 drivers/base/core.c    | 54 ++++++++++++++++++++++++++++++++++++++++++
 include/linux/device.h |  2 ++
 2 files changed, 56 insertions(+)
drivers/base/core.c +54 -0
index 8b056306f04e..81e5465aa746 100644
@@ -5216,6 +5216,60 @@ void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode)
 }
 EXPORT_SYMBOL_GPL(set_secondary_fwnode);
 
+/**
+ * device_remove_of_node - Remove an of_node from a device
+ * @dev: device whose device-tree node is being removed
+ */
+void device_remove_of_node(struct device *dev)
+{
+	dev = get_device(dev);
+	if (!dev)
+		return;
+
+	if (!dev->of_node)
+		goto end;
+
+	if (dev->fwnode == of_fwnode_handle(dev->of_node))
+		dev->fwnode = NULL;
+
+	of_node_put(dev->of_node);
+	dev->of_node = NULL;
+
+end:
+	put_device(dev);
+}
+EXPORT_SYMBOL_GPL(device_remove_of_node);
+
+/**
+ * device_add_of_node - Add an of_node to an existing device
+ * @dev: device whose device-tree node is being added
+ * @of_node: of_node to add
+ */
+void device_add_of_node(struct device *dev, struct device_node *of_node)
+{
+	if (!of_node)
+		return;
+
+	dev = get_device(dev);
+	if (!dev)
+		return;
+
+	if (dev->of_node) {
+		dev_warn(dev, "Cannot replace node %pOF with %pOF\n",
+			 dev->of_node, of_node);
+		goto end;
+	}
+
+	dev->of_node = of_node_get(of_node);
+
+	if (!dev->fwnode)
+		dev->fwnode = of_fwnode_handle(of_node);
+
+end:
+	put_device(dev);
+}
+EXPORT_SYMBOL_GPL(device_add_of_node);
+
 /**
  * device_set_of_node_from_dev - reuse device-tree node of another device
  * @dev: device whose device-tree node is being set
include/linux/device.h +2 -0
index 667cb6db9019..ef4c0f3c41cd 100644
@@ -1149,6 +1149,8 @@ int device_online(struct device *dev);
 void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode);
 void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode);
 void device_set_node(struct device *dev, struct fwnode_handle *fwnode);
+void device_add_of_node(struct device *dev, struct device_node *of_node);
+void device_remove_of_node(struct device *dev);
 void device_set_of_node_from_dev(struct device *dev, const struct device *dev2);
 
 static inline struct device_node *dev_of_node(struct device *dev)
Signature · 1 line
2.47.0
#2 lore raw

Re: [PATCH v5 1/5] driver core: Introduce device_{add,remove}_of_node()

Quoted 46 lines · Herve Codina

An of_node can be set to a device using device_set_node(). This function cannot prevent any of_node and/or fwnode overwrites.

When adding an of_node on an already present device, the following operations need to be done:
- Attach the of_node if no of_node were already attached
- Attach the of_node as a fwnode if no fwnode were already attached

This is the purpose of device_add_of_node(). device_remove_of_node() reverts the operations done by device_add_of_node().

---
 drivers/base/core.c    | 54 ++++++++++++++++++++++++++++++++++++++++++
 include/linux/device.h |  2 ++
 2 files changed, 56 insertions(+)
drivers/base/core.c +20 -0
index 8b056306f04e..81e5465aa746 100644
@@ -5216,6 +5216,60 @@ void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode)
 }
 EXPORT_SYMBOL_GPL(set_secondary_fwnode);
 
+/**
+ * device_remove_of_node - Remove an of_node from a device
+ * @dev: device whose device-tree node is being removed
+ */
+void device_remove_of_node(struct device *dev)
+{
+	dev = get_device(dev);
+	if (!dev)
+		return;
+
+	if (!dev->of_node)
+		goto end;
+
+	if (dev->fwnode == of_fwnode_handle(dev->of_node))
+		dev->fwnode = NULL;
+
+	of_node_put(dev->of_node);
+	dev->of_node = NULL;
+
+end:

drivers/base/core.c void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode) · line 5248

Quoted 10 lines
drivers/base/core.c +10 -0
+	put_device(dev);
+}
+EXPORT_SYMBOL_GPL(device_remove_of_node);
+
+/**
+ * device_add_of_node - Add an of_node to an existing device
+ * @dev: device whose device-tree node is being added
+ * @of_node: of_node to add
+ */
+void device_add_of_node(struct device *dev, struct device_node *of_node)

Why is this void?

drivers/base/core.c void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode) · line 5259

Quoted 11 lines
drivers/base/core.c +11 -0
+{
+	if (!of_node)
+		return;
+
+	dev = get_device(dev);
+	if (!dev)
+		return;
+
+	if (dev->of_node) {
+		dev_warn(dev, "Cannot replace node %pOF with %pOF\n",
+			 dev->of_node, of_node);

Why not return an error too? Otherwise you can never know if this worked or not.

thanks,

greg k-h

#3 lore raw

PATCH v5 2/5 PCI: of: Use device_{add,remove}_of_node() to attach of_node to existing device

In reply to Herve Codina

The commit 407d1a51921e ("PCI: Create device tree node for bridge") creates of_node for PCI devices. The newly created of_node is attached to an existing device. This is done setting directly pdev->dev.of_node in the code.

Even if pdev->dev.of_node cannot be previously set, this doesn't handle the fwnode field of the struct device. Indeed, this field needs to be set if it hasn't already been set.

device_{add,remove}_of_node() have been introduced to handle this case.

Use them instead of the direct setting.

---
 drivers/pci/of.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/of.c +2 -2
index 52f770bcc481..3cca33105b85 100644
@@ -655,8 +655,8 @@ void of_pci_remove_node(struct pci_dev *pdev)
 	np = pci_device_to_OF_node(pdev);
 	if (!np || !of_node_check_flag(np, OF_DYNAMIC))
 		return;
-	pdev->dev.of_node = NULL;
 
+	device_remove_of_node(&pdev->dev);
 	of_changeset_revert(np->data);
 	of_changeset_destroy(np->data);
 	of_node_put(np);
@@ -713,7 +713,7 @@ void of_pci_make_dev_node(struct pci_dev *pdev)
 		goto out_free_node;
 
 	np->data = cset;
-	pdev->dev.of_node = np;
+	device_add_of_node(&pdev->dev, np);
 	kfree(name);
 
 	return;
Signature · 1 line
2.47.0
#4 lore raw

PATCH v5 3/5 PCI: of_property: Add support for NULL pdev in of_pci_set_address()

In reply to Herve Codina

The pdev (pointer to a struct pci_dev) parameter of of_pci_set_address() cannot be NULL.

In order to reuse of_pci_set_address() when creating the PCI root bus node, this function needs to support a NULL pdev parameter. Indeed, in the case of the PCI root bus node creation, no pdev are available and of_pci_set_address() will be used with the bridge windows.

Allow to call of_pci_set_address() with a NULL pdev.

---
 drivers/pci/of_property.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/pci/of_property.c +7 -3
index 886c236e5de6..8aff9ca1f222 100644
@@ -54,9 +54,13 @@ enum of_pci_prop_compatible {
 static void of_pci_set_address(struct pci_dev *pdev, u32 *prop, u64 addr,
 			       u32 reg_num, u32 flags, bool reloc)
 {
-	prop[0] = FIELD_PREP(OF_PCI_ADDR_FIELD_BUS, pdev->bus->number) |
-		FIELD_PREP(OF_PCI_ADDR_FIELD_DEV, PCI_SLOT(pdev->devfn)) |
-		FIELD_PREP(OF_PCI_ADDR_FIELD_FUNC, PCI_FUNC(pdev->devfn));
+	if (pdev)
+		prop[0] = FIELD_PREP(OF_PCI_ADDR_FIELD_BUS, pdev->bus->number) |
+			  FIELD_PREP(OF_PCI_ADDR_FIELD_DEV, PCI_SLOT(pdev->devfn)) |
+			  FIELD_PREP(OF_PCI_ADDR_FIELD_FUNC, PCI_FUNC(pdev->devfn));
+	else
+		prop[0] = 0;
+
 	prop[0] |= flags | reg_num;
 	if (!reloc) {
 		prop[0] |= OF_PCI_ADDR_FIELD_NONRELOC;
Signature · 1 line
2.47.0
#5 lore raw

PATCH v5 4/5 PCI: of_property: Constify parameter in of_pci_get_addr_flags()

In reply to Herve Codina

The res parameter has no reason to be a pointer to an un-const struct resource. Indeed, struct resource is not supposed to be modified by the function.

Constify the res parameter.

---
 drivers/pci/of_property.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/of_property.c +1 -1
index 8aff9ca1f222..400c4c2e434d 100644
@@ -69,7 +69,7 @@ static void of_pci_set_address(struct pci_dev *pdev, u32 *prop, u64 addr,
 	}
 }
 
-static int of_pci_get_addr_flags(struct resource *res, u32 *flags)
+static int of_pci_get_addr_flags(const struct resource *res, u32 *flags)
 {
 	u32 ss;
 
Signature · 1 line
2.47.0
#6 lore raw

PATCH v5 5/5 PCI: of: Create device-tree PCI host bridge node

In reply to Herve Codina

PCI devices device-tree nodes can be already created. This was introduced by commit 407d1a51921e ("PCI: Create device tree node for bridge").

In order to have device-tree nodes related to PCI devices attached on their PCI root bus (the PCI bus handled by the PCI host bridge), a PCI root bus device-tree node is needed. This root bus node will be used as the parent node of the first level devices scanned on the bus. On device-tree based systems, this PCI root bus device tree node is set to the node of the related PCI host bridge. The PCI host bridge node is available in the device-tree used to describe the hardware passed at boot.

On non device-tree based system (such as ACPI), a device-tree node for the PCI host bridge or for the root bus does not exist. Indeed, the PCI host bridge is not described in a device-tree used at boot simply because no device-tree are passed at boot.

The device-tree PCI host bridge node creation needs to be done at runtime. This is done in the same way as for the creation of the PCI device nodes. I.e. node and properties are created based on computed information done by the PCI core. Also, as is done on device-tree based systems, this PCI host bridge node is used for the PCI root bus.

---
 drivers/pci/of.c          |  94 ++++++++++++++++++++++++++++++++++-
 drivers/pci/of_property.c | 102 ++++++++++++++++++++++++++++++++++++++
 drivers/pci/pci.h         |   6 +++
 drivers/pci/probe.c       |   2 +
 drivers/pci/remove.c      |   2 +
 5 files changed, 205 insertions(+), 1 deletion(-)
drivers/pci/of.c +93 -1
index 3cca33105b85..108a67be12ea 100644
@@ -726,7 +726,99 @@ void of_pci_make_dev_node(struct pci_dev *pdev)
 out_free_name:
 	kfree(name);
 }
-#endif
+
+void of_pci_remove_host_bridge_node(struct pci_host_bridge *bridge)
+{
+	struct device_node *np;
+
+	np = pci_bus_to_OF_node(bridge->bus);
+	if (!np || !of_node_check_flag(np, OF_DYNAMIC))
+		return;
+
+	device_remove_of_node(&bridge->bus->dev);
+	device_remove_of_node(&bridge->dev);
+	of_changeset_revert(np->data);
+	of_changeset_destroy(np->data);
+	of_node_put(np);
+}
+
+void of_pci_make_host_bridge_node(struct pci_host_bridge *bridge)
+{
+	struct device_node *np = NULL;
+	struct of_changeset *cset;
+	const char *name;
+	int ret;
+
+	/*
+	 * If there is already a device-tree node linked to the PCI bus handled
+	 * by this bridge (i.e. the PCI root bus), nothing to do.
+	 */
+	if (pci_bus_to_OF_node(bridge->bus))
+		return;
+
+	/* The root bus has no node. Check that the host bridge has no node too */
+	if (bridge->dev.of_node) {
+		dev_err(&bridge->dev, "PCI host bridge of_node already set");
+		return;
+	}
+
+	/* Check if there is a DT root node to attach the created node */
+	if (!of_root) {
+		pr_err("of_root node is NULL, cannot create PCI host bridge node\n");
+		return;
+	}
+
+	name = kasprintf(GFP_KERNEL, "pci@%x,%x", pci_domain_nr(bridge->bus),
+			 bridge->bus->number);
+	if (!name)
+		return;
+
+	cset = kmalloc(sizeof(*cset), GFP_KERNEL);
+	if (!cset)
+		goto out_free_name;
+	of_changeset_init(cset);
+
+	np = of_changeset_create_node(cset, of_root, name);
+	if (!np)
+		goto out_destroy_cset;
+
+	ret = of_pci_add_host_bridge_properties(bridge, cset, np);
+	if (ret)
+		goto out_free_node;
+
+	/*
+	 * This of_node will be added to an existing device. The of_node parent
+	 * is the root OF node and so this node will be handled by the platform
+	 * bus. Avoid any new device creation.
+	 */
+	of_node_set_flag(np, OF_POPULATED);
+	np->fwnode.dev = &bridge->dev;
+	fwnode_dev_initialized(&np->fwnode, true);
+
+	ret = of_changeset_apply(cset);
+	if (ret)
+		goto out_free_node;
+
+	np->data = cset;
+
+	/* Add the of_node to host bridge and the root bus */
+	device_add_of_node(&bridge->dev, np);
+	device_add_of_node(&bridge->bus->dev, np);
+
+	kfree(name);
+
+	return;
+
+out_free_node:
+	of_node_put(np);
+out_destroy_cset:
+	of_changeset_destroy(cset);
+	kfree(cset);
+out_free_name:
+	kfree(name);
+}
+
+#endif /* CONFIG_PCI_DYNAMIC_OF_NODES */
 
 /**
  * of_pci_supply_present() - Check if the power supply is present for the PCI
drivers/pci/of_property.c +102 -0

105 lines not on this page · raw message

drivers/pci/pci.h +6 -0
index 2e40fc63ba31..0cdb2b3daea8 100644
@@ -871,9 +871,15 @@ void of_pci_make_dev_node(struct pci_dev *pdev);
 void of_pci_remove_node(struct pci_dev *pdev);
 int of_pci_add_properties(struct pci_dev *pdev, struct of_changeset *ocs,
 			  struct device_node *np);
+void of_pci_make_host_bridge_node(struct pci_host_bridge *bridge);
+void of_pci_remove_host_bridge_node(struct pci_host_bridge *bridge);
+int of_pci_add_host_bridge_properties(struct pci_host_bridge *bridge, struct of_changeset *ocs,
+				      struct device_node *np);
 #else
 static inline void of_pci_make_dev_node(struct pci_dev *pdev) { }
 static inline void of_pci_remove_node(struct pci_dev *pdev) { }
+static inline void of_pci_make_host_bridge_node(struct pci_host_bridge *bridge) { }
+static inline void of_pci_remove_host_bridge_node(struct pci_host_bridge *bridge) { }
 #endif
 
 #ifdef CONFIG_PCIEAER
drivers/pci/probe.c +2 -0
index 2e81ab0f5a25..629287f6b3d9 100644
@@ -1051,6 +1051,8 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge)
 		dev_info(&bus->dev, "root bus resource %pR%s\n", res, addr);
 	}
 
+	of_pci_make_host_bridge_node(bridge);
+
 	down_write(&pci_bus_sem);
 	list_add_tail(&bus->node, &pci_root_buses);
 	up_write(&pci_bus_sem);
drivers/pci/remove.c +2 -0
index efc37fcb73e2..9f7df2b20183 100644
@@ -163,6 +163,8 @@ void pci_stop_root_bus(struct pci_bus *bus)
 					 &bus->devices, bus_list)
 		pci_stop_bus_device(child);
 
+	of_pci_remove_host_bridge_node(host_bridge);
+
 	/* stop the host bridge */
 	device_release_driver(&host_bridge->dev);
 }
Signature · 1 line
2.47.0
#7 lore raw

Re: [PATCH v5 5/5] PCI: of: Create device-tree PCI host bridge node

kernel test robot noticed "WARNING:at_drivers/of/base.c:#of_n_addr_cells" on:

Hello,

kernel test robot noticed "WARNING:at_drivers/of/base.c:#of_n_addr_cells" on:

commit: 7e0c4ed7342d44f246bc8d905421f8010de74662 ("[PATCH v5 5/5] PCI: of: Create device-tree PCI host bridge node")
url: https://github.com/intel-lab-lkp/linux/commits/Herve-Codina/driver-core-Introduce-device_-add-remove-_of_node/20241209-211305
base: https://git.kernel.org/cgit/linux/kernel/git/pci/pci.git next
patch link: https://lore.kernel.org/all/[email protected]/
patch subject: [PATCH v5 5/5] PCI: of: Create device-tree PCI host bridge node

in testcase: boot

config: i386-randconfig-001-20241220
compiler: clang-19
test machine: qemu-system-i386 -enable-kvm -cpu SandyBridge -smp 2 -m 4G

(please refer to attached dmesg/kmsg for entire log/backtrace)

+-------------------------------------------------------------------------+------------+------------+
|                                                                         | 320b0bf1d5 | 7e0c4ed734 |
+-------------------------------------------------------------------------+------------+------------+
| WARNING:at_drivers/of/base.c:#of_n_addr_cells                           | 0          | 18         |
| EIP:of_n_addr_cells                                                     | 0          | 18         |
+-------------------------------------------------------------------------+------------+------------+

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-lkp/[email protected]

[    1.417876][    T1] ------------[ cut here ]------------
[    1.418708][    T1] Missing '#address-cells' in
[ 1.419500][ T1] WARNING: CPU: 1 PID: 1 at drivers/of/base.c:107 of_n_addr_cells (drivers/of/base.c:106 drivers/of/base.c:117)
[    1.420197][    T1] Modules linked in:
[    1.420818][    T1] CPU: 1 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.13.0-rc1-00012-g7e0c4ed7342d #1 4d930b120051bd0d99d76027ef034fe5e41e6f6f
[    1.422678][    T1] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
[ 1.424206][ T1] EIP: of_n_addr_cells (drivers/of/base.c:106 drivers/of/base.c:117)
[ 1.424986][ T1] Code: c0 79 2b 80 3d 6f 0c 00 44 00 74 09 8b 7f 34 85 ff 75 d7 eb 1c c6 05 6f 0c 00 44 01 57 68 d7 08 1e 43 e8 53 12 a3 fe 83 c4 08 <0f> 0b eb de 8b 75 f0 89 f0 83 c4 04 5e 5f 5b 5d 31 c9 31 d2 c3 cc
All code
========
   0:	c0 79 2b 80          	sarb   $0x80,0x2b(%rcx)
   4:	3d 6f 0c 00 44       	cmp    $0x44000c6f,%eax
   9:	00 74 09 8b          	add    %dh,-0x75(%rcx,%rcx,1)
   d:	7f 34                	jg     0x43
   f:	85 ff                	test   %edi,%edi
  11:	75 d7                	jne    0xffffffffffffffea
  13:	eb 1c                	jmp    0x31
  15:	c6 05 6f 0c 00 44 01 	movb   $0x1,0x44000c6f(%rip)        # 0x44000c8b
  1c:	57                   	push   %rdi
  1d:	68 d7 08 1e 43       	push   $0x431e08d7
  22:	e8 53 12 a3 fe       	call   0xfffffffffea3127a
  27:	83 c4 08             	add    $0x8,%esp
  2a:*	0f 0b                	ud2		<-- trapping instruction
  2c:	eb de                	jmp    0xc
  2e:	8b 75 f0             	mov    -0x10(%rbp),%esi
  31:	89 f0                	mov    %esi,%eax
  33:	83 c4 04             	add    $0x4,%esp
  36:	5e                   	pop    %rsi
  37:	5f                   	pop    %rdi
  38:	5b                   	pop    %rbx
  39:	5d                   	pop    %rbp
  3a:	31 c9                	xor    %ecx,%ecx
  3c:	31 d2                	xor    %edx,%edx
  3e:	c3                   	ret
  3f:	cc                   	int3

Code starting with the faulting instruction
===========================================

   0:	0f 0b                	ud2
   2:	eb de                	jmp    0xffffffffffffffe2
   4:	8b 75 f0             	mov    -0x10(%rbp),%esi
   7:	89 f0                	mov    %esi,%eax
   9:	83 c4 04             	add    $0x4,%esp
   c:	5e                   	pop    %rsi
   d:	5f                   	pop    %rdi
   e:	5b                   	pop    %rbx
   f:	5d                   	pop    %rbp
  10:	31 c9                	xor    %ecx,%ecx
  12:	31 d2                	xor    %edx,%edx
  14:	c3                   	ret
  15:	cc                   	int3
[    1.427777][    T1] EAX: 00000000 EBX: 44d5992c ECX: 00000000 EDX: 00000000
[    1.428821][    T1] ESI: 00000001 EDI: ee7fdeb8 EBP: 44d5993c ESP: 44d5992c
[    1.429891][    T1] DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068 EFLAGS: 00010202
[    1.430985][    T1] CR0: 80050033 CR2: 00000000 CR3: 042ec000 CR4: 000406d0
[    1.432049][    T1] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
[    1.433214][    T1] DR6: fffe0ff0 DR7: 00000400
[    1.433946][    T1] Call Trace:
[ 1.434502][ T1] ? show_regs (arch/x86/kernel/dumpstack.c:478)
[ 1.435199][ T1] ? of_n_addr_cells (drivers/of/base.c:106 drivers/of/base.c:117)
[ 1.435949][ T1] ? __warn (kernel/panic.c:242)
[ 1.436615][ T1] ? of_n_addr_cells (drivers/of/base.c:106 drivers/of/base.c:117)
[ 1.437327][ T1] ? of_n_addr_cells (drivers/of/base.c:106 drivers/of/base.c:117)
[ 1.437993][ T1] ? report_bug (lib/bug.c:199)
[ 1.438659][ T1] ? exc_overflow (arch/x86/kernel/traps.c:301)
[ 1.439808][ T1] ? handle_bug (arch/x86/kernel/traps.c:?)
[ 1.440043][ T1] ? exc_invalid_op (arch/x86/kernel/traps.c:309)
[ 1.440791][ T1] ? handle_exception (arch/x86/entry/entry_32.S:1048)
[ 1.441635][ T1] ? exc_overflow (arch/x86/kernel/traps.c:301)
[ 1.442355][ T1] ? of_n_addr_cells (drivers/of/base.c:106 drivers/of/base.c:117)
[ 1.443145][ T1] ? exc_overflow (arch/x86/kernel/traps.c:301)
[ 1.443829][ T1] ? of_n_addr_cells (drivers/of/base.c:106 drivers/of/base.c:117)
[ 1.444564][ T1] ? of_pci_add_host_bridge_properties (drivers/pci/of_property.c:? drivers/pci/of_property.c:493)
[ 1.445519][ T1] ? of_changeset_create_node (drivers/of/dynamic.c:917 include/linux/of.h:1614 drivers/of/dynamic.c:512)
[ 1.446365][ T1] ? of_pci_make_host_bridge_node (drivers/pci/of.c:786)
[ 1.447291][ T1] ? pci_register_host_bridge (drivers/pci/probe.c:1056)
[ 1.448154][ T1] ? __raw_spin_lock_init (include/linux/lockdep.h:135 include/linux/lockdep.h:142 kernel/locking/spinlock_debug.c:25)
[ 1.448953][ T1] ? __init_waitqueue_head (kernel/sched/wait.c:11)
[ 1.449806][ T1] ? pci_create_root_bus (drivers/pci/probe.c:3093)
[ 1.450039][ T1] ? acpi_pci_root_create (drivers/acpi/pci_root.c:1025)
[ 1.450869][ T1] ? pci_acpi_scan_root (arch/x86/pci/acpi.c:574)
[ 1.451682][ T1] ? acpi_pci_root_add (drivers/acpi/pci_root.c:728)
[ 1.452495][ T1] ? acpi_bus_get_status (drivers/acpi/bus.c:82)
[ 1.453269][ T1] ? acpi_bus_attach (drivers/acpi/scan.c:2261 drivers/acpi/scan.c:2309)
[ 1.454031][ T1] ? klist_next (lib/klist.c:384)
[ 1.454743][ T1] ? acpi_dev_for_one_check (drivers/acpi/bus.c:1145)
[ 1.455569][ T1] ? acpi_dev_for_each_child (drivers/acpi/bus.c:1139)
[ 1.456416][ T1] ? device_for_each_child (drivers/base/core.c:3993)
[ 1.457227][ T1] ? acpi_dev_for_each_child (drivers/acpi/bus.c:1157)
[ 1.458056][ T1] ? acpi_scan_clear_dep_fn (drivers/acpi/scan.c:2274)
[ 1.459806][ T1] ? acpi_bus_attach (drivers/acpi/scan.c:2331)
[ 1.459806][ T1] ? klist_next (lib/klist.c:384)
[ 1.460029][ T1] ? acpi_dev_for_one_check (drivers/acpi/bus.c:1145)
[ 1.460869][ T1] ? acpi_dev_for_each_child (drivers/acpi/bus.c:1139)
[ 1.461729][ T1] ? device_for_each_child (drivers/base/core.c:3993)
[ 1.462550][ T1] ? acpi_dev_for_each_child (drivers/acpi/bus.c:1157)
[ 1.463350][ T1] ? acpi_scan_clear_dep_fn (drivers/acpi/scan.c:2274)
[ 1.464160][ T1] ? acpi_bus_attach (drivers/acpi/scan.c:2331)
[ 1.464912][ T1] ? acpi_bus_scan (drivers/acpi/scan.c:2541)
[ 1.465639][ T1] ? acpi_scan_init (drivers/acpi/scan.c:2747)
[ 1.466388][ T1] ? __pci_mmcfg_init (include/linux/list.h:373 arch/x86/pci/mmconfig-shared.c:691)
[ 1.467151][ T1] ? acpi_init (drivers/acpi/bus.c:1468)
[ 1.467841][ T1] ? __initstub__kmod_acpi__390_1478_acpi_init4 (drivers/acpi/bus.c:1478)
[ 1.469805][ T1] ? do_one_initcall (init/main.c:1266)
[ 1.469805][ T1] ? __lock_acquire (kernel/locking/lockdep.c:4670)
[ 1.470057][ T1] ? kvm_sched_clock_read (arch/x86/kernel/kvmclock.c:91)
[ 1.470854][ T1] ? sched_clock_noinstr (arch/x86/kernel/tsc.c:268)
[ 1.471606][ T1] ? local_clock_noinstr (kernel/sched/clock.c:269 kernel/sched/clock.c:306)
[ 1.472397][ T1] ? local_clock (arch/x86/include/asm/preempt.h:84 kernel/sched/clock.c:316)
[ 1.473076][ T1] ? kvm_sched_clock_read (arch/x86/kernel/kvmclock.c:91)
[ 1.473884][ T1] ? sched_clock_noinstr (arch/x86/kernel/tsc.c:268)
[ 1.474646][ T1] ? local_clock_noinstr (kernel/sched/clock.c:269 kernel/sched/clock.c:306)
[ 1.475469][ T1] ? local_clock (arch/x86/include/asm/preempt.h:84 kernel/sched/clock.c:316)
[ 1.476194][ T1] ? ktime_get (include/linux/seqlock.h:226)
[ 1.476927][ T1] ? ktime_get (kernel/time/timekeeping.c:226 kernel/time/timekeeping.c:335 kernel/time/timekeeping.c:812)
[ 1.477633][ T1] ? sched_balance_trigger (kernel/sched/fair.c:12886)
[ 1.479808][ T1] ? clockevents_program_event (kernel/time/clockevents.c:336)
[ 1.479808][ T1] ? profile_tick (include/linux/profile.h:50)
[ 1.480043][ T1] ? tick_periodic (kernel/time/tick-common.c:103)
[ 1.480781][ T1] ? __lock_acquire (kernel/locking/lockdep.c:4670)
[ 1.481550][ T1] ? sched_clock_noinstr (arch/x86/kernel/tsc.c:268)
[ 1.482352][ T1] ? tick_handle_periodic (kernel/time/tick-common.c:132)
[ 1.483169][ T1] ? trace_hardirqs_on (kernel/trace/trace_preemptirq.c:49)
[ 1.483939][ T1] ? irqentry_exit (kernel/entry/common.c:?)
[ 1.484656][ T1] ? sysvec_call_function_single (arch/x86/kernel/apic/apic.c:1049)
[ 1.485505][ T1] ? sysvec_apic_timer_interrupt (arch/x86/kernel/apic/apic.c:1049)
[ 1.486375][ T1] ? handle_exception (arch/x86/entry/entry_32.S:1048)
[ 1.487143][ T1] ? xa_extract (lib/xarray.c:2157)
[ 1.487863][ T1] ? next_arg (lib/cmdline.c:273)
[ 1.489879][ T1] ? parse_args (kernel/params.c:153)
[ 1.489879][ T1] ? acpi_sleep_init (drivers/acpi/bus.c:1478)
[ 1.489879][ T1] ? do_initcall_level (init/main.c:1327)
[ 1.490609][ T1] ? rest_init (init/main.c:1458)
[ 1.491323][ T1] ? do_initcalls (init/main.c:1341)
[ 1.492037][ T1] ? rest_init (init/main.c:1458)
[ 1.492745][ T1] ? do_basic_setup (init/main.c:1364)
[ 1.493510][ T1] ? kernel_init_freeable (init/main.c:1579)
[ 1.494299][ T1] ? kernel_init (init/main.c:1468)
[ 1.494991][ T1] ? ret_from_fork (arch/x86/kernel/process.c:153)
[ 1.495713][ T1] ? ret_from_fork_asm (arch/x86/entry/entry_32.S:737)
[ 1.496483][ T1] ? entry_INT80_32 (arch/x86/entry/entry_32.S:945)
[    1.497262][    T1] irq event stamp: 46823
[ 1.499897][ T1] hardirqs last enabled at (46835): __console_unlock (arch/x86/include/asm/irqflags.h:26 arch/x86/include/asm/irqflags.h:87 arch/x86/include/asm/irqflags.h:147 kernel/printk/printk.c:344 kernel/printk/printk.c:2869)
[ 1.499897][ T1] hardirqs last disabled at (46844): __console_unlock (kernel/printk/printk.c:342)
[ 1.500213][ T1] softirqs last enabled at (46858): __do_softirq (kernel/softirq.c:589)
[ 1.501440][ T1] softirqs last disabled at (46853): __do_softirq (kernel/softirq.c:589)
[    1.502694][    T1] ---[ end trace 0000000000000000 ]---
[    1.503814][    T1] pci 0000:00:00.0: [8086:1237] type 00 class 0x060000 conventional PCI endpoint
[    1.507268][    T1] pci 0000:00:01.0: [8086:7000] type 00 class 0x060100 conventional PCI endpoint
[    1.510876][    T1] pci 0000:00:01.1: [8086:7010] type 00 class 0x010180 conventional PCI endpoint
[    1.514831][    T1] pci 0000:00:01.1: BAR 4 [io  0xc140-0xc14f]
[    1.516807][    T1] pci 0000:00:01.1: BAR 0 [io  0x01f0-0x01f7]: legacy IDE quirk
[    1.519807][    T1] pci 0000:00:01.1: BAR 1 [io  0x03f6]: legacy IDE quirk

The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20241224/[email protected]

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki