public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] riscv: Implement pte_accessible()
@ 2024-01-28 11:59 Alexandre Ghiti
  2024-06-27 17:50 ` patchwork-bot+linux-riscv
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandre Ghiti @ 2024-01-28 11:59 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-riscv,
	linux-kernel
  Cc: Alexandre Ghiti

Like other architectures, a pte is accessible if it is present or if
there is a pending tlb flush and the pte is protnone (which could be the
case when a pte is downgraded to protnone before a flush tlb is
executed).

Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
---
 arch/riscv/include/asm/pgtable.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
index 0c94260b5d0c..3b46677827f6 100644
--- a/arch/riscv/include/asm/pgtable.h
+++ b/arch/riscv/include/asm/pgtable.h
@@ -353,6 +353,19 @@ static inline int pte_present(pte_t pte)
 	return (pte_val(pte) & (_PAGE_PRESENT | _PAGE_PROT_NONE));
 }
 
+#define pte_accessible pte_accessible
+static inline unsigned long pte_accessible(struct mm_struct *mm, pte_t a)
+{
+	if (pte_val(a) & _PAGE_PRESENT)
+		return true;
+
+	if ((pte_val(a) & _PAGE_PROT_NONE) &&
+	    atomic_read(&mm->tlb_flush_pending))
+		return true;
+
+	return false;
+}
+
 static inline int pte_none(pte_t pte)
 {
 	return (pte_val(pte) == 0);
-- 
2.39.2


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

* Re: [PATCH] riscv: Implement pte_accessible()
  2024-01-28 11:59 [PATCH] riscv: Implement pte_accessible() Alexandre Ghiti
@ 2024-06-27 17:50 ` patchwork-bot+linux-riscv
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-06-27 17:50 UTC (permalink / raw)
  To: Alexandre Ghiti; +Cc: linux-riscv, paul.walmsley, palmer, aou, linux-kernel

Hello:

This patch was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Sun, 28 Jan 2024 12:59:53 +0100 you wrote:
> Like other architectures, a pte is accessible if it is present or if
> there is a pending tlb flush and the pte is protnone (which could be the
> case when a pte is downgraded to protnone before a flush tlb is
> executed).
> 
> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
> 
> [...]

Here is the summary with links:
  - riscv: Implement pte_accessible()
    https://git.kernel.org/riscv/c/50b5bae5be1b

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-06-27 17:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-28 11:59 [PATCH] riscv: Implement pte_accessible() Alexandre Ghiti
2024-06-27 17:50 ` patchwork-bot+linux-riscv

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox