Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
a3833b81
Commit
a3833b81
authored
Dec 03, 2020
by
David Woodhouse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
KVM: x86/xen: latch long_mode when hypercall page is set up
Signed-off-by:
David Woodhouse
<
dwmw@amazon.co.uk
>
parent
a76b9641
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
1 deletion
+24
-1
arch/x86/include/asm/kvm_host.h
arch/x86/include/asm/kvm_host.h
+6
-0
arch/x86/kvm/xen.c
arch/x86/kvm/xen.c
+15
-1
include/uapi/linux/kvm.h
include/uapi/linux/kvm.h
+3
-0
No files found.
arch/x86/include/asm/kvm_host.h
View file @
a3833b81
...
...
@@ -905,6 +905,11 @@ struct msr_bitmap_range {
unsigned
long
*
bitmap
;
};
/* Xen emulation context */
struct
kvm_xen
{
bool
long_mode
;
};
enum
kvm_irqchip_mode
{
KVM_IRQCHIP_NONE
,
KVM_IRQCHIP_KERNEL
,
/* created with KVM_CREATE_IRQCHIP */
...
...
@@ -984,6 +989,7 @@ struct kvm_arch {
struct
hlist_head
mask_notifier_list
;
struct
kvm_hv
hyperv
;
struct
kvm_xen
xen
;
#ifdef CONFIG_KVM_MMU_AUDIT
int
audit_point
;
...
...
arch/x86/kvm/xen.c
View file @
a3833b81
...
...
@@ -25,6 +25,13 @@ int kvm_xen_hvm_set_attr(struct kvm *kvm, struct kvm_xen_hvm_attr *data)
mutex_unlock
(
&
kvm
->
lock
);
switch
(
data
->
type
)
{
case
KVM_XEN_ATTR_TYPE_LONG_MODE
:
if
(
!
IS_ENABLED
(
CONFIG_64BIT
)
&&
data
->
u
.
long_mode
)
return
-
EINVAL
;
kvm
->
arch
.
xen
.
long_mode
=
!!
data
->
u
.
long_mode
;
r
=
0
;
break
;
default:
break
;
}
...
...
@@ -40,6 +47,10 @@ int kvm_xen_hvm_get_attr(struct kvm *kvm, struct kvm_xen_hvm_attr *data)
mutex_lock
(
&
kvm
->
lock
);
switch
(
data
->
type
)
{
case
KVM_XEN_ATTR_TYPE_LONG_MODE
:
data
->
u
.
long_mode
=
kvm
->
arch
.
xen
.
long_mode
;
r
=
0
;
break
;
default:
break
;
}
...
...
@@ -53,6 +64,10 @@ int kvm_xen_write_hypercall_page(struct kvm_vcpu *vcpu, u64 data)
struct
kvm
*
kvm
=
vcpu
->
kvm
;
u32
page_num
=
data
&
~
PAGE_MASK
;
u64
page_addr
=
data
&
PAGE_MASK
;
bool
lm
=
is_long_mode
(
vcpu
);
/* Latch long_mode for shared_info pages etc. */
vcpu
->
kvm
->
arch
.
xen
.
long_mode
=
lm
;
/*
* If Xen hypercall intercept is enabled, fill the hypercall
...
...
@@ -87,7 +102,6 @@ int kvm_xen_write_hypercall_page(struct kvm_vcpu *vcpu, u64 data)
return
1
;
}
}
else
{
int
lm
=
is_long_mode
(
vcpu
);
u64
blob_addr
=
lm
?
kvm
->
arch
.
xen_hvm_config
.
blob_addr_64
:
kvm
->
arch
.
xen_hvm_config
.
blob_addr_32
;
u8
blob_size
=
lm
?
kvm
->
arch
.
xen_hvm_config
.
blob_size_64
...
...
include/uapi/linux/kvm.h
View file @
a3833b81
...
...
@@ -1594,10 +1594,13 @@ struct kvm_xen_hvm_attr {
__u16
type
;
__u16
pad
[
3
];
union
{
__u8
long_mode
;
__u64
pad
[
8
];
}
u
;
};
#define KVM_XEN_ATTR_TYPE_LONG_MODE 0x0
/* Secure Encrypted Virtualization command */
enum
sev_cmd_id
{
/* Guest initialization commands */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment