On 06.12.21 14:41, Jan Kiszka wrote: > On 06.12.21 14:34, Ralf Ramsauer wrote: >> If we want to use the qemu-x86.c on AMD platforms, we must not define >> Intel IOMMU units. Build an extra variant for AMD platforms. >> >> Signed-off-by: Ralf Ramsauer <[email protected]> >> --- >> README.md | 8 ++++++-- >> configs/Makefile | 11 +++++++++++ >> configs/x86/qemu-x86.c | 2 ++ >> 3 files changed, 19 insertions(+), 2 deletions(-) >> >> diff --git a/README.md b/README.md >> index f1b0cbe3..ac457119 100644 >> --- a/README.md >> +++ b/README.md >> @@ -288,11 +288,15 @@ installation steps. >> The Jailhouse QEMU cell config will block use of the serial port by the >> guest >> OS, so make sure that the guest kernel command line does NOT have its >> console >> set to log to the serial port (ie remove any 'console=ttyS0' arguments from >> the >> -grub config). Reboot the guest and load jailhouse.ko. Then enable Jailhouse >> -like this: >> +grub config). Reboot the guest and load jailhouse.ko. On Intel x86 >> platforms, >> +enable Jailhouse like this: >> >> jailhouse enable /path/to/qemu-x86.cell >> >> +On AMD platforms, use: >> + >> + jailhouse enable /path/to/qemu-x86-amd.cell >> + >> Next you can create a cell with a demonstration application as follows: >> >> jailhouse cell create /path/to/apic-demo.cell >> diff --git a/configs/Makefile b/configs/Makefile >> index 327043b7..5af0647a 100644 >> --- a/configs/Makefile >> +++ b/configs/Makefile >> @@ -28,6 +28,17 @@ OBJCOPYFLAGS := -O binary >> --remove-section=.note.gnu.property >> CONFIGS = $(shell cd $(src); ls $(SRCARCH)/*.c) >> >> always-y := $(CONFIGS:.c=.cell) >> +ifeq ($(SRCARCH),x86) >> + always-y += x86/qemu-x86-amd.cell >> + targets += x86/qemu-x86-amd.o >> +endif >> + >> +$(obj)/x86/qemu-x86-amd.cell: $(obj)/x86/qemu-x86-amd.o >> + >> +$(obj)/x86/qemu-x86-amd.o: $(obj)/x86/qemu-x86.c FORCE >> + $(call if_changed,cc_o_c) >> + >> +CFLAGS_x86/qemu-x86-amd.o += -D__IS_AMD >> >> targets += $(CONFIGS:.c=.o) $(CONFIGS:.c=.cell) >> >> diff --git a/configs/x86/qemu-x86.c b/configs/x86/qemu-x86.c >> index 9ca5c528..3f8f673b 100644 >> --- a/configs/x86/qemu-x86.c >> +++ b/configs/x86/qemu-x86.c >> @@ -45,6 +45,7 @@ struct { >> .platform_info = { >> .pci_mmconfig_base = 0xb0000000, >> .pci_mmconfig_end_bus = 0xff, >> +#ifndef __IS_AMD >> .iommu_units = { >> { >> .type = JAILHOUSE_IOMMU_INTEL, >> @@ -52,6 +53,7 @@ struct { >> .size = 0x1000, >> }, >> }, >> +#endif /* !__IS_AMD */ > > Nope, please not. Rather enable the AMD IOMMU in a separate AMD config > (common inclusion would be fine). Will require some tuning of the QEMU > command line, and we may also have to think about what to do with SMI > blocking which is demanded by Jailhouse but not emulated by QEMU. The > rest is supposed to work, though. >
And that would likely reduce the number of $ git grep HACK hypervisor/ noteworthy. Jan -- Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jailhouse-dev/91187804-a222-cfe1-a2a2-f1c54ea8ef24%40siemens.com.
