arch/s390/kvm/vsie.c
Source file repositories/reference/linux-study-clean/arch/s390/kvm/vsie.c
File Facts
- System
- Linux kernel
- Corpus path
arch/s390/kvm/vsie.c- Extension
.c- Size
- 48655 bytes
- Lines
- 1656
- Domain
- Architecture Layer
- Bucket
- arch/s390
- Inferred role
- Architecture Layer: implementation source
- Status
- source 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.
- 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/align.hlinux/vmalloc.hlinux/kvm_host.hlinux/bug.hlinux/compiler.hlinux/list.hlinux/bitmap.hlinux/sched/signal.hlinux/stddef.hlinux/io.hlinux/mman.hasm/mmu_context.hasm/sclp.hasm/nmi.hasm/dis.hasm/facility.hkvm-s390.hgaccess.hgmap.h
Detected Declarations
struct vsie_pageenum vsie_page_flagsfunction set_validity_icptfunction prefix_unmappedfunction prefix_unmapped_syncfunction prefix_mappedfunction prefix_is_mappedfunction update_intervention_requestsfunction prepare_cpuflagsfunction setup_apcb10function setup_apcb00function setup_apcb11function setup_apcbfunction set_validity_icptfunction shadow_esafunction prepare_ibcfunction unshadow_scbfunction shadow_scbfunction kvm_s390_vsie_gmap_notifierfunction map_prefixfunction pin_guest_pagefunction unpin_guest_pagefunction unpin_blocksfunction pointersfunction unpin_scbfunction pin_scbfunction inject_faultfunction handle_faultfunction handle_last_faultfunction clear_vsie_icptfunction retry_vsie_icptfunction handle_stfle_0function handle_stfle_2function handle_stflefunction vsie_get_registerfunction vsie_handle_mvpgfunction do_vsie_runfunction release_gmap_shadowfunction scoped_guardfunction register_shadow_scbfunction unregister_shadow_scbfunction vsie_runfunction try_get_vsie_pagefunction put_vsie_pagefunction kvm_s390_handle_vsiefunction kvm_s390_vsie_initfunction kvm_s390_vsie_destroyfunction kvm_s390_vsie_kick
Annotated Snippet
struct vsie_page {
struct kvm_s390_sie_block scb_s; /* 0x0000 */
/*
* the backup info for machine check. ensure it's at
* the same offset as that in struct sie_page!
*/
struct mcck_volatile_info mcck_info; /* 0x0200 */
/*
* The pinned original scb. Be aware that other VCPUs can modify
* it while we read from it. Values that are used for conditions or
* are reused conditionally, should be accessed via READ_ONCE.
*/
struct kvm_s390_sie_block *scb_o; /* 0x0218 */
/*
* Flags: must be set/cleared atomically after the vsie page can be
* looked up by other CPUs.
*/
unsigned long flags; /* 0x0220 */
/* address of the last reported fault to guest2 */
unsigned long fault_addr; /* 0x0228 */
/* calculated guest addresses of satellite control blocks */
gpa_t sca_gpa; /* 0x0230 */
gpa_t itdba_gpa; /* 0x0238 */
gpa_t gvrd_gpa; /* 0x0240 */
gpa_t riccbd_gpa; /* 0x0248 */
gpa_t sdnx_gpa; /* 0x0250 */
/*
* guest address of the original SCB. Remains set for free vsie
* pages, so we can properly look them up in our addr_to_page
* radix tree.
*/
gpa_t scb_gpa; /* 0x0258 */
/* the shadow gmap in use by the vsie_page */
struct gmap_cache gmap_cache; /* 0x0260 */
__u8 reserved[0x06f8 - 0x0278]; /* 0x0278 */
struct kvm_s390_crypto_cb crycb; /* 0x06f8 */
__u8 fac[8 + S390_ARCH_FAC_LIST_SIZE_BYTE];/* 0x07f8 */
};
static_assert(sizeof(struct vsie_page) == PAGE_SIZE);
/* trigger a validity icpt for the given scb */
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;
}
/* mark the prefix as unmapped, this will block the VSIE */
static void prefix_unmapped(struct vsie_page *vsie_page)
{
atomic_or(PROG_REQUEST, &vsie_page->scb_s.prog20);
}
/* mark the prefix as unmapped and wait until the VSIE has been left */
static void prefix_unmapped_sync(struct vsie_page *vsie_page)
{
prefix_unmapped(vsie_page);
if (vsie_page->scb_s.prog0c & PROG_IN_SIE)
atomic_or(CPUSTAT_STOP_INT, &vsie_page->scb_s.cpuflags);
while (vsie_page->scb_s.prog0c & PROG_IN_SIE)
cpu_relax();
}
/* mark the prefix as mapped, this will allow the VSIE to run */
static void prefix_mapped(struct vsie_page *vsie_page)
{
atomic_andnot(PROG_REQUEST, &vsie_page->scb_s.prog20);
}
/* test if the prefix is mapped into the gmap shadow */
static int prefix_is_mapped(struct vsie_page *vsie_page)
{
return !(atomic_read(&vsie_page->scb_s.prog20) & PROG_REQUEST);
}
/* copy the updated intervention request bits into the shadow scb */
static void update_intervention_requests(struct vsie_page *vsie_page)
{
const int bits = CPUSTAT_STOP_INT | CPUSTAT_IO_INT | CPUSTAT_EXT_INT;
int cpuflags;
cpuflags = atomic_read(&vsie_page->scb_o->cpuflags);
atomic_andnot(bits, &vsie_page->scb_s.cpuflags);
atomic_or(cpuflags & bits, &vsie_page->scb_s.cpuflags);
}
Annotation
- Immediate include surface: `linux/align.h`, `linux/vmalloc.h`, `linux/kvm_host.h`, `linux/bug.h`, `linux/compiler.h`, `linux/list.h`, `linux/bitmap.h`, `linux/sched/signal.h`.
- Detected declarations: `struct vsie_page`, `enum vsie_page_flags`, `function set_validity_icpt`, `function prefix_unmapped`, `function prefix_unmapped_sync`, `function prefix_mapped`, `function prefix_is_mapped`, `function update_intervention_requests`, `function prepare_cpuflags`, `function setup_apcb10`.
- Atlas domain: Architecture Layer / arch/s390.
- Implementation status: source 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.