Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
⌀
Function
large_stringlengths
11
3.45k
Label
list
Linux Kernel
arch/s390/kvm/priv.c
static int handle_gs(struct kvm_vcpu *vcpu) { vcpu->stat.instruction_gs++; if (test_kvm_facility(vcpu->kvm, 133)) { VCPU_EVENT(vcpu, 3, "%s", "ENABLE: GS (lazy)"); preempt_disable(); __ctl_set_bit(2, 4); current->thread.gs_cb = (struct gs_cb *)&vcpu->run->s.regs.gscb; restore_gs_cb(current->th...
[ 1, 0 ]
Linux Kernel
arch/s390/kvm/priv.c
static int handle_set_clock(struct kvm_vcpu *vcpu) { struct kvm_s390_vm_tod_clock gtod = {0}; int rc; u8 ar; u64 op2; vcpu->stat.instruction_sck++; if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); op2 = kvm_s390_get_base_disp_s(vcpu...
[ 1, 0 ]
Linux Kernel
arch/s390/kvm/priv.c
int kvm_s390_skey_check_enable(struct kvm_vcpu *vcpu) { int rc; trace_kvm_s390_skey_related_inst(vcpu); if (vcpu->arch.skey_enabled) return 0; rc = s390_enable_skey(); VCPU_EVENT(vcpu, 3, "enabling storage keys for guest: %d", rc); if (rc) return rc; if (kvm_s390_test_cpuflags(vcpu, CPUSTAT_KS...
[ 1, 0 ]
Linux Kernel
arch/s390/kvm/priv.c
static int handle_iske(struct kvm_vcpu *vcpu) { unsigned long gaddr, vmaddr; unsigned char key; int reg1, reg2; bool unlocked; int rc; vcpu->stat.instruction_iske++; if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); rc = try_handl...
[ 1, 0 ]
Linux Kernel
arch/s390/kvm/priv.c
static int handle_ipte_interlock(struct kvm_vcpu *vcpu) { vcpu->stat.instruction_ipte_interlock++; if (psw_bits(vcpu->arch.sie_block->gpsw).pstate) return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); wait_event(vcpu->kvm->arch.ipte_wq, !ipte_lock_held(vcpu->kvm)); kvm_s390_retry_instr(vcpu); VCP...
[ 1, 0 ]
Linux Kernel
arch/s390/kvm/priv.c
static int handle_stfl(struct kvm_vcpu *vcpu) { int rc; unsigned int fac; vcpu->stat.instruction_stfl++; if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); fac = *vcpu->kvm->arch.model.fac_list >> 32; rc = write_guest_lc(vcpu, offsetof(...
[ 1, 0 ]
Linux Kernel
arch/s390/kvm/priv.c
int is_valid_psw(psw_t *psw) { if (psw->mask & PSW_MASK_UNASSIGNED) return 0; if ((psw->mask & PSW_MASK_ADDR_MODE) == PSW_MASK_BA) { if (psw->addr & ~PSW_ADDR_31) return 0; } if (!(psw->mask & PSW_MASK_ADDR_MODE) && (psw->addr & ~PSW_ADDR_24)) return 0; if ((psw->mask & PSW_MASK_ADDR_MODE) ...
[ 0, 0 ]
Linux Kernel
arch/s390/kvm/priv.c
static int handle_stidp(struct kvm_vcpu *vcpu) { u64 stidp_data = vcpu->kvm->arch.model.cpuid; u64 operand2; int rc; u8 ar; vcpu->stat.instruction_stidp++; if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); operand2 = kvm_s390_get_ba...
[ 1, 0 ]
Linux Kernel
arch/s390/kvm/priv.c
static void handle_stsi_3_2_2(struct kvm_vcpu *vcpu, struct sysinfo_3_2_2 *mem) { int cpus = 0; int n; cpus = atomic_read(&vcpu->kvm->online_vcpus); if (stsi(mem, 3, 2, 2)) mem->count = 0; if (mem->count < 8) mem->count++; for (n = mem->count - 1; n > 0; n--) memc...
[ 1, 0 ]
Linux Kernel
arch/s390/kvm/priv.c
int kvm_s390_handle_lctl(struct kvm_vcpu *vcpu) { int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4; int reg3 = vcpu->arch.sie_block->ipa & 0x000f; int reg, rc, nr_regs; u32 ctl_array[16]; u64 ga; u8 ar; vcpu->stat.instruction_lctl++; if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) retu...
[ 1, 0 ]
Linux Kernel
arch/s390/kvm/priv.c
int kvm_s390_handle_stctl(struct kvm_vcpu *vcpu) { int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4; int reg3 = vcpu->arch.sie_block->ipa & 0x000f; int reg, rc, nr_regs; u32 ctl_array[16]; u64 ga; u8 ar; vcpu->stat.instruction_stctl++; if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) re...
[ 1, 0 ]
Linux Kernel
arch/s390/kvm/priv.c
static int handle_sckpf(struct kvm_vcpu *vcpu) { u32 value; vcpu->stat.instruction_sckpf++; if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); if (vcpu->run->s.regs.gprs[0] & 0x00000000ffff0000) return kvm_s390_inject_program_int(vcpu,...
[ 1, 0 ]
Linux Kernel
arch/s390/kvm/priv.c
int kvm_s390_handle_01(struct kvm_vcpu *vcpu) { switch (vcpu->arch.sie_block->ipa & 0x00ff) { case 0x04: return handle_ptff(vcpu); case 0x07: return handle_sckpf(vcpu); default: return -EOPNOTSUPP; } }
[ 1, 0 ]
Linux Kernel
arch/s390/kvm/pv.c
int kvm_s390_pv_destroy_cpu(struct kvm_vcpu *vcpu, u16 *rc, u16 *rrc) { int cc; if (!kvm_s390_pv_cpu_get_handle(vcpu)) return 0; cc = uv_cmd_nodata(kvm_s390_pv_cpu_get_handle(vcpu), UVC_CMD_DESTROY_SEC_CPU, rc, rrc); KVM_UV_EVENT(vcpu->kvm, 3, "PROTVIRT DESTROY VCPU %d: rc %x rrc %x"...
[ 1, 0 ]
Linux Kernel
arch/s390/kvm/pv.c
static int kvm_s390_pv_alloc_vm(struct kvm *kvm) { unsigned long base = uv_info.guest_base_stor_len; unsigned long virt = uv_info.guest_virt_var_stor_len; unsigned long npages = 0, vlen = 0; kvm->arch.pv.stor_var = NULL; kvm->arch.pv.stor_base = __get_free_pages(GFP_KERNEL_ACCOUNT, get_order(base)); ...
[ 1, 0 ]
Linux Kernel
arch/s390/kvm/pv.c
static int unpack_one(struct kvm *kvm, unsigned long addr, u64 tweak, u64 offset, u16 *rc, u16 *rrc) { struct uv_cb_unp uvcb = { .header.cmd = UVC_CMD_UNPACK_IMG, .header.len = sizeof(uvcb), .guest_handle = kvm_s390_pv_get_handle(kvm), .gaddr = addr, .tweak[0] = tw...
[ 1, 0 ]
Linux Kernel
arch/s390/kvm/pv.c
int kvm_s390_pv_dump_cpu(struct kvm_vcpu *vcpu, void *buff, u16 *rc, u16 *rrc) { struct uv_cb_dump_cpu uvcb = { .header.cmd = UVC_CMD_DUMP_CPU, .header.len = sizeof(uvcb), .cpu_handle = vcpu->arch.pv.handle, .dump_area_origin = (u64)buff, }; int cc; cc = uv_call_sched(0, (u64)&uvcb); ...
[ 1, 0 ]
Linux Kernel
arch/s390/kvm/sigp.c
static int __sigp_external_call(struct kvm_vcpu *vcpu, struct kvm_vcpu *dst_vcpu, u64 *reg) { struct kvm_s390_irq irq = { .type = KVM_S390_INT_EXTERNAL_CALL, .u.extcall.code = vcpu->vcpu_id, }; int rc; rc = kvm_s390_inject_vcpu(dst_vcpu, &irq); if (rc == -EBUSY) {...
[ 1, 0 ]
Linux Kernel
arch/s390/kvm/sigp.c
static int __sigp_stop(struct kvm_vcpu *vcpu, struct kvm_vcpu *dst_vcpu) { struct kvm_s390_irq irq = { .type = KVM_S390_SIGP_STOP, }; int rc; rc = kvm_s390_inject_vcpu(dst_vcpu, &irq); if (rc == -EBUSY) rc = SIGP_CC_BUSY; else if (rc == 0) VCPU_EVENT(vcpu, 4, "sent sigp stop to cpu %x", dst_...
[ 0, 0 ]
Linux Kernel
arch/s390/kvm/sigp.c
static int __sigp_set_arch(struct kvm_vcpu *vcpu, u32 parameter, u64 *status_reg) { *status_reg &= 0xffffffff00000000UL; *status_reg |= SIGP_STATUS_INVALID_PARAMETER; return SIGP_CC_STATUS_STORED; }
[ 1, 0 ]
Linux Kernel
arch/s390/kvm/sigp.c
static int __sigp_sense_running(struct kvm_vcpu *vcpu, struct kvm_vcpu *dst_vcpu, u64 *reg) { int rc; if (!test_kvm_facility(vcpu->kvm, 9)) { *reg &= 0xffffffff00000000UL; *reg |= SIGP_STATUS_INVALID_ORDER; return SIGP_CC_STATUS_STORED; } if (kvm_s390_test_cpuflags(...
[ 1, 0 ]
Linux Kernel
arch/s390/kvm/vsie.c
static int set_validity_icpt(struct kvm_s390_sie_block *scb, __u16 reason_code) { scb->ipa = 0x1000; scb->ipb = ((__u32)reason_code) << 16; scb->icptcode = ICPT_VALIDITY; return 1; }
[ 1, 0 ]
Linux Kernel
arch/s390/kvm/vsie.c
static int prefix_is_mapped(struct vsie_page *vsie_page) { return !(atomic_read(&vsie_page->scb_s.prog20) & PROG_REQUEST); }
[ 0, 0 ]
Linux Kernel
arch/s390/kvm/vsie.c
static int setup_apcb00(struct kvm_vcpu *vcpu, unsigned long *apcb_s, unsigned long apcb_o, unsigned long *apcb_h) { if (read_guest_real(vcpu, apcb_o, apcb_s, sizeof(struct kvm_s390_apcb0))) return -EFAULT; bitmap_and(apcb_s, apcb_s, apcb_h, sizeof(struct kvm_s390_apcb0)); return 0; ...
[ 1, 0 ]
Linux Kernel
arch/s390/kvm/vsie.c
static int setup_apcb(struct kvm_vcpu *vcpu, struct kvm_s390_crypto_cb *crycb_s, const u32 crycb_o, struct kvm_s390_crypto_cb *crycb_h, int fmt_o, int fmt_h) { struct kvm_s390_crypto_cb *crycb; crycb = (struct kvm_s390_crypto_cb *)(unsigned long)crycb_o; switch (fmt_o...
[ 1, 0 ]
Linux Kernel
arch/s390/kvm/vsie.c
static int pin_guest_page(struct kvm *kvm, gpa_t gpa, hpa_t *hpa) { struct page *page; page = gfn_to_page(kvm, gpa_to_gfn(gpa)); if (is_error_page(page)) return -EINVAL; *hpa = (hpa_t)page_to_virt(page) + (gpa & ~PAGE_MASK); return 0; }
[ 0, 0 ]
Linux Kernel
arch/s390/kvm/vsie.c
static int pin_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page, gpa_t gpa) { hpa_t hpa; int rc; rc = pin_guest_page(vcpu->kvm, gpa, &hpa); if (rc) { rc = kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); WARN_ON_ONCE(rc); return 1; } vsie_page->scb_o = (struct kvm_s39...
[ 0, 0 ]
Linux Kernel
arch/s390/kvm/vsie.c
static void handle_last_fault(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) { if (vsie_page->fault_addr) kvm_s390_shadow_fault(vcpu, vsie_page->gmap, vsie_page->fault_addr, NULL); vsie_page->fault_addr = 0; }
[ 0, 0 ]
Linux Kernel
arch/s390/kvm/vsie.c
static void retry_vsie_icpt(struct vsie_page *vsie_page) { struct kvm_s390_sie_block *scb_s = &vsie_page->scb_s; int ilen = insn_length(scb_s->ipa >> 8); /* take care of EXECUTE instructions */ if (scb_s->icptstatus & 1) { ilen = (scb_s->icptstatus >> 4) & 0x6; if (!ilen) ilen = 4; } scb_s->g...
[ 1, 0 ]
Linux Kernel
arch/s390/kvm/vsie.c
static void release_gmap_shadow(struct vsie_page *vsie_page) { if (vsie_page->gmap) gmap_put(vsie_page->gmap); WRITE_ONCE(vsie_page->gmap, NULL); prefix_unmapped(vsie_page); }
[ 0, 0 ]
Linux Kernel
arch/s390/kvm/vsie.c
static void put_vsie_page(struct kvm *kvm, struct vsie_page *vsie_page) { struct page *page = pfn_to_page(__pa(vsie_page) >> PAGE_SHIFT); page_ref_dec(page); }
[ 0, 0 ]
Linux Kernel
arch/s390/kvm/vsie.c
int kvm_s390_handle_vsie(struct kvm_vcpu *vcpu) { struct vsie_page *vsie_page; unsigned long scb_addr; int rc; vcpu->stat.instruction_sie++; if (!test_kvm_cpu_feat(vcpu->kvm, KVM_S390_VM_CPU_FEAT_SIEF2)) return -EOPNOTSUPP; if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) return kvm_s390_inje...
[ 1, 0 ]
Linux Kernel
arch/s390/lib/delay.c
void __udelay(unsigned long usecs) { delay_loop(usecs << 12); }
[ 0, 0 ]
Linux Kernel
arch/s390/lib/delay.c
void __ndelay(unsigned long nsecs) { nsecs <<= 9; do_div(nsecs, 125); delay_loop(nsecs); }
[ 1, 0 ]
Linux Kernel
arch/s390/lib/find.c
unsigned long find_first_bit_inv(const unsigned long *addr, unsigned long size) { const unsigned long *p = addr; unsigned long result = 0; unsigned long tmp; while (size & ~(BITS_PER_LONG - 1)) { if ((tmp = *(p++))) goto found; result += BITS_PER_LONG; size -=...
[ 1, 0 ]
Linux Kernel
arch/s390/lib/spinlock.c
void arch_spin_lock_setup(int cpu) { struct spin_wait *node; int ix; node = per_cpu_ptr(&spin_wait[0], cpu); for (ix = 0; ix < 4; ix++, node++) { memset(node, 0, sizeof(*node)); node->node_id = ((cpu + 1) << _Q_TAIL_CPU_OFFSET) + (ix << _Q_TAIL_IDX_OFFSET); } }
[ 1, 0 ]
Linux Kernel
arch/s390/lib/spinlock.c
static inline struct spin_wait *arch_spin_decode_tail(int lock) { int ix, cpu; ix = (lock & _Q_TAIL_IDX_MASK) >> _Q_TAIL_IDX_OFFSET; cpu = (lock & _Q_TAIL_CPU_MASK) >> _Q_TAIL_CPU_OFFSET; return per_cpu_ptr(&spin_wait[ix], cpu - 1); }
[ 0, 0 ]
Linux Kernel
arch/s390/lib/spinlock.c
static inline void arch_spin_lock_classic(arch_spinlock_t *lp) { int lockval, old, new, owner, count; lockval = SPINLOCK_LOCKVAL; /* Pass the virtual CPU to the lock holder if it is not running */ owner = arch_spin_yield_target(READ_ONCE(lp->lock), NULL); if (owner && arch_vcpu_is_preempted(owner - 1)) ...
[ 0, 0 ]
Linux Kernel
arch/s390/lib/spinlock.c
void arch_read_lock_wait(arch_rwlock_t *rw) { if (unlikely(in_interrupt())) { while (READ_ONCE(rw->cnts) & 0x10000) barrier(); return; } __atomic_add_const(-1, &rw->cnts); /* Put the reader into the wait queue */ arch_spin_lock(&rw->wait); /* Now add this reader to the count value again */ ...
[ 0, 0 ]
Linux Kernel
arch/s390/lib/string.c
size_t strnlen(const char *s, size_t n) { return __strnend(s, n) - s; }
[ 0, 0 ]
Linux Kernel
arch/s390/lib/string.c
size_t strlcat(char *dest, const char *src, size_t n) { size_t dsize = __strend(dest) - dest; size_t len = __strend(src) - src; size_t res = dsize + len; if (dsize < n) { dest += dsize; n -= dsize; if (len >= n) len = n - 1; dest[len] = '\0'; memcpy(dest, src, len); } return res; ...
[ 1, 0 ]
Linux Kernel
arch/s390/lib/string.c
int strcmp(const char *s1, const char *s2) { int ret = 0; asm volatile(" lghi 0,0\n" "0: clst %[s1],%[s2]\n" " jo 0b\n" " je 1f\n" " ic %[ret],0(%[s1])\n" " ic 0,0(%[s2])\n" " sr %[ret],0\n" "1:" ...
[ 0, 0 ]
Linux Kernel
arch/s390/lib/test_kprobes.c
static void test_kprobe_offset(struct kunit *test, struct kprobe *kp, const char *target, int offset) { int ret; setup_kprobe(test, kp, target, 0); ret = register_kprobe(kp); if (!ret) unregister_kprobe(kp); KUNIT_EXPECT_EQ(test, 0, ret); setup_kprobe(test, kp, target, o...
[ 0, 0 ]
Linux Kernel
arch/s390/lib/test_modules.c
static void test_modules_many_vmlinux_relocs(struct kunit *test) { int result = 0; #define CALL_RETURN(i) result += test_modules_return_##i() REPEAT_10000(CALL_RETURN); KUNIT_ASSERT_EQ(test, result, 49995000); }
[ 0, 0 ]
Linux Kernel
arch/s390/lib/test_unwind.c
static int test_unwind_kretprobe(struct unwindme *u) { int ret; struct kretprobe my_kretprobe; if (!IS_ENABLED(CONFIG_KPROBES)) kunit_skip(current_test, "requires CONFIG_KPROBES"); u->ret = -1; unwindme = u; memset(&my_kretprobe, 0, sizeof(my_kretprobe)); my_kretprobe.handler = kretprobe_ret_handle...
[ 1, 0 ]
Linux Kernel
arch/s390/lib/test_unwind.c
static int kprobe_pre_handler(struct kprobe *p, struct pt_regs *regs) { struct unwindme *u = unwindme; u->ret = test_unwind(NULL, (u->flags & UWM_REGS) ? regs : NULL, (u->flags & UWM_SP) ? u->sp : 0); return 0; }
[ 1, 0 ]
Linux Kernel
arch/s390/lib/test_unwind.c
static int test_unwind_ftrace(struct unwindme *u) { int ret; #ifdef CONFIG_DYNAMIC_FTRACE struct ftrace_ops *fops; fops = kunit_kzalloc(current_test, sizeof(*fops), GFP_KERNEL); fops->func = test_unwind_ftrace_handler; fops->flags = FTRACE_OPS_FL_DYNAMIC | FTRACE_OPS_FL_RECURSION | FTRACE_OP...
[ 1, 0 ]
Linux Kernel
arch/s390/lib/uaccess.c
static unsigned long raw_copy_from_user_key(void *to, const void __user *from, unsigned long size, unsigned long key) { unsigned long tmp1, tmp2; union oac spec = { .oac2.key = key, .oac2.as = PSW_BITS_AS_SECONDARY, ...
[ 0, 0 ]
Linux Kernel
arch/s390/lib/uaccess.c
static unsigned long raw_copy_to_user_key(void __user *to, const void *from, unsigned long size, unsigned long key) { unsigned long tmp1, tmp2; union oac spec = { .oac1.key = key, .oac1.as = PSW_BITS_AS_SECONDARY, ...
[ 0, 0 ]
Linux Kernel
arch/s390/lib/uaccess.c
unsigned long _copy_to_user_key(void __user *to, const void *from, unsigned long n, unsigned long key) { might_fault(); if (should_fail_usercopy()) return n; instrument_copy_to_user(to, from, n); return raw_copy_to_user_key(to, from, n, key); }
[ 0, 0 ]
Linux Kernel
arch/s390/lib/xor.c
static void xor_xc_3(unsigned long bytes, unsigned long *__restrict p1, const unsigned long *__restrict p2, const unsigned long *__restrict p3) { asm volatile(" larl 1,2f\n" " aghi %0,-1\n" " jm 3f\n" " srlg 0,%0,8\n" ...
[ 0, 0 ]
Linux Kernel
arch/s390/mm/cmm.c
static void cmm_kick_thread(void) { wake_up(&cmm_thread_wait); }
[ 0, 0 ]
Linux Kernel
arch/s390/mm/cmm.c
static int cmm_skip_blanks(char *cp, char **endp) { char *str; for (str = cp; *str == ' ' || *str == '\t'; str++) ; *endp = str; return str != cp; }
[ 0, 0 ]
Linux Kernel
arch/s390/mm/cmm.c
static int cmm_timed_pages_handler(struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { long nr = cmm_get_timed_pages(); struct ctl_table ctl_entry = { .procname = ctl->procname, .data = &nr, .maxlen = sizeof(long), }; int rc; rc ...
[ 1, 0 ]
Linux Kernel
arch/s390/mm/cmm.c
static void cmm_smsg_target(const char *from, char *msg) { long nr, seconds; if (strlen(sender) > 0 && strcmp(from, sender) != 0) return; if (!cmm_skip_blanks(msg + strlen(SMSG_PREFIX), &msg)) return; if (strncmp(msg, "SHRINK", 6) == 0) { if (!cmm_skip_blanks(msg + 6, &msg)) return; nr = ...
[ 1, 0 ]
Linux Kernel
arch/s390/mm/dump_pagetables.c
void ptdump_check_wx(void) { struct pg_state st = { .ptdump = {.note_page = note_page, .range = (struct ptdump_range[]){ {.start = 0, .end = max_addr}, {.start = 0, .end = 0}, }}, .seq = NULL, ...
[ 1, 0 ]
Linux Kernel
arch/s390/mm/extable.c
static bool ex_handler_ua_load_mem(const struct exception_table_entry *ex, struct pt_regs *regs) { unsigned int reg_addr = FIELD_GET(EX_DATA_REG_ADDR, ex->data); unsigned int reg_err = FIELD_GET(EX_DATA_REG_ERR, ex->data); size_t len = FIELD_GET(EX_DATA_LEN, ex->data); regs-...
[ 1, 0 ]
Linux Kernel
arch/s390/mm/extmem.c
void segment_unload(char *name) { unsigned long dummy; struct dcss_segment *seg; if (!MACHINE_IS_VM) return; mutex_lock(&dcss_lock); seg = segment_by_name(name); if (seg == NULL) { pr_err("Unloading unknown DCSS %s failed\n", name); goto out_unlock; } if (!refcount_dec_and_test(&seg->ref_c...
[ 1, 0 ]
Linux Kernel
arch/s390/mm/fault.c
static enum fault_type get_fault_type(struct pt_regs *regs) { unsigned long trans_exc_code; trans_exc_code = regs->int_parm_long & 3; if (likely(trans_exc_code == 0)) { if (user_mode(regs)) return USER_FAULT; if (!IS_ENABLED(CONFIG_PGSTE)) return KERNEL_FAULT; if (test_pt_regs_flag(regs,...
[ 0, 0 ]
Linux Kernel
arch/s390/mm/fault.c
static void dump_pagetable(unsigned long asce, unsigned long address) { unsigned long *table = __va(asce & _ASCE_ORIGIN); pr_alert("AS:%016lx ", asce); switch (asce & _ASCE_TYPE_MASK) { case _ASCE_TYPE_REGION1: table += (address & _REGION1_INDEX) >> _REGION1_SHIFT; if (bad_address(table)) goto b...
[ 1, 0 ]
Linux Kernel
arch/s390/mm/fault.c
static void dump_fault_info(struct pt_regs *regs) { unsigned long asce; pr_alert("Failing address: %016lx TEID: %016lx\n", regs->int_parm_long & __FAIL_ADDR_MASK, regs->int_parm_long); pr_alert("Fault in "); switch (regs->int_parm_long & 3) { case 3: pr_cont("home space "); break; case ...
[ 1, 0 ]
Linux Kernel
arch/s390/mm/fault.c
static noinline void do_sigsegv(struct pt_regs *regs, int si_code) { report_user_fault(regs, SIGSEGV, 1); force_sig_fault(SIGSEGV, si_code, (void __user *)(regs->int_parm_long & __FAIL_ADDR_MASK)); }
[ 0, 0 ]
Linux Kernel
arch/s390/mm/gmap.c
static void gmap_radix_tree_free(struct radix_tree_root *root) { struct radix_tree_iter iter; unsigned long indices[16]; unsigned long index; void __rcu **slot; int i, nr; index = 0; do { nr = 0; radix_tree_for_each_slot(slot, root, &iter, index) { indices[nr] = iter.index; if (++nr =...
[ 0, 0 ]
Linux Kernel
arch/s390/mm/gmap.c
void gmap_enable(struct gmap *gmap) { S390_lowcore.gmap = (unsigned long)gmap; }
[ 0, 0 ]
Linux Kernel
arch/s390/mm/gmap.c
void gmap_disable(struct gmap *gmap) { S390_lowcore.gmap = 0UL; }
[ 0, 0 ]
Linux Kernel
arch/s390/mm/gmap.c
struct gmap *gmap_get_enabled(void) { return (struct gmap *)S390_lowcore.gmap; }
[ 0, 0 ]
Linux Kernel
arch/s390/mm/gmap.c
static int __gmap_unlink_by_vmaddr(struct gmap *gmap, unsigned long vmaddr) { unsigned long *entry; int flush = 0; BUG_ON(gmap_is_shadow(gmap)); spin_lock(&gmap->guest_table_lock); entry = radix_tree_delete(&gmap->host_to_guest, vmaddr >> PMD_SHIFT); if (entry) { flush = (*entry != _SEGMENT_ENTRY_EMPTY...
[ 0, 0 ]
Linux Kernel
arch/s390/mm/gmap.c
void gmap_unlink(struct mm_struct *mm, unsigned long *table, unsigned long vmaddr) { struct gmap *gmap; int flush; rcu_read_lock(); list_for_each_entry_rcu(gmap, &mm->context.gmap_list, list) { flush = __gmap_unlink_by_vmaddr(gmap, vmaddr); if (flush) gmap_flush_tlb(gmap); } ...
[ 0, 0 ]
Linux Kernel
arch/s390/mm/gmap.c
int gmap_fault(struct gmap *gmap, unsigned long gaddr, unsigned int fault_flags) { unsigned long vmaddr; int rc; bool unlocked; mmap_read_lock(gmap->mm); retry: unlocked = false; vmaddr = __gmap_translate(gmap, gaddr); if (IS_ERR_VALUE(vmaddr)) { rc = vmaddr; goto out_up; } if...
[ 0, 0 ]
Linux Kernel
arch/s390/mm/gmap.c
void gmap_register_pte_notifier(struct gmap_notifier *nb) { spin_lock(&gmap_notifier_lock); list_add_rcu(&nb->list, &gmap_notifier_list); spin_unlock(&gmap_notifier_lock); }
[ 0, 0 ]
Linux Kernel
arch/s390/mm/gmap.c
static void gmap_call_notifier(struct gmap *gmap, unsigned long start, unsigned long end) { struct gmap_notifier *nb; list_for_each_entry(nb, &gmap_notifier_list, list) nb->notifier_call(gmap, start, end); }
[ 0, 0 ]
Linux Kernel
arch/s390/mm/gmap.c
static pte_t *gmap_pte_op_walk(struct gmap *gmap, unsigned long gaddr, spinlock_t **ptl) { unsigned long *table; BUG_ON(gmap_is_shadow(gmap)); table = gmap_table_walk(gmap, gaddr, 1); /* get segment pointer */ if (!table || *table & _SEGMENT_ENTRY_INVALID) return NULL; ret...
[ 0, 0 ]
Linux Kernel
arch/s390/mm/gmap.c
static int gmap_pte_op_fixup(struct gmap *gmap, unsigned long gaddr, unsigned long vmaddr, int prot) { struct mm_struct *mm = gmap->mm; unsigned int fault_flags; bool unlocked = false; BUG_ON(gmap_is_shadow(gmap)); fault_flags = (prot == PROT_WRITE) ? FAULT_FLAG_WRITE : 0; if (...
[ 0, 0 ]
Linux Kernel
arch/s390/mm/gmap.c
static int gmap_protect_pte(struct gmap *gmap, unsigned long gaddr, pmd_t *pmdp, int prot, unsigned long bits) { int rc; pte_t *ptep; spinlock_t *ptl = NULL; unsigned long pbits = 0; if (pmd_val(*pmdp) & _SEGMENT_ENTRY_INVALID) return -EAGAIN; ptep = pte_alloc_map_lock(gmap...
[ 1, 0 ]
Linux Kernel
arch/s390/mm/gmap.c
static int gmap_protect_range(struct gmap *gmap, unsigned long gaddr, unsigned long len, int prot, unsigned long bits) { unsigned long vmaddr, dist; pmd_t *pmdp; int rc; BUG_ON(gmap_is_shadow(gmap)); while (len) { rc = -EAGAIN; pmdp = gmap_pmd_op_walk(gmap, gaddr); i...
[ 0, 0 ]
Linux Kernel
arch/s390/mm/gmap.c
static void __gmap_unshadow_r1t(struct gmap *sg, unsigned long raddr, unsigned long *r1t) { unsigned long asce, *r2t; struct page *page; int i; BUG_ON(!gmap_is_shadow(sg)); asce = (unsigned long)r1t | _ASCE_TYPE_REGION1; for (i = 0; i < _CRST_ENTRIES; i++, raddr += _REGION1_...
[ 1, 0 ]
Linux Kernel
arch/s390/mm/gmap.c
static void gmap_unshadow(struct gmap *sg) { unsigned long *table; BUG_ON(!gmap_is_shadow(sg)); if (sg->removed) return; sg->removed = 1; gmap_call_notifier(sg, 0, -1UL); gmap_flush_tlb(sg); table = (unsigned long *)(sg->asce & _ASCE_ORIGIN); switch (sg->asce & _ASCE_TYPE_MASK) { case _ASCE_TYPE_...
[ 1, 0 ]
Linux Kernel
arch/s390/mm/gmap.c
void ptep_notify(struct mm_struct *mm, unsigned long vmaddr, pte_t *pte, unsigned long bits) { unsigned long offset, gaddr = 0; unsigned long *table; struct gmap *gmap, *sg, *next; offset = ((unsigned long)pte) & (255 * sizeof(pte_t)); offset = offset * (PAGE_SIZE / sizeof(pte_t)); rcu_rea...
[ 1, 0 ]
Linux Kernel
arch/s390/mm/gmap.c
static void gmap_pmdp_xchg(struct gmap *gmap, pmd_t *pmdp, pmd_t new, unsigned long gaddr) { gaddr &= HPAGE_MASK; pmdp_notify_gmap(gmap, pmdp, gaddr); new = clear_pmd_bit(new, __pgprot(_SEGMENT_ENTRY_GMAP_IN)); if (MACHINE_HAS_TLB_GUEST) __pmdp_idte(gaddr, (pmd_t *)pmdp, IDTE_GUES...
[ 0, 0 ]
Linux Kernel
arch/s390/mm/gmap.c
static void gmap_pmdp_clear(struct mm_struct *mm, unsigned long vmaddr, int purge) { pmd_t *pmdp; struct gmap *gmap; unsigned long gaddr; rcu_read_lock(); list_for_each_entry_rcu(gmap, &mm->context.gmap_list, list) { spin_lock(&gmap->guest_table_lock); pmdp = (pmd...
[ 0, 0 ]
Linux Kernel
arch/s390/mm/gmap.c
static inline void thp_split_mm(struct mm_struct *mm) { struct vm_area_struct *vma; VMA_ITERATOR(vmi, mm, 0); for_each_vma(vmi, vma) { vma->vm_flags &= ~VM_HUGEPAGE; vma->vm_flags |= VM_NOHUGEPAGE; walk_page_vma(vma, &thp_split_walk_ops, NULL); } mm->def_flags |= VM_NOHUGEPAGE; }
[ 0, 0 ]
Linux Kernel
arch/s390/mm/gmap.c
int s390_enable_sie(void) { struct mm_struct *mm = current->mm; if (mm_has_pgste(mm)) return 0; /* Fail if the page tables are 2K */ if (!mm_alloc_pgste(mm)) return -EINVAL; mmap_write_lock(mm); mm->context.has_pgste = 1; /* split thp mappings and disable thp for future mappings */ thp_split_mm...
[ 0, 0 ]
Linux Kernel
arch/s390/mm/gmap.c
void s390_uv_destroy_pfns(unsigned long count, unsigned long *pfns) { unsigned long i; for (i = 0; i < count; i++) { uv_destroy_owned_page(pfn_to_phys(pfns[i])); /* get rid of the extra reference */ put_page(pfn_to_page(pfns[i])); cond_resched(); } }
[ 0, 0 ]
Linux Kernel
arch/s390/mm/hugetlbpage.c
static void clear_huge_pte_skeys(struct mm_struct *mm, unsigned long rste) { struct page *page; unsigned long size, paddr; if (!mm_uses_skeys(mm) || rste & _SEGMENT_ENTRY_INVALID) return; if ((rste & _REGION_ENTRY_TYPE_MASK) == _REGION_ENTRY_TYPE_R3) { page = pud_page(__pud(rste)); size = PUD_SIZ...
[ 0, 0 ]
Linux Kernel
arch/s390/mm/hugetlbpage.c
pte_t huge_ptep_get(pte_t *ptep) { return __rste_to_pte(pte_val(*ptep)); }
[ 0, 0 ]
Linux Kernel
arch/s390/mm/hugetlbpage.c
int pud_huge(pud_t pud) { return pud_large(pud); }
[ 0, 0 ]
Linux Kernel
arch/s390/mm/init.c
int set_memory_decrypted(unsigned long addr, int numpages) { int i; for (i = 0; i < numpages; ++i) { uv_set_shared(addr); addr += PAGE_SIZE; } return 0; }
[ 0, 0 ]
Linux Kernel
arch/s390/mm/init.c
void __init mem_init(void) { cpumask_set_cpu(0, &init_mm.context.cpu_attach_mask); cpumask_set_cpu(0, mm_cpumask(&init_mm)); set_max_mapnr(max_low_pfn); high_memory = (void *)__va(max_low_pfn * PAGE_SIZE); pv_init(); kfence_split_mapping(); cmma_init(); /* this will put all low memory onto the freel...
[ 0, 0 ]
Linux Kernel
arch/s390/mm/init.c
void free_initmem(void) { __set_memory((unsigned long)_sinittext, (unsigned long)(_einittext - _sinittext) >> PAGE_SHIFT, SET_MEMORY_RW | SET_MEMORY_NX); free_initmem_default(POISON_FREE_INITMEM); }
[ 0, 0 ]
Linux Kernel
arch/s390/mm/init.c
static int s390_cma_mem_notifier(struct notifier_block *nb, unsigned long action, void *data) { struct s390_cma_mem_data mem_data; struct memory_notify *arg; int rc = 0; arg = data; mem_data.start = arg->start_pfn << PAGE_SHIFT; mem_data.end = mem_data.start + (arg->nr_pag...
[ 0, 0 ]
Linux Kernel
arch/s390/mm/init.c
int arch_add_memory(int nid, u64 start, u64 size, struct mhp_params *params) { unsigned long start_pfn = PFN_DOWN(start); unsigned long size_pages = PFN_DOWN(size); int rc; if (WARN_ON_ONCE(params->altmap)) return -EINVAL; if (WARN_ON_ONCE(params->pgprot.pgprot != PAGE_KERNEL.pgprot)) return -EINVA...
[ 1, 0 ]
Linux Kernel
arch/s390/mm/init.c
void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap) { unsigned long start_pfn = start >> PAGE_SHIFT; unsigned long nr_pages = size >> PAGE_SHIFT; __remove_pages(start_pfn, nr_pages, altmap); vmem_remove_mapping(start, size); }
[ 1, 0 ]
Linux Kernel
arch/s390/mm/kasan_init.c
static void *__init kasan_early_alloc_segment(void) { segment_pos -= _SEGMENT_SIZE; if (segment_pos < segment_low) kasan_early_panic("out of memory during initialisation\n"); return (void *)segment_pos; }
[ 0, 0 ]
Linux Kernel
arch/s390/mm/maccess.c
size_t memcpy_real_iter(struct iov_iter *iter, unsigned long src, size_t count) { size_t len, copied, res = 0; unsigned long phys, offset; void *chunk; pte_t pte; while (count) { phys = src & PAGE_MASK; offset = src & ~PAGE_MASK; chunk = (void *)(__memcpy_real_area + offs...
[ 0, 0 ]
Linux Kernel
arch/s390/mm/maccess.c
static int get_swapped_owner(phys_addr_t addr) { phys_addr_t lc; int cpu; for_each_online_cpu(cpu) { lc = virt_to_phys(lowcore_ptr[cpu]); if (addr > lc + sizeof(struct lowcore) - 1 || addr < lc) continue; return cpu; } return -1; }
[ 1, 0 ]
Linux Kernel
arch/s390/mm/maccess.c
void unxlate_dev_mem_ptr(phys_addr_t addr, void *ptr) { if (addr != virt_to_phys(ptr)) free_page((unsigned long)ptr); }
[ 0, 0 ]
Linux Kernel
arch/s390/mm/mmap.c
static unsigned long stack_maxrandom_size(void) { if (!(current->flags & PF_RANDOMIZE)) return 0; return STACK_RND_MASK << PAGE_SHIFT; }
[ 0, 0 ]
Linux Kernel
arch/s390/mm/page-states.c
static inline void set_page_unused(struct page *page, int order) { int i, rc; for (i = 0; i < (1 << order); i++) asm volatile(".insn rrf,0xb9ab0000,%0,%1,%2,0" : "=&d"(rc) : "a"(page_to_phys(page + i)), "i"(ESSA_SET_UNUSED)); }
[ 0, 0 ]
Linux Kernel
arch/s390/mm/page-states.c
static inline void set_page_stable_nodat(struct page *page, int order) { int i, rc; for (i = 0; i < (1 << order); i++) asm volatile(".insn rrf,0xb9ab0000,%0,%1,%2,0" : "=&d"(rc) : "a"(page_to_phys(page + i)), "i"(ESSA_SET_STABLE_NODAT)); }
[ 0, 0 ]
Linux Kernel
arch/s390/mm/page-states.c
static void mark_kernel_pmd(pud_t *pud, unsigned long addr, unsigned long end) { unsigned long next; struct page *page; pmd_t *pmd; pmd = pmd_offset(pud, addr); do { next = pmd_addr_end(addr, end); if (pmd_none(*pmd) || pmd_large(*pmd)) continue; page = phys_to_page(pmd_val(*pmd)); set...
[ 0, 0 ]