@@ -1037,6 +1037,32 @@ static inline vm_fault_t nv_insert_pfn(struct vm_area_struct *vma,
10371037 return VM_FAULT_SIGBUS ;
10381038}
10391039
1040+ /* Converts BAR index to Linux specific PCI BAR index */
1041+ static inline NvU8 nv_bar_index_to_os_bar_index
1042+ (
1043+ struct pci_dev * dev ,
1044+ NvU8 nv_bar_index
1045+ )
1046+ {
1047+ NvU8 bar_index = 0 ;
1048+ NvU8 i ;
1049+
1050+ BUG_ON (nv_bar_index >= NV_GPU_NUM_BARS );
1051+
1052+ for (i = 0 ; i < nv_bar_index ; i ++ )
1053+ {
1054+ if (NV_PCI_RESOURCE_FLAGS (dev , bar_index ) & PCI_BASE_ADDRESS_MEM_TYPE_64 )
1055+ {
1056+ bar_index += 2 ;
1057+ }
1058+ else
1059+ {
1060+ bar_index ++ ;
1061+ }
1062+ }
1063+
1064+ return bar_index ;
1065+ }
10401066
10411067#define NV_PAGE_MASK (NvU64)(long)PAGE_MASK
10421068
@@ -1161,16 +1187,6 @@ typedef struct nvidia_pte_s {
11611187 unsigned int page_count ;
11621188} nvidia_pte_t ;
11631189
1164-
1165-
1166-
1167-
1168-
1169-
1170-
1171-
1172-
1173-
11741190typedef struct nv_alloc_s {
11751191 struct nv_alloc_s * next ;
11761192 struct device * dev ;
@@ -1413,34 +1429,6 @@ struct os_wait_queue {
14131429 struct completion q ;
14141430};
14151431
1416-
1417-
1418-
1419-
1420-
1421-
1422-
1423-
1424-
1425-
1426-
1427-
1428-
1429-
1430-
1431-
1432-
1433-
1434-
1435-
1436-
1437-
1438-
1439-
1440-
1441-
1442-
1443-
14441432/*
14451433 * To report error in msi/msix when unhandled count reaches a threshold
14461434 */
@@ -1464,19 +1452,6 @@ struct nv_dma_device {
14641452 NvBool nvlink ;
14651453};
14661454
1467-
1468-
1469-
1470-
1471-
1472-
1473-
1474-
1475-
1476-
1477-
1478-
1479-
14801455/* linux-specific version of old nv_state_t */
14811456/* this is a general os-specific state structure. the first element *must* be
14821457 the general state structure, for the generic unix-based code */
@@ -1492,11 +1467,6 @@ typedef struct nv_linux_state_s {
14921467 /* IBM-NPU info associated with this GPU */
14931468 nv_ibmnpu_info_t * npu ;
14941469
1495-
1496-
1497-
1498-
1499-
15001470 /* NUMA node information for the platforms where GPU memory is presented
15011471 * as a NUMA node to the kernel */
15021472 struct {
@@ -1576,23 +1546,6 @@ typedef struct nv_linux_state_s {
15761546 /* Per-device notifier block for ACPI events */
15771547 struct notifier_block acpi_nb ;
15781548
1579-
1580-
1581-
1582-
1583-
1584-
1585-
1586-
1587-
1588-
1589-
1590-
1591-
1592-
1593-
1594-
1595-
15961549 /* Lock serializing ISRs for different SOC vectors */
15971550 nv_spinlock_t soc_isr_lock ;
15981551
@@ -1760,12 +1713,10 @@ static inline struct kmem_cache *nv_kmem_cache_create(const char *name, unsigned
17601713 return cache ;
17611714}
17621715
1763-
17641716#if defined(CONFIG_PCI_IOV )
17651717#define NV_PCI_SRIOV_SUPPORT
17661718#endif /* CONFIG_PCI_IOV */
17671719
1768-
17691720#define NV_PCIE_CFG_MAX_OFFSET 0x1000
17701721
17711722#include "nv-proto.h"
@@ -1959,11 +1910,6 @@ static inline NvU32 nv_default_irq_flags(nv_state_t *nv)
19591910
19601911NvS32 nv_request_soc_irq (nv_linux_state_t * , NvU32 , nv_soc_irq_type_t , NvU32 , NvU32 );
19611912
1962-
1963-
1964-
1965-
1966-
19671913static inline void nv_mutex_destroy (struct mutex * lock )
19681914{
19691915 mutex_destroy (lock );
0 commit comments