/**
  * pci_setup_msi_device_domain - Setup a device MSI interrupt domain
  * @pdev:      The PCI device to create the domain on
+ * @hwsize:    The maximum number of MSI vectors
  *
  * Return:
  *  True when:
  *     - The device is removed
  *     - MSI is disabled and a MSI-X domain is created
  */
-bool pci_setup_msi_device_domain(struct pci_dev *pdev)
+bool pci_setup_msi_device_domain(struct pci_dev *pdev, unsigned int hwsize)
 {
        if (WARN_ON_ONCE(pdev->msix_enabled))
                return false;
        if (pci_match_device_domain(pdev, DOMAIN_BUS_PCI_DEVICE_MSIX))
                msi_remove_device_irq_domain(&pdev->dev, MSI_DEFAULT_DOMAIN);
 
-       return pci_create_device_domain(pdev, &pci_msi_template, 1);
+       return pci_create_device_domain(pdev, &pci_msi_template, hwsize);
 }
 
 /**
 
        if (nvec < minvec)
                return -ENOSPC;
 
-       if (nvec > maxvec)
-               nvec = maxvec;
-
        rc = pci_setup_msi_context(dev);
        if (rc)
                return rc;
 
-       if (!pci_setup_msi_device_domain(dev))
+       if (!pci_setup_msi_device_domain(dev, nvec))
                return -ENODEV;
 
+       if (nvec > maxvec)
+               nvec = maxvec;
+
        for (;;) {
                if (affd) {
                        nvec = irq_calc_affinity_vectors(minvec, nvec, affd);
 
 };
 
 bool pci_msi_domain_supports(struct pci_dev *dev, unsigned int feature_mask, enum support_mode mode);
-bool pci_setup_msi_device_domain(struct pci_dev *pdev);
+bool pci_setup_msi_device_domain(struct pci_dev *pdev, unsigned int hwsize);
 bool pci_setup_msix_device_domain(struct pci_dev *pdev, unsigned int hwsize);
 
 /* Legacy (!IRQDOMAIN) fallbacks */