Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp454840pxb; Tue, 3 Nov 2020 04:12:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJy6p94r09G5uxa34Bsvnnmqe1W9GDXU2DDbRaDx6M8DVg5AJWcG+G0w5lOu++hBbBlVkzzf X-Received: by 2002:a17:906:c293:: with SMTP id r19mr19058177ejz.63.1604405537937; Tue, 03 Nov 2020 04:12:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604405537; cv=none; d=google.com; s=arc-20160816; b=oZrqtynsF0NdTLnmefV+6L6MXFuRdDu7FL8yGT/J8ir3OvOMcVu+R3/RQoB5hIrx7H EdN8At7xdRbYMB4ace0ic87bCbQKf9NR/a8acU5AdJHafYYzPvS2EfcWOKYBvkpIxMJD //MF4cJ9/KuiHxcbk4j0mht1MK/pMwyJ6zD80CM4SYbwm6n1QNrVjiVpyqcT8KEzqw/F bXGUQSVa/rnmpNnrs+xrPeKp/626ngP+eLBrGWjHc8bldtGNaT8PbhpJXfWO2zppbYQ3 uf7E/S2oHKFz/1dK3quIn8gOaX6Cl4UsRNtVcR4JSuTmWfLR3DT26t25kMZeA0UnxW9N 0uAQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=h9MFns4+YUM2WrMN1n/hdiPQQ9AmvoWKTdDk9TUNovM=; b=hvnsi6o36O6SrCkQG+UjPEh0/kzsmI+s5UxO80TSWimhinj94MYvdBQzcA7bfv9BBm 5/yhkG0250uh40pbZvKgIpQVbOrqMUzH3gq6SYXa/teQNaDwbwYSPLXEbmVso3a7KTMp HOcTHLAtqWKx2O+8FpTH8rqUY7LiVE/s7idJxMlkG46lxfP3/8xTOadh68saa13UcIv2 cf71Uslb0IZr/M4lQBJbnFSQNIweDuVD6tkN86AXzCw/cCGp6Gx/2u9oExh0TAgCXCCJ HC/wS5QXPiGYhDZDX9KltWpnCH9esGDevAevCXUMO8Y07Ae1XjlkppMW23evf71PKBfz Yuig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=aLc618jU; 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=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p7si11928830ejg.491.2020.11.03.04.11.54; Tue, 03 Nov 2020 04:12:17 -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=@oracle.com header.s=corp-2020-01-29 header.b=aLc618jU; 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728928AbgKCMHz (ORCPT + 99 others); Tue, 3 Nov 2020 07:07:55 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:46802 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728146AbgKCMHz (ORCPT ); Tue, 3 Nov 2020 07:07:55 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0A3BxhkK075803; Tue, 3 Nov 2020 12:06:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2020-01-29; bh=h9MFns4+YUM2WrMN1n/hdiPQQ9AmvoWKTdDk9TUNovM=; b=aLc618jUYvkIpc6amrRH57re+QonILrYfcHUpV7rkyFlfV9Usuo2GTt6h4OAhUJwXd5K 81YnIXqlWBuCRrx6lGKPGXrhsZSIwWuvpsqJraedawh7s4AqMk6+XtqL3L57Yl0KErhE Xkx4hAi10CU1EZyloP+wwBjb3/oFTiiNMj4voujIa53reKmheIhH1nleLuYYfNwh6cy+ PdOnVfTrE2GjxSZuV97+KixDqPEsJ5mn1e+VWHYN7jn8GDShkTn5NFRazsAg3/BXcOQo XQhzo7aLG3ctjQCBrRd+Dx9w/CQwtMHEdXA20zJ/ACt3TmKjjHs2TpomqAOGxZgVSqJq 1g== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 34hhvc8ves-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 03 Nov 2020 12:06:11 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0A3C0fGM156489; Tue, 3 Nov 2020 12:04:11 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 34hw0df56d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Nov 2020 12:04:11 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 0A3C459J030210; Tue, 3 Nov 2020 12:04:05 GMT Received: from disaster-area.hh.sledj.net (/81.187.26.238) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 03 Nov 2020 04:04:05 -0800 Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 82f746cd; Tue, 3 Nov 2020 12:04:00 +0000 (UTC) From: David Edmondson To: linux-kernel@vger.kernel.org Cc: Vitaly Kuznetsov , Nadav Amit , x86@kernel.org, Wanpeng Li , kvm@vger.kernel.org, Thomas Gleixner , Sean Christopherson , Paolo Bonzini , "H. Peter Anvin" , Joerg Roedel , Jim Mattson , Borislav Petkov , Ingo Molnar , David Edmondson Subject: [PATCH] KVM: x86: clflushopt should be treated as a no-op by emulation Date: Tue, 3 Nov 2020 12:04:00 +0000 Message-Id: <20201103120400.240882-1-david.edmondson@oracle.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9793 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 mlxlogscore=906 phishscore=0 bulkscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011030083 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9793 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=1 impostorscore=0 malwarescore=0 priorityscore=1501 mlxlogscore=933 bulkscore=0 phishscore=0 adultscore=0 mlxscore=0 lowpriorityscore=0 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011030083 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- arch/x86/kvm/emulate.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 0d917eb70319..56cae1ff9e3f 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -4046,6 +4046,12 @@ static int em_clflush(struct x86_emulate_ctxt *ctxt) 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; @@ -4585,7 +4591,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 = { { -- 2.28.0