mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
hw: rename Vm_data to Vcpu_data
Rename Vm_data to Vcpu_data to make it clear that the allocated data is per vCPU, not per VM. Issue #5100
This commit is contained in:
parent
69b76ba9ed
commit
8540b4c9d1
@ -27,7 +27,7 @@ namespace Genode {
|
||||
* CPU context of a virtual machine
|
||||
*/
|
||||
struct Vcpu_state;
|
||||
using Vm_data = Vcpu_state;
|
||||
using Vcpu_data = Vcpu_state;
|
||||
struct Vcpu_state;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ namespace Genode {
|
||||
* CPU context of a virtual machine
|
||||
*/
|
||||
struct Vcpu_state;
|
||||
using Vm_data = Vcpu_state;
|
||||
using Vcpu_data = Vcpu_state;
|
||||
}
|
||||
|
||||
|
||||
|
@ -26,7 +26,7 @@ namespace Genode {
|
||||
* CPU context of a virtual machine
|
||||
*/
|
||||
struct Vcpu_state;
|
||||
using Vm_data = Vcpu_state;
|
||||
using Vcpu_data = Vcpu_state;
|
||||
|
||||
using uint128_t = __uint128_t;
|
||||
}
|
||||
|
@ -23,10 +23,10 @@ namespace Genode {
|
||||
/**
|
||||
* CPU context of a virtual machine
|
||||
*/
|
||||
struct Vm_data;
|
||||
struct Vcpu_data;
|
||||
}
|
||||
|
||||
struct Genode::Vm_data
|
||||
struct Genode::Vcpu_data
|
||||
{
|
||||
alignas(Genode::get_page_size())
|
||||
uint8_t vmcb[get_page_size()];
|
||||
|
@ -43,7 +43,7 @@ namespace Board {
|
||||
struct Vcpu_context;
|
||||
|
||||
using Vcpu_state = Genode::Vcpu_state;
|
||||
using Vm_data = Vcpu_state;
|
||||
using Vcpu_data = Vcpu_state;
|
||||
};
|
||||
|
||||
|
||||
|
@ -82,7 +82,7 @@ class Kernel::Vm : private Kernel::Object, public Cpu_job
|
||||
*/
|
||||
Vm(Irq::Pool & user_irq_pool,
|
||||
Cpu & cpu,
|
||||
Genode::Vm_data & data,
|
||||
Genode::Vcpu_data & data,
|
||||
Kernel::Signal_context & context,
|
||||
Identity & id);
|
||||
|
||||
|
@ -26,7 +26,7 @@ void Kernel::Thread::_call_new_vm()
|
||||
}
|
||||
|
||||
_call_new<Vm>(_user_irq_pool, _cpu_pool.cpu((unsigned)user_arg_2()),
|
||||
*(Board::Vm_data*)user_arg_3(),
|
||||
*(Board::Vcpu_data*)user_arg_3(),
|
||||
*context, *(Vm::Identity*)user_arg_4());
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace Kernel { class Cpu; }
|
||||
namespace Board {
|
||||
|
||||
using Core::Vcpu_state;
|
||||
using Vm_data = Core::Vcpu_state;
|
||||
using Vcpu_data = Core::Vcpu_state;
|
||||
|
||||
enum { VCPU_MAX = 1 };
|
||||
|
||||
|
@ -32,7 +32,7 @@ namespace Board {
|
||||
struct Vcpu_context;
|
||||
|
||||
using Vcpu_state = Genode::Vcpu_state;
|
||||
using Vm_data = Genode::Vcpu_state;
|
||||
using Vcpu_data = Genode::Vcpu_state;
|
||||
};
|
||||
|
||||
|
||||
|
@ -103,7 +103,7 @@ static Vmid_allocator &alloc()
|
||||
}
|
||||
|
||||
|
||||
Genode::addr_t Vm_session_component::_alloc_vm_data(Genode::addr_t ds_addr)
|
||||
Genode::addr_t Vm_session_component::_alloc_vcpu_data(Genode::addr_t ds_addr)
|
||||
{
|
||||
return ds_addr;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ using namespace Kernel;
|
||||
|
||||
Vm::Vm(Irq::Pool & user_irq_pool,
|
||||
Cpu & cpu,
|
||||
Genode::Vm_data & data,
|
||||
Genode::Vcpu_data & data,
|
||||
Kernel::Signal_context & context,
|
||||
Identity & id)
|
||||
:
|
||||
|
@ -52,7 +52,7 @@ void * Vm_session_component::_alloc_table()
|
||||
static unsigned id_alloc = 0;
|
||||
|
||||
|
||||
Genode::addr_t Vm_session_component::_alloc_vm_data(Genode::addr_t ds_addr)
|
||||
Genode::addr_t Vm_session_component::_alloc_vcpu_data(Genode::addr_t ds_addr)
|
||||
{
|
||||
return ds_addr;
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ void Board::Vcpu_context::Virtual_timer_irq::disable()
|
||||
|
||||
Kernel::Vm::Vm(Irq::Pool & user_irq_pool,
|
||||
Cpu & cpu,
|
||||
Genode::Vm_data & data,
|
||||
Genode::Vcpu_data & data,
|
||||
Kernel::Signal_context & context,
|
||||
Identity & id)
|
||||
:
|
||||
|
@ -110,7 +110,7 @@ void Board::Vcpu_context::Virtual_timer_irq::disable()
|
||||
|
||||
Vm::Vm(Irq::Pool & user_irq_pool,
|
||||
Cpu & cpu,
|
||||
Genode::Vm_data & data,
|
||||
Genode::Vcpu_data & data,
|
||||
Kernel::Signal_context & context,
|
||||
Identity & id)
|
||||
:
|
||||
|
@ -31,7 +31,7 @@ namespace Board {
|
||||
|
||||
struct Vcpu_context;
|
||||
|
||||
using Vm_data = Genode::Vm_data;
|
||||
using Vcpu_data = Genode::Vcpu_data;
|
||||
using Vcpu_state = Genode::Vcpu_state;
|
||||
|
||||
enum {
|
||||
|
@ -37,7 +37,7 @@ using Board::Vmcb;
|
||||
|
||||
Vm::Vm(Irq::Pool & user_irq_pool,
|
||||
Cpu & cpu,
|
||||
Genode::Vm_data & data,
|
||||
Genode::Vcpu_data & data,
|
||||
Kernel::Signal_context & context,
|
||||
Identity & id)
|
||||
:
|
||||
@ -78,7 +78,7 @@ void Vm::proceed(Cpu & cpu)
|
||||
* we can pop it later
|
||||
*/
|
||||
_vcpu_context.regs->trapno = _vcpu_context.vmcb.root_vmcb_phys;
|
||||
Hypervisor::switch_world(_vcpu_context.vmcb.vm_data()->vmcb_phys_addr,
|
||||
Hypervisor::switch_world(_vcpu_context.vmcb.vcpu_data()->vmcb_phys_addr,
|
||||
(addr_t) &_vcpu_context.regs->r8,
|
||||
_vcpu_context.regs->fpu_context());
|
||||
/*
|
||||
|
@ -155,9 +155,9 @@ struct alignas(Genode::get_page_size()) Board::Vmcb
|
||||
sizeof(Board::Vmcb_state_save_area) -
|
||||
Board::Vmcb_control_area::total_size];
|
||||
|
||||
Genode::Vm_data * vm_data()
|
||||
Genode::Vcpu_data * vcpu_data()
|
||||
{
|
||||
return reinterpret_cast<Genode::Vm_data *>(this);
|
||||
return reinterpret_cast<Genode::Vcpu_data *>(this);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -101,23 +101,23 @@ static Vmid_allocator &alloc()
|
||||
}
|
||||
|
||||
|
||||
Genode::addr_t Vm_session_component::_alloc_vm_data(Genode::addr_t ds_addr)
|
||||
Genode::addr_t Vm_session_component::_alloc_vcpu_data(Genode::addr_t ds_addr)
|
||||
{
|
||||
void * vm_data_ptr = cma()
|
||||
.alloc_aligned(sizeof(Board::Vm_data), 12)
|
||||
.convert<void *>(
|
||||
[&](void *ptr) { return ptr; },
|
||||
[&](Range_allocator::Alloc_error) -> void * {
|
||||
/* XXX handle individual error conditions */
|
||||
error("failed to allocate kernel object");
|
||||
throw Insufficient_ram_quota();
|
||||
}
|
||||
void * vcpu_data_ptr = cma()
|
||||
.alloc_aligned(sizeof(Board::Vcpu_data), 12)
|
||||
.convert<void *>(
|
||||
[&](void *ptr) { return ptr; },
|
||||
[&](Range_allocator::Alloc_error) -> void * {
|
||||
/* XXX handle individual error conditions */
|
||||
error("failed to allocate kernel object");
|
||||
throw Insufficient_ram_quota();
|
||||
}
|
||||
);
|
||||
|
||||
Genode::Vm_data* vm_data = (Genode::Vm_data *) vm_data_ptr;
|
||||
vm_data->vcpu_state = (Genode::Vcpu_state *) ds_addr;
|
||||
vm_data->vmcb_phys_addr = (addr_t)cma().phys_addr(vm_data->vmcb);
|
||||
return (Genode::addr_t) vm_data_ptr;
|
||||
Genode::Vcpu_data* vcpu_data = (Genode::Vcpu_data *) vcpu_data_ptr;
|
||||
vcpu_data->vcpu_state = (Genode::Vcpu_state *) ds_addr;
|
||||
vcpu_data->vmcb_phys_addr = (addr_t)cma().phys_addr(vcpu_data->vmcb);
|
||||
return (Genode::addr_t) vcpu_data_ptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -65,7 +65,7 @@ Capability<Vm_session::Native_vcpu> Vm_session_component::create_vcpu(Thread_cap
|
||||
|
||||
try {
|
||||
vcpu.ds_cap = _constrained_md_ram_alloc.alloc(_ds_size(), Cache::UNCACHED);
|
||||
vcpu.ds_addr = _alloc_vm_data(_region_map.attach(vcpu.ds_cap));
|
||||
vcpu.ds_addr = _alloc_vcpu_data(_region_map.attach(vcpu.ds_cap));
|
||||
} catch (...) {
|
||||
if (vcpu.ds_cap.valid())
|
||||
_constrained_md_ram_alloc.free(vcpu.ds_cap);
|
||||
|
@ -92,7 +92,7 @@ class Core::Vm_session_component
|
||||
unsigned _vcpu_id_alloc { 0 };
|
||||
|
||||
static size_t _ds_size();
|
||||
static size_t _alloc_vm_data(Genode::addr_t ds_addr);
|
||||
static size_t _alloc_vcpu_data(Genode::addr_t ds_addr);
|
||||
|
||||
void * _alloc_table();
|
||||
void _attach(addr_t phys_addr, addr_t vm_addr, size_t size);
|
||||
|
Loading…
Reference in New Issue
Block a user