Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,11 @@ DEFINE_vec(protected_vm, fmt::format("{}", CF_DEFAULTS_PROTECTED_VM),

DEFINE_vec(mte, fmt::format("{}", CF_DEFAULTS_MTE), "Enable MTE");

DEFINE_vec(enable_pkvm, fmt::format("{}", CF_DEFAULTS_ENABLE_PKVM),
"Provision the guest to run pKVM so it can host its own protected "
"VMs; requires a nested-virt capable host, --vm_manager=crosvm "
"and an arm64 guest.");

DEFINE_vec(enable_audio, fmt::format("{}", CF_DEFAULTS_ENABLE_AUDIO),
"Whether to play or capture audio");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ DECLARE_vec(protected_vm);

DECLARE_vec(mte);

DECLARE_vec(enable_pkvm);

DECLARE_vec(enable_audio);

DECLARE_vec(enable_jcard_simulator);
Expand Down
24 changes: 16 additions & 8 deletions base/cvd/cuttlefish/host/commands/assemble_cvd/bootconfig_args.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,23 @@ Result<std::unordered_map<std::string, std::string>> BootconfigArgsFromConfig(
}

// TODO(b/217564326): improve this checks for a hypervisor in the VM.
if (instance.target_arch() == Arch::X86 ||
instance.target_arch() == Arch::X86_64) {
bootconfig_args["androidboot.hypervisor.version"] =
"cf-" + ToString(config.vm_manager());
bootconfig_args["androidboot.hypervisor.vm.supported"] = "1";
} else {
bootconfig_args["androidboot.hypervisor.vm.supported"] = "0";
switch (instance.target_arch()) {
case Arch::Arm64:
// The guest bootloader reports the hypervisor properties.
break;
case Arch::X86:
case Arch::X86_64:
bootconfig_args["androidboot.hypervisor.version"] =
"cf-" + ToString(config.vm_manager());
bootconfig_args["androidboot.hypervisor.vm.supported"] = "1";
bootconfig_args["androidboot.hypervisor.protected_vm.supported"] = "0";
break;
case Arch::Arm:
case Arch::RiscV64:
bootconfig_args["androidboot.hypervisor.vm.supported"] = "0";
bootconfig_args["androidboot.hypervisor.protected_vm.supported"] = "0";
break;
}
bootconfig_args["androidboot.hypervisor.protected_vm.supported"] = "0";
if (!instance.kernel_path().empty()) {
bootconfig_args["androidboot.kernel_hotswapped"] = "1";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ constexpr struct {
std::string_view init_boot = "init_boot";
std::string_view metadata = "metadata";
std::string_view misc = "misc";
std::string_view pvmfw = "pvmfw";
std::string_view super = "super";
std::string_view userdata = "userdata";
std::string_view vbmeta = "vbmeta";
Expand Down Expand Up @@ -83,6 +84,7 @@ Result<std::vector<ImagePartition>> AndroidCompositeDiskConfig(
const std::set<std::string_view> ab_partitions = {
kPartitions.boot,
kPartitions.init_boot,
kPartitions.pvmfw,
kPartitions.vbmeta,
kPartitions.vbmeta_system,
kPartitions.vbmeta_system_dlkm,
Expand Down
10 changes: 10 additions & 0 deletions base/cvd/cuttlefish/host/commands/assemble_cvd/flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,8 @@ Result<CuttlefishConfig> InitializeCuttlefishConfiguration(
std::vector<bool> vhost_net_vec = CF_EXPECT(GET_FLAG_BOOL_VALUE(vhost_net));
std::vector<std::string> vhost_user_vsock_vec =
CF_EXPECT(GET_FLAG_STR_VALUE(vhost_user_vsock));
std::vector<bool> enable_pkvm_vec =
CF_EXPECT(GET_FLAG_BOOL_VALUE(enable_pkvm));
std::vector<std::string> ril_dns_vec = CF_EXPECT(GET_FLAG_STR_VALUE(ril_dns));
std::vector<bool> enable_jcard_simulator_vec =
CF_EXPECT(GET_FLAG_BOOL_VALUE(enable_jcard_simulator));
Expand Down Expand Up @@ -907,6 +909,14 @@ Result<CuttlefishConfig> InitializeCuttlefishConfiguration(
vhost_user_vsock_vec[instance_index]);
}

if (enable_pkvm_vec[instance_index]) {
CF_EXPECT_EQ(tmp_config_obj.vm_manager(), VmmMode::kCrosvm,
"Only crosvm supports --enable_pkvm");
CF_EXPECT_EQ(guest_configs[instance_index].target_arch, Arch::Arm64,
"--enable_pkvm requires an arm64 guest");
}
instance.set_enable_pkvm(enable_pkvm_vec[instance_index]);

if (use_random_serial_vec[instance_index]) {
instance.set_serial_number(
RandomSerialNumber("CFCVD" + std::to_string(num)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
#define CF_DEFAULTS_SECURE_HALS CF_DEFAULTS_DYNAMIC_STRING
#define CF_DEFAULTS_PROTECTED_VM false
#define CF_DEFAULTS_MTE false
#define CF_DEFAULTS_ENABLE_PKVM false

// Kernel default parameters
#define CF_DEFAULTS_ENABLE_KERNEL_LOG true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,23 @@ namespace {
constexpr char kMiscInfoPath[] = "META/misc_info.txt";
constexpr char kDynamicPartitionsPath[] = "META/dynamic_partitions_info.txt";
constexpr std::array kVendorTargetImages = {
"IMAGES/boot.img", "IMAGES/dtbo.img",
"IMAGES/init_boot.img", "IMAGES/odm.img",
"IMAGES/odm_dlkm.img", "IMAGES/recovery.img",
"IMAGES/system_dlkm.img", "IMAGES/userdata.img",
"IMAGES/vbmeta.img", "IMAGES/vbmeta_system_dlkm.img",
"IMAGES/vbmeta_vendor.img", "IMAGES/vbmeta_vendor_dlkm.img",
"IMAGES/vendor.img", "IMAGES/vendor_boot.img",
"IMAGES/vendor_dlkm.img", "IMAGES/vendor_kernel_boot.img",
"IMAGES/boot.img",
"IMAGES/dtbo.img",
"IMAGES/init_boot.img",
"IMAGES/odm.img",
"IMAGES/odm_dlkm.img",
"IMAGES/pvmfw.img",
"IMAGES/recovery.img",
"IMAGES/system_dlkm.img",
"IMAGES/userdata.img",
"IMAGES/vbmeta.img",
"IMAGES/vbmeta_system_dlkm.img",
"IMAGES/vbmeta_vendor.img",
"IMAGES/vbmeta_vendor_dlkm.img",
"IMAGES/vendor.img",
"IMAGES/vendor_boot.img",
"IMAGES/vendor_dlkm.img",
"IMAGES/vendor_kernel_boot.img",
};
constexpr std::array kVendorTargetBuildProps = {
"ODM/build.prop",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ std::vector<std::string> GetRamdiskModules(
"vmw_vsock_virtio_transport.ko",
"vmw_vsock_virtio_transport_common.ko",
"vsock.ko",
"pkvm_iommu_temp.ko",
// TODO(b/176860479) once virt_wifi is deprecated fully,
// these following modules can be loaded in second stage init
"libarc4.ko",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ graph {
vm--config
vm--memory_mb
vm--custom_actions
vm--enable_pkvm
vm--vm_manager
crosvm_binary_dir [label = "binary_dir"]
qemu_binary_dir [label = "binary_dir"]
Expand Down
Binary file modified base/cvd/cuttlefish/host/commands/cvd/cli/parser/doc/vm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading