arch/s390/kvm/dat.c
Source file repositories/reference/linux-study-clean/arch/s390/kvm/dat.c
File Facts
- System
- Linux kernel
- Corpus path
arch/s390/kvm/dat.c- Extension
.c- Size
- 35555 bytes
- Lines
- 1323
- 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.
- 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/kernel.hlinux/pagewalk.hlinux/swap.hlinux/smp.hlinux/spinlock.hlinux/slab.hlinux/swapops.hlinux/ksm.hlinux/mm.hlinux/mman.hlinux/pgtable.hlinux/kvm_types.hlinux/kvm_host.hlinux/pgalloc.hasm/page-states.hasm/tlb.hdat.h
Detected Declarations
struct slot_privstruct dat_get_cmma_statestruct dat_set_cmma_statefunction Authorfunction dat_free_levelfunction dat_set_asce_limitfunction dat_crstep_xchg_atomicfunction dat_set_storage_key_from_pgstefunction dat_move_storage_keyfunction dat_save_storage_key_into_pgstefunction __dat_ptep_xchgfunction dat_split_stefunction dat_split_crstefunction dat_entry_walkfunction dat_pte_walk_rangefunction dat_crste_walk_rangefunction _dat_walk_gfn_rangefunction dat_get_storage_keyfunction dat_update_ptep_sdfunction dat_set_storage_keyfunction page_cond_set_storage_keyfunction dat_cond_set_storage_keyfunction dat_reset_reference_bitfunction dat_reset_skeys_ptefunction dat_reset_skeys_crstefunction dat_reset_skeysfunction _dat_slot_ptefunction _dat_slot_crstefunction dat_set_slotfunction pgste_set_unlock_multiplefunction pgste_get_trylock_multiplefunction dat_get_ptvalfunction dat_set_ptvalfunction _dat_test_young_ptefunction _dat_test_young_crstefunction dat_test_age_gfnfunction dat_set_pn_crstefunction dat_set_pn_ptefunction dat_set_prefix_notif_bitfunction dat_perform_essafunction dat_reset_cmma_ptefunction dat_reset_cmmafunction __dat_peek_cmma_ptefunction __dat_peek_cmma_crstefunction dat_peek_cmmafunction __dat_get_cmma_ptefunction dat_get_cmmafunction __dat_set_cmma_pte
Annotated Snippet
struct slot_priv {
unsigned long token;
struct kvm_s390_mmu_cache *mc;
};
static long _dat_slot_pte(union pte *ptep, gfn_t gfn, gfn_t next, struct dat_walk *walk)
{
struct slot_priv *p = walk->priv;
union crste dummy = { .val = p->token };
union pte new_pte, pte = READ_ONCE(*ptep);
new_pte = _PTE_TOK(dummy.tok.type, dummy.tok.par);
/* Table entry already in the desired state. */
if (pte.val == new_pte.val)
return 0;
dat_ptep_xchg(ptep, new_pte, gfn, walk->asce, false);
return 0;
}
static long _dat_slot_crste(union crste *crstep, gfn_t gfn, gfn_t next, struct dat_walk *walk)
{
union crste new_crste, crste = READ_ONCE(*crstep);
struct slot_priv *p = walk->priv;
new_crste.val = p->token;
new_crste.h.tt = crste.h.tt;
/* Table entry already in the desired state. */
if (crste.val == new_crste.val)
return 0;
/* This table entry needs to be updated. */
if (walk->start <= gfn && walk->end >= next) {
if (!dat_crstep_xchg_atomic(crstep, crste, new_crste, gfn, walk->asce))
return -EINVAL;
/* A lower level table was present, needs to be freed. */
if (!crste.h.fc && !crste.h.i) {
if (is_pmd(crste))
dat_free_pt(dereference_pmd(crste.pmd));
else
dat_free_level(dereference_crste(crste), true);
}
return 0;
}
/* A lower level table is present, things will handled there. */
if (!crste.h.fc && !crste.h.i)
return 0;
/* Split (install a lower level table), and handle things there. */
return dat_split_crste(p->mc, crstep, gfn, walk->asce, false);
}
static const struct dat_walk_ops dat_slot_ops = {
.pte_entry = _dat_slot_pte,
.crste_ops = { _dat_slot_crste, _dat_slot_crste, _dat_slot_crste, _dat_slot_crste, },
};
int dat_set_slot(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t start, gfn_t end,
u16 type, u16 param)
{
struct slot_priv priv = {
.token = _CRSTE_TOK(0, type, param).val,
.mc = mc,
};
return _dat_walk_gfn_range(start, end, asce, &dat_slot_ops,
DAT_WALK_IGN_HOLES | DAT_WALK_ANY, &priv);
}
static void pgste_set_unlock_multiple(union pte *first, int n, union pgste *pgstes)
{
int i;
for (i = 0; i < n; i++) {
if (!pgstes[i].pcl)
break;
pgste_set_unlock(first + i, pgstes[i]);
}
}
static bool pgste_get_trylock_multiple(union pte *first, int n, union pgste *pgstes)
{
int i;
for (i = 0; i < n; i++) {
if (!pgste_get_trylock(first + i, pgstes + i))
break;
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/pagewalk.h`, `linux/swap.h`, `linux/smp.h`, `linux/spinlock.h`, `linux/slab.h`, `linux/swapops.h`, `linux/ksm.h`.
- Detected declarations: `struct slot_priv`, `struct dat_get_cmma_state`, `struct dat_set_cmma_state`, `function Author`, `function dat_free_level`, `function dat_set_asce_limit`, `function dat_crstep_xchg_atomic`, `function dat_set_storage_key_from_pgste`, `function dat_move_storage_key`, `function dat_save_storage_key_into_pgste`.
- Atlas domain: Architecture Layer / arch/s390.
- Implementation status: source implementation candidate.
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.