Messages in this thread Patch in this message | | | From | Thomas Gleixner <> | Subject | Re: [patch V2 50/58] x86/apic: Provide common init infrastructure | Date | Tue, 01 Aug 2023 09:30:39 +0200 |
| |
On Tue, Aug 01 2023 at 08:41, Thomas Gleixner wrote:
> On Mon, Jul 31 2023 at 17:48, Thomas Gleixner wrote: > >> On Mon, Jul 31 2023 at 15:10, Juergen Gross wrote: >>> On 31.07.23 15:01, Thomas Gleixner wrote: >>>>> apic_driver(xen_pv_apic); >>>> >>>> I wonder whether this explicit install is actually needed at all. >>>> Shouldn't the driver be installed via the APIC probing mechanism >>>> automagically? >>> >>> Only in case x86_init.irq.intr_mode_init is set appropriately. Today it is >>> a nop for Xen PV, but that can be changed. I'll have a look. >> >> You could simply set that callback to default_setup_apic_routing() and >> be done with it. > > Doesn't work because XEN overrides it already. So sure, lets just go > with the solution you proposed. One more ugly or less in XEN/PV does not > really matter much :) > > Let me grab this and put it into the right position in the queue.
Spoke too early. The below should work AFAICT from the code.
--- a/arch/x86/xen/apic.c +++ b/arch/x86/xen/apic.c @@ -99,10 +99,7 @@ static void xen_apic_icr_write(u32 low, static int xen_apic_probe_pv(void) { - if (xen_pv_domain()) - return 1; - - return 0; + return xen_pv_domain(); } static int xen_madt_oem_check(char *oem_id, char *oem_table_id) @@ -157,20 +154,14 @@ static struct apic xen_pv_apic = { .icr_read = xen_apic_icr_read, .icr_write = xen_apic_icr_write, }; - -static void __init xen_apic_check(void) -{ - apic_install_driver(&xen_pv_apic); -} +apic_driver(xen_pv_apic); void __init xen_init_apic(void) { x86_apic_ops.io_apic_read = xen_io_apic_read; - /* On PV guests the APIC CPUID bit is disabled so none of the - * routines end up executing. */ - if (!xen_initial_domain()) - apic_install_driver(&xen_pv_apic); - - x86_platform.apic_post_init = xen_apic_check; + /* + * On PV guests the APIC CPUID bit is disabled so none of the + * routines end up executing. + */ + apic_install_driver(&xen_pv_apic); } -apic_driver(xen_pv_apic); --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -1325,7 +1325,7 @@ asmlinkage __visible void __init xen_sta x86_platform.realmode_init = x86_init_noop; x86_init.resources.memory_setup = xen_memory_setup; - x86_init.irqs.intr_mode_select = x86_init_noop; + x86_init.irqs.intr_mode_select = xen_init_apic; x86_init.irqs.intr_mode_init = x86_init_noop; x86_init.oem.arch_setup = xen_arch_setup; x86_init.oem.banner = xen_banner; @@ -1366,13 +1366,6 @@ asmlinkage __visible void __init xen_sta xen_init_capabilities(); -#ifdef CONFIG_X86_LOCAL_APIC - /* - * set up the basic apic ops. - */ - xen_init_apic(); -#endif - machine_ops = xen_machine_ops; /* --- a/arch/x86/xen/xen-ops.h +++ b/arch/x86/xen/xen-ops.h @@ -118,7 +118,11 @@ static inline void __init xen_init_vga(c void xen_add_preferred_consoles(void); +#ifdef CONFIG_X86_LOCAL_APIC void __init xen_init_apic(void); +#else +# define xen_init_apic x86_init_noop +#endif #ifdef CONFIG_XEN_EFI extern void xen_efi_init(struct boot_params *boot_params);
| |