pvmfw: Validate incoming <reg> and <iommus> against phys'
This adds following validations:
- reg:
- Validates that PV reg and phys reg match in order via HVC
- Validates that there's no overlap among all PV reg and phys reg
- iommus:
- Validates that pvIOMMU and IOMMU match via HVC
- Validates that (IOMMU token, SID) pair is unique
- Validates that (pvIOMMU id, vSID) pair is unique
Bug: 277993056
Test: atest libpvmfw.device_assignment.test, launch protected VM
Change-Id: Iffe3ecf41bf13fca869849c50996ba6fbaea7955
diff --git a/pvmfw/src/fdt.rs b/pvmfw/src/fdt.rs
index 2a6819b..b53e452 100644
--- a/pvmfw/src/fdt.rs
+++ b/pvmfw/src/fdt.rs
@@ -675,6 +675,8 @@
patch_device_tree(fdt, &info)?;
+ // TODO(b/317201360): Ensure no overlapping in <reg> among devices
+
fdt.pack().map_err(|e| {
error!("Failed to unpack DT after patching: {e}");
RebootReason::InvalidFdt