Skip to content

Commit 152d32a

Browse files
committed
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull kvm updates from Paolo Bonzini: "This is a large update by KVM standards, including AMD PSP (Platform Security Processor, aka "AMD Secure Technology") and ARM CoreSight (debug and trace) changes. ARM: - CoreSight: Add support for ETE and TRBE - Stage-2 isolation for the host kernel when running in protected mode - Guest SVE support when running in nVHE mode - Force W^X hypervisor mappings in nVHE mode - ITS save/restore for guests using direct injection with GICv4.1 - nVHE panics now produce readable backtraces - Guest support for PTP using the ptp_kvm driver - Performance improvements in the S2 fault handler x86: - AMD PSP driver changes - Optimizations and cleanup of nested SVM code - AMD: Support for virtual SPEC_CTRL - Optimizations of the new MMU code: fast invalidation, zap under read lock, enable/disably dirty page logging under read lock - /dev/kvm API for AMD SEV live migration (guest API coming soon) - support SEV virtual machines sharing the same encryption context - support SGX in virtual machines - add a few more statistics - improved directed yield heuristics - Lots and lots of cleanups Generic: - Rework of MMU notifier interface, simplifying and optimizing the architecture-specific code - a handful of "Get rid of oprofile leftovers" patches - Some selftests improvements" * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (379 commits) KVM: selftests: Speed up set_memory_region_test selftests: kvm: Fix the check of return value KVM: x86: Take advantage of kvm_arch_dy_has_pending_interrupt() KVM: SVM: Skip SEV cache flush if no ASIDs have been used KVM: SVM: Remove an unnecessary prototype declaration of sev_flush_asids() KVM: SVM: Drop redundant svm_sev_enabled() helper KVM: SVM: Move SEV VMCB tracking allocation to sev.c KVM: SVM: Explicitly check max SEV ASID during sev_hardware_setup() KVM: SVM: Unconditionally invoke sev_hardware_teardown() KVM: SVM: Enable SEV/SEV-ES functionality by default (when supported) KVM: SVM: Condition sev_enabled and sev_es_enabled on CONFIG_KVM_AMD_SEV=y KVM: SVM: Append "_enabled" to module-scoped SEV/SEV-ES control variables KVM: SEV: Mask CPUID[0x8000001F].eax according to supported features KVM: SVM: Move SEV module params/variables to sev.c KVM: SVM: Disable SEV/SEV-ES if NPT is disabled KVM: SVM: Free sev_asid_bitmap during init if SEV setup fails KVM: SVM: Zero out the VMCB array used to track SEV ASID association x86/sev: Drop redundant and potentially misleading 'sev_enabled' KVM: x86: Move reverse CPUID helpers to separate header file KVM: x86: Rename GPR accessors to make mode-aware variants the defaults ...
2 parents 4f97010 + 3bf0fcd commit 152d32a

File tree

216 files changed

+12447
-4022
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

216 files changed

+12447
-4022
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
What: /sys/bus/coresight/devices/trbe<cpu>/align
2+
Date: March 2021
3+
KernelVersion: 5.13
4+
Contact: Anshuman Khandual <[email protected]>
5+
Description: (Read) Shows the TRBE write pointer alignment. This value
6+
is fetched from the TRBIDR register.
7+
8+
What: /sys/bus/coresight/devices/trbe<cpu>/flag
9+
Date: March 2021
10+
KernelVersion: 5.13
11+
Contact: Anshuman Khandual <[email protected]>
12+
Description: (Read) Shows if TRBE updates in the memory are with access
13+
and dirty flag updates as well. This value is fetched from
14+
the TRBIDR register.
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# SPDX-License-Identifier: GPL-2.0-only or BSD-2-Clause
2+
# Copyright 2021, Arm Ltd
3+
%YAML 1.2
4+
---
5+
$id: "http://devicetree.org/schemas/arm/ete.yaml#"
6+
$schema: "http://devicetree.org/meta-schemas/core.yaml#"
7+
8+
title: ARM Embedded Trace Extensions
9+
10+
maintainers:
11+
- Suzuki K Poulose <[email protected]>
12+
- Mathieu Poirier <[email protected]>
13+
14+
description: |
15+
Arm Embedded Trace Extension(ETE) is a per CPU trace component that
16+
allows tracing the CPU execution. It overlaps with the CoreSight ETMv4
17+
architecture and has extended support for future architecture changes.
18+
The trace generated by the ETE could be stored via legacy CoreSight
19+
components (e.g, TMC-ETR) or other means (e.g, using a per CPU buffer
20+
Arm Trace Buffer Extension (TRBE)). Since the ETE can be connected to
21+
legacy CoreSight components, a node must be listed per instance, along
22+
with any optional connection graph as per the coresight bindings.
23+
See bindings/arm/coresight.txt.
24+
25+
properties:
26+
$nodename:
27+
pattern: "^ete([0-9a-f]+)$"
28+
compatible:
29+
items:
30+
- const: arm,embedded-trace-extension
31+
32+
cpu:
33+
description: |
34+
Handle to the cpu this ETE is bound to.
35+
$ref: /schemas/types.yaml#/definitions/phandle
36+
37+
out-ports:
38+
description: |
39+
Output connections from the ETE to legacy CoreSight trace bus.
40+
$ref: /schemas/graph.yaml#/properties/ports
41+
properties:
42+
port:
43+
description: Output connection from the ETE to legacy CoreSight Trace bus.
44+
$ref: /schemas/graph.yaml#/properties/port
45+
46+
required:
47+
- compatible
48+
- cpu
49+
50+
additionalProperties: false
51+
52+
examples:
53+
54+
# An ETE node without legacy CoreSight connections
55+
- |
56+
ete0 {
57+
compatible = "arm,embedded-trace-extension";
58+
cpu = <&cpu_0>;
59+
};
60+
# An ETE node with legacy CoreSight connections
61+
- |
62+
ete1 {
63+
compatible = "arm,embedded-trace-extension";
64+
cpu = <&cpu_1>;
65+
66+
out-ports { /* legacy coresight connection */
67+
port {
68+
ete1_out_port: endpoint {
69+
remote-endpoint = <&funnel_in_port0>;
70+
};
71+
};
72+
};
73+
};
74+
75+
...
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# SPDX-License-Identifier: GPL-2.0-only or BSD-2-Clause
2+
# Copyright 2021, Arm Ltd
3+
%YAML 1.2
4+
---
5+
$id: "http://devicetree.org/schemas/arm/trbe.yaml#"
6+
$schema: "http://devicetree.org/meta-schemas/core.yaml#"
7+
8+
title: ARM Trace Buffer Extensions
9+
10+
maintainers:
11+
- Anshuman Khandual <[email protected]>
12+
13+
description: |
14+
Arm Trace Buffer Extension (TRBE) is a per CPU component
15+
for storing trace generated on the CPU to memory. It is
16+
accessed via CPU system registers. The software can verify
17+
if it is permitted to use the component by checking the
18+
TRBIDR register.
19+
20+
properties:
21+
$nodename:
22+
const: "trbe"
23+
compatible:
24+
items:
25+
- const: arm,trace-buffer-extension
26+
27+
interrupts:
28+
description: |
29+
Exactly 1 PPI must be listed. For heterogeneous systems where
30+
TRBE is only supported on a subset of the CPUs, please consult
31+
the arm,gic-v3 binding for details on describing a PPI partition.
32+
maxItems: 1
33+
34+
required:
35+
- compatible
36+
- interrupts
37+
38+
additionalProperties: false
39+
40+
examples:
41+
42+
- |
43+
#include <dt-bindings/interrupt-controller/arm-gic.h>
44+
45+
trbe {
46+
compatible = "arm,trace-buffer-extension";
47+
interrupts = <GIC_PPI 15 IRQ_TYPE_LEVEL_HIGH>;
48+
};
49+
...
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
==============================
4+
Trace Buffer Extension (TRBE).
5+
==============================
6+
7+
:Author: Anshuman Khandual <[email protected]>
8+
:Date: November 2020
9+
10+
Hardware Description
11+
--------------------
12+
13+
Trace Buffer Extension (TRBE) is a percpu hardware which captures in system
14+
memory, CPU traces generated from a corresponding percpu tracing unit. This
15+
gets plugged in as a coresight sink device because the corresponding trace
16+
generators (ETE), are plugged in as source device.
17+
18+
The TRBE is not compliant to CoreSight architecture specifications, but is
19+
driven via the CoreSight driver framework to support the ETE (which is
20+
CoreSight compliant) integration.
21+
22+
Sysfs files and directories
23+
---------------------------
24+
25+
The TRBE devices appear on the existing coresight bus alongside the other
26+
coresight devices::
27+
28+
>$ ls /sys/bus/coresight/devices
29+
trbe0 trbe1 trbe2 trbe3
30+
31+
The ``trbe<N>`` named TRBEs are associated with a CPU.::
32+
33+
>$ ls /sys/bus/coresight/devices/trbe0/
34+
align flag
35+
36+
*Key file items are:-*
37+
* ``align``: TRBE write pointer alignment
38+
* ``flag``: TRBE updates memory with access and dirty flags

Documentation/virt/kvm/amd-memory-encryption.rst

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ measurement. Since the guest owner knows the initial contents of the guest at
148148
boot, the measurement can be verified by comparing it to what the guest owner
149149
expects.
150150

151+
If len is zero on entry, the measurement blob length is written to len and
152+
uaddr is unused.
153+
151154
Parameters (in): struct kvm_sev_launch_measure
152155

153156
Returns: 0 on success, -negative on error
@@ -271,6 +274,9 @@ report containing the SHA-256 digest of the guest memory and VMSA passed through
271274
commands and signed with the PEK. The digest returned by the command should match the digest
272275
used by the guest owner with the KVM_SEV_LAUNCH_MEASURE.
273276

277+
If len is zero on entry, the measurement blob length is written to len and
278+
uaddr is unused.
279+
274280
Parameters (in): struct kvm_sev_attestation
275281

276282
Returns: 0 on success, -negative on error
@@ -284,6 +290,143 @@ Returns: 0 on success, -negative on error
284290
__u32 len;
285291
};
286292

293+
11. KVM_SEV_SEND_START
294+
----------------------
295+
296+
The KVM_SEV_SEND_START command can be used by the hypervisor to create an
297+
outgoing guest encryption context.
298+
299+
If session_len is zero on entry, the length of the guest session information is
300+
written to session_len and all other fields are not used.
301+
302+
Parameters (in): struct kvm_sev_send_start
303+
304+
Returns: 0 on success, -negative on error
305+
306+
::
307+
308+
struct kvm_sev_send_start {
309+
__u32 policy; /* guest policy */
310+
311+
__u64 pdh_cert_uaddr; /* platform Diffie-Hellman certificate */
312+
__u32 pdh_cert_len;
313+
314+
__u64 plat_certs_uaddr; /* platform certificate chain */
315+
__u32 plat_certs_len;
316+
317+
__u64 amd_certs_uaddr; /* AMD certificate */
318+
__u32 amd_certs_len;
319+
320+
__u64 session_uaddr; /* Guest session information */
321+
__u32 session_len;
322+
};
323+
324+
12. KVM_SEV_SEND_UPDATE_DATA
325+
----------------------------
326+
327+
The KVM_SEV_SEND_UPDATE_DATA command can be used by the hypervisor to encrypt the
328+
outgoing guest memory region with the encryption context creating using
329+
KVM_SEV_SEND_START.
330+
331+
If hdr_len or trans_len are zero on entry, the length of the packet header and
332+
transport region are written to hdr_len and trans_len respectively, and all
333+
other fields are not used.
334+
335+
Parameters (in): struct kvm_sev_send_update_data
336+
337+
Returns: 0 on success, -negative on error
338+
339+
::
340+
341+
struct kvm_sev_launch_send_update_data {
342+
__u64 hdr_uaddr; /* userspace address containing the packet header */
343+
__u32 hdr_len;
344+
345+
__u64 guest_uaddr; /* the source memory region to be encrypted */
346+
__u32 guest_len;
347+
348+
__u64 trans_uaddr; /* the destination memory region */
349+
__u32 trans_len;
350+
};
351+
352+
13. KVM_SEV_SEND_FINISH
353+
------------------------
354+
355+
After completion of the migration flow, the KVM_SEV_SEND_FINISH command can be
356+
issued by the hypervisor to delete the encryption context.
357+
358+
Returns: 0 on success, -negative on error
359+
360+
14. KVM_SEV_SEND_CANCEL
361+
------------------------
362+
363+
After completion of SEND_START, but before SEND_FINISH, the source VMM can issue the
364+
SEND_CANCEL command to stop a migration. This is necessary so that a cancelled
365+
migration can restart with a new target later.
366+
367+
Returns: 0 on success, -negative on error
368+
369+
15. KVM_SEV_RECEIVE_START
370+
-------------------------
371+
372+
The KVM_SEV_RECEIVE_START command is used for creating the memory encryption
373+
context for an incoming SEV guest. To create the encryption context, the user must
374+
provide a guest policy, the platform public Diffie-Hellman (PDH) key and session
375+
information.
376+
377+
Parameters: struct kvm_sev_receive_start (in/out)
378+
379+
Returns: 0 on success, -negative on error
380+
381+
::
382+
383+
struct kvm_sev_receive_start {
384+
__u32 handle; /* if zero then firmware creates a new handle */
385+
__u32 policy; /* guest's policy */
386+
387+
__u64 pdh_uaddr; /* userspace address pointing to the PDH key */
388+
__u32 pdh_len;
389+
390+
__u64 session_uaddr; /* userspace address which points to the guest session information */
391+
__u32 session_len;
392+
};
393+
394+
On success, the 'handle' field contains a new handle and on error, a negative value.
395+
396+
For more details, see SEV spec Section 6.12.
397+
398+
16. KVM_SEV_RECEIVE_UPDATE_DATA
399+
-------------------------------
400+
401+
The KVM_SEV_RECEIVE_UPDATE_DATA command can be used by the hypervisor to copy
402+
the incoming buffers into the guest memory region with encryption context
403+
created during the KVM_SEV_RECEIVE_START.
404+
405+
Parameters (in): struct kvm_sev_receive_update_data
406+
407+
Returns: 0 on success, -negative on error
408+
409+
::
410+
411+
struct kvm_sev_launch_receive_update_data {
412+
__u64 hdr_uaddr; /* userspace address containing the packet header */
413+
__u32 hdr_len;
414+
415+
__u64 guest_uaddr; /* the destination guest memory region */
416+
__u32 guest_len;
417+
418+
__u64 trans_uaddr; /* the incoming buffer memory region */
419+
__u32 trans_len;
420+
};
421+
422+
17. KVM_SEV_RECEIVE_FINISH
423+
--------------------------
424+
425+
After completion of the migration flow, the KVM_SEV_RECEIVE_FINISH command can be
426+
issued by the hypervisor to make the guest ready for execution.
427+
428+
Returns: 0 on success, -negative on error
429+
287430
References
288431
==========
289432

0 commit comments

Comments
 (0)