Skip to content

Commit ae204f8

Browse files
eaugerchazy
authored andcommitted
KVM: arm/arm64: Document KVM_DEV_ARM_ITS_CTRL_RESET
At the moment, the in-kernel emulated ITS is not properly reset. On guest restart/reset some registers keep their old values and internal structures like device, ITE, and collection lists are not freed. This may lead to various bugs. Among them, we can have incorrect state backup or failure when saving the ITS state at early guest boot stage. This patch documents a new attribute, KVM_DEV_ARM_ITS_CTRL_RESET in the KVM_DEV_ARM_VGIC_GRP_CTRL group. Upon this action, we can reset registers and especially those pointing to tables previously allocated by the guest and free the internal data structures storing the list of devices, collections and lpis. The usual approach for device reset of having userspace write the reset values of the registers to the kernel via the register read/write APIs doesn't work for the ITS because it has some internal state (caches) which is not exposed as registers, and there is no register interface for "drop cached data without writing it back to RAM". So we need a KVM API which mimics the hardware's reset line, to provide the equivalent behaviour to a "pull the power cord out of the back of the machine" reset. Reviewed-by: Christoffer Dall <[email protected]> Reviewed-by: Marc Zyngier <[email protected]> Signed-off-by: Eric Auger <[email protected]> Reported-by: wanghaibin <[email protected]> Signed-off-by: Christoffer Dall <[email protected]>
1 parent 36d6961 commit ae204f8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Documentation/virtual/kvm/devices/arm-vgic-its.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ Groups:
3333
request the initialization of the ITS, no additional parameter in
3434
kvm_device_attr.addr.
3535

36+
KVM_DEV_ARM_ITS_CTRL_RESET
37+
reset the ITS, no additional parameter in kvm_device_attr.addr.
38+
See "ITS Reset State" section.
39+
3640
KVM_DEV_ARM_ITS_SAVE_TABLES
3741
save the ITS table data into guest RAM, at the location provisioned
3842
by the guest in corresponding registers/table entries.
@@ -157,3 +161,19 @@ Then vcpus can be started.
157161
- pINTID is the physical LPI ID; if zero, it means the entry is not valid
158162
and other fields are not meaningful.
159163
- ICID is the collection ID
164+
165+
ITS Reset State:
166+
----------------
167+
168+
RESET returns the ITS to the same state that it was when first created and
169+
initialized. When the RESET command returns, the following things are
170+
guaranteed:
171+
172+
- The ITS is not enabled and quiescent
173+
GITS_CTLR.Enabled = 0 .Quiescent=1
174+
- There is no internally cached state
175+
- No collection or device table are used
176+
GITS_BASER<n>.Valid = 0
177+
- GITS_CBASER = 0, GITS_CREADR = 0, GITS_CWRITER = 0
178+
- The ABI version is unchanged and remains the one set when the ITS
179+
device was first created.

0 commit comments

Comments
 (0)