Commit graph

402 commits

Author SHA1 Message Date
Changyuan Lyu
bc5ee80a77 fix(pci): do not add resources to memory at boot
As per PCIe Spec v6.1 Sec 7.5.1.1.3 Table 7-4, the default values of
the memory and I/O space bits of the Command register are 0.

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-07-04 12:00:37 -07:00
Changyuan Lyu
ce1554948c fix(virtio): mark non-prefetchable BARs as 32-bit
PCIe Spec v6.1 Sec 7.5.1.3.8 does not include the support
for 64-bit non-prefetchable BARs.

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-07-04 12:00:37 -07:00
Changyuan Lyu
3d3d6df856 refactor: move x86_64 ACPI to board/x86_64
Module ACPI should only include helpers for individual tables.
Putting tables together is architecture dependent.

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-07-04 12:00:37 -07:00
Changyuan Lyu
79ec0077b4 fix(mem/aarch64): create guest memory with memfd
Shared memory is required to make vhost-user devices work.

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-30 16:37:18 -07:00
Changyuan Lyu
01d387b0f0 fix(kvm/aarch64): set DevID in GSI routing table
Fixes: 6ca2e25b89 ("feat(kvm/aarch64)!: assign a DevID to MsiSender")

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-30 16:06:32 -07:00
Changyuan Lyu
6ca2e25b89 feat(kvm/aarch64)!: assign a DevID to MsiSender
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-29 12:03:04 -07:00
Changyuan Lyu
3160823378 feat(pci)!: reserve a BDF before adding a device
MSI on aarch64 requires an additional devid, which is usually the
device BDF. Thus the `MsiSender` of a PCI device needs to know the
BDF. However, currently the BDF is unknown until the device
has been plugged into the PCI bus.

This commit changes the API such that a BDF is reserved first before
a device is plugged in. The reserved BDF then can be passed to the
constructor of an `MsiSender`.

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-29 11:41:14 -07:00
Changyuan Lyu
b766dbc54c feat(board/aarch64): create a GIC V3 if supported
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-29 09:54:48 -07:00
Changyuan Lyu
9fb57c7655 feat(kvm/aarch64): create and init GIC V3 and ITS
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-29 09:54:48 -07:00
Changyuan Lyu
b71ee9aac3 refactor(kvm): add a module for in-kernel devices
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-29 09:54:48 -07:00
Changyuan Lyu
a90f1b44c8 docs: fix the vhost-vsock dev path
/dev/vsock is the guest vsock driver.

Fixes: 2e59fe0866 ("docs: update README.md")

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-26 01:14:02 -07:00
Changyuan Lyu
2e59fe0866 docs: update README.md
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-26 00:53:25 -07:00
Changyuan Lyu
164b6abd3c docs(snp): boot SEV-SNP guests with latest KVM
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-26 00:53:25 -07:00
Changyuan Lyu
57c5667c12 feat(hvf): map/unmap guest memory
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-23 15:37:06 -07:00
Changyuan Lyu
f0719ff1c4 feat(hvf): create and destroy VCPUs
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-23 15:37:06 -07:00
Changyuan Lyu
8165673b00 fix(cli): derive Default for Hypervisor on macOS
This removes the `derivable_impls` warning from clippy.

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-23 15:37:06 -07:00
Changyuan Lyu
ebeff5f872 feat(hvf): create and destroy guests
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-23 15:37:06 -07:00
Changyuan Lyu
cd95d29164 refactor(hvf): move Vm and Vcpu to sub modules
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-23 15:37:06 -07:00
Changyuan Lyu
e26a46887a fix(board)!: handle shutdown and reset on aarch64
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-22 23:41:26 -07:00
Changyuan Lyu
8c45dd7ef4 fix(board): do not add PCI IO bus on aarch64
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-22 23:41:26 -07:00
Changyuan Lyu
a324ecfc57 fix(board): impl empty coco_* methods on aarch64
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-22 23:41:26 -07:00
Changyuan Lyu
1c1148639e feat(board): create devicetree for aarch64 guests
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-22 23:12:49 -07:00
Changyuan Lyu
5634465cda feat(dt): add a module for creating devicetree
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-22 23:12:49 -07:00
Changyuan Lyu
7d5f6e8838 feat(loader): load Linux kernel image on aarch64
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-22 23:12:49 -07:00
Changyuan Lyu
810211b228 feat(pl011): implement an emuldated UART(PL011)
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-22 20:30:29 -07:00
Changyuan Lyu
41eee098f6 feat(kvm): create up to 32 IrqSenders on aarch64
Most devices should use MSI. 32 SPIs should be enough for MMIO
devices.

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-22 20:30:29 -07:00
Changyuan Lyu
aeac0b601d fix(hv)!: rename IntxSender to IrqSender
The term "INTx" seems to be mostly used with PCI devices. "IRQ" is a
more general name for pin-based interrupts.

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-22 20:30:29 -07:00
Changyuan Lyu
ca2319a82d fix(vm): create VCPU and GIC earlier than devices
On aarch64, as required by KVM, all VCPUs and the GIC must be created
before any IRQFD can be created.

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-22 20:30:29 -07:00
Changyuan Lyu
914c725936 refactor(serial): split out console as a new mod
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-22 20:30:29 -07:00
Changyuan Lyu
98be90f6d6 feat(board): create RAM for aarch64 VMs
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-21 17:50:12 -07:00
Changyuan Lyu
1978840e70 feat(kvm)!: init aarch64 VCPUs
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-21 17:50:12 -07:00
Changyuan Lyu
5d037becae feat(board)!: create and init GIC V2 for aarch64
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-21 17:50:12 -07:00
Changyuan Lyu
e79171d626 feat(kvm)!: create in-kernel GIC V2 for aarch64
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-21 17:50:12 -07:00
Changyuan Lyu
4563d5fb33 feat(kvm)!: get/set aarch64 registers
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-21 17:50:12 -07:00
Changyuan Lyu
cab83e44b0 fix(kvm): add cfg attr to remove compiler warnings
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-21 17:50:12 -07:00
Changyuan Lyu
548e748a85 fix!: use u64 as the type of guest addresses
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-21 00:09:15 -07:00
Changyuan Lyu
42ee9393bb ci: cargo clippy for aarch64-unknown-linux-gnu
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-19 15:57:01 -07:00
Changyuan Lyu
645879bfac ci: add action cache to reduce workflow time
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-19 15:57:01 -07:00
Changyuan Lyu
61eb8200f8 ci: remove Cirrus, add GitHub Actions on macOS
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-16 22:12:28 -07:00
Changyuan Lyu
78e4f92e96 feat: skeleton for running VMs on Apple silicon
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-16 22:12:28 -07:00
Changyuan Lyu
7065002d42 fix(trace_error): add cfg attr to match arms
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-16 22:12:28 -07:00
Changyuan Lyu
038329b721 feat: skeleton for running KVM VMs on aarch64
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-16 20:43:01 -07:00
Changyuan Lyu
6368c4fb38 feat: add definitions for aarch64 registers
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-16 20:43:01 -07:00
Changyuan Lyu
468080b5b0 refactor(board): separate out arch-dependent code
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-16 20:43:01 -07:00
Changyuan Lyu
2603a38380 refactor(kvm): separate out AMD-SEV related code
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-16 20:43:01 -07:00
Changyuan Lyu
6efa97ab84 refactor(kvm): separate out arch-dependent code
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-16 20:43:01 -07:00
Changyuan Lyu
c8e891e7e7 refactor: move x86_64 registers to module arch
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-16 20:43:01 -07:00
Changyuan Lyu
54a12de6f5 test(kvm): move VCPU tests to sub module x86_64
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-16 20:43:01 -07:00
Changyuan Lyu
917cc88c3c refactor(kvm): use c_enum for KVM VM types
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-16 19:29:37 -07:00
Changyuan Lyu
3813d22a43 refactor(kvm): use c_enum for capabilities
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-06-16 19:29:37 -07:00