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
diff --git a/pkvm/pkvm_enabler.c b/pkvm/pkvm_enabler.c
index cb14ba6..b927318 100644
--- a/pkvm/pkvm_enabler.c
+++ b/pkvm/pkvm_enabler.c
@@ -24,7 +24,6 @@
#include <log/log.h>
-#define KVM_DEVICE "/dev/kvm"
#define MISC_WRITER "/vendor/bin/misc_writer"
int main() {
@@ -33,22 +32,7 @@
pid_t pid;
int ret, wstatus;
- /* Check whether KVM device exists. */
- 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.
- */
+ /* Run misc_writer and return FAILURE to force a reboot. */
pid = fork();
if (pid == -1) {
ALOGE("Could not fork: %d", errno);