I have some questions about the sequence of calls to request/free MSI-X interrupt resource on FreeBSD.
I tried "amd64 FreeBSD 13.1" and "amd64 FreeBSD 13.2".
When requesting MSI-X interrupt resource, I tried the following 2 sequences:
*Sequence A:
bus_alloc_resource
pci_msix_count
pci_alloc_msix
bus_setup_intr
*Sequence B:
pci_msix_count
pci_alloc_msix
bus_alloc_resource
bus_setup_intr
When using "Sequence A", I observed bus_alloc_resource FAIL (return NULL pointer).
When using "Sequence B", it works so I choose "Sequence B".
When freeing MSI-X interrupt resource, I tried the following 2 sequences:
*Sequence C:
bus_teardown_intr
pci_release_msi
bus_release_resource
*Sequence D:
bus_teardown_intr
bus_release_resource
pci_release_msi
When using "Sequence C", I observed one system log "Device leaked MSI vectors" when unloading the device driver.
When using "Sequence D", I observed "sudo acpiconf -s 3" is no longer able to suspend system to RAM.
Related man: https://man.freebsd.org/cgi/man.cgi?query=pci_release_msi&sektion=9&manpath=freebsd-release-ports
According to the man, "Sequence A" and "Sequence C" are correct. However, "Sequence A" and "Sequence C" have problems as shown above.
Can advice what is the cause of the problems?
Or is there a workaround solution available?
Thanks in advance.