Skip to contentSkip to conversation

firmware: arm_scmi: fix VIRTIO dependency

PATCH Applied Arnd Bergmann 2 participants 4 messages Sep 20, 2021 System control & power/management interface (SCPI/SCMI) Message Protocol drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 firmware: arm_scmi: fix VIRTIO dependency

From: Arnd Bergmann <[email protected]>

Building with CONFIG_VIRTIO=m but CONFIG_ARM_SCMI_PROTOCOL=y leads to a link error for the scmi virtio transport:

arm-linux-gnueabi-ld: drivers/firmware/arm_scmi/virtio.o: in function `virtio_send_message':
virtio.c:(.text+0x200): undefined reference to `virtqueue_add_sgs'
arm-linux-gnueabi-ld: virtio.c:(.text+0x280): undefined reference to `virtqueue_kick'
arm-linux-gnueabi-ld: drivers/firmware/arm_scmi/virtio.o: in function `scmi_vio_feed_vq_rx':
virtio.c:(.text+0x390): undefined reference to `virtqueue_add_inbuf'
arm-linux-gnueabi-ld: virtio.c:(.text+0x3dc): undefined reference to `virtqueue_kick'
arm-linux-gnueabi-ld: drivers/firmware/arm_scmi/virtio.o: in function `virtio_scmi_exit':
virtio.c:(.text+0x538): undefined reference to `unregister_virtio_driver'
arm-linux-gnueabi-ld: drivers/firmware/arm_scmi/virtio.o: in function `virtio_chan_available':

Prevent this configuration by making the Kconfig dependency a bit stricter.

Fixes 46abe13b5e3d ("firmware: arm_scmi: Add virtio transport")
---
 drivers/firmware/arm_scmi/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/arm_scmi/Kconfig +1 -1
index 7f4d2435503b..3d7081e84853 100644
@@ -68,7 +68,7 @@ config ARM_SCMI_TRANSPORT_SMC
 
 config ARM_SCMI_TRANSPORT_VIRTIO
 	bool "SCMI transport based on VirtIO"
-	depends on VIRTIO
+	depends on VIRTIO=y || VIRTIO=ARM_SCMI_PROTOCOL
 	select ARM_SCMI_HAVE_TRANSPORT
 	select ARM_SCMI_HAVE_MSG
 	help
Signature · 1 line
2.29.2
#1 lore raw

PATCH 2/2 firmware: arm_scmi: remove __exit annotation

From: Arnd Bergmann <[email protected]>

virtio_scmi_exit() is only called from __exit function, so the annotation is correct, but when the driver is built-in, the section gets discarded and the reference from a callback pointer causes a link-time error:

virtio_scmi_exit' referenced in section .rodata' of drivers/firmware/arm_scmi/virtio.o: defined in discarded section `.exit.text' of drivers/firmware/arm_scmi/virtio.o

I could not figure out a better workaround, so let's just remove that annotation even if it wastes a couple of bytes in .text.

Fixes 46abe13b5e3d ("firmware: arm_scmi: Add virtio transport")
---
 drivers/firmware/arm_scmi/virtio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/arm_scmi/virtio.c +1 -1
index 224577f86928..8941bb40f2df 100644
@@ -476,7 +476,7 @@ static int __init virtio_scmi_init(void)
 	return register_virtio_driver(&virtio_scmi_driver);
 }
 
-static void __exit virtio_scmi_exit(void)
+static void virtio_scmi_exit(void)
 {
 	unregister_virtio_driver(&virtio_scmi_driver);
 }
Signature · 1 line
2.29.2
Applied
#2 lore raw

Re: [PATCH 2/2] firmware: arm_scmi: remove __exit annotation

Quoted 11 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

virtio_scmi_exit() is only called from __exit function, so the annotation is correct, but when the driver is built-in, the section gets discarded and the reference from a callback pointer causes a link-time error:

virtio_scmi_exit' referenced in section .rodata' of drivers/firmware/arm_scmi/virtio.o: defined in discarded section `.exit.text' of drivers/firmware/arm_scmi/virtio.o

I could not figure out a better workaround, so let's just remove that annotation even if it wastes a couple of bytes in .text.

[...]

Applied to sudeep.holla/linux (for-next/scmi), thanks!

[2/2] firmware: arm_scmi: remove __exit annotation

      https://git.kernel.org/sudeep.holla/c/1cd73200da

--
Regards,
Sudeep

#3 lore raw
In reply to Arnd Bergmann
Quoted 15 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Building with CONFIG_VIRTIO=m but CONFIG_ARM_SCMI_PROTOCOL=y leads to a link error for the scmi virtio transport:

arm-linux-gnueabi-ld: drivers/firmware/arm_scmi/virtio.o: in function `virtio_send_message':
virtio.c:(.text+0x200): undefined reference to `virtqueue_add_sgs'
arm-linux-gnueabi-ld: virtio.c:(.text+0x280): undefined reference to `virtqueue_kick'
arm-linux-gnueabi-ld: drivers/firmware/arm_scmi/virtio.o: in function `scmi_vio_feed_vq_rx':
virtio.c:(.text+0x390): undefined reference to `virtqueue_add_inbuf'
arm-linux-gnueabi-ld: virtio.c:(.text+0x3dc): undefined reference to `virtqueue_kick'
arm-linux-gnueabi-ld: drivers/firmware/arm_scmi/virtio.o: in function `virtio_scmi_exit':
virtio.c:(.text+0x538): undefined reference to `unregister_virtio_driver'
arm-linux-gnueabi-ld: drivers/firmware/arm_scmi/virtio.o: in function `virtio_chan_available':

Quoted 9 lines

Prevent this configuration by making the Kconfig dependency a bit stricter.

Fixes 46abe13b5e3d ("firmware: arm_scmi: Add virtio transport")
---
 drivers/firmware/arm_scmi/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Hi Arnd,

I have already queued similar fix by Cristain[1] a while ago. I was waiting to get other possible fixes sorted before sending pull request. Sorry for that, will do that soon.

Signature · 4 lines
Regards,
Sudeep

[1] https://lore.kernel.org/all/[email protected]/