arch/s390/kvm/dat.h

Source file repositories/reference/linux-study-clean/arch/s390/kvm/dat.h

File Facts

System
Linux kernel
Corpus path
arch/s390/kvm/dat.h
Extension
.h
Size
27963 bytes
Lines
979
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct segment_table {
	union pmd pmds[_CRST_ENTRIES];
};

struct region3_table {
	union pud puds[_CRST_ENTRIES];
};

struct region2_table {
	union p4d p4ds[_CRST_ENTRIES];
};

struct region1_table {
	union pgd pgds[_CRST_ENTRIES];
};

struct crst_table {
	union {
		union crste crstes[_CRST_ENTRIES];
		struct segment_table segment;
		struct region3_table region3;
		struct region2_table region2;
		struct region1_table region1;
	};
};

struct page_table {
	union pte ptes[_PAGE_ENTRIES];
	union pgste pgstes[_PAGE_ENTRIES];
};

static_assert(sizeof(struct crst_table) == _CRST_TABLE_SIZE);
static_assert(sizeof(struct page_table) == PAGE_SIZE);

struct dat_walk;

typedef long (*dat_walk_op)(union crste *crste, gfn_t gfn, gfn_t next, struct dat_walk *w);

struct dat_walk_ops {
	union {
		dat_walk_op crste_ops[4];
		struct {
			dat_walk_op pmd_entry;
			dat_walk_op pud_entry;
			dat_walk_op p4d_entry;
			dat_walk_op pgd_entry;
		};
	};
	long (*pte_entry)(union pte *pte, gfn_t gfn, gfn_t next, struct dat_walk *w);
};

struct dat_walk {
	const struct dat_walk_ops *ops;
	union crste *last;
	union pte *last_pte;
	union asce asce;
	gfn_t start;
	gfn_t end;
	int flags;
	void *priv;
};

struct ptval_param {
	unsigned char offset : 6;
	unsigned char len : 2;
};

/**
 * _pte() - Useful constructor for union pte
 * @pfn: the pfn this pte should point to.
 * @writable: whether the pte should be writable.
 * @dirty: whether the pte should be dirty.
 * @special: whether the pte should be marked as special
 *
 * The pte is also marked as young and present. If the pte is marked as dirty,
 * it gets marked as soft-dirty too. If the pte is not dirty, the hardware
 * protect bit is set (independently of the write softbit); this way proper
 * dirty tracking can be performed.
 *
 * Return: a union pte value.
 */
static inline union pte _pte(kvm_pfn_t pfn, bool writable, bool dirty, bool special)
{
	union pte res = { .val = PFN_PHYS(pfn) };

	res.h.p = !dirty;
	res.s.y = 1;
	res.s.pr = 1;
	res.s.w = writable;
	res.s.d = dirty;

Annotation

Implementation Notes