Skip to content

Commit ad6e215

Browse files
authored
Merge branch 'main' into sapphire_rapids
2 parents da1e9b1 + e7f6051 commit ad6e215

File tree

219 files changed

+3454
-5629
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

219 files changed

+3454
-5629
lines changed

.cargo/audit.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
[advisories]
2+
# The `paste` dependency is transitively included via `gdbstub`.
3+
# While the crate is archived/unmaintained, the author considers it feature-complete
4+
# and functionally stable. gdbstub will be update once they migrate
5+
# to an alternative solution.
6+
# See https://github.com/daniel5151/gdbstub/issues/168
7+
ignore = ["RUSTSEC-2024-0436"]

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ and this project adheres to
2121

2222
### Fixed
2323

24+
- #\[[5074](https://github.com/firecracker-microvm/firecracker/pull/5074)\] Fix
25+
the `SendCtrlAltDel` command not working for ACPI-enabled guest kernels, by
26+
dropping the i8042.nopnp argument from the default kernel command line
27+
Firecracker constructs.
28+
2429
## [1.11.0]
2530

2631
### Added

docs/tracing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ clippy-tracing \
4646
--action fix \
4747
--path ./src \
4848
--exclude benches \
49-
--exclude virtio/gen,bindings.rs,net/gen \
49+
--exclude virtio/generated,bindings.rs,net/generated \
5050
--exclude log-instrument-macros/,log-instrument/,clippy-tracing/ \
5151
--exclude vmm_config/logger.rs,logger/,signal_handler.rs,time.rs
5252
```

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# allowlisted using a toolchain that requires it, causing the A/B-test to
1212
# always fail.
1313
[toolchain]
14-
channel = "1.83.0"
14+
channel = "1.85.0"
1515
targets = ["x86_64-unknown-linux-musl", "aarch64-unknown-linux-musl"]
1616
profile = "minimal"
1717

src/acpi-tables/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "acpi_tables"
33
version = "0.1.0"
44
authors = ["The Cloud Hypervisor Authors", "Amazon Firecracker team <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
license = "Apache-2.0"
77
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88

src/acpi-tables/src/aml.rs

Lines changed: 47 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,12 @@ impl EisaName {
265265

266266
let data = name.as_bytes();
267267

268-
let value: u32 = (u32::from(data[0] - 0x40) << 26
269-
| u32::from(data[1] - 0x40) << 21
270-
| u32::from(data[2] - 0x40) << 16
271-
| name.chars().nth(3).unwrap().to_digit(16).unwrap() << 12
272-
| name.chars().nth(4).unwrap().to_digit(16).unwrap() << 8
273-
| name.chars().nth(5).unwrap().to_digit(16).unwrap() << 4
268+
let value: u32 = ((u32::from(data[0] - 0x40) << 26)
269+
| (u32::from(data[1] - 0x40) << 21)
270+
| (u32::from(data[2] - 0x40) << 16)
271+
| (name.chars().nth(3).unwrap().to_digit(16).unwrap() << 12)
272+
| (name.chars().nth(4).unwrap().to_digit(16).unwrap() << 8)
273+
| (name.chars().nth(5).unwrap().to_digit(16).unwrap() << 4)
274274
| name.chars().nth(6).unwrap().to_digit(16).unwrap())
275275
.swap_bytes();
276276

@@ -439,7 +439,7 @@ where
439439
r#type: AddressSpaceType::Memory,
440440
min,
441441
max,
442-
type_flags: (cacheable as u8) << 1 | u8::from(read_write),
442+
type_flags: ((cacheable as u8) << 1) | u8::from(read_write),
443443
})
444444
}
445445

@@ -471,7 +471,7 @@ where
471471
bytes.push(descriptor); // Word Address Space Descriptor
472472
bytes.extend_from_slice(&(TryInto::<u16>::try_into(length).unwrap()).to_le_bytes());
473473
bytes.push(self.r#type as u8); // type
474-
let generic_flags = 1 << 2 /* Min Fixed */ | 1 << 3; // Max Fixed
474+
let generic_flags = (1 << 2) /* Min Fixed */ | (1 << 3); // Max Fixed
475475
bytes.push(generic_flags);
476476
bytes.push(self.type_flags);
477477
}
@@ -591,9 +591,9 @@ impl Aml for Interrupt {
591591
fn append_aml_bytes(&self, bytes: &mut Vec<u8>) -> Result<(), AmlError> {
592592
bytes.push(0x89); // Extended IRQ Descriptor
593593
bytes.extend_from_slice(&6u16.to_le_bytes());
594-
let flags = u8::from(self.shared) << 3
595-
| u8::from(self.active_low) << 2
596-
| u8::from(self.edge_triggered) << 1
594+
let flags = (u8::from(self.shared) << 3)
595+
| (u8::from(self.active_low) << 2)
596+
| (u8::from(self.edge_triggered) << 1)
597597
| u8::from(self.consumer);
598598
bytes.push(flags);
599599
bytes.push(1u8); // count
@@ -682,7 +682,7 @@ impl Aml for Method<'_> {
682682
fn append_aml_bytes(&self, bytes: &mut Vec<u8>) -> Result<(), AmlError> {
683683
let mut tmp = Vec::new();
684684
self.path.append_aml_bytes(&mut tmp)?;
685-
let flags: u8 = (self.args & 0x7) | u8::from(self.serialized) << 3;
685+
let flags: u8 = (self.args & 0x7) | (u8::from(self.serialized) << 3);
686686
tmp.push(flags);
687687
for child in &self.children {
688688
child.append_aml_bytes(&mut tmp)?;
@@ -766,7 +766,7 @@ impl Aml for Field {
766766
let mut tmp = Vec::new();
767767
self.path.append_aml_bytes(&mut tmp)?;
768768

769-
let flags: u8 = self.access_type as u8 | (self.update_rule as u8) << 5;
769+
let flags: u8 = self.access_type as u8 | ((self.update_rule as u8) << 5);
770770
tmp.push(flags);
771771

772772
for field in self.fields.iter() {
@@ -1263,15 +1263,17 @@ mod tests {
12631263
assert_eq!(
12641264
Scope::new(
12651265
"_SB_.MBRD".try_into().unwrap(),
1266-
vec![&Name::new(
1267-
"_CRS".try_into().unwrap(),
1268-
&ResourceTemplate::new(vec![&Memory32Fixed::new(
1269-
true,
1270-
0xE800_0000,
1271-
0x1000_0000
1272-
)])
1273-
)
1274-
.unwrap()]
1266+
vec![
1267+
&Name::new(
1268+
"_CRS".try_into().unwrap(),
1269+
&ResourceTemplate::new(vec![&Memory32Fixed::new(
1270+
true,
1271+
0xE800_0000,
1272+
0x1000_0000
1273+
)])
1274+
)
1275+
.unwrap()
1276+
]
12751277
)
12761278
.to_aml_bytes()
12771279
.unwrap(),
@@ -1438,13 +1440,15 @@ mod tests {
14381440
assert_eq!(
14391441
Name::new(
14401442
"_CRS".try_into().unwrap(),
1441-
&ResourceTemplate::new(vec![&AddressSpace::new_memory(
1442-
AddressSpaceCacheable::Cacheable,
1443-
true,
1444-
0x8_0000_0000u64,
1445-
0xf_ffff_ffffu64
1446-
)
1447-
.unwrap()])
1443+
&ResourceTemplate::new(vec![
1444+
&AddressSpace::new_memory(
1445+
AddressSpaceCacheable::Cacheable,
1446+
true,
1447+
0x8_0000_0000u64,
1448+
0xf_ffff_ffffu64
1449+
)
1450+
.unwrap()
1451+
])
14481452
)
14491453
.unwrap()
14501454
.to_aml_bytes()
@@ -1491,12 +1495,12 @@ mod tests {
14911495
assert_eq!(create_pkg_length(&[0u8; 62], true), vec![63]);
14921496
assert_eq!(
14931497
create_pkg_length(&[0u8; 64], true),
1494-
vec![1 << 6 | (66 & 0xf), 66 >> 4]
1498+
vec![(1 << 6) | (66 & 0xf), 66 >> 4]
14951499
);
14961500
assert_eq!(
14971501
create_pkg_length(&[0u8; 4096], true),
14981502
vec![
1499-
2 << 6 | (4099 & 0xf) as u8,
1503+
(2 << 6) | (4099 & 0xf) as u8,
15001504
((4099 >> 4) & 0xff).try_into().unwrap(),
15011505
((4099 >> 12) & 0xff).try_into().unwrap()
15021506
]
@@ -1553,7 +1557,9 @@ mod tests {
15531557
(&"_SB_.PCI0._HID".try_into().unwrap() as &Path)
15541558
.to_aml_bytes()
15551559
.unwrap(),
1556-
[0x2F, 0x03, 0x5F, 0x53, 0x42, 0x5F, 0x50, 0x43, 0x49, 0x30, 0x5F, 0x48, 0x49, 0x44]
1560+
[
1561+
0x2F, 0x03, 0x5F, 0x53, 0x42, 0x5F, 0x50, 0x43, 0x49, 0x30, 0x5F, 0x48, 0x49, 0x44
1562+
]
15571563
);
15581564
}
15591565

@@ -2007,13 +2013,15 @@ mod tests {
20072013
vec![
20082014
&Name::new(
20092015
"MR64".try_into().unwrap(),
2010-
&ResourceTemplate::new(vec![&AddressSpace::new_memory(
2011-
AddressSpaceCacheable::Cacheable,
2012-
true,
2013-
0x0000_0000_0000_0000u64,
2014-
0xFFFF_FFFF_FFFF_FFFEu64
2015-
)
2016-
.unwrap()])
2016+
&ResourceTemplate::new(vec![
2017+
&AddressSpace::new_memory(
2018+
AddressSpaceCacheable::Cacheable,
2019+
true,
2020+
0x0000_0000_0000_0000u64,
2021+
0xFFFF_FFFF_FFFF_FFFEu64
2022+
)
2023+
.unwrap()
2024+
])
20172025
)
20182026
.unwrap(),
20192027
&CreateField::<u64>::new(

src/acpi-tables/src/dsdt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::mem::size_of;
66
use vm_memory::{Address, Bytes, GuestAddress, GuestMemory};
77
use zerocopy::IntoBytes;
88

9-
use crate::{checksum, AcpiError, Result, Sdt, SdtHeader};
9+
use crate::{AcpiError, Result, Sdt, SdtHeader, checksum};
1010

1111
/// Differentiated System Description Table (DSDT)
1212
///

src/acpi-tables/src/fadt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use vm_memory::{Bytes, GuestAddress, GuestMemory};
77
use zerocopy::little_endian::{U16, U32, U64};
88
use zerocopy::{Immutable, IntoBytes};
99

10-
use crate::{checksum, GenericAddressStructure, Result, Sdt, SdtHeader};
10+
use crate::{GenericAddressStructure, Result, Sdt, SdtHeader, checksum};
1111

1212
#[cfg(target_arch = "x86_64")]
1313
pub const IAPC_BOOT_ARG_FLAGS_VGA_NOT_PRESENT: u16 = 2;
@@ -41,7 +41,7 @@ pub const FADT_F_HW_REDUCED_ACPI: u8 = 20;
4141
/// the pointer to the DSDT table.
4242
/// More information about this table can be found in the ACPI specification:
4343
/// https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#fixed-acpi-description-table-fadt
44-
#[repr(packed)]
44+
#[repr(C, packed)]
4545
#[derive(Debug, Copy, Clone, Default, IntoBytes, Immutable)]
4646
pub struct Fadt {
4747
header: SdtHeader,

src/acpi-tables/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub enum AcpiError {
4949
pub type Result<T> = std::result::Result<T, AcpiError>;
5050

5151
/// ACPI type representing memory addresses
52-
#[repr(packed)]
52+
#[repr(C, packed)]
5353
#[derive(IntoBytes, Immutable, Clone, Copy, Debug, Default)]
5454
pub struct GenericAddressStructure {
5555
pub address_space_id: u8,
@@ -78,7 +78,7 @@ impl GenericAddressStructure {
7878
}
7979

8080
/// Header included in all System Descriptor Tables
81-
#[repr(packed)]
81+
#[repr(C, packed)]
8282
#[derive(Clone, Debug, Copy, Default, IntoBytes, Immutable)]
8383
pub struct SdtHeader {
8484
pub signature: [u8; 4],

src/acpi-tables/src/madt.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ use vm_memory::{Address, Bytes, GuestAddress, GuestMemory};
99
use zerocopy::little_endian::U32;
1010
use zerocopy::{Immutable, IntoBytes};
1111

12-
use crate::{checksum, AcpiError, Result, Sdt, SdtHeader};
12+
use crate::{AcpiError, Result, Sdt, SdtHeader, checksum};
1313

1414
const MADT_CPU_ENABLE_FLAG: u32 = 0;
1515

1616
// clippy doesn't understand that we actually "use" the fields of this struct when we serialize
1717
// them as bytes in guest memory, so here we just ignore dead code to avoid having to name
1818
// everything with an underscore prefix
1919
#[allow(dead_code)]
20-
#[repr(packed)]
20+
#[repr(C, packed)]
2121
#[derive(Copy, Clone, Debug, Default, IntoBytes, Immutable)]
2222
pub struct LocalAPIC {
2323
r#type: u8,
@@ -43,7 +43,7 @@ impl LocalAPIC {
4343
// them as bytes in guest memory, so here we just ignore dead code to avoid having to name
4444
// everything with an underscore prefix
4545
#[allow(dead_code)]
46-
#[repr(packed)]
46+
#[repr(C, packed)]
4747
#[derive(Copy, Clone, Debug, Default, IntoBytes, Immutable)]
4848
pub struct IoAPIC {
4949
r#type: u8,
@@ -71,7 +71,7 @@ impl IoAPIC {
7171
// them as bytes in guest memory, so here we just ignore dead code to avoid having to name
7272
// everything with an underscore prefix
7373
#[allow(dead_code)]
74-
#[repr(packed)]
74+
#[repr(C, packed)]
7575
#[derive(Debug, IntoBytes, Immutable)]
7676
struct MadtHeader {
7777
sdt: SdtHeader,

src/acpi-tables/src/rsdp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use vm_memory::{Bytes, GuestAddress, GuestMemory};
88
use zerocopy::little_endian::{U32, U64};
99
use zerocopy::{Immutable, IntoBytes};
1010

11-
use crate::{checksum, Result, Sdt};
11+
use crate::{Result, Sdt, checksum};
1212

1313
// clippy doesn't understand that we actually "use" the fields of this struct when we serialize
1414
// them as bytes in guest memory, so here we just ignore dead code to avoid having to name
@@ -21,7 +21,7 @@ use crate::{checksum, Result, Sdt};
2121
/// a pointer to XSDT
2222
/// More information about this structure can be found in the ACPI specification:
2323
/// https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#root-system-description-pointer-rsdp
24-
#[repr(packed)]
24+
#[repr(C, packed)]
2525
#[derive(Clone, Copy, Debug, Default, IntoBytes, Immutable)]
2626
pub struct Rsdp {
2727
signature: [u8; 8],

src/acpi-tables/src/xsdt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::mem::size_of;
88
use vm_memory::{Address, Bytes, GuestAddress, GuestMemory};
99
use zerocopy::IntoBytes;
1010

11-
use crate::{checksum, AcpiError, Result, Sdt, SdtHeader};
11+
use crate::{AcpiError, Result, Sdt, SdtHeader, checksum};
1212

1313
/// Extended System Description Table (XSDT)
1414
///

src/clippy-tracing/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "clippy-tracing"
33
version = "0.1.0"
44
authors = ["Amazon Firecracker team <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
license = "Apache-2.0"
77

88
[[bin]]

src/clippy-tracing/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ fn exec() -> Result<Option<(PathBuf, usize, usize)>, ExecError> {
271271
// The file must not be a `build.rs` file.
272272
let not_build_file = !entry_path.ends_with("build.rs");
273273
// The file must be a `.rs` file.
274-
let is_rs_file = entry_path.extension().map_or(false, |ext| ext == "rs");
274+
let is_rs_file = entry_path.extension().is_some_and(|ext| ext == "rs");
275275

276276
if no_excluded_strings && not_build_file && is_rs_file {
277277
let file = OpenOptions::new()

src/clippy-tracing/tests/integration_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
use std::fs::{remove_file, OpenOptions};
4+
use std::fs::{OpenOptions, remove_file};
55
use std::io::{Read, Write};
66
use std::process::Command;
77

src/cpu-template-helper/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "cpu-template-helper"
33
version = "1.12.0-dev"
44
authors = ["Amazon Firecracker team <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
license = "Apache-2.0"
77

88
[[bin]]

src/cpu-template-helper/src/template/dump/aarch64.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
use vmm::arch::aarch64::regs::{RegSize, PC, SYS_CNTPCT_EL0, SYS_CNTV_CVAL_EL0};
4+
use vmm::arch::aarch64::regs::{PC, RegSize, SYS_CNTPCT_EL0, SYS_CNTV_CVAL_EL0};
55
use vmm::cpu_config::aarch64::custom_cpu_template::RegisterModifier;
66
use vmm::cpu_config::templates::{CpuConfiguration, CustomCpuTemplate, RegisterValueFilter};
77
use vmm::logger::warn;
@@ -50,7 +50,7 @@ const REG_EXCLUSION_LIST: [u64; 3] = [
5050

5151
#[cfg(test)]
5252
mod tests {
53-
use vmm::arch::aarch64::regs::{reg_size, Aarch64RegisterRef, Aarch64RegisterVec};
53+
use vmm::arch::aarch64::regs::{Aarch64RegisterRef, Aarch64RegisterVec, reg_size};
5454

5555
use super::*;
5656

src/cpu-template-helper/src/template/dump/x86_64.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33

44
use std::collections::BTreeMap;
55

6-
use vmm::arch::x86_64::gen::msr_index::*;
6+
use vmm::MSR_RANGE;
7+
use vmm::arch::x86_64::generated::msr_index::*;
78
use vmm::arch::x86_64::msr::MsrRange;
89
use vmm::cpu_config::templates::{CpuConfiguration, CustomCpuTemplate, RegisterValueFilter};
910
use vmm::cpu_config::x86_64::cpuid::common::get_vendor_id_from_host;
1011
use vmm::cpu_config::x86_64::cpuid::{Cpuid, VENDOR_ID_AMD};
1112
use vmm::cpu_config::x86_64::custom_cpu_template::{
1213
CpuidLeafModifier, CpuidRegister, CpuidRegisterModifier, RegisterModifier,
1314
};
14-
use vmm::MSR_RANGE;
1515

1616
use crate::utils::x86_64::{cpuid_leaf_modifier, cpuid_reg_modifier, msr_modifier};
1717

0 commit comments

Comments
 (0)