mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: "Pan, Jacob jun" <jacob.jun.pan@intel.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
	LKML <linux-kernel@vger.kernel.org>, x86 team <x86@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Arjan van de Veen <arjan@infradead.org>,
	Avi Kivity <avi@redhat.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Alok N Kataria <akataria@vmware.com>
Subject: Re: [RFC PATCH 3/7] x86: add moorestown specific platform setup code
Date: Sat, 29 Aug 2009 19:20:58 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.00.0908291900090.19335@localhost.localdomain> (raw)
In-Reply-To: <43F901BD926A4E43B106BF17856F07556A5EA874@orsmsx508.amr.corp.intel.com>

On Fri, 28 Aug 2009, Pan, Jacob jun wrote:

> >From dbb97928dc27061b56fc86b9b37f71f54bbafb59 Mon Sep 17 00:00:00 2001
> From: Jacob Pan <jacob.jun.pan@intel.com>
> Date: Fri, 28 Aug 2009 08:31:45 -0700
> Subject: [PATCH] x86: add moorestown specific platform setup code
> 
> This patch fills in platform_setup functions for Moorestown. The abstraction
> is used to integarte into pc compaitible boot flow.

Your patch series is horrible as it breaks left and right. Patches
need to be ordered so they compile and boot in any stage.
 
> Signed-off-by: Jacob Pan <jacob.jun.pan@intel.com>
> ---
>  arch/x86/include/asm/setup.h |    8 ++
>  arch/x86/kernel/Makefile     |    1 +
>  arch/x86/kernel/mrst.c       |  149 ++++++++++++++++++++++++++++++++++++++++++
>  arch/x86/kernel/setup.c      |    1 +
>  4 files changed, 159 insertions(+), 0 deletions(-)
>  create mode 100644 arch/x86/kernel/mrst.c
> 
> diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h
> index 055b778..2ef1514 100644
> --- a/arch/x86/include/asm/setup.h
> +++ b/arch/x86/include/asm/setup.h
> @@ -49,6 +49,14 @@ extern void reserve_standard_io_resources(void);
>  extern void i386_reserve_resources(void);
>  extern void setup_default_timer_irq(void);
>  
> +#ifdef CONFIG_MRST
> +extern void mrst_early_detect(void);
> +extern void setup_mrst_default_feature(void);

Why ? The function is inline in mrst.c.

> +++ b/arch/x86/kernel/mrst.c
> @@ -0,0 +1,149 @@
> +/*
> + * mrst.c: Intel Moorestown platform specific setup code
> + *
> + * (C) Copyright 2008 Intel Corporation
> + * Author: Jacob Pan (jacob.jun.pan@intel.com)
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; version 2
> + * of the License.
> + *
> + * Note:
> + *
> + */
> +
> +#include <linux/stackprotector.h>
> +#include <linux/spi/spi.h>
> +#include <linux/i2c.h>
> +#include <linux/sfi.h>
> +#include <linux/i2c/pca953x.h>
> +#include <linux/spi/langwell_pmic_gpio.h>
> +#include <linux/gpio_keys.h>
> +#include <linux/input.h>
> +#include <linux/platform_device.h>
> +#include <linux/pci.h>
> +
> +#include <asm/platform_feature.h>
> +#include <asm/apb_timer.h>
> +#include <asm/apic.h>
> +#include <asm/hw_irq.h>
> +#include <asm/setup.h>
> +#include <asm/io.h>

Do we really need that whole bunch of includes ?

> +#define LANGWELL_GPIO_ALT_ADDR	0xff12c038
> +#define MRST_I2C_BUSNUM		3

That should be in the appropriate header file aside of being unused.

> +static inline void __init mrst_pre_intr_init(void)
> +{
> +	pre_init_apic_IRQ();
> +}

Later on you assign that function to:

> +	platform_setup.irqs.pre_vector_init = mrst_pre_intr_init;

I don't think that's correct. You need the early setup of the APIC
when you setup the APBT timer, but that's way after pre_vector_init.

Please do not use random platform functions just because they are
available.

The setup of the APIC to make your timer work should be done either in
context of the timer init function or in some appropriate place before
that.

> +/*
> + * the secondary clock in Moorestown can be APBT or LAPIC clock, default to
> + * APBT but cmdline option can also override it.

We have the platform functions to avoid constructs like this. If you
set the function pointer to mrst_setup_secondary_clock in your
platform init the you can check the disable_apbt_percpu there or
restore the default in the function which evaluates the command line
option.

> + */
> +static void __init mrst_setup_secondary_clock(void)

Needs to be __cpuinit. If you have CPU_HOTPLUG enabled, which you need
for suspend/hibernate this function will be gone at the point you
access it.

> +{
> +	if (disable_apbt_percpu)
> +		return setup_secondary_APIC_clock();
> +	else {
> +#ifdef CONFIG_CC_STACKPROTECTOR
> +		/*
> +		  * TBD:
> +		 * this is to avoid false stack corruption panic since
> +		 * request_irq will be called early for secondary apbt clock.
> +		*/
> +		boot_init_stack_canary();
  
Eeek. Why is this related to request_irq ?

> +#endif
> +		apbt_setup_secondary_clock();
> +	}
> +}
> +
> +static void __init mrst_check_timer(void)
> +{
> +	if (timer_irq_works())
> +		printk(KERN_INFO "APB timer works\n");
> +	else
> +		panic("Check APB timer failed\n");
> +}

Errm. You add a new platform function just to add printk debug noise ?

> +static unsigned long __init mrst_calibrate_tsc(void)
> +{
> +	unsigned long flags, fast_calibrate;
> +
> +	local_irq_save(flags);
> +	fast_calibrate = apbt_quick_calibrate();
> +	local_irq_restore(flags);
> +
> +	if (fast_calibrate)
> +		return fast_calibrate;
> +
> +	return 0;

  	return fast_calibrate;

	might do the same with less obfuscation.

> +}

> +inline void setup_mrst_default_feature(void)
> +{
> +	/*
> +	 * x86pc default platform setup ops are setup prior to start_kernel
> +	 * we override default platform_setup calls for Moorestown
> +	 */
> +	platform_setup.resources.reserve_ebda_region = platform_setup_noop;

  See below.

> +void __init mrst_early_detect(void)
> +{
> +	int subarch_id = boot_params.hdr.hardware_subarch;
> +
> +	if ((subarch_id >= 0) && (subarch_id < N_X86_SUBARCHS)) {

  What's the purpose of this check ? Either it's X86_SUBARCH_MRST or
  not.

> +		if (subarch_id == X86_SUBARCH_MRST) {
> +			setup_mrst_default_feature();
> @@ -692,6 +692,7 @@ void __init setup_arch(char **cmdline_p)
>  #ifdef CONFIG_X86_32
>  	memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
>  	visws_early_detect();
> +	mrst_early_detect();

That call is too late.

You override platform_setup.resources.reserve_ebda_region _AFTER_ it
has been called.

Thanks,

	tglx

  reply	other threads:[~2009-08-29 17:22 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-21 21:29 [RFC patch 00/32] x86: Refactor the setup code to provide a base for embedded platforms Thomas Gleixner
2009-08-21 21:29 ` [RFC patch 01/32] x86: Add platform_setup infrastructure Thomas Gleixner
2009-08-21 21:29 ` [RFC patch 02/32] x86: Add probe_roms to platform_setup Thomas Gleixner
2009-08-21 22:23   ` Jeremy Fitzhardinge
2009-08-21 22:36     ` Thomas Gleixner
2009-08-28 21:52       ` [RFC PATCH 0/7] x86/boot: Moorestown patch set based on platform_set abstraction Pan, Jacob jun
2009-08-29 16:59         ` Thomas Gleixner
2009-08-28 21:52       ` [RFC PATCH 2/7] x86: introduce a set of platform feature flags Pan, Jacob jun
2009-08-28 21:52       ` [RFC PATCH 3/7] x86: add moorestown specific platform setup code Pan, Jacob jun
2009-08-29 17:20         ` Thomas Gleixner [this message]
2009-08-28 21:53       ` [RFC PATCH 4/7] x86/apbt: Moorestown APB system timer driver Pan, Jacob jun
2009-08-28 21:53       ` [RFC PATCH 5/7] x86/apic: decouple legacy irq handling in ioapic Pan, Jacob jun
2009-08-28 21:53       ` [RFC PATCH 6/7] x86/apic: Early setup IOAPIC for APB timer Pan, Jacob jun
2009-08-28 21:53       ` [RFC PATCH 7/7] x86: add more platform_setup functions Pan, Jacob jun
2009-08-29 17:31         ` Thomas Gleixner
2009-08-21 21:29 ` [RFC patch 03/32] x86: Add request_standard_resources to platform_setup Thomas Gleixner
2009-08-21 21:29 ` [RFC patch 04/32] x86: Add reserve_ebda_region " Thomas Gleixner
2009-08-21 21:29 ` [RFC patch 05/32] x86: Move memory_setup to platform Thomas Gleixner
2009-08-21 21:29 ` [RFC patch 06/32] x86: Sanitize smp_record and move it to platform_setup Thomas Gleixner
2009-08-21 21:30 ` [RFC patch 07/32] x86: Move ioapic_ids_setup " Thomas Gleixner
2009-08-21 21:30 ` [RFC patch 08/32] x86: Move mpc_apic_id " Thomas Gleixner
2009-08-21 21:30 ` [RFC patch 09/32] x86: Move smp_read_mpc_oem " Thomas Gleixner
2009-08-21 21:30 ` [RFC patch 10/32] x86: Move mpc_oem_pci_bus " Thomas Gleixner
2009-08-21 21:30 ` [RFC patch 11/32] x86: Move oem_bus_info " Thomas Gleixner
2009-08-21 21:30 ` [RFC patch 12/32] x86: Move get/find_smp_config " Thomas Gleixner
2009-08-21 21:30 ` [RFC patch 13/32] x86: Move pre_intr_init " Thomas Gleixner
2009-08-21 21:30 ` [RFC patch 14/32] x86: Move irq_init " Thomas Gleixner
2009-08-21 21:30 ` [RFC patch 15/32] x86: Move traps_init " Thomas Gleixner
2009-08-21 21:30 ` [RFC patch 16/32] x86: Replace ARCH_SETUP by a proper platform function Thomas Gleixner
2009-08-21 22:30   ` Jeremy Fitzhardinge
2009-08-21 23:42     ` Thomas Gleixner
2009-08-28 21:52       ` [PATCH 1/7] x86/boot: adding hw subarch ID for Moorestown Pan, Jacob jun
2009-08-29 16:58         ` Thomas Gleixner
2009-08-21 21:30 ` [RFC patch 17/32] x86: Move paravirt banner printout to platform Thomas Gleixner
2009-08-21 21:30 ` [RFC patch 18/32] x86: Move paravirt pagetable_setup " Thomas Gleixner
2009-08-21 21:31 ` [RFC patch 19/32] x86: Move xen_post_allocator_init into xen_pagetable_setup_done Thomas Gleixner
2009-08-21 21:31 ` [RFC patch 20/32] x86: Move percpu clockevents setup to platform Thomas Gleixner
2009-08-21 21:31 ` [RFC patch 21/32] x86: Add timer_init " Thomas Gleixner
2009-08-24  6:48   ` Andrey Panin
2009-08-21 21:31 ` [RFC patch 22/32] x86: Remove do_timer hook Thomas Gleixner
2009-08-21 21:31 ` [RFC patch 23/32] x86: Prepare unification of time_32/64.c Thomas Gleixner
2009-08-21 21:31 ` [RFC patch 24/32] x86: Simplify timer_ack magic in time_32.c Thomas Gleixner
2009-08-21 21:31 ` [RFC patch 25/32] x86: Remove mca bus ifdef from timer interrupt Thomas Gleixner
2009-08-21 21:31 ` [RFC patch 26/32] x86: Make timer setup and global variables the same in time_32/64.c Thomas Gleixner
2009-08-21 21:31 ` [RFC patch 27/32] x86: Move calibrate_cpu to tsc.c Thomas Gleixner
2009-08-21 21:32 ` [RFC patch 28/32] x86: time_32/64.c unify profile_pc Thomas Gleixner
2009-08-21 21:32 ` [RFC patch 29/32] x86: Replace the now identical time_32/64.c by time.c Thomas Gleixner
2009-08-21 21:32 ` [RFC patch 30/32] x86: Move tsc_calibration to platform Thomas Gleixner
2009-08-21 21:32 ` [RFC patch 31/32] init: Move sched_clock_init after late_time_init Thomas Gleixner
2009-08-21 21:32 ` [RFC patch 32/32] x86: Move tsc_init to late_time_init Thomas Gleixner
2009-08-21 22:19 ` [RFC patch 00/32] x86: Refactor the setup code to provide a base for embedded platforms Jeremy Fitzhardinge
2009-08-22 10:57 ` Ingo Molnar
2009-08-23  9:15   ` Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.00.0908291900090.19335@localhost.localdomain \
    --to=tglx@linutronix.de \
    --cc=akataria@vmware.com \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=avi@redhat.com \
    --cc=jacob.jun.pan@intel.com \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rusty@rustcorp.com.au \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®