Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pci_ivshmem: return back to polling mode when interrupt mode invalid #145

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions drivers/pci/pci_ivshmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,23 +255,26 @@ static int ivshmem_probe(FAR struct pci_device_s *dev)

if (ivdev->vmid != 0 && ivdev->vmid != 1)
{
ret = -EINVAL;
pcierr("Vmid must be 0 or 1\n");
goto err_master;
pciwarn("Vmid=%"PRIu32" not 0/1, use polling mode\n", ivdev->vmid);
ivdev->vmid = IVSHMEM_INVALID_VMID;
goto out;
}

ret = pci_alloc_irq(dev, &ivdev->irq, 1);
if (ret != 1)
{
pcierr("Failed to allocate irq %d\n", ret);
goto err_master;
pciwarn("Failed to allocate irq %d, use polling mode\n", ret);
ivdev->vmid = IVSHMEM_INVALID_VMID;
goto out;
}

ret = pci_connect_irq(dev, &ivdev->irq, 1);
if (ret < 0)
{
pcierr("Failed to connect irq %d\n", ret);
goto err_msi_alloc;
pciwarn("Failed to connect irq %d, use polling mode\n", ret);
pci_release_irq(dev, &ivdev->irq, 1);
ivdev->vmid = IVSHMEM_INVALID_VMID;
goto out;
}

pciinfo("vmid=%" PRIu32 " irq=%d\n", ivdev->vmid, ivdev->irq);
Expand All @@ -281,6 +284,7 @@ static int ivshmem_probe(FAR struct pci_device_s *dev)
ivdev->vmid = IVSHMEM_INVALID_VMID;
}

out:
ret = ivshmem_register_device(ivdev);
if (ret < 0)
{
Expand All @@ -290,8 +294,6 @@ static int ivshmem_probe(FAR struct pci_device_s *dev)
g_ivshmem_next_id++;
return ret;

err_msi_alloc:
pci_release_irq(dev, &ivdev->irq, 1);
err_master:
pci_clear_master(dev);
pci_disable_device(dev);
Expand Down
Loading