hypervisor: Fix AIA IMSIC attr calculation

The IMSIC attr of RISC-V AIA is wrongly configured to start from 0, which
would error out with `os error 22` (invalid argument).

```console
Error booting VM: VmBoot(DeviceManager(CreateInterruptController(CreateAia(CreateVaia(Vaia error SetDeviceAttribute(SetDeviceAttribute(Invalid argument (os error 22))))))))
```

`riscv_imsic_attr_of` should shift `cpu_index` by 1 here to produce
correct IMSIC attr.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
This commit is contained in:
Ruoqing He 2025-01-21 10:53:58 +08:00 committed by Rob Bradford
parent ca8eda5399
commit cf463b88b7

View File

@ -99,7 +99,7 @@ impl KvmAiaImsics {
let riscv_imsic_addr_of = |cpu_index: u32| -> u64 {
self.imsic_addr + (cpu_index * kvm_bindings::KVM_DEV_RISCV_IMSIC_SIZE) as u64
};
let riscv_imsic_attr_of = |cpu_index: u32| -> u64 { cpu_index as u64 };
let riscv_imsic_attr_of = |cpu_index: u32| -> u64 { cpu_index as u64 + 1 };
// Setting up RISC-V IMSICs
for cpu_index in 0..self.vcpu_count {