All of lore.kernel.org
 help / color / mirror / Atom feed
From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm: Fix linux-next compile error in arch/arm/common/gic.c
Date: Tue, 03 Jan 2012 07:53:35 -0600	[thread overview]
Message-ID: <4F03085F.4060008@gmail.com> (raw)
In-Reply-To: <4F02E377.2050409@arm.com>



On 01/03/2012 05:16 AM, Marc Zyngier wrote:
> [Adding Will to the loop as he's the author of the logical map stuff,
> though I'm not sure he'll read that before next week...]
> 
> On 03/01/12 00:44, Yang Bai wrote:
>> On Tue, Jan 3, 2012 at 12:33 AM, Joerg Roedel <joerg.roedel@amd.com> wrote:
>>> With CONFIG_SMP=n the following compile error occurs:
>>>
>>>  CC      arch/arm/common/gic.o
>>> arch/arm/common/gic.c: In function 'gic_init_bases':
>>> arch/arm/common/gic.c:679:4: error: implicit declaration of function 'cpu_logical_map' [-Werror=implicit-function-declaration]
>>> cc1: some warnings being treated as errors
>>>
>>> This patch fixes the problem.
>>>
>>> Cc: Marc Zyngier <marc.zyngier@arm.com>
>>> Cc: Thomas Gleixner <tglx@linutronix.de>
>>> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
>>> Cc: Rob Herring <rob.herring@calxeda.com>
>>> Cc: linux-arm-kernel at lists.infradead.org
>>> Cc: linux-kernel at vger.kernel.org
>>> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
>>> ---
>>>  arch/arm/common/gic.c |    5 ++++-
>>>  1 files changed, 4 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
>>> index b2dc2dd..b33f6b0 100644
>>> --- a/arch/arm/common/gic.c
>>> +++ b/arch/arm/common/gic.c
>>> @@ -676,7 +676,10 @@ void __init gic_init_bases(unsigned int gic_nr, int irq_start,
>>>                }
>>>
>>>                for_each_possible_cpu(cpu) {
>>> -                       unsigned long offset = percpu_offset * cpu_logical_map(cpu);
>>> +                       unsigned long offset = percpu_offset;
>>> +#ifdef CONFIG_SMP
>>> +                       offset *= cpu_logical_map(cpu);
>>> +#endif
>>>                        *per_cpu_ptr(gic->dist_base.percpu_base, cpu) = dist_base + offset;
>>>                        *per_cpu_ptr(gic->cpu_base.percpu_base, cpu) = cpu_base + offset;
>>>                }
>>> --
>>> 1.7.5.4
>>>
>>>
>>
>> Is this the right way to fix it? Or shall we do like this:
>>
>> #ifdef CONFIG_SMP
>> ...
>> #else
>> #define cpu_logical_map() 1
>> #endif
>>
>> and leave the gic.c code unchanged.

IIRC, part of the problem is asm/smp.h is only included by linux/smp.h
for CONFIG_SMP, so this would have to change. Doing that could easily
break other arches.

> 
> Well, both patches are wrong. In the UP case (and assuming we're running
> on physical CPU 0), offset should be 0.
> 
> The second patch would be my favorite approach, except that
> cpu_logical_map(x) should return either "x" or 0. And I'm not sure how
> to handle the (unlikely?) case of running a UP kernel on a secondary CPU...

Wouldn't this be the case with 2 AMP instances of Linux running?

Rob

WARNING: multiple messages have this Message-ID (diff)
From: Rob Herring <robherring2@gmail.com>
To: Marc Zyngier <marc.zyngier@arm.com>
Cc: Yang Bai <hamo.by@gmail.com>, Joerg Roedel <joerg.roedel@amd.com>,
	Russell King <linux@arm.linux.org.uk>,
	Thomas Gleixner <tglx@linutronix.de>,
	Santosh Shilimkar <santosh.shilimkar@ti.com>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Will Deacon <will.deacon@arm.com>
Subject: Re: [PATCH] arm: Fix linux-next compile error in arch/arm/common/gic.c
Date: Tue, 03 Jan 2012 07:53:35 -0600	[thread overview]
Message-ID: <4F03085F.4060008@gmail.com> (raw)
In-Reply-To: <4F02E377.2050409@arm.com>



On 01/03/2012 05:16 AM, Marc Zyngier wrote:
> [Adding Will to the loop as he's the author of the logical map stuff,
> though I'm not sure he'll read that before next week...]
> 
> On 03/01/12 00:44, Yang Bai wrote:
>> On Tue, Jan 3, 2012 at 12:33 AM, Joerg Roedel <joerg.roedel@amd.com> wrote:
>>> With CONFIG_SMP=n the following compile error occurs:
>>>
>>>  CC      arch/arm/common/gic.o
>>> arch/arm/common/gic.c: In function 'gic_init_bases':
>>> arch/arm/common/gic.c:679:4: error: implicit declaration of function 'cpu_logical_map' [-Werror=implicit-function-declaration]
>>> cc1: some warnings being treated as errors
>>>
>>> This patch fixes the problem.
>>>
>>> Cc: Marc Zyngier <marc.zyngier@arm.com>
>>> Cc: Thomas Gleixner <tglx@linutronix.de>
>>> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
>>> Cc: Rob Herring <rob.herring@calxeda.com>
>>> Cc: linux-arm-kernel@lists.infradead.org
>>> Cc: linux-kernel@vger.kernel.org
>>> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
>>> ---
>>>  arch/arm/common/gic.c |    5 ++++-
>>>  1 files changed, 4 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
>>> index b2dc2dd..b33f6b0 100644
>>> --- a/arch/arm/common/gic.c
>>> +++ b/arch/arm/common/gic.c
>>> @@ -676,7 +676,10 @@ void __init gic_init_bases(unsigned int gic_nr, int irq_start,
>>>                }
>>>
>>>                for_each_possible_cpu(cpu) {
>>> -                       unsigned long offset = percpu_offset * cpu_logical_map(cpu);
>>> +                       unsigned long offset = percpu_offset;
>>> +#ifdef CONFIG_SMP
>>> +                       offset *= cpu_logical_map(cpu);
>>> +#endif
>>>                        *per_cpu_ptr(gic->dist_base.percpu_base, cpu) = dist_base + offset;
>>>                        *per_cpu_ptr(gic->cpu_base.percpu_base, cpu) = cpu_base + offset;
>>>                }
>>> --
>>> 1.7.5.4
>>>
>>>
>>
>> Is this the right way to fix it? Or shall we do like this:
>>
>> #ifdef CONFIG_SMP
>> ...
>> #else
>> #define cpu_logical_map() 1
>> #endif
>>
>> and leave the gic.c code unchanged.

IIRC, part of the problem is asm/smp.h is only included by linux/smp.h
for CONFIG_SMP, so this would have to change. Doing that could easily
break other arches.

> 
> Well, both patches are wrong. In the UP case (and assuming we're running
> on physical CPU 0), offset should be 0.
> 
> The second patch would be my favorite approach, except that
> cpu_logical_map(x) should return either "x" or 0. And I'm not sure how
> to handle the (unlikely?) case of running a UP kernel on a secondary CPU...

Wouldn't this be the case with 2 AMP instances of Linux running?

Rob



  reply	other threads:[~2012-01-03 13:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-02 16:33 [PATCH] arm: Fix linux-next compile error in arch/arm/common/gic.c Joerg Roedel
2012-01-02 16:33 ` Joerg Roedel
2012-01-03  0:44 ` Yang Bai
2012-01-03  0:44   ` Yang Bai
2012-01-03  9:31   ` Joerg Roedel
2012-01-03  9:31     ` Joerg Roedel
2012-01-03 11:16   ` Marc Zyngier
2012-01-03 11:16     ` Marc Zyngier
2012-01-03 13:53     ` Rob Herring [this message]
2012-01-03 13:53       ` Rob Herring
2012-01-03 14:05       ` Marc Zyngier
2012-01-03 14:05         ` Marc Zyngier
2012-01-03 17:32         ` Will Deacon
2012-01-03 17:32           ` Will Deacon

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=4F03085F.4060008@gmail.com \
    --to=robherring2@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.