[PATCH] x86/of: Don't log error on the missing IO-APIC unconditionally

Roman Kisel posted 1 patch 1 year ago
arch/x86/kernel/devicetree.c | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
[PATCH] x86/of: Don't log error on the missing IO-APIC unconditionally
Posted by Roman Kisel 1 year ago
The x86 OF code reports the missing IO-APIC wihtout any
checks whether the IO-APIC presence is required or not.
That is due to that part of the code being dovetailed to
the Intel MID platform.

Check if the IO-APIC must be available. Log the error only
when the IO-APIC is expected to be present.

Signed-off-by: Roman Kisel <romank@linux.microsoft.com>
---
 arch/x86/kernel/devicetree.c | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c
index 59d23cdf4ed0..5b3b47930d1c 100644
--- a/arch/x86/kernel/devicetree.c
+++ b/arch/x86/kernel/devicetree.c
@@ -47,6 +47,15 @@ static struct of_device_id __initdata ce4100_ids[] = {
 	{},
 };
 
+static bool falconfalls_compatible(void)
+{
+	if (!of_have_populated_dt())
+		return false;
+
+	return of_flat_dt_is_compatible(
+			of_get_flat_dt_root(), "intel,falconfalls");
+}
+
 static int __init add_bus_probe(void)
 {
 	if (!of_have_populated_dt())
@@ -259,12 +268,20 @@ static void __init dtb_ioapic_setup(void)
 
 	for_each_compatible_node(dn, NULL, "intel,ce4100-ioapic")
 		dtb_add_ioapic(dn);
+	if (!nr_ioapics && falconfalls_compatible())
+		pr_err("Error: No information about IO-APIC in OF.\n");
 
-	if (nr_ioapics) {
+	if (nr_ioapics)
 		of_ioapic = 1;
-		return;
-	}
-	pr_err("Error: No information about IO-APIC in OF.\n");
+
+	/*
+	 * At this point, it might so happen that no IO-APIC has been discovered.
+	 *
+	 * A general assumption would be that most x86 boards have IO-APIC,
+	 * yet that is not something the kernel should report as a firmware
+	 * bug unconditionally as there are setups (VMs would be an easy example)
+	 * that are able to employ other means of interrupt routing.
+	 */
 }
 #else
 static void __init dtb_ioapic_setup(void) {}

base-commit: eea6e4b4dfb8859446177c32961c96726d0117be
-- 
2.34.1
Re: [PATCH] x86/of: Don't log error on the missing IO-APIC unconditionally
Posted by kernel test robot 1 year ago
Hi Roman,

kernel test robot noticed the following build warnings:

[auto build test WARNING on eea6e4b4dfb8859446177c32961c96726d0117be]

url:    https://github.com/intel-lab-lkp/linux/commits/Roman-Kisel/x86-of-Don-t-log-error-on-the-missing-IO-APIC-unconditionally/20250110-024320
base:   eea6e4b4dfb8859446177c32961c96726d0117be
patch link:    https://lore.kernel.org/r/20250109184015.1674388-1-romank%40linux.microsoft.com
patch subject: [PATCH] x86/of: Don't log error on the missing IO-APIC unconditionally
config: i386-randconfig-004-20250111 (https://download.01.org/0day-ci/archive/20250111/202501110358.e3qQDC6q-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250111/202501110358.e3qQDC6q-lkp@intel.com/reproduce)

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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501110358.e3qQDC6q-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> arch/x86/kernel/devicetree.c:50:13: warning: 'falconfalls_compatible' defined but not used [-Wunused-function]
      50 | static bool falconfalls_compatible(void)
         |             ^~~~~~~~~~~~~~~~~~~~~~


vim +/falconfalls_compatible +50 arch/x86/kernel/devicetree.c

    49	
  > 50	static bool falconfalls_compatible(void)
    51	{
    52		if (!of_have_populated_dt())
    53			return false;
    54	
    55		return of_flat_dt_is_compatible(
    56				of_get_flat_dt_root(), "intel,falconfalls");
    57	}
    58	

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