[PATCH] x86/emul: Remove ops->{read,write}_segment checks for swapgs

Teddy Astie posted 1 patch 4 days, 12 hours ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/c29e790caae7642fe442fa68111582ffdb37177c.1775636817.git.teddy.astie@vates.tech
xen/arch/x86/x86_emulate/0f01.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] x86/emul: Remove ops->{read,write}_segment checks for swapgs
Posted by Teddy Astie 4 days, 12 hours ago
Remove these checks now that we don't use these 2 ops anymore.

Amends: 4bedbe47eef4f ("x86/emul: Remove fallback path from SWAPGS")
Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
---
 xen/arch/x86/x86_emulate/0f01.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/0f01.c b/xen/arch/x86/x86_emulate/0f01.c
index 54bd6faf0f..4d36c7d289 100644
--- a/xen/arch/x86/x86_emulate/0f01.c
+++ b/xen/arch/x86/x86_emulate/0f01.c
@@ -187,8 +187,7 @@ int x86emul_0f01(struct x86_emulate_state *s,
     case 0xf8: /* swapgs */
         generate_exception_if(!mode_64bit(), X86_EXC_UD);
         generate_exception_if(!mode_ring0(), X86_EXC_GP, 0);
-        fail_if(!ops->read_segment || !ops->read_msr ||
-                !ops->write_segment || !ops->write_msr);
+        fail_if(!ops->read_msr || !ops->write_msr);
         if ( (rc = ops->read_msr(MSR_GS_BASE, &sreg.base,
                                  ctxt)) != X86EMUL_OKAY ||
              (rc = ops->read_msr(MSR_SHADOW_GS_BASE, &msr_val,
-- 
2.53.0



--
Teddy Astie | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech
Re: [PATCH] x86/emul: Remove ops->{read,write}_segment checks for swapgs
Posted by Andrew Cooper 4 days, 12 hours ago
On 08/04/2026 9:34 am, Teddy Astie wrote:
> Remove these checks now that we don't use these 2 ops anymore.
>
> Amends: 4bedbe47eef4f ("x86/emul: Remove fallback path from SWAPGS")
> Signed-off-by: Teddy Astie <teddy.astie@vates.tech>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>