|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen stable-4.14] x86: Fix build with the get/set_reg() infrastructure
commit bdf197d8405e2e64f3d9ad875763790bdb4ecd4f
Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Wed Jan 26 12:51:31 2022 +0100
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Jan 26 12:51:31 2022 +0100
x86: Fix build with the get/set_reg() infrastructure
I clearly messed up concluding that the stubs were safe to drop.
The is_{pv,hvm}_domain() predicates are not symmetrical with both CONFIG_PV
and CONFIG_HVM. As a result logic of the form `if ( pv/hvm ) ... else ...`
will always have one side which can't be DCE'd.
While technically only the hvm stubs are needed, due to the use of the
is_pv_domain() predicate in guest_{rd,wr}msr(), sort out the pv stubs too to
avoid leaving a bear trap for future users.
Fixes: 88d3ff7ab15d ("x86/guest: Introduce {get,set}_reg() infrastructure")
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
master commit: 13caa585791234fe3e3719c8376f7ea731012451
master date: 2022-01-21 12:42:11 +0000
---
xen/include/asm-x86/hvm/hvm.h | 10 ++++++++++
xen/include/asm-x86/pv/domain.h | 18 ++++++++++++++----
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index e69828e274..6d67ea3b05 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -766,6 +766,16 @@ static inline bool
hvm_has_set_descriptor_access_exiting(void)
return false;
}
+static inline uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg)
+{
+ ASSERT_UNREACHABLE();
+ return 0;
+}
+static inline void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+ ASSERT_UNREACHABLE();
+}
+
#define is_viridian_domain(d) ((void)(d), false)
#define is_viridian_vcpu(v) ((void)(v), false)
#define has_viridian_time_ref_count(d) ((void)(d), false)
diff --git a/xen/include/asm-x86/pv/domain.h b/xen/include/asm-x86/pv/domain.h
index 3a67816764..6b16da9d18 100644
--- a/xen/include/asm-x86/pv/domain.h
+++ b/xen/include/asm-x86/pv/domain.h
@@ -65,10 +65,6 @@ static inline unsigned long get_pcid_bits(const struct vcpu
*v, bool is_xpti)
#endif
}
-/* See hvm_{get,set}_reg() for description. */
-uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
-void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
-
#ifdef CONFIG_PV
void pv_vcpu_destroy(struct vcpu *v);
@@ -93,6 +89,10 @@ unsigned long pv_fixup_guest_cr4(const struct vcpu *v,
unsigned long cr4);
/* Create a cr4 value to load into hardware, based on vcpu settings. */
unsigned long pv_make_cr4(const struct vcpu *v);
+/* See hvm_{get,set}_reg() for description. */
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
bool xpti_pcid_enabled(void);
#else /* !CONFIG_PV */
@@ -106,6 +106,16 @@ static inline int pv_domain_initialise(struct domain *d) {
return -EOPNOTSUPP; }
static inline unsigned long pv_make_cr4(const struct vcpu *v) { return ~0ul; }
+static inline uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
+{
+ ASSERT_UNREACHABLE();
+ return 0;
+}
+static inline void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+ ASSERT_UNREACHABLE();
+}
+
#endif /* CONFIG_PV */
void paravirt_ctxt_switch_from(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |