Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | arch/riscv/kernel/reset.c |
void machine_restart(char *cmd) {
do_kernel_restart(cmd);
while (1)
;
} | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/sbi.c | void sbi_shutdown(void) {
sbi_ecall(SBI_EXT_0_1_SHUTDOWN, 0, 0, 0, 0, 0, 0, 0);
} | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/sbi.c | void sbi_clear_ipi(void) {
sbi_ecall(SBI_EXT_0_1_CLEAR_IPI, 0, 0, 0, 0, 0, 0, 0);
} | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/sbi.c |
static void sbi_set_power_off(void) { pm_power_off = sbi_shutdown; }
#else | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/sbi.c |
static void __sbi_set_timer_v02(uint64_t stime_value) {
#if __riscv_xlen == 32
sbi_ecall(SBI_EXT_TIME, SBI_EXT_TIME_SET_TIMER, stime_value,
stime_value >> 32, 0, 0, 0, 0);
#else
sbi_ecall(SBI_EXT_TIME, SBI_EXT_TIME_SET_TIMER, stime_value, 0, 0, 0, 0, 0);
#endif
} | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/sbi.c | static int __sbi_send_ipi_v02(const struct cpumask *cpu_mask) {
unsigned long hartid, cpuid, hmask = 0, hbase = 0, htop = 0;
struct sbiret ret = {0};
int result;
if (!cpu_mask || cpumask_empty(cpu_mask))
cpu_mask = cpu_online_mask;
for_each_cpu(cpuid, cpu_mask) {
hartid = cpuid_to_hartid_map(cpuid);... | [
1,
0
] |
Linux Kernel | arch/riscv/kernel/sbi.c | int sbi_remote_hfence_vvma(const struct cpumask *cpu_mask, unsigned long start,
unsigned long size) {
return __sbi_rfence(SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA, cpu_mask, start, size,
0, 0);
} | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/sbi.c |
static long __sbi_base_ecall(int fid) {
struct sbiret ret;
ret = sbi_ecall(SBI_EXT_BASE, fid, 0, 0, 0, 0, 0, 0);
if (!ret.error)
return ret.value;
else
return sbi_err_map_linux_errno(ret.error);
} | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/sbi.c |
static inline long sbi_get_firmware_version(void) {
return __sbi_base_ecall(SBI_EXT_BASE_GET_IMP_VERSION);
} | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/sbi.c |
void __init sbi_init(void) {
int ret;
sbi_set_power_off();
ret = sbi_get_spec_version();
if (ret > 0)
sbi_spec_version = ret;
pr_info("SBI specification v%lu.%lu detected\n", sbi_major_version(),
sbi_minor_version());
if (!sbi_spec_is_0_1()) {
pr_info("SBI implementation ID=0x%lx Versi... | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/signal.c | static long save_fp_state(struct pt_regs *regs,
union __riscv_fp_state __user *sc_fpregs) {
long err;
struct __riscv_d_ext_state __user *state = &sc_fpregs->d;
size_t i;
fstate_save(current, regs);
err = __copy_to_user(state, ¤t->thread.fstate, sizeof(*state));
if (unlikely(... | [
1,
0
] |
Linux Kernel | arch/riscv/kernel/signal.c | static long setup_sigcontext(struct rt_sigframe __user *frame,
struct pt_regs *regs) {
struct sigcontext __user *sc = &frame->uc.uc_mcontext;
long err;
err = __copy_to_user(&sc->sc_regs, regs, sizeof(sc->sc_regs));
/* Save the floating-point state. */
if (has_fpu())
err |= sa... | [
1,
0
] |
Linux Kernel | arch/riscv/kernel/signal.c | static void handle_signal(struct ksignal *ksig, struct pt_regs *regs) {
sigset_t *oldset = sigmask_to_save();
int ret;
if (regs->cause == EXC_SYSCALL) {
/* Avoid additional syscall restarting via ret_from_exception */
regs->cause = -1UL;
/* If so, check system call restarting.. */
switch (regs->a... | [
1,
0
] |
Linux Kernel | arch/riscv/kernel/signal.c | asmlinkage __visible void do_notify_resume(struct pt_regs *regs,
unsigned long thread_info_flags) {
if (thread_info_flags & _TIF_UPROBE)
uprobe_notify_resume(regs);
if (thread_info_flags & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL))
do_signal(regs);
if (thread_info... | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/smp.c |
bool arch_match_cpu_phys_id(int cpu, u64 phys_id) {
return phys_id == cpuid_to_hartid_map(cpu);
} | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/smp.c |
static void ipi_stop(void) {
set_cpu_online(smp_processor_id(), false);
while (1)
wait_for_interrupt();
}
#ifdef CONFIG_KEXEC_CORE | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/smp.c | static inline void ipi_cpu_crash_stop(unsigned int cpu, struct pt_regs *regs) {
unreachable();
}
#endif | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/smp.c | void arch_irq_work_raise(void) {
send_ipi_single(smp_processor_id(), IPI_IRQ_WORK);
}
#endif | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/smp.c |
void show_ipi_stats(struct seq_file *p, int prec) {
unsigned int cpu, i;
for (i = 0; i < IPI_MAX; i++) {
seq_printf(p, "%*s%u:%s", prec - 1, "IPI", i, prec >= 4 ? " " : "");
for_each_online_cpu(cpu) seq_printf(p, "%10lu ", ipi_data[cpu].stats[i]);
seq_printf(p, " %s\n", ipi_names[i]);
}
} | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/smp.c |
void arch_send_call_function_single_ipi(int cpu) {
send_ipi_single(cpu, IPI_CALL_FUNC);
}
#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/smp.c |
bool smp_crash_stop_failed(void) {
return (atomic_read(&waiting_for_crash_ipi) > 0);
}
#endif | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/smpboot.c |
void __init smp_prepare_boot_cpu(void) { init_cpu_topology(); } | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/smpboot.c |
static int start_secondary_cpu(int cpu, struct task_struct *tidle) {
if (cpu_ops[cpu]->cpu_start)
return cpu_ops[cpu]->cpu_start(cpu, tidle);
return -EOPNOTSUPP;
} | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/suspend.c |
static void suspend_restore_csrs(struct suspend_context *context) {
csr_write(CSR_SCRATCH, context->scratch);
csr_write(CSR_TVEC, context->tvec);
csr_write(CSR_IE, context->ie);
#ifdef CONFIG_MMU
csr_write(CSR_SATP, context->satp);
#endif
} | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/suspend.c | int cpu_suspend(unsigned long arg,
int (*finish)(unsigned long arg, unsigned long entry,
unsigned long context)) {
int rc = 0;
struct suspend_context context = {0};
if (!finish)
return -EINVAL;
/* Save additional CSRs*/
suspend_save_csrs(&context);
/*
... | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/traps.c |
void die(struct pt_regs *regs, const char *str) {
static int die_counter;
int ret;
long cause;
oops_enter();
spin_lock_irq(&die_lock);
console_verbose();
bust_spinlocks(1);
pr_emerg("%s [#%d]\n", str, ++die_counter);
print_modules();
if (regs)
show_regs(regs);
cause = regs ? regs->cause :... | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/traps.c | asmlinkage void handle_bad_stack(struct pt_regs *regs) {
unsigned long tsk_stk = (unsigned long)current->stack;
unsigned long ovf_stk = (unsigned long)this_cpu_ptr(overflow_stack);
smp_store_release(&spin_shadow_stack, 0);
console_verbose();
pr_emerg("Insufficient stack space to handle exception!\n");
pr... | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/traps_misaligned.c |
static inline u64 load_u64(const u64 *addr) {
return load_u32((u32 *)addr) + ((u64)load_u32((u32 *)addr + 1) << 32);
} | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/vdso/vgettimeofday.c | int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) {
return __cvdso_gettimeofday(tv, tz);
} | [
0,
0
] |
Linux Kernel | arch/riscv/kernel/vdso.c | int vdso_join_timens(struct task_struct *task, struct time_namespace *ns) {
struct mm_struct *mm = task->mm;
struct vm_area_struct *vma;
VMA_ITERATOR(vmi, mm, 0);
mmap_read_lock(mm);
for_each_vma(vmi, vma) {
unsigned long size = vma->vm_end - vma->vm_start;
if (vma_is_special_mapping(vma, vdso_info... | [
1,
0
] |
Linux Kernel | arch/riscv/kvm/main.c |
long kvm_arch_dev_ioctl(struct file *filp, unsigned int ioctl,
unsigned long arg) {
return -EINVAL;
} | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/main.c |
int kvm_arch_check_processor_compat(void *opaque) { return 0; } | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/main.c |
int kvm_arch_init(void *opaque) {
const char *str;
if (!riscv_isa_extension_available(NULL, h)) {
kvm_info("hypervisor extension not available\n");
return -ENODEV;
}
if (sbi_spec_is_0_1()) {
kvm_info("require SBI v0.2 or higher\n");
return -ENODEV;
}
if (sbi_probe_extension(SBI_EXT_RFENC... | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/mmu.c |
static inline unsigned long gstage_pte_page_vaddr(pte_t pte) {
return (unsigned long)pfn_to_virt(__page_val_to_pfn(pte_val(pte)));
} | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/mmu.c |
static bool gstage_get_leaf_entry(struct kvm *kvm, gpa_t addr, pte_t **ptepp,
u32 *ptep_level) {
pte_t *ptep;
u32 current_level = gstage_pgd_levels - 1;
*ptep_level = current_level;
ptep = (pte_t *)kvm->arch.pgd;
ptep = &ptep[gstage_pte_index(addr, current_level)];
while ... | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/mmu.c |
static int gstage_set_pte(struct kvm *kvm, u32 level,
struct kvm_mmu_memory_cache *pcache, gpa_t addr,
const pte_t *new_pte) {
u32 current_level = gstage_pgd_levels - 1;
pte_t *next_ptep = (pte_t *)kvm->arch.pgd;
pte_t *ptep = &next_ptep[gstage_pte_index(addr, ... | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/mmu.c |
void kvm_arch_mmu_enable_log_dirty_pt_masked(struct kvm *kvm,
struct kvm_memory_slot *slot,
gfn_t gfn_offset,
unsigned long mask) {
phys_addr_t base_gfn = slot->base_gfn + gfn_offset... | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/mmu.c |
void kvm_arch_flush_shadow_all(struct kvm *kvm) {
kvm_riscv_gstage_free_pgd(kvm);
} | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/mmu.c |
void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
struct kvm_memory_slot *slot) {
gpa_t gpa = slot->base_gfn << PAGE_SHIFT;
phys_addr_t size = slot->npages << PAGE_SHIFT;
spin_lock(&kvm->mmu_lock);
gstage_unmap_range(kvm, gpa, size, false);
spin_unlock(&kvm->mmu_lock);
} | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/mmu.c |
void kvm_riscv_gstage_update_hgatp(struct kvm_vcpu *vcpu) {
unsigned long hgatp = gstage_mode;
struct kvm_arch *k = &vcpu->kvm->arch;
hgatp |= (READ_ONCE(k->vmid.vmid) << HGATP_VMID_SHIFT) & HGATP_VMID_MASK;
hgatp |= (k->pgd_phys >> PAGE_SHIFT) & HGATP_PPN;
csr_write(CSR_HGATP, hgatp);
if (!kvm_riscv_gs... | [
1,
0
] |
Linux Kernel | arch/riscv/kvm/tlb.c |
void kvm_riscv_local_hfence_vvma_asid_all(unsigned long vmid,
unsigned long asid) {
unsigned long hgatp;
hgatp = csr_swap(CSR_HGATP, vmid << HGATP_VMID_SHIFT);
asm volatile(HFENCE_VVMA(zero, % 0) : : "r"(asid) : "memory");
csr_write(CSR_HGATP, hgatp);
} | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/tlb.c |
void kvm_riscv_local_hfence_vvma_gva(unsigned long vmid, unsigned long gva,
unsigned long gvsz, unsigned long order) {
unsigned long pos, hgatp;
if (PTRS_PER_PTE < (gvsz >> order)) {
kvm_riscv_local_hfence_vvma_all(vmid);
return;
}
hgatp = csr_swap(CSR_HGATP, vmid... | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/tlb.c |
static bool vcpu_hfence_dequeue(struct kvm_vcpu *vcpu,
struct kvm_riscv_hfence *out_data) {
bool ret = false;
struct kvm_vcpu_arch *varch = &vcpu->arch;
spin_lock(&varch->hfence_lock);
if (varch->hfence_queue[varch->hfence_head].type) {
memcpy(out_data, &varch->hfence_queu... | [
1,
0
] |
Linux Kernel | arch/riscv/kvm/tlb.c |
static bool vcpu_hfence_enqueue(struct kvm_vcpu *vcpu,
const struct kvm_riscv_hfence *data) {
bool ret = false;
struct kvm_vcpu_arch *varch = &vcpu->arch;
spin_lock(&varch->hfence_lock);
if (!varch->hfence_queue[varch->hfence_tail].type) {
memcpy(&varch->hfence_queue[varch... | [
1,
0
] |
Linux Kernel | arch/riscv/kvm/tlb.c | static void make_xfence_request(struct kvm *kvm, unsigned long hbase,
unsigned long hmask, unsigned int req,
unsigned int fallback_req,
const struct kvm_riscv_hfence *data) {
unsigned long i;
struct kvm_vcpu *vcpu;
uns... | [
1,
0
] |
Linux Kernel | arch/riscv/kvm/tlb.c |
void kvm_riscv_hfence_gvma_vmid_all(struct kvm *kvm, unsigned long hbase,
unsigned long hmask) {
make_xfence_request(kvm, hbase, hmask, KVM_REQ_HFENCE_GVMA_VMID_ALL,
KVM_REQ_HFENCE_GVMA_VMID_ALL, NULL);
} | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/tlb.c |
void kvm_riscv_hfence_vvma_asid_gva(struct kvm *kvm, unsigned long hbase,
unsigned long hmask, unsigned long gva,
unsigned long gvsz, unsigned long order,
unsigned long asid) {
struct kvm_riscv_hfence data;
... | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/tlb.c |
void kvm_riscv_hfence_vvma_gva(struct kvm *kvm, unsigned long hbase,
unsigned long hmask, unsigned long gva,
unsigned long gvsz, unsigned long order) {
struct kvm_riscv_hfence data;
data.type = KVM_RISCV_HFENCE_VVMA_GVA;
data.asid = 0;
data.addr = ... | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/tlb.c |
void kvm_riscv_hfence_vvma_all(struct kvm *kvm, unsigned long hbase,
unsigned long hmask) {
make_xfence_request(kvm, hbase, hmask, KVM_REQ_HFENCE_VVMA_ALL,
KVM_REQ_HFENCE_VVMA_ALL, NULL);
} | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu.c |
static unsigned long kvm_riscv_vcpu_base2isa_ext(unsigned long base_ext) {
unsigned long i;
for (i = 0; i < KVM_RISCV_ISA_EXT_MAX; i++) {
if (kvm_isa_ext_arr[i] == base_ext)
return i;
}
return KVM_RISCV_ISA_EXT_MAX;
} | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu.c |
int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu) {
return kvm_riscv_vcpu_timer_pending(vcpu);
} | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu.c |
void kvm_arch_vcpu_blocking(struct kvm_vcpu *vcpu) {} | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu.c |
int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) {
return (kvm_riscv_vcpu_has_interrupts(vcpu, -1UL) && !vcpu->arch.power_off &&
!vcpu->arch.pause);
} | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu.c |
vm_fault_t kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf) {
return VM_FAULT_SIGBUS;
} | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu.c |
static int kvm_riscv_vcpu_get_reg_core(struct kvm_vcpu *vcpu,
const struct kvm_one_reg *reg) {
struct kvm_cpu_context *cntx = &vcpu->arch.guest_context;
unsigned long __user *uaddr =
(unsigned long __user *)(unsigned long)reg->addr;
unsigned long reg_num =
reg->... | [
1,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu.c | static int kvm_riscv_vcpu_set_reg_isa_ext(struct kvm_vcpu *vcpu,
const struct kvm_one_reg *reg) {
unsigned long __user *uaddr =
(unsigned long __user *)(unsigned long)reg->addr;
unsigned long reg_num = reg->id & ~(KVM_REG_ARCH_MASK | KVM_REG_SIZE_MASK |
... | [
1,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu.c |
int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
struct kvm_sregs *sregs) {
return -EINVAL;
} | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu.c |
int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) {
return -EINVAL;
} | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu.c |
void kvm_riscv_vcpu_flush_interrupts(struct kvm_vcpu *vcpu) {
struct kvm_vcpu_csr *csr = &vcpu->arch.guest_csr;
unsigned long mask, val;
if (READ_ONCE(vcpu->arch.irqs_pending_mask)) {
mask = xchg_acquire(&vcpu->arch.irqs_pending_mask, 0);
val = READ_ONCE(vcpu->arch.irqs_pending) & mask;
csr->hvip &... | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu.c | void kvm_riscv_vcpu_sync_interrupts(struct kvm_vcpu *vcpu) {
unsigned long hvip;
struct kvm_vcpu_arch *v = &vcpu->arch;
struct kvm_vcpu_csr *csr = &vcpu->arch.guest_csr;
csr->vsie = csr_read(CSR_VSIE);
/* Sync-up HVIP.VSSIP bit changes does by Guest */
hvip = csr_read(CSR_HVIP);
if ((csr->hvip ^ hvip) &... | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu.c |
int kvm_riscv_vcpu_unset_interrupt(struct kvm_vcpu *vcpu, unsigned int irq) {
if (irq != IRQ_VS_SOFT && irq != IRQ_VS_TIMER && irq != IRQ_VS_EXT)
return -EINVAL;
clear_bit(irq, &vcpu->arch.irqs_pending);
smp_mb__before_atomic();
set_bit(irq, &vcpu->arch.irqs_pending_mask);
return 0;
} | [
1,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu.c |
void kvm_riscv_vcpu_power_off(struct kvm_vcpu *vcpu) {
vcpu->arch.power_off = true;
kvm_make_request(KVM_REQ_SLEEP, vcpu);
kvm_vcpu_kick(vcpu);
} | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu.c | static void kvm_riscv_check_vcpu_requests(struct kvm_vcpu *vcpu) {
struct rcuwait *wait = kvm_arch_vcpu_get_wait(vcpu);
if (kvm_request_pending(vcpu)) {
if (kvm_check_request(KVM_REQ_SLEEP, vcpu)) {
kvm_vcpu_srcu_read_unlock(vcpu);
rcuwait_wait_event(wait, (!vcpu->arch.power_off) && (!vcpu->arch.pa... | [
1,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu_exit.c | void kvm_riscv_vcpu_trap_redirect(struct kvm_vcpu *vcpu,
struct kvm_cpu_trap *trap) {
unsigned long vsstatus = csr_read(CSR_VSSTATUS);
vsstatus &= ~SR_SPP;
if (vcpu->arch.guest_context.sstatus & SR_SPP)
vsstatus |= SR_SPP;
/* Change Guest SSTATUS.SPIE bit */
vsstatus &=... | [
1,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu_fp.c |
void kvm_riscv_vcpu_guest_fp_save(struct kvm_cpu_context *cntx,
const unsigned long *isa) {
if ((cntx->sstatus & SR_FS) == SR_FS_DIRTY) {
if (riscv_isa_extension_available(isa, d))
__kvm_riscv_fp_d_save(cntx);
else if (riscv_isa_extension_available(isa, f))
__kvm... | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu_insn.c | void kvm_riscv_vcpu_wfi(struct kvm_vcpu *vcpu) {
if (!kvm_arch_vcpu_runnable(vcpu)) {
kvm_vcpu_srcu_read_unlock(vcpu);
kvm_vcpu_halt(vcpu);
kvm_vcpu_srcu_read_lock(vcpu);
}
} | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu_insn.c | int kvm_riscv_vcpu_csr_return(struct kvm_vcpu *vcpu, struct kvm_run *run) {
ulong insn;
if (vcpu->arch.csr_decode.return_handled)
return 0;
vcpu->arch.csr_decode.return_handled = 1;
insn = vcpu->arch.csr_decode.insn;
if ((insn >> SH_RD) & MASK_RX)
SET_RD(insn, &vcpu->arch.guest_context, run->riscv_c... | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu_insn.c |
static int system_opcode_insn(struct kvm_vcpu *vcpu, struct kvm_run *run,
ulong insn) {
int i, rc = KVM_INSN_ILLEGAL_TRAP;
const struct insn_func *ifn;
for (i = 0; i < ARRAY_SIZE(system_opcode_funcs); i++) {
ifn = &system_opcode_funcs[i];
if ((insn & ifn->mask) == ifn->matc... | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu_insn.c | int kvm_riscv_vcpu_virtual_insn(struct kvm_vcpu *vcpu, struct kvm_run *run,
struct kvm_cpu_trap *trap) {
unsigned long insn = trap->stval;
struct kvm_cpu_trap utrap = {0};
struct kvm_cpu_context *ct;
if (unlikely(INSN_IS_16BIT(insn))) {
if (insn == 0) {
ct = &vcpu->arc... | [
1,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu_sbi.c |
static int kvm_linux_err_map_sbi(int err) {
switch (err) {
case 0:
return SBI_SUCCESS;
case -EPERM:
return SBI_ERR_DENIED;
case -EINVAL:
return SBI_ERR_INVALID_PARAM;
case -EFAULT:
return SBI_ERR_INVALID_ADDRESS;
case -EOPNOTSUPP:
return SBI_ERR_NOT_SUPPORTED;
case -EALREADY:
retu... | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu_sbi_base.c | static int kvm_sbi_ext_base_handler(struct kvm_vcpu *vcpu, struct kvm_run *run,
unsigned long *out_val,
struct kvm_cpu_trap *trap, bool *exit) {
int ret = 0;
struct kvm_cpu_context *cp = &vcpu->arch.guest_context;
struct sbiret ecall_ret;
... | [
0,
1
] |
Linux Kernel | arch/riscv/kvm/vcpu_sbi_hsm.c |
static int kvm_sbi_hsm_vcpu_get_status(struct kvm_vcpu *vcpu) {
struct kvm_cpu_context *cp = &vcpu->arch.guest_context;
unsigned long target_vcpuid = cp->a0;
struct kvm_vcpu *target_vcpu;
target_vcpu = kvm_get_vcpu_by_id(vcpu->kvm, target_vcpuid);
if (!target_vcpu)
return -EINVAL;
if (!target_vcpu->ar... | [
1,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu_sbi_hsm.c |
static int kvm_sbi_ext_hsm_handler(struct kvm_vcpu *vcpu, struct kvm_run *run,
unsigned long *out_val,
struct kvm_cpu_trap *utrap, bool *exit) {
int ret = 0;
struct kvm_cpu_context *cp = &vcpu->arch.guest_context;
struct kvm *kvm = vcpu->kvm;
... | [
1,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu_sbi_replace.c |
static int kvm_sbi_ext_ipi_handler(struct kvm_vcpu *vcpu, struct kvm_run *run,
unsigned long *out_val,
struct kvm_cpu_trap *utrap, bool *exit) {
int ret = 0;
unsigned long i;
struct kvm_vcpu *tmp;
struct kvm_cpu_context *cp = &vcpu->arch.gue... | [
1,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu_timer.c |
static u64 kvm_riscv_current_cycles(struct kvm_guest_timer *gt) {
return get_cycles64() + gt->time_delta;
} | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu_timer.c |
int kvm_riscv_vcpu_timer_next_event(struct kvm_vcpu *vcpu, u64 ncycles) {
struct kvm_vcpu_timer *t = &vcpu->arch.timer;
return t->timer_next_event(vcpu, ncycles);
} | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu_timer.c |
bool kvm_riscv_vcpu_timer_pending(struct kvm_vcpu *vcpu) {
struct kvm_vcpu_timer *t = &vcpu->arch.timer;
struct kvm_guest_timer *gt = &vcpu->kvm->arch.timer;
if (!kvm_riscv_delta_cycles2ns(t->next_cycles, gt, t) ||
kvm_riscv_vcpu_has_interrupts(vcpu, 1UL << IRQ_VS_TIMER))
return true;
else
retur... | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu_timer.c |
static void kvm_riscv_vcpu_timer_unblocking(struct kvm_vcpu *vcpu) {
kvm_riscv_vcpu_timer_cancel(&vcpu->arch.timer);
} | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu_timer.c |
int kvm_riscv_vcpu_timer_reset(struct kvm_vcpu *vcpu) {
struct kvm_vcpu_timer *t = &vcpu->arch.timer;
t->next_cycles = -1ULL;
return kvm_riscv_vcpu_timer_cancel(&vcpu->arch.timer);
} | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/vcpu_timer.c |
void kvm_riscv_guest_timer_init(struct kvm *kvm) {
struct kvm_guest_timer *gt = &kvm->arch.timer;
riscv_cs_get_mult_shift(>->nsec_mult, >->nsec_shift);
gt->time_delta = -get_cycles64();
} | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/vm.c |
int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) {
int r;
switch (ext) {
case KVM_CAP_IOEVENTFD:
case KVM_CAP_DEVICE_CTRL:
case KVM_CAP_USER_MEMORY:
case KVM_CAP_SYNC_MMU:
case KVM_CAP_DESTROY_MEMORY_REGION_WORKS:
case KVM_CAP_ONE_REG:
case KVM_CAP_READONLY_MEM:
case KVM_CAP_MP_STATE:
... | [
0,
0
] |
Linux Kernel | arch/riscv/kvm/vmid.c |
bool kvm_riscv_gstage_vmid_ver_changed(struct kvm_vmid *vmid) {
if (!vmid_bits)
return false;
return unlikely(READ_ONCE(vmid->vmid_version) != READ_ONCE(vmid_version));
} | [
0,
0
] |
Linux Kernel | arch/riscv/mm/cacheflush.c | void flush_icache_pte(pte_t pte) {
struct page *page = pte_page(pte);
if (!test_and_set_bit(PG_dcache_clean, &page->flags))
flush_icache_all();
} | [
0,
0
] |
Linux Kernel | arch/riscv/mm/cacheflush.c | void riscv_init_cbom_blocksize(void) {
struct device_node *node;
unsigned long cbom_hartid;
u32 val, probed_block_size;
int ret;
probed_block_size = 0;
for_each_of_cpu_node(node) {
unsigned long hartid;
ret = riscv_of_processor_hartid(node, &hartid);
if (ret)
continue;
ret = of_prop... | [
1,
0
] |
Linux Kernel | arch/riscv/mm/context.c | static unsigned long __new_context(struct mm_struct *mm) {
static u32 cur_idx = 1;
unsigned long cntx = atomic_long_read(&mm->context.id);
unsigned long asid, ver = atomic_long_read(¤t_version);
lockdep_assert_held(&context_lock);
if (cntx != 0) {
unsigned long newcntx = ver | (cntx & asid_mask);
... | [
1,
0
] |
Linux Kernel | arch/riscv/mm/context.c | static void set_mm_asid(struct mm_struct *mm, unsigned int cpu) {
unsigned long flags;
bool need_flush_tlb = false;
unsigned long cntx, old_active_cntx;
cntx = atomic_long_read(&mm->context.id);
old_active_cntx = atomic_long_read(&per_cpu(active_context, cpu));
if (old_active_cntx &&
((cntx & ~asid_... | [
1,
0
] |
Linux Kernel | arch/riscv/mm/context.c | static void set_mm_noasid(struct mm_struct *mm) {
/* Switch the page table and blindly nuke entire local TLB */
csr_write(CSR_SATP, virt_to_pfn(mm->pgd) | satp_mode);
local_flush_tlb_all();
} | [
0,
0
] |
Linux Kernel | arch/riscv/mm/context.c |
static inline void set_mm(struct mm_struct *mm, unsigned int cpu) {
if (static_branch_unlikely(&use_asid_allocator))
set_mm_asid(mm, cpu);
else
set_mm_noasid(mm);
} | [
0,
0
] |
Linux Kernel | arch/riscv/mm/context.c | static int __init asids_init(void) {
unsigned long old;
old = csr_read(CSR_SATP);
asid_bits = old | (SATP_ASID_MASK << SATP_ASID_SHIFT);
csr_write(CSR_SATP, asid_bits);
asid_bits = (csr_read(CSR_SATP) >> SATP_ASID_SHIFT) & SATP_ASID_MASK;
asid_bits = fls_long(asid_bits);
csr_write(CSR_SATP, old);
/*
... | [
0,
0
] |
Linux Kernel | arch/riscv/mm/extable.c |
static bool ex_handler_uaccess_err_zero(const struct exception_table_entry *ex,
struct pt_regs *regs) {
int reg_err = FIELD_GET(EX_DATA_REG_ERR, ex->data);
int reg_zero = FIELD_GET(EX_DATA_REG_ZERO, ex->data);
regs_set_gpr(regs, reg_err * sizeof(unsigned long), -EFAULT);
... | [
1,
0
] |
Linux Kernel | arch/riscv/mm/fault.c | static inline void bad_area(struct pt_regs *regs, struct mm_struct *mm,
int code, unsigned long addr) {
mmap_read_unlock(mm);
/* User mode accesses just cause a SIGSEGV */
if (user_mode(regs)) {
do_trap(regs, SIGSEGV, code, addr);
return;
}
no_context(regs, addr);
} | [
0,
0
] |
Linux Kernel | arch/riscv/mm/hugetlbpage.c |
int pmd_huge(pmd_t pmd) { return pmd_leaf(pmd); } | [
0,
0
] |
Linux Kernel | arch/riscv/mm/init.c |
static inline void print_ml(char *name, unsigned long b, unsigned long t) {
unsigned long diff = t - b;
if (IS_ENABLED(CONFIG_64BIT) && (diff >> LOG2_SZ_1T) >= 10)
print_mlt(name, b, t);
else if ((diff >> LOG2_SZ_1G) >= 10)
print_mlg(name, b, t);
else if ((diff >> LOG2_SZ_1M) >= 10)
print_mlm(name... | [
1,
0
] |
Linux Kernel | arch/riscv/mm/init.c | void __init mem_init(void) {
#ifdef CONFIG_FLATMEM
BUG_ON(!mem_map);
#endif
swiotlb_init(max_pfn > PFN_DOWN(dma32_phys_limit), SWIOTLB_VERBOSE);
memblock_free_all();
print_vm_layout();
} | [
0,
0
] |
Linux Kernel | arch/riscv/mm/init.c |
static int __init early_mem(char *p) {
u64 size;
if (!p)
return 1;
size = memparse(p, &p) & PAGE_MASK;
memory_limit = min_t(u64, size, memory_limit);
pr_notice("Memory limited to %lldMB\n", (u64)memory_limit >> 20);
return 0;
} | [
0,
0
] |
Linux Kernel | arch/riscv/mm/init.c | DECLARE_VM_GET_PAGE_PROT
void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot) {
unsigned long addr = __fix_to_virt(idx);
pte_t *ptep;
BUG_ON(idx <= FIX_HOLE || idx >= __end_of_fixed_addresses);
ptep = &fixmap_pte[pte_index(addr)];
if (pgprot_val(prot))
set_pte(ptep, pfn_pte(phy... | [
1,
0
] |
Linux Kernel | arch/riscv/mm/init.c |
static inline phys_addr_t __init alloc_pte_fixmap(uintptr_t va) {
return memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE);
} | [
0,
0
] |
Linux Kernel | arch/riscv/mm/init.c |
static void __init create_pte_mapping(pte_t *ptep, uintptr_t va, phys_addr_t pa,
phys_addr_t sz, pgprot_t prot) {
uintptr_t pte_idx = pte_index(va);
BUG_ON(sz != PAGE_SIZE);
if (pte_none(ptep[pte_idx]))
ptep[pte_idx] = pfn_pte(PFN_DOWN(pa), prot);
} | [
0,
0
] |
Linux Kernel | arch/riscv/mm/init.c | static pmd_t *__init get_pmd_virt_early(phys_addr_t pa) {
return (pmd_t *)((uintptr_t)pa);
} | [
0,
0
] |
Linux Kernel | arch/riscv/mm/init.c |
static pmd_t *__init get_pmd_virt_late(phys_addr_t pa) {
return (pmd_t *)__va(pa);
} | [
0,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.