linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: mvebu: use __pa_symbol in the mv98dx3236 platform SMP code
@ 2017-07-07  7:59 Gregory CLEMENT
  2017-07-07  8:02 ` Gregory CLEMENT
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Gregory CLEMENT @ 2017-07-07  7:59 UTC (permalink / raw)
  To: linux-arm-kernel

As we already did for Armada XP switch from virt_to_phys() to
__pa_symbol().

The reason for it was well explained by Mark Rutland so let's quote him:

"virt_to_phys() is intended to operate on the linear/direct mapping of
RAM.

__pa_symbol() is intended to operate on the kernel mapping, which may
not be in the linear/direct mapping on all architectures. e.g. arm64 and
x86_64 map the kernel image and RAM separately.

On 32-bit ARM the kernel image mapping is tied to the linear/direct
mapping, so that works, but as it's semantically wrong (and broken for
generic code), the DEBUG_VIRTUAL checks complain."

Fixes: db88977894ab ("arm: mvebu: support for SMP on 98DX3336 SoC")
Cc: <stable@vger.kernel.org>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
---

Hi Chris,

with this patch I don't expect any regression, hover it would be nice
if you can test it.

Thanks,

Gregory

 arch/arm/mach-mvebu/platsmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
index e62273aacb43..4ffbbd217e82 100644
--- a/arch/arm/mach-mvebu/platsmp.c
+++ b/arch/arm/mach-mvebu/platsmp.c
@@ -211,7 +211,7 @@ static int mv98dx3236_resume_set_cpu_boot_addr(int hw_cpu, void *boot_addr)
 		return PTR_ERR(base);
 
 	writel(0, base + MV98DX3236_CPU_RESUME_CTRL_REG);
-	writel(virt_to_phys(boot_addr), base + MV98DX3236_CPU_RESUME_ADDR_REG);
+	writel(__pa_symbol(boot_addr), base + MV98DX3236_CPU_RESUME_ADDR_REG);
 
 	iounmap(base);
 
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] ARM: mvebu: use __pa_symbol in the mv98dx3236 platform SMP code
  2017-07-07  7:59 [PATCH] ARM: mvebu: use __pa_symbol in the mv98dx3236 platform SMP code Gregory CLEMENT
@ 2017-07-07  8:02 ` Gregory CLEMENT
  2017-07-07 17:31   ` Florian Fainelli
  2017-07-09 21:32 ` Chris Packham
  2017-07-12 17:06 ` Gregory CLEMENT
  2 siblings, 1 reply; 5+ messages in thread
From: Gregory CLEMENT @ 2017-07-07  8:02 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Florian,

I forgot to CC you on this patch.

Gregory

 On ven., juil. 07 2017, Gregory CLEMENT <gregory.clement@free-electrons.com> wrote:

> As we already did for Armada XP switch from virt_to_phys() to
> __pa_symbol().
>
> The reason for it was well explained by Mark Rutland so let's quote him:
>
> "virt_to_phys() is intended to operate on the linear/direct mapping of
> RAM.
>
> __pa_symbol() is intended to operate on the kernel mapping, which may
> not be in the linear/direct mapping on all architectures. e.g. arm64 and
> x86_64 map the kernel image and RAM separately.
>
> On 32-bit ARM the kernel image mapping is tied to the linear/direct
> mapping, so that works, but as it's semantically wrong (and broken for
> generic code), the DEBUG_VIRTUAL checks complain."
>
> Fixes: db88977894ab ("arm: mvebu: support for SMP on 98DX3336 SoC")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
> ---
>
> Hi Chris,
>
> with this patch I don't expect any regression, hover it would be nice
> if you can test it.
>
> Thanks,
>
> Gregory
>
>  arch/arm/mach-mvebu/platsmp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
> index e62273aacb43..4ffbbd217e82 100644
> --- a/arch/arm/mach-mvebu/platsmp.c
> +++ b/arch/arm/mach-mvebu/platsmp.c
> @@ -211,7 +211,7 @@ static int mv98dx3236_resume_set_cpu_boot_addr(int hw_cpu, void *boot_addr)
>  		return PTR_ERR(base);
>  
>  	writel(0, base + MV98DX3236_CPU_RESUME_CTRL_REG);
> -	writel(virt_to_phys(boot_addr), base + MV98DX3236_CPU_RESUME_ADDR_REG);
> +	writel(__pa_symbol(boot_addr), base + MV98DX3236_CPU_RESUME_ADDR_REG);
>  
>  	iounmap(base);
>  
> -- 
> 2.13.2
>

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] ARM: mvebu: use __pa_symbol in the mv98dx3236 platform SMP code
  2017-07-07  8:02 ` Gregory CLEMENT
@ 2017-07-07 17:31   ` Florian Fainelli
  0 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2017-07-07 17:31 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/07/2017 01:02 AM, Gregory CLEMENT wrote:
> Hi Florian,
> 
> I forgot to CC you on this patch.
> 
> Gregory
> 
>  On ven., juil. 07 2017, Gregory CLEMENT <gregory.clement@free-electrons.com> wrote:
> 
>> As we already did for Armada XP switch from virt_to_phys() to
>> __pa_symbol().
>>
>> The reason for it was well explained by Mark Rutland so let's quote him:
>>
>> "virt_to_phys() is intended to operate on the linear/direct mapping of
>> RAM.
>>
>> __pa_symbol() is intended to operate on the kernel mapping, which may
>> not be in the linear/direct mapping on all architectures. e.g. arm64 and
>> x86_64 map the kernel image and RAM separately.
>>
>> On 32-bit ARM the kernel image mapping is tied to the linear/direct
>> mapping, so that works, but as it's semantically wrong (and broken for
>> generic code), the DEBUG_VIRTUAL checks complain."
>>
>> Fixes: db88977894ab ("arm: mvebu: support for SMP on 98DX3336 SoC")
>> Cc: <stable@vger.kernel.org>
>> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

Thanks!
-- 
Florian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] ARM: mvebu: use __pa_symbol in the mv98dx3236 platform SMP code
  2017-07-07  7:59 [PATCH] ARM: mvebu: use __pa_symbol in the mv98dx3236 platform SMP code Gregory CLEMENT
  2017-07-07  8:02 ` Gregory CLEMENT
@ 2017-07-09 21:32 ` Chris Packham
  2017-07-12 17:06 ` Gregory CLEMENT
  2 siblings, 0 replies; 5+ messages in thread
From: Chris Packham @ 2017-07-09 21:32 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/07/17 19:59, Gregory CLEMENT wrote:
> As we already did for Armada XP switch from virt_to_phys() to
> __pa_symbol().
> 
> The reason for it was well explained by Mark Rutland so let's quote him:
> 
> "virt_to_phys() is intended to operate on the linear/direct mapping of
> RAM.
> 
> __pa_symbol() is intended to operate on the kernel mapping, which may
> not be in the linear/direct mapping on all architectures. e.g. arm64 and
> x86_64 map the kernel image and RAM separately.
> 
> On 32-bit ARM the kernel image mapping is tied to the linear/direct
> mapping, so that works, but as it's semantically wrong (and broken for
> generic code), the DEBUG_VIRTUAL checks complain."
> 
> Fixes: db88977894ab ("arm: mvebu: support for SMP on 98DX3336 SoC")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
> ---
> 
> Hi Chris,
> 
> with this patch I don't expect any regression, hover it would be nice
> if you can test it.

Works for me

Tested-by: Chris Packham <chris.packham@alliedtelesis.co.nz>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] ARM: mvebu: use __pa_symbol in the mv98dx3236 platform SMP code
  2017-07-07  7:59 [PATCH] ARM: mvebu: use __pa_symbol in the mv98dx3236 platform SMP code Gregory CLEMENT
  2017-07-07  8:02 ` Gregory CLEMENT
  2017-07-09 21:32 ` Chris Packham
@ 2017-07-12 17:06 ` Gregory CLEMENT
  2 siblings, 0 replies; 5+ messages in thread
From: Gregory CLEMENT @ 2017-07-12 17:06 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,
 
 On ven., juil. 07 2017, Gregory CLEMENT <gregory.clement@free-electrons.com> wrote:

> As we already did for Armada XP switch from virt_to_phys() to
> __pa_symbol().
>
> The reason for it was well explained by Mark Rutland so let's quote him:
>
> "virt_to_phys() is intended to operate on the linear/direct mapping of
> RAM.
>
> __pa_symbol() is intended to operate on the kernel mapping, which may
> not be in the linear/direct mapping on all architectures. e.g. arm64 and
> x86_64 map the kernel image and RAM separately.
>
> On 32-bit ARM the kernel image mapping is tied to the linear/direct
> mapping, so that works, but as it's semantically wrong (and broken for
> generic code), the DEBUG_VIRTUAL checks complain."
>
> Fixes: db88977894ab ("arm: mvebu: support for SMP on 98DX3336 SoC")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>


Applied on mvebu/fixes with the tags from Chris and Floriant.

Gregory

> ---
>
> Hi Chris,
>
> with this patch I don't expect any regression, hover it would be nice
> if you can test it.
>
> Thanks,
>
> Gregory
>
>  arch/arm/mach-mvebu/platsmp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
> index e62273aacb43..4ffbbd217e82 100644
> --- a/arch/arm/mach-mvebu/platsmp.c
> +++ b/arch/arm/mach-mvebu/platsmp.c
> @@ -211,7 +211,7 @@ static int mv98dx3236_resume_set_cpu_boot_addr(int hw_cpu, void *boot_addr)
>  		return PTR_ERR(base);
>  
>  	writel(0, base + MV98DX3236_CPU_RESUME_CTRL_REG);
> -	writel(virt_to_phys(boot_addr), base + MV98DX3236_CPU_RESUME_ADDR_REG);
> +	writel(__pa_symbol(boot_addr), base + MV98DX3236_CPU_RESUME_ADDR_REG);
>  
>  	iounmap(base);
>  
> -- 
> 2.13.2
>

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-07-12 17:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-07  7:59 [PATCH] ARM: mvebu: use __pa_symbol in the mv98dx3236 platform SMP code Gregory CLEMENT
2017-07-07  8:02 ` Gregory CLEMENT
2017-07-07 17:31   ` Florian Fainelli
2017-07-09 21:32 ` Chris Packham
2017-07-12 17:06 ` Gregory CLEMENT

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).