/* * Bits 0-1 are used to encode the memory ownership state of each page from the * point of view of a pKVM "component" (host, hyp, guest, ... see enum * pkvm_component_id): * 00: The page is owned and exclusively accessible by the component; * 01: The page is owned and accessible by the component, but is also * accessible by another component; * 10: The page is accessible but not owned by the component; * The storage of this state depends on the component: either in the * hyp_vmemmap for the host and hyp states or in PTE software bits for guests.
*/ enum pkvm_page_state {
PKVM_PAGE_OWNED = 0ULL,
PKVM_PAGE_SHARED_OWNED = BIT(0),
PKVM_PAGE_SHARED_BORROWED = BIT(1),
/* * 'Meta-states' are not stored directly in PTE SW bits for guest * states, but inferred from the context (e.g. invalid PTE entries). * For the host and hyp, meta-states are stored directly in the * struct hyp_page.
*/
PKVM_NOPAGE = BIT(0) | BIT(1),
}; #define PKVM_PAGE_STATE_MASK (BIT(0) | BIT(1))
/* Host state. Guarded by the host stage-2 lock. */ unsigned __host_state : 4;
/* * Complement of the hyp state. Guarded by the hyp stage-1 lock. We use * the complement so that the initial 0 in __hyp_state_comp (due to the * entire vmemmap starting off zeroed) encodes PKVM_NOPAGE.
*/ unsigned __hyp_state_comp : 4;
/* * Refcounting for 'struct hyp_page'. * hyp_pool::lock must be held if atomic access to the refcount is required.
*/ staticinlineint hyp_page_count(void *addr)
{ struct hyp_page *p = hyp_virt_to_page(addr);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.