Skip to contentSkip to conversation

Minimal build for RISCV

PATCH Superseded Connor Davis 6 participants 20 messages May 24, 2021 – Jun 3, 2021 RISC-V

v4 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#1 lore raw

PATCH v4 1/4 xen/char: Default HAS_NS16550 to y only for X86 and ARM

In reply to Connor Davis

Defaulting to yes only for X86 and ARM reduces the requirements for a minimal build when porting new architectures.

---
 xen/drivers/char/Kconfig | 1 +
 1 file changed, 1 insertion(+)
xen/drivers/char/Kconfig +1 -0
index b572305657..2ff5b288e2 100644
@@ -1,5 +1,6 @@
 config HAS_NS16550
 	bool "NS16550 UART driver" if ARM
+	default n if RISCV
 	default y
 	help
 	  This selects the 16550-series UART support. For most systems, say Y.
Signature · 1 line
2.31.1
#8 lore raw

PATCH v4 3/4 xen: Add files needed for minimal riscv build

In reply to Connor Davis

Add arch-specific makefiles and configs needed to build for riscv. Also add a minimal head.S that is a simple infinite loop. head.o can be built with

$ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen tiny64_defconfig
$ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen TARGET=head.o

No other TARGET is supported at the moment.

---
 config/riscv.mk                         |  4 +++
 xen/Makefile                            |  8 +++--
 xen/arch/riscv/Kconfig                  | 47 +++++++++++++++++++++++++
 xen/arch/riscv/Kconfig.debug            |  0
 xen/arch/riscv/Makefile                 |  0
 xen/arch/riscv/Rules.mk                 |  0
 xen/arch/riscv/arch.mk                  | 14 ++++++++
 xen/arch/riscv/asm-offsets.c            |  0
 xen/arch/riscv/configs/tiny64_defconfig | 13 +++++++
 xen/arch/riscv/head.S                   |  6 ++++
 xen/include/asm-riscv/config.h          | 47 +++++++++++++++++++++++++
 11 files changed, 137 insertions(+), 2 deletions(-)
 create mode 100644 config/riscv.mk
 create mode 100644 xen/arch/riscv/Kconfig
 create mode 100644 xen/arch/riscv/Kconfig.debug
 create mode 100644 xen/arch/riscv/Makefile
 create mode 100644 xen/arch/riscv/Rules.mk
 create mode 100644 xen/arch/riscv/arch.mk
 create mode 100644 xen/arch/riscv/asm-offsets.c
 create mode 100644 xen/arch/riscv/configs/tiny64_defconfig
 create mode 100644 xen/arch/riscv/head.S
 create mode 100644 xen/include/asm-riscv/config.h
config/riscv.mk new file +4 -0
new file mode 100644
index 0000000000..2b2cc2e63a
@@ -0,0 +1,4 @@
+CONFIG_RISCV := y
+CONFIG_RISCV_$(XEN_OS) := y
+
+CONFIG_XEN_INSTALL_SUFFIX :=
xen/Makefile +6 -2
index 9f3be7766d..3a1ff0045b 100644
@@ -26,7 +26,9 @@ MAKEFLAGS += -rR
 EFI_MOUNTPOINT ?= $(BOOT_DIR)/efi
 
 ARCH=$(XEN_TARGET_ARCH)
-SRCARCH=$(shell echo $(ARCH) | sed -e 's/x86.*/x86/' -e s'/arm\(32\|64\)/arm/g')
+SRCARCH=$(shell echo $(ARCH) | \
+          sed -e 's/x86.*/x86/' -e s'/arm\(32\|64\)/arm/g' \
+              -e s'/riscv.*/riscv/g')
 
 # Don't break if the build process wasn't called from the top level
 # we need XEN_TARGET_ARCH to generate the proper config
@@ -35,7 +37,8 @@ include $(XEN_ROOT)/Config.mk
 # Set ARCH/SUBARCH appropriately.
 export TARGET_SUBARCH  := $(XEN_TARGET_ARCH)
 export TARGET_ARCH     := $(shell echo $(XEN_TARGET_ARCH) | \
-                            sed -e 's/x86.*/x86/' -e s'/arm\(32\|64\)/arm/g')
+                            sed -e 's/x86.*/x86/' -e s'/arm\(32\|64\)/arm/g' \
+                                -e s'/riscv.*/riscv/g')
 
 # Allow someone to change their config file
 export KCONFIG_CONFIG ?= .config
@@ -335,6 +338,7 @@ _clean: delete-unfresh-files
 	$(MAKE) $(clean) xsm
 	$(MAKE) $(clean) crypto
 	$(MAKE) $(clean) arch/arm
+	$(MAKE) $(clean) arch/riscv
 	$(MAKE) $(clean) arch/x86
 	$(MAKE) $(clean) test
 	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) clean
xen/arch/riscv/Kconfig new file +47 -0

47 lines not on this page · raw message

xen/arch/riscv/Kconfig.debug new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
xen/arch/riscv/Makefile new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
xen/arch/riscv/Rules.mk new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
xen/arch/riscv/arch.mk new file +14 -0
new file mode 100644
index 0000000000..53dadb8975
@@ -0,0 +1,14 @@
+########################################
+# RISCV-specific definitions
+
+CFLAGS-$(CONFIG_RISCV_64) += -mabi=lp64
+
+riscv-march-$(CONFIG_RISCV_ISA_RV64IMA) := rv64ima
+riscv-march-$(CONFIG_RISCV_ISA_C)       := $(riscv-march-y)c
+
+# Note that -mcmodel=medany is used so that Xen can be mapped
+# into the upper half _or_ the lower half of the address space.
+# -mcmodel=medlow would force Xen into the lower half.
+
+CFLAGS += -march=$(riscv-march-y) -mstrict-align -mcmodel=medany
+CFLAGS += -I$(BASEDIR)/include
xen/arch/riscv/asm-offsets.c new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
xen/arch/riscv/configs/tiny64_defconfig new file +13 -0
new file mode 100644
index 0000000000..3c9a2ff941
@@ -0,0 +1,13 @@
+# CONFIG_SCHED_CREDIT is not set
+# CONFIG_SCHED_RTDS is not set
+# CONFIG_SCHED_NULL is not set
+# CONFIG_SCHED_ARINC653 is not set
+# CONFIG_TRACEBUFFER is not set
+# CONFIG_HYPFS is not set
+# CONFIG_GRANT_TABLE is not set
+# CONFIG_SPECULATIVE_HARDEN_ARRAY is not set
+
+CONFIG_RISCV_64=y
+CONFIG_DEBUG=y
+CONFIG_DEBUG_INFO=y
+CONFIG_EXPERT=y
xen/arch/riscv/head.S new file +6 -0
new file mode 100644
index 0000000000..0dbc27ba75
@@ -0,0 +1,6 @@
+#include <asm/config.h>
+
+        .text
+
+ENTRY(start)
+        j  start
xen/include/asm-riscv/config.h new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
2.31.1
#0 lore raw

v4 cover Minimal build for RISCV

Hi all,

This series introduces a minimal build for RISCV. It is based on Bobby's previous work from last year[0] rebased onto current Xen.

This series provides the patches necessary to get a minimal build working. The build is "minimal" in the sense that it only supports building TARGET=head.o. The arch/riscv/head.S is just a simple while(1).

The first 2 patches are mods to non-RISCV bits that enable building a config with:

!CONFIG_HAS_NS16550
!CONFIG_HAS_PASSTHROUGH

respectively. The third patch adds the make/Kconfig boilerplate alongside head.S and asm-riscv/config.h (head.S references ENTRY that is defined in asm-riscv/config.h).

The last adds a docker container for doing the build. To build from the docker container (after creating it locally), you can run the following:

  $ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen tiny64_defconfig
  $ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen TARGET=head.o

[0] https://lore.kernel.org/xen-devel/[email protected]/

Thanks,
Connor

--
Changes since v3:
- Dropped "xen: Fix build when !CONFIG_GRANT_TABLE" since this was applied by Jan
- Adjusted Kconfig condition for building NS16550
- Use bool rather than bool_t
- Removed riscv memory map, as this should probably be done later once the frametable size is figured out
- Consolidated 64-bit #defines in asm-riscv/config.h
- Renamed riscv64_defconfig to tiny64_defconfig, added CONFIG_DEBUG and CONFIG_DEBUG_INFO
- Fixed logic/alignment/whitespace issues in Kconfig files
- Use upstream archlinux riscv64 cross-compiler packages instead of custom built toolchain in docker container

Changes since v2:
- Reduced number of riscv files added to ease review

Changes since v1:
- Dropped "xen/sched: Fix build when NR_CPUS == 1" since this was

    fixed for 4.15

- Moved #ifdef-ary around iommu_enabled to iommu.h
- Moved struct grant_table declaration above ifdef CONFIG_GRANT_TABLE instead of defining an empty struct when !CONFIG_GRANT_TABLE
--
Connor Davis (4):
xen/char: Default HAS_NS16550 to y only for X86 and ARM xen/common: Guard iommu symbols with CONFIG_HAS_PASSTHROUGH
xen: Add files needed for minimal riscv build
automation: Add container for riscv64 builds

 automation/build/archlinux/riscv64.dockerfile | 19 ++++++++
 automation/scripts/containerize               |  1 +
 config/riscv.mk                               |  4 ++
 xen/Makefile                                  |  8 +++-
 xen/arch/riscv/Kconfig                        | 47 +++++++++++++++++++
 xen/arch/riscv/Kconfig.debug                  |  0
 xen/arch/riscv/Makefile                       |  0
 xen/arch/riscv/Rules.mk                       |  0
 xen/arch/riscv/arch.mk                        | 14 ++++++
 xen/arch/riscv/asm-offsets.c                  |  0
 xen/arch/riscv/configs/tiny64_defconfig       | 13 +++++
 xen/arch/riscv/head.S                         |  6 +++
 xen/common/memory.c                           | 10 ++++
 xen/drivers/char/Kconfig                      |  1 +
 xen/include/asm-riscv/config.h                | 47 +++++++++++++++++++
 xen/include/xen/iommu.h                       |  8 +++-
 16 files changed, 175 insertions(+), 3 deletions(-)
 create mode 100644 automation/build/archlinux/riscv64.dockerfile
 create mode 100644 config/riscv.mk
 create mode 100644 xen/arch/riscv/Kconfig
 create mode 100644 xen/arch/riscv/Kconfig.debug
 create mode 100644 xen/arch/riscv/Makefile
 create mode 100644 xen/arch/riscv/Rules.mk
 create mode 100644 xen/arch/riscv/arch.mk
 create mode 100644 xen/arch/riscv/asm-offsets.c
 create mode 100644 xen/arch/riscv/configs/tiny64_defconfig
 create mode 100644 xen/arch/riscv/head.S
 create mode 100644 xen/include/asm-riscv/config.h

