Skip to contentSkip to conversation

cdx: don't select CONFIG_GENERIC_MSI_IRQ

PATCH In review Arnd Bergmann 5 participants 5 messages Aug 5, 2025 – Aug 11, 2025 AMD cdx bus driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cdx: don't select CONFIG_GENERIC_MSI_IRQ

From: Arnd Bergmann <[email protected]>

x86 does not use CONFIG_GENERIC_MSI_IRQ, and trying to enable it anyway results in a build failure:

In file included from include/linux/ssb/ssb.h:10,
from drivers/ssb/pcihost_wrapper.c:18:
include/linux/gpio/driver.h:41:33: error: field 'msiinfo' has incomplete type

   41 |         msi_alloc_info_t        msiinfo;
      |                                 ^~~~~~~
In file included from include/linux/kvm_host.h:19,
                 from arch/x86/events/intel/core.c:17:

include/linux/msi.h:528:33: error: field 'alloc_info' has incomplete type
528 | msi_alloc_info_t alloc_info;

Change the driver to actually build without this symbol and remove the incorrect 'select' statements.

---
 drivers/cdx/Kconfig                     | 1 -
 drivers/cdx/cdx.c                       | 2 +-
 drivers/cdx/controller/Kconfig          | 1 -
 drivers/cdx/controller/cdx_controller.c | 3 ++-
 4 files changed, 3 insertions(+), 4 deletions(-)
drivers/cdx/Kconfig +0 -1
index 3af41f51cf38..1f1e360507d7 100644
@@ -8,7 +8,6 @@
 config CDX_BUS
 	bool "CDX Bus driver"
 	depends on OF && ARM64 || COMPILE_TEST
-	select GENERIC_MSI_IRQ
 	help
 	  Driver to enable Composable DMA Transfer(CDX) Bus. CDX bus
 	  exposes Fabric devices which uses composable DMA IP to the
drivers/cdx/cdx.c +1 -1
index 092306ca2541..1a5c95ba09ba 100644
@@ -310,7 +310,7 @@ static int cdx_probe(struct device *dev)
 	 * Setup MSI device data so that generic MSI alloc/free can
 	 * be used by the device driver.
 	 */
-	if (cdx->msi_domain) {
+	if (IS_ENABLED(CONFIG_GENERIC_MSI_IRQ) && cdx->msi_domain) {
 		error = msi_setup_device_data(&cdx_dev->dev);
 		if (error)
 			return error;
drivers/cdx/controller/Kconfig +0 -1
index 0641a4c21e66..a480b62cbd1f 100644
@@ -10,7 +10,6 @@ if CDX_BUS
 config CDX_CONTROLLER
 	tristate "CDX bus controller"
 	depends on HAS_DMA
-	select GENERIC_MSI_IRQ
 	select REMOTEPROC
 	select RPMSG
 	help
drivers/cdx/controller/cdx_controller.c +2 -1
index fca83141e3e6..5e3fd89b6b56 100644
@@ -193,7 +193,8 @@ static int xlnx_cdx_probe(struct platform_device *pdev)
 	cdx->ops = &cdx_ops;
 
 	/* Create MSI domain */
-	cdx->msi_domain = cdx_msi_domain_init(&pdev->dev);
+	if (IS_ENABLED(CONFIG_GENERIC_MSI_IRQ))
+		cdx->msi_domain = cdx_msi_domain_init(&pdev->dev);
 	if (!cdx->msi_domain) {
 		ret = dev_err_probe(&pdev->dev, -ENODEV, "cdx_msi_domain_init() failed");
 		goto cdx_msi_fail;
Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 12 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

x86 does not use CONFIG_GENERIC_MSI_IRQ, and trying to enable it anyway results in a build failure:

In file included from include/linux/ssb/ssb.h:10,
from drivers/ssb/pcihost_wrapper.c:18:
include/linux/gpio/driver.h:41:33: error: field 'msiinfo' has incomplete type

    41 |         msi_alloc_info_t        msiinfo;
       |                                 ^~~~~~~
In file included from include/linux/kvm_host.h:19,
                  from arch/x86/events/intel/core.c:17:
Quoted 5 lines

include/linux/msi.h:528:33: error: field 'alloc_info' has incomplete type
528 | msi_alloc_info_t alloc_info;

Change the driver to actually build without this symbol and remove the incorrect 'select' statements.

Looks OK to me, the Makefile is clearly trying to support building without this force-enabled anyway. In fact I'd go as far as saying that this also deserves a

Fixes e8b18c11731d ("cdx: Fix missing GENERIC_MSI_IRQ on compile test")

And FWIW,

Quoted 59 lines
---
  drivers/cdx/Kconfig                     | 1 -
  drivers/cdx/cdx.c                       | 2 +-
  drivers/cdx/controller/Kconfig          | 1 -
  drivers/cdx/controller/cdx_controller.c | 3 ++-
  4 files changed, 3 insertions(+), 4 deletions(-)
drivers/cdx/Kconfig +0 -1
index 3af41f51cf38..1f1e360507d7 100644
@@ -8,7 +8,6 @@
  config CDX_BUS
  	bool "CDX Bus driver"
  	depends on OF && ARM64 || COMPILE_TEST
-	select GENERIC_MSI_IRQ
  	help
  	  Driver to enable Composable DMA Transfer(CDX) Bus. CDX bus
  	  exposes Fabric devices which uses composable DMA IP to the
drivers/cdx/cdx.c +1 -1
index 092306ca2541..1a5c95ba09ba 100644
@@ -310,7 +310,7 @@ static int cdx_probe(struct device *dev)
  	 * Setup MSI device data so that generic MSI alloc/free can
  	 * be used by the device driver.
  	 */
-	if (cdx->msi_domain) {
+	if (IS_ENABLED(CONFIG_GENERIC_MSI_IRQ) && cdx->msi_domain) {
  		error = msi_setup_device_data(&cdx_dev->dev);
  		if (error)
  			return error;
drivers/cdx/controller/Kconfig +0 -1
index 0641a4c21e66..a480b62cbd1f 100644
@@ -10,7 +10,6 @@ if CDX_BUS
  config CDX_CONTROLLER
  	tristate "CDX bus controller"
  	depends on HAS_DMA
-	select GENERIC_MSI_IRQ
  	select REMOTEPROC
  	select RPMSG
  	help
drivers/cdx/controller/cdx_controller.c +2 -1
index fca83141e3e6..5e3fd89b6b56 100644
@@ -193,7 +193,8 @@ static int xlnx_cdx_probe(struct platform_device *pdev)
  	cdx->ops = &cdx_ops;
 
  	/* Create MSI domain */
-	cdx->msi_domain = cdx_msi_domain_init(&pdev->dev);
+	if (IS_ENABLED(CONFIG_GENERIC_MSI_IRQ))
+		cdx->msi_domain = cdx_msi_domain_init(&pdev->dev);
  	if (!cdx->msi_domain) {
  		ret = dev_err_probe(&pdev->dev, -ENODEV, "cdx_msi_domain_init() failed");
  		goto cdx_msi_fail;
#2 lore raw
In reply to Arnd Bergmann
Quoted 12 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

x86 does not use CONFIG_GENERIC_MSI_IRQ, and trying to enable it anyway results in a build failure:

In file included from include/linux/ssb/ssb.h:10,
from drivers/ssb/pcihost_wrapper.c:18:
include/linux/gpio/driver.h:41:33: error: field 'msiinfo' has incomplete type

   41 |         msi_alloc_info_t        msiinfo;
      |                                 ^~~~~~~
In file included from include/linux/kvm_host.h:19,
                 from arch/x86/events/intel/core.c:17:
Quoted 6 lines

include/linux/msi.h:528:33: error: field 'alloc_info' has incomplete type
528 | msi_alloc_info_t alloc_info;

Change the driver to actually build without this symbol and remove the incorrect 'select' statements.

Maybe also original reported-by credits?
https://lore.kernel.org/all/[email protected]/

And cc-stable and fixes.

I started working on this and had similar fix, but then I got impression the CDX people will fix that:

https://lore.kernel.org/all/BL1PR12MB5333449243C7FE258728C8E39D5EA@BL1PR12MB5333.namprd12.prod.outlook.com/

so I stopped working.

Shall CDX maintainers entry be changed to Odd Fixes?

Best regards,
Krzysztof

#3 lore raw
In reply to Arnd Bergmann
kernel test robot noticed the following build errors:

Hi Arnd,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on next-20250806]
[cannot apply to soc/for-next v6.16]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Arnd-Bergmann/cdx-don-t-select-CONFIG_GENERIC_MSI_IRQ/20250806-121343
base:   linus/master
patch link:    https://lore.kernel.org/r/20250805161059.4006484-1-arnd%40kernel.org
patch subject: [PATCH] cdx: don't select CONFIG_GENERIC_MSI_IRQ
config: hexagon-randconfig-002-20250807 (https://download.01.org/0day-ci/archive/20250807/[email protected]/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 7b8dea265e72c3037b6b1e54d5ab51b7e14f328b)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250807/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> drivers/vfio/cdx/intr.c:41:8: error: call to undeclared function 'msi_domain_alloc_irqs'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      41 |         ret = msi_domain_alloc_irqs(dev, MSI_DEFAULT_DOMAIN, nvec);
         |               ^
   drivers/vfio/cdx/intr.c:41:8: note: did you mean 'msi_domain_get_virq'?
   include/linux/msi_api.h:58:14: note: 'msi_domain_get_virq' declared here
      58 | unsigned int msi_domain_get_virq(struct device *dev, unsigned int domid, unsigned int index);
         |              ^
>> drivers/vfio/cdx/intr.c:135:2: error: call to undeclared function 'msi_domain_free_irqs_all'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     135 |         msi_domain_free_irqs_all(dev, MSI_DEFAULT_DOMAIN);
         |         ^

2 errors generated.

vim +/msi_domain_alloc_irqs +41 drivers/vfio/cdx/intr.c

848e447e000c418 Nipun Gupta 2024-04-23   23  
848e447e000c418 Nipun Gupta 2024-04-23   24  static int vfio_cdx_msi_enable(struct vfio_cdx_device *vdev, int nvec)
848e447e000c418 Nipun Gupta 2024-04-23   25  {
848e447e000c418 Nipun Gupta 2024-04-23   26  	struct cdx_device *cdx_dev = to_cdx_device(vdev->vdev.dev);
848e447e000c418 Nipun Gupta 2024-04-23   27  	struct device *dev = vdev->vdev.dev;
848e447e000c418 Nipun Gupta 2024-04-23   28  	int msi_idx, ret;
848e447e000c418 Nipun Gupta 2024-04-23   29  
848e447e000c418 Nipun Gupta 2024-04-23   30  	vdev->cdx_irqs = kcalloc(nvec, sizeof(struct vfio_cdx_irq), GFP_KERNEL);
848e447e000c418 Nipun Gupta 2024-04-23   31  	if (!vdev->cdx_irqs)
848e447e000c418 Nipun Gupta 2024-04-23   32  		return -ENOMEM;
848e447e000c418 Nipun Gupta 2024-04-23   33  
848e447e000c418 Nipun Gupta 2024-04-23   34  	ret = cdx_enable_msi(cdx_dev);
848e447e000c418 Nipun Gupta 2024-04-23   35  	if (ret) {
848e447e000c418 Nipun Gupta 2024-04-23   36  		kfree(vdev->cdx_irqs);
848e447e000c418 Nipun Gupta 2024-04-23   37  		return ret;
848e447e000c418 Nipun Gupta 2024-04-23   38  	}
848e447e000c418 Nipun Gupta 2024-04-23   39  
848e447e000c418 Nipun Gupta 2024-04-23   40  	/* Allocate cdx MSIs */
848e447e000c418 Nipun Gupta 2024-04-23  @41  	ret = msi_domain_alloc_irqs(dev, MSI_DEFAULT_DOMAIN, nvec);
848e447e000c418 Nipun Gupta 2024-04-23   42  	if (ret) {
848e447e000c418 Nipun Gupta 2024-04-23   43  		cdx_disable_msi(cdx_dev);
848e447e000c418 Nipun Gupta 2024-04-23   44  		kfree(vdev->cdx_irqs);
848e447e000c418 Nipun Gupta 2024-04-23   45  		return ret;
848e447e000c418 Nipun Gupta 2024-04-23   46  	}
848e447e000c418 Nipun Gupta 2024-04-23   47  
848e447e000c418 Nipun Gupta 2024-04-23   48  	for (msi_idx = 0; msi_idx < nvec; msi_idx++)
848e447e000c418 Nipun Gupta 2024-04-23   49  		vdev->cdx_irqs[msi_idx].irq_no = msi_get_virq(dev, msi_idx);
848e447e000c418 Nipun Gupta 2024-04-23   50  
848e447e000c418 Nipun Gupta 2024-04-23   51  	vdev->msi_count = nvec;
848e447e000c418 Nipun Gupta 2024-04-23   52  	vdev->config_msi = 1;
848e447e000c418 Nipun Gupta 2024-04-23   53  
848e447e000c418 Nipun Gupta 2024-04-23   54  	return 0;
848e447e000c418 Nipun Gupta 2024-04-23   55  }
848e447e000c418 Nipun Gupta 2024-04-23   56  
848e447e000c418 Nipun Gupta 2024-04-23   57  static int vfio_cdx_msi_set_vector_signal(struct vfio_cdx_device *vdev,
848e447e000c418 Nipun Gupta 2024-04-23   58  					  int vector, int fd)
848e447e000c418 Nipun Gupta 2024-04-23   59  {
848e447e000c418 Nipun Gupta 2024-04-23   60  	struct eventfd_ctx *trigger;
848e447e000c418 Nipun Gupta 2024-04-23   61  	int irq_no, ret;
848e447e000c418 Nipun Gupta 2024-04-23   62  
848e447e000c418 Nipun Gupta 2024-04-23   63  	if (vector < 0 || vector >= vdev->msi_count)
848e447e000c418 Nipun Gupta 2024-04-23   64  		return -EINVAL;
848e447e000c418 Nipun Gupta 2024-04-23   65  
848e447e000c418 Nipun Gupta 2024-04-23   66  	irq_no = vdev->cdx_irqs[vector].irq_no;
848e447e000c418 Nipun Gupta 2024-04-23   67  
848e447e000c418 Nipun Gupta 2024-04-23   68  	if (vdev->cdx_irqs[vector].trigger) {
848e447e000c418 Nipun Gupta 2024-04-23   69  		free_irq(irq_no, vdev->cdx_irqs[vector].trigger);
848e447e000c418 Nipun Gupta 2024-04-23   70  		kfree(vdev->cdx_irqs[vector].name);
848e447e000c418 Nipun Gupta 2024-04-23   71  		eventfd_ctx_put(vdev->cdx_irqs[vector].trigger);
848e447e000c418 Nipun Gupta 2024-04-23   72  		vdev->cdx_irqs[vector].trigger = NULL;
848e447e000c418 Nipun Gupta 2024-04-23   73  	}
848e447e000c418 Nipun Gupta 2024-04-23   74  
848e447e000c418 Nipun Gupta 2024-04-23   75  	if (fd < 0)
848e447e000c418 Nipun Gupta 2024-04-23   76  		return 0;
848e447e000c418 Nipun Gupta 2024-04-23   77  
848e447e000c418 Nipun Gupta 2024-04-23   78  	vdev->cdx_irqs[vector].name = kasprintf(GFP_KERNEL, "vfio-msi[%d](%s)",
848e447e000c418 Nipun Gupta 2024-04-23   79  						vector, dev_name(vdev->vdev.dev));
848e447e000c418 Nipun Gupta 2024-04-23   80  	if (!vdev->cdx_irqs[vector].name)
848e447e000c418 Nipun Gupta 2024-04-23   81  		return -ENOMEM;
848e447e000c418 Nipun Gupta 2024-04-23   82  
848e447e000c418 Nipun Gupta 2024-04-23   83  	trigger = eventfd_ctx_fdget(fd);
848e447e000c418 Nipun Gupta 2024-04-23   84  	if (IS_ERR(trigger)) {
848e447e000c418 Nipun Gupta 2024-04-23   85  		kfree(vdev->cdx_irqs[vector].name);
848e447e000c418 Nipun Gupta 2024-04-23   86  		return PTR_ERR(trigger);
848e447e000c418 Nipun Gupta 2024-04-23   87  	}
848e447e000c418 Nipun Gupta 2024-04-23   88  
848e447e000c418 Nipun Gupta 2024-04-23   89  	ret = request_irq(irq_no, vfio_cdx_msihandler, 0,
848e447e000c418 Nipun Gupta 2024-04-23   90  			  vdev->cdx_irqs[vector].name, trigger);
848e447e000c418 Nipun Gupta 2024-04-23   91  	if (ret) {
848e447e000c418 Nipun Gupta 2024-04-23   92  		kfree(vdev->cdx_irqs[vector].name);
848e447e000c418 Nipun Gupta 2024-04-23   93  		eventfd_ctx_put(trigger);
848e447e000c418 Nipun Gupta 2024-04-23   94  		return ret;
848e447e000c418 Nipun Gupta 2024-04-23   95  	}
848e447e000c418 Nipun Gupta 2024-04-23   96  
848e447e000c418 Nipun Gupta 2024-04-23   97  	vdev->cdx_irqs[vector].trigger = trigger;
848e447e000c418 Nipun Gupta 2024-04-23   98  
848e447e000c418 Nipun Gupta 2024-04-23   99  	return 0;
848e447e000c418 Nipun Gupta 2024-04-23  100  }
848e447e000c418 Nipun Gupta 2024-04-23  101  
848e447e000c418 Nipun Gupta 2024-04-23  102  static int vfio_cdx_msi_set_block(struct vfio_cdx_device *vdev,
848e447e000c418 Nipun Gupta 2024-04-23  103  				  unsigned int start, unsigned int count,
848e447e000c418 Nipun Gupta 2024-04-23  104  				  int32_t *fds)
848e447e000c418 Nipun Gupta 2024-04-23  105  {
848e447e000c418 Nipun Gupta 2024-04-23  106  	int i, j, ret = 0;
848e447e000c418 Nipun Gupta 2024-04-23  107  
848e447e000c418 Nipun Gupta 2024-04-23  108  	if (start >= vdev->msi_count || start + count > vdev->msi_count)
848e447e000c418 Nipun Gupta 2024-04-23  109  		return -EINVAL;
848e447e000c418 Nipun Gupta 2024-04-23  110  
848e447e000c418 Nipun Gupta 2024-04-23  111  	for (i = 0, j = start; i < count && !ret; i++, j++) {
848e447e000c418 Nipun Gupta 2024-04-23  112  		int fd = fds ? fds[i] : -1;
848e447e000c418 Nipun Gupta 2024-04-23  113  
848e447e000c418 Nipun Gupta 2024-04-23  114  		ret = vfio_cdx_msi_set_vector_signal(vdev, j, fd);
848e447e000c418 Nipun Gupta 2024-04-23  115  	}
848e447e000c418 Nipun Gupta 2024-04-23  116  
848e447e000c418 Nipun Gupta 2024-04-23  117  	if (ret) {
848e447e000c418 Nipun Gupta 2024-04-23  118  		for (--j; j >= (int)start; j--)
848e447e000c418 Nipun Gupta 2024-04-23  119  			vfio_cdx_msi_set_vector_signal(vdev, j, -1);
848e447e000c418 Nipun Gupta 2024-04-23  120  	}
848e447e000c418 Nipun Gupta 2024-04-23  121  
848e447e000c418 Nipun Gupta 2024-04-23  122  	return ret;
848e447e000c418 Nipun Gupta 2024-04-23  123  }
848e447e000c418 Nipun Gupta 2024-04-23  124  
848e447e000c418 Nipun Gupta 2024-04-23  125  static void vfio_cdx_msi_disable(struct vfio_cdx_device *vdev)
848e447e000c418 Nipun Gupta 2024-04-23  126  {
848e447e000c418 Nipun Gupta 2024-04-23  127  	struct cdx_device *cdx_dev = to_cdx_device(vdev->vdev.dev);
848e447e000c418 Nipun Gupta 2024-04-23  128  	struct device *dev = vdev->vdev.dev;
848e447e000c418 Nipun Gupta 2024-04-23  129  
848e447e000c418 Nipun Gupta 2024-04-23  130  	vfio_cdx_msi_set_block(vdev, 0, vdev->msi_count, NULL);
848e447e000c418 Nipun Gupta 2024-04-23  131  
848e447e000c418 Nipun Gupta 2024-04-23  132  	if (!vdev->config_msi)
848e447e000c418 Nipun Gupta 2024-04-23  133  		return;
848e447e000c418 Nipun Gupta 2024-04-23  134  
848e447e000c418 Nipun Gupta 2024-04-23 @135  	msi_domain_free_irqs_all(dev, MSI_DEFAULT_DOMAIN);
848e447e000c418 Nipun Gupta 2024-04-23  136  	cdx_disable_msi(cdx_dev);
848e447e000c418 Nipun Gupta 2024-04-23  137  	kfree(vdev->cdx_irqs);
848e447e000c418 Nipun Gupta 2024-04-23  138  
848e447e000c418 Nipun Gupta 2024-04-23  139  	vdev->cdx_irqs = NULL;
848e447e000c418 Nipun Gupta 2024-04-23  140  	vdev->msi_count = 0;
848e447e000c418 Nipun Gupta 2024-04-23  141  	vdev->config_msi = 0;
848e447e000c418 Nipun Gupta 2024-04-23  142  }
848e447e000c418 Nipun Gupta 2024-04-23  143  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
maintainer
#4 lore raw
In reply to Arnd Bergmann
Quoted 29 lines

-----Original Message-----
From: Arnd Bergmann <[email protected]>
Sent: Tuesday, August 5, 2025 9:41 PM
To: Gupta, Nipun <[email protected]>; Agarwal, Nikhil <[email protected]>
Cc: Thomas Gleixner <[email protected]>; Marc Zyngier <[email protected]>; Arnd Bergmann <[email protected]>; Krzysztof Kozlowski <[email protected]>; Greg Kroah-Hartman <[email protected]>; Thomas Weißschuu <[email protected]>; Qiu- ji Chen <[email protected]>; Peter Zijlstra <[email protected]>; Rob Herring (Arm) <[email protected]>; Robin Murphy <[email protected]>; Gangurde, Abhijit <[email protected]>; Nathan Chancellor <[email protected]>; [email protected]
Subject: [PATCH] cdx: don't select CONFIG_GENERIC_MSI_IRQ

From: Arnd Bergmann <[email protected]>

x86 does not use CONFIG_GENERIC_MSI_IRQ, and trying to enable it anyway results in a build failure:

In file included from include/linux/ssb/ssb.h:10,
from drivers/ssb/pcihost_wrapper.c:18:
include/linux/gpio/driver.h:41:33: error: field 'msiinfo' has incomplete type

   41 |         msi_alloc_info_t        msiinfo;
      |                                 ^~~~~~~
In file included from include/linux/kvm_host.h:19,
                 from arch/x86/events/intel/core.c:17:
Quoted 7 lines

include/linux/msi.h:528:33: error: field 'alloc_info' has incomplete type
528 | msi_alloc_info_t alloc_info;

Change the driver to actually build without this symbol and remove the incorrect 'select' statements.

This change looks fine, but a similar change would be needed in vfio-cdx as well, to compile without CONFIG_GENERIC_MSI_IRQ as reported by kernel test robot. Do you want me to do that patch or will you be updating this?