Port-powerpc archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: ofppc - panic pmap_pvo_find_va returning NULL for kernel pmap
Hi list.
On 6/30/26 00:40, Radosław Kujawa wrote:
The check should not assume that given VA >= PMAP_DIRECT_MAPPED_LEN . Note that PMAP_DIRECT_MAPPED_LEN is calculated according to the formula in oea/pmap.h (line 128) :
SEGMENT_LENGTH (256MB) * USER_SR
Why does the panic not trigger on macppc and other PowerPC ports? By coincidence that depends on ordering of USER_SR and KERNEL_SR utilized by a given port:
macppc, evbppc etc. use USER_SR 12 and KERNEL_SR 13, 14, so segment-mappend KVA lands between 0xD0000000 - 0xF0000000, and PMAP_DIRECT_MAPPED_LEN as calculated is 0xC0000000 .
ofppc uses USER_SR 14 and KERNEL_SR 10, 11, so segment-mapped KVA lands between 0xA0000000 - 0xC0000000, and PMAP_DIRECT_MAPPED_LEN as calculated is 0xE0000000 .
After discussion with other developers (thanks Martin, Nick), it was
concluded that cleanest solution is to fix the PMAP_DIRECT_MAPPED_LEN
calculation itself, so that PMAP_DIRECT_MAPPED_LEN reflects true range
of identity-mapped addresses and is independent of KERNEL_SR / USER_SR
ordering on a given port.
The following fix was committed today.
Index: src/sys/arch/powerpc/include/oea/pmap.h
diff -u src/sys/arch/powerpc/include/oea/pmap.h:1.39
src/sys/arch/powerpc/include/oea/pmap.h:1.40
--- src/sys/arch/powerpc/include/oea/pmap.h:1.39 Fri Dec 15 09:42:33 2023
+++ src/sys/arch/powerpc/include/oea/pmap.h Tue Jun 30 17:21:18 2026
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.39 2023/12/15 09:42:33 rin Exp $ */
+/* $NetBSD: pmap.h,v 1.40 2026/06/30 17:21:18 rkujawa Exp $ */
/*-
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -122,11 +122,13 @@ __BEGIN_DECLS
#include <sys/systm.h>
/*
- * For OEA and OEA64_BRIDGE, we guarantee that pa below USER_ADDR
- * (== 3GB < VM_MIN_KERNEL_ADDRESS) is direct-mapped.
+ * Physical memory below PMAP_DIRECT_MAPPED_LEN is direct-mapped
+ * (pa == va). Direct region covers the segments below BOTH
+ * the user copyin window (USER_SR) and the kernel HTAB window
+ * (KERNEL_SR), so it can never overlap.
*/
#if defined(PPC_OEA) || defined(PPC_OEA64_BRIDGE)
-#define PMAP_DIRECT_MAPPED_SR (USER_SR - 1)
+#define PMAP_DIRECT_MAPPED_SR (MIN(USER_SR, KERNEL_SR) - 1)
#define PMAP_DIRECT_MAPPED_LEN \
((vaddr_t)SEGMENT_LENGTH * (PMAP_DIRECT_MAPPED_SR + 1))
#endif
Best regards,
Radoslaw
Home |
Main Index |
Thread Index |
Old Index