[PATCH] trivial: kvm/arm: merge cases to reduce code lines

2019-11-29 Thread Heyi Guo
It seems a little confusing for KVM_CAP_ARM_SET_DEVICE_ADDR to have a separate branch while it doesn't have any difference with the above cases. So we merge it to the above cases, which can also save 2 lines. Signed-off-by: Heyi Guo Cc: Marc Zyngier Cc: James Morse Cc: Julien Thierry Cc

[PATCH] kvm/arm64: change gicv3_cpuif to static likely branch

2019-11-29 Thread Heyi Guo
pdate arm32 specific code for they may still only have GICv2. Signed-off-by: Heyi Guo Cc: Marc Zyngier Cc: James Morse Cc: Julien Thierry Cc: Suzuki K Poulose Cc: Will Deacon --- arch/arm64/kvm/hyp/switch.c | 4 ++-- include/kvm/arm_vgic.h| 2 +- virt/kvm/arm/vgic/vgic-init.c | 9

[RFC PATCH 00/12] Add SDEI support for arm64

2019-09-24 Thread Heyi Guo
and framework first. We can refine the code for several rounds after the big things have been determined. Please give your comments and suggestions. Thanks, HG Cc: Peter Maydell Cc: Dave Martin Cc: Marc Zyngier Cc: Mark Rutland Cc: James Morse Heyi Guo (12): linux-headers: import arm_sdei.h

[RFC PATCH 03/12] arm/sdei: add support to handle SDEI requests from guest

2019-09-24 Thread Heyi Guo
are case). Return: args[0..3]: x0..x3 as defined in SMCCC. We rely on KVM to extract args[0..3] and write them to x0..x3 when hypercall exit returns. Signed-off-by: Heyi Guo Signed-off-by: Jingyi Wang Cc: Peter Maydell Cc: Dave Martin Cc: Marc Zyngier Cc: M

[RFC PATCH 12/12] virt/acpi: add SDEI table if SDEI is enabled

2019-09-24 Thread Heyi Guo
Add SDEI table if SDEI is enabled, so that guest OS can get aware and utilize the interfaces. Signed-off-by: Heyi Guo Cc: Peter Maydell Cc: Dave Martin Cc: Marc Zyngier Cc: Mark Rutland Cc: James Morse Cc: Shannon Zhao Cc: "Michael S. Tsirkin" Cc: Igor Mammedov --- hw/arm

[RFC PATCH 08/12] arm/sdei: add support to register interrupt bind notifier

2019-09-24 Thread Heyi Guo
Other qemu modules related with the interrupt bind operation may want to be notified when guest requests to bind interrupt to sdei event, so we add register and unregister interfaces. Signed-off-by: Heyi Guo Cc: Peter Maydell Cc: Dave Martin Cc: Marc Zyngier Cc: Mark Rutland Cc: James Morse

[RFC PATCH 10/12] arm/sdei: check KVM cap and enable SDEI

2019-09-24 Thread Heyi Guo
Check KVM hypercall forward capability and enable it, and set global flag "sdei_enabled" to true if everything works well. Signed-off-by: Heyi Guo Cc: Peter Maydell Cc: Dave Martin Cc: Marc Zyngier Cc: Mark Rutland Cc: James Morse --- target/arm/sdei.c | 17 +

[RFC PATCH 11/12] arm/kvm: handle guest exit of hypercall

2019-09-24 Thread Heyi Guo
Add support to handle guest exit of hypercall, and forward to SDEI dispatcher if SDEI is enabled and it is an SDEI request. Signed-off-by: Heyi Guo Cc: Peter Maydell Cc: Dave Martin Cc: Marc Zyngier Cc: Mark Rutland Cc: James Morse --- target/arm/kvm.c | 17 + 1 file

[RFC PATCH 02/12] arm/sdei: add virtual device framework

2019-09-24 Thread Heyi Guo
index as lower bit for each allocated event number, so that we can get property easily from valid input event number, as well as the QemuSDE instance. Signed-off-by: Heyi Guo Signed-off-by: Jingyi Wang Cc: Peter Maydell Cc: Dave Martin Cc: Marc Zyngier Cc: Mark Rutland Cc: James Morse

[RFC PATCH 09/12] linux-headers/kvm.h: add capability to forward hypercall

2019-09-24 Thread Heyi Guo
e also use an additional argument to pass exception bit mask, to request KVM to forward all hypercalls except the classes specified in the bit mask. Currently only PSCI can be set as exception, so that we can still keep consistent with the original PSCI processing flow. Signed-off-by: Heyi Guo Cc: Pet

[RFC PATCH 01/12] linux-headers: import arm_sdei.h

2019-09-24 Thread Heyi Guo
Import Linux header file include/uapi/linux/arm_sdei.h from kernel v5.3 release. This is to prepare for qemu SDEI emulation. Signed-off-by: Heyi Guo Cc: Peter Maydell Cc: Dave Martin Cc: Marc Zyngier Cc: Mark Rutland Cc: James Morse Cc: "Michael S. Tsirkin" Cc: Cornelia Huck

[RFC PATCH 06/12] core/irq: add qemu_irq_remove_intercept interface

2019-09-24 Thread Heyi Guo
to default one (i.e. ARM GIC). qemu_irq_remove_intercept() is the new interface to do the above job. Signed-off-by: Heyi Guo Cc: Peter Maydell Cc: Dave Martin Cc: Marc Zyngier Cc: Mark Rutland Cc: James Morse --- hw/core/irq.c| 11 +++ include/hw/irq.h | 8 ++-- 2 files

[RFC PATCH 04/12] arm/sdei: add system reset callback

2019-09-24 Thread Heyi Guo
For this is a logical device which is not attached to system bus, we cannot use DeviceClass->reset interface directly. Instead we register our own reset callback to reset SDEI services when system resets. Signed-off-by: Heyi Guo Signed-off-by: Jingyi Wang Cc: Peter Maydell Cc: Dave Martin

[RFC PATCH 07/12] arm/sdei: override qemu_irq handler when binding interrupt

2019-09-24 Thread Heyi Guo
post_load(). Signed-off-by: Heyi Guo Cc: Peter Maydell Cc: Dave Martin Cc: Marc Zyngier Cc: Mark Rutland Cc: James Morse --- target/arm/sdei.c | 137 -- target/arm/sdei_int.h | 3 ++ 2 files changed, 137 insertions(+), 3 deletions(-) diff --git

[RFC PATCH 05/12] arm/sdei: add support to trigger event by GIC interrupt ID

2019-09-24 Thread Heyi Guo
Add an external interface to trigger an SDEI event bound to an interrupt by providing GIC interrupt ID. Signed-off-by: Heyi Guo Cc: Peter Maydell Cc: Dave Martin Cc: Marc Zyngier Cc: Mark Rutland Cc: James Morse --- target/arm/sdei.c | 38 ++ target/arm

[RFC PATCH 2/2] kvm/arm64: expose hypercall_forwarding capability

2019-09-24 Thread Heyi Guo
l argument to pass exception bit mask, to request KVM to forward all hypercalls except the classes specified in the bit mask. Currently only PSCI can be set as exception, so that we can still keep consistent with the old PSCI processing flow. Signed-off-by: Heyi Guo Cc: Peter Maydell Cc: Dave Martin

[RFC PATCH 1/2] kvm/arm: add capability to forward hypercall to user space

2019-09-24 Thread Heyi Guo
e. Another flag hypercall_excl_psci is to exclude PSCI from forwarding for backward compatible, and it only makes sense to check its value when hypercall_forward is enabled. Signed-off-by: Heyi Guo Cc: Peter Maydell Cc: Dave Martin Cc: Marc Zyngier Cc: Mark Rutland Cc: James Morse Cc: Julien T

[RFC PATCH 0/2] Add virtual SDEI support for arm64

2019-09-24 Thread Heyi Guo
rcall exit returns. And there is a corresponding patch set for qemu. Please give your comments and suggestions. Thanks, HG Cc: Peter Maydell Cc: Dave Martin Cc: Marc Zyngier Cc: Mark Rutland Cc: James Morse Heyi Guo (2): kvm/arm: add capability to forward hypercall to user space

[PATCH] kvm/arm/vgic: fix potential deadlock when ap_list is long

2019-08-26 Thread Heyi Guo
[ 2667.130288] el0_svc+0x8/0xc So return 0 immediately when a==b. Signed-off-by: Zenghui Yu Signed-off-by: Heyi Guo Cc: Marc Zyngier Cc: James Morse Cc: Julien Thierry Cc: Suzuki K Poulose --- virt/kvm/arm/vgic/vgic.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/virt/kvm/arm/vgic

Re: ARM/gic-v4: deadlock occurred

2019-05-09 Thread Heyi Guo
On 2019/5/9 15:48, Marc Zyngier wrote: Hi Heyi, On Wed, 08 May 2019 14:01:48 +0100, Heyi Guo wrote: Hi Marc, The bad news is that though your previous patch fixed the lockdep warnings, we can still reproduce soft lockup panics and some other exceptions... So our issue may not be related

Re: ARM/gic-v4: deadlock occurred

2019-05-08 Thread Heyi Guo
priority is to debug the above issue, so it may take some time to get back with the test result. Sorry for that. Thanks, Heyi On 2019/5/8 20:31, Marc Zyngier wrote: On Sun, 05 May 2019 12:07:02 +0100, Heyi Guo wrote: Hi Marc, Appreciate your quick patch :) We'll test it and let you know

Re: ARM/gic-v4: deadlock occurred

2019-05-05 Thread Heyi Guo
Hi Heyi, On Sun, 05 May 2019 03:26:18 +0100, Heyi Guo wrote: Hi folks, We observed deadlocks after enabling GICv4 and PCI passthrough on ARM64 virtual machines, when not pinning VCPU to physical CPU. We observed below warnings after enabling lockdep debug in kernel: [ 362.847

Re: ARM/gic-v4: deadlock occurred

2019-05-05 Thread Heyi Guo
Hi Marc, Appreciate your quick patch :) We'll test it and let you know the result. Heyi On 2019/5/5 18:38, Marc Zyngier wrote: [+ kvmarm] Hi Heyi, On Sun, 05 May 2019 03:26:18 +0100, Heyi Guo wrote: Hi folks, We observed deadlocks after enabling GICv4 and PCI passthrough on ARM64

Re: [RFC] arm/cpu: fix soft lockup panic after resuming from stop

2019-04-11 Thread Heyi Guo
19/3/27 1:12, Steven Price wrote: Hi Heyi, On 26/03/2019 13:53, Heyi Guo wrote: I also tested save/restore operations, and observed that clock in guest would not jump after restoring either. If we consider guest clock not being synchronized with real wall clock as an issue, does it mean save/

Re: [PATCH] KVM: arm/arm64: vgic-v3: Retire pending interrupts on disabling LPIs

2019-04-02 Thread Heyi Guo
Hi Marc, The issue has been fixed after applying your patch. Thanks, Heyi On 2019/4/2 17:32, Heyi Guo wrote: Thanks, I'll use this one for test. Heyi On 2019/4/2 16:48, Marc Zyngier wrote: On Tue, 02 Apr 2019 09:22:29 +0100, Auger Eric wrote: Hi Marc, On 4/2/19 9:24 AM, Marc Zyngier

Re: [PATCH] KVM: arm/arm64: vgic-v3: Retire pending interrupts on disabling LPIs

2019-04-02 Thread Heyi Guo
disable LPIs. Reported-by: Heyi Guo Fixes: 0e4e82f154e3 ("KVM: arm64: vgic-its: Enable ITS emulation as a virtual MSI controller") Signed-off-by: Marc Zyngier --- Heyi, Can you please give this alternative patch a go on your setup? This should be a much better fit than my ori

Re: Unexpected interrupt received in Guest OS when booting after "system_reset"

2019-03-29 Thread Heyi Guo
On 2019/3/29 18:54, Marc Zyngier wrote: On 29/03/2019 09:19, Heyi Guo wrote: Hi Marc, The patch works. I tested for 1.5 hour and 52 VM resets. There were 16 times that a virtual LPI left in the ap_list (seen by an additional printk) during reset and we never saw "Unexpected inte

Re: Unexpected interrupt received in Guest OS when booting after "system_reset"

