x86: use slave label to differentiate device PDs

Issue #1848
This commit is contained in:
Alexander Boettcher 2016-01-08 18:11:23 +01:00 committed by Christian Helmuth
parent 82e35326b7
commit cec3ca6a70
3 changed files with 15 additions and 12 deletions

View File

@ -41,9 +41,10 @@ class Platform::Device_pd_policy : public Genode::Slave_policy
Device_pd_policy(Genode::Rpc_entrypoint &slave_ep,
Genode::Ram_session_capability ram_ref_cap,
Genode::addr_t device_pd_ram_quota)
Genode::addr_t device_pd_ram_quota,
const char * label)
:
Slave_policy("device_pd", slave_ep),
Slave_policy(label, slave_ep, nullptr, "device_pd"),
_lock(Genode::Lock::LOCKED),
_ram_ref_cap(ram_ref_cap),
_device_pd_slave(slave_ep, *this, device_pd_ram_quota, ram_ref_cap)

View File

@ -147,6 +147,9 @@ void Platform::Device_pd_component::assign_pci(Genode::Io_mem_dataspace_capabili
PERR("assignment of PCI device %x:%x.%x failed phys=%lx virt=%lx",
rid >> 8, (rid >> 3) & 0x1f, rid & 0x7,
ds_client.phys_addr(), page);
else
PINF("assignment of %x:%x.%x succeeded",
rid >> 8, (rid >> 3) & 0x1f, rid & 0x7);
/* we don't need the mapping anymore */
rm_session()->detach(page);
@ -156,8 +159,6 @@ int main(int argc, char **argv)
{
using namespace Genode;
Genode::printf("Device protection domain starting ...\n");
/*
* Initialize server entry point
*/
@ -177,8 +178,6 @@ int main(int argc, char **argv)
env()->parent()->announce(ep.manage(&root));
printf("Device protection domain started\n");
Genode::sleep_forever();
return 0;
}

View File

@ -145,7 +145,8 @@ namespace Platform {
Devicepd (Genode::Rpc_entrypoint &ep,
Genode::Allocator_guard &md_alloc,
Genode::Ram_session_capability ram_ref_cap)
Genode::Ram_session_capability ram_ref_cap,
const char * label)
:
policy(nullptr),
child(Genode::reinterpret_cap_cast<Device_pd>(Genode::Native_capability())),
@ -161,7 +162,7 @@ namespace Platform {
}
try {
policy = new (md_alloc) Device_pd_policy(ep, ram_ref_cap, DEVICE_PD_RAM_QUOTA);
policy = new (md_alloc) Device_pd_policy(ep, ram_ref_cap, DEVICE_PD_RAM_QUOTA, label);
using Genode::Session_capability;
using Genode::Affinity;
@ -199,11 +200,11 @@ namespace Platform {
bool valid() { return policy && policy->root().valid() && child.valid(); }
};
Genode::Lazy_volatile_object<struct Devicepd> _device_pd;
Genode::Session_label _label;
Genode::Session_policy _policy;
Genode::Lazy_volatile_object<struct Devicepd> _device_pd;
enum { MAX_PCI_DEVICES = Device_config::MAX_BUSES *
Device_config::MAX_DEVICES *
Device_config::MAX_FUNCTIONS };
@ -745,7 +746,8 @@ namespace Platform {
if (!_device_pd.is_constructed())
_device_pd.construct(_device_pd_ep, _md_alloc,
_resources.ram().cap());
_resources.ram().cap(),
_label.string());
if (!_device_pd->valid())
return;
@ -772,7 +774,8 @@ namespace Platform {
{
if (!_device_pd.is_constructed())
_device_pd.construct(_device_pd_ep, _md_alloc,
_resources.ram().cap());
_resources.ram().cap(),
_label.string());
if (!_md_alloc.withdraw(size))
throw Out_of_metadata();