From patchwork Mon Mar 25 15:31: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: 13602430 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (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 6C4D31D69B for ; Mon, 25 Mar 2024 15:31:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711380719; cv=none; b=pKzrhC/e9paZTfiPWtpKw/ffZYKA28IcVQwaH1qNuDNVZ7YJO9zuLHQOnwj+vezRJhHif3D9GWzlznTL61lXkYM1bEk4UV6JIPWjlxPNl25iBWPzcKftoclRmmeDYslv6R5FrkeVXNNqEIh/PdIWaZd0kvwPiS5MhnpsbyHaKvI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711380719; c=relaxed/simple; bh=eSCPp5BZR2FchMsq+62Fxq/ckhn8vfDXgrh80QckDOE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NCf24BGe80TjWR+pOEesukJnTA6cREYE7Aa/NdiJhvLJSd6/i5yflJc6B2X4cl4Wwdkp5hIHBGi4WlDirAJP2MgdfB0yE99JAxjx9MAgOZER+cooETdTTbXfaugHNdiOgQyyQXpzgkRUyH08AootExQJdoAyYRdV/CgtlYjk3IM= 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=P5eQdbNw; arc=none smtp.client-ip=209.85.214.173 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="P5eQdbNw" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1e0025ef1efso26856565ad.1 for ; Mon, 25 Mar 2024 08:31:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1711380717; x=1711985517; 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=P5eQdbNwTDCn0IESRmRMGYDI4oVpxVBsqxvTa4gdWllx2Q9jjRuYvOWOY21AUaMum1 Ad5e6cgcYRw0ycFnyfLmB63sngfwJpAVcdW5GZG8C+xwJvn4G9VkB95kALzkoCYnfJGQ REr+V6fnwjDRV8OhU4um8NDRfmmZpi+qAc973gaR0hyYW+0Cnt+BbajCqaUxW5N760ki SYtRI4us0iPX9HJR6pm76yoZ9DMOCZDcAAQypkTXGFsAH0H0W3z7u3OkTI/b+1E3WurZ JxgiNbxHG17K0sJB8/8GE/GiT26JrNAdqmbkFe0Kz60Q6iU5qAfZx7RAHpmbY1A0fuYx 72Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711380717; x=1711985517; 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=QIPpdaJuxV+Z0F+tYbIeknLMWCBMUAGkmRPvrLKx+9CRbtuKtACRjOKpkb7mj3Gs0T biwj9obOLeoFHVgLuveUU0yPMcilUdugcLLJmThQDhwpnp29MMnWbKXwCVCMliQUfTKO +SXHqZc+uHDl4LsKv3HknHs494RG8kuUPt3maMERnaPXCfgVeDeM0wVJ4MOs8yFAKk9I 9F4C9JW5e5KCl99ZxknpcIR0eGe56lL1AV0EMHPsoku117ayl0bzy/Cv5kysUOMAkyf6 rA23rYaIKlTNeoul0s8pCeABnxm2yBqefx4MoFeGMgDev87/k3fqk8L0/LIkFOpx65up jy+Q== X-Forwarded-Encrypted: i=1; AJvYcCWkNE9hpH+wBl59+z6XMPY5+KI6j3SiA2oIJe5ByZNfKxrXycXSzj+WlXEn85WCLFNuHdeKSEDD/trix7/xAUp3LGCR X-Gm-Message-State: AOJu0Yw9ehP3T15Hq0frrwNTNf/OHvpkhfZAlvo7Q7RGxxogrSST7IwL BtDtTJToq7QnD2whvA/dJc2KrP0aMGNoVBUUUS1rRZr4lN0jvMbzsY80pfiMsg4= X-Google-Smtp-Source: AGHT+IEidlt4z9SzrxAHUotdQ3IKzr0Y8v3yZjpPFay5QiMwGlg2ZNJy9hgCxal0AM+PapbOapLOFQ== X-Received: by 2002:a17:902:dacd:b0:1de:ecb4:79ca with SMTP id q13-20020a170902dacd00b001deecb479camr9628371plx.25.1711380716505; Mon, 25 Mar 2024 08:31:56 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.87.36]) by smtp.gmail.com with ESMTPSA id u11-20020a170902e80b00b001dd0d090954sm4789044plg.269.2024.03.25.08.31.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 08:31:56 -0700 (PDT) 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 v2 01/10] Sync-up headers with Linux-6.8 for KVM RISC-V Date: Mon, 25 Mar 2024 21:01:32 +0530 Message-Id: <20240325153141.6816-2-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240325153141.6816-1-apatel@ventanamicro.com> References: <20240325153141.6816-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 Mon Mar 25 15:31: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: 13602431 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (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 3D4231D69B for ; Mon, 25 Mar 2024 15:32:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711380722; cv=none; b=YQHNJoKD2oY6Nio8aG9ke+1lf1CHcmB9cYVWNITlrsMuZ2iILCIuspVUD8xZDvfFH4SZvBkbJfRknxHfQxe2uXxF2cWw8voYk9llpx9lL3qoFQsr352xE6qSVOfK9QgS0WRfsGaF56M3Gss7zlOg98KxpcuBlaQ4oURV26Eid3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711380722; c=relaxed/simple; bh=gx2vTofXebLP6JVlkEb2oQb0fWvIH2qsTnYAPuwH21U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LjWyfJBLe7V42Mx1Htg2A9z0jpIzI/LIrrWD2jQSwbtwLSFYch1s39p2jTvvZs7K5hzpBhoezWfPyDxMr8PF9nJgvEDwYSHxpCRmlXFaETW8gzOgDiAa6o129w5vHa7f8JwPkUTImlhQkNEKlrQmberT9evgsh0LmTecdGI+cxc= 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=FKuLKAG/; arc=none smtp.client-ip=209.85.210.170 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="FKuLKAG/" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-6e6fb9a494aso3459375b3a.0 for ; Mon, 25 Mar 2024 08:32:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1711380720; x=1711985520; 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=FKuLKAG/BcpS0Dtd9uFeJ0J1McFKfqxbAo0/dPV6tYiGa5whmvrBx90Lx4jxyUj3aD fqm27WVJ385Wg2MQDRxbazTk66ZiEs2PRAzY54ZaIocWVNcl4wOEXisZlyWfGTgJvi5r eby2WFubHHwHDVE9zMMko8LujbZw+WfmghJGDsYXXGeLopZih382+lcUSjbVyn00ISXa SzlfW421tsv+HcKKO27E4WwYVjGiRZMO6xb8rK1EZJE7mWCLdHHAEnBrKv33R/mCAxB0 jhq3sCRqSeZsFSeABgRBhk73BUFJJYfT1exg7itl8JYpVsTETb9poG3f4CPU0G+dDfqg FW5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711380720; x=1711985520; 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=qTHtO2ps6fe6sb2M8x4B+h8sN9t0/AGEJ5eBqbodSj+z4y+1H6gx5U2uglajJfEdRr G1v6sGVK7z72pE7UZHLg9RX8Uf9nYL3MbXtZlpAPM8MHQc006/JNZ+ij9bX+GNmAp2Nv 1Cas46ar6Hfv2XhaSL+PZW/7I2BZJCkTJ+GK0N8VyqtDyEvr7oAbe87DZj+feETjQCZh td15HvbqbJxRv4K5021q7n7Z16AmITzLMXHK4Cjrh1I3+jgumscayU/Lvsa+2Yj7+/mW VvAG4kkZroy4XhVFiB932H8Of/xQ140zvZZjV9SEdrPn79Cs+REfyr3BTgmlkbs23uud 66Ow== X-Forwarded-Encrypted: i=1; AJvYcCVQ/hIsk/Tts5SOxMI4+haBXES+mJR8RMmLbrV34qVzdMX/HBi79tgBca0vzvf1DCt4xlW/uPoDCM5H2JX3Zzx3B3hs X-Gm-Message-State: AOJu0YzMdpfgDvV1GdSCs3J80PcSoZm5odLub+g68TgPkNgrAqBPMqq+ Y4xWnSGsDaAjmShyXHBbrq8WrHjNBpyoAzuWsUbSvAw0RWl/JVw/h7RMUtVof6M= X-Google-Smtp-Source: AGHT+IGgCsS+vxU2FHTscoGAW+/TuWSqpGlQQADJWzmCBbL3CpLtJkxhJgat1JMj3DtVFxdIylb1/g== X-Received: by 2002:a17:902:f544:b0:1e0:d0e8:b083 with SMTP id h4-20020a170902f54400b001e0d0e8b083mr1246206plf.51.1711380720508; Mon, 25 Mar 2024 08:32:00 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.87.36]) by smtp.gmail.com with ESMTPSA id u11-20020a170902e80b00b001dd0d090954sm4789044plg.269.2024.03.25.08.31.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 08:32:00 -0700 (PDT) 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 v2 02/10] kvmtool: Fix absence of __packed definition Date: Mon, 25 Mar 2024 21:01:33 +0530 Message-Id: <20240325153141.6816-3-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240325153141.6816-1-apatel@ventanamicro.com> References: <20240325153141.6816-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 Reviewed-by: Andrew Jones --- 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 Mon Mar 25 15:31: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: 13602432 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (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 6F2AE481DE for ; Mon, 25 Mar 2024 15:32:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711380726; cv=none; b=r1RgEekJiI9ybFTKDDzmIp/U/sYrTwnfFhsGxeRBCvwFdnVslvkBGmzkCVHm9/EzU8kR0WIyniO0knUX3SYWMAo0tlr5YkP2BFlH8ddW+HLCRz2R1Pzb/75WRjoJgBKkJEjEUO2QcshCbXYXH7tb5yAhfAk8gNsBJGtViObWAWg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711380726; c=relaxed/simple; bh=GW5z7MqJ5aLA1CF/5n0v7FHh7UlD/oGdqRRJKML6+Rg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sF4T/+63y+X7mhz+eoxVyj5MR+m31kgM0p/zjZISkqpgmofqG6kRC6Bv0Tt816Iq+Zcu+8xr3gM2HMNeGOyL8CuD9KgSsYhuqqpgFAwQ/2fMtSsEqN8CxowxkK9i7IgVq/g6QLY3yC+56wDbHZ+dvsZ6Nzbw+JRlhX6nLNWWZOI= 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=USsZK2vt; arc=none smtp.client-ip=209.85.214.179 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="USsZK2vt" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1e0878b76f3so21699325ad.0 for ; Mon, 25 Mar 2024 08:32:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1711380724; x=1711985524; 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=dsnDKpOPK6NSHgg6UVlxEBFTpXYmQ0vw53/Q6mnf+qo=; b=USsZK2vtcgjRPlVvns6dKguou8ci2pTSRNYvqbxSxNn6UBjxCxwg4fpgESECNFs5Zw xxvTJKqSLKtxi9GdyRGKKVBIXpEK8WhHYBAtfp3GDbaVQJNhohN8iBtAOSbOBr4w29iF b8SGPHKFGkZpmJkd6uUc3g+npimPv7UL5APADUHXDoBUBV9VkSLlqfyX3tYPCHZlyK+1 dvFddYA9XEO3x/fDi9w/gITR2i1G9Z8fvxi44D7j6S5YzY5TpB/eUKQtPOpX854DLt98 +aXQyDXXg3oAd+7kLraa7vUaTLjtmqBFz3R4lZtpJfyLcVcLjbiVMxU5mLLM/qa7b8fi PCkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711380724; x=1711985524; 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=dsnDKpOPK6NSHgg6UVlxEBFTpXYmQ0vw53/Q6mnf+qo=; b=ulAhzYa2QNre9ZqexZne/yQAgg0L6FZxMf9XKiH9ZY5U5i45LWndSdgPArCgqzqG33 g7It2cXlJ9qlWtY4HNrGH9dpLOSrk3+tOW3U7OFTvNnb9rqq5Af2HFnegedc3rS/5VTs sqArwJEe/1wTc+VaW1VaC/ENG7pRLOA+4Lgc0koEKVSxcfY/Pe+eKf8TY/cPh5pS9iXV PlmtfSNDYHJe57ZOnQr/ECdQiNMXRxUbTaZQ+P4k4QHm9/oDN9kTnFLLGlDgrndAstF8 a48cwuX0T8k8SQMgQRfoUW4b7RWdgQyTMcHYyNtX9MgRRxG4eEtclI+hsfaMUW6Fs+D+ WyKw== X-Forwarded-Encrypted: i=1; AJvYcCVoe1nAQrSCqT86KxMHsoDO19EVpizZ2Ie0Yp2ZQiNTbnMG9+2Qgcf+tjROn1lcdiGb4HlLv671Zl0jYC/L4zzTMP2b X-Gm-Message-State: AOJu0YwVnHtp/rvLN6E+2RbumLiFBSNaUj46XPvJQ8yNGx4Z+NiwT/Yb LbRK2vXKdwYMbaDpVFe9GgEwWBVQCmaLOrVMrbZOfh4FQGnwq5NTfee3gEtJMk4= X-Google-Smtp-Source: AGHT+IHSbQ6+kvovnIpRkDyDtxvcwtzAc1RLnLaAypxFjW/3T827fUsWrO+zRjaJAb7KnzljJYcfxQ== X-Received: by 2002:a17:902:d4d0:b0:1dd:df89:5c2 with SMTP id o16-20020a170902d4d000b001dddf8905c2mr10066270plg.22.1711380724452; Mon, 25 Mar 2024 08:32:04 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.87.36]) by smtp.gmail.com with ESMTPSA id u11-20020a170902e80b00b001dd0d090954sm4789044plg.269.2024.03.25.08.32.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 08:32:04 -0700 (PDT) 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 v2 03/10] riscv: Add Zbc extension support Date: Mon, 25 Mar 2024 21:01:34 +0530 Message-Id: <20240325153141.6816-4-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240325153141.6816-1-apatel@ventanamicro.com> References: <20240325153141.6816-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 Mon Mar 25 15:31: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: 13602433 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (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 2389C4DA11 for ; Mon, 25 Mar 2024 15:32:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711380730; cv=none; b=GXXxlokHxlUed5YMkrINteKQD8jl8S9tztfSszTcyZ5LGgyBQZm4qM5BN2E0EGFEtw/8heYIiTF7S0lvYCJE0SOX0t01mAcWJ9fbvIepCikwpkfddccRk1F/WGr9NSjSOPSt5R0bGs8lfUB8Q7iElxaek/Tn/YeaMkZOdQuSkUQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711380730; c=relaxed/simple; bh=Toen6tS0ClDye5WWdGidypJLDNjVy0u+fHU/JZlMUXw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=g4Mxbxe0jxcEFEvzfJejcnwWlM0cSSspPMdgVFqVx77nnvVKunl/JFQFaTj2gEXpZNNvF8sTvwOtZ+vDpbJuazPFr2UtzAsBNsBclb7isFUoIltz+CvgWahQTrZn02ihC2ZiBcDQc5BV2QSa5UCMBdxSxz8S1jRemuqfH5WRlW8= 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=LlbFlHTZ; arc=none smtp.client-ip=209.85.214.172 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="LlbFlHTZ" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1e0b889901bso8545995ad.1 for ; Mon, 25 Mar 2024 08:32:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1711380728; x=1711985528; 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=ew95XvvTol4/ofCLLLZzdrFLR5bnldw50BI/kwmiGo0=; b=LlbFlHTZK87tSiCtO3RVA/k0LYSCtU5sRQWzyUWhC/+m39kUvuomCGMYd4XQm4U9l3 f+I1X1CcolMtOYnA8AoAUEXR2wWrcTwsTa4wcO3RMiSwM4bf/+FuqH+grXeuZ8G7xe1J tf/kKopWKUuoPkqzAw+ZLlUoTQwbAjQStd3DF/JdEHUQrxWOTJPBcdYtjHCOrSZ6LdYH Xx/C69sM5D3cxje8+gFuQ48uXP6kVRliZ2FWymq0oCiJCZRXoFUCAhpvWJO92qGOZHFg W9ExfGf3OgYzGQfErgd5wUEmsct63iUwdLX/79uLxeaR7R0YhSPdqIJ0CROS93QSCG3N saOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711380728; x=1711985528; 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=ew95XvvTol4/ofCLLLZzdrFLR5bnldw50BI/kwmiGo0=; b=cBLFn8WBRidP+sue4qUzmOEur4nM+jReBfIWwDD+CC7noAlQ0pcBelRyxeKvvCnm97 AXnIN+L9vqs7uC3UYejiuVUFbWxY/DT5BMaFcuV6j+3gtKmQBJoTmIo6S6m/y/+x3SKF 25MtoCx9MdPz43NuRCwDQ0AaFqCJwc/rOthGUj3CDOTenKY+z24swYvb4V9duzRRO6bK V0nQOII8aOC9ww0zDYZGsm5ub6LlSY715FbnFSK6l3S/m03fSkZxSRvCci3GotN2ZQbW xiGZlFJCb/MdFwtD8Jn8PzKmBYY84SlAlCVWBDntl802x7Z3SMEfOZTrSetir2o4m6sU +aDQ== X-Forwarded-Encrypted: i=1; AJvYcCWm584rTIoHba3HjXbJbUo4tFwm0s4V9AKEZCnr3Gx6oH2nSyXzN7LlYtCqUGV89uVimT7qej/BvxmbQ6PnzMCQtkbi X-Gm-Message-State: AOJu0Yy7+59qGc7wOpUILQvZZZpHfBUU3hfYk5zulQxpTbzaCzSzyPTd X4I0Y+rwywgTwVVCVRhu0IzDBNbmAWxV3qfUYg4oXCNz6irwWTwbAyIQ5j6bx0s= X-Google-Smtp-Source: AGHT+IHd01HEQle7MFWsl8lSOS4t1U0+IipUIywyfXGAs11x9EEwtIIw3BQVwHEoK4SHC9n9Bm3zww== X-Received: by 2002:a17:902:d306:b0:1df:fd30:8b2d with SMTP id b6-20020a170902d30600b001dffd308b2dmr6112710plc.50.1711380728296; Mon, 25 Mar 2024 08:32:08 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.87.36]) by smtp.gmail.com with ESMTPSA id u11-20020a170902e80b00b001dd0d090954sm4789044plg.269.2024.03.25.08.32.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 08:32:07 -0700 (PDT) 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 v2 04/10] riscv: Add scalar crypto extensions support Date: Mon, 25 Mar 2024 21:01:35 +0530 Message-Id: <20240325153141.6816-5-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240325153141.6816-1-apatel@ventanamicro.com> References: <20240325153141.6816-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 Reviewed-by: Andrew Jones --- riscv/fdt.c | 10 +++++++++ riscv/include/kvm/csr.h | 16 +++++++++++++++ riscv/include/kvm/kvm-config-arch.h | 30 +++++++++++++++++++++++++++ riscv/kvm-cpu.c | 32 +++++++++++++++++++++++++++++ 4 files changed, 88 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..bcbf61d --- /dev/null +++ b/riscv/include/kvm/csr.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#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..ae87848 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,42 @@ 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 = SEED_OPST_ES16; + 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 Mon Mar 25 15:31: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: 13602434 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 18D164DA11 for ; Mon, 25 Mar 2024 15:32:12 +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=1711380734; cv=none; b=ZhbtyzdbAUDH7RglDQ36agWJzsAnVzgVmJHGGOn7ksl4fQSJ9hRH0xh7zuEkXrlr0RCus4mkwagQvT+GB+QmbpE7iUz5x7PeM5LhRa3v44coxvghnUMyUqrVETPgefNEA10HvpLWxa+hhbDdHMfoHOXQ3Sw6TK17IkxzXdHFv7M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711380734; c=relaxed/simple; bh=G9ZBiWINEVrRqOgA1UbsuWhoUIZXZTJ716OEPxAhhPw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EnkZhSSZdgL7uybqCty1TJ9fRjGEtXQ23jFA0vU7yi9cUHpM4+4bek5ayU34VYmtxHRR8rV/btZruPLTZMYI/YP4SrmFlD/zAY65kDfcnu5RzTQqvjKEbNeerecm9mMCKDanlHqvSTNwEykZ7ThJ0yZ9/IZowidmB1+PQg0qnAY= 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=AS57uGVl; 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="AS57uGVl" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-6ea9a60f7f5so1501617b3a.3 for ; Mon, 25 Mar 2024 08:32:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1711380732; x=1711985532; 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=KR4qc/aD91W6fk1Y+xlYy6RF781gGiM4VPBpe+upgXQ=; b=AS57uGVlW0urrd2Oy6yVAe/Fnzq5mA5D7i299Re2kP2Ou4fTBfLFKl/ycQxLOe+x+R qpnKqglCPxAFV5GqoK4nh5X9Un/KE06lsPyTR8ZZjy0D/TZw1lMW5Q/JD8ibQiqCv3/o sg3R1AzcdCSBTGJWBZiyHB91Hv0pVb/M1Kt/Czg/rpI6Ob98UeH8PR4ih/BSCAFuw376 5x3n38E0aB8mNMzpTCPKA+9UR4aGRDbY/0XbjDnXHUc0yuPQirMGfD+Zu4ib1sSmH8fM D5FfMQQkKnh2qyhqLXbdna0GLqbeDd3mD9rhUF8L9OKCPl/MZ2r+bIcdmkkCV/HcNRiY oIxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711380732; x=1711985532; 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=KR4qc/aD91W6fk1Y+xlYy6RF781gGiM4VPBpe+upgXQ=; b=luPKdk6qcMfETwXSAWZ0e4rbF5bXCot3Jj1t3q1GSMOKfCl8Y3pbd5gkFORfrtLQJa 1JaNQEb3BPxC5SQNQTXnXePGArY9yednN/CCc22yd2unkv9mRiCqLpdfieyPY8rFp4Sc 5eWjrmLFHv55mIUBwMdJUJljxx78zoQ1wP4ZNjQtSBRAXsrhMoOd7IZLxHf+e4gYt6gs kR94C8Nqp5AdoZ2pANUIe/GJVZJMqQ6hXtidh7EpPkJ7mnOKbeAtBp9OPkrncZhHnWhH vaZo8Cs0iz1r/lc5WOp+6dDIL6LZiiNbufu6el3wKzy3UdRRfzNiRvBjvUMyVLbGyBFr aA5A== X-Forwarded-Encrypted: i=1; AJvYcCXqEYgQ8PZQCLU4ghjhF0gQ3EcpCIRTPkjc2K4HAf6Xsl7o2vXlOiqmowAbKSq3xKdSVLv4hntPuK3UnWLz25Lacr+L X-Gm-Message-State: AOJu0YyjaJjFuhPLPqKQN3YQ1/XeiaCB5fVGLp07dyeXg5rmVa+pFU7n XEDdl2HYpAvmFurv0T8NVGb/Zptd3bzLyTQEc2GM1GOqB6NE72aoenCwVgz+TcE= X-Google-Smtp-Source: AGHT+IFP1hGItMy4B6xNWlor7LmXK8dO/OvBS60IrBHLuP2fJtoPNchUrxpOLKst7t8A4NrYscXhnQ== X-Received: by 2002:a17:902:9888:b0:1de:e84b:74e1 with SMTP id s8-20020a170902988800b001dee84b74e1mr5793979plp.29.1711380732227; Mon, 25 Mar 2024 08:32:12 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.87.36]) by smtp.gmail.com with ESMTPSA id u11-20020a170902e80b00b001dd0d090954sm4789044plg.269.2024.03.25.08.32.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 08:32:11 -0700 (PDT) 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 v2 05/10] riscv: Add vector crypto extensions support Date: Mon, 25 Mar 2024 21:01:36 +0530 Message-Id: <20240325153141.6816-6-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240325153141.6816-1-apatel@ventanamicro.com> References: <20240325153141.6816-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 Mon Mar 25 15:31: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: 13602435 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 650EB4DA11 for ; Mon, 25 Mar 2024 15:32:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711380738; cv=none; b=O8sygA04anEZMYxdXkagprmk+bL9YGjYsa7rfG7TvjtHO8X0ncpgp8XiVjQb/pd4wzp+C6Vout71A2U0W1+KEQAjgKhAWiiHzA5r1yyAYWLd8/i5Ts2dXDo8Xdhi4Gzo+EEA+dX+H+eK1BNKgtSj7pZL5QeOFA6mtfXNmoEuPz8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711380738; c=relaxed/simple; bh=e2Jv2Q9FlU7BqxLJngPORhZDXnMQKyhhnHvDE++gJoY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uiLj+/ZBwKVmDtsFUzMNs07Vj1PmUDxfjtldCH/BXAuaOWvDsiHS3tLspixK0dGYHpMDc3GQHFkv6H40x65s19d/CWypQx2XX9NCLKtjCZ2FJz2C6CKX9wovYHPx7jbb8EDR+YZXlIJopEn5EaFB+gYCUQ+7iyiGIpBGadAMZTQ= 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=BGttq1v4; arc=none smtp.client-ip=209.85.214.177 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="BGttq1v4" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1def89f0cfdso40004445ad.0 for ; Mon, 25 Mar 2024 08:32:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1711380736; x=1711985536; 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=4UNZw1HKonYlBZvv+pVqlr0cHdA9JysAQAhjF4txKvY=; b=BGttq1v47P8Vsnmdc7wD2L55fvLE03a89N2pe55pnAPtY5YCRRF+CBrkMlW6yZe8si 79Dxu81JKi1TB40SPp5CKZnCb9fvRYoF1gEBbC3Xo5X3xFItv26qpzxdaZWDNhapaWhc amfP5Qy3ivzY5gDKr5oxGUp3ik62h2kYmgXgErOhR14gtXlBL5YH1qANFit6nHzQDq8s 23a6JvMMfVzmRlNCTzK7q4sja0FX8ia/dak4AGQR5xO7BVBBDOiObZXq8hjWUI4ttj7z 8UWJJhPy7HuHrReI7LqOh0koPEhwkZPG+QzsmQgxymYu7uwThnZnT4xWKZdu1Ab4cDjZ MLyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711380736; x=1711985536; 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=4UNZw1HKonYlBZvv+pVqlr0cHdA9JysAQAhjF4txKvY=; b=TulmIuNER8QJYC1AYaW0qaQRz8w1/7kF2Sa1aqYi38x24Y36rN6BKgBGLZIL3OdDeV nfw2gqoQ1hH/L1ES6T8ASY+SMDQhV+qbW7MMnHNSJmDGP0JsRcfVi0RY7eUENmdFJbZm JsFDlacxnK8n6dYkb07bhal/LlDxYNDWXsdvTdE3VkUZLi6MVv9bEPrPaZcJTBJS4Vvo +RssjBawqoeB/IbvRg027PWMpJsf0uWaW2P+Ck5+mvH5rPD9WSI0ft5eUuUduQuAOpRn 2rlzIEESTDnyBPFutxr2YcSX3XY7UOYAHii+oBk0Q92xXAXHAzf8h0Dyboc2U2GBc/Z/ Ltcw== X-Forwarded-Encrypted: i=1; AJvYcCVKzwemdXoDfa9PGmlnItc6Fz852S5tCb91jVTgi1cPt3Bj3JAdaaR+WPLIwnI/to9QiQGSoZFTinachk+w8rP6p4xz X-Gm-Message-State: AOJu0YyUKrtlAp6LwWBwkFSQB/dlyFGvYCTMsg6QtniSf2THDbjEHPT5 kvcpP0c+9B+ISZpwLAoY3uG2AL+UvwvGGU53S9gOwOtPhRjqsMFPulsGyEGFMPE= X-Google-Smtp-Source: AGHT+IHPwsrs49S6yyD6ygszSBABqNrykpVi23D9o/WsfTyjh2IAWOZRtu/n8Y8pCF6s1suY+ra4iA== X-Received: by 2002:a17:902:f54d:b0:1e0:b697:d3ae with SMTP id h13-20020a170902f54d00b001e0b697d3aemr5903113plf.19.1711380736537; Mon, 25 Mar 2024 08:32:16 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.87.36]) by smtp.gmail.com with ESMTPSA id u11-20020a170902e80b00b001dd0d090954sm4789044plg.269.2024.03.25.08.32.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 08:32:16 -0700 (PDT) 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 v2 06/10] riscv: Add Zfh[min] extensions support Date: Mon, 25 Mar 2024 21:01:37 +0530 Message-Id: <20240325153141.6816-7-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240325153141.6816-1-apatel@ventanamicro.com> References: <20240325153141.6816-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 Mon Mar 25 15:31: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: 13602436 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.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 2117C74C04 for ; Mon, 25 Mar 2024 15:32:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711380742; cv=none; b=dBSm4Lr/K4dptzmnjhB8xyEPJqqUp9KSuWMkyYVWWypN6ADFKbD07y00pkTsuTGxv3ZYUDZFSRK1E+JO2fgs0QxJtuUCa/Zeqp+9LlrCjZIJGfMznUowEZMc/ZzTp+j4bDiwGXYN2EWvkkG3POAZZfB6O9mFGlKBttRDo59Bsw0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711380742; c=relaxed/simple; bh=DP1EWV+DaTZClNbTiC14/4ATSw1RqTbtY2Q8DvhB4vo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gLDWGRjuG4yR1h0hQycXP6ZRYDi/SMs4ljgLUDM+8jvP9SKAgAp9egQOf2RmwU5UY7YAe6LXeWKwRpdsh5ZPtXn3FQDCOb+LFa7iQSoHGaJhjXPgAAsGLzUYH02kFyLrPK9HlTgbNMdB5+iFXm/XdVVTJDWFN7q/3RtRIN1He50= 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=ZsFzR4JC; arc=none smtp.client-ip=209.85.214.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="ZsFzR4JC" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1e0ae065d24so12301835ad.1 for ; Mon, 25 Mar 2024 08:32:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1711380740; x=1711985540; 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=SFm9NQGP0DUDEjsrEvI+7wvK/uTDrnrNenXusq6GWmA=; b=ZsFzR4JCJrg5/R9gEjoDXXQ62mA61+eo6xHMR5mu4aQ6AyA7wBfB5s6EwYHzFMjxSz jDDYJ2O+UjWTrVP7Q0cg75Wm2CZFla9ilOFKe+kLHTjlNMtGNRfXHH6IQXMv+rU1Y18g TirARr+28KjVhOE2Qlf7/u+G6ZkfMUUmPRbV4hTKtZ9TVGcX2EdYFA8e8ngkW+e0vG50 qozRzr/3cxXl2bVtP0FCm+wEzi6KKndv71RSWEHtj5qCKV0ZxWpzKyONxbIO8dswdCZ1 5X9NaJMuxRw1eq0VLTT4ZsgCNEfMymRumndET0urpQzLl5tReQF+4rorGoujpnV4GtJw tMcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711380740; x=1711985540; 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=SFm9NQGP0DUDEjsrEvI+7wvK/uTDrnrNenXusq6GWmA=; b=Fm4AdiyuNnafEeI1oi6woDekkU3LnunVdsQD7QcszJ1sOc/M3DH+X7VZZJf1cc3Gi+ 5zHl4hgpq1++3k599Vz8jAOFPFSQbLfXbUL2Dh8fLNIvivdoAFQr9YdxMBfCkhjbWoSb JiAqxeWR3+EnEtF03zv3SReHcpSB9LzgRad9Nk8OwGLBzYyzLmRrwiCpFxGdaSJ9+7IB 43I27t4K8VB4fxPBAGZllSZT1LHjrt4u+s88yn1Q/HfjD0+bO2w4oK92vxfh5a0cPNc+ AP8CgJJRlbsXXFAuvHJMa4Y5Pudv1Y55sB4JeLzCAkFzVkY/gkqErSA7aNKU8TNJphsW l0+Q== X-Forwarded-Encrypted: i=1; AJvYcCXlXwL8x6j51GKUASb5WMRVba7pC2fwDrlCrOXM6aDpA5P937oMPRE1F4hzDn9VIzG6A6D1aWib8Rt9Cp/TjN8irRPm X-Gm-Message-State: AOJu0Yw4AikQMExaWgrgU4IjF21nrRnwQJagnCrEHUPyWd9qYCrCHhBB 9gl44TNtFD+rgfmBglerQJXItbH6S57c7TFJyJfNH5QIjXrg8L8KChD7RZauJR8= X-Google-Smtp-Source: AGHT+IHKz7diJGkynNyYXC1BSf/dtkbZPeikB0qGgp1b90pjrujts/88PI8LBaP8ykyhNRL+Y02FNQ== X-Received: by 2002:a17:902:f687:b0:1e0:b87f:beb4 with SMTP id l7-20020a170902f68700b001e0b87fbeb4mr3914639plg.30.1711380740385; Mon, 25 Mar 2024 08:32:20 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.87.36]) by smtp.gmail.com with ESMTPSA id u11-20020a170902e80b00b001dd0d090954sm4789044plg.269.2024.03.25.08.32.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 08:32:19 -0700 (PDT) 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 v2 07/10] riscv: Add Zihintntl extension support Date: Mon, 25 Mar 2024 21:01:38 +0530 Message-Id: <20240325153141.6816-8-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240325153141.6816-1-apatel@ventanamicro.com> References: <20240325153141.6816-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 Mon Mar 25 15:31: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: 13602437 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.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 EDDF674E37 for ; Mon, 25 Mar 2024 15:32:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711380746; cv=none; b=hf6vY2SdoAr98l1Qjtc5IyKVFOG1pdrvpN6E25NLdLy02cGicjpVRkAtzzyU1ymBrJCM5w9icEnckY7H/+k93j/SjHzQDFg9ikMXxCnxrue3O32O2xAh11xHOYvLnoNSC1C9Q+c1QNPdOO4MpibWhvwjlTBxBVsXD1I63tiLgIc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711380746; c=relaxed/simple; bh=WQGsUrL1Tt2vMz7njVQ6Z6386puHvbXgRmXaSA6NOqw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ClduNCz5CZ/e8Mqh7Oppr5ChlTE0lxncENERpx07dCdm+zcNN9g99cQI1uB3i5fFVxCPZxqM6qTDnolgRAlBBFmSUT1SiPBxRKR+7aqL/8G4w+QVNbseknJjM2BkHPFj7T5jLn8QMS0yhNFDtVSTMNngxgK4998AG2dk8r5zZak= 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=SEerhQd8; arc=none smtp.client-ip=209.85.214.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="SEerhQd8" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1e0878b76f3so21701765ad.0 for ; Mon, 25 Mar 2024 08:32:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1711380744; x=1711985544; 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=DkCfColGR9bTT6WQltCO6K4bbcIOQkopwMdSmeJg1nY=; b=SEerhQd8OAhKDSDEO3/t4z1Jhmqz/UTsoJ8jHHSQ7+XVuBnsb0IK/wwuiZZJQxrRPZ G4g6cjmxlhjMtkND1U9sX5VnjkgJg9TLviyUxMejDlMyOqn8WCeXVqKSbmkJZT5TiXc0 adjGD/NBgVh5+jtOC6Q8jTGx9TBL+TiWrSh6IitPX18eqVwvQNiA4PkDwXiT1csIHhR1 acIvY9tkn2VILtyGQuXNjieZ8ZD6H5AcQDafbyIpjG7ywmidi5dTqwbPWz5FlLrZvP6j V7wXr8+PKWdEAy6juNja0EK6wvEal+pGci3+OqbcZf1ja9ZHafzc8N6MlSBEmrC5U3DI G0rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711380744; x=1711985544; 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=DkCfColGR9bTT6WQltCO6K4bbcIOQkopwMdSmeJg1nY=; b=XhlWe5bOgSk1V10ouk/23LVIwISTlbheiH/ccvhvnMo1I6rl6sDeHLWTlr+bo0dNwy 1nmIqJUIE/rmr+N9SKhyCOKT+P1p6vZmbWEgsVMiKYVa1HaMSwfW2wn9aPE95F4nc+5M 8KZUis402UQswUMHrMNVyFcEoZL5j9rJAtev2BmaLFKnRcVQFr4/uNoX2NzRVJ9/y4ZG 860E2TNlx4HI+lmpsezVo46UAzkKm8k3t+7sZULAF2s3L75SuPiNuyPIn+Cn46v1VeXa 3lz4Dj3o09cg1zV89PBj9km4Y7DR0WhP1ZlI8FgVWgtMk89GePZ2bkNuODV+T4TspkGT cd5A== X-Forwarded-Encrypted: i=1; AJvYcCUqnbXNap5efGFNGbgMHwqqg5vYio/D34XN53aXtpaEKIFWF3aNmAaZf9uTXaTomxjkxa7I/jc+2CJ8Ulz+DgHpunua X-Gm-Message-State: AOJu0Yyu/1kh9ZT3jNlfpLGatJHDXHjtXtxVFGopLzvBjM3KThErqKZz QhDnaib6/M9aKZDQF1EzlgapeVJlqHXEaiEJPbF05Avuc/QQPeZYEEqLCTFWsa4= X-Google-Smtp-Source: AGHT+IGHFnkbxH0FS9kWv8SjN1JEVLQ12GYixxzAuAG+1JMhlP8qfDUA6Abc1zhD0P1HVn6xauiqyw== X-Received: by 2002:a17:902:da92:b0:1e0:b5ee:e9cb with SMTP id j18-20020a170902da9200b001e0b5eee9cbmr6202281plx.22.1711380744151; Mon, 25 Mar 2024 08:32:24 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.87.36]) by smtp.gmail.com with ESMTPSA id u11-20020a170902e80b00b001dd0d090954sm4789044plg.269.2024.03.25.08.32.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 08:32:23 -0700 (PDT) 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 v2 08/10] riscv: Add Zvfh[min] extensions support Date: Mon, 25 Mar 2024 21:01:39 +0530 Message-Id: <20240325153141.6816-9-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240325153141.6816-1-apatel@ventanamicro.com> References: <20240325153141.6816-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 Mon Mar 25 15:31: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: 13602438 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (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 B11F874C04 for ; Mon, 25 Mar 2024 15:32:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711380750; cv=none; b=eJimvJID9ao7tvfNAl/NwScA++hORIJ660XZ0UzptTinrcobjsSOJrx9mGDH6S3XEOgGSvU732U4Nc4Tz82I1GSBqYsTI0h6g6yHNkj6GJOQVeLXxWWJAftlelPx630fHZow/APN96dMzjL0pF5HdGoLMqaeH/ePANqFYRw+u4I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711380750; c=relaxed/simple; bh=qForT4ksltydvu0puy+RU/ZpC2kYWAEmcusFk3Kzzpc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LL0GJIBxU5DR+ok8iXlcKrTWVE66CLm20sDhdA/3NxKuib+lCXw3+U3XOErPOavbmo1xNH/56Ww2N2CkQ5StoQFnkAyGR0UPgEoMQOoRLxLMHBwE1vF/FLVcMbJx3MvPzjxrBHNcABJn3D5ovOsNLANOIOIz/cs/FNra501ANTA= 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=WgQ1CDrb; arc=none smtp.client-ip=209.85.214.175 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="WgQ1CDrb" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1e0bec01232so7505775ad.3 for ; Mon, 25 Mar 2024 08:32:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1711380748; x=1711985548; 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=DcmWDFYi+hIpyADRApkiB2/o3ThAebVDFFRbt0ZWsYY=; b=WgQ1CDrbAfqu6qMbTER1n7sJ5G/cBe2B+AZ+XOSQtj3Z+QwAMrwfkNs4nC+WCREmws bx4BsSFGkLml5nukwuhl0ShJurDzDWG7a0vd0lVFSFU/pfzlmg8m+bb8If22lzvd4vH3 XsDFTXWnizBJlYJ8R4Rh/O0TKZxDS0cKMsMvs8aVn1rfbQmUcnXK4wdd7WjqNJafrJj4 wkSGpcxrJkh7Go8eit2hLGnkGvbv/51IvtrSXuemZ+9lhA+ayVwRrZTCctqiF+67i26L 8Fe8MR/WsBLoMlXVakPeRaozZNsFbk36cfTdekT9DzKqoIA5EwTZVdRVUpp7dUZWxIAn Yecw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711380748; x=1711985548; 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=DcmWDFYi+hIpyADRApkiB2/o3ThAebVDFFRbt0ZWsYY=; b=KJFkaW+Ada+REPXN5/rFACh7tf0kGdYMfBZM+EP/vG4f0izvigxP9btZHPvwFHsVAH J0LS+3OorHlgVeVmK5w1OeGEWkmEc/EqoDKgwRBHWZM+MtXg8ZdyJ0ftORm+D6jTqASV j7axCL/fQutSZNbs93fVBVycu4QSvMqFDcVPZwwK1JpHDFlWpBXrscqj+B+2qD/OKNNJ IiSwKmyydosbMk3nsLqJ1U4i9weKitzT2U+KpW4DEita5euObwguEuPtXjUGQcUzoH2A oIopLGpEn7TGsBd2m3MbIvYeiyoHEvh0nbFl7glVYGpchUVGsquA5swb/TRe4n6sJ5jm a6sQ== X-Forwarded-Encrypted: i=1; AJvYcCXXeMYniGb1mJ8+ne8R7hs5Cl/Y0oMJeHXErFEMqWh2YaR8nISQhIBnrWCOvwC/A/PnDmR7jo0sdznoBPuRnGTay33I X-Gm-Message-State: AOJu0Yy/FCWXJ/LFMmnby1z/gQO59D+Pb8JJdX6G9fU5CSVy9GOXmOJ7 R45Ly5ouhY9SCWbAl+h+Xk3voYyoafntTT+tIOSyEjUeanbc3chxMX1RD/iUuhs= X-Google-Smtp-Source: AGHT+IFVdUkAk33D26gezJZrNf6ao4CtxELl8NKowvX10lhTx+jlPG1vjmw8qYy4gPp1ygye7HQRJw== X-Received: by 2002:a17:903:1111:b0:1e0:939d:3d3a with SMTP id n17-20020a170903111100b001e0939d3d3amr7604828plh.33.1711380747847; Mon, 25 Mar 2024 08:32:27 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.87.36]) by smtp.gmail.com with ESMTPSA id u11-20020a170902e80b00b001dd0d090954sm4789044plg.269.2024.03.25.08.32.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 08:32:27 -0700 (PDT) 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 v2 09/10] riscv: Add Zfa extensiona support Date: Mon, 25 Mar 2024 21:01:40 +0530 Message-Id: <20240325153141.6816-10-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240325153141.6816-1-apatel@ventanamicro.com> References: <20240325153141.6816-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 Mon Mar 25 15:31: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: 13602439 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (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 63DFB75814 for ; Mon, 25 Mar 2024 15:32:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711380753; cv=none; b=TmhitJpbHwdfOP80+wvJK4pQznCfwrzaSybCCMjm1MToVaAzmMqtAyvcJ2Wxx2JIwTe5vzWiAJQ4TsCd91yBKrgdoixHDYh/9JjEK3mwIWD6r0cLQAlNxJPVyGmVMiupV+jS71syFuzzOJi85xwQdAoJB6g3pKnFnXX1uJsFKk4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711380753; c=relaxed/simple; bh=9FRLaj26Nbc3olJZoasXCER2j1jcBTOkVRlidkh9x8U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=l7aKPb7FQhtJD79h11eFHTHbGqoiPXg7jL11JaQ3obMY8Q804cDSFm5bu9oPOMm9ERtTh3HK/iz+CaH0mUfEFkl3r3HnGykGwQdw3umAsM26dgo1SvFgsXyCQP8mj1gfgdaWN0LgZPT74zDCI47LiNMUFZh4pzAIoplTwqKDEyQ= 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=PgsSx5Z7; arc=none smtp.client-ip=209.85.210.172 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="PgsSx5Z7" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-6e88e4c8500so3114500b3a.2 for ; Mon, 25 Mar 2024 08:32:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1711380751; x=1711985551; 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=aX0lk9qzFL2Ep07Hy3NQIs6ID/gEGXEzWmEmIs3hZ2Q=; b=PgsSx5Z7qZFl8QAY+YrCdgXCkj1Vm7qLDcHqigWDaumR8YeV01GaX8paYi+UWSAFTy aa3w97dtcwIJlAO2iDDPMZUjPQuQA7bbRqpD30m6mxon49nBw0LLZsCcjDs//dDbmNNd CB36nfdiLTnT8ITl8VmmgzOQOCRcYENCq8hbEdjJuss1q8c/zxMgZRs/uRB/8roik1r7 NGtYlxYHYiQfIg/6JegvOPOI2eCgVLH7T+f02xVmxBz1RarsE9hgGHV+fl9aLRoV/gcn ZFrR0tItzPEcykcSmQmn9P14NDlTT9v9LWPq1PsfrCcyoq7W3bVz3CTgcaTa1hp17PSy VcoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711380751; x=1711985551; 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=aX0lk9qzFL2Ep07Hy3NQIs6ID/gEGXEzWmEmIs3hZ2Q=; b=rOyou5uggZxJD1LQpc0LuyEunGsMJ6iJsRYkR/z2+UfWX4asfQL9UXFTfwIhED9xo7 xZ/tCQYTVEtpgmUFxGM5XxfVw6Uks8oeRPRBrU4/9XgHL+rWZKtOPGB70+3H1wYTUa84 CMJfqEliBNfM5uFFOKEUB5oinYreagcg/K2wgsB1INh4XIH26FfZANRXYKfsQAxEcJk1 PpsLqBEa8wdQ4cYBlOqlh4gJY4eyComRpX5dZ12fj5qMSbsBryfcxotgCKlxCsbzXVwS nuQcEfFbI2RKGcrfxb/wsQKvmuXlfMgchE3HcLEZUXyP5bBsST6u3AJTckiauifRvv2b JqFQ== X-Forwarded-Encrypted: i=1; AJvYcCWjeocGBb8Q0QQS9n9QT6zwzjpcu37PVRHhLpf9YkMvGDl0XEmKx67akPjUuenghFZBmfYfDt0DNKspn6F7+u+Craes X-Gm-Message-State: AOJu0YxfuUkplhGiZbjzTGpwuWId0Rm7homcHCuAKda3rTB/xoCtpdv8 66x6f3Ocs3ECdd9MLeZixg1/TDYivpoA5kqTgrVa40BZLd7YeAxeKU6laQOIVeQ= X-Google-Smtp-Source: AGHT+IGNnAkuwKt6vn7OKTa0ZSTpr/iGu7EkAF8A2AIVlxqpdmpM6K3l/lqP5wQp39/ghE0UXoK1DA== X-Received: by 2002:a05:6a20:30d6:b0:1a3:63fa:d0e6 with SMTP id 22-20020a056a2030d600b001a363fad0e6mr124456pzo.57.1711380751545; Mon, 25 Mar 2024 08:32:31 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.87.36]) by smtp.gmail.com with ESMTPSA id u11-20020a170902e80b00b001dd0d090954sm4789044plg.269.2024.03.25.08.32.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 08:32:31 -0700 (PDT) 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 v2 10/10] riscv: Allow disabling SBI STA extension for Guest Date: Mon, 25 Mar 2024 21:01:41 +0530 Message-Id: <20240325153141.6816-11-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240325153141.6816-1-apatel@ventanamicro.com> References: <20240325153141.6816-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 */