From nobody Fri Oct 18 05:22:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1694810231; cv=none; d=zohomail.com; s=zohoarc; b=c+eSgjWcXMm55PS94JEPRFSxqh/pFo1MT6hCuxI1BpCzGV8Jp4Y1MdBEvKOyt0lFzlIVZmlQUOD7h7ILl/i4rs2EW9JmT6ZBVBxM4ICnu3Ccu0vHmQZW+T51NrIBdCYJxO5+9VFnbZTjglaA6Qs5fwbu56jrQOdrgcpLnLDn50g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694810231; 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=KDSe7vxMZ9OZ+bpYqWCJZrdUb9NZGoKHWUMCEWiKfaA=; b=Al9TAgREQj8aJo7nPqNO6szmx/jSNv0xLawc5cd+10eC4gx+6ltLIT8xWRzP97n5TVgD5k1KIDXXlLZ03VjKUbA/g7M20P6fZmgVeCtGCf8Ujy3pL8mgtXvHO5jQH71vC7MNfgUfpHG77Lt7ScnfNJa6JS4RFkEQek8iCpRTfp0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1694810231077660.7643772322941; Fri, 15 Sep 2023 13:37:11 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.603361.940342 (Exim 4.92) (envelope-from ) id 1qhFYW-0001VQ-51; Fri, 15 Sep 2023 20:36:48 +0000 Received: by outflank-mailman (output) from mailman id 603361.940342; Fri, 15 Sep 2023 20:36:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qhFYW-0001VH-1i; Fri, 15 Sep 2023 20:36:48 +0000 Received: by outflank-mailman (input) for mailman id 603361; Fri, 15 Sep 2023 20:36:46 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qhFYU-0001T8-5e for xen-devel@lists.xenproject.org; Fri, 15 Sep 2023 20:36:46 +0000 Received: from esa5.hc3370-68.iphmx.com (esa5.hc3370-68.iphmx.com [216.71.155.168]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 94e8f95e-5407-11ee-8788-cb3800f73035; Fri, 15 Sep 2023 22:36:44 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 94e8f95e-5407-11ee-8788-cb3800f73035 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1694810204; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ff/2EofbVuWE4xzAF9UfYfZVRYEZrCslF2ClKTfM04U=; b=RFSfLxzTJr4D0sPrH8BtnfT0VLMFyxgo6ItOgPgA5zFusk44NnCrW8Er jqjQZ2nl0v+jSznsG2fdnwQlt7FhNISk1GFMh5o/0doQvqxm/Je3S+4vv 8tT3FyryjWA0eGRwM4/HISRnQe85gRjYsZNOX6ULB5TQGQ0kUl1or5I1S I=; X-CSE-ConnectionGUID: yX2361nNQWCUBRY66Zgs3Q== X-CSE-MsgGUID: gGehqQ37Tya7O0+Nb3lSjw== Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 121464505 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.123 X-Policy: $RELAYED X-ThreatScanner-Verdict: Negative IronPort-Data: A9a23:xRZ9MaryxRbzLJ9BFoOKXBfp4xZeBmIuZRIvgKrLsJaIsI4StFCzt garIBnVOP/eZjHxKd5/YI7loU9Q75+Hy9dkTgto+yg1EHsUoJuZCYyVIHmrMnLJJKUvbq7FA +Y2MYCccZ9uHhcwgj/3b9ANeFEljfngqoLUUbOCYmYpA1Y8FE/NsDo788YhmIlknNOlNA2Ev NL2sqX3NUSsnjV5KQr40YrawP9UlKq04GlwUmAWP6gR5wePziRNV/rzGInqR5fGatgMdgKFb 76rIIGRpgvx4xorA9W5pbf3GmVirmn6ZFXmZtJ+AsBOszAazsAA+v9T2Mk0MC+7vw6hjdFpo OihgLTrIesf0g8gr8xGO/VQO3kW0aSrY9YrK1Dn2SCY5xWun3cBX5yCpaz5VGEV0r8fPI1Ay RAXACE9NEvd3uSQ+Y2Qd8NWt5p9HsbwZ7pK7xmMzRmBZRonaZXKQqGM7t5ExjYgwMtJGJ4yZ eJAN2ApNk6ZJUQSZBFOUslWcOSA3xETdxVxrl6PqLVxyG/U1AFri5DmMcbPe8zMTsJQ9qqdj jucpjinXkxCabRzzxKK3X+sn9aUwh/qUd01TP6e/KVuu1+Mkzl75Bo+CgLg/KjRZlSFc8JSL QkY9zQjqYA29Ve3VZ/tUhugunmGsxUAHd1KHIUS6guA167V6AaxHXUfQ3hKb9lOnNAybSwn0 BmOhdyBLT5utrqVD3GU8LjSrimaNi0cLGtEbigBJTbp+PG6/tt11EiWCI8+Tujs1Iad9SzML y6ivRhk3OtKi+gy6I6G12r23WyeqYOSd1tgjunIZV6N4gR8bY+jQoWn71nH8PpNRLqkokm9U GsswJbHsr1XZX2ZvGnUGbhWQun1jxqQGGeE6WODCaXN4NhEF5SLWYlLqA9zK05yWirvUW+4O RSD0e+9CXI6AZdLUUOVS9jhYyjJ5fK6fTgAahwzRoMUCqWdjCfdoElTibe4hggBanQEn6AlI ou8es2xF3scAqkP5GPoFrtNieV0ln1umDq7qXXHI/KPi+L2iJm9E+xtDbdzRrphsPPsTPv9r L6zyPdmOz0ACbajM0E7AKYYLEwQLGhTOHwFg5U/SwJ3GSI/QDtJI6aIkdscl3lNw/w9ehHgo ivsBSe1CTPX2RX6FOl9Qis6Mem3AMcu8SpT0O5FFQ/A5kXPqL2HtM83H6bbt5F9nAC/5ZaYl 8U4Rvg= IronPort-HdrOrdr: A9a23:NPWp3q1JvOk65HR1HvB/9gqjBHYkLtp133Aq2lEZdPU0SKGlfq GV7ZEmPHrP4gr5N0tOpTntAse9qBDnhPxICOsqXYtKNTOO0AeVxelZhrcKqAeQeBEWmNQ96U 9hGZIOcuEZDzJB/LvHCN/TKadd/DGFmprY+ts31x1WPGVXgzkL1XYANu6ceHcGIzVuNN4CO7 e3wNFInDakcWR/VLXBOpFUN9KzweEijfjdEGc7OyI= X-Talos-CUID: =?us-ascii?q?9a23=3AT2KxqWh2nv5e3hC51210I5aTfzJuY02HlymJJWm?= =?us-ascii?q?BNk1UYoekFwGi97g/qp87?= X-Talos-MUID: 9a23:Br8lPAbkRHvgAOBTuBDhhChbb5hU8q3xLxhOt59dv/KGKnkl X-IronPort-AV: E=Sophos;i="6.02,150,1688443200"; d="scan'208";a="121464505" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , Jinoh Kang Subject: [PATCH 4/7] x86/pv: Drop priv_op_ctxt.bpmatch and use pending_dbg instead Date: Fri, 15 Sep 2023 21:36:25 +0100 Message-ID: <20230915203628.837732-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230915203628.837732-1-andrew.cooper3@citrix.com> References: <20230915203628.837732-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1694810232895100003 With a full pending_dbg field in x86_emulate_ctxt, use it rather than using= a local bpmatch field. This simplifies the X86EMUL_OKAY path as singlestep is already accumulated = by x86_emulate() when appropriate. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu CC: Jinoh Kang v2: * Tweak commit message to avoid referencing X86EMUL_DONE. --- xen/arch/x86/pv/emul-priv-op.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c index 0d9f84f458ba..2f73ed0682e1 100644 --- a/xen/arch/x86/pv/emul-priv-op.c +++ b/xen/arch/x86/pv/emul-priv-op.c @@ -34,7 +34,6 @@ struct priv_op_ctxt { unsigned long base, limit; } cs; char *io_emul_stub; - unsigned int bpmatch; }; =20 /* I/O emulation helpers. Use non-standard calling conventions. */ @@ -367,7 +366,8 @@ static int cf_check read_io( if ( !guest_io_okay(port, bytes, curr, ctxt->regs) ) return X86EMUL_UNHANDLEABLE; =20 - poc->bpmatch =3D check_guest_io_breakpoint(curr, port, bytes); + poc->ctxt.retire.pending_dbg |=3D + check_guest_io_breakpoint(curr, port, bytes); =20 if ( admin_io_okay(port, bytes, currd) ) { @@ -472,7 +472,8 @@ static int cf_check write_io( if ( !guest_io_okay(port, bytes, curr, ctxt->regs) ) return X86EMUL_UNHANDLEABLE; =20 - poc->bpmatch =3D check_guest_io_breakpoint(curr, port, bytes); + poc->ctxt.retire.pending_dbg |=3D + check_guest_io_breakpoint(curr, port, bytes); =20 if ( admin_io_okay(port, bytes, currd) ) { @@ -636,7 +637,8 @@ static int cf_check rep_ins( return X86EMUL_EXCEPTION; } =20 - poc->bpmatch =3D check_guest_io_breakpoint(curr, port, bytes_per_rep); + poc->ctxt.retire.pending_dbg |=3D + check_guest_io_breakpoint(curr, port, bytes_per_rep); =20 while ( *reps < goal ) { @@ -658,7 +660,7 @@ static int cf_check rep_ins( =20 ++*reps; =20 - if ( poc->bpmatch || hypercall_preempt_check() ) + if ( poc->ctxt.retire.pending_dbg || hypercall_preempt_check() ) break; =20 /* x86_emulate() clips the repetition count to ensure we don't wra= p. */ @@ -703,7 +705,8 @@ static int cf_check rep_outs( return X86EMUL_EXCEPTION; } =20 - poc->bpmatch =3D check_guest_io_breakpoint(curr, port, bytes_per_rep); + poc->ctxt.retire.pending_dbg |=3D + check_guest_io_breakpoint(curr, port, bytes_per_rep); =20 while ( *reps < goal ) { @@ -726,7 +729,7 @@ static int cf_check rep_outs( =20 ++*reps; =20 - if ( poc->bpmatch || hypercall_preempt_check() ) + if ( poc->ctxt.retire.pending_dbg || hypercall_preempt_check() ) break; =20 /* x86_emulate() clips the repetition count to ensure we don't wra= p. */ @@ -1360,12 +1363,9 @@ int pv_emulate_privileged_op(struct cpu_user_regs *r= egs) case X86EMUL_OKAY: ASSERT(!curr->arch.pv.trap_bounce.flags); =20 - if ( ctxt.ctxt.retire.singlestep ) - ctxt.bpmatch |=3D DR_STEP; - - if ( ctxt.bpmatch ) + if ( ctxt.ctxt.retire.pending_dbg ) { - curr->arch.dr6 |=3D ctxt.bpmatch | DR_STATUS_RESERVED_ONE; + curr->arch.dr6 |=3D ctxt.ctxt.retire.pending_dbg | DR_STATUS_R= ESERVED_ONE; pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC); } =20 --=20 2.30.2