[PATCH v2] kvm/arm64: Rename HSR to ESR

2020-06-29 Thread Gavin Shan
kvm/arm32 isn't supported since commit 541ad0150ca4 ("arm: Remove 32bit KVM host support"). So HSR isn't meaningful since then. This renames HSR to ESR accordingly. This shouldn't cause any functional changes: * Rename kvm_vcpu_get_hsr() to kvm_vcpu_get_esr() to make the function names

Re: [PATCH 2/2] kvm/arm64: Detach ESR operator from vCPU struct

2020-06-29 Thread Gavin Shan
Hi Andrew, On 6/29/20 7:59 PM, Andrew Scull wrote: On Mon, Jun 29, 2020 at 07:18:41PM +1000, Gavin Shan wrote: There are a set of inline functions defined in kvm_emulate.h. Those functions reads ESR from vCPU fault information struct and then operate on it. So it's tied with vCPU fault

Re: [PATCH 2/2] kvm/arm64: Detach ESR operator from vCPU struct

2020-06-29 Thread Gavin Shan
Hi Mark, On 6/29/20 9:00 PM, Mark Rutland wrote: On Mon, Jun 29, 2020 at 07:18:41PM +1000, Gavin Shan wrote: There are a set of inline functions defined in kvm_emulate.h. Those functions reads ESR from vCPU fault information struct and then operate on it. So it's tied with vCPU fault

Re: [PATCH 1/2] kvm/arm64: Rename HSR to ESR

2020-06-29 Thread Gavin Shan
On 6/30/20 3:00 AM, Marc Zyngier wrote: On 2020-06-29 11:32, Mark Rutland wrote: On Mon, Jun 29, 2020 at 07:18:40PM +1000, Gavin Shan wrote: kvm/arm32 isn't supported since commit 541ad0150ca4 ("arm: Remove 32bit KVM host support"). So HSR isn't meaningful since then. This renames HSR to ESR

[PATCH 2/2] arm64: Add workaround for Arm Cortex-A77 erratum 1508412

2020-06-29 Thread Rob Herring
On Cortex-A77 r0p0 and r1p0, a sequence of a non-cacheable or device load and a store exclusive or PAR_EL1 read can cause a deadlock. The workaround requires a DMB SY before and after a PAR_EL1 register read and the disabling of KVM. KVM must be disabled to prevent the problematic sequence in

[PATCH 1/2] arm64: Add part number for Arm Cortex-A77

2020-06-29 Thread Rob Herring
Add the MIDR part number info for the Arm Cortex-A77. Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Rob Herring --- arch/arm64/include/asm/cputype.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h index

Re: [PATCH 1/2] kvm/arm64: Rename HSR to ESR

2020-06-29 Thread Marc Zyngier
On 2020-06-29 11:32, Mark Rutland wrote: On Mon, Jun 29, 2020 at 07:18:40PM +1000, Gavin Shan wrote: kvm/arm32 isn't supported since commit 541ad0150ca4 ("arm: Remove 32bit KVM host support"). So HSR isn't meaningful since then. This renames HSR to ESR accordingly. This shouldn't cause any

[GIT PULL] KVM/arm64 fixes for 5.8, take #2

2020-06-29 Thread Marc Zyngier
Hi Paolo, Here's another pull request for a handful of KVM/arm64 fixes. Nothing absolutely critical (see the tag for the gory details), but I'd rather get these merged as soon as possible. Please pull, M. The following changes since commit b3a9e3b9622ae10064826dccb4f7a52bd88c7407:

[PATCH 2/4] KVM: arm64: Fix kvm_reset_vcpu() return code being incorrect with SVE

2020-06-29 Thread Marc Zyngier
From: Steven Price If SVE is enabled then 'ret' can be assigned the return value of kvm_vcpu_enable_sve() which may be 0 causing future "goto out" sites to erroneously return 0 on failure rather than -EINVAL as expected. Remove the initialisation of 'ret' and make setting the return value

[PATCH 1/4] KVM: arm64: Annotate hyp NMI-related functions as __always_inline

2020-06-29 Thread Marc Zyngier
From: Alexandru Elisei The "inline" keyword is a hint for the compiler to inline a function. The functions system_uses_irq_prio_masking() and gic_write_pmr() are used by the code running at EL2 on a non-VHE system, so mark them as __always_inline to make sure they'll always be part of the

[PATCH 4/4] KVM: arm64: vgic-v4: Plug race between non-residency and v4.1 doorbell

2020-06-29 Thread Marc Zyngier
When making a vPE non-resident because it has hit a blocking WFI, the doorbell can fire at any time after the write to the RD. Crucially, it can fire right between the write to GICR_VPENDBASER and the write to the pending_last field in the its_vpe structure. This means that we would overwrite

[PATCH 3/4] KVM: arm64: pvtime: Ensure task delay accounting is enabled

2020-06-29 Thread Marc Zyngier
From: Andrew Jones Ensure we're actually accounting run_delay before we claim that we'll expose it to the guest. If we're not, then we just pretend like steal time isn't supported in order to avoid any confusion. Signed-off-by: Andrew Jones Signed-off-by: Marc Zyngier Link:

Re: [PATCH 2/2] kvm/arm64: Detach ESR operator from vCPU struct

2020-06-29 Thread Andrew Scull
On Mon, Jun 29, 2020 at 07:18:41PM +1000, Gavin Shan wrote: > There are a set of inline functions defined in kvm_emulate.h. Those > functions reads ESR from vCPU fault information struct and then operate > on it. So it's tied with vCPU fault information and vCPU struct. It > limits their usage

Re: [PATCH 1/2] kvm/arm64: Rename HSR to ESR

2020-06-29 Thread Andrew Scull
On Mon, Jun 29, 2020 at 07:18:40PM +1000, Gavin Shan wrote: > kvm/arm32 isn't supported since commit 541ad0150ca4 ("arm: Remove > 32bit KVM host support"). So HSR isn't meaningful since then. This > renames HSR to ESR accordingly. This shouldn't cause any functional > changes: > >* Rename

Re: [PATCH v8 1/2] target/arm: kvm: Handle DABT with no valid ISS

2020-06-29 Thread Beata Michalska
On Mon, 29 Jun 2020 at 09:15, Andrew Jones wrote: > > On Sun, Jun 28, 2020 at 04:04:58PM +0100, Beata Michalska wrote: > > 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

[PATCH v9 0/2] target/arm: kvm: Support for KVM DABT with no valid ISS

2020-06-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

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

2020-06-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

[PATCH v9 2/2] target/arm: kvm: Handle misconfigured dabt injection

2020-06-29 Thread Beata Michalska
Injecting external data abort through KVM might trigger an issue on kernels that do not get updated to include the KVM fix. For those and aarch32 guests, the injected abort gets misconfigured to be an implementation defined exception. This leads to the guest repeatedly re-running the faulting

Re: [PATCH 1/2] kvm/arm64: Rename HSR to ESR

2020-06-29 Thread Mark Rutland
On Mon, Jun 29, 2020 at 11:32:08AM +0100, Mark Rutland wrote: > On Mon, Jun 29, 2020 at 07:18:40PM +1000, Gavin Shan wrote: > > kvm/arm32 isn't supported since commit 541ad0150ca4 ("arm: Remove > > 32bit KVM host support"). So HSR isn't meaningful since then. This > > renames HSR to ESR

Re: [PATCH 2/2] kvm/arm64: Detach ESR operator from vCPU struct

2020-06-29 Thread Mark Rutland
On Mon, Jun 29, 2020 at 07:18:41PM +1000, Gavin Shan wrote: > There are a set of inline functions defined in kvm_emulate.h. Those > functions reads ESR from vCPU fault information struct and then operate > on it. So it's tied with vCPU fault information and vCPU struct. It > limits their usage

Re: [PATCH 1/2] kvm/arm64: Rename HSR to ESR

2020-06-29 Thread Mark Rutland
On Mon, Jun 29, 2020 at 07:18:40PM +1000, Gavin Shan wrote: > kvm/arm32 isn't supported since commit 541ad0150ca4 ("arm: Remove > 32bit KVM host support"). So HSR isn't meaningful since then. This > renames HSR to ESR accordingly. This shouldn't cause any functional > changes: > >* Rename

[PATCH 0/2] Refactor ESR related functions

2020-06-29 Thread Gavin Shan
This series bases on kvm/arm64 ("next") tree as below. It's preparatory work for async page fault where the ESR is specified instead of fetching from vCPU struct. Besides, HSR isn't meaningful since kvm/arm32 support has been dropped. This refactors ESR related functions to serve them.

[PATCH 2/2] kvm/arm64: Detach ESR operator from vCPU struct

2020-06-29 Thread Gavin Shan
There are a set of inline functions defined in kvm_emulate.h. Those functions reads ESR from vCPU fault information struct and then operate on it. So it's tied with vCPU fault information and vCPU struct. It limits their usage scope. This detaches these functions from the vCPU struct by

[PATCH 1/2] kvm/arm64: Rename HSR to ESR

2020-06-29 Thread Gavin Shan
kvm/arm32 isn't supported since commit 541ad0150ca4 ("arm: Remove 32bit KVM host support"). So HSR isn't meaningful since then. This renames HSR to ESR accordingly. This shouldn't cause any functional changes: * Rename kvm_vcpu_get_hsr() to kvm_vcpu_get_esr() to make the function names

Re: [PATCH v8 2/2] target/arm: kvm: Handle misconfigured dabt injection

2020-06-29 Thread Andrew Jones
On Sun, Jun 28, 2020 at 04:04:59PM +0100, Beata Michalska wrote: > Injecting external data abort through KVM might trigger > an issue on kernels that do not get updated to include the KVM fix. > For those and aarch32 guests, the injected abort gets misconfigured > to be an implementation defined

Re: [PATCH v8 1/2] target/arm: kvm: Handle DABT with no valid ISS

2020-06-29 Thread Andrew Jones
On Sun, Jun 28, 2020 at 04:04:58PM +0100, Beata Michalska wrote: > 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)