[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH for-4.21] x86/hvm: fix reading from 0xe9 IO port if port E9 hack is active


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Thu, 2 Oct 2025 12:22:00 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5QUB8XuJaJVA7h4ehC5DNoDp0OLu6jlM/AdVcy6r/j0=; b=Zun3qwVCGSdU1lE0tqw9I0K2Cg0gZRVaWBgo+gDMlbjCIX8MhuBZ5yYJ32nekVfQ5x4hmr/xkIEmTcOYqF0+NB+L49HleKBZ+dj9zzlG4AXbvIvNbyrsEPWEtuLvwZtxSDGaUhh6NYuZlC9dMxESjw+6ZZef9SHZxTuAgNd+0oMsgjq2JAi1oDr7ruvN7MrSbgEUAI++gXoycgi5d70vr6uOQy8AaAOMtyzWNcMpdXGR5+2g6tTRLkqB2npeeVqMXgG2bn2p9kTQBhYy4FGT4V2xlAV7i/OjCQKWsyzoqUhb/JJoUjoN4xpN2fc8qRkZ8s0aLLftL4oerob+MiItYw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HwtyMWs9h/W1KrkMJ62pVYm1sEFV5RfmUdFgeBAPACUpim8qAbQ6VieT9m2tXSlJ1/g4YTtzeLnX6PMFCJ0AzUlyGO2B8m1dF33RRyKoC6dIoYb2Hu1Ktlj8B1psudxKiEk3k43PCt6pk1+1Af/swIBFenwWQf9oxdOh9wOkSnvckByubzaXvLDRqAFPOaNy4d+0UsXRwC43cr5MLJjh27fCzo9H9azBnLhOSHg0TfPaVWcC8/M3UX8gZmLxVhTQD9TiPdLpJqfZ0DZe2K4Ki+wX6WxK6RlPmOVbNFalM/uTaR36fGnK3K1oiPdE/H7cKdjdeC3+8M/4SkAjWSyxaA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Thu, 02 Oct 2025 10:22:24 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Reading from the E9 port if the emergency console is active should return
0xe9 according to the documentation from Bochs:

https://bochs.sourceforge.io/doc/docbook/user/bochsrc.html

See `port_e9_hack` section description.

Fix Xen so it also returns the port address.  OSes can use it to detect
whether the emergency console is available or not.

Fixes: d1bd157fbc9b ("Big merge the HVM full-virtualisation abstractions.")
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/arch/x86/hvm/hvm.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 23bd7f078a1d..0c60faa39d7b 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -567,9 +567,15 @@ static int cf_check hvm_print_line(
 
     ASSERT(bytes == 1 && port == XEN_HVM_DEBUGCONS_IOPORT);
 
-    /* Deny any input requests. */
-    if ( dir != IOREQ_WRITE )
-        return X86EMUL_UNHANDLEABLE;
+    if ( dir == IOREQ_READ )
+    {
+        /*
+         * According to Bochs documentation, reading from the E9 port should
+         * return 0xE9 if the "port E9 hack" is implemented.
+         */
+        *val = XEN_HVM_DEBUGCONS_IOPORT;
+        return X86EMUL_OKAY;
+    }
 
     if ( !is_console_printable(c) )
         return X86EMUL_OKAY;
-- 
2.51.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.