From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422963AbdKQWmY (ORCPT ); Fri, 17 Nov 2017 17:42:24 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:52983 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422947AbdKQWmQ (ORCPT ); Fri, 17 Nov 2017 17:42:16 -0500 Date: Fri, 17 Nov 2017 23:42:02 +0100 (CET) From: Thomas Gleixner To: Jan Kiszka cc: Ingo Molnar , "H . Peter Anvin" , x86@kernel.org, Linux Kernel Mailing List , jailhouse-dev@googlegroups.com Subject: Re: [PATCH 03/10] x86: jailhouse: Enable APIC and SMP support In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 16 Nov 2017, Jan Kiszka wrote: Just noticed, that all prefixes should be 'x86/jailhouse:' please > +static unsigned int x2apic_get_apic_id(unsigned long id) > +{ > + return id; > +} > + > static void __init jailhouse_init_platform(void) > { > u64 pa_data = boot_params.hdr.setup_data; > struct jailhouse_setup_data *data; > + unsigned int cpu; > > data = early_memremap(pa_data, sizeof(*data)); > > @@ -59,6 +66,23 @@ static void __init jailhouse_init_platform(void) > data->compatible_version > SETUP_REQUIRED_VERSION) > panic("Jailhouse: Unsupported setup data structure"); > > +#ifdef CONFIG_X86_X2APIC > + /* > + * Register x2APIC handlers early. We need them when running > + * register_lapic_address. > + */ > + if (x2apic_enabled()) { > + apic->read = native_apic_msr_read; > + apic->write = native_apic_msr_write; > + apic->get_apic_id = x2apic_get_apic_id; Uurgh. That looks hacky. > + } > +#endif > + register_lapic_address(0xfee00000); No need to do all of this here. The right thing to do is to override x86_init.mpparse.get_smp_config which is invoked after generic_apic_probe() which should select x2apic_phys, but I might be wrong. > + for (cpu = 0; cpu < data->num_cpus; cpu++) > + generic_processor_info(data->cpu_ids[cpu], > + boot_cpu_apic_version); Please add brackets around multi line statements. Thanks, tglx