linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] MIPS: Enable ARCH_HAS_DEBUG_VIRTUAL for 64-bit
@ 2022-07-07 22:04 Florian Fainelli
  2022-07-11  8:39 ` Thomas Bogendoerfer
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Fainelli @ 2022-07-07 22:04 UTC (permalink / raw)
  To: linux-mips
  Cc: fancer.lancer, gerg, Florian Fainelli, Thomas Bogendoerfer,
	open list

Update __debug_virt_addr_valid() to check for a virtual address'
validity below CKSSEG and remove the !64BIT dependency on
ARCH_HAS_DEBUG_VIRTUAL to make DEBUG_VIRTUAL selectable.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
This requires the previous patch to be applied for this to work cleanly.

 arch/mips/Kconfig       | 2 +-
 arch/mips/mm/physaddr.c | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index db09d45d59ec..ddb6bde8fa1f 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -5,7 +5,7 @@ config MIPS
 	select ARCH_32BIT_OFF_T if !64BIT
 	select ARCH_BINFMT_ELF_STATE if MIPS_FP_SUPPORT
 	select ARCH_HAS_CURRENT_STACK_POINTER if !CC_IS_CLANG || CLANG_VERSION >= 140000
-	select ARCH_HAS_DEBUG_VIRTUAL if !64BIT
+	select ARCH_HAS_DEBUG_VIRTUAL
 	select ARCH_HAS_FORTIFY_SOURCE
 	select ARCH_HAS_KCOV
 	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE if !EVA
diff --git a/arch/mips/mm/physaddr.c b/arch/mips/mm/physaddr.c
index a82f8f57a652..3076238943d3 100644
--- a/arch/mips/mm/physaddr.c
+++ b/arch/mips/mm/physaddr.c
@@ -31,7 +31,11 @@ static inline bool __debug_virt_addr_valid(unsigned long x)
 	if (x == MAX_DMA_ADDRESS)
 		return true;
 
+#ifdef CONFIG_64BIT
+	return KSEGX(x) < CKSSEG;
+#else
 	return KSEGX(x) < KSEG2;
+#endif
 }
 
 phys_addr_t __virt_to_phys(volatile const void *x)
-- 
2.25.1


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

* Re: [RFC] MIPS: Enable ARCH_HAS_DEBUG_VIRTUAL for 64-bit
  2022-07-07 22:04 [RFC] MIPS: Enable ARCH_HAS_DEBUG_VIRTUAL for 64-bit Florian Fainelli
@ 2022-07-11  8:39 ` Thomas Bogendoerfer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2022-07-11  8:39 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: linux-mips, fancer.lancer, gerg, open list

On Thu, Jul 07, 2022 at 03:04:27PM -0700, Florian Fainelli wrote:
> Update __debug_virt_addr_valid() to check for a virtual address'
> validity below CKSSEG and remove the !64BIT dependency on
> ARCH_HAS_DEBUG_VIRTUAL to make DEBUG_VIRTUAL selectable.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> This requires the previous patch to be applied for this to work cleanly.
> 
>  arch/mips/Kconfig       | 2 +-
>  arch/mips/mm/physaddr.c | 4 ++++
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index db09d45d59ec..ddb6bde8fa1f 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -5,7 +5,7 @@ config MIPS
>  	select ARCH_32BIT_OFF_T if !64BIT
>  	select ARCH_BINFMT_ELF_STATE if MIPS_FP_SUPPORT
>  	select ARCH_HAS_CURRENT_STACK_POINTER if !CC_IS_CLANG || CLANG_VERSION >= 140000
> -	select ARCH_HAS_DEBUG_VIRTUAL if !64BIT
> +	select ARCH_HAS_DEBUG_VIRTUAL
>  	select ARCH_HAS_FORTIFY_SOURCE
>  	select ARCH_HAS_KCOV
>  	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE if !EVA
> diff --git a/arch/mips/mm/physaddr.c b/arch/mips/mm/physaddr.c
> index a82f8f57a652..3076238943d3 100644
> --- a/arch/mips/mm/physaddr.c
> +++ b/arch/mips/mm/physaddr.c
> @@ -31,7 +31,11 @@ static inline bool __debug_virt_addr_valid(unsigned long x)
>  	if (x == MAX_DMA_ADDRESS)
>  		return true;
>  
> +#ifdef CONFIG_64BIT
> +	return KSEGX(x) < CKSSEG;

as KSEGX does 32bit casts, I have some doubts that this is correct.
What do I miss ?

Thomas.

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

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

end of thread, other threads:[~2022-07-11  8:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-07 22:04 [RFC] MIPS: Enable ARCH_HAS_DEBUG_VIRTUAL for 64-bit Florian Fainelli
2022-07-11  8:39 ` Thomas Bogendoerfer

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).