Skip to content

Commit 2c4d9dd

Browse files
committed
doc: add documentation on usage of PCI support
Add information in our Documentation regarding how users can enable PCI support for Firecracker microVMs and mention requirements for building the guest kernel, as well as the requirements for kernel command line parameters. Also, add an entry in the CHANGELOG mentioning the addition of PCI support. (cherry picked from commit 431d77e) Signed-off-by: Babis Chalios <[email protected]>
1 parent 127fcf8 commit 2c4d9dd

File tree

4 files changed

+82
-3
lines changed

4 files changed

+82
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ and this project adheres to
3535
requests to `/mmds/config` to enforce MMDS to always respond plain text
3636
contents in the IMDS format regardless of the `Accept` header in requests.
3737
Users need to regenerate snapshots.
38+
- [#5364](https://github.com/firecracker-microvm/firecracker/pull/5364): Added
39+
PCI support in Firecracker. PCI support is optional. Users can enable it
40+
passing the `--enable-pci` flag when launching the Firecracker process. When
41+
Firecracker process is launched with PCI support, it will create all VirtIO
42+
devices using a PCI VirtIO transport. If not enabled, Firecracker will use the
43+
MMIO transport instead.
3844

3945
### Changed
4046

FAQ.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ Example of a kernel valid command line that enables the serial console (which
129129
goes in the `boot_args` field of the `/boot-source` Firecracker API resource):
130130

131131
```console
132-
console=ttyS0 reboot=k panic=1 pci=off nomodule
132+
console=ttyS0 reboot=k panic=1 nomodule
133133
```
134134

135135
### How can I configure multiple Ethernet devices through the kernel command line?

docs/getting-started.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,16 @@ API_SOCKET="/tmp/firecracker.socket"
194194
sudo rm -f $API_SOCKET
195195

196196
# Run firecracker
197-
sudo ./firecracker --api-sock "${API_SOCKET}"
197+
sudo ./firecracker --api-sock "${API_SOCKET} --enable-pci"
198198
```
199199

200+
The `--enable-pci` flag instructs Firecracker to create all VirtIO devices using
201+
a PCI VirtIO transport. This flag is optional. If not passed, Firecracker will
202+
create devices using the legacy MMIO transport. We suggest that users enable the
203+
PCI transport, as it yields higher throughput and lower latency for VirtIO
204+
devices. For more information regarding guest kernel requirements for using PCI
205+
look at our [kernel policy documentation](./kernel-policy.md).
206+
200207
In a new terminal (do not close the 1st one):
201208

202209
```bash
@@ -240,7 +247,7 @@ sudo curl -X PUT --unix-socket "${API_SOCKET}" \
240247
"http://localhost/logger"
241248

242249
KERNEL="./$(ls vmlinux* | tail -1)"
243-
KERNEL_BOOT_ARGS="console=ttyS0 reboot=k panic=1 pci=off"
250+
KERNEL_BOOT_ARGS="console=ttyS0 reboot=k panic=1"
244251

245252
ARCH=$(uname -m)
246253

docs/kernel-policy.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ The configuration items that may be relevant for Firecracker are:
6767
- use CPU RNG instructions (if present) to initialize RNG. Available for >=
6868
5.10
6969
- ACPI support - `CONFIG_ACPI` and `CONFIG_PCI`
70+
- PCI support:
71+
- `CONFIG_BLK_MQ_PCI`
72+
- `CONFIG_PCI`
73+
- `CONFIG_PCI_MMCONFIG`
74+
- `CONFIG_PCI_MSI`
75+
- `CONFIG_PCIEPORTBUS`
76+
- `CONFIG_VIRTIO_PCI`
77+
- `CONFIG_PCI_HOST_COMMON`
78+
- `CONFIG_PCI_HOST_GENERIC`
7079

7180
There are also guest config options which are dependant on the platform on which
7281
Firecracker is run:
@@ -138,6 +147,63 @@ following configurations:
138147
- Only legacy mechanisms
139148
- Both ACPI and legacy mechanisms
140149

150+
##### Booting with PCI:
151+
152+
Firecracker supports booting guest microVMs with PCI support. This option is
153+
enabled using the `--enable-pci` flag when launching the Firecracker process.
154+
With PCI enabled, Firecracker will create all VirtIO devices using a PCI VirtIO
155+
transport. The PCI transport typically achieves higher throughput and lower
156+
latency for VirtIO devices. No further, per device, configuration is needed to
157+
enable the PCI transport.
158+
159+
PCI support is optional; if it is not enabled Firecracker will create VirtIO
160+
devices using the MMIO transport.
161+
162+
For Firecracker microVMs to boot properly with PCI support, use a guest kernel
163+
built with PCI support. See the relevant Kconfig flags in our list of
164+
[relevant Kconfig options](#guest-kernel-configuration-items):
165+
166+
> [!IMPORTANT]
167+
>
168+
> Make sure that the kernel command line **does NOT** include the `pci=off`
169+
> slug, which disables PCI support during boot time within the guest. When PCI
170+
> is disabled, Firecracker will add this slug in the command line to instruct
171+
> the guest kernel to skip useless PCI checks. For more info, look into the
172+
> section for [Kernel command line parameters](#kernel-command-line-parameters).
173+
174+
> [!NOTE]
175+
>
176+
> On x86_64 systems, `CONFIG_PCI` Kconfig option is needed even when booting
177+
> microVMs without PCI support in case users want to use ACPI to boot. See
178+
> [here](#booting-with-acpi-x86_64-only) for more info.
179+
180+
## Kernel command line parameters
181+
182+
By default, Firecracker will boot a guest microVM passing the following command
183+
line parameters to the kernel:
184+
185+
`reboot=k panic=1 nomodule 8250.nr_uarts=0 i8042.noaux i8042.nomux i8042.dumbkbd swiotlb=noforce`.
186+
187+
- `reboot=k` shut down the guest on reboot, instead of rebooting
188+
- `panic=1` on panic, reboot after 1 second
189+
- `nomodule` disable loadable kernel module support
190+
- `8250.nr_uarts=0` disable 8250 serial interface
191+
- `i8042.noaux` do not probe the i8042 controller for an attached mouse (save
192+
boot time)
193+
- `i8042.nomux` do not probe i8042 for a multiplexing controller (save boot
194+
time)
195+
- `i8042.dumbkbd` do not attempt to control kbd state via the i8042 (save boot
196+
time)
197+
- `swiotlb=noforce` disable software bounce buffers (SWIOTLB)
198+
199+
When running without [PCI support](#booting-with-pci), Firecracker will also
200+
append `pci=off` to the above list. This option instructs the guest kernel to
201+
avoid PCI probing.
202+
203+
Users can provide their own command line parameters through the `boot_args`
204+
field of the `/boot-source`
205+
[Firecracker API](../src/firecracker/swagger/firecracker.yaml).
206+
141207
## Caveats
142208

143209
- [Snapshot compatibility across kernel versions](snapshotting/snapshot-support.md#snapshot-compatibility-across-kernel-versions)

0 commit comments

Comments
 (0)