From nobody Mon Feb 9 23:15:54 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3FB722157B for ; Fri, 14 Nov 2025 00:36:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763080603; cv=none; b=GNI6mCIBVFOxAwtczkMSuZDeg3yX/bndPdpmfvjLGJQtcsKFYgj4fEAqHYiyWn9vTlBhL1c+6jddfMndMGulwXieCYfB27kvzgdJC6yzYhf+fOXeV9QQyPv7MYoEX/PLZsijynIdG7yG5wbqlOMMa9644YF+0slgGwY1hLDY2aI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763080603; c=relaxed/simple; bh=vxHkaROEL/BY525YUhGo0nMaP1cMhptMXQ8pDEJVP+w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Q8i/rnKT/NO4HcCU4ew4EShg/fUpuoq+V4Cg7wJnMuwuowtiiMBWIxn8Ke7uOnBsIrsXxMkIov2MG/EcwP5eJL465JDidBXzNZLFcla0Yh5y35gWJMgdFjTmC8H9VUHSxp1A19I73orl7TInWqBKu8k1Psw/jnbLGx+eA9/Oxos= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=hadYHTpv; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hadYHTpv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763080600; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2+QYxSsLujLsfOK9VJedC1w46EE3jwzSpZW4DcZzgUc=; b=hadYHTpvkT36B38IVsG/qlFrvCmigF0bqVKfqMCanYMWnv+Xw0jlpy8CmcGFY1SLa6m8ev 65AKTn/uRpww67t19zKcxHo/1btPpsQkh1THl0Qghv0IbMvRodBVSXJBpt3/plR90Of9Un OKVqlxN6fNPe0Kq78wnmDDlHP0xe3tU= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-260-X9VRm1CVOE6eVvXqnFd-yg-1; Thu, 13 Nov 2025 19:36:39 -0500 X-MC-Unique: X9VRm1CVOE6eVvXqnFd-yg-1 X-Mimecast-MFC-AGG-ID: X9VRm1CVOE6eVvXqnFd-yg_1763080597 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CC99C195608F; Fri, 14 Nov 2025 00:36:37 +0000 (UTC) Received: from virtlab1023.lab.eng.rdu2.redhat.com (virtlab1023.lab.eng.rdu2.redhat.com [10.8.1.187]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 400E519560B9; Fri, 14 Nov 2025 00:36:37 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: kbusch@kernel.org, chang.seok.bae@intel.com Subject: [PATCH 04/10] KVM: emulate: move op_prefix to struct x86_emulate_ctxt Date: Thu, 13 Nov 2025 19:36:27 -0500 Message-ID: <20251114003633.60689-5-pbonzini@redhat.com> In-Reply-To: <20251114003633.60689-1-pbonzini@redhat.com> References: <20251114003633.60689-1-pbonzini@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Content-Type: text/plain; charset="utf-8" VEX decode will need to set it based on the "pp" bits, so make it a field in the struct rather than a local variable. No functional change intended. Signed-off-by: Paolo Bonzini --- arch/x86/kvm/emulate.c | 8 ++++---- arch/x86/kvm/kvm_emulate.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 28f81346878e..7ef791407dbc 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -4761,7 +4761,6 @@ int x86_decode_insn(struct x86_emulate_ctxt *ctxt, vo= id *insn, int insn_len, int int rc =3D X86EMUL_CONTINUE; int mode =3D ctxt->mode; int def_op_bytes, def_ad_bytes, goffset, simd_prefix; - bool op_prefix =3D false; bool has_seg_override =3D false; struct opcode opcode; u16 dummy; @@ -4813,7 +4812,7 @@ int x86_decode_insn(struct x86_emulate_ctxt *ctxt, vo= id *insn, int insn_len, int for (;;) { switch (ctxt->b =3D insn_fetch(u8, ctxt)) { case 0x66: /* operand-size override */ - op_prefix =3D true; + ctxt->op_prefix =3D true; /* switch between 2/4 bytes */ ctxt->op_bytes =3D def_op_bytes ^ 6; break; @@ -4920,9 +4919,9 @@ int x86_decode_insn(struct x86_emulate_ctxt *ctxt, vo= id *insn, int insn_len, int opcode =3D opcode.u.group[goffset]; break; case Prefix: - if (ctxt->rep_prefix && op_prefix) + if (ctxt->rep_prefix && ctxt->op_prefix) return EMULATION_FAILED; - simd_prefix =3D op_prefix ? 0x66 : ctxt->rep_prefix; + simd_prefix =3D ctxt->op_prefix ? 0x66 : ctxt->rep_prefix; switch (simd_prefix) { case 0x00: opcode =3D opcode.u.gprefix->pfx_no; break; case 0x66: opcode =3D opcode.u.gprefix->pfx_66; break; @@ -5140,6 +5139,7 @@ void init_decode_cache(struct x86_emulate_ctxt *ctxt) ctxt->rip_relative =3D false; ctxt->rex_prefix =3D 0; ctxt->lock_prefix =3D 0; + ctxt->op_prefix =3D false; ctxt->rep_prefix =3D 0; ctxt->regs_valid =3D 0; ctxt->regs_dirty =3D 0; diff --git a/arch/x86/kvm/kvm_emulate.h b/arch/x86/kvm/kvm_emulate.h index 7b5ddb787a25..83af019620e3 100644 --- a/arch/x86/kvm/kvm_emulate.h +++ b/arch/x86/kvm/kvm_emulate.h @@ -348,6 +348,7 @@ struct x86_emulate_ctxt { u8 opcode_len; u8 b; u8 intercept; + bool op_prefix; u8 op_bytes; u8 ad_bytes; union { --=20 2.43.5