Device Tree Support#31
Conversation
|
I think the design here should roughly follow the principles we use in other places, specifically the memory map today (and possibly MADT in the future): The SVSM gets /all/ information (i.e. the complete device tree), removes the resources it uses itself (i.e. a chunk of memory in case of the memory map, or specific devices in case of the device tree), and passes on that updated information to edk2 firmware. For the pc/q35 machine types this does not matter much because there is no device tree used for hardware detection today. On aarch64 device trees are rather essential though, and CCA is coming. The x86 microvm machine type also uses device trees to pass hardware information from qemu to firmware. So IMHO the design should consider the case that edk2 needs a device tree too. We'll need some kind of hint in the device tree for the svsm which devices are meant for the svsm to use. Adding some qdev device property for that certainly makes sense. That hint needs to be added to the device three though, so svsm can do the filtering itself (as described above) instead of depending on getting a filtered device tree from qemu. [note: discusses this with luigi already in private, adding here for reference] |
|
Addressed @kraxel comments:
|
|
@luigix25 about commit cc43764 and 3799726 from @joergroedel are those the same included in the latest RFC sent upstream? |
stefano-garzarella
left a comment
There was a problem hiding this comment.
Minor comments that can be fixed later upstream.
they are basically the same, @joergroedel squashed "qdev: Set default plane property" into "qdev: Add plane property" My idea is to cherry-pick the new version so we have less changes from the upstream. I also need to swap two commits for bisectability. I hope I can do it by the end of the week. Thanks for the review! |
Add a property to the QEMU MachineState to specify the default plane to send device interrupts to. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Add a property to track the plane into which the qdev needs to inject IRQs. Co-developed-by: Luigi Leonardi <leonardi@redhat.com> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
The device-plane check depends on accel_nr_planes(), which requires the full planes API that is not yet available. This causes a build failure. Remove the check until the accelerator planes API is implemented. Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
Generate a flattened device tree describing virtio-mmio devices on the PC machine. This FDT is consumed by Coconut SVSM firmware, which uses it to discover devices assigned to the firmware plane via IGVM parameters instead of relying on fw_cfg. The device tree is intentionally incomplete: CPUs and memory are not included as firmware obtains that information through other channels. Add FDT/DEVICE_TREE dependency to the PC Kconfig. The implementation is based on hw/i386/microvm-dt.c. Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
Extend the x86 device tree to include ISA serial devices found on the ISA bus, so the firmware can discover serial ports assigned to its plane. Note that ISA serial addresses are well-known and cannot be hidden from the guest OS. Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
These devices use well-known I/O port addresses but there is no easy way for firmware to detect their presence at runtime. Expose them through the device tree so that consumers, like SVSM, can discover and use them without hardcoding assumptions about the platform configuration. Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
Add the plane property to all microvm device tree nodes so firmware can identify which plane each device is assigned to. This is needed by Coconut SVSM to filter devices by plane assignment and discover which devices belong to the firmware plane. Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
|
Coconut SVSM, with the upcoming device tree support [1], will use the IGVM device tree parameter to discover virtio-mmio and ISA serial devices instead of relying on the fw_cfg interface, which is QEMU-specific. The device tree is packed before copying into the IGVM parameter area to reduce its size, since IGVM files can define tighter memory constraints for parameter areas. Packing is done in the generic IGVM backend rather than in per-architecture device tree setup code, so that each architecture does not need to handle it individually. [1] coconut-svsm/svsm#1006 Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
Introduce device tree support.
This series is based on #32 that rebased our fork to latest master."qdev: Add plane property" and "hw/core/machine: Add device-plane property" are cherry-picked from the planes branch.
This series adds two new parameters:
The generated device tree for the PC machine is not complete: it exposes:
SVSM PR: coconut-svsm/svsm#1006