.chip           = &vmd_msi_controller,
  };
  
 -      vmd->irq_domain = pci_msi_create_irq_domain(fn, &vmd_msi_domain_info,
 -                                                  x86_vector_domain);
+ static int vmd_create_irq_domain(struct vmd_dev *vmd)
+ {
+       struct fwnode_handle *fn;
+ 
+       fn = irq_domain_alloc_named_id_fwnode("VMD-MSI", vmd->sysdata.domain);
+       if (!fn)
+               return -ENODEV;
+ 
++      vmd->irq_domain = pci_msi_create_irq_domain(fn, &vmd_msi_domain_info, NULL);
+       if (!vmd->irq_domain) {
+               irq_domain_free_fwnode(fn);
+               return -ENODEV;
+       }
+ 
+       return 0;
+ }
+ 
+ static void vmd_remove_irq_domain(struct vmd_dev *vmd)
+ {
+       if (vmd->irq_domain) {
+               struct fwnode_handle *fn = vmd->irq_domain->fwnode;
+ 
+               irq_domain_remove(vmd->irq_domain);
+               irq_domain_free_fwnode(fn);
+       }
+ }
+ 
  static char __iomem *vmd_cfg_addr(struct vmd_dev *vmd, struct pci_bus *bus,
                                  unsigned int devfn, int reg, int len)
  {
  
        sd->node = pcibus_to_node(vmd->dev->bus);
  
-       fn = irq_domain_alloc_named_id_fwnode("VMD-MSI", vmd->sysdata.domain);
-       if (!fn)
-               return -ENODEV;
- 
-       vmd->irq_domain = pci_msi_create_irq_domain(fn, &vmd_msi_domain_info,
-                                                   NULL);
- 
-       if (!vmd->irq_domain) {
-               irq_domain_free_fwnode(fn);
-               return -ENODEV;
-       }
+       ret = vmd_create_irq_domain(vmd);
+       if (ret)
+               return ret;
  
 +      /*
 +       * Override the irq domain bus token so the domain can be distinguished
 +       * from a regular PCI/MSI domain.
 +       */
 +      irq_domain_update_bus_token(vmd->irq_domain, DOMAIN_BUS_VMD_MSI);
 +
        pci_add_resource(&resources, &vmd->resources[0]);
        pci_add_resource_offset(&resources, &vmd->resources[1], offset[0]);
        pci_add_resource_offset(&resources, &vmd->resources[2], offset[1]);