Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move smbios table creation to propolis (out of server+standalone) #759

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

iximeow
Copy link
Member

@iximeow iximeow commented Sep 5, 2024

tiny cleanup i noticed alongside #756: the two generate_smbios() were similar but not quite the same, and it wasn't entirely clear what external inputs were to the tables either would generate. so, take the SmbiosParameters idea from propolis-standalone and make propolis-server put its parameters in a similar struct.

nice benefit: anything we make configurable for propolis-standalone is at least progress towards configurability for propolis- server.

in the process i've added a few more fields to SmbiosParameters for values that either varied or had different defaulting behavior depending on the application: rom_release_date, cpuid_vendor, and the value as we use table 1's serial number and uuid, which i'm calling system_id - it's the instance's ID and just left as defaults in propolis-standalone.

edit: i did go a bit beyond just code motion in acb6da1. as i was moving this around i realized that's the only place we need a scratchpad in MachineInitializer, so i wanted to see how things look with rom_size passed around on its own. seems fine? do we expect MachineInitializerState would eventually have more state in it?

Comment on lines +1159 to +1160
if cpuid::host_query(cpuid::Ident(0x8000_0000, None)).eax
>= 0x8000_0004
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boring but funny note: the oldest CPUs that don't support cpuid leaves 0x8000_000[1..4] are, i think, Pentium II and K5. so as long as Propolis is running on a CPU newer than those, this arm is always taken?

not really sure how i feel about this, but it seems interesting this is the only state in MachineInitializerState right now..
Comment on lines 957 to +976
// With "only" types 0, 1, 4, 16, 17, and 32, we are technically missing
// some (types 3, 7, 9, 19) of the data required by the 2.7 spec. The
// data provided here were what we determined was a reasonable
// collection to start with. Should further requirements arise, we may
// expand on it.
let mut smb_tables = smbios::Tables::new(0x7f00.into());
smb_tables.add(0x0000.into(), &smb_type0).unwrap();
smb_tables.add(0x0100.into(), &smb_type1).unwrap();
smb_tables.add(0x0300.into(), &smb_type4).unwrap();
smb_tables.add(phys_mem_array_handle, &smb_type16).unwrap();
smb_tables.add(0x1700.into(), &smb_type17).unwrap();
smb_tables.add(0x3200.into(), &smb_type32).unwrap();
smb_tables.add(0x0000.into(), &smbios_params.table_type0()).unwrap();
smb_tables.add(0x0100.into(), &smbios_params.table_type1()).unwrap();
smb_tables.add(0x0300.into(), &smbios_params.table_type4()).unwrap();
let phys_mem_array_handle = 0x1600.into();
smb_tables
.add(phys_mem_array_handle, &smbios_params.table_type16())
.unwrap();
smb_tables
.add(
0x1700.into(),
&smbios_params.table_type17(phys_mem_array_handle),
)
.unwrap();
smb_tables.add(0x3200.into(), &smbios_params.table_type32()).unwrap();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pfmooney how's this seem? my thinking is that the SmbiosParams::table_* are "this is probably a reasonable way to put the tables together", and if we find value in changing any of the defaults we'd hoist them into fields of SmbiosParameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant