|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/hypercall: Make the HVM hcall_64bit boolean common
commit bb84ffc56ec14766f33a002a61fd97a62b6b17cd
Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Tue Feb 14 18:21:22 2017 +0000
Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Thu Feb 16 14:15:25 2017 +0000
x86/hypercall: Make the HVM hcall_64bit boolean common
HVM guests currently make use of arch.hvm_vcpu.hcall_64bit to track the ABI
of
the hypercall in use.
The rest of Xen deals in terms of the comat ABI or not, so rename the
boolean
and make it common, guared by CONFIG_COMPAT to avoid bloat if a compat ABI
is
not wanted/needed.
Set hcall_compat uniformly for PV guests as well as HVM guests. This
removes
the remaining piece of guest-type-specific knowledge from
hypercall_create_continuation(), allowing it to operate only in terms of the
hypercall ABI in use.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
xen/arch/x86/domain.c | 4 +---
xen/arch/x86/hvm/hvm.c | 9 +++------
xen/arch/x86/hvm/hypercall.c | 11 +++++------
xen/arch/x86/hypercall.c | 2 ++
xen/include/asm-x86/hvm/vcpu.h | 2 --
xen/include/xen/sched.h | 4 ++++
6 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 4ffd94b..694d2dc 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -2225,9 +2225,7 @@ unsigned long hypercall_create_continuation(
regs->rax = op;
- if ( is_pv_vcpu(curr) ?
- !is_pv_32bit_vcpu(curr) :
- curr->arch.hvm_vcpu.hcall_64bit )
+ if ( !curr->hcall_compat )
{
for ( i = 0; *p != '\0'; i++ )
{
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 3f5c4bf..6621d62 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3253,8 +3253,7 @@ unsigned long copy_to_user_hvm(void *to, const void
*from, unsigned int len)
{
int rc;
- if ( !current->arch.hvm_vcpu.hcall_64bit &&
- is_compat_arg_xlat_range(to, len) )
+ if ( current->hcall_compat && is_compat_arg_xlat_range(to, len) )
{
memcpy(to, from, len);
return 0;
@@ -3268,8 +3267,7 @@ unsigned long clear_user_hvm(void *to, unsigned int len)
{
int rc;
- if ( !current->arch.hvm_vcpu.hcall_64bit &&
- is_compat_arg_xlat_range(to, len) )
+ if ( current->hcall_compat && is_compat_arg_xlat_range(to, len) )
{
memset(to, 0x00, len);
return 0;
@@ -3283,8 +3281,7 @@ unsigned long copy_from_user_hvm(void *to, const void
*from, unsigned len)
{
int rc;
- if ( !current->arch.hvm_vcpu.hcall_64bit &&
- is_compat_arg_xlat_range(from, len) )
+ if ( current->hcall_compat && is_compat_arg_xlat_range(from, len) )
{
memcpy(to, from, len);
return 0;
diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
index fe7802b..0f7c310 100644
--- a/xen/arch/x86/hvm/hypercall.c
+++ b/xen/arch/x86/hvm/hypercall.c
@@ -35,7 +35,7 @@ static long hvm_memory_op(int cmd,
XEN_GUEST_HANDLE_PARAM(void) arg)
return -ENOSYS;
}
- if ( curr->arch.hvm_vcpu.hcall_64bit )
+ if ( !curr->hcall_compat )
rc = do_memory_op(cmd, arg);
else
rc = compat_memory_op(cmd, arg);
@@ -65,7 +65,7 @@ static long hvm_grant_table_op(
return -ENOSYS;
}
- if ( current->arch.hvm_vcpu.hcall_64bit )
+ if ( !current->hcall_compat )
return do_grant_table_op(cmd, uop, count);
else
return compat_grant_table_op(cmd, uop, count);
@@ -89,7 +89,7 @@ static long hvm_physdev_op(int cmd,
XEN_GUEST_HANDLE_PARAM(void) arg)
break;
}
- if ( curr->arch.hvm_vcpu.hcall_64bit )
+ if ( !curr->hcall_compat )
return do_physdev_op(cmd, arg);
else
return compat_physdev_op(cmd, arg);
@@ -203,12 +203,9 @@ int hvm_hypercall(struct cpu_user_regs *regs)
}
#endif
- curr->arch.hvm_vcpu.hcall_64bit = 1;
regs->rax = hvm_hypercall_table[eax].native(rdi, rsi, rdx, r10, r8,
r9);
- curr->arch.hvm_vcpu.hcall_64bit = 0;
-
#ifndef NDEBUG
if ( !curr->hcall_preempted )
{
@@ -250,8 +247,10 @@ int hvm_hypercall(struct cpu_user_regs *regs)
}
#endif
+ curr->hcall_compat = true;
regs->rax = hvm_hypercall_table[eax].compat(ebx, ecx, edx, esi, edi,
ebp);
+ curr->hcall_compat = false;
#ifndef NDEBUG
if ( !curr->hcall_preempted )
diff --git a/xen/arch/x86/hypercall.c b/xen/arch/x86/hypercall.c
index 945afa0..c0718f8 100644
--- a/xen/arch/x86/hypercall.c
+++ b/xen/arch/x86/hypercall.c
@@ -234,7 +234,9 @@ void pv_hypercall(struct cpu_user_regs *regs)
__trace_hypercall(TRC_PV_HYPERCALL_V2, eax, args);
}
+ curr->hcall_compat = true;
regs->_eax = pv_hypercall_table[eax].compat(ebx, ecx, edx, esi, edi,
ebp);
+ curr->hcall_compat = false;
#ifndef NDEBUG
if ( !curr->hcall_preempted )
diff --git a/xen/include/asm-x86/hvm/vcpu.h b/xen/include/asm-x86/hvm/vcpu.h
index 6d5553d..6c54773 100644
--- a/xen/include/asm-x86/hvm/vcpu.h
+++ b/xen/include/asm-x86/hvm/vcpu.h
@@ -166,8 +166,6 @@ struct hvm_vcpu {
bool debug_state_latch;
bool single_step;
- bool hcall_64bit;
-
struct hvm_vcpu_asid n1asid;
u32 msr_tsc_aux;
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 1b1c26a..0929c0b 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -205,6 +205,10 @@ struct vcpu
/* A hypercall has been preempted. */
bool hcall_preempted;
+#ifdef CONFIG_COMPAT
+ /* A hypercall is using the compat ABI? */
+ bool hcall_compat;
+#endif
/*
--
generated by git-patchbot for /home/xen/git/xen.git#master
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |