pvmfw: Use label syntax for device assignment test data
Bug: 323453334
Test: atest libpvmfw.device_assignment.test
Change-Id: Iee55d61196c1471f84ca840b145c779f62ea6f48
diff --git a/Android.bp b/Android.bp
index 6e7c3c8..f50007f 100644
--- a/Android.bp
+++ b/Android.bp
@@ -87,7 +87,7 @@
genrule_defaults {
name: "dts_to_dtb",
tools: ["dtc"],
- cmd: "FILES=($(in)) && $(location dtc) -I dts -O dtb $${FILES[-1]} -o $(out)",
+ cmd: "FILES=($(in)) && $(location dtc) -@ -I dts -O dtb $${FILES[-1]} -o $(out)",
}
// This is a temporary workaround until b/309090563 is implemented.
diff --git a/pvmfw/src/device_assignment.rs b/pvmfw/src/device_assignment.rs
index d4f87c6..9c3e566 100644
--- a/pvmfw/src/device_assignment.rs
+++ b/pvmfw/src/device_assignment.rs
@@ -922,7 +922,7 @@
let expected = [AssignedDeviceInfo {
node_path: CString::new("/bus0/backlight").unwrap(),
- dtbo_node_path: cstr!("/fragment@backlight/__overlay__/bus0/backlight").into(),
+ dtbo_node_path: cstr!("/fragment@0/__overlay__/bus0/backlight").into(),
reg: vec![[0x9, 0xFF].into()],
interrupts: into_fdt_prop(vec![0x0, 0xF, 0x4]),
iommus: vec![],
@@ -946,7 +946,7 @@
let expected = [AssignedDeviceInfo {
node_path: CString::new("/rng").unwrap(),
- dtbo_node_path: cstr!("/fragment@rng/__overlay__/rng").into(),
+ dtbo_node_path: cstr!("/fragment@0/__overlay__/rng").into(),
reg: vec![[0x9, 0xFF].into()],
interrupts: into_fdt_prop(vec![0x0, 0xF, 0x4]),
iommus: vec![(PvIommu { id: 0x4 }, Vsid(0xFF0))],
@@ -973,23 +973,22 @@
let symbols = vm_dtbo.symbols().unwrap().unwrap();
- let rng = vm_dtbo.node(cstr!("/fragment@rng/__overlay__/rng")).unwrap();
+ let rng = vm_dtbo.node(cstr!("/fragment@0/__overlay__/rng")).unwrap();
assert_ne!(rng, None);
let rng_symbol = symbols.getprop_str(cstr!("rng")).unwrap();
- assert_eq!(Some(cstr!("/fragment@rng/__overlay__/rng")), rng_symbol);
+ assert_eq!(Some(cstr!("/fragment@0/__overlay__/rng")), rng_symbol);
- let light = vm_dtbo.node(cstr!("/fragment@rng/__overlay__/light")).unwrap();
+ let light = vm_dtbo.node(cstr!("/fragment@0/__overlay__/light")).unwrap();
assert_eq!(light, None);
let light_symbol = symbols.getprop_str(cstr!("light")).unwrap();
assert_eq!(None, light_symbol);
- let led = vm_dtbo.node(cstr!("/fragment@led/__overlay__/led")).unwrap();
+ let led = vm_dtbo.node(cstr!("/fragment@0/__overlay__/led")).unwrap();
assert_eq!(led, None);
let led_symbol = symbols.getprop_str(cstr!("led")).unwrap();
assert_eq!(None, led_symbol);
- let backlight =
- vm_dtbo.node(cstr!("/fragment@backlight/__overlay__/bus0/backlight")).unwrap();
+ let backlight = vm_dtbo.node(cstr!("/fragment@0/__overlay__/bus0/backlight")).unwrap();
assert_eq!(backlight, None);
let backlight_symbol = symbols.getprop_str(cstr!("backlight")).unwrap();
assert_eq!(None, backlight_symbol);
diff --git a/pvmfw/testdata/test_pvmfw_devices_vm_dtbo.dts b/pvmfw/testdata/test_pvmfw_devices_vm_dtbo.dts
index 23bc3c0..daf8158 100644
--- a/pvmfw/testdata/test_pvmfw_devices_vm_dtbo.dts
+++ b/pvmfw/testdata/test_pvmfw_devices_vm_dtbo.dts
@@ -1,4 +1,5 @@
/dts-v1/;
+/plugin/;
/ {
host {
@@ -6,113 +7,62 @@
#size-cells = <0x1>;
rng {
reg = <0x0 0x12f00000 0xFF>;
- iommus = <0x1 0x3>;
- android,pvmfw,target = <0x2>;
+ iommus = <&iommu0 0x3>;
+ android,pvmfw,target = <&rng>;
};
light {
reg = <0x0 0x00f00000 0x1000>, <0x0 0x00f10000 0x1000>;
- iommus = <0x3 0x4>, <0x4 0x5>;
- android,pvmfw,target = <0x5>;
+ iommus = <&iommu1 0x4>, <&iommu2 0x5>;
+ android,pvmfw,target = <&light>;
};
led {
reg = <0x0 0x12000000 0x9>;
- iommus = <0x1 0x9>;
- android,pvmfw,target = <0x6>;
+ iommus = <&iommu0 0x9>;
+ android,pvmfw,target = <&led>;
};
bus0 {
#address-cells = <0x1>;
#size-cells = <0x1>;
backlight {
reg = <0x300 0xFF>;
- android,pvmfw,target = <0x7>;
+ android,pvmfw,target = <&backlight>;
};
};
- iommu0 {
+ iommu0: iommu0 {
#iommu-cells = <0x1>;
android,pvmfw,token = <0x0 0x12e40000>;
- phandle = <0x1>;
};
- iommu1 {
+ iommu1: iommu1 {
#iommu-cells = <0x1>;
android,pvmfw,token = <0x0 0x40000>;
- phandle = <0x3>;
};
- iommu2 {
+ iommu2: iommu2 {
#iommu-cells = <0x1>;
android,pvmfw,token = <0x0 0x50000>;
- phandle = <0x4>;
- };
- };
- fragment@rng {
- target-path = "/";
- __overlay__ {
- rng {
- compatible = "android,rng";
- android,rng,ignore-gctrl-reset;
- phandle = <0x2>;
- };
- };
- };
- fragment@sensor {
- target-path = "/";
- __overlay__ {
- light {
- compatible = "android,light";
- version = <0x1 0x2>;
- phandle = <0x5>;
- };
- };
- };
- fragment@led {
- target-path = "/";
- __overlay__ {
- led {
- compatible = "android,led";
- prop = <0x555>;
- phandle = <0x6>;
- };
- };
- };
- fragment@backlight {
- target-path = "/";
- __overlay__ {
- bus0 {
- backlight {
- compatible = "android,backlight";
- android,backlight,ignore-gctrl-reset;
- phandle = <0x7>;
- };
- };
- };
- };
- __symbols__ {
- iommu0 = "/host/iommu0";
- iommu1 = "/host/iommu1";
- iommu2 = "/host/iommu2";
- rng = "/fragment@rng/__overlay__/rng";
- light = "/fragment@sensor/__overlay__/light";
- led = "/fragment@led/__overlay__/led";
- backlight = "/fragment@backlight/__overlay__/bus0/backlight";
- };
- __local_fixups__ {
- host {
- rng {
- iommus = <0x0>;
- android,pvmfw,target = <0x0>;
- };
- light {
- iommus = <0x0 0x8>;
- android,pvmfw,target = <0x0>;
- };
- led {
- iommus = <0x0>;
- android,pvmfw,target = <0x0>;
- };
- bus0 {
- backlight {
- android,pvmfw,target = <0x0>;
- };
- };
};
};
};
+
+&{/} {
+ rng: rng {
+ compatible = "android,rng";
+ android,rng,ignore-gctrl-reset;
+ };
+
+ light: light {
+ compatible = "android,light";
+ version = <0x1 0x2>;
+ };
+
+ led: led {
+ compatible = "android,led";
+ prop = <0x555>;
+ };
+
+ bus0 {
+ backlight: backlight {
+ compatible = "android,backlight";
+ android,backlight,ignore-gctrl-reset;
+ };
+ };
+};
\ No newline at end of file
diff --git a/pvmfw/testdata/test_pvmfw_devices_vm_dtbo_with_duplicated_iommus.dts b/pvmfw/testdata/test_pvmfw_devices_vm_dtbo_with_duplicated_iommus.dts
index 45b26e0..fb68320 100644
--- a/pvmfw/testdata/test_pvmfw_devices_vm_dtbo_with_duplicated_iommus.dts
+++ b/pvmfw/testdata/test_pvmfw_devices_vm_dtbo_with_duplicated_iommus.dts
@@ -1,4 +1,5 @@
/dts-v1/;
+/plugin/;
/ {
host {
@@ -6,55 +7,29 @@
#size-cells = <0x1>;
rng {
reg = <0x0 0x12f00000 0xFF>;
- iommus = <0x1 0x3>;
- android,pvmfw,target = <0x2>;
+ iommus = <&iommu0 0x3>;
+ android,pvmfw,target = <&rng>;
};
led {
reg = <0x0 0x12000000 0x9>;
- iommus = <0x1 0x3>;
- android,pvmfw,target = <0x6>;
+ iommus = <&iommu0 0x3>;
+ android,pvmfw,target = <&led>;
};
- iommu0 {
+ iommu0: iommu0 {
#iommu-cells = <0x1>;
android,pvmfw,token = <0x0 0x12e40000>;
- phandle = <0x1>;
};
};
- fragment@rng {
- target-path = "/";
- __overlay__ {
- rng {
- compatible = "android,rng";
- android,rng,ignore-gctrl-reset;
- phandle = <0x2>;
- };
- };
+};
+
+&{/} {
+ rng: rng {
+ compatible = "android,rng";
+ android,rng,ignore-gctrl-reset;
};
- fragment@led {
- target-path = "/";
- __overlay__ {
- led {
- compatible = "android,led";
- prop = <0x555>;
- phandle = <0x6>;
- };
- };
- };
- __symbols__ {
- iommu0 = "/host/iommu0";
- rng = "/fragment@rng/__overlay__/rng";
- led = "/fragment@led/__overlay__/led";
- };
- __local_fixups__ {
- host {
- rng {
- iommus = <0x0>;
- android,pvmfw,target = <0x0>;
- };
- led {
- iommus = <0x0>;
- android,pvmfw,target = <0x0>;
- };
- };
+
+ led: led {
+ compatible = "android,led";
+ prop = <0x555>;
};
};