Changeset 85698 in vbox for trunk/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c
- Timestamp:
- Aug 11, 2020 5:05:29 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c
r83471 r85698 48 48 # include <linux/intel-iommu.h> 49 49 # include <linux/pci.h> 50 # if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1,0) && \51 ( LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 41) || LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0,0))50 # if RTLNX_VER_MAX(3,1,0) && \ 51 (RTLNX_VER_MAX(2,6,41) || RTLNX_VER_MIN(3,0,0)) 52 52 # include <asm/amd_iommu.h> 53 53 # else 54 54 # include <linux/amd-iommu.h> 55 55 # endif 56 # if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2,0)56 # if RTLNX_VER_MAX(3,2,0) 57 57 # define IOMMU_PRESENT() iommu_found() 58 58 # define IOMMU_DOMAIN_ALLOC() iommu_domain_alloc() … … 87 87 88 88 89 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,20)89 #if RTLNX_VER_MIN(2,6,20) 90 90 # define PCI_DEV_GET(v,d,p) pci_get_device(v,d,p) 91 91 # define PCI_DEV_PUT(x) pci_dev_put(x) 92 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17,0)92 #if RTLNX_VER_MIN(4,17,0) 93 93 /* assume the domain number to be zero - exactly the same assumption of 94 94 * pci_get_bus_and_slot() … … 165 165 if (request_module(PCI_STUB_MODULE) == 0) 166 166 { 167 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,30)167 # if RTLNX_VER_MIN(2,6,30) 168 168 /* find_module() is static before Linux 2.6.30 */ 169 169 mutex_lock(&module_mutex); … … 320 320 if (RT_LIKELY(pIns->pPciDev)) 321 321 { 322 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,28)322 #if RTLNX_VER_MIN(2,6,28) 323 323 if (pci_reset_function(pIns->pPciDev)) 324 324 { … … 374 374 fs_save = get_fs(); 375 375 set_fs(KERNEL_DS); 376 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14,0)376 #if RTLNX_VER_MIN(4,14,0) 377 377 ret = kernel_write(file, data, size, &offset); 378 378 #else … … 448 448 int iCmdLen; 449 449 const int cMaxBuf = 128; 450 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,29)450 #if RTLNX_VER_MIN(2,6,29) 451 451 const struct cred *pOldCreds; 452 452 struct cred *pNewCreds; … … 469 469 470 470 /* Somewhat ugly hack - override current credentials */ 471 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,29)471 #if RTLNX_VER_MIN(2,6,29) 472 472 pNewCreds = prepare_creds(); 473 473 if (!pNewCreds) 474 474 goto done; 475 475 476 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5,0)476 # if RTLNX_VER_MIN(3,5,0) 477 477 pNewCreds->fsuid = GLOBAL_ROOT_UID; 478 478 # else … … 533 533 printk(KERN_DEBUG "vboxpci: cannot open %s\n", szFileBuf); 534 534 535 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,29)535 #if RTLNX_VER_MIN(2,6,29) 536 536 revert_creds(pOldCreds); 537 537 put_cred(pNewCreds); … … 560 560 int iCmdLen; 561 561 const int cMaxBuf = 128; 562 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,29)562 #if RTLNX_VER_MIN(2,6,29) 563 563 const struct cred *pOldCreds; 564 564 struct cred *pNewCreds; … … 586 586 587 587 /* Somewhat ugly hack - override current credentials */ 588 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,29)588 #if RTLNX_VER_MIN(2,6,29) 589 589 pNewCreds = prepare_creds(); 590 590 if (!pNewCreds) 591 591 goto done; 592 592 593 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5,0)593 # if RTLNX_VER_MIN(3,5,0) 594 594 pNewCreds->fsuid = GLOBAL_ROOT_UID; 595 595 # else … … 627 627 printk(KERN_DEBUG "vboxpci: cannot open %s\n", szFileBuf); 628 628 629 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,29)629 #if RTLNX_VER_MIN(2,6,29) 630 630 revert_creds(pOldCreds); 631 631 put_cred(pNewCreds); … … 670 670 vbpci_printk(KERN_DEBUG, pPciDev, "%s\n", __func__); 671 671 672 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,1)672 #if RTLNX_VER_MIN(2,6,1) 673 673 if (pci_enable_msi(pPciDev) == 0) 674 674 pIns->fMsiUsed = true; … … 717 717 vboxPciLinuxDevUnregisterWithIommu(pIns); 718 718 719 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,1)719 #if RTLNX_VER_MIN(2,6,1) 720 720 if (pIns->fMsiUsed) 721 721 pci_disable_msi(pPciDev); … … 843 843 if (!rcLnx) 844 844 { 845 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,25)845 #if RTLNX_VER_MIN(2,6,25) 846 846 /* 847 847 * ioremap() defaults to no caching since the 2.6 kernels. … … 859 859 else 860 860 { 861 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,25)861 #if RTLNX_VER_MIN(2,6,25) 862 862 vbpci_printk(KERN_DEBUG, pPciDev, "ioremap() failed\n"); 863 863 #else … … 956 956 * @param pRegs Register set. Removed in 2.6.19. 957 957 */ 958 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,19) && !defined(DOXYGEN_RUNNING)958 #if RTLNX_VER_MIN(2,6,19) && !defined(DOXYGEN_RUNNING) 959 959 static irqreturn_t vboxPciOsIrqHandler(int iIrq, void *pvDevId) 960 960 #else … … 992 992 #ifdef VBOX_WITH_SHARED_PCI_INTERRUPTS 993 993 /* Allow interrupts sharing. */ 994 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,20)994 # if RTLNX_VER_MIN(2,6,20) 995 995 IRQF_SHARED, 996 996 # else … … 1002 1002 /* We don't allow interrupts sharing */ 1003 1003 /* XXX overhaul */ 1004 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 1,0)1004 # if RTLNX_VER_MIN(2,6,20) && RTLNX_VER_MAX(4,1,0) 1005 1005 IRQF_DISABLED, /* keep irqs disabled when calling the action handler */ 1006 1006 # else
Note:
See TracChangeset
for help on using the changeset viewer.