mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
base-nova: Adapted PD session to the change of NOVA's API for cell management.
This commit is contained in:
@@ -106,27 +106,56 @@ void Pd_session_component::map(addr_t virt, addr_t size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _calculate_mask_for_location(Nova::mword_t *core_mask, const Affinity::Location &loc)
|
||||||
|
{
|
||||||
|
for (unsigned y = loc.ypos(); y < loc.ypos() + loc.height(); y++)
|
||||||
|
{
|
||||||
|
for (unsigned x = loc.xpos(); x < loc.xpos()+loc.width(); x++)
|
||||||
|
{
|
||||||
|
unsigned kernel_cpu = platform_specific().kernel_cpu_id(Affinity::Location(x, y, loc.width(), loc.height()));
|
||||||
|
unsigned i = kernel_cpu / (sizeof(Nova::mword_t) * 8);
|
||||||
|
unsigned b = kernel_cpu % (sizeof(Nova::mword_t) * 8);
|
||||||
|
core_mask[i] |= (1UL << b);
|
||||||
|
|
||||||
|
Genode::log("core_mask[", i, "]=", core_mask[i], " i=", i, "b=", b, "kernel_cpu=", kernel_cpu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Pd_session_component::create_cell(long prioritiy, const Affinity::Location &loc)
|
void Pd_session_component::create_cell(long prioritiy, const Affinity::Location &loc)
|
||||||
{
|
{
|
||||||
Nova::uint8_t err = Nova::NOVA_OK;
|
Nova::uint8_t err = Nova::NOVA_OK;
|
||||||
if ((err = Nova::create_cell(_pd->pd_sel(), prioritiy, loc.xpos(), loc.xpos()+loc.width())) != Nova::NOVA_OK) {
|
unsigned num_cpus = platform_specific().MAX_SUPPORTED_CPUS;
|
||||||
|
unsigned num_vect = num_cpus / (sizeof(Nova::mword_t) * 8);
|
||||||
|
Nova::mword_t core_mask[num_vect];
|
||||||
|
|
||||||
|
Genode::memset(core_mask, 0, sizeof(core_mask));
|
||||||
|
|
||||||
|
_calculate_mask_for_location(core_mask, loc);
|
||||||
|
|
||||||
|
log("Requested to create new cell for <", this->label(), "> of priority ", prioritiy, " at ", loc);
|
||||||
|
for (unsigned i = 0; i < num_vect; i++) {
|
||||||
|
if ((err = Nova::create_cell(_pd->pd_sel(), prioritiy, core_mask[i], i, 1) != Nova::NOVA_OK))
|
||||||
|
{
|
||||||
error("Could not create new cell: ", err);
|
error("Could not create new cell: ", err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pd_session_component::grow_cell(const Affinity::Location &loc)
|
|
||||||
{
|
|
||||||
Nova::uint8_t err = Nova::NOVA_OK;
|
|
||||||
if ((err = Nova::grow_cell(_pd->pd_sel(), loc.xpos(), loc.xpos()+loc.width())) != Nova::NOVA_OK) {
|
|
||||||
error("Could not enlarge cell: ", err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pd_session_component::shrink_cell(const Affinity::Location &loc)
|
void Pd_session_component::update_cell(const Affinity::Location &loc)
|
||||||
{
|
{
|
||||||
Nova::uint8_t err = Nova::NOVA_OK;
|
Nova::uint8_t err = Nova::NOVA_OK;
|
||||||
if ((err = Nova::shrink_cell(_pd->pd_sel(), loc.xpos(), loc.xpos()+loc.width())) != Nova::NOVA_OK) {
|
unsigned num_cpus = platform_specific().affinity_space().total();
|
||||||
error("Could not shrink down cell: ", err);
|
unsigned num_vect = num_cpus / (sizeof(Nova::mword_t) * 8);
|
||||||
|
Nova::mword_t core_mask[num_vect];
|
||||||
|
|
||||||
|
_calculate_mask_for_location(core_mask, loc);
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < num_vect; i++) {
|
||||||
|
if ((err = Nova::update_cell(_pd->pd_sel(), core_mask[i], i))) {
|
||||||
|
error("Failed to update cell <", label(), ">: ", err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,14 +111,9 @@ struct Genode::Pd_session_client : Rpc_client<Pd_session>
|
|||||||
call<Rpc_create_cell>(prioritiy, loc);
|
call<Rpc_create_cell>(prioritiy, loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void grow_cell(const Affinity::Location &loc) override
|
void update_cell(const Affinity::Location &loc) override
|
||||||
{
|
{
|
||||||
call<Rpc_grow_cell>(loc);
|
call<Rpc_update_cell>(loc);
|
||||||
}
|
|
||||||
|
|
||||||
void shrink_cell(const Affinity::Location &loc) override
|
|
||||||
{
|
|
||||||
call<Rpc_shrink_cell>(loc);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -351,9 +351,7 @@ struct Genode::Pd_session : Session, Ram_allocator
|
|||||||
*/
|
*/
|
||||||
virtual void create_cell(long prioritiy, const Affinity::Location &loc) = 0;
|
virtual void create_cell(long prioritiy, const Affinity::Location &loc) = 0;
|
||||||
|
|
||||||
virtual void shrink_cell(const Affinity::Location &loc) = 0;
|
virtual void update_cell(const Affinity::Location &loc) = 0;
|
||||||
|
|
||||||
virtual void grow_cell(const Affinity::Location &loc) = 0;
|
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
** RPC declaration **
|
** RPC declaration **
|
||||||
@@ -411,8 +409,7 @@ struct Genode::Pd_session : Session, Ram_allocator
|
|||||||
|
|
||||||
GENODE_RPC(Rpc_create_cell, void, create_cell, long, Affinity::Location const &);
|
GENODE_RPC(Rpc_create_cell, void, create_cell, long, Affinity::Location const &);
|
||||||
|
|
||||||
GENODE_RPC(Rpc_shrink_cell, void, shrink_cell, Affinity::Location const &);
|
GENODE_RPC(Rpc_update_cell, void, update_cell, Affinity::Location const &);
|
||||||
GENODE_RPC(Rpc_grow_cell, void, grow_cell, Affinity::Location const &);
|
|
||||||
|
|
||||||
GENODE_RPC_INTERFACE(Rpc_assign_parent, Rpc_assign_pci, Rpc_map,
|
GENODE_RPC_INTERFACE(Rpc_assign_parent, Rpc_assign_pci, Rpc_map,
|
||||||
Rpc_alloc_signal_source, Rpc_free_signal_source,
|
Rpc_alloc_signal_source, Rpc_free_signal_source,
|
||||||
@@ -424,7 +421,7 @@ struct Genode::Pd_session : Session, Ram_allocator
|
|||||||
Rpc_transfer_ram_quota, Rpc_ram_quota, Rpc_used_ram,
|
Rpc_transfer_ram_quota, Rpc_ram_quota, Rpc_used_ram,
|
||||||
Rpc_native_pd, Rpc_managing_system,
|
Rpc_native_pd, Rpc_managing_system,
|
||||||
Rpc_dma_addr, Rpc_attach_dma,
|
Rpc_dma_addr, Rpc_attach_dma,
|
||||||
Rpc_create_cell, Rpc_grow_cell, Rpc_shrink_cell);
|
Rpc_create_cell, Rpc_update_cell);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _INCLUDE__PD_SESSION__PD_SESSION_H_ */
|
#endif /* _INCLUDE__PD_SESSION__PD_SESSION_H_ */
|
||||||
|
|||||||
Reference in New Issue
Block a user