hw: x86_64: refactor Vm_session_component

On x86, the `Vm_session_component` obscured the differences between SVM
and VMX.

Separate the implementations, factor out common functionality and
address a number of long-standing issues in the process:

- Allocate nested page tables from Core_ram_allocator as a more suitable
  abstraction and account for the required memory, subtract the
  necessary amount of RAM from the session's `Ram_quota` *before*
  constructing the session object, to make sure that the memory
  allocated from the `Core_ram_allocator` is available from the VMM's
  RAM quota.
- Move the allocation of Vcpu_state and Vcpu_data into the Core::Vcpu
  class and use the Core RAM Allocator to allocate memory with a known
  physical address.
- Remove the fixed number of virtual CPUs and the associated reservation
  of memory by using a Registry for a flexible amount of vCPUs.

Issue #5221
This commit is contained in:
Benjamin Lamowski
2025-01-07 16:35:16 +01:00
committed by Christian Helmuth
parent 922fdd1628
commit 05522696c7
13 changed files with 1051 additions and 298 deletions

View File

@ -99,7 +99,7 @@ struct Genode::Vm_connection : Connection<Vm_session>, Rpc_client<Vm_session>
long priority = Cpu_session::DEFAULT_PRIORITY,
unsigned long affinity = 0)
:
Connection<Vm_session>(env, label, Ram_quota { 16*1024 }, Affinity(),
Connection<Vm_session>(env, label, Ram_quota { 5*1024*1024 }, Affinity(),
Args("priority=", Hex(priority), ", "
"affinity=", Hex(affinity))),
Rpc_client<Vm_session>(cap())