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

2018-11-22 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, >> >>> When virtual

[PATCH v5 6/7] iommu/virtio: Add probe request

2018-11-22 Thread Jean-Philippe Brucker
When the device offers the probe feature, send a probe request for each device managed by the IOMMU. Extract RESV_MEM information. When we encounter a MSI doorbell region, set it up as a IOMMU_RESV_MSI region. This will tell other subsystems that there is no need to map the MSI doorbell in the

[PATCH v5 7/7] iommu/virtio: Add event queue

2018-11-22 Thread Jean-Philippe Brucker
The event queue offers a way for the device to report access faults from endpoints. It is implemented on virtqueue #1. Whenever the host needs to signal a fault, it fills one of the buffers offered by the guest and interrupts it. Reviewed-by: Eric Auger Signed-off-by: Jean-Philippe Brucker ---

[PATCH v5 1/7] dt-bindings: virtio-mmio: Add IOMMU description

2018-11-22 Thread Jean-Philippe Brucker
The nature of a virtio-mmio node is discovered by the virtio driver at probe time. However the DMA relation between devices must be described statically. When a virtio-mmio node is a virtio-iommu device, it needs an "#iommu-cells" property as specified by bindings/iommu/iommu.txt. Otherwise, the

[PATCH v5 2/7] dt-bindings: virtio: Add virtio-pci-iommu node

2018-11-22 Thread Jean-Philippe Brucker
Some systems implement virtio-iommu as a PCI endpoint. The operating system needs to discover the relationship between IOMMU and masters long before the PCI endpoint gets probed. Add a PCI child node to describe the virtio-iommu device. The virtio-pci-iommu is conceptually split between a PCI

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

2018-11-22 Thread Jean-Philippe Brucker
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 bulk of the code transforms calls coming from the IOMMU API into

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

2018-11-22 Thread Jean-Philippe Brucker
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 discussed in v4. That the device fills the probe buffer with zeroes is now

[PATCH v5 4/7] PCI: OF: Initialize dev->fwnode appropriately

2018-11-22 Thread Jean-Philippe Brucker
For PCI devices that have an OF node, set the fwnode as well. This way drivers that rely on fwnode don't need the special case described by commit f94277af03ea ("of/platform: Initialise dev->fwnode appropriately"). Acked-by: Bjorn Helgaas Signed-off-by: Jean-Philippe Brucker ---

[PATCH v5 3/7] of: Allow the iommu-map property to omit untranslated devices

2018-11-22 Thread Jean-Philippe Brucker
In PCI root complex nodes, the iommu-map property describes the IOMMU that translates each endpoint. On some platforms, the IOMMU itself is presented as a PCI endpoint (e.g. AMD IOMMU and virtio-iommu). This isn't supported by the current OF driver, which expects all endpoints to have an IOMMU.

Re: [PATCH 4/4] arm64: KVM: Implement workaround for Cortex-A76 erratum 1165522

2018-11-22 Thread Marc Zyngier
On 08/11/2018 20:10, Christoffer Dall wrote: > On Thu, Nov 08, 2018 at 06:05:55PM +, Marc Zyngier wrote: >> On 06/11/18 08:15, Christoffer Dall wrote: >>> On Mon, Nov 05, 2018 at 02:36:16PM +, Marc Zyngier wrote: Early versions of Cortex-A76 can end-up with corrupt TLBs if they

Re: [RFC PATCH v2 00/23] KVM: arm64: Initial support for SVE guests

2018-11-22 Thread Alex Bennée
Dave Martin writes: > This series implements basic support for allowing KVM guests to use the > Arm Scalable Vector Extension (SVE). > > The patches are based on v4.19-rc5. > > The patches are also available on a branch for reviewer convenience. [1] > > This is a significant overhaul of the

Re: [RFC PATCH v2 23/23] KVM: arm64/sve: Document KVM API extensions for SVE

2018-11-22 Thread Alex Bennée
Dave Martin writes: > This patch adds sections to the KVM API documentation describing > the extensions for supporting the Scalable Vector Extension (SVE) > in guests. > > Signed-off-by: Dave Martin > --- > Documentation/virtual/kvm/api.txt | 142 > +- > 1

Re: [RFC PATCH v2 21/23] KVM: arm64/sve: allow KVM_ARM_SVE_CONFIG_QUERY on vm fd

2018-11-22 Thread Alex Bennée
Dave Martin writes: > Since userspace may need to decide on the set of vector lengths for > the guest before setting up a vm, it is onerous to require a vcpu > fd to be available first. KVM_ARM_SVE_CONFIG_QUERY is not > vcpu-dependent anyway, so this patch wires up KVM_ARM_SVE_CONFIG to > be

Re: [RFC PATCH v2 19/23] KVM: arm64/sve: Report and enable SVE API extensions for userspace

2018-11-22 Thread Alex Bennée
Dave Martin writes: > This patch adds the necessary API extensions to allow userspace to > detect SVE support for guests and enable it. > > A new capability KVM_CAP_ARM_SVE is defined to allow userspace to > detect the availability of the KVM SVE API extensions in the usual > way. > > Userspace

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

2018-11-22 Thread Christoffer Dall
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 QEMU side] > > > > > > On Thu, Nov 15, 2018 at 05:27:11PM +, Dave Martin

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

2018-11-22 Thread Peter Maydell
On 22 November 2018 at 12:34, Christoffer Dall wrote: > So on migration, will you have the required information for > KVM_ARM_VCPU_INIT before setting the registers from the migration > stream? > > (I assume so, because presumably this comes from a command-line switch > or from the machine

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

2018-11-22 Thread Christoffer Dall
On Thu, Nov 22, 2018 at 11:13:51AM +, Peter Maydell wrote: > On 22 November 2018 at 10:53, Christoffer Dall > wrote: > > [Adding Peter and Alex for their view on the QEMU side] > > > > On Thu, Nov 15, 2018 at 05:27:11PM +, Dave Martin wrote: > >> My expectation is that

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

2018-11-22 Thread Dave P Martin
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 QEMU side] > > > > On Thu, Nov 15, 2018 at 05:27:11PM +, Dave Martin wrote: > >> On Fri, Nov 02, 2018 at 09:16:25AM +0100, Christoffer Dall wrote: > >>

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

2018-11-22 Thread Alex Bennée
Christoffer Dall writes: > [Adding Peter and Alex for their view on the QEMU side] > > On Thu, Nov 15, 2018 at 05:27:11PM +, Dave Martin wrote: >> On Fri, Nov 02, 2018 at 09:16:25AM +0100, Christoffer Dall wrote: >> > On Fri, Sep 28, 2018 at 02:39:15PM +0100, Dave Martin wrote: >> > >

[PATCH v3 0/4] arm64: Support perf event modifiers :G and :H

2018-11-22 Thread Andrew Murray
This patchset provides support for perf event modifiers :G and :H which allows for filtering of PMU events between host and guests when used with KVM. As the underlying hardware cannot distinguish between guest and host context, the performance counters must be stopped and started upon entry/exit

[PATCH v3 2/4] arm64: KVM: add accessors to track guest/host only counters

2018-11-22 Thread Andrew Murray
In order to effeciently enable/disable guest/host only perf counters at guest entry/exit we add bitfields to kvm_cpu_context for guest and host only events as well as accessors for updating them. Signed-off-by: Andrew Murray --- arch/arm64/include/asm/kvm_host.h | 20 1

[PATCH v3 4/4] arm64: KVM: Enable support for :G/:H perf event modifiers

2018-11-22 Thread Andrew Murray
Enable/disable event counters as appropriate when entering and exiting the guest to enable support for guest or host only event counting. For both VHE and non-VHE we switch the counters between host/guest at EL2. EL2 is filtered out by the PMU when we are using the :G modifier. The PMU may be on

[PATCH v3 3/4] arm64: arm_pmu: Add support for exclude_host/exclude_guest attributes

2018-11-22 Thread Andrew Murray
Add support for the :G and :H attributes in perf by handling the exclude_host/exclude_guest event attributes. We notify KVM of counters that we wish to be enabled or disabled on guest entry/exit and thus defer from starting or stopping :G events as per the events exclude_host attribute. With

[PATCH v3 1/4] arm64: arm_pmu: remove unnecessary isb instruction

2018-11-22 Thread Andrew Murray
The armv8pmu_enable_event_counter function issues an isb instruction after enabling a pair of counters - this doesn't provide any value and is inconsistent with the armv8pmu_disable_event_counter. In any case armv8pmu_enable_event_counter is always called with the PMU stopped. Starting the PMU

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

2018-11-22 Thread Peter Maydell
On 22 November 2018 at 10:53, Christoffer Dall wrote: > [Adding Peter and Alex for their view on the QEMU side] > > On Thu, Nov 15, 2018 at 05:27:11PM +, Dave Martin wrote: >> My expectation is that KVM_ARM_SVE_CONFIG_SET is considered part of >> creating the vcpu, so that if issued at all

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

2018-11-22 Thread Christoffer Dall
[Adding Peter and Alex for their view on the QEMU side] On Thu, Nov 15, 2018 at 05:27:11PM +, Dave Martin wrote: > On Fri, Nov 02, 2018 at 09:16:25AM +0100, Christoffer Dall wrote: > > On Fri, Sep 28, 2018 at 02:39:15PM +0100, Dave Martin wrote: > > > KVM_GET_REG_LIST should only enumerate

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

2018-11-22 Thread Christoffer Dall
On Wed, Nov 21, 2018 at 03:53:03PM +, Julien Thierry wrote: > > > On 21/11/18 15:24, Christoffer Dall wrote: > >On Wed, Nov 21, 2018 at 12:17:45PM +, Julien Thierry wrote: > >> > >> > >>On 21/11/18 11:06, Christoffer Dall wrote: > >>>Hi, > >>> > >>>On Wed, Nov 21, 2018 at 04:56:54PM

Re: [PATCH v2 3/4] arm64: arm_pmu: Add support for exclude_host/exclude_guest attributes

2018-11-22 Thread Andrew Murray
On Wed, Nov 21, 2018 at 05:01:47PM +, Suzuki K Poulose wrote: > > > On 21/11/2018 13:23, Andrew Murray wrote: > > On Wed, Nov 21, 2018 at 10:56:02AM +, Andrew Murray wrote: > > > On Tue, Nov 20, 2018 at 02:49:05PM +, Suzuki K Poulose wrote: > > > > On 11/20/2018 02:15 PM, Andrew

Re: [PATCH v2 2/4] arm64: KVM: add accessors to track guest/host only counters

2018-11-22 Thread Andrew Murray
On Wed, Nov 21, 2018 at 04:04:03PM +, Marc Zyngier wrote: > On 20/11/2018 14:15, Andrew Murray wrote: > > In order to effeciently enable/disable guest/host only perf counters > > at guest entry/exit we add bitfields to kvm_cpu_context for guest and > > host only events as well as accessors for

Re: [PATCH v2 1/4] arm64: arm_pmu: remove unnecessary isb instruction

2018-11-22 Thread Andrew Murray
On Wed, Nov 21, 2018 at 03:58:14PM +, Mark Rutland wrote: > On Tue, Nov 20, 2018 at 02:15:19PM +, Andrew Murray wrote: > > The armv8pmu_enable_event_counter function issues an isb instruction > > after enabling a pair of counters - this doesn't provide any value > > and is inconsistent