pci: Add conftest to determine if msi_get_virq() present

The API msi_get_virq() get added by commit 98043704f375 ("genirq/msi:
Make msi_get_virq() device domain aware") in Linux v6.1. Use
conftest to determine if this API is available or not.

Jira HOSTX-5375

Change-Id: I5e4cef9622d852fc889d9652e6631a79f2d21f9b
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3166766
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Laxman Dewangan
2024-07-02 11:38:19 +00:00
committed by mobile promotions
parent b260a8f442
commit 00a95facef
3 changed files with 21 additions and 4 deletions

View File

@@ -292,7 +292,7 @@ static void pcie_dma_epf_unbind(struct pci_epf *epf)
struct pcie_epf_bar *epf_bar = (struct pcie_epf_bar *)epfnv->bar_virt; struct pcie_epf_bar *epf_bar = (struct pcie_epf_bar *)epfnv->bar_virt;
struct device *cdev = epc->dev.parent; struct device *cdev = epc->dev.parent;
struct platform_device *pdev = of_find_device_by_node(cdev->of_node); struct platform_device *pdev = of_find_device_by_node(cdev->of_node);
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0) #if !defined(NV_MSI_GET_VIRQ_PRESENT) /* Linux v6.1 */
struct msi_desc *desc; struct msi_desc *desc;
#endif #endif
enum pci_barno bar; enum pci_barno bar;
@@ -309,7 +309,7 @@ static void pcie_dma_epf_unbind(struct pci_epf *epf)
#if defined(NV_PLATFORM_MSI_DOMAIN_FREE_IRQS_PRESENT) /* Linux v6.9 */ #if defined(NV_PLATFORM_MSI_DOMAIN_FREE_IRQS_PRESENT) /* Linux v6.9 */
platform_msi_domain_free_irqs(&pdev->dev); platform_msi_domain_free_irqs(&pdev->dev);
#endif #endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) #if defined(NV_MSI_GET_VIRQ_PRESENT) /* Linux v6.1 */
irq = msi_get_virq(&pdev->dev, 0); irq = msi_get_virq(&pdev->dev, 0);
#else #else
for_each_msi_entry(desc, cdev) { for_each_msi_entry(desc, cdev) {
@@ -355,7 +355,7 @@ static int pcie_dma_epf_bind(struct pci_epf *epf)
struct pcie_epf_bar *epf_bar_virt; struct pcie_epf_bar *epf_bar_virt;
struct pci_epf_bar *epf_bar; struct pci_epf_bar *epf_bar;
struct irq_domain *domain; struct irq_domain *domain;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0) #if !defined(NV_MSI_GET_VIRQ_PRESENT) /* Linux v6.1 */
struct msi_desc *desc; struct msi_desc *desc;
#endif #endif
enum pci_barno bar; enum pci_barno bar;
@@ -425,7 +425,7 @@ static int pcie_dma_epf_bind(struct pci_epf *epf)
goto fail_kasnprintf; goto fail_kasnprintf;
} }
#endif #endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) #if defined(NV_MSI_GET_VIRQ_PRESENT) /* Linux v6.1 */
epfnv->edma.msi_irq = msi_get_virq(&pdev->dev, 1); epfnv->edma.msi_irq = msi_get_virq(&pdev->dev, 1);
irq = msi_get_virq(&pdev->dev, 0); irq = msi_get_virq(&pdev->dev, 0);
#else #else

View File

@@ -136,6 +136,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += mii_bus_struct_has_read_c45
NV_CONFTEST_FUNCTION_COMPILE_TESTS += mii_bus_struct_has_write_c45 NV_CONFTEST_FUNCTION_COMPILE_TESTS += mii_bus_struct_has_write_c45
NV_CONFTEST_FUNCTION_COMPILE_TESTS += media_entity_remote_pad NV_CONFTEST_FUNCTION_COMPILE_TESTS += media_entity_remote_pad
NV_CONFTEST_FUNCTION_COMPILE_TESTS += module_import_ns_macro NV_CONFTEST_FUNCTION_COMPILE_TESTS += module_import_ns_macro
NV_CONFTEST_FUNCTION_COMPILE_TESTS += msi_get_virq
NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_set_tso_max_size NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_set_tso_max_size
NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_napi_add_weight NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_napi_add_weight
NV_CONFTEST_FUNCTION_COMPILE_TESTS += of_get_named_gpio_flags NV_CONFTEST_FUNCTION_COMPILE_TESTS += of_get_named_gpio_flags

View File

@@ -1192,6 +1192,22 @@ compile_test() {
compile_check_conftest "$CODE" "NV_MDEV_DRIVER_HAS_SUPPORTED_TYPE_GROUPS" "" "types" compile_check_conftest "$CODE" "NV_MDEV_DRIVER_HAS_SUPPORTED_TYPE_GROUPS" "" "types"
;; ;;
msi_get_virq)
#
# Determine if msi_get_virq() function is present or not
#
# Added by commit 98043704f375 ("genirq/msi: Make msi_get_virq()
# device domain aware") in Linux V6.1
#
CODE="
#include <linux/msi.h>
void conftest_msi_get_virq() {
msi_get_virq();
}"
compile_check_conftest "$CODE" "NV_MSI_GET_VIRQ_PRESENT" "" "functions"
;;
vfio_device_ops_has_dma_unmap) vfio_device_ops_has_dma_unmap)
# #
# Determine if 'vfio_device_ops' struct has 'dma_unmap' field. # Determine if 'vfio_device_ops' struct has 'dma_unmap' field.