base-commit: d4fb5f166c2bfbaf9ba0de69da0d411288f437a9

Signature · 1 line
2.31.1
#5 lore raw

PATCH v4 2/4 xen/common: Guard iommu symbols with CONFIG_HAS_PASSTHROUGH

The variables iommu_enabled and iommu_dont_flush_iotlb are defined in drivers/passthrough/iommu.c and are referenced in common code, which causes the link to fail when !CONFIG_HAS_PASSTHROUGH.

Guard references to these variables in common code so that xen builds when !CONFIG_HAS_PASSTHROUGH.

---
 xen/common/memory.c     | 10 ++++++++++
 xen/include/xen/iommu.h |  8 +++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)
xen/common/memory.c +10 -0
index b5c70c4b85..72a6b70cb5 100644
@@ -294,7 +294,9 @@ int guest_remove_page(struct domain *d, unsigned long gmfn)
     p2m_type_t p2mt;
 #endif
     mfn_t mfn;
+#ifdef CONFIG_HAS_PASSTHROUGH
     bool *dont_flush_p, dont_flush;
+#endif
     int rc;
 
 #ifdef CONFIG_X86
@@ -385,13 +387,17 @@ int guest_remove_page(struct domain *d, unsigned long gmfn)
      * Since we're likely to free the page below, we need to suspend
      * xenmem_add_to_physmap()'s suppressing of IOMMU TLB flushes.
      */
+#ifdef CONFIG_HAS_PASSTHROUGH
     dont_flush_p = &this_cpu(iommu_dont_flush_iotlb);
     dont_flush = *dont_flush_p;
     *dont_flush_p = false;
+#endif
 
     rc = guest_physmap_remove_page(d, _gfn(gmfn), mfn, 0);
 
+#ifdef CONFIG_HAS_PASSTHROUGH
     *dont_flush_p = dont_flush;
+#endif
 
     /*
      * With the lack of an IOMMU on some platforms, domains with DMA-capable
@@ -839,11 +845,13 @@ int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap *xatp,
     xatp->gpfn += start;
     xatp->size -= start;
 
+#ifdef CONFIG_HAS_PASSTHROUGH
     if ( is_iommu_enabled(d) )
     {
        this_cpu(iommu_dont_flush_iotlb) = 1;
        extra.ppage = &pages[0];
     }
+#endif
 
     while ( xatp->size > done )
     {
@@ -868,6 +876,7 @@ int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap *xatp,
         }
     }
 
+#ifdef CONFIG_HAS_PASSTHROUGH
     if ( is_iommu_enabled(d) )
     {
         int ret;
@@ -894,6 +903,7 @@ int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap *xatp,
         if ( unlikely(ret) && rc >= 0 )
             rc = ret;
     }
+#endif
 
     return rc;
 }
xen/include/xen/iommu.h +7 -1
index 460755df29..904cdf725d 100644
@@ -51,9 +51,15 @@ static inline bool_t dfn_eq(dfn_t x, dfn_t y)
     return dfn_x(x) == dfn_x(y);
 }
 
-extern bool_t iommu_enable, iommu_enabled;
+extern bool_t iommu_enable;
 extern bool force_iommu, iommu_quarantine, iommu_verbose;
 
+#ifdef CONFIG_HAS_PASSTHROUGH
+extern bool iommu_enabled;
+#else
+#define iommu_enabled false
+#endif
+
 #ifdef CONFIG_X86
 extern enum __packed iommu_intremap {
    /*
Signature · 1 line
2.31.1
#18 lore raw

PATCH v4 4/4 automation: Add container for riscv64 builds

In reply to Connor Davis

Add a container for cross-compiling xen to riscv64. This just includes the cross-compiler and necessary packages for building xen itself (packages for tools, stubdoms, etc., can be added later).

---
 automation/build/archlinux/riscv64.dockerfile | 19 +++++++++++++++++++
 automation/scripts/containerize               |  1 +
 2 files changed, 20 insertions(+)
 create mode 100644 automation/build/archlinux/riscv64.dockerfile
automation/build/archlinux/riscv64.dockerfile new file +19 -0
new file mode 100644
index 0000000000..ff8b2b955d
@@ -0,0 +1,19 @@
+FROM archlinux
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="[email protected]"
+
+# Packages needed for the build
+RUN pacman --noconfirm --needed -Syu \
+    base-devel \
+    git \
+    inetutils \
+    riscv64-linux-gnu-binutils \
+    riscv64-linux-gnu-gcc \
+    riscv64-linux-gnu-glibc
+
+# Add compiler path
+ENV CROSS_COMPILE=riscv64-linux-gnu-
+
+RUN useradd --create-home user
+USER user
+WORKDIR /build
automation/scripts/containerize +1 -0
index b7c81559fb..59edf0ba40 100755
@@ -26,6 +26,7 @@ BASE="registry.gitlab.com/xen-project/xen"
 case "_${CONTAINER}" in
     _alpine) CONTAINER="${BASE}/alpine:3.12" ;;
     _archlinux|_arch) CONTAINER="${BASE}/archlinux:current" ;;
+    _riscv64) CONTAINER="${BASE}/archlinux:riscv64" ;;
     _centos7) CONTAINER="${BASE}/centos:7" ;;
     _centos72) CONTAINER="${BASE}/centos:7.2" ;;
     _fedora) CONTAINER="${BASE}/fedora:29";;
Signature · 1 line
2.31.1
#3 lore raw

Re: [PATCH v4 1/4] xen/char: Default HAS_NS16550 to y only for X86 and ARM

Quoted 8 lines · Jan Beulich
Quoted 5 lines · Connor Davis

Defaulting to yes only for X86 and ARM reduces the requirements for a minimal build when porting new architectures.

Actually, just to make sure: This ...

xen/drivers/char/Kconfig line 3

Quoted 6 lines
xen/drivers/char/Kconfig +1 -0
@@ -1,5 +1,6 @@
 config HAS_NS16550
 	bool "NS16550 UART driver" if ARM
+	default n if RISCV

... won't trigger a kconfig warning prior to the RISCV symbol getting introduced, will it? (I was about to commit the change when I started wondering.)

Jan

Acked-by on v4 2/4
#6 lore raw

Re: [PATCH v4 2/4] xen/common: Guard iommu symbols with CONFIG_HAS_PASSTHROUGH

In reply to Connor Davis
Quoted 8 lines · Connor Davis

The variables iommu_enabled and iommu_dont_flush_iotlb are defined in drivers/passthrough/iommu.c and are referenced in common code, which causes the link to fail when !CONFIG_HAS_PASSTHROUGH.

Guard references to these variables in common code so that xen builds when !CONFIG_HAS_PASSTHROUGH.

Somewhat hesitantly

with ...

xen/include/xen/iommu.h static inline bool_t dfn_eq(dfn_t x, dfn_t y) · line 54

Quoted 8 lines
xen/include/xen/iommu.h +1 -1
@@ -51,9 +51,15 @@ static inline bool_t dfn_eq(dfn_t x, dfn_t y)
     return dfn_x(x) == dfn_x(y);
 }
 
-extern bool_t iommu_enable, iommu_enabled;
+extern bool_t iommu_enable;

... just "bool" used here, as I think I did say before. Can be taken care of while committing, I think.

Jan

#9 lore raw

Re: [PATCH v4 3/4] xen: Add files needed for minimal riscv build

In reply to Connor Davis
Quoted 25 lines · Connor Davis

Add arch-specific makefiles and configs needed to build for riscv. Also add a minimal head.S that is a simple infinite loop. head.o can be built with

$ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen tiny64_defconfig
$ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen TARGET=head.o

No other TARGET is supported at the moment.

---
 config/riscv.mk                         |  4 +++
 xen/Makefile                            |  8 +++--
 xen/arch/riscv/Kconfig                  | 47 +++++++++++++++++++++++++
 xen/arch/riscv/Kconfig.debug            |  0
 xen/arch/riscv/Makefile                 |  0
 xen/arch/riscv/Rules.mk                 |  0
 xen/arch/riscv/arch.mk                  | 14 ++++++++
 xen/arch/riscv/asm-offsets.c            |  0
 xen/arch/riscv/configs/tiny64_defconfig | 13 +++++++
 xen/arch/riscv/head.S                   |  6 ++++
 xen/include/asm-riscv/config.h          | 47 +++++++++++++++++++++++++
 11 files changed, 137 insertions(+), 2 deletions(-)
 create mode 100644 config/riscv.mk
 create mode 100644 xen/arch/riscv/Kconfig
Quoted 8 lines
 create mode 100644 xen/arch/riscv/Kconfig.debug
 create mode 100644 xen/arch/riscv/Makefile
 create mode 100644 xen/arch/riscv/Rules.mk
 create mode 100644 xen/arch/riscv/arch.mk
 create mode 100644 xen/arch/riscv/asm-offsets.c
 create mode 100644 xen/arch/riscv/configs/tiny64_defconfig
 create mode 100644 xen/arch/riscv/head.S
 create mode 100644 xen/include/asm-riscv/config.h

I think this wants to be accompanied by an addition to ./MAINTAINERS right away, such that future RISC-V patches can be acked by the respective designated maintainers, rather than falling under "THE REST". Question is whether you / we have settled yet who's to become arch maintainer there.

Jan

#19 lore raw

Re: [PATCH v4 4/4] automation: Add container for riscv64 builds

In reply to Connor Davis
Quoted 6 lines · Connor Davis

Add a container for cross-compiling xen to riscv64. This just includes the cross-compiler and necessary packages for building xen itself (packages for tools, stubdoms, etc., can be added later).

I've deployed this version of the container, which (surprisingly, not) is rather smaller than the one with the locally built gcc toolchain.

Therefore, Acked-by: Andrew Cooper <[email protected]> and I'll commit this right away to make xen.git match reality.

~Andrew

#10 lore raw

Re: [PATCH v4 3/4] xen: Add files needed for minimal riscv build

In reply to Jan Beulich
Quoted 35 lines · Jan Beulich
Quoted 25 lines · Connor Davis

Add arch-specific makefiles and configs needed to build for riscv. Also add a minimal head.S that is a simple infinite loop. head.o can be built with

$ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen tiny64_defconfig
$ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen TARGET=head.o

No other TARGET is supported at the moment.

---
 config/riscv.mk                         |  4 +++
 xen/Makefile                            |  8 +++--
 xen/arch/riscv/Kconfig                  | 47 +++++++++++++++++++++++++
 xen/arch/riscv/Kconfig.debug            |  0
 xen/arch/riscv/Makefile                 |  0
 xen/arch/riscv/Rules.mk                 |  0
 xen/arch/riscv/arch.mk                  | 14 ++++++++
 xen/arch/riscv/asm-offsets.c            |  0
 xen/arch/riscv/configs/tiny64_defconfig | 13 +++++++
 xen/arch/riscv/head.S                   |  6 ++++
 xen/include/asm-riscv/config.h          | 47 +++++++++++++++++++++++++
 11 files changed, 137 insertions(+), 2 deletions(-)
 create mode 100644 config/riscv.mk
 create mode 100644 xen/arch/riscv/Kconfig
Quoted 8 lines
 create mode 100644 xen/arch/riscv/Kconfig.debug
 create mode 100644 xen/arch/riscv/Makefile
 create mode 100644 xen/arch/riscv/Rules.mk
 create mode 100644 xen/arch/riscv/arch.mk
 create mode 100644 xen/arch/riscv/asm-offsets.c
 create mode 100644 xen/arch/riscv/configs/tiny64_defconfig
 create mode 100644 xen/arch/riscv/head.S
 create mode 100644 xen/include/asm-riscv/config.h
Quoted 8 lines

I think this wants to be accompanied by an addition to ./MAINTAINERS right away, such that future RISC-V patches can be acked by the respective designated maintainers, rather than falling under "THE REST". Question is whether you / we have settled yet who's to become arch maintainer there.

Jan

I'd like to volunteer myself for this, as I'm slated to continue with the port indefinitely and would at least like to review patches. If Connor has the time, I think it makes sense for him to be listed there too.

Until we have others (it's just us two right now), it'll be a lot of us reviewing each other's arch-specific work (in addition to reviewers elsewhere in the Xen project, of course).

-Bobby

Signature · 2 lines
Bobby Eshleman
SE at Vates SAS
#7 lore raw

Re: [PATCH v4 2/4] xen/common: Guard iommu symbols with CONFIG_HAS_PASSTHROUGH

In reply to Jan Beulich
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Connor Davis
xen/include/xen/iommu.h +0 -0
@@ -51,9 +51,15 @@ static inline bool_t dfn_eq(dfn_t x, dfn_t y)
     return dfn_x(x) == dfn_x(y);
 }
 
Quoted 5 lines

xen/include/xen/iommu.h static inline bool_t dfn_eq(dfn_t x, dfn_t y) · line 54

Quoted 2 lines
xen/include/xen/iommu.h +1 -1
-extern bool_t iommu_enable, iommu_enabled;
+extern bool_t iommu_enable;

... just "bool" used here, as I think I did say before. Can be taken care of while committing, I think.

Actually, while preparing to commit this, I realized this would better be

xen/include/xen/iommu.h +4 -0
@@ -51,8 +51,12 @@ static inline bool_t dfn_eq(dfn_t x, dfn_t y)
     return dfn_x(x) == dfn_x(y);
 }
 
+#ifdef CONFIG_HAS_PASSTHROUGH
 extern bool_t iommu_enable, iommu_enabled;
 extern bool force_iommu, iommu_quarantine, iommu_verbose;
+#else
+#define iommu_enabled false
+#endif
 
 #ifdef CONFIG_X86
 extern enum __packed iommu_intremap {

Which is what I'm about to commit.

Jan

#4 lore raw

Re: [PATCH v4 1/4] xen/char: Default HAS_NS16550 to y only for X86 and ARM

In reply to Jan Beulich
Quoted 12 lines · Jan Beulich
Quoted 8 lines · Jan Beulich
Quoted 5 lines · Connor Davis

Defaulting to yes only for X86 and ARM reduces the requirements for a minimal build when porting new architectures.

Actually, just to make sure: This ...

Quoted 10 lines

xen/drivers/char/Kconfig line 3

Quoted 6 lines
xen/drivers/char/Kconfig +1 -0
@@ -1,5 +1,6 @@
 config HAS_NS16550
 	bool "NS16550 UART driver" if ARM
+	default n if RISCV

... won't trigger a kconfig warning prior to the RISCV symbol getting introduced, will it? (I was about to commit the change when I started wondering.)

While, not having heard back, I've now verified this myself, I still decided to leave committing this until the point where it can be committed together with at least patch 3 here, so there wouldn't be a seemingly stray reference to RISCV here.

Jan

#11 lore raw

Re: [PATCH v4 3/4] xen: Add files needed for minimal riscv build

In reply to Bob Eshleman
Quoted 48 lines · Bob Eshleman
Quoted 34 lines · Jan Beulich
Quoted 23 lines · Connor Davis

Add arch-specific makefiles and configs needed to build for riscv. Also add a minimal head.S that is a simple infinite loop. head.o can be built with

$ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen tiny64_defconfig
$ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen TARGET=head.o

No other TARGET is supported at the moment.

---
  config/riscv.mk                         |  4 +++
  xen/Makefile                            |  8 +++--
  xen/arch/riscv/Kconfig                  | 47 +++++++++++++++++++++++++
  xen/arch/riscv/Kconfig.debug            |  0
  xen/arch/riscv/Makefile                 |  0
  xen/arch/riscv/Rules.mk                 |  0
  xen/arch/riscv/arch.mk                  | 14 ++++++++
  xen/arch/riscv/asm-offsets.c            |  0
  xen/arch/riscv/configs/tiny64_defconfig | 13 +++++++
  xen/arch/riscv/head.S                   |  6 ++++
  xen/include/asm-riscv/config.h          | 47 +++++++++++++++++++++++++
  11 files changed, 137 insertions(+), 2 deletions(-)
Quoted 10 lines

create mode 100644 config/riscv.mk
create mode 100644 xen/arch/riscv/Kconfig
create mode 100644 xen/arch/riscv/Kconfig.debug create mode 100644 xen/arch/riscv/Makefile create mode 100644 xen/arch/riscv/Rules.mk create mode 100644 xen/arch/riscv/arch.mk
create mode 100644 xen/arch/riscv/asm-offsets.c create mode 100644 xen/arch/riscv/configs/tiny64_defconfig create mode 100644 xen/arch/riscv/head.S
create mode 100644 xen/include/asm-riscv/config.h

Quoted 8 lines

I think this wants to be accompanied by an addition to ./MAINTAINERS right away, such that future RISC-V patches can be acked by the respective designated maintainers, rather than falling under "THE REST". Question is whether you / we have settled yet who's to become arch maintainer there.

Jan

I'd like to volunteer myself for this, as I'm slated to continue with the port indefinitely and would at least like to review patches. If Connor has the time, I think it makes sense for him to be listed there too.

Quoted 6 lines

Until we have others (it's just us two right now), it'll be a lot of us reviewing each other's arch-specific work (in addition to reviewers elsewhere in the Xen project, of course).

-Bobby

Jan: can you list Bobby as the maintainer on commit? You can list me as well, but I can't guarantee a time commitment unlike Bobby.

Thanks,
Connor

#12 lore raw

Re: [PATCH v4 3/4] xen: Add files needed for minimal riscv build

Quoted 55 lines · Connor Davis
Quoted 52 lines · Bob Eshleman
Quoted 34 lines · Jan Beulich
Quoted 23 lines · Connor Davis

Add arch-specific makefiles and configs needed to build for riscv. Also add a minimal head.S that is a simple infinite loop. head.o can be built with

$ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen tiny64_defconfig
$ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen TARGET=head.o

No other TARGET is supported at the moment.

---
  config/riscv.mk                         |  4 +++
  xen/Makefile                            |  8 +++--
  xen/arch/riscv/Kconfig                  | 47 +++++++++++++++++++++++++
  xen/arch/riscv/Kconfig.debug            |  0
  xen/arch/riscv/Makefile                 |  0
  xen/arch/riscv/Rules.mk                 |  0
  xen/arch/riscv/arch.mk                  | 14 ++++++++
  xen/arch/riscv/asm-offsets.c            |  0
  xen/arch/riscv/configs/tiny64_defconfig | 13 +++++++
  xen/arch/riscv/head.S                   |  6 ++++
  xen/include/asm-riscv/config.h          | 47 +++++++++++++++++++++++++
  11 files changed, 137 insertions(+), 2 deletions(-)
Quoted 10 lines

create mode 100644 config/riscv.mk
create mode 100644 xen/arch/riscv/Kconfig
create mode 100644 xen/arch/riscv/Kconfig.debug create mode 100644 xen/arch/riscv/Makefile create mode 100644 xen/arch/riscv/Rules.mk create mode 100644 xen/arch/riscv/arch.mk
create mode 100644 xen/arch/riscv/asm-offsets.c create mode 100644 xen/arch/riscv/configs/tiny64_defconfig create mode 100644 xen/arch/riscv/head.S
create mode 100644 xen/include/asm-riscv/config.h

Quoted 8 lines

I think this wants to be accompanied by an addition to ./MAINTAINERS right away, such that future RISC-V patches can be acked by the respective designated maintainers, rather than falling under "THE REST". Question is whether you / we have settled yet who's to become arch maintainer there.

Jan

I'd like to volunteer myself for this, as I'm slated to continue with the port indefinitely and would at least like to review patches. If Connor has the time, I think it makes sense for him to be listed there too.

Until we have others (it's just us two right now), it'll be a lot of us reviewing each other's arch-specific work (in addition to reviewers elsewhere in the Xen project, of course).

Quoted 5 lines
Quoted 2 lines

-Bobby

Jan: can you list Bobby as the maintainer on commit? You can list me as well,
but I can't guarantee a time commitment unlike Bobby.

Well, actually I did expect a v5 submission with whatever entry you both deem suitable. Otoh I now realize that patch 1 had my extra request addressed (by myself) and hence with this one needing just that entry, I could indeed add that addition myself while committing. Let me move the mails back to the to-be-committed folder...

Jan

#16 lore raw

Re: [PATCH v4 3/4] xen: Add files needed for minimal riscv build

In reply to Connor Davis
Quoted 8 lines · Connor Davis

Add arch-specific makefiles and configs needed to build for riscv. Also add a minimal head.S that is a simple infinite loop. head.o can be built with

$ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen tiny64_defconfig
$ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen TARGET=head.o

No other TARGET is supported at the moment.

Just to confirm - an actual (even if not functioning) xen binary can't be linked yet? I ask because that would be the prereq for me to set up routine (cross) build testing, just like I do for Arm.

Jan

#13 lore raw

Re: [PATCH v4 3/4] xen: Add files needed for minimal riscv build

In reply to Jan Beulich

Hi,

Quoted 62 lines · Jan Beulich
Quoted 55 lines · Connor Davis
Quoted 52 lines · Bob Eshleman
Quoted 34 lines · Jan Beulich
Quoted 23 lines · Connor Davis

Add arch-specific makefiles and configs needed to build for riscv. Also add a minimal head.S that is a simple infinite loop. head.o can be built with

$ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen tiny64_defconfig
$ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen TARGET=head.o

No other TARGET is supported at the moment.

---
   config/riscv.mk                         |  4 +++
   xen/Makefile                            |  8 +++--
   xen/arch/riscv/Kconfig                  | 47 +++++++++++++++++++++++++
   xen/arch/riscv/Kconfig.debug            |  0
   xen/arch/riscv/Makefile                 |  0
   xen/arch/riscv/Rules.mk                 |  0
   xen/arch/riscv/arch.mk                  | 14 ++++++++
   xen/arch/riscv/asm-offsets.c            |  0
   xen/arch/riscv/configs/tiny64_defconfig | 13 +++++++
   xen/arch/riscv/head.S                   |  6 ++++
   xen/include/asm-riscv/config.h          | 47 +++++++++++++++++++++++++
   11 files changed, 137 insertions(+), 2 deletions(-)
Quoted 10 lines

create mode 100644 config/riscv.mk
create mode 100644 xen/arch/riscv/Kconfig
create mode 100644 xen/arch/riscv/Kconfig.debug create mode 100644 xen/arch/riscv/Makefile create mode 100644 xen/arch/riscv/Rules.mk create mode 100644 xen/arch/riscv/arch.mk
create mode 100644 xen/arch/riscv/asm-offsets.c create mode 100644 xen/arch/riscv/configs/tiny64_defconfig create mode 100644 xen/arch/riscv/head.S
create mode 100644 xen/include/asm-riscv/config.h

Quoted 8 lines

I think this wants to be accompanied by an addition to ./MAINTAINERS right away, such that future RISC-V patches can be acked by the respective designated maintainers, rather than falling under "THE REST". Question is whether you / we have settled yet who's to become arch maintainer there.

Jan

I'd like to volunteer myself for this, as I'm slated to continue with the port indefinitely and would at least like to review patches. If Connor has the time, I think it makes sense for him to be listed there too.

Until we have others (it's just us two right now), it'll be a lot of us reviewing each other's arch-specific work (in addition to reviewers elsewhere in the Xen project, of course).

Quoted 5 lines
Quoted 2 lines

-Bobby

Jan: can you list Bobby as the maintainer on commit? You can list me as well,
but I can't guarantee a time commitment unlike Bobby.

Quoted 5 lines

Well, actually I did expect a v5 submission with whatever entry you both deem suitable. Otoh I now realize that patch 1 had my extra request addressed (by myself) and hence with this one needing just that entry, I could indeed add that addition myself while committing. Let me move the mails back to the to-be-committed folder...

At the risk of being picky, I don't think this should be done of commit. Instead, a formal patch should be sent with both maintainers + one of the committer acking (or signed-off-by) the proposal.

Cheers,

Signature · 1 line
Julien Grall
#17 lore raw

Re: [PATCH v4 3/4] xen: Add files needed for minimal riscv build

In reply to Jan Beulich
Quoted 5 lines · Jan Beulich
Quoted 4 lines · Connor Davis

Add arch-specific makefiles and configs needed to build for riscv. Also add a minimal head.S that is a simple infinite loop. head.o can be built with

Quoted 7 lines
Quoted 4 lines
$ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen tiny64_defconfig
$ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen TARGET=head.o

No other TARGET is supported at the moment.

Just to confirm - an actual (even if not functioning) xen binary can't be linked yet? I ask because that would be the prereq for me to set up routine (cross) build testing, just like I do for Arm.

That's right. The consensus was that targets and files should be added incrementally, so I stopped at head.o for now.

Thanks,
Connor

#14 lore raw

Re: [PATCH v4 3/4] xen: Add files needed for minimal riscv build

In reply to Julien Grall
Quoted 67 lines · Julien Grall

Hi,

Quoted 64 lines · Jan Beulich
Quoted 62 lines · Connor Davis
Quoted 50 lines · Bob Eshleman
Quoted 36 lines · Jan Beulich
Quoted 25 lines · Connor Davis

Add arch-specific makefiles and configs needed to build for riscv. Also add a minimal head.S that is a simple infinite loop. head.o can be built with

$ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen tiny64_defconfig
$ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen TARGET=head.o

No other TARGET is supported at the moment.

---
   config/riscv.mk                         |  4 +++ xen/Makefile                            |  8 +++-- xen/arch/riscv/Kconfig                  | 47
+++++++++++++++++++++++++
   xen/arch/riscv/Kconfig.debug            |  0 xen/arch/riscv/Makefile                 |  0 xen/arch/riscv/Rules.mk                 |  0 xen/arch/riscv/arch.mk                  | 14 ++++++++ xen/arch/riscv/asm-offsets.c            |  0 xen/arch/riscv/configs/tiny64_defconfig | 13 +++++++ xen/arch/riscv/head.S                   |  6 ++++ xen/include/asm-riscv/config.h          | 47
+++++++++++++++++++++++++

   11 files changed, 137 insertions(+), 2 deletions(-)
Quoted 10 lines

   create mode 100644 config/riscv.mk
   create mode 100644 xen/arch/riscv/Kconfig
   create mode 100644 xen/arch/riscv/Kconfig.debug create mode 100644 xen/arch/riscv/Makefile create mode 100644 xen/arch/riscv/Rules.mk create mode 100644 xen/arch/riscv/arch.mk
   create mode 100644 xen/arch/riscv/asm-offsets.c create mode 100644 xen/arch/riscv/configs/tiny64_defconfig create mode 100644 xen/arch/riscv/head.S
   create mode 100644 xen/include/asm-riscv/config.h

Quoted 8 lines

I think this wants to be accompanied by an addition to ./MAINTAINERS right away, such that future RISC-V patches can be acked by the respective designated maintainers, rather than falling under "THE REST". Question is whether you / we have settled yet who's to become arch maintainer there.

Jan

I'd like to volunteer myself for this, as I'm slated to continue with the port indefinitely and would at least like to review patches.  If Connor has the time, I think it makes sense for him to be listed there too.

Quoted 6 lines

Until we have others (it's just us two right now), it'll be a lot of us reviewing each other's arch-specific work (in addition to reviewers elsewhere in the Xen project, of course).

-Bobby

Jan: can you list Bobby as the maintainer on commit? You can list me as well,
but I can't guarantee a time commitment unlike Bobby.

Quoted 7 lines
Quoted 5 lines

Well, actually I did expect a v5 submission with whatever entry you both deem suitable. Otoh I now realize that patch 1 had my extra request addressed (by myself) and hence with this one needing just that entry, I could indeed add that addition myself while committing. Let me move the mails back to the to-be-committed folder...

At the risk of being picky, I don't think this should be done of commit. Instead, a formal patch should be sent with both maintainers + one of the committer acking (or signed-off-by) the proposal.

No problem, I will send a v5.

Thanks,
Connor

#15 lore raw

Re: [PATCH v4 3/4] xen: Add files needed for minimal riscv build

In reply to Connor Davis
Quoted 56 lines · Connor Davis
Quoted 52 lines · Bob Eshleman
Quoted 34 lines · Jan Beulich
Quoted 23 lines · Connor Davis

Add arch-specific makefiles and configs needed to build for riscv. Also add a minimal head.S that is a simple infinite loop. head.o can be built with

$ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen tiny64_defconfig
$ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen TARGET=head.o

No other TARGET is supported at the moment.

---
  config/riscv.mk                         |  4 +++
  xen/Makefile                            |  8 +++--
  xen/arch/riscv/Kconfig                  | 47 +++++++++++++++++++++++++
  xen/arch/riscv/Kconfig.debug            |  0
  xen/arch/riscv/Makefile                 |  0
  xen/arch/riscv/Rules.mk                 |  0
  xen/arch/riscv/arch.mk                  | 14 ++++++++
  xen/arch/riscv/asm-offsets.c            |  0
  xen/arch/riscv/configs/tiny64_defconfig | 13 +++++++
  xen/arch/riscv/head.S                   |  6 ++++
  xen/include/asm-riscv/config.h          | 47 +++++++++++++++++++++++++
  11 files changed, 137 insertions(+), 2 deletions(-)
Quoted 10 lines

create mode 100644 config/riscv.mk
create mode 100644 xen/arch/riscv/Kconfig
create mode 100644 xen/arch/riscv/Kconfig.debug create mode 100644 xen/arch/riscv/Makefile create mode 100644 xen/arch/riscv/Rules.mk create mode 100644 xen/arch/riscv/arch.mk
create mode 100644 xen/arch/riscv/asm-offsets.c create mode 100644 xen/arch/riscv/configs/tiny64_defconfig create mode 100644 xen/arch/riscv/head.S
create mode 100644 xen/include/asm-riscv/config.h

Quoted 8 lines

I think this wants to be accompanied by an addition to ./MAINTAINERS right away, such that future RISC-V patches can be acked by the respective designated maintainers, rather than falling under "THE REST". Question is whether you / we have settled yet who's to become arch maintainer there.

Jan

I'd like to volunteer myself for this, as I'm slated to continue with the port indefinitely and would at least like to review patches. If Connor has the time, I think it makes sense for him to be listed there too.

Until we have others (it's just us two right now), it'll be a lot of us reviewing each other's arch-specific work (in addition to reviewers elsewhere in the Xen project, of course).

Quoted 5 lines
Quoted 2 lines

-Bobby

Jan: can you list Bobby as the maintainer on commit? You can list me as well,
but I can't guarantee a time commitment unlike Bobby.

If you need more people you can add me as well. I don't have too much time to spend here, but I did start the initial Xen port and have a good understanding of the RISC-V Hypervisor extension.

Alistair

Quoted 4 lines

Thanks,
Connor