hv: allow guest with the highest severity to read RESET_CONTROL

Guest VM, such as Linux, may read RESET_CONTROL(0xCF9) register
before writing to, in this case, ACRN should not always return
dummy value.

Tracked-On: #8688
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Yonghua Huang 2024-08-09 18:05:59 +08:00 committed by acrnsi-robot
parent 5c351bee0f
commit 4e552b0785
1 changed files with 6 additions and 2 deletions

View File

@ -74,12 +74,16 @@ static bool handle_reset_reg_read(struct acrn_vcpu *vcpu, __unused uint16_t addr
{
bool ret = true;
if (is_postlaunched_vm(vcpu->vm)) {
if (get_highest_severity_vm(true) == vcpu->vm) {
/* Guest may read RESET_CONTROL register before cold reset or warm reset */
vcpu->req.reqs.pio_request.value = pio_read8(0xcf9U);
} else if (is_postlaunched_vm(vcpu->vm)) {
/* re-inject to DM */
ret = false;
} else {
/*
* - reset control register 0xcf9: hide this from guests for now.
* - reset control register 0xcf9: hide this from guests whose severity is not the highest.
* - FADT reset register: the read behavior is not defined in spec, keep it simple to return all '1'.
*/
vcpu->req.reqs.pio_request.value = ~0U;