<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/arm64/kvm/debug.c, branch linux-6.15.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.15.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.15.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2025-01-12T12:50:11Z</updated>
<entry>
<title>KVM: arm64: Support trace filtering for guests</title>
<updated>2025-01-12T12:50:11Z</updated>
<author>
<name>James Clark</name>
</author>
<published>2025-01-06T14:24:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=054b88391bbe2e470c5484cb91622238314344fb'/>
<id>urn:sha1:054b88391bbe2e470c5484cb91622238314344fb</id>
<content type='text'>
For nVHE, switch the filter value in and out if the Coresight driver
asks for it. This will support filters for guests when sinks other than
TRBE are used.

For VHE, just write the filter directly to TRFCR_EL1 where trace can be
used even with TRBE sinks.

Signed-off-by: James Clark &lt;james.clark@linaro.org&gt;
Link: https://lore.kernel.org/r/20250106142446.628923-7-james.clark@linaro.org
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
</content>
</entry>
<entry>
<title>KVM: arm64: coresight: Give TRBE enabled state to KVM</title>
<updated>2025-01-12T12:50:11Z</updated>
<author>
<name>James Clark</name>
</author>
<published>2025-01-06T14:24:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a665e3bc88081dd65642d83fc22a1abdb6a901bc'/>
<id>urn:sha1:a665e3bc88081dd65642d83fc22a1abdb6a901bc</id>
<content type='text'>
Currently in nVHE, KVM has to check if TRBE is enabled on every guest
switch even if it was never used. Because it's a debug feature and is
more likely to not be used than used, give KVM the TRBE buffer status to
allow a much simpler and faster do-nothing path in the hyp.

Protected mode now disables trace regardless of TRBE (because
trfcr_while_in_guest is always 0), which was not previously done.
However, it continues to flush whenever the buffer is enabled
regardless of the filter status. This avoids the hypothetical case of a
host that had disabled the filter but not flushed which would arise if
only doing the flush when the filter was enabled.

Signed-off-by: James Clark &lt;james.clark@linaro.org&gt;
Link: https://lore.kernel.org/r/20250106142446.628923-6-james.clark@linaro.org
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
</content>
</entry>
<entry>
<title>KVM: arm64: Avoid reading ID_AA64DFR0_EL1 for debug save/restore</title>
<updated>2024-12-20T09:04:14Z</updated>
<author>
<name>Oliver Upton</name>
</author>
<published>2024-12-19T22:41:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8c02c2bbd64375e603df79449f0eb2c57e1a597c'/>
<id>urn:sha1:8c02c2bbd64375e603df79449f0eb2c57e1a597c</id>
<content type='text'>
Similar to other per-CPU profiling/debug features we handle, store the
number of breakpoints/watchpoints in kvm_host_data to avoid reading the
ID register 4 times on every guest entry/exit. And if you're in the
nested virt business that's quite a few avoidable exits to the L0
hypervisor.

Tested-by: James Clark &lt;james.clark@linaro.org&gt;
Signed-off-by: Oliver Upton &lt;oliver.upton@linux.dev&gt;
Link: https://lore.kernel.org/r/20241219224116.3941496-18-oliver.upton@linux.dev
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
</content>
</entry>
<entry>
<title>KVM: arm64: Manage software step state at load/put</title>
<updated>2024-12-20T09:04:06Z</updated>
<author>
<name>Marc Zyngier</name>
</author>
<published>2024-12-20T08:59:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2ca3f03bf524c98afa421c479689f1e7dc030bf0'/>
<id>urn:sha1:2ca3f03bf524c98afa421c479689f1e7dc030bf0</id>
<content type='text'>
KVM takes over the guest's software step state machine if the VMM is
debugging the guest, but it does the save/restore fiddling for every
guest entry.

Note that the only constraint on host usage of software step is that the
guest's configuration remains visible to userspace via the ONE_REG
ioctls. So, we can cut down on the amount of fiddling by doing this at
load/put instead.

Tested-by: James Clark &lt;james.clark@linaro.org&gt;
Signed-off-by: Oliver Upton &lt;oliver.upton@linux.dev&gt;
Link: https://lore.kernel.org/r/20241219224116.3941496-16-oliver.upton@linux.dev
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
</content>
</entry>
<entry>
<title>KVM: arm64: Don't hijack guest context MDSCR_EL1</title>
<updated>2024-12-20T09:02:51Z</updated>
<author>
<name>Oliver Upton</name>
</author>
<published>2024-12-19T22:41:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4ad3a0b87f2ec4714fdfa6bd5de57b4c30e15753'/>
<id>urn:sha1:4ad3a0b87f2ec4714fdfa6bd5de57b4c30e15753</id>
<content type='text'>
Stealing MDSCR_EL1 in the guest's kvm_cpu_context for external debugging
is rather gross. Just add a field for this instead and let the context
switch code pick the correct one based on the debug owner.

Tested-by: James Clark &lt;james.clark@linaro.org&gt;
Signed-off-by: Oliver Upton &lt;oliver.upton@linux.dev&gt;
Link: https://lore.kernel.org/r/20241219224116.3941496-15-oliver.upton@linux.dev
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
</content>
</entry>
<entry>
<title>KVM: arm64: Compute MDCR_EL2 at vcpu_load()</title>
<updated>2024-12-20T09:01:25Z</updated>
<author>
<name>Oliver Upton</name>
</author>
<published>2024-12-19T22:41:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=75a5fbaf6623328d3ac69719145c2247f7b4e299'/>
<id>urn:sha1:75a5fbaf6623328d3ac69719145c2247f7b4e299</id>
<content type='text'>
KVM has picked up several hacks to cope with vcpu-&gt;arch.mdcr_el2 needing
to be prepared before vcpu_load(), which is when it gets programmed
into hardware on VHE.

Now that the flows for reprogramming MDCR_EL2 have been simplified, move
that computation to vcpu_load().

Tested-by: James Clark &lt;james.clark@linaro.org&gt;
Signed-off-by: Oliver Upton &lt;oliver.upton@linux.dev&gt;
Link: https://lore.kernel.org/r/20241219224116.3941496-14-oliver.upton@linux.dev
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
</content>
</entry>
<entry>
<title>KVM: arm64: Reload vCPU for accesses to OSLAR_EL1</title>
<updated>2024-12-20T09:01:25Z</updated>
<author>
<name>Oliver Upton</name>
</author>
<published>2024-12-19T22:41:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=06d22a9c1b94006ebfa67693a38baed86b9a75e8'/>
<id>urn:sha1:06d22a9c1b94006ebfa67693a38baed86b9a75e8</id>
<content type='text'>
KVM takes ownership of the debug regs if the guest enables the OS lock,
as it needs to use MDSCR_EL1 to mask debug exceptions. Just reload the
vCPU if the guest toggles the OS lock, relying on kvm_vcpu_load_debug()
to update the debug owner and get the right trap configuration in place.

Tested-by: James Clark &lt;james.clark@linaro.org&gt;
Signed-off-by: Oliver Upton &lt;oliver.upton@linux.dev&gt;
Link: https://lore.kernel.org/r/20241219224116.3941496-13-oliver.upton@linux.dev
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
</content>
</entry>
<entry>
<title>KVM: arm64: Use debug_owner to track if debug regs need save/restore</title>
<updated>2024-12-20T09:01:25Z</updated>
<author>
<name>Oliver Upton</name>
</author>
<published>2024-12-19T22:41:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=beb470d96cec8dd8f4e05b2135c74d828f7b114b'/>
<id>urn:sha1:beb470d96cec8dd8f4e05b2135c74d828f7b114b</id>
<content type='text'>
Use the debug owner to determine if the debug regs are in use instead of
keeping around the DEBUG_DIRTY flag. Debug registers are now
saved/restored after the first trap, regardless of whether it was a read
or a write. This also shifts the point at which KVM becomes lazy to
vcpu_put() rather than the next exception taken from the guest.

Tested-by: James Clark &lt;james.clark@linaro.org&gt;
Signed-off-by: Oliver Upton &lt;oliver.upton@linux.dev&gt;
Link: https://lore.kernel.org/r/20241219224116.3941496-12-oliver.upton@linux.dev
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
</content>
</entry>
<entry>
<title>KVM: arm64: Remove vestiges of debug_ptr</title>
<updated>2024-12-20T09:01:25Z</updated>
<author>
<name>Oliver Upton</name>
</author>
<published>2024-12-19T22:41:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=803602b0d94168bd25f5ff6eafdfd9388a6dd2ec'/>
<id>urn:sha1:803602b0d94168bd25f5ff6eafdfd9388a6dd2ec</id>
<content type='text'>
Delete the remnants of debug_ptr now that debug registers are selected
based on the debug owner instead.

Tested-by: James Clark &lt;james.clark@linaro.org&gt;
Signed-off-by: Oliver Upton &lt;oliver.upton@linux.dev&gt;
Link: https://lore.kernel.org/r/20241219224116.3941496-11-oliver.upton@linux.dev
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
</content>
</entry>
<entry>
<title>KVM: arm64: Remove debug tracepoints</title>
<updated>2024-12-20T09:01:25Z</updated>
<author>
<name>Oliver Upton</name>
</author>
<published>2024-12-19T22:41:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3b7780945cc8494793040ab0a9805b77b7826abb'/>
<id>urn:sha1:3b7780945cc8494793040ab0a9805b77b7826abb</id>
<content type='text'>
The debug tracepoints are a useless firehose of information that track
implementation detail rather than well-defined events. These are going
to be rather difficult to uphold now that the implementation is getting
redone, so throw them out instead of bending over backwards.

Tested-by: James Clark &lt;james.clark@linaro.org&gt;
Signed-off-by: Oliver Upton &lt;oliver.upton@linux.dev&gt;
Link: https://lore.kernel.org/r/20241219224116.3941496-10-oliver.upton@linux.dev
[maz: fixed compilation after trace-ectomy]
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
</content>
</entry>
</feed>
