129129#include <asm/pgtable.h> /* pte bit definitions */
130130#include <asm/bitops.h> /* __set_bit() */
131131#include <linux/time.h> /* FD_SET() */
132+ #include <linux/memremap.h>
132133
133134/*
134135 * Use current->cred->euid, instead of calling current_euid().
@@ -503,7 +504,7 @@ static inline pgprot_t nv_adjust_pgprot(pgprot_t vm_prot)
503504
504505#define NV_HAVE_MEMORY_ENCRYPT_DECRYPT 0
505506
506- #if defined(NVCPU_X86_64 ) && \
507+ #if ( defined(NVCPU_X86_64 ) || defined( NVCPU_AARCH64 ) ) && \
507508 NV_IS_EXPORT_SYMBOL_GPL_set_memory_encrypted && \
508509 NV_IS_EXPORT_SYMBOL_GPL_set_memory_decrypted
509510#undef NV_HAVE_MEMORY_ENCRYPT_DECRYPT
@@ -553,7 +554,7 @@ static inline dma_addr_t nv_phys_to_dma(struct device *dev, NvU64 pa)
553554#endif
554555}
555556
556- #define NV_GET_PAGE_STRUCT (phys_page ) virt_to_page(__va( phys_page) )
557+ #define NV_GET_PAGE_STRUCT (phys_page ) pfn_to_page( phys_page >> PAGE_SHIFT )
557558#define NV_VMA_PGOFF (vma ) ((vma)->vm_pgoff)
558559#define NV_VMA_SIZE (vma ) ((vma)->vm_end - (vma)->vm_start)
559560#define NV_VMA_OFFSET (vma ) (((NvU64)(vma)->vm_pgoff) << PAGE_SHIFT)
@@ -562,6 +563,12 @@ static inline dma_addr_t nv_phys_to_dma(struct device *dev, NvU64 pa)
562563
563564#define NV_DEVICE_MINOR_NUMBER (x ) minor((x)->i_rdev)
564565
566+ #if defined(NV_GET_DEV_PAGEMAP_HAS_PGMAP_ARG )
567+ #define NV_GET_DEV_PAGEMAP (pfn ) get_dev_pagemap(pfn, NULL)
568+ #else
569+ #define NV_GET_DEV_PAGEMAP get_dev_pagemap
570+ #endif
571+
565572#define NV_PCI_DISABLE_DEVICE (pci_dev ) \
566573 { \
567574 NvU16 __cmd[2]; \
@@ -671,18 +678,6 @@ static inline dma_addr_t nv_phys_to_dma(struct device *dev, NvU64 pa)
671678#define PCI_CAP_ID_EXP 0x10
672679#endif
673680
674- /*
675- * If the host OS has page sizes larger than 4KB, we may have a security
676- * problem. Registers are typically grouped in 4KB pages, but if there are
677- * larger pages, then the smallest userspace mapping possible (e.g., a page)
678- * may give more access than intended to the user.
679- */
680- #define NV_4K_PAGE_ISOLATION_REQUIRED (addr , size ) \
681- ((PAGE_SIZE > NV_RM_PAGE_SIZE) && \
682- ((size) <= NV_RM_PAGE_SIZE) && \
683- (((addr) >> NV_RM_PAGE_SHIFT) == \
684- (((addr) + (size) - 1) >> NV_RM_PAGE_SHIFT)))
685-
686681static inline int nv_remap_page_range (struct vm_area_struct * vma ,
687682 unsigned long virt_addr , NvU64 phys_addr , NvU64 size , pgprot_t prot )
688683{
@@ -1212,6 +1207,10 @@ typedef struct coherent_link_info_s {
12121207 * of virutalized OS environment it is Intermediate Physical Address(IPA) */
12131208 NvU64 gpu_mem_pa ;
12141209
1210+ /* Size of the GPU memory mappable through coherent link. It is possible
1211+ that less than whole FB is mapped to CPU. */
1212+ NvU64 gpu_mem_size ;
1213+
12151214 /* Physical address of the reserved portion of the GPU memory, applicable
12161215 * only in Grace Hopper self hosted passthrough virtualizatioan platform. */
12171216 NvU64 rsvd_mem_pa ;
@@ -1374,6 +1373,13 @@ typedef struct nv_linux_state_s {
13741373
13751374 /* Lock serializing ISRs for different SOC vectors */
13761375 nv_spinlock_t soc_isr_lock ;
1376+
1377+ /*
1378+ * Lock serializing access to the soc_isr_info struct across top and
1379+ * bottom halves for SOC vectors.
1380+ */
1381+ nv_spinlock_t soc_isr_info_lock ;
1382+
13771383 void * soc_bh_mutex ;
13781384
13791385 struct nv_timer snapshot_timer ;
@@ -1428,6 +1434,9 @@ typedef struct nv_linux_state_s {
14281434 int (* devfreq_enable_boost )(struct device * dev , unsigned int duration );
14291435 int (* devfreq_disable_boost )(struct device * dev );
14301436#endif
1437+
1438+ /* Per-device GPU init on probe setting, initialized from global NVreg_GpuInitOnProbe */
1439+ NvBool init_on_probe ;
14311440} nv_linux_state_t ;
14321441
14331442extern nv_linux_state_t * nv_linux_devices ;
@@ -1485,9 +1494,11 @@ typedef struct
14851494 nv_kthread_q_item_t deferred_close_q_item ;
14861495 NvU32 * attached_gpus ;
14871496 size_t num_attached_gpus ;
1488- nv_alloc_mapping_context_t mmap_context ;
14891497 struct address_space mapping ;
14901498
1499+ struct rw_semaphore fileVaLock ;
1500+ nv_alloc_mapping_list_node_t * file_mapping_list ;
1501+
14911502 nv_kthread_q_item_t open_q_item ;
14921503 struct completion open_complete ;
14931504 nv_linux_state_t * deferred_open_nvl ;
@@ -1599,6 +1610,8 @@ extern NvU32 NVreg_RegisterPlatformDeviceDriver;
15991610extern NvU32 NVreg_EnableResizableBar ;
16001611extern NvU32 NVreg_TegraGpuPgMask ;
16011612extern NvU32 NVreg_EnableNonblockingOpen ;
1613+ extern NvU32 NVreg_UseKernelSuspendNotifiers ;
1614+ extern NvU32 NVreg_GpuInitOnProbe ;
16021615
16031616extern NvU32 num_probed_nv_devices ;
16041617extern NvU32 num_nv_devices ;
0 commit comments