Skip to content

Commit 2a2b892

Browse files
committed
fix(swagger): add definitions for CpuConfig
The custom CPU templates were just a plain object with no definition of their fields. This patch adds specific definition for all its fields. Signed-off-by: Riccardo Mancini <[email protected]>
1 parent 198af57 commit 2a2b892

File tree

1 file changed

+109
-11
lines changed

1 file changed

+109
-11
lines changed

src/firecracker/swagger/firecracker.yaml

Lines changed: 109 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -898,21 +898,119 @@ definitions:
898898
The CPU configuration template defines a set of bit maps as modifiers of flags accessed by register
899899
to be disabled/enabled for the microvm.
900900
properties:
901+
kvm_capabilities:
902+
type: array
903+
description: A collection of KVM capabilities to be added or removed (both x86_64 and aarch64)
904+
items:
905+
type: string
906+
description: KVM capability as a numeric string. Prefix with '!' to remove capability. Example "121" (add) or "!121" (remove)
901907
cpuid_modifiers:
902-
type: object
903-
description: A collection of CPUIDs to be modified. (x86_64)
908+
type: array
909+
description: A collection of CPUID leaf modifiers (x86_64 only)
910+
items:
911+
$ref: "#/definitions/CpuidLeafModifier"
904912
msr_modifiers:
905-
type: object
906-
description: A collection of model specific registers to be modified. (x86_64)
913+
type: array
914+
description: A collection of model specific register modifiers (x86_64 only)
915+
items:
916+
$ref: "#/definitions/MsrModifier"
907917
reg_modifiers:
908-
type: object
909-
description: A collection of registers to be modified. (aarch64)
918+
type: array
919+
description: A collection of register modifiers (aarch64 only)
920+
items:
921+
$ref: "#/definitions/ArmRegisterModifier"
910922
vcpu_features:
911-
type: object
912-
description: A collection of vcpu features to be modified. (aarch64)
913-
kvm_capabilities:
914-
type: object
915-
description: A collection of kvm capabilities to be modified. (aarch64)
923+
type: array
924+
description: A collection of vCPU features to be modified (aarch64 only)
925+
items:
926+
$ref: "#/definitions/VcpuFeatures"
927+
928+
CpuidLeafModifier:
929+
type: object
930+
description: Modifier for a CPUID leaf and subleaf (x86_64)
931+
required:
932+
- leaf
933+
- subleaf
934+
- flags
935+
- modifiers
936+
properties:
937+
leaf:
938+
type: string
939+
description: CPUID leaf index as hex string (e.g., "0x1" or "0x80000001")
940+
subleaf:
941+
type: string
942+
description: CPUID subleaf index as hex, binary, or decimal string (e.g., "0x0", "0b0", "0")
943+
flags:
944+
type: integer
945+
format: int32
946+
description: KVM feature flags for this leaf-subleaf
947+
modifiers:
948+
type: array
949+
description: Register modifiers for this CPUID leaf
950+
items:
951+
$ref: "#/definitions/CpuidRegisterModifier"
952+
953+
CpuidRegisterModifier:
954+
type: object
955+
description: Modifier for a specific CPUID register within a leaf (x86_64)
956+
required:
957+
- register
958+
- bitmap
959+
properties:
960+
register:
961+
type: string
962+
description: Target CPUID register name
963+
enum:
964+
- eax
965+
- ebx
966+
- ecx
967+
- edx
968+
bitmap:
969+
type: string
970+
description: 32-bit bitmap string defining which bits to modify. Format is "0b" followed by 32 characters where '0' = clear bit, '1' = set bit, 'x' = don't modify. Example "0b00000000000000000000000000000001" or "0bxxxxxxxxxxxxxxxxxxxxxxxxxxxx0001"
971+
972+
MsrModifier:
973+
type: object
974+
description: Modifier for a model specific register (x86_64)
975+
required:
976+
- addr
977+
- bitmap
978+
properties:
979+
addr:
980+
type: string
981+
description: MSR address as hex string (e.g., "0x10a")
982+
bitmap:
983+
type: string
984+
description: 64-bit bitmap string defining which bits to modify. Format is "0b" followed by 64 characters where '0' = clear bit, '1' = set bit, 'x' = don't modify. Underscores can be used for readability. Example "0b0000000000000000000000000000000000000000000000000000000000000001"
985+
986+
ArmRegisterModifier:
987+
type: object
988+
description: Modifier for an ARM register (aarch64)
989+
required:
990+
- addr
991+
- bitmap
992+
properties:
993+
addr:
994+
type: string
995+
description: Register address as hex string (e.g., "0x0030000000000000")
996+
bitmap:
997+
type: string
998+
description: 128-bit bitmap string defining which bits to modify. Format is "0b" followed by up to 128 characters where '0' = clear bit, '1' = set bit, 'x' = don't modify. Underscores can be used for readability. Example "0b0000000000000000000000000000000000000000000000000000000000000001"
999+
1000+
VcpuFeatures:
1001+
type: object
1002+
description: vCPU feature modifier (aarch64)
1003+
required:
1004+
- index
1005+
- bitmap
1006+
properties:
1007+
index:
1008+
type: integer
1009+
format: int32
1010+
description: Index in the kvm_vcpu_init.features array
1011+
bitmap:
1012+
type: string
1013+
description: 32-bit bitmap string defining which bits to modify. Format is "0b" followed by 32 characters where '0' = clear bit, '1' = set bit, 'x' = don't modify. Example "0b00000000000000000000000001100000"
9161014

9171015
Drive:
9181016
type: object

0 commit comments

Comments
 (0)