From nobody Mon Feb 9 16:19:13 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1575452670; cv=none; d=zohomail.com; s=zohoarc; b=nrGXMslE1Q2HKlbE2R070CPCy4iK6gRYL7SGPNh4upB78FhIcFOhkH+gWv+8EQ5lysDb0xerhjngxFvwf5Eyaa3hTyYVneSz3rGtxCunOIWvzAR+BODstuJS7C9X2a0VNvR/PqXmlHytuGIayUxEXoXKeyrNldaiT2EYtNuDOX8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575452670; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nzrkPlQ3PEH2F5TGXl2cWAy+lWf7eBMRr53SY9YU5j8=; b=Oh0OBQqnImmNHYRUJBDCp1Nv1YsEEu86henDoWhTjVyucIO5BndugoRvN9KLB58DjdUGdQSxcec9zU5KUw6lIirVhhCA6QuUk5BsEL+pbXbDrhnNl6ImFBds2ROURigJJD53p8aVIvuEEeMD0VNddfKRKmiEHqKQUy5IE7Ogp1w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1575452670267441.88966684457034; Wed, 4 Dec 2019 01:44:30 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1icRCP-00041v-HA; Wed, 04 Dec 2019 09:43:57 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1icRCO-00041b-Pg for xen-devel@lists.xenproject.org; Wed, 04 Dec 2019 09:43:56 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9106ff82-167a-11ea-99dd-bc764e2007e4; Wed, 04 Dec 2019 09:43:46 +0000 (UTC) X-Inumbo-ID: 9106ff82-167a-11ea-99dd-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1575452626; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Cvxmuy06uR79zSidQfxCiE2b6b+g8mWL1PVavXRL8L8=; b=Bb4YEMMF9eBzidp5i2s6UJvS5v9rre9XYwGt8XnMd6WjFVAMsp1j9bQl c69KWa5Uz7YeyQRAsSyNVR4b+LtG5fETjxpQenPHuqVPv/15OLKRSafF9 FIcKtaLRa45GigS5ylOcsM4bUPdha3tCVH6lpXJuwj2dmlSHEEvAMpXQu w=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: pVfd3SMRa7BQXWoTKgZmjdhhLu9Vi+jzPNFFolxLhfz5BOGPLPNjzPmRGG1nLrPoelVdI3x37l omv5uWdzQWnBM74QHOnR0h1ZUS6g8gw3/Rbkw7AqTx194J98yeAMSUrdAkgYTABsyJs9DwEFVK OsgWDs9lInT7f+Maq0nn5001mqzQAgj7krlk23U/D8qjQKfAi9p/KnB4PChcxwMD+X9eFmsvSj AVmH/BaJCbxcPy04V+PvQMKfy1WBwBhV1pvXW8vYcsUXUrn3IeC5wP3ETh+vuC9rSIETIDx0GQ pCk= X-SBRS: 2.7 X-MesageID: 9723658 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,277,1571716800"; d="scan'208";a="9723658" From: Andrew Cooper To: Xen-devel Date: Wed, 4 Dec 2019 09:43:35 +0000 Message-ID: <20191204094335.24603-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191204094335.24603-1-andrew.cooper3@citrix.com> References: <20191204094335.24603-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 4/4] x86/svm: Use named (bit)fields for task switch exit info X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Introduce vmcb.e1.* and vmcb.e2.* to provide names to fields in exitinfo{1,= 2} respectively. Implement the task switch names for now, and clean up the TASK_SWITCH handler. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/hvm/svm/svm.c | 22 ++++++---------------- xen/include/asm-x86/hvm/svm/vmcb.h | 26 ++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 263ae03bfd..6c68bcee59 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -2746,10 +2746,7 @@ void svm_vmexit_handler(struct cpu_user_regs *regs) svm_vmexit_do_invalidate_cache(regs, exit_reason =3D=3D VMEXIT_INV= D); break; =20 - case VMEXIT_TASK_SWITCH: { - enum hvm_task_switch_reason reason; - int32_t errcode =3D -1; - + case VMEXIT_TASK_SWITCH: /* * All TASK_SWITCH intercepts have fault-like semantics. NRIP is * never provided, even for instruction-induced task switches, but= we @@ -2795,19 +2792,12 @@ void svm_vmexit_handler(struct cpu_user_regs *regs) if ( insn_len < 0 && (insn_len =3D svm_get_task_switch_insn_len())= =3D=3D 0 ) goto crash_or_fault; =20 - if ( (vmcb->exitinfo2 >> 36) & 1 ) - reason =3D TSW_iret; - else if ( (vmcb->exitinfo2 >> 38) & 1 ) - reason =3D TSW_jmp; - else - reason =3D TSW_call_or_int; - if ( (vmcb->exitinfo2 >> 44) & 1 ) - errcode =3D (uint32_t)vmcb->exitinfo2; - - hvm_task_switch(vmcb->exitinfo1, reason, errcode, insn_len, - (vmcb->exitinfo2 & (1ul << 48)) ? X86_EFLAGS_RF : = 0); + hvm_task_switch(vmcb->e1.task_switch.sel, + vmcb->e2.task_switch.iret ? TSW_iret : + vmcb->e2.task_switch.jmp ? TSW_jmp : TSW_call_or_= int, + vmcb->e2.task_switch.ev ? vmcb->e2.task_switch.ec = : -1, + insn_len, vmcb->e2.task_switch.rf ? X86_EFLAGS_RF = : 0); break; - } =20 case VMEXIT_CPUID: if ( (insn_len =3D svm_get_insn_len(v, INSTR_CPUID)) =3D=3D 0 ) diff --git a/xen/include/asm-x86/hvm/svm/vmcb.h b/xen/include/asm-x86/hvm/s= vm/vmcb.h index fc67a88660..02b5e86b49 100644 --- a/xen/include/asm-x86/hvm/svm/vmcb.h +++ b/xen/include/asm-x86/hvm/svm/vmcb.h @@ -418,8 +418,30 @@ struct vmcb_struct { vintr_t _vintr; /* offset 0x60 - cleanbit 3 */ u64 interrupt_shadow; /* offset 0x68 */ u64 exitcode; /* offset 0x70 */ - u64 exitinfo1; /* offset 0x78 */ - u64 exitinfo2; /* offset 0x80 */ + union { + u64 exitinfo1; /* offset 0x78 */ + union { + struct { + uint16_t sel; + } task_switch; + } e1; + }; + union { + u64 exitinfo2; /* offset 0x80 */ + union { + struct { + uint32_t ec; + uint32_t :4; + bool iret:1; + uint32_t :1; + bool jmp:1; + uint32_t :5; + bool ev:1; + uint32_t :3; + bool rf:1; + } task_switch; + } e2; + }; intinfo_t exitintinfo; /* offset 0x88 */ u64 _np_enable; /* offset 0x90 - cleanbit 4 */ u64 res08[2]; --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel