From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755216AbeDWNIv (ORCPT ); Mon, 23 Apr 2018 09:08:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58044 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755124AbeDWNIp (ORCPT ); Mon, 23 Apr 2018 09:08:45 -0400 Date: Mon, 23 Apr 2018 10:08:23 -0300 From: Eduardo Habkost To: Borislav Petkov Cc: Paolo Bonzini , Wanpeng Li , LKML , kvm , Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [PATCH] KVM: X86: Allow userspace to define the microcode version Message-ID: <20180423130823.GM29865@localhost.localdomain> References: <24cd527d-5287-f0be-ffe8-eab341bf1d94@redhat.com> <3866d359-0ef8-6a99-6254-84890be62b93@redhat.com> <20180226122205.GG4377@pd.tnic> <20180417202417.GA29865@localhost.localdomain> <20180418090329.GJ29865@localhost.localdomain> <20180423125849.GD22238@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180423125849.GD22238@pd.tnic> X-Fnord: you can see the fnord User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 23, 2018 at 02:58:49PM +0200, Borislav Petkov wrote: > On Wed, Apr 18, 2018 at 12:36:37PM +0200, Paolo Bonzini wrote: > > On 18/04/2018 11:03, Eduardo Habkost wrote: > > >>> QEMU setting ucode_rev automatically using the host value when > > >>> using "-cpu host" (with no need for explicit ucode_rev option) > > >>> makes sense to me. > > >> QEMU can't get the host value by rdmsr MSR_IA32_UCODE_REV directly > > >> since rdmsr will #GP when ring !=0, any idea? > > > By looking at kvm_get_msr_feature(), it looks like > > > ioctl(system_fd, KVM_GET_MSRS) would return the host MSR value > > > for us. > > > > Yes, that's exactly what it was introduced for (together with other MSRs > > including VMX capabilities). > > Can't qemu do: > > grep microcode /proc/cpuinfo | awk '{ print $3 }' | head -n 1 It could, but why would QEMU do it if a real API already exists for that? -- Eduardo