Received: by 10.192.165.148 with SMTP id m20csp3424419imm; Mon, 23 Apr 2018 06:25:49 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+5fCY6/hNWaatxUGrQyBwcwKtC8PDNxK7GPG7SxffsbICfLZqrqEevsmOoknUpbF+zPIgy X-Received: by 10.98.163.21 with SMTP id s21mr20193480pfe.168.1524489949592; Mon, 23 Apr 2018 06:25:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524489949; cv=none; d=google.com; s=arc-20160816; b=wqEIOd8QrbqTFZwS9/xDL0NRHxfrRunov9Hb3+rCkMwPyOke94GlgOZDI4qx+PEPqf S7f+J116B/KHTsRP+RJVju5++swJjtQs+vhLclQlq8o14IPUl2khQKpsauF++v8K8EAb qOyfCGNR5+P+j4YZBr3PBYjCdXvm2ORZMqObB0VRm9VnX7Tfu0V97A55K29MSlgsUAFa 3UsgeSVQNHxbhiRg6rhhfRT9mliodxDaMb62OK0B/caVCYK8t3UKEkpwsY7r1uWZ45v+ Ae25ne9STBn+3jbmN+Nkafm9iV+sp5Izl92Goy06rB/TYPjuCk+uBti+ZQfBmAe8rstC jFZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=Lljbrawnevngn/uI6NH8z/e3gyxXrTQD3d4E7tVNjm0=; b=YdX2scBUrYw0+Ede2TGqehyABzJRqWezUi6ySbVkuw+eCuALIGmt4KRQ2kyaF4An9i WcKjqeAwJZxrigemiWPyb5fRYwWPdMgXvNkNZjoL07i3gMtRqEE9pctoM2PLdTM5yRIq qRgWyIvu47QZY8gsWruv1d/WHCe9n38gTawYkUPdwPjHnfpL3aaKrpBe8a5wpsHFbmER /OYp994ZYAABcrwc6I6XSWTEEjwazbTa+gzhftUJaJd7wsx+MMkh28USkJIMcteXEcP8 YMRyOrmuOg7s7l1F/qdT/86HRmOy/GXCbWfthckKRxg5tfGu0Irbx5W9xE6V2WXDjplB YWMQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y7si10748539pfl.313.2018.04.23.06.25.35; Mon, 23 Apr 2018 06:25:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755334AbeDWNYQ (ORCPT + 99 others); Mon, 23 Apr 2018 09:24:16 -0400 Received: from mail.skyhub.de ([5.9.137.197]:38032 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755256AbeDWNYN (ORCPT ); Mon, 23 Apr 2018 09:24:13 -0400 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de Received: from mail.skyhub.de ([127.0.0.1]) by localhost (blast.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ohKhZmXJdOYE; Mon, 23 Apr 2018 15:23:56 +0200 (CEST) Received: from pd.tnic (p200300EC2BC8AC00557A5D25006EBC38.dip0.t-ipconnect.de [IPv6:2003:ec:2bc8:ac00:557a:5d25:6e:bc38]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 80C3F1EC0288; Mon, 23 Apr 2018 15:23:56 +0200 (CEST) Date: Mon, 23 Apr 2018 15:23:47 +0200 From: Borislav Petkov To: Eduardo Habkost 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: <20180423132347.GE22238@pd.tnic> References: <3866d359-0ef8-6a99-6254-84890be62b93@redhat.com> <20180226122205.GG4377@pd.tnic> <20180417202417.GA29865@localhost.localdomain> <20180418090329.GJ29865@localhost.localdomain> <20180423125849.GD22238@pd.tnic> <20180423130823.GM29865@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180423130823.GM29865@localhost.localdomain> User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 23, 2018 at 10:08:23AM -0300, Eduardo Habkost wrote: > 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? To save an MSR read per logical CPU but from the looks of it, that KVM_GET_MSRS is widely used in qemu with kvm_get_msrs() so I guess one more MSR doesn't matter. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.