Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1172651pxb; Fri, 20 Nov 2020 03:06:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJxxjPfWY2zg0nlKEo24kCdyRqfJd1D058dpar3MPKwe70F30QWuryRVtZwQBHqVkO5S6E5O X-Received: by 2002:a17:906:a891:: with SMTP id ha17mr33308740ejb.116.1605870401724; Fri, 20 Nov 2020 03:06:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605870401; cv=none; d=google.com; s=arc-20160816; b=JQmNH2WM9BhYhNKz2Rkcn6YSFKDxBARNE0u3NOPcyrQW9OBMAeMlHM+QaJa60wbW8n G7S64NFnvTlUX7PlYb4MzrDQxRR19iqK+G0aCF4Q/rc8z/U8Br1603j+WM6DlweUKPTX 3/tIJgdU64Je1S1X3pEZEQp66CrUlmHOXqjDjRBlkPPjyU/2ifIpoxDqUZcZNyCTI+n9 tE0Q5tygUuXIUKEW4JOMNZiGAIXbwMVKLy4DgOlJQgIpkVkvYoRq5BOZTQwZnfnKcujy k3SjNkwJIyBfpriU2Pc2w+RiRBBA72THPPu8qWnYu3vxPxuzTSqB1yZkAs++cZE2Lf8G //Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LAHSAqeB9B5PUKLVEIpB+0ASuysnub6oImVUUKH5toE=; b=YS42QSby40/bUOOm8959jQTRu/kiAHnHgsplTgu4VwqAnyLQwcQliyqd2LPmvtK5UM Gur6sMunMrvbuo3VIvQhiwAy7G15wnm7KGwB1MOM2iz9Aa19IUF0oiT3Z2XX6v/xlyI9 HmaJ544LC99+g6/CCR2X13qeZJN1JdqWif5u26O0SGW79C7aL/tcHIwlzIT19hlrr2go EzyhAlN+OYD5FhQcjyez0m2dzFQ3NR/WZ0KKfAgdu0m01+PaaFPnHtzqpkP1hzICzGG5 IopQKKUfGJFi1ux6UhDmlMxIWmRNwE0o9XS6DAiSGC8/SvZ/T9ukZL8ILn8wXiFX2r+w D9uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bZuKDbkn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yl23si1788494ejb.441.2020.11.20.03.06.18; Fri, 20 Nov 2020 03:06:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bZuKDbkn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727678AbgKTLDf (ORCPT + 99 others); Fri, 20 Nov 2020 06:03:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:50744 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725789AbgKTLDf (ORCPT ); Fri, 20 Nov 2020 06:03:35 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3C00522255; Fri, 20 Nov 2020 11:03:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1605870214; bh=03Y/u/tnlP5eaLfzaq6Vle9auOAVXrvWtwUEtN7JWxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bZuKDbknSIn0DYfpQam6k67QGoO3xR+QhUtfTSKhusw3xn1rDJEsmZJ5lvKipxXDp S0S+lvXNdqDblDdp12iQVUEiD9OnfuvYeaEHqesAI6T30oXQy8CtO5SFZzjOElJ6lz qJXT/O2+p9Bd9n0xSe8kV56lksNpbMF+rE7B/KAc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Edmondson , Joao Martins , Paolo Bonzini Subject: [PATCH 4.4 15/15] KVM: x86: clflushopt should be treated as a no-op by emulation Date: Fri, 20 Nov 2020 12:03:13 +0100 Message-Id: <20201120104540.311014155@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201120104539.534424264@linuxfoundation.org> References: <20201120104539.534424264@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Edmondson commit 51b958e5aeb1e18c00332e0b37c5d4e95a3eff84 upstream. The instruction emulator ignores clflush instructions, yet fails to support clflushopt. Treat both similarly. Fixes: 13e457e0eebf ("KVM: x86: Emulator does not decode clflush well") Signed-off-by: David Edmondson Message-Id: <20201103120400.240882-1-david.edmondson@oracle.com> Reviewed-by: Joao Martins Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/emulate.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -3922,6 +3922,12 @@ static int em_clflush(struct x86_emulate return X86EMUL_CONTINUE; } +static int em_clflushopt(struct x86_emulate_ctxt *ctxt) +{ + /* emulating clflushopt regardless of cpuid */ + return X86EMUL_CONTINUE; +} + static int em_movsxd(struct x86_emulate_ctxt *ctxt) { ctxt->dst.val = (s32) ctxt->src.val; @@ -4411,7 +4417,7 @@ static const struct opcode group11[] = { }; static const struct gprefix pfx_0f_ae_7 = { - I(SrcMem | ByteOp, em_clflush), N, N, N, + I(SrcMem | ByteOp, em_clflush), I(SrcMem | ByteOp, em_clflushopt), N, N, }; static const struct group_dual group15 = { {