ZXFoundation™ 26h2
Loading...
Searching...
No Matches
core.cxx File Reference

DGP memory-contract adapter validation implementation. More...

import std;
import lib.error;
import arch.s390x.mmu.consts;
import arch.s390x.mmu.types;
import zxfoundation.dgp.isolation.types;
import zxfoundation.base.types;
Include dependency graph for core.cxx:

Functions

auto zxfoundation::dgp::memory_contract::authorize_mapping (const contract_request &request) noexcept -> std::expected< contract_result, lib::kernel_error >
 Authorize creation of a VM mapping authority record.
auto zxfoundation::dgp::memory_contract::authorize_protect (const contract_request &request, arch::s390x::mmu::page_prot old_prot) noexcept -> std::expected< contract_result, lib::kernel_error >
 Authorize a VM protection change.
auto zxfoundation::dgp::memory_contract::authorize_unmap (const contract_request &request) noexcept -> std::expected< contract_result, lib::kernel_error >
 Authorize removal of a VM mapping authority record.
auto zxfoundation::dgp::memory_contract::contract_generation () noexcept -> u64
 Return the current DGP memory-policy generation.
auto zxfoundation::dgp::memory_contract::generation_bump () noexcept -> u64
 Advance the global memory-contract generation.
auto zxfoundation::dgp::memory_contract::resolve_storage_key (u8 storage_key) noexcept -> std::expected< u8, lib::kernel_error >
 Resolve a storage key value for region metadata.
auto zxfoundation::dgp::memory_contract::validate_range (u64 va_start, u64 va_end) noexcept -> std::expected< void, lib::kernel_error >
 Validate a virtual address range before a VM or portal operation.
auto zxfoundation::dgp::memory_contract::validate_request (const contract_request &request) noexcept -> std::expected< void, lib::kernel_error >
 Validate a complete memory-contract request.
auto zxfoundation::dgp::memory_contract::validate_storage_key (u8 storage_key) noexcept -> std::expected< void, lib::kernel_error >
 Validate a storage key for a DGP memory request.

Variables

no_export std::atomic< u64 > zxfoundation::dgp::memory_contract::detail::g_generation {1ULL}
 Live monotonic generation.
no_export std::atomic< u64 > zxfoundation::dgp::memory_contract::g_generation
 Live monotonic generation.

Detailed Description

DGP memory-contract adapter validation implementation.

SPDX-License-Identifier: Apache-2.0

Function Documentation

◆ authorize_mapping()

auto zxfoundation::dgp::memory_contract::authorize_mapping ( const contract_request & request) ->std::expected< contract_result, lib::kernel_error >
nodiscardexportnoexcept

Authorize creation of a VM mapping authority record.

Parameters
[in]requestComplete VM/DAT/storage-key/NUMA request.
Returns
DGP policy metadata to store in the owning vm_region.
Note
The result records conservative invalidation needs; actual PTLB/IDTE/IPTE dispatch is wired in the DAT invalidation wave.
Warning
This function authorizes policy only; it does not allocate frames or install DAT entries.
Parameters
[in]requestComplete VM/DAT/storage-key/NUMA request.
Returns
DGP policy metadata to store in the owning vm_region.

◆ authorize_protect()

auto zxfoundation::dgp::memory_contract::authorize_protect ( const contract_request & request,
arch::s390x::mmu::page_prot old_prot )->std::expected< contract_result, lib::kernel_error >
nodiscardexportnoexcept

Authorize a VM protection change.

Parameters
[in]requestComplete VM/DAT/storage-key/NUMA request for the new protection.
[in]old_protPrevious hardware protection bits.
Returns
DGP policy metadata to store in affected VM regions.
Note
Any changed DAT protection is conservatively marked address-space scoped until CPU-ASCE attachment tracking is complete.
Warning
The caller must perform DAT invalidation before reusing frames or relaxing storage-key authority.
Parameters
[in]requestComplete VM/DAT/storage-key/NUMA request for the new protection.
[in]old_protPrevious hardware protection bits.
Returns
DGP policy metadata to store in affected VM regions.

◆ authorize_unmap()

auto zxfoundation::dgp::memory_contract::authorize_unmap ( const contract_request & request) ->std::expected< contract_result, lib::kernel_error >
nodiscardexportnoexcept

Authorize removal of a VM mapping authority record.

Parameters
[in]requestComplete VM/DAT/storage-key/NUMA request describing the removed range.
Returns
DGP policy metadata describing the required teardown authority.
Note
Physical frame, portal, storage-key, and DAT reuse must wait for the returned invalidation scope.
Warning
This function does not perform teardown; it only selects policy metadata.
Parameters
[in]requestComplete VM/DAT/storage-key/NUMA request describing the removed range.
Returns
DGP policy metadata describing the required teardown authority.

◆ resolve_storage_key()

auto zxfoundation::dgp::memory_contract::resolve_storage_key ( u8 storage_key) ->std::expected< u8, lib::kernel_error >
nodiscardexportnoexcept

Resolve a storage key value for region metadata.

Parameters
[in]storage_keyRequested storage key, or isolation::STORAGE_KEY_AUTO.
Returns
Concrete architected storage-key access-control value.
Parameters
[in]storage_keyRequested storage key, or STORAGE_KEY_AUTO.
Returns
Concrete architected storage-key access-control value.

◆ validate_range()

auto zxfoundation::dgp::memory_contract::validate_range ( u64 va_start,
u64 va_end )->std::expected< void, lib::kernel_error >
nodiscardexportnoexcept

Validate a virtual address range before a VM or portal operation.

Parameters
[in]va_startFirst virtual address in the range.
[in]va_endExclusive end of the virtual range.
Returns
Success when the range is ordered, non-empty, and page-aligned.
Note
The contract checks generic range safety only; ownership and DAT effects are checked by later adapters.
Warning
Passing this check does not install or invalidate any DAT entry.
Parameters
[in]va_startFirst virtual address in the range.
[in]va_endExclusive end of the virtual range.
Returns
Success when the range is ordered, non-empty, and page-aligned.

◆ validate_request()

auto zxfoundation::dgp::memory_contract::validate_request ( const contract_request & request) ->std::expected< void, lib::kernel_error >
nodiscardexportnoexcept

Validate a complete memory-contract request.

Parameters
[in]requestDGP memory request to validate.
Returns
Success when the generic range, length, and storage-key constraints are satisfied.
Note
Later migration waves will bind this request to VM regions, DAT permissions, NUMA zones, and TLB scope.
Warning
This adapter performs no allocation and installs no mapping.
Parameters
[in]requestDGP memory request to validate.
Returns
Success when the generic range, length, and storage-key constraints are satisfied.

◆ validate_storage_key()

auto zxfoundation::dgp::memory_contract::validate_storage_key ( u8 storage_key) ->std::expected< void, lib::kernel_error >
nodiscardexportnoexcept

Validate a storage key for a DGP memory request.

Parameters
[in]storage_keyFour-bit access-control key value.
Returns
Success when the key is architecturally representable.
Note
The IBM PoP defines the storage-key access-control field as four bits.
Warning
This check does not allocate, reserve, or release a key.
Parameters
[in]storage_keyFour-bit access-control key value.
Returns
Success when the key is architecturally representable.