Re: [PATCH 5/5] KVM: x86: Set kvm_x86_ops only after ->hardware_setup() completes

2020-01-29 Thread Paolo Bonzini
On 30/01/20 01:10, Sean Christopherson wrote: > Set kvm_x86_ops with the vendor's ops only after ->hardware_setup() > completes to "prevent" using kvm_x86_ops before they are ready, i.e. to > generate a null pointer fault instead of silently consuming unconfigured > state. What about even copying

[PATCH 5/5] KVM: x86: Set kvm_x86_ops only after ->hardware_setup() completes

2020-01-29 Thread Sean Christopherson
Set kvm_x86_ops with the vendor's ops only after ->hardware_setup() completes to "prevent" using kvm_x86_ops before they are ready, i.e. to generate a null pointer fault instead of silently consuming unconfigured state. An alternative implementation would be to have ->hardware_setup() return the v

[PATCH 3/5] KVM: VMX: Move hardware_setup() definition below vmx_x86_ops

2020-01-29 Thread Sean Christopherson
Move VMX's hardware_setup() below its vmx_x86_ops definition so that a future patch can refactor hardware_setup() to modify vmx_x86_ops directly instead of indirectly modifying the ops via the global kvm_x86_ops. No functional change intended. Signed-off-by: Sean Christopherson --- arch/x86/kvm

[PATCH 4/5] KVM: VMX: Configure runtime hooks using vmx_x86_ops

2020-01-29 Thread Sean Christopherson
Configure VMX's runtime hooks by modifying vmx_x86_ops directly instead of using on the global kvm_x86_ops. This sets the stage for waiting until after ->hardware_setup() to set kvm_x86_ops with the vendor's implementation. Signed-off-by: Sean Christopherson --- arch/x86/kvm/vmx/nested.c | 15 +

[PATCH 0/5] KVM: Move x86 init ops to separate struct

2020-01-29 Thread Sean Christopherson
The non-x86 part of this series is wholly contained in patch 01. Compared to other recent kvm-wide changes, this one is very straightforward (famous last words). Like a few other architectures, e.g. PPC, x86 uses a set of global hooks to call back into vendor code on demand. A handlful of the x8

[PATCH 2/5] KVM: x86: Move init-only kvm_x86_ops to separate struct

2020-01-29 Thread Sean Christopherson
Move the kvm_x86_ops functions that are used only within the scope of kvm_init() into a separate struct, kvm_x86_init_ops. In addition to identifying the init-only functions without restorting to code comments, this also sets the stage for waiting until after ->hardware_setup() to set kvm_x86_ops.

[PATCH 1/5] KVM: Pass kvm_init()'s opaque param to additional arch funcs

2020-01-29 Thread Sean Christopherson
Pass @opaque to kvm_arch_hardware_setup() and kvm_arch_check_processor_compat() to allow architecture specific code to reference @opaque without having to stash it away in a temporary global variable. This will enable x86 to separate its vendor specific callback ops, which are passed via @opaque,

[PATCH v2 1/2] target/arm: kvm: Inject events at the last stage of sync

2020-01-29 Thread Beata Michalska
KVM_SET_VCPU_EVENTS might actually lead to vcpu registers being modified. As such this should be the last step of sync to avoid potential overwriting of whatever changes KVM might have done. Signed-off-by: Beata Michalska --- target/arm/kvm32.c | 20 ++-- target/arm/kvm64.c | 20

[PATCH v2 2/2] target/arm: kvm: Handle DABT with no valid ISS

2020-01-29 Thread Beata Michalska
On ARMv7 & ARMv8 some load/store instructions might trigger a data abort exception with no valid ISS info to be decoded. The lack of decode info makes it at least tricky to emulate those instruction which is one of the (many) reasons why KVM will not even try to do so. Add support for handling tho

[PATCH v2 0/2] target/arm: kvm: Support for KVM DABT without valid ISS

2020-01-29 Thread Beata Michalska
Some of the ARMv7 & ARMv8 load/store instructions might trigger a data abort exception with no valid ISS info to be decoded. The lack of decode info makes it at least tricky to emulate the instruction which is one of the (many) reasons why KVM will not even try to do so. So far, if a guest made an

Re: [kvm-unit-tests PATCH v3 12/14] arm/run: Allow Migration tests

2020-01-29 Thread Auger Eric
Hi Thomas, On 1/29/20 9:07 AM, Thomas Huth wrote: > On 28/01/2020 11.34, Eric Auger wrote: >> Let's link getchar.o to use puts and getchar from the >> tests. >> >> Then allow tests belonging to the migration group to >> trigger the migration from the test code by putting >> "migrate" into the uart

Re: [kvm-unit-tests PATCH v3 12/14] arm/run: Allow Migration tests

2020-01-29 Thread Thomas Huth
On 28/01/2020 11.34, Eric Auger wrote: > Let's link getchar.o to use puts and getchar from the > tests. > > Then allow tests belonging to the migration group to > trigger the migration from the test code by putting > "migrate" into the uart. Then the code can wait for the > migration completion by