<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/arch/arm64/kvm, branch linus/master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/arch/arm64/kvm?h=linus%2Fmaster</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/arch/arm64/kvm?h=linus%2Fmaster'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/'/>
<updated>2022-06-09T12:24:02Z</updated>
<entry>
<title>KVM: arm64: Remove redundant hyp_assert_lock_held() assertions</title>
<updated>2022-06-09T12:24:02Z</updated>
<author>
<name>Will Deacon</name>
<email>will@kernel.org</email>
</author>
<published>2022-06-09T12:12:22Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=5879c97f37022ff22a3f13174c24fcf2807fdbc0'/>
<id>urn:sha1:5879c97f37022ff22a3f13174c24fcf2807fdbc0</id>
<content type='text'>
host_stage2_try() asserts that the KVM host lock is held, so there's no
need to duplicate the assertion in its wrappers.

Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Link: https://lore.kernel.org/r/20220609121223.2551-6-will@kernel.org
</content>
</entry>
<entry>
<title>KVM: arm64: Ignore 'kvm-arm.mode=protected' when using VHE</title>
<updated>2022-06-09T12:24:02Z</updated>
<author>
<name>Will Deacon</name>
<email>will@kernel.org</email>
</author>
<published>2022-06-09T12:12:20Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=cde5042adf11b0a30a6ce0ec3d071afcf8d2efaf'/>
<id>urn:sha1:cde5042adf11b0a30a6ce0ec3d071afcf8d2efaf</id>
<content type='text'>
Ignore 'kvm-arm.mode=protected' when using VHE so that kvm_get_mode()
only returns KVM_MODE_PROTECTED on systems where the feature is available.

Cc: David Brazdil &lt;dbrazdil@google.com&gt;
Acked-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Link: https://lore.kernel.org/r/20220609121223.2551-4-will@kernel.org
</content>
</entry>
<entry>
<title>KVM: arm64: Handle all ID registers trapped for a protected VM</title>
<updated>2022-06-09T12:24:02Z</updated>
<author>
<name>Marc Zyngier</name>
<email>maz@kernel.org</email>
</author>
<published>2022-06-09T12:12:19Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=fa7a17214488ef7df347dcd1a5594f69ea17f4dc'/>
<id>urn:sha1:fa7a17214488ef7df347dcd1a5594f69ea17f4dc</id>
<content type='text'>
A protected VM accessing ID_AA64ISAR2_EL1 gets punished with an UNDEF,
while it really should only get a zero back if the register is not
handled by the hypervisor emulation (as mandated by the architecture).

Introduce all the missing ID registers (including the unallocated ones),
and have them to return 0.

Reported-by: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Link: https://lore.kernel.org/r/20220609121223.2551-3-will@kernel.org
</content>
</entry>
<entry>
<title>KVM: arm64: Return error from kvm_arch_init_vm() on allocation failure</title>
<updated>2022-06-09T12:24:02Z</updated>
<author>
<name>Will Deacon</name>
<email>will@kernel.org</email>
</author>
<published>2022-06-09T12:12:18Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=ae187fec75aa670a551d9662f83e3947d3f02a69'/>
<id>urn:sha1:ae187fec75aa670a551d9662f83e3947d3f02a69</id>
<content type='text'>
If we fail to allocate the 'supported_cpus' cpumask in kvm_arch_init_vm()
then be sure to return -ENOMEM instead of success (0) on the failure
path.

Reviewed-by: Alexandru Elisei &lt;alexandru.elisei@arm.com&gt;
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Link: https://lore.kernel.org/r/20220609121223.2551-2-will@kernel.org
</content>
</entry>
<entry>
<title>KVM: arm64: Warn if accessing timer pending state outside of vcpu context</title>
<updated>2022-06-08T09:16:23Z</updated>
<author>
<name>Marc Zyngier</name>
<email>maz@kernel.org</email>
</author>
<published>2022-06-07T13:14:27Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=efedd01de475e126e43a07d0b1221bb65e497163'/>
<id>urn:sha1:efedd01de475e126e43a07d0b1221bb65e497163</id>
<content type='text'>
A recurrent bug in the KVM/arm64 code base consists in trying to
access the timer pending state outside of the vcpu context, which
makes zero sense (the pending state only exists when the vcpu
is loaded).

In order to avoid more embarassing crashes and catch the offenders
red-handed, add a warning to kvm_arch_timer_get_input_level() and
return the state as non-pending. This avoids taking the system down,
and still helps tracking down silly bugs.

Reviewed-by: Eric Auger &lt;eric.auger@redhat.com&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Link: https://lore.kernel.org/r/20220607131427.1164881-4-maz@kernel.org
</content>
</entry>
<entry>
<title>KVM: arm64: Replace vgic_v3_uaccess_read_pending with vgic_uaccess_read_pending</title>
<updated>2022-06-08T09:16:15Z</updated>
<author>
<name>Marc Zyngier</name>
<email>maz@kernel.org</email>
</author>
<published>2022-06-07T13:14:26Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=98432ccdec9f178ba041e1e5f9f32dbd71576504'/>
<id>urn:sha1:98432ccdec9f178ba041e1e5f9f32dbd71576504</id>
<content type='text'>
Now that GICv2 has a proper userspace accessor for the pending state,
switch GICv3 over to it, dropping the local version, moving over the
specific behaviours that CGIv3 requires (such as the distinction
between pending latch and line level which were never enforced
with GICv2).

We also gain extra locking that isn't really necessary for userspace,
but that's a small price to pay for getting rid of superfluous code.

Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Reviewed-by: Eric Auger &lt;eric.auger@redhat.com&gt;
Link: https://lore.kernel.org/r/20220607131427.1164881-3-maz@kernel.org
</content>
</entry>
<entry>
<title>KVM: arm64: Don't read a HW interrupt pending state in user context</title>
<updated>2022-06-07T15:28:19Z</updated>
<author>
<name>Marc Zyngier</name>
<email>maz@kernel.org</email>
</author>
<published>2022-06-07T13:14:25Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=2cdea19a34c2340b3aa69508804efe4e3750fcec'/>
<id>urn:sha1:2cdea19a34c2340b3aa69508804efe4e3750fcec</id>
<content type='text'>
Since 5bfa685e62e9 ("KVM: arm64: vgic: Read HW interrupt pending state
from the HW"), we're able to source the pending bit for an interrupt
that is stored either on the physical distributor or on a device.

However, this state is only available when the vcpu is loaded,
and is not intended to be accessed from userspace. Unfortunately,
the GICv2 emulation doesn't provide specific userspace accessors,
and we fallback with the ones that are intended for the guest,
with fatal consequences.

Add a new vgic_uaccess_read_pending() accessor for userspace
to use, build on top of the existing vgic_mmio_read_pending().

Reported-by: Eric Auger &lt;eric.auger@redhat.com&gt;
Reviewed-by: Eric Auger &lt;eric.auger@redhat.com&gt;
Tested-by: Eric Auger &lt;eric.auger@redhat.com&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Fixes: 5bfa685e62e9 ("KVM: arm64: vgic: Read HW interrupt pending state from the HW")
Link: https://lore.kernel.org/r/20220607131427.1164881-2-maz@kernel.org
Cc: stable@vger.kernel.org
</content>
</entry>
<entry>
<title>KVM: arm64: Fix inconsistent indenting</title>
<updated>2022-06-07T14:27:05Z</updated>
<author>
<name>sunliming</name>
<email>sunliming@kylinos.cn</email>
</author>
<published>2022-06-02T02:48:05Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=e3fe65e0d3671ee5ae8a2723e429ee4830a7c89c'/>
<id>urn:sha1:e3fe65e0d3671ee5ae8a2723e429ee4830a7c89c</id>
<content type='text'>
Fix the following smatch warnings:

arch/arm64/kvm/vmid.c:62 flush_context() warn: inconsistent indenting

Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Signed-off-by: sunliming &lt;sunliming@kylinos.cn&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Link: https://lore.kernel.org/r/20220602024805.511457-1-sunliming@kylinos.cn
</content>
</entry>
<entry>
<title>KVM: arm64: Always start with clearing SME flag on load</title>
<updated>2022-06-07T13:31:30Z</updated>
<author>
<name>Marc Zyngier</name>
<email>maz@kernel.org</email>
</author>
<published>2022-05-28T11:38:12Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=039f49c4cafb785504c678f28664d088e0108d35'/>
<id>urn:sha1:039f49c4cafb785504c678f28664d088e0108d35</id>
<content type='text'>
On each vcpu load, we set the KVM_ARM64_HOST_SME_ENABLED
flag if SME is enabled for EL0 on the host. This is used to
restore the correct state on vpcu put.

However, it appears that nothing ever clears this flag. Once
set, it will stick until the vcpu is destroyed, which has the
potential to spuriously enable SME for userspace. As it turns
out, this is due to the SME code being more or less copied from
SVE, and inheriting the same shortcomings.

We never saw the issue because nothing uses SME, and the amount
of testing is probably still pretty low.

Fixes: 861262ab8627 ("KVM: arm64: Handle SME host state when running guests")
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Reviwed-by: Mark Brown &lt;broonie@kernel.org&gt;
Link: https://lore.kernel.org/r/20220528113829.1043361-3-maz@kernel.org
</content>
</entry>
<entry>
<title>KVM: arm64: Always start with clearing SVE flag on load</title>
<updated>2022-06-07T13:19:23Z</updated>
<author>
<name>Marc Zyngier</name>
<email>maz@kernel.org</email>
</author>
<published>2022-05-28T11:38:11Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=d52d165d67c5aa26c8c89909003c94a66492d23d'/>
<id>urn:sha1:d52d165d67c5aa26c8c89909003c94a66492d23d</id>
<content type='text'>
On each vcpu load, we set the KVM_ARM64_HOST_SVE_ENABLED
flag if SVE is enabled for EL0 on the host. This is used to restore
the correct state on vpcu put.

However, it appears that nothing ever clears this flag. Once
set, it will stick until the vcpu is destroyed, which has the
potential to spuriously enable SVE for userspace.

We probably never saw the issue because no VMM uses SVE, but
that's still pretty bad. Unconditionally clearing the flag
on vcpu load addresses the issue.

Fixes: 8383741ab2e7 ("KVM: arm64: Get rid of host SVE tracking/saving")
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Cc: stable@vger.kernel.org
Reviewed-by: Mark Brown &lt;broonie@kernel.org&gt;
Link: https://lore.kernel.org/r/20220528113829.1043361-2-maz@kernel.org
</content>
</entry>
</feed>
