Enable pkvm based on the relevant sysprop rather than /dev/kvm
1. This is simpler, as it can be triggered by logic in the init.rc 2. The old method of probing /dev/kvm fails if non-protected kvm is enabled: the device will exist, but pkvm is not enable Bug: 346525496 Test: observe that pkvm is enabled after double reboot Change-Id: I2f557ed56f13458a288ede34e672692b511b6bc9
This commit is contained in:
parent
f34142e084
commit
4ff69cacdf
2 changed files with 7 additions and 18 deletions
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
#include <log/log.h>
|
#include <log/log.h>
|
||||||
|
|
||||||
#define KVM_DEVICE "/dev/kvm"
|
|
||||||
#define MISC_WRITER "/vendor/bin/misc_writer"
|
#define MISC_WRITER "/vendor/bin/misc_writer"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
@ -33,22 +32,7 @@ int main() {
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int ret, wstatus;
|
int ret, wstatus;
|
||||||
|
|
||||||
/* Check whether KVM device exists. */
|
/* Run misc_writer and return FAILURE to force a reboot. */
|
||||||
ret = access(KVM_DEVICE, F_OK);
|
|
||||||
|
|
||||||
/* If KVM device exists, return SUCCESS to continue booting. */
|
|
||||||
if (ret == 0) {
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ret != -ENOENT) {
|
|
||||||
ALOGW("Unexpected error from access(): %d", ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If KVM device does not exist, run misc_writer and return FAILURE
|
|
||||||
* to force a reboot.
|
|
||||||
*/
|
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (pid == -1) {
|
if (pid == -1) {
|
||||||
ALOGE("Could not fork: %d", errno);
|
ALOGE("Could not fork: %d", errno);
|
||||||
|
|
|
@ -2,5 +2,10 @@ service pkvm_enabler /vendor/bin/pkvm_enabler
|
||||||
reboot_on_failure reboot,pkvm-not-enabled
|
reboot_on_failure reboot,pkvm-not-enabled
|
||||||
user root
|
user root
|
||||||
|
|
||||||
on early-init
|
# Old bootloaders do not set the protected_vm sysprop when pkvm is disabled
|
||||||
|
on early-init && property:ro.boot.hypervisor.protected_vm.supported=
|
||||||
|
exec_start pkvm_enabler
|
||||||
|
|
||||||
|
# New bootloaders set the protected_vm sysprop to 0 when pkvm is disabled
|
||||||
|
on early-init && property:ro.boot.hypervisor.protected_vm.supported=0
|
||||||
exec_start pkvm_enabler
|
exec_start pkvm_enabler
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue