From patchwork Fri Aug 9 13:34:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13758824 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21B0A195808 for ; Fri, 9 Aug 2024 13:34:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723210494; cv=none; b=rhy2l9X5Jo6crZCIhNtIk75M428Y7KR55Dpz/bxEc/yr3dVnFHziipFhxEAwP87rOPqsh7pAhX6vD7nz2HlBIlSjcR68uBOERiJPtzvBgb8YnbnSfmc9/O8znGsD/vEz5P7ZbN8LcqyAlp5p9WMlb8pLkoXA/nIn1g1EvSFVQ/Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723210494; c=relaxed/simple; bh=PWtc5aldsHtv2h7Ede3x534t98EKCHMOqmWv9fq7rK8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jfqt2g2KPjHuaZV3WgK98KeDhAxRhFEd6vpwdYXE9zBthVnl0w2nDAob1Mnf7AKmCLGGayK4w/Z1AJT1cDCwQCiPCoWb/1nMrmdWwavpunVkW0uJ7yUkj/Efi2IioqGE1IITPPogKrbfrXevz78qcCvq7Lecgm9PI0jS2bgvGjA= 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=FwcT0ja3; arc=none smtp.client-ip=209.85.210.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="FwcT0ja3" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-70d19d768c2so1634328b3a.3 for ; Fri, 09 Aug 2024 06:34:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1723210492; x=1723815292; 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=Pc3oH83451CeWS4VKLJb3/MW3Irx8Ealej33KWVBpwI=; b=FwcT0ja3fkkoG9Q8G/CSeAzciFi3KcY9TMPQF0e+XwAU4e8P1ZUBfYfRhXy0zKAJT2 Zmb4htK8H7rbcyAEFV5SkIiEt6RDFIuGA31dBJa63Clz2IO+ZiuOiGaILExeFG+XnYzC rd+MstUnNlMLyY/mgfiEsrLk6g+gjh98/o46QQDULPH5TR+rYmrsm87i/4qXqa7kbdnL VSvshAlclZfNG1VkaqggkK+9MwB7H5pFbg1moPgU9hjD1M3ZFaGtHAMVA6KnTPpD5zJg HbXOYxbpyh/qM0HfCP845QxmnkvOxtVEPGdLubni2mByQGgTpp1gAg4gnkDiqDv5GSlY 3NcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723210492; x=1723815292; 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=UKpvQPOHxWrC+lkcu0ZXv1s3jAxTABkWlc+U3jTSVw5mKJaDyX08vqVnp8XBq0WT0P ceRfduoLEwTwqyeRiy/67OhmMx+w3wxQeAO7Jk/2VEJQt456mazPrDcmxc2ZFMxUa+rD v5agKPGEUjI8AjbqvMI529OKEey6puwynQ3etgKGym6S47dBRwTIrQld5FAf7RWxziLP qan8VM2XlYkvSfbWiTPXsqcfo2JpDZlJ5H7QMMZEzYbQsnkcNC216GD+H9dnQo6mDVcL eWlsRWFOGG2kVUN4urN94HAFBBqST7tT+Xq2TnjDQdKDUHN0TsHvnEgKxktYPlb1EZoz v8qw== X-Forwarded-Encrypted: i=1; AJvYcCV1StqFtMddZwHOq1kgesmzqNdEPLzQn7wntfPKqOYIlhRrU18OydlR2hOyBh9MUGuz9d2vVmStN/Bz0PNqJgmp2SKx X-Gm-Message-State: AOJu0YzBDXVeyIooD3aak1zItFWYewyDCToyWAkRZaeWUFq5AruE2x3g x6IgyTolhaqVSA4TWQjBK931QIp3Ldhq4VfGEp+sW08NfxdmSMYdwNz2h3cEqFU= X-Google-Smtp-Source: AGHT+IFubSqDYlL+P3vYeS5dVgdOwojF0u7HU3L4hNCFxltza27UiptLarDBPiYeOAcacZwrk89LYA== X-Received: by 2002:a17:902:d48d:b0:1ff:4618:36c2 with SMTP id d9443c01a7336-200ae4dbc37mr18401585ad.10.1723210491902; Fri, 09 Aug 2024 06:34:51 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff58f26f4bsm142107075ad.34.2024.08.09.06.34.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Aug 2024 06:34:51 -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 1/3] Sync-up headers with Linux-6.10 kernel Date: Fri, 9 Aug 2024 19:04:29 +0530 Message-Id: <20240809133431.2465029-2-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240809133431.2465029-1-apatel@ventanamicro.com> References: <20240809133431.2465029-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 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 Fri Aug 9 13:34:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13758825 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6BCA197512 for ; Fri, 9 Aug 2024 13:34:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723210499; cv=none; b=ZRwULKViiw5j1J5NEHXXue2DSwpwwrHMo176QpytbW2dYqSZjl0szmSE9H9Wm4qNG0rRUlwlK8UvOlxo0tdlEdyD84MAlRz+qFNT+GjmldP3KqROO8EPU4U/jIp2sBACkzx+LG4F6wki/kGyQRg9cRVlJZC6JZM8AbJ4vkSgsRc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723210499; c=relaxed/simple; bh=fy1jkpYpkE6qm2m79ms2b9vDyDR5YEymMlq2ISlxvCA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=oHseXIXvcoaDq6q4ybbDR/bTROExyFdTPCCdRE8XK+pq/VCBtol0JVEuLIUUVoQCtQahzPS8bR9ivBabIA2k3TUnMA7G0qyFtodmcdVYGtVjwPnV0qhjj2uEu62xV68fMfuceZmxPT0Z6XgCF0b80RBm6OdPRcTJ9V30EN/BPG4= 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=iOiyH+/+; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="iOiyH+/+" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1ff4fa918afso14046405ad.1 for ; Fri, 09 Aug 2024 06:34:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1723210497; x=1723815297; 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=oINtVjqt1HSId9RPGFIf1FQmhq9XpHG+7bXI6iFdSBA=; b=iOiyH+/+o5Se6kGwk8wjL1EUnzxYkc1NalTDjQ83hzomVvPbb7F3rtheXkEHoWreUf hAWQ8RhQqdxEwZkrGRmgGqUDabxbLveqXE4NaBeGib/MJccwNp367BbaqZMHYUxO9Kec GoomvY1RURndgdFPKWtYm/LerlSyvs1ymV+HQS1YNEWK3VdIy+PZDz0KjIzfVLs6dqAD Z1p2DRsjocHlBcBhy2zLPlaSAGSpKCb1lgh/l9cX6hh1/LJhez5lRyKjZ1wXAuDzakAk lvRUmy5yPKhJ66GRLuT84yEHS0lOmwgIwsINETa08ISaxfXQiy7/1IClkZ2zvSHulM+I ugAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723210497; x=1723815297; 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=SXz7EvYZdEg1T5+jj8YYbLpHzfo1YfhJqn/u54uM78uKXMNTOvJvGocqCIBipipdt9 FdTLykx3xzoUjJfFd97cz6d+uBBTkEixAuGxo7Zpw/RAr+mZAv4FLwtfiLKbKJmmpu2v +38mFAjdN/he5uV71HcdEcDV97n9V1fRUSRcPetCWPuFIixHLKJ1zcYpvC8VF2T2/SDG AYWMMedIU7/7i4evvdOlPRf/Z1qsZSzNF6mf6HE4O31GR2ftRmp0oo0pxLwMFWzAJ+nE 0bYX/Mpvqun0KSqX320rslYQQsbxIojll0x9z+Q2OVbpYUaykt/1aN63VNrGaipXB5+Y xJog== X-Forwarded-Encrypted: i=1; AJvYcCUC06PhcC5y/DsXy1aUm0FmV7Z8rRHqsrh/C7YqgsAYq4K1SvLJ8Fhmcs640UMmBBd+3usIQnSWIEDt+bjc3OT07AL9 X-Gm-Message-State: AOJu0YzKCueHnZITkWOGmIcqwELjMEUsESfEWdMHzB/G9aFwvObLMstp gwxndAqAnRkyi7cXvHSA5R6US/og6cOoKwdD+kJe83m8u/+/Yt0sPsCkbTwfdEE= X-Google-Smtp-Source: AGHT+IHExaHn6KWfbZBKG3BC7NltP1BSB+1w2QjEnUOn48ApT2+REQEbjebTl6WS/iOKckRayd8UYA== X-Received: by 2002:a17:902:e885:b0:1ff:4568:652f with SMTP id d9443c01a7336-200ae4bb4cdmr18679395ad.1.1723210496742; Fri, 09 Aug 2024 06:34:56 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff58f26f4bsm142107075ad.34.2024.08.09.06.34.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Aug 2024 06:34: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, Atish Patra , Anup Patel Subject: [kvmtool PATCH v2 2/3] riscv: Add Sscofpmf extensiona support Date: Fri, 9 Aug 2024 19:04:30 +0530 Message-Id: <20240809133431.2465029-3-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240809133431.2465029-1-apatel@ventanamicro.com> References: <20240809133431.2465029-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 Fri Aug 9 13:34:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13758826 Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.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 4B505195F04 for ; Fri, 9 Aug 2024 13:35:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723210503; cv=none; b=ihUPLtYS02q9v35CdBgm73O/TMXq0hTmzfOD47aBWFXUKJEMgalk+4vLZ2hJfD3kL5Z/wp3B9/pSiqgmjuI8afF7PMub0TceDt6EMxqLYge/I3Ba8byoKRPNU8l+I2xgc1jqTha6q5eXL0drruNuDYcI64hxC4kHNtbul3XMO88= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723210503; c=relaxed/simple; bh=K+V7s4lhvmj533HTxynH3XTk1ifZ+Jcx/a/SUHWKnfU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Sp61MjdHK6oOZZ55egDZsg8TlgBNVPNdAogWYYqnDU2/5PgnRUBEBYt0FzAfTgWoYHiejQZBDy2LIqNfDDHTzAms78Ee3tPHP+raieceVHMMCRL+TdhhkVdoZ0nKv0dq9dcb9z4JtsmmZ2lqOb0mURLECoj1q9fywInn/6gKUYU= 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=cAo8IySN; arc=none smtp.client-ip=209.85.215.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="cAo8IySN" Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-7b396521ff6so1651934a12.1 for ; Fri, 09 Aug 2024 06:35:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1723210501; x=1723815301; 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=BXdIh8b8xsEHMRPpfkOL4NE/nDWmTWNNEanJmKrWH1A=; b=cAo8IySNZ+ddDaWLE+poLJZtNrqCDFe+pd5TiJakSfSfIiGZCZQjM7VaWUXENCaHaH BfKOawh+ZhdSYfgQIwbCEEGaMNZJigMutR8nEAA6gbAX4t7Nzwf6VAjWf2g183tW4Q6J XXphd75Jis/Kd8PwkMMyHleXIEGAEH4Gsluj8PXPdQpYpSlne76n82Ni3X+8ggELS3we LFO5Jb3erN8yylZjQO+TwOpCiSh+0LRzpj3MHQSa/PVRl2dNFH+/UKwLjfNBvhxnH06K u9UWOA2yWeJANWGoFRNQb/D6xk53z5s92vWD8snPBFHV5NyaWVV+FDs5/eYdQdS8KJYD LO5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723210501; x=1723815301; 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=IYKIzG5as3eRYZtFYTzNrmkCGFP6aPHxWRt1cWqUYxUfYM6BHtGR9v1DXy2JO8eUzp 4Qe2GcU20gtY+tuyiNGZxBwS/dpowYj0TYvhtmbZvrYD1FflgUyaSLbvjJ8fv2QuhQfa W2uOtIP8uRtLaZgcXlT7/RzTLWv0RuzAkFbLRVHHR/TqrYdCCVLCocZbgPGhni9UK6a/ gP7ZYWzqqQogF3tcO43GQY/PZcnasPwIav6Er2Qe4gFzdxurEAaIDdNQT/GAUJ0h8Tow GJmVipcLgTHbBg0p85US1XnPu5i89LCKLL7nfgFhKFyNzV4PIn45dp+bfqjNtX5ULXNL BUGQ== X-Forwarded-Encrypted: i=1; AJvYcCWIquyoHQtjJvpUYeFnj9UYLDMqrbjFGqyWuEaTwQoxxvzsAsBEG3mUrg9wyTsWy1e91y8EUSg3qAHtlC9kW+5DvNsI X-Gm-Message-State: AOJu0YzladwsD0UPpjPg0sFRE+o6sHWMnz8apcQSDX5bcKwdIEDskcxD DeNlutleUZ+GdKFZ5jElXNIU9AjfT7tLIRX1ftwN6PwdQq2qiLlX6sCmw5kpUYM= X-Google-Smtp-Source: AGHT+IEB7dT26j/Diue9jPPQkJ4/fO+gdwRdmAym9DuYkekhfrZ/mIEeU4lhddcnVLIB5FEBgtdl2w== X-Received: by 2002:a17:902:f689:b0:1fc:5879:1d08 with SMTP id d9443c01a7336-200ae550755mr19846695ad.32.1723210501265; Fri, 09 Aug 2024 06:35:01 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff58f26f4bsm142107075ad.34.2024.08.09.06.34.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Aug 2024 06:35: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 3/3] riscv: Set SBI_SUCCESS on successful DBCN call Date: Fri, 9 Aug 2024 19:04:31 +0530 Message-Id: <20240809133431.2465029-4-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240809133431.2465029-1-apatel@ventanamicro.com> References: <20240809133431.2465029-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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;