From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751893AbdKTR1G (ORCPT ); Mon, 20 Nov 2017 12:27:06 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:59521 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751646AbdKTR1F (ORCPT ); Mon, 20 Nov 2017 12:27:05 -0500 Date: Mon, 20 Nov 2017 18:26:56 +0100 (CET) From: Thomas Gleixner To: Konrad Rzeszutek Wilk cc: Jan Kiszka , 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: <20171120143950.GC24312@char.us.oracle.com> Message-ID: References: <20171120143950.GC24312@char.us.oracle.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 20 Nov 2017, Konrad Rzeszutek Wilk wrote: > On Fri, Nov 17, 2017 at 11:42:02PM +0100, Thomas Gleixner wrote: > > 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. > > Could just create a new APIC driver (which would call most of these)? Why so? See further down. > > > > > + } > > > +#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 >