Received: from mail-ua1-f44.google.com (mail-ua1-f44.google.com [209.85.222.44]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.34525.1796051676621778735 for ; Mon, 30 Nov 2026 07:14:37 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre.com header.s=google header.b=j9BYqxdG; spf=pass (domain: baylibre.com, ip: 209.85.222.44, mailfrom: hfranco@baylibre.com) Received: by mail-ua1-f44.google.com with SMTP id a1e0cc1a2514c-98c7798ce74so2856197241.1 for ; Mon, 30 Nov 2026 07:14:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1796051675; x=1796656475; darn=lists.yoctoproject.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=QAtan6unNHTcM9ltC/wrRO1Fk2GqdDtevOtn2BkxmNk=; b=j9BYqxdGcK+4TxukdD2Wk75C4DgMwd36EQJaLmkAxqL+/XXnosO8H4PrEUwdtj52Om c2z7PMLmR9WnDlfdhEBmr+zId17xVLNhFqOiDs9Ec9JFQrGxYNh3ksju7E0cdzO27EY2 N5v526eNl/UCVIleoor6HkB5nAEFOf/hSW1VyERTrbE4/AP2RobZrcnra4sZd9wl6Sp9 VuqhRrWRufhSRfZjECj0toPrhcj0UV1Zvkx4znXLqTy91kGV+07pJcs21GO/+HCiINT6 5EbUYyVr/4LHWvoTxhBaX/jFjcEw2xz9T8PpsjG7w6C2KV1pqF6aMNg66yvXwNyETqRz gezA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796051675; x=1796656475; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=QAtan6unNHTcM9ltC/wrRO1Fk2GqdDtevOtn2BkxmNk=; b=g8d5k3vQghynBIdOdW4QuKwTZG/CaH30rT+IL7zBHfbqK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Qj/iWtBKbpoKZkaOTImhnXyVyId019m+TyuukmB/+ie/iFgcwy 18dL10uPVh/tjDS0B05QX4Lfu X-Received: by 2002:a05:6122:17a2:b0:5ea:a173:6607 with SMTP id 71dfb90a1353d-5ee8aed26admr16675333e0c.10.1796051674758; Mon, 30 Nov 2026 07:14:34 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2804:14c:4c5:8bf0:ed2f:8706:26c4:46d9]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-5ee8b42f564sm33332307e0c.2.2026.11.30.07.14.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 07:14:34 -0800 (PST) From: Hiago De Franco To: meta-virtualization@lists.yoctoproject.org Cc: Ronaldo Nunez , Hiago De Franco Subject: [meta-virtualization][PATCH v2] xen: add initial riscv64 support Date: Mon, 30 Nov 2026 12:12:28 -0300 Message-ID: <20261130151413.976786-1-hfranco@baylibre.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Mon, 30 Nov 2026 15:14:39 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/meta-virtualization/message/10215 Content-Type: text/plain; charset="utf-8" Add riscv64 to the Xen architecture mapping and allow the Xen hypervisor recipe to build for it. Xen sets its own -march and -mabi flags for RISC-V, so clear TUNE_CCARGS for riscv64 in the same way as is already done for aarch64. The Xen tools do not support riscv64 yet, so skip the xen-tools deploy dependencies on that architecture. Add a qemuriscv64 section to the Xen build and boot documentation. Tested-by: Ronaldo Nunez Signed-off-by: Hiago De Franco --- v2: - Added Xen riscv64 instructions (build and boot) to README-xen.md file. - Updated commit description accordingly. v1: https://lore.kernel.org/all/20261126131035.73287-1-hfranco@baylibre.com/ --- recipes-extended/images/README-xen.md | 43 +++++++++++++++++++++++++ recipes-extended/xen/xen-arch.inc | 1 + recipes-extended/xen/xen-hypervisor.inc | 22 ++++++++----- 3 files changed, 58 insertions(+), 8 deletions(-) diff --git a/recipes-extended/images/README-xen.md b/recipes-extended/images/README-xen.md index 3fe490a3..e87f0d8a 100644 --- a/recipes-extended/images/README-xen.md +++ b/recipes-extended/images/README-xen.md @@ -241,6 +241,49 @@ root@qemux86-64:~# ctr image pull docker.io/library/alpine:latest root@qemux86-64:~# vctr run --rm docker.io/library/alpine:latest test1 echo hello hello +### qemuriscv64 + +The Xen tools do not support riscv64 yet, so xen-image-minimal and the +xl toolstack are not available for this architecture. Only the hypervisor +is built, and it is booted directly by QEMU. + +local.conf contains: + + MACHINE = "qemuriscv64" + +Build the hypervisor: + + % bitbake xen + +The hypervisor is deployed as: + + tmp/deploy/images/qemuriscv64/xen-qemuriscv64 + +runqemu cannot be used here because it requires an image with qemuboot +metadata, and xen-image-minimal is not buildable without the tools. Boot +the deployed hypervisor directly from the build directory with QEMU +instead: + + % qemu-system-riscv64 \ + -machine virt,aia=aplic-imsic,aia-guests=4 \ + -cpu rv64,svpbmt=on,sv57=off,sv48=off \ + -smp 2 -m 2g -nographic -bios default \ + -kernel tmp/deploy/images/qemuriscv64/xen-qemuriscv64 + +QEMU's built-in OpenSBI loads Xen in S-mode and passes it the device tree +generated by the virt machine. The svpbmt extension and the AIA +APLIC/IMSIC interrupt controllers are required by the RISC-V port, Xen +panics if either is missing. + +The upstream RISC-V port currently boots the hypervisor only. Dom0 and +DomU support are still under development, so Xen halts after printing: + + (XEN) Xen version 4.23-unstable ... + ... + (XEN) Max supported G-stage mode is sv39x4 + (XEN) VMIDs use is enabled + (XEN) All set up + vxn and containerd integration ------------------------------ diff --git a/recipes-extended/xen/xen-arch.inc b/recipes-extended/xen/xen-arch.inc index fb0093e3..8c505396 100644 --- a/recipes-extended/xen/xen-arch.inc +++ b/recipes-extended/xen/xen-arch.inc @@ -2,6 +2,7 @@ valid_xen_archs = " \ x86_64 x86_32 \ arm32 arm64 \ + riscv64 \ " def map_xen_arch(a, d): diff --git a/recipes-extended/xen/xen-hypervisor.inc b/recipes-extended/xen/xen-hypervisor.inc index f448564d..fe987a08 100644 --- a/recipes-extended/xen/xen-hypervisor.inc +++ b/recipes-extended/xen/xen-hypervisor.inc @@ -7,7 +7,7 @@ DESCRIPTION = "The Xen hypervisor" # to build the different components. eg. 32-bit tools and a 64-bit hypervisor. # The Xen hypervisor has a narrower compatible platform range than the Xen tools -COMPATIBLE_HOST = '(x86_64.*).*-linux|aarch64.*-linux' +COMPATIBLE_HOST = '(x86_64.*).*-linux|aarch64.*-linux|riscv64.*-linux' inherit deploy python3native cml1 @@ -94,12 +94,17 @@ do_deploy() { # - add the task before do_build to ensure that deployment has completed when # the recipe build done stamp is written addtask deploy after do_compile do_populate_sysroot before do_build -# To ensure that a deployed hypervisor has matching tools, add a dependency to -# make sure that the tools have built and been staged: -do_deploy[depends] += "xen-tools:do_populate_sysroot" -# Also ensure anything that the tools recipe needs to deploy, such as a -# XSM policy file, has been deployed first: -do_deploy[depends] += "xen-tools:do_deploy" +# To ensure that a deployed hypervisor has matching tools, add dependencies to +# make sure that the tools have built and been staged, and that anything the +# tools recipe needs to deploy, such as a XSM policy file, has been deployed +# first. +XEN_TOOLS_DEPLOY_DEPENDS = " \ + xen-tools:do_populate_sysroot \ + xen-tools:do_deploy \ + " +# xen-tools is not yet buildable for riscv64. +XEN_TOOLS_DEPLOY_DEPENDS:riscv64 = "" +do_deploy[depends] += "${XEN_TOOLS_DEPLOY_DEPENDS}" # Enable use of menuconfig directly from bitbake and also within the devshell do_devshell[depends] += "ncurses-native:do_populate_sysroot" @@ -113,5 +118,6 @@ CROSS_CURSES_LIB += "-L${STAGING_LIBDIR_NATIVE}" KCONFIG_CONFIG_ROOTDIR = "${S}/xen" # Xen is setting all CC flags on its own. Make sure that they are not modified -# for aarch64, e.g. with architecture-specific optimizations. +# for aarch64 and riscv64, e.g. with architecture-specific optimizations. TUNE_CCARGS:aarch64 = "" +TUNE_CCARGS:riscv64 = "" -- 2.47.3