<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/arm64/kvm/hyp/include, branch linux-5.13.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.13.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.13.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2021-05-15T09:27:59Z</updated>
<entry>
<title>KVM: arm64: Move __adjust_pc out of line</title>
<updated>2021-05-15T09:27:59Z</updated>
<author>
<name>Marc Zyngier</name>
</author>
<published>2021-05-06T13:31:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f5e30680616ab09e690b153b7a68ff7dd13e6579'/>
<id>urn:sha1:f5e30680616ab09e690b153b7a68ff7dd13e6579</id>
<content type='text'>
In order to make it easy to call __adjust_pc() from the EL1 code
(in the case of nVHE), rename it to __kvm_adjust_pc() and move
it out of line.

No expected functional change.

Reviewed-by: Alexandru Elisei &lt;alexandru.elisei@arm.com&gt;
Reviewed-by: Zenghui Yu &lt;yuzenghui@huawei.com&gt;
Tested-by: Zenghui Yu &lt;yuzenghui@huawei.com&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Cc: stable@vger.kernel.org # 5.11
</content>
</entry>
<entry>
<title>Merge branch 'kvm-arm64/nvhe-panic-info' into kvmarm-master/next</title>
<updated>2021-04-13T14:38:03Z</updated>
<author>
<name>Marc Zyngier</name>
</author>
<published>2021-04-13T14:38:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5c92a7643b14a5bc93bac6e2af5f9010e284b584'/>
<id>urn:sha1:5c92a7643b14a5bc93bac6e2af5f9010e284b584</id>
<content type='text'>
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
</content>
</entry>
<entry>
<title>KVM: arm64: Log source when panicking from nVHE hyp</title>
<updated>2021-04-01T08:54:37Z</updated>
<author>
<name>Andrew Scull</name>
</author>
<published>2021-03-18T14:33:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=aec0fae62e47050019474936248a311a0ab08705'/>
<id>urn:sha1:aec0fae62e47050019474936248a311a0ab08705</id>
<content type='text'>
To aid with debugging, add details of the source of a panic from nVHE
hyp. This is done by having nVHE hyp exit to nvhe_hyp_panic_handler()
rather than directly to panic(). The handler will then add the extra
details for debugging before panicking the kernel.

If the panic was due to a BUG(), look up the metadata to log the file
and line, if available, otherwise log an address that can be looked up
in vmlinux. The hyp offset is also logged to allow other hyp VAs to be
converted, similar to how the kernel offset is logged during a panic.

__hyp_panic_string is now inlined since it no longer needs to be
referenced as a symbol and the message is free to diverge between VHE
and nVHE.

The following is an example of the logs generated by a BUG in nVHE hyp.

[   46.754840] kvm [307]: nVHE hyp BUG at: arch/arm64/kvm/hyp/nvhe/switch.c:242!
[   46.755357] kvm [307]: Hyp Offset: 0xfffea6c58e1e0000
[   46.755824] Kernel panic - not syncing: HYP panic:
[   46.755824] PS:400003c9 PC:0000d93a82c705ac ESR:f2000800
[   46.755824] FAR:0000000080080000 HPFAR:0000000000800800 PAR:0000000000000000
[   46.755824] VCPU:0000d93a880d0000
[   46.756960] CPU: 3 PID: 307 Comm: kvm-vcpu-0 Not tainted 5.12.0-rc3-00005-gc572b99cf65b-dirty #133
[   46.757459] Hardware name: QEMU QEMU Virtual Machine, BIOS 0.0.0 02/06/2015
[   46.758366] Call trace:
[   46.758601]  dump_backtrace+0x0/0x1b0
[   46.758856]  show_stack+0x18/0x70
[   46.759057]  dump_stack+0xd0/0x12c
[   46.759236]  panic+0x16c/0x334
[   46.759426]  arm64_kernel_unmapped_at_el0+0x0/0x30
[   46.759661]  kvm_arch_vcpu_ioctl_run+0x134/0x750
[   46.759936]  kvm_vcpu_ioctl+0x2f0/0x970
[   46.760156]  __arm64_sys_ioctl+0xa8/0xec
[   46.760379]  el0_svc_common.constprop.0+0x60/0x120
[   46.760627]  do_el0_svc+0x24/0x90
[   46.760766]  el0_svc+0x2c/0x54
[   46.760915]  el0_sync_handler+0x1a4/0x1b0
[   46.761146]  el0_sync+0x170/0x180
[   46.761889] SMP: stopping secondary CPUs
[   46.762786] Kernel Offset: 0x3e1cd2820000 from 0xffff800010000000
[   46.763142] PHYS_OFFSET: 0xffffa9f680000000
[   46.763359] CPU features: 0x00240022,61806008
[   46.763651] Memory Limit: none
[   46.813867] ---[ end Kernel panic - not syncing: HYP panic:
[   46.813867] PS:400003c9 PC:0000d93a82c705ac ESR:f2000800
[   46.813867] FAR:0000000080080000 HPFAR:0000000000800800 PAR:0000000000000000
[   46.813867] VCPU:0000d93a880d0000 ]---

Signed-off-by: Andrew Scull &lt;ascull@google.com&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Link: https://lore.kernel.org/r/20210318143311.839894-6-ascull@google.com
</content>
</entry>
<entry>
<title>KVM: arm64: Protect the .hyp sections from the host</title>
<updated>2021-03-19T12:02:19Z</updated>
<author>
<name>Quentin Perret</name>
</author>
<published>2021-03-19T10:01:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=90134ac9cabb69972d0a509bf08e108a73442184'/>
<id>urn:sha1:90134ac9cabb69972d0a509bf08e108a73442184</id>
<content type='text'>
When KVM runs in nVHE protected mode, use the host stage 2 to unmap the
hypervisor sections by marking them as owned by the hypervisor itself.
The long-term goal is to ensure the EL2 code can remain robust
regardless of the host's state, so this starts by making sure the host
cannot e.g. write to the .hyp sections directly.

Acked-by: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Quentin Perret &lt;qperret@google.com&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Link: https://lore.kernel.org/r/20210319100146.1149909-39-qperret@google.com
</content>
</entry>
<entry>
<title>KVM: arm64: Wrap the host with a stage 2</title>
<updated>2021-03-19T12:02:18Z</updated>
<author>
<name>Quentin Perret</name>
</author>
<published>2021-03-19T10:01:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1025c8c0c6accfcbdc8f52ca1940160f65cd87d6'/>
<id>urn:sha1:1025c8c0c6accfcbdc8f52ca1940160f65cd87d6</id>
<content type='text'>
When KVM runs in protected nVHE mode, make use of a stage 2 page-table
to give the hypervisor some control over the host memory accesses. The
host stage 2 is created lazily using large block mappings if possible,
and will default to page mappings in absence of a better solution.

&gt;From this point on, memory accesses from the host to protected memory
regions (e.g. not 'owned' by the host) are fatal and lead to hyp_panic().

Acked-by: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Quentin Perret &lt;qperret@google.com&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Link: https://lore.kernel.org/r/20210319100146.1149909-36-qperret@google.com
</content>
</entry>
<entry>
<title>KVM: arm64: Reserve memory for host stage 2</title>
<updated>2021-03-19T12:01:22Z</updated>
<author>
<name>Quentin Perret</name>
</author>
<published>2021-03-19T10:01:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=04e5de03093f669ccc233e56b7838bfa7a7af6e1'/>
<id>urn:sha1:04e5de03093f669ccc233e56b7838bfa7a7af6e1</id>
<content type='text'>
Extend the memory pool allocated for the hypervisor to include enough
pages to map all of memory at page granularity for the host stage 2.
While at it, also reserve some memory for device mappings.

Acked-by: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Quentin Perret &lt;qperret@google.com&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Link: https://lore.kernel.org/r/20210319100146.1149909-27-qperret@google.com
</content>
</entry>
<entry>
<title>KVM: arm64: Refactor __populate_fault_info()</title>
<updated>2021-03-19T12:01:21Z</updated>
<author>
<name>Quentin Perret</name>
</author>
<published>2021-03-19T10:01:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=159b859beed76836a2c7cfa6303c312a40bb9dc7'/>
<id>urn:sha1:159b859beed76836a2c7cfa6303c312a40bb9dc7</id>
<content type='text'>
Refactor __populate_fault_info() to introduce __get_fault_info() which
will be used once the host is wrapped in a stage 2.

Acked-by: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Quentin Perret &lt;qperret@google.com&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Link: https://lore.kernel.org/r/20210319100146.1149909-25-qperret@google.com
</content>
</entry>
<entry>
<title>KVM: arm64: Prepare the creation of s1 mappings at EL2</title>
<updated>2021-03-19T12:01:21Z</updated>
<author>
<name>Quentin Perret</name>
</author>
<published>2021-03-19T10:01:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f320bc742bc23c1d43567712fe2814bf04b19ebc'/>
<id>urn:sha1:f320bc742bc23c1d43567712fe2814bf04b19ebc</id>
<content type='text'>
When memory protection is enabled, the EL2 code needs the ability to
create and manage its own page-table. To do so, introduce a new set of
hypercalls to bootstrap a memory management system at EL2.

This leads to the following boot flow in nVHE Protected mode:

 1. the host allocates memory for the hypervisor very early on, using
    the memblock API;

 2. the host creates a set of stage 1 page-table for EL2, installs the
    EL2 vectors, and issues the __pkvm_init hypercall;

 3. during __pkvm_init, the hypervisor re-creates its stage 1 page-table
    and stores it in the memory pool provided by the host;

 4. the hypervisor then extends its stage 1 mappings to include a
    vmemmap in the EL2 VA space, hence allowing to use the buddy
    allocator introduced in a previous patch;

 5. the hypervisor jumps back in the idmap page, switches from the
    host-provided page-table to the new one, and wraps up its
    initialization by enabling the new allocator, before returning to
    the host.

 6. the host can free the now unused page-table created for EL2, and
    will now need to issue hypercalls to make changes to the EL2 stage 1
    mappings instead of modifying them directly.

Note that for the sake of simplifying the review, this patch focuses on
the hypervisor side of things. In other words, this only implements the
new hypercalls, but does not make use of them from the host yet. The
host-side changes will follow in a subsequent patch.

Credits to Will for __pkvm_init_switch_pgd.

Acked-by: Will Deacon &lt;will@kernel.org&gt;
Co-authored-by: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Quentin Perret &lt;qperret@google.com&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Link: https://lore.kernel.org/r/20210319100146.1149909-18-qperret@google.com
</content>
</entry>
<entry>
<title>KVM: arm64: Introduce a Hyp buddy page allocator</title>
<updated>2021-03-19T12:01:20Z</updated>
<author>
<name>Quentin Perret</name>
</author>
<published>2021-03-19T10:01:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8e17c66249e9ea08b44879c7af0315e70a83316c'/>
<id>urn:sha1:8e17c66249e9ea08b44879c7af0315e70a83316c</id>
<content type='text'>
When memory protection is enabled, the hyp code will require a basic
form of memory management in order to allocate and free memory pages at
EL2. This is needed for various use-cases, including the creation of hyp
mappings or the allocation of stage 2 page tables.

To address these use-case, introduce a simple memory allocator in the
hyp code. The allocator is designed as a conventional 'buddy allocator',
working with a page granularity. It allows to allocate and free
physically contiguous pages from memory 'pools', with a guaranteed order
alignment in the PA space. Each page in a memory pool is associated
with a struct hyp_page which holds the page's metadata, including its
refcount, as well as its current order, hence mimicking the kernel's
buddy system in the GFP infrastructure. The hyp_page metadata are made
accessible through a hyp_vmemmap, following the concept of
SPARSE_VMEMMAP in the kernel.

Acked-by: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Quentin Perret &lt;qperret@google.com&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Link: https://lore.kernel.org/r/20210319100146.1149909-13-qperret@google.com
</content>
</entry>
<entry>
<title>KVM: arm64: Introduce an early Hyp page allocator</title>
<updated>2021-03-19T12:01:20Z</updated>
<author>
<name>Quentin Perret</name>
</author>
<published>2021-03-19T10:01:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e759604087231c672f91564cc805336e70d333a0'/>
<id>urn:sha1:e759604087231c672f91564cc805336e70d333a0</id>
<content type='text'>
With nVHE, the host currently creates all stage 1 hypervisor mappings at
EL1 during boot, installs them at EL2, and extends them as required
(e.g. when creating a new VM). But in a world where the host is no
longer trusted, it cannot have full control over the code mapped in the
hypervisor.

In preparation for enabling the hypervisor to create its own stage 1
mappings during boot, introduce an early page allocator, with minimal
functionality. This allocator is designed to be used only during early
bootstrap of the hyp code when memory protection is enabled, which will
then switch to using a full-fledged page allocator after init.

Acked-by: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Quentin Perret &lt;qperret@google.com&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Link: https://lore.kernel.org/r/20210319100146.1149909-11-qperret@google.com
</content>
</entry>
</feed>