2019-03-29 Thread Heyi Guo
arch.vgic_cpu./ with /vgic_cpu->/ in the lock/unlock code line, to reduce some words? Thanks, Heyi On 2019/3/29 9:19, Heyi Guo wrote: On 2019/3/29 1:18, Marc Zyngier wrote: [Please do not send HTML emails] Sorry; will keep in mind next time :) On 28/03/2019 15:44, Heyi Guo wrote: Hi Marc

Re: Unexpected interrupt received in Guest OS when booting after "system_reset"

2019-03-28 Thread Heyi Guo
On 2019/3/29 1:18, Marc Zyngier wrote: [Please do not send HTML emails] Sorry; will keep in mind next time :) On 28/03/2019 15:44, Heyi Guo wrote: Hi Marc and Christoffer, When we issue "system_reset" from qemu monitor to a running VM, guest Linux will occasionally get &

Unexpected interrupt received in Guest OS when booting after "system_reset"

2019-03-28 Thread Heyi Guo
Hi Marc and Christoffer, When we issue "system_reset" from qemu monitor to a running VM, guest Linux will occasionally get "Unexpected interrupt" after rebooting, with kernel message at the bottom. After some investigation, we found it might be caused by the preservation of virtual LPI during

Re: [RFC] arm/cpu: fix soft lockup panic after resuming from stop

2019-03-26 Thread Heyi Guo
Guo wrote: Hi Steven, Thanks for your explanation. Please see my comments below. On 2019/3/21 0:29, Steven Price wrote: On 19/03/2019 14:39, Heyi Guo wrote: Hi Christoffer and Steve, On 2019/3/15 16:59, Christoffer Dall wrote: Hi Steve, On Wed, Mar 13, 2019 at 10:11:30AM +, Steven Price

Re: [RFC] arm/cpu: fix soft lockup panic after resuming from stop

2019-03-26 Thread Heyi Guo
Hi Steven, Thanks for your explanation. Please see my comments below. On 2019/3/21 0:29, Steven Price wrote: On 19/03/2019 14:39, Heyi Guo wrote: Hi Christoffer and Steve, On 2019/3/15 16:59, Christoffer Dall wrote: Hi Steve, On Wed, Mar 13, 2019 at 10:11:30AM +, Steven Price wrote

Re: [RFC] Question about enable doorbell irq and halt_poll process

2019-03-20 Thread Heyi Guo
+cc Marc and Christoffer... On 2019/3/19 21:25, Tangnianyao (ICT) wrote: Hi, all Using gicv4, when guest is waiting for irq, it sends wfi and traps to kvm. When vlpi is forwarded to PE after its_vpe_deschedule, before halt_poll in kvm_vcpu_block, halt_poll may increase latency for this vlpi

Re: [RFC] arm/cpu: fix soft lockup panic after resuming from stop

2019-03-19 Thread Heyi Guo
Hi Christoffer and Steve, On 2019/3/15 16:59, Christoffer Dall wrote: Hi Steve, On Wed, Mar 13, 2019 at 10:11:30AM +, Steven Price wrote: Personally I think what we need is: * Either a patch like the one from Heyi Guo (save/restore CNTVCT_EL0) or alternatively hooking up

Re: [RFC] arm/cpu: fix soft lockup panic after resuming from stop

2019-03-14 Thread Heyi Guo
Hi Peter and Steven, On 2019/3/13 18:11, Steven Price wrote: On 12/03/2019 14:12, Marc Zyngier wrote: Hi Peter, On 12/03/2019 10:08, Peter Maydell wrote: On Tue, 12 Mar 2019 at 06:10, Heyi Guo wrote: When we stop a VM for more than 30 seconds and then resume it, by qemu monitor command

Re: [RFC] arm/cpu: fix soft lockup panic after resuming from stop

2019-03-13 Thread Heyi Guo
dell wrote: On Tue, 12 Mar 2019 at 06:10, Heyi Guo wrote: When we stop a VM for more than 30 seconds and then resume it, by qemu monitor command "stop" and "cont", Linux on VM will complain of "soft lockup - CPU#x stuck for xxs!" as below: [ 2783.809517] watchdog: