mirror of
https://github.com/NVIDIA/open-gpu-kernel-modules.git
synced 2026-01-30 21:19:49 +00:00
590.48.01
This commit is contained in:
@@ -649,9 +649,9 @@ static inline dma_addr_t nv_phys_to_dma(struct device *dev, NvU64 pa)
|
||||
#define NV_PRINT_AT(nv_debug_level,at) \
|
||||
{ \
|
||||
nv_printf(nv_debug_level, \
|
||||
"NVRM: VM: %s:%d: 0x%p, %d page(s), count = %d, " \
|
||||
"NVRM: VM: %s:%d: 0x%p, %d page(s), count = %lld, " \
|
||||
"page_table = 0x%p\n", __FUNCTION__, __LINE__, at, \
|
||||
at->num_pages, NV_ATOMIC_READ(at->usage_count), \
|
||||
at->num_pages, (long long)atomic64_read(&at->usage_count), \
|
||||
at->page_table); \
|
||||
}
|
||||
|
||||
@@ -919,7 +919,7 @@ struct nv_dma_buf
|
||||
typedef struct nv_alloc_s {
|
||||
struct nv_alloc_s *next;
|
||||
struct device *dev;
|
||||
atomic_t usage_count;
|
||||
atomic64_t usage_count;
|
||||
struct {
|
||||
NvBool contig : 1;
|
||||
NvBool guest : 1;
|
||||
@@ -1248,7 +1248,7 @@ struct nv_pci_tegra_devfreq_dev;
|
||||
typedef struct nv_linux_state_s {
|
||||
nv_state_t nv_state;
|
||||
|
||||
atomic_t usage_count;
|
||||
atomic64_t usage_count;
|
||||
|
||||
NvU32 suspend_count;
|
||||
|
||||
@@ -1627,9 +1627,9 @@ static inline NvBool nv_alloc_release(nv_linux_file_private_t *nvlfp, nv_alloc_t
|
||||
{
|
||||
NV_PRINT_AT(NV_DBG_MEMINFO, at);
|
||||
|
||||
if (NV_ATOMIC_DEC_AND_TEST(at->usage_count))
|
||||
if (atomic64_dec_and_test(&at->usage_count))
|
||||
{
|
||||
NV_ATOMIC_INC(at->usage_count);
|
||||
atomic64_inc(&at->usage_count);
|
||||
|
||||
at->next = nvlfp->free_list;
|
||||
nvlfp->free_list = at;
|
||||
|
||||
@@ -196,14 +196,33 @@ static inline struct rw_semaphore *nv_mmap_get_lock(struct mm_struct *mm)
|
||||
* Commit 45ad9f5290dc updated vma_start_write() to call __vma_start_write().
|
||||
*/
|
||||
void nv_vma_start_write(struct vm_area_struct *);
|
||||
|
||||
static inline void nv_vma_flags_set_word(struct vm_area_struct *vma, unsigned long flags)
|
||||
{
|
||||
nv_vma_start_write(vma);
|
||||
#if defined(NV_VMA_FLAGS_SET_WORD_PRESENT)
|
||||
vma_flags_set_word(&vma->flags, flags);
|
||||
#else
|
||||
ACCESS_PRIVATE(vma, __vm_flags) |= flags;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void nv_vma_flags_clear_word(struct vm_area_struct *vma, unsigned long flags)
|
||||
{
|
||||
nv_vma_start_write(vma);
|
||||
#if defined(NV_VMA_FLAGS_SET_WORD_PRESENT)
|
||||
vma_flags_clear_word(&vma->flags, flags);
|
||||
#else
|
||||
ACCESS_PRIVATE(vma, __vm_flags) &= ~flags;
|
||||
#endif
|
||||
}
|
||||
#endif // !NV_CAN_CALL_VMA_START_WRITE
|
||||
|
||||
static inline void nv_vm_flags_set(struct vm_area_struct *vma, vm_flags_t flags)
|
||||
{
|
||||
#if !NV_CAN_CALL_VMA_START_WRITE
|
||||
nv_vma_start_write(vma);
|
||||
ACCESS_PRIVATE(vma, __vm_flags) |= flags;
|
||||
#elif defined(NV_VM_AREA_STRUCT_HAS_CONST_VM_FLAGS)
|
||||
nv_vma_flags_set_word(vma, flags);
|
||||
#elif defined(NV_VM_FLAGS_SET_PRESENT)
|
||||
vm_flags_set(vma, flags);
|
||||
#else
|
||||
vma->vm_flags |= flags;
|
||||
@@ -213,9 +232,8 @@ static inline void nv_vm_flags_set(struct vm_area_struct *vma, vm_flags_t flags)
|
||||
static inline void nv_vm_flags_clear(struct vm_area_struct *vma, vm_flags_t flags)
|
||||
{
|
||||
#if !NV_CAN_CALL_VMA_START_WRITE
|
||||
nv_vma_start_write(vma);
|
||||
ACCESS_PRIVATE(vma, __vm_flags) &= ~flags;
|
||||
#elif defined(NV_VM_AREA_STRUCT_HAS_CONST_VM_FLAGS)
|
||||
nv_vma_flags_clear_word(vma, flags);
|
||||
#elif defined(NV_VM_FLAGS_SET_PRESENT)
|
||||
vm_flags_clear(vma, flags);
|
||||
#else
|
||||
vma->vm_flags &= ~flags;
|
||||
|
||||
@@ -36,6 +36,19 @@
|
||||
#define NV_MAX_ISR_DELAY_MS (NV_MAX_ISR_DELAY_US / 1000)
|
||||
#define NV_NSECS_TO_JIFFIES(nsec) ((nsec) * HZ / 1000000000)
|
||||
|
||||
/*
|
||||
* in_hardirq() was added in v5.11-rc1 (2020-12-15) to replace in_irq().
|
||||
* Fall back to in_irq() for older kernels that don't have in_hardirq().
|
||||
*/
|
||||
static inline NvBool nv_in_hardirq(void)
|
||||
{
|
||||
#if defined(in_hardirq)
|
||||
return in_hardirq();
|
||||
#else
|
||||
return in_irq();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(NV_KTIME_GET_RAW_TS64_PRESENT)
|
||||
static inline void ktime_get_raw_ts64(struct timespec64 *ts64)
|
||||
{
|
||||
@@ -82,7 +95,7 @@ static inline NV_STATUS nv_sleep_us(unsigned int us)
|
||||
ktime_get_raw_ts64(&tm1);
|
||||
#endif
|
||||
|
||||
if (in_irq() && (us > NV_MAX_ISR_DELAY_US))
|
||||
if (nv_in_hardirq() && (us > NV_MAX_ISR_DELAY_US))
|
||||
return NV_ERR_GENERIC;
|
||||
|
||||
mdelay_safe_msec = us / 1000;
|
||||
@@ -127,7 +140,7 @@ static inline NV_STATUS nv_sleep_ms(unsigned int ms)
|
||||
tm_start = tm_aux;
|
||||
#endif
|
||||
|
||||
if (in_irq() && (ms > NV_MAX_ISR_DELAY_MS))
|
||||
if (nv_in_hardirq() && (ms > NV_MAX_ISR_DELAY_MS))
|
||||
{
|
||||
return NV_ERR_GENERIC;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user