[v7,01/14] MIPS: spaces: Define a couple of handy macros

Message ID 20240205153503.574468-2-gregory.clement@bootlin.com
State New
Headers
Series Add support for the Mobileye EyeQ5 SoC |

Commit Message

Gregory CLEMENT Feb. 5, 2024, 3:34 p.m. UTC
  Define KSEGX_SIZE to represent the size of each KSEG segment.

Introduce CKSEG0ADDR_OR_64BIT and CKSEG1ADDR_OR_64BIT to get an XPHYS
address in 64bits and CKSEG[01]ADDR() in 32 bits mode.

Co-developed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
---
 arch/mips/include/asm/addrspace.h           | 5 +++++
 arch/mips/include/asm/mach-generic/spaces.h | 4 ++++
 2 files changed, 9 insertions(+)
  

Comments

Thomas Bogendoerfer Feb. 8, 2024, 12:14 p.m. UTC | #1
On Mon, Feb 05, 2024 at 04:34:47PM +0100, Gregory CLEMENT wrote:
> Define KSEGX_SIZE to represent the size of each KSEG segment.
> 
> Introduce CKSEG0ADDR_OR_64BIT and CKSEG1ADDR_OR_64BIT to get an XPHYS
> address in 64bits and CKSEG[01]ADDR() in 32 bits mode.
> 
> Co-developed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
> ---
>  arch/mips/include/asm/addrspace.h           | 5 +++++
>  arch/mips/include/asm/mach-generic/spaces.h | 4 ++++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/arch/mips/include/asm/addrspace.h b/arch/mips/include/asm/addrspace.h
> index 59a48c60a065c..03a5e2c8b5dc9 100644
> --- a/arch/mips/include/asm/addrspace.h
> +++ b/arch/mips/include/asm/addrspace.h
> @@ -47,6 +47,11 @@
>   */
>  #define KSEGX(a)		((_ACAST32_(a)) & _ACAST32_(0xe0000000))
>  
> +/*
> + * Gives the size of each kernel segment
> + */
> +#define KSEGX_SIZE		0x20000000

well this is the KSEG size for 32bit and defined in a common section,
so better use CSEGX_SIZE

Thomas.
  
Gregory CLEMENT Feb. 14, 2024, 4:44 p.m. UTC | #2
Thomas Bogendoerfer <tsbogend@alpha.franken.de> writes:

> On Mon, Feb 05, 2024 at 04:34:47PM +0100, Gregory CLEMENT wrote:
>> Define KSEGX_SIZE to represent the size of each KSEG segment.
>> 
>> Introduce CKSEG0ADDR_OR_64BIT and CKSEG1ADDR_OR_64BIT to get an XPHYS
>> address in 64bits and CKSEG[01]ADDR() in 32 bits mode.
>> 
>> Co-developed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>> Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
>> ---
>>  arch/mips/include/asm/addrspace.h           | 5 +++++
>>  arch/mips/include/asm/mach-generic/spaces.h | 4 ++++
>>  2 files changed, 9 insertions(+)
>> 
>> diff --git a/arch/mips/include/asm/addrspace.h b/arch/mips/include/asm/addrspace.h
>> index 59a48c60a065c..03a5e2c8b5dc9 100644
>> --- a/arch/mips/include/asm/addrspace.h
>> +++ b/arch/mips/include/asm/addrspace.h
>> @@ -47,6 +47,11 @@
>>   */
>>  #define KSEGX(a)		((_ACAST32_(a)) & _ACAST32_(0xe0000000))
>>  
>> +/*
>> + * Gives the size of each kernel segment
>> + */
>> +#define KSEGX_SIZE		0x20000000
>
> well this is the KSEG size for 32bit and defined in a common section,
> so better use CSEGX_SIZE

Done in the next series.

Thanks,

Gregory


>
> Thomas.
>
> -- 
> Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
> good idea.                                                [ RFC1925, 2.3 ]
  

Patch

diff --git a/arch/mips/include/asm/addrspace.h b/arch/mips/include/asm/addrspace.h
index 59a48c60a065c..03a5e2c8b5dc9 100644
--- a/arch/mips/include/asm/addrspace.h
+++ b/arch/mips/include/asm/addrspace.h
@@ -47,6 +47,11 @@ 
  */
 #define KSEGX(a)		((_ACAST32_(a)) & _ACAST32_(0xe0000000))
 
+/*
+ * Gives the size of each kernel segment
+ */
+#define KSEGX_SIZE		0x20000000
+
 /*
  * Returns the physical address of a CKSEGx / XKPHYS address
  */
diff --git a/arch/mips/include/asm/mach-generic/spaces.h b/arch/mips/include/asm/mach-generic/spaces.h
index b247575c5e699..f8783d339fb0d 100644
--- a/arch/mips/include/asm/mach-generic/spaces.h
+++ b/arch/mips/include/asm/mach-generic/spaces.h
@@ -49,6 +49,8 @@ 
 #define HIGHMEM_START		_AC(0x20000000, UL)
 #endif
 
+#define CKSEG0ADDR_OR_64BIT(x)	CKSEG0ADDR(x)
+#define CKSEG1ADDR_OR_64BIT(x)	CKSEG1ADDR(x)
 #endif /* CONFIG_32BIT */
 
 #ifdef CONFIG_64BIT
@@ -82,6 +84,8 @@ 
 #define TO_CAC(x)		(CAC_BASE   | ((x) & TO_PHYS_MASK))
 #define TO_UNCAC(x)		(UNCAC_BASE | ((x) & TO_PHYS_MASK))
 
+#define CKSEG0ADDR_OR_64BIT(x)	TO_CAC(x)
+#define CKSEG1ADDR_OR_64BIT(x)	TO_UNCAC(x)
 #endif /* CONFIG_64BIT */
 
 /*