Re: [PATCH 4/6] irqchip: GIC: Use chip_data instead of handler_data for cascaded interrupts

2015-07-10 Thread Marc Zyngier
On 10/07/15 09:17, Jiang Liu wrote: On 2015/7/10 15:52, Marc Zyngier wrote: On 09/07/15 22:33, Thomas Gleixner wrote: On Thu, 9 Jul 2015, Marc Zyngier wrote: When used as a primary interrupt controller, the GIC driver uses irq_data-chip_data to extract controller-specific information. When

Re: [PATCH 4/6] irqchip: GIC: Use chip_data instead of handler_data for cascaded interrupts

2015-07-10 Thread Marc Zyngier
On 09/07/15 22:33, Thomas Gleixner wrote: On Thu, 9 Jul 2015, Marc Zyngier wrote: When used as a primary interrupt controller, the GIC driver uses irq_data-chip_data to extract controller-specific information. When used as a secondary interrupt controller, it uses handler_data instead. As

Re: [PATCH 4/6] irqchip: GIC: Use chip_data instead of handler_data for cascaded interrupts

2015-07-10 Thread Jiang Liu
On 2015/7/10 15:52, Marc Zyngier wrote: On 09/07/15 22:33, Thomas Gleixner wrote: On Thu, 9 Jul 2015, Marc Zyngier wrote: When used as a primary interrupt controller, the GIC driver uses irq_data-chip_data to extract controller-specific information. When used as a secondary interrupt

***SPAM*** KVM on ARM: How to add some functions into interrupt.S with C code?

2015-07-10 Thread harry
I want to add some functions into interrupt.S with C code to do some operations in hyp mode with a hypcall. I have tried to add .global [function name] and use bl [function name], but there will be a prefetch abort. So I want to know if the C code can be linked into interrupt.S and how to

[RFC PATCH] target-arm: kvm: Differentiate registers based on write-back levels

2015-07-10 Thread Christoffer Dall
Some registers like the CNTVCT register should only be written to the kernel as part of machine initialization or on vmload operations, but never during runtime, as this can potentially make time go backwards or create inconsistent time observations between VCPUs. Introduce a list of registers

Re: [RFC PATCH] target-arm: kvm: Differentiate registers based on write-back levels

2015-07-10 Thread Peter Maydell
On 10 July 2015 at 12:00, Christoffer Dall christoffer.d...@linaro.org wrote: Some registers like the CNTVCT register should only be written to the kernel as part of machine initialization or on vmload operations, but never during runtime, as this can potentially make time go backwards or

Re: [PATCH 07/13] arm64: KVM: VHE: Patch out use of HVC

2015-07-10 Thread Paolo Bonzini
On 08/07/2015 19:54, Marc Zyngier wrote: Alternatively, I could move it to arch/arm64/include/asm (renamed to kvm_vhe_macros.h?), which would solve this issue. I just gave it a go, and that seems sensible enough. Yes, that would do. Alternatively: * create kvm_hyp_macros.h and put more

[PATCH v4 0/2] arm/arm64: KVM: Optimize arm64 fp/simd, saves 30-50% on exits for non-VHE

2015-07-10 Thread Mario Smarduch
This is a followp to previous iteration but implemented on top of VHE patches. Only non-VHE path is addressied by this patch. In second patch 32-bit handler is updated to keep exit handling consistent with 64-bit code, and nothing has changed. Currently we save/restore fp/simd on each exit, the

[PATCH v4 2/2] keep arm vfp/simd exit handling consistent with arm64

2015-07-10 Thread Mario Smarduch
After enhancing arm64 FP/SIMD exit handling, ARMv7 VFP exit branch is moved to guest trap handling. This allows us to keep exit handling flow between both architectures consistent. Signed-off-by: Mario Smarduch m.smard...@samsung.com --- arch/arm/kvm/interrupts.S | 14 -- 1 file

[PATCH v2 03/15] KVM: arm/arm64: add emulation model specific destroy function

2015-07-10 Thread Andre Przywara
Currently we destroy the VGIC emulation in one function that cares for all emulated models. To be on par with init_model (which is model specific), lets introduce a per-emulation-model destroy method, too. Use it for a tiny GICv3 specific code already, later it will be handy for the ITS emulation.

[PATCH v2 01/15] KVM: arm/arm64: VGIC: don't track used LRs in the distributor

2015-07-10 Thread Andre Przywara
Currently we track which IRQ has been mapped to which VGIC list register and also have to synchronize both. We used to do this to hold some extra state (for instance the active bit). It turns out that this extra state in the LRs is no longer needed and this extra tracking causes some pain later.

[PATCH v2 00/15] KVM: arm64: GICv3 ITS emulation

2015-07-10 Thread Andre Przywara
Hi, this respin tries to address all comments I got so far from the list. Thanks to Eric, Pavel and Christoffer for the review! The major change in this series is the reworked locking. The current implementation is now much more fine grained and avoids any calls to functions that could possibly

[PATCH v2 06/15] KVM: arm64: Introduce new MMIO region for the ITS base address

2015-07-10 Thread Andre Przywara
The ARM GICv3 ITS controller requires a separate register frame to cover ITS specific registers. Add a new VGIC address type and store the address in a field in the vgic_dist structure. Provide a function to check whether userland has provided the address, so ITS functionality can be guarded by

[PATCH v2 08/15] KVM: arm64: introduce ITS emulation file with stub functions

2015-07-10 Thread Andre Przywara
The ARM GICv3 ITS emulation code goes into a separate file, but needs to be connected to the GICv3 emulation, of which it is an option. Introduce the skeleton with function stubs to be filled later. Introduce the basic ITS data structure and initialize it, but don't return any success yet, as we

[PATCH v2 09/15] KVM: arm64: implement basic ITS register handlers

2015-07-10 Thread Andre Przywara
Add emulation for some basic MMIO registers used in the ITS emulation. This includes: - GITS_{CTLR,TYPER,IIDR} - ID registers - GITS_{CBASER,CREADR,CWRITER} those implement the ITS command buffer handling Most of the handlers are pretty straight forward, but CWRITER goes some extra miles to

[PATCH v2 04/15] KVM: arm/arm64: extend arch CAP checks to allow per-VM capabilities

2015-07-10 Thread Andre Przywara
KVM capabilities can be a per-VM property, though ARM/ARM64 currently does not pass on the VM pointer to the architecture specific capability handlers. Add a struct kvm* parameter to those function to later allow proper per-VM capability reporting. Signed-off-by: Andre Przywara

[PATCH v2 12/15] KVM: arm64: sync LPI configuration and pending tables

2015-07-10 Thread Andre Przywara
The LPI configuration and pending tables of the GICv3 LPIs are held in tables in (guest) memory. To achieve reasonable performance, we cache this data in our own data structures, so we need to sync those two views from time to time. This behaviour is well described in the GICv3 spec and is also

[PATCH v2 11/15] KVM: arm64: handle pending bit for LPIs in ITS emulation

2015-07-10 Thread Andre Przywara
As the actual LPI number in a guest can be quite high, but is mostly assigned using a very sparse allocation scheme, bitmaps and arrays for storing the virtual interrupt status are a waste of memory. We use our equivalent of the Interrupt Translation Table Entry (ITTE) to hold this extra status

[PATCH v2 02/15] KVM: extend struct kvm_msi to hold a 32-bit device ID

2015-07-10 Thread Andre Przywara
The ARM GICv3 ITS MSI controller requires a device ID to be able to assign the proper interrupt vector. On real hardware, this ID is sampled from the bus. To be able to emulate an ITS controller, extend the KVM MSI interface to let userspace provide such a device ID. For PCI devices, the device ID

[PATCH v2 10/15] KVM: arm64: add data structures to model ITS interrupt translation

2015-07-10 Thread Andre Przywara
The GICv3 Interrupt Translation Service (ITS) uses tables in memory to allow a sophisticated interrupt routing. It features device tables, an interrupt table per device and a table connecting collections to actual CPUs (aka. redistributors in the GICv3 lingo). Since the interrupt numbers for the

Re: ***SPAM*** KVM on ARM: How to add some functions into interrupt.S with C code?

2015-07-10 Thread Marc Zyngier
Hi Harry, On 10/07/15 10:06, harry wrote: I want to add some functions into interrupt.S with C code to do some operations in hyp mode with a hypcall. I have tried to add .global [function name] and use bl [function name], but there will be a prefetch abort. So I want to know if the C

[PATCH v2 15/15] KVM: arm64: enable ITS emulation as a virtual MSI controller

2015-07-10 Thread Andre Przywara
If userspace has provided a base address for the ITS register frame, we enable the bits that advertise LPIs in the GICv3. When the guest has enabled LPIs and the ITS, we enable the emulation part by initializing the ITS data structures and trapping on ITS register frame accesses by the guest. Also

[PATCH v2 13/15] KVM: arm64: implement ITS command queue command handlers

2015-07-10 Thread Andre Przywara
The connection between a device, an event ID, the LPI number and the allocated CPU is stored in in-memory tables in a GICv3, but their format is not specified by the spec. Instead software uses a command queue in a ring buffer to let the ITS implementation use their own format. Implement handlers

Re: [PATCH v2 4/7] KVM: arm/arm64: enable irqchip routing

2015-07-10 Thread Andre Przywara
Hi Eric, On 09/07/15 09:22, Eric Auger wrote: This patch adds compilation and link against irqchip. On ARM, irqchip routing is not really useful since there is a single irqchip. However main motivation behind using irqchip code is to enable MSI routing code. With the support of in-kernel

Re: [PATCH v2 3/7] KVM: irqchip: convey devid to kvm_set_msi

2015-07-10 Thread Andre Przywara
On 09/07/15 09:22, Eric Auger wrote: on ARM, a devid field is populated in kvm_msi struct in case the flag is set to KVM_MSI_VALID_DEVID. Let's populate the corresponding kvm_kernel_irq_routing_entry devid field and set the msi type to KVM_IRQ_ROUTING_EXTENDED_MSI. Signed-off-by: Eric Auger

Re: [PATCH v2 6/7] KVM: arm/arm64: enable MSI routing

2015-07-10 Thread Andre Przywara
On 09/07/15 09:22, Eric Auger wrote: Up to now, only irqchip routing entries could be set. This patch adds the capability to insert MSI routing entries, with or without device id. Although standard MSI entries can be set, their injection still is not supported. For ARM64, let's also increase

Re: [PATCH v2 7/7] KVM: arm: implement kvm_set_msi by gsi direct mapping

2015-07-10 Thread Andre Przywara
On 09/07/15 09:22, Eric Auger wrote: If the ITS modality is not available, let's simply support MSI injection by transforming the MSI.data into an SPI ID. This becomes possible to use KVM_SIGNAL_MSI ioctl for arm too. Signed-off-by: Eric Auger eric.au...@linaro.org --- v1 - v2: -