All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: boris.ostrovsky@oracle.com, david.vrabel@citrix.com,
	xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] x86/xen/apic: Work with UP, non-SMP 32-bit kernels.
Date: Tue, 3 Mar 2015 15:29:28 -0500	[thread overview]
Message-ID: <20150303202928.GA15436@l.oracle.com> (raw)
In-Reply-To: <1425414042-13897-2-git-send-email-konrad.wilk@oracle.com>

On Tue, Mar 03, 2015 at 03:20:41PM -0500, Konrad Rzeszutek Wilk wrote:
> Most of the APIC code that use APIC_LDR is not used on
> 64-bit. On 32-bit it is bit of an hack - and the mechanism
> it is uses is to "setup" the APIC_LDR via apci->init_apic_ldr
> (which we set to NULL) and then use apic->x86_32_early_logical_apicid
> to get an CPU to APIC ID mapping and also apic->read to match
> the APIC_LDR.
> 
> The 'x86_32_early_logical_apicid' is called from 'setup_local_APIC'
> which is called from the following functions:
>  - start_secondary ->smp_callin -> apic_ap_setup [not called on PV]
>  - native_smp_prepare_cpus -> apci_bsp_setup [not called on PV]
>  - up_late_init -> APIC_init_uniprocessor -> apic_bsp_setup ->setup_local_APIC
>    [called on PV with CONFIG_SMP not defined, CONFIG_X86_32 and UP kernel]
> 
> This patch fixes the build issue and also allows the bootup
> to continue without warnings.
> 
> Reported-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
>  arch/x86/xen/apic.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/xen/apic.c b/arch/x86/xen/apic.c
> index 86bea3e..de1c74d 100644
> --- a/arch/x86/xen/apic.c
> +++ b/arch/x86/xen/apic.c
> @@ -56,7 +56,10 @@ static u32 xen_apic_read(u32 reg)
>  
>  	if (reg == APIC_LVR)
>  		return 0x10;
> -
> +#ifdef CONFIG_X86_32
> +	if (reg == APIC_LDR)
> +		return SET_APIC_LOGICAL_ID(1UL << smp_processor_id());
> +#endif
>  	if (reg != APIC_ID)
>  		return 0;
>  
> @@ -117,6 +120,12 @@ static int xen_phys_pkg_id(int initial_apic_id, int index_msb)
>  	return initial_apic_id >> index_msb;
>  }
>  
> +static int xen_x86_32_early_logical_apicid(int cpu)
> +{
> +	/* Match with APIC_LDR read. Otherwise setup_local_APIC complains. */
> +	return 1 << cpu;
> +}
> +

Argh. That should have been wrapped with CONFIG_X86_32 otherwise it will complain
on 64-bit (not used.. etc).

David, I can commit it in and fix it up.

>  static void xen_noop(void)
>  {
>  }
> @@ -176,8 +185,8 @@ static struct apic xen_pv_apic = {
>  	.safe_wait_icr_idle 		= xen_safe_apic_wait_icr_idle,
>  
>  #ifdef CONFIG_X86_32
> -	/* generic_processor_info */
> -	.x86_32_early_logical_apicid	= default_x86_32_early_logical_apicid,
> +	/* generic_processor_info and setup_local_APIC. */
> +	.x86_32_early_logical_apicid	= xen_x86_32_early_logical_apicid,
>  #endif
>  };
>  
> -- 
> 1.8.4.2
> 

  reply	other threads:[~2015-03-03 20:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-03 20:20 [PATCH] Fixes to x86/xen: Provide a Xen PV APIC driver to support patch Konrad Rzeszutek Wilk
2015-03-03 20:20 ` [PATCH 1/2] x86/xen/apic: Work with UP, non-SMP 32-bit kernels Konrad Rzeszutek Wilk
2015-03-03 20:20 ` Konrad Rzeszutek Wilk
2015-03-03 20:29   ` Konrad Rzeszutek Wilk [this message]
2015-03-04  9:33     ` David Vrabel
2015-03-04  9:33     ` David Vrabel
2015-03-03 20:29   ` Konrad Rzeszutek Wilk
2015-03-03 20:20 ` [PATCH 2/2] x86/xen/apic: WARN with details Konrad Rzeszutek Wilk
2015-03-03 20:20 ` Konrad Rzeszutek Wilk

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=20150303202928.GA15436@l.oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=linux-kernel@vger.kernel.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.