Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1176227pxb; Fri, 20 Nov 2020 03:12:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJwmJHILPc0HOxZUSqrjSP2eb0tsdx+wmnZ/DAX36OytNr6wHat07hRMB52CjOJT0BfmoyOl X-Received: by 2002:a50:e68a:: with SMTP id z10mr4586660edm.66.1605870732279; Fri, 20 Nov 2020 03:12:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605870732; cv=none; d=google.com; s=arc-20160816; b=TKqas2KB5MRhlVOZs9rVhXO3u3ZVxK4WhZySkZ0XiKUAP6QCjam9O9Fm0mGz7oB+Xh KXd1Ky6/XJvTU/kWq9cL5yNOweuDT3jzmLz96IyMuSImLLN4DORM3zmDz5qDjlZwmMjj EMCeYpV7gMgdWlNkKpu5lNfpPDZAOCrORhjWBXeULVgMGffbVnvrGR2M7OhraRWHLgPp 8GKwEgcWgWI7zXJYPdJL+zKIdnFstycjkVURyTBgb+6qfDm9WtlVnxOVY0cnjCTZ/6bL ue7uFJ792ms4aLM0FYSnGhiK7TshXGxo804FP7ymn6c3U6tcn2RQSuojkVjzSKFmDaGR WCEQ== 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=olBZCTOTn83lDKU+fjP536VIURgNWTB9Z+phUEErn8U=; b=bB+veCK6ggGu6GSRKDwiJQbYaDupx8xyg4Giw4LDN2Dy+k3YUn95m/K3xv3f5mmngE OaA73imhBjWQtwsIZk6I25KQNtCPAUzADmOFFAof9BANff9smnUQ/hxPwZ6NbgENk3Al OvBY10fFb6G3UjIrKc49DxGEnWuImLz+27/DvOoAP9xCujTZjf2WrIAyEOAni+pYS9gd py6AhHhwj6EanwBscWYJpD6bnnuDPxDVGSOqr8Y9OoKuWz2b8iMbd7BsjvJIgp+NfLUL W7/P9v4Zc5i45zMVeLByE7tLux66Vhx2t1kchl6cR4qcNYgJy2S2T/r2Kt3gFm8NNzQh q7mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0PHAkoAD; 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 f25si1662098edy.261.2020.11.20.03.11.49; Fri, 20 Nov 2020 03:12:12 -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=0PHAkoAD; 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 S1728466AbgKTLJ7 (ORCPT + 99 others); Fri, 20 Nov 2020 06:09:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:54172 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728388AbgKTLG0 (ORCPT ); Fri, 20 Nov 2020 06:06:26 -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 1C54F206E3; Fri, 20 Nov 2020 11:06:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1605870385; bh=J6jQKE/UZP5uU4IlM2NWyorOOshnTi1QfvDyzJgSTbM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0PHAkoADupJp9hUpp4PunIGSr9iLmIr+98RrmjUYdEhqZ8mvTyCent3AmZRrjAOru MR0vYPpKGs7Q/Mu1/0GTZ0LwB5Au9vGOFQ4KFQ6/iy3DbHOL7pt0a8OIwIGVjbZDWA J2DeV/CrybIPhY4K1N4wBvEza8AZOXQ69bAg1NpY= 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.19 13/14] KVM: x86: clflushopt should be treated as a no-op by emulation Date: Fri, 20 Nov 2020 12:03:34 +0100 Message-Id: <20201120104540.471604502@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201120104539.806156260@linuxfoundation.org> References: <20201120104539.806156260@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 @@ -3994,6 +3994,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; @@ -4507,7 +4513,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 = { {