target/i386/sev: Housekeeping (OVMF + SEV-disabled binaries)
v2 cover target/i386/sev: Housekeeping (OVMF + SEV-disabled binaries)
Hi,
While testing James & Dov patch:
https://www.mail-archive.com/[email protected]/msg810571.html
I wasted some time trying to figure out how OVMF was supposed to behave until realizing the binary I was using was built without SEV support... Then wrote this series to help other developers to not hit the same problem.
Some SEV patches I was following have been queued on Eduardo's 'x86-next' tree, so I used his tree as base, and included David and Connor patches to reduce merge conflicts.
Patches 1-16 are SEV related,
patches 17-23 are OVMF related.
Special comment for Laszlo: Please don't review this version, wait for the respin (hoping the SEV cleanup patch get accepted, the respin will be focused on OVMF).
Based-on: https://gitlab.com/ehabkost/qemu/-/commits/x86-next/
Supersedes: <[email protected]>
Connor Kuehl (1):
MAINTAINERS: Add Connor Kuehl as reviewer for AMD SEV
Dr. David Alan Gilbert (1):
target/i386/sev: sev_get_attestation_report use g_autofree
Philippe Mathieu-Daudé (21):
qapi/misc-target: Wrap long 'SEV Attestation Report' long lines qapi/misc-target: Group SEV QAPI definitions target/i386/monitor: Return QMP error when SEV is disabled in build target/i386/cpu: Add missing 'qapi/error.h' header target/i386/sev_i386.h: Remove unused headers target/i386/sev: Remove sev_get_me_mask() target/i386/sev: Mark unreachable code with g_assert_not_reached() target/i386/sev: Restrict SEV to system emulation target/i386/sev: Move qmp_query_sev_attestation_report() to sev.c target/i386/sev: Move qmp_sev_inject_launch_secret() to sev.c target/i386/sev: Move qmp_query_sev_capabilities() to sev.c target/i386/sev: Move qmp_query_sev_launch_measure() to sev.c target/i386/sev: Move qmp_query_sev() & hmp_info_sev() to sev.c
monitor: Restrict 'info sev' to x86 targets hw/i386/acpi-common: Remove unused includes
hw/i386: Rename acpi-build.c -> acpi-pc.c
hw/i386: Move pc_madt_cpu_entry() to acpi-pc.c
hw/acpi: Do not restrict ACPI core routines to x86 architecture hw/i386: Introduce X86_FW_OVMF Kconfig symbol hw/acpi/Kconfig: Add missing Kconfig dependencies (build error) hw/i386/Kconfig: Add missing Kconfig dependency (runtime error)
qapi/misc-target.json | 78 ++++++++--------
include/hw/i386/pc.h | 1 +
include/monitor/hmp-target.h | 1 +
include/monitor/hmp.h | 1 -
target/i386/sev_i386.h | 11 ---
hw/i386/acpi-common.c | 45 ----------
hw/i386/{acpi-build.c => acpi-pc.c} | 39 ++++++++
hw/i386/pc_sysfw.c | 107 ----------------------
hw/i386/pc_sysfw_ovmf-stubs.c | 26 ++++++
hw/i386/pc_sysfw_ovmf.c | 135 ++++++++++++++++++++++++++++
target/i386/cpu.c | 1 +
target/i386/monitor.c | 91 -------------------
target/i386/sev-stub.c | 49 +---------
target/i386/sev-sysemu-stub.c | 69 ++++++++++++++
target/i386/sev.c | 130 +++++++++++++++++++++------
MAINTAINERS | 8 ++
hw/acpi/Kconfig | 4 +
hw/acpi/meson.build | 3 +-
hw/i386/Kconfig | 5 ++
hw/i386/meson.build | 4 +-
target/i386/meson.build | 4 +-
21 files changed, 443 insertions(+), 369 deletions(-)
rename hw/i386/{acpi-build.c => acpi-pc.c} (98%)
create mode 100644 hw/i386/pc_sysfw_ovmf-stubs.c
create mode 100644 hw/i386/pc_sysfw_ovmf.c
create mode 100644 target/i386/sev-sysemu-stub.cSignature · 1 line
2.31.1
PATCH v2 1/23 MAINTAINERS: Add Connor Kuehl as reviewer for AMD SEV
From: Connor Kuehl <[email protected]>
It may not be appropriate for me to take over as a maintainer at this time, but I would consider myself familiar with AMD SEV and what this code is meant to be doing as part of a VMM for launching SEV-protected guests.
To that end, I would be happy to volunteer as a reviewer for SEV-related changes so that I am CC'd on them and can help share the review burden with whoever does maintain this code.
Message-Id: <[email protected]>
--- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
@@ -2937,6 +2937,13 @@ F: hw/core/clock-vmstate.c F: hw/core/qdev-clock.c F: docs/devel/clocks.rst +AMD Secure Encrypted Virtualization (SEV) +R: Connor Kuehl <[email protected]> +F: docs/amd-memory-encryption.txt +F: accel/kvm/sev-stub.c +F: target/i386/sev* +F: include/sysemu/sev.h + Usermode Emulation ------------------ Overall usermode emulation
Signature · 1 line
2.31.1
Re: [PATCH v2 01/23] MAINTAINERS: Add Connor Kuehl as reviewer for AMD SEV
Quoted 24 lines · Philippe Mathieu-Daudé
From: Connor Kuehl <[email protected]>
It may not be appropriate for me to take over as a maintainer at this time, but I would consider myself familiar with AMD SEV and what this code is meant to be doing as part of a VMM for launching SEV-protected guests.
To that end, I would be happy to volunteer as a reviewer for SEV-related changes so that I am CC'd on them and can help share the review burden with whoever does maintain this code.
Signed-off-by Connor Kuehl <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Message-Id: <[email protected]>
[PMD: Cover more files]Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+)MAINTAINERS +0
-0
MAINTAINERS F: hw/core/clock-vmstate.c · line 2941
Quoted 5 lines
MAINTAINERS +2
-0@@ -2937,6 +2937,13 @@ F: hw/core/clock-vmstate.c F: hw/core/qdev-clock.c F: docs/devel/clocks.rst +AMD Secure Encrypted Virtualization (SEV) +R: Connor Kuehl <[email protected]>
Is this patch still valid?
Quoted 9 lines
MAINTAINERS +5
-0+F: docs/amd-memory-encryption.txt +F: accel/kvm/sev-stub.c +F: target/i386/sev* +F: include/sysemu/sev.h + Usermode Emulation ------------------ Overall usermode emulation
Re: [PATCH v2 01/23] MAINTAINERS: Add Connor Kuehl as reviewer for AMD SEV
Quoted 5 lines · Philippe Mathieu-Daudé
MAINTAINERS F: hw/core/clock-vmstate.c · line 2941
Quoted 3 lines
MAINTAINERS +2
-0+AMD Secure Encrypted Virtualization (SEV) +R: Connor Kuehl <[email protected]>Is this patch still valid?
Thank you for championing it, but due to recent changes, no, it is no longer valid.
Thank you,
Connor
PATCH v2 2/23 qapi/misc-target: Wrap long 'SEV Attestation Report' long lines
In reply to Philippe Mathieu-DaudéWrap long lines before 70 characters for legibility.
---
Note: it would be nice if checkpatch enforce 70 char for json
(or at least QAPI json), that would save future developer modifying QAPI definitions reformating time.
--- qapi/misc-target.json | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
qapi/misc-target.json +10 -7
@@ -290,8 +290,8 @@ ## # @SevAttestationReport: # -# The struct describes attestation report for a Secure Encrypted Virtualization -# feature. +# The struct describes attestation report for a Secure Encrypted +# Virtualization feature. # # @data: guest attestation report (base64 encoded) #
@@ -305,10 +305,11 @@ ## # @query-sev-attestation-report: # -# This command is used to get the SEV attestation report, and is supported on AMD -# X86 platforms only. +# This command is used to get the SEV attestation report, and is +# supported on AMD X86 platforms only. # -# @mnonce: a random 16 bytes value encoded in base64 (it will be included in report) +# @mnonce: a random 16 bytes value encoded in base64 (it will be +# included in report) # # Returns: SevAttestationReport objects. #
@@ -316,10 +317,12 @@ # # Example: # -# -> { "execute" : "query-sev-attestation-report", "arguments": { "mnonce": "aaaaaaa" } } +# -> { "execute" : "query-sev-attestation-report", + "arguments": { "mnonce": "aaaaaaa" } } # <- { "return" : { "data": "aaaaaaaabbbddddd"} } # ## -{ 'command': 'query-sev-attestation-report', 'data': { 'mnonce': 'str' }, +{ 'command': 'query-sev-attestation-report', + 'data': { 'mnonce': 'str' }, 'returns': 'SevAttestationReport', 'if': 'defined(TARGET_I386)' }
Signature · 1 line
2.31.1
Re: [PATCH v2 02/23] qapi/misc-target: Wrap long 'SEV Attestation Report' long lines
Quoted 43 lines · * Philippe Mathieu-Daudé ([email protected]) wrote:
Wrap long lines before 70 characters for legibility.
Suggested-by Markus Armbruster <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
Note: it would be nice if checkpatch enforce 70 char for json
(or at least QAPI json), that would save future developer modifying QAPI definitions reformating time.--- qapi/misc-target.json | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)qapi/misc-target.json +6
-5@@ -290,8 +290,8 @@ ## # @SevAttestationReport: # -# The struct describes attestation report for a Secure Encrypted Virtualization -# feature. +# The struct describes attestation report for a Secure Encrypted +# Virtualization feature. # # @data: guest attestation report (base64 encoded) #@@ -305,10 +305,11 @@ ## # @query-sev-attestation-report: # -# This command is used to get the SEV attestation report, and is supported on AMD -# X86 platforms only. +# This command is used to get the SEV attestation report, and is +# supported on AMD X86 platforms only. # -# @mnonce: a random 16 bytes value encoded in base64 (it will be included in report) +# @mnonce: a random 16 bytes value encoded in base64 (it will be +# included in report) # # Returns: SevAttestationReport objects. #
qapi/misc-target.json line 321
Quoted 6 lines
qapi/misc-target.json +2
-1@@ -316,10 +317,12 @@ # # Example: # -# -> { "execute" : "query-sev-attestation-report", "arguments": { "mnonce": "aaaaaaa" } } +# -> { "execute" : "query-sev-attestation-report", + "arguments": { "mnonce": "aaaaaaa" } }
Shouldn't that start with a # ?
(Actually, last time I tried this command, I think I realised that we should also put a real nonce value in there; it requirs a 16 byte value)
Dave
Quoted 11 lines
qapi/misc-target.json +2
-1# <- { "return" : { "data": "aaaaaaaabbbddddd"} } # ## -{ 'command': 'query-sev-attestation-report', 'data': { 'mnonce': 'str' }, +{ 'command': 'query-sev-attestation-report', + 'data': { 'mnonce': 'str' }, 'returns': 'SevAttestationReport', 'if': 'defined(TARGET_I386)' }Signature · 1 line
2.31.1
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Re: [PATCH v2 02/23] qapi/misc-target: Wrap long 'SEV Attestation Report' long lines
In reply to Philippe Mathieu-DaudéQuoted 4 lines · Philippe Mathieu-Daudé
Wrap long lines before 70 characters for legibility.
Suggested-by Markus Armbruster <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 4 lines
---
Note: it would be nice if checkpatch enforce 70 char for json
(or at least QAPI json), that would save future developer modifying QAPI definitions reformating time.
Yes.
Re: [PATCH v2 02/23] qapi/misc-target: Wrap long 'SEV Attestation Report' long lines
Quoted 8 lines · Markus Armbruster
Quoted 4 lines · Philippe Mathieu-Daudé
Wrap long lines before 70 characters for legibility.
Suggested-by Markus Armbruster <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Markus Armbruster <[email protected]>
With the typo spotted by Dave fixed, of course.
Quoted 7 lines
Quoted 5 lines
---
Note: it would be nice if checkpatch enforce 70 char for json
(or at least QAPI json), that would save future developer modifying QAPI definitions reformating time.Yes.
PATCH v2 3/23 qapi/misc-target: Group SEV QAPI definitions
In reply to Philippe Mathieu-DaudéThere is already a section with various SEV commands / types, so move the SEV guest attestation together.
--- qapi/misc-target.json | 81 +++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 41 deletions(-)
qapi/misc-target.json +40 -41
@@ -219,6 +219,46 @@ 'data': { 'packet-header': 'str', 'secret': 'str', '*gpa': 'uint64' }, 'if': 'defined(TARGET_I386)' } +## +# @SevAttestationReport: +# +# The struct describes attestation report for a Secure Encrypted +# Virtualization feature. +# +# @data: guest attestation report (base64 encoded) +# +# +# Since: 6.1 +## +{ 'struct': 'SevAttestationReport', + 'data': { 'data': 'str'}, + 'if': 'defined(TARGET_I386)' } + +## +# @query-sev-attestation-report: +# +# This command is used to get the SEV attestation report, and is +# supported on AMD X86 platforms only. +# +# @mnonce: a random 16 bytes value encoded in base64 (it will be +# included in report) +# +# Returns: SevAttestationReport objects. +# +# Since: 6.1 +# +# Example: +# +# -> { "execute" : "query-sev-attestation-report", +# "arguments": { "mnonce": "aaaaaaa" } } +# <- { "return" : { "data": "aaaaaaaabbbddddd"} } +# +## +{ 'command': 'query-sev-attestation-report', + 'data': { 'mnonce': 'str' }, + 'returns': 'SevAttestationReport', + 'if': 'defined(TARGET_I386)' } + ## # @dump-skeys: #
@@ -285,44 +325,3 @@ ## { 'command': 'query-gic-capabilities', 'returns': ['GICCapability'], 'if': 'defined(TARGET_ARM)' } - - -## -# @SevAttestationReport: -# -# The struct describes attestation report for a Secure Encrypted -# Virtualization feature. -# -# @data: guest attestation report (base64 encoded) -# -# -# Since: 6.1 -## -{ 'struct': 'SevAttestationReport', - 'data': { 'data': 'str'}, - 'if': 'defined(TARGET_I386)' } - -## -# @query-sev-attestation-report: -# -# This command is used to get the SEV attestation report, and is -# supported on AMD X86 platforms only. -# -# @mnonce: a random 16 bytes value encoded in base64 (it will be -# included in report) -# -# Returns: SevAttestationReport objects. -# -# Since: 6.1 -# -# Example: -# -# -> { "execute" : "query-sev-attestation-report", - "arguments": { "mnonce": "aaaaaaa" } } -# <- { "return" : { "data": "aaaaaaaabbbddddd"} } -# -## -{ 'command': 'query-sev-attestation-report', - 'data': { 'mnonce': 'str' }, - 'returns': 'SevAttestationReport', - 'if': 'defined(TARGET_I386)' }
Signature · 1 line
2.31.1
Re: [PATCH v2 03/23] qapi/misc-target: Group SEV QAPI definitions
Phil,
Quoted 3 lines · Philippe Mathieu-Daudé
There is already a section with various SEV commands / types, so move the SEV guest attestation together.
I have two questions (regarding several qapi patches in this series):
1. Should we extract all the SEV commands/types to a separate file? Maybe sev.json, or confidential-guest-sev.json -- anticipating the other platforms.
2. I see that some qapi types/commands are conditioned on defined(CONFIG_...). For example in qapi/tpm.json we have:
{ 'command': 'query-tpm-types', 'returns': ['TpmType'],
'if': 'defined(CONFIG_TPM)' }
I wonder if the same applies to SEV.
-Dov
Quoted 102 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- qapi/misc-target.json | 81 +++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 41 deletions(-)qapi/misc-target.json +40
-41@@ -219,6 +219,46 @@ 'data': { 'packet-header': 'str', 'secret': 'str', '*gpa': 'uint64' }, 'if': 'defined(TARGET_I386)' } +## +# @SevAttestationReport: +# +# The struct describes attestation report for a Secure Encrypted +# Virtualization feature. +# +# @data: guest attestation report (base64 encoded) +# +# +# Since: 6.1 +## +{ 'struct': 'SevAttestationReport', + 'data': { 'data': 'str'}, + 'if': 'defined(TARGET_I386)' } + +## +# @query-sev-attestation-report: +# +# This command is used to get the SEV attestation report, and is +# supported on AMD X86 platforms only. +# +# @mnonce: a random 16 bytes value encoded in base64 (it will be +# included in report) +# +# Returns: SevAttestationReport objects. +# +# Since: 6.1 +# +# Example: +# +# -> { "execute" : "query-sev-attestation-report", +# "arguments": { "mnonce": "aaaaaaa" } } +# <- { "return" : { "data": "aaaaaaaabbbddddd"} } +# +## +{ 'command': 'query-sev-attestation-report', + 'data': { 'mnonce': 'str' }, + 'returns': 'SevAttestationReport', + 'if': 'defined(TARGET_I386)' } + ## # @dump-skeys: #@@ -285,44 +325,3 @@ ## { 'command': 'query-gic-capabilities', 'returns': ['GICCapability'], 'if': 'defined(TARGET_ARM)' } - - -## -# @SevAttestationReport: -# -# The struct describes attestation report for a Secure Encrypted -# Virtualization feature. -# -# @data: guest attestation report (base64 encoded) -# -# -# Since: 6.1 -## -{ 'struct': 'SevAttestationReport', - 'data': { 'data': 'str'}, - 'if': 'defined(TARGET_I386)' } - -## -# @query-sev-attestation-report: -# -# This command is used to get the SEV attestation report, and is -# supported on AMD X86 platforms only. -# -# @mnonce: a random 16 bytes value encoded in base64 (it will be -# included in report) -# -# Returns: SevAttestationReport objects. -# -# Since: 6.1 -# -# Example: -# -# -> { "execute" : "query-sev-attestation-report", - "arguments": { "mnonce": "aaaaaaa" } } -# <- { "return" : { "data": "aaaaaaaabbbddddd"} } -# -## -{ 'command': 'query-sev-attestation-report', - 'data': { 'mnonce': 'str' }, - 'returns': 'SevAttestationReport', - 'if': 'defined(TARGET_I386)' }
Re: [PATCH v2 03/23] qapi/misc-target: Group SEV QAPI definitions
Quoted 8 lines · Dov Murik
Phil,
Quoted 3 lines · Philippe Mathieu-Daudé
There is already a section with various SEV commands / types, so move the SEV guest attestation together.
Quoted 5 lines
I have two questions (regarding several qapi patches in this series):
1. Should we extract all the SEV commands/types to a separate file? Maybe sev.json, or confidential-guest-sev.json -- anticipating the other platforms.
Certainly. "confidential-guest" matches QEMU naming, and I agree having the implementation as extension (here "-sev") will reduce the noise on other maintainers each time this file is modified.
Quoted 7 lines
2. I see that some qapi types/commands are conditioned on
defined(CONFIG_...). For example inqapi/tpm.jsonwe have:{ 'command': 'query-tpm-types', 'returns': ['TpmType'],
'if': 'defined(CONFIG_TPM)' }I wonder if the same applies to SEV.
This part I am not sure so I'll defer to Markus / Paolo / anyone who knows. My understanding is QAPI is generated at some point in the buildsys process, so only the configuration features passed via the ninja invocation can be used (see after NINJA in ./configure). I hope I'm wrong and buildsys/QAPI works as you expect, but haven't tried :)
Regards,
Phil.
Re: [PATCH v2 03/23] qapi/misc-target: Group SEV QAPI definitions
In reply to Philippe Mathieu-DaudéQuoted 38 lines · Philippe Mathieu-Daudé
There is already a section with various SEV commands / types, so move the SEV guest attestation together.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- qapi/misc-target.json | 81 +++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 41 deletions(-)qapi/misc-target.json +22
-0@@ -219,6 +219,46 @@ 'data': { 'packet-header': 'str', 'secret': 'str', '*gpa': 'uint64' }, 'if': 'defined(TARGET_I386)' } +## +# @SevAttestationReport: +# +# The struct describes attestation report for a Secure Encrypted +# Virtualization feature. +# +# @data: guest attestation report (base64 encoded) +# +# +# Since: 6.1 +## +{ 'struct': 'SevAttestationReport', + 'data': { 'data': 'str'}, + 'if': 'defined(TARGET_I386)' } + +## +# @query-sev-attestation-report: +# +# This command is used to get the SEV attestation report, and is +# supported on AMD X86 platforms only. +# +# @mnonce: a random 16 bytes value encoded in base64 (it will be
qapi/misc-target.json line 253
Quoted 10 lines
qapi/misc-target.json +10
-0+# included in report) +# +# Returns: SevAttestationReport objects. +# +# Since: 6.1 +# +# Example: +# +# -> { "execute" : "query-sev-attestation-report", +# "arguments": { "mnonce": "aaaaaaa" } }
You're fixing the typo from PATCH 02 here.
Quoted 46 lines
qapi/misc-target.json +8
-31+# <- { "return" : { "data": "aaaaaaaabbbddddd"} } +# +## +{ 'command': 'query-sev-attestation-report', + 'data': { 'mnonce': 'str' }, + 'returns': 'SevAttestationReport', + 'if': 'defined(TARGET_I386)' } + ## # @dump-skeys: #@@ -285,44 +325,3 @@ ## { 'command': 'query-gic-capabilities', 'returns': ['GICCapability'], 'if': 'defined(TARGET_ARM)' } - - -## -# @SevAttestationReport: -# -# The struct describes attestation report for a Secure Encrypted -# Virtualization feature. -# -# @data: guest attestation report (base64 encoded) -# -# -# Since: 6.1 -## -{ 'struct': 'SevAttestationReport', - 'data': { 'data': 'str'}, - 'if': 'defined(TARGET_I386)' } - -## -# @query-sev-attestation-report: -# -# This command is used to get the SEV attestation report, and is -# supported on AMD X86 platforms only. -# -# @mnonce: a random 16 bytes value encoded in base64 (it will be -# included in report) -# -# Returns: SevAttestationReport objects. -# -# Since: 6.1 -# -# Example:
qapi/misc-target.json line 328
Quoted 10 lines
qapi/misc-target.json +0
-10-# -# -> { "execute" : "query-sev-attestation-report", - "arguments": { "mnonce": "aaaaaaa" } } -# <- { "return" : { "data": "aaaaaaaabbbddddd"} } -# -## -{ 'command': 'query-sev-attestation-report', - 'data': { 'mnonce': 'str' }, - 'returns': 'SevAttestationReport', - 'if': 'defined(TARGET_I386)' }
PATCH v2 4/23 target/i386/monitor: Return QMP error when SEV is disabled in build
In reply to Philippe Mathieu-DaudéIf the management layer tries to inject a secret, it gets an empty response in case the binary built without SEV:
{ "execute": "sev-inject-launch-secret",
"arguments": { "packet-header": "mypkt", "secret": "mypass", "gpa": 4294959104 }
}
{
"return": {
}
}Make it clearer by returning an error, mentioning the feature is disabled:
{ "execute": "sev-inject-launch-secret",
"arguments": { "packet-header": "mypkt", "secret": "mypass", "gpa": 4294959104 }
}
{
"error": {
"class": "GenericError",
"desc": "this feature or command is not currently supported"
}
}--- target/i386/monitor.c | 5 +++++ 1 file changed, 5 insertions(+)
target/i386/monitor.c +5 -0
@@ -28,6 +28,7 @@#include "monitor/hmp-target.h" #include "monitor/hmp.h" #include "qapi/qmp/qdict.h" +#include "qapi/qmp/qerror.h" #include "sysemu/kvm.h" #include "sysemu/sev.h" #include "qapi/error.h"
@@ -742,6 +743,10 @@ void qmp_sev_inject_launch_secret(const char *packet_hdr, bool has_gpa, uint64_t gpa, Error **errp) { + if (!sev_enabled()) { +error_setg (errp ,QERR_UNSUPPORTED ); +return ; + }if (!has_gpa) {uint8_t *data;struct sev_secret_area *area;
Signature · 1 line
2.31.1
PATCH v2 5/23 target/i386/cpu: Add missing 'qapi/error.h' header
In reply to Philippe Mathieu-DaudéCommit 00b81053244 ("target-i386: Remove assert_no_error usage") forgot to add the "qapi/error.h" for &error_abort, add it now.
--- target/i386/cpu.c | 1 + 1 file changed, 1 insertion(+)
target/i386/cpu.c +1 -0
@@ -27,6 +27,7 @@#include "sysemu/hvf.h" #include "kvm/kvm_i386.h" #include "sev_i386.h" +#include "qapi/error.h" #include "qapi/qapi-visit-machine.h" #include "qapi/qmp/qerror.h" #include "qapi/qapi-commands-machine-target.h"
Signature · 1 line
2.31.1
PATCH v2 6/23 target/i386/sev_i386.h: Remove unused headers
In reply to Philippe Mathieu-DaudéDeclarations don't require these headers, remove them.
--- target/i386/sev_i386.h | 4 ---- target/i386/sev-stub.c | 1 + 2 files changed, 1 insertion(+), 4 deletions(-)
target/i386/sev_i386.h +0 -4
@@ -14,11 +14,7 @@#ifndef QEMU_SEV_I386_H #define QEMU_SEV_I386_H -#include "qom/object.h" -#include "qapi/error.h" -#include "sysemu/kvm.h" #include "sysemu/sev.h" -#include "qemu/error-report.h" #include "qapi/qapi-types-misc-target.h" #define SEV_POLICY_NODBG 0x1
target/i386/sev-stub.c +1 -0
@@ -12,6 +12,7 @@*/ #include "qemu/osdep.h" +#include "qapi/error.h" #include "sev_i386.h" SevInfo *sev_get_info (void )
Signature · 1 line
2.31.1
PATCH v2 7/23 target/i386/sev: Remove sev_get_me_mask()
In reply to Philippe Mathieu-DaudéUnused dead code makes review harder, so remove it.
--- target/i386/sev_i386.h | 1 - target/i386/sev-stub.c | 5 ----- target/i386/sev.c | 9 --------- 3 files changed, 15 deletions(-)
target/i386/sev_i386.h +0 -1
@@ -25,7 +25,6 @@#define SEV_POLICY_SEV 0x20extern bool sev_es_enabled (void ); -extern uint64_t sev_get_me_mask (void );extern SevInfo *sev_get_info (void );extern uint32_t sev_get_cbit_position (void );extern uint32_t sev_get_reduced_phys_bits (void );
target/i386/sev-stub.c +0 -5
@@ -25,11 +25,6 @@ bool sev_enabled(void)return false; } -uint64_t sev_get_me_mask (void ) -{ -return ~0 ; -} -uint32_t sev_get_cbit_position (void ) {return 0 ;
target/i386/sev.c +0 -9
@@ -64,7 +64,6 @@ struct SevGuestState {uint8_t api_major;uint8_t api_minor;uint8_t build_id; -uint64_t me_mask;int sev_fd;SevState state;gchar *measurement;
@@ -362,12 +361,6 @@ sev_es_enabled(void)return sev_enabled () && (sev_guest->policy &SEV_POLICY_ES ); } -uint64_t -sev_get_me_mask (void ) -{ -return sev_guest ? sev_guest->me_mask : ~0 ; -} -uint32_t sev_get_cbit_position (void ) {
@@ -810,8 +803,6 @@ int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp) goto err; } - sev->me_mask = ~(1UL << sev->cbitpos); - devname =object_property_get_str (OBJECT (sev),"sev-device" ,NULL ); sev->sev_fd =open (devname,O_RDWR );if (sev->sev_fd <0 ) {
Signature · 1 line
2.31.1
PATCH v2 8/23 target/i386/sev: Mark unreachable code with g_assert_not_reached()
In reply to Philippe Mathieu-DaudéThe unique sev_encrypt_flash() invocation (in pc_system_flash_map) is protected by the "if (sev_enabled())" check, so is not reacheable.
Replace the abort() call in sev_es_save_reset_vector() by g_assert_not_reached() which meaning is clearer.
--- target/i386/sev-stub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/i386/sev-stub.c +2 -2
@@ -54,7 +54,7 @@ int sev_inject_launch_secret(const char *hdr, const char *secret,int sev_encrypt_flash (uint8_t *ptr,uint64_t len,Error **errp) { -return 0 ; +g_assert_not_reached (); }bool sev_es_enabled (void )
@@ -68,7 +68,7 @@ void sev_es_set_reset_vector(CPUState *cpu)int sev_es_save_reset_vector (void *flash_ptr,uint64_t flash_size) { -abort (); +g_assert_not_reached (); } SevAttestationReport *
Signature · 1 line
2.31.1
PATCH v2 9/23 target/i386/sev: sev_get_attestation_report use g_autofree
In reply to Philippe Mathieu-DaudéFrom: "Dr. David Alan Gilbert" <[email protected]>
Removes a whole bunch of g_free's and a goto.
Message-Id: <[email protected]>
--- target/i386/sev.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
target/i386/sev.c +3 -8
@@ -493,8 +493,8 @@ sev_get_attestation_report(const char *mnonce, Error **errp)struct kvm_sev_attestation_report input = {};SevAttestationReport *report =NULL ;SevGuestState *sev = sev_guest; -guchar *data; -guchar *buf; + g_autofree guchar *data = NULL; + g_autofree guchar *buf = NULL;gsize len;int err =0 , ret;
@@ -514,7 +514,6 @@ sev_get_attestation_report(const char *mnonce, Error **errp)if (len !=sizeof (input.mnonce)) {error_setg (errp,"SEV: mnonce must be %zu bytes (got %" G_GSIZE_FORMAT ")" ,sizeof (input.mnonce), len); -g_free (buf);return NULL ; }
@@ -525,7 +524,6 @@ sev_get_attestation_report(const char *mnonce, Error **errp)if (err !=SEV_RET_INVALID_LEN ) {error_setg (errp,"failed to query the attestation report length " "ret=%d fw_err=%d (%s)" , ret, err,fw_error_to_str (err)); -g_free (buf);return NULL ; } }
@@ -540,7 +538,7 @@ sev_get_attestation_report(const char *mnonce, Error **errp)if (ret) {error_setg_errno (errp, errno,"Failed to get attestation report" " ret=%d fw_err=%d (%s)" , ret, err,fw_error_to_str (err)); - goto e_free_data; +return NULL ; } report =g_new0 (SevAttestationReport,1 );
@@ -548,9 +546,6 @@ sev_get_attestation_report(const char *mnonce, Error **errp)trace_kvm_sev_attestation_report (mnonce, report->data); -e_free_data: -g_free (data); -g_free (buf);return report; }
Signature · 1 line
2.31.1
PATCH v2 10/23 target/i386/sev: Restrict SEV to system emulation
In reply to Philippe Mathieu-DaudéSEV is irrelevant on user emulation, so restrict it to sysemu. Some stubs are still required because used in cpu.c by x86_register_cpudef_types(), so move the sysemu specific stubs to sev-sysemu-stub.c instead. This will allow us to simplify monitor.c (which is not available in user emulation) in the next commit.
--- target/i386/sev-stub.c | 43 ------------------------- target/i386/sev-sysemu-stub.c | 60 +++++++++++++++++++++++++++++++++++ target/i386/meson.build | 4 ++- 3 files changed, 63 insertions(+), 44 deletions(-) create mode 100644 target/i386/sev-sysemu-stub.c
target/i386/sev-stub.c +0 -43
@@ -15,11 +15,6 @@#include "qapi/error.h" #include "sev_i386.h" -SevInfo *sev_get_info (void ) -{ -return NULL ; -} -bool sev_enabled (void ) {return false;
@@ -35,45 +30,7 @@ uint32_t sev_get_reduced_phys_bits(void)return 0 ; } -char *sev_get_launch_measurement (void ) -{ -return NULL ; -} - -SevCapability *sev_get_capabilities (Error **errp) -{ -error_setg (errp,"SEV is not available in this QEMU" ); -return NULL ; -} - -int sev_inject_launch_secret (const char *hdr,const char *secret, -uint64_t gpa,Error **errp) -{ -return 1 ; -} - -int sev_encrypt_flash (uint8_t *ptr,uint64_t len,Error **errp) -{ -g_assert_not_reached (); -} -bool sev_es_enabled (void ) {return false; } - -void sev_es_set_reset_vector (CPUState *cpu) -{ -} - -int sev_es_save_reset_vector (void *flash_ptr,uint64_t flash_size) -{ -g_assert_not_reached (); -} - -SevAttestationReport * -sev_get_attestation_report (const char *mnonce,Error **errp) -{ -error_setg (errp,"SEV is not available in this QEMU" ); -return NULL ; -}
target/i386/sev-sysemu-stub.c new file +60 -0
60 lines not on this page · raw message
target/i386/meson.build +3 -1
@@ -6,7 +6,7 @@ 'xsave_helper.c', 'cpu-dump.c', )) -i386_ss.add(when: 'CONFIG_SEV', if_true: files('host-cpu.c', 'sev.c'), if_false: files('sev-stub.c')) +i386_ss.add(when: 'CONFIG_SEV', if_true: files('host-cpu.c'), if_false: files('sev-stub.c')) # x86 cpu type i386_ss.add(when: 'CONFIG_KVM', if_true: files('host-cpu.c'))
@@ -20,6 +20,8 @@ 'monitor.c', 'cpu-sysemu.c', )) +i386_softmmu_ss.add(when: 'CONFIG_SEV', if_true: files('sev.c'), if_false: files('sev-sysemu-stub.c')) + i386_user_ss = ss.source_set() subdir('kvm')
Signature · 1 line
2.31.1
PATCH v2 11/23 target/i386/sev: Move qmp_query_sev_attestation_report() to sev.c
In reply to Philippe Mathieu-DaudéMove qmp_query_sev_attestation_report() from monitor.c to sev.c and make sev_get_attestation_report() static. We don't need the stub anymore, remove it.
--- target/i386/sev_i386.h | 2 -- target/i386/monitor.c | 6 ------ target/i386/sev-sysemu-stub.c | 6 +++--- target/i386/sev.c | 12 ++++++++++-- 4 files changed, 13 insertions(+), 13 deletions(-)
target/i386/sev_i386.h +0 -2
@@ -30,7 +30,5 @@ extern uint32_t sev_get_cbit_position(void);extern uint32_t sev_get_reduced_phys_bits (void );extern char *sev_get_launch_measurement (void );extern SevCapability *sev_get_capabilities (Error **errp); -extern SevAttestationReport * -sev_get_attestation_report (const char *mnonce,Error **errp);#endif
target/i386/monitor.c +0 -6
@@ -762,9 +762,3 @@ void qmp_sev_inject_launch_secret(const char *packet_hdr,sev_inject_launch_secret (packet_hdr, secret, gpa, errp); } - -SevAttestationReport * -qmp_query_sev_attestation_report (const char *mnonce,Error **errp) -{ -return sev_get_attestation_report (mnonce, errp); -}
target/i386/sev-sysemu-stub.c +3 -3
@@ -13,6 +13,7 @@#include "qemu/osdep.h" #include "qapi/qapi-commands-misc-target.h" +#include "qapi/qmp/qerror.h" #include "qapi/error.h" #include "sev_i386.h"
@@ -52,9 +53,8 @@ int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size)g_assert_not_reached (); } -SevAttestationReport *sev_get_attestation_report (const char *mnonce, -Error **errp) +SevAttestationReport *qmp_query_sev_attestation_report (const char *mnonce,Error **errp) { -error_setg (errp,"SEV is not available in this QEMU" ); +error_setg (errp,QERR_UNSUPPORTED );return NULL ; }
target/i386/sev.c +10 -2
@@ -31,6 +31,8 @@#include "migration/blocker.h" #include "qom/object.h" #include "monitor/monitor.h" +#include "qapi/qapi-commands-misc-target.h" +#include "qapi/qmp/qerror.h" #include "exec/confidential-guest-support.h" #include "hw/i386/pc.h"
@@ -487,8 +489,8 @@ out:return cap; } -SevAttestationReport * -sev_get_attestation_report (const char *mnonce,Error **errp) +static SevAttestationReport *sev_get_attestation_report (const char *mnonce, +Error **errp) {struct kvm_sev_attestation_report input = {};SevAttestationReport *report =NULL ;
@@ -549,6 +551,12 @@ sev_get_attestation_report(const char *mnonce, Error **errp)return report; } +SevAttestationReport *qmp_query_sev_attestation_report (const char *mnonce, +Error **errp) +{ +return sev_get_attestation_report (mnonce, errp); +} +static int sev_read_file_base64 (const char *filename,guchar **data,gsize *len) {
Signature · 1 line
2.31.1
PATCH v2 12/23 target/i386/sev: Move qmp_sev_inject_launch_secret() to sev.c
In reply to Philippe Mathieu-DaudéMove qmp_sev_inject_launch_secret() from monitor.c to sev.c and make sev_inject_launch_secret() static. We don't need the stub anymore, remove it.
--- target/i386/monitor.c | 31 ------------------------------- target/i386/sev-sysemu-stub.c | 6 +++--- target/i386/sev.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 34 deletions(-)
target/i386/monitor.c +0 -31
@@ -731,34 +731,3 @@ SevCapability *qmp_query_sev_capabilities(Error **errp) {return sev_get_capabilities (errp); } - -#define SEV_SECRET_GUID "4c2eb361-7d9b-4cc3-8081-127c90d3d294" -struct sev_secret_area { -uint32_t base; -uint32_t size; -}; - -void qmp_sev_inject_launch_secret (const char *packet_hdr, -const char *secret, -bool has_gpa,uint64_t gpa, -Error **errp) -{ -if (!sev_enabled ()) { -error_setg (errp,QERR_UNSUPPORTED ); -return ; - } -if (!has_gpa) { -uint8_t *data; -struct sev_secret_area *area; - -if (!pc_system_ovmf_table_find (SEV_SECRET_GUID , &data,NULL )) { -error_setg (errp,"SEV: no secret area found in OVMF," -" gpa must be specified." ); -return ; - } - area = (struct sev_secret_area *)data; - gpa = area->base; - } - -sev_inject_launch_secret (packet_hdr, secret, gpa, errp); -}
target/i386/sev-sysemu-stub.c +3 -3
@@ -33,10 +33,10 @@ SevCapability *sev_get_capabilities(Error **errp)return NULL ; } -int sev_inject_launch_secret (const char *hdr,const char *secret, -uint64_t gpa,Error **errp) +void qmp_sev_inject_launch_secret (const char *packet_header,const char *secret, +bool has_gpa,uint64_t gpa,Error **errp) { -return 1 ; +error_setg (errp,QERR_UNSUPPORTED ); }int sev_encrypt_flash (uint8_t *ptr,uint64_t len,Error **errp)
target/i386/sev.c +31 -0
@@ -955,6 +955,37 @@ int sev_inject_launch_secret(const char *packet_hdr, const char *secret,return 0 ; } +#define SEV_SECRET_GUID "4c2eb361-7d9b-4cc3-8081-127c90d3d294" +struct sev_secret_area { +uint32_t base; +uint32_t size; +}; + +void qmp_sev_inject_launch_secret (const char *packet_hdr, +const char *secret, +bool has_gpa,uint64_t gpa, +Error **errp) +{ +if (!sev_enabled ()) { +error_setg (errp,QERR_UNSUPPORTED ); +return ; + } +if (!has_gpa) { +uint8_t *data; +struct sev_secret_area *area; + +if (!pc_system_ovmf_table_find (SEV_SECRET_GUID , &data,NULL )) { +error_setg (errp,"SEV: no secret area found in OVMF," +" gpa must be specified." ); +return ; + } + area = (struct sev_secret_area *)data; + gpa = area->base; + } + +sev_inject_launch_secret (packet_hdr, secret, gpa, errp); +} +static int sev_es_parse_reset_block (SevInfoBlock *info,uint32_t *addr) {
Signature · 1 line
2.31.1
PATCH v2 13/23 target/i386/sev: Move qmp_query_sev_capabilities() to sev.c
In reply to Philippe Mathieu-DaudéMove qmp_query_sev_capabilities() from monitor.c to sev.c and make sev_get_capabilities() static. We don't need the stub anymore, remove it.
--- target/i386/sev_i386.h | 1 - target/i386/monitor.c | 5 ----- target/i386/sev-sysemu-stub.c | 4 ++-- target/i386/sev.c | 8 ++++++-- 4 files changed, 8 insertions(+), 10 deletions(-)
target/i386/sev_i386.h +0 -1
@@ -29,6 +29,5 @@ extern SevInfo *sev_get_info(void);extern uint32_t sev_get_cbit_position (void );extern uint32_t sev_get_reduced_phys_bits (void );extern char *sev_get_launch_measurement (void ); -extern SevCapability *sev_get_capabilities (Error **errp);#endif
target/i386/monitor.c +0 -5
@@ -726,8 +726,3 @@ SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp)return info; } - -SevCapability *qmp_query_sev_capabilities (Error **errp) -{ -return sev_get_capabilities (errp); -}
target/i386/sev-sysemu-stub.c +2 -2
@@ -27,9 +27,9 @@ char *sev_get_launch_measurement(void)return NULL ; } -SevCapability *sev_get_capabilities (Error **errp) +SevCapability *qmp_query_sev_capabilities (Error **errp) { -error_setg (errp,"SEV is not available in this QEMU" ); +error_setg (errp,QERR_UNSUPPORTED );return NULL ; }
target/i386/sev.c +6 -2
@@ -438,8 +438,7 @@ e_free:return 1 ; } -SevCapability * -sev_get_capabilities (Error **errp) +static SevCapability *sev_get_capabilities (Error **errp) {SevCapability *cap =NULL ;guchar *pdh_data =NULL ;
@@ -489,6 +488,11 @@ out:return cap; } +SevCapability *qmp_query_sev_capabilities (Error **errp) +{ +return sev_get_capabilities (errp); +} +static SevAttestationReport *sev_get_attestation_report (const char *mnonce,Error **errp) {
Signature · 1 line
2.31.1
PATCH v2 14/23 target/i386/sev: Move qmp_query_sev_launch_measure() to sev.c
In reply to Philippe Mathieu-DaudéMove qmp_query_sev_launch_measure() from monitor.c to sev.c and make sev_get_launch_measurement() static. We don't need the stub anymore, remove it.
--- target/i386/sev_i386.h | 1 - target/i386/monitor.c | 17 ----------------- target/i386/sev-sysemu-stub.c | 3 ++- target/i386/sev.c | 20 ++++++++++++++++++-- 4 files changed, 20 insertions(+), 21 deletions(-)
target/i386/sev_i386.h +0 -1
@@ -28,6 +28,5 @@ extern bool sev_es_enabled(void);extern SevInfo *sev_get_info (void );extern uint32_t sev_get_cbit_position (void );extern uint32_t sev_get_reduced_phys_bits (void ); -extern char *sev_get_launch_measurement (void );#endif
target/i386/monitor.c +0 -17
@@ -709,20 +709,3 @@ void hmp_info_sev(Monitor *mon, const QDict *qdict)qapi_free_SevInfo (info); } - -SevLaunchMeasureInfo *qmp_query_sev_launch_measure (Error **errp) -{ -char *data; -SevLaunchMeasureInfo *info; - - data =sev_get_launch_measurement (); -if (!data) { -error_setg (errp,"Measurement is not available" ); -return NULL ; - } - - info =g_malloc0 (sizeof (*info)); - info->data = data; - -return info; -}
target/i386/sev-sysemu-stub.c +2 -1
@@ -22,8 +22,9 @@ SevInfo *sev_get_info(void)return NULL ; } -char *sev_get_launch_measurement (void ) +SevLaunchMeasureInfo *qmp_query_sev_launch_measure (Error **errp) { +error_setg (errp,QERR_UNSUPPORTED );return NULL ; }
target/i386/sev.c +18 -2
@@ -718,8 +718,7 @@ free_measurement:g_free (measurement); } -char * -sev_get_launch_measurement (void ) +static char *sev_get_launch_measurement (void ) {if (sev_guest && sev_guest->state >=SEV_STATE_LAUNCH_SECRET ) {
@@ -729,6 +728,23 @@ sev_get_launch_measurement(void)return NULL ; } +SevLaunchMeasureInfo *qmp_query_sev_launch_measure (Error **errp) +{ +char *data; +SevLaunchMeasureInfo *info; + + data =sev_get_launch_measurement (); +if (!data) { +error_setg (errp,"Measurement is not available" ); +return NULL ; + } + + info =g_malloc0 (sizeof (*info)); + info->data = data; + +return info; +} +static Notifier sev_machine_done_notify = { .notify = sev_launch_get_measure, };
Signature · 1 line
2.31.1
PATCH v2 15/23 target/i386/sev: Move qmp_query_sev() & hmp_info_sev() to sev.c
In reply to Philippe Mathieu-DaudéMove qmp_query_sev() & hmp_info_sev()() from monitor.c to sev.c and make sev_get_info() static. We don't need the stub anymore, remove it. Add a stub for hmp_info_sev().
---
Note: what is left in sev_i386.h eventually belong to "sysemu/sev.h"
meaning we could remove this local header.
--- target/i386/sev_i386.h | 2 -- target/i386/monitor.c | 37 --------------------------------- target/i386/sev-sysemu-stub.c | 10 ++++++++- target/i386/sev.c | 39 +++++++++++++++++++++++++++++++++-- 4 files changed, 46 insertions(+), 42 deletions(-)
target/i386/sev_i386.h +0 -2
@@ -15,7 +15,6 @@#define QEMU_SEV_I386_H #include "sysemu/sev.h" -#include "qapi/qapi-types-misc-target.h" #define SEV_POLICY_NODBG 0x1#define SEV_POLICY_NOKS 0x2
@@ -25,7 +24,6 @@#define SEV_POLICY_SEV 0x20extern bool sev_es_enabled (void ); -extern SevInfo *sev_get_info (void );extern uint32_t sev_get_cbit_position (void );extern uint32_t sev_get_reduced_phys_bits (void );
target/i386/monitor.c +0 -37
@@ -28,11 +28,8 @@#include "monitor/hmp-target.h" #include "monitor/hmp.h" #include "qapi/qmp/qdict.h" -#include "qapi/qmp/qerror.h" #include "sysemu/kvm.h" -#include "sysemu/sev.h" #include "qapi/error.h" -#include "sev_i386.h" #include "qapi/qapi-commands-misc-target.h" #include "qapi/qapi-commands-misc.h" #include "hw/i386/pc.h"
@@ -675,37 +672,3 @@ void hmp_info_io_apic(Monitor *mon, const QDict *qdict)monitor_printf (mon,"This command is obsolete and will be " "removed soon. Please use 'info pic' instead.\n" ); } - -SevInfo *qmp_query_sev (Error **errp) -{ -SevInfo *info; - - info =sev_get_info (); -if (!info) { -error_setg (errp,"SEV feature is not available" ); -return NULL ; - } - -return info; -} - -void hmp_info_sev (Monitor *mon,const QDict *qdict) -{ -SevInfo *info =sev_get_info (); - -if (info && info->enabled) { -monitor_printf (mon,"handle: %d\n" , info->handle); -monitor_printf (mon,"state: %s\n" ,SevState_str (info->state)); -monitor_printf (mon,"build: %d\n" , info->build_id); -monitor_printf (mon,"api version: %d.%d\n" , - info->api_major, info->api_minor); -monitor_printf (mon,"debug: %s\n" , - info->policy &SEV_POLICY_NODBG ?"off" :"on" ); -monitor_printf (mon,"key-sharing: %s\n" , - info->policy &SEV_POLICY_NOKS ?"off" :"on" ); - }else { -monitor_printf (mon,"SEV is not enabled\n" ); - } - -qapi_free_SevInfo (info); -}
target/i386/sev-sysemu-stub.c +9 -1
@@ -12,13 +12,16 @@*/ #include "qemu/osdep.h" +#include "monitor/monitor.h" +#include "monitor/hmp.h" #include "qapi/qapi-commands-misc-target.h" #include "qapi/qmp/qerror.h" #include "qapi/error.h" #include "sev_i386.h" -SevInfo *sev_get_info (void ) +SevInfo *qmp_query_sev (Error **errp) { +error_setg (errp,QERR_UNSUPPORTED );return NULL ; }
@@ -59,3 +62,8 @@ SevAttestationReport *qmp_query_sev_attestation_report(const char *mnonce, Errorerror_setg (errp,QERR_UNSUPPORTED );return NULL ; } + +void hmp_info_sev (Monitor *mon,const QDict *qdict) +{ +monitor_printf (mon,"SEV is not available in this QEMU\n" ); +}
target/i386/sev.c +37 -2
@@ -27,10 +27,12 @@#include "sev_i386.h" #include "sysemu/sysemu.h" #include "sysemu/runstate.h" +#include "sysemu/sev.h" #include "trace.h" #include "migration/blocker.h" #include "qom/object.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" #include "qapi/qapi-commands-misc-target.h" #include "qapi/qmp/qerror.h" #include "exec/confidential-guest-support.h"
@@ -375,8 +377,7 @@ sev_get_reduced_phys_bits(void)return sev_guest ? sev_guest->reduced_phys_bits :0 ; } -SevInfo * -sev_get_info (void ) +static SevInfo *sev_get_info (void ) {SevInfo *info;
@@ -395,6 +396,40 @@ sev_get_info(void)return info; } +SevInfo *qmp_query_sev (Error **errp) +{ +SevInfo *info; + + info =sev_get_info (); +if (!info) { +error_setg (errp,"SEV feature is not available" ); +return NULL ; + } + +return info; +} + +void hmp_info_sev (Monitor *mon,const QDict *qdict) +{ +SevInfo *info =sev_get_info (); + +if (info && info->enabled) { +monitor_printf (mon,"handle: %d\n" , info->handle); +monitor_printf (mon,"state: %s\n" ,SevState_str (info->state)); +monitor_printf (mon,"build: %d\n" , info->build_id); +monitor_printf (mon,"api version: %d.%d\n" , + info->api_major, info->api_minor); +monitor_printf (mon,"debug: %s\n" , + info->policy &SEV_POLICY_NODBG ?"off" :"on" ); +monitor_printf (mon,"key-sharing: %s\n" , + info->policy &SEV_POLICY_NOKS ?"off" :"on" ); + }else { +monitor_printf (mon,"SEV is not enabled\n" ); + } + +qapi_free_SevInfo (info); +} +static int sev_get_pdh_info (int fd,guchar **pdh,size_t *pdh_len,guchar **cert_chain,size_t *cert_chain_len,Error **errp)
Signature · 1 line
2.31.1
PATCH v2 16/23 monitor: Restrict 'info sev' to x86 targets
In reply to Philippe Mathieu-Daudé--- include/monitor/hmp-target.h | 1 + include/monitor/hmp.h | 1 - target/i386/sev-sysemu-stub.c | 2 +- target/i386/sev.c | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-)
include/monitor/hmp-target.h +1 -0
@@ -49,5 +49,6 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict);void hmp_mce (Monitor *mon,const QDict *qdict);void hmp_info_local_apic (Monitor *mon,const QDict *qdict);void hmp_info_io_apic (Monitor *mon,const QDict *qdict); +void hmp_info_sev (Monitor *mon,const QDict *qdict);#endif /* MONITOR_HMP_TARGET_H */
include/monitor/hmp.h +0 -1
@@ -124,7 +124,6 @@ void hmp_info_ramblock(Monitor *mon, const QDict *qdict);void hmp_hotpluggable_cpus (Monitor *mon,const QDict *qdict);void hmp_info_vm_generation_id (Monitor *mon,const QDict *qdict);void hmp_info_memory_size_summary (Monitor *mon,const QDict *qdict); -void hmp_info_sev (Monitor *mon,const QDict *qdict);void hmp_info_replay (Monitor *mon,const QDict *qdict);void hmp_replay_break (Monitor *mon,const QDict *qdict);void hmp_replay_delete_break (Monitor *mon,const QDict *qdict);
target/i386/sev-sysemu-stub.c +1 -1
@@ -13,7 +13,7 @@#include "qemu/osdep.h" #include "monitor/monitor.h" -#include "monitor/hmp.h" +#include "monitor/hmp-target.h" #include "qapi/qapi-commands-misc-target.h" #include "qapi/qmp/qerror.h" #include "qapi/error.h"
target/i386/sev.c +1 -1
@@ -32,7 +32,7 @@#include "migration/blocker.h" #include "qom/object.h" #include "monitor/monitor.h" -#include "monitor/hmp.h" +#include "monitor/hmp-target.h" #include "qapi/qapi-commands-misc-target.h" #include "qapi/qmp/qerror.h" #include "exec/confidential-guest-support.h"
Signature · 1 line
2.31.1
PATCH v2 17/23 hw/i386/acpi-common: Remove unused includes
In reply to Philippe Mathieu-Daudé--- hw/i386/acpi-common.c | 5 ----- 1 file changed, 5 deletions(-)
hw/i386/acpi-common.c +0 -5
@@ -21,15 +21,10 @@*/ #include "qemu/osdep.h" -#include "qapi/error.h" - -#include "exec/memory.h" #include "hw/acpi/acpi.h" #include "hw/acpi/aml-build.h" -#include "hw/acpi/utils.h" #include "hw/i386/pc.h" #include "target/i386/cpu.h" -#include "acpi-build.h" #include "acpi-common.h"
Signature · 1 line
2.31.1
PATCH v2 18/23 hw/i386: Rename acpi-build.c -> acpi-pc.c
In reply to Philippe Mathieu-DaudéThe acpi-build.c file contains routines common to the QEMU "PC" machines (Q35+ICH & i440FX+PIIX), rename it as acpi-pc.c.
---
hw/i386/{acpi-build.c => acpi-pc.c} | 0
hw/i386/meson.build | 2 +-
2 files changed, 1 insertion(+), 1 deletion(-)
rename hw/i386/{acpi-build.c => acpi-pc.c} (100%)hw/i386/acpi-pc.c renamed from hw/i386/acpi-build.c +0 -0
hw/i386/meson.build +1 -1
@@ -22,7 +22,7 @@ i386_ss.add(when: 'CONFIG_PC', if_true: files( 'pc.c', 'pc_sysfw.c', - 'acpi-build.c', + 'acpi-pc.c', 'port92.c')) subdir('kvm')
Signature · 1 line
2.31.1
PATCH v2 19/23 hw/i386: Move pc_madt_cpu_entry() to acpi-pc.c
In reply to Philippe Mathieu-Daudépc_madt_cpu_entry() is specific to QEMU 'PC' machines, move it to acpi-pc.c.
--- hw/i386/acpi-common.c | 40 ---------------------------------------- hw/i386/acpi-pc.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 40 deletions(-)
hw/i386/acpi-common.c +0 -40
@@ -23,49 +23,10 @@#include "qemu/osdep.h" #include "hw/acpi/acpi.h" #include "hw/acpi/aml-build.h" -#include "hw/i386/pc.h" #include "target/i386/cpu.h" #include "acpi-build.h" #include "acpi-common.h" -void pc_madt_cpu_entry (AcpiDeviceIf *adev,int uid, -const CPUArchIdList *apic_ids,GArray *entry) -{ -uint32_t apic_id = apic_ids->cpus[uid].arch_id; - -/* ACPI spec says that LAPIC entry for non present -* CPU may be omitted from MADT or it must be marked -* as disabled. However omitting non present CPU from -* MADT breaks hotplug on linux. So possible CPUs -* should be put in MADT but kept disabled. -*/ -if (apic_id <255 ) { -AcpiMadtProcessorApic *apic =acpi_data_push (entry,sizeof *apic); - - apic->type =ACPI_APIC_PROCESSOR ; - apic->length =sizeof (*apic); - apic->processor_id = uid; - apic->local_apic_id = apic_id; -if (apic_ids->cpus[uid].cpu !=NULL ) { - apic->flags =cpu_to_le32 (1 ); - }else { - apic->flags =cpu_to_le32 (0 ); - } - }else { -AcpiMadtProcessorX2Apic *apic =acpi_data_push (entry,sizeof *apic); - - apic->type =ACPI_APIC_LOCAL_X2APIC ; - apic->length =sizeof (*apic); - apic->uid =cpu_to_le32 (uid); - apic->x2apic_id =cpu_to_le32 (apic_id); -if (apic_ids->cpus[uid].cpu !=NULL ) { - apic->flags =cpu_to_le32 (1 ); - }else { - apic->flags =cpu_to_le32 (0 ); - } - } -} -void acpi_build_madt (GArray *table_data,BIOSLinker *linker,X86MachineState *x86ms,AcpiDeviceIf *adev,const char *oem_id,const char *oem_table_id)
@@ -155,4 +116,3 @@ void acpi_build_madt(GArray *table_data, BIOSLinker *linker, (void *)(table_data->data + madt_start),"APIC" , table_data->len - madt_start, 1, oem_id, oem_table_id); } -
hw/i386/acpi-pc.c +39 -0
@@ -2707,3 +2707,42 @@ void acpi_setup(void)*/ acpi_build_tables_cleanup (&tables, false); } + +void pc_madt_cpu_entry (AcpiDeviceIf *adev,int uid, +const CPUArchIdList *apic_ids,GArray *entry) +{ +uint32_t apic_id = apic_ids->cpus[uid].arch_id; + +/* +* ACPI spec says that LAPIC entry for non present +* CPU may be omitted from MADT or it must be marked +* as disabled. However omitting non present CPU from +* MADT breaks hotplug on linux. So possible CPUs +* should be put in MADT but kept disabled. +*/ +if (apic_id <255 ) { +AcpiMadtProcessorApic *apic =acpi_data_push (entry,sizeof *apic); + + apic->type =ACPI_APIC_PROCESSOR ; + apic->length =sizeof (*apic); + apic->processor_id = uid; + apic->local_apic_id = apic_id; +if (apic_ids->cpus[uid].cpu !=NULL ) { + apic->flags =cpu_to_le32 (1 ); + }else { + apic->flags =cpu_to_le32 (0 ); + } + }else { +AcpiMadtProcessorX2Apic *apic =acpi_data_push (entry,sizeof *apic); + + apic->type =ACPI_APIC_LOCAL_X2APIC ; + apic->length =sizeof (*apic); + apic->uid =cpu_to_le32 (uid); + apic->x2apic_id =cpu_to_le32 (apic_id); +if (apic_ids->cpus[uid].cpu !=NULL ) { + apic->flags =cpu_to_le32 (1 ); + }else { + apic->flags =cpu_to_le32 (0 ); + } + } +}
Signature · 1 line
2.31.1
Re: [PATCH v2 19/23] hw/i386: Move pc_madt_cpu_entry() to acpi-pc.c
Quoted 7 lines · On Wed, 16 Jun 2021 22:43:24 +0200 Philippe Mathieu-Daudé <[email protected]>…
pc_madt_cpu_entry()is specific to QEMU 'PC' machines, move it toacpi-pc.c.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/i386/acpi-common.c | 40 ---------------------------------------- hw/i386/acpi-pc.c | 39 +++++++++++++++++++++++++++++++++++++++
it's used not only by PC machines but also microvm, which didn't use acpi-build.c (aka acpi-pc.c) it only links fine by virtue that PC machines are object files are also included.
Quoted 108 lines
2 files changed, 39 insertions(+), 40 deletions(-)hw/i386/acpi-common.c +0
-40@@ -23,49 +23,10 @@#include "qemu/osdep.h" #include "hw/acpi/acpi.h" #include "hw/acpi/aml-build.h" -#include "hw/i386/pc.h" #include "target/i386/cpu.h" #include "acpi-build.h" #include "acpi-common.h" -void pc_madt_cpu_entry (AcpiDeviceIf *adev,int uid, -const CPUArchIdList *apic_ids,GArray *entry) -{ -uint32_t apic_id = apic_ids->cpus[uid].arch_id; - -/* ACPI spec says that LAPIC entry for non present -* CPU may be omitted from MADT or it must be marked -* as disabled. However omitting non present CPU from -* MADT breaks hotplug on linux. So possible CPUs -* should be put in MADT but kept disabled. -*/ -if (apic_id <255 ) { -AcpiMadtProcessorApic *apic =acpi_data_push (entry,sizeof *apic); - - apic->type =ACPI_APIC_PROCESSOR ; - apic->length =sizeof (*apic); - apic->processor_id = uid; - apic->local_apic_id = apic_id; -if (apic_ids->cpus[uid].cpu !=NULL ) { - apic->flags =cpu_to_le32 (1 ); - }else { - apic->flags =cpu_to_le32 (0 ); - } - }else { -AcpiMadtProcessorX2Apic *apic =acpi_data_push (entry,sizeof *apic); - - apic->type =ACPI_APIC_LOCAL_X2APIC ; - apic->length =sizeof (*apic); - apic->uid =cpu_to_le32 (uid); - apic->x2apic_id =cpu_to_le32 (apic_id); -if (apic_ids->cpus[uid].cpu !=NULL ) { - apic->flags =cpu_to_le32 (1 ); - }else { - apic->flags =cpu_to_le32 (0 ); - } - } -} -void acpi_build_madt (GArray *table_data,BIOSLinker *linker,X86MachineState *x86ms,AcpiDeviceIf *adev,const char *oem_id,const char *oem_table_id)@@ -155,4 +116,3 @@ void acpi_build_madt(GArray *table_data, BIOSLinker *linker, (void *)(table_data->data + madt_start),"APIC" , table_data->len - madt_start, 1, oem_id, oem_table_id); } -hw/i386/acpi-pc.c +39
-0@@ -2707,3 +2707,42 @@ void acpi_setup(void)*/ acpi_build_tables_cleanup (&tables, false); } + +void pc_madt_cpu_entry (AcpiDeviceIf *adev,int uid, +const CPUArchIdList *apic_ids,GArray *entry) +{ +uint32_t apic_id = apic_ids->cpus[uid].arch_id; + +/* +* ACPI spec says that LAPIC entry for non present +* CPU may be omitted from MADT or it must be marked +* as disabled. However omitting non present CPU from +* MADT breaks hotplug on linux. So possible CPUs +* should be put in MADT but kept disabled. +*/ +if (apic_id <255 ) { +AcpiMadtProcessorApic *apic =acpi_data_push (entry,sizeof *apic); + + apic->type =ACPI_APIC_PROCESSOR ; + apic->length =sizeof (*apic); + apic->processor_id = uid; + apic->local_apic_id = apic_id; +if (apic_ids->cpus[uid].cpu !=NULL ) { + apic->flags =cpu_to_le32 (1 ); + }else { + apic->flags =cpu_to_le32 (0 ); + } + }else { +AcpiMadtProcessorX2Apic *apic =acpi_data_push (entry,sizeof *apic); + + apic->type =ACPI_APIC_LOCAL_X2APIC ; + apic->length =sizeof (*apic); + apic->uid =cpu_to_le32 (uid); + apic->x2apic_id =cpu_to_le32 (apic_id); +if (apic_ids->cpus[uid].cpu !=NULL ) { + apic->flags =cpu_to_le32 (1 ); + }else { + apic->flags =cpu_to_le32 (0 ); + } + } +}
Re: [PATCH v2 19/23] hw/i386: Move pc_madt_cpu_entry() to acpi-pc.c
Quoted 11 lines · Igor Mammedov
Quoted 7 lines · On Wed, 16 Jun 2021 22:43:24 +0200 Philippe Mathieu-Daudé <[email protected]>…
pc_madt_cpu_entry()is specific to QEMU 'PC' machines, move it toacpi-pc.c.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/i386/acpi-common.c | 40 ---------------------------------------- hw/i386/acpi-pc.c | 39 +++++++++++++++++++++++++++++++++++++++
Quoted 4 lines
it's used not only by PC machines but also microvm, which didn't use
acpi-build.c(akaacpi-pc.c) it only links fine by virtue that PC machines are object files are also included.
Is that something new? I can't see this in mainstream, the microvm machine builds fine without this code.
Re: [PATCH v2 19/23] hw/i386: Move pc_madt_cpu_entry() to acpi-pc.c
Quoted 12 lines · Philippe Mathieu-Daudé
Quoted 11 lines · Igor Mammedov
Quoted 7 lines · On Wed, 16 Jun 2021 22:43:24 +0200 Philippe Mathieu-Daudé <[email protected]>…
pc_madt_cpu_entry()is specific to QEMU 'PC' machines, move it toacpi-pc.c.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/i386/acpi-common.c | 40 ---------------------------------------- hw/i386/acpi-pc.c | 39 +++++++++++++++++++++++++++++++++++++++
Quoted 7 lines
Quoted 4 lines
it's used not only by PC machines but also microvm, which didn't use
acpi-build.c(akaacpi-pc.c) it only links fine by virtue that PC machines are object files are also included.Is that something new? I can't see this in mainstream, the microvm machine builds fine without this code.
I think Igor means this:
hw/i386/generic_event_device_x86.c: adevc->madt_cpu = pc_madt_cpu_entry;
and
hw/i386/microvm.c: DeviceState *dev = qdev_new(TYPE_ACPI_GED_X86);
Admittedly given it's not limited to pc the function name is wrong ...
Signature · 1 line
MST
Re: [PATCH v2 19/23] hw/i386: Move pc_madt_cpu_entry() to acpi-pc.c
Quoted 21 lines · Michael S. Tsirkin
Quoted 12 lines · Philippe Mathieu-Daudé
Quoted 11 lines · Igor Mammedov
Quoted 7 lines · On Wed, 16 Jun 2021 22:43:24 +0200 Philippe Mathieu-Daudé <[email protected]>…
pc_madt_cpu_entry()is specific to QEMU 'PC' machines, move it toacpi-pc.c.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/i386/acpi-common.c | 40 ---------------------------------------- hw/i386/acpi-pc.c | 39 +++++++++++++++++++++++++++++++++++++++Quoted 7 lines
Quoted 4 lines
it's used not only by PC machines but also microvm, which didn't use
acpi-build.c(akaacpi-pc.c) it only links fine by virtue that PC machines are object files are also included.Is that something new? I can't see this in mainstream, the microvm machine builds fine without this code.
Quoted 7 lines
I think Igor means this:
hw/i386/generic_event_device_x86.c:adevc->madt_cpu=pc_madt_cpu_entry;and
hw/i386/microvm.c: DeviceState *dev =qdev_new(TYPE_ACPI_GED_X86);
Oh I missed that, indeed I didn't runtime test.
Thanks Michael.
Quoted 2 lines
Admittedly given it's not limited to pc the function name is wrong ...
PATCH v2 20/23 hw/acpi: Do not restrict ACPI core routines to x86 architecture
In reply to Philippe Mathieu-DaudéACPI core routines (in core.c) are not really x86-specific.
--- hw/acpi/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/acpi/meson.build +2 -1
@@ -3,6 +3,7 @@ 'acpi_interface.c', 'aml-build.c', 'bios-linker-loader.c', + 'core.c', 'utils.c', )) acpi_ss.add(when: 'CONFIG_ACPI_CPU_HOTPLUG', if_true: files('cpu.c'))
@@ -14,7 +15,7 @@ acpi_ss.add(when: 'CONFIG_ACPI_HW_REDUCED', if_true: files('generic_event_device.c')) acpi_ss.add(when: 'CONFIG_ACPI_HMAT', if_true: files('hmat.c')) acpi_ss.add(when: 'CONFIG_ACPI_APEI', if_true: files('ghes.c')) -acpi_ss.add(when: 'CONFIG_ACPI_X86', if_true: files('core.c', 'piix4.c', 'pcihp.c'), if_false: files('acpi-stub.c')) +acpi_ss.add(when: 'CONFIG_ACPI_X86', if_true: files('piix4.c', 'pcihp.c')) acpi_ss.add(when: 'CONFIG_ACPI_X86_ICH', if_true: files('ich9.c', 'tco.c')) acpi_ss.add(when: 'CONFIG_IPMI', if_true: files('ipmi.c'), if_false: files('ipmi-stub.c')) acpi_ss.add(when: 'CONFIG_PC', if_false: files('acpi-x86-stub.c'))
Signature · 1 line
2.31.1
Re: [PATCH v2 20/23] hw/acpi: Do not restrict ACPI core routines to x86 architecture
Quoted 20 lines · Philippe Mathieu-Daudé
ACPI core routines (in
core.c) are not really x86-specific.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/acpi/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)hw/acpi/meson.build +1
-0@@ -3,6 +3,7 @@ 'acpi_interface.c', 'aml-build.c', 'bios-linker-loader.c', + 'core.c', 'utils.c', )) acpi_ss.add(when: 'CONFIG_ACPI_CPU_HOTPLUG', if_true: files('cpu.c'))
hw/acpi/meson.build line 18
Quoted 5 lines
hw/acpi/meson.build +1
-1@@ -14,7 +15,7 @@ acpi_ss.add(when: 'CONFIG_ACPI_HW_REDUCED', if_true: files('generic_event_device.c')) acpi_ss.add(when: 'CONFIG_ACPI_HMAT', if_true: files('hmat.c')) acpi_ss.add(when: 'CONFIG_ACPI_APEI', if_true: files('ghes.c')) -acpi_ss.add(when: 'CONFIG_ACPI_X86', if_true: files('core.c', 'piix4.c', 'pcihp.c'), if_false: files('acpi-stub.c')) +acpi_ss.add(when: 'CONFIG_ACPI_X86', if_true: files('piix4.c', 'pcihp.c'))
So is acpi-stub.c still useful then?
Quoted 5 lines
hw/acpi/meson.build +0
-0acpi_ss.add(when: 'CONFIG_ACPI_X86_ICH', if_true: files('ich9.c', 'tco.c')) acpi_ss.add(when: 'CONFIG_IPMI', if_true: files('ipmi.c'), if_false: files('ipmi-stub.c')) acpi_ss.add(when: 'CONFIG_PC', if_false: files('acpi-x86-stub.c'))Signature · 1 line
2.31.1
Re: [PATCH v2 20/23] hw/acpi: Do not restrict ACPI core routines to x86 architecture
Quoted 21 lines · Michael S. Tsirkin
Quoted 20 lines · Philippe Mathieu-Daudé
ACPI core routines (in
core.c) are not really x86-specific.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/acpi/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)hw/acpi/meson.build +1
-0@@ -3,6 +3,7 @@ 'acpi_interface.c', 'aml-build.c', 'bios-linker-loader.c', + 'core.c', 'utils.c', )) acpi_ss.add(when: 'CONFIG_ACPI_CPU_HOTPLUG', if_true: files('cpu.c'))@@ -14,7 +15,7 @@
Quoted 8 lines
hw/acpi/meson.build line 18
Quoted 5 lines
hw/acpi/meson.build +1
-1acpi_ss.add(when: 'CONFIG_ACPI_HW_REDUCED', if_true: files('generic_event_device.c')) acpi_ss.add(when: 'CONFIG_ACPI_HMAT', if_true: files('hmat.c')) acpi_ss.add(when: 'CONFIG_ACPI_APEI', if_true: files('ghes.c')) -acpi_ss.add(when: 'CONFIG_ACPI_X86', if_true: files('core.c', 'piix4.c', 'pcihp.c'), if_false: files('acpi-stub.c')) +acpi_ss.add(when: 'CONFIG_ACPI_X86', if_true: files('piix4.c', 'pcihp.c'))So is
acpi-stub.cstill useful then?
Certainly:
softmmu/vl.c:3256: acpi_table_add(opts, &error_fatal);
Could be eventually merged with aml-build-stub.c...
PATCH v2 21/23 hw/i386: Introduce X86_FW_OVMF Kconfig symbol
In reply to Philippe Mathieu-DaudéIntroduce the X86_FW_OVMF Kconfig symbol for OVMF-specific code. Move the OVMF-specific code from pc_sysfw.c to pc_sysfw_ovmf.c, adding a pair of stubs.
Update MAINTAINERS to reach OVMF maintainers when these new files are modified.
This fixes when building the microvm machine standalone:
/usr/bin/ld: libqemu-i386-softmmu.fa.p/target_i386_monitor.c.o: in function `qmp_sev_inject_launch_secret':
target/i386/monitor.c:749: undefined reference to `pc_system_ovmf_table_find'
---
Note:
1/ Obviously the MAINTAINERS change is pending Laszlo Ack.
2/ Various declarations from "hw/i386/pc.h" actually belong
to a local header in hw/i386/, such pc_system_parse_ovmf_flash().
--- include/hw/i386/pc.h | 1 + hw/i386/pc_sysfw.c | 107 --------------------------- hw/i386/pc_sysfw_ovmf-stubs.c | 26 +++++++ hw/i386/pc_sysfw_ovmf.c | 135 ++++++++++++++++++++++++++++++++++ MAINTAINERS | 1 + hw/i386/Kconfig | 4 + hw/i386/meson.build | 2 + 7 files changed, 169 insertions(+), 107 deletions(-) create mode 100644 hw/i386/pc_sysfw_ovmf-stubs.c create mode 100644 hw/i386/pc_sysfw_ovmf.c
include/hw/i386/pc.h +1 -0
@@ -191,6 +191,7 @@ void pc_system_flash_cleanup_unused(PCMachineState *pcms);void pc_system_firmware_init (PCMachineState *pcms,MemoryRegion *rom_memory);bool pc_system_ovmf_table_find (const char *entry,uint8_t **data,int *data_len); +void pc_system_parse_ovmf_flash (uint8_t *flash_ptr,size_t flash_size);/* acpi-build.c */
hw/i386/pc_sysfw.c +0 -107
113 lines not on this page · raw message
hw/i386/pc_sysfw_ovmf-stubs.c new file +26 -0
@@ -0,0 +1,26 @@ +/* +* QEMU PC System Firmware (OVMF stubs) +* +* Copyright (c) 2021 Red Hat, Inc. +* +* Author: +* Philippe Mathieu-Daudé <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0-or-later +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +*/ + +#include "qemu/osdep.h" +#include "hw/i386/pc.h" + +bool pc_system_ovmf_table_find (const char *entry,uint8_t **data,int *data_len) +{ +g_assert_not_reached (); +} + +void pc_system_parse_ovmf_flash (uint8_t *flash_ptr,size_t flash_size) +{ +g_assert_not_reached (); +}
hw/i386/pc_sysfw_ovmf.c new file +135 -0
135 lines not on this page · raw message
MAINTAINERS +1 -0
@@ -2900,6 +2900,7 @@ EDK2 Firmware M: Laszlo Ersek <[email protected]> M: Philippe Mathieu-Daudé <[email protected]> S: Supported +F: hw/i386/*ovmf* F: pc-bios/descriptors/??-edk2-*.json F: pc-bios/edk2-* F: roms/Makefile.edk2
hw/i386/Kconfig +4 -0
@@ -1,5 +1,9 @@ +config X86_FW_OVMF + bool + config SEV bool + select X86_FW_OVMF depends on KVM config PC
hw/i386/meson.build +2 -0
@@ -24,6 +24,8 @@ 'pc_sysfw.c', 'acpi-pc.c', 'port92.c')) +i386_ss.add(when: 'CONFIG_X86_FW_OVMF', if_true: files('pc_sysfw_ovmf.c'), + if_false: files('pc_sysfw_ovmf-stubs.c')) subdir('kvm') subdir('xen')
Signature · 1 line
2.31.1
Re: [PATCH v2 21/23] hw/i386: Introduce X86_FW_OVMF Kconfig symbol
Quoted 6 lines · Philippe Mathieu-Daudé
Introduce the
X86_FW_OVMFKconfigsymbol for OVMF-specific code. Move the OVMF-specific code frompc_sysfw.ctopc_sysfw_ovmf.c, adding a pair of stubs.
UpdateMAINTAINERSto reach OVMF maintainers when these new files are modified.
Quoted 8 lines
This fixes when building the microvm machine standalone:
/usr/bin/ld:libqemu-i386-softmmu.fa.p/target_i386_monitor.c.o: in function `qmp_sev_inject_launch_secret':
target/i386/monitor.c:749: undefined reference to `pc_system_ovmf_table_find'Fixes f522cef9b35 ("sev: update sev-inject-launch-secret to make gpa optional")Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks, queued to fw-edk2 tree.
PATCH v2 22/23 hw/acpi/Kconfig: Add missing Kconfig dependencies (build error)
In reply to Philippe Mathieu-DaudéThe 'microvm' machine misses various dependencies:
/usr/bin/ld: libqemu-i386-softmmu.fa.p/hw_i386_acpi-microvm.c.o: in function `acpi_setup_microvm':
hw/i386/acpi-microvm.c:247: undefined reference to acpi_build_tables_init' /usr/bin/ld: libqemu-i386-softmmu.fa.p/hw_i386_acpi-microvm.c.o: in function acpi_build_microvm':
hw/i386/acpi-microvm.c:192: undefined reference to bios_linker_loader_alloc' /usr/bin/ld: libqemu-i386-softmmu.fa.p/hw_i386_acpi-microvm.c.o: in function build_dsdt_microvm':
hw/i386/acpi-microvm.c:121: undefined reference to init_aml_allocator' /usr/bin/ld: hw/i386/acpi-microvm.c:124: undefined reference to acpi_data_push' /usr/bin/ld: hw/i386/acpi-microvm.c:126: undefined reference to aml_scope' /usr/bin/ld: hw/i386/acpi-microvm.c:129: undefined reference to build_ged_aml' /usr/bin/ld: hw/i386/acpi-microvm.c:131: undefined reference to acpi_dsdt_add_power_button' /usr/bin/ld: libqemu-i386-softmmu.fa.p/hw_i386_acpi-microvm.c.o: in function acpi_dsdt_add_virtio':
hw/i386/acpi-microvm.c:77: undefined reference to `aml_string'
/usr/bin/ld: libqemu-i386-softmmu.fa.p/hw_i386_acpi-microvm.c.o: in function `build_dsdt_microvm':
hw/i386/acpi-microvm.c:138: undefined reference to `aml_scope'
/usr/bin/ld: hw/i386/acpi-microvm.c:149: undefined reference to build_header' /usr/bin/ld: hw/i386/acpi-microvm.c:152: undefined reference to free_aml_allocator' /usr/bin/ld: libqemu-i386-softmmu.fa.p/hw_i386_acpi-microvm.c.o: in function `acpi_build_microvm':
hw/i386/acpi-microvm.c:202: undefined reference to `acpi_add_table'
/usr/bin/ld: hw/i386/acpi-microvm.c:203: undefined reference to build_fadt' /usr/bin/ld: hw/i386/acpi-microvm.c:206: undefined reference to acpi_add_table' /usr/bin/ld: hw/i386/acpi-microvm.c:207: undefined reference to acpi_build_madt' /usr/bin/ld: hw/i386/acpi-microvm.c:212: undefined reference to build_xsdt' /usr/bin/ld: hw/i386/acpi-microvm.c:224: undefined reference to build_rsdp' /usr/bin/ld: libqemu-i386-softmmu.fa.p/hw_i386_acpi-microvm.c.o: in function acpi_setup_microvm':
hw/i386/acpi-microvm.c:251: undefined reference to `acpi_add_rom_blob'
/usr/bin/ld: hw/i386/acpi-microvm.c:253: undefined reference to acpi_add_rom_blob' /usr/bin/ld: hw/i386/acpi-microvm.c:255: undefined reference to acpi_add_rom_blob' /usr/bin/ld: hw/i386/acpi-microvm.c:258: undefined reference to acpi_build_tables_cleanup' /usr/bin/ld: libqemu-i386-softmmu.fa.p/hw_i386_acpi-microvm.c.o: in function acpi_dsdt_add_pci':
hw/i386/acpi-microvm.c:105: undefined reference to `acpi_dsdt_add_gpex'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Update the ACPI_HW_REDUCED symbol to select ACPI_MEMORY_HOTPLUG / ACPI_NVDIMM / ACPI.
--- hw/acpi/Kconfig | 4 ++++ 1 file changed, 4 insertions(+)
hw/acpi/Kconfig +4 -0
@@ -42,3 +42,7 @@ config ACPI_VMGENID depends on PC config ACPI_HW_REDUCED + bool + select ACPI + select ACPI_MEMORY_HOTPLUG + select ACPI_NVDIMM
Signature · 1 line
2.31.1
Re: [PATCH v2 22/23] hw/acpi/Kconfig: Add missing Kconfig dependencies (build error)
Quoted 35 lines · Philippe Mathieu-Daudé
The 'microvm' machine misses various dependencies:
/usr/bin/ld:libqemu-i386-softmmu.fa.p/hw_i386_acpi-microvm.c.o: in function `acpi_setup_microvm':
hw/i386/acpi-microvm.c:247: undefined reference toacpi_build_tables_init' /usr/bin/ld: libqemu-i386-softmmu.fa.p/hw_i386_acpi-microvm.c.o: in functionacpi_build_microvm':
hw/i386/acpi-microvm.c:192: undefined reference tobios_linker_loader_alloc' /usr/bin/ld: libqemu-i386-softmmu.fa.p/hw_i386_acpi-microvm.c.o: in functionbuild_dsdt_microvm':
hw/i386/acpi-microvm.c:121: undefined reference toinit_aml_allocator' /usr/bin/ld: hw/i386/acpi-microvm.c:124: undefined reference toacpi_data_push'/usr/bin/ld:hw/i386/acpi-microvm.c:126: undefined reference toaml_scope' /usr/bin/ld: hw/i386/acpi-microvm.c:129: undefined reference tobuild_ged_aml'/usr/bin/ld:hw/i386/acpi-microvm.c:131: undefined reference toacpi_dsdt_add_power_button' /usr/bin/ld: libqemu-i386-softmmu.fa.p/hw_i386_acpi-microvm.c.o: in functionacpi_dsdt_add_virtio':
hw/i386/acpi-microvm.c:77: undefined reference to `aml_string'
/usr/bin/ld:libqemu-i386-softmmu.fa.p/hw_i386_acpi-microvm.c.o: in function `build_dsdt_microvm':
hw/i386/acpi-microvm.c:138: undefined reference to `aml_scope'
/usr/bin/ld:hw/i386/acpi-microvm.c:149: undefined reference tobuild_header' /usr/bin/ld: hw/i386/acpi-microvm.c:152: undefined reference tofree_aml_allocator'/usr/bin/ld:libqemu-i386-softmmu.fa.p/hw_i386_acpi-microvm.c.o: in function `acpi_build_microvm':
hw/i386/acpi-microvm.c:202: undefined reference to `acpi_add_table'
/usr/bin/ld:hw/i386/acpi-microvm.c:203: undefined reference tobuild_fadt' /usr/bin/ld: hw/i386/acpi-microvm.c:206: undefined reference toacpi_add_table'/usr/bin/ld:hw/i386/acpi-microvm.c:207: undefined reference toacpi_build_madt' /usr/bin/ld: hw/i386/acpi-microvm.c:212: undefined reference tobuild_xsdt'/usr/bin/ld:hw/i386/acpi-microvm.c:224: undefined reference tobuild_rsdp' /usr/bin/ld: libqemu-i386-softmmu.fa.p/hw_i386_acpi-microvm.c.o: in functionacpi_setup_microvm':
hw/i386/acpi-microvm.c:251: undefined reference to `acpi_add_rom_blob'
/usr/bin/ld:hw/i386/acpi-microvm.c:253: undefined reference toacpi_add_rom_blob' /usr/bin/ld: hw/i386/acpi-microvm.c:255: undefined reference toacpi_add_rom_blob'/usr/bin/ld:hw/i386/acpi-microvm.c:258: undefined reference toacpi_build_tables_cleanup' /usr/bin/ld: libqemu-i386-softmmu.fa.p/hw_i386_acpi-microvm.c.o: in functionacpi_dsdt_add_pci':
hw/i386/acpi-microvm.c:105: undefined reference to `acpi_dsdt_add_gpex'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Quoted 5 lines
Update the
ACPI_HW_REDUCEDsymbol to selectACPI_MEMORY_HOTPLUG/ACPI_NVDIMM/ ACPI.Fixes 8045df14bcc ("microvm/acpi: add minimal acpi support")Signed-off-by Philippe Mathieu-Daudé <[email protected]>
PATCH v2 23/23 hw/i386/Kconfig: Add missing Kconfig dependency (runtime error)
In reply to Philippe Mathieu-DaudéWhen building the 'microvm' machine stand-alone we get:
$ qemu-system-x86_64 -M microvm ** ERROR:qom/object.c:714:object_new_with_type: assertion failed: (type != NULL) Bail out! ERROR:qom/object.c:714:object_new_with_type: assertion failed: (type != NULL) Aborted (core dumped)
Looking at the backtrace:
(gdb) bt
#3 0x00007ff2330492ff in g_assertion_message_expr () at /lib64/libglib-2.0.so.0 #4 0x000055a878c18341 in object_new_with_type (type=<optimized out>) at qom/object.c:714 #5 0x000055a878c18399 in object_new (typename=typename@entry=0x55a878dec36a "isa-pit") at qom/object.c:747 #6 0x000055a878cc8146 in qdev_new (name=name@entry=0x55a878dec36a "isa-pit") at hw/core/qdev.c:153 #7 0x000055a878a8b439 in isa_new (name=name@entry=0x55a878dec36a "isa-pit") at hw/isa/isa-bus.c:160 #8 0x000055a878adb782 in i8254_pit_init (base=64, isa_irq=0, alt_irq=0x0, bus=0x55a87ab38760) at include/hw/timer/i8254.h:54 #9 microvm_devices_init (mms=0x55a87ac36800) at hw/i386/microvm.c:263
#10 microvm_machine_state_init (machine=<optimized out>) at hw/i386/microvm.c:471
#11 0x000055a878a944ab in machine_run_board_init (machine=machine@entry=0x55a87ac36800) at hw/core/machine.c:1239
The "isa-pit" type (TYPE_I8254) is missing. Add it.
--- hw/i386/Kconfig | 1 + 1 file changed, 1 insertion(+)
hw/i386/Kconfig +1 -0
@@ -111,6 +111,7 @@ config MICROVM select ACPI_HW_REDUCED select PCI_EXPRESS_GENERIC_BRIDGE select USB_XHCI_SYSBUS + select I8254 config X86_IOMMU bool
Signature · 1 line
2.31.1
Re: [PATCH v2 23/23] hw/i386/Kconfig: Add missing Kconfig dependency (runtime error)
Quoted 18 lines · Philippe Mathieu-Daudé
When building the 'microvm' machine stand-alone we get:
$ qemu-system-x86_64 -M microvm ** ERROR:qom/object.c:714:object_new_with_type: assertion failed: (type != NULL) Bail out! ERROR:qom/object.c:714:object_new_with_type: assertion failed: (type != NULL) Aborted (core dumped)Looking at the backtrace:
(gdb) bt
#3 0x00007ff2330492ff in g_assertion_message_expr () at /lib64/libglib-2.0.so.0 #4 0x000055a878c18341 in object_new_with_type (type=<optimized out>) at qom/object.c:714 #5 0x000055a878c18399 in object_new (typename=typename@entry=0x55a878dec36a "isa-pit") at qom/object.c:747 #6 0x000055a878cc8146 in qdev_new (name=name@entry=0x55a878dec36a "isa-pit") at hw/core/qdev.c:153 #7 0x000055a878a8b439 in isa_new (name=name@entry=0x55a878dec36a "isa-pit") at hw/isa/isa-bus.c:160 #8 0x000055a878adb782 in i8254_pit_init (base=64, isa_irq=0, alt_irq=0x0, bus=0x55a87ab38760) at include/hw/timer/i8254.h:54 #9 microvm_devices_init (mms=0x55a87ac36800) at hw/i386/microvm.c:263
Quoted 7 lines
#10
microvm_machine_state_init(machine=<optimized out>) athw/i386/microvm.c:471
#110x000055a878a944abinmachine_run_board_init(machine=machine@entry=0x55a87ac36800) athw/core/machine.c:1239The "isa-pit" type (
TYPE_I8254) is missing. Add it.Fixes 0ebf007ddac ("hw/i386: Introduce the microvm machine type")Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 16 lines · Philippe Mathieu-Daudé
Hi,
While testing James & Dov patch:
https://www.mail-archive.com/[email protected]/msg810571.html
I wasted some time trying to figure out how OVMF was supposed to behave until realizing the binary I was using was built without SEV support... Then wrote this series to help other developers to not hit the same problem.Some SEV patches I was following have been queued on Eduardo's 'x86-next' tree, so I used his tree as base, and included David and Connor patches to reduce merge conflicts.
Patches 1-16 are SEV related,
patches 17-23 are OVMF related.
Quoted 6 lines
Special comment for Laszlo: Please don't review this version, wait for the respin (hoping the SEV cleanup patch get accepted, the respin will be focused on OVMF).
Based-on: https://gitlab.com/ehabkost/qemu/-/commits/x86-next/
Supersedes: <[email protected]>
acpi things
do you want to split acpi things out so I can merge?
Quoted 59 lines
Connor Kuehl (1):
MAINTAINERS: Add Connor Kuehl as reviewer for AMD SEVDr. David Alan Gilbert (1):
target/i386/sev:sev_get_attestation_reportuseg_autofreePhilippe Mathieu-Daudé (21):
qapi/misc-target: Wrap long 'SEV Attestation Report' long lines qapi/misc-target: Group SEV QAPI definitions target/i386/monitor: Return QMP error when SEV is disabled in build target/i386/cpu: Add missing 'qapi/error.h' headertarget/i386/sev_i386.h: Remove unused headers target/i386/sev: Removesev_get_me_mask()target/i386/sev: Mark unreachable code withg_assert_not_reached()target/i386/sev: Restrict SEV to system emulation target/i386/sev: Moveqmp_query_sev_attestation_report()tosev.ctarget/i386/sev: Moveqmp_sev_inject_launch_secret()tosev.ctarget/i386/sev: Moveqmp_query_sev_capabilities()tosev.ctarget/i386/sev: Moveqmp_query_sev_launch_measure()tosev.ctarget/i386/sev: Moveqmp_query_sev()&hmp_info_sev()tosev.c
monitor: Restrict 'info sev' to x86 targets hw/i386/acpi-common: Remove unused includes
hw/i386: Renameacpi-build.c->acpi-pc.c
hw/i386: Movepc_madt_cpu_entry()toacpi-pc.c
hw/acpi: Do not restrict ACPI core routines to x86 architecture hw/i386: IntroduceX86_FW_OVMFKconfigsymbol hw/acpi/Kconfig: Add missingKconfigdependencies (build error) hw/i386/Kconfig: Add missingKconfigdependency (runtime error)qapi/misc-target.json | 78 ++++++++-------- include/hw/i386/pc.h | 1 + include/monitor/hmp-target.h | 1 + include/monitor/hmp.h | 1 - target/i386/sev_i386.h | 11 --- hw/i386/acpi-common.c | 45 ---------- hw/i386/{acpi-build.c => acpi-pc.c} | 39 ++++++++ hw/i386/pc_sysfw.c | 107 ---------------------- hw/i386/pc_sysfw_ovmf-stubs.c | 26 ++++++ hw/i386/pc_sysfw_ovmf.c | 135 ++++++++++++++++++++++++++++ target/i386/cpu.c | 1 + target/i386/monitor.c | 91 ------------------- target/i386/sev-stub.c | 49 +--------- target/i386/sev-sysemu-stub.c | 69 ++++++++++++++ target/i386/sev.c | 130 +++++++++++++++++++++------ MAINTAINERS | 8 ++ hw/acpi/Kconfig | 4 + hw/acpi/meson.build | 3 +- hw/i386/Kconfig | 5 ++ hw/i386/meson.build | 4 +- target/i386/meson.build | 4 +- 21 files changed, 443 insertions(+), 369 deletions(-) rename hw/i386/{acpi-build.c => acpi-pc.c} (98%) create mode 100644 hw/i386/pc_sysfw_ovmf-stubs.c create mode 100644 hw/i386/pc_sysfw_ovmf.c create mode 100644 target/i386/sev-sysemu-stub.cSignature · 1 line
2.31.1
Quoted 25 lines · On Thu, 17 Jun 2021 16:42:24 -0400 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 16 lines · Philippe Mathieu-Daudé
Hi,
While testing James & Dov patch:
https://www.mail-archive.com/[email protected]/msg810571.html
I wasted some time trying to figure out how OVMF was supposed to behave until realizing the binary I was using was built without SEV support... Then wrote this series to help other developers to not hit the same problem.Some SEV patches I was following have been queued on Eduardo's 'x86-next' tree, so I used his tree as base, and included David and Connor patches to reduce merge conflicts.
Patches 1-16 are SEV related,
patches 17-23 are OVMF related.Quoted 6 lines
Special comment for Laszlo: Please don't review this version, wait for the respin (hoping the SEV cleanup patch get accepted, the respin will be focused on OVMF).
Based-on: https://gitlab.com/ehabkost/qemu/-/commits/x86-next/
Supersedes: <[email protected]>
Quoted 5 lines
acpi things
do you want to split acpi things out so I can merge?
I agree they should have been split out.
(I see in cover letter SEV don't look into series anymore, so this APCI patches which are totally irrelevant to SEV weren't even unnoticed).
Perhaps I should take these into my ACPI refactoring series (with your acks), which would need to be rebased on top of these. Though I'd drop 19/23 which doesn't look correct to me.
Quoted 61 lines
Quoted 60 lines
Connor Kuehl (1):
MAINTAINERS: Add Connor Kuehl as reviewer for AMD SEVDr. David Alan Gilbert (1):
target/i386/sev:sev_get_attestation_reportuseg_autofreePhilippe Mathieu-Daudé (21):
qapi/misc-target: Wrap long 'SEV Attestation Report' long lines qapi/misc-target: Group SEV QAPI definitions target/i386/monitor: Return QMP error when SEV is disabled in build target/i386/cpu: Add missing 'qapi/error.h' headertarget/i386/sev_i386.h: Remove unused headers target/i386/sev: Removesev_get_me_mask()target/i386/sev: Mark unreachable code withg_assert_not_reached()target/i386/sev: Restrict SEV to system emulation target/i386/sev: Moveqmp_query_sev_attestation_report()tosev.ctarget/i386/sev: Moveqmp_sev_inject_launch_secret()tosev.ctarget/i386/sev: Moveqmp_query_sev_capabilities()tosev.ctarget/i386/sev: Moveqmp_query_sev_launch_measure()tosev.ctarget/i386/sev: Moveqmp_query_sev()&hmp_info_sev()tosev.c
monitor: Restrict 'info sev' to x86 targets hw/i386/acpi-common: Remove unused includes
hw/i386: Renameacpi-build.c->acpi-pc.c
hw/i386: Movepc_madt_cpu_entry()toacpi-pc.c
hw/acpi: Do not restrict ACPI core routines to x86 architecture hw/i386: IntroduceX86_FW_OVMFKconfigsymbol hw/acpi/Kconfig: Add missingKconfigdependencies (build error) hw/i386/Kconfig: Add missingKconfigdependency (runtime error)qapi/misc-target.json | 78 ++++++++-------- include/hw/i386/pc.h | 1 + include/monitor/hmp-target.h | 1 + include/monitor/hmp.h | 1 - target/i386/sev_i386.h | 11 --- hw/i386/acpi-common.c | 45 ---------- hw/i386/{acpi-build.c => acpi-pc.c} | 39 ++++++++ hw/i386/pc_sysfw.c | 107 ---------------------- hw/i386/pc_sysfw_ovmf-stubs.c | 26 ++++++ hw/i386/pc_sysfw_ovmf.c | 135 ++++++++++++++++++++++++++++ target/i386/cpu.c | 1 + target/i386/monitor.c | 91 ------------------- target/i386/sev-stub.c | 49 +--------- target/i386/sev-sysemu-stub.c | 69 ++++++++++++++ target/i386/sev.c | 130 +++++++++++++++++++++------ MAINTAINERS | 8 ++ hw/acpi/Kconfig | 4 + hw/acpi/meson.build | 3 +- hw/i386/Kconfig | 5 ++ hw/i386/meson.build | 4 +- target/i386/meson.build | 4 +- 21 files changed, 443 insertions(+), 369 deletions(-) rename hw/i386/{acpi-build.c => acpi-pc.c} (98%) create mode 100644 hw/i386/pc_sysfw_ovmf-stubs.c create mode 100644 hw/i386/pc_sysfw_ovmf.c create mode 100644 target/i386/sev-sysemu-stub.cSignature · 1 line
2.31.1
Quoted 32 lines · Igor Mammedov
Quoted 29 lines · On Thu, 17 Jun 2021 16:42:24 -0400 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 16 lines · Philippe Mathieu-Daudé
Hi,
While testing James & Dov patch:
https://www.mail-archive.com/[email protected]/msg810571.html
I wasted some time trying to figure out how OVMF was supposed to behave until realizing the binary I was using was built without SEV support... Then wrote this series to help other developers to not hit the same problem.Some SEV patches I was following have been queued on Eduardo's 'x86-next' tree, so I used his tree as base, and included David and Connor patches to reduce merge conflicts.
Patches 1-16 are SEV related,
patches 17-23 are OVMF related.Quoted 6 lines
Special comment for Laszlo: Please don't review this version, wait for the respin (hoping the SEV cleanup patch get accepted, the respin will be focused on OVMF).
Based-on: https://gitlab.com/ehabkost/qemu/-/commits/x86-next/
Supersedes: <[email protected]>acpi things
Quoted 8 lines
Quoted 1 line
do you want to split acpi things out so I can merge?
I agree they should have been split out.
(I see in cover letter SEV don't look into series anymore, so this APCI patches which are totally irrelevant to SEV weren't even unnoticed).Perhaps I should take these into my ACPI refactoring series (with your acks), which would need to be rebased on top of these.
OK.
Quoted 1 line
Though I'd drop 19/23 which doesn't look correct to me.
Yes let's drop that one.
Quoted 61 lines
Quoted 61 lines
Quoted 60 lines
Connor Kuehl (1):
MAINTAINERS: Add Connor Kuehl as reviewer for AMD SEVDr. David Alan Gilbert (1):
target/i386/sev:sev_get_attestation_reportuseg_autofreePhilippe Mathieu-Daudé (21):
qapi/misc-target: Wrap long 'SEV Attestation Report' long lines qapi/misc-target: Group SEV QAPI definitions target/i386/monitor: Return QMP error when SEV is disabled in build target/i386/cpu: Add missing 'qapi/error.h' headertarget/i386/sev_i386.h: Remove unused headers target/i386/sev: Removesev_get_me_mask()target/i386/sev: Mark unreachable code withg_assert_not_reached()target/i386/sev: Restrict SEV to system emulation target/i386/sev: Moveqmp_query_sev_attestation_report()tosev.ctarget/i386/sev: Moveqmp_sev_inject_launch_secret()tosev.ctarget/i386/sev: Moveqmp_query_sev_capabilities()tosev.ctarget/i386/sev: Moveqmp_query_sev_launch_measure()tosev.ctarget/i386/sev: Moveqmp_query_sev()&hmp_info_sev()tosev.c
monitor: Restrict 'info sev' to x86 targets hw/i386/acpi-common: Remove unused includes
hw/i386: Renameacpi-build.c->acpi-pc.c
hw/i386: Movepc_madt_cpu_entry()toacpi-pc.c
hw/acpi: Do not restrict ACPI core routines to x86 architecture hw/i386: IntroduceX86_FW_OVMFKconfigsymbol hw/acpi/Kconfig: Add missingKconfigdependencies (build error) hw/i386/Kconfig: Add missingKconfigdependency (runtime error)qapi/misc-target.json | 78 ++++++++-------- include/hw/i386/pc.h | 1 + include/monitor/hmp-target.h | 1 + include/monitor/hmp.h | 1 - target/i386/sev_i386.h | 11 --- hw/i386/acpi-common.c | 45 ---------- hw/i386/{acpi-build.c => acpi-pc.c} | 39 ++++++++ hw/i386/pc_sysfw.c | 107 ---------------------- hw/i386/pc_sysfw_ovmf-stubs.c | 26 ++++++ hw/i386/pc_sysfw_ovmf.c | 135 ++++++++++++++++++++++++++++ target/i386/cpu.c | 1 + target/i386/monitor.c | 91 ------------------- target/i386/sev-stub.c | 49 +--------- target/i386/sev-sysemu-stub.c | 69 ++++++++++++++ target/i386/sev.c | 130 +++++++++++++++++++++------ MAINTAINERS | 8 ++ hw/acpi/Kconfig | 4 + hw/acpi/meson.build | 3 +- hw/i386/Kconfig | 5 ++ hw/i386/meson.build | 4 +- target/i386/meson.build | 4 +- 21 files changed, 443 insertions(+), 369 deletions(-) rename hw/i386/{acpi-build.c => acpi-pc.c} (98%) create mode 100644 hw/i386/pc_sysfw_ovmf-stubs.c create mode 100644 hw/i386/pc_sysfw_ovmf.c create mode 100644 target/i386/sev-sysemu-stub.cSignature · 1 line
2.31.1
Quoted 3 lines · Philippe Mathieu-Daudé
Special comment for Laszlo: Please don't review this version, wait for the respin (hoping the SEV cleanup patch get accepted, the respin will be focused on OVMF).
Appreciate the note.
Laszlo