patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Alyssa Ross <alyssa.ross@unikie.com>
To: devel@spectrum-os.org
Cc: Puck Meerburg <puck@puckipedia.com>,
	Ville Ilvonen <ville.ilvonen@unikie.com>
Subject: [RFC PATCH 05/10] img/app: add support for testing virtio-gpu
Date: Fri, 30 Sep 2022 12:49:35 +0000	[thread overview]
Message-ID: <20220930124940.1013577-6-alyssa.ross@unikie.com> (raw)
In-Reply-To: <20220930124940.1013577-1-alyssa.ross@unikie.com>

crosvm sadly doesn't support socket activation or readiness
notification, hence the sleep loop here.

I've removed the tap device as it required privileges to set up, and
was difficult to actually test with since it wouldn't be set up
correctly on the host in the same way the Spectrum host would set it
up.

Signed-off-by: Alyssa Ross <alyssa.ross@unikie.com>
---
 img/app/Makefile | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/img/app/Makefile b/img/app/Makefile
index a3fefc3..145001c 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -6,6 +6,8 @@
 # QEMU_KVM = qemu-system-x86_64 -enable-kvm.
 QEMU_KVM = qemu-kvm
 CLOUD_HYPERVISOR = cloud-hypervisor
+CROSVM = crosvm
+CROSVM_DEVICE_GPU = $(CROSVM) device gpu
 
 prefix = /usr/local
 imgdir = $(prefix)/img
@@ -96,6 +98,17 @@ build/etc/s6-rc: $(VM_S6_RC_FILES)
 	    s6-rc-compile $@ $$dir; \
 	    exit=$$?; rm -r $$dir; exit $$exit
 
+start-vhost-user-gpu:
+	rm -f vhost-user-gpu.sock
+	$(CROSVM_DEVICE_GPU) \
+	    --socket vhost-user-gpu.sock \
+	    --wayland-sock "$$XDG_RUNTIME_DIR/$$WAYLAND_DISPLAY" \
+	    --params '{"context-types":"cross-domain"}' &
+	while ! [ -S vhost-user-gpu.sock ]; do
+	    sleep 1
+	done
+.PHONY: start-vhost-user-gpu
+
 run-qemu: build/host/appvm/blk/root.img
 	$(QEMU_KVM) -m 128 -cpu host -machine q35,kernel=$(KERNEL) -vga none \
 	  -drive file=build/host/appvm/blk/root.img,if=virtio,format=raw,readonly=on \
@@ -108,13 +121,14 @@ run-qemu: build/host/appvm/blk/root.img
 	  -device virtconsole,chardev=virtiocon0
 .PHONY: run-qemu
 
-run-cloud-hypervisor: build/host/appvm/blk/root.img
+run-cloud-hypervisor: build/host/appvm/blk/root.img start-vhost-user-gpu
 	$(CLOUD_HYPERVISOR) \
 	    --api-socket path=vmm.sock \
-	    --memory size=128M \
+	    --memory size=128M,shared=on \
 	    --disk path=build/host/appvm/blk/root.img,readonly=on \
 	           path=$(RUN_IMG),readonly=on \
 	    --net tap=tap0,mac=0A:B3:EC:00:00:00 \
+	    --gpu socket=vhost-user-gpu.sock \
 	    --kernel $(KERNEL) \
 	    --cmdline "console=ttyS0 root=PARTLABEL=root" \
 	    --console tty \
-- 
2.37.1



  parent reply	other threads:[~2022-09-30 12:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-30 12:49 [RFC PATCH 00/10] Initial support for VM Wayland Alyssa Ross
2022-09-30 12:49 ` [RFC PATCH 01/10] host/start-vm: use MAP_SHARED memory for VMs Alyssa Ross
2022-09-30 12:49 ` [RFC PATCH 02/10] img/app: don't block app startup on network online Alyssa Ross
2022-09-30 12:49 ` [RFC PATCH 03/10] img/app: add Wayland over virtio-gpu support to kernel Alyssa Ross
2022-09-30 12:49 ` [RFC PATCH 04/10] vm-lib: add mesa drivers to VM Alyssa Ross
2022-09-30 12:49 ` Alyssa Ross [this message]
2022-09-30 13:03   ` [RFC PATCH 05/10] img/app: add support for testing virtio-gpu Alyssa Ross
2022-09-30 12:49 ` [RFC PATCH 06/10] img/app: add support for testing in crosvm Alyssa Ross
2022-09-30 12:49 ` [RFC PATCH 07/10] host/start-vm: factor out VM definition path Alyssa Ross
2022-09-30 12:49 ` [RFC PATCH 08/10] host: add support for Wayland in VMs Alyssa Ross
2022-09-30 12:49 ` [RFC PATCH 09/10] vm/app: add hello-wayland demo VM Alyssa Ross
2022-09-30 12:49 ` [RFC PATCH 10/10] host/start-vm: disable cloud-hypervisor sandbox Alyssa Ross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220930124940.1013577-6-alyssa.ross@unikie.com \
    --to=alyssa.ross@unikie.com \
    --cc=devel@spectrum-os.org \
    --cc=puck@puckipedia.com \
    --cc=ville.ilvonen@unikie.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).