arch/s390/kvm/interrupt.c
Source file repositories/reference/linux-study-clean/arch/s390/kvm/interrupt.c
File Facts
- System
- Linux kernel
- Corpus path
arch/s390/kvm/interrupt.c- Extension
.c- Size
- 103676 bytes
- Lines
- 3793
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/cpufeature.hlinux/interrupt.hlinux/kvm_host.hlinux/hrtimer.hlinux/export.hlinux/mmu_context.hlinux/nospec.hlinux/signal.hlinux/slab.hlinux/bitmap.hlinux/vmalloc.hasm/access-regs.hasm/asm-offsets.hasm/dis.hlinux/uaccess.hasm/sclp.hasm/isc.hasm/nmi.hasm/airq.hasm/tpi.hkvm-s390.hgaccess.htrace-s390.hpci.hgmap.h
Detected Declarations
function sca_ext_call_pendingfunction sca_inject_ext_callfunction sca_clear_ext_callfunction psw_extint_disabledfunction psw_ioint_disabledfunction psw_mchk_disabledfunction psw_interrupts_disabledfunction ckc_interrupts_enabledfunction ckc_irq_pendingfunction cpu_timer_interrupts_enabledfunction cpu_timer_irq_pendingfunction isc_to_isc_bitsfunction isc_to_int_wordfunction int_word_to_iscfunction gisa_set_iamfunction gisa_clear_ipmfunction gisa_get_ipm_or_restore_iamfunction gisa_set_ipm_giscfunction gisa_get_ipmfunction gisa_tac_ipm_giscfunction pending_irqs_no_gisafunction pending_irqsfunction isc_to_irq_typefunction irq_type_to_iscfunction disable_iscsfunction deliverable_irqsfunction __set_cpu_idlefunction __unset_cpu_idlefunction __reset_intercept_indicatorsfunction set_intercept_indicators_iofunction set_intercept_indicators_extfunction set_intercept_indicators_mchkfunction set_intercept_indicators_stopfunction set_intercept_indicatorsfunction __deliver_cpu_timerfunction __deliver_ckcfunction __deliver_pfault_initfunction __write_machine_checkfunction checkfunction __deliver_machine_checkfunction test_bitfunction __deliver_restartfunction __deliver_set_prefixfunction __deliver_emergency_signalfunction __deliver_external_callfunction __deliver_prog_pvfunction __deliver_progfunction write_sclp
Annotated Snippet
switch (lc) {
case 0:
case 10:
ext_sa_addr &= ~0x3ffUL;
break;
case 11:
ext_sa_addr &= ~0x7ffUL;
break;
case 12:
ext_sa_addr &= ~0xfffUL;
break;
default:
ext_sa_addr = 0;
break;
}
} else {
ext_sa_addr &= ~0x3ffUL;
}
if (!rc && mci.vr && ext_sa_addr && test_kvm_facility(vcpu->kvm, 129)) {
if (write_guest_abs(vcpu, ext_sa_addr, vcpu->run->s.regs.vrs,
512))
mci.vr = 0;
} else {
mci.vr = 0;
}
if (!rc && mci.gs && ext_sa_addr && test_kvm_facility(vcpu->kvm, 133)
&& (lc == 11 || lc == 12)) {
if (write_guest_abs(vcpu, ext_sa_addr + 1024,
&vcpu->run->s.regs.gscb, 32))
mci.gs = 0;
} else {
mci.gs = 0;
}
/* General interruption information */
rc |= put_guest_lc(vcpu, 1, (u8 __user *) __LC_AR_MODE_ID);
rc |= write_guest_lc(vcpu, __LC_MCK_OLD_PSW,
&vcpu->arch.sie_block->gpsw, sizeof(psw_t));
rc |= read_guest_lc(vcpu, __LC_MCK_NEW_PSW,
&vcpu->arch.sie_block->gpsw, sizeof(psw_t));
rc |= put_guest_lc(vcpu, mci.val, (u64 __user *) __LC_MCCK_CODE);
/* Register-save areas */
if (cpu_has_vx()) {
convert_vx_to_fp(fprs, (__vector128 *) vcpu->run->s.regs.vrs);
rc |= write_guest_lc(vcpu, __LC_FPREGS_SAVE_AREA, fprs, 128);
} else {
rc |= write_guest_lc(vcpu, __LC_FPREGS_SAVE_AREA,
vcpu->run->s.regs.fprs, 128);
}
rc |= write_guest_lc(vcpu, __LC_GPREGS_SAVE_AREA,
vcpu->run->s.regs.gprs, 128);
rc |= put_guest_lc(vcpu, vcpu->run->s.regs.fpc,
(u32 __user *) __LC_FP_CREG_SAVE_AREA);
rc |= put_guest_lc(vcpu, vcpu->arch.sie_block->todpr,
(u32 __user *) __LC_TOD_PROGREG_SAVE_AREA);
rc |= put_guest_lc(vcpu, kvm_s390_get_cpu_timer(vcpu),
(u64 __user *) __LC_CPU_TIMER_SAVE_AREA);
rc |= put_guest_lc(vcpu, vcpu->arch.sie_block->ckc >> 8,
(u64 __user *) __LC_CLOCK_COMP_SAVE_AREA);
rc |= write_guest_lc(vcpu, __LC_AREGS_SAVE_AREA,
&vcpu->run->s.regs.acrs, 64);
rc |= write_guest_lc(vcpu, __LC_CREGS_SAVE_AREA,
&vcpu->arch.sie_block->gcr, 128);
/* Extended interruption information */
rc |= put_guest_lc(vcpu, mchk->ext_damage_code,
(u32 __user *) __LC_EXT_DAMAGE_CODE);
rc |= put_guest_lc(vcpu, mchk->failing_storage_address,
(u64 __user *) __LC_MCCK_FAIL_STOR_ADDR);
rc |= write_guest_lc(vcpu, __LC_PSW_SAVE_AREA, &mchk->fixed_logout,
sizeof(mchk->fixed_logout));
return rc ? -EFAULT : 0;
}
static int __must_check __deliver_machine_check(struct kvm_vcpu *vcpu)
{
struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int;
struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int;
struct kvm_s390_mchk_info mchk = {};
int deliver = 0;
int rc = 0;
unsigned long flags;
spin_lock_irqsave(&fi->lock, flags);
spin_lock(&li->lock);
if (test_bit(IRQ_PEND_MCHK_EX, &li->pending_irqs) ||
test_bit(IRQ_PEND_MCHK_REP, &li->pending_irqs)) {
/*
Annotation
- Immediate include surface: `linux/cpufeature.h`, `linux/interrupt.h`, `linux/kvm_host.h`, `linux/hrtimer.h`, `linux/export.h`, `linux/mmu_context.h`, `linux/nospec.h`, `linux/signal.h`.
- Detected declarations: `function sca_ext_call_pending`, `function sca_inject_ext_call`, `function sca_clear_ext_call`, `function psw_extint_disabled`, `function psw_ioint_disabled`, `function psw_mchk_disabled`, `function psw_interrupts_disabled`, `function ckc_interrupts_enabled`, `function ckc_irq_pending`, `function cpu_timer_interrupts_enabled`.
- Atlas domain: Architecture Layer / arch/s390.
- Implementation status: integration implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.