All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>,
	Jan Beulich <JBeulich@suse.com>, Wei Liu <wl@xen.org>
Subject: Re: [PATCH] x86/ioapic: Check 1k alignment for IO-APIC physical addresses
Date: Mon, 20 Nov 2023 18:36:04 +0100	[thread overview]
Message-ID: <ZVuZBGcbyZK8CESL@macbook.local> (raw)
In-Reply-To: <20231120151006.168773-1-andrew.cooper3@citrix.com>

On Mon, Nov 20, 2023 at 03:10:06PM +0000, Andrew Cooper wrote:
> The MP spec requires a minimum of 1k alignment.  So too does Xen's use of a
> single fixmap page to map the IO-APIC.
> 
> Reject out-of-spec values so we don't end up in a position where a bad
> firmware value causes Xen to use the wrong mapping.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Wei Liu <wl@xen.org>
> CC: Roger Pau Monné <roger.pau@citrix.com>
> ---
>  xen/arch/x86/io_apic.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
> index 0ef61fb2f167..db1ea6e2f2ca 100644
> --- a/xen/arch/x86/io_apic.c
> +++ b/xen/arch/x86/io_apic.c
> @@ -2589,10 +2589,11 @@ static void __init ioapic_init_mappings(void)
>          union IO_APIC_reg_01 reg_01;
>          paddr_t ioapic_phys = mp_ioapics[i].mpc_apicaddr;
>  
> -        if ( !ioapic_phys )
> +        if ( !ioapic_phys || (ioapic_phys & (KB(1) - 1)) )

Might be clearer to use !IS_ALIGNED(), otherwise:

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

>          {
>              printk(KERN_ERR
> -                   "WARNING: bogus zero IO-APIC address found in MPTABLE, disabling IO/APIC support!\n");
> +                   "WARNING: bogus IO-APIC address %08lx found in MPTABLE, disabling IO/APIC support!\n",

FWIW, I think the '!' at the end is not useful, and I would adjust
the last 'IO/APIC' to 'IO-APIC' if already modifying the line.

Thanks, Roger.


  parent reply	other threads:[~2023-11-20 17:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-20 15:10 [PATCH] x86/ioapic: Check 1k alignment for IO-APIC physical addresses Andrew Cooper
2023-11-20 16:06 ` Jan Beulich
2023-11-20 16:09   ` Andrew Cooper
2023-11-20 17:36 ` Roger Pau Monné [this message]
2023-11-20 17:38   ` Andrew Cooper

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=ZVuZBGcbyZK8CESL@macbook.local \
    --to=roger.pau@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=wl@xen.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.