mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Moger, Babu" <bmoger@amd.com>
To: Maksim Davydov <davydov-max@yandex-team.ru>, kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, babu.moger@amd.com, x86@kernel.org,
	seanjc@google.com, sandipan.das@amd.com, bp@alien8.de,
	mingo@redhat.com, tglx@linutronix.de,
	dave.hansen@linux.intel.com, hpa@zytor.com, pbonzini@redhat.com
Subject: Re: [PATCH 1/2] x86: KVM: Advertise FSRS and FSRC on AMD to userspace
Date: Fri, 15 Nov 2024 13:51:52 -0600	[thread overview]
Message-ID: <5267175a-27ed-9293-c780-ed22b13bb8ca@amd.com> (raw)
In-Reply-To: <20241113133042.702340-2-davydov-max@yandex-team.ru>

Hi Maksim,

On 11/13/2024 7:30 AM, Maksim Davydov wrote:
> Fast short REP STOSB and fast short CMPSB support on AMD processors are
> provided in other CPUID function in comparison with Intel processors:
> * FSRS: 10 bit in 0x80000021_EAX
> * FSRC: 11 bit in 0x80000021_EAX
> 
> AMD bit numbers differ from existing definition of FSRC and
> FSRS. So, the new appropriate values have to be added with new names.
> 
> It's safe to advertise these features to userspace because they are a part
> of CPU model definition and they can't be disabled (as existing Intel
> features).
> 
> Fixes: 2a4209d6a9cb ("KVM: x86: Advertise fast REP string features inherent to the CPU")
> Signed-off-by: Maksim Davydov <davydov-max@yandex-team.ru>
> ---
>   arch/x86/include/asm/cpufeatures.h | 2 ++
>   arch/x86/kvm/cpuid.c               | 4 ++--
>   2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
> index 913fd3a7bac6..2f8a858325a4 100644
> --- a/arch/x86/include/asm/cpufeatures.h
> +++ b/arch/x86/include/asm/cpufeatures.h
> @@ -457,6 +457,8 @@
>   #define X86_FEATURE_NULL_SEL_CLR_BASE	(20*32+ 6) /* Null Selector Clears Base */
>   #define X86_FEATURE_AUTOIBRS		(20*32+ 8) /* Automatic IBRS */
>   #define X86_FEATURE_NO_SMM_CTL_MSR	(20*32+ 9) /* SMM_CTL MSR is not present */
> +#define X86_FEATURE_AMD_FSRS	        (20*32+10) /* AMD Fast short REP STOSB supported */
> +#define X86_FEATURE_AMD_FSRC		(20*30+11) /* AMD Fast short REP CMPSB supported */
>   
>   #define X86_FEATURE_SBPB		(20*32+27) /* Selective Branch Prediction Barrier */
>   #define X86_FEATURE_IBPB_BRTYPE		(20*32+28) /* MSR_PRED_CMD[IBPB] flushes all branch type predictions */
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index 41786b834b16..30ce1bcfc47f 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -793,8 +793,8 @@ void kvm_set_cpu_caps(void)
>   
>   	kvm_cpu_cap_mask(CPUID_8000_0021_EAX,
>   		F(NO_NESTED_DATA_BP) | F(LFENCE_RDTSC) | 0 /* SmmPgCfgLock */ |
> -		F(NULL_SEL_CLR_BASE) | F(AUTOIBRS) | 0 /* PrefetchCtlMsr */ |
> -		F(WRMSR_XX_BASE_NS)
> +		F(NULL_SEL_CLR_BASE) | F(AUTOIBRS) | F(AMD_FSRS) |
> +		F(AMD_FSRC) | 0 /* PrefetchCtlMsr */ | F(WRMSR_XX_BASE_NS)

KVM still does not report AMD_FSRC.

The KVM_GET_SUPPORTED_CPUID output for the function 0x80000021.

{0x80000021, 0000, eax = 0x1800074f, ebx= 0000000000, ecx = 0000000000, 
edx= 0000000000}, /* 0 */



>   	);
>   
>   	kvm_cpu_cap_check_and_set(X86_FEATURE_SBPB);

-- 
- Babu Moger

  reply	other threads:[~2024-11-15 19:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-13 13:30 [PATCH 0/2] x86: KVM: Add missing AMD features Maksim Davydov
2024-11-13 13:30 ` [PATCH 1/2] x86: KVM: Advertise FSRS and FSRC on AMD to userspace Maksim Davydov
2024-11-15 19:51   ` Moger, Babu [this message]
2024-11-16 10:34     ` Maksim Davydov
2024-11-13 13:30 ` [PATCH 2/2] x86: KVM: Advertise AMD's speculation control features Maksim Davydov
2024-11-15 20:12   ` Moger, Babu
2024-11-15 20:32     ` Jim Mattson
2024-11-15 21:29       ` Moger, Babu
2024-11-16 11:51         ` Maksim Davydov
2024-11-18 17:37       ` Tom Lendacky
2024-11-16 11:47 ` [PATCH 0/2] x86: KVM: Add missing AMD features Borislav Petkov
2024-11-16 12:02   ` Maksim Davydov
2024-11-16 12:10     ` Borislav Petkov
2024-11-18 14:07       ` Maksim Davydov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5267175a-27ed-9293-c780-ed22b13bb8ca@amd.com \
    --to=bmoger@amd.com \
    --cc=babu.moger@amd.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=davydov-max@yandex-team.ru \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=sandipan.das@amd.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®