1 /* 2 * Copyright 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package android.system.virtualizationservice; 17 18 import android.system.virtualizationservice.CpuTopology; 19 import android.system.virtualizationservice.DiskImage; 20 import android.system.virtualizationservice.DisplayConfig; 21 import android.system.virtualizationservice.GpuConfig; 22 import android.system.virtualizationservice.InputDevice; 23 24 /** Raw configuration for running a VM. */ 25 parcelable VirtualMachineRawConfig { 26 /** Name of VM */ 27 String name; 28 29 /** Id of the VM instance */ 30 byte[64] instanceId; 31 32 /** The kernel image, if any. */ 33 @nullable ParcelFileDescriptor kernel; 34 35 /** The initial ramdisk for the kernel, if any. */ 36 @nullable ParcelFileDescriptor initrd; 37 38 /** 39 * Parameters to pass to the kernel. As far as the VMM and boot protocol are concerned this is 40 * just a string, but typically it will contain multiple parameters separated by spaces. 41 */ 42 @nullable @utf8InCpp String params; 43 44 /** 45 * The bootloader to use. If this is supplied then the kernel and initrd must not be supplied; 46 * the bootloader is instead responsibly for loading the kernel from one of the disks. 47 */ 48 @nullable ParcelFileDescriptor bootloader; 49 50 /** Disk images to be made available to the VM. */ 51 DiskImage[] disks; 52 53 /** Whether the VM should be a protected VM. */ 54 boolean protectedVm; 55 56 /** The amount of RAM to give the VM, in MiB. 0 or negative to use the default. */ 57 int memoryMib; 58 59 /** The vCPU topology that will be generated for the VM. Default to 1 vCPU. */ 60 CpuTopology cpuTopology = CpuTopology.ONE_CPU; 61 62 /** 63 * A version or range of versions of the virtual platform that this config is compatible with. 64 * The format follows SemVer. 65 */ 66 @utf8InCpp String platformVersion; 67 68 /** 69 * Port at which crosvm will start a gdb server to debug guest kernel. 70 * If set to zero, then gdb server won't be started. 71 */ 72 int gdbPort = 0; 73 74 /** 75 * Ask the kernel for transparent huge-pages (THP). This is only a hint and 76 * the kernel will allocate THP-backed memory only if globally enabled by 77 * the system and if any can be found. See 78 * https://docs.kernel.org/admin-guide/mm/transhuge.html 79 */ 80 boolean hugePages; 81 82 /** List of SysFS nodes of devices to be assigned */ 83 String[] devices; 84 85 @nullable DisplayConfig displayConfig; 86 87 /** List of input devices to the VM */ 88 InputDevice[] inputDevices; 89 90 /** Whether the VM should have network feature. */ 91 boolean networkSupported; 92 93 /** The serial device for VM console input. */ 94 @nullable @utf8InCpp String consoleInputDevice; 95 96 /** Enable boost UClamp for less variance during testing/benchmarking */ 97 boolean boostUclamp; 98 99 @nullable GpuConfig gpuConfig; 100 } 101