From 66ffaceffc154a6a0ca6f900b55cc7e325350c42 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Wed, 10 Mar 2021 13:58:27 +0000 Subject: [PATCH] vmm: tdx: Correctly populate the 64-bit MMIO region The MMIO structure contains the length rather than the maximum address so it is necessary to subtract the starting address from the end address to calculate the length. Signed-off-by: Rob Bradford --- vmm/src/vm.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vmm/src/vm.rs b/vmm/src/vm.rs index f832ba794..3cc90195a 100644 --- a/vmm/src/vm.rs +++ b/vmm/src/vm.rs @@ -1652,8 +1652,12 @@ impl Vm { .unwrap() .end_of_device_area() .raw_value(); - hob.add_mmio_resource(&mem, start_of_device_area, end_of_device_area) - .map_err(Error::PopulateHob)?; + hob.add_mmio_resource( + &mem, + start_of_device_area, + end_of_device_area - start_of_device_area, + ) + .map_err(Error::PopulateHob)?; hob.finish(&mem).map_err(Error::PopulateHob)?;