From patchwork Wed Feb 14 12:21:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13556387 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60F7F1BC4C for ; Wed, 14 Feb 2024 12:21:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707913316; cv=none; b=NvLd3toSlAT6ufJVZJnftJfkBwHK4J7DesQB9UW7DohsEddJHz+eZJeBTf0NwHwxWvUg8yUleQirhb9A1h/KeyG+phpJWnqlasZc8vQU72KOeF/KQDATJtmeXLBmHGEDISM/LJDOhGG5xRaMhFRv8wOHNu1ToMlGpqQjAjQt2NM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707913316; c=relaxed/simple; bh=eSCPp5BZR2FchMsq+62Fxq/ckhn8vfDXgrh80QckDOE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=k8bznD9xPgqa5f4tyLQSH1SNVom7+DQD3gxmyQp+D6u04EBtbGfNB1dHvR73ozbhLRDofmwgnJM2QRJEWPcMkwxGciOxk3WEEKofPxaH1CuMc2eYIgQpxAH67n/gL6nAw9kkf+EwALodNy33M48vfosmhdq0chyOjoFQXXjpntY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=ZdlCN6fI; arc=none smtp.client-ip=209.85.210.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="ZdlCN6fI" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-6e0a4c6c2adso2075455b3a.1 for ; Wed, 14 Feb 2024 04:21:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1707913313; x=1708518113; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0ngxwXlnRnmE5mmXUezOnr5izpLf9SqETmoi0NyF/Uo=; b=ZdlCN6fIItgX/ySbwg8D8cYxrgj54ZqVlJ+EsDGkG1WbqE+AVWSDzfQk+EN8joMfZE 3HtFCFXCHYdGPa2vR9SYJCSOMf+L0kIDoVZpyHueqR9cIbbIIoO3XFnZ/bX4biTP6iY7 M5gmTtBK1yVzMC0qFoXCGPInlAX13/7QuNd6OtdLr7Ows497CVaAhEl1tdn7wbdgmNjc G1tej7FW0N/4K4Filh2SIvI31sJr343yMMsiZpAR2RpXKDYTBKBNLus9v/e0tIF0hLRa /CbBPC1SpgxhSfN1dzhq6/HDIpdrrTzhM0w62JM/FSWUhVd4Fn6l312n1UnhqMMrNJTk WPUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707913313; x=1708518113; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0ngxwXlnRnmE5mmXUezOnr5izpLf9SqETmoi0NyF/Uo=; b=GNnYhOatdslG9R0rxKgjwLHp7Nm9SxSzrf04Fja5ET1Myj4JD2AlzWwcO9lzXKiszR WO6aiGt3AOLF+XiKKuZJv/ePdNZpeQZ9MSaRykSYOLts5xgDqrSInPZYSqLDlvhhDUZy 9H1DtKTgvVuIX4Uqiq0DVrvc5DXmu/U55lQqZzloiOQeyg8KnK6wArzXGTGmXes/KiLv fM3qWPI0qFsRXxrJh9XS3QH5e7oI86+tQLJZeP/jnYMAYOfX8VKFetfPEn4JS+DBKHfg QOcaQmJdv7tvi27TJjq5N11BTMblwOmUdKak+/bpT+Wmhz2xIdpm5b23jxTJ7fPRmTs2 zoMw== X-Forwarded-Encrypted: i=1; AJvYcCVXxKCmagv7A7Tl4IPZnEOFbM8r/GJGrj8ifmcTj+15ZpejtyuiTxtn/wS9h8abyJm3nqBHvZtCzf9oi1ShfGHgJO0t X-Gm-Message-State: AOJu0Yw6vIivwE9p8/HqeK3vj9/rIZfQUKY4XsIG2C1MqmqTSeZ8T6xO 5L6WugY/KtQk9Jak76UgqXHLjFeSvfa0/wZ9nwwO7RBLQEjNGcKZ33eKBjHUY5w= X-Google-Smtp-Source: AGHT+IFntPXJG+DP7/SKZ0zP4F4+odgq6jaMijmravexY58pKlv0JJplCuC9gCFDxOc1KsR4mgM66g== X-Received: by 2002:a05:6a00:1404:b0:6df:f7f3:6197 with SMTP id l4-20020a056a00140400b006dff7f36197mr2541379pfu.34.1707913313379; Wed, 14 Feb 2024 04:21:53 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWytp6abX29d43AwyIxDb3T4tKOFhNM11aM0SABRX/qDm/ceg6xIH3NberSB8SzFn9EKMpMg3sEQTE5PetwT2EP2VSwSrE7qC2EmRxTEtb2VkR4EZe/NPl/U4r7PEYB9pYiGjw0gsNkFdjkHMtUmqTZffh0tU4Bh2+/xeHa3MSRtDHxKAx2GPGDuCHtSvELwfYLIdbGrn5wJts2cvPdDPSsSPS+JfX8GnYujX7jDoZsFjhJySte/Bo9Qi/lUXeHirZ5xA7B8uxh2oeQJUtgvyDgjyX/Adh9LOP2Nn2OdXAAuNA319DmP7ci2gMvVFbQYg== Received: from anup-ubuntu-vm.localdomain ([171.76.87.178]) by smtp.gmail.com with ESMTPSA id hq26-20020a056a00681a00b006dbdac1595esm9496060pfb.141.2024.02.14.04.21.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 04:21:52 -0800 (PST) From: Anup Patel To: Will Deacon , julien.thierry.kdev@gmail.com, maz@kernel.org Cc: Paolo Bonzini , Atish Patra , Andrew Jones , Anup Patel , kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, Anup Patel Subject: [kvmtool PATCH 01/10] Sync-up header with Linux-6.8-rc4 for KVM RISC-V Date: Wed, 14 Feb 2024 17:51:32 +0530 Message-Id: <20240214122141.305126-2-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240214122141.305126-1-apatel@ventanamicro.com> References: <20240214122141.305126-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We sync-up Linux headers to get latest KVM RISC-V headers having Zbc, Scalar crypto, Vector crypto, Zfh[min], Zihintntl, Zvfh[min], Zfa, and SBI steal-time support. Signed-off-by: Anup Patel --- include/linux/kvm.h | 140 ++++++++++++---------------------- include/linux/virtio_config.h | 8 +- include/linux/virtio_pci.h | 68 +++++++++++++++++ riscv/include/asm/kvm.h | 40 ++++++++++ x86/include/asm/kvm.h | 3 + 5 files changed, 168 insertions(+), 91 deletions(-) diff --git a/include/linux/kvm.h b/include/linux/kvm.h index 211b86d..c330853 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h @@ -16,76 +16,6 @@ #define KVM_API_VERSION 12 -/* *** Deprecated interfaces *** */ - -#define KVM_TRC_SHIFT 16 - -#define KVM_TRC_ENTRYEXIT (1 << KVM_TRC_SHIFT) -#define KVM_TRC_HANDLER (1 << (KVM_TRC_SHIFT + 1)) - -#define KVM_TRC_VMENTRY (KVM_TRC_ENTRYEXIT + 0x01) -#define KVM_TRC_VMEXIT (KVM_TRC_ENTRYEXIT + 0x02) -#define KVM_TRC_PAGE_FAULT (KVM_TRC_HANDLER + 0x01) - -#define KVM_TRC_HEAD_SIZE 12 -#define KVM_TRC_CYCLE_SIZE 8 -#define KVM_TRC_EXTRA_MAX 7 - -#define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02) -#define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03) -#define KVM_TRC_PEND_INTR (KVM_TRC_HANDLER + 0x04) -#define KVM_TRC_IO_READ (KVM_TRC_HANDLER + 0x05) -#define KVM_TRC_IO_WRITE (KVM_TRC_HANDLER + 0x06) -#define KVM_TRC_CR_READ (KVM_TRC_HANDLER + 0x07) -#define KVM_TRC_CR_WRITE (KVM_TRC_HANDLER + 0x08) -#define KVM_TRC_DR_READ (KVM_TRC_HANDLER + 0x09) -#define KVM_TRC_DR_WRITE (KVM_TRC_HANDLER + 0x0A) -#define KVM_TRC_MSR_READ (KVM_TRC_HANDLER + 0x0B) -#define KVM_TRC_MSR_WRITE (KVM_TRC_HANDLER + 0x0C) -#define KVM_TRC_CPUID (KVM_TRC_HANDLER + 0x0D) -#define KVM_TRC_INTR (KVM_TRC_HANDLER + 0x0E) -#define KVM_TRC_NMI (KVM_TRC_HANDLER + 0x0F) -#define KVM_TRC_VMMCALL (KVM_TRC_HANDLER + 0x10) -#define KVM_TRC_HLT (KVM_TRC_HANDLER + 0x11) -#define KVM_TRC_CLTS (KVM_TRC_HANDLER + 0x12) -#define KVM_TRC_LMSW (KVM_TRC_HANDLER + 0x13) -#define KVM_TRC_APIC_ACCESS (KVM_TRC_HANDLER + 0x14) -#define KVM_TRC_TDP_FAULT (KVM_TRC_HANDLER + 0x15) -#define KVM_TRC_GTLB_WRITE (KVM_TRC_HANDLER + 0x16) -#define KVM_TRC_STLB_WRITE (KVM_TRC_HANDLER + 0x17) -#define KVM_TRC_STLB_INVAL (KVM_TRC_HANDLER + 0x18) -#define KVM_TRC_PPC_INSTR (KVM_TRC_HANDLER + 0x19) - -struct kvm_user_trace_setup { - __u32 buf_size; - __u32 buf_nr; -}; - -#define __KVM_DEPRECATED_MAIN_W_0x06 \ - _IOW(KVMIO, 0x06, struct kvm_user_trace_setup) -#define __KVM_DEPRECATED_MAIN_0x07 _IO(KVMIO, 0x07) -#define __KVM_DEPRECATED_MAIN_0x08 _IO(KVMIO, 0x08) - -#define __KVM_DEPRECATED_VM_R_0x70 _IOR(KVMIO, 0x70, struct kvm_assigned_irq) - -struct kvm_breakpoint { - __u32 enabled; - __u32 padding; - __u64 address; -}; - -struct kvm_debug_guest { - __u32 enabled; - __u32 pad; - struct kvm_breakpoint breakpoints[4]; - __u32 singlestep; -}; - -#define __KVM_DEPRECATED_VCPU_W_0x87 _IOW(KVMIO, 0x87, struct kvm_debug_guest) - -/* *** End of deprecated interfaces *** */ - - /* for KVM_SET_USER_MEMORY_REGION */ struct kvm_userspace_memory_region { __u32 slot; @@ -95,6 +25,19 @@ struct kvm_userspace_memory_region { __u64 userspace_addr; /* start of the userspace allocated memory */ }; +/* for KVM_SET_USER_MEMORY_REGION2 */ +struct kvm_userspace_memory_region2 { + __u32 slot; + __u32 flags; + __u64 guest_phys_addr; + __u64 memory_size; + __u64 userspace_addr; + __u64 guest_memfd_offset; + __u32 guest_memfd; + __u32 pad1; + __u64 pad2[14]; +}; + /* * The bit 0 ~ bit 15 of kvm_userspace_memory_region::flags are visible for * userspace, other bits are reserved for kvm internal use which are defined @@ -102,6 +45,7 @@ struct kvm_userspace_memory_region { */ #define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0) #define KVM_MEM_READONLY (1UL << 1) +#define KVM_MEM_GUEST_MEMFD (1UL << 2) /* for KVM_IRQ_LINE */ struct kvm_irq_level { @@ -265,6 +209,7 @@ struct kvm_xen_exit { #define KVM_EXIT_RISCV_CSR 36 #define KVM_EXIT_NOTIFY 37 #define KVM_EXIT_LOONGARCH_IOCSR 38 +#define KVM_EXIT_MEMORY_FAULT 39 /* For KVM_EXIT_INTERNAL_ERROR */ /* Emulate instruction failed. */ @@ -518,6 +463,13 @@ struct kvm_run { #define KVM_NOTIFY_CONTEXT_INVALID (1 << 0) __u32 flags; } notify; + /* KVM_EXIT_MEMORY_FAULT */ + struct { +#define KVM_MEMORY_EXIT_FLAG_PRIVATE (1ULL << 3) + __u64 flags; + __u64 gpa; + __u64 size; + } memory_fault; /* Fix the size of the union. */ char padding[256]; }; @@ -945,9 +897,6 @@ struct kvm_ppc_resize_hpt { */ #define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04) /* in bytes */ #define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x05, struct kvm_cpuid2) -#define KVM_TRACE_ENABLE __KVM_DEPRECATED_MAIN_W_0x06 -#define KVM_TRACE_PAUSE __KVM_DEPRECATED_MAIN_0x07 -#define KVM_TRACE_DISABLE __KVM_DEPRECATED_MAIN_0x08 #define KVM_GET_EMULATED_CPUID _IOWR(KVMIO, 0x09, struct kvm_cpuid2) #define KVM_GET_MSR_FEATURE_INDEX_LIST _IOWR(KVMIO, 0x0a, struct kvm_msr_list) @@ -1201,6 +1150,11 @@ struct kvm_ppc_resize_hpt { #define KVM_CAP_ARM_EAGER_SPLIT_CHUNK_SIZE 228 #define KVM_CAP_ARM_SUPPORTED_BLOCK_SIZES 229 #define KVM_CAP_ARM_SUPPORTED_REG_MASK_RANGES 230 +#define KVM_CAP_USER_MEMORY2 231 +#define KVM_CAP_MEMORY_FAULT_INFO 232 +#define KVM_CAP_MEMORY_ATTRIBUTES 233 +#define KVM_CAP_GUEST_MEMFD 234 +#define KVM_CAP_VM_TYPES 235 #ifdef KVM_CAP_IRQ_ROUTING @@ -1291,6 +1245,7 @@ struct kvm_x86_mce { #define KVM_XEN_HVM_CONFIG_EVTCHN_2LEVEL (1 << 4) #define KVM_XEN_HVM_CONFIG_EVTCHN_SEND (1 << 5) #define KVM_XEN_HVM_CONFIG_RUNSTATE_UPDATE_FLAG (1 << 6) +#define KVM_XEN_HVM_CONFIG_PVCLOCK_TSC_UNSTABLE (1 << 7) struct kvm_xen_hvm_config { __u32 flags; @@ -1483,6 +1438,8 @@ struct kvm_vfio_spapr_tce { struct kvm_userspace_memory_region) #define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47) #define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64) +#define KVM_SET_USER_MEMORY_REGION2 _IOW(KVMIO, 0x49, \ + struct kvm_userspace_memory_region2) /* enable ucontrol for s390 */ struct kvm_s390_ucas_mapping { @@ -1507,20 +1464,8 @@ struct kvm_s390_ucas_mapping { _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone) #define KVM_UNREGISTER_COALESCED_MMIO \ _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone) -#define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, \ - struct kvm_assigned_pci_dev) #define KVM_SET_GSI_ROUTING _IOW(KVMIO, 0x6a, struct kvm_irq_routing) -/* deprecated, replaced by KVM_ASSIGN_DEV_IRQ */ -#define KVM_ASSIGN_IRQ __KVM_DEPRECATED_VM_R_0x70 -#define KVM_ASSIGN_DEV_IRQ _IOW(KVMIO, 0x70, struct kvm_assigned_irq) #define KVM_REINJECT_CONTROL _IO(KVMIO, 0x71) -#define KVM_DEASSIGN_PCI_DEVICE _IOW(KVMIO, 0x72, \ - struct kvm_assigned_pci_dev) -#define KVM_ASSIGN_SET_MSIX_NR _IOW(KVMIO, 0x73, \ - struct kvm_assigned_msix_nr) -#define KVM_ASSIGN_SET_MSIX_ENTRY _IOW(KVMIO, 0x74, \ - struct kvm_assigned_msix_entry) -#define KVM_DEASSIGN_DEV_IRQ _IOW(KVMIO, 0x75, struct kvm_assigned_irq) #define KVM_IRQFD _IOW(KVMIO, 0x76, struct kvm_irqfd) #define KVM_CREATE_PIT2 _IOW(KVMIO, 0x77, struct kvm_pit_config) #define KVM_SET_BOOT_CPU_ID _IO(KVMIO, 0x78) @@ -1537,9 +1482,6 @@ struct kvm_s390_ucas_mapping { * KVM_CAP_VM_TSC_CONTROL to set defaults for a VM */ #define KVM_SET_TSC_KHZ _IO(KVMIO, 0xa2) #define KVM_GET_TSC_KHZ _IO(KVMIO, 0xa3) -/* Available with KVM_CAP_PCI_2_3 */ -#define KVM_ASSIGN_SET_INTX_MASK _IOW(KVMIO, 0xa4, \ - struct kvm_assigned_pci_dev) /* Available with KVM_CAP_SIGNAL_MSI */ #define KVM_SIGNAL_MSI _IOW(KVMIO, 0xa5, struct kvm_msi) /* Available with KVM_CAP_PPC_GET_SMMU_INFO */ @@ -1592,8 +1534,6 @@ struct kvm_s390_ucas_mapping { #define KVM_SET_SREGS _IOW(KVMIO, 0x84, struct kvm_sregs) #define KVM_TRANSLATE _IOWR(KVMIO, 0x85, struct kvm_translation) #define KVM_INTERRUPT _IOW(KVMIO, 0x86, struct kvm_interrupt) -/* KVM_DEBUG_GUEST is no longer supported, use KVM_SET_GUEST_DEBUG instead */ -#define KVM_DEBUG_GUEST __KVM_DEPRECATED_VCPU_W_0x87 #define KVM_GET_MSRS _IOWR(KVMIO, 0x88, struct kvm_msrs) #define KVM_SET_MSRS _IOW(KVMIO, 0x89, struct kvm_msrs) #define KVM_SET_CPUID _IOW(KVMIO, 0x8a, struct kvm_cpuid) @@ -2267,4 +2207,24 @@ struct kvm_s390_zpci_op { /* flags for kvm_s390_zpci_op->u.reg_aen.flags */ #define KVM_S390_ZPCIOP_REGAEN_HOST (1 << 0) +/* Available with KVM_CAP_MEMORY_ATTRIBUTES */ +#define KVM_SET_MEMORY_ATTRIBUTES _IOW(KVMIO, 0xd2, struct kvm_memory_attributes) + +struct kvm_memory_attributes { + __u64 address; + __u64 size; + __u64 attributes; + __u64 flags; +}; + +#define KVM_MEMORY_ATTRIBUTE_PRIVATE (1ULL << 3) + +#define KVM_CREATE_GUEST_MEMFD _IOWR(KVMIO, 0xd4, struct kvm_create_guest_memfd) + +struct kvm_create_guest_memfd { + __u64 size; + __u64 flags; + __u64 reserved[6]; +}; + #endif /* __LINUX_KVM_H */ diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h index 8881aea..2445f36 100644 --- a/include/linux/virtio_config.h +++ b/include/linux/virtio_config.h @@ -52,7 +52,7 @@ * rest are per-device feature bits. */ #define VIRTIO_TRANSPORT_F_START 28 -#define VIRTIO_TRANSPORT_F_END 41 +#define VIRTIO_TRANSPORT_F_END 42 #ifndef VIRTIO_CONFIG_NO_LEGACY /* Do we get callbacks when the ring is completely used, even if we've @@ -114,4 +114,10 @@ * This feature indicates that the driver can reset a queue individually. */ #define VIRTIO_F_RING_RESET 40 + +/* + * This feature indicates that the device support administration virtqueues. + */ +#define VIRTIO_F_ADMIN_VQ 41 + #endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */ diff --git a/include/linux/virtio_pci.h b/include/linux/virtio_pci.h index 44f4dd2..ef3810d 100644 --- a/include/linux/virtio_pci.h +++ b/include/linux/virtio_pci.h @@ -175,6 +175,9 @@ struct virtio_pci_modern_common_cfg { __le16 queue_notify_data; /* read-write */ __le16 queue_reset; /* read-write */ + + __le16 admin_queue_index; /* read-only */ + __le16 admin_queue_num; /* read-only */ }; /* Fields in VIRTIO_PCI_CAP_PCI_CFG: */ @@ -215,7 +218,72 @@ struct virtio_pci_cfg_cap { #define VIRTIO_PCI_COMMON_Q_USEDHI 52 #define VIRTIO_PCI_COMMON_Q_NDATA 56 #define VIRTIO_PCI_COMMON_Q_RESET 58 +#define VIRTIO_PCI_COMMON_ADM_Q_IDX 60 +#define VIRTIO_PCI_COMMON_ADM_Q_NUM 62 #endif /* VIRTIO_PCI_NO_MODERN */ +/* Admin command status. */ +#define VIRTIO_ADMIN_STATUS_OK 0 + +/* Admin command opcode. */ +#define VIRTIO_ADMIN_CMD_LIST_QUERY 0x0 +#define VIRTIO_ADMIN_CMD_LIST_USE 0x1 + +/* Admin command group type. */ +#define VIRTIO_ADMIN_GROUP_TYPE_SRIOV 0x1 + +/* Transitional device admin command. */ +#define VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE 0x2 +#define VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_READ 0x3 +#define VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_WRITE 0x4 +#define VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_READ 0x5 +#define VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO 0x6 + +struct __packed virtio_admin_cmd_hdr { + __le16 opcode; + /* + * 1 - SR-IOV + * 2-65535 - reserved + */ + __le16 group_type; + /* Unused, reserved for future extensions. */ + __u8 reserved1[12]; + __le64 group_member_id; +}; + +struct __packed 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 { + __u8 offset; /* Starting offset of the register(s) to write. */ + __u8 reserved[7]; + __u8 registers[]; +}; + +struct __packed virtio_admin_cmd_legacy_rd_data { + __u8 offset; /* Starting offset of the register(s) to read. */ +}; + +#define VIRTIO_ADMIN_CMD_NOTIFY_INFO_FLAGS_END 0 +#define VIRTIO_ADMIN_CMD_NOTIFY_INFO_FLAGS_OWNER_DEV 0x1 +#define VIRTIO_ADMIN_CMD_NOTIFY_INFO_FLAGS_OWNER_MEM 0x2 + +#define VIRTIO_ADMIN_CMD_MAX_NOTIFY_INFO 4 + +struct __packed 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]; + __le64 offset; /* Offset within bar. */ +}; + +struct virtio_admin_cmd_notify_info_result { + struct virtio_admin_cmd_notify_info_data entries[VIRTIO_ADMIN_CMD_MAX_NOTIFY_INFO]; +}; + #endif diff --git a/riscv/include/asm/kvm.h b/riscv/include/asm/kvm.h index 60d3b21..7499e88 100644 --- a/riscv/include/asm/kvm.h +++ b/riscv/include/asm/kvm.h @@ -139,6 +139,33 @@ enum KVM_RISCV_ISA_EXT_ID { KVM_RISCV_ISA_EXT_ZIHPM, KVM_RISCV_ISA_EXT_SMSTATEEN, KVM_RISCV_ISA_EXT_ZICOND, + KVM_RISCV_ISA_EXT_ZBC, + KVM_RISCV_ISA_EXT_ZBKB, + KVM_RISCV_ISA_EXT_ZBKC, + KVM_RISCV_ISA_EXT_ZBKX, + KVM_RISCV_ISA_EXT_ZKND, + KVM_RISCV_ISA_EXT_ZKNE, + KVM_RISCV_ISA_EXT_ZKNH, + KVM_RISCV_ISA_EXT_ZKR, + KVM_RISCV_ISA_EXT_ZKSED, + KVM_RISCV_ISA_EXT_ZKSH, + KVM_RISCV_ISA_EXT_ZKT, + KVM_RISCV_ISA_EXT_ZVBB, + KVM_RISCV_ISA_EXT_ZVBC, + KVM_RISCV_ISA_EXT_ZVKB, + KVM_RISCV_ISA_EXT_ZVKG, + KVM_RISCV_ISA_EXT_ZVKNED, + KVM_RISCV_ISA_EXT_ZVKNHA, + KVM_RISCV_ISA_EXT_ZVKNHB, + KVM_RISCV_ISA_EXT_ZVKSED, + KVM_RISCV_ISA_EXT_ZVKSH, + KVM_RISCV_ISA_EXT_ZVKT, + KVM_RISCV_ISA_EXT_ZFH, + KVM_RISCV_ISA_EXT_ZFHMIN, + KVM_RISCV_ISA_EXT_ZIHINTNTL, + KVM_RISCV_ISA_EXT_ZVFH, + KVM_RISCV_ISA_EXT_ZVFHMIN, + KVM_RISCV_ISA_EXT_ZFA, KVM_RISCV_ISA_EXT_MAX, }; @@ -157,9 +184,16 @@ enum KVM_RISCV_SBI_EXT_ID { KVM_RISCV_SBI_EXT_EXPERIMENTAL, KVM_RISCV_SBI_EXT_VENDOR, KVM_RISCV_SBI_EXT_DBCN, + KVM_RISCV_SBI_EXT_STA, KVM_RISCV_SBI_EXT_MAX, }; +/* SBI STA extension registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */ +struct kvm_riscv_sbi_sta { + unsigned long shmem_lo; + unsigned long shmem_hi; +}; + /* Possible states for kvm_riscv_timer */ #define KVM_RISCV_TIMER_STATE_OFF 0 #define KVM_RISCV_TIMER_STATE_ON 1 @@ -241,6 +275,12 @@ enum KVM_RISCV_SBI_EXT_ID { #define KVM_REG_RISCV_VECTOR_REG(n) \ ((n) + sizeof(struct __riscv_v_ext_state) / sizeof(unsigned long)) +/* Registers for specific SBI extensions are mapped as type 10 */ +#define KVM_REG_RISCV_SBI_STATE (0x0a << KVM_REG_RISCV_TYPE_SHIFT) +#define KVM_REG_RISCV_SBI_STA (0x0 << KVM_REG_RISCV_SUBTYPE_SHIFT) +#define KVM_REG_RISCV_SBI_STA_REG(name) \ + (offsetof(struct kvm_riscv_sbi_sta, name) / sizeof(unsigned long)) + /* Device Control API: RISC-V AIA */ #define KVM_DEV_RISCV_APLIC_ALIGN 0x1000 #define KVM_DEV_RISCV_APLIC_SIZE 0x4000 diff --git a/x86/include/asm/kvm.h b/x86/include/asm/kvm.h index 1a6a1f9..a448d09 100644 --- a/x86/include/asm/kvm.h +++ b/x86/include/asm/kvm.h @@ -562,4 +562,7 @@ struct kvm_pmu_event_filter { /* x86-specific KVM_EXIT_HYPERCALL flags. */ #define KVM_EXIT_HYPERCALL_LONG_MODE BIT(0) +#define KVM_X86_DEFAULT_VM 0 +#define KVM_X86_SW_PROTECTED_VM 1 + #endif /* _ASM_X86_KVM_H */ From patchwork Wed Feb 14 12:21:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13556388 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF2791B962 for ; Wed, 14 Feb 2024 12:21:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707913320; cv=none; b=NTFwJnSN3IBnMfyfww7b8PIAGHcXgzJR+oezOZDKsgTfHBQKUzAPkPS9v5HUWTzVlibsvJUwMSZjWDB18XclzCxDF1FK9gqeaxut4lm1+/+35o1wqqlXsH93o6ZPo1SXvFESWOSf8EiwoiTx/L8NEYYyadKzF7wZC4EcndZ5YYE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707913320; c=relaxed/simple; bh=gx2vTofXebLP6JVlkEb2oQb0fWvIH2qsTnYAPuwH21U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=F3LOFAsFtS3xBPfEccQMtXcg6bRRtH7rWyvzb+wVq2CtyfeK/C+plV3pnTSOqbgPucVipcogrwNV3/tsj9g4PswgpikLH2hQuhGOAaM5tYuYh4EbPprFTbn7xDVKGL3vNthK/109sRIo7yr7pPaSe8HpnRDMUZVO+tPND7nTZeQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=fdGZ5Zsx; arc=none smtp.client-ip=209.85.210.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="fdGZ5Zsx" Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-6e0a4c6c2adso2075473b3a.1 for ; Wed, 14 Feb 2024 04:21:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1707913317; x=1708518117; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HozRKN9wrxi5PL0DaVXWcH0x0hBsJpBpA/05xqOENN4=; b=fdGZ5ZsxBXyJoAAObOgI50zqgqLcYDEeilm9G0M48ymSRbxiaNteGu2M3y+Kifefjw +ZJfRfKU/0ulL0NnFJUstghMySfbI6pEhrzYYkHHxVs7LXKTVU8xpsjRKsvdkRCsNwHK 8AUzgVnk5wv1w/nUWlusrdROlYQgtwMaq6tajLB6tRrD3SOamjiRZx32jyWFxR2P8epO 4UQxAlKorSLM8bAIvdxtj6zhAZMK4YRsGtdq0GuxkAmTNir7hJORZi8QkKlcwamI9Hmu Qp1FpyPXnfTXS+kNXCrD2K62Lb+TeA/3jbdrdM39eR0u72YtSAjwg1fvtT7RAPEJmWYY IuEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707913317; x=1708518117; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HozRKN9wrxi5PL0DaVXWcH0x0hBsJpBpA/05xqOENN4=; b=e7CPm2lKX2xRS234TetNkm8KjR82G9LkfGiNUGH4V36MZp8CkKlKL1TA2NfOZadD5N r314Lh9rt/fLnWqvGZQiZfCXoy1Ma6lQp49AtlE6vqGd4h3g0E6KAnI5Ko/S9wRLC1e2 +L2rSN/6xOt6MLS5ft7Qn3gEUUoXKGQYBTqa+s4/X+I+CPEHnx0jQ9mYVNaMUM5mMXyI 2huy0axFPb8KwtHHXvZQBB0y234XR4io6WeWuP0R+uOQAmreAetYziz1d0UqPCVumzmQ Q6MQ8BaM7v1gj/t0N8fmNId7+Mbm1S1XmS0ScA6Y1Vas2p34l/Ss9Cgrj0gw4Jyh9djm DEGg== X-Forwarded-Encrypted: i=1; AJvYcCXfJq0OxHkUJxrgNx3YBomAUoqjkPo+vX14yzYheT1w5tMZBP0bqypDSFwGRbQo+8tUl9+joyOrqQyZspOVsO1jT2eB X-Gm-Message-State: AOJu0YwX6CEGKj9p3z+sWrz4+3mArLdLQi9ARPlPMpouocrqeGWPmyeu 7gr/MD6hC/vbtsGoImN/hAQ5Z0Gr9bdT7P2+pZcrooJEqNnn5Q1OqqDLMH/6NF8= X-Google-Smtp-Source: AGHT+IEo4JmWJk3ub2RFwdayKe84WA+0F8fNJd+GmlJi4TdUok/qdLLvqvHeBpKGcRkn55UtAoI53A== X-Received: by 2002:a05:6a00:1404:b0:6df:f7f3:6197 with SMTP id l4-20020a056a00140400b006dff7f36197mr2541585pfu.34.1707913317244; Wed, 14 Feb 2024 04:21:57 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCW34+3mvXzC4qP2w5IptkW5t4OtBPxU/G7pTY1dSz+kSE4UlrtO3QKrilk0ho6dh8ikCdl0TVNayWANOJA+rtfdIUkQy0oNb4nN9ZYSF2lXnaGVv/OjkugqbKgWldV4P9JIEZ5GSf6UumzKFXR7lknkDN/oHQV1TvFuc6HTjateSwkDe26D0v0bnosHIeq9t1nagQ5L3N4gH+SMojElCEXdWqLrXjjvOWsYatcccn4q2Bud1H7IBT9FRqD7AZb6vuxEVlFjC+NI45wSRw9w8OIoMFvxbUyW+701ZLIw0Up0bcFnVo7bpSi4qZ8StJlf1Q== Received: from anup-ubuntu-vm.localdomain ([171.76.87.178]) by smtp.gmail.com with ESMTPSA id hq26-20020a056a00681a00b006dbdac1595esm9496060pfb.141.2024.02.14.04.21.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 04:21:56 -0800 (PST) From: Anup Patel To: Will Deacon , julien.thierry.kdev@gmail.com, maz@kernel.org Cc: Paolo Bonzini , Atish Patra , Andrew Jones , Anup Patel , kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, Anup Patel Subject: [kvmtool PATCH 02/10] kvmtool: Fix absence of __packed definition Date: Wed, 14 Feb 2024 17:51:33 +0530 Message-Id: <20240214122141.305126-3-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240214122141.305126-1-apatel@ventanamicro.com> References: <20240214122141.305126-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The absence of __packed definition in kvm/compiler.h cause build failer after syncing kernel headers with Linux-6.8 because the kernel header uapi/linux/virtio_pci.h uses __packed for structures. Signed-off-by: Anup Patel --- include/kvm/compiler.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/kvm/compiler.h b/include/kvm/compiler.h index 2013a83..dd8a22a 100644 --- a/include/kvm/compiler.h +++ b/include/kvm/compiler.h @@ -1,6 +1,8 @@ #ifndef KVM_COMPILER_H_ #define KVM_COMPILER_H_ +#include + #ifndef __compiletime_error # define __compiletime_error(message) #endif From patchwork Wed Feb 14 12:21:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13556389 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 91CB01BDD5 for ; Wed, 14 Feb 2024 12:22:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707913323; cv=none; b=rwAQWd3JHjv8hDWjOL/ZxeXQC3Hy9PueyoHm+0vAFYh2rtuiRrxFFPvf5D97PkDJFhdqwr7ZbbgipQC6NmfZPNUvOLY86BjxcQpIRIcUzFF8UgNBpfocONhox6Poyl6AdNgB4LOHgGnl38DWZqBwFZAlZT6wOLhpdjQRTbNeFco= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707913323; c=relaxed/simple; bh=S4oA+1bymS3gdRGx34gZrT0AIwBm0mwDi4op0z+exN8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=e3RNQ2b7sfj6HBToO1OhuAbNTbBhujUgzl/zBTn51nmDBoZ3o1fw7jGN5BdzYs1pMm4fccss/ZhrJ0Fq8nBYouRCrEAJIvVbERidrImFqkvB7URrG2738VAuzyLiWfw6x8eFJ1huIhc5AV0y1Y9CmH+468NiZ1kz4G7tkaifmu8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=VFInAbee; arc=none smtp.client-ip=209.85.210.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="VFInAbee" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-6e0a4c6c2adso2075495b3a.1 for ; Wed, 14 Feb 2024 04:22:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1707913321; x=1708518121; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AZyXdwC+1687r0DWdyyihI8jDTPcrLnDk2dDeYIy6R4=; b=VFInAbeec0ivUFSj53MxWJSmU5hXM1GM1Gwp3ooIAULlMVWIc4O7Pc5hk6py4FkgNu uw5vZi/7YrBCXhNbMNBvhoa4DUDjUeNRcAUKML+xWLzWPWUAsUEPMuvAMqO8sPRR958x mEHQYf2+cxf0h8s8ODcR9ijjeckQyfanjuthWDh+JhiRe078R+F39KY9HKMzzcxazL/x eYOYOeVil3HWh3Y6Ie+7OC+kXSXaGIEvlD7LbW2C6DduDdSc33oFYVG5/k4INkJq8PKw 96sM8cgF70A6qa7NW0RJUbVWYyGiJLblUALoUHIhei2hSvX59glsmmMotX+9daCf+iKg 8Sjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707913321; x=1708518121; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AZyXdwC+1687r0DWdyyihI8jDTPcrLnDk2dDeYIy6R4=; b=HQM9nyvvmDvmvtOPPi83FeO+fhLUbqmM/zduWN2LZFmliBEOZD4ZS3Zdb08Cn/0CRz 4r6ugvDtmNVz63VFcQnuLeYCip1izrKPVdIv+dtz/fVAf71XpPgl3O29B8fnbbYCI8lL Y5FJDxj3zyWIMGPGSpG4S6qYFeA+2bgbeoFSq6qP9obMe6caCCezMddSmTGQGCOa6fCE uBL+iBghAuBtuRAIK+enKVmxtZOvPzRzkEvlanLKgPFyJMJOutDYT4R9cD8sl6hGjlvp PSwZuBwqAucWU14awjLVURbN4dBggJP1IL7Xe8qUZnuz9s3QqDupMrDxBoILBn25YZtl oQ7Q== X-Forwarded-Encrypted: i=1; AJvYcCUUSO+e8LXT1MLo7xcvHFyapDybcjVHK51eTXw3Ghnrd3ryRW3BBwmyBO300H2ZBPUqn4Y+isCVK9yfoG8tBKiDZ8/o X-Gm-Message-State: AOJu0Yx5cVnf0fKSOF18AwV5HVo6WI5BClrxVWQbWGwtiZPoA4x4D9JC keNPUmhu57hO2fAtPdFVo9UvJ6upsimVrOS6rC4wmi3IqS6kWGViHpv2O09AHjPbvGA+5t0IDcO J X-Google-Smtp-Source: AGHT+IFwrXYvob739M8Fd2iW5zrG5JU1zA3mZGQ/M8qWCKM/S4tE5Lgo0PHVYouee4PG3t7Ks3v2eQ== X-Received: by 2002:a05:6a00:1797:b0:6e0:6b0d:455 with SMTP id s23-20020a056a00179700b006e06b0d0455mr2383028pfg.13.1707913320847; Wed, 14 Feb 2024 04:22:00 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXt/p1y8f9YaagutOaBSmse37NARIUi3dBUY65j8yFYtexjTv1O28+xR6+hWYS+h6WfXt0q+CfFbG48SnpZTRnY5z6ye3d4dpWA6Sx0SBEGi0EUO2ut4OUgeM2cMU4YPArU6BUo2yBh6y0uEe+czq90BdJqKq3vko/c9dhhM3pW8r23GhYYUXfc5WP+gp78oQ88GJERN9pMnHJ209n8BNodhkIYfBGdGqp0SmtL+3SyAgQpgWsqlA/DIDLgFEQSHqgK2wHxCSd2cZe3hIhoAR+oVrUZJNyE8AbNQSvUUl1oinMh1+nfzLL9PKvs1bflbA== Received: from anup-ubuntu-vm.localdomain ([171.76.87.178]) by smtp.gmail.com with ESMTPSA id hq26-20020a056a00681a00b006dbdac1595esm9496060pfb.141.2024.02.14.04.21.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 04:22:00 -0800 (PST) From: Anup Patel To: Will Deacon , julien.thierry.kdev@gmail.com, maz@kernel.org Cc: Paolo Bonzini , Atish Patra , Andrew Jones , Anup Patel , kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, Anup Patel Subject: [kvmtool PATCH 03/10] riscv: Add Zbc extension support Date: Wed, 14 Feb 2024 17:51:34 +0530 Message-Id: <20240214122141.305126-4-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240214122141.305126-1-apatel@ventanamicro.com> References: <20240214122141.305126-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When the Zbc extension is available expose it to the guest via device tree so that guest can use it. Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- riscv/fdt.c | 1 + riscv/include/kvm/kvm-config-arch.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/riscv/fdt.c b/riscv/fdt.c index 8485acf..84b6087 100644 --- a/riscv/fdt.c +++ b/riscv/fdt.c @@ -24,6 +24,7 @@ struct isa_ext_info isa_info_arr[] = { {"svpbmt", KVM_RISCV_ISA_EXT_SVPBMT}, {"zba", KVM_RISCV_ISA_EXT_ZBA}, {"zbb", KVM_RISCV_ISA_EXT_ZBB}, + {"zbc", KVM_RISCV_ISA_EXT_ZBC}, {"zbs", KVM_RISCV_ISA_EXT_ZBS}, {"zicbom", KVM_RISCV_ISA_EXT_ZICBOM}, {"zicboz", KVM_RISCV_ISA_EXT_ZICBOZ}, diff --git a/riscv/include/kvm/kvm-config-arch.h b/riscv/include/kvm/kvm-config-arch.h index d2fc2d4..6d09eee 100644 --- a/riscv/include/kvm/kvm-config-arch.h +++ b/riscv/include/kvm/kvm-config-arch.h @@ -49,6 +49,9 @@ struct kvm_config_arch { OPT_BOOLEAN('\0', "disable-zbb", \ &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZBB], \ "Disable Zbb Extension"), \ + OPT_BOOLEAN('\0', "disable-zbc", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZBC], \ + "Disable Zbc Extension"), \ OPT_BOOLEAN('\0', "disable-zbs", \ &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZBS], \ "Disable Zbs Extension"), \ From patchwork Wed Feb 14 12:21:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13556390 Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59C141CD0F for ; Wed, 14 Feb 2024 12:22:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707913326; cv=none; b=jVL0zw0cF+gHtfPIIfa4zdEmqtXBDJ0vJJ1ke57ShPemdWvKnhsch6jzWuyA5h9xfp2WL6iQkhojZGKi3923wI9yGRj54AfyhWZ8fIn8wgMF1C0FIQuiYaKViiB/iLpQ5E77H9TUOCTe59HP57cWikbzz5X/dKrpnFkLvA2iSbc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707913326; c=relaxed/simple; bh=OVvM3FMv8/NR21J+dE6C56B0IghZOQkZqVDKL8wGZwM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=s6jFtOEET5YzVY8aEZ1ckyPlY9KgUXwwbWDTK5iDcTQxfmRCCzc5iKJ87Cu+TIvXn0qwvUmqPgrsykt4SDUw6YPY7+5lror7aUPDQCKUzgeh73hUI1+5M660HcJbSLB3eJhRwgqGyBtQoGzxfgyrXt/bCqJA0znP9BVxE0th4Jo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=msjzoidu; arc=none smtp.client-ip=209.85.215.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="msjzoidu" Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-5dc816e4affso1579539a12.2 for ; Wed, 14 Feb 2024 04:22:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1707913325; x=1708518125; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EJHsdkwY98XNAe7FkD7zjxblmst8KoO5VlTSmaDE1gU=; b=msjzoiduq8Pr6Hpit5AcqVJkAz7sYDXwBjmroZPllYzTPYmDLlmEZFz6tPziu/Bdw3 /MKDjIJzTLej0shR98TMTLGrnTha24sbGbdw0NAgl0VfmfjqKksO64+Ot4rQxX142jmh n4sWTl42Q9UtjDXXWTx49040Kz2j2Ex6gG+yoUWHCLpNMMuzkyuLzEmriMDzgIxillek JFabLw7e5YyBysvPsH9wvS9495wbd7IDkjeg6fM7lqvRrzu4E8WMrf2F+R4oiC2on9ls Vx1qZRxht/9ZpeGxSfGFWWjzRFy9O7Rsu4SFZVtSb6OimnGgX+2zVJXap/I1GE60Ovsw rcZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707913325; x=1708518125; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EJHsdkwY98XNAe7FkD7zjxblmst8KoO5VlTSmaDE1gU=; b=HZitlQDknkP+B97iJHj0wAaSgXSNHPk8Qc+vzelyeEtPBSNOHa3RhiPai/WvoFR7Dg fWc4OgMLxTwV1IThb/nbXGY2dmnz4wD9160anS9yujBkz+AkXe0PrNJ4S0Y8DqKHQpRK 55ebKzo1tigUILMzjxYwcO4/Op7a1WFStWdge7iWqvrJLomxxmB1Gi4xfbzUv0hlUjfp qjjNNiCsc1YpLs+ACkmUdwvfkjwjr9IwTRr7dkiu/R2u5AKL5NOAMbCEUpkRtOs5eOeO yzOTMJzVUN9RoiZvzB8NRCltK3R3355SuiO34yRpSiDZIjyGTXyQ6s+zD102BBi9r8QO fumw== X-Forwarded-Encrypted: i=1; AJvYcCUJVzq87jQcEH9aiuk+1qT9kr9v1lWI0IBe/S1K7pTHlgm8bWt80s01czqMCa/uH1Ac2BYOlKzL2gjzX9R2R4d7mvf0 X-Gm-Message-State: AOJu0Yw+XbGNn/FDAPs98pt5KnBXxrAT6U02LPTl9r8C94RiNDCKId5U reBpZSgVfaHjkkUQsDC57fuaaokeATV9NUOv2bUOrtLfujiYFihVbUricHz4MF8= X-Google-Smtp-Source: AGHT+IGp4YwbcwK+b1C4aq3yR7OclF7DR3MNrVHVpS7sfr51IswGxSrVvBIsYCSQNVCPhQbvUbffSA== X-Received: by 2002:a05:6a20:9597:b0:19e:a25e:a7f5 with SMTP id iu23-20020a056a20959700b0019ea25ea7f5mr3019724pzb.46.1707913324651; Wed, 14 Feb 2024 04:22:04 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVGs0dh5rH2LYPpbdVIJ4u49Ly9YNrZHkdy1J3ir8Jw1I1/gPgTiMabQlgrwfOwFUOKXDt81221legsQiG4RuJFshhigmbdRTNsSsJ+NgD5YrQSXsah6KuPXgXpsfRiE+Dsj2t+4F0yZdCxQBavp905JL9DzZ9suTSsfofIYoPd3chterKvn2FbfQFWqIJdj1s1Rz9PTLrOCu7TXu0vDVOGEEASnQNsLc3KpR3GhBv/fcJr3i8F36ZjM06EGpsSYT7KX3lnt3p7er6RHZFrmFYtCJ4pdBDtLIvoNonSlA9qBT0ko05EfaW1XlaL0ZuPhw== Received: from anup-ubuntu-vm.localdomain ([171.76.87.178]) by smtp.gmail.com with ESMTPSA id hq26-20020a056a00681a00b006dbdac1595esm9496060pfb.141.2024.02.14.04.22.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 04:22:04 -0800 (PST) From: Anup Patel To: Will Deacon , julien.thierry.kdev@gmail.com, maz@kernel.org Cc: Paolo Bonzini , Atish Patra , Andrew Jones , Anup Patel , kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, Anup Patel Subject: [kvmtool PATCH 04/10] riscv: Add scalar crypto extensions support Date: Wed, 14 Feb 2024 17:51:35 +0530 Message-Id: <20240214122141.305126-5-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240214122141.305126-1-apatel@ventanamicro.com> References: <20240214122141.305126-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When the scalar extensions are available expose them to the guest via device tree so that guest can use it. This includes extensions Zbkb, Zbkc, Zbkx, Zknd, Zkne, Zknh, Zkr, Zksed, Zksh, and Zkt. The Zkr extension requires SEED CSR emulation in user space so we also add related KVM_EXIT_RISCV_CSR handling. Signed-off-by: Anup Patel --- riscv/fdt.c | 10 ++++++++++ riscv/include/kvm/csr.h | 15 ++++++++++++++ riscv/include/kvm/kvm-config-arch.h | 30 ++++++++++++++++++++++++++++ riscv/kvm-cpu.c | 31 +++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 riscv/include/kvm/csr.h diff --git a/riscv/fdt.c b/riscv/fdt.c index 84b6087..be87e9a 100644 --- a/riscv/fdt.c +++ b/riscv/fdt.c @@ -25,6 +25,9 @@ struct isa_ext_info isa_info_arr[] = { {"zba", KVM_RISCV_ISA_EXT_ZBA}, {"zbb", KVM_RISCV_ISA_EXT_ZBB}, {"zbc", KVM_RISCV_ISA_EXT_ZBC}, + {"zbkb", KVM_RISCV_ISA_EXT_ZBKB}, + {"zbkc", KVM_RISCV_ISA_EXT_ZBKC}, + {"zbkx", KVM_RISCV_ISA_EXT_ZBKX}, {"zbs", KVM_RISCV_ISA_EXT_ZBS}, {"zicbom", KVM_RISCV_ISA_EXT_ZICBOM}, {"zicboz", KVM_RISCV_ISA_EXT_ZICBOZ}, @@ -34,6 +37,13 @@ struct isa_ext_info isa_info_arr[] = { {"zifencei", KVM_RISCV_ISA_EXT_ZIFENCEI}, {"zihintpause", KVM_RISCV_ISA_EXT_ZIHINTPAUSE}, {"zihpm", KVM_RISCV_ISA_EXT_ZIHPM}, + {"zknd", KVM_RISCV_ISA_EXT_ZKND}, + {"zkne", KVM_RISCV_ISA_EXT_ZKNE}, + {"zknh", KVM_RISCV_ISA_EXT_ZKNH}, + {"zkr", KVM_RISCV_ISA_EXT_ZKR}, + {"zksed", KVM_RISCV_ISA_EXT_ZKSED}, + {"zksh", KVM_RISCV_ISA_EXT_ZKSH}, + {"zkt", KVM_RISCV_ISA_EXT_ZKT}, }; static void dump_fdt(const char *dtb_file, void *fdt) diff --git a/riscv/include/kvm/csr.h b/riscv/include/kvm/csr.h new file mode 100644 index 0000000..2d27f74 --- /dev/null +++ b/riscv/include/kvm/csr.h @@ -0,0 +1,15 @@ +#ifndef KVM__KVM_CSR_H +#define KVM__KVM_CSR_H + +#include + +/* Scalar Crypto Extension - Entropy */ +#define CSR_SEED 0x015 +#define SEED_OPST_MASK _AC(0xC0000000, UL) +#define SEED_OPST_BIST _AC(0x00000000, UL) +#define SEED_OPST_WAIT _AC(0x40000000, UL) +#define SEED_OPST_ES16 _AC(0x80000000, UL) +#define SEED_OPST_DEAD _AC(0xC0000000, UL) +#define SEED_ENTROPY_MASK _AC(0xFFFF, UL) + +#endif /* KVM__KVM_CSR_H */ diff --git a/riscv/include/kvm/kvm-config-arch.h b/riscv/include/kvm/kvm-config-arch.h index 6d09eee..3764d7c 100644 --- a/riscv/include/kvm/kvm-config-arch.h +++ b/riscv/include/kvm/kvm-config-arch.h @@ -52,6 +52,15 @@ struct kvm_config_arch { OPT_BOOLEAN('\0', "disable-zbc", \ &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZBC], \ "Disable Zbc Extension"), \ + OPT_BOOLEAN('\0', "disable-zbkb", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZBKB], \ + "Disable Zbkb Extension"), \ + OPT_BOOLEAN('\0', "disable-zbkc", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZBKC], \ + "Disable Zbkc Extension"), \ + OPT_BOOLEAN('\0', "disable-zbkx", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZBKX], \ + "Disable Zbkx Extension"), \ OPT_BOOLEAN('\0', "disable-zbs", \ &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZBS], \ "Disable Zbs Extension"), \ @@ -79,6 +88,27 @@ struct kvm_config_arch { OPT_BOOLEAN('\0', "disable-zihpm", \ &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZIHPM], \ "Disable Zihpm Extension"), \ + OPT_BOOLEAN('\0', "disable-zknd", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZKND], \ + "Disable Zknd Extension"), \ + OPT_BOOLEAN('\0', "disable-zkne", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZKNE], \ + "Disable Zkne Extension"), \ + OPT_BOOLEAN('\0', "disable-zknh", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZKNH], \ + "Disable Zknh Extension"), \ + OPT_BOOLEAN('\0', "disable-zkr", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZKR], \ + "Disable Zkr Extension"), \ + OPT_BOOLEAN('\0', "disable-zksed", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZKSED], \ + "Disable Zksed Extension"), \ + OPT_BOOLEAN('\0', "disable-zksh", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZKSH], \ + "Disable Zksh Extension"), \ + OPT_BOOLEAN('\0', "disable-zkt", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZKT], \ + "Disable Zkt Extension"), \ OPT_BOOLEAN('\0', "disable-sbi-legacy", \ &(cfg)->sbi_ext_disabled[KVM_RISCV_SBI_EXT_V01], \ "Disable SBI Legacy Extensions"), \ diff --git a/riscv/kvm-cpu.c b/riscv/kvm-cpu.c index c4e83c4..3e17c12 100644 --- a/riscv/kvm-cpu.c +++ b/riscv/kvm-cpu.c @@ -1,3 +1,4 @@ +#include "kvm/csr.h" #include "kvm/kvm-cpu.h" #include "kvm/kvm.h" #include "kvm/virtio.h" @@ -222,11 +223,41 @@ static bool kvm_cpu_riscv_sbi(struct kvm_cpu *vcpu) return ret; } +static bool kvm_cpu_riscv_csr(struct kvm_cpu *vcpu) +{ + int dfd = kvm_cpu__get_debug_fd(); + bool ret = true; + + switch (vcpu->kvm_run->riscv_csr.csr_num) { + case CSR_SEED: + /* + * We ignore the new_value and write_mask and simply + * return a random value as SEED. + */ + vcpu->kvm_run->riscv_csr.ret_value = rand() & SEED_ENTROPY_MASK; + break; + default: + dprintf(dfd, "Unhandled CSR access\n"); + dprintf(dfd, "csr_num=0x%lx new_value=0x%lx\n", + vcpu->kvm_run->riscv_csr.csr_num, + vcpu->kvm_run->riscv_csr.new_value); + dprintf(dfd, "write_mask=0x%lx ret_value=0x%lx\n", + vcpu->kvm_run->riscv_csr.write_mask, + vcpu->kvm_run->riscv_csr.ret_value); + ret = false; + break; + }; + + return ret; +} + bool kvm_cpu__handle_exit(struct kvm_cpu *vcpu) { switch (vcpu->kvm_run->exit_reason) { case KVM_EXIT_RISCV_SBI: return kvm_cpu_riscv_sbi(vcpu); + case KVM_EXIT_RISCV_CSR: + return kvm_cpu_riscv_csr(vcpu); default: break; }; From patchwork Wed Feb 14 12:21:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13556391 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD51029431 for ; Wed, 14 Feb 2024 12:22:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707913330; cv=none; b=WtcDPG6lgWBEVm+m8C+0Zz0VgMZNL1nz8mqa5Azh0BjHKr441Wngu2xdMlaB6+v0brJCkuDQ8SXlffWtdmjmqrFT8v51lXYAi5M9A8JpssxVF3jWtFCfI10zWCx375Dbx+DlqfpVBJA4qD0+ugryJf7KlMqOFkWMiM2kSIGHyt8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707913330; c=relaxed/simple; bh=GhGdAUJaOiPDL7I3RUQVxMbYQNtDhrZQZB5dDsOTdi4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=B6crEB0Va0y2e925/j8nejOggGFvKaXURaVSnvvgY5mhWmnmrbtGczyUZmvLUJjMWcgEYgtzpvHRIxHPGqxpUM7E2+pTLTRu1lGMOm+6N9uo1i3PVnw8BCtBjUI/OYf/uuc5cyNuImr43Og4FGI5GXlmaE1OnWNeJ3t70OYXMnU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=SKeGNsv6; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="SKeGNsv6" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-6e10614c276so762162b3a.3 for ; Wed, 14 Feb 2024 04:22:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1707913328; x=1708518128; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=m9/do4dc4JDGvXceYSvpkZtB8ISeycNbs9VMo8Y3ia8=; b=SKeGNsv6GUliiiyjM+EaDRasZ82fLvbD6lfjJrdKQ/dAg1r6vO5/3MPZVK5gZTvGz7 RWn/lzSL376Kb5MngRSGxCDtN8rajI/Y5da8BVHwOw91NqpbtKG5vAdxRAnYU9HUL8As y5iV1lkHhwdYUKEMT3/sBoXBj99LHuEV7U9KQkLvKquzi/NKB11Nogie3d+TJa4oJFVY dqq32UtNWwTMv1qkaXYQn2OdgYC+evflJLCcu0It5RzUdG3XSClKrmZxPpZ84mC2Ngqr pX8fN8N0W11U57gnHdxivpppW+huTgUgWDLeARm/uXyF+UZ3Xaot3p7hwQnkQXscWqvL bugg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707913328; x=1708518128; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m9/do4dc4JDGvXceYSvpkZtB8ISeycNbs9VMo8Y3ia8=; b=Wi8p+NgTf24CqM6nmeWiI7T+Jbzo4973HsujxUGu8iuQFJZwR38Fqkqhz555Ua2HGl C4r9HBOGh1Y4D9Amjwltnjc5SkV1WFl3/+3AwJXr0xL7fe6n27dgA+nkP8+8dRg53Eqe rm2sYsxNO1+wcx6xdGro84robGmpRnzBv+KR5skdFvofX9kDzmqyXGcPccH6zlg44I/1 iJLeSDG6jwodq1MEuqim7h4Z0C3XSVyRq6FZcwyozN2NJVx2H5sd51Qr+X8aA3saHAhX SSm+aXtFbEqNRBI7+ZsqL5qk36YxwUof1cBANxyCE7TV8/2hMBN+YsyFuHI3Lj+ci/Sm 9CIA== X-Forwarded-Encrypted: i=1; AJvYcCVP22cJnOnXfUtONi1gU2vYi21DjbL1WrC4/ADIUrU/C+mMwwUnqcgz2PdaTi7uVzQN3Vj7iEcyia1d/dt0vZhjfzT4 X-Gm-Message-State: AOJu0YwI95ZFyKID8RIiGmOZTvCfcKh+2Ug6OhUXVz7OxZwB4XpkHQq8 7+SghtOLjjYRpCGyHo4rk/CzU/RzrHHCGptJ48dtnCASubQoYwfX6pTMFVGJaBg= X-Google-Smtp-Source: AGHT+IEo9LvuSGjYo7apnUnwhO8hBIzhPN+7NgSbQFuAByJTEI70yE2tz86KtDMb9U/a3nPU7sfyGg== X-Received: by 2002:a05:6a21:2d08:b0:1a0:70db:43dc with SMTP id tw8-20020a056a212d0800b001a070db43dcmr681995pzb.6.1707913328136; Wed, 14 Feb 2024 04:22:08 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXyRyu6/DexPKhGlQ1N8Z34F3Ov0gMHYOY2+oDruiWsrXcwyWzJgZ+9HvHkNRFzXOeWOAEIZtFS9SsdiA4R24K2fe2DJjfs7f94jtVDiJ6uX0Cai2/q85XR1KkcTaxOcJVtRji+6qmebl59ec2N01g+BWvxgxv+2JhnLlHgObcy9+6Wp7ey9dWrmBzDFq9D8h7PgYL1f5ChshmuG2fgn0+PAkvuQ8ZUzPBg32fQba+OjCU6X2+i0M5MosVACrbrWG2NQFd2qkMNr96Xe+0TzhQgzdZ6GDc9Iuk72xx0zizgP++eQxnh1DLUvHotzajZTw== Received: from anup-ubuntu-vm.localdomain ([171.76.87.178]) by smtp.gmail.com with ESMTPSA id hq26-20020a056a00681a00b006dbdac1595esm9496060pfb.141.2024.02.14.04.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 04:22:07 -0800 (PST) From: Anup Patel To: Will Deacon , julien.thierry.kdev@gmail.com, maz@kernel.org Cc: Paolo Bonzini , Atish Patra , Andrew Jones , Anup Patel , kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, Anup Patel Subject: [kvmtool PATCH 05/10] riscv: Add vector crypto extensions support Date: Wed, 14 Feb 2024 17:51:36 +0530 Message-Id: <20240214122141.305126-6-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240214122141.305126-1-apatel@ventanamicro.com> References: <20240214122141.305126-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When the vector extensions are available expose them to the guest via device tree so that guest can use it. This includes extensions Zvbb, Zvbc, Zvkb, Zvkg, Zvkned, Zvknha, Zvknhb, Zvksed, Zvksh, and Zvkt. Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- riscv/fdt.c | 10 ++++++++++ riscv/include/kvm/kvm-config-arch.h | 30 +++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/riscv/fdt.c b/riscv/fdt.c index be87e9a..44058dc 100644 --- a/riscv/fdt.c +++ b/riscv/fdt.c @@ -44,6 +44,16 @@ 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}, + {"zvbb", KVM_RISCV_ISA_EXT_ZVBB}, + {"zvbc", KVM_RISCV_ISA_EXT_ZVBC}, + {"zvkb", KVM_RISCV_ISA_EXT_ZVKB}, + {"zvkg", KVM_RISCV_ISA_EXT_ZVKG}, + {"zvkned", KVM_RISCV_ISA_EXT_ZVKNED}, + {"zvknha", KVM_RISCV_ISA_EXT_ZVKNHA}, + {"zvknhb", KVM_RISCV_ISA_EXT_ZVKNHB}, + {"zvksed", KVM_RISCV_ISA_EXT_ZVKSED}, + {"zvksh", KVM_RISCV_ISA_EXT_ZVKSH}, + {"zvkt", KVM_RISCV_ISA_EXT_ZVKT}, }; static void dump_fdt(const char *dtb_file, void *fdt) diff --git a/riscv/include/kvm/kvm-config-arch.h b/riscv/include/kvm/kvm-config-arch.h index 3764d7c..ae648ce 100644 --- a/riscv/include/kvm/kvm-config-arch.h +++ b/riscv/include/kvm/kvm-config-arch.h @@ -109,6 +109,36 @@ struct kvm_config_arch { OPT_BOOLEAN('\0', "disable-zkt", \ &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZKT], \ "Disable Zkt Extension"), \ + OPT_BOOLEAN('\0', "disable-zvbb", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZVBB], \ + "Disable Zvbb Extension"), \ + OPT_BOOLEAN('\0', "disable-zvbc", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZVBC], \ + "Disable Zvbc Extension"), \ + OPT_BOOLEAN('\0', "disable-zvkb", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZVKB], \ + "Disable Zvkb Extension"), \ + OPT_BOOLEAN('\0', "disable-zvkg", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZVKG], \ + "Disable Zvkg Extension"), \ + OPT_BOOLEAN('\0', "disable-zvkned", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZVKNED], \ + "Disable Zvkned Extension"), \ + OPT_BOOLEAN('\0', "disable-zvknha", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZVKNHA], \ + "Disable Zvknha Extension"), \ + OPT_BOOLEAN('\0', "disable-zvknhb", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZVKNHB], \ + "Disable Zvknhb Extension"), \ + OPT_BOOLEAN('\0', "disable-zvksed", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZVKSED], \ + "Disable Zvksed Extension"), \ + OPT_BOOLEAN('\0', "disable-zvksh", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZVKSH], \ + "Disable Zvksh Extension"), \ + OPT_BOOLEAN('\0', "disable-zvkt", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZVKT], \ + "Disable Zvkt Extension"), \ OPT_BOOLEAN('\0', "disable-sbi-legacy", \ &(cfg)->sbi_ext_disabled[KVM_RISCV_SBI_EXT_V01], \ "Disable SBI Legacy Extensions"), \ From patchwork Wed Feb 14 12:21:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13556392 Received: from mail-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E33072D60F for ; Wed, 14 Feb 2024 12:22:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707913334; cv=none; b=YkDn7lfFNMZuwNXESUOlM7HWXqjP6UuALOlhozLSsLh8SNvcmiwN9qkcooxaXAf1TXKPVeWJxeKmQ81J2DtibZgDbD363F9ARk3nbpRaHDH4G/1SEmYKoWUvm4mAwg4IGwUxJqLhcpYYg2FuB94m7oVEgbT6DJjrxSuS6t/A5MI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707913334; c=relaxed/simple; bh=sJCkH+jhw69qz8Jq+Hk9LNI45Ra6IvI/agcwjaFNlfI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=q70GI2UaiYSYxbfJm8yx/h4Y4J5cag+/STdCFnk1VINyBEhtljhED1obV7rI1MM38zTRo6WTIxOTPVG2wLSkioXt67HOpXteS1yC36Xa0TpoX9eFjORUkJQZ74o66FYQvLrDnL8Q9GR4LTTOMht++VCHZQXEHJthbrpUXho59m8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=lRx12hfA; arc=none smtp.client-ip=209.85.210.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="lRx12hfA" Received: by mail-ot1-f50.google.com with SMTP id 46e09a7af769-6dc36e501e1so3613721a34.1 for ; Wed, 14 Feb 2024 04:22:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1707913332; x=1708518132; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hdrgspXtjJ8x+TgvCvFfZY4HshcuByVZLxSfDH92JrE=; b=lRx12hfASUgzhhWo7P3NIkfyi0/2g5+sVyPP8OoPqV8QbpPm33D2z9XU00g3fgmhiC ghT1ewVg7Wt9qOAm3CCCaBKN61LFNBMezkGSmUqknElgtBxWapfZpiqJbmdy4UMYTDxL m/3vOjEHzjLLaUNSuRbGxUP33zXs0QHAcxPoPs5J5bs9pq6lJgUdz6CL3hw3iCY+KLs1 /UyRLeosDUv4d62N5d+1ciOQVg1BiHQ8HJ5vwFDG/kq2/fwXeWYP6/ChN7tQ7Tm25L3l v3dAq0Ve48n9jbi8W83mh3jTCI8KkSFXKulVZd2/DweKn7WbpuuOEoYhVFJD3LE/EGx3 5MIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707913332; x=1708518132; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hdrgspXtjJ8x+TgvCvFfZY4HshcuByVZLxSfDH92JrE=; b=UaTwVbHHhJIxhqvHop7l3ZOBDohIfYIXNdcn9wDtbZKKZo2Jlz/1N9Xseu0iYl+QKl QqNRjJ8ZSiLeeEexFmQj+f4qPqHb1/DqyrwNRuWl4EikubVCegp40a2FdTCHnDSKquzt l/ioPRGngN6K4H9VIrKFJwNNTi6Qn/3i171mtB58ihMQBW73mB3AX41+TDPTjwcXuiAX wTTN8k+gy8OBUNkZ/vgyUGMV8GjPeUTM5+VEe1hEShuvDgTiJFq4oDscUVOo4rUvkZL0 zKnal5rO23M0y+p9ikirRvAVj3gIcfAzFBn51vKqQTZmW/LsBJ4uBHpRSgjG747qqbWs er9w== X-Forwarded-Encrypted: i=1; AJvYcCXZO/O8Qbb9u+1A/xYdM12yjVlS8Fa6Hfz/YDIF3uLFuKYZ2Df/f93KoVNTXgHhNIv/By8XRwO1FYxmSwRk8aoYbuPi X-Gm-Message-State: AOJu0YxR+XmJRMnGVPbZLfStYr5mCTziq3Eo0JbOKBIVvyfm7BLJZbCl s/RqpkMv8HC5tKjD5oOzd1ySLVkxxJ56Y11u2IYwW02Dl0a1BeVgyPI1+HOs3ws= X-Google-Smtp-Source: AGHT+IEaEo5UJWRqqmuDjnOvwwCBIt89UVG1tUctHZ4EVYrMg4pLuUf2JAAYr6lA6jKWE5/77aIHMw== X-Received: by 2002:a05:6358:524d:b0:17a:f909:2cef with SMTP id c13-20020a056358524d00b0017af9092cefmr2217115rwa.31.1707913331698; Wed, 14 Feb 2024 04:22:11 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVcL6IAExbu7zEngu3X/DEPUevZaDpQwFlwQprCF4X4MLxUu9XAwAQO/45RjiWdoAH4BJc4GRuW94G8tz6khf3B9Tv9nkKzn9N8oSXcqfqXfp39XFY1UWE0zla0xkG8SR4d66iLRGwmyctkzLxU7ZQnw5toz3q5QIdA0TjN//rIjGnvp/E2ySLO039NCPclrrRKvuxVaohqaJAd2mIkiTknsXejoxoqebf3jHMoOhlwFWxW9PPBJdCCwDUj3umVfVKcTLai09Il0VlhZbm5yEsnlGDiI7lud2lXRlcBp1HDgpGcrcBumz1jia7cvSRVSg== Received: from anup-ubuntu-vm.localdomain ([171.76.87.178]) by smtp.gmail.com with ESMTPSA id hq26-20020a056a00681a00b006dbdac1595esm9496060pfb.141.2024.02.14.04.22.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 04:22:11 -0800 (PST) From: Anup Patel To: Will Deacon , julien.thierry.kdev@gmail.com, maz@kernel.org Cc: Paolo Bonzini , Atish Patra , Andrew Jones , Anup Patel , kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, Anup Patel Subject: [kvmtool PATCH 06/10] riscv: Add Zfh[min] extensions support Date: Wed, 14 Feb 2024 17:51:37 +0530 Message-Id: <20240214122141.305126-7-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240214122141.305126-1-apatel@ventanamicro.com> References: <20240214122141.305126-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When the Zfh[min] extensions are available expose it to the guest via device tree so that guest can use it. Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- riscv/fdt.c | 2 ++ riscv/include/kvm/kvm-config-arch.h | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/riscv/fdt.c b/riscv/fdt.c index 44058dc..7687624 100644 --- a/riscv/fdt.c +++ b/riscv/fdt.c @@ -29,6 +29,8 @@ 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}, + {"zfh", KVM_RISCV_ISA_EXT_ZFH}, + {"zfhmin", KVM_RISCV_ISA_EXT_ZFHMIN}, {"zicbom", KVM_RISCV_ISA_EXT_ZICBOM}, {"zicboz", KVM_RISCV_ISA_EXT_ZICBOZ}, {"zicntr", KVM_RISCV_ISA_EXT_ZICNTR}, diff --git a/riscv/include/kvm/kvm-config-arch.h b/riscv/include/kvm/kvm-config-arch.h index ae648ce..f1ac56b 100644 --- a/riscv/include/kvm/kvm-config-arch.h +++ b/riscv/include/kvm/kvm-config-arch.h @@ -64,6 +64,12 @@ struct kvm_config_arch { OPT_BOOLEAN('\0', "disable-zbs", \ &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZBS], \ "Disable Zbs Extension"), \ + OPT_BOOLEAN('\0', "disable-zfh", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZFH], \ + "Disable Zfh Extension"), \ + OPT_BOOLEAN('\0', "disable-zfhmin", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZFHMIN], \ + "Disable Zfhmin Extension"), \ OPT_BOOLEAN('\0', "disable-zicbom", \ &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZICBOM], \ "Disable Zicbom Extension"), \ From patchwork Wed Feb 14 12:21:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13556393 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2230E33082 for ; Wed, 14 Feb 2024 12:22:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707913337; cv=none; b=g6wAZ+YPk3zoDJ74G4VwAW7VwjrY516vwrXuD+9raIi7sHHRV/wyzfOuIJ4m2O68Gu+r063sLiTMKrBX60tjAK9GAleyjkj6Ks4wqNJl5CTeLzaxeYgexnnjLCJCkeUki+iraymcS4kwgDCwWIb8svi1roTFt6rib1BIM/nFyjo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707913337; c=relaxed/simple; bh=wJwTvM5mVd1MXqWP/WyWJ56swcNYEHP/wHGTRHHgGXs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uNAk0UEDuZpBcdCZOdcpXDgpKEhC7rPlynrGOwCQ2bBk90VWzhyuFJfk/qXaiVPF8xMK7Zvqz930VgyFaBMnS7c1o7Jjyi3UQCoH0uK3dZR9r2qR8ZbJ4cjKXYxw9MJfDP3H926nRTwiLfRMnDz1eMyCXVV3VNXwJa570VezpU0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=SHcFOAYy; arc=none smtp.client-ip=209.85.210.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="SHcFOAYy" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-6e0f5934813so1508784b3a.2 for ; Wed, 14 Feb 2024 04:22:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1707913335; x=1708518135; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TFrJR7zq1Wh+NaQVmo8MahkS9AhhLjr7VokUjc39p8w=; b=SHcFOAYyMTWDh0NdGc2ls3IPwntCet9nN9a8VM2jH82UKSb0zRH/M3HFgIF3SniyOg bTExLtPe84f+6DOV35Z7J+zL8cEj2s+mAZeIjL8AkYXW94nSH0oCgbEyIbQpzAknJTmt w3g0roCpVGF9oUrT+Nm26l4JUrUGtBDZvQgAQfK96d4CVyGd7bgIOHktJPna31xYdYNb OKwjhucWD0iviyqecDr4fLpj2apx0kroE3r049nchQaIDixtXwoMiXbfGl6FxH7e5wMQ sSHyLDhcTXXqdTffP36+Hfx/gknkd83eVihPj+HvdgfcdCmHWNifzzt5MHF7NXNXtUjd DSWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707913335; x=1708518135; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TFrJR7zq1Wh+NaQVmo8MahkS9AhhLjr7VokUjc39p8w=; b=Y3M0bZK/cyzeIfBQgVdKE0/TogL0XAT2pwkwAT1RhLGIx1tGvtplNcodGJAqwzR3lz wXvfbJLL8C1nxh4XdFvQyGxNIphqX39AHHg9WbH5tLLYcwdQDub/C48wVB/d1UPYBAmT tO8BHBwA7u+jgSBe2642lsDUt9HyPg5lqGTfTGHGU02Qo43zmZsT1obybJzWlgkI3VOL YtGkSMbGAozKFpFgwT0sZ+JQtuqskyerZBU5cOwwpM61tbJ0swzfsLJ2cioW+vexiPrB OZE8CB1FiuSipChRwb7aOw3+yIusnrZeY6/Kulv5xwyVZkt/CqjDDapaOfgIo60BLU8H aylg== X-Forwarded-Encrypted: i=1; AJvYcCXM5DCPfzOkXIFoFSSvH4N71zzKpHtKYYJQbeSpOisw+GCGOVifdi/Rmj+4dX3XjG2abFNmBeiH25wqpiMddT/7EEtq X-Gm-Message-State: AOJu0Yyqvyjm/XrvEzhqd1lG1XrS+N50B3Otr6/2FaGcZogO6ksia2PA MbXLLUFj4qWvLNKb9BYqSFbu491ow2oyzFIKqQLxUBLgvQMTynpg8rM5x50dvlA= X-Google-Smtp-Source: AGHT+IHHg6mR1oE5KV3JL5Ul1+XprOuDuIXsFOWSumDnqgVZHvdiGWEqbiuJhhstLxsBhyToHX0nIA== X-Received: by 2002:a05:6a20:e68e:b0:1a0:6dd9:ef76 with SMTP id mz14-20020a056a20e68e00b001a06dd9ef76mr921198pzb.56.1707913335284; Wed, 14 Feb 2024 04:22:15 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXwE/FJZ+5K3PdVza5DR+at+9GHTWB0pV2AkH1WRTM/evpC7Q982V/s6voPRBx+N+fhlyHtWlE0PNU4u+3U8g8jjJWkymv3M6Ex+0sN5PgnxmDLuFlZbRTtxCWxcqju+R6RQkIbMYnhHJTJtmeTUN0y6RqK+q/0dJyMOOq5IszI+8On4eJhw+50K6m/Lx8XaOD0v9Bv6K3xG3PadjM8NvvBaAvilkaJ/qOqZjxmvYmBna/Sthk4i51u/WJ+b8pnxk38y8itMsQnfwCJlsoGEpGnIeQgp2pwoMvCDbvKQTVWx3/mRExbtsPyoydY74LJTg== Received: from anup-ubuntu-vm.localdomain ([171.76.87.178]) by smtp.gmail.com with ESMTPSA id hq26-20020a056a00681a00b006dbdac1595esm9496060pfb.141.2024.02.14.04.22.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 04:22:14 -0800 (PST) From: Anup Patel To: Will Deacon , julien.thierry.kdev@gmail.com, maz@kernel.org Cc: Paolo Bonzini , Atish Patra , Andrew Jones , Anup Patel , kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, Anup Patel Subject: [kvmtool PATCH 07/10] riscv: Add Zihintntl extension support Date: Wed, 14 Feb 2024 17:51:38 +0530 Message-Id: <20240214122141.305126-8-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240214122141.305126-1-apatel@ventanamicro.com> References: <20240214122141.305126-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When the Zihintntl extension is available expose it to the guest via device tree so that guest can use it. Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- riscv/fdt.c | 1 + riscv/include/kvm/kvm-config-arch.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/riscv/fdt.c b/riscv/fdt.c index 7687624..80e045d 100644 --- a/riscv/fdt.c +++ b/riscv/fdt.c @@ -37,6 +37,7 @@ struct isa_ext_info isa_info_arr[] = { {"zicond", KVM_RISCV_ISA_EXT_ZICOND}, {"zicsr", KVM_RISCV_ISA_EXT_ZICSR}, {"zifencei", KVM_RISCV_ISA_EXT_ZIFENCEI}, + {"zihintntl", KVM_RISCV_ISA_EXT_ZIHINTNTL}, {"zihintpause", KVM_RISCV_ISA_EXT_ZIHINTPAUSE}, {"zihpm", KVM_RISCV_ISA_EXT_ZIHPM}, {"zknd", KVM_RISCV_ISA_EXT_ZKND}, diff --git a/riscv/include/kvm/kvm-config-arch.h b/riscv/include/kvm/kvm-config-arch.h index f1ac56b..2935c01 100644 --- a/riscv/include/kvm/kvm-config-arch.h +++ b/riscv/include/kvm/kvm-config-arch.h @@ -88,6 +88,9 @@ struct kvm_config_arch { OPT_BOOLEAN('\0', "disable-zifencei", \ &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZIFENCEI], \ "Disable Zifencei Extension"), \ + OPT_BOOLEAN('\0', "disable-zihintntl", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZIHINTNTL], \ + "Disable Zihintntl Extension"), \ OPT_BOOLEAN('\0', "disable-zihintpause", \ &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZIHINTPAUSE],\ "Disable Zihintpause Extension"), \ From patchwork Wed Feb 14 12:21:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13556394 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B58111BDD6 for ; Wed, 14 Feb 2024 12:22:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707913341; cv=none; b=AvO7rY5EhPWacsnEjV/GNo0Pwz0jdPG6SVzIJTUaY3LI6sMJkATx8mQZGg/rNfwLwFZwXPtYtlYgazlCbP+ksb9iyaDWSX8s0YBEiljcT2aBuBqfaewSznV7z//GlOUV9tEdX8c1Z+0K0lXiu6Lp+9ZBnFLs9Pi43FfeJxKx0NQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707913341; c=relaxed/simple; bh=HvRyYGFpjro27IO9DodrXZqLWvpLPTxHX9oPCUZIVXg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=s5JzAVvt7CKpfuuzvaTDvfeONRtJprTLB3+X+cimpeColIdyqOOC4YNgd2RH5WW9LRkKmoe6Bbu5GTpxXyHj3/2kpaoIPSyXHLU+DRYaAroNGyOOOQ8QNRgyCVxKoDzuQKdSO0M13NLTbEO/e8t1PG8nnuNkmh2jlNQFbNsd5r4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=lJGFvVGB; arc=none smtp.client-ip=209.85.210.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="lJGFvVGB" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-6e10614c276so762295b3a.3 for ; Wed, 14 Feb 2024 04:22:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1707913339; x=1708518139; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TwZk29D7fDiwtPISRLXLV92+Pgyhvl1ktMadRkygXHo=; b=lJGFvVGB5JSgYddYTUGKiIz8fXpBYZTaMFgl3Rkxyx2cPHMgW3MaJ/rFx4reeA4SUV b7hbCcWiidTn9ueiwhLn90Yj/JyzSbL3LFXpRfPGSAquPbbtwo6fpH7KI/7x1haEs0Vs OLuxfkS1PS/VhovpzfWM3+bSXstzSlHO9vUds/tPHszmlkMdxBdmNUhZ6JOFak7QKv8O jjI374nWGVMOA+Q9wynRahz/rR2Tb86L/GUHLiH/mOF/O5vWAX5V2HjRSzEMGnJS4erl ozOLBrRCY2IFir4t3tjgkL1XIwhfu5pk8Xo5NVhA34SM+J6Ber101uVOaQh6I/IT0bUt qRsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707913339; x=1708518139; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TwZk29D7fDiwtPISRLXLV92+Pgyhvl1ktMadRkygXHo=; b=MMx1i0M6t1yreRfh++k3gzB3LpykiuneZgYP6O1aQDSspD+stV6AG6ziEOFRRbWDhe YAKkGEZtfPiEmQTcNUyfN+ophIbca8hLujH+St2l8OJ9V9hHbHiHG13iMdyYmYRYXJNt zhjEx70HO73PcAvLKI0fqqbtqIF02HVBnrvJbn4EBj7OXah0ly+Z6jLPFbbQmKdjpynd ccUA5dG2pzvuCG4kedSk1fmkIczH61LPzqvIMzSlQgUi29CpjoPCNMbeJIMVOsegyKQD HJJfPzsKImHxkAu333ROZpLnAe0i7EWOsTXIC5wpZyMad8ZjHhA/tqA5qx3R41SLZHXt BzOQ== X-Forwarded-Encrypted: i=1; AJvYcCUUkVDCVfbve+63ZPg6xekVqNr61y5e2hkhSSlneJNRIPU3rsp0BD2j2tNPEcFJd6BxacJ0/6Czk1Ws7QR780E1aFJ3 X-Gm-Message-State: AOJu0YzFOSU1BuBuGuF4PGSW8YbAsQ+Z+3KcBGIBd4AwZUCuep7h2PB6 OKJgz4ug3RqCWB0zgC51iZH5ISNeM1uDcox9Vow/E7BBMc4pBRwVwNtYjzErby0= X-Google-Smtp-Source: AGHT+IFXEup+ygQBhG8RG/CmNF54QhSb5MczyRDZQDIjov2Ofqd95iexN1vN5scmhnOu40Q8F6PxOg== X-Received: by 2002:a05:6a20:be99:b0:19f:f059:c190 with SMTP id gf25-20020a056a20be9900b0019ff059c190mr1984396pzb.24.1707913338915; Wed, 14 Feb 2024 04:22:18 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVHkP2GyUogWJDisi/6ilstay2olYoo2aUNfzDPWxxnUPv0/R1CS1bmgE4opDx0Q6D7gRaZ36suH+3Nu8AZhokZmO9gZ+N+hwrfRT7PvfE7N0BZF/pJ1sgQC05LqVKHMQGeeqgpLsMA+23ZlS08wR+5aiRYazYTQ0wkd1wqWv1KZUcJe22B8eVGcY3RbXqcoHFTIS4rn97yXRfkGcT9dkYLLekQ/aOKLKt2tlPA/LNywjaEnQPm0dNi6MmsllU5UK0a+83fnd02pc8ZBeKRRt0KM3KUgEyQRi4L7Zlw3qt94UEzK8T6eNjA0Go6y9aG4A== Received: from anup-ubuntu-vm.localdomain ([171.76.87.178]) by smtp.gmail.com with ESMTPSA id hq26-20020a056a00681a00b006dbdac1595esm9496060pfb.141.2024.02.14.04.22.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 04:22:18 -0800 (PST) From: Anup Patel To: Will Deacon , julien.thierry.kdev@gmail.com, maz@kernel.org Cc: Paolo Bonzini , Atish Patra , Andrew Jones , Anup Patel , kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, Anup Patel Subject: [kvmtool PATCH 08/10] riscv: Add Zvfh[min] extensions support Date: Wed, 14 Feb 2024 17:51:39 +0530 Message-Id: <20240214122141.305126-9-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240214122141.305126-1-apatel@ventanamicro.com> References: <20240214122141.305126-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When the Zvfh[min] extensions are available expose it to the guest via device tree so that guest can use it. Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- riscv/fdt.c | 2 ++ riscv/include/kvm/kvm-config-arch.h | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/riscv/fdt.c b/riscv/fdt.c index 80e045d..005301e 100644 --- a/riscv/fdt.c +++ b/riscv/fdt.c @@ -49,6 +49,8 @@ struct isa_ext_info isa_info_arr[] = { {"zkt", KVM_RISCV_ISA_EXT_ZKT}, {"zvbb", KVM_RISCV_ISA_EXT_ZVBB}, {"zvbc", KVM_RISCV_ISA_EXT_ZVBC}, + {"zvfh", KVM_RISCV_ISA_EXT_ZVFH}, + {"zvfhmin", KVM_RISCV_ISA_EXT_ZVFHMIN}, {"zvkb", KVM_RISCV_ISA_EXT_ZVKB}, {"zvkg", KVM_RISCV_ISA_EXT_ZVKG}, {"zvkned", KVM_RISCV_ISA_EXT_ZVKNED}, diff --git a/riscv/include/kvm/kvm-config-arch.h b/riscv/include/kvm/kvm-config-arch.h index 2935c01..10ca3b8 100644 --- a/riscv/include/kvm/kvm-config-arch.h +++ b/riscv/include/kvm/kvm-config-arch.h @@ -124,6 +124,12 @@ struct kvm_config_arch { OPT_BOOLEAN('\0', "disable-zvbc", \ &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZVBC], \ "Disable Zvbc Extension"), \ + OPT_BOOLEAN('\0', "disable-zvfh", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZVFH], \ + "Disable Zvfh Extension"), \ + OPT_BOOLEAN('\0', "disable-zvfhmin", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZVFHMIN], \ + "Disable Zvfhmin Extension"), \ OPT_BOOLEAN('\0', "disable-zvkb", \ &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZVKB], \ "Disable Zvkb Extension"), \ From patchwork Wed Feb 14 12:21:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13556395 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B6361BC23 for ; Wed, 14 Feb 2024 12:22:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707913344; cv=none; b=EYqECfoWz/D5D2/xsUpChe5mdAXyHOT0ASEfjB9/6G0SZVeRaAQtpm6jKETKeCzaOdq5rUGMHUKyOS4r+KSmCHJngJXey6+bAcqYpTbB40f0rI8ZnEeSP0a1sEuKlDPHJzd5VlFYEDSJPoiP3id6A1jmcjbp/6CDw6q6Z5ecQ3o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707913344; c=relaxed/simple; bh=xlPbLZBvKkdxUBtEAJ+L9SekTqD+Hm03KeTB7HFipLo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CD3XUibSD7+xiJGNbVmSoN2CtWCXnm6iIRbCknhzCc+R57Zm2MH7bTl22oDOjwQOev5QYM4jsY6p+UszKbZlfjix1R4GgbTBHJ3wnDID27z++aV29CzF4yWdDWx2tgLIEm2MBwVTyo7mCet7M3oHONb/cB2Kqv0OCJTR8I5eEbw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=JbUBtiSz; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="JbUBtiSz" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-6e0f4e3bc59so1481029b3a.0 for ; Wed, 14 Feb 2024 04:22:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1707913342; x=1708518142; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BIXRz6EyWQfNdjp5qvvOmQztA9TRpuUypiRGbNjXHSw=; b=JbUBtiSzRfHNGNVaI8ys8xyZv6VYZWQZZidWnbveGXD/wdBo4jsPx/0o/HVua1WtCw MI5BkZZiMvxDwFWkCvmcAGXf1Zljen6KhMkryxwPLNNpKgD+PAIcpOmQ9736svwGJd8v Hjafdekqp4FjHCCY656pGdfgzTHuD/R4HoC0TQjkp1zMPVmCsnIUGoDiIht6oZ5doPFc sY0/MF/0M4q4plr3z4msT4T/e+gxo9EreC9k05M4fyE4OqRlavR94gHZhqnPvpLf2IJS HbkquUDF7LAcTZ02KGkeQKPb+tJR9WAwT/7S/HDMkJABMTMDeMuTjcoIUqk3Pf2hyzWY lqZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707913342; x=1708518142; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BIXRz6EyWQfNdjp5qvvOmQztA9TRpuUypiRGbNjXHSw=; b=d/JGRuYCTWTHZYlafr15aoPqOa0yk/wk6BC+walP7rjyFkhjTrKHZ8Gebdj4KSGLvO syIsbJxn/FEJP67h8DkP7m9Uq9bDyeD9/7Q9w2+eAgknB4uIKhNJ2B/0PWu7K3iRuJ+T MDZYShCXglCJiI3QZT62WkH5D/es7LfSj5FK5U/5tNVBdEsPnB05cc3TYtZLcXkenkpK b97pDwp2TGt6pYfAxfPhhWTC/Tcezwi2l/hd7ALJbCys1C/qMroBA9CfrjClJ/AF7HjB sO3B92TwoNUIDVSqXcUTtIJDsFLL0JvVwOYj5s3jEDIMSnmgb9A4B81/Nfq6DJnwXZZs LGIA== X-Forwarded-Encrypted: i=1; AJvYcCXNVS8AsK+H2f4hClJlvuUNiHNeUZkZKqPXXomfbJg11BMx5fPtCcexDYlhqpxkRuvFc/wOb1/Id0wHgqfB6mevJfDt X-Gm-Message-State: AOJu0Yy7HDU9jiG3j77wEP1dEdIGQHBDPOZIeDA6vQuhAY0pBYZi9XWB LqlP1KoQ88X0vKRAXWFoCHoLUWgX57L807AWoIpV5Abx2oFPq31EZuHszWickZA= X-Google-Smtp-Source: AGHT+IF4SBbzY4krg7h3GKfiSobUOEAfykSn0IYuhmfqB8DaaXEewiw2EnzFMNOALrIVbhuOkUQ+vA== X-Received: by 2002:a62:ce42:0:b0:6e1:159e:a5ba with SMTP id y63-20020a62ce42000000b006e1159ea5bamr335556pfg.31.1707913342503; Wed, 14 Feb 2024 04:22:22 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXAhfRZfHNE/DpcS65XvdUoKpo2xtOVeSlMP8h8N2LMX3NZH1cyXN367oRd7FJAKi7BvsEKsFdP25wjrsyoSTnWrDfdXcxHbuxdZ/bOBJe2vqHC/W6e/X5PGb9vv9xDQuCDdUBQw+N5MIHSx6+JjY2KyXSo/3PwG1E+a6H4Hsq0MZNeFLfa0AsYC5bDXgjX0UAchOXRwg8wSLCvRUVLXC2+Mp+chVWkXnd3efUuvV9RZnl/pMFBw31cWkQQDF4PLibMMaXbDlPvn578Sni9JWNoG1EY6Sn369if1drVx9vPtomGTBPmsJF+OJdS96j0Iw== Received: from anup-ubuntu-vm.localdomain ([171.76.87.178]) by smtp.gmail.com with ESMTPSA id hq26-20020a056a00681a00b006dbdac1595esm9496060pfb.141.2024.02.14.04.22.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 04:22:22 -0800 (PST) From: Anup Patel To: Will Deacon , julien.thierry.kdev@gmail.com, maz@kernel.org Cc: Paolo Bonzini , Atish Patra , Andrew Jones , Anup Patel , kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, Anup Patel Subject: [kvmtool PATCH 09/10] riscv: Add Zfa extensiona support Date: Wed, 14 Feb 2024 17:51:40 +0530 Message-Id: <20240214122141.305126-10-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240214122141.305126-1-apatel@ventanamicro.com> References: <20240214122141.305126-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When the Zfa extension is available expose it to the guest via device tree so that guest can use it. Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- riscv/fdt.c | 1 + riscv/include/kvm/kvm-config-arch.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/riscv/fdt.c b/riscv/fdt.c index 005301e..cc8070d 100644 --- a/riscv/fdt.c +++ b/riscv/fdt.c @@ -29,6 +29,7 @@ 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}, + {"zfa", KVM_RISCV_ISA_EXT_ZFA}, {"zfh", KVM_RISCV_ISA_EXT_ZFH}, {"zfhmin", KVM_RISCV_ISA_EXT_ZFHMIN}, {"zicbom", KVM_RISCV_ISA_EXT_ZICBOM}, diff --git a/riscv/include/kvm/kvm-config-arch.h b/riscv/include/kvm/kvm-config-arch.h index 10ca3b8..6415d3d 100644 --- a/riscv/include/kvm/kvm-config-arch.h +++ b/riscv/include/kvm/kvm-config-arch.h @@ -64,6 +64,9 @@ struct kvm_config_arch { OPT_BOOLEAN('\0', "disable-zbs", \ &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZBS], \ "Disable Zbs Extension"), \ + OPT_BOOLEAN('\0', "disable-zfa", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZFA], \ + "Disable Zfa Extension"), \ OPT_BOOLEAN('\0', "disable-zfh", \ &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZFH], \ "Disable Zfh Extension"), \ From patchwork Wed Feb 14 12:21:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13556396 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF7691BC23 for ; Wed, 14 Feb 2024 12:22:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707913348; cv=none; b=K7AMdRTXU4Mf0+1RLN37RARakjfPwCWN6IB/HXcni7V8FRR3vWNL0t++5ivBoaNuX+528dvDBpSfgttKsgHRYylrZH/e1PN3FajfAOI4nPZkFg/tecfgohWFNTA1RikukIXfFnGdfBLpSM5g6VZyewzQFqYh0O7KByw19Ri2eUg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707913348; c=relaxed/simple; bh=FM8JJcijXwGvhwqUGfo3hl8R96UIlvkLcMUirnZUWYM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VLiLHs6J/B7buz/AgPmLOmR+CbPXP/KQzdbt8w2rHiFC/MmNpVh2vTtJJD6IXSuPsSa8PkKclX27C6a9lcMHPqtqe9ITxKSQucWhI2bXyUt5xE5go9nHZkRrTzGMoVO1ZpEVOM/xSVYDVX47TQLfYc4OBenUV7Kt4Q3jZNXeQfY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=UJ/LA9Bs; arc=none smtp.client-ip=209.85.210.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="UJ/LA9Bs" Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-6e114708b67so127683b3a.1 for ; Wed, 14 Feb 2024 04:22:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1707913346; x=1708518146; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9C1EGpCLcxou/YpDDLj5lw71FvQ1ltUDDgItP+qJmT0=; b=UJ/LA9Bs8ZO0BRgSRlWuDNYpjeFqfpZNsS6dYOH7BRJsWszL5k9e8R4REiQqByxg5c p7R0Sg0wwFYgrXgsoRQR7MhbC45jtk88bWcRn7kS4rUPIPt2kM/QEnvIbUjVaNleO5Te htEZnOw2lLEoDPwL32vyDXHJ1qEi8IbQjcYldb+7k3sZRqsrKT2k+on/MRONbpNDM7QQ IYkJA14cBO70BdVcswz+eqqHjG1rtM7QtzwsI7dMi0Jc3B6K2HGmPTgaOBA8zxiz//MN /SmoJclg3eGiTIYG43gZIC3+oSRO0vcmZbKA2qyQq9ODN+AhXJVbPIle9Kmo8eVVP38g a6uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707913346; x=1708518146; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9C1EGpCLcxou/YpDDLj5lw71FvQ1ltUDDgItP+qJmT0=; b=hIFHLmEvDzKb6KtJR6JTRCF9tu1ak6TZ1ibIr6v8cOV2P+Yba5vYWS7ew5kkgo1nk7 BlmJlrQUVs1Ggrcub7lU6E0gPzF4ErHx3QD3iIHLuSJWbosPeQ2paoMzaSX/mKnEkSpp F3gNrNhGJQfroCjQ5B0Tlbz8knErrwhuxnbzbu5lhBPtIb5UD+Lrg6l4ZwQoZ8m3Grvq kfVC6JeQIZCWnO+WBoF0qcBw33pNIM2Y5afzaSK3U+fpfIBVnusHpucNaCNbEuKr9NEY WI81QsL/61HEpWCTNbX1bGREmPxCpR6LiJMTk2bE1A4o53a6naal0LO6T2PShtcfRqJS 7XnQ== X-Forwarded-Encrypted: i=1; AJvYcCVT+FOUMGHcXRYip9gbjJtfTQeLcYmVYMLCymnN4jDdFsDeWuunZDvEN5glC9RBieQTu0JMJQNQVn6dZuYBC6PLgFoc X-Gm-Message-State: AOJu0Yzz4RDgSqUzr3hUyXQtj7tohPYmTE4+LfhexeSymvm36hHln+Gs 4nnKLqNHNIVsObcgthl8y+4VM4zJyg5QE5Epqq+r1oMHzD3SP2SqlzT7Ru3ap0c= X-Google-Smtp-Source: AGHT+IEd9EmDHvdyrl4sNbWVOK7l4DrpU2Vek16busKhtxakrRGUD5bghoZIvvWTdAi53btmngg9Og== X-Received: by 2002:a05:6a21:670b:b0:1a0:5a2f:bfca with SMTP id wh11-20020a056a21670b00b001a05a2fbfcamr2261950pzb.0.1707913345939; Wed, 14 Feb 2024 04:22:25 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUEP9cFoCcRbhytiU7SgBrNLRMTvsUJt8RZhPOFRupZKHPosbqEXPH24R1S9LvEyvr9TQhyQBMB0QzTMSOQFuC+BaUbKixR8+x3FOxUKBzyrZqWdiEBasYZMncViV5tQUoGHXU6OJdbSM1phk1I3gBVtFKKdrJtHsHl6FjOp7buZvcXs3sQhzNqYJYMNhwFIUbf1eO8oebQnOqM9lpk1rd4SSdXQqbD/ReiJ0Tr08RGA40/oPUVocHgRGg8t707Sxh6fc4aWj1FVMoV+CW99RMW6lAxt29t6WAnF9DgjZZLZGo2/UMr/cchZcJF32Ur9w== Received: from anup-ubuntu-vm.localdomain ([171.76.87.178]) by smtp.gmail.com with ESMTPSA id hq26-20020a056a00681a00b006dbdac1595esm9496060pfb.141.2024.02.14.04.22.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 04:22:25 -0800 (PST) From: Anup Patel To: Will Deacon , julien.thierry.kdev@gmail.com, maz@kernel.org Cc: Paolo Bonzini , Atish Patra , Andrew Jones , Anup Patel , kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, Anup Patel Subject: [kvmtool PATCH 10/10] riscv: Allow disabling SBI STA extension for Guest Date: Wed, 14 Feb 2024 17:51:41 +0530 Message-Id: <20240214122141.305126-11-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240214122141.305126-1-apatel@ventanamicro.com> References: <20240214122141.305126-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We add "--disable-sbi-sta" options to allow users disable SBI steal-time extension for the Guest. Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- riscv/include/kvm/kvm-config-arch.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/riscv/include/kvm/kvm-config-arch.h b/riscv/include/kvm/kvm-config-arch.h index 6415d3d..e562d71 100644 --- a/riscv/include/kvm/kvm-config-arch.h +++ b/riscv/include/kvm/kvm-config-arch.h @@ -186,6 +186,9 @@ struct kvm_config_arch { "Disable SBI Vendor Extensions"), \ OPT_BOOLEAN('\0', "disable-sbi-dbcn", \ &(cfg)->sbi_ext_disabled[KVM_RISCV_SBI_EXT_DBCN], \ - "Disable SBI DBCN Extension"), + "Disable SBI DBCN Extension"), \ + OPT_BOOLEAN('\0', "disable-sbi-sta", \ + &(cfg)->sbi_ext_disabled[KVM_RISCV_SBI_EXT_STA], \ + "Disable SBI STA Extension"), #endif /* KVM__KVM_CONFIG_ARCH_H */