pvmfw: Apply VM DTBO
This CL only applies assigned VM DTBO for the simplest case, which
iommu, phandle, nor aliases aren't involved.
Next CLs will handle following cases:
- Apply iommu. Platform DT will be also updated to have pre-populated
pvmiommu node
- Validate patched values (reg, iommu, ..)
- Handle __local_fixup__, __fixups__ (i.e. handle phandle in VM DTBO)
- Handle /alias in VM DTBO
- ...
Bug: 277993056
Test: atest libpvmfw.device_assignment.test, launch protected VM
Change-Id: I4e4aea0885da925ae419921d729380a1d71707e0
diff --git a/pvmfw/Android.bp b/pvmfw/Android.bp
index 8c21030..946ed85 100644
--- a/pvmfw/Android.bp
+++ b/pvmfw/Android.bp
@@ -59,6 +59,55 @@
],
}
+genrule {
+ name: "test_pvmfw_devices_vm_dtbo",
+ defaults: ["dts_to_dtb"],
+ srcs: ["testdata/test_pvmfw_devices_vm_dtbo.dts"],
+ out: ["test_pvmfw_devices_vm_dtbo.dtbo"],
+}
+
+genrule {
+ name: "test_pvmfw_devices_vm_dtbo_without_symbols",
+ defaults: ["dts_to_dtb"],
+ srcs: ["testdata/test_pvmfw_devices_vm_dtbo_without_symbols.dts"],
+ out: ["test_pvmfw_devices_vm_dtbo_without_symbols.dtbo"],
+}
+
+genrule {
+ name: "test_pvmfw_devices_with_rng",
+ defaults: ["dts_to_dtb"],
+ srcs: ["testdata/test_pvmfw_devices_with_rng.dts"],
+ out: ["test_pvmfw_devices_with_rng.dtb"],
+}
+
+rust_test {
+ name: "libpvmfw.device_assignment.test",
+ srcs: ["src/device_assignment.rs"],
+ defaults: ["avf_build_flags_rust"],
+ test_suites: ["general-tests"],
+ test_options: {
+ unit_test: true,
+ },
+ prefer_rlib: true,
+ rustlibs: [
+ "liblibfdt",
+ "liblog_rust",
+ "libpvmfw_fdt_template",
+ ],
+ data: [
+ ":test_pvmfw_devices_vm_dtbo",
+ ":test_pvmfw_devices_vm_dtbo_without_symbols",
+ ":test_pvmfw_devices_with_rng",
+ ],
+ // To use libpvmfw_fdt_template for testing
+ enabled: false,
+ target: {
+ android_arm64: {
+ enabled: true,
+ },
+ },
+}
+
cc_binary {
name: "pvmfw",
defaults: ["vmbase_elf_defaults"],