patches and low-level development discussion
 help / color / mirror / code / Atom feed
* [PATCH 0/2] IOMMU fixes
@ 2022-09-22  7:56 Alyssa Ross
  2022-09-22  7:56 ` [PATCH 1/2] Set intel_iommu=on in kernel command line Alyssa Ross
  2022-09-22  7:56 ` [PATCH 2/2] Add IOMMU to other host test targets Alyssa Ross
  0 siblings, 2 replies; 5+ messages in thread
From: Alyssa Ross @ 2022-09-22  7:56 UTC (permalink / raw)
  To: devel; +Cc: Vadim Likholetov

Vadim found that it was not possible to test networking in the live
image's make run target.  This turned out to be for two separate
reasons.  One was that we didn't have an IOMMU on that QEMU machine,
but even adding that wasn't enough, because Intel IOMMUs also just
didn't work at all on the live image, due to a missing kernel command
line parameter.

Alyssa Ross (2):
  Set intel_iommu=on in kernel command line
  Add IOMMU to other host test targets

 host/initramfs/Makefile | 4 +++-
 img/combined/run-vm.nix | 3 ++-
 img/live/Makefile       | 4 +++-
 3 files changed, 8 insertions(+), 3 deletions(-)


base-commit: 3aa2f8aa7423cdf36c797943ad7d5a9756290909
-- 
2.37.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] Set intel_iommu=on in kernel command line
  2022-09-22  7:56 [PATCH 0/2] IOMMU fixes Alyssa Ross
@ 2022-09-22  7:56 ` Alyssa Ross
  2022-11-14  1:14   ` Alyssa Ross
  2022-09-22  7:56 ` [PATCH 2/2] Add IOMMU to other host test targets Alyssa Ross
  1 sibling, 1 reply; 5+ messages in thread
From: Alyssa Ross @ 2022-09-22  7:56 UTC (permalink / raw)
  To: devel; +Cc: Vadim Likholetov

In Nixpkgs kernels, Intel IOMMUs are disabled by
default (CONFIG_INTEL_IOMMU_DEFAULT_ON=n), so it needs to be
explicitly enabled on the kernel command line.  This was already done
in the rootfs run make target, which is what I mostly use for testing,
which is why I hadn't noticed until now.

We could also set CONFIG_INTEL_IOMMU_DEFAULT_ON, but I think it's
better to avoid changing our kernel configuration too much at the
moment.  (This might change in future if we want to go all in.)

No changes are required for AMD IOMMUs, which are enabled by default.

Reported-by: Vadim Likholetov <vadim.likholetov@unikie.com>
Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
 host/initramfs/Makefile | 2 +-
 img/live/Makefile       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/host/initramfs/Makefile b/host/initramfs/Makefile
index 1bdc407..596b15e 100644
--- a/host/initramfs/Makefile
+++ b/host/initramfs/Makefile
@@ -67,7 +67,7 @@ run: build/initramfs build/rootfs.verity.roothash build/live.img
 	$(QEMU_KVM) -m 4G \
 	    -kernel $(KERNEL) \
 	    -initrd build/initramfs \
-	    -append "ro console=ttyS0 ext=vda roothash=$$(< build/rootfs.verity.roothash)" \
+	    -append "ro console=ttyS0 ext=vda intel_iommu=on roothash=$$(< build/rootfs.verity.roothash)" \
 	    -cpu host \
 	    -display gtk,gl=on \
 	    -device virtio-vga-gl \
diff --git a/img/live/Makefile b/img/live/Makefile
index 9815c88..f13dd26 100644
--- a/img/live/Makefile
+++ b/img/live/Makefile
@@ -26,7 +26,7 @@ build/spectrum.conf: build/rootfs.verity.roothash
 	printf "title Spectrum\n" > $@
 	printf "linux /spectrum/linux\n" >> $@
 	printf "initrd /spectrum/initrd\n" >> $@
-	printf "options ro console=tty console=ttyS0 roothash=" >> $@
+	printf "options ro console=tty console=ttyS0 intel_iommu=on roothash=" >> $@
 	cat build/rootfs.verity.roothash >> $@
 
 build/boot.fat: $(KERNEL) $(INITRAMFS) $(SYSTEMD_BOOT_EFI) build/spectrum.conf
-- 
2.37.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] Add IOMMU to other host test targets
  2022-09-22  7:56 [PATCH 0/2] IOMMU fixes Alyssa Ross
  2022-09-22  7:56 ` [PATCH 1/2] Set intel_iommu=on in kernel command line Alyssa Ross
@ 2022-09-22  7:56 ` Alyssa Ross
  2022-11-14  1:14   ` Alyssa Ross
  1 sibling, 1 reply; 5+ messages in thread
From: Alyssa Ross @ 2022-09-22  7:56 UTC (permalink / raw)
  To: devel; +Cc: Vadim Likholetov

This will make it possible to test passthrough in all test targets
where it makes sense, rather than just host/rootfs.

I think we should consider in future having a single wrapper script
that runs QEMU with all the flags necessary to support Spectrum's
hardware requirements, because this is only going to get more
difficult to maintain once we need to support multiple CPU
architectures.

Reported-by: Vadim Likholetov <vadim.likholetov@unikie.com>
Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
 host/initramfs/Makefile | 2 ++
 img/combined/run-vm.nix | 3 ++-
 img/live/Makefile       | 2 ++
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/host/initramfs/Makefile b/host/initramfs/Makefile
index 596b15e..602b5b3 100644
--- a/host/initramfs/Makefile
+++ b/host/initramfs/Makefile
@@ -69,7 +69,9 @@ run: build/initramfs build/rootfs.verity.roothash build/live.img
 	    -initrd build/initramfs \
 	    -append "ro console=ttyS0 ext=vda intel_iommu=on roothash=$$(< build/rootfs.verity.roothash)" \
 	    -cpu host \
+	    -machine q35,kernel-irqchip=split \
 	    -display gtk,gl=on \
+	    -device intel-iommu,intremap=on \
 	    -device virtio-vga-gl \
 	    -device qemu-xhci \
 	    -device usb-storage,drive=drive1,removable=true \
diff --git a/img/combined/run-vm.nix b/img/combined/run-vm.nix
index 40eacc4..047bc3f 100644
--- a/img/combined/run-vm.nix
+++ b/img/combined/run-vm.nix
@@ -13,8 +13,9 @@ writeShellScript "run-spectrum-installer-vm.sh" ''
   truncate -s 10G "$img"
   exec 3<>"$img"
   rm -f "$img"
-  exec qemu-kvm -cpu host -m 4G -machine q35 -snapshot \
+  exec qemu-kvm -cpu host -m 4G -machine q35,kernel-irqchip=split -snapshot \
     -display gtk,gl=on \
+    -device intel-iommu,intremap=on \
     -device virtio-vga-gl \
     -device qemu-xhci \
     -device usb-storage,drive=drive1,removable=true \
diff --git a/img/live/Makefile b/img/live/Makefile
index f13dd26..5942251 100644
--- a/img/live/Makefile
+++ b/img/live/Makefile
@@ -61,7 +61,9 @@ clean:
 run: build/live.img
 	$(QEMU_KVM) -m 4G \
 	    -cpu host \
+	    -machine q35,kernel-irqchip=split \
 	    -display gtk,gl=on \
+	    -device intel-iommu,intremap=on \
 	    -device virtio-vga-gl \
 	    -device qemu-xhci \
 	    -device usb-storage,drive=drive1,removable=true \
-- 
2.37.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] Set intel_iommu=on in kernel command line
  2022-09-22  7:56 ` [PATCH 1/2] Set intel_iommu=on in kernel command line Alyssa Ross
@ 2022-11-14  1:14   ` Alyssa Ross
  0 siblings, 0 replies; 5+ messages in thread
From: Alyssa Ross @ 2022-11-14  1:14 UTC (permalink / raw)
  To: Alyssa Ross, devel; +Cc: Vadim Likholetov

This patch has been committed as 7a4389a94ecffadf9ece46423c1824280114d5a8,
which can be viewed online at
https://spectrum-os.org/git/spectrum/commit/?id=7a4389a94ecffadf9ece46423c1824280114d5a8.

This is an automated message.  Send comments/questions/requests to:
Alyssa Ross <hi@alyssa.is>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] Add IOMMU to other host test targets
  2022-09-22  7:56 ` [PATCH 2/2] Add IOMMU to other host test targets Alyssa Ross
@ 2022-11-14  1:14   ` Alyssa Ross
  0 siblings, 0 replies; 5+ messages in thread
From: Alyssa Ross @ 2022-11-14  1:14 UTC (permalink / raw)
  To: Alyssa Ross, devel; +Cc: Vadim Likholetov

This patch has been committed as 435a82a9d09e6aaca27402a45756de1abd37437f,
which can be viewed online at
https://spectrum-os.org/git/spectrum/commit/?id=435a82a9d09e6aaca27402a45756de1abd37437f.

This is an automated message.  Send comments/questions/requests to:
Alyssa Ross <hi@alyssa.is>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-11-14  1:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-22  7:56 [PATCH 0/2] IOMMU fixes Alyssa Ross
2022-09-22  7:56 ` [PATCH 1/2] Set intel_iommu=on in kernel command line Alyssa Ross
2022-11-14  1:14   ` Alyssa Ross
2022-09-22  7:56 ` [PATCH 2/2] Add IOMMU to other host test targets Alyssa Ross
2022-11-14  1:14   ` Alyssa Ross

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).