Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Paul Burton <paul.burton@imgtec.com>
To: Markos Chandras <markos.chandras@imgtec.com>
Cc: <linux-mips@linux-mips.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH 6/7] MIPS: kernel: cps-vec: Use macros for various arithmetics and memory operations
Date: Tue, 14 Jul 2015 13:40:11 +0100	[thread overview]
Message-ID: <20150714124011.GH2519@NP-P-BURTON> (raw)
In-Reply-To: <1435738414-30944-7-git-send-email-markos.chandras@imgtec.com>

On Wed, Jul 01, 2015 at 09:13:33AM +0100, Markos Chandras wrote:
> Replace lw/sw and various arithmetic instructions with macros so the
> code can work on 64-bit kernels as well.
> 
> Cc: <stable@vger.kernel.org> # 3.16+
> Reviewed-by: Paul Burton <paul.burton@imgtec.com>
> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
> ---
>  arch/mips/kernel/cps-vec.S | 32 ++++++++++++++++----------------
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/arch/mips/kernel/cps-vec.S b/arch/mips/kernel/cps-vec.S
> index 2f95568e0da5..1b6ca634e646 100644
> --- a/arch/mips/kernel/cps-vec.S
> +++ b/arch/mips/kernel/cps-vec.S
> @@ -108,9 +108,9 @@ not_nmi:
>  	mul	t1, t1, t2
>  
>  	li	a0, CKSEG0
> -	add	a1, a0, t1
> +	PTR_ADD	a1, a0, t1
>  1:	cache	Index_Store_Tag_I, 0(a0)
> -	add	a0, a0, t0
> +	PTR_ADD	a0, a0, t0
>  	bne	a0, a1, 1b
>  	 nop
>  icache_done:
> @@ -135,11 +135,11 @@ icache_done:
>  	mul	t1, t1, t2
>  
>  	li	a0, CKSEG0
> -	addu	a1, a0, t1
> -	subu	a1, a1, t0
> +	PTR_ADDU a1, a0, t1
> +	PTR_SUBU a1, a1, t0
>  1:	cache	Index_Store_Tag_D, 0(a0)
>  	bne	a0, a1, 1b
> -	 add	a0, a0, t0
> +	 PTR_ADD a0, a0, t0
>  dcache_done:
>  
>  	/* Set Kseg0 CCA to that in s0 */
> @@ -152,7 +152,7 @@ dcache_done:
>  
>  	/* Enter the coherent domain */
>  	li	t0, 0xff
> -	sw	t0, GCR_CL_COHERENCE_OFS(v1)
> +	PTR_S	t0, GCR_CL_COHERENCE_OFS(v1)

Hi Markos,

I don't believe this is correct where accessing GCRs. Since you've
pushed elsewhere to perform 32 bit accesses when running a 32 bit kernel
on a MIPS64 core with CM3, can we just keep doing 32 bit accesses here?

>  	ehb
>  
>  	/* Jump to kseg0 */
> @@ -178,9 +178,9 @@ dcache_done:
>  	 nop
>  
>  	/* Off we go! */
> -	lw	t1, VPEBOOTCFG_PC(v0)
> -	lw	gp, VPEBOOTCFG_GP(v0)
> -	lw	sp, VPEBOOTCFG_SP(v0)
> +	PTR_L	t1, VPEBOOTCFG_PC(v0)
> +	PTR_L	gp, VPEBOOTCFG_GP(v0)
> +	PTR_L	sp, VPEBOOTCFG_SP(v0)
>  	jr	t1
>  	 nop
>  	END(mips_cps_core_entry)
> @@ -299,15 +299,15 @@ LEAF(mips_cps_core_init)
>  LEAF(mips_cps_boot_vpes)
>  	/* Retrieve CM base address */
>  	PTR_LA	t0, mips_cm_base
> -	lw	t0, 0(t0)
> +	PTR_L	t0, 0(t0)
>  
>  	/* Calculate a pointer to this cores struct core_boot_config */
> -	lw	t0, GCR_CL_ID_OFS(t0)
> +	PTR_L	t0, GCR_CL_ID_OFS(t0)

Ditto here.

Thanks,
    Paul

>  	li	t1, COREBOOTCFG_SIZE
>  	mul	t0, t0, t1
>  	PTR_LA	t1, mips_cps_core_bootcfg
> -	lw	t1, 0(t1)
> -	addu	t0, t0, t1
> +	PTR_L	t1, 0(t1)
> +	PTR_ADDU t0, t0, t1
>  
>  	/* Calculate this VPEs ID. If the core doesn't support MT use 0 */
>  	has_mt	ta2, 1f
> @@ -334,8 +334,8 @@ LEAF(mips_cps_boot_vpes)
>  1:	/* Calculate a pointer to this VPEs struct vpe_boot_config */
>  	li	t1, VPEBOOTCFG_SIZE
>  	mul	v0, t9, t1
> -	lw	ta3, COREBOOTCFG_VPECONFIG(t0)
> -	addu	v0, v0, ta3
> +	PTR_L	ta3, COREBOOTCFG_VPECONFIG(t0)
> +	PTR_ADDU v0, v0, ta3
>  
>  #ifdef CONFIG_MIPS_MT
>  
> @@ -360,7 +360,7 @@ LEAF(mips_cps_boot_vpes)
>  	ehb
>  
>  	/* Loop through each VPE */
> -	lw	ta2, COREBOOTCFG_VPEMASK(t0)
> +	PTR_L	ta2, COREBOOTCFG_VPEMASK(t0)
>  	move	t8, ta2
>  	li	ta1, 0
>  
> -- 
> 2.4.5
> 
> 

WARNING: multiple messages have this Message-ID (diff)
From: Paul Burton <paul.burton@imgtec.com>
To: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org, stable@vger.kernel.org
Subject: Re: [PATCH 6/7] MIPS: kernel: cps-vec: Use macros for various arithmetics and memory operations
Date: Tue, 14 Jul 2015 13:40:11 +0100	[thread overview]
Message-ID: <20150714124011.GH2519@NP-P-BURTON> (raw)
Message-ID: <20150714124011.1DwYStRyC0mOCFpBF9sCwot1U2a2lmHbTYcnZFz81iU@z> (raw)
In-Reply-To: <1435738414-30944-7-git-send-email-markos.chandras@imgtec.com>

On Wed, Jul 01, 2015 at 09:13:33AM +0100, Markos Chandras wrote:
> Replace lw/sw and various arithmetic instructions with macros so the
> code can work on 64-bit kernels as well.
> 
> Cc: <stable@vger.kernel.org> # 3.16+
> Reviewed-by: Paul Burton <paul.burton@imgtec.com>
> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
> ---
>  arch/mips/kernel/cps-vec.S | 32 ++++++++++++++++----------------
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/arch/mips/kernel/cps-vec.S b/arch/mips/kernel/cps-vec.S
> index 2f95568e0da5..1b6ca634e646 100644
> --- a/arch/mips/kernel/cps-vec.S
> +++ b/arch/mips/kernel/cps-vec.S
> @@ -108,9 +108,9 @@ not_nmi:
>  	mul	t1, t1, t2
>  
>  	li	a0, CKSEG0
> -	add	a1, a0, t1
> +	PTR_ADD	a1, a0, t1
>  1:	cache	Index_Store_Tag_I, 0(a0)
> -	add	a0, a0, t0
> +	PTR_ADD	a0, a0, t0
>  	bne	a0, a1, 1b
>  	 nop
>  icache_done:
> @@ -135,11 +135,11 @@ icache_done:
>  	mul	t1, t1, t2
>  
>  	li	a0, CKSEG0
> -	addu	a1, a0, t1
> -	subu	a1, a1, t0
> +	PTR_ADDU a1, a0, t1
> +	PTR_SUBU a1, a1, t0
>  1:	cache	Index_Store_Tag_D, 0(a0)
>  	bne	a0, a1, 1b
> -	 add	a0, a0, t0
> +	 PTR_ADD a0, a0, t0
>  dcache_done:
>  
>  	/* Set Kseg0 CCA to that in s0 */
> @@ -152,7 +152,7 @@ dcache_done:
>  
>  	/* Enter the coherent domain */
>  	li	t0, 0xff
> -	sw	t0, GCR_CL_COHERENCE_OFS(v1)
> +	PTR_S	t0, GCR_CL_COHERENCE_OFS(v1)

Hi Markos,

I don't believe this is correct where accessing GCRs. Since you've
pushed elsewhere to perform 32 bit accesses when running a 32 bit kernel
on a MIPS64 core with CM3, can we just keep doing 32 bit accesses here?

>  	ehb
>  
>  	/* Jump to kseg0 */
> @@ -178,9 +178,9 @@ dcache_done:
>  	 nop
>  
>  	/* Off we go! */
> -	lw	t1, VPEBOOTCFG_PC(v0)
> -	lw	gp, VPEBOOTCFG_GP(v0)
> -	lw	sp, VPEBOOTCFG_SP(v0)
> +	PTR_L	t1, VPEBOOTCFG_PC(v0)
> +	PTR_L	gp, VPEBOOTCFG_GP(v0)
> +	PTR_L	sp, VPEBOOTCFG_SP(v0)
>  	jr	t1
>  	 nop
>  	END(mips_cps_core_entry)
> @@ -299,15 +299,15 @@ LEAF(mips_cps_core_init)
>  LEAF(mips_cps_boot_vpes)
>  	/* Retrieve CM base address */
>  	PTR_LA	t0, mips_cm_base
> -	lw	t0, 0(t0)
> +	PTR_L	t0, 0(t0)
>  
>  	/* Calculate a pointer to this cores struct core_boot_config */
> -	lw	t0, GCR_CL_ID_OFS(t0)
> +	PTR_L	t0, GCR_CL_ID_OFS(t0)

Ditto here.

Thanks,
    Paul

>  	li	t1, COREBOOTCFG_SIZE
>  	mul	t0, t0, t1
>  	PTR_LA	t1, mips_cps_core_bootcfg
> -	lw	t1, 0(t1)
> -	addu	t0, t0, t1
> +	PTR_L	t1, 0(t1)
> +	PTR_ADDU t0, t0, t1
>  
>  	/* Calculate this VPEs ID. If the core doesn't support MT use 0 */
>  	has_mt	ta2, 1f
> @@ -334,8 +334,8 @@ LEAF(mips_cps_boot_vpes)
>  1:	/* Calculate a pointer to this VPEs struct vpe_boot_config */
>  	li	t1, VPEBOOTCFG_SIZE
>  	mul	v0, t9, t1
> -	lw	ta3, COREBOOTCFG_VPECONFIG(t0)
> -	addu	v0, v0, ta3
> +	PTR_L	ta3, COREBOOTCFG_VPECONFIG(t0)
> +	PTR_ADDU v0, v0, ta3
>  
>  #ifdef CONFIG_MIPS_MT
>  
> @@ -360,7 +360,7 @@ LEAF(mips_cps_boot_vpes)
>  	ehb
>  
>  	/* Loop through each VPE */
> -	lw	ta2, COREBOOTCFG_VPEMASK(t0)
> +	PTR_L	ta2, COREBOOTCFG_VPEMASK(t0)
>  	move	t8, ta2
>  	li	ta1, 0
>  
> -- 
> 2.4.5
> 
> 

  parent reply	other threads:[~2015-07-14 12:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-01  8:13 [PATCH 0/7] Initial SMP/CPS 64-bit support Markos Chandras
2015-07-01  8:13 ` Markos Chandras
2015-07-01  8:13 ` [PATCH 1/7] MIPS: kernel: smp-cps: Fix 64-bit compatibility errors due to pointer casting Markos Chandras
2015-07-01  8:13   ` Markos Chandras
2015-07-01  8:13 ` [PATCH 2/7] MIPS: kernel: cps-vec: Replace 'la' macro with PTR_LA Markos Chandras
2015-07-01  8:13   ` Markos Chandras
2015-07-01  8:13 ` [PATCH 3/7] MIPS: kernel: cps-vec: Replace mips32r2 ISA level with mips64r2 Markos Chandras
2015-07-01  8:13   ` Markos Chandras
2015-07-01  8:13 ` [PATCH 4/7] MIPS: kernel: cps-vec: Use ta0-ta3 pseudo-registers for 64-bit Markos Chandras
2015-07-01  8:13   ` Markos Chandras
2015-07-01  8:13 ` [PATCH 5/7] MIPS: kernel: cps-vec: Replace KSEG0 with CKSEG0 Markos Chandras
2015-07-01  8:13   ` Markos Chandras
2015-07-01  8:13 ` [PATCH 6/7] MIPS: kernel: cps-vec: Use macros for various arithmetics and memory operations Markos Chandras
2015-07-01  8:13   ` Markos Chandras
2015-07-14 12:40   ` Paul Burton [this message]
2015-07-14 12:40     ` Paul Burton
2015-07-14 13:07     ` Markos Chandras
2015-07-14 13:07       ` Markos Chandras
2015-07-01  8:31 ` [PATCH 7/7] Revert "MIPS: Kconfig: Disable SMP/CPS for 64-bit" Markos Chandras
2015-07-01  8:31   ` Markos Chandras

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=20150714124011.GH2519@NP-P-BURTON \
    --to=paul.burton@imgtec.com \
    --cc=linux-mips@linux-mips.org \
    --cc=markos.chandras@imgtec.com \
    --cc=stable@vger.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