Re: [patch V2 50/58] x86/apic: Provide common init infrastructure

From: Juergen Gross
Date: Tue Aug 01 2023 - 03:08:24 EST


On 01.08.23 08:49, Juergen Gross wrote:
On 01.08.23 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

It is overriding it with x86_init_noop().

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.

Wait a few minutes, please. I'm just about to test your suggestion.

Using the following diff on top of your patch is working fine:

diff --git a/arch/x86/xen/apic.c b/arch/x86/xen/apic.c
index 804a26b7c85e..d7743ba0212d 100644
--- a/arch/x86/xen/apic.c
+++ b/arch/x86/xen/apic.c
@@ -166,11 +166,6 @@ static void __init xen_apic_check(void)
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;
}
apic_driver(xen_pv_apic);
diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
index 93b658248d01..164e5be23a45 100644
--- a/arch/x86/xen/enlighten_pv.c
+++ b/arch/x86/xen/enlighten_pv.c
@@ -1326,7 +1326,7 @@ asmlinkage __visible void __init xen_start_kernel(struct start_info *si)

x86_init.resources.memory_setup = xen_memory_setup;
x86_init.irqs.intr_mode_select = x86_init_noop;
- x86_init.irqs.intr_mode_init = x86_init_noop;
+ x86_init.irqs.intr_mode_init = x86_64_probe_apic;
x86_init.oem.arch_setup = xen_arch_setup;
x86_init.oem.banner = xen_banner;
x86_init.hyper.init_platform = xen_pv_init_platform;


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature