<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/arch/arm64/kvm/hyp/include/nvhe, branch linux-6.2.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.2.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.2.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2023-04-20T10:36:54Z</updated>
<entry>
<title>KVM: arm64: Advertise ID_AA64PFR0_EL1.CSV2/3 to protected VMs</title>
<updated>2023-04-20T10:36:54Z</updated>
<author>
<name>Fuad Tabba</name>
<email>tabba@google.com</email>
</author>
<published>2023-04-04T15:23:21Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=6e83bde56955511c168e6a7bc05efac832de2e1c'/>
<id>urn:sha1:6e83bde56955511c168e6a7bc05efac832de2e1c</id>
<content type='text'>
[ Upstream commit e81625218bf7986ba1351a98c43d346b15601d26 ]

The existing pKVM code attempts to advertise CSV2/3 using values
initialized to 0, but never set. To advertise CSV2/3 to protected
guests, pass the CSV2/3 values to hyp when initializing hyp's
view of guests' ID_AA64PFR0_EL1.

Similar to non-protected KVM, these are system-wide, rather than
per cpu, for simplicity.

Fixes: 6c30bfb18d0b ("KVM: arm64: Add handlers for protected VM System Registers")
Signed-off-by: Fuad Tabba &lt;tabba@google.com&gt;
Link: https://lore.kernel.org/r/20230404152321.413064-1-tabba@google.com
Signed-off-by: Oliver Upton &lt;oliver.upton@linux.dev&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>KVM: arm64: Use the pKVM hyp vCPU structure in handle___kvm_vcpu_run()</title>
<updated>2022-11-11T17:19:35Z</updated>
<author>
<name>Will Deacon</name>
<email>will@kernel.org</email>
</author>
<published>2022-11-10T19:02:59Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=be66e67f175096f283c9d5614c4991fc9e7ed975'/>
<id>urn:sha1:be66e67f175096f283c9d5614c4991fc9e7ed975</id>
<content type='text'>
As a stepping stone towards deprivileging the host's access to the
guest's vCPU structures, introduce some naive flush/sync routines to
copy most of the host vCPU into the hyp vCPU on vCPU run and back
again on return to EL1.

This allows us to run using the pKVM hyp structures when KVM is
initialised in protected mode.

Tested-by: Vincent Donnefort &lt;vdonnefort@google.com&gt;
Co-developed-by: Fuad Tabba &lt;tabba@google.com&gt;
Signed-off-by: Fuad Tabba &lt;tabba@google.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/20221110190259.26861-27-will@kernel.org
</content>
</entry>
<entry>
<title>KVM: arm64: Return guest memory from EL2 via dedicated teardown memcache</title>
<updated>2022-11-11T17:18:58Z</updated>
<author>
<name>Quentin Perret</name>
<email>qperret@google.com</email>
</author>
<published>2022-11-10T19:02:53Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=f41dff4efb918db68923a826e966ca62c7c8e929'/>
<id>urn:sha1:f41dff4efb918db68923a826e966ca62c7c8e929</id>
<content type='text'>
Rather than relying on the host to free the previously-donated pKVM
hypervisor VM pages explicitly on teardown, introduce a dedicated
teardown memcache which allows the host to reclaim guest memory
resources without having to keep track of all of the allocations made by
the pKVM hypervisor at EL2.

Tested-by: Vincent Donnefort &lt;vdonnefort@google.com&gt;
Co-developed-by: Fuad Tabba &lt;tabba@google.com&gt;
Signed-off-by: Fuad Tabba &lt;tabba@google.com&gt;
Signed-off-by: Quentin Perret &lt;qperret@google.com&gt;
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
[maz: dropped __maybe_unused from unmap_donated_memory_noclear()]
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Link: https://lore.kernel.org/r/20221110190259.26861-21-will@kernel.org
</content>
</entry>
<entry>
<title>KVM: arm64: Instantiate guest stage-2 page-tables at EL2</title>
<updated>2022-11-11T17:16:25Z</updated>
<author>
<name>Quentin Perret</name>
<email>qperret@google.com</email>
</author>
<published>2022-11-10T19:02:52Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=60dfe093ec13b056856c672e1daa35134be38283'/>
<id>urn:sha1:60dfe093ec13b056856c672e1daa35134be38283</id>
<content type='text'>
Extend the initialisation of guest data structures within the pKVM
hypervisor at EL2 so that we instantiate a memory pool and a full
'struct kvm_s2_mmu' structure for each VM, with a stage-2 page-table
entirely independent from the one managed by the host at EL1.

The 'struct kvm_pgtable_mm_ops' used by the page-table code is populated
with a set of callbacks that can manage guest pages in the hypervisor
without any direct intervention from the host, allocating page-table
pages from the provided pool and returning these to the host on VM
teardown. To keep things simple, the stage-2 MMU for the guest is
configured identically to the host stage-2 in the VTCR register and so
the IPA size of the guest must match the PA size of the host.

For now, the new page-table is unused as there is no way for the host
to map anything into it. Yet.

Tested-by: Vincent Donnefort &lt;vdonnefort@google.com&gt;
Signed-off-by: Quentin Perret &lt;qperret@google.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/20221110190259.26861-20-will@kernel.org
</content>
</entry>
<entry>
<title>KVM: arm64: Add generic hyp_memcache helpers</title>
<updated>2022-11-11T17:16:25Z</updated>
<author>
<name>Quentin Perret</name>
<email>qperret@google.com</email>
</author>
<published>2022-11-10T19:02:50Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=717a7eebac106a5cc5d5493f8eef9cf4ae6edf19'/>
<id>urn:sha1:717a7eebac106a5cc5d5493f8eef9cf4ae6edf19</id>
<content type='text'>
The host at EL1 and the pKVM hypervisor at EL2 will soon need to
exchange memory pages dynamically for creating and destroying VM state.

Indeed, the hypervisor will rely on the host to donate memory pages it
can use to create guest stage-2 page-tables and to store VM and vCPU
metadata. In order to ease this process, introduce a
'struct hyp_memcache' which is essentially a linked list of available
pages, indexed by physical addresses so that it can be passed
meaningfully between the different virtual address spaces configured at
EL1 and EL2.

Tested-by: Vincent Donnefort &lt;vdonnefort@google.com&gt;
Signed-off-by: Quentin Perret &lt;qperret@google.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/20221110190259.26861-18-will@kernel.org
</content>
</entry>
<entry>
<title>KVM: arm64: Add per-cpu fixmap infrastructure at EL2</title>
<updated>2022-11-11T17:16:25Z</updated>
<author>
<name>Quentin Perret</name>
<email>qperret@google.com</email>
</author>
<published>2022-11-10T19:02:47Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=aa6948f82f0b7060fbbac21911dc7996b144ba3c'/>
<id>urn:sha1:aa6948f82f0b7060fbbac21911dc7996b144ba3c</id>
<content type='text'>
Mapping pages in a guest page-table from within the pKVM hypervisor at
EL2 may require cache maintenance to ensure that the initialised page
contents is visible even to non-cacheable (e.g. MMU-off) accesses from
the guest.

In preparation for performing this maintenance at EL2, introduce a
per-vCPU fixmap which allows the pKVM hypervisor to map guest pages
temporarily into its stage-1 page-table for the purposes of cache
maintenance and, in future, poisoning on the reclaim path. The use of a
fixmap avoids the need for memory allocation or locking on the map()
path.

Tested-by: Vincent Donnefort &lt;vdonnefort@google.com&gt;
Signed-off-by: Quentin Perret &lt;qperret@google.com&gt;
Co-developed-by: Will Deacon &lt;will@kernel.org&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/20221110190259.26861-15-will@kernel.org
</content>
</entry>
<entry>
<title>KVM: arm64: Add infrastructure to create and track pKVM instances at EL2</title>
<updated>2022-11-11T17:16:05Z</updated>
<author>
<name>Fuad Tabba</name>
<email>tabba@google.com</email>
</author>
<published>2022-11-10T19:02:45Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=a1ec5c70d3f63d8a143fb83cd7f53bd8ff2f72c8'/>
<id>urn:sha1:a1ec5c70d3f63d8a143fb83cd7f53bd8ff2f72c8</id>
<content type='text'>
Introduce a global table (and lock) to track pKVM instances at EL2, and
provide hypercalls that can be used by the untrusted host to create and
destroy pKVM VMs and their vCPUs. pKVM VM/vCPU state is directly
accessible only by the trusted hypervisor (EL2).

