platform: use default domain only as fallback

The default IOMMU domain is used as a default if the kernel has IOMMU
support and if devices are not linked explicitly linked to a IOMMU
device. As soon as an IOMMU device is present, the kernel IOMMU is never
used. Hence, there is no point in maintaining the default domain if
there are other domains present.

genodelabs/genode#5494
This commit is contained in:
Johannes Schlatow 2025-03-26 15:14:59 +01:00 committed by Norman Feske
parent e4704a1d39
commit 1df55bd2dc
2 changed files with 9 additions and 5 deletions

View File

@ -87,10 +87,13 @@ class Driver::Io_mmu_domain_registry : public Registry<Io_mmu_domain>
template <typename FN>
void for_each_domain(FN && fn)
{
bool use_default { true };
for_each([&] (Io_mmu_domain & wrapper) {
fn(wrapper.domain); });
fn(wrapper.domain);
use_default = false;
});
if (_default_domain.constructed())
if (use_default && _default_domain.constructed())
fn(_default_domain->domain);
}

View File

@ -463,9 +463,10 @@ Session_component::Session_component(Env & env,
_ram_quota_guard().withdraw(Ram_quota{5*1024});
/**
* Until we integrated IOMMU support within the platform driver, we assume
* there is a kernel_iommu used by each device if _iommu is set. We therefore
* construct a corresponding domain object at session construction.
* Fallback, in case there is no IOMMU present but the kernel implements it,
* is to let every device use the kernel IOMMU implicitly.
* We therefore construct a corresponding domain object at session
* construction.
*/
if (kernel_iommu)
_io_mmu_devices.for_each([&] (Io_mmu & io_mmu_dev) {