aboutsummaryrefslogtreecommitdiff
path: root/target/i386/sev.h
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@redhat.com>2021-10-07 18:17:09 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2021-10-13 10:47:49 +0200
commit02eacf31374152e6fb44554a4632f477d82dd9fc (patch)
treef3e3845b7b22136583c704d361b26af630eb407c /target/i386/sev.h
parentdeae846f944a330e69109af8c807d6f2e66c95e6 (diff)
downloadqemu-02eacf31374152e6fb44554a4632f477d82dd9fc.zip
qemu-02eacf31374152e6fb44554a4632f477d82dd9fc.tar.gz
qemu-02eacf31374152e6fb44554a4632f477d82dd9fc.tar.bz2
target/i386/sev: Remove stubs by using code elision
Only declare sev_enabled() and sev_es_enabled() when CONFIG_SEV is set, to allow the compiler to elide unused code. Remove unnecessary stubs. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20211007161716.453984-17-philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target/i386/sev.h')
-rw-r--r--target/i386/sev.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/target/i386/sev.h b/target/i386/sev.h
index c96072b..b628923 100644
--- a/target/i386/sev.h
+++ b/target/i386/sev.h
@@ -14,6 +14,10 @@
#ifndef QEMU_SEV_I386_H
#define QEMU_SEV_I386_H
+#ifndef CONFIG_USER_ONLY
+#include CONFIG_DEVICES /* CONFIG_SEV */
+#endif
+
#include "exec/confidential-guest-support.h"
#include "qapi/qapi-types-misc-target.h"
@@ -35,8 +39,14 @@ typedef struct SevKernelLoaderContext {
size_t cmdline_size;
} SevKernelLoaderContext;
+#ifdef CONFIG_SEV
bool sev_enabled(void);
-extern bool sev_es_enabled(void);
+bool sev_es_enabled(void);
+#else
+#define sev_enabled() 0
+#define sev_es_enabled() 0
+#endif
+
extern SevInfo *sev_get_info(void);
extern uint32_t sev_get_cbit_position(void);
extern uint32_t sev_get_reduced_phys_bits(void);