iwlwifi: work around reverse dependency on MEI
Subsystems (3)
PATCH 1/1 iwlwifi: work around reverse dependency on MEI
From: Arnd Bergmann <[email protected]>
If the iwlmei code is a loadable module, the main iwlwifi driver cannot be built-in:
x86_64-linux-ld: drivers/net/wireless/intel/iwlwifi/pcie/trans.o: in function `iwl_pcie_prepare_card_hw':
trans.c:(.text+0x4158): undefined reference to `iwl_mei_is_connected'
Unfortunately, Kconfig enforces the opposite, forcing the MEI driver to not be built-in if iwlwifi is a module.
There is no easy way to express the correct dependency in Kconfig, this is the best workaround I could come up with, turning CONFIG_IWLMEI into a 'bool' symbol, and spelling out the exact conditions under which it may be enabled, and then using Makefile logic to ensure it is built-in when iwlwifi is.
A better option would be change iwl_mei_is_connected() so it could be called from iwlwifi regardless of whether the mei driver is reachable, but that requires a larger rework in the driver.
--- drivers/net/wireless/intel/iwlwifi/Kconfig | 6 +++--- drivers/net/wireless/intel/iwlwifi/Makefile | 3 +-- drivers/net/wireless/intel/iwlwifi/mei/Makefile | 4 +++- 3 files changed, 7 insertions(+), 6 deletions(-)
drivers/net/wireless/intel/iwlwifi/Kconfig +3 -3
@@ -93,10 +93,10 @@ config IWLWIFI_BCAST_FILTERING expect incoming broadcasts for their normal operations. config IWLMEI - tristate "Intel Management Engine communication over WLAN" - depends on INTEL_MEI + bool "Intel Management Engine communication over WLAN" + depends on INTEL_MEI=y || INTEL_MEI=IWLMVM + depends on IWLMVM=y || IWLWIFI=m depends on PM - depends on IWLMVM help Enables the iwlmei kernel module.
drivers/net/wireless/intel/iwlwifi/Makefile +1 -2
@@ -29,7 +29,6 @@ iwlwifi-$(CONFIG_IWLWIFI_DEVICE_TRACING) += iwl-devtrace.o ccflags-y += -I$(src) obj-$(CONFIG_IWLDVM) += dvm/ -obj-$(CONFIG_IWLMVM) += mvm/ -obj-$(CONFIG_IWLMEI) += mei/ +obj-$(CONFIG_IWLMVM) += mvm/ mei/ CFLAGS_iwl-devtrace.o := -I$(src)
drivers/net/wireless/intel/iwlwifi/mei/Makefile +3 -1
@@ -1,5 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only -obj-$(CONFIG_IWLMEI) += iwlmei.o +ifdef CONFIG_IWLMEI +obj-$(CONFIG_IWLWIFI) += iwlmei.o +endif iwlmei-y += main.o iwlmei-y += net.o iwlmei-$(CONFIG_IWLWIFI_DEVICE_TRACING) += trace.o
Signature · 1 line
2.29.2
Hi Arend,
Quoted 14 lines
Subject: [PATCH] iwlwifi: work around reverse dependency on MEI
From: Arnd Bergmann <[email protected]>
If the iwlmei code is a loadable module, the main iwlwifi driver cannot be built-in:
x86_64-linux-ld:
drivers/net/wireless/intel/iwlwifi/pcie/trans.o: in function `iwl_pcie_prepare_card_hw':
trans.c:(.text+0x4158): undefined reference to `iwl_mei_is_connected'Unfortunately,
Kconfigenforces the opposite, forcing the MEI driver to not be built-in if iwlwifi is a module.
Quoted 8 lines
There is no easy way to express the correct dependency in
Kconfig, this is the best workaround I could come up with, turningCONFIG_IWLMEIinto a 'bool' symbol, and spelling out the exact conditions under which it may be enabled, and then usingMakefilelogic to ensure it is built-in when iwlwifi is.A better option would be change
iwl_mei_is_connected()so it could be called from iwlwifi regardless of whether the mei driver is reachable, but that requires a larger rework in the driver.
I can try to do that but I don't really see how..
I can't really make a function that would behave differently based on whether the symbol is available or not.
Quoted 16 lines
Signed-off-by Arnd Bergmann <[email protected]>--- drivers/net/wireless/intel/iwlwifi/Kconfig | 6 +++--- drivers/net/wireless/intel/iwlwifi/Makefile | 3 +-- drivers/net/wireless/intel/iwlwifi/mei/Makefile | 4 +++- 3 files changed, 7 insertions(+), 6 deletions(-)drivers/net/wireless/intel/iwlwifi/Kconfig +0
-0@@ -93,10 +93,10 @@ config IWLWIFI_BCAST_FILTERING expect incoming broadcasts for their normal operations.
drivers/net/wireless/intel/iwlwifi/Kconfig config IWLWIFI_BCAST_FILTERING · line 101
Quoted 10 lines
drivers/net/wireless/intel/iwlwifi/Kconfig +3
-3config IWLMEI - tristate "Intel Management Engine communication over WLAN" - depends on INTEL_MEI + bool "Intel Management Engine communication over WLAN" + depends on INTEL_MEI=y || INTEL_MEI=IWLMVM + depends on IWLMVM=y || IWLWIFI=m depends on PM - depends on IWLMVM help Enables the iwlmei kernel module.
Johannes suggested to make IWLMVM depend on IWLMEI || !IWLMEI
That worked as well, I just had issues with this in our internal backport based tree. I need to spend a bit more time on this, but I admit my total ignorance in Kconfig's dialect.
Quoted 31 lines
drivers/net/wireless/intel/iwlwifi/Makefile +1
-2@@ -29,7 +29,6 @@ iwlwifi-$(CONFIG_IWLWIFI_DEVICE_TRACING) += iwl- devtrace.o ccflags-y += -I$(src) obj-$(CONFIG_IWLDVM) += dvm/ -obj-$(CONFIG_IWLMVM) += mvm/ -obj-$(CONFIG_IWLMEI) += mei/ +obj-$(CONFIG_IWLMVM) += mvm/ mei/ CFLAGS_iwl-devtrace.o := -I$(src)drivers/net/wireless/intel/iwlwifi/mei/Makefile +3
-2@@ -1,5 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only -obj-$(CONFIG_IWLMEI) += iwlmei.o +ifdef CONFIG_IWLMEI +obj-$(CONFIG_IWLWIFI) += iwlmei.o +endif iwlmei-y += main.o iwlmei-y += net.o iwlmei-$(CONFIG_IWLWIFI_DEVICE_TRACING) += trace.o --2.29.2
Quoted 6 lines · Emmanuel
Quoted 3 lines
A better option would be change
iwl_mei_is_connected()so it could be called from iwlwifi regardless of whether the mei driver is reachable, but that requires a larger rework in the driver.I can try to do that but I don't really see how..
I can't really make a function that would behave differently based on whether the symbol is available or not.
I meant that this would be an inline function that only accesses variables that are available to the iwlwifi driver already, rather than part of the iwlmei driver.
Part of the problem here is that the current implementation checks a global variable that is part of the iwlmei driver, so there is no easy way for iwlwifi to access it.
Quoted 11 lines
drivers/net/wireless/intel/iwlwifi/Kconfig config IWLWIFI_BCAST_FILTERING · line 101
Quoted 10 lines
config IWLMEI
drivers/net/wireless/intel/iwlwifi/Kconfig +3
-3- tristate "Intel Management Engine communication over WLAN" - depends on INTEL_MEI + bool "Intel Management Engine communication over WLAN" + depends on INTEL_MEI=y || INTEL_MEI=IWLMVM + depends on IWLMVM=y || IWLWIFI=m depends on PM - depends on IWLMVM help Enables the iwlmei kernel module.
Quoted 3 lines
Johannes suggested to make IWLMVM depend on IWLMEI || !IWLMEI
That worked as well, I just had issues with this in our internal backport based tree. I need to spend a bit more time on this, but I admit my total ignorance in Kconfig's dialect.
It's still not enough, the dependency is in iwlwifi, not in iwlmvm, so it would remain broken for IWLWIFI=y IWLMVM=m IWLMEI=m.
One easy solution might be to link all the iwlmei objects intro the main iwlwifi driver, the same way it links in the fw/*.c files.
Arnd
drivers/net/wireless/intel/iwlwifi/Kconfig config IWLWIFI_BCAST_FILTERING · line 98
Quoted 13 lines · Arnd Bergmann
drivers/net/wireless/intel/iwlwifi/Kconfig +3
-2@@ -93,10 +93,10 @@ config IWLWIFI_BCAST_FILTERING expect incoming broadcasts for their normal operations. config IWLMEI - tristate "Intel Management Engine communication over WLAN" - depends on INTEL_MEI + bool "Intel Management Engine communication over WLAN" + depends on INTEL_MEI=y || INTEL_MEI=IWLMVM + depends on IWLMVM=y || IWLWIFI=m
For reference, that line is wrong, and I still see the same problem with my patch
applied. It should work after changing it to
depends on IWLMVM=y || IWLMVM=m
but I'm still testing for further problems.
Arnd
Quoted 11 lines · Arnd Bergmann
Quoted 11 lines
Quoted 10 lines
config IWLMEI
drivers/net/wireless/intel/iwlwifi/Kconfig +3
-3- tristate "Intel Management Engine communication over WLAN" - depends on INTEL_MEI + bool "Intel Management Engine communication over WLAN" + depends on INTEL_MEI=y || INTEL_MEI=IWLMVM + depends on IWLMVM=y || IWLWIFI=m depends on PM - depends on IWLMVM help Enables the iwlmei kernel module.
Quoted 7 lines
Quoted 3 lines
Johannes suggested to make IWLMVM depend on IWLMEI || !IWLMEI
That worked as well, I just had issues with this in our internal backport based tree. I need to spend a bit more time on this, but I admit my total ignorance in Kconfig's dialect.It's still not enough, the dependency is in iwlwifi, not in iwlmvm, so it would remain broken for IWLWIFI=y IWLMVM=m IWLMEI=m.
I missed the pcie/trans.c dependency, and the others are (I think) in mvm...
but then we can do
config IWLWIFI
... depends on IWLMEI || !IWLMEI ...
no? That way, we exclude IWLWIFI=y && IWLMEI=m, which I believe causes the issue? And IWLMVM already depends on IWLWIFI (via the if clause), so that
johannes
Quoted 27 lines · Johannes Berg
Quoted 11 lines · Arnd Bergmann
Quoted 11 lines
Quoted 10 lines
config IWLMEI
drivers/net/wireless/intel/iwlwifi/Kconfig +3
-3- tristate "Intel Management Engine communication over WLAN" - depends on INTEL_MEI + bool "Intel Management Engine communication over WLAN" + depends on INTEL_MEI=y || INTEL_MEI=IWLMVM + depends on IWLMVM=y || IWLWIFI=m depends on PM - depends on IWLMVM help Enables the iwlmei kernel module.Quoted 7 lines
Quoted 3 lines
Johannes suggested to make IWLMVM depend on IWLMEI || !IWLMEI
That worked as well, I just had issues with this in our internal backport based tree. I need to spend a bit more time on this, but I admit my total ignorance in Kconfig's dialect.It's still not enough, the dependency is in iwlwifi, not in iwlmvm, so it would remain broken for IWLWIFI=y IWLMVM=m IWLMEI=m.
I missed the
pcie/trans.cdependency, and the others are (I think) in mvm...but then we can do
Quoted 8 lines
config IWLWIFI
... depends on IWLMEI || !IWLMEI ...no? That way, we exclude IWLWIFI=y && IWLMEI=m, which I believe causes the issue? And IWLMVM already depends on IWLWIFI (via the if clause), so that
Right, that should work. Testing with that version now.
Arnd