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
66f63474
Commit
66f63474
authored
Apr 23, 2020
by
Marc Zyngier
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'kvm-arm64/psci-fixes-5.7' into kvmarm-master/master
parents
8f3d9f35
fdc9999e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
virt/kvm/arm/psci.c
virt/kvm/arm/psci.c
+40
-0
No files found.
virt/kvm/arm/psci.c
View file @
66f63474
...
...
@@ -186,6 +186,33 @@ static void kvm_psci_system_reset(struct kvm_vcpu *vcpu)
kvm_prepare_system_event
(
vcpu
,
KVM_SYSTEM_EVENT_RESET
);
}
static
void
kvm_psci_narrow_to_32bit
(
struct
kvm_vcpu
*
vcpu
)
{
int
i
;
/*
* Zero the input registers' upper 32 bits. They will be fully
* zeroed on exit, so we're fine changing them in place.
*/
for
(
i
=
1
;
i
<
4
;
i
++
)
vcpu_set_reg
(
vcpu
,
i
,
lower_32_bits
(
vcpu_get_reg
(
vcpu
,
i
)));
}
static
unsigned
long
kvm_psci_check_allowed_function
(
struct
kvm_vcpu
*
vcpu
,
u32
fn
)
{
switch
(
fn
)
{
case
PSCI_0_2_FN64_CPU_SUSPEND
:
case
PSCI_0_2_FN64_CPU_ON
:
case
PSCI_0_2_FN64_AFFINITY_INFO
:
/* Disallow these functions for 32bit guests */
if
(
vcpu_mode_is_32bit
(
vcpu
))
return
PSCI_RET_NOT_SUPPORTED
;
break
;
}
return
0
;
}
static
int
kvm_psci_0_2_call
(
struct
kvm_vcpu
*
vcpu
)
{
struct
kvm
*
kvm
=
vcpu
->
kvm
;
...
...
@@ -193,6 +220,10 @@ static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu)
unsigned
long
val
;
int
ret
=
1
;
val
=
kvm_psci_check_allowed_function
(
vcpu
,
psci_fn
);
if
(
val
)
goto
out
;
switch
(
psci_fn
)
{
case
PSCI_0_2_FN_PSCI_VERSION
:
/*
...
...
@@ -210,12 +241,16 @@ static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu)
val
=
PSCI_RET_SUCCESS
;
break
;
case
PSCI_0_2_FN_CPU_ON
:
kvm_psci_narrow_to_32bit
(
vcpu
);
fallthrough
;
case
PSCI_0_2_FN64_CPU_ON
:
mutex_lock
(
&
kvm
->
lock
);
val
=
kvm_psci_vcpu_on
(
vcpu
);
mutex_unlock
(
&
kvm
->
lock
);
break
;
case
PSCI_0_2_FN_AFFINITY_INFO
:
kvm_psci_narrow_to_32bit
(
vcpu
);
fallthrough
;
case
PSCI_0_2_FN64_AFFINITY_INFO
:
val
=
kvm_psci_vcpu_affinity_info
(
vcpu
);
break
;
...
...
@@ -256,6 +291,7 @@ static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu)
break
;
}
out:
smccc_set_retval
(
vcpu
,
val
,
0
,
0
,
0
);
return
ret
;
}
...
...
@@ -273,6 +309,10 @@ static int kvm_psci_1_0_call(struct kvm_vcpu *vcpu)
break
;
case
PSCI_1_0_FN_PSCI_FEATURES
:
feature
=
smccc_get_arg1
(
vcpu
);
val
=
kvm_psci_check_allowed_function
(
vcpu
,
feature
);
if
(
val
)
break
;
switch
(
feature
)
{
case
PSCI_0_2_FN_PSCI_VERSION
:
case
PSCI_0_2_FN_CPU_SUSPEND
:
...
...
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