<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/arch/arm64/include/asm/virt.h, branch linus/master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/arch/arm64/include/asm/virt.h?h=linus%2Fmaster</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/arch/arm64/include/asm/virt.h?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: Extend comment in has_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:21Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=112f3bab41113dc53b4f35e9034b2208245bc002'/>
<id>urn:sha1:112f3bab41113dc53b4f35e9034b2208245bc002</id>
<content type='text'>
has_vhe() expands to a compile-time constant when evaluated from the VHE
or nVHE code, alternatively checking a static key when called from
elsewhere in the kernel. On face value, this looks like a case of
premature optimization, but in fact this allows symbol references on
VHE-specific code paths to be dropped from the nVHE object.

Expand the comment in has_vhe() to make this clearer, hopefully
discouraging anybody from simplifying the code.

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-5-will@kernel.org
</content>
</entry>
<entry>
<title>arm64: trans_pgd: hibernate: Add trans_pgd_copy_el2_vectors</title>
<updated>2021-10-01T12:30:59Z</updated>
<author>
<name>Pasha Tatashin</name>
<email>pasha.tatashin@soleen.com</email>
</author>
<published>2021-09-30T14:31:00Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=788bfdd97434982b6d575062581e8e72eea755af'/>
<id>urn:sha1:788bfdd97434982b6d575062581e8e72eea755af</id>
<content type='text'>
Users of trans_pgd may also need a copy of vector table because it is
also may be overwritten if a linear map can be overwritten.

Move setup of EL2 vectors from hibernate to trans_pgd, so it can be
later shared with kexec as well.

Signed-off-by: Pasha Tatashin &lt;pasha.tatashin@soleen.com&gt;
Acked-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Link: https://lore.kernel.org/r/20210930143113.1502553-3-pasha.tatashin@soleen.com
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
</content>
</entry>
<entry>
<title>arm64: kernel: add helper for booted at EL2 and not VHE</title>
<updated>2021-10-01T12:30:59Z</updated>
<author>
<name>Pasha Tatashin</name>
<email>pasha.tatashin@soleen.com</email>
</author>
<published>2021-09-30T14:30:59Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=094a3684b9b67758ccedf0e6068d90f22f2942d9'/>
<id>urn:sha1:094a3684b9b67758ccedf0e6068d90f22f2942d9</id>
<content type='text'>
Replace places that contain logic like this:
	is_hyp_mode_available() &amp;&amp; !is_kernel_in_hyp_mode()

With a dedicated boolean function  is_hyp_nvhe(). This will be needed
later in kexec in order to sooner switch back to EL2.

Suggested-by: James Morse &lt;james.morse@arm.com&gt;
Signed-off-by: Pasha Tatashin &lt;pasha.tatashin@soleen.com&gt;
Acked-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Link: https://lore.kernel.org/r/20210930143113.1502553-2-pasha.tatashin@soleen.com
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
</content>
</entry>
<entry>
<title>arm64: Provide an 'upgrade to VHE' stub hypercall</title>
<updated>2021-02-08T12:51:26Z</updated>
<author>
<name>Marc Zyngier</name>
<email>maz@kernel.org</email>
</author>
<published>2021-02-08T09:57:13Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=f359182291c757cdf77bcd014c025d1ed6b87662'/>
<id>urn:sha1:f359182291c757cdf77bcd014c025d1ed6b87662</id>
<content type='text'>
As we are about to change the way a VHE system boots, let's
provide the core helper, in the form of a stub hypercall that
enables VHE and replicates the full EL1 context at EL2, thanks
to EL1 and VHE-EL2 being extremely similar.

On exception return, the kernel carries on at EL2. Fancy!

Nothing calls this new hypercall yet, so no functional change.

Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Acked-by: David Brazdil &lt;dbrazdil@google.com&gt;
Acked-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Link: https://lore.kernel.org/r/20210208095732.3267263-5-maz@kernel.org
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
</content>
</entry>
<entry>
<title>KVM: arm64: Fix EL2 mode availability checks</title>
<updated>2020-12-04T10:08:36Z</updated>
<author>
<name>David Brazdil</name>
<email>dbrazdil@google.com</email>
</author>
<published>2020-12-02T18:41:22Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=f19f6644a5433cfae8a068445b149bc2247c1445'/>
<id>urn:sha1:f19f6644a5433cfae8a068445b149bc2247c1445</id>
<content type='text'>
With protected nVHE hyp code interception host's PSCI SMCs, the host
starts seeing new CPUs boot in EL1 instead of EL2. The kernel logic
that keeps track of the boot mode needs to be adjusted.

Add a static key enabled if KVM protected mode initialization is
successful.

When the key is enabled, is_hyp_mode_available continues to report
`true` because its users either treat it as a check whether KVM will be
/ was initialized, or whether stub HVCs can be made (eg. hibernate).

is_hyp_mode_mismatched is changed to report `false` when the key is
enabled. That's because all cores' modes matched at the point of KVM
init and KVM will not allow cores not present at init to boot. That
said, the function is never used after KVM is initialized.

Signed-off-by: David Brazdil &lt;dbrazdil@google.com&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Link: https://lore.kernel.org/r/20201202184122.26046-27-dbrazdil@google.com
</content>
</entry>
<entry>
<title>KVM: arm64: Add ARM64_KVM_PROTECTED_MODE CPU capability</title>
<updated>2020-12-04T08:44:19Z</updated>
<author>
<name>David Brazdil</name>
<email>dbrazdil@google.com</email>
</author>
<published>2020-12-02T18:40:58Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=3eb681fba2bf8b67b65ce92d0ebfd7cbfc263da9'/>
<id>urn:sha1:3eb681fba2bf8b67b65ce92d0ebfd7cbfc263da9</id>
<content type='text'>
Expose the boolean value whether the system is running with KVM in
protected mode (nVHE + kernel param). CPU capability was selected over
a global variable to allow use in alternatives.

Signed-off-by: David Brazdil &lt;dbrazdil@google.com&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Link: https://lore.kernel.org/r/20201202184122.26046-3-dbrazdil@google.com
</content>
</entry>
<entry>
<title>arm64: cpufeature: upgrade hyp caps to final</title>
<updated>2020-10-30T08:53:10Z</updated>
<author>
<name>Mark Rutland</name>
<email>mark.rutland@arm.com</email>
</author>
<published>2020-10-26T13:49:31Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=d86de40decaa14e6613af1b2783bf4d589d0f38b'/>
<id>urn:sha1:d86de40decaa14e6613af1b2783bf4d589d0f38b</id>
<content type='text'>
We finalize caps before initializing kvm hyp code, and any use of
cpus_have_const_cap() in kvm hyp code generates redundant and
potentially unsound code to read the cpu_hwcaps array.

A number of helper functions used in both hyp context and regular kernel
context use cpus_have_const_cap(), as some regular kernel code runs
before the capabilities are finalized. It's tedious and error-prone to
write separate copies of these for hyp and non-hyp code.

So that we can avoid the redundant code, let's automatically upgrade
cpus_have_const_cap() to cpus_have_final_cap() when used in hyp context.
With this change, there's never a reason to access to cpu_hwcaps array
from hyp code, and we don't need to create an NVHE alias for this.

This should have no effect on non-hyp code.

Signed-off-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Acked-by: Will Deacon &lt;will@kernel.org&gt;
Cc: David Brazdil &lt;dbrazdil@google.com&gt;
Cc: Marc Zyngier &lt;maz@kernel.org&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Link: https://lore.kernel.org/r/20201026134931.28246-4-mark.rutland@arm.com
</content>
</entry>
<entry>
<title>KVM: arm64: Factor out is_{vhe,nvhe}_hyp_code()</title>
<updated>2020-10-30T08:52:51Z</updated>
<author>
<name>Mark Rutland</name>
<email>mark.rutland@arm.com</email>
</author>
<published>2020-10-26T13:49:29Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=e9a33caec90e05673e2f7fb7c80f172031964d25'/>
<id>urn:sha1:e9a33caec90e05673e2f7fb7c80f172031964d25</id>
<content type='text'>
Currently has_vhe() detects whether it is being compiled for VHE/NVHE
hyp code based on preprocessor definitions, and uses this knowledge to
avoid redundant runtime checks.

There are other cases where we'd like to use this knowledge, so let's
factor the preprocessor checks out into separate helpers.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Acked-by: Will Deacon &lt;will@kernel.org&gt;
Cc: David Brazdil &lt;dbrazdil@google.com&gt;
Cc: Marc Zyngier &lt;maz@kernel.org&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Link: https://lore.kernel.org/r/20201026134931.28246-2-mark.rutland@arm.com
</content>
</entry>
<entry>
<title>KVM: arm64: Use build-time defines in has_vhe()</title>
<updated>2020-07-05T17:38:01Z</updated>
<author>
<name>David Brazdil</name>
<email>dbrazdil@google.com</email>
</author>
<published>2020-06-25T13:14:09Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=53b671128bd7f9ea41ae1a06106d88eb4cf66623'/>
<id>urn:sha1:53b671128bd7f9ea41ae1a06106d88eb4cf66623</id>
<content type='text'>
Build system compiles hyp code with macros specifying if the code belongs
to VHE or nVHE. Use these macros to evaluate has_vhe() at compile time.

Signed-off-by: David Brazdil &lt;dbrazdil@google.com&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Link: https://lore.kernel.org/r/20200625131420.71444-5-dbrazdil@google.com
</content>
</entry>
<entry>
<title>KVM: arm64: Use cpus_have_final_cap for has_vhe()</title>
<updated>2020-05-16T14:04:51Z</updated>
<author>
<name>Marc Zyngier</name>
<email>maz@kernel.org</email>
</author>
<published>2020-05-13T10:38:28Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=ce6f8f02f9f6786355fa6c79d88b839639dd75d8'/>
<id>urn:sha1:ce6f8f02f9f6786355fa6c79d88b839639dd75d8</id>
<content type='text'>
By the time we start using the has_vhe() helper, we have long
discovered whether we are running VHE or not. It thus makes
sense to use cpus_have_final_cap() instead of cpus_have_const_cap(),
which leads to a small text size reduction.

Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Acked-by: David Brazdil &lt;dbrazdil@google.com&gt;
Link: https://lore.kernel.org/r/20200513103828.74580-1-maz@kernel.org
</content>
</entry>
</feed>
