arch/s390/kvm/priv.c
Source file repositories/reference/linux-study-clean/arch/s390/kvm/priv.c
File Facts
- System
- Linux kernel
- Corpus path
arch/s390/kvm/priv.c- Extension
.c- Size
- 42896 bytes
- Lines
- 1567
- Domain
- Architecture Layer
- Bucket
- arch/s390
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kvm.hlinux/gfp.hlinux/errno.hlinux/mm_types.hlinux/pgtable.hlinux/io.hasm/asm-offsets.hasm/facility.hasm/current.hasm/debug.hasm/ebcdic.hasm/sysinfo.hasm/page-states.hasm/ptrace.hasm/sclp.hasm/ap.hasm/gmap_helpers.hgaccess.hkvm-s390.htrace.hgmap.h
Detected Declarations
function Authorfunction kvm_s390_handle_aafunction handle_gsfunction kvm_s390_handle_e3function handle_set_clockfunction installedfunction handle_set_prefixfunction handle_store_prefixfunction handle_store_cpu_addressfunction kvm_s390_skey_check_enablefunction try_handle_skeyfunction handle_iskefunction handle_rrbefunction handle_sskefunction handle_ipte_interlockfunction handle_test_blockfunction handle_tpifunction handle_tschfunction handle_io_instfunction kvm_s390_is_gpa_in_memslotfunction handle_pqapfunction handle_stflfunction is_valid_pswfunction kvm_s390_handle_lpswfunction handle_lpswefunction handle_lpsweyfunction handle_stidpfunction handle_stsi_3_2_2function insert_stsi_usr_datafunction handle_stsifunction kvm_s390_handle_b2function handle_epswfunction handle_pfmffunction test_kvm_facilityfunction scoped_guardfunction heldfunction _essa_clear_cbrlfunction handle_essafunction kvm_s390_handle_b9function kvm_s390_handle_lctlfunction kvm_s390_handle_stctlfunction handle_lctlgfunction handle_stctgfunction kvm_s390_handle_ebfunction handle_tprotfunction kvm_s390_handle_e5function handle_sckpffunction handle_ptff
Annotated Snippet
scoped_guard(read_lock, &vcpu->kvm->mmu_lock) {
rc = dat_cond_set_storage_key(vcpu->arch.mc, vcpu->arch.gmap->asce,
gpa_to_gfn(start), key, &oldkey,
m3 & SSKE_NQ, m3 & SSKE_MR, m3 & SSKE_MC);
}
if (rc > 1)
return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
if (rc == -ENOMEM) {
kvm_s390_mmu_cache_topup(vcpu->arch.mc);
continue;
}
if (rc < 0)
return rc;
start += PAGE_SIZE;
}
if (m3 & (SSKE_MC | SSKE_MR)) {
if (m3 & SSKE_MB) {
/* skey in reg1 is unpredictable */
kvm_s390_set_psw_cc(vcpu, 3);
} else {
kvm_s390_set_psw_cc(vcpu, rc);
vcpu->run->s.regs.gprs[reg1] &= ~0xff00UL;
vcpu->run->s.regs.gprs[reg1] |= (u64)oldkey.skey << 8;
}
}
if (m3 & SSKE_MB) {
if (psw_bits(vcpu->arch.sie_block->gpsw).eaba == PSW_BITS_AMODE_64BIT)
vcpu->run->s.regs.gprs[reg2] &= ~PAGE_MASK;
else
vcpu->run->s.regs.gprs[reg2] &= ~0xfffff000UL;
end = kvm_s390_logical_to_effective(vcpu, end);
vcpu->run->s.regs.gprs[reg2] |= end;
}
return 0;
}
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);
VCPU_EVENT(vcpu, 4, "%s", "retrying ipte interlock operation");
return 0;
}
static int handle_test_block(struct kvm_vcpu *vcpu)
{
gpa_t addr;
int reg2;
vcpu->stat.instruction_tb++;
if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
kvm_s390_get_regs_rre(vcpu, NULL, ®2);
addr = vcpu->run->s.regs.gprs[reg2] & PAGE_MASK;
addr = kvm_s390_logical_to_effective(vcpu, addr);
if (kvm_s390_check_low_addr_prot_real(vcpu, addr))
return kvm_s390_inject_prog_irq(vcpu, &vcpu->arch.pgm);
addr = kvm_s390_real_to_abs(vcpu, addr);
if (!kvm_is_gpa_in_memslot(vcpu->kvm, addr))
return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
/*
* We don't expect errors on modern systems, and do not care
* about storage keys (yet), so let's just clear the page.
*/
if (kvm_clear_guest(vcpu->kvm, addr, PAGE_SIZE))
return -EFAULT;
kvm_s390_set_psw_cc(vcpu, 0);
vcpu->run->s.regs.gprs[0] = 0;
return 0;
}
static int handle_tpi(struct kvm_vcpu *vcpu)
{
struct kvm_s390_interrupt_info *inti;
unsigned long len;
u32 tpi_data[3];
int rc;
u64 addr;
u8 ar;
vcpu->stat.instruction_tpi++;
addr = kvm_s390_get_base_disp_s(vcpu, &ar);
Annotation
- Immediate include surface: `linux/kvm.h`, `linux/gfp.h`, `linux/errno.h`, `linux/mm_types.h`, `linux/pgtable.h`, `linux/io.h`, `asm/asm-offsets.h`, `asm/facility.h`.
- Detected declarations: `function Author`, `function kvm_s390_handle_aa`, `function handle_gs`, `function kvm_s390_handle_e3`, `function handle_set_clock`, `function installed`, `function handle_set_prefix`, `function handle_store_prefix`, `function handle_store_cpu_address`, `function kvm_s390_skey_check_enable`.
- Atlas domain: Architecture Layer / arch/s390.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.