Add RISC-V ISA extensions based on Linux-6.9
Subsystems (4)
cover Add RISC-V ISA extensions based on Linux-6.9
This series adds support for new ISA extensions based on Linux-6.9 namely:
Ztso and Zacas.
These patches can also be found in the riscv_more_exts_round2_v1 branch
at: https://github.com/avpatel/kvmtool.git
Anup Patel (3):
Sync-up headers with Linux-6.9 kernel
riscv: Add Ztso extensiona support
riscv: Add Zacas extensiona support
arm/aarch64/include/asm/kvm.h | 15 +- arm/aarch64/include/asm/sve_context.h | 11 + include/linux/kvm.h | 689 +------------------------- include/linux/virtio_pci.h | 10 +- mips/include/asm/kvm.h | 2 - powerpc/include/asm/kvm.h | 45 +- riscv/fdt.c | 2 + riscv/include/asm/kvm.h | 3 +- riscv/include/kvm/kvm-config-arch.h | 6 + x86/include/asm/kvm.h | 308 +++++++++++- 10 files changed, 384 insertions(+), 707 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/3 Sync-up headers with Linux-6.9 kernel
We sync-up Linux headers to get latest KVM RISC-V headers having Ztso and Zacas support.
--- arm/aarch64/include/asm/kvm.h | 15 +- arm/aarch64/include/asm/sve_context.h | 11 + include/linux/kvm.h | 689 +------------------------- include/linux/virtio_pci.h | 10 +- mips/include/asm/kvm.h | 2 - powerpc/include/asm/kvm.h | 45 +- riscv/include/asm/kvm.h | 3 +- x86/include/asm/kvm.h | 308 +++++++++++- 8 files changed, 376 insertions(+), 707 deletions(-)
arm/aarch64/include/asm/kvm.h +9 -6
@@ -37,9 +37,7 @@#include <asm/ptrace.h> #include <asm/sve_context.h> -#define __KVM_HAVE_GUEST_DEBUG#define __KVM_HAVE_IRQ_LINE -#define __KVM_HAVE_READONLY_MEM#define __KVM_HAVE_VCPU_EVENTS#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
@@ -76,11 +74,11 @@ struct kvm_regs {/* KVM_ARM_SET_DEVICE_ADDR ioctl id encoding */ #define KVM_ARM_DEVICE_TYPE_SHIFT 0 -#define KVM_ARM_DEVICE_TYPE_MASK GENMASK(KVM_ARM_DEVICE_TYPE_SHIFT + 15, \ - KVM_ARM_DEVICE_TYPE_SHIFT) +#define KVM_ARM_DEVICE_TYPE_MASK __GENMASK(KVM_ARM_DEVICE_TYPE_SHIFT + 15, \ + KVM_ARM_DEVICE_TYPE_SHIFT)#define KVM_ARM_DEVICE_ID_SHIFT 16 -#define KVM_ARM_DEVICE_ID_MASK GENMASK(KVM_ARM_DEVICE_ID_SHIFT + 15, \ - KVM_ARM_DEVICE_ID_SHIFT) +#define KVM_ARM_DEVICE_ID_MASK __GENMASK(KVM_ARM_DEVICE_ID_SHIFT + 15, \ + KVM_ARM_DEVICE_ID_SHIFT)/* Supported device IDs */ #define KVM_ARM_DEVICE_VGIC_V2 0
@@ -162,6 +160,11 @@ struct kvm_sync_regs {__u64 device_irq_level; }; +/* Bits for run->s.regs.device_irq_level */ +#define KVM_ARM_DEV_EL1_VTIMER (1 << 0) +#define KVM_ARM_DEV_EL1_PTIMER (1 << 1) +#define KVM_ARM_DEV_PMU (1 << 2) +/* * PMU filter structure. Describe a range of events with a particular * action. To be used with KVM_ARM_VCPU_PMU_V3_FILTER.
arm/aarch64/include/asm/sve_context.h +11 -0
@@ -13,6 +13,17 @@#define __SVE_VQ_BYTES 16/* number of bytes per quadword */ +/* +* Yes, __SVE_VQ_MAX is 512 QUADWORDS. +* +* To help ensure forward portability, this is much larger than the +* current maximum value defined by the SVE architecture. While arrays +* or static allocations can be sized based on this value, watch out! +* It will waste a surprisingly large amount of memory. +* +* Dynamic sizing based on the actual runtime vector length is likely to +* be preferable for most purposes. +*/ #define __SVE_VQ_MIN 1#define __SVE_VQ_MAX 512
include/linux/kvm.h +5 -684
774 lines not on this page · raw message
include/linux/virtio_pci.h +5 -5
@@ -240,7 +240,7 @@ struct virtio_pci_cfg_cap {#define VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_READ 0x5#define VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO 0x6 -struct __packed virtio_admin_cmd_hdr { +struct virtio_admin_cmd_hdr {__le16 opcode;/* * 1 - SR-IOV
@@ -252,20 +252,20 @@ struct __packed virtio_admin_cmd_hdr {__le64 group_member_id; }; -struct __packed virtio_admin_cmd_status { +struct virtio_admin_cmd_status {__le16 status;__le16 status_qualifier;/* Unused, reserved for future extensions. */ __u8 reserved2[4 ]; }; -struct __packed virtio_admin_cmd_legacy_wr_data { +struct virtio_admin_cmd_legacy_wr_data {__u8 offset;/* Starting offset of the register(s) to write. */ __u8 reserved[7 ];__u8 registers[]; }; -struct __packed virtio_admin_cmd_legacy_rd_data { +struct virtio_admin_cmd_legacy_rd_data {__u8 offset;/* Starting offset of the register(s) to read. */ };
@@ -275,7 +275,7 @@ struct __packed virtio_admin_cmd_legacy_rd_data {#define VIRTIO_ADMIN_CMD_MAX_NOTIFY_INFO 4 -struct __packed virtio_admin_cmd_notify_info_data { +struct virtio_admin_cmd_notify_info_data {__u8 flags;/* 0 = end of list, 1 = owner device, 2 = member device */ __u8 bar;/* BAR of the member or the owner device */ __u8 padding[6 ];
mips/include/asm/kvm.h +0 -2
@@ -20,8 +20,6 @@* Some parts derived from the x86 version of this file. */ -#define __KVM_HAVE_READONLY_MEM -#define KVM_COALESCED_MMIO_PAGE_OFFSET 1/*
powerpc/include/asm/kvm.h +44 -1
55 lines not on this page · raw message
riscv/include/asm/kvm.h +2 -1
@@ -16,7 +16,6 @@#include <asm/ptrace.h> #define __KVM_HAVE_IRQ_LINE -#define __KVM_HAVE_READONLY_MEM#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
@@ -166,6 +165,8 @@ enum KVM_RISCV_ISA_EXT_ID {KVM_RISCV_ISA_EXT_ZVFH ,KVM_RISCV_ISA_EXT_ZVFHMIN ,KVM_RISCV_ISA_EXT_ZFA , +KVM_RISCV_ISA_EXT_ZTSO , +KVM_RISCV_ISA_EXT_ZACAS , KVM_RISCV_ISA_EXT_MAX, };
x86/include/asm/kvm.h +300 -8
346 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 2/3 riscv: Add Ztso extensiona support
In reply to Anup PatelWhen the Ztso extension is available expose it to the guest via device tree so that guest can use it.
--- riscv/fdt.c | 1 + riscv/include/kvm/kvm-config-arch.h | 3 +++ 2 files changed, 4 insertions(+)
riscv/fdt.c +1 -0
@@ -48,6 +48,7 @@ struct isa_ext_info isa_info_arr[] = { {"zksed", KVM_RISCV_ISA_EXT_ZKSED}, {"zksh", KVM_RISCV_ISA_EXT_ZKSH}, {"zkt", KVM_RISCV_ISA_EXT_ZKT}, + {"ztso", KVM_RISCV_ISA_EXT_ZTSO}, {"zvbb", KVM_RISCV_ISA_EXT_ZVBB}, {"zvbc", KVM_RISCV_ISA_EXT_ZVBC}, {"zvfh", KVM_RISCV_ISA_EXT_ZVFH},
riscv/include/kvm/kvm-config-arch.h +3 -0
@@ -121,6 +121,9 @@ struct kvm_config_arch {OPT_BOOLEAN ('\0' ,"disable-zkt" , \ &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZKT ], \"Disable Zkt Extension" ), \ +OPT_BOOLEAN ('\0' ,"disable-ztso" , \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZTSO ], \ +"Disable Ztso Extension" ), \OPT_BOOLEAN ('\0' ,"disable-zvbb" , \ &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZVBB ], \ "Disable Zvbb Extension"), \
Signature · 1 line
2.34.1
PATCH 3/3 riscv: Add Zacas extensiona support
In reply to Anup PatelWhen the Zacas extension is available expose it to the guest via device tree so that guest can use it.
--- riscv/fdt.c | 1 + riscv/include/kvm/kvm-config-arch.h | 3 +++ 2 files changed, 4 insertions(+)
riscv/fdt.c +1 -0
@@ -22,6 +22,7 @@ struct isa_ext_info isa_info_arr[] = { {"svinval", KVM_RISCV_ISA_EXT_SVINVAL}, {"svnapot", KVM_RISCV_ISA_EXT_SVNAPOT}, {"svpbmt", KVM_RISCV_ISA_EXT_SVPBMT}, + {"zacas", KVM_RISCV_ISA_EXT_ZACAS}, {"zba", KVM_RISCV_ISA_EXT_ZBA}, {"zbb", KVM_RISCV_ISA_EXT_ZBB}, {"zbc", KVM_RISCV_ISA_EXT_ZBC},
riscv/include/kvm/kvm-config-arch.h +3 -0
@@ -43,6 +43,9 @@ struct kvm_config_arch {OPT_BOOLEAN ('\0' ,"disable-svpbmt" , \ &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_SVPBMT ], \"Disable Svpbmt Extension" ), \ +OPT_BOOLEAN ('\0' ,"disable-zacas" , \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZACAS ], \ +"Disable Zacas Extension" ), \OPT_BOOLEAN ('\0' ,"disable-zba" , \ &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZBA ], \ "Disable Zba Extension"), \
Signature · 1 line
2.34.1
Will Deacon
AppliedQuoted 6 lines · Anup Patel
This series adds support for new ISA extensions based on Linux-6.9 namely:
Ztso and Zacas.These patches can also be found in the
riscv_more_exts_round2_v1branch
at: https://github.com/avpatel/kvmtool.git
Quoted 6 lines
Anup Patel (3):
Sync-up headers with Linux-6.9 kernel
riscv: Add Ztso extensiona support
riscv: Add Zacas extensiona support[...]
Applied to kvmtool (master), thanks!
[1/3] Sync-up headers with Linux-6.9 kernel
https://git.kernel.org/will/kvmtool/c/85aaadf64649 [2/3] riscv: Add Ztso extensiona support https://git.kernel.org/will/kvmtool/c/a20adc64b4ea [3/3] riscv: Add Zacas extensiona support https://git.kernel.org/will/kvmtool/c/32f810364df0
Cheers,
Signature · 5 lines
Will https://fixes.arm64.dev https://next.arm64.dev https://will.arm64.dev