run_qemu.sh: Fix script for pVM mode

Fix the PVMFW DTS injected into the kernel's DT in order to:

 - have the region as a subnode of 'reserved-memory'
 - mark the 'reserved-memory' with 'ranges' (required by the kernel)
 - have a '#size-cells' of 2 (required by the kernel)
 - use the right 'compatible' field (required by pKVM)
 - mark the memory region as 'no-map' (required by pKVM)
 - provide a address without a leading '0x' (warning from dtc)

Fix the submitted PVMFW size to be page-aligned (required by pKVM).

Change-Id: Ibaefe81ba5bc71e2a5c1f5ae5ac2ee326fe3672c
diff --git a/aarch64/run_qemu.sh b/aarch64/run_qemu.sh
index bade6b4..edcf5b9 100755
--- a/aarch64/run_qemu.sh
+++ b/aarch64/run_qemu.sh
@@ -105,11 +105,16 @@
 
 	cat <<EOF
 &{/} {
-	pkvm_template@${addr} {
-		compatible = "pkvm,arm64";
+	reserved-memory {
 		#address-cells = <2>;
-		#size-cells = <1>;
-		reg = <0x00 ${addr} ${size}>;
+		#size-cells = <2>;
+		ranges;
+
+		pvmfw: pkvm_guest_firmware@$(hex ${addr} '') {
+			compatible = "linux,pkvm-guest-firmware-memory";
+			no-map;
+			reg = <0x00 ${addr} 0x00 ${size}>;
+		};
 	};
 };
 EOF
@@ -238,8 +243,10 @@
 	PVMFW_ADDR=$(( KERNEL_ADDR + 128*MiB + $(file_size "${DTB}") ))
 	PVMFW_ADDR=$(hex $(align_page_size ${PVMFW_ADDR}))
 	PVMFW_SIZE=$(file_size "${PVMFW}")
+	# pKVM enforces a page-aligned size for the memory slot
+	MEMSLOT_SIZE=$(align_page_size ${PVMFW_SIZE})
 
-	inject_overlay <(pvmfw_overlay ${PVMFW_ADDR} ${PVMFW_SIZE}) "${QEMU_DTB}" \
+	inject_overlay <(pvmfw_overlay ${PVMFW_ADDR} ${MEMSLOT_SIZE}) "${QEMU_DTB}"\
 		>"${DTB}"
 
 	CMD+=(-dtb "${DTB}")