qemu/target/i386
Michael Roth 16dcf200dc i386/sev: Introduce "sev-common" type to encapsulate common SEV state
Currently all SEV/SEV-ES functionality is managed through a single
'sev-guest' QOM type. With upcoming support for SEV-SNP, taking this
same approach won't work well since some of the properties/state
managed by 'sev-guest' is not applicable to SEV-SNP, which will instead
rely on a new QOM type with its own set of properties/state.

To prepare for this, this patch moves common state into an abstract
'sev-common' parent type to encapsulate properties/state that are
common to both SEV/SEV-ES and SEV-SNP, leaving only SEV/SEV-ES-specific
properties/state in the current 'sev-guest' type. This should not
affect current behavior or command-line options.

As part of this patch, some related changes are also made:

  - a static 'sev_guest' variable is currently used to keep track of
    the 'sev-guest' instance. SEV-SNP would similarly introduce an
    'sev_snp_guest' static variable. But these instances are now
    available via qdev_get_machine()->cgs, so switch to using that
    instead and drop the static variable.

  - 'sev_guest' is currently used as the name for the static variable
    holding a pointer to the 'sev-guest' instance. Re-purpose the name
    as a local variable referring the 'sev-guest' instance, and use
    that consistently throughout the code so it can be easily
    distinguished from sev-common/sev-snp-guest instances.

  - 'sev' is generally used as the name for local variables holding a
    pointer to the 'sev-guest' instance. In cases where that now points
    to common state, use the name 'sev_common'; in cases where that now
    points to state specific to 'sev-guest' instance, use the name
    'sev_guest'

In order to enable kernel-hashes for SNP, pull it from
SevGuestProperties to its parent SevCommonProperties so
it will be available for both SEV and SNP.

Signed-off-by: Michael Roth <michael.roth@amd.com>
Co-developed-by: Dov Murik <dovmurik@linux.ibm.com>
Signed-off-by: Dov Murik <dovmurik@linux.ibm.com>
Acked-by: Markus Armbruster <armbru@redhat.com> (QAPI schema)
Co-developed-by: Pankaj Gupta <pankaj.gupta@amd.com>
Signed-off-by: Pankaj Gupta <pankaj.gupta@amd.com>
Message-ID: <20240530111643.1091816-5-pankaj.gupta@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-06-05 11:01:06 +02:00
..
hvf accel/hvf: Use accel-specific per-vcpu @dirty field 2024-04-26 17:03:00 +02:00
kvm target-i386: hyper-v: Correct kvm_hv_handle_exit return value 2024-05-22 19:56:28 +02:00
nvmm accel/nvmm: Fix NULL dereference in nvmm_init_vcpu() 2024-05-03 14:37:51 +02:00
tcg target/i386: fix xsave.flat from kvm-unit-tests 2024-06-05 11:01:05 +02:00
whpx accel/whpx: Fix NULL dereference in whpx_init_vcpu() 2024-05-03 14:37:51 +02:00
arch_dump.c dump: Replace opaque DumpState pointer with a typed one 2022-10-06 19:30:43 +04:00
arch_memory_mapping.c memory: follow Error API guidelines 2023-10-19 23:13:27 +02:00
confidential-guest.c target/i386: introduce x86-confidential-guest 2024-04-23 17:35:25 +02:00
confidential-guest.h target/i386: Implement mc->kvm_type() to get VM type 2024-04-23 17:35:25 +02:00
cpu-apic.c target/i386: Move APIC related code to cpu-apic.c 2024-04-25 10:12:54 +02:00
cpu-dump.c target/i386: Remove x86_cpu_dump_local_apic_state() dead stub 2023-02-27 22:29:01 +01:00
cpu-internal.h i386: split off sysemu part of cpu.c 2021-05-10 15:41:52 -04:00
cpu-param.h target: Define TCG_GUEST_DEFAULT_MO in 'cpu-param.h' 2024-04-26 15:31:37 +02:00
cpu-qom.h target: Move ArchCPUClass definition to 'cpu.h' 2023-11-07 13:08:48 +01:00
cpu-sysemu.c target/i386: Move APIC related code to cpu-apic.c 2024-04-25 10:12:54 +02:00
cpu.c i386/cpu: Use CPUCacheInfo.share_level to encode CPUID[0x8000001D].EAX[bits 25:14] 2024-05-22 19:56:27 +02:00
cpu.h target/i386: Pass host pointer and size to cpu_x86_{xsave,xrstor} 2024-05-26 15:49:58 -07:00
gdbstub.c misc: Use QEMU header path relative to include/ directory 2024-05-09 00:07:21 +02:00
helper.c target/i386: add control bits support for LAM 2024-05-22 15:53:30 +02:00
helper.h target/i386: clean up AAM/AAD 2024-05-22 15:53:30 +02:00
host-cpu.c target/i386/host-cpu: Consolidate the use of warn_report_once() 2024-04-23 17:35:26 +02:00
host-cpu.h accel-cpu: make cpu_realizefn return a bool 2021-05-10 15:41:50 -04:00
Kconfig i386: select correct components for no-board build 2024-05-10 15:45:15 +02:00
machine.c target/i386: Constify VMState in machine.c 2023-12-29 11:17:30 +11:00
meson.build target/i386: Move APIC related code to cpu-apic.c 2024-04-25 10:12:54 +02:00
monitor.c target/i386: Move APIC related code to cpu-apic.c 2024-04-25 10:12:54 +02:00
ops_sse.h target/i386: set CC_OP in helpers if they want CC_OP_EFLAGS 2024-05-25 13:28:01 +02:00
sev-sysemu-stub.c error: Drop superfluous #include "qapi/qmp/qerror.h" 2023-02-23 13:56:14 +01:00
sev.c i386/sev: Introduce "sev-common" type to encapsulate common SEV state 2024-06-05 11:01:06 +02:00
sev.h i386/sev: Introduce "sev-common" type to encapsulate common SEV state 2024-06-05 11:01:06 +02:00
svm.h target/i386: check intercept for XSETBV 2023-10-17 15:20:53 +02:00
trace-events * Update the references to some doc files (use *.rst instead of *.txt) 2021-06-02 17:08:11 +01:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
xsave_helper.c x86: add support for KVM_CAP_XSAVE2 and AMX state migration 2022-03-15 11:50:50 +01:00