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

Re: [Xen-devel] [PATCH 1/2] x86/xen/apic: Work with UP, non-SMP 32-bit kernels.



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@xxxxxxxxxx>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
> ---
>  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
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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