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/Android.bp b/pvmfw/Android.bp
index 37d8ac9..b12ae26 100644
--- a/pvmfw/Android.bp
+++ b/pvmfw/Android.bp
@@ -82,12 +82,15 @@
data: [
":test_pvmfw_devices_vm_dtbo",
":test_pvmfw_devices_vm_dtbo_without_symbols",
+ ":test_pvmfw_devices_vm_dtbo_with_duplicated_iommus",
":test_pvmfw_devices_with_rng",
":test_pvmfw_devices_with_multiple_devices_iommus",
":test_pvmfw_devices_with_iommu_sharing",
":test_pvmfw_devices_with_iommu_id_conflict",
":test_pvmfw_devices_without_device",
":test_pvmfw_devices_without_iommus",
+ ":test_pvmfw_devices_with_duplicated_pviommus",
+ ":test_pvmfw_devices_with_multiple_reg_iommus",
],
// To use libpvmfw_fdt_template for testing
enabled: false,
@@ -124,6 +127,13 @@
out: ["test_pvmfw_devices_vm_dtbo_without_symbols.dtbo"],
}
+genrule {
+ name: "test_pvmfw_devices_vm_dtbo_with_duplicated_iommus",
+ defaults: ["dts_to_dtb"],
+ srcs: ["testdata/test_pvmfw_devices_vm_dtbo_with_duplicated_iommus.dts"],
+ out: ["test_pvmfw_devices_vm_dtbo_with_duplicated_iommus.dtbo"],
+}
+
genrule_defaults {
name: "test_device_assignment_dts_to_dtb",
defaults: ["dts_to_dtb"],
@@ -172,6 +182,20 @@
out: ["test_pvmfw_devices_with_iommu_id_conflict.dtb"],
}
+genrule {
+ name: "test_pvmfw_devices_with_duplicated_pviommus",
+ defaults: ["test_device_assignment_dts_to_dtb"],
+ srcs: ["testdata/test_pvmfw_devices_with_duplicated_pviommus.dts"],
+ out: ["test_pvmfw_devices_with_duplicated_pviommus.dtb"],
+}
+
+genrule {
+ name: "test_pvmfw_devices_with_multiple_reg_iommus",
+ defaults: ["test_device_assignment_dts_to_dtb"],
+ srcs: ["testdata/test_pvmfw_devices_with_multiple_reg_iommus.dts"],
+ out: ["test_pvmfw_devices_with_multiple_reg_iommus.dtb"],
+}
+
cc_binary {
name: "pvmfw",
defaults: ["vmbase_elf_defaults"],