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

q35: add virtio-mmio slots #13

Draft
wants to merge 1 commit into
base: svsm-igvm
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions hw/i386/pc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1646,6 +1646,21 @@ static void pc_machine_set_smbios_ep(Object *obj, Visitor *v, const char *name,
visit_type_SmbiosEntryPointType(v, name, &pcms->smbios_entry_point_type, errp);
}

static bool pc_machine_get_svsm_virtio_mmio(Object *obj, Error **errp)
{
PCMachineState *pcms = PC_MACHINE(obj);

return pcms->svsm_virtio_mmio;
}

static void pc_machine_set_svsm_virtio_mmio(Object *obj, bool value,
Error **errp)
{
PCMachineState *pcms = PC_MACHINE(obj);

pcms->svsm_virtio_mmio = value;
}

static void pc_machine_get_max_ram_below_4g(Object *obj, Visitor *v,
const char *name, void *opaque,
Error **errp)
Expand Down Expand Up @@ -1889,6 +1904,9 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
NULL, NULL);
object_class_property_set_description(oc, PC_MACHINE_SMBIOS_EP,
"SMBIOS Entry Point type [32, 64]");

object_class_property_add_bool(oc, "x-svsm-virtio-mmio",
pc_machine_get_svsm_virtio_mmio, pc_machine_set_svsm_virtio_mmio);
}

static const TypeInfo pc_machine_info = {
Expand Down
7 changes: 7 additions & 0 deletions hw/i386/pc_q35.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,13 @@ static void pc_q35_init(MachineState *machine)

/* Apply confidential guest state from IGVM if supplied */
cgs_process_igvm(machine->cgs);

if (pcms->svsm_virtio_mmio) {
for (int dev = 0; dev < 4; dev++) {
hwaddr addr = 0xfef00000 + dev * TARGET_PAGE_SIZE;
sysbus_create_simple("virtio-mmio", addr, /* no irq */ NULL);
}
}
}

#define DEFINE_Q35_MACHINE(suffix, name, compatfn, optionfn) \
Expand Down
1 change: 1 addition & 0 deletions include/hw/i386/pc.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ typedef struct PCMachineState {
bool hpet_enabled;
bool i8042_enabled;
bool default_bus_bypass_iommu;
bool svsm_virtio_mmio;
uint64_t max_fw_size;

/* ACPI Memory hotplug IO base address */
Expand Down