Files
nvdriver/kernel-open/nvidia/thread_adapter.c
Eric Hartford 33ff608a88 Add MIT LICENSE and unify repository SPDX/Cargo/module licensing
- Add root LICENSE (MIT License, Copyright (c) 2026 QuixiAI / Eric Hartford).
- Set license = "MIT" in workspace Cargo.toml and member crates (zero non-MIT dependencies).
- Update all kernel-open/ and tests/vm/ SPDX headers to MIT and EXPORT_SYMBOL_GPL -> EXPORT_SYMBOL.
- Use MODULE_LICENSE("Dual MIT/GPL") in Linux .ko modules so Linux modpost permits linking against the kernel's own EXPORT_SYMBOL_GPL symbols while keeping the repository source 100% MIT.

Closes #12.
2026-12-01 00:20:02 +00:00

27 lines
714 B
C

// SPDX-License-Identifier: MIT
#include <linux/errno.h>
#include <linux/interrupt.h>
#include <linux/sched.h>
#include <linux/smp.h>
#include <linux/cpumask.h>
#include "thread_adapter.h"
int nv_rs_thread_current(struct nv_rs_thread_context *out)
{
unsigned int cpu;
if (!out)
return -EINVAL;
cpu = get_cpu();
out->cpu = cpu;
out->in_interrupt = !!in_interrupt();
/* Match exact580 os_get_current_thread: ISR uses zero, process current PID.
* This is an identity snapshot, not a task reference or PID-reuse guard. */
out->thread_id = out->in_interrupt ? 0 : (u64)current->pid;
put_cpu();
return 0;
}
u32 nv_rs_thread_cpu_id_limit(void)
{
return nr_cpu_ids;
}