mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-21 06:33:31 +00:00
pc/platform: detect invalid IOMMU devices
genodelabs/genode#5002 genodelabs/genode#2700
This commit is contained in:
parent
c06b53e52e
commit
4163367b53
@ -349,6 +349,11 @@ Intel::Io_mmu::Io_mmu(Env & env,
|
|||||||
_managed_root_table(_env, table_allocator, *this, !coherent_page_walk()),
|
_managed_root_table(_env, table_allocator, *this, !coherent_page_walk()),
|
||||||
_domain_allocator(_max_domains()-1)
|
_domain_allocator(_max_domains()-1)
|
||||||
{
|
{
|
||||||
|
if (_broken_device()) {
|
||||||
|
error(name, " reports invalid capability registers. Please disable VT-d/IOMMU.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!read<Capability::Sagaw_4_level>() && !read<Capability::Sagaw_3_level>()) {
|
if (!read<Capability::Sagaw_4_level>() && !read<Capability::Sagaw_3_level>()) {
|
||||||
error("IOMMU does not support 3- or 4-level page tables");
|
error("IOMMU does not support 3- or 4-level page tables");
|
||||||
return;
|
return;
|
||||||
|
@ -482,6 +482,21 @@ class Intel::Io_mmu : private Attached_mmio,
|
|||||||
log("disabled IOMMU ", name());
|
log("disabled IOMMU ", name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Some broken BIOSes messes up the ACPI table. In consequence, we may
|
||||||
|
* try accessing invalid DMAR units. We only check for this to log an
|
||||||
|
* error as a hint to the user to disable VT-d.
|
||||||
|
*
|
||||||
|
* See #2700
|
||||||
|
*/
|
||||||
|
bool _broken_device()
|
||||||
|
{
|
||||||
|
return read<Capability>() == ~(Capability::access_t)0 ||
|
||||||
|
read<Extended_capability>() == ~(Extended_capability::access_t)0 ||
|
||||||
|
read<Capability>() == (Capability::access_t)0 ||
|
||||||
|
read<Extended_capability>() == (Extended_capability::access_t)0;
|
||||||
|
}
|
||||||
|
|
||||||
const uint32_t _supported_page_sizes {
|
const uint32_t _supported_page_sizes {
|
||||||
read<Capability::Page_1GB>() << 30 |
|
read<Capability::Page_1GB>() << 30 |
|
||||||
read<Capability::Page_2MB>() << 21 | 1u << 12 };
|
read<Capability::Page_2MB>() << 21 | 1u << 12 };
|
||||||
|
Loading…
Reference in New Issue
Block a user