public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: He Chen <he.chen@linux.intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>,
	"Luc, Piotr" <Piotr.Luc@intel.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"x86@kernel.org" <x86@kernel.org>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"Kang, Luwei" <luwei.kang@intel.com>,
	"rkrcmar@redhat.com" <rkrcmar@redhat.com>
Subject: Re: [PATCH] x86/cpuid: expose AVX512_4VNNIW and AVX512_4FMAPS features to kvm guest
Date: Tue, 1 Nov 2016 15:48:50 +0800	[thread overview]
Message-ID: <20161101074850.GA11430@he> (raw)
In-Reply-To: <6cb0bdc3-69f6-1c17-5576-82fbe42e5457@redhat.com>

On Mon, Oct 31, 2016 at 12:41:32PM +0100, Paolo Bonzini wrote:
> 
> 
> On 31/10/2016 12:05, Borislav Petkov wrote:
> > On Mon, Oct 31, 2016 at 11:47:48AM +0100, Paolo Bonzini wrote:
> >> The information is all in arch/x86/kernel/cpu/scattered.c's cpuid_bits
> >> array.  Borislav, would it be okay to export the cpuid_regs enum?
> > 
> > Yeah, and kill the duplicated one in arch/x86/events/intel/pt.c too
> > please, while at it.
> > 
> > I'd still put it all in arch/x86/kernel/cpu/scattered.c so that it is
> > close-by and call it from outside.
> 
> Good.  Chen, are you going to do this?
> 

Sure.

Before sending a patch, let me check if my understanding is right...
I will add a helper in scattered.c like:

unsigned int get_scattered_cpuid_features(unsigned int level,
					unsigned int sub_leaf, enum cpuid_regs reg)
{
	u32 val = 0;
	const struct cpuid_bit *cb;

	for (cb = cpuid_bits; cb->feature; cb++) {

		if (reg == cb->reg &&
			level == cb->level &&
			sub_leaf == cb->sub_leaf &&
			boot_cpu_has(cb->feature))

			val |= cb->bit;
	}

	return val;
}

And, when KVM wants to mask out features, it can be called outside like:

entry->edx &= kvm_cpuid_7_0_edx_x86_features;
entry->edx &= get_scatterd_cpuid_features(7, 0, CR_EDX);

Thanks,
-He

  reply	other threads:[~2016-11-01  7:49 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-28  9:12 [PATCH] x86/cpuid: expose AVX512_4VNNIW and AVX512_4FMAPS features to kvm guest He Chen
2016-10-28  9:31 ` Paolo Bonzini
2016-10-28  9:46   ` He Chen
2016-10-28  9:54     ` Paolo Bonzini
2016-10-28  9:55       ` He Chen
2016-10-28 10:13 ` Luc, Piotr
2016-10-28 10:17   ` Paolo Bonzini
2016-10-28 11:08     ` Borislav Petkov
2016-10-28 12:07       ` Paolo Bonzini
2016-10-28 12:21         ` Borislav Petkov
2016-10-29 12:21           ` Paolo Bonzini
2016-10-29 12:25             ` Borislav Petkov
2016-10-29 12:36               ` Paolo Bonzini
2016-10-29 12:53                 ` Borislav Petkov
2016-10-29 13:20                   ` Paolo Bonzini
2016-10-31  9:15             ` Luc, Piotr
2016-10-31  9:53               ` Borislav Petkov
2016-10-31 10:18                 ` Luc, Piotr
2016-10-31 10:30                   ` Borislav Petkov
2016-10-31 10:47                     ` Paolo Bonzini
2016-10-31 11:05                       ` Borislav Petkov
2016-10-31 11:41                         ` Paolo Bonzini
2016-11-01  7:48                           ` He Chen [this message]
2016-11-01  8:46                             ` Borislav Petkov

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=20161101074850.GA11430@he \
    --to=he.chen@linux.intel.com \
    --cc=Piotr.Luc@intel.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luwei.kang@intel.com \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.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