vITS Reset
PATCH v4 1/4 hw/intc/arm_gicv3_its: Don't call post_load on reset
In reply to Eric AugerQuoted 1 line
From the very beginning,
post_load()was called from common
reset. This is not standard and obliged to discriminate the reset case from the restore case using the iidr value.
Let's get rid of that call.
--- hw/intc/arm_gicv3_its_common.c | 2 -- hw/intc/arm_gicv3_its_kvm.c | 4 ---- 2 files changed, 6 deletions(-)
hw/intc/arm_gicv3_its_common.c +0 -2
@@ -131,8 +131,6 @@ static void gicv3_its_common_reset(DeviceState *dev) s->creadr =0 ; s->iidr =0 ;memset (&s->baser,0 ,sizeof (s->baser)); - -gicv3_its_post_load (s,0 ); }static void gicv3_its_common_class_init (ObjectClass *klass,void *data)
hw/intc/arm_gicv3_its_kvm.c +0 -4
@@ -155,10 +155,6 @@ static void kvm_arm_its_post_load(GICv3ITSState *s) {int i; -if (!s->iidr) { -return ; - } -kvm_device_access (s->dev_fd,KVM_DEV_ARM_VGIC_GRP_ITS_REGS ,GITS_IIDR , &s->iidr, true, &error_abort);
Signature · 1 line
2.5.5
PATCH v4 2/4 hw/intc/arm_gicv3_its: Implement a minimalist reset
In reply to Eric AugerAt the moment the ITS is not properly reset and this causes various bugs on save/restore. We implement a minimalist reset through individual register writes but for kernel versions before v4.15 this fails voiding the vITS cache. We cannot claim we have a comprehensive reset (hence the error message) but that's better than nothing.
---
v2 -> v3:
- individual register writes performed in kvm_arm_its_reset
- check KVM_DEV_ARM_VGIC_GRP_ITS_REGS support
--- hw/intc/arm_gicv3_its_kvm.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)
hw/intc/arm_gicv3_its_kvm.c +41 -0
@@ -28,6 +28,16 @@#define TYPE_KVM_ARM_ITS "arm-its-kvm"#define KVM_ARM_ITS (obj) OBJECT_CHECK(GICv3ITSState, (obj), TYPE_KVM_ARM_ITS) +#define KVM_ARM_ITS_CLASS (klass) \ + OBJECT_CLASS_CHECK(KVMARMITSClass, (klass), TYPE_KVM_ARM_ITS) +#define KVM_ARM_ITS_GET_CLASS (obj) \ + OBJECT_GET_CLASS(KVMARMITSClass, (obj), TYPE_KVM_ARM_ITS) + +typedef struct KVMARMITSClass { +GICv3ITSCommonClass parent_class; +void (*parent_reset)(DeviceState *dev); +}KVMARMITSClass ; +static int kvm_its_send_msi (GICv3ITSState *s,uint32_t value,uint16_t devid) {
@@ -186,6 +196,34 @@ static void kvm_arm_its_post_load(GICv3ITSState *s) GITS_CTLR, &s->ctlr, true, &error_abort); } +static void kvm_arm_its_reset (DeviceState *dev) +{ +GICv3ITSState *s =ARM_GICV3_ITS_COMMON (dev); +KVMARMITSClass *c =KVM_ARM_ITS_GET_CLASS (s); +int i; + + c->parent_reset (dev); + +error_report ("ITS KVM: full reset is not supported by the host kernel" ); + +if (!kvm_device_check_attr (s->dev_fd,KVM_DEV_ARM_VGIC_GRP_ITS_REGS , +GITS_CTLR )) { +return ; + } + +kvm_device_access (s->dev_fd,KVM_DEV_ARM_VGIC_GRP_ITS_REGS , +GITS_CTLR , &s->ctlr, true, &error_abort); + +kvm_device_access (s->dev_fd,KVM_DEV_ARM_VGIC_GRP_ITS_REGS , +GITS_CBASER , &s->cbaser, true, &error_abort); + +for (i =0 ; i <8 ; i++) { +kvm_device_access (s->dev_fd,KVM_DEV_ARM_VGIC_GRP_ITS_REGS , +GITS_BASER + i *8 , &s->baser[i], true, + &error_abort); + } +} +static Property kvm_arm_its_props[] = {DEFINE_PROP_LINK ("parent-gicv3" , GICv3ITSState, gicv3,"kvm-arm-gicv3" , GICv3State *),
@@ -196,12 +234,15 @@ static void kvm_arm_its_class_init(ObjectClass *klass, void *data) {DeviceClass *dc =DEVICE_CLASS (klass);GICv3ITSCommonClass *icc =ARM_GICV3_ITS_COMMON_CLASS (klass); +KVMARMITSClass *ic =KVM_ARM_ITS_CLASS (klass); dc->realize = kvm_arm_its_realize; dc->props = kvm_arm_its_props; + ic->parent_reset = dc->reset; icc->send_msi = kvm_its_send_msi; icc->pre_save = kvm_arm_its_pre_save; icc->post_load = kvm_arm_its_post_load; + dc->reset = kvm_arm_its_reset; }static const TypeInfo kvm_arm_its_info = {
Signature · 1 line
2.5.5
v4 cover vITS Reset
At the moment the ITS is not properly reset. On System reset or reboot, previous ITS register values and caches are left unchanged. Some of the registers might point to some guest RAM tables which are not valid anymore. This leads to state inconsistencies that are detected by the kernel save/restore code. And eventually this may cause qemu abort.
This series adds vITS reset modality:
- the 2 first patches bring a minimalist reset through individual register writes. However, with kernel versions < 4.15, this reset is not complete (vITS caches are not voided).
- With kernel versions >= 4.15 we can rely on a new ITS KVM device reset IOTCL. The last 2 patches introduce the full reset.
Tested with 4.11, 4.14 and 4.15 host kernels.
Best Regards
Eric
The series is available at:
https://github.com/eauger/qemu/tree/2.11.0-rc2-its-reset-v4
History:
v3 -> v4:
- replace partial linux header update by an exhaustive one
v2 -> v3:
- don't call post_load on reset (no iidr check anymore)
v1 -> v2:
- Clarify why abort should be removed for save. Leave abort for restore.
- Adopt the same reset infra as vgic
- introduce "hw/intc/arm_gicv3_its: Implement a minimalist reset" which perform individual register writes. This is sufficient to fix the issues without ioctl
Eric Auger (4):
hw/intc/arm_gicv3_its: Don't call post_load on reset hw/intc/arm_gicv3_its: Implement a minimalist reset
linux-headers: update to pre 4.15-rc0 hw/intc/arm_gicv3_its: Implement full reset
hw/intc/arm_gicv3_its_common.c | 2 - hw/intc/arm_gicv3_its_kvm.c | 52 ++- include/standard-headers/asm-s390/virtio-ccw.h | 1 + include/standard-headers/asm-x86/hyperv.h | 394 +-------------------- include/standard-headers/linux/input-event-codes.h | 2 + include/standard-headers/linux/input.h | 1 + include/standard-headers/linux/pci_regs.h | 45 ++- linux-headers/asm-arm/kvm.h | 8 + linux-headers/asm-arm/kvm_para.h | 1 + linux-headers/asm-arm/unistd.h | 2 + linux-headers/asm-arm64/kvm.h | 8 + linux-headers/asm-arm64/unistd.h | 1 + linux-headers/asm-powerpc/epapr_hcalls.h | 1 + linux-headers/asm-powerpc/kvm.h | 1 + linux-headers/asm-powerpc/kvm_para.h | 1 + linux-headers/asm-powerpc/unistd.h | 1 + linux-headers/asm-s390/kvm.h | 1 + linux-headers/asm-s390/kvm_para.h | 1 + linux-headers/asm-s390/unistd.h | 4 +- linux-headers/asm-x86/kvm.h | 1 + linux-headers/asm-x86/kvm_para.h | 2 +- linux-headers/asm-x86/unistd.h | 1 + linux-headers/linux/kvm.h | 2 + linux-headers/linux/kvm_para.h | 1 + linux-headers/linux/psci.h | 1 + linux-headers/linux/userfaultfd.h | 1 + linux-headers/linux/vfio.h | 1 + linux-headers/linux/vfio_ccw.h | 1 + linux-headers/linux/vhost.h | 1 + 29 files changed, 122 insertions(+), 417 deletions(-)
Signature · 1 line
2.5.5
PATCH v4 3/4 linux-headers: update to pre 4.15-rc0
Update headers against post v4.14 and pre v4.15-rc0.
--- include/standard-headers/asm-s390/virtio-ccw.h | 1 + include/standard-headers/asm-x86/hyperv.h | 394 +-------------------- include/standard-headers/linux/input-event-codes.h | 2 + include/standard-headers/linux/input.h | 1 + include/standard-headers/linux/pci_regs.h | 45 ++- linux-headers/asm-arm/kvm.h | 8 + linux-headers/asm-arm/kvm_para.h | 1 + linux-headers/asm-arm/unistd.h | 2 + linux-headers/asm-arm64/kvm.h | 8 + linux-headers/asm-arm64/unistd.h | 1 + linux-headers/asm-powerpc/epapr_hcalls.h | 1 + linux-headers/asm-powerpc/kvm.h | 1 + linux-headers/asm-powerpc/kvm_para.h | 1 + linux-headers/asm-powerpc/unistd.h | 1 + linux-headers/asm-s390/kvm.h | 1 + linux-headers/asm-s390/kvm_para.h | 1 + linux-headers/asm-s390/unistd.h | 4 +- linux-headers/asm-x86/kvm.h | 1 + linux-headers/asm-x86/kvm_para.h | 2 +- linux-headers/asm-x86/unistd.h | 1 + linux-headers/linux/kvm.h | 2 + linux-headers/linux/kvm_para.h | 1 + linux-headers/linux/psci.h | 1 + linux-headers/linux/userfaultfd.h | 1 + linux-headers/linux/vfio.h | 1 + linux-headers/linux/vfio_ccw.h | 1 + linux-headers/linux/vhost.h | 1 + 27 files changed, 74 insertions(+), 411 deletions(-)
include/standard-headers/asm-s390/virtio-ccw.h +1 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Definitions for virtio-ccw devices. *
include/standard-headers/asm-x86/hyperv.h +1 -393
394 lines not on this page · raw message
include/standard-headers/linux/input-event-codes.h +2 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Input event codes *
@@ -406,6 +407,7 @@#define BTN_TOOL_MOUSE 0x146#define BTN_TOOL_LENS 0x147#define BTN_TOOL_QUINTTAP 0x148/* Five fingers on trackpad */ +#define BTN_STYLUS3 0x149#define BTN_TOUCH 0x14a#define BTN_STYLUS 0x14b#define BTN_STYLUS2 0x14c
include/standard-headers/linux/input.h +1 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (c) 1999-2002 Vojtech Pavlik *
include/standard-headers/linux/pci_regs.h +29 -16
72 lines not on this page · raw message
linux-headers/asm-arm/kvm.h +8 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2012 - Virtual Open Systems and Columbia University * Author: Christoffer Dall <[email protected]>
@@ -151,6 +152,12 @@ struct kvm_arch_memory_slot { (__ARM_CP15_REG(op1, 0, crm, 0) | KVM_REG_SIZE_U64)#define ARM_CP15_REG64 (...) __ARM_CP15_REG64(__VA_ARGS__) +/* PL1 Physical Timer Registers */ +#define KVM_REG_ARM_PTIMER_CTL ARM_CP15_REG32(0, 14, 2, 1) +#define KVM_REG_ARM_PTIMER_CNT ARM_CP15_REG64(0, 14) +#define KVM_REG_ARM_PTIMER_CVAL ARM_CP15_REG64(2, 14) + +/* Virtual Timer Registers */ #define KVM_REG_ARM_TIMER_CTL ARM_CP15_REG32(0, 14, 3, 1)#define KVM_REG_ARM_TIMER_CNT ARM_CP15_REG64(1, 14)#define KVM_REG_ARM_TIMER_CVAL ARM_CP15_REG64(3, 14)
@@ -215,6 +222,7 @@ struct kvm_arch_memory_slot {#define KVM_DEV_ARM_ITS_SAVE_TABLES 1#define KVM_DEV_ARM_ITS_RESTORE_TABLES 2#define KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES 3 +#define KVM_DEV_ARM_ITS_CTRL_RESET 4/* KVM_IRQ_LINE irq field index values */ #define KVM_ARM_IRQ_TYPE_SHIFT 24
linux-headers/asm-arm/kvm_para.h +1 -0
@@ -1 +1,2 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #include <asm-generic/kvm_para.h>
linux-headers/asm-arm/unistd.h +2 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * arch/arm/include/asm/unistd.h *
@@ -35,5 +36,6 @@#define __ARM_NR_usr26 (__ARM_NR_BASE+3)#define __ARM_NR_usr32 (__ARM_NR_BASE+4)#define __ARM_NR_set_tls (__ARM_NR_BASE+5) +#define __ARM_NR_get_tls (__ARM_NR_BASE+6)#endif /* __ASM_ARM_UNISTD_H */
linux-headers/asm-arm64/kvm.h +8 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2012,2013 - ARM Ltd * Author: Marc Zyngier <[email protected]>
@@ -195,6 +196,12 @@ struct kvm_arch_memory_slot {#define ARM64_SYS_REG (...) (__ARM64_SYS_REG(__VA_ARGS__) | KVM_REG_SIZE_U64) +/* Physical Timer EL0 Registers */ +#define KVM_REG_ARM_PTIMER_CTL ARM64_SYS_REG(3, 3, 14, 2, 1) +#define KVM_REG_ARM_PTIMER_CVAL ARM64_SYS_REG(3, 3, 14, 2, 2) +#define KVM_REG_ARM_PTIMER_CNT ARM64_SYS_REG(3, 3, 14, 0, 1) + +/* EL0 Virtual Timer Registers */ #define KVM_REG_ARM_TIMER_CTL ARM64_SYS_REG(3, 3, 14, 3, 1)#define KVM_REG_ARM_TIMER_CNT ARM64_SYS_REG(3, 3, 14, 3, 2)#define KVM_REG_ARM_TIMER_CVAL ARM64_SYS_REG(3, 3, 14, 0, 2)
@@ -227,6 +234,7 @@ struct kvm_arch_memory_slot {#define KVM_DEV_ARM_ITS_SAVE_TABLES 1#define KVM_DEV_ARM_ITS_RESTORE_TABLES 2#define KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES 3 +#define KVM_DEV_ARM_ITS_CTRL_RESET 4/* Device Control API on vcpu fd */ #define KVM_ARM_VCPU_PMU_V3_CTRL 0
linux-headers/asm-arm64/unistd.h +1 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2012 ARM Ltd. *
linux-headers/asm-powerpc/epapr_hcalls.h +1 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * ePAPR hcall interface *
linux-headers/asm-powerpc/kvm.h +1 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as
linux-headers/asm-powerpc/kvm_para.h +1 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as
linux-headers/asm-powerpc/unistd.h +1 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * This file contains the system call numbers. *
linux-headers/asm-s390/kvm.h +1 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_KVM_S390_H#define __LINUX_KVM_S390_H/*
linux-headers/asm-s390/kvm_para.h +1 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * User API definitions for paravirtual devices on s390 *
linux-headers/asm-s390/unistd.h +3 -1
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * S390 version *
@@ -315,7 +316,8 @@#define __NR_pwritev2 377#define __NR_s390_guarded_storage 378#define __NR_statx 379 -#define NR_syscalls 380 +#define __NR_s390_sthyi 380 +#define NR_syscalls 381/* * There are some system calls that are not present on 64 bit, some
linux-headers/asm-x86/kvm.h +1 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_KVM_H#define _ASM_X86_KVM_H
linux-headers/asm-x86/kvm_para.h +1 -1
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_KVM_PARA_H#define _ASM_X86_KVM_PARA_H
@@ -109,5 +110,4 @@ struct kvm_vcpu_pv_apf_data {#define KVM_PV_EOI_ENABLED KVM_PV_EOI_MASK#define KVM_PV_EOI_DISABLED 0x0 -#endif /* _ASM_X86_KVM_PARA_H */
linux-headers/asm-x86/unistd.h +1 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_UNISTD_H#define _ASM_X86_UNISTD_H
linux-headers/linux/kvm.h +2 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_KVM_H#define __LINUX_KVM_H
@@ -930,6 +931,7 @@ struct kvm_ppc_resize_hpt {#define KVM_CAP_PPC_SMT_POSSIBLE 147#define KVM_CAP_HYPERV_SYNIC2 148#define KVM_CAP_HYPERV_VP_INDEX 149 +#define KVM_CAP_S390_AIS_MIGRATION 150#ifdef KVM_CAP_IRQ_ROUTING
linux-headers/linux/kvm_para.h +1 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_KVM_PARA_H#define __LINUX_KVM_PARA_H
linux-headers/linux/psci.h +1 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ARM Power State and Coordination Interface (PSCI) header *
linux-headers/linux/userfaultfd.h +1 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * include/linux/userfaultfd.h *
linux-headers/linux/vfio.h +1 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * VFIO API definition *
linux-headers/linux/vfio_ccw.h +1 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Interfaces for vfio-ccw *
linux-headers/linux/vhost.h +1 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_VHOST_H#define _LINUX_VHOST_H/* Userspace interface for in-kernel virtio accelerators. */
Signature · 1 line
2.5.5
PATCH v4 4/4 hw/intc/arm_gicv3_its: Implement full reset
In reply to Eric AugerVoiding the ITS caches is not supposed to happen via individual register writes. So we introduced a dedicated ITS KVM device ioctl to perform a cold reset of the ITS:
KVM_DEV_ARM_VGIC_GRP_CTRL/KVM_DEV_ARM_ITS_CTRL_RESET. Let's use this latter if the kernel supports it.
--- hw/intc/arm_gicv3_its_kvm.c | 7 +++++++ 1 file changed, 7 insertions(+)
hw/intc/arm_gicv3_its_kvm.c +7 -0
@@ -204,6 +204,13 @@ static void kvm_arm_its_reset(DeviceState *dev) c->parent_reset (dev); +if (kvm_device_check_attr (s->dev_fd,KVM_DEV_ARM_VGIC_GRP_CTRL , +KVM_DEV_ARM_ITS_CTRL_RESET )) { +kvm_device_access (s->dev_fd,KVM_DEV_ARM_VGIC_GRP_CTRL , +KVM_DEV_ARM_ITS_CTRL_RESET ,NULL , true, &error_abort); +return ; + } +error_report ("ITS KVM: full reset is not supported by the host kernel" ); if (!kvm_device_check_attr(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS,
Signature · 1 line
2.5.5
Re: [Qemu-arm] [PATCH v4 2/4] hw/intc/arm_gicv3_its: Implement a minimalist reset
In reply to Eric AugerQuoted 42 lines · Eric Auger
At the moment the ITS is not properly reset and this causes various bugs on save/restore. We implement a minimalist reset through individual register writes but for kernel versions before v4.15 this fails voiding the vITS cache. We cannot claim we have a comprehensive reset (hence the error message) but that's better than nothing.
Signed-off-by Eric Auger <[email protected]>---
v2 -> v3:
- individual register writes performed inkvm_arm_its_reset
- checkKVM_DEV_ARM_VGIC_GRP_ITS_REGSsupport--- hw/intc/arm_gicv3_its_kvm.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)hw/intc/arm_gicv3_its_kvm.c +10
-0@@ -28,6 +28,16 @@#define TYPE_KVM_ARM_ITS "arm-its-kvm"#define KVM_ARM_ITS (obj) OBJECT_CHECK(GICv3ITSState, (obj), TYPE_KVM_ARM_ITS) +#define KVM_ARM_ITS_CLASS (klass) \ + OBJECT_CLASS_CHECK(KVMARMITSClass, (klass), TYPE_KVM_ARM_ITS) +#define KVM_ARM_ITS_GET_CLASS (obj) \ + OBJECT_GET_CLASS(KVMARMITSClass, (obj), TYPE_KVM_ARM_ITS) + +typedef struct KVMARMITSClass { +GICv3ITSCommonClass parent_class; +void (*parent_reset)(DeviceState *dev); +}KVMARMITSClass ; +static int kvm_its_send_msi (GICv3ITSState *s,uint32_t value,uint16_t devid) {@@ -186,6 +196,34 @@ static void kvm_arm_its_post_load(GICv3ITSState *s) GITS_CTLR, &s->ctlr, true, &error_abort); }
hw/intc/arm_gicv3_its_kvm.c static void kvm_arm_its_post_load(GICv3ITSState *s) · line 207
Quoted 10 lines
hw/intc/arm_gicv3_its_kvm.c +9
-0+static void kvm_arm_its_reset (DeviceState *dev) +{ +GICv3ITSState *s =ARM_GICV3_ITS_COMMON (dev); +KVMARMITSClass *c =KVM_ARM_ITS_GET_CLASS (s); +int i; + + c->parent_reset (dev); + +error_report ("ITS KVM: full reset is not supported by the host kernel" );
This message claims that we have a problem because of the host kernel version, but I can't see where we do the check on the host kernel that lets us avoid the error message when it's new enough ?
thanks
-- PMM
Re: [Qemu-arm] [PATCH v4 3/4] linux-headers: update to pre 4.15-rc0
In reply to Eric AugerQuoted 44 lines · Eric Auger
Update headers against post v4.14 and pre v4.15-rc0.
Signed-off-by Eric Auger <[email protected]>--- include/standard-headers/asm-s390/virtio-ccw.h | 1 + include/standard-headers/asm-x86/hyperv.h | 394 +-------------------- include/standard-headers/linux/input-event-codes.h | 2 + include/standard-headers/linux/input.h | 1 + include/standard-headers/linux/pci_regs.h | 45 ++- linux-headers/asm-arm/kvm.h | 8 + linux-headers/asm-arm/kvm_para.h | 1 + linux-headers/asm-arm/unistd.h | 2 + linux-headers/asm-arm64/kvm.h | 8 + linux-headers/asm-arm64/unistd.h | 1 + linux-headers/asm-powerpc/epapr_hcalls.h | 1 + linux-headers/asm-powerpc/kvm.h | 1 + linux-headers/asm-powerpc/kvm_para.h | 1 + linux-headers/asm-powerpc/unistd.h | 1 + linux-headers/asm-s390/kvm.h | 1 + linux-headers/asm-s390/kvm_para.h | 1 + linux-headers/asm-s390/unistd.h | 4 +- linux-headers/asm-x86/kvm.h | 1 + linux-headers/asm-x86/kvm_para.h | 2 +- linux-headers/asm-x86/unistd.h | 1 + linux-headers/linux/kvm.h | 2 + linux-headers/linux/kvm_para.h | 1 + linux-headers/linux/psci.h | 1 + linux-headers/linux/userfaultfd.h | 1 + linux-headers/linux/vfio.h | 1 + linux-headers/linux/vfio_ccw.h | 1 + linux-headers/linux/vhost.h | 1 +include/standard-headers/asm-x86/hyperv.h +0
-9@@ -1,393 +1 @@ -#ifndef _ASM_X86_HYPERV_H -#define _ASM_X86_HYPERV_H - -#include "standard-headers/linux/types.h" - -/* -* The below CPUID leaves are present if VersionAndFeatures.HypervisorPresent -* is set by CPUID(HvCpuIdFunctionVersionAndFeatures). -*/
include/standard-headers/asm-x86/hyperv.h line 19
Quoted 10 lines
include/standard-headers/asm-x86/hyperv.h +0
-10-#define HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS 0x40000000 -#define HYPERV_CPUID_INTERFACE 0x40000001 -#define HYPERV_CPUID_VERSION 0x40000002 -#define HYPERV_CPUID_FEATURES 0x40000003 -#define HYPERV_CPUID_ENLIGHTMENT_INFO 0x40000004 -#define HYPERV_CPUID_IMPLEMENT_LIMITS 0x40000005 - -#define HYPERV_HYPERVISOR_PRESENT_BIT 0x80000000 -#define HYPERV_CPUID_MIN 0x40000005 -#define HYPERV_CPUID_MAX 0x4000ffff
Did you test building on x86 host? It's hard to see how the code in QEMU that uses these HYPERV #defines will still compile.
thanks
-- PMM
Re: [Qemu-arm] [PATCH v4 2/4] hw/intc/arm_gicv3_its: Implement a minimalist reset
In reply to Peter MaydellHi Peter,
Quoted 44 lines · Peter Maydell
Quoted 43 lines · Eric Auger
At the moment the ITS is not properly reset and this causes various bugs on save/restore. We implement a minimalist reset through individual register writes but for kernel versions before v4.15 this fails voiding the vITS cache. We cannot claim we have a comprehensive reset (hence the error message) but that's better than nothing.
Signed-off-by Eric Auger <[email protected]>---
v2 -> v3:
- individual register writes performed inkvm_arm_its_reset
- checkKVM_DEV_ARM_VGIC_GRP_ITS_REGSsupport--- hw/intc/arm_gicv3_its_kvm.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)hw/intc/arm_gicv3_its_kvm.c +10
-0@@ -28,6 +28,16 @@#define TYPE_KVM_ARM_ITS "arm-its-kvm"#define KVM_ARM_ITS (obj) OBJECT_CHECK(GICv3ITSState, (obj), TYPE_KVM_ARM_ITS) +#define KVM_ARM_ITS_CLASS (klass) \ + OBJECT_CLASS_CHECK(KVMARMITSClass, (klass), TYPE_KVM_ARM_ITS) +#define KVM_ARM_ITS_GET_CLASS (obj) \ + OBJECT_GET_CLASS(KVMARMITSClass, (obj), TYPE_KVM_ARM_ITS) + +typedef struct KVMARMITSClass { +GICv3ITSCommonClass parent_class; +void (*parent_reset)(DeviceState *dev); +}KVMARMITSClass ; +static int kvm_its_send_msi (GICv3ITSState *s,uint32_t value,uint16_t devid) {@@ -186,6 +196,34 @@ static void kvm_arm_its_post_load(GICv3ITSState *s) GITS_CTLR, &s->ctlr, true, &error_abort); }
Quoted 14 lines
hw/intc/arm_gicv3_its_kvm.c static void kvm_arm_its_post_load(GICv3ITSState *s) · line 207
Quoted 9 lines
hw/intc/arm_gicv3_its_kvm.c +9
-0+static void kvm_arm_its_reset (DeviceState *dev) +{ +GICv3ITSState *s =ARM_GICV3_ITS_COMMON (dev); +KVMARMITSClass *c =KVM_ARM_ITS_GET_CLASS (s); +int i; + + c->parent_reset (dev); + +error_report ("ITS KVM: full reset is not supported by the host kernel" );This message claims that we have a problem because of the host kernel version, but I can't see where we do the check on the host kernel that lets us avoid the error message when it's new enough ?
Actually the check is added in 4/4. So in that patch the message may be "full ITS reset is not supported" without mentioning the host kernel.
Thanks
Eric
Quoted 4 lines
thanks
-- PMM
Re: [Qemu-arm] [PATCH v4 4/4] hw/intc/arm_gicv3_its: Implement full reset
In reply to Eric AugerQuoted 30 lines · Eric Auger
Voiding the ITS caches is not supposed to happen via individual register writes. So we introduced a dedicated ITS KVM device ioctl to perform a cold reset of the ITS:
KVM_DEV_ARM_VGIC_GRP_CTRL/KVM_DEV_ARM_ITS_CTRL_RESET. Let's use this latter if the kernel supports it.Signed-off-by Eric Auger <[email protected]>--- hw/intc/arm_gicv3_its_kvm.c | 7 +++++++ 1 file changed, 7 insertions(+)hw/intc/arm_gicv3_its_kvm.c +7
-1@@ -204,6 +204,13 @@ static void kvm_arm_its_reset(DeviceState *dev) c->parent_reset (dev); +if (kvm_device_check_attr (s->dev_fd,KVM_DEV_ARM_VGIC_GRP_CTRL , +KVM_DEV_ARM_ITS_CTRL_RESET )) { +kvm_device_access (s->dev_fd,KVM_DEV_ARM_VGIC_GRP_CTRL , +KVM_DEV_ARM_ITS_CTRL_RESET ,NULL , true, &error_abort); +return ; + } +error_report ("ITS KVM: full reset is not supported by the host kernel" ); if (!kvm_device_check_attr(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS, --
Quoted 1 line
2.5.5
Ah, here's the check that makes the error message correct. If we're applying the whole series at once, no big deal; but if we want to put the earlier patches in 2.11 but not this one we need the error message to be correct for the situation at that release.
thanks
-- PMM
Re: [Qemu-arm] [PATCH v4 1/4] hw/intc/arm_gicv3_its: Don't call post_load on reset
In reply to Eric AugerQuoted 31 lines · Eric Auger
From the very beginning,
post_load()was called from common reset. This is not standard and obliged to discriminate the reset case from the restore case using the iidr value.Let's get rid of that call.
Signed-off-by Eric Auger <[email protected]>--- hw/intc/arm_gicv3_its_common.c | 2 -- hw/intc/arm_gicv3_its_kvm.c | 4 ---- 2 files changed, 6 deletions(-)hw/intc/arm_gicv3_its_common.c +0
-2@@ -131,8 +131,6 @@ static void gicv3_its_common_reset(DeviceState *dev) s->creadr =0 ; s->iidr =0 ;memset (&s->baser,0 ,sizeof (s->baser)); - -gicv3_its_post_load (s,0 ); }static void gicv3_its_common_class_init (ObjectClass *klass,void *data)hw/intc/arm_gicv3_its_kvm.c +0
-0@@ -155,10 +155,6 @@ static void kvm_arm_its_post_load(GICv3ITSState *s) {
hw/intc/arm_gicv3_its_kvm.c static void kvm_arm_its_post_load(GICv3ITSState *s)
Quoted 10 lines
hw/intc/arm_gicv3_its_kvm.c +0
-5int i; -if (!s->iidr) { -return ; - } -kvm_device_access (s->dev_fd,KVM_DEV_ARM_VGIC_GRP_ITS_REGS ,GITS_IIDR , &s->iidr, true, &error_abort); --
thanks
-- PMM
Re: [Qemu-arm] [PATCH v4 3/4] linux-headers: update to pre 4.15-rc0
In reply to Peter MaydellHi Peter,
Quoted 50 lines · Peter Maydell
Quoted 49 lines · Eric Auger
Update headers against post v4.14 and pre v4.15-rc0.
Signed-off-by Eric Auger <[email protected]>--- include/standard-headers/asm-s390/virtio-ccw.h | 1 + include/standard-headers/asm-x86/hyperv.h | 394 +-------------------- include/standard-headers/linux/input-event-codes.h | 2 + include/standard-headers/linux/input.h | 1 + include/standard-headers/linux/pci_regs.h | 45 ++- linux-headers/asm-arm/kvm.h | 8 + linux-headers/asm-arm/kvm_para.h | 1 + linux-headers/asm-arm/unistd.h | 2 + linux-headers/asm-arm64/kvm.h | 8 + linux-headers/asm-arm64/unistd.h | 1 + linux-headers/asm-powerpc/epapr_hcalls.h | 1 + linux-headers/asm-powerpc/kvm.h | 1 + linux-headers/asm-powerpc/kvm_para.h | 1 + linux-headers/asm-powerpc/unistd.h | 1 + linux-headers/asm-s390/kvm.h | 1 + linux-headers/asm-s390/kvm_para.h | 1 + linux-headers/asm-s390/unistd.h | 4 +- linux-headers/asm-x86/kvm.h | 1 + linux-headers/asm-x86/kvm_para.h | 2 +- linux-headers/asm-x86/unistd.h | 1 + linux-headers/linux/kvm.h | 2 + linux-headers/linux/kvm_para.h | 1 + linux-headers/linux/psci.h | 1 + linux-headers/linux/userfaultfd.h | 1 + linux-headers/linux/vfio.h | 1 + linux-headers/linux/vfio_ccw.h | 1 + linux-headers/linux/vhost.h | 1 +include/standard-headers/asm-x86/hyperv.h +0
-14@@ -1,393 +1 @@ -#ifndef _ASM_X86_HYPERV_H -#define _ASM_X86_HYPERV_H - -#include "standard-headers/linux/types.h" - -/* -* The below CPUID leaves are present if VersionAndFeatures.HypervisorPresent -* is set by CPUID(HvCpuIdFunctionVersionAndFeatures). -*/ -#define HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS 0x40000000 -#define HYPERV_CPUID_INTERFACE 0x40000001 -#define HYPERV_CPUID_VERSION 0x40000002 -#define HYPERV_CPUID_FEATURES 0x40000003 -#define HYPERV_CPUID_ENLIGHTMENT_INFO 0x40000004
Quoted 8 lines
include/standard-headers/asm-x86/hyperv.h line 19
Quoted 5 lines
include/standard-headers/asm-x86/hyperv.h +0
-5-#define HYPERV_CPUID_IMPLEMENT_LIMITS 0x40000005 - -#define HYPERV_HYPERVISOR_PRESENT_BIT 0x80000000 -#define HYPERV_CPUID_MIN 0x40000005 -#define HYPERV_CPUID_MAX 0x4000ffffDid you test building on x86 host? It's hard to see how the code in QEMU that uses these HYPERV #defines will still compile.
Just test built with
./configure --target-list="aarch64-softmmu arm-softmmu arm-linux-user x86_64-softmmu i386-softmmu" --enable-kvm --enable-trace-backends=log
and it looks OK.
Thanks
Eric
Quoted 4 lines
thanks
-- PMM