Add riscv isa exts based on linux-6.11
Subsystems (3)
cover Add riscv isa exts based on linux-6.11
From: Quan Zhou <[email protected]>
Add support for a few Zc* extensions, Zimop, Zcmop and Zawrs.
Quan Zhou (2):
Sync-up headers with Linux-6.11 kernel
riscv: Add Zc*/Zimop/Zcmop/Zawrs exts support
include/linux/kvm.h | 27 +++++++++++++++- powerpc/include/asm/kvm.h | 3 ++ riscv/fdt.c | 7 +++++ riscv/include/asm/kvm.h | 7 +++++ riscv/include/kvm/kvm-config-arch.h | 21 +++++++++++++ x86/include/asm/kvm.h | 49 +++++++++++++++++++++++++++++ 6 files changed, 113 insertions(+), 1 deletion(-)
base-commit: b48735e5d562eaffb96cf98a91da212176f1534c
Signature · 1 line
2.34.1
PATCH 1/2 Sync-up headers with Linux-6.11 kernel
From: Quan Zhou <[email protected]>
Sync Linux-6.11 headers to get the latest RISC-V KVM caps.
--- include/linux/kvm.h | 27 ++++++++++++++++++++- powerpc/include/asm/kvm.h | 3 +++ riscv/include/asm/kvm.h | 7 ++++++ x86/include/asm/kvm.h | 49 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+), 1 deletion(-)
include/linux/kvm.h +26 -1
@@ -192,11 +192,24 @@ struct kvm_xen_exit {/* Flags that describe what fields in emulation_failure hold valid data. */ #define KVM_INTERNAL_ERROR_EMULATION_FLAG_INSTRUCTION_BYTES (1ULL << 0) +/* +* struct kvm_run can be modified by userspace@any time, so KVM must be +* careful to avoid TOCTOU bugs. In order to protect KVM, HINT_UNSAFE_IN_KVM() +* renames fields in struct kvm_run from <symbol> to <symbol>__unsafe when +* compiled into the kernel, ensuring that any use within KVM is obvious and +* gets extra scrutiny. +*/ +#ifdef __KERNEL__ +#define HINT_UNSAFE_IN_KVM (_symbol) _symbol##__unsafe +#else +#define HINT_UNSAFE_IN_KVM (_symbol) _symbol +#endif +/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ struct kvm_run {/* in */ __u8 request_interrupt_window; -__u8 immediate_exit; +__u8 HINT_UNSAFE_IN_KVM(immediate_exit );__u8 padding1[6 ];/* out */
@@ -917,6 +930,9 @@ struct kvm_enable_cap {#define KVM_CAP_MEMORY_ATTRIBUTES 233#define KVM_CAP_GUEST_MEMFD 234#define KVM_CAP_VM_TYPES 235 +#define KVM_CAP_PRE_FAULT_MEMORY 236 +#define KVM_CAP_X86_APIC_BUS_CYCLES_NS 237 +#define KVM_CAP_X86_GUEST_MODE 238struct kvm_irq_routing_irqchip {__u32 irqchip;
@@ -1548,4 +1564,13 @@ struct kvm_create_guest_memfd { __u64 reserved[6]; }; +#define KVM_PRE_FAULT_MEMORY _IOWR(KVMIO, 0xd5, struct kvm_pre_fault_memory) + +struct kvm_pre_fault_memory { +__u64 gpa; +__u64 size; +__u64 flags; +__u64 padding[5 ]; +}; +#endif /* __LINUX_KVM_H */
powerpc/include/asm/kvm.h +3 -0
@@ -645,6 +645,9 @@ struct kvm_ppc_cpu_char {#define KVM_REG_PPC_SIER3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc3)#define KVM_REG_PPC_DAWR1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc4)#define KVM_REG_PPC_DAWRX1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc5) +#define KVM_REG_PPC_DEXCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc6) +#define KVM_REG_PPC_HASHKEYR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc7) +#define KVM_REG_PPC_HASHPKEYR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc8)/* Transactional Memory checkpointed state: * This is all GPRs, all VSX regs and a subset of SPRs
riscv/include/asm/kvm.h +7 -0
@@ -168,6 +168,13 @@ enum KVM_RISCV_ISA_EXT_ID {KVM_RISCV_ISA_EXT_ZTSO ,KVM_RISCV_ISA_EXT_ZACAS ,KVM_RISCV_ISA_EXT_SSCOFPMF , +KVM_RISCV_ISA_EXT_ZIMOP , +KVM_RISCV_ISA_EXT_ZCA , +KVM_RISCV_ISA_EXT_ZCB , +KVM_RISCV_ISA_EXT_ZCD , +KVM_RISCV_ISA_EXT_ZCF , +KVM_RISCV_ISA_EXT_ZCMOP , +KVM_RISCV_ISA_EXT_ZAWRS , KVM_RISCV_ISA_EXT_MAX, };
x86/include/asm/kvm.h +49 -0
72 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 2/2 riscv: Add Zc*/Zimop/Zcmop/Zawrs exts support
In reply to [email protected]From: Quan Zhou <[email protected]>
When the Zc*/Zimop/Zcmop/Zawrs extensions are available expose them to the guest via device tree so that guest can use it.
--- riscv/fdt.c | 7 +++++++ riscv/include/kvm/kvm-config-arch.h | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+)
riscv/fdt.c +7 -0
@@ -24,6 +24,7 @@ struct isa_ext_info isa_info_arr[] = { {"svnapot", KVM_RISCV_ISA_EXT_SVNAPOT}, {"svpbmt", KVM_RISCV_ISA_EXT_SVPBMT}, {"zacas", KVM_RISCV_ISA_EXT_ZACAS}, + {"zawrs", KVM_RISCV_ISA_EXT_ZAWRS}, {"zba", KVM_RISCV_ISA_EXT_ZBA}, {"zbb", KVM_RISCV_ISA_EXT_ZBB}, {"zbc", KVM_RISCV_ISA_EXT_ZBC},
@@ -31,6 +32,12 @@ struct isa_ext_info isa_info_arr[] = { {"zbkc", KVM_RISCV_ISA_EXT_ZBKC}, {"zbkx", KVM_RISCV_ISA_EXT_ZBKX}, {"zbs", KVM_RISCV_ISA_EXT_ZBS}, + {"zca", KVM_RISCV_ISA_EXT_ZCA}, + {"zcb", KVM_RISCV_ISA_EXT_ZCB}, + {"zcd", KVM_RISCV_ISA_EXT_ZCD}, + {"zcf", KVM_RISCV_ISA_EXT_ZCF}, + {"zcmop", KVM_RISCV_ISA_EXT_ZCMOP}, + {"zimop", KVM_RISCV_ISA_EXT_ZIMOP}, {"zfa", KVM_RISCV_ISA_EXT_ZFA}, {"zfh", KVM_RISCV_ISA_EXT_ZFH}, {"zfhmin", KVM_RISCV_ISA_EXT_ZFHMIN},
riscv/include/kvm/kvm-config-arch.h +21 -0
@@ -49,6 +49,9 @@ struct kvm_config_arch {OPT_BOOLEAN ('\0' ,"disable-zacas" , \ &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZACAS ], \"Disable Zacas Extension" ), \ +OPT_BOOLEAN ('\0' ,"disable-zawrs" , \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZAWRS ], \ +"Disable Zawrs Extension" ), \OPT_BOOLEAN ('\0' ,"disable-zba" , \ &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZBA ], \ "Disable Zba Extension"), \
@@ -70,6 +73,24 @@ struct kvm_config_arch {OPT_BOOLEAN ('\0' ,"disable-zbs" , \ &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZBS ], \"Disable Zbs Extension" ), \ +OPT_BOOLEAN ('\0' ,"disable-zca" , \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZCA ], \ +"Disable Zca Extension" ), \ +OPT_BOOLEAN ('\0' ,"disable-zcb" , \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZCB ], \ +"Disable Zcb Extension" ), \ +OPT_BOOLEAN ('\0' ,"disable-zcd" , \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZCD ], \ +"Disable Zcd Extension" ), \ +OPT_BOOLEAN ('\0' ,"disable-zcf" , \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZCF ], \ +"Disable Zcf Extension" ), \ +OPT_BOOLEAN ('\0' ,"disable-zcmop" , \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZCMOP ], \ +"Disable Zcmop Extension" ), \ +OPT_BOOLEAN ('\0' ,"disable-zimop" , \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZIMOP ], \ +"Disable Zimop Extension" ), \OPT_BOOLEAN ('\0' ,"disable-zfa" , \ &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZFA ], \ "Disable Zfa Extension"), \
Signature · 1 line
2.34.1
Quoted 17 lines · zhouquan at iscas.ac.cn
From: Quan Zhou <[email protected]>
Add support for a few Zc* extensions, Zimop, Zcmop and Zawrs.
Quan Zhou (2):
Sync-up headers with Linux-6.11 kernel
riscv: Add Zc*/Zimop/Zcmop/Zawrs exts supportinclude/linux/kvm.h | 27 +++++++++++++++- powerpc/include/asm/kvm.h | 3 ++ riscv/fdt.c | 7 +++++ riscv/include/asm/kvm.h | 7 +++++ riscv/include/kvm/kvm-config-arch.h | 21 +++++++++++++ x86/include/asm/kvm.h | 49 +++++++++++++++++++++++++++++ 6 files changed, 113 insertions(+), 1 deletion(-)
Quoted 4 lines
base-commit:
b48735e5d562eaffb96cf98a91da212176f1534cSignature · 1 line
2.34.1
These have already been posted by Anup [1].
[1] https://lore.kernel.org/all/20240831112743.379709-1-apatel at ventanamicro.com/
Thanks,
drew
Quoted 23 lines · Andrew Jones
Quoted 17 lines · zhouquan at iscas.ac.cn
From: Quan Zhou <[email protected]>
Add support for a few Zc* extensions, Zimop, Zcmop and Zawrs.
Quan Zhou (2):
Sync-up headers with Linux-6.11 kernel
riscv: Add Zc*/Zimop/Zcmop/Zawrs exts supportinclude/linux/kvm.h | 27 +++++++++++++++- powerpc/include/asm/kvm.h | 3 ++ riscv/fdt.c | 7 +++++ riscv/include/asm/kvm.h | 7 +++++ riscv/include/kvm/kvm-config-arch.h | 21 +++++++++++++ x86/include/asm/kvm.h | 49 +++++++++++++++++++++++++++++ 6 files changed, 113 insertions(+), 1 deletion(-)Quoted 4 lines
base-commit:
b48735e5d562eaffb96cf98a91da212176f1534cSignature · 1 line
2.34.1
Quoted 6 lines
These have already been posted by Anup [1].
[1] https://lore.kernel.org/all/20240831112743.379709-1-apatel at ventanamicro.com/
Thanks,
drew
Sorry, I missed that. Thanks for the reminder!
Thanks,
Quan