Skip to contentSkip to conversation

About Revert this patch: arm: Allow system registers for KVM guests to be changed by QEMU code

Qemu-arm gengdongjiu 2 participants 5 messages Mar 14, 2019

lore
Share & tools
lore
#0 lore raw

Hi Peter/Eric,
I think we should fix the regression issue instead of revert this patch, I think the reason of this issue is that QEMU modified some unexpected resisters, we should find out.

    Revert "arm: Allow system registers for KVM guests to be changed by QEMU code"

    This reverts commit 823e1b3818f9b10b824ddcd756983b6e2fa68730,
    which introduces a regression running EDK2 guest firmware
    under KVM:

    error: kvm run failed Function not implemented
     PC=000000013f5a6208 X00=00000000404003c4 X01=000000000000003a
    X02=0000000000000000 X03=00000000404003c4 X04=0000000000000000
    X05=0000000096000046 X06=000000013d2ef270 X07=000000013e3d1710
    X08=09010755ffaf8ba8 X09=ffaf8b9cfeeb5468 X10=feeb546409010756
    X11=09010757ffaf8b90 X12=feeb50680903068b X13=090306a1ffaf8bc0
    X14=0000000000000000 X15=0000000000000000 X16=000000013f872da0
    X17=00000000ffffa6ab X18=0000000000000000 X19=000000013f5a92d0
    X20=000000013f5a7a78 X21=000000000000003a X22=000000013f5a7ab2
    X23=000000013f5a92e8 X24=000000013f631090 X25=0000000000000010
    X26=0000000000000100 X27=000000013f89501b X28=000000013e3d14e0
    X29=000000013e3d12a0 X30=000000013f5a2518  SP=000000013b7be0b0
    PSTATE=404003c4 -Z-- EL1t

    with
    [ 3507.926571] kvm [35042]: load/store instruction decoding not implemented
    in the host dmesg.

    Revert the change for the moment until we can investigate the
    cause of the regression.

    Reported-by: Eric Auger <[email protected]>
    Signed-off-by: Peter Maydell <[email protected]>
#1 lore raw
Quoted 4 lines · gengdongjiu

Hi Peter/Eric,
I think we should fix the regression issue instead of revert this patch, I think the reason of this issue is that QEMU modified some unexpected resisters, we should find out.

Yes, I agree that we need to actually fix the underlying bug. But I committed the revert as an interim fix because it's taking me some time to identify what is going wrong.

thanks
-- PMM

#2 lore raw
In reply to gengdongjiu

If you think this patch will introduce some issue, we can add one function write_part_cpustate_to_list()[2] to change the specified register instead of all the registers[1].

Below function that you added will modified all the register if new value is different with old value. [1]:
bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync)
{

}

[2]:
+bool write_part_cpustate_to_list(ARMCPU *cpu, ptrdiff_t fieldoffset) +{
+ const ARMCPRegInfo *ri;
+ uint32_t regidx, i;
+
+ for (i = 0; i < cpu->cpreg_array_len; i++) {

+        regidx = kvm_to_cpreg_id(cpu->cpreg_indexes[i]);
+        ri = get_arm_cp_reginfo(cpu->cp_regs, regidx);
+        if (!ri) {

+ continue;
+ }
+
+ if (ri->type & ARM_CP_NO_RAW) {
+ continue;
+ }
+ if (ri->fieldoffset == fieldoffset) {
+ cpu->cpreg_values[i] = read_raw_cp_reg(&cpu->env, ri);
+ return true;
+ }
+ }
+ return false;
+}
+

Quoted 35 lines · gengdongjiu

Hi Peter/Eric,
I think we should fix the regression issue instead of revert this patch, I think the reason of this issue is that QEMU modified some unexpected resisters, we should find out.

    Revert "arm: Allow system registers for KVM guests to be changed by QEMU code"

    This reverts commit 823e1b3818f9b10b824ddcd756983b6e2fa68730,
    which introduces a regression running EDK2 guest firmware
    under KVM:

    error: kvm run failed Function not implemented
     PC=000000013f5a6208 X00=00000000404003c4 X01=000000000000003a
    X02=0000000000000000 X03=00000000404003c4 X04=0000000000000000
    X05=0000000096000046 X06=000000013d2ef270 X07=000000013e3d1710
    X08=09010755ffaf8ba8 X09=ffaf8b9cfeeb5468 X10=feeb546409010756
    X11=09010757ffaf8b90 X12=feeb50680903068b X13=090306a1ffaf8bc0
    X14=0000000000000000 X15=0000000000000000 X16=000000013f872da0
    X17=00000000ffffa6ab X18=0000000000000000 X19=000000013f5a92d0
    X20=000000013f5a7a78 X21=000000000000003a X22=000000013f5a7ab2
    X23=000000013f5a92e8 X24=000000013f631090 X25=0000000000000010
    X26=0000000000000100 X27=000000013f89501b X28=000000013e3d14e0
    X29=000000013e3d12a0 X30=000000013f5a2518  SP=000000013b7be0b0
    PSTATE=404003c4 -Z-- EL1t

    with
    [ 3507.926571] kvm [35042]: load/store instruction decoding not implemented
    in the host dmesg.

    Revert the change for the moment until we can investigate the
    cause of the regression.

    Reported-by: Eric Auger <[email protected]>
    Signed-off-by: Peter Maydell <[email protected]>
#3 lore raw
Quoted 3 lines · gengdongjiu

If you think this patch will introduce some issue, we can add one function write_part_cpustate_to_list()[2] to change the specified register instead of all the registers[1].

It definitely does introduce an issue, but we need to address it by working out why it breaks something that I wasn't expecting to break. Then we can fix it properly. Looking it this is on my todo list for this week.

thanks
-- PMM

#4 lore raw
Quoted 6 lines · Peter Maydell
Quoted 2 lines

If you think this patch will introduce some issue, we can add one function write_part_cpustate_to_list()[2] to change the specified register instead of all the registers[1].

It definitely does introduce an issue, but we need to address it by working out why it breaks something that I wasn't expecting to break. Then we can fix it properly. Looking it this is on my todo list for this week.

Got it, great, thanks very much to Peter.