|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [RFC PATCH 1/6] xen/riscv: Add necessary headers and definitions to build xen.
Hi Xie, Thank you for the contribution. On 31/05/2022 07:57, Xie Xun wrote: Target xen and xen-syms can be built with: $ make XEN_TARGET_ARCH=riscv64 CROSS_COMPILE=riscv64-linux-gnu- tiny64_defconfig $ make XEN_TARGET_ARCH=riscv64 CROSS_COMPILE=riscv64-linux-gnu- It can be tested with Qemu. $ qemu-system-riscv64 -machine virt -m 1G -kernel xen Xen will jump into an infinite loop and there will be no output. I will answer here what you wrote in the cover letter: "There are some problems though. The first patch of this series is very large, but it seems most of the code is necessary for building xen. I am trying my best to remove some code but it still has more than 8000 lines of code."I think it would be beneficial to split this patch in smaller logical one even they don't build one by one. Briefly looking through the series, it looks like some code (such as the atomic) was imported from another project. So you could move them in one (or multiple) separate patch.Also, if you took code from other project, it would be good to specify where this coming from and what was the baseline. This will help to re-sync the code in the future. Signed-off-by: Xie Xun <xiexun162534@xxxxxxxxx> --- xen/arch/riscv/Kconfig | 2 + xen/arch/riscv/Makefile | 51 ++ xen/arch/riscv/Rules.mk | 57 ++ xen/arch/riscv/delay.c | 14 + xen/arch/riscv/domain.c | 191 ++++ xen/arch/riscv/domctl.c | 52 ++ xen/arch/riscv/guestcopy.c | 59 ++ xen/arch/riscv/include/asm/acpi.h | 9 + xen/arch/riscv/include/asm/altp2m.h | 39 + xen/arch/riscv/include/asm/asm.h | 76 ++ xen/arch/riscv/include/asm/atomic.h | 375 ++++++++ xen/arch/riscv/include/asm/bitops.h | 397 ++++++++ xen/arch/riscv/include/asm/bug.h | 67 ++ xen/arch/riscv/include/asm/byteorder.h | 16 + xen/arch/riscv/include/asm/cache.h | 24 + xen/arch/riscv/include/asm/cmpxchg.h | 382 ++++++++ xen/arch/riscv/include/asm/config.h | 149 ++- xen/arch/riscv/include/asm/cpufeature.h | 68 ++ xen/arch/riscv/include/asm/csr.h | 81 ++ xen/arch/riscv/include/asm/current.h | 41 + xen/arch/riscv/include/asm/debugger.h | 15 + xen/arch/riscv/include/asm/delay.h | 28 + xen/arch/riscv/include/asm/desc.h | 12 + xen/arch/riscv/include/asm/device.h | 93 ++ xen/arch/riscv/include/asm/div64.h | 23 + xen/arch/riscv/include/asm/domain.h | 80 ++ xen/arch/riscv/include/asm/event.h | 42 + xen/arch/riscv/include/asm/fence.h | 12 + xen/arch/riscv/include/asm/flushtlb.h | 56 ++ xen/arch/riscv/include/asm/grant_table.h | 93 ++ xen/arch/riscv/include/asm/guest_access.h | 125 +++ xen/arch/riscv/include/asm/guest_atomics.h | 62 ++ xen/arch/riscv/include/asm/hardirq.h | 27 + xen/arch/riscv/include/asm/hypercall.h | 12 + xen/arch/riscv/include/asm/init.h | 42 + xen/arch/riscv/include/asm/io.h | 283 ++++++ xen/arch/riscv/include/asm/iocap.h | 16 + xen/arch/riscv/include/asm/iommu.h | 46 + xen/arch/riscv/include/asm/iommu_fwspec.h | 68 ++ xen/arch/riscv/include/asm/irq.h | 62 ++ xen/arch/riscv/include/asm/mem_access.h | 35 + xen/arch/riscv/include/asm/mm.h | 320 +++++++ xen/arch/riscv/include/asm/monitor.h | 65 ++ xen/arch/riscv/include/asm/nospec.h | 25 + xen/arch/riscv/include/asm/numa.h | 41 + xen/arch/riscv/include/asm/p2m.h | 307 +++++++ xen/arch/riscv/include/asm/page-bits.h | 14 + xen/arch/riscv/include/asm/page.h | 319 +++++++ xen/arch/riscv/include/asm/paging.h | 16 + xen/arch/riscv/include/asm/pci.h | 31 + xen/arch/riscv/include/asm/percpu.h | 35 + xen/arch/riscv/include/asm/processor.h | 176 ++++ xen/arch/riscv/include/asm/random.h | 9 + xen/arch/riscv/include/asm/regs.h | 42 + xen/arch/riscv/include/asm/riscv_encoding.h | 960 ++++++++++++++++++++ xen/arch/riscv/include/asm/setup.h | 23 + xen/arch/riscv/include/asm/smp.h | 69 ++ xen/arch/riscv/include/asm/softirq.h | 16 + xen/arch/riscv/include/asm/spinlock.h | 13 + xen/arch/riscv/include/asm/string.h | 28 + xen/arch/riscv/include/asm/system.h | 98 ++ xen/arch/riscv/include/asm/time.h | 81 ++ xen/arch/riscv/include/asm/trace.h | 12 + xen/arch/riscv/include/asm/traps.h | 30 + xen/arch/riscv/include/asm/types.h | 73 ++ xen/arch/riscv/include/asm/vm_event.h | 63 ++ xen/arch/riscv/include/asm/xenoprof.h | 12 + xen/arch/riscv/irq.c | 126 +++ xen/arch/riscv/lib/Makefile | 1 + xen/arch/riscv/lib/find_next_bit.c | 285 ++++++ This is a copy from the Arm version, right? If so, please move the Arm one in common/lib/ so you can re-use it. xen/arch/riscv/mm.c | 409 +++++++++ xen/arch/riscv/p2m.c | 97 ++ xen/arch/riscv/percpu.c | 84 ++ xen/arch/riscv/platforms/Kconfig | 31 + xen/arch/riscv/riscv64/Makefile | 2 +- xen/arch/riscv/riscv64/asm-offsets.c | 39 + xen/arch/riscv/riscv64/head.S | 13 +- xen/arch/riscv/setup.c | 65 ++ xen/arch/riscv/shutdown.c | 24 + xen/arch/riscv/smp.c | 38 + xen/arch/riscv/smpboot.c | 78 ++ xen/arch/riscv/sysctl.c | 31 + xen/arch/riscv/time.c | 69 ++ xen/arch/riscv/traps.c | 87 ++ xen/arch/riscv/vm_event.c | 51 ++ xen/arch/riscv/xen.lds.S | 274 ++++++ xen/include/public/arch-riscv.h | 182 ++++ xen/include/public/arch-riscv/hvm/save.h | 39 + xen/include/public/hvm/save.h | 2 + xen/include/public/io/protocols.h | 3 + xen/include/public/pmu.h | 2 + xen/include/public/xen.h | 2 + The public headers could be moved separately. [...] The indentation looks incorrect to me. Kconfig is using hard tab rather than soft tab. [...] diff --git a/xen/arch/riscv/Rules.mk b/xen/arch/riscv/Rules.mk index e69de29bb2..85e0cc5e64 100644 --- a/xen/arch/riscv/Rules.mk +++ b/xen/arch/riscv/Rules.mk @@ -0,0 +1,57 @@ +######################################## +# riscv-specific definitions + +# +# If you change any of these configuration options then you must +# 'make clean' before rebuilding. +# + +CFLAGS += -I$(BASEDIR)/include + +$(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS)) +$(call cc-option-add,CFLAGS,CC,-Wnested-externs) +$(call cc-option-add,CFLAGS,CC,-mstrict-align) +$(call cc-option-add,CFLAGS,CC,-mtune=size) + +EARLY_PRINTK := n + +ifeq ($(CONFIG_DEBUG),y) + +# See docs/misc/arm/early-printk.txt for syntax + +EARLY_PRINTK := 8250,0x1c021000,2 Is the UART standardized in RISCv? + +ifneq ($(EARLY_PRINTK_$(CONFIG_EARLY_PRINTK)),) On Arm, we converted the early printk to Kconfig. I would recommend to do the same because otherwise the user would have to specify the option on most of "make" options. This lead to quite a few errors on the Arm side. diff --git a/xen/arch/riscv/delay.c b/xen/arch/riscv/delay.c new file mode 100644 index 0000000000..4a712e97e8 --- /dev/null +++ b/xen/arch/riscv/delay.c @@ -0,0 +1,14 @@ +void __delay(unsigned long cycles) This doesn't seem to be used in the common code. How did you decide what was needed? I am asking that because I think it would be good to avoid adding helpers that will never get used. I am assuming this is going to be implemented at some point. At minimum, I would recommend to add a TODO. But I would also consider to add ASSERT_UNREACHABLE() so anyone can notice when you use a function that has to be implemented. This is less a problem for function like delay. However... ... you may have hard time to debug some of those functions here. You are not implementing any of those domctl yet. So I think it would be
better to print an error message (gprintk(XENLOG_ERR...) and return -ENOSYS.
What's the problem? Cheers, -- Julien Grall
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |