[PATCH] kvm: arm/arm64 : fix vm's hanging at startup time

2018-11-23 Thread peng.hao2
>> >Hi, >> > >> >On Wed, Nov 21, 2018 at 04:56:54PM +0800, peng.h...@zte.com.cn wrote: >> >> >On 19/11/2018 09:10, Mark Rutland wrote: >> >> >> On Sat, Nov 17, 2018 at 10:58:37AM +0800, peng.h...@zte.com.cn wrote: >> >> On 16/11/18 00:23, peng.h...@zte.com.cn wrote: >> >> >> Hi, >> >>

Re: [PATCH v5 5/7] iommu: Add virtio-iommu driver

2018-11-23 Thread Michael S. Tsirkin
On Thu, Nov 22, 2018 at 07:37:59PM +, Jean-Philippe Brucker wrote: > The virtio IOMMU is a para-virtualized device, allowing to send IOMMU > requests such as map/unmap over virtio transport without emulating page > tables. This implementation handles ATTACH, DETACH, MAP and UNMAP > requests. >

Re: [PATCH v5 5/7] iommu: Add virtio-iommu driver

2018-11-23 Thread Michael S. Tsirkin
On Thu, Nov 22, 2018 at 07:37:59PM +, Jean-Philippe Brucker wrote: > The virtio IOMMU is a para-virtualized device, allowing to send IOMMU > requests such as map/unmap over virtio transport without emulating page > tables. This implementation handles ATTACH, DETACH, MAP and UNMAP > requests. >

Re: [PATCH v5 5/7] iommu: Add virtio-iommu driver

2018-11-23 Thread Michael S. Tsirkin
On Thu, Nov 22, 2018 at 07:37:59PM +, Jean-Philippe Brucker wrote: > The virtio IOMMU is a para-virtualized device, allowing to send IOMMU > requests such as map/unmap over virtio transport without emulating page > tables. This implementation handles ATTACH, DETACH, MAP and UNMAP > requests. >

[PATCH v2 4/8] arm64: Add TCR_EPD{0,1} definitions

2018-11-23 Thread Marc Zyngier
We are soon going to play with TCR_EL1.EPD{0,1}, so let's add the relevant definitions. Signed-off-by: Marc Zyngier --- arch/arm64/include/asm/pgtable-hwdef.h | 4 1 file changed, 4 insertions(+) diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h

[PATCH v2 2/8] KVM: arm64: Rework detection of SVE, !VHE systems

2018-11-23 Thread Marc Zyngier
An SVE system is so far the only case where we mandate VHE. As we're starting to grow this requirements, let's slightly rework the way we deal with that situation, allowing for easy extension of this check. Signed-off-by: Marc Zyngier --- arch/arm/include/asm/kvm_host.h | 2 +-

[PATCH v2 6/8] arm64: KVM: Add synchronization on translation regime change for erratum 1165522

2018-11-23 Thread Marc Zyngier
In order to ensure that slipping HCR_EL2.TGE is done at the right time when switching translation regime, let insert the required ISBs that will be patched in when erratum 1165522 is detected. Signed-off-by: Marc Zyngier --- arch/arm64/include/asm/kvm_hyp.h | 7 +++

[PATCH v2 7/8] arm64: KVM: Handle ARM erratum 1165522 in TLB invalidation

2018-11-23 Thread Marc Zyngier
In order to avoid TLB corruption whilst invalidating TLBs on CPUs affected by erratum 1165522, we need to prevent S1 page tables from being usable. For this, we set the EL1 S1 MMU on, and also disable the page table walker (by setting the TCR_EL1.EPD* bits to 1). This ensures that once we switch

[PATCH v2 0/8] Workaround for Cortex-A76 erratum 1165522

2018-11-23 Thread Marc Zyngier
Early Cortex-A76 suffer from an erratum that can result in invalid TLBs when the CPU speculatively executes an AT instruction in the middle of a guest world switch, while the guest virtual memory configuration is in an inconsistent state. We handle this issue by mandating the use of VHE and

[PATCH v2 1/8] arm64: KVM: Make VHE Stage-2 TLB invalidation operations non-interruptible

2018-11-23 Thread Marc Zyngier
Contrary to the non-VHE version of the TLB invalidation helpers, the VHE code has interrupts enabled, meaning that we can take an interrupt in the middle of such a sequence, and start running something else with HCR_EL2.TGE cleared. That's really not a good idea. Take the heavy-handed option

[PATCH v2 5/8] arm64: KVM: Force VHE for systems affected by erratum 1165522

2018-11-23 Thread Marc Zyngier
In order to easily mitigate ARM erratum 1165522, we need to force affected CPUs to run in VHE mode if using KVM. Signed-off-by: Marc Zyngier --- arch/arm64/include/asm/cpucaps.h | 3 ++- arch/arm64/include/asm/kvm_host.h | 4 arch/arm64/kernel/cpu_errata.c| 8 3 files

[PATCH v2 3/8] arm64: KVM: Install stage-2 translation before enabling traps

2018-11-23 Thread Marc Zyngier
It is a bit odd that we only install stage-2 translation after having cleared HCR_EL2.TGE, which means that there is a window during which AT requests could fail as stage-2 is not configured yet. Let's move stage-2 configuration before we clear TGE, making the guest entry sequence clearer: we

[PATCH v2 8/8] arm64: Add configuration/documentation for Cortex-A76 erratum 1165522

2018-11-23 Thread Marc Zyngier
Now that the infrastructure to handle erratum 1165522 is in place, let's make it a selectable option and add the required documentation. Signed-off-by: Marc Zyngier --- Documentation/arm64/silicon-errata.txt | 1 + arch/arm64/Kconfig | 12 2 files changed, 13

Re: [RFC PATCH v2 11/23] KVM: arm64: Support runtime sysreg filtering for KVM_GET_REG_LIST

2018-11-23 Thread Dave Martin
On Thu, Nov 22, 2018 at 02:07:18PM +0100, Christoffer Dall wrote: > On Thu, Nov 22, 2018 at 01:32:37PM +0100, Dave P Martin wrote: > > On Thu, Nov 22, 2018 at 11:27:53AM +, Alex Bennée wrote: > > > > > > Christoffer Dall writes: > > > > > > > [Adding Peter and Alex for their view on the

Re: Instruction/Cycle Counting in Guest Using the Kvm PMU

2018-11-23 Thread James Morse
Hi Jan, On 23/11/2018 12:29, James Morse wrote: > On 23/11/2018 09:36, Jan Bolke wrote: >> I am using the Kvm Api and try to integrate it as an instruction set >> simulator >> in a SystemC environment. > > >> I need some mechanism to count executed instructions in the guest (or >> cycles). >>

Re: Instruction/Cycle Counting in Guest Using the Kvm PMU

2018-11-23 Thread Andrew Murray
On Fri, Nov 23, 2018 at 12:29:08PM +, James Morse wrote: > Hi Jan, > > (CC: +Andrew) > > On 23/11/2018 09:36, Jan Bolke wrote: > > I am not sure if this question is well-placed here, so sorry if it misses > > the > > purpose of this mailing list. > > arm64? kvm? Sounds like you've come to

Re: Instruction/Cycle Counting in Guest Using the Kvm PMU

2018-11-23 Thread James Morse
Hi Jan, (CC: +Andrew) On 23/11/2018 09:36, Jan Bolke wrote: > I am not sure if this question is well-placed here, so sorry if it misses the > purpose of this mailing list. arm64? kvm? Sounds like you've come to the right place! > I am using the Kvm Api and try to integrate it as an

Instruction/Cycle Counting in Guest Using the Kvm PMU

2018-11-23 Thread Jan Bolke
Hi, I am not sure if this question is well-placed here, so sorry if it misses the purpose of this mailing list. My name is Jan and i am currently writing my master's thesis. I am using the Kvm Api and try to integrate it as an instruction set simulator in a SystemC environment. Anyway, I

Re: [PATCH] kvm: arm/arm64 : fix vm's hanging at startup time

2018-11-23 Thread Christoffer Dall
On Fri, Nov 23, 2018 at 02:01:56PM +0800, peng.h...@zte.com.cn wrote: > >Hi, > > > >On Wed, Nov 21, 2018 at 04:56:54PM +0800, peng.h...@zte.com.cn wrote: > >> >On 19/11/2018 09:10, Mark Rutland wrote: > >> >> On Sat, Nov 17, 2018 at 10:58:37AM +0800, peng.h...@zte.com.cn wrote: > >> On

Re: [PATCH v5 0/7] Add virtio-iommu driver

2018-11-23 Thread Auger Eric
Hi Jean, On 11/22/18 8:37 PM, Jean-Philippe Brucker wrote: > Implement the virtio-iommu driver, following specification v0.9 [1]. > > Since v4 [2] I fixed the issues reported by Eric, and added Reviewed-by > from Eric and Rob. Thanks! > > I changed the specification to fix one inconsistency

Re: [PATCH v5 5/7] iommu: Add virtio-iommu driver

2018-11-23 Thread Auger Eric
Hi Jean, On 11/22/18 8:37 PM, Jean-Philippe Brucker wrote: > The virtio IOMMU is a para-virtualized device, allowing to send IOMMU > requests such as map/unmap over virtio transport without emulating page > tables. This implementation handles ATTACH, DETACH, MAP and UNMAP > requests. > > The