Each pKVM VM is directly associated with an untrusted host KVM instance,
and is referenced by the host using an opaque handle. Future patches
will provide hypercalls to allow the host to initialize/set/get pKVM
VM/vCPU state using the opaque handle.

Tested-by: Vincent Donnefort &lt;vdonnefort@google.com&gt;
Signed-off-by: Fuad Tabba &lt;tabba@google.com&gt;
Co-developed-by: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
[maz: silence warning on unmap_donated_memory_noclear()]
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Link: https://lore.kernel.org/r/20221110190259.26861-13-will@kernel.org
</content>
</entry>
<entry>
<title>KVM: arm64: Rename 'host_kvm' to 'host_mmu'</title>
<updated>2022-11-11T16:40:54Z</updated>
<author>
<name>Will Deacon</name>
<email>will@kernel.org</email>
</author>
<published>2022-11-10T19:02:44Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=5304002dc3754a5663d75c977bfa2d9e3c08906d'/>
<id>urn:sha1:5304002dc3754a5663d75c977bfa2d9e3c08906d</id>
<content type='text'>
In preparation for introducing VM and vCPU state at EL2, rename the
existing 'struct host_kvm' and its singleton 'host_kvm' instance to
'host_mmu' so as to avoid confusion between the structure tracking the
host stage-2 MMU state and the host instance of a 'struct kvm' for a
protected guest.

Reviewed-by: Philippe Mathieu-Daudé &lt;philmd@linaro.org&gt;
Tested-by: Vincent Donnefort &lt;vdonnefort@google.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/20221110190259.26861-12-will@kernel.org
</content>
</entry>
<entry>
<title>KVM: arm64: Add hyp_spinlock_t static initializer</title>
<updated>2022-11-11T16:40:54Z</updated>
<author>
<name>Fuad Tabba</name>
<email>tabba@google.com</email>
</author>
<published>2022-11-10T19:02:43Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=1c80002e3264552d8b9c0e162e09aa4087403716'/>
<id>urn:sha1:1c80002e3264552d8b9c0e162e09aa4087403716</id>
<content type='text'>
Introduce a static initializer macro for 'hyp_spinlock_t' so that it is
straightforward to instantiate global locks at EL2. This will be later
utilised for locking the VM table in the hypervisor.

Reviewed-by: Philippe Mathieu-Daudé &lt;philmd@linaro.org&gt;
Tested-by: Vincent Donnefort &lt;vdonnefort@google.com&gt;
Signed-off-by: Fuad Tabba &lt;tabba@google.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/20221110190259.26861-11-will@kernel.org
</content>
</entry>
<entry>
<title>KVM: arm64: Include asm/kvm_mmu.h in nvhe/mem_protect.h</title>
<updated>2022-11-11T16:40:54Z</updated>
<author>
<name>Will Deacon</name>
<email>will@kernel.org</email>
</author>
<published>2022-11-10T19:02:42Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=4d968b12e6bbe4440f4f220c41d779e02df8af1a'/>
<id>urn:sha1:4d968b12e6bbe4440f4f220c41d779e02df8af1a</id>
<content type='text'>
nvhe/mem_protect.h refers to __load_stage2() in the definition of
__load_host_stage2() but doesn't include the relevant header.

Include asm/kvm_mmu.h in nvhe/mem_protect.h so that users of the latter
don't have to do this themselves.

Reviewed-by: Philippe Mathieu-Daudé &lt;philmd@linaro.org&gt;
Tested-by: Vincent Donnefort &lt;vdonnefort@google.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/20221110190259.26861-10-will@kernel.org
</content>
</entry>
</feed>
