From patchwork Wed Aug 21 14:26:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1974984 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=1Vw+Cw+S; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=U6s+/8KT; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WppYf3KlLz1yf6 for ; Thu, 22 Aug 2024 00:26:46 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CY+3QnLYqwwzwAiIO63h5NgZVa7yO+UoyDzXb7gd9Nk=; b=1Vw+Cw+SLc/hVi h+S0/DbymIYeF1H7YaJZHRFKEhTxoWSRUCWriYJyk7+QyCZjiI+ClHRyK4SEfI1gryfWOgQYUbIDd 4pRRAMwfe9iCrkMjj1XztlTBdz0N97+0aYiZ+ODO0rkJjAkLxcEGnFVL8J754XuNofi6gk+jdcK5+ T/YwvhhLSAwRgnvIgoLNJyjJUqXkMmtB4MTFj5tdHlO/smnCRpWVtcr8RdFqhdJ3Zs9SlO4xIoTI7 IWg8MVeVVm5K9jOFsPEgH91vO5/jL8tAo9JGNAOcnnunRzKMJnUa7E8ZNSitRxzgDDkzzBXIfQS8M gD2lqIr6nUoWapcUcvEQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgmIP-00000009IK5-0uz1; Wed, 21 Aug 2024 14:26:45 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgmIM-00000009IHz-471K for kvm-riscv@lists.infradead.org; Wed, 21 Aug 2024 14:26:44 +0000 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-429ec9f2155so48855385e9.2 for ; Wed, 21 Aug 2024 07:26:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1724250401; x=1724855201; darn=lists.infradead.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=Pc3oH83451CeWS4VKLJb3/MW3Irx8Ealej33KWVBpwI=; b=U6s+/8KThTlgsjythJJsU/LG43zY9pggNB7l2UakECsJbiB7iHXnDT+U/K7aOFfBnQ 1naeG0Sdht2usfcmQ/ZsK/D7PoEadWpNiCzAecBK3CMiTgfpyVCo2YzrpYfs0dFEYBhw PRW74guBr7J5YC/lvz+jW3KcN3dlLFYbeU9N4A6SL1HfQWlbcm9zFgVacMrB2PExxytI 1THoCwBmctWrW43FWQZnP756D+N9Z111PJ9Fu9VvVnsLL2Z1TZMmg++rbFz8YHY2KLhD oJ53MQcb+1o8pzAI4Yfy30zXJVH7MJ9ReDr3M8ZIqEPz4BwZA3aVgX2EkNV4Eb4GboGq Y1Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724250401; x=1724855201; 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=Pc3oH83451CeWS4VKLJb3/MW3Irx8Ealej33KWVBpwI=; b=SSghX74BISEx9fSL9Rgdn7dhL8w8CKTqd1UQ0yB9rg0vXqQmTHrh77h8UA8pY+fnqy tLwz0Om0KW3rk7a1l1YW/sCvmSyttK+H7D8a/tgnEIN6BuNjguXNh3jtmIKhwI+yqxCq 7NaTKA9+G15hal4q+Hvvye8x4YaAKAxOCSLriTZZ3uBuWF6B15vUdj1XG4K/I5dKDgxB 5ngeJjKd1r6pMrkinV9b9RVrJF6leybAv8F065wTZFS1kpsrCPfMHIga0oIWQrFkj7d5 dNbApAB35xkQYrYkBlPrwY8V3K1HdZGUUCxhvYdnvk854vtIHFCWQT2HLm2wHtsCFqLR vNVA== X-Forwarded-Encrypted: i=1; AJvYcCU+nUfXJgjcxsImdiJda3KGnRRsj7+lD9YFli3oFaMQWT8ggnva9Pon3Dig7MliZAfMffAmHFq6ERc=@lists.infradead.org X-Gm-Message-State: AOJu0Yy3Km8hxvibLYQv+K3XESZLyarzkhkull5EPi66/QzMwLjBrYZk hmbeX84sQgO5GPudzIikFGTYeMKSoKCXuRnSO7PdKrR8p/MiXIpy24IsMlkfAns= X-Google-Smtp-Source: AGHT+IGKQ01goe26Qzs3n/MKI58ZfYTLt7lQKleX8xrbKlefkSmkxHuviKTprq/5KohjpfGQ8TtGGg== X-Received: by 2002:a05:600c:3581:b0:428:e09d:3c with SMTP id 5b1f17b1804b1-42abf0a8d02mr16517105e9.33.1724250400071; Wed, 21 Aug 2024 07:26:40 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42abebc34ddsm28646765e9.0.2024.08.21.07.26.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Aug 2024 07:26:39 -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 v3 1/4] Sync-up headers with Linux-6.10 kernel Date: Wed, 21 Aug 2024 19:56:07 +0530 Message-Id: <20240821142610.3297483-2-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240821142610.3297483-1-apatel@ventanamicro.com> References: <20240821142610.3297483-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_072643_053598_C852ED28 X-CRM114-Status: GOOD ( 13.39 ) X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: We sync-up Linux headers to get latest KVM RISC-V headers having Sscofpmf support. Signed-off-by: Anup Patel Anup Patel --- include/linux/kvm.h | 4 +- include/linux/virtio_net.h | 143 +++++++++++++++++++++++++++++++++++++ riscv/include/asm/kvm.h | 1 + x86/i [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:335 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: kvm-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kvm-riscv" Errors-To: kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org We sync-up Linux headers to get latest KVM RISC-V headers having Sscofpmf support. Signed-off-by: Anup Patel Anup Patel --- include/linux/kvm.h | 4 +- include/linux/virtio_net.h | 143 +++++++++++++++++++++++++++++++++++++ riscv/include/asm/kvm.h | 1 + x86/include/asm/kvm.h | 22 +++++- 4 files changed, 166 insertions(+), 4 deletions(-) diff --git a/include/linux/kvm.h b/include/linux/kvm.h index 2190adb..d03842a 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h @@ -1221,9 +1221,9 @@ struct kvm_vfio_spapr_tce { /* Available with KVM_CAP_SPAPR_RESIZE_HPT */ #define KVM_PPC_RESIZE_HPT_PREPARE _IOR(KVMIO, 0xad, struct kvm_ppc_resize_hpt) #define KVM_PPC_RESIZE_HPT_COMMIT _IOR(KVMIO, 0xae, struct kvm_ppc_resize_hpt) -/* Available with KVM_CAP_PPC_RADIX_MMU or KVM_CAP_PPC_HASH_MMU_V3 */ +/* Available with KVM_CAP_PPC_MMU_RADIX or KVM_CAP_PPC_MMU_HASH_V3 */ #define KVM_PPC_CONFIGURE_V3_MMU _IOW(KVMIO, 0xaf, struct kvm_ppc_mmuv3_cfg) -/* Available with KVM_CAP_PPC_RADIX_MMU */ +/* Available with KVM_CAP_PPC_MMU_RADIX */ #define KVM_PPC_GET_RMMU_INFO _IOW(KVMIO, 0xb0, struct kvm_ppc_rmmu_info) /* Available with KVM_CAP_PPC_GET_CPU_CHAR */ #define KVM_PPC_GET_CPU_CHAR _IOR(KVMIO, 0xb1, struct kvm_ppc_cpu_char) diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h index cc65ef0..ac91747 100644 --- a/include/linux/virtio_net.h +++ b/include/linux/virtio_net.h @@ -56,6 +56,7 @@ #define VIRTIO_NET_F_MQ 22 /* Device supports Receive Flow * Steering */ #define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */ +#define VIRTIO_NET_F_DEVICE_STATS 50 /* Device can provide device-level statistics. */ #define VIRTIO_NET_F_VQ_NOTF_COAL 52 /* Device supports virtqueue notification coalescing */ #define VIRTIO_NET_F_NOTF_COAL 53 /* Device supports notifications coalescing */ #define VIRTIO_NET_F_GUEST_USO4 54 /* Guest can handle USOv4 in. */ @@ -406,4 +407,146 @@ struct virtio_net_ctrl_coal_vq { struct virtio_net_ctrl_coal coal; }; +/* + * Device Statistics + */ +#define VIRTIO_NET_CTRL_STATS 8 +#define VIRTIO_NET_CTRL_STATS_QUERY 0 +#define VIRTIO_NET_CTRL_STATS_GET 1 + +struct virtio_net_stats_capabilities { + +#define VIRTIO_NET_STATS_TYPE_CVQ (1ULL << 32) + +#define VIRTIO_NET_STATS_TYPE_RX_BASIC (1ULL << 0) +#define VIRTIO_NET_STATS_TYPE_RX_CSUM (1ULL << 1) +#define VIRTIO_NET_STATS_TYPE_RX_GSO (1ULL << 2) +#define VIRTIO_NET_STATS_TYPE_RX_SPEED (1ULL << 3) + +#define VIRTIO_NET_STATS_TYPE_TX_BASIC (1ULL << 16) +#define VIRTIO_NET_STATS_TYPE_TX_CSUM (1ULL << 17) +#define VIRTIO_NET_STATS_TYPE_TX_GSO (1ULL << 18) +#define VIRTIO_NET_STATS_TYPE_TX_SPEED (1ULL << 19) + + __le64 supported_stats_types[1]; +}; + +struct virtio_net_ctrl_queue_stats { + struct { + __le16 vq_index; + __le16 reserved[3]; + __le64 types_bitmap[1]; + } stats[1]; +}; + +struct virtio_net_stats_reply_hdr { +#define VIRTIO_NET_STATS_TYPE_REPLY_CVQ 32 + +#define VIRTIO_NET_STATS_TYPE_REPLY_RX_BASIC 0 +#define VIRTIO_NET_STATS_TYPE_REPLY_RX_CSUM 1 +#define VIRTIO_NET_STATS_TYPE_REPLY_RX_GSO 2 +#define VIRTIO_NET_STATS_TYPE_REPLY_RX_SPEED 3 + +#define VIRTIO_NET_STATS_TYPE_REPLY_TX_BASIC 16 +#define VIRTIO_NET_STATS_TYPE_REPLY_TX_CSUM 17 +#define VIRTIO_NET_STATS_TYPE_REPLY_TX_GSO 18 +#define VIRTIO_NET_STATS_TYPE_REPLY_TX_SPEED 19 + __u8 type; + __u8 reserved; + __le16 vq_index; + __le16 reserved1; + __le16 size; +}; + +struct virtio_net_stats_cvq { + struct virtio_net_stats_reply_hdr hdr; + + __le64 command_num; + __le64 ok_num; +}; + +struct virtio_net_stats_rx_basic { + struct virtio_net_stats_reply_hdr hdr; + + __le64 rx_notifications; + + __le64 rx_packets; + __le64 rx_bytes; + + __le64 rx_interrupts; + + __le64 rx_drops; + __le64 rx_drop_overruns; +}; + +struct virtio_net_stats_tx_basic { + struct virtio_net_stats_reply_hdr hdr; + + __le64 tx_notifications; + + __le64 tx_packets; + __le64 tx_bytes; + + __le64 tx_interrupts; + + __le64 tx_drops; + __le64 tx_drop_malformed; +}; + +struct virtio_net_stats_rx_csum { + struct virtio_net_stats_reply_hdr hdr; + + __le64 rx_csum_valid; + __le64 rx_needs_csum; + __le64 rx_csum_none; + __le64 rx_csum_bad; +}; + +struct virtio_net_stats_tx_csum { + struct virtio_net_stats_reply_hdr hdr; + + __le64 tx_csum_none; + __le64 tx_needs_csum; +}; + +struct virtio_net_stats_rx_gso { + struct virtio_net_stats_reply_hdr hdr; + + __le64 rx_gso_packets; + __le64 rx_gso_bytes; + __le64 rx_gso_packets_coalesced; + __le64 rx_gso_bytes_coalesced; +}; + +struct virtio_net_stats_tx_gso { + struct virtio_net_stats_reply_hdr hdr; + + __le64 tx_gso_packets; + __le64 tx_gso_bytes; + __le64 tx_gso_segments; + __le64 tx_gso_segments_bytes; + __le64 tx_gso_packets_noseg; + __le64 tx_gso_bytes_noseg; +}; + +struct virtio_net_stats_rx_speed { + struct virtio_net_stats_reply_hdr hdr; + + /* rx_{packets,bytes}_allowance_exceeded are too long. So rename to + * short name. + */ + __le64 rx_ratelimit_packets; + __le64 rx_ratelimit_bytes; +}; + +struct virtio_net_stats_tx_speed { + struct virtio_net_stats_reply_hdr hdr; + + /* tx_{packets,bytes}_allowance_exceeded are too long. So rename to + * short name. + */ + __le64 tx_ratelimit_packets; + __le64 tx_ratelimit_bytes; +}; + #endif /* _UAPI_LINUX_VIRTIO_NET_H */ diff --git a/riscv/include/asm/kvm.h b/riscv/include/asm/kvm.h index b1c503c..e878e7c 100644 --- a/riscv/include/asm/kvm.h +++ b/riscv/include/asm/kvm.h @@ -167,6 +167,7 @@ enum KVM_RISCV_ISA_EXT_ID { KVM_RISCV_ISA_EXT_ZFA, KVM_RISCV_ISA_EXT_ZTSO, KVM_RISCV_ISA_EXT_ZACAS, + KVM_RISCV_ISA_EXT_SSCOFPMF, KVM_RISCV_ISA_EXT_MAX, }; diff --git a/x86/include/asm/kvm.h b/x86/include/asm/kvm.h index ef11aa4..9fae1b7 100644 --- a/x86/include/asm/kvm.h +++ b/x86/include/asm/kvm.h @@ -457,8 +457,13 @@ struct kvm_sync_regs { #define KVM_STATE_VMX_PREEMPTION_TIMER_DEADLINE 0x00000001 -/* attributes for system fd (group 0) */ -#define KVM_X86_XCOMP_GUEST_SUPP 0 +/* vendor-independent attributes for system fd (group 0) */ +#define KVM_X86_GRP_SYSTEM 0 +# define KVM_X86_XCOMP_GUEST_SUPP 0 + +/* vendor-specific groups and attributes for system fd */ +#define KVM_X86_GRP_SEV 1 +# define KVM_X86_SEV_VMSA_FEATURES 0 struct kvm_vmx_nested_state_data { __u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE]; @@ -689,6 +694,9 @@ enum sev_cmd_id { /* Guest Migration Extension */ KVM_SEV_SEND_CANCEL, + /* Second time is the charm; improved versions of the above ioctls. */ + KVM_SEV_INIT2, + KVM_SEV_NR_MAX, }; @@ -700,6 +708,14 @@ struct kvm_sev_cmd { __u32 sev_fd; }; +struct kvm_sev_init { + __u64 vmsa_features; + __u32 flags; + __u16 ghcb_version; + __u16 pad1; + __u32 pad2[8]; +}; + struct kvm_sev_launch_start { __u32 handle; __u32 policy; @@ -856,5 +872,7 @@ struct kvm_hyperv_eventfd { #define KVM_X86_DEFAULT_VM 0 #define KVM_X86_SW_PROTECTED_VM 1 +#define KVM_X86_SEV_VM 2 +#define KVM_X86_SEV_ES_VM 3 #endif /* _ASM_X86_KVM_H */ From patchwork Wed Aug 21 14:26:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1974985 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=ARhZDpRX; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=UnwJDvRE; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WppYm2BVxz1yf6 for ; Thu, 22 Aug 2024 00:26:52 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hB1O69sfqBFHDD6dzuGEdB8Ag/A6UGpGgrZ2cl+sZMo=; b=ARhZDpRX/5PLOL V8y9s41ehqeh9tG76fIV18c/f0aEV+MDP8vfCrGJrmFrUbUawb8wvDukHNMsKKQF9eEeUbBqVEYZF bTjHx8DWZn4NtVFOi/tUv9fAZodSIpJd3qhjqBlpqERa15mu7kXTehgQOF56KXSd2bRD4ATdidILx Iv9Rn0+HvjCWQ8iR1rcgZF6HqLyfPvbInJfAL7WPp8I0Vohzfko9z1goZzRaWamf0EK+Di0FDLTfQ SMadjHCey0nGowbeVt0bSKDNjNKRUCYGPYSoTZG7/1crWedv4fYuSa6yX+jQsxPWTpocKh12YCI2l u9MDQe9rbpeSEpBhXtuA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgmIV-00000009INU-0Olg; Wed, 21 Aug 2024 14:26:51 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgmIT-00000009ILk-15kA for kvm-riscv@lists.infradead.org; Wed, 21 Aug 2024 14:26:50 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4280c55e488so5030895e9.0 for ; Wed, 21 Aug 2024 07:26:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1724250407; x=1724855207; darn=lists.infradead.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=oINtVjqt1HSId9RPGFIf1FQmhq9XpHG+7bXI6iFdSBA=; b=UnwJDvRElnXX8Qh1KnN142Y16/DNQ3rP4BZcwTDxDDIMyep7zOmeDJ8YjURsQFGYFC MtjbovA/qOzFprwp6TLxomZTuD97KzsiWs8V2OOML2bVCmSqK/p0mFwrhU4V1FHmoNiQ d3O/0ifABgxYpD8Gxl6Y+Ri55vYBJ9SLqaGutZ4AAUKY659xihuSCYl/ypdmXoBec7bi 5spKaGAxL1fPPzEOfuevx1FTFpimsI3hbzDMdGBWXt1dKtVLOA5ffr8S3o1rIa6pAkiK b+IN2LmJnUMfrJn99TGkFvAtKWJwATEHKFOX1Q39m6XppydZxd9orUxiDJYpl7oFzqAQ AeFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724250407; x=1724855207; 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=oINtVjqt1HSId9RPGFIf1FQmhq9XpHG+7bXI6iFdSBA=; b=ZAIjlGpij1zsxWsN2BQlffclgGeYi8sDg2/Ulh5MWZGlW9kB8sc+pqZxSJ19/jVAGa 6Ee34xPa56mu3WIFy4vdvbOCEEWQ4uWmip/ewJnzMe72B5iH9lS7HdNyjjGg77JK6AAC lfAKACZu2zkV4GwxXFaR8XfFM4nOMu63uZ9nmHslSaWAF9zmhi86BovhU4PloxKGzO+7 oD3t6Ir9+hiI3udcNqpoNr5qR0quRl3GLa4qe2dDfMWOC1lPcYSlR3KTSuPfzL2eWcEv 4dUSk4cAaqP9uflr+/o8nkexu+A9FrpprE8cY2cJs35P2qRpX/o+1P4aAdbv8gszEDXD meRg== X-Forwarded-Encrypted: i=1; AJvYcCUyzqUSpWM0nOrqXVY5J6eWa18JTs+KSpyvjb6aBWZacWoG+YFs+EAzBq79Etad+kkrdyTNHwcVSHc=@lists.infradead.org X-Gm-Message-State: AOJu0Yz4Ek7mR21y2qG9ODG68rw060sLL6XWgoR89DRW/q3/IDZOocOd /1z6WwV60V+OROuxf2AZ6FkTv9eUJ1NgJh4ZeFSjyxpd3+bdLegzZm9hg9ZMmYg= X-Google-Smtp-Source: AGHT+IGAG+CtUJijxv36J+sCbfags7JKci6hApRnvL6bK+8fTcLvO3mKXdE7IxDPtcijvhliEfAxtg== X-Received: by 2002:a05:600c:3104:b0:424:8743:86b4 with SMTP id 5b1f17b1804b1-42abe654bb6mr14247895e9.6.1724250406586; Wed, 21 Aug 2024 07:26:46 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42abebc34ddsm28646765e9.0.2024.08.21.07.26.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Aug 2024 07:26:46 -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, Atish Patra , Anup Patel Subject: [kvmtool PATCH v3 2/4] riscv: Add Sscofpmf extensiona support Date: Wed, 21 Aug 2024 19:56:08 +0530 Message-Id: <20240821142610.3297483-3-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240821142610.3297483-1-apatel@ventanamicro.com> References: <20240821142610.3297483-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_072649_334793_861DA276 X-CRM114-Status: UNSURE ( 9.99 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Atish Patra When the Sscofpmf extension is available expose it to the guest via device tree so that guest can use it. Signed-off-by: Atish Patra Signed-off-by: Anup Patel --- riscv/fdt.c | 1 + riscv/include/kvm/kvm-config-arch.h | 3 +++ 2 files changed, 4 insertions(+) Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:332 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: kvm-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kvm-riscv" Errors-To: kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Atish Patra When the Sscofpmf extension is available expose it to the guest via device tree so that guest can use it. Signed-off-by: Atish Patra Signed-off-by: Anup Patel --- 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 cf367b9..e331f80 100644 --- a/riscv/fdt.c +++ b/riscv/fdt.c @@ -18,6 +18,7 @@ struct isa_ext_info isa_info_arr[] = { /* sorted alphabetically */ {"smstateen", KVM_RISCV_ISA_EXT_SMSTATEEN}, {"ssaia", KVM_RISCV_ISA_EXT_SSAIA}, + {"sscofpmf", KVM_RISCV_ISA_EXT_SSCOFPMF}, {"sstc", KVM_RISCV_ISA_EXT_SSTC}, {"svinval", KVM_RISCV_ISA_EXT_SVINVAL}, {"svnapot", KVM_RISCV_ISA_EXT_SVNAPOT}, diff --git a/riscv/include/kvm/kvm-config-arch.h b/riscv/include/kvm/kvm-config-arch.h index 17f0ceb..3fbc4f7 100644 --- a/riscv/include/kvm/kvm-config-arch.h +++ b/riscv/include/kvm/kvm-config-arch.h @@ -31,6 +31,9 @@ struct kvm_config_arch { OPT_BOOLEAN('\0', "disable-ssaia", \ &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_SSAIA], \ "Disable Ssaia Extension"), \ + OPT_BOOLEAN('\0', "disable-sscofpmf", \ + &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_SSCOFPMF], \ + "Disable Sscofpmf Extension"), \ OPT_BOOLEAN('\0', "disable-sstc", \ &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_SSTC], \ "Disable Sstc Extension"), \ From patchwork Wed Aug 21 14:26:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1974986 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=XoKJjnh0; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=maFa/2k7; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WppYt66hNz1yf6 for ; Thu, 22 Aug 2024 00:26:58 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Ykn0cGCTVMya2WVEq2IawTwNY9JBiL30eA2ACTVzWUg=; b=XoKJjnh00AQJKU u/yMosjEMLUgSas1uoy/M6rjhy0+sPXtArt9XT4Jy/HrgXw8fCQy7CjIIO5WX6pg8Bt352Ts504aw kfMFR8SJpC0uS5VgMKmneK5/XasiGcsU+fIntDyyz7gxP+w1vW6qcbu3ecB4yhUVKvWHiEXEy9QX5 Df//PPmzA5m4D/sDmfOc1IOJ+hTLvR0pwy1tCOXMUhNLDCzGqAoOqRlgcK2Y9jUMCICCM2nK0P6W0 2NPs4JkX931uOj+Wt+ErtUL+2Bb/l6uIOV850dwDupAnXpMvnmFbjXiqxlkAO93G5MMMe7RH3lS88 NMDio2qc+q19NwVnb50g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgmIb-00000009IRp-2h0T; Wed, 21 Aug 2024 14:26:57 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgmIY-00000009IPC-3wB5 for kvm-riscv@lists.infradead.org; Wed, 21 Aug 2024 14:26:56 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-429da8b5feaso74067145e9.2 for ; Wed, 21 Aug 2024 07:26:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1724250413; x=1724855213; darn=lists.infradead.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=BXdIh8b8xsEHMRPpfkOL4NE/nDWmTWNNEanJmKrWH1A=; b=maFa/2k7iwWejfiSMYi+D9KdlLDD1pKNBcQVXndpnhOO61laRo06HezGolqWZpYPF1 Z1FzNSjkSMeM8yYLjUmjMMwBd22ytOruxaXSW3kEFu/GL/+010smBWGcua9T5D47teGN x4W4DMht652YRf0UR2WgW16uECSOJVBv3n3wYdEPf4QTzISAgL8HwS5/bj1ZFIUIq62Z kNRovm5Oz2iPQq1rEhvFMuj1zkAMCXZiih0ZYQdFPc82ysrFEl9+uQOeuWX6abnhgH3L AmBZHPKhQ0jqDd0zY5JwgAkKd6GRF2gp4uLLdRq8VaWKPGSh7JTb9VOHZAIkutQ6Z1rE 0gXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724250413; x=1724855213; 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=BXdIh8b8xsEHMRPpfkOL4NE/nDWmTWNNEanJmKrWH1A=; b=a8GWHAOL76iNnNb5+VhWdkImSgIQ64Cd5Xz88CltllToL2+CTv5/RfM31a0BDPLZSC 644Ca6D4KnTWuYwBlJBHx9FbjdOnirPpk+bdRA8dO7yDwDW49j7M8jLrqGSnEmQG7PLb lGzFGdLl4oeaSK4PulqwMEaTjYpGSf8/5jYg/hG1FaUcR9IrbHc73fbpdbv/MzzN2esm T4GRsTSRXc7t5k9mrOxVFyG8wG/iPSNfEP/GFod1bT9iAbnrEZfaMfhps8DLT9b7vLFv ByclVni3bQfj/r99jp88x63k12XXl11iF3+py0oWoPKBKUfMjYgUHgfZFug5A5gseK+M 6HXg== X-Forwarded-Encrypted: i=1; AJvYcCUAvDr+fjab/fKNxTJobxE6THnyO9r7ZJmtBM3PtqSrC3IgiyguqGfJ4ZRPM4eYYYg5GTJdYfJepqk=@lists.infradead.org X-Gm-Message-State: AOJu0YwyGzkE0bdszFhbYMP3DcFIRPzLKoCUupyAOd1BuJz4EwbcQwN/ IVFM576oT16fGrxcb5GYaQRuyjhvuPbQS4Sv6XVKNAXS7nBWeWr9k20g4x6QWrY= X-Google-Smtp-Source: AGHT+IE88JXO2twpmq32Cb9MW3e8dGHHyuJR6n2yRh6Jgp4wKRdFEtp+8UEdL8Pnee5IeiPEJWvqBg== X-Received: by 2002:a05:600c:310d:b0:426:6ed5:fcb with SMTP id 5b1f17b1804b1-42abd113c18mr26021405e9.4.1724250412671; Wed, 21 Aug 2024 07:26:52 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42abebc34ddsm28646765e9.0.2024.08.21.07.26.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Aug 2024 07:26:52 -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 v3 3/4] riscv: Set SBI_SUCCESS on successful DBCN call Date: Wed, 21 Aug 2024 19:56:09 +0530 Message-Id: <20240821142610.3297483-4-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240821142610.3297483-1-apatel@ventanamicro.com> References: <20240821142610.3297483-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_072655_002290_7C72EA57 X-CRM114-Status: UNSURE ( 8.03 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Andrew Jones Ensure we explicitly set SBI_SUCCESS on a successful SBI calls since KVM will not initialize it to zero for us. Only DBCN was neglecting to do so. Fixes: 4ddaa4249e0c ("riscv: Handle SBI DBCN calls from Guest/VM") Signed-off-by: Andrew Jones Signed-off-by: Anup Patel --- riscv/kvm-cpu.c | 1 + 1 [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:32d listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: kvm-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kvm-riscv" Errors-To: kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Andrew Jones Ensure we explicitly set SBI_SUCCESS on a successful SBI calls since KVM will not initialize it to zero for us. Only DBCN was neglecting to do so. Fixes: 4ddaa4249e0c ("riscv: Handle SBI DBCN calls from Guest/VM") Signed-off-by: Andrew Jones Signed-off-by: Anup Patel --- riscv/kvm-cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/riscv/kvm-cpu.c b/riscv/kvm-cpu.c index ae87848..0c171da 100644 --- a/riscv/kvm-cpu.c +++ b/riscv/kvm-cpu.c @@ -162,6 +162,7 @@ static bool kvm_cpu_riscv_sbi(struct kvm_cpu *vcpu) switch (vcpu->kvm_run->riscv_sbi.function_id) { case SBI_EXT_DBCN_CONSOLE_WRITE: case SBI_EXT_DBCN_CONSOLE_READ: + vcpu->kvm_run->riscv_sbi.ret[0] = SBI_SUCCESS; addr = vcpu->kvm_run->riscv_sbi.args[1]; #if __riscv_xlen == 32 addr |= (u64)vcpu->kvm_run->riscv_sbi.args[2] << 32; From patchwork Wed Aug 21 14:26:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1974987 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=AuSIk7DQ; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=pNqI0/t0; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WppZ02N51z1yf6 for ; Thu, 22 Aug 2024 00:27:04 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MnjZQmr7bXqeKYcwYGU5yLFbtlJEiMkzgQh6aKpD8bI=; b=AuSIk7DQ0eCVFO /SV3QmCt67WGfAxd5eHZ3aZmvD6fT6bWzgs+R8xc4ylMU/dNUrs/zwY8Ymzcla7ZMI/MGDMrNdM6R 1pDkwRxGRQA+1aWM+kibmzSWCKyNbTbaz0pa307VKkqhlReW6h92n9zBr7RpfK0Hnv0zxVCRiOjzm Fl0xE9d6aj5BJGgqUKYXHL3SK3bUsS9Ip7mWhKf7s34DdgRbcv1RDoRNA7e2h3QOzsWnrZEnhg8Mz 93GFLvjRwRkWbgHu9Pt9ipnSYEdvn9oPJEMvZtBlU87r8PXIEhf2G+G13Pi0Hhxapx4E+VEU67a9D aG/8gU4Z8D7kgGkq/Q8w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgmIh-00000009ITp-0WcG; Wed, 21 Aug 2024 14:27:03 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgmIe-00000009ISy-30WC for kvm-riscv@lists.infradead.org; Wed, 21 Aug 2024 14:27:01 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-428243f928cso54814845e9.3 for ; Wed, 21 Aug 2024 07:27:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1724250419; x=1724855219; darn=lists.infradead.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=5KqTGxW8AKVPvkiuwUCASJeIM7PQDb/Zh6a+fYZvgHw=; b=pNqI0/t0Azu35yBPG9LLgF6FkA0BI8nG5aJhX5t5Fr+lyuZWkcSPyiYG3l79erEqUr uYLw2qsCMq6Bb5ipbaXk5+YYA8VM+9MuxtjOxngAS0UNi+TJF6Gze+m++jVOqL3zEagA fh0QvPOZO36UNVZBUuZeOLKx2mjZpkYu4dMPDK39p/K0WNLKmbZZTLWsIbofTEmnQueR +gVdx15frOASbNjA//G30Zy4e2AF7ODtGnZsqy/4MUktRBDPft56VT5KtHroDD9AE2tU pDCvm5WrtqvobgCY6mnxWtqFx5Q7tX5gvi08nKWpXuWP3YXflAoFoCbp/YO5JVdSN7Qa yJyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724250419; x=1724855219; 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=5KqTGxW8AKVPvkiuwUCASJeIM7PQDb/Zh6a+fYZvgHw=; b=wix0Yiz49UsXmZJoVftWpAUXoj61NhGwJnKICrZx7YZjJAUnNkBw+c9TTBOFxX0Gwa 0YZU9j6L+8Kh6/1/EV8WpoLQoddiRCfs1nCQxnPB3FtpUDfh6WJm9gcFXEsmwfI/ikhL XPSnsx+LeMWGWbfeYz0Ym2Ap+AW/CgWOVS/pz3wENtIyaoG8A1K8XQNpRpX1iD1Ubw1+ k8ErhC8O7xRm4HUgmbxmfSFyWdzlqwnfh2jvl1qJYZNX477xTUuuiJJQ/TUDnDxpllVx t/AODxnrSd6jOzjChuF8+iPo3WJ40eZZ+od1arP1w+jm3afTe1eVlbQRBgTH+75fBWEN IvtA== X-Forwarded-Encrypted: i=1; AJvYcCVwSP0whcgfFqgn3lq5WYTiPwWuoL1ocVdml8qpSqqlXbAXL2BBlXwDkU+n/paL22TU0hplOGphHds=@lists.infradead.org X-Gm-Message-State: AOJu0YyOtRuwqdSlf+zUJUrlQ/nlePcwFznRemLkdbpbjGgrjpkF8DiV Ii7p+TBC5YSLnv+IXmufsaWFyLNK+DqXky4dSpvxfM/g9Q/BwiNM1bJU17fSL1Y= X-Google-Smtp-Source: AGHT+IGafRGb247lD1GrwccfwBXd98zL9sW8f4ol63M7LSb6wWS+TrhwVQYhVrUkyGsLrvYd0XQeKw== X-Received: by 2002:a5d:4c51:0:b0:368:2f01:307a with SMTP id ffacd0b85a97d-372fd70f4e4mr1778474f8f.46.1724250418743; Wed, 21 Aug 2024 07:26:58 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42abebc34ddsm28646765e9.0.2024.08.21.07.26.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Aug 2024 07:26:58 -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 v3 4/4] riscv: Correct number of hart bits Date: Wed, 21 Aug 2024 19:56:10 +0530 Message-Id: <20240821142610.3297483-5-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240821142610.3297483-1-apatel@ventanamicro.com> References: <20240821142610.3297483-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_072700_778285_16C7F56A X-CRM114-Status: GOOD ( 11.84 ) X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Andrew Jones The number of hart bits should be obtained from the highest hart ID, not the number of harts. For example, if a guest has 2 harts, then the number of bits should be fls(1) == 1. Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:334 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: kvm-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kvm-riscv" Errors-To: kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Andrew Jones The number of hart bits should be obtained from the highest hart ID, not the number of harts. For example, if a guest has 2 harts, then the number of bits should be fls(1) == 1. Signed-off-by: Andrew Jones Signed-off-by: Anup Patel --- riscv/aia.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/riscv/aia.c b/riscv/aia.c index fe9399a..21d9704 100644 --- a/riscv/aia.c +++ b/riscv/aia.c @@ -164,7 +164,7 @@ static int aia__init(struct kvm *kvm) ret = ioctl(aia_fd, KVM_SET_DEVICE_ATTR, &aia_nr_sources_attr); if (ret) return ret; - aia_hart_bits = fls_long(kvm->nrcpus); + aia_hart_bits = fls_long(kvm->nrcpus - 1); ret = ioctl(aia_fd, KVM_SET_DEVICE_ATTR, &aia_hart_bits_attr); if (ret) return ret;