Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1176844pxb; Fri, 20 Nov 2020 03:13:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJxC07TofQ3fXxLrLzLfV00zZXq9jubySLPrIczkaLOAScS+aNJr3q0BMSETOkZgq2zxW6A9 X-Received: by 2002:a50:9f61:: with SMTP id b88mr36416681edf.282.1605870791528; Fri, 20 Nov 2020 03:13:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605870791; cv=none; d=google.com; s=arc-20160816; b=YduS/jtD5XMC3mDfOv7WUqcg5mZoJblU2YF6w4lYU8lFv8vN3BEkZKS1WaOqLwixcl /cMf5Lf8/s7hmzjDleD2D+CTcsfTxj13fZOetKz2W4pokdSaLTM+UM2FMGXSBRVj6BgB AFcPXkVJy5lctz2HnqRZ/CzOND5ZsAwBIMwaEtxBGiZVvp387NTZLmMgUmiGus8yZ4aY Tb1jAGa5PygSzs4bNYoaL2c9WIUqNeVyG2IUrxQ1XZrj4ecZDuL2MIrykQxVN5zm9/IY n9x6fGiEV3dhpH6tJdWHOii2O1Oy9IUUcUDzHkymxlsYOEfhjEGDVsJAhMULvz3H+6XL z+Tw== 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=NRu9SYtehN6fMJlUTvT2Ogz3ieqexl/rDO/wgMTLeTw=; b=KPukUOg7H+XNQkV6NDxx1/QVDmrKP6pl8sX9GoZVQJWzwdYaZV82vf0dWHroK9SLXb 4Sex3BIunbLyHCR35QLI/HivowSqarUODggo0O5NkOY/HeYWPtlBUsfAVGLV+6gmncXS gEdrX9GnxU6XQXIVYuYs4vzzjXyAKycWl8MJQid77WrmaVYFstX4Gmia1W250HmmPXRu 9hFxpaxV2QspXTSKZlGdrQhjszaik91ot4raCTulROSF8QZ8jvEq1VnG7PAtdR4XVhIJ +mZinc4d8FVm5lDcWDp5/gZUarztpYtdLM3rMQpfFBWTVwQRq/wsGGEjjfZVqSQQqRFn uq1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CcKiCNJy; 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 n15si1582810eje.122.2020.11.20.03.12.45; Fri, 20 Nov 2020 03:13:11 -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=CcKiCNJy; 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 S1728444AbgKTLJu (ORCPT + 99 others); Fri, 20 Nov 2020 06:09:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:54886 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727496AbgKTLGz (ORCPT ); Fri, 20 Nov 2020 06:06:55 -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 E31BE22255; Fri, 20 Nov 2020 11:06:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1605870414; bh=aii0EAy8Ze/E/lQb6Q4FBxAPIU/7VmT8GxryEEU9sus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CcKiCNJyrt6kQ5wvva1J9QdhJmbGMFgEcyUGOF9nP5bEJl4BK1niPFRj8HnUeW3qR RL9fyoaoZiJk5i1MALS/lpAeNezTwG+dliobxc/h6IVjxJGgGDAzg6Fgv5gAm+oP82 Oy+hfRooW6gCktqHwL7/P+2hV8lsOZUZTj2k4P3A= 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 5.4 16/17] KVM: x86: clflushopt should be treated as a no-op by emulation Date: Fri, 20 Nov 2020 12:03:43 +0100 Message-Id: <20201120104541.856883236@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201120104541.058449969@linuxfoundation.org> References: <20201120104541.058449969@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 @@ -4050,6 +4050,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; @@ -4592,7 +4598,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 = { {