xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Roger Pau Monne <roger.pau@citrix.com>, xen-devel@lists.xenproject.org
Cc: Jan Beulich <jbeulich@suse.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Oleksii Kurochko <oleksii.kurochko@gmail.com>
Subject: Re: [PATCH for-4.21] x86/hvm: fix reading from 0xe9 IO port if port E9 hack is active
Date: Thu, 2 Oct 2025 11:37:36 +0100	[thread overview]
Message-ID: <1b4bcb40-d62b-47b5-847f-b6e16906f52e@citrix.com> (raw)
In-Reply-To: <20251002102200.15548-1-roger.pau@citrix.com>

On 02/10/2025 11:22 am, Roger Pau Monne wrote:
> 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@citrix.com>

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

That's been wrong for rather a long time.  How did you find it?

CC-ing Oleksii as you've tagged this for 4.21.

> ---
>  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;



  reply	other threads:[~2025-10-02 10:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-02 10:22 [PATCH for-4.21] x86/hvm: fix reading from 0xe9 IO port if port E9 hack is active Roger Pau Monne
2025-10-02 10:37 ` Andrew Cooper [this message]
2025-10-02 13:38   ` Roger Pau Monné
2025-10-02 14:02     ` Alejandro Vallejo
2025-10-02 14:17       ` Roger Pau Monné
2025-10-02 14:56         ` Alejandro Vallejo
2025-10-03  8:18           ` Roger Pau Monné
2025-10-03  9:34             ` Alejandro Vallejo
2025-10-03  8:38     ` Oleksii Kurochko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1b4bcb40-d62b-47b5-847f-b6e16906f52e@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=oleksii.kurochko@gmail.com \
    --cc=roger.pau@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).