| 0/0 |
2026/05/13 00:35 |
flow |
assessment-security |
52m
Results: map[DenialOfService:true Explanation:Based on the analysis of the provided bug report and the JFS source code, here
is the security assessment:
### Root Cause Analysis
The bug report indicates a `BUG()` triggered by an `ASSERT(p->header.flag &
BT_LEAF)` in `add_missing_indices()` (called from `jfs_readdir()`). This happens
when `jfs_readdir()` encounters a corrupted directory index and attempts to fix
it, but the page it is processing is actually an internal B+-tree page
(`BT_INTERNAL`) rather than a leaf page (`BT_LEAF`), or a completely corrupted
page with `p->header.flag == 0`.
However, in JFS, `ASSERT()` is only active if `CONFIG_JFS_DEBUG` is enabled. In
standard production kernel builds (e.g., Ubuntu, Debian, Android),
`CONFIG_JFS_DEBUG` is disabled, meaning the `ASSERT()` macro compiles to a no-op
(`do {} while (0)`).
When the assertion is compiled out, `add_missing_indices()` proceeds to modify
the internal page and returns. `jfs_readdir()` then continues to process the
internal page as if it were a leaf page. This causes it to read `struct
idtentry` structures as `struct ldtentry` structures. Because the layouts
differ, the `namlen` (name length) field of the `ldtentry` overlaps with the
attacker-controlled extent descriptor (`xd`) of the `idtentry`. This allows the
attacker to fully control `d->namlen` (up to 255) and the subsequent `d->name`
characters.
### Exploitation via Buffer Overflow
This leads directly to a highly exploitable buffer overflow in `jfs_readdir()`.
When checking if the new directory entry will fit into the allocated page-sized
buffer (`dirent_buf`), the code does the following:
```c
if (((long) jfs_dirent + d->namlen + 1) > (dirent_buf + PAGE_SIZE)) {
/* DBCS codepages could overrun dirent_buf */
index = i;
overflow = 1;
break;
}
```
The check assumes that the output string length will be roughly equal to
`d->namlen`. However, `d->namlen` is the number of `__le16` characters, not
bytes. When a multibyte NLS codepage is used (like UTF-8, which can be forced by
the attacker by mounting the filesystem with `iocharset=utf8`),
`jfs_strfromUCS_le()` can write up to 3-6 bytes per character.
If `jfs_dirent` is near the end of the page (e.g., 260 bytes remaining) and the
attacker provides `d->namlen = 255`, the check `255 + 1 > 260` is false, so the
loop proceeds. `jfs_strfromUCS_le()` will then convert the 255 characters into
UTF-8, writing up to `255 * 3 = 765` bytes into the buffer. This results in a
**~500-byte out-of-bounds write** past the end of the `dirent_buf` page.
Since `dirent_buf` is allocated via `__get_free_page(GFP_KERNEL)`, this is a
page-level heap buffer overflow. The attacker controls the contents of the
overflow (the UTF-8 encoded characters), making this highly exploitable for
**Privilege Escalation** and **Denial of Service**.
### Security Dimensions
* **Exploitable:** **Yes**. The bug leads to a page-level heap out-of-bounds
write of attacker-controlled data, which can be leveraged for privilege
escalation.
* **Denial of Service:** **Yes**. The out-of-bounds write will corrupt adjacent
kernel memory, leading to a system crash. (In debug builds, the `ASSERT` itself
causes a panic).
* **Accessible From Unprivileged Processes:** **Yes**. Any unprivileged user can
trigger the bug by calling the `readdir` syscall on the mounted malicious JFS
filesystem.
* **Accessible From User Namespaces:** **Yes**. If the filesystem is mounted, it
can be accessed from within a user namespace.
* **Peripheral Trigger:** **Yes**. The bug can be triggered by plugging in a
malicious USB drive formatted with a crafted JFS filesystem.
* **Malicious Filesystem Trigger:** **Yes**. The vulnerability relies on parsing
a maliciously crafted JFS filesystem image.
* **VM Guest / Host / Network / Remote Triggers:** **No**. This is a local
filesystem vulnerability. Exploitable:true FilesystemTrigger:true NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:true UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
|
| 1/1 |
2026/05/13 00:35 |
action |
syz-repro-to-c-repro |
0m
Results:
|
| 2/1 |
2026/05/13 00:35 |
action |
kernel-checkouter |
1m
Results: map[KernelSrc:/app/workdir/cache/src/f4a17f26f46b41c5640d7019504698aa43794202]
|
| 3/1 |
2026/05/13 00:37 |
action |
kernel-builder |
18m
Results: map[KernelObj:/app/workdir/cache/build/4d14e9057e1dd66552f1154779d9ddd2582fc562]
|
| 4/1 |
2026/05/13 00:55 |
action |
codesearch-prepare |
19m
Results: map[Index:codesearch-index]
|
| 5/1 |
2026/05/13 01:14 |
agent |
expert |
13m
Model:
Results: map[DenialOfService:true Exploitable:true FilesystemTrigger:true NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:true UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
Instruction:
You are an experienced Linux kernel security engineer. Your task is to analyze given kernel bug report
and determine its security impact based on the following dimensions.
Use the provided tools to examine the source code, check for capability checks (e.g., capable(), ns_capable()),
and understand the nature of the bug. Analyze the given kernel build and configuration.
You can check the kernel config by grepping ".config" file; you can check kernel cmdline by greeping
".config" file for "CONFIG_CMDLINE=". Assume sysctl parameters have default values.
But analyze for the corresponding production build w/o debugging tools enabled (like KASAN, KMSAN, UBSAN).
Don't make assumptions; verify them with source code access. Try different strategies when analyzing the bug:
- think of ways in which the vulnerable code is unreachable
- or the other way around: try to come up with different ideas of how an unprivileged user can reach the bug
If still unsure err on the side of the bug being non-exploitable/not-accessible.
In the final reply, provide a reasoning for your assessment.
Analysis dimensions:
* Exploitable:
Determine if the bug can result in memory corruption or elevated privileges.
Memory safety issues are almost always exploitable (KASAN or UBSAN reports for use-after-free, out-of-bounds;
refcounting issues, corrupted lists, etc). When kernel is crashing on a completly wild pointer access
(e.g. user-space address, or non-canonical address, but not on NULL or address corresponding to KASAN shadow
for NULL address), including both data accesses and control tranfers, that's also usually implies possibility
of exploitation. Such reports usually say "unable to handle kernel paging request".
Uses of uninitialized values detected by KMSAN may be exploitable b/c attacker frequently can affect uninit
values with spraying techniques. However, for these exploitabability depends on how exactly the uninit value
is used in the code, and what it affects.
Think of what happens after the bug is triggered. Some bugs cause kernel panic and halt execution,
they are harder to exploit. For example, BUG reports halts the kernel. However, WARNING reports don't halt
execution in production builds. Debug bug detection tools (like KASAN, KMSAN, KCSAN, UBSAN) are also not enabled
in production builds, so attacker can freely exploit these bugs w/o being detected by these tools.
If you see an integer overflow, think how the overflowed value used later (if it's used as allocation size,
or an array index). If you see an out-of-bounds read, think if it's followed by an out-of-bounds write as well.
Some KCSAN data-races may be exploitable by skilled attackers as well. Think what data structures got corrupted
as the result of data races and how. However, note that kernel has lots of "benign" data races that don't lead
to any runtime misbehavior at all.
* Denial Of Service:
Determine if the bug can result in denial-of-service. Most bugs can, since they cause system crash,
hangs, deadlocks, or resource leaks. This is mostly applicable to WARNING bugs that won't cause system crash
in production. For these think what will be consequences of the violation of the kernel assumptions flagged
by the WARNING. In some cases the unexpected condition is also properly handled by the normal control flow
(e.g. with "if (WARN_ON(...))"), these won't cause denial-of-service. If the condition is not handled,
then it may or may not cause denial-of-service.
* Accessible From Unprivileged Processes:
Determine if the bug can be reached from a typical (non-root) user process that does NOT have any special capabilities
(like CAP_SYS_ADMIN, CAP_NET_ADMIN, CAP_NET_RAW, CAP_PERFMON) or access to device nodes restricted to root.
Assume that unprivileged_bpf_disabled=1, that is eBPF loading is not accessible. However, cBPF (classical BPF)
is still accessible to non-root processes.
Assume that user namespaces are not accessible, that is, the process cannot get the mentioned capabilities even
within a new user namespace (checked by ns_capable() function in the kernel sources).
* Accessible From User Namespaces:
Determine if the bug can be reached within a user-namespace where the process has all capabilities
(including CAP_SYS_ADMIN, CAP_NET_ADMIN, CAP_NET_RAW, CAP_PERFMON). Such capabilities are checked with ns_capable()
function in the kernel sources.
* VM Guest Trigger:
Determine if the bug can be triggered from the context of a typical KVM guest (e.g., set up by a QEMU VMM).
Consider accesses to standard Linux host paravirtualized features (virtio-blk, virtio-net, etc.),
and handling of VM exits in the KVM code.
* VM Host Trigger in The Confidetial Computing Context:
Determine if the bug can be triggered in a confidential computing guest kernel from the context of a KVM host.
Consider access to standard Linux guest paravirtualized features (virtio-blk, virtio-net, etc.).
* Ethernet Network Trigger:
Determine if the bug can be triggered by processing ingress network Ethernet traffic, either directly (network stack)
or via drivers exposed to network data.
* Other Remote Trigger:
Determine if the bug can be triggered by processing remote traffic other than Ethernet (Wifi, Bluetooth, NFC, etc).
* Peripheral Trigger:
Determine if the bug can be triggered via an untrusted peripheral device that can be physically plugged
into a system, such as a USB device or a niche hardware driver handling external hardware inputs.
This is particularly important for mobile and desktop environments where users can plug in unknown devices.
* Malicious Filesystem Trigger:
Determine if the bug can be triggered by the kernel mounting and parsing a malicious filesystem image.
This is highly critical for Desktop and Mobile environments where external media or downloaded images
might be auto-mounted.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt:
The kernel bug report is:
BUG at fs/jfs/jfs_dtree.c:2640 assert(p->header.flag & 0x02)
------------[ cut here ]------------
kernel BUG at fs/jfs/jfs_dtree.c:2640!
Oops: invalid opcode: 0000 [#1] SMP KASAN PTI
CPU: 0 UID: 0 PID: 19459 Comm: syz.2.1265 Not tainted syzkaller #0 PREEMPT_{RT,(full)}
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/18/2026
RIP: 0010:add_missing_indices+0xcc9/0xcd0 fs/jfs/jfs_dtree.c:2640
Code: e9 75 fc ff ff e8 27 ea 71 fe 48 c7 c7 a0 ad 8a 8b 48 c7 c6 80 ac 8a 8b ba 50 0a 00 00 48 c7 c1 00 b6 8a 8b e8 48 c7 d4 fd 90 <0f> 0b 0f 1f 44 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90
RSP: 0018:ffffc90005197920 EFLAGS: 00010246
RAX: 000000000000003c RBX: ffff88805beee010 RCX: 2ce1a78098c85e00
RDX: ffffc9000e819000 RSI: 00000000000016a5 RDI: 00000000000016a6
RBP: ffffc90005197a30 R08: 0000000000000000 R09: 0000000000000000
R10: dffffc0000000000 R11: fffff52000a32ed5 R12: ffff88805beee000
R13: dffffc0000000000 R14: 0000000000000000 R15: 1ffff1100b7ddc02
FS: 00007f2a0ef656c0(0000) GS:ffff888126332000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f2a10d79f00 CR3: 0000000070074000 CR4: 00000000003526f0
Call Trace:
<TASK>
jfs_readdir+0x1e34/0x3c10 fs/jfs/jfs_dtree.c:3031
wrap_directory_iterator+0x99/0xe0 fs/readdir.c:65
iterate_dir+0x3a5/0x580 fs/readdir.c:108
__do_sys_getdents fs/readdir.c:327 [inline]
__se_sys_getdents+0xf1/0x270 fs/readdir.c:312
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f2a10d2c819
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f2a0ef65028 EFLAGS: 00000246 ORIG_RAX: 000000000000004e
RAX: ffffffffffffffda RBX: 00007f2a10fa6090 RCX: 00007f2a10d2c819
RDX: 000000000000003a RSI: 0000200000000180 RDI: 0000000000000006
RBP: 00007f2a10dc2c91 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f2a10fa6128 R14: 00007f2a10fa6090 R15: 00007ffd98bd2fa8
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:add_missing_indices+0xcc9/0xcd0 fs/jfs/jfs_dtree.c:2640
Code: e9 75 fc ff ff e8 27 ea 71 fe 48 c7 c7 a0 ad 8a 8b 48 c7 c6 80 ac 8a 8b ba 50 0a 00 00 48 c7 c1 00 b6 8a 8b e8 48 c7 d4 fd 90 <0f> 0b 0f 1f 44 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90
RSP: 0018:ffffc90005197920 EFLAGS: 00010246
RAX: 000000000000003c RBX: ffff88805beee010 RCX: 2ce1a78098c85e00
RDX: ffffc9000e819000 RSI: 00000000000016a5 RDI: 00000000000016a6
RBP: ffffc90005197a30 R08: 0000000000000000 R09: 0000000000000000
R10: dffffc0000000000 R11: fffff52000a32ed5 R12: ffff88805beee000
R13: dffffc0000000000 R14: 0000000000000000 R15: 1ffff1100b7ddc02
FS: 00007f2a0ef656c0(0000) GS:ffff888126332000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f2a10d79f00 CR3: 0000000070074000 CR4: 00000000003526f0
Reply: Based on the analysis of the provided bug report and the JFS source code, here is the security assessment:
### Root Cause Analysis
The bug report indicates a `BUG()` triggered by an `ASSERT(p->header.flag & BT_LEAF)` in `add_missing_indices()` (called from `jfs_readdir()`). This happens when `jfs_readdir()` encounters a corrupted directory index and attempts to fix it, but the page it is processing is actually an internal B+-tree page (`BT_INTERNAL`) rather than a leaf page (`BT_LEAF`), or a completely corrupted page with `p->header.flag == 0`.
However, in JFS, `ASSERT()` is only active if `CONFIG_JFS_DEBUG` is enabled. In standard production kernel builds (e.g., Ubuntu, Debian, Android), `CONFIG_JFS_DEBUG` is disabled, meaning the `ASSERT()` macro compiles to a no-op (`do {} while (0)`).
When the assertion is compiled out, `add_missing_indices()` proceeds to modify the internal page and returns. `jfs_readdir()` then continues to process the internal page as if it were a leaf page. This causes it to read `struct idtentry` structures as `struct ldtentry` structures. Because the layouts differ, the `namlen` (name length) field of the `ldtentry` overlaps with the attacker-controlled extent descriptor (`xd`) of the `idtentry`. This allows the attacker to fully control `d->namlen` (up to 255) and the subsequent `d->name` characters.
### Exploitation via Buffer Overflow
This leads directly to a highly exploitable buffer overflow in `jfs_readdir()`. When checking if the new directory entry will fit into the allocated page-sized buffer (`dirent_buf`), the code does the following:
```c
if (((long) jfs_dirent + d->namlen + 1) > (dirent_buf + PAGE_SIZE)) {
/* DBCS codepages could overrun dirent_buf */
index = i;
overflow = 1;
break;
}
```
The check assumes that the output string length will be roughly equal to `d->namlen`. However, `d->namlen` is the number of `__le16` characters, not bytes. When a multibyte NLS codepage is used (like UTF-8, which can be forced by the attacker by mounting the filesystem with `iocharset=utf8`), `jfs_strfromUCS_le()` can write up to 3-6 bytes per character.
If `jfs_dirent` is near the end of the page (e.g., 260 bytes remaining) and the attacker provides `d->namlen = 255`, the check `255 + 1 > 260` is false, so the loop proceeds. `jfs_strfromUCS_le()` will then convert the 255 characters into UTF-8, writing up to `255 * 3 = 765` bytes into the buffer. This results in a **~500-byte out-of-bounds write** past the end of the `dirent_buf` page.
Since `dirent_buf` is allocated via `__get_free_page(GFP_KERNEL)`, this is a page-level heap buffer overflow. The attacker controls the contents of the overflow (the UTF-8 encoded characters), making this highly exploitable for **Privilege Escalation** and **Denial of Service**.
### Security Dimensions
* **Exploitable:** **Yes**. The bug leads to a page-level heap out-of-bounds write of attacker-controlled data, which can be leveraged for privilege escalation.
* **Denial of Service:** **Yes**. The out-of-bounds write will corrupt adjacent kernel memory, leading to a system crash. (In debug builds, the `ASSERT` itself causes a panic).
* **Accessible From Unprivileged Processes:** **Yes**. Any unprivileged user can trigger the bug by calling the `readdir` syscall on the mounted malicious JFS filesystem.
* **Accessible From User Namespaces:** **Yes**. If the filesystem is mounted, it can be accessed from within a user namespace.
* **Peripheral Trigger:** **Yes**. The bug can be triggered by plugging in a malicious USB drive formatted with a crafted JFS filesystem.
* **Malicious Filesystem Trigger:** **Yes**. The vulnerability relies on parsing a maliciously crafted JFS filesystem image.
* **VM Guest / Host / Network / Remote Triggers:** **No**. This is a local filesystem vulnerability.
|
| 6/2 |
2026/05/13 01:14 |
llm |
expert |
0m
Model:
Tokens:
input: 6711
output: 46
thoughts: 84
Thoughts: Here's my analysis of the situation:
**Investigating a JFS Bug in `add_missing_indices`**
Okay, there's a serious problem reported, a BUG in `fs/jfs/jfs_dtree.c` at line 2640. The specific issue is an assertion failure: `assert(p->header.flag & 0x02)`. This is occurring within the `add_missing_indices` function, which is itself called by `jfs_readdir`. My initial thought is to go directly into `fs/jfs/jfs_dtree.c` to see what's happening. The assertion failure indicates an unexpected state of a data structure (`p->header.flag`). I need to understand what `flag` represents and why this bit (0x02) should always be set within the context of `add_missing_indices` and `jfs_readdir`. Specifically, I need to know under which conditions we are missing indices to see whether they are missing for a reason (e.g., deleted or renamed). I also need to investigate whether this is due to a stale cache. I'll need to figure out what data is represented by `p` and how the `header` structure is defined and initialized. I'll also need to consider possible concurrency issues within `jfs_readdir` that might be contributing to this condition. My immediate plan is to examine the code surrounding line 2640, trace the call stack leading to `add_missing_indices`, and understand the data flow to pinpoint the root cause. This could be a data corruption issue, a race condition, or a logical error in the index management.
|
| 7/2 |
2026/05/13 01:14 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/jfs/jfs_dtree.c IncludeLines:true Name:add_missing_indices]
Results: map[SourceCode:2609: /*
2610: * add_missing_indices()
2611: *
2612: * function: Fix dtree page in which one or more entries has an invalid index.
2613: * fsck.jfs should really fix this, but it currently does not.
2614: * Called from jfs_readdir when bad index is detected.
2615: */
2616: static int add_missing_indices(struct inode *inode, s64 bn)
2617: {
2618: struct ldtentry *d;
2619: struct dt_lock *dtlck;
2620: int i;
2621: uint index;
2622: struct lv *lv;
2623: struct metapage *mp;
2624: dtpage_t *p;
2625: int rc = 0;
2626: s8 *stbl;
2627: tid_t tid;
2628: struct tlock *tlck;
2629:
2630: tid = txBegin(inode->i_sb, 0);
2631:
2632: DT_GETPAGE(inode, bn, mp, PSIZE, p, rc);
2633:
2634: if (rc) {
2635: printk(KERN_ERR "DT_GETPAGE failed!\n");
2636: goto end;
2637: }
2638: BT_MARK_DIRTY(mp, inode);
2639:
2640: ASSERT(p->header.flag & BT_LEAF);
2641:
2642: tlck = txLock(tid, inode, mp, tlckDTREE | tlckENTRY);
2643: if (BT_IS_ROOT(mp))
2644: tlck->type |= tlckBTROOT;
2645:
2646: dtlck = (struct dt_lock *) &tlck->lock;
2647:
2648: stbl = DT_GETSTBL(p);
2649: for (i = 0; i < p->header.nextindex; i++) {
2650: if (stbl[i] < 0) {
2651: jfs_err("jfs: add_missing_indices: Invalid stbl[%d] = %d for inode %ld, block = %lld",
2652: i, stbl[i], (long)inode->i_ino, (long long)bn);
2653: rc = -EIO;
2654:
2655: DT_PUTPAGE(mp);
2656: txAbort(tid, 0);
2657: goto end;
2658: }
2659:
2660: d = (struct ldtentry *) &p->slot[stbl[i]];
2661: index = le32_to_cpu(d->index);
2662: if ((index < 2) || (index >= JFS_IP(inode)->next_index)) {
2663: d->index = cpu_to_le32(add_index(tid, inode, bn, i));
2664: if (dtlck->index >= dtlck->maxcnt)
2665: dtlck = (struct dt_lock *) txLinelock(dtlck);
2666: lv = &dtlck->lv[dtlck->index];
2667: lv->offset = stbl[i];
2668: lv->length = 1;
2669: dtlck->index++;
2670: }
2671: }
2672:
2673: DT_PUTPAGE(mp);
2674: (void) txCommit(tid, 1, &inode, 0);
2675: end:
2676: txEnd(tid);
2677: return rc;
2678: }
SourceFile:fs/jfs/jfs_dtree.c]
|
| 8/2 |
2026/05/13 01:14 |
llm |
expert |
0m
Model:
Tokens:
input: 8315
output: 20
thoughts: 64
Thoughts: **Debugging a JFS dtree Bug**
Okay, so I've got this bug, and the error's pointing me right to `ASSERT(p->header.flag & BT_LEAF);` in `fs/jfs/jfs_dtree.c:2640`. That `ASSERT` suggests the code *expects* a leaf node. Now, `BT_LEAF` is likely a bit flag, so I need to figure out which one. Based on my experience, I suspect it's `0x02`, but let's confirm that. I'll need to double-check the definitions. Time to track down where `BT_LEAF` is defined within the JFS code.
|
| 9/2 |
2026/05/13 01:15 |
tool |
grepper |
0m
Error:
Args: map[Expression:#define BT_LEAF]
Results:
|
| 10/2 |
2026/05/13 01:15 |
llm |
expert |
0m
Model:
Tokens:
input: 8568
output: 21
thoughts: 61
Thoughts: Okay, let's see... the code's got an `assert(p->header.flag & 0x02)`. Hang on a second, the bug report *also* says `assert(p->header.flag & 0x02)`. That's interesting. I need to understand what this flag represents, so I'll go straight to the source, to `fs/jfs/jfs_btree.h`. That's where the definition should be. Let's see what `0x02` means in that context.
|
| 11/2 |
2026/05/13 01:15 |
tool |
grepper |
0m
Args: map[Expression:#define.*BT_LEAF]
Results: map[Output:fs/jfs/jfs_btree.h=17=struct btpage {
--
fs/jfs/jfs_btree.h-30-#define BT_ROOT 0x01 /* root page */
fs/jfs/jfs_btree.h:31:#define BT_LEAF 0x02 /* leaf page */
fs/jfs/jfs_btree.h-32-#define BT_INTERNAL 0x04 /* internal page */
]
|
| 12/2 |
2026/05/13 01:15 |
llm |
expert |
0m
Model:
Tokens:
input: 8899
output: 45
thoughts: 41
Thoughts: Okay, here's my interpretation of that.
**Analyzing the Indexing Bug**
Right, so I've pinned down the source of the trouble. It looks like the `add_missing_indices` function is being called on a page that isn't a leaf node. This is a red flag. Leaf pages are the ones that should contain the actual data, so this call on an internal node is fundamentally wrong, as this function is supposed to act on the data, not navigate to it. The function is clearly acting on the wrong level. Now, where is this misapplication happening? Ah, the call originates from `jfs_readdir`. That function is crucial for directory listing. So, there's a problem in how it's handling the directory traversal that's leading to `add_missing_indices` being incorrectly triggered on internal index pages. The bug is most likely in how the readdir logic determines what page type it is dealing with. I need to dive into `jfs_readdir` and trace the execution path. The problem is almost certainly there, in the page-handling logic.
|
| 13/2 |
2026/05/13 01:15 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/jfs/jfs_dtree.c IncludeLines:true Name:jfs_readdir]
Results: map[SourceCode:2703: /*
2704: * jfs_readdir()
2705: *
2706: * function: read directory entries sequentially
2707: * from the specified entry offset
2708: *
2709: * parameter:
2710: *
2711: * return: offset = (pn, index) of start entry
2712: * of next jfs_readdir()/dtRead()
2713: */
2714: int jfs_readdir(struct file *file, struct dir_context *ctx)
2715: {
2716: struct inode *ip = file_inode(file);
2717: struct nls_table *codepage = JFS_SBI(ip->i_sb)->nls_tab;
2718: int rc = 0;
2719: loff_t dtpos; /* legacy OS/2 style position */
2720: struct dtoffset {
2721: s16 pn;
2722: s16 index;
2723: s32 unused;
2724: } *dtoffset = (struct dtoffset *) &dtpos;
2725: s64 bn;
2726: struct metapage *mp;
2727: dtpage_t *p;
2728: int index;
2729: s8 *stbl;
2730: struct btstack btstack;
2731: int i, next;
2732: struct ldtentry *d;
2733: struct dtslot *t;
2734: int d_namleft, len, outlen;
2735: unsigned long dirent_buf;
2736: char *name_ptr;
2737: u32 dir_index;
2738: int do_index = 0;
2739: uint loop_count = 0;
2740: struct jfs_dirent *jfs_dirent;
2741: int jfs_dirents;
2742: int overflow, fix_page, page_fixed = 0;
2743: static int unique_pos = 2; /* If we can't fix broken index */
2744:
2745: if (ctx->pos == DIREND)
2746: return 0;
2747:
2748: if (DO_INDEX(ip)) {
2749: /*
2750: * persistent index is stored in directory entries.
2751: * Special cases: 0 = .
2752: * 1 = ..
2753: * -1 = End of directory
2754: */
2755: do_index = 1;
2756:
2757: dir_index = (u32) ctx->pos;
2758:
2759: /*
2760: * NFSv4 reserves cookies 1 and 2 for . and .. so the value
2761: * we return to the vfs is one greater than the one we use
2762: * internally.
2763: */
2764: if (dir_index)
2765: dir_index--;
2766:
2767: if (dir_index > 1) {
2768: struct dir_table_slot dirtab_slot;
2769:
2770: if (dtEmpty(ip) ||
2771: (dir_index >= JFS_IP(ip)->next_index)) {
2772: /* Stale position. Directory has shrunk */
2773: ctx->pos = DIREND;
2774: return 0;
2775: }
2776: repeat:
2777: rc = read_index(ip, dir_index, &dirtab_slot);
2778: if (rc) {
2779: ctx->pos = DIREND;
2780: return rc;
2781: }
2782: if (dirtab_slot.flag == DIR_INDEX_FREE) {
2783: if (loop_count++ > JFS_IP(ip)->next_index) {
2784: jfs_err("jfs_readdir detected infinite loop!");
2785: ctx->pos = DIREND;
2786: return 0;
2787: }
2788: dir_index = le32_to_cpu(dirtab_slot.addr2);
2789: if (dir_index == -1) {
2790: ctx->pos = DIREND;
2791: return 0;
2792: }
2793: goto repeat;
2794: }
2795: bn = addressDTS(&dirtab_slot);
2796: index = dirtab_slot.slot;
2797: DT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
2798: if (rc) {
2799: ctx->pos = DIREND;
2800: return 0;
2801: }
2802: if (p->header.flag & BT_INTERNAL) {
2803: jfs_err("jfs_readdir: bad index table");
2804: DT_PUTPAGE(mp);
2805: ctx->pos = DIREND;
2806: return 0;
2807: }
2808: } else {
2809: if (dir_index == 0) {
2810: /*
2811: * self "."
2812: */
2813: ctx->pos = 1;
2814: if (!dir_emit(ctx, ".", 1, ip->i_ino, DT_DIR))
2815: return 0;
2816: }
2817: /*
2818: * parent ".."
2819: */
2820: ctx->pos = 2;
2821: if (!dir_emit(ctx, "..", 2, PARENT(ip), DT_DIR))
2822: return 0;
2823:
2824: /*
2825: * Find first entry of left-most leaf
2826: */
2827: if (dtEmpty(ip)) {
2828: ctx->pos = DIREND;
2829: return 0;
2830: }
2831:
2832: if ((rc = dtReadFirst(ip, &btstack)))
2833: return rc;
2834:
2835: DT_GETSEARCH(ip, btstack.top, bn, mp, p, index);
2836: }
2837: } else {
2838: /*
2839: * Legacy filesystem - OS/2 & Linux JFS < 0.3.6
2840: *
2841: * pn = 0; index = 1: First entry "."
2842: * pn = 0; index = 2: Second entry ".."
2843: * pn > 0: Real entries, pn=1 -> leftmost page
2844: * pn = index = -1: No more entries
2845: */
2846: dtpos = ctx->pos;
2847: if (dtpos < 2) {
2848: /* build "." entry */
2849: ctx->pos = 1;
2850: if (!dir_emit(ctx, ".", 1, ip->i_ino, DT_DIR))
2851: return 0;
2852: dtoffset->index = 2;
2853: ctx->pos = dtpos;
2854: }
2855:
2856: if (dtoffset->pn == 0) {
2857: if (dtoffset->index == 2) {
2858: /* build ".." entry */
2859: if (!dir_emit(ctx, "..", 2, PARENT(ip), DT_DIR))
2860: return 0;
2861: } else {
2862: jfs_err("jfs_readdir called with invalid offset!");
2863: }
2864: dtoffset->pn = 1;
2865: dtoffset->index = 0;
2866: ctx->pos = dtpos;
2867: }
2868:
2869: if (dtEmpty(ip)) {
2870: ctx->pos = DIREND;
2871: return 0;
2872: }
2873:
2874: if ((rc = dtReadNext(ip, &ctx->pos, &btstack))) {
2875: jfs_err("jfs_readdir: unexpected rc = %d from dtReadNext",
2876: rc);
2877: ctx->pos = DIREND;
2878: return 0;
2879: }
2880: /* get start leaf page and index */
2881: DT_GETSEARCH(ip, btstack.top, bn, mp, p, index);
2882:
2883: /* offset beyond directory eof ? */
2884: if (bn < 0) {
2885: ctx->pos = DIREND;
2886: return 0;
2887: }
2888: }
2889:
2890: dirent_buf = __get_free_page(GFP_KERNEL);
2891: if (dirent_buf == 0) {
2892: DT_PUTPAGE(mp);
2893: jfs_warn("jfs_readdir: __get_free_page failed!");
2894: ctx->pos = DIREND;
2895: return -ENOMEM;
2896: }
2897:
2898: while (1) {
2899: jfs_dirent = (struct jfs_dirent *) dirent_buf;
2900: jfs_dirents = 0;
2901: overflow = fix_page = 0;
2902:
2903: stbl = DT_GETSTBL(p);
2904:
2905: for (i = index; i < p->header.nextindex; i++) {
2906: if (stbl[i] < 0) {
2907: jfs_err("JFS: Invalid stbl[%d] = %d for inode %ld, block = %lld",
2908: i, stbl[i], (long)ip->i_ino, (long long)bn);
2909: free_page(dirent_buf);
2910: DT_PUTPAGE(mp);
2911: return -EIO;
2912: }
2913:
2914: d = (struct ldtentry *) & p->slot[stbl[i]];
2915:
2916: if (((long) jfs_dirent + d->namlen + 1) >
2917: (dirent_buf + PAGE_SIZE)) {
2918: /* DBCS codepages could overrun dirent_buf */
2919: index = i;
2920: overflow = 1;
2921: break;
2922: }
2923:
2924: d_namleft = d->namlen;
2925: name_ptr = jfs_dirent->name;
2926: jfs_dirent->ino = le32_to_cpu(d->inumber);
2927:
2928: if (do_index) {
2929: len = min(d_namleft, DTLHDRDATALEN);
2930: jfs_dirent->position = le32_to_cpu(d->index);
2931: /*
2932: * d->index should always be valid, but it
2933: * isn't. fsck.jfs doesn't create the
2934: * directory index for the lost+found
2935: * directory. Rather than let it go,
2936: * we can try to fix it.
2937: */
2938: if ((jfs_dirent->position < 2) ||
2939: (jfs_dirent->position >=
2940: JFS_IP(ip)->next_index)) {
2941: if (!page_fixed && !isReadOnly(ip)) {
2942: fix_page = 1;
2943: /*
2944: * setting overflow and setting
2945: * index to i will cause the
2946: * same page to be processed
2947: * again starting here
2948: */
2949: overflow = 1;
2950: index = i;
2951: break;
2952: }
2953: jfs_dirent->position = unique_pos++;
2954: }
2955: /*
2956: * We add 1 to the index because we may
2957: * use a value of 2 internally, and NFSv4
2958: * doesn't like that.
2959: */
2960: jfs_dirent->position++;
2961: } else {
2962: jfs_dirent->position = dtpos;
2963: len = min(d_namleft, DTLHDRDATALEN_LEGACY);
2964: }
2965:
2966: /* copy the name of head/only segment */
2967: outlen = jfs_strfromUCS_le(name_ptr, d->name, len,
2968: codepage);
2969: jfs_dirent->name_len = outlen;
2970:
2971: /* copy name in the additional segment(s) */
2972: next = d->next;
2973: while (next >= 0) {
2974: t = (struct dtslot *) & p->slot[next];
2975: name_ptr += outlen;
2976: d_namleft -= len;
2977: /* Sanity Check */
2978: if (d_namleft == 0) {
2979: jfs_error(ip->i_sb,
2980: "JFS:Dtree error: ino = %ld, bn=%lld, index = %d\n",
2981: (long)ip->i_ino,
2982: (long long)bn,
2983: i);
2984: goto skip_one;
2985: }
2986: len = min(d_namleft, DTSLOTDATALEN);
2987: outlen = jfs_strfromUCS_le(name_ptr, t->name,
2988: len, codepage);
2989: jfs_dirent->name_len += outlen;
2990:
2991: next = t->next;
2992: }
2993:
2994: jfs_dirents++;
2995: jfs_dirent = next_jfs_dirent(jfs_dirent);
2996: skip_one:
2997: if (!do_index)
2998: dtoffset->index++;
2999: }
3000:
3001: if (!overflow) {
3002: /* Point to next leaf page */
3003: if (p->header.flag & BT_ROOT)
3004: bn = 0;
3005: else {
3006: bn = le64_to_cpu(p->header.next);
3007: index = 0;
3008: /* update offset (pn:index) for new page */
3009: if (!do_index) {
3010: dtoffset->pn++;
3011: dtoffset->index = 0;
3012: }
3013: }
3014: page_fixed = 0;
3015: }
3016:
3017: /* unpin previous leaf page */
3018: DT_PUTPAGE(mp);
3019:
3020: jfs_dirent = (struct jfs_dirent *) dirent_buf;
3021: while (jfs_dirents--) {
3022: ctx->pos = jfs_dirent->position;
3023: if (!dir_emit(ctx, jfs_dirent->name,
3024: jfs_dirent->name_len,
3025: jfs_dirent->ino, DT_UNKNOWN))
3026: goto out;
3027: jfs_dirent = next_jfs_dirent(jfs_dirent);
3028: }
3029:
3030: if (fix_page) {
3031: if ((rc = add_missing_indices(ip, bn)))
3032: goto out;
3033: page_fixed = 1;
3034: }
3035:
3036: if (!overflow && (bn == 0)) {
3037: ctx->pos = DIREND;
3038: break;
3039: }
3040:
3041: DT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
3042: if (rc) {
3043: free_page(dirent_buf);
3044: return rc;
3045: }
3046: }
3047:
3048: out:
3049: free_page(dirent_buf);
3050:
3051: return rc;
3052: }
SourceFile:fs/jfs/jfs_dtree.c]
|
| 14/2 |
2026/05/13 01:15 |
llm |
expert |
0m
Model:
Tokens:
input: 14223
output: 45
thoughts: 1102
Thoughts: **Analyzing a Potential JFS Readdir Bug**
Okay, so I'm looking at this `jfs_readdir` function and something's bugging me. Specifically, I'm focusing on the `fix_page` logic. The situation is this: a file system might have a directory with a corrupted index. The code attempts to fix it. `fix_page` gets set if the directory index appears to be invalid β for instance, it might be out of bounds.
Here's the problem: when `fix_page` is set, `add_missing_indices` is called, and this function takes `ip` (the inode) and `bn` (a block number) as parameters. Initially, `bn` is the block number of the current directory page. If the code *doesn't* need to "fix" the page, `bn` gets updated to the next page using the `header.next` field of the current page. However, the logic *inside* the conditional where `fix_page` gets set, will result in `bn` *not* getting updated. This seems like it could create an issue.
Now, `DT_PUTPAGE(mp)` is called *before* `add_missing_indices(ip, bn)`. `add_missing_indices` then fetches the page again using `DT_GETPAGE` *with the same `bn`*. Critically, it asserts that the page has the `BT_LEAF` flag set.
My concern is that if the directory tree's root page is corrupt, then the `p->header.flag` could be zero, which is neither a root nor a leaf nor an internal node. This means it *passes* the initial check, potentially resulting in `fix_page` getting set. It then enters the loop and finds the bad index, sets `fix_page = 1`, calls `add_missing_indices` with the block number of the *corrupted* page. `add_missing_indices` then asserts `p->header.flag & BT_LEAF`, which in our case is zero. This, in turn, will cause a kernel BUG.
So, I think I've identified a vulnerability. The root cause appears to be the handling of potentially corrupt directory metadata, which leads to `add_missing_indices` being called on a page that isn't a leaf, resulting in an assertion failure.
I need to investigate `DT_GETSEARCH` to see if there's any related issue there, as that's where the first page is fetched.
|
| 15/2 |
2026/05/13 01:15 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:fs/jfs/jfs_dtree.c IncludeLines:true Name:DT_GETSEARCH]
Results: map[SourceCode: SourceFile:]
|
| 16/2 |
2026/05/13 01:15 |
llm |
expert |
0m
Model:
Tokens:
input: 15936
output: 21
thoughts: 13
Thoughts: Okay, here's my summary, presented as a stream of thought:
**Identifying and Locating the Macro**
Alright, I see this⦠it looks like we're dealing with a macro. My first instinct, given my experience, is to zero in on where this thing lives. Time to break out the `grep`! Let's get to work, run it to scan through the code base and see if we can find all instances of this macro. From there, I can get a better understanding of how it's used and what context it resides in.
|
| 17/2 |
2026/05/13 01:15 |
tool |
grepper |
0m
Args: map[Expression:#define.*DT_GETSEARCH]
Results: map[Output:fs/jfs/jfs_dtree.c=115=do { \
--
fs/jfs/jfs_dtree.c-133-
fs/jfs/jfs_dtree.c:134:#define DT_GETSEARCH(IP, LEAF, BN, MP, P, INDEX) \
fs/jfs/jfs_dtree.c-135- BT_GETSEARCH(IP, LEAF, BN, MP, dtpage_t, P, INDEX, i_dtroot)
]
|
| 18/2 |
2026/05/13 01:15 |
llm |
expert |
0m
Model:
Tokens:
input: 16228
output: 21
thoughts: 10
Thoughts: Okay, here's my interpretation of that thought process, assuming I'm an expert in this field, presented as a first-person summary:
**Analyzing the Query: BT_GETSEARCH**
Alright, *BT_GETSEARCH*. The immediate association is clear: this likely pertains to some sort of search operation, probably within a business or technology context given the *BT* prefix. My mind immediately starts to parse the implications. Is this a database query, an API call, a specific function name, or maybe a structured message type? The capitalization suggests a defined constant or command.
I need more context, obviously, to pinpoint its exact function. What system is this embedded within? What's the surrounding code or data flow? Is this part of a legacy system or something modern? *BT* is a common acronym and could mean many different things. Business Technology? Back-End Technology? Before I can draw any concrete conclusions about its functionality, I need to know more about the environment it lives in. So, let's keep it abstract, for now.
|
| 19/2 |
2026/05/13 01:15 |
tool |
grepper |
0m
Args: map[Expression:#define.*BT_GETSEARCH]
Results: map[Output:fs/jfs/jfs_btree.h=131=static inline void BT_STACK_DUMP(struct btstack *btstack)
--
fs/jfs/jfs_btree.h-141-/* retrieve search results */
fs/jfs/jfs_btree.h:142:#define BT_GETSEARCH(IP, LEAF, BN, MP, TYPE, P, INDEX, ROOT)\
fs/jfs/jfs_btree.h-143-{\
]
|
| 20/2 |
2026/05/13 01:15 |
llm |
expert |
0m
Model:
Tokens:
input: 16606
output: 44
thoughts: 21
Thoughts: Okay, here's my interpretation of that thought process, assuming I'm deep in the weeds of file system internals:
**Diving into JFS B-Tree Structure**
Alright, time to get my hands dirty. My mind's automatically jumping to the specifics; specifically, line 142 of `fs/jfs/jfs_btree.h`. This likely means I'm troubleshooting, or maybe optimizing the B-tree implementation within the JFS file system. I'm probably trying to understand how data is organized within those B-tree structures. This likely involves understanding key concepts like node structure, key/value storage, block pointers, and how concurrency is handled in the tree. I might be looking for the definition of a specific data structure within the B-tree, maybe a node structure, or a specific function like the search or insertion function to get a good understanding of what is going on at this line. Understanding this line is critical to understanding the bigger picture. Understanding this will help me troubleshoot any read or write errors or performance bottlenecks I am experiencing with JFS.
|
| 21/2 |
2026/05/13 01:15 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:fs/jfs/jfs_btree.h IncludeLines:true Name:BT_GETSEARCH]
Results: map[SourceCode: SourceFile:]
|
| 22/2 |
2026/05/13 01:15 |
llm |
expert |
0m
Model:
Tokens:
input: 16918
output: 26
thoughts: 14
Thoughts: Okay, here's my summary, presented as a stream of thought:
**Initial Assessment: Macro Handling**
Alright, this is a macro. The most efficient way to process this and extract what I need is to skip any intermediate steps and go straight to reading the source file directly. Thatβs generally the best approach with these types of constructs, especially if I'm after a specific piece of information or structure within the macro's definition. Less indirection, less potential for misinterpretation. Time to get down to the file level.
|
| 23/2 |
2026/05/13 01:15 |
tool |
read-file |
0m
Args: map[File:fs/jfs/jfs_btree.h]
Results: map[Contents:/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (C) International Business Machines Corp., 2000-2004
*/
#ifndef _H_JFS_BTREE
#define _H_JFS_BTREE
/*
* jfs_btree.h: B+-tree
*
* JFS B+-tree (dtree and xtree) common definitions
*/
/*
* basic btree page - btpage
*
struct btpage {
s64 next; right sibling bn
s64 prev; left sibling bn
u8 flag;
u8 rsrvd[7]; type specific
s64 self; self address
u8 entry[4064];
}; */
/* btpaget_t flag */
#define BT_TYPE 0x07 /* B+-tree index */
#define BT_ROOT 0x01 /* root page */
#define BT_LEAF 0x02 /* leaf page */
#define BT_INTERNAL 0x04 /* internal page */
#define BT_RIGHTMOST 0x10 /* rightmost page */
#define BT_LEFTMOST 0x20 /* leftmost page */
#define BT_SWAPPED 0x80 /* used by fsck for endian swapping */
/* btorder (in inode) */
#define BT_RANDOM 0x0000
#define BT_SEQUENTIAL 0x0001
#define BT_LOOKUP 0x0010
#define BT_INSERT 0x0020
#define BT_DELETE 0x0040
/*
* btree page buffer cache access
*/
#define BT_IS_ROOT(MP) (((MP)->xflag & COMMIT_PAGE) == 0)
/* get page from buffer page */
#define BT_PAGE(IP, MP, TYPE, ROOT)\
(BT_IS_ROOT(MP) ? (TYPE *)&JFS_IP(IP)->ROOT : (TYPE *)(MP)->data)
/* get the page buffer and the page for specified block address */
#define BT_GETPAGE(IP, BN, MP, TYPE, SIZE, P, RC, ROOT)\
{\
if ((BN) == 0)\
{\
MP = (struct metapage *)&JFS_IP(IP)->bxflag;\
P = (TYPE *)&JFS_IP(IP)->ROOT;\
RC = 0;\
}\
else\
{\
MP = read_metapage((IP), BN, SIZE, 1);\
if (MP) {\
RC = 0;\
P = (MP)->data;\
} else {\
P = NULL;\
jfs_err("bread failed!");\
RC = -EIO;\
}\
}\
}
#define BT_MARK_DIRTY(MP, IP)\
{\
if (BT_IS_ROOT(MP))\
mark_inode_dirty(IP);\
else\
mark_metapage_dirty(MP);\
}
/* put the page buffer */
#define BT_PUTPAGE(MP)\
{\
if (! BT_IS_ROOT(MP)) \
release_metapage(MP); \
}
/*
* btree traversal stack
*
* record the path traversed during the search;
* top frame record the leaf page/entry selected.
*/
struct btframe { /* stack frame */
s64 bn; /* 8: */
s16 index; /* 2: */
s16 lastindex; /* 2: unused */
struct metapage *mp; /* 4/8: */
}; /* (16/24) */
struct btstack {
struct btframe *top;
int nsplit;
struct btframe stack[MAXTREEHEIGHT];
};
#define BT_CLR(btstack)\
(btstack)->top = (btstack)->stack
#define BT_STACK_FULL(btstack)\
( (btstack)->top == &((btstack)->stack[MAXTREEHEIGHT-1]))
#define BT_PUSH(BTSTACK, BN, INDEX)\
{\
assert(!BT_STACK_FULL(BTSTACK));\
(BTSTACK)->top->bn = BN;\
(BTSTACK)->top->index = INDEX;\
++(BTSTACK)->top;\
}
#define BT_POP(btstack)\
( (btstack)->top == (btstack)->stack ? NULL : --(btstack)->top )
#define BT_STACK(btstack)\
( (btstack)->top == (btstack)->stack ? NULL : (btstack)->top )
static inline void BT_STACK_DUMP(struct btstack *btstack)
{
int i;
printk("btstack dump:\n");
for (i = 0; i < MAXTREEHEIGHT; i++)
printk(KERN_ERR "bn = %Lx, index = %d\n",
(long long)btstack->stack[i].bn,
btstack->stack[i].index);
}
/* retrieve search results */
#define BT_GETSEARCH(IP, LEAF, BN, MP, TYPE, P, INDEX, ROOT)\
{\
BN = (LEAF)->bn;\
MP = (LEAF)->mp;\
if (BN)\
P = (TYPE *)MP->data;\
else\
P = (TYPE *)&JFS_IP(IP)->ROOT;\
INDEX = (LEAF)->index;\
}
/* put the page buffer of search */
#define BT_PUTSEARCH(BTSTACK)\
{\
if (! BT_IS_ROOT((BTSTACK)->top->mp))\
release_metapage((BTSTACK)->top->mp);\
}
#endif /* _H_JFS_BTREE */
]
|
| 24/2 |
2026/05/13 01:15 |
llm |
expert |
0m
Model:
Tokens:
input: 18476
output: 44
thoughts: 984
Thoughts: **Analyzing the JFS Readdir Implementation and Potential Vulnerability**
Okay, let's break this down. My initial thought is that within `jfs_readdir`, the function seems to be fetching `bn`, `mp`, `p`, and `index` from `btstack.top` using `DT_GETSEARCH`. Now, if `bn` isn't zero, `p` is set to `MP->data`.
Here's the sequence. The logic diverges based on `dir_index`. If `dir_index > 1`, we use `DT_GETPAGE`. If it's `dir_index <= 1`, we use `dtReadFirst` and then `DT_GETSEARCH`. The `while (1)` loop processes `stbl[i]` entries. This is where it gets interesting.
If a bad index is found, `fix_page` is set, and the loop breaks. Here's a key observation: `overflow` is linked to `fix_page`. The code then *doesn't* update `bn` because `overflow` is set to 1. Consequently, it calls `DT_PUTPAGE` to release the memory page. Then, the code calls `add_missing_indices(ip, bn)`.
Let's look closely at `add_missing_indices`. Within this function, there's a crucial assertion: `ASSERT(p->header.flag & BT_LEAF)`. It gets the page via `DT_GETPAGE`.
Here's the potential issue. If `p->header.flag & BT_LEAF` is false, it triggers a BUG. But the question is: How can this happen? The code explicitly checks for `BT_INTERNAL` when `dir_index > 1`, but it doesn't *ensure* `BT_LEAF`. The flag might be 0 or `BT_ROOT`, which doesn't satisfy the assertion. `p->header.flag` could be 0 due to disk corruption or a malicious file system. This means `jfs_readdir` doesn't reject pages with flags other than `BT_INTERNAL`. It processes entries and calls `add_missing_indices` which contains the assertion, and thus could lead to a crash.
My next step is to examine `dtReadFirst` to see if it implicitly assures the leaf node flag when `dir_index <= 1`.
|
| 25/2 |
2026/05/13 01:16 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/jfs/jfs_dtree.c IncludeLines:true Name:dtReadFirst]
Results: map[SourceCode:3055: /*
3056: * dtReadFirst()
3057: *
3058: * function: get the leftmost page of the directory
3059: */
3060: static int dtReadFirst(struct inode *ip, struct btstack * btstack)
3061: {
3062: int rc = 0;
3063: s64 bn;
3064: int psize = 288; /* initial in-line directory */
3065: struct metapage *mp;
3066: dtpage_t *p;
3067: s8 *stbl;
3068: struct btframe *btsp;
3069: pxd_t *xd;
3070:
3071: BT_CLR(btstack); /* reset stack */
3072:
3073: /*
3074: * descend leftmost path of the tree
3075: *
3076: * by convention, root bn = 0.
3077: */
3078: for (bn = 0;;) {
3079: DT_GETPAGE(ip, bn, mp, psize, p, rc);
3080: if (rc)
3081: return rc;
3082:
3083: /*
3084: * leftmost leaf page
3085: */
3086: if (p->header.flag & BT_LEAF) {
3087: /* return leftmost entry */
3088: btsp = btstack->top;
3089: btsp->bn = bn;
3090: btsp->index = 0;
3091: btsp->mp = mp;
3092:
3093: return 0;
3094: }
3095:
3096: /*
3097: * descend down to leftmost child page
3098: */
3099: if (BT_STACK_FULL(btstack)) {
3100: DT_PUTPAGE(mp);
3101: jfs_error(ip->i_sb, "btstack overrun\n");
3102: BT_STACK_DUMP(btstack);
3103: return -EIO;
3104: }
3105: /* push (bn, index) of the parent page/entry */
3106: BT_PUSH(btstack, bn, 0);
3107:
3108: /* get the leftmost entry */
3109: stbl = DT_GETSTBL(p);
3110:
3111: if (stbl[0] < 0) {
3112: DT_PUTPAGE(mp);
3113: jfs_error(ip->i_sb, "stbl[0] out of bound\n");
3114: return -EIO;
3115: }
3116:
3117: xd = (pxd_t *) & p->slot[stbl[0]];
3118:
3119: /* get the child page block address */
3120: bn = addressPXD(xd);
3121: psize = lengthPXD(xd) << JFS_SBI(ip->i_sb)->l2bsize;
3122:
3123: /* unpin the parent page */
3124: DT_PUTPAGE(mp);
3125: }
3126: }
SourceFile:fs/jfs/jfs_dtree.c]
|
| 26/2 |
2026/05/13 01:16 |
llm |
expert |
0m
Model:
Tokens:
input: 21009
output: 18
thoughts: 758
Thoughts: **Analyzing the JFS Readdir Logic**
Okay, let's break down this `jfs_readdir` code. My initial thought process is centered around how it traverses the B-tree structure. I see that `dtReadFirst` is responsible for descending through the tree until it finds a leaf page, marked with the `BT_LEAF` flag. If it encounters a page with `p->header.flag` equal to zero, which is not set to `BT_LEAF`, it treats it as an internal node and continues the descent. This makes perfect sense; the logic ensures we eventually reach a leaf. When `dir_index <= 1`, `dtReadFirst` guarantees `BT_LEAF`.
However, the more interesting case is when `dir_index > 1`. Here, the code reads a page from the directory table slot. It checks for `BT_INTERNAL`, but importantly, *it doesn't check for `BT_LEAF` explicitly*. If the flag is zero, the code proceeds. Then, if it encounters issues, `add_missing_indices` is called, and this function *asserts* that it's a leaf.
A deeper look reveals another issue. Even if `dir_index <= 1` initially leads to a leaf, the code iterates to the *next* page. This happens when the current leaf is processed and there are more entries. The important part is that the code fetches the *next* page, using `p->header.next`, and *doesn't verify* that this new page is actually a leaf! So, if `p->header.next` points to a page with a flag of zero, it processes it. The bug is that `jfs_readdir` processes a page without verifying `BT_LEAF` is set. Then, if it runs into an error, the `add_missing_indices` function asserts `BT_LEAF`.
This is a subtle but critical flaw. If the underlying data structure is corrupted, and a non-leaf page is somehow linked in where a leaf should be, this code will proceed and attempt to process a potentially invalid structure. The `ASSERT` is a safety net here. It's not preventing the problem, only detecting it *after* it has already happened in many cases.
|
| 27/2 |
2026/05/13 01:16 |
tool |
grepper |
0m
Args: map[Expression:#define.*ASSERT]
Results: map[Output:
Full output is too long, showing 500 out of 8294 lines.
Use more precise expression if possible.
[arch/alpha/include/uapi/asm/gentrap.h-20-#define GEN_ROPRAND -11 /* reserved operand */
arch/alpha/include/uapi/asm/gentrap.h:21:#define GEN_ASSERTERR -12 /* assertion error */
arch/alpha/include/uapi/asm/gentrap.h-22-#define GEN_NULPTRERR -13 /* null pointer error */
--
arch/arc/include/asm/asserts.h-7-#ifndef __ASM_ARC_ASSERTS_H
arch/arc/include/asm/asserts.h:8:#define __ASM_ARC_ASSERTS_H
arch/arc/include/asm/asserts.h-9-
--
arch/arm/include/asm/hardware/dec21285.h-64-#define SA110_CNTL_INITCMPLETE (1 << 0)
arch/arm/include/asm/hardware/dec21285.h:65:#define SA110_CNTL_ASSERTSERR (1 << 1)
arch/arm/include/asm/hardware/dec21285.h-66-#define SA110_CNTL_RXSERR (1 << 3)
--
arch/arm/include/asm/vmlinux.lds.h-77- */
arch/arm/include/asm/vmlinux.lds.h:78:#define ARM_ASSERTS \
arch/arm/include/asm/vmlinux.lds.h-79- .plt : { \
--
arch/arm/mach-mvebu/cpu-reset.c=19=static size_t cpu_reset_size;
--
arch/arm/mach-mvebu/cpu-reset.c-21-#define CPU_RESET_OFFSET(cpu) (cpu * 0x8)
arch/arm/mach-mvebu/cpu-reset.c:22:#define CPU_RESET_ASSERT BIT(0)
arch/arm/mach-mvebu/cpu-reset.c-23-
--
arch/arm64/kernel/image-vars.h-13-#if defined(CONFIG_LD_IS_LLD) && CONFIG_LLD_VERSION < 210000
arch/arm64/kernel/image-vars.h:14:#define ASSERT(...)
arch/arm64/kernel/image-vars.h-15-#endif
--
arch/loongarch/include/asm/elf.h-47-#define R_LARCH_SOP_PUSH_PLT_PCREL 29
arch/loongarch/include/asm/elf.h:48:#define R_LARCH_SOP_ASSERT 30
arch/loongarch/include/asm/elf.h-49-#define R_LARCH_SOP_NOT 31
--
arch/mips/include/asm/ip32/mace.h=181=struct mace_isactrl {
--
arch/mips/include/asm/ip32/mace.h-187-#define MACEISA_PWD_CLEAR BIT(1) /* 1=> PWD CLEAR jumper detected */
arch/mips/include/asm/ip32/mace.h:188:#define MACEISA_NIC_DEASSERT BIT(2)
arch/mips/include/asm/ip32/mace.h-189-#define MACEISA_NIC_DATA BIT(3)
--
arch/parisc/math-emu/fpudispatch.c=153=static void update_status_cbit();
--
arch/parisc/math-emu/fpudispatch.c-155-
arch/parisc/math-emu/fpudispatch.c:156:#define VASSERT(x)
arch/parisc/math-emu/fpudispatch.c-157-
--
arch/powerpc/include/asm/keylargo.h-64-#define KL_GPIO_EXTINT_CPU1 (KEYLARGO_GPIO_0+0x0a)
arch/powerpc/include/asm/keylargo.h:65:#define KL_GPIO_EXTINT_CPU1_ASSERT 0x04
arch/powerpc/include/asm/keylargo.h-66-#define KL_GPIO_EXTINT_CPU1_RELEASE 0x38
--
arch/powerpc/include/asm/ps3av.h-216-#define PS3AV_CMD_AUDIO_CTRL_RESET_NEGATE 0x0000
arch/powerpc/include/asm/ps3av.h:217:#define PS3AV_CMD_AUDIO_CTRL_RESET_ASSERT 0x0001
arch/powerpc/include/asm/ps3av.h-218-/* audio_ctrl_data[0] de-emphasis */
--
arch/powerpc/include/uapi/asm/kvm.h=433=struct kvm_ppc_cpu_char {
--
arch/powerpc/include/uapi/asm/kvm.h-691-#define KVM_XIVE_LEVEL_SENSITIVE (1ULL << 0)
arch/powerpc/include/uapi/asm/kvm.h:692:#define KVM_XIVE_LEVEL_ASSERTED (1ULL << 1)
arch/powerpc/include/uapi/asm/kvm.h-693-
--
arch/powerpc/platforms/83xx/suspend.c=42=struct mpc83xx_pmc {
--
arch/powerpc/platforms/83xx/suspend.c-64-#define PMCCR1_PME_EN 0x00000080
arch/powerpc/platforms/83xx/suspend.c:65:#define PMCCR1_ASSERT_PME 0x00000040
arch/powerpc/platforms/83xx/suspend.c-66-#define PMCCR1_POWER_OFF 0x00000020
--
arch/riscv/kernel/tests/module_test/test_module_linking_main.c=26=extern int test_uleb_large(void);
--
arch/riscv/kernel/tests/module_test/test_module_linking_main.c-28-
arch/riscv/kernel/tests/module_test/test_module_linking_main.c:29:#define CHECK_EQ(lhs, rhs) KUNIT_ASSERT_EQ(test, lhs, rhs)
arch/riscv/kernel/tests/module_test/test_module_linking_main.c-30-
--
arch/x86/include/asm/apicdef.h-85-#define APIC_INT_LEVELTRIG 0x08000
arch/x86/include/asm/apicdef.h:86:#define APIC_INT_ASSERT 0x04000
arch/x86/include/asm/apicdef.h-87-#define APIC_ICR_BUSY 0x01000
--
arch/x86/kernel/cpu/mshyperv.c=485=static void hv_reserve_irq_vectors(void)
--
arch/x86/kernel/cpu/mshyperv.c-487- #define HYPERV_DBG_FASTFAIL_VECTOR 0x29
arch/x86/kernel/cpu/mshyperv.c:488: #define HYPERV_DBG_ASSERT_VECTOR 0x2C
arch/x86/kernel/cpu/mshyperv.c-489- #define HYPERV_DBG_SERVICE_VECTOR 0x2D
--
drivers/accel/habanalabs/include/gaudi/gaudi_masks.h-295-
drivers/accel/habanalabs/include/gaudi/gaudi_masks.h:296:#define CPU_RESET_ASSERT (\
drivers/accel/habanalabs/include/gaudi/gaudi_masks.h-297- 1 << CPU_CA53_CFG_ARM_RST_CONTROL_NMBISTRESET_SHIFT)
drivers/accel/habanalabs/include/gaudi/gaudi_masks.h-298-
drivers/accel/habanalabs/include/gaudi/gaudi_masks.h:299:#define CPU_RESET_CORE0_DEASSERT (\
drivers/accel/habanalabs/include/gaudi/gaudi_masks.h-300- 1 << CPU_CA53_CFG_ARM_RST_CONTROL_NCPUPORESET_SHIFT |\
--
drivers/accel/habanalabs/include/goya/asic_reg/goya_masks.h-181-
drivers/accel/habanalabs/include/goya/asic_reg/goya_masks.h:182:#define CPU_RESET_ASSERT (\
drivers/accel/habanalabs/include/goya/asic_reg/goya_masks.h-183- 1 << CPU_CA53_CFG_ARM_RST_CONTROL_NMBISTRESET_SHIFT)
drivers/accel/habanalabs/include/goya/asic_reg/goya_masks.h-184-
drivers/accel/habanalabs/include/goya/asic_reg/goya_masks.h:185:#define CPU_RESET_CORE0_DEASSERT (\
drivers/accel/habanalabs/include/goya/asic_reg/goya_masks.h-186- 1 << CPU_CA53_CFG_ARM_RST_CONTROL_NCPUPORESET_SHIFT |\
--
drivers/atm/fore200e.c-84-#if 1
drivers/atm/fore200e.c:85:#define ASSERT(expr) if (!(expr)) { \
drivers/atm/fore200e.c-86- printk(FORE200E "assertion failed! %s[%d]: %s\n", \
--
drivers/atm/fore200e.c-90-#else
drivers/atm/fore200e.c:91:#define ASSERT(expr) do {} while (0)
drivers/atm/fore200e.c-92-#endif
--
drivers/block/drbd/drbd_polymorph_printk.h=49=void drbd_dyn_dbg_with_wrong_object_type(void);
--
drivers/block/drbd/drbd_polymorph_printk.h-120-
drivers/block/drbd/drbd_polymorph_printk.h:121:#define D_ASSERT(x, exp) \
drivers/block/drbd/drbd_polymorph_printk.h-122- do { \
--
drivers/bluetooth/btintel_pcie.c=52=struct btintel_pcie_dev_recovery {
--
drivers/bluetooth/btintel_pcie.c-77-#define BTINTEL_PCIE_TRIGGER_REASON_USER_TRIGGER 0x17A2
drivers/bluetooth/btintel_pcie.c:78:#define BTINTEL_PCIE_TRIGGER_REASON_FW_ASSERT 0x1E61
drivers/bluetooth/btintel_pcie.c-79-
--
drivers/clk/sophgo/clk-sg2044.c-23-
drivers/clk/sophgo/clk-sg2044.c:24:#define DIV_ASSERT BIT(0)
drivers/clk/sophgo/clk-sg2044.c-25-#define DIV_FACTOR_REG_SOURCE BIT(3)
--
drivers/clk/sophgo/clk-sg2044.c-27-
drivers/clk/sophgo/clk-sg2044.c:28:#define DIV_ASSERT_TIME 2
drivers/clk/sophgo/clk-sg2044.c-29-
--
drivers/comedi/drivers/adv_pci1760.c-54-#define PCI1760_INTCSR2_IRQ_STATUS BIT(6)
drivers/comedi/drivers/adv_pci1760.c:55:#define PCI1760_INTCSR2_IRQ_ASSERTED BIT(7)
drivers/comedi/drivers/adv_pci1760.c-56-
--
drivers/comedi/drivers/amcc_s5933.h-56-/* read only, interrupt asserted */
drivers/comedi/drivers/amcc_s5933.h:57:#define INTCSR_INTR_ASSERTED 0x800000
drivers/comedi/drivers/amcc_s5933.h-58-
--
drivers/comedi/drivers/amcc_s5933.h-137-
drivers/comedi/drivers/amcc_s5933.h:138:#define AINT_INT_ASSERTED 0x00800000
drivers/comedi/drivers/amcc_s5933.h-139-#define AINT_BM_ERROR 0x00200000
--
drivers/dpll/dpll_core.c=31=static u32 dpll_pin_xa_id;
drivers/dpll/dpll_core.c-32-
drivers/dpll/dpll_core.c:33:#define ASSERT_DPLL_REGISTERED(d) \
drivers/dpll/dpll_core.c-34- WARN_ON_ONCE(!xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED))
drivers/dpll/dpll_core.c:35:#define ASSERT_DPLL_NOT_REGISTERED(d) \
drivers/dpll/dpll_core.c-36- WARN_ON_ONCE(xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED))
drivers/dpll/dpll_core.c:37:#define ASSERT_DPLL_PIN_REGISTERED(p) \
drivers/dpll/dpll_core.c-38- WARN_ON_ONCE(!xa_get_mark(&dpll_pin_xa, (p)->id, DPLL_REGISTERED))
--
drivers/dpll/dpll_netlink.c-17-
drivers/dpll/dpll_netlink.c:18:#define ASSERT_NOT_NULL(ptr) (WARN_ON(!ptr))
drivers/dpll/dpll_netlink.c-19-
--
drivers/firmware/arm_scmi/reset.c=38=struct scmi_msg_reset_domain_reset {
--
drivers/firmware/arm_scmi/reset.c-41-#define AUTONOMOUS_RESET BIT(0)
drivers/firmware/arm_scmi/reset.c:42:#define EXPLICIT_RESET_ASSERT BIT(1)
drivers/firmware/arm_scmi/reset.c-43-#define ASYNCHRONOUS_RESET BIT(2)
--
drivers/gpu/drm/amd/amdgpu/sid.h-26-
drivers/gpu/drm/amd/amdgpu/sid.h:27:#define SI_MAX_CTLACKS_ASSERTION_WAIT 100
drivers/gpu/drm/amd/amdgpu/sid.h-28-
--
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_standalone_libraries/lib_float_math.c-6-
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_standalone_libraries/lib_float_math.c:7:#define ASSERT(condition)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_standalone_libraries/lib_float_math.c-8-
--
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h-8-#include "os_types.h"
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h:9:#define DML_ASSERT(condition) ASSERT(condition)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h-10-#define DML_LOG_LEVEL_DEFAULT DML_LOG_LEVEL_WARN
--
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h-104-#define DML_LOG_ERROR(fmt, ...) DML_LOG_INTERNAL("[DML ERROR] "fmt, ## __VA_ARGS__)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h:105:#define DML_ASSERT_MSG(condition, fmt, ...) \
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h-106- do { \
--
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h-114-#define DML_LOG_ERROR(fmt, ...) ((void)0)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h:115:#define DML_ASSERT_MSG(condition, fmt, ...) ((void)0)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h-116-#endif
--
drivers/gpu/drm/amd/display/dc/dml2_0/dml_assert.h-27-#ifndef __DML_ASSERT_H__
drivers/gpu/drm/amd/display/dc/dml2_0/dml_assert.h:28:#define __DML_ASSERT_H__
drivers/gpu/drm/amd/display/dc/dml2_0/dml_assert.h-29-
--
drivers/gpu/drm/amd/display/dc/os_types.h-70-
drivers/gpu/drm/amd/display/dc/os_types.h:71:#define ASSERT_CRITICAL(expr) do { \
drivers/gpu/drm/amd/display/dc/os_types.h-72- if (WARN_ON(!(expr))) \
--
drivers/gpu/drm/amd/display/dc/os_types.h-75-
drivers/gpu/drm/amd/display/dc/os_types.h:76:#define ASSERT(expr) do { \
drivers/gpu/drm/amd/display/dc/os_types.h-77- if (WARN_ON_ONCE(!(expr))) \
--
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-8-#if defined(CONFIG_HAVE_KGDB) || defined(CONFIG_KGDB)
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h:9:#define SPL_ASSERT_CRITICAL(expr) do { \
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-10- if (WARN_ON(!(expr))) { \
--
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-14-#else
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h:15:#define SPL_ASSERT_CRITICAL(expr) do { \
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-16- if (WARN_ON(!(expr))) { \
--
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-22-#if defined(CONFIG_DEBUG_KERNEL_DC)
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h:23:#define SPL_ASSERT(expr) SPL_ASSERT_CRITICAL(expr)
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-24-#else
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h:25:#define SPL_ASSERT(expr) WARN_ON(!(expr))
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-26-#endif /* CONFIG_DEBUG_KERNEL_DC */
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-27-
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h:28:#define SPL_BREAK_TO_DEBUGGER() SPL_ASSERT(0)
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-29-
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h-6889-#define PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x00000012
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:6890:#define PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x00400000L
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:6891:#define PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x00000016
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h-6892-#define PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x00100000L
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h-6893-#define PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0__SHIFT 0x00000014
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:6894:#define PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x00080000L
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:6895:#define PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x00000013
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h-6896-#define PCIE_LC_CNTL2__LC_DISABLE_INFERRED_ELEC_IDLE_DET_MASK 0x00010000L
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h-7093-#define PCIE_LC_LANE_CNTL__LC_LANE_DIS__SHIFT 0x00000010
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:7094:#define PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x00010000L
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:7095:#define PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x00000010
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h-7096-#define PCIE_LC_LINK_WIDTH_CNTL__LC_DUAL_END_RECONFIG_EN_MASK 0x00080000L
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h-7313-#define PCIE_LC_TRAINING_CNTL__LC_DISABLE_TRAINING_BIT_ARCH__SHIFT 0x0000000d
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:7314:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x01000000L
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:7315:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x00000018
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:7316:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x02000000L
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:7317:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x00000019
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h-7318-#define PCIE_LC_TRAINING_CNTL__LC_DONT_GO_TO_L0S_IF_L1_ARMED_MASK 0x00000800L
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h-3066-#define PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x12
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3067:#define PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x80000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3068:#define PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x13
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h-3069-#define PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x100000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h-3072-#define PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS__SHIFT 0x15
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3073:#define PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x400000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3074:#define PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h-3075-#define PCIE_LC_CNTL2__LC_WAIT_FOR_LANES_IN_LW_NEG_MASK 0x1800000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h-3236-#define PCIE_LC_TRAINING_CNTL__LC_ASPM_L1_NAK_TIMER_SEL__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3237:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x1000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3238:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x18
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3239:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x2000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3240:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x19
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h-3241-#define PCIE_LC_TRAINING_CNTL__LC_RESET_ASPM_L1_NAK_TIMER_MASK 0x4000000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h-3272-#define PCIE_LC_LINK_WIDTH_CNTL__LC_UPCFG_TIMER_SEL__SHIFT 0xf
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3273:#define PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x10000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3274:#define PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x10
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h-3275-#define PCIE_LC_LINK_WIDTH_CNTL__LC_L1_RECONFIG_EN_MASK 0x20000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-10798-#define PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x12
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:10799:#define PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x80000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:10800:#define PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x13
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-10801-#define PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x100000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-10804-#define PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS__SHIFT 0x15
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:10805:#define PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x400000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:10806:#define PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-10807-#define PCIE_LC_CNTL2__LC_WAIT_FOR_LANES_IN_LW_NEG_MASK 0x1800000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-10984-#define PCIE_LC_TRAINING_CNTL__LC_ASPM_L1_NAK_TIMER_SEL__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:10985:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x1000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:10986:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x18
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:10987:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x2000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:10988:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x19
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-10989-#define PCIE_LC_TRAINING_CNTL__LC_RESET_ASPM_L1_NAK_TIMER_MASK 0x4000000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-11020-#define PCIE_LC_LINK_WIDTH_CNTL__LC_UPCFG_TIMER_SEL__SHIFT 0xf
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11021:#define PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x10000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11022:#define PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x10
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-11023-#define PCIE_LC_LINK_WIDTH_CNTL__LC_L1_RECONFIG_EN_MASK 0x20000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-11246-#define PCIEP_HPGI_PRIVATE__PRESENCE_DETECT_STATE_PRIVATE__SHIFT 0x6
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11247:#define PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN_MASK 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11248:#define PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN__SHIFT 0x0
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11249:#define PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN_MASK 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11250:#define PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN__SHIFT 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11251:#define PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN_MASK 0x4
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11252:#define PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN__SHIFT 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11253:#define PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN_MASK 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11254:#define PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN__SHIFT 0x3
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-11255-#define PCIEP_HPGI__REG_HPGI_HOOK_MASK 0x80
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-11256-#define PCIEP_HPGI__REG_HPGI_HOOK__SHIFT 0x7
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11257:#define PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS_MASK 0x100
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11258:#define PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS__SHIFT 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11259:#define PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS_MASK 0x200
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11260:#define PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS__SHIFT 0x9
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11261:#define PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS_MASK 0x400
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11262:#define PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS__SHIFT 0xa
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11263:#define PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS_MASK 0x800
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11264:#define PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS__SHIFT 0xb
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-11265-#define PCIEP_HPGI__HPGI_REG_PRESENCE_DETECT_STATE_CHANGE_STATUS_MASK 0x8000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-4020-#define PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x12
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4021:#define PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x80000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4022:#define PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x13
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-4023-#define PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x100000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-4026-#define PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS__SHIFT 0x15
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4027:#define PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x400000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4028:#define PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-4029-#define PCIE_LC_CNTL2__LC_WAIT_FOR_LANES_IN_LW_NEG_MASK 0x1800000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-4190-#define PCIE_LC_TRAINING_CNTL__LC_ASPM_L1_NAK_TIMER_SEL__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4191:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x1000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4192:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x18
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4193:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x2000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4194:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x19
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-4195-#define PCIE_LC_TRAINING_CNTL__LC_RESET_ASPM_L1_NAK_TIMER_MASK 0x4000000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-4226-#define PCIE_LC_LINK_WIDTH_CNTL__LC_UPCFG_TIMER_SEL__SHIFT 0xf
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4227:#define PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x10000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4228:#define PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x10
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-4229-#define PCIE_LC_LINK_WIDTH_CNTL__LC_L1_RECONFIG_EN_MASK 0x20000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5110-#define D2F1_PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x12
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5111:#define D2F1_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x80000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5112:#define D2F1_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x13
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5113-#define D2F1_PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x100000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5116-#define D2F1_PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS__SHIFT 0x15
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5117:#define D2F1_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x400000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5118:#define D2F1_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5119-#define D2F1_PCIE_LC_CNTL2__LC_WAIT_FOR_LANES_IN_LW_NEG_MASK 0x1800000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5296-#define D2F1_PCIE_LC_TRAINING_CNTL__LC_ASPM_L1_NAK_TIMER_SEL__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5297:#define D2F1_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x1000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5298:#define D2F1_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x18
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5299:#define D2F1_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x2000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5300:#define D2F1_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x19
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5301-#define D2F1_PCIE_LC_TRAINING_CNTL__LC_RESET_ASPM_L1_NAK_TIMER_MASK 0x4000000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5332-#define D2F1_PCIE_LC_LINK_WIDTH_CNTL__LC_UPCFG_TIMER_SEL__SHIFT 0xf
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5333:#define D2F1_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x10000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5334:#define D2F1_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x10
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5335-#define D2F1_PCIE_LC_LINK_WIDTH_CNTL__LC_L1_RECONFIG_EN_MASK 0x20000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5558-#define D2F1_PCIEP_HPGI_PRIVATE__PRESENCE_DETECT_STATE_PRIVATE__SHIFT 0x6
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5559:#define D2F1_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN_MASK 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5560:#define D2F1_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN__SHIFT 0x0
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5561:#define D2F1_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN_MASK 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5562:#define D2F1_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN__SHIFT 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5563:#define D2F1_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN_MASK 0x4
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5564:#define D2F1_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN__SHIFT 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5565:#define D2F1_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN_MASK 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5566:#define D2F1_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN__SHIFT 0x3
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5567-#define D2F1_PCIEP_HPGI__REG_HPGI_HOOK_MASK 0x80
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5568-#define D2F1_PCIEP_HPGI__REG_HPGI_HOOK__SHIFT 0x7
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5569:#define D2F1_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS_MASK 0x100
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5570:#define D2F1_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS__SHIFT 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5571:#define D2F1_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS_MASK 0x200
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5572:#define D2F1_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS__SHIFT 0x9
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5573:#define D2F1_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS_MASK 0x400
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5574:#define D2F1_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS__SHIFT 0xa
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5575:#define D2F1_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS_MASK 0x800
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5576:#define D2F1_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS__SHIFT 0xb
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5577-#define D2F1_PCIEP_HPGI__HPGI_REG_PRESENCE_DETECT_STATE_CHANGE_STATUS_MASK 0x8000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7048-#define D2F2_PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x12
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7049:#define D2F2_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x80000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7050:#define D2F2_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x13
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7051-#define D2F2_PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x100000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7054-#define D2F2_PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS__SHIFT 0x15
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7055:#define D2F2_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x400000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7056:#define D2F2_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7057-#define D2F2_PCIE_LC_CNTL2__LC_WAIT_FOR_LANES_IN_LW_NEG_MASK 0x1800000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7234-#define D2F2_PCIE_LC_TRAINING_CNTL__LC_ASPM_L1_NAK_TIMER_SEL__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7235:#define D2F2_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x1000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7236:#define D2F2_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x18
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7237:#define D2F2_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x2000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7238:#define D2F2_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x19
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7239-#define D2F2_PCIE_LC_TRAINING_CNTL__LC_RESET_ASPM_L1_NAK_TIMER_MASK 0x4000000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7270-#define D2F2_PCIE_LC_LINK_WIDTH_CNTL__LC_UPCFG_TIMER_SEL__SHIFT 0xf
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7271:#define D2F2_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x10000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7272:#define D2F2_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x10
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7273-#define D2F2_PCIE_LC_LINK_WIDTH_CNTL__LC_L1_RECONFIG_EN_MASK 0x20000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7496-#define D2F2_PCIEP_HPGI_PRIVATE__PRESENCE_DETECT_STATE_PRIVATE__SHIFT 0x6
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7497:#define D2F2_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN_MASK 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7498:#define D2F2_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN__SHIFT 0x0
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7499:#define D2F2_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN_MASK 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7500:#define D2F2_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN__SHIFT 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7501:#define D2F2_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN_MASK 0x4
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7502:#define D2F2_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN__SHIFT 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7503:#define D2F2_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN_MASK 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7504:#define D2F2_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN__SHIFT 0x3
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7505-#define D2F2_PCIEP_HPGI__REG_HPGI_HOOK_MASK 0x80
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7506-#define D2F2_PCIEP_HPGI__REG_HPGI_HOOK__SHIFT 0x7
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7507:#define D2F2_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS_MASK 0x100
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7508:#define D2F2_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS__SHIFT 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7509:#define D2F2_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS_MASK 0x200
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7510:#define D2F2_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS__SHIFT 0x9
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7511:#define D2F2_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS_MASK 0x400
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7512:#define D2F2_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS__SHIFT 0xa
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7513:#define D2F2_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS_MASK 0x800
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7514:#define D2F2_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS__SHIFT 0xb
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7515-#define D2F2_PCIEP_HPGI__HPGI_REG_PRESENCE_DETECT_STATE_CHANGE_STATUS_MASK 0x8000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-8986-#define D2F3_PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x12
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:8987:#define D2F3_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x80000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:8988:#define D2F3_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x13
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-8989-#define D2F3_PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x100000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-8992-#define D2F3_PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS__SHIFT 0x15
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:8993:#define D2F3_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x400000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:8994:#define D2F3_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-8995-#define D2F3_PCIE_LC_CNTL2__LC_WAIT_FOR_LANES_IN_LW_NEG_MASK 0x1800000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-9172-#define D2F3_PCIE_LC_TRAINING_CNTL__LC_ASPM_L1_NAK_TIMER_SEL__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9173:#define D2F3_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x1000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9174:#define D2F3_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x18
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9175:#define D2F3_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x2000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9176:#define D2F3_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x19
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-9177-#define D2F3_PCIE_LC_TRAINING_CNTL__LC_RESET_ASPM_L1_NAK_TIMER_MASK 0x4000000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-9208-#define D2F3_PCIE_LC_LINK_WIDTH_CNTL__LC_UPCFG_TIMER_SEL__SHIFT 0xf
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9209:#define D2F3_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x10000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9210:#define D2F3_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x10
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-9211-#define D2F3_PCIE_LC_LINK_WIDTH_CNTL__LC_L1_RECONFIG_EN_MASK 0x20000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-9434-#define D2F3_PCIEP_HPGI_PRIVATE__PRESENCE_DETECT_STATE_PRIVATE__SHIFT 0x6
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9435:#define D2F3_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN_MASK 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9436:#define D2F3_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN__SHIFT 0x0
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9437:#define D2F3_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN_MASK 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9438:#define D2F3_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN__SHIFT 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9439:#define D2F3_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN_MASK 0x4
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9440:#define D2F3_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN__SHIFT 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9441:#define D2F3_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN_MASK 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9442:#define D2F3_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN__SHIFT 0x3
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-9443-#define D2F3_PCIEP_HPGI__REG_HPGI_HOOK_MASK 0x80
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-9444-#define D2F3_PCIEP_HPGI__REG_HPGI_HOOK__SHIFT 0x7
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9445:#define D2F3_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS_MASK 0x100
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9446:#define D2F3_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS__SHIFT 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9447:#define D2F3_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS_MASK 0x200
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9448:#define D2F3_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS__SHIFT 0x9
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9449:#define D2F3_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS_MASK 0x400
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9450:#define D2F3_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS__SHIFT 0xa
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9451:#define D2F3_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS_MASK 0x800
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9452:#define D2F3_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS__SHIFT 0xb
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-9453-#define D2F3_PCIEP_HPGI__HPGI_REG_PRESENCE_DETECT_STATE_CHANGE_STATUS_MASK 0x8000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-10924-#define D2F4_PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x12
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:10925:#define D2F4_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x80000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:10926:#define D2F4_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x13
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-10927-#define D2F4_PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x100000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-10930-#define D2F4_PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS__SHIFT 0x15
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:10931:#define D2F4_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x400000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:10932:#define D2F4_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-10933-#define D2F4_PCIE_LC_CNTL2__LC_WAIT_FOR_LANES_IN_LW_NEG_MASK 0x1800000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-11110-#define D2F4_PCIE_LC_TRAINING_CNTL__LC_ASPM_L1_NAK_TIMER_SEL__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11111:#define D2F4_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x1000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11112:#define D2F4_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x18
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11113:#define D2F4_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x2000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11114:#define D2F4_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x19
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-11115-#define D2F4_PCIE_LC_TRAINING_CNTL__LC_RESET_ASPM_L1_NAK_TIMER_MASK 0x4000000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-11146-#define D2F4_PCIE_LC_LINK_WIDTH_CNTL__LC_UPCFG_TIMER_SEL__SHIFT 0xf
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11147:#define D2F4_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x10000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11148:#define D2F4_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x10
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-11149-#define D2F4_PCIE_LC_LINK_WIDTH_CNTL__LC_L1_RECONFIG_EN_MASK 0x20000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-11372-#define D2F4_PCIEP_HPGI_PRIVATE__PRESENCE_DETECT_STATE_PRIVATE__SHIFT 0x6
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11373:#define D2F4_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN_MASK 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11374:#define D2F4_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN__SHIFT 0x0
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11375:#define D2F4_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN_MASK 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11376:#define D2F4_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN__SHIFT 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11377:#define D2F4_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN_MASK 0x4
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11378:#define D2F4_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN__SHIFT 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11379:#define D2F4_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN_MASK 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11380:#define D2F4_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN__SHIFT 0x3
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-11381-#define D2F4_PCIEP_HPGI__REG_HPGI_HOOK_MASK 0x80
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-11382-#define D2F4_PCIEP_HPGI__REG_HPGI_HOOK__SHIFT 0x7
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11383:#define D2F4_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS_MASK 0x100
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11384:#define D2F4_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS__SHIFT 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11385:#define D2F4_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS_MASK 0x200
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11386:#define D2F4_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS__SHIFT 0x9
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11387:#define D2F4_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS_MASK 0x400
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11388:#define D2F4_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS__SHIFT 0xa
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11389:#define D2F4_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS_MASK 0x800
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11390:#define D2F4_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS__SHIFT 0xb
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-11391-#define D2F4_PCIEP_HPGI__HPGI_REG_PRESENCE_DETECT_STATE_CHANGE_STATUS_MASK 0x8000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-12862-#define D2F5_PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x12
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:12863:#define D2F5_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x80000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:12864:#define D2F5_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x13
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-12865-#define D2F5_PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x100000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-12868-#define D2F5_PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS__SHIFT 0x15
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:12869:#define D2F5_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x400000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:12870:#define D2F5_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-12871-#define D2F5_PCIE_LC_CNTL2__LC_WAIT_FOR_LANES_IN_LW_NEG_MASK 0x1800000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-13048-#define D2F5_PCIE_LC_TRAINING_CNTL__LC_ASPM_L1_NAK_TIMER_SEL__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:13049:#define D2F5_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x1000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:13050:#define D2F5_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x18
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:13051:#define D2F5_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x2000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:13052:#define D2F5_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x19
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-13053-#define D2F5_PCIE_LC_TRAINING_CNTL__LC_RESET_ASPM_L1_NAK_TIMER_MASK 0x4000000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-13084-#define D2F5_PCIE_LC_LINK_WIDTH_CNTL__LC_UPCFG_TIMER_SEL__SHIFT 0xf
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:13085:#define D2F5_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x10000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:13086:#define D2F5_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x10
]
]
|
| 28/2 |
2026/05/13 01:16 |
llm |
expert |
0m
Model:
Tokens:
input: 46016
output: 18
thoughts: 16
Thoughts: Okay, here's my thought process summarized, geared towards an expert:
**Investigating the JFS Filesystem for Assertions**
Alright, let's get down to brass tacks. I'm thinking, "Where would a filesystem like JFS likely house its assertion code?" Given my experience, the `fs/jfs/` directory in a typical kernel source tree immediately comes to mind. That seems like the logical starting point for hunting down any `ASSERT` macros or similar debugging constructs. I'm going to kick off a `grep` search. Nothing fancy, just a quick and dirty way to scan through the code and identify potential assertion usage within that specific filesystem module. It should quickly highlight the areas where developers were incorporating checks to ensure critical assumptions hold true during runtime. This initial scan is just to gain a high-level view and narrow down the specific files or functions that warrant closer inspection.
|
| 29/2 |
2026/05/13 01:16 |
tool |
grepper |
0m
Args: map[Expression:#define.*ASSERT]
Results: map[Output:
Full output is too long, showing 500 out of 8294 lines.
Use more precise expression if possible.
[arch/alpha/include/uapi/asm/gentrap.h-20-#define GEN_ROPRAND -11 /* reserved operand */
arch/alpha/include/uapi/asm/gentrap.h:21:#define GEN_ASSERTERR -12 /* assertion error */
arch/alpha/include/uapi/asm/gentrap.h-22-#define GEN_NULPTRERR -13 /* null pointer error */
--
arch/arc/include/asm/asserts.h-7-#ifndef __ASM_ARC_ASSERTS_H
arch/arc/include/asm/asserts.h:8:#define __ASM_ARC_ASSERTS_H
arch/arc/include/asm/asserts.h-9-
--
arch/arm/include/asm/hardware/dec21285.h-64-#define SA110_CNTL_INITCMPLETE (1 << 0)
arch/arm/include/asm/hardware/dec21285.h:65:#define SA110_CNTL_ASSERTSERR (1 << 1)
arch/arm/include/asm/hardware/dec21285.h-66-#define SA110_CNTL_RXSERR (1 << 3)
--
arch/arm/include/asm/vmlinux.lds.h-77- */
arch/arm/include/asm/vmlinux.lds.h:78:#define ARM_ASSERTS \
arch/arm/include/asm/vmlinux.lds.h-79- .plt : { \
--
arch/arm/mach-mvebu/cpu-reset.c=19=static size_t cpu_reset_size;
--
arch/arm/mach-mvebu/cpu-reset.c-21-#define CPU_RESET_OFFSET(cpu) (cpu * 0x8)
arch/arm/mach-mvebu/cpu-reset.c:22:#define CPU_RESET_ASSERT BIT(0)
arch/arm/mach-mvebu/cpu-reset.c-23-
--
arch/arm64/kernel/image-vars.h-13-#if defined(CONFIG_LD_IS_LLD) && CONFIG_LLD_VERSION < 210000
arch/arm64/kernel/image-vars.h:14:#define ASSERT(...)
arch/arm64/kernel/image-vars.h-15-#endif
--
arch/loongarch/include/asm/elf.h-47-#define R_LARCH_SOP_PUSH_PLT_PCREL 29
arch/loongarch/include/asm/elf.h:48:#define R_LARCH_SOP_ASSERT 30
arch/loongarch/include/asm/elf.h-49-#define R_LARCH_SOP_NOT 31
--
arch/mips/include/asm/ip32/mace.h=181=struct mace_isactrl {
--
arch/mips/include/asm/ip32/mace.h-187-#define MACEISA_PWD_CLEAR BIT(1) /* 1=> PWD CLEAR jumper detected */
arch/mips/include/asm/ip32/mace.h:188:#define MACEISA_NIC_DEASSERT BIT(2)
arch/mips/include/asm/ip32/mace.h-189-#define MACEISA_NIC_DATA BIT(3)
--
arch/parisc/math-emu/fpudispatch.c=153=static void update_status_cbit();
--
arch/parisc/math-emu/fpudispatch.c-155-
arch/parisc/math-emu/fpudispatch.c:156:#define VASSERT(x)
arch/parisc/math-emu/fpudispatch.c-157-
--
arch/powerpc/include/asm/keylargo.h-64-#define KL_GPIO_EXTINT_CPU1 (KEYLARGO_GPIO_0+0x0a)
arch/powerpc/include/asm/keylargo.h:65:#define KL_GPIO_EXTINT_CPU1_ASSERT 0x04
arch/powerpc/include/asm/keylargo.h-66-#define KL_GPIO_EXTINT_CPU1_RELEASE 0x38
--
arch/powerpc/include/asm/ps3av.h-216-#define PS3AV_CMD_AUDIO_CTRL_RESET_NEGATE 0x0000
arch/powerpc/include/asm/ps3av.h:217:#define PS3AV_CMD_AUDIO_CTRL_RESET_ASSERT 0x0001
arch/powerpc/include/asm/ps3av.h-218-/* audio_ctrl_data[0] de-emphasis */
--
arch/powerpc/include/uapi/asm/kvm.h=433=struct kvm_ppc_cpu_char {
--
arch/powerpc/include/uapi/asm/kvm.h-691-#define KVM_XIVE_LEVEL_SENSITIVE (1ULL << 0)
arch/powerpc/include/uapi/asm/kvm.h:692:#define KVM_XIVE_LEVEL_ASSERTED (1ULL << 1)
arch/powerpc/include/uapi/asm/kvm.h-693-
--
arch/powerpc/platforms/83xx/suspend.c=42=struct mpc83xx_pmc {
--
arch/powerpc/platforms/83xx/suspend.c-64-#define PMCCR1_PME_EN 0x00000080
arch/powerpc/platforms/83xx/suspend.c:65:#define PMCCR1_ASSERT_PME 0x00000040
arch/powerpc/platforms/83xx/suspend.c-66-#define PMCCR1_POWER_OFF 0x00000020
--
arch/riscv/kernel/tests/module_test/test_module_linking_main.c=26=extern int test_uleb_large(void);
--
arch/riscv/kernel/tests/module_test/test_module_linking_main.c-28-
arch/riscv/kernel/tests/module_test/test_module_linking_main.c:29:#define CHECK_EQ(lhs, rhs) KUNIT_ASSERT_EQ(test, lhs, rhs)
arch/riscv/kernel/tests/module_test/test_module_linking_main.c-30-
--
arch/x86/include/asm/apicdef.h-85-#define APIC_INT_LEVELTRIG 0x08000
arch/x86/include/asm/apicdef.h:86:#define APIC_INT_ASSERT 0x04000
arch/x86/include/asm/apicdef.h-87-#define APIC_ICR_BUSY 0x01000
--
arch/x86/kernel/cpu/mshyperv.c=485=static void hv_reserve_irq_vectors(void)
--
arch/x86/kernel/cpu/mshyperv.c-487- #define HYPERV_DBG_FASTFAIL_VECTOR 0x29
arch/x86/kernel/cpu/mshyperv.c:488: #define HYPERV_DBG_ASSERT_VECTOR 0x2C
arch/x86/kernel/cpu/mshyperv.c-489- #define HYPERV_DBG_SERVICE_VECTOR 0x2D
--
drivers/accel/habanalabs/include/gaudi/gaudi_masks.h-295-
drivers/accel/habanalabs/include/gaudi/gaudi_masks.h:296:#define CPU_RESET_ASSERT (\
drivers/accel/habanalabs/include/gaudi/gaudi_masks.h-297- 1 << CPU_CA53_CFG_ARM_RST_CONTROL_NMBISTRESET_SHIFT)
drivers/accel/habanalabs/include/gaudi/gaudi_masks.h-298-
drivers/accel/habanalabs/include/gaudi/gaudi_masks.h:299:#define CPU_RESET_CORE0_DEASSERT (\
drivers/accel/habanalabs/include/gaudi/gaudi_masks.h-300- 1 << CPU_CA53_CFG_ARM_RST_CONTROL_NCPUPORESET_SHIFT |\
--
drivers/accel/habanalabs/include/goya/asic_reg/goya_masks.h-181-
drivers/accel/habanalabs/include/goya/asic_reg/goya_masks.h:182:#define CPU_RESET_ASSERT (\
drivers/accel/habanalabs/include/goya/asic_reg/goya_masks.h-183- 1 << CPU_CA53_CFG_ARM_RST_CONTROL_NMBISTRESET_SHIFT)
drivers/accel/habanalabs/include/goya/asic_reg/goya_masks.h-184-
drivers/accel/habanalabs/include/goya/asic_reg/goya_masks.h:185:#define CPU_RESET_CORE0_DEASSERT (\
drivers/accel/habanalabs/include/goya/asic_reg/goya_masks.h-186- 1 << CPU_CA53_CFG_ARM_RST_CONTROL_NCPUPORESET_SHIFT |\
--
drivers/atm/fore200e.c-84-#if 1
drivers/atm/fore200e.c:85:#define ASSERT(expr) if (!(expr)) { \
drivers/atm/fore200e.c-86- printk(FORE200E "assertion failed! %s[%d]: %s\n", \
--
drivers/atm/fore200e.c-90-#else
drivers/atm/fore200e.c:91:#define ASSERT(expr) do {} while (0)
drivers/atm/fore200e.c-92-#endif
--
drivers/block/drbd/drbd_polymorph_printk.h=49=void drbd_dyn_dbg_with_wrong_object_type(void);
--
drivers/block/drbd/drbd_polymorph_printk.h-120-
drivers/block/drbd/drbd_polymorph_printk.h:121:#define D_ASSERT(x, exp) \
drivers/block/drbd/drbd_polymorph_printk.h-122- do { \
--
drivers/bluetooth/btintel_pcie.c=52=struct btintel_pcie_dev_recovery {
--
drivers/bluetooth/btintel_pcie.c-77-#define BTINTEL_PCIE_TRIGGER_REASON_USER_TRIGGER 0x17A2
drivers/bluetooth/btintel_pcie.c:78:#define BTINTEL_PCIE_TRIGGER_REASON_FW_ASSERT 0x1E61
drivers/bluetooth/btintel_pcie.c-79-
--
drivers/clk/sophgo/clk-sg2044.c-23-
drivers/clk/sophgo/clk-sg2044.c:24:#define DIV_ASSERT BIT(0)
drivers/clk/sophgo/clk-sg2044.c-25-#define DIV_FACTOR_REG_SOURCE BIT(3)
--
drivers/clk/sophgo/clk-sg2044.c-27-
drivers/clk/sophgo/clk-sg2044.c:28:#define DIV_ASSERT_TIME 2
drivers/clk/sophgo/clk-sg2044.c-29-
--
drivers/comedi/drivers/adv_pci1760.c-54-#define PCI1760_INTCSR2_IRQ_STATUS BIT(6)
drivers/comedi/drivers/adv_pci1760.c:55:#define PCI1760_INTCSR2_IRQ_ASSERTED BIT(7)
drivers/comedi/drivers/adv_pci1760.c-56-
--
drivers/comedi/drivers/amcc_s5933.h-56-/* read only, interrupt asserted */
drivers/comedi/drivers/amcc_s5933.h:57:#define INTCSR_INTR_ASSERTED 0x800000
drivers/comedi/drivers/amcc_s5933.h-58-
--
drivers/comedi/drivers/amcc_s5933.h-137-
drivers/comedi/drivers/amcc_s5933.h:138:#define AINT_INT_ASSERTED 0x00800000
drivers/comedi/drivers/amcc_s5933.h-139-#define AINT_BM_ERROR 0x00200000
--
drivers/dpll/dpll_core.c=31=static u32 dpll_pin_xa_id;
drivers/dpll/dpll_core.c-32-
drivers/dpll/dpll_core.c:33:#define ASSERT_DPLL_REGISTERED(d) \
drivers/dpll/dpll_core.c-34- WARN_ON_ONCE(!xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED))
drivers/dpll/dpll_core.c:35:#define ASSERT_DPLL_NOT_REGISTERED(d) \
drivers/dpll/dpll_core.c-36- WARN_ON_ONCE(xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED))
drivers/dpll/dpll_core.c:37:#define ASSERT_DPLL_PIN_REGISTERED(p) \
drivers/dpll/dpll_core.c-38- WARN_ON_ONCE(!xa_get_mark(&dpll_pin_xa, (p)->id, DPLL_REGISTERED))
--
drivers/dpll/dpll_netlink.c-17-
drivers/dpll/dpll_netlink.c:18:#define ASSERT_NOT_NULL(ptr) (WARN_ON(!ptr))
drivers/dpll/dpll_netlink.c-19-
--
drivers/firmware/arm_scmi/reset.c=38=struct scmi_msg_reset_domain_reset {
--
drivers/firmware/arm_scmi/reset.c-41-#define AUTONOMOUS_RESET BIT(0)
drivers/firmware/arm_scmi/reset.c:42:#define EXPLICIT_RESET_ASSERT BIT(1)
drivers/firmware/arm_scmi/reset.c-43-#define ASYNCHRONOUS_RESET BIT(2)
--
drivers/gpu/drm/amd/amdgpu/sid.h-26-
drivers/gpu/drm/amd/amdgpu/sid.h:27:#define SI_MAX_CTLACKS_ASSERTION_WAIT 100
drivers/gpu/drm/amd/amdgpu/sid.h-28-
--
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_standalone_libraries/lib_float_math.c-6-
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_standalone_libraries/lib_float_math.c:7:#define ASSERT(condition)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_standalone_libraries/lib_float_math.c-8-
--
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h-8-#include "os_types.h"
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h:9:#define DML_ASSERT(condition) ASSERT(condition)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h-10-#define DML_LOG_LEVEL_DEFAULT DML_LOG_LEVEL_WARN
--
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h-104-#define DML_LOG_ERROR(fmt, ...) DML_LOG_INTERNAL("[DML ERROR] "fmt, ## __VA_ARGS__)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h:105:#define DML_ASSERT_MSG(condition, fmt, ...) \
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h-106- do { \
--
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h-114-#define DML_LOG_ERROR(fmt, ...) ((void)0)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h:115:#define DML_ASSERT_MSG(condition, fmt, ...) ((void)0)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h-116-#endif
--
drivers/gpu/drm/amd/display/dc/dml2_0/dml_assert.h-27-#ifndef __DML_ASSERT_H__
drivers/gpu/drm/amd/display/dc/dml2_0/dml_assert.h:28:#define __DML_ASSERT_H__
drivers/gpu/drm/amd/display/dc/dml2_0/dml_assert.h-29-
--
drivers/gpu/drm/amd/display/dc/os_types.h-70-
drivers/gpu/drm/amd/display/dc/os_types.h:71:#define ASSERT_CRITICAL(expr) do { \
drivers/gpu/drm/amd/display/dc/os_types.h-72- if (WARN_ON(!(expr))) \
--
drivers/gpu/drm/amd/display/dc/os_types.h-75-
drivers/gpu/drm/amd/display/dc/os_types.h:76:#define ASSERT(expr) do { \
drivers/gpu/drm/amd/display/dc/os_types.h-77- if (WARN_ON_ONCE(!(expr))) \
--
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-8-#if defined(CONFIG_HAVE_KGDB) || defined(CONFIG_KGDB)
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h:9:#define SPL_ASSERT_CRITICAL(expr) do { \
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-10- if (WARN_ON(!(expr))) { \
--
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-14-#else
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h:15:#define SPL_ASSERT_CRITICAL(expr) do { \
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-16- if (WARN_ON(!(expr))) { \
--
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-22-#if defined(CONFIG_DEBUG_KERNEL_DC)
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h:23:#define SPL_ASSERT(expr) SPL_ASSERT_CRITICAL(expr)
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-24-#else
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h:25:#define SPL_ASSERT(expr) WARN_ON(!(expr))
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-26-#endif /* CONFIG_DEBUG_KERNEL_DC */
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-27-
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h:28:#define SPL_BREAK_TO_DEBUGGER() SPL_ASSERT(0)
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-29-
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h-6889-#define PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x00000012
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:6890:#define PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x00400000L
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:6891:#define PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x00000016
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h-6892-#define PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x00100000L
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h-6893-#define PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0__SHIFT 0x00000014
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:6894:#define PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x00080000L
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:6895:#define PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x00000013
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h-6896-#define PCIE_LC_CNTL2__LC_DISABLE_INFERRED_ELEC_IDLE_DET_MASK 0x00010000L
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h-7093-#define PCIE_LC_LANE_CNTL__LC_LANE_DIS__SHIFT 0x00000010
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:7094:#define PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x00010000L
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:7095:#define PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x00000010
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h-7096-#define PCIE_LC_LINK_WIDTH_CNTL__LC_DUAL_END_RECONFIG_EN_MASK 0x00080000L
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h-7313-#define PCIE_LC_TRAINING_CNTL__LC_DISABLE_TRAINING_BIT_ARCH__SHIFT 0x0000000d
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:7314:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x01000000L
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:7315:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x00000018
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:7316:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x02000000L
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:7317:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x00000019
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h-7318-#define PCIE_LC_TRAINING_CNTL__LC_DONT_GO_TO_L0S_IF_L1_ARMED_MASK 0x00000800L
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h-3066-#define PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x12
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3067:#define PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x80000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3068:#define PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x13
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h-3069-#define PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x100000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h-3072-#define PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS__SHIFT 0x15
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3073:#define PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x400000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3074:#define PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h-3075-#define PCIE_LC_CNTL2__LC_WAIT_FOR_LANES_IN_LW_NEG_MASK 0x1800000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h-3236-#define PCIE_LC_TRAINING_CNTL__LC_ASPM_L1_NAK_TIMER_SEL__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3237:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x1000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3238:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x18
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3239:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x2000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3240:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x19
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h-3241-#define PCIE_LC_TRAINING_CNTL__LC_RESET_ASPM_L1_NAK_TIMER_MASK 0x4000000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h-3272-#define PCIE_LC_LINK_WIDTH_CNTL__LC_UPCFG_TIMER_SEL__SHIFT 0xf
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3273:#define PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x10000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3274:#define PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x10
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h-3275-#define PCIE_LC_LINK_WIDTH_CNTL__LC_L1_RECONFIG_EN_MASK 0x20000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-10798-#define PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x12
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:10799:#define PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x80000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:10800:#define PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x13
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-10801-#define PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x100000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-10804-#define PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS__SHIFT 0x15
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:10805:#define PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x400000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:10806:#define PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-10807-#define PCIE_LC_CNTL2__LC_WAIT_FOR_LANES_IN_LW_NEG_MASK 0x1800000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-10984-#define PCIE_LC_TRAINING_CNTL__LC_ASPM_L1_NAK_TIMER_SEL__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:10985:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x1000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:10986:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x18
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:10987:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x2000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:10988:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x19
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-10989-#define PCIE_LC_TRAINING_CNTL__LC_RESET_ASPM_L1_NAK_TIMER_MASK 0x4000000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-11020-#define PCIE_LC_LINK_WIDTH_CNTL__LC_UPCFG_TIMER_SEL__SHIFT 0xf
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11021:#define PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x10000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11022:#define PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x10
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-11023-#define PCIE_LC_LINK_WIDTH_CNTL__LC_L1_RECONFIG_EN_MASK 0x20000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-11246-#define PCIEP_HPGI_PRIVATE__PRESENCE_DETECT_STATE_PRIVATE__SHIFT 0x6
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11247:#define PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN_MASK 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11248:#define PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN__SHIFT 0x0
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11249:#define PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN_MASK 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11250:#define PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN__SHIFT 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11251:#define PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN_MASK 0x4
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11252:#define PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN__SHIFT 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11253:#define PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN_MASK 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11254:#define PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN__SHIFT 0x3
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-11255-#define PCIEP_HPGI__REG_HPGI_HOOK_MASK 0x80
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-11256-#define PCIEP_HPGI__REG_HPGI_HOOK__SHIFT 0x7
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11257:#define PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS_MASK 0x100
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11258:#define PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS__SHIFT 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11259:#define PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS_MASK 0x200
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11260:#define PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS__SHIFT 0x9
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11261:#define PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS_MASK 0x400
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11262:#define PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS__SHIFT 0xa
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11263:#define PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS_MASK 0x800
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11264:#define PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS__SHIFT 0xb
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-11265-#define PCIEP_HPGI__HPGI_REG_PRESENCE_DETECT_STATE_CHANGE_STATUS_MASK 0x8000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-4020-#define PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x12
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4021:#define PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x80000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4022:#define PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x13
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-4023-#define PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x100000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-4026-#define PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS__SHIFT 0x15
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4027:#define PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x400000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4028:#define PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-4029-#define PCIE_LC_CNTL2__LC_WAIT_FOR_LANES_IN_LW_NEG_MASK 0x1800000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-4190-#define PCIE_LC_TRAINING_CNTL__LC_ASPM_L1_NAK_TIMER_SEL__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4191:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x1000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4192:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x18
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4193:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x2000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4194:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x19
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-4195-#define PCIE_LC_TRAINING_CNTL__LC_RESET_ASPM_L1_NAK_TIMER_MASK 0x4000000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-4226-#define PCIE_LC_LINK_WIDTH_CNTL__LC_UPCFG_TIMER_SEL__SHIFT 0xf
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4227:#define PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x10000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4228:#define PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x10
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-4229-#define PCIE_LC_LINK_WIDTH_CNTL__LC_L1_RECONFIG_EN_MASK 0x20000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5110-#define D2F1_PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x12
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5111:#define D2F1_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x80000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5112:#define D2F1_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x13
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5113-#define D2F1_PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x100000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5116-#define D2F1_PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS__SHIFT 0x15
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5117:#define D2F1_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x400000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5118:#define D2F1_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5119-#define D2F1_PCIE_LC_CNTL2__LC_WAIT_FOR_LANES_IN_LW_NEG_MASK 0x1800000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5296-#define D2F1_PCIE_LC_TRAINING_CNTL__LC_ASPM_L1_NAK_TIMER_SEL__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5297:#define D2F1_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x1000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5298:#define D2F1_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x18
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5299:#define D2F1_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x2000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5300:#define D2F1_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x19
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5301-#define D2F1_PCIE_LC_TRAINING_CNTL__LC_RESET_ASPM_L1_NAK_TIMER_MASK 0x4000000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5332-#define D2F1_PCIE_LC_LINK_WIDTH_CNTL__LC_UPCFG_TIMER_SEL__SHIFT 0xf
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5333:#define D2F1_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x10000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5334:#define D2F1_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x10
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5335-#define D2F1_PCIE_LC_LINK_WIDTH_CNTL__LC_L1_RECONFIG_EN_MASK 0x20000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5558-#define D2F1_PCIEP_HPGI_PRIVATE__PRESENCE_DETECT_STATE_PRIVATE__SHIFT 0x6
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5559:#define D2F1_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN_MASK 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5560:#define D2F1_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN__SHIFT 0x0
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5561:#define D2F1_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN_MASK 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5562:#define D2F1_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN__SHIFT 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5563:#define D2F1_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN_MASK 0x4
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5564:#define D2F1_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN__SHIFT 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5565:#define D2F1_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN_MASK 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5566:#define D2F1_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN__SHIFT 0x3
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5567-#define D2F1_PCIEP_HPGI__REG_HPGI_HOOK_MASK 0x80
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5568-#define D2F1_PCIEP_HPGI__REG_HPGI_HOOK__SHIFT 0x7
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5569:#define D2F1_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS_MASK 0x100
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5570:#define D2F1_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS__SHIFT 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5571:#define D2F1_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS_MASK 0x200
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5572:#define D2F1_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS__SHIFT 0x9
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5573:#define D2F1_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS_MASK 0x400
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5574:#define D2F1_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS__SHIFT 0xa
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5575:#define D2F1_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS_MASK 0x800
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5576:#define D2F1_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS__SHIFT 0xb
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5577-#define D2F1_PCIEP_HPGI__HPGI_REG_PRESENCE_DETECT_STATE_CHANGE_STATUS_MASK 0x8000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7048-#define D2F2_PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x12
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7049:#define D2F2_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x80000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7050:#define D2F2_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x13
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7051-#define D2F2_PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x100000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7054-#define D2F2_PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS__SHIFT 0x15
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7055:#define D2F2_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x400000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7056:#define D2F2_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7057-#define D2F2_PCIE_LC_CNTL2__LC_WAIT_FOR_LANES_IN_LW_NEG_MASK 0x1800000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7234-#define D2F2_PCIE_LC_TRAINING_CNTL__LC_ASPM_L1_NAK_TIMER_SEL__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7235:#define D2F2_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x1000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7236:#define D2F2_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x18
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7237:#define D2F2_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x2000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7238:#define D2F2_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x19
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7239-#define D2F2_PCIE_LC_TRAINING_CNTL__LC_RESET_ASPM_L1_NAK_TIMER_MASK 0x4000000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7270-#define D2F2_PCIE_LC_LINK_WIDTH_CNTL__LC_UPCFG_TIMER_SEL__SHIFT 0xf
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7271:#define D2F2_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x10000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7272:#define D2F2_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x10
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7273-#define D2F2_PCIE_LC_LINK_WIDTH_CNTL__LC_L1_RECONFIG_EN_MASK 0x20000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7496-#define D2F2_PCIEP_HPGI_PRIVATE__PRESENCE_DETECT_STATE_PRIVATE__SHIFT 0x6
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7497:#define D2F2_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN_MASK 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7498:#define D2F2_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN__SHIFT 0x0
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7499:#define D2F2_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN_MASK 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7500:#define D2F2_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN__SHIFT 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7501:#define D2F2_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN_MASK 0x4
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7502:#define D2F2_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN__SHIFT 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7503:#define D2F2_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN_MASK 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7504:#define D2F2_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN__SHIFT 0x3
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7505-#define D2F2_PCIEP_HPGI__REG_HPGI_HOOK_MASK 0x80
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7506-#define D2F2_PCIEP_HPGI__REG_HPGI_HOOK__SHIFT 0x7
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7507:#define D2F2_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS_MASK 0x100
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7508:#define D2F2_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS__SHIFT 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7509:#define D2F2_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS_MASK 0x200
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7510:#define D2F2_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS__SHIFT 0x9
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7511:#define D2F2_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS_MASK 0x400
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7512:#define D2F2_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS__SHIFT 0xa
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7513:#define D2F2_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS_MASK 0x800
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7514:#define D2F2_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS__SHIFT 0xb
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7515-#define D2F2_PCIEP_HPGI__HPGI_REG_PRESENCE_DETECT_STATE_CHANGE_STATUS_MASK 0x8000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-8986-#define D2F3_PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x12
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:8987:#define D2F3_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x80000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:8988:#define D2F3_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x13
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-8989-#define D2F3_PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x100000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-8992-#define D2F3_PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS__SHIFT 0x15
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:8993:#define D2F3_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x400000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:8994:#define D2F3_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-8995-#define D2F3_PCIE_LC_CNTL2__LC_WAIT_FOR_LANES_IN_LW_NEG_MASK 0x1800000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-9172-#define D2F3_PCIE_LC_TRAINING_CNTL__LC_ASPM_L1_NAK_TIMER_SEL__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9173:#define D2F3_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x1000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9174:#define D2F3_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x18
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9175:#define D2F3_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x2000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9176:#define D2F3_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x19
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-9177-#define D2F3_PCIE_LC_TRAINING_CNTL__LC_RESET_ASPM_L1_NAK_TIMER_MASK 0x4000000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-9208-#define D2F3_PCIE_LC_LINK_WIDTH_CNTL__LC_UPCFG_TIMER_SEL__SHIFT 0xf
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9209:#define D2F3_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x10000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9210:#define D2F3_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x10
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-9211-#define D2F3_PCIE_LC_LINK_WIDTH_CNTL__LC_L1_RECONFIG_EN_MASK 0x20000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-9434-#define D2F3_PCIEP_HPGI_PRIVATE__PRESENCE_DETECT_STATE_PRIVATE__SHIFT 0x6
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9435:#define D2F3_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN_MASK 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9436:#define D2F3_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN__SHIFT 0x0
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9437:#define D2F3_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN_MASK 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9438:#define D2F3_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN__SHIFT 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9439:#define D2F3_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN_MASK 0x4
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9440:#define D2F3_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN__SHIFT 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9441:#define D2F3_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN_MASK 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9442:#define D2F3_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN__SHIFT 0x3
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-9443-#define D2F3_PCIEP_HPGI__REG_HPGI_HOOK_MASK 0x80
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-9444-#define D2F3_PCIEP_HPGI__REG_HPGI_HOOK__SHIFT 0x7
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9445:#define D2F3_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS_MASK 0x100
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9446:#define D2F3_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS__SHIFT 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9447:#define D2F3_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS_MASK 0x200
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9448:#define D2F3_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS__SHIFT 0x9
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9449:#define D2F3_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS_MASK 0x400
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9450:#define D2F3_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS__SHIFT 0xa
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9451:#define D2F3_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS_MASK 0x800
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9452:#define D2F3_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS__SHIFT 0xb
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-9453-#define D2F3_PCIEP_HPGI__HPGI_REG_PRESENCE_DETECT_STATE_CHANGE_STATUS_MASK 0x8000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-10924-#define D2F4_PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x12
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:10925:#define D2F4_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x80000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:10926:#define D2F4_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x13
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-10927-#define D2F4_PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x100000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-10930-#define D2F4_PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS__SHIFT 0x15
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:10931:#define D2F4_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x400000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:10932:#define D2F4_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-10933-#define D2F4_PCIE_LC_CNTL2__LC_WAIT_FOR_LANES_IN_LW_NEG_MASK 0x1800000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-11110-#define D2F4_PCIE_LC_TRAINING_CNTL__LC_ASPM_L1_NAK_TIMER_SEL__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11111:#define D2F4_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x1000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11112:#define D2F4_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x18
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11113:#define D2F4_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x2000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11114:#define D2F4_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x19
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-11115-#define D2F4_PCIE_LC_TRAINING_CNTL__LC_RESET_ASPM_L1_NAK_TIMER_MASK 0x4000000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-11146-#define D2F4_PCIE_LC_LINK_WIDTH_CNTL__LC_UPCFG_TIMER_SEL__SHIFT 0xf
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11147:#define D2F4_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x10000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11148:#define D2F4_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x10
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-11149-#define D2F4_PCIE_LC_LINK_WIDTH_CNTL__LC_L1_RECONFIG_EN_MASK 0x20000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-11372-#define D2F4_PCIEP_HPGI_PRIVATE__PRESENCE_DETECT_STATE_PRIVATE__SHIFT 0x6
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11373:#define D2F4_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN_MASK 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11374:#define D2F4_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN__SHIFT 0x0
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11375:#define D2F4_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN_MASK 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11376:#define D2F4_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN__SHIFT 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11377:#define D2F4_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN_MASK 0x4
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11378:#define D2F4_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN__SHIFT 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11379:#define D2F4_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN_MASK 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11380:#define D2F4_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN__SHIFT 0x3
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-11381-#define D2F4_PCIEP_HPGI__REG_HPGI_HOOK_MASK 0x80
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-11382-#define D2F4_PCIEP_HPGI__REG_HPGI_HOOK__SHIFT 0x7
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11383:#define D2F4_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS_MASK 0x100
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11384:#define D2F4_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS__SHIFT 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11385:#define D2F4_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS_MASK 0x200
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11386:#define D2F4_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS__SHIFT 0x9
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11387:#define D2F4_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS_MASK 0x400
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11388:#define D2F4_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS__SHIFT 0xa
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11389:#define D2F4_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS_MASK 0x800
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11390:#define D2F4_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS__SHIFT 0xb
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-11391-#define D2F4_PCIEP_HPGI__HPGI_REG_PRESENCE_DETECT_STATE_CHANGE_STATUS_MASK 0x8000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-12862-#define D2F5_PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x12
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:12863:#define D2F5_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x80000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:12864:#define D2F5_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x13
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-12865-#define D2F5_PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x100000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-12868-#define D2F5_PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS__SHIFT 0x15
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:12869:#define D2F5_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x400000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:12870:#define D2F5_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-12871-#define D2F5_PCIE_LC_CNTL2__LC_WAIT_FOR_LANES_IN_LW_NEG_MASK 0x1800000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-13048-#define D2F5_PCIE_LC_TRAINING_CNTL__LC_ASPM_L1_NAK_TIMER_SEL__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:13049:#define D2F5_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x1000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:13050:#define D2F5_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x18
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:13051:#define D2F5_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x2000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:13052:#define D2F5_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x19
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-13053-#define D2F5_PCIE_LC_TRAINING_CNTL__LC_RESET_ASPM_L1_NAK_TIMER_MASK 0x4000000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-13084-#define D2F5_PCIE_LC_LINK_WIDTH_CNTL__LC_UPCFG_TIMER_SEL__SHIFT 0xf
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:13085:#define D2F5_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x10000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:13086:#define D2F5_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x10
]
]
|
| 30/2 |
2026/05/13 01:16 |
llm |
expert |
0m
Model:
Tokens:
input: 69983
output: 23
thoughts: 16
Thoughts: Okay, here's my thought process summarized, geared towards an expert:
**Investigating the JFS Filesystem for Assertions**
Alright, let's get down to brass tacks. I'm thinking, "Where would a filesystem like JFS likely house its assertion code?" Given my experience, the `fs/jfs/` directory in a typical kernel source tree immediately comes to mind. That seems like the logical starting point for hunting down any `ASSERT` macros or similar debugging constructs. I'm going to kick off a `grep` search. Nothing fancy, just a quick and dirty way to scan through the code and identify potential assertion usage within that specific filesystem module. It should quickly highlight the areas where developers were incorporating checks to ensure critical assumptions hold true during runtime. This initial scan is just to gain a high-level view and narrow down the specific files or functions that warrant closer inspection.
|
| 31/2 |
2026/05/13 01:16 |
tool |
grepper |
0m
Error:
Args: map[Expression:#define.*ASSERT.*fs/jfs]
Results:
|
| 32/2 |
2026/05/13 01:16 |
llm |
expert |
0m
Model:
Tokens:
input: 70224
output: 18
thoughts: 11
Thoughts: Okay, here's the summary, assuming I'm a seasoned developer familiar with Git and code searching:
**My Immediate Thought Process**
Alright, time to hunt down that specific instance ofβ¦ whatever it is I'm looking for. Let's see... a simple `grep` probably won't cut it, I need something more robust, something that understands the codebase better. Ah, yes! `git grep`. That's the ticket. It'll traverse the Git history and actually be aware of the repository's structure, which is vital. Using `git grep` will allow me to narrow down the search quickly, avoiding false positives from potentially irrelevant files or old versions. Thatβs a good starting point.
|
| 33/2 |
2026/05/13 01:16 |
tool |
grepper |
0m
Args: map[Expression:#define.*ASSERT]
Results: map[Output:
Full output is too long, showing 500 out of 8294 lines.
Use more precise expression if possible.
[arch/alpha/include/uapi/asm/gentrap.h-20-#define GEN_ROPRAND -11 /* reserved operand */
arch/alpha/include/uapi/asm/gentrap.h:21:#define GEN_ASSERTERR -12 /* assertion error */
arch/alpha/include/uapi/asm/gentrap.h-22-#define GEN_NULPTRERR -13 /* null pointer error */
--
arch/arc/include/asm/asserts.h-7-#ifndef __ASM_ARC_ASSERTS_H
arch/arc/include/asm/asserts.h:8:#define __ASM_ARC_ASSERTS_H
arch/arc/include/asm/asserts.h-9-
--
arch/arm/include/asm/hardware/dec21285.h-64-#define SA110_CNTL_INITCMPLETE (1 << 0)
arch/arm/include/asm/hardware/dec21285.h:65:#define SA110_CNTL_ASSERTSERR (1 << 1)
arch/arm/include/asm/hardware/dec21285.h-66-#define SA110_CNTL_RXSERR (1 << 3)
--
arch/arm/include/asm/vmlinux.lds.h-77- */
arch/arm/include/asm/vmlinux.lds.h:78:#define ARM_ASSERTS \
arch/arm/include/asm/vmlinux.lds.h-79- .plt : { \
--
arch/arm/mach-mvebu/cpu-reset.c=19=static size_t cpu_reset_size;
--
arch/arm/mach-mvebu/cpu-reset.c-21-#define CPU_RESET_OFFSET(cpu) (cpu * 0x8)
arch/arm/mach-mvebu/cpu-reset.c:22:#define CPU_RESET_ASSERT BIT(0)
arch/arm/mach-mvebu/cpu-reset.c-23-
--
arch/arm64/kernel/image-vars.h-13-#if defined(CONFIG_LD_IS_LLD) && CONFIG_LLD_VERSION < 210000
arch/arm64/kernel/image-vars.h:14:#define ASSERT(...)
arch/arm64/kernel/image-vars.h-15-#endif
--
arch/loongarch/include/asm/elf.h-47-#define R_LARCH_SOP_PUSH_PLT_PCREL 29
arch/loongarch/include/asm/elf.h:48:#define R_LARCH_SOP_ASSERT 30
arch/loongarch/include/asm/elf.h-49-#define R_LARCH_SOP_NOT 31
--
arch/mips/include/asm/ip32/mace.h=181=struct mace_isactrl {
--
arch/mips/include/asm/ip32/mace.h-187-#define MACEISA_PWD_CLEAR BIT(1) /* 1=> PWD CLEAR jumper detected */
arch/mips/include/asm/ip32/mace.h:188:#define MACEISA_NIC_DEASSERT BIT(2)
arch/mips/include/asm/ip32/mace.h-189-#define MACEISA_NIC_DATA BIT(3)
--
arch/parisc/math-emu/fpudispatch.c=153=static void update_status_cbit();
--
arch/parisc/math-emu/fpudispatch.c-155-
arch/parisc/math-emu/fpudispatch.c:156:#define VASSERT(x)
arch/parisc/math-emu/fpudispatch.c-157-
--
arch/powerpc/include/asm/keylargo.h-64-#define KL_GPIO_EXTINT_CPU1 (KEYLARGO_GPIO_0+0x0a)
arch/powerpc/include/asm/keylargo.h:65:#define KL_GPIO_EXTINT_CPU1_ASSERT 0x04
arch/powerpc/include/asm/keylargo.h-66-#define KL_GPIO_EXTINT_CPU1_RELEASE 0x38
--
arch/powerpc/include/asm/ps3av.h-216-#define PS3AV_CMD_AUDIO_CTRL_RESET_NEGATE 0x0000
arch/powerpc/include/asm/ps3av.h:217:#define PS3AV_CMD_AUDIO_CTRL_RESET_ASSERT 0x0001
arch/powerpc/include/asm/ps3av.h-218-/* audio_ctrl_data[0] de-emphasis */
--
arch/powerpc/include/uapi/asm/kvm.h=433=struct kvm_ppc_cpu_char {
--
arch/powerpc/include/uapi/asm/kvm.h-691-#define KVM_XIVE_LEVEL_SENSITIVE (1ULL << 0)
arch/powerpc/include/uapi/asm/kvm.h:692:#define KVM_XIVE_LEVEL_ASSERTED (1ULL << 1)
arch/powerpc/include/uapi/asm/kvm.h-693-
--
arch/powerpc/platforms/83xx/suspend.c=42=struct mpc83xx_pmc {
--
arch/powerpc/platforms/83xx/suspend.c-64-#define PMCCR1_PME_EN 0x00000080
arch/powerpc/platforms/83xx/suspend.c:65:#define PMCCR1_ASSERT_PME 0x00000040
arch/powerpc/platforms/83xx/suspend.c-66-#define PMCCR1_POWER_OFF 0x00000020
--
arch/riscv/kernel/tests/module_test/test_module_linking_main.c=26=extern int test_uleb_large(void);
--
arch/riscv/kernel/tests/module_test/test_module_linking_main.c-28-
arch/riscv/kernel/tests/module_test/test_module_linking_main.c:29:#define CHECK_EQ(lhs, rhs) KUNIT_ASSERT_EQ(test, lhs, rhs)
arch/riscv/kernel/tests/module_test/test_module_linking_main.c-30-
--
arch/x86/include/asm/apicdef.h-85-#define APIC_INT_LEVELTRIG 0x08000
arch/x86/include/asm/apicdef.h:86:#define APIC_INT_ASSERT 0x04000
arch/x86/include/asm/apicdef.h-87-#define APIC_ICR_BUSY 0x01000
--
arch/x86/kernel/cpu/mshyperv.c=485=static void hv_reserve_irq_vectors(void)
--
arch/x86/kernel/cpu/mshyperv.c-487- #define HYPERV_DBG_FASTFAIL_VECTOR 0x29
arch/x86/kernel/cpu/mshyperv.c:488: #define HYPERV_DBG_ASSERT_VECTOR 0x2C
arch/x86/kernel/cpu/mshyperv.c-489- #define HYPERV_DBG_SERVICE_VECTOR 0x2D
--
drivers/accel/habanalabs/include/gaudi/gaudi_masks.h-295-
drivers/accel/habanalabs/include/gaudi/gaudi_masks.h:296:#define CPU_RESET_ASSERT (\
drivers/accel/habanalabs/include/gaudi/gaudi_masks.h-297- 1 << CPU_CA53_CFG_ARM_RST_CONTROL_NMBISTRESET_SHIFT)
drivers/accel/habanalabs/include/gaudi/gaudi_masks.h-298-
drivers/accel/habanalabs/include/gaudi/gaudi_masks.h:299:#define CPU_RESET_CORE0_DEASSERT (\
drivers/accel/habanalabs/include/gaudi/gaudi_masks.h-300- 1 << CPU_CA53_CFG_ARM_RST_CONTROL_NCPUPORESET_SHIFT |\
--
drivers/accel/habanalabs/include/goya/asic_reg/goya_masks.h-181-
drivers/accel/habanalabs/include/goya/asic_reg/goya_masks.h:182:#define CPU_RESET_ASSERT (\
drivers/accel/habanalabs/include/goya/asic_reg/goya_masks.h-183- 1 << CPU_CA53_CFG_ARM_RST_CONTROL_NMBISTRESET_SHIFT)
drivers/accel/habanalabs/include/goya/asic_reg/goya_masks.h-184-
drivers/accel/habanalabs/include/goya/asic_reg/goya_masks.h:185:#define CPU_RESET_CORE0_DEASSERT (\
drivers/accel/habanalabs/include/goya/asic_reg/goya_masks.h-186- 1 << CPU_CA53_CFG_ARM_RST_CONTROL_NCPUPORESET_SHIFT |\
--
drivers/atm/fore200e.c-84-#if 1
drivers/atm/fore200e.c:85:#define ASSERT(expr) if (!(expr)) { \
drivers/atm/fore200e.c-86- printk(FORE200E "assertion failed! %s[%d]: %s\n", \
--
drivers/atm/fore200e.c-90-#else
drivers/atm/fore200e.c:91:#define ASSERT(expr) do {} while (0)
drivers/atm/fore200e.c-92-#endif
--
drivers/block/drbd/drbd_polymorph_printk.h=49=void drbd_dyn_dbg_with_wrong_object_type(void);
--
drivers/block/drbd/drbd_polymorph_printk.h-120-
drivers/block/drbd/drbd_polymorph_printk.h:121:#define D_ASSERT(x, exp) \
drivers/block/drbd/drbd_polymorph_printk.h-122- do { \
--
drivers/bluetooth/btintel_pcie.c=52=struct btintel_pcie_dev_recovery {
--
drivers/bluetooth/btintel_pcie.c-77-#define BTINTEL_PCIE_TRIGGER_REASON_USER_TRIGGER 0x17A2
drivers/bluetooth/btintel_pcie.c:78:#define BTINTEL_PCIE_TRIGGER_REASON_FW_ASSERT 0x1E61
drivers/bluetooth/btintel_pcie.c-79-
--
drivers/clk/sophgo/clk-sg2044.c-23-
drivers/clk/sophgo/clk-sg2044.c:24:#define DIV_ASSERT BIT(0)
drivers/clk/sophgo/clk-sg2044.c-25-#define DIV_FACTOR_REG_SOURCE BIT(3)
--
drivers/clk/sophgo/clk-sg2044.c-27-
drivers/clk/sophgo/clk-sg2044.c:28:#define DIV_ASSERT_TIME 2
drivers/clk/sophgo/clk-sg2044.c-29-
--
drivers/comedi/drivers/adv_pci1760.c-54-#define PCI1760_INTCSR2_IRQ_STATUS BIT(6)
drivers/comedi/drivers/adv_pci1760.c:55:#define PCI1760_INTCSR2_IRQ_ASSERTED BIT(7)
drivers/comedi/drivers/adv_pci1760.c-56-
--
drivers/comedi/drivers/amcc_s5933.h-56-/* read only, interrupt asserted */
drivers/comedi/drivers/amcc_s5933.h:57:#define INTCSR_INTR_ASSERTED 0x800000
drivers/comedi/drivers/amcc_s5933.h-58-
--
drivers/comedi/drivers/amcc_s5933.h-137-
drivers/comedi/drivers/amcc_s5933.h:138:#define AINT_INT_ASSERTED 0x00800000
drivers/comedi/drivers/amcc_s5933.h-139-#define AINT_BM_ERROR 0x00200000
--
drivers/dpll/dpll_core.c=31=static u32 dpll_pin_xa_id;
drivers/dpll/dpll_core.c-32-
drivers/dpll/dpll_core.c:33:#define ASSERT_DPLL_REGISTERED(d) \
drivers/dpll/dpll_core.c-34- WARN_ON_ONCE(!xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED))
drivers/dpll/dpll_core.c:35:#define ASSERT_DPLL_NOT_REGISTERED(d) \
drivers/dpll/dpll_core.c-36- WARN_ON_ONCE(xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED))
drivers/dpll/dpll_core.c:37:#define ASSERT_DPLL_PIN_REGISTERED(p) \
drivers/dpll/dpll_core.c-38- WARN_ON_ONCE(!xa_get_mark(&dpll_pin_xa, (p)->id, DPLL_REGISTERED))
--
drivers/dpll/dpll_netlink.c-17-
drivers/dpll/dpll_netlink.c:18:#define ASSERT_NOT_NULL(ptr) (WARN_ON(!ptr))
drivers/dpll/dpll_netlink.c-19-
--
drivers/firmware/arm_scmi/reset.c=38=struct scmi_msg_reset_domain_reset {
--
drivers/firmware/arm_scmi/reset.c-41-#define AUTONOMOUS_RESET BIT(0)
drivers/firmware/arm_scmi/reset.c:42:#define EXPLICIT_RESET_ASSERT BIT(1)
drivers/firmware/arm_scmi/reset.c-43-#define ASYNCHRONOUS_RESET BIT(2)
--
drivers/gpu/drm/amd/amdgpu/sid.h-26-
drivers/gpu/drm/amd/amdgpu/sid.h:27:#define SI_MAX_CTLACKS_ASSERTION_WAIT 100
drivers/gpu/drm/amd/amdgpu/sid.h-28-
--
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_standalone_libraries/lib_float_math.c-6-
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_standalone_libraries/lib_float_math.c:7:#define ASSERT(condition)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_standalone_libraries/lib_float_math.c-8-
--
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h-8-#include "os_types.h"
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h:9:#define DML_ASSERT(condition) ASSERT(condition)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h-10-#define DML_LOG_LEVEL_DEFAULT DML_LOG_LEVEL_WARN
--
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h-104-#define DML_LOG_ERROR(fmt, ...) DML_LOG_INTERNAL("[DML ERROR] "fmt, ## __VA_ARGS__)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h:105:#define DML_ASSERT_MSG(condition, fmt, ...) \
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h-106- do { \
--
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h-114-#define DML_LOG_ERROR(fmt, ...) ((void)0)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h:115:#define DML_ASSERT_MSG(condition, fmt, ...) ((void)0)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_debug.h-116-#endif
--
drivers/gpu/drm/amd/display/dc/dml2_0/dml_assert.h-27-#ifndef __DML_ASSERT_H__
drivers/gpu/drm/amd/display/dc/dml2_0/dml_assert.h:28:#define __DML_ASSERT_H__
drivers/gpu/drm/amd/display/dc/dml2_0/dml_assert.h-29-
--
drivers/gpu/drm/amd/display/dc/os_types.h-70-
drivers/gpu/drm/amd/display/dc/os_types.h:71:#define ASSERT_CRITICAL(expr) do { \
drivers/gpu/drm/amd/display/dc/os_types.h-72- if (WARN_ON(!(expr))) \
--
drivers/gpu/drm/amd/display/dc/os_types.h-75-
drivers/gpu/drm/amd/display/dc/os_types.h:76:#define ASSERT(expr) do { \
drivers/gpu/drm/amd/display/dc/os_types.h-77- if (WARN_ON_ONCE(!(expr))) \
--
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-8-#if defined(CONFIG_HAVE_KGDB) || defined(CONFIG_KGDB)
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h:9:#define SPL_ASSERT_CRITICAL(expr) do { \
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-10- if (WARN_ON(!(expr))) { \
--
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-14-#else
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h:15:#define SPL_ASSERT_CRITICAL(expr) do { \
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-16- if (WARN_ON(!(expr))) { \
--
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-22-#if defined(CONFIG_DEBUG_KERNEL_DC)
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h:23:#define SPL_ASSERT(expr) SPL_ASSERT_CRITICAL(expr)
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-24-#else
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h:25:#define SPL_ASSERT(expr) WARN_ON(!(expr))
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-26-#endif /* CONFIG_DEBUG_KERNEL_DC */
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-27-
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h:28:#define SPL_BREAK_TO_DEBUGGER() SPL_ASSERT(0)
drivers/gpu/drm/amd/display/dc/sspl/spl_debug.h-29-
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h-6889-#define PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x00000012
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:6890:#define PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x00400000L
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:6891:#define PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x00000016
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h-6892-#define PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x00100000L
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h-6893-#define PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0__SHIFT 0x00000014
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:6894:#define PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x00080000L
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:6895:#define PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x00000013
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h-6896-#define PCIE_LC_CNTL2__LC_DISABLE_INFERRED_ELEC_IDLE_DET_MASK 0x00010000L
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h-7093-#define PCIE_LC_LANE_CNTL__LC_LANE_DIS__SHIFT 0x00000010
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:7094:#define PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x00010000L
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:7095:#define PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x00000010
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h-7096-#define PCIE_LC_LINK_WIDTH_CNTL__LC_DUAL_END_RECONFIG_EN_MASK 0x00080000L
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h-7313-#define PCIE_LC_TRAINING_CNTL__LC_DISABLE_TRAINING_BIT_ARCH__SHIFT 0x0000000d
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:7314:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x01000000L
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:7315:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x00000018
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:7316:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x02000000L
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h:7317:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x00000019
drivers/gpu/drm/amd/include/asic_reg/bif/bif_3_0_sh_mask.h-7318-#define PCIE_LC_TRAINING_CNTL__LC_DONT_GO_TO_L0S_IF_L1_ARMED_MASK 0x00000800L
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h-3066-#define PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x12
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3067:#define PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x80000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3068:#define PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x13
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h-3069-#define PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x100000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h-3072-#define PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS__SHIFT 0x15
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3073:#define PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x400000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3074:#define PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h-3075-#define PCIE_LC_CNTL2__LC_WAIT_FOR_LANES_IN_LW_NEG_MASK 0x1800000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h-3236-#define PCIE_LC_TRAINING_CNTL__LC_ASPM_L1_NAK_TIMER_SEL__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3237:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x1000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3238:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x18
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3239:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x2000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3240:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x19
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h-3241-#define PCIE_LC_TRAINING_CNTL__LC_RESET_ASPM_L1_NAK_TIMER_MASK 0x4000000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h-3272-#define PCIE_LC_LINK_WIDTH_CNTL__LC_UPCFG_TIMER_SEL__SHIFT 0xf
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3273:#define PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x10000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h:3274:#define PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x10
drivers/gpu/drm/amd/include/asic_reg/bif/bif_4_1_sh_mask.h-3275-#define PCIE_LC_LINK_WIDTH_CNTL__LC_L1_RECONFIG_EN_MASK 0x20000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-10798-#define PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x12
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:10799:#define PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x80000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:10800:#define PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x13
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-10801-#define PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x100000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-10804-#define PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS__SHIFT 0x15
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:10805:#define PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x400000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:10806:#define PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-10807-#define PCIE_LC_CNTL2__LC_WAIT_FOR_LANES_IN_LW_NEG_MASK 0x1800000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-10984-#define PCIE_LC_TRAINING_CNTL__LC_ASPM_L1_NAK_TIMER_SEL__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:10985:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x1000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:10986:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x18
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:10987:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x2000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:10988:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x19
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-10989-#define PCIE_LC_TRAINING_CNTL__LC_RESET_ASPM_L1_NAK_TIMER_MASK 0x4000000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-11020-#define PCIE_LC_LINK_WIDTH_CNTL__LC_UPCFG_TIMER_SEL__SHIFT 0xf
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11021:#define PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x10000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11022:#define PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x10
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-11023-#define PCIE_LC_LINK_WIDTH_CNTL__LC_L1_RECONFIG_EN_MASK 0x20000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-11246-#define PCIEP_HPGI_PRIVATE__PRESENCE_DETECT_STATE_PRIVATE__SHIFT 0x6
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11247:#define PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN_MASK 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11248:#define PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN__SHIFT 0x0
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11249:#define PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN_MASK 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11250:#define PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN__SHIFT 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11251:#define PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN_MASK 0x4
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11252:#define PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN__SHIFT 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11253:#define PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN_MASK 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11254:#define PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN__SHIFT 0x3
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-11255-#define PCIEP_HPGI__REG_HPGI_HOOK_MASK 0x80
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-11256-#define PCIEP_HPGI__REG_HPGI_HOOK__SHIFT 0x7
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11257:#define PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS_MASK 0x100
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11258:#define PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS__SHIFT 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11259:#define PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS_MASK 0x200
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11260:#define PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS__SHIFT 0x9
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11261:#define PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS_MASK 0x400
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11262:#define PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS__SHIFT 0xa
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11263:#define PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS_MASK 0x800
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h:11264:#define PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS__SHIFT 0xb
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_0_sh_mask.h-11265-#define PCIEP_HPGI__HPGI_REG_PRESENCE_DETECT_STATE_CHANGE_STATUS_MASK 0x8000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-4020-#define PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x12
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4021:#define PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x80000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4022:#define PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x13
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-4023-#define PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x100000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-4026-#define PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS__SHIFT 0x15
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4027:#define PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x400000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4028:#define PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-4029-#define PCIE_LC_CNTL2__LC_WAIT_FOR_LANES_IN_LW_NEG_MASK 0x1800000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-4190-#define PCIE_LC_TRAINING_CNTL__LC_ASPM_L1_NAK_TIMER_SEL__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4191:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x1000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4192:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x18
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4193:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x2000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4194:#define PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x19
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-4195-#define PCIE_LC_TRAINING_CNTL__LC_RESET_ASPM_L1_NAK_TIMER_MASK 0x4000000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-4226-#define PCIE_LC_LINK_WIDTH_CNTL__LC_UPCFG_TIMER_SEL__SHIFT 0xf
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4227:#define PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x10000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:4228:#define PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x10
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-4229-#define PCIE_LC_LINK_WIDTH_CNTL__LC_L1_RECONFIG_EN_MASK 0x20000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5110-#define D2F1_PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x12
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5111:#define D2F1_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x80000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5112:#define D2F1_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x13
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5113-#define D2F1_PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x100000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5116-#define D2F1_PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS__SHIFT 0x15
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5117:#define D2F1_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x400000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5118:#define D2F1_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5119-#define D2F1_PCIE_LC_CNTL2__LC_WAIT_FOR_LANES_IN_LW_NEG_MASK 0x1800000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5296-#define D2F1_PCIE_LC_TRAINING_CNTL__LC_ASPM_L1_NAK_TIMER_SEL__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5297:#define D2F1_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x1000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5298:#define D2F1_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x18
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5299:#define D2F1_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x2000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5300:#define D2F1_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x19
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5301-#define D2F1_PCIE_LC_TRAINING_CNTL__LC_RESET_ASPM_L1_NAK_TIMER_MASK 0x4000000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5332-#define D2F1_PCIE_LC_LINK_WIDTH_CNTL__LC_UPCFG_TIMER_SEL__SHIFT 0xf
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5333:#define D2F1_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x10000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5334:#define D2F1_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x10
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5335-#define D2F1_PCIE_LC_LINK_WIDTH_CNTL__LC_L1_RECONFIG_EN_MASK 0x20000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5558-#define D2F1_PCIEP_HPGI_PRIVATE__PRESENCE_DETECT_STATE_PRIVATE__SHIFT 0x6
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5559:#define D2F1_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN_MASK 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5560:#define D2F1_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN__SHIFT 0x0
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5561:#define D2F1_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN_MASK 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5562:#define D2F1_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN__SHIFT 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5563:#define D2F1_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN_MASK 0x4
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5564:#define D2F1_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN__SHIFT 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5565:#define D2F1_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN_MASK 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5566:#define D2F1_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN__SHIFT 0x3
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5567-#define D2F1_PCIEP_HPGI__REG_HPGI_HOOK_MASK 0x80
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5568-#define D2F1_PCIEP_HPGI__REG_HPGI_HOOK__SHIFT 0x7
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5569:#define D2F1_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS_MASK 0x100
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5570:#define D2F1_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS__SHIFT 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5571:#define D2F1_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS_MASK 0x200
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5572:#define D2F1_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS__SHIFT 0x9
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5573:#define D2F1_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS_MASK 0x400
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5574:#define D2F1_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS__SHIFT 0xa
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5575:#define D2F1_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS_MASK 0x800
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:5576:#define D2F1_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS__SHIFT 0xb
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-5577-#define D2F1_PCIEP_HPGI__HPGI_REG_PRESENCE_DETECT_STATE_CHANGE_STATUS_MASK 0x8000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7048-#define D2F2_PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x12
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7049:#define D2F2_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x80000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7050:#define D2F2_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x13
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7051-#define D2F2_PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x100000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7054-#define D2F2_PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS__SHIFT 0x15
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7055:#define D2F2_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x400000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7056:#define D2F2_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7057-#define D2F2_PCIE_LC_CNTL2__LC_WAIT_FOR_LANES_IN_LW_NEG_MASK 0x1800000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7234-#define D2F2_PCIE_LC_TRAINING_CNTL__LC_ASPM_L1_NAK_TIMER_SEL__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7235:#define D2F2_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x1000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7236:#define D2F2_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x18
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7237:#define D2F2_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x2000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7238:#define D2F2_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x19
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7239-#define D2F2_PCIE_LC_TRAINING_CNTL__LC_RESET_ASPM_L1_NAK_TIMER_MASK 0x4000000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7270-#define D2F2_PCIE_LC_LINK_WIDTH_CNTL__LC_UPCFG_TIMER_SEL__SHIFT 0xf
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7271:#define D2F2_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x10000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7272:#define D2F2_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x10
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7273-#define D2F2_PCIE_LC_LINK_WIDTH_CNTL__LC_L1_RECONFIG_EN_MASK 0x20000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7496-#define D2F2_PCIEP_HPGI_PRIVATE__PRESENCE_DETECT_STATE_PRIVATE__SHIFT 0x6
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7497:#define D2F2_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN_MASK 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7498:#define D2F2_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN__SHIFT 0x0
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7499:#define D2F2_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN_MASK 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7500:#define D2F2_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN__SHIFT 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7501:#define D2F2_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN_MASK 0x4
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7502:#define D2F2_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN__SHIFT 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7503:#define D2F2_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN_MASK 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7504:#define D2F2_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN__SHIFT 0x3
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7505-#define D2F2_PCIEP_HPGI__REG_HPGI_HOOK_MASK 0x80
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7506-#define D2F2_PCIEP_HPGI__REG_HPGI_HOOK__SHIFT 0x7
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7507:#define D2F2_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS_MASK 0x100
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7508:#define D2F2_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS__SHIFT 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7509:#define D2F2_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS_MASK 0x200
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7510:#define D2F2_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS__SHIFT 0x9
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7511:#define D2F2_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS_MASK 0x400
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7512:#define D2F2_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS__SHIFT 0xa
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7513:#define D2F2_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS_MASK 0x800
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:7514:#define D2F2_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS__SHIFT 0xb
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-7515-#define D2F2_PCIEP_HPGI__HPGI_REG_PRESENCE_DETECT_STATE_CHANGE_STATUS_MASK 0x8000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-8986-#define D2F3_PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x12
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:8987:#define D2F3_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x80000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:8988:#define D2F3_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x13
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-8989-#define D2F3_PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x100000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-8992-#define D2F3_PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS__SHIFT 0x15
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:8993:#define D2F3_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x400000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:8994:#define D2F3_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-8995-#define D2F3_PCIE_LC_CNTL2__LC_WAIT_FOR_LANES_IN_LW_NEG_MASK 0x1800000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-9172-#define D2F3_PCIE_LC_TRAINING_CNTL__LC_ASPM_L1_NAK_TIMER_SEL__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9173:#define D2F3_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x1000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9174:#define D2F3_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x18
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9175:#define D2F3_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x2000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9176:#define D2F3_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x19
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-9177-#define D2F3_PCIE_LC_TRAINING_CNTL__LC_RESET_ASPM_L1_NAK_TIMER_MASK 0x4000000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-9208-#define D2F3_PCIE_LC_LINK_WIDTH_CNTL__LC_UPCFG_TIMER_SEL__SHIFT 0xf
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9209:#define D2F3_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x10000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9210:#define D2F3_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x10
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-9211-#define D2F3_PCIE_LC_LINK_WIDTH_CNTL__LC_L1_RECONFIG_EN_MASK 0x20000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-9434-#define D2F3_PCIEP_HPGI_PRIVATE__PRESENCE_DETECT_STATE_PRIVATE__SHIFT 0x6
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9435:#define D2F3_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN_MASK 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9436:#define D2F3_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN__SHIFT 0x0
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9437:#define D2F3_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN_MASK 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9438:#define D2F3_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN__SHIFT 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9439:#define D2F3_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN_MASK 0x4
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9440:#define D2F3_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN__SHIFT 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9441:#define D2F3_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN_MASK 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9442:#define D2F3_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN__SHIFT 0x3
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-9443-#define D2F3_PCIEP_HPGI__REG_HPGI_HOOK_MASK 0x80
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-9444-#define D2F3_PCIEP_HPGI__REG_HPGI_HOOK__SHIFT 0x7
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9445:#define D2F3_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS_MASK 0x100
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9446:#define D2F3_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS__SHIFT 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9447:#define D2F3_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS_MASK 0x200
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9448:#define D2F3_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS__SHIFT 0x9
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9449:#define D2F3_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS_MASK 0x400
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9450:#define D2F3_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS__SHIFT 0xa
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9451:#define D2F3_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS_MASK 0x800
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:9452:#define D2F3_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS__SHIFT 0xb
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-9453-#define D2F3_PCIEP_HPGI__HPGI_REG_PRESENCE_DETECT_STATE_CHANGE_STATUS_MASK 0x8000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-10924-#define D2F4_PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x12
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:10925:#define D2F4_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x80000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:10926:#define D2F4_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x13
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-10927-#define D2F4_PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x100000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-10930-#define D2F4_PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS__SHIFT 0x15
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:10931:#define D2F4_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x400000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:10932:#define D2F4_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-10933-#define D2F4_PCIE_LC_CNTL2__LC_WAIT_FOR_LANES_IN_LW_NEG_MASK 0x1800000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-11110-#define D2F4_PCIE_LC_TRAINING_CNTL__LC_ASPM_L1_NAK_TIMER_SEL__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11111:#define D2F4_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x1000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11112:#define D2F4_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x18
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11113:#define D2F4_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x2000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11114:#define D2F4_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x19
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-11115-#define D2F4_PCIE_LC_TRAINING_CNTL__LC_RESET_ASPM_L1_NAK_TIMER_MASK 0x4000000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-11146-#define D2F4_PCIE_LC_LINK_WIDTH_CNTL__LC_UPCFG_TIMER_SEL__SHIFT 0xf
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11147:#define D2F4_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x10000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11148:#define D2F4_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x10
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-11149-#define D2F4_PCIE_LC_LINK_WIDTH_CNTL__LC_L1_RECONFIG_EN_MASK 0x20000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-11372-#define D2F4_PCIEP_HPGI_PRIVATE__PRESENCE_DETECT_STATE_PRIVATE__SHIFT 0x6
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11373:#define D2F4_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN_MASK 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11374:#define D2F4_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SMI_EN__SHIFT 0x0
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11375:#define D2F4_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN_MASK 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11376:#define D2F4_PCIEP_HPGI__REG_HPGI_ASSERT_TO_SCI_EN__SHIFT 0x1
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11377:#define D2F4_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN_MASK 0x4
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11378:#define D2F4_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SMI_EN__SHIFT 0x2
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11379:#define D2F4_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN_MASK 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11380:#define D2F4_PCIEP_HPGI__REG_HPGI_DEASSERT_TO_SCI_EN__SHIFT 0x3
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-11381-#define D2F4_PCIEP_HPGI__REG_HPGI_HOOK_MASK 0x80
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-11382-#define D2F4_PCIEP_HPGI__REG_HPGI_HOOK__SHIFT 0x7
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11383:#define D2F4_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS_MASK 0x100
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11384:#define D2F4_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SMI_STATUS__SHIFT 0x8
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11385:#define D2F4_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS_MASK 0x200
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11386:#define D2F4_PCIEP_HPGI__HPGI_REG_ASSERT_TO_SCI_STATUS__SHIFT 0x9
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11387:#define D2F4_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS_MASK 0x400
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11388:#define D2F4_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SMI_STATUS__SHIFT 0xa
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11389:#define D2F4_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS_MASK 0x800
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:11390:#define D2F4_PCIEP_HPGI__HPGI_REG_DEASSERT_TO_SCI_STATUS__SHIFT 0xb
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-11391-#define D2F4_PCIEP_HPGI__HPGI_REG_PRESENCE_DETECT_STATE_CHANGE_STATUS_MASK 0x8000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-12862-#define D2F5_PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23__SHIFT 0x12
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:12863:#define D2F5_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S_MASK 0x80000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:12864:#define D2F5_PCIE_LC_CNTL2__LC_DEASSERT_RX_EN_IN_L0S__SHIFT 0x13
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-12865-#define D2F5_PCIE_LC_CNTL2__LC_BLOCK_EL_IDLE_IN_L0_MASK 0x100000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-12868-#define D2F5_PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS__SHIFT 0x15
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:12869:#define D2F5_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD_MASK 0x400000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:12870:#define D2F5_PCIE_LC_CNTL2__LC_ASSERT_INACTIVE_DURING_HOLD__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-12871-#define D2F5_PCIE_LC_CNTL2__LC_WAIT_FOR_LANES_IN_LW_NEG_MASK 0x1800000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-13048-#define D2F5_PCIE_LC_TRAINING_CNTL__LC_ASPM_L1_NAK_TIMER_SEL__SHIFT 0x16
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:13049:#define D2F5_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED_MASK 0x1000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:13050:#define D2F5_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_R_SPEED__SHIFT 0x18
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:13051:#define D2F5_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST_MASK 0x2000000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:13052:#define D2F5_PCIE_LC_TRAINING_CNTL__LC_DONT_DEASSERT_RX_EN_IN_TEST__SHIFT 0x19
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-13053-#define D2F5_PCIE_LC_TRAINING_CNTL__LC_RESET_ASPM_L1_NAK_TIMER_MASK 0x4000000
--
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h-13084-#define D2F5_PCIE_LC_LINK_WIDTH_CNTL__LC_UPCFG_TIMER_SEL__SHIFT 0xf
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:13085:#define D2F5_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB_MASK 0x10000
drivers/gpu/drm/amd/include/asic_reg/bif/bif_5_1_sh_mask.h:13086:#define D2F5_PCIE_LC_LINK_WIDTH_CNTL__LC_DEASSERT_TX_PDNB__SHIFT 0x10
]
]
|
| 34/2 |
2026/05/13 01:17 |
llm |
expert |
0m
Model:
Tokens:
input: 94149
output: 22
thoughts: 21
Thoughts: Here's my take on the thought process, summarized as you requested:
**Navigating the JFS Debug Landscape**
Okay, so I'm trying to get a handle on this particular issue. My first instinct, given my experience with filesystems, is to dive straight into the code. I immediately think to check out the debug header files. Specifically, I'm reaching for something like `fs/jfs/jfs_debug.h` or something similarly named within the JFS codebase. That's the go-to place for debug flags, print macros, and generally the guts of how they're handling debugging at a lower level. My aim is to quickly identify any relevant debugging controls or tracing capabilities that might shed some light on the problem. I'm hoping to get a quick visual of how to enable verbose output or trace specific operations.
|
| 35/2 |
2026/05/13 01:17 |
tool |
codesearch-dir-index |
0m
Args:
Results: map[Files:[acl.c file.c inode.c ioctl.c jfs_acl.h jfs_btree.h jfs_debug.c jfs_debug.h jfs_dinode.h jfs_discard.c jfs_discard.h jfs_dmap.c jfs_dmap.h jfs_dtree.c jfs_dtree.h jfs_extent.c jfs_extent.h jfs_filsys.h jfs_imap.c jfs_imap.h jfs_incore.h jfs_inode.c jfs_inode.h jfs_lock.h jfs_logmgr.c jfs_logmgr.h jfs_metapage.c jfs_metapage.h jfs_mount.c jfs_superblock.h jfs_txnmgr.c jfs_txnmgr.h jfs_types.h jfs_umount.c jfs_unicode.c jfs_unicode.h jfs_xattr.h jfs_xtree.c jfs_xtree.h namei.c resize.c super.c symlink.c xattr.c] Subdirs:<nil>]
|
| 36/2 |
2026/05/13 01:17 |
llm |
expert |
0m
Model:
Tokens:
input: 94776
output: 26
thoughts: 17
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience:
**Diving into the JFS Debug Header**
Alright, let's get down to brass tacks. I'm going to dig into the `fs/jfs/jfs_debug.h` header file. My goal is to understand the debug facilities available within the JFS filesystem code. Knowing the debug flags, logging mechanisms, and potentially the instrumentation points defined there is critical for effective troubleshooting and deeper analysis when I'm working with JFS. I need to quickly grasp how the debug options are structured and how to control them at runtime, because a deep dive into tracing is going to be necessary. Time to parse through this header and see what gems I can find. I anticipate seeing conditional compilation directives based on debug levels, macro definitions for tracing functions, and probably some definitions related to debug output formats. Let's see if this header gives me the hook into the core debugging infrastructure I need.
|
| 37/2 |
2026/05/13 01:17 |
tool |
read-file |
0m
Args: map[File:fs/jfs/jfs_debug.h]
Results: map[Contents:/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (C) International Business Machines Corp., 2000-2002
* Portions Copyright (C) Christoph Hellwig, 2001-2002
*/
#ifndef _H_JFS_DEBUG
#define _H_JFS_DEBUG
/*
* jfs_debug.h
*
* global debug message, data structure/macro definitions
* under control of CONFIG_JFS_DEBUG, CONFIG_JFS_STATISTICS;
*/
/*
* Create /proc/fs/jfs if procfs is enabled andeither
* CONFIG_JFS_DEBUG or CONFIG_JFS_STATISTICS is defined
*/
#if defined(CONFIG_PROC_FS) && (defined(CONFIG_JFS_DEBUG) || defined(CONFIG_JFS_STATISTICS))
#define PROC_FS_JFS
extern void jfs_proc_init(void);
extern void jfs_proc_clean(void);
#endif
/*
* assert with traditional printf/panic
*/
#define assert(p) do { \
if (!(p)) { \
printk(KERN_CRIT "BUG at %s:%d assert(%s)\n", \
__FILE__, __LINE__, #p); \
BUG(); \
} \
} while (0)
/*
* debug ON
* --------
*/
#ifdef CONFIG_JFS_DEBUG
#define ASSERT(p) assert(p)
/* printk verbosity */
#define JFS_LOGLEVEL_ERR 1
#define JFS_LOGLEVEL_WARN 2
#define JFS_LOGLEVEL_DEBUG 3
#define JFS_LOGLEVEL_INFO 4
extern int jfsloglevel;
int jfs_txanchor_proc_show(struct seq_file *m, void *v);
/* information message: e.g., configuration, major event */
#define jfs_info(fmt, arg...) do { \
if (jfsloglevel >= JFS_LOGLEVEL_INFO) \
printk(KERN_INFO fmt "\n", ## arg); \
} while (0)
/* debug message: ad hoc */
#define jfs_debug(fmt, arg...) do { \
if (jfsloglevel >= JFS_LOGLEVEL_DEBUG) \
printk(KERN_DEBUG fmt "\n", ## arg); \
} while (0)
/* warn message: */
#define jfs_warn(fmt, arg...) do { \
if (jfsloglevel >= JFS_LOGLEVEL_WARN) \
printk(KERN_WARNING fmt "\n", ## arg); \
} while (0)
/* error event message: e.g., i/o error */
#define jfs_err(fmt, arg...) do { \
if (jfsloglevel >= JFS_LOGLEVEL_ERR) \
printk(KERN_ERR fmt "\n", ## arg); \
} while (0)
/*
* debug OFF
* ---------
*/
#else /* CONFIG_JFS_DEBUG */
#define ASSERT(p) do {} while (0)
#define jfs_info(fmt, arg...) do {} while (0)
#define jfs_debug(fmt, arg...) do {} while (0)
#define jfs_warn(fmt, arg...) do {} while (0)
#define jfs_err(fmt, arg...) do {} while (0)
#endif /* CONFIG_JFS_DEBUG */
/*
* statistics
* ----------
*/
#ifdef CONFIG_JFS_STATISTICS
int jfs_lmstats_proc_show(struct seq_file *m, void *v);
int jfs_txstats_proc_show(struct seq_file *m, void *v);
int jfs_mpstat_proc_show(struct seq_file *m, void *v);
int jfs_xtstat_proc_show(struct seq_file *m, void *v);
#define INCREMENT(x) ((x)++)
#define DECREMENT(x) ((x)--)
#define HIGHWATERMARK(x,y) ((x) = max((x), (y)))
#else
#define INCREMENT(x)
#define DECREMENT(x)
#define HIGHWATERMARK(x,y)
#endif /* CONFIG_JFS_STATISTICS */
#endif /* _H_JFS_DEBUG */
]
|
| 38/2 |
2026/05/13 01:17 |
llm |
expert |
0m
Model:
Tokens:
input: 96098
output: 19
thoughts: 111
Thoughts: **Analyzing the JFS Debug Assertions**
Okay, so I'm looking at this `ASSERT` macro in the JFS code. Seems like it's conditionally defined. Right off the bat, I see that `ASSERT` only gets defined if `CONFIG_JFS_DEBUG` is enabled. Makes sense, that's pretty standard practice.
Now, let's see how it's actually implemented. Ah, so `ASSERT(p)` expands to `assert(p)`, which, knowing this kernel, probably ends up calling `BUG()`. Thatβs my immediate assumption, and Iβll bet it's correct. Good for catching hard errors during development.
But what happens when `CONFIG_JFS_DEBUG` is *off*? Let me look... yep, it's just a `do {} while (0)` block. Effectively, it's a no-op, which is exactly what I'd expect. Avoids adding overhead to production code. Smart.
The important question now is, are we accidentally enabling `CONFIG_JFS_DEBUG` in any production builds? That would be a major performance hit. I've almost never seen a debug option left on in a production kernel. I'd better be sure. Usually, that's just a development/testing configuration.
Right, I'm going to quickly check `fs/jfs/Kconfig` to confirm where `CONFIG_JFS_DEBUG` is defined and what the default value is. Best to be completely sure.
|
| 39/2 |
2026/05/13 01:17 |
tool |
grepper |
0m
Args: map[Expression:config JFS_DEBUG]
Results: map[Output:fs/jfs/Kconfig=25=config JFS_SECURITY
--
fs/jfs/Kconfig-36-
fs/jfs/Kconfig:37:config JFS_DEBUG
fs/jfs/Kconfig-38- bool "JFS debugging"
]
|
| 40/2 |
2026/05/13 01:17 |
llm |
expert |
0m
Model:
Tokens:
input: 96628
output: 22
thoughts: 15
Thoughts: Okay, let's dive into this. Here's my take on those thoughts, as if they're my own:
**Analyzing the JFS_DEBUG Configuration**
Right, let's get down to brass tacks. I need to see the *entire* `config JFS_DEBUG` block. No snippets, no partial views. I want the complete picture. I need to understand all the available options, their default values (if any), and how they interact with each other. This isn't just about glancing at a few lines; it's about a comprehensive understanding. I need to see the logic, the dependencies, and the potential implications of each setting. I'm going to start by reading the entire config and formulating a model.
|
| 41/2 |
2026/05/13 01:17 |
tool |
read-file |
0m
Args:
Results: map[Contents:# SPDX-License-Identifier: GPL-2.0-only
config JFS_FS
tristate "JFS filesystem support"
select BUFFER_HEAD
select NLS
select NLS_UCS2_UTILS
select CRC32
select LEGACY_DIRECT_IO
help
This is a port of IBM's Journaled Filesystem . More information is
available in the file <file:Documentation/admin-guide/jfs.rst>.
If you do not intend to use the JFS filesystem, say N.
config JFS_POSIX_ACL
bool "JFS POSIX Access Control Lists"
depends on JFS_FS
select FS_POSIX_ACL
help
Posix Access Control Lists (ACLs) support permissions for users and
groups beyond the owner/group/world scheme.
If you don't know what Access Control Lists are, say N
config JFS_SECURITY
bool "JFS Security Labels"
depends on JFS_FS
help
Security labels support alternative access control models
implemented by security modules like SELinux. This option
enables an extended attribute handler for file security
labels in the jfs filesystem.
If you are not using a security module that requires using
extended attributes for file security labels, say N.
config JFS_DEBUG
bool "JFS debugging"
depends on JFS_FS
help
If you are experiencing any problems with the JFS filesystem, say
Y here. This will result in additional debugging messages to be
written to the system log. Under normal circumstances, this
results in very little overhead.
config JFS_STATISTICS
bool "JFS statistics"
depends on JFS_FS
help
Enabling this option will cause statistics from the JFS file system
to be made available to the user in the /proc/fs/jfs/ directory.
]
|
| 42/2 |
2026/05/13 01:17 |
llm |
expert |
0m
Model:
Tokens:
input: 97297
output: 46
thoughts: 100
Thoughts: **Analyzing the `JFS_DEBUG` Configuration and its Implications**
Okay, so I'm looking at this `CONFIG_JFS_DEBUG` option, which is clearly a debugging flag. The prompt is asking me to consider how this would affect the *production* build, meaning without any of those nice debugging tools enabled β no KASAN, KMSAN, or UBSAN. That's key. If `CONFIG_JFS_DEBUG` isn't set, then my understanding is that `ASSERT(p)` becomes essentially a null operation, a no-op. It gets optimized away. That's when things get interesting. Hold onβ¦ if `ASSERT(p)` does nothing, what's supposed to happen within the subsequent calls made in `add_missing_indices`? I need to look into `add_missing_indices` to understand the implications of the assertion being removed and ensure that the absence of the debug check doesn't introduce a subtle bug. I suspect that there is a critical dependency on the assertion to make sure `p` isn't null. I need to understand that.
|
| 43/2 |
2026/05/13 01:17 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/jfs/jfs_dtree.c IncludeLines:true Name:add_missing_indices]
Results: map[SourceCode:2609: /*
2610: * add_missing_indices()
2611: *
2612: * function: Fix dtree page in which one or more entries has an invalid index.
2613: * fsck.jfs should really fix this, but it currently does not.
2614: * Called from jfs_readdir when bad index is detected.
2615: */
2616: static int add_missing_indices(struct inode *inode, s64 bn)
2617: {
2618: struct ldtentry *d;
2619: struct dt_lock *dtlck;
2620: int i;
2621: uint index;
2622: struct lv *lv;
2623: struct metapage *mp;
2624: dtpage_t *p;
2625: int rc = 0;
2626: s8 *stbl;
2627: tid_t tid;
2628: struct tlock *tlck;
2629:
2630: tid = txBegin(inode->i_sb, 0);
2631:
2632: DT_GETPAGE(inode, bn, mp, PSIZE, p, rc);
2633:
2634: if (rc) {
2635: printk(KERN_ERR "DT_GETPAGE failed!\n");
2636: goto end;
2637: }
2638: BT_MARK_DIRTY(mp, inode);
2639:
2640: ASSERT(p->header.flag & BT_LEAF);
2641:
2642: tlck = txLock(tid, inode, mp, tlckDTREE | tlckENTRY);
2643: if (BT_IS_ROOT(mp))
2644: tlck->type |= tlckBTROOT;
2645:
2646: dtlck = (struct dt_lock *) &tlck->lock;
2647:
2648: stbl = DT_GETSTBL(p);
2649: for (i = 0; i < p->header.nextindex; i++) {
2650: if (stbl[i] < 0) {
2651: jfs_err("jfs: add_missing_indices: Invalid stbl[%d] = %d for inode %ld, block = %lld",
2652: i, stbl[i], (long)inode->i_ino, (long long)bn);
2653: rc = -EIO;
2654:
2655: DT_PUTPAGE(mp);
2656: txAbort(tid, 0);
2657: goto end;
2658: }
2659:
2660: d = (struct ldtentry *) &p->slot[stbl[i]];
2661: index = le32_to_cpu(d->index);
2662: if ((index < 2) || (index >= JFS_IP(inode)->next_index)) {
2663: d->index = cpu_to_le32(add_index(tid, inode, bn, i));
2664: if (dtlck->index >= dtlck->maxcnt)
2665: dtlck = (struct dt_lock *) txLinelock(dtlck);
2666: lv = &dtlck->lv[dtlck->index];
2667: lv->offset = stbl[i];
2668: lv->length = 1;
2669: dtlck->index++;
2670: }
2671: }
2672:
2673: DT_PUTPAGE(mp);
2674: (void) txCommit(tid, 1, &inode, 0);
2675: end:
2676: txEnd(tid);
2677: return rc;
2678: }
SourceFile:fs/jfs/jfs_dtree.c]
|
| 44/2 |
2026/05/13 01:17 |
llm |
expert |
0m
Model:
Tokens:
input: 98791
output: 20
thoughts: 216
Thoughts: **Analyzing the `add_missing_indices` Function**
Okay, so I'm looking at this `add_missing_indices` function, and it seems like a crucial piece for handling index entries in this B-tree implementation. The first thing I see is this `ASSERT` statement checking if the page is a leaf node. If that's a no-op, then we're good to continue. This suggests we're expecting the process to be called specifically for leaf pages; the implications of it being a no-op are important - that probably points towards a more robust system that can withstand an input that does not conform to the expected parameters.
Next, it gets `stbl` β the symbol table β using `DT_GETSTBL(p)`. It then goes into a loop, iterating through the table. I'm assuming that the size of this symbol table is dynamic and defined by the `nextindex` header value. Now, within the loop, the code checks if any `stbl[i]` entry is negative; if so, it returns an `-EIO` error, which indicates an I/O error β likely because of an invalid table entry.
Then it proceeds to dereference an entry. It gets `d`, which is a pointer to the `ldtentry` structure, using `stbl[i]`. I'm curious about the specific layout of this data structure, but for now, the process assumes it's present and correct. It grabs the `index` field from that entry, converts it from little-endian format, and checks if the index is "bad". If it's indeed bad, then `add_index` is called, with all the necessary parameters, which is the key function in play here.
Now, hold on a second... what if this page *isn't* a leaf page? This function has to be more robust than that, right? If it's an internal page, the memory layout might be different. Let's think, if it is internal, `stbl` and `slot` are still present. This means that we'll have different table entries, something like `idtentry` structure, instead of `ldtentry`. Okay, I need to check how the `dtpage_t` is defined β that will determine the precise structure of the internal nodes and make sure the logic is handling different page types correctly. I need to make sure I'm not making invalid assumptions about how this data is laid out in memory. This is critical for the overall integrity of the index structure.
|
| 45/2 |
2026/05/13 01:17 |
tool |
grepper |
0m
Error:
Args: map[Expression:typedef.*dtpage_t]
Results:
|
| 46/2 |
2026/05/13 01:17 |
llm |
expert |
0m
Model:
Tokens:
input: 99579
output: 20
thoughts: 11
Thoughts: Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person:
**Initial Investigation: "dtpage_t" Hunt**
Alright, the initial prompt is pretty straightforward. My first instinct here, given the likely context (embedded systems, kernel development, maybe even hardware design), is to reach for `grep`. I'm going to start by looking for instances of `dtpage_t`. The specific intent? Well, it's about diving into the code, and seeing where and how this structure or type, is being used. I need to understand its role in the system. The exact scope of the grep will depend on the project, the size of the codebase, and what I already know about the relevant modules, but I know what to do. What I'm looking for is context. Usage examples, definitions, potentially even related files. I'm hoping to get a quick overview of how this 'dtpage_t' concept is integrated, so I can start to understand its implications. I know, without a hint, that it might be about hardware, device trees or something similar.
|
| 47/2 |
2026/05/13 01:18 |
tool |
grepper |
0m
Args: map[Expression:struct.*dtpage_t]
Results: map[Output:fs/jfs/jfs_dtree.c=143=static int dtSplitPage(tid_t tid, struct inode *ip, struct dtsplit * split,
fs/jfs/jfs_dtree.c:144: struct metapage ** rmpp, dtpage_t ** rpp, pxd_t * rxdp);
fs/jfs/jfs_dtree.c-145-
--
fs/jfs/jfs_dtree.c=152=static int dtDeleteUp(tid_t tid, struct inode *ip, struct metapage * fmp,
--
fs/jfs/jfs_dtree.c-154-
fs/jfs/jfs_dtree.c:155:static int dtRelink(tid_t tid, struct inode *ip, dtpage_t * p);
fs/jfs/jfs_dtree.c-156-
--
fs/jfs/jfs_dtree.c=159=static int dtReadNext(struct inode *ip,
--
fs/jfs/jfs_dtree.c-161-
fs/jfs/jfs_dtree.c:162:static int dtCompare(struct component_name * key, dtpage_t * p, int si);
fs/jfs/jfs_dtree.c-163-
fs/jfs/jfs_dtree.c:164:static int ciCompare(struct component_name * key, dtpage_t * p, int si,
fs/jfs/jfs_dtree.c-165- int flag);
--
fs/jfs/jfs_dtree.c=1326=static int dtSplitPage(tid_t tid, struct inode *ip, struct dtsplit * split,
fs/jfs/jfs_dtree.c:1327: struct metapage ** rmpp, dtpage_t ** rpp, pxd_t * rpxdp)
fs/jfs/jfs_dtree.c-1328-{
--
fs/jfs/jfs_dtree.c=2233=static int dtDeleteUp(tid_t tid, struct inode *ip,
fs/jfs/jfs_dtree.c:2234: struct metapage * fmp, dtpage_t * fp, struct btstack * btstack)
fs/jfs/jfs_dtree.c-2235-{
--
fs/jfs/jfs_dtree.c-2444- */
fs/jfs/jfs_dtree.c:2445:static int dtRelink(tid_t tid, struct inode *ip, dtpage_t * p)
fs/jfs/jfs_dtree.c-2446-{
]
|
| 48/2 |
2026/05/13 01:18 |
llm |
expert |
0m
Model:
Tokens:
input: 100546
output: 20
thoughts: 13
Thoughts: Okay, here's my attempt at summarizing my thought process in the first person, assuming I'm already pretty familiar with the general topic:
**Hunting Down `dtpage_t`**
Alright, so the task at hand is to understand `dtpage_t`. My first instinct, as always, is to get a solid definition. I need to know exactly what this represents. Is it a data structure? A typedef? A macro? The specific details are critical. I can't start analyzing anything related to it without a firm grasp of its basic nature. Let's dig in and find its definition. I need to get to the root of this.
|
| 49/2 |
2026/05/13 01:18 |
tool |
grepper |
0m
Args: map[Expression:} dtpage_t;]
Results: map[Output:fs/jfs/jfs_dtree.h=180=typedef union {
--
fs/jfs/jfs_dtree.h-197- struct dtslot slot[128];
fs/jfs/jfs_dtree.h:198:} dtpage_t;
fs/jfs/jfs_dtree.h-199-
]
|
| 50/2 |
2026/05/13 01:18 |
llm |
expert |
0m
Model:
Tokens:
input: 100822
output: 27
thoughts: 25
Thoughts: Here's my summary, as though I'm processing this task:
**Delving into the JFS Dtree Implementation**
Okay, let's dive right in. The task is to familiarize myself with the `fs/jfs/jfs_dtree.h` header, specifically around line 180. I suspect this section deals with some core data structure or function related to the JFS directory tree (Dtree) implementation. My guess is it might be a structure definition, a macro, or perhaps an inline function related to Dtree managementβlikely a node or entry definition. Given my experience with journaling file systems, the "dtree" likely refers to the B+Tree structure used to manage directory entries efficiently and I expect to see definitions related to its nodes, keys, and pointers or perhaps definitions to track free space within the directory tree. Let's see what we find.
|
| 51/2 |
2026/05/13 01:18 |
tool |
read-file |
0m
Args: map[File:fs/jfs/jfs_dtree.h]
Results: map[Contents:/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (C) International Business Machines Corp., 2000-2002
*/
#ifndef _H_JFS_DTREE
#define _H_JFS_DTREE
/*
* jfs_dtree.h: directory B+-tree manager
*/
#include "jfs_btree.h"
typedef union {
struct {
tid_t tid;
struct inode *ip;
u32 ino;
} leaf;
pxd_t xd;
} ddata_t;
/*
* entry segment/slot
*
* an entry consists of type dependent head/only segment/slot and
* additional segments/slots linked vi next field;
* N.B. last/only segment of entry is terminated by next = -1;
*/
/*
* directory page slot
*/
struct dtslot {
s8 next; /* 1: */
s8 cnt; /* 1: */
__le16 name[15]; /* 30: */
}; /* (32) */
#define DATASLOTSIZE 16
#define L2DATASLOTSIZE 4
#define DTSLOTSIZE 32
#define L2DTSLOTSIZE 5
#define DTSLOTHDRSIZE 2
#define DTSLOTDATASIZE 30
#define DTSLOTDATALEN 15
/*
* internal node entry head/only segment
*/
struct idtentry {
pxd_t xd; /* 8: child extent descriptor */
s8 next; /* 1: */
u8 namlen; /* 1: */
__le16 name[11]; /* 22: 2-byte aligned */
}; /* (32) */
#define DTIHDRSIZE 10
#define DTIHDRDATALEN 11
/* compute number of slots for entry */
#define NDTINTERNAL(klen) (DIV_ROUND_UP((4 + (klen)), 15))
/*
* leaf node entry head/only segment
*
* For legacy filesystems, name contains 13 wchars -- no index field
*/
struct ldtentry {
__le32 inumber; /* 4: 4-byte aligned */
s8 next; /* 1: */
u8 namlen; /* 1: */
__le16 name[11]; /* 22: 2-byte aligned */
__le32 index; /* 4: index into dir_table */
}; /* (32) */
#define DTLHDRSIZE 6
#define DTLHDRDATALEN_LEGACY 13 /* Old (OS/2) format */
#define DTLHDRDATALEN 11
/*
* dir_table used for directory traversal during readdir
*/
/*
* Keep persistent index for directory entries
*/
#define DO_INDEX(INODE) (JFS_SBI((INODE)->i_sb)->mntflag & JFS_DIR_INDEX)
/*
* Maximum entry in inline directory table
*/
#define MAX_INLINE_DIRTABLE_ENTRY 13
struct dir_table_slot {
u8 rsrvd; /* 1: */
u8 flag; /* 1: 0 if free */
u8 slot; /* 1: slot within leaf page of entry */
u8 addr1; /* 1: upper 8 bits of leaf page address */
__le32 addr2; /* 4: lower 32 bits of leaf page address -OR-
index of next entry when this entry was deleted */
}; /* (8) */
/*
* flag values
*/
#define DIR_INDEX_VALID 1
#define DIR_INDEX_FREE 0
#define DTSaddress(dir_table_slot, address64)\
{\
(dir_table_slot)->addr1 = ((u64)address64) >> 32;\
(dir_table_slot)->addr2 = __cpu_to_le32((address64) & 0xffffffff);\
}
#define addressDTS(dts)\
( ((s64)((dts)->addr1)) << 32 | __le32_to_cpu((dts)->addr2) )
/* compute number of slots for entry */
#define NDTLEAF_LEGACY(klen) (DIV_ROUND_UP((2 + (klen)), 15))
#define NDTLEAF NDTINTERNAL
/*
* directory root page (in-line in on-disk inode):
*
* cf. dtpage_t below.
*/
typedef union {
struct {
struct dasd DASD; /* 16: DASD limit/usage info */
u8 flag; /* 1: */
u8 nextindex; /* 1: next free entry in stbl */
s8 freecnt; /* 1: free count */
s8 freelist; /* 1: freelist header */
__le32 idotdot; /* 4: parent inode number */
s8 stbl[8]; /* 8: sorted entry index table */
} header; /* (32) */
struct dtslot slot[9];
} dtroot_t;
#define PARENT(IP) \
(le32_to_cpu(JFS_IP(IP)->i_dtroot.header.idotdot))
#define DTROOTMAXSLOT 9
#define dtEmpty(IP) (JFS_IP(IP)->i_dtroot.header.nextindex == 0)
/*
* directory regular page:
*
* entry slot array of 32 byte slot
*
* sorted entry slot index table (stbl):
* contiguous slots at slot specified by stblindex,
* 1-byte per entry
* 512 byte block: 16 entry tbl (1 slot)
* 1024 byte block: 32 entry tbl (1 slot)
* 2048 byte block: 64 entry tbl (2 slot)
* 4096 byte block: 128 entry tbl (4 slot)
*
* data area:
* 512 byte block: 16 - 2 = 14 slot
* 1024 byte block: 32 - 2 = 30 slot
* 2048 byte block: 64 - 3 = 61 slot
* 4096 byte block: 128 - 5 = 123 slot
*
* N.B. index is 0-based; index fields refer to slot index
* except nextindex which refers to entry index in stbl;
* end of entry stot list or freelist is marked with -1.
*/
typedef union {
struct {
__le64 next; /* 8: next sibling */
__le64 prev; /* 8: previous sibling */
u8 flag; /* 1: */
u8 nextindex; /* 1: next entry index in stbl */
s8 freecnt; /* 1: */
s8 freelist; /* 1: slot index of head of freelist */
u8 maxslot; /* 1: number of slots in page slot[] */
u8 stblindex; /* 1: slot index of start of stbl */
u8 rsrvd[2]; /* 2: */
pxd_t self; /* 8: self pxd */
} header; /* (32) */
struct dtslot slot[128];
} dtpage_t;
#define DTPAGEMAXSLOT 128
#define DT8THPGNODEBYTES 512
#define DT8THPGNODETSLOTS 1
#define DT8THPGNODESLOTS 16
#define DTQTRPGNODEBYTES 1024
#define DTQTRPGNODETSLOTS 1
#define DTQTRPGNODESLOTS 32
#define DTHALFPGNODEBYTES 2048
#define DTHALFPGNODETSLOTS 2
#define DTHALFPGNODESLOTS 64
#define DTFULLPGNODEBYTES 4096
#define DTFULLPGNODETSLOTS 4
#define DTFULLPGNODESLOTS 128
#define DTENTRYSTART 1
/* get sorted entry table of the page */
#define DT_GETSTBL(p) ( ((p)->header.flag & BT_ROOT) ?\
((dtroot_t *)(p))->header.stbl : \
(s8 *)&(p)->slot[(p)->header.stblindex] )
/*
* Flags for dtSearch
*/
#define JFS_CREATE 1
#define JFS_LOOKUP 2
#define JFS_REMOVE 3
#define JFS_RENAME 4
/*
* Maximum file offset for directories.
*/
#define DIREND INT_MAX
/*
* external declarations
*/
extern void dtInitRoot(tid_t tid, struct inode *ip, u32 idotdot);
extern int dtSearch(struct inode *ip, struct component_name * key,
ino_t * data, struct btstack * btstack, int flag);
extern int dtInsert(tid_t tid, struct inode *ip, struct component_name * key,
ino_t * ino, struct btstack * btstack);
extern int dtDelete(tid_t tid, struct inode *ip, struct component_name * key,
ino_t * data, int flag);
extern int dtModify(tid_t tid, struct inode *ip, struct component_name * key,
ino_t * orig_ino, ino_t new_ino, int flag);
extern int jfs_readdir(struct file *file, struct dir_context *ctx);
#endif /* !_H_JFS_DTREE */
]
|
| 52/2 |
2026/05/13 01:18 |
llm |
expert |
1m
Model:
Tokens:
input: 103474
output: 44
thoughts: 3050
Thoughts: **Analysis of the JFS Filesystem Corruption Vulnerability**
Okay, so here's the breakdown of this JFS bug, as I see it. The core issue revolves around how `add_missing_indices` handles internal directory pages when they are misidentified as leaf pages. The problem arises because the layout of the directory entries, specifically `idtentry` (for internal nodes) and `ldtentry` (for leaves), are different, but share a common structure early in the data. `add_missing_indices` incorrectly treats an `idtentry` as if it were an `ldtentry`.
The crux of the matter is the `index` field within `ldtentry`. This field resides at the end of the entry and overlaps with the last four bytes of the `name` field in `idtentry`. When `add_missing_indices` modifies the index, it overwrites these last four bytes of the directory name in an internal node. This action directly corrupts the filesystem metadata.
Now, if `CONFIG_JFS_DEBUG` is enabled, this will trigger a `BUG` at `fs/jfs/jfs_dtree.c:2640` due to an `ASSERT` that should have been true. But, the crucial point here is that `CONFIG_JFS_DEBUG` is typically *disabled* in production kernels. So, the kernel doesn't crash on a production build. The `ASSERT` becomes a no-op. So, the code just modifies the page in memory, which is then written to disk. The bug report is from Syzbot, which *does* enable debug builds, thus the bug report.
The overwrite of the name isn't an immediate kernel memory corruption, so no security vulnerability in that way. It's just a filesystem corruption, which leads to potentially garbage data.
Further down the chain, when `jfs_readdir` is called, it continues to try and read the corrupted page. If `jfs_readdir` is processing an internal page that has been corrupted by the `add_missing_indices` function, it will attempt to treat it as a leaf page. This leads to returning garbage inode numbers and names to user space. It could potentially also cause an infinite loop in some situations, but the structure of how names are stored prevents an infinite loop.
The key is that the corruption is silent in production. So, although it creates a filesystem corruption, it doesn't cause a crash or denial of service in a non-debug kernel. In the case where `jfs_readdir` is called on a directory that is corrupted, it will return incorrect data to user space. It could also lead to a filesystem remount-ro, but only with specific mount options.
|
| 53/2 |
2026/05/13 01:19 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/jfs/jfs_dtree.c IncludeLines:true Name:add_index]
Results: map[SourceCode: 315: /*
316: * add_index()
317: *
318: * Adds an entry to the directory index table. This is used to provide
319: * each directory entry with a persistent index in which to resume
320: * directory traversals
321: */
322: static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot)
323: {
324: struct super_block *sb = ip->i_sb;
325: struct jfs_sb_info *sbi = JFS_SBI(sb);
326: struct jfs_inode_info *jfs_ip = JFS_IP(ip);
327: u64 blkno;
328: struct dir_table_slot *dirtab_slot;
329: u32 index;
330: struct linelock *llck;
331: struct lv *lv;
332: struct metapage *mp;
333: s64 offset;
334: uint page_offset;
335: struct tlock *tlck;
336: s64 xaddr;
337:
338: ASSERT(DO_INDEX(ip));
339:
340: if (jfs_ip->next_index < 2) {
341: jfs_warn("add_index: next_index = %d. Resetting!",
342: jfs_ip->next_index);
343: jfs_ip->next_index = 2;
344: }
345:
346: index = jfs_ip->next_index++;
347:
348: if (index <= MAX_INLINE_DIRTABLE_ENTRY) {
349: /*
350: * i_size reflects size of index table, or 8 bytes per entry.
351: */
352: ip->i_size = (loff_t) (index - 1) << 3;
353:
354: /*
355: * dir table fits inline within inode
356: */
357: dirtab_slot = &jfs_ip->i_dirtable[index-2];
358: dirtab_slot->flag = DIR_INDEX_VALID;
359: dirtab_slot->slot = slot;
360: DTSaddress(dirtab_slot, bn);
361:
362: set_cflag(COMMIT_Dirtable, ip);
363:
364: return index;
365: }
366: if (index == (MAX_INLINE_DIRTABLE_ENTRY + 1)) {
367: struct dir_table_slot temp_table[12];
368:
369: /*
370: * It's time to move the inline table to an external
371: * page and begin to build the xtree
372: */
373: if (dquot_alloc_block(ip, sbi->nbperpage))
374: goto clean_up;
375: if (dbAlloc(ip, 0, sbi->nbperpage, &xaddr)) {
376: dquot_free_block(ip, sbi->nbperpage);
377: goto clean_up;
378: }
379:
380: /*
381: * Save the table, we're going to overwrite it with the
382: * xtree root
383: */
384: memcpy(temp_table, &jfs_ip->i_dirtable, sizeof(temp_table));
385:
386: /*
387: * Initialize empty x-tree
388: */
389: xtInitRoot(tid, ip);
390:
391: /*
392: * Add the first block to the xtree
393: */
394: if (xtInsert(tid, ip, 0, 0, sbi->nbperpage, &xaddr, 0)) {
395: /* This really shouldn't fail */
396: jfs_warn("add_index: xtInsert failed!");
397: memcpy(&jfs_ip->i_dirtable, temp_table,
398: sizeof (temp_table));
399: dbFree(ip, xaddr, sbi->nbperpage);
400: dquot_free_block(ip, sbi->nbperpage);
401: goto clean_up;
402: }
403: ip->i_size = PSIZE;
404:
405: mp = get_index_page(ip, 0);
406: if (!mp) {
407: jfs_err("add_index: get_metapage failed!");
408: xtTruncate(tid, ip, 0, COMMIT_PWMAP);
409: memcpy(&jfs_ip->i_dirtable, temp_table,
410: sizeof (temp_table));
411: goto clean_up;
412: }
413: tlck = txLock(tid, ip, mp, tlckDATA);
414: llck = (struct linelock *) & tlck->lock;
415: ASSERT(llck->index == 0);
416: lv = &llck->lv[0];
417:
418: lv->offset = 0;
419: lv->length = 6; /* tlckDATA slot size is 16 bytes */
420: llck->index++;
421:
422: memcpy(mp->data, temp_table, sizeof(temp_table));
423:
424: mark_metapage_dirty(mp);
425: release_metapage(mp);
426:
427: /*
428: * Logging is now directed by xtree tlocks
429: */
430: clear_cflag(COMMIT_Dirtable, ip);
431: }
432:
433: offset = (index - 2) * sizeof(struct dir_table_slot);
434: page_offset = offset & (PSIZE - 1);
435: blkno = ((offset + 1) >> L2PSIZE) << sbi->l2nbperpage;
436: if (page_offset == 0) {
437: /*
438: * This will be the beginning of a new page
439: */
440: xaddr = 0;
441: if (xtInsert(tid, ip, 0, blkno, sbi->nbperpage, &xaddr, 0)) {
442: jfs_warn("add_index: xtInsert failed!");
443: goto clean_up;
444: }
445: ip->i_size += PSIZE;
446:
447: if ((mp = get_index_page(ip, blkno)))
448: memset(mp->data, 0, PSIZE); /* Just looks better */
449: else
450: xtTruncate(tid, ip, offset, COMMIT_PWMAP);
451: } else
452: mp = read_index_page(ip, blkno);
453:
454: if (!mp) {
455: jfs_err("add_index: get/read_metapage failed!");
456: goto clean_up;
457: }
458:
459: lock_index(tid, ip, mp, index);
460:
461: dirtab_slot =
462: (struct dir_table_slot *) ((char *) mp->data + page_offset);
463: dirtab_slot->flag = DIR_INDEX_VALID;
464: dirtab_slot->slot = slot;
465: DTSaddress(dirtab_slot, bn);
466:
467: mark_metapage_dirty(mp);
468: release_metapage(mp);
469:
470: return index;
471:
472: clean_up:
473:
474: jfs_ip->next_index--;
475:
476: return 0;
477: }
SourceFile:fs/jfs/jfs_dtree.c]
|
| 54/2 |
2026/05/13 01:19 |
llm |
expert |
0m
Model:
Tokens:
input: 109601
output: 44
thoughts: 1529
Thoughts: **Analyzing the JFS Readdir Bug**
Okay, let's break this down. First, `add_index` is updating the directory table, that makes sense. If `jfs_readdir` processes an internal page, it uses `add_index` which writes to the directory table and, eventually, returns directory entries to userspace. I was initially looking for memory corruption here, but it seems that isn't the primary concern; rather, it's about incorrect filesystem entries. The bug overwrites the last four bytes of the `name` field with the `index` when it shouldn't. It's a filesystem corruption, which means we need a specifically crafted image to trigger it. This would cause a crash only if `CONFIG_JFS_DEBUG` is enabled. If not, it just returns garbage to the user.
Now, let's explore this further. If `p->header.flag == 0`, `jfs_readdir` will go to the next page, based on the `p->header.next` value. If that value is invalid, we will return from the function.
Now, let's check this out-of-bounds access. The code iterates through `stbl`, and accesses elements by `stbl[i]`. `p->header.nextindex` is up to 255. `stbl` is either `p->header.stbl` when `BT_ROOT` is set, or `(s8 *)&(p)->slot[(p)->header.stblindex]`. If it's the root directory, `stbl` is an 8-byte array. If `p->header.nextindex` is greater than 8, this will be an out-of-bounds read. However, `dtroot_t` is a union, and `dtroot_t` has `slot[9]`, so while it reads outside the scope of `stbl`, it's within `dtroot_t`.
If it's *not* the root directory, `stbl` is `p->slot[(p)->header.stblindex]`. Critically, `p->header.stblindex` is a `u8`, which means it can be up to 255. Now, `p->slot` is an array of 128 `dtslot` elements. If `p->header.stblindex` is 255, we are reading out of the bounds of this array. This offset is equivalent to 255 * 32, which is 8160. That's way past the end of the `dtpage_t` structure which is only 4096 bytes. Therefore, there's an out-of-bounds read! This is a vulnerability. This out-of-bounds read is not checked anywhere!
|
| 55/2 |
2026/05/13 01:19 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:fs/jfs/jfs_btree.h IncludeLines:true Name:BT_GETPAGE]
Results: map[SourceCode: SourceFile:]
|
| 56/2 |
2026/05/13 01:19 |
llm |
expert |
0m
Model:
Tokens:
input: 111805
output: 21
thoughts: 12
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience:
**Macro Maneuvers**
Okay, so I'm looking at this code, and my immediate reaction is, "Hang on a minute... `DT_GETPAGE`?". It hits me β that's a macro. My brain just automatically flagged it, which is the result of years of experience in this kind of stuff. I need to understand what this macro is doing before I can proceed. No more skimming for me, I need to know. Macros can be sneaky little devils, so I need to make sure I'm taking the correct path.
|
| 57/2 |
2026/05/13 01:20 |
tool |
grepper |
0m
Args: map[Expression:#define.*DT_GETPAGE]
Results: map[Output:fs/jfs/jfs_dtree.c=102=struct dtsplit {
--
fs/jfs/jfs_dtree.c-113-/* get page buffer for specified block address */
fs/jfs/jfs_dtree.c:114:#define DT_GETPAGE(IP, BN, MP, SIZE, P, RC) \
fs/jfs/jfs_dtree.c-115-do { \
]
|
| 58/2 |
2026/05/13 01:20 |
llm |
expert |
0m
Model:
Tokens:
input: 112095
output: 45
thoughts: 10
Thoughts: Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person:
**Initial Assessment: Decoding the `DT_GETPAGE` Directive**
Alright, let's dive into this. The mental trigger is that command: `DT_GETPAGE`. Immediately, my brain starts to parse that directive. Itβs obviously tied to dynamic data structures, most likely addressing the need to fetch a specific page or segment of data within a larger, potentially paged, memory space. The "DT" prefix screams "dynamic table" or "dynamic structure" in my head. I'm expecting this to be a low-level operation, possibly at the kernel or driver level, or at least deeply embedded within a memory management subsystem.
I'm picturing it being used in a virtual memory scenario, with pagination, or perhaps even in a system that implements data streaming and/or lazy loading. I'll need to consider context. is it user-mode or kernel-mode? is it a simple system, or a distributed system? I need to know which language, which architecture, and which memory model the code exists. Is it for general purpose data or memory mapped file access? My mind now starts to anticipate the underlying implementation details. I wonder whether it uses direct memory access, caching strategies, or if it is just a simple "read this page from disk to memory" function. I'm already looking at the nuances of performance implications and potential concurrency issues this operation might introduce. I'll need to consider how the "page" is defined, what the data structure behind it looks like, and how the requested page is indexed and retrieved. I need to be prepared to see complex algorithms regarding page faults, swap-in/swap-out events. So, let's start reading and see what it is actually about.
|
| 59/2 |
2026/05/13 01:20 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:fs/jfs/jfs_dtree.c IncludeLines:true Name:DT_GETPAGE]
Results: map[SourceCode: SourceFile:]
|
| 60/2 |
2026/05/13 01:20 |
llm |
expert |
0m
Model:
Tokens:
input: 112555
output: 20
thoughts: 31
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience:
**Analyzing a Potential Macro in jfs_dtree.c**
Okay, so I'm seeing something here that's immediately calling out as a potential macro. Given the context, my initial thought is to dive straight into `fs/jfs/jfs_dtree.c` and specifically around line 114. That's usually the best place to start when I encounter something that seems like it could be a macro definition or usage, in the JFS file system. I'll need to confirm if it's macro-related, or something else.
|
| 61/2 |
2026/05/13 01:21 |
tool |
grepper |
0m
Args: map[Expression:#define DT_GETPAGE]
Results: map[Output:fs/jfs/jfs_dtree.c=102=struct dtsplit {
--
fs/jfs/jfs_dtree.c-113-/* get page buffer for specified block address */
fs/jfs/jfs_dtree.c:114:#define DT_GETPAGE(IP, BN, MP, SIZE, P, RC) \
fs/jfs/jfs_dtree.c-115-do { \
]
|
| 62/2 |
2026/05/13 01:21 |
llm |
expert |
1m
Model:
Tokens:
input: 112869
output: 21
thoughts: 28
Thoughts: Okay, let's dive into this. Here's my take on those lines of code:
**Analyzing `fs/jfs/jfs_dtree.c` (Lines 110-130)**
Alright, so I'm looking at `fs/jfs/jfs_dtree.c`, specifically lines 110 through 130. Based on the file name and that section of the source, I'm going to assume this deals with direct node trees within the JFS file system, which probably means this is about manipulating the on-disk format of directory entries in the B-tree structure. Given the section number, I would expect it to be a key function within the directory entry management, probably dealing with adding, removing or modifying entries. I anticipate it deals with the logic involved in maintaining the index/tree structure for accessing data quickly. I should be looking for details about how the function handles things like splitting nodes, merging nodes, or even the allocation and deallocation of space within the tree. It's crucial for understanding how the file system efficiently manages large directories. I want to see how this function interacts with the higher-level directory API calls, and where it fits in the broader picture of JFS directory operations.
|
| 63/2 |
2026/05/13 01:22 |
tool |
grepper |
0m
Args: map[Expression:#define DT_GETPAGE.*]
Results: map[Output:fs/jfs/jfs_dtree.c=102=struct dtsplit {
--
fs/jfs/jfs_dtree.c-113-/* get page buffer for specified block address */
fs/jfs/jfs_dtree.c:114:#define DT_GETPAGE(IP, BN, MP, SIZE, P, RC) \
fs/jfs/jfs_dtree.c-115-do { \
]
|
| 64/2 |
2026/05/13 01:22 |
llm |
expert |
0m
Model:
Tokens:
input: 113307
output: 77
thoughts: 16
Thoughts: Okay, here's the summary, assuming I'm a seasoned professional and the text describes my thought process:
**Strategic File Exploration**
Alright, the task requires a deep dive into some file data. My immediate instinct is to leverage my existing expertise. I'm thinking, "I need to get in there and quickly understand the landscape." So, I'll go directly to using the more powerful tools, given the likely complexity of the dataset.
My approach will be targeted and efficient. I'm leaning towards employing `read-file` when the file size and structure are manageable, as I can examine the data with more clarity. But if the dataset is large or has complex nested structures, I know that's not the ideal tool. In that case, I will definitely opt for `grepper` or a similar context-aware tool, focusing my search and quickly identifying the relevant sections. Context is key, after all. I'll craft my searches carefully, considering keywords, patterns, and perhaps even leveraging regex, depending on the data type, to ensure I'm extracting only what I need and ignoring the rest. Itβs about being precise and getting to the core information quickly.
|
| 65/2 |
2026/05/13 01:23 |
tool |
grepper |
0m
Error:
Args: map[Expression:#define DT_GETPAGE.*\\n.*\\n.*\\n.*\\n.*\\n.*\\n.*\\n.*\\n.*\\n.*\\n.*\\n.*\\n.*\\n.*\\n.*\\n.*\\n.*\\n.*\\n.*\\n]
Results:
|
| 66/2 |
2026/05/13 01:23 |
llm |
expert |
0m
Model:
Tokens:
input: 113661
output: 20
thoughts: 19
Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience:
**Streamlining the Process**
Alright, so we're looking to locate occurrences of `DT_GETPAGE` within some files, right? The most straightforward approach that jumps to mind, given the likely context, is to leverage the standard Unix utilities. No need to overcomplicate things with some overly complex or custom script. My initial instinct is to go with `read-file` in conjunction with `grep`. Itβs simple, efficient, and readily available on any system I'm likely to be working on. We can quickly get the job done without overthinking or creating extra dependencies. This should be a quick and dirty way to get our answer.
|
| 67/2 |
2026/05/13 01:24 |
tool |
grepper |
0m
Args: map[Expression:#define DT_GETPAGE]
Results: map[Output:fs/jfs/jfs_dtree.c=102=struct dtsplit {
--
fs/jfs/jfs_dtree.c-113-/* get page buffer for specified block address */
fs/jfs/jfs_dtree.c:114:#define DT_GETPAGE(IP, BN, MP, SIZE, P, RC) \
fs/jfs/jfs_dtree.c-115-do { \
]
|
| 68/2 |
2026/05/13 01:24 |
llm |
expert |
0m
Model:
Tokens:
input: 113978
output: 21
thoughts: 29
Thoughts: Okay, let's dive into this. Here's my take on those lines of code, presented as if they were my own immediate thoughts:
**Analyzing `fs/jfs/jfs_dtree.c` - Lines 114-130**
Alright, I'm checking out lines 114 to 130 of `jfs_dtree.c`. This section's probably dealing with the directory tree structure within the JFS filesystem. Given the file and function context, I'd bet it's something about traversing or manipulating directory entriesβpotentially adding, removing, or looking them up. I'm focusing on the specifics of this section. I need to understand what this code block is specifically doing, likely in relation to the directory tree's organization. Is this part of the b-tree implementation? Or are they handling directory entry allocation/deallocation here? Is it perhaps related to a specific cache or indexing strategy? I need to look closely at the data structures and functions being called to deduce the exact functionality. And how it's interfacing with the wider JFS system's design. Let's see... looking at the context, this code block might be a subroutine for finding a directory entry in the dtree, or perhaps iterating all the entries in a node. It might even handle the logic for splitting or merging directory blocks, depending on how full they are. I expect to be picking out details about how the code determines the correct directory entry, handles errors, and perhaps ensures data consistency during operations on the file system.
|
| 69/2 |
2026/05/13 01:25 |
tool |
grepper |
0m
Args: map[Expression:#define DT_GETPAGE.*]
Results: map[Output:fs/jfs/jfs_dtree.c=102=struct dtsplit {
--
fs/jfs/jfs_dtree.c-113-/* get page buffer for specified block address */
fs/jfs/jfs_dtree.c:114:#define DT_GETPAGE(IP, BN, MP, SIZE, P, RC) \
fs/jfs/jfs_dtree.c-115-do { \
]
|
| 70/2 |
2026/05/13 01:25 |
llm |
expert |
0m
Model:
Tokens:
input: 114480
output: 20
thoughts: 21
Thoughts: Okay, here's the summary, expressed as though I'm the one having the thought process:
**Diving into the Code with Git Grep**
Right, let's see... I need to find where that particular macro is defined. Hmm, I recall it's associated with device tree handling, so I should be able to track it down fairly quickly. I'll use `git grep` β it's always the best first approach for this type of code archaeology. Let's start with `git grep`. Now, what was the macro again? Ah, yes, it's `#define DT_GETPAGE`. I'll also add a generous context window, just to make sure I don't miss any surrounding code that might be relevant; I'll use `-A 20` to show 20 lines after the match. This should give me enough information to understand how the macro is being used and where it's being defined within the codebase. Hopefully, this will lead me right to the heart of the matter.
|
| 71/2 |
2026/05/13 01:25 |
tool |
grepper |
0m
Args: map[Expression:#define DT_GETPAGE]
Results: map[Output:fs/jfs/jfs_dtree.c=102=struct dtsplit {
--
fs/jfs/jfs_dtree.c-113-/* get page buffer for specified block address */
fs/jfs/jfs_dtree.c:114:#define DT_GETPAGE(IP, BN, MP, SIZE, P, RC) \
fs/jfs/jfs_dtree.c-115-do { \
]
|
| 72/2 |
2026/05/13 01:25 |
llm |
expert |
0m
Model:
Tokens:
input: 114864
output: 27
thoughts: 9
Thoughts: Okay, here's the summary, expressed as my internal thought process:
**A Quick Realization**
Wait a second... all this complexity I was envisioning... all this parsing and elaborate processing... I can completely bypass it! I don't need to overthink this. I can simply read the damn file directly. This is much more straightforward.
|
| 73/2 |
2026/05/13 01:25 |
tool |
read-file |
0m
Args: map[File:fs/jfs/jfs_dtree.c]
Results: map[Contents:// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) International Business Machines Corp., 2000-2004
*/
/*
* jfs_dtree.c: directory B+-tree manager
*
* B+-tree with variable length key directory:
*
* each directory page is structured as an array of 32-byte
* directory entry slots initialized as a freelist
* to avoid search/compaction of free space at insertion.
* when an entry is inserted, a number of slots are allocated
* from the freelist as required to store variable length data
* of the entry; when the entry is deleted, slots of the entry
* are returned to freelist.
*
* leaf entry stores full name as key and file serial number
* (aka inode number) as data.
* internal/router entry stores sufffix compressed name
* as key and simple extent descriptor as data.
*
* each directory page maintains a sorted entry index table
* which stores the start slot index of sorted entries
* to allow binary search on the table.
*
* directory starts as a root/leaf page in on-disk inode
* inline data area.
* when it becomes full, it starts a leaf of a external extent
* of length of 1 block. each time the first leaf becomes full,
* it is extended rather than split (its size is doubled),
* until its length becoms 4 KBytes, from then the extent is split
* with new 4 Kbyte extent when it becomes full
* to reduce external fragmentation of small directories.
*
* blah, blah, blah, for linear scan of directory in pieces by
* readdir().
*
*
* case-insensitive directory file system
*
* names are stored in case-sensitive way in leaf entry.
* but stored, searched and compared in case-insensitive (uppercase) order
* (i.e., both search key and entry key are folded for search/compare):
* (note that case-sensitive order is BROKEN in storage, e.g.,
* sensitive: Ad, aB, aC, aD -> insensitive: aB, aC, aD, Ad
*
* entries which folds to the same key makes up a equivalent class
* whose members are stored as contiguous cluster (may cross page boundary)
* but whose order is arbitrary and acts as duplicate, e.g.,
* abc, Abc, aBc, abC)
*
* once match is found at leaf, requires scan forward/backward
* either for, in case-insensitive search, duplicate
* or for, in case-sensitive search, for exact match
*
* router entry must be created/stored in case-insensitive way
* in internal entry:
* (right most key of left page and left most key of right page
* are folded, and its suffix compression is propagated as router
* key in parent)
* (e.g., if split occurs <abc> and <aBd>, <ABD> trather than <aB>
* should be made the router key for the split)
*
* case-insensitive search:
*
* fold search key;
*
* case-insensitive search of B-tree:
* for internal entry, router key is already folded;
* for leaf entry, fold the entry key before comparison.
*
* if (leaf entry case-insensitive match found)
* if (next entry satisfies case-insensitive match)
* return EDUPLICATE;
* if (prev entry satisfies case-insensitive match)
* return EDUPLICATE;
* return match;
* else
* return no match;
*
* serialization:
* target directory inode lock is being held on entry/exit
* of all main directory service routines.
*
* log based recovery:
*/
#include <linux/fs.h>
#include <linux/quotaops.h>
#include <linux/slab.h>
#include "jfs_incore.h"
#include "jfs_superblock.h"
#include "jfs_filsys.h"
#include "jfs_metapage.h"
#include "jfs_dmap.h"
#include "jfs_unicode.h"
#include "jfs_debug.h"
/* dtree split parameter */
struct dtsplit {
struct metapage *mp;
s16 index;
s16 nslot;
struct component_name *key;
ddata_t *data;
struct pxdlist *pxdlist;
};
#define DT_PAGE(IP, MP) BT_PAGE(IP, MP, dtpage_t, i_dtroot)
/* get page buffer for specified block address */
#define DT_GETPAGE(IP, BN, MP, SIZE, P, RC) \
do { \
BT_GETPAGE(IP, BN, MP, dtpage_t, SIZE, P, RC, i_dtroot); \
if (!(RC)) { \
if (((P)->header.nextindex > \
(((BN) == 0) ? DTROOTMAXSLOT : (P)->header.maxslot)) || \
((BN) && (((P)->header.maxslot > DTPAGEMAXSLOT) || \
((P)->header.stblindex >= DTPAGEMAXSLOT)))) { \
BT_PUTPAGE(MP); \
jfs_error((IP)->i_sb, \
"DT_GETPAGE: dtree page corrupt\n"); \
MP = NULL; \
RC = -EIO; \
} \
} \
} while (0)
/* for consistency */
#define DT_PUTPAGE(MP) BT_PUTPAGE(MP)
#define DT_GETSEARCH(IP, LEAF, BN, MP, P, INDEX) \
BT_GETSEARCH(IP, LEAF, BN, MP, dtpage_t, P, INDEX, i_dtroot)
/*
* forward references
*/
static int dtSplitUp(tid_t tid, struct inode *ip,
struct dtsplit * split, struct btstack * btstack);
static int dtSplitPage(tid_t tid, struct inode *ip, struct dtsplit * split,
struct metapage ** rmpp, dtpage_t ** rpp, pxd_t * rxdp);
static int dtExtendPage(tid_t tid, struct inode *ip,
struct dtsplit * split, struct btstack * btstack);
static int dtSplitRoot(tid_t tid, struct inode *ip,
struct dtsplit * split, struct metapage ** rmpp);
static int dtDeleteUp(tid_t tid, struct inode *ip, struct metapage * fmp,
dtpage_t * fp, struct btstack * btstack);
static int dtRelink(tid_t tid, struct inode *ip, dtpage_t * p);
static int dtReadFirst(struct inode *ip, struct btstack * btstack);
static int dtReadNext(struct inode *ip,
loff_t * offset, struct btstack * btstack);
static int dtCompare(struct component_name * key, dtpage_t * p, int si);
static int ciCompare(struct component_name * key, dtpage_t * p, int si,
int flag);
static void dtGetKey(dtpage_t * p, int i, struct component_name * key,
int flag);
static int ciGetLeafPrefixKey(dtpage_t * lp, int li, dtpage_t * rp,
int ri, struct component_name * key, int flag);
static void dtInsertEntry(dtpage_t * p, int index, struct component_name * key,
ddata_t * data, struct dt_lock **);
static void dtMoveEntry(dtpage_t * sp, int si, dtpage_t * dp,
struct dt_lock ** sdtlock, struct dt_lock ** ddtlock,
int do_index);
static void dtDeleteEntry(dtpage_t * p, int fi, struct dt_lock ** dtlock);
static void dtTruncateEntry(dtpage_t * p, int ti, struct dt_lock ** dtlock);
static void dtLinelockFreelist(dtpage_t * p, int m, struct dt_lock ** dtlock);
#define ciToUpper(c) UniStrupr((c)->name)
/*
* read_index_page()
*
* Reads a page of a directory's index table.
* Having metadata mapped into the directory inode's address space
* presents a multitude of problems. We avoid this by mapping to
* the absolute address space outside of the *_metapage routines
*/
static struct metapage *read_index_page(struct inode *inode, s64 blkno)
{
int rc;
s64 xaddr;
int xflag;
s32 xlen;
rc = xtLookup(inode, blkno, 1, &xflag, &xaddr, &xlen, 1);
if (rc || (xaddr == 0))
return NULL;
return read_metapage(inode, xaddr, PSIZE, 1);
}
/*
* get_index_page()
*
* Same as get_index_page(), but get's a new page without reading
*/
static struct metapage *get_index_page(struct inode *inode, s64 blkno)
{
int rc;
s64 xaddr;
int xflag;
s32 xlen;
rc = xtLookup(inode, blkno, 1, &xflag, &xaddr, &xlen, 1);
if (rc || (xaddr == 0))
return NULL;
return get_metapage(inode, xaddr, PSIZE, 1);
}
/*
* find_index()
*
* Returns dtree page containing directory table entry for specified
* index and pointer to its entry.
*
* mp must be released by caller.
*/
static struct dir_table_slot *find_index(struct inode *ip, u32 index,
struct metapage ** mp, s64 *lblock)
{
struct jfs_inode_info *jfs_ip = JFS_IP(ip);
s64 blkno;
s64 offset;
int page_offset;
struct dir_table_slot *slot;
static int maxWarnings = 10;
if (index < 2) {
if (maxWarnings) {
jfs_warn("find_entry called with index = %d", index);
maxWarnings--;
}
return NULL;
}
if (index >= jfs_ip->next_index) {
jfs_warn("find_entry called with index >= next_index");
return NULL;
}
if (jfs_dirtable_inline(ip)) {
/*
* Inline directory table
*/
*mp = NULL;
slot = &jfs_ip->i_dirtable[index - 2];
} else {
offset = (index - 2) * sizeof(struct dir_table_slot);
page_offset = offset & (PSIZE - 1);
blkno = ((offset + 1) >> L2PSIZE) <<
JFS_SBI(ip->i_sb)->l2nbperpage;
if (*mp && (*lblock != blkno)) {
release_metapage(*mp);
*mp = NULL;
}
if (!(*mp)) {
*lblock = blkno;
*mp = read_index_page(ip, blkno);
}
if (!(*mp)) {
jfs_err("free_index: error reading directory table");
return NULL;
}
slot =
(struct dir_table_slot *) ((char *) (*mp)->data +
page_offset);
}
return slot;
}
static inline void lock_index(tid_t tid, struct inode *ip, struct metapage * mp,
u32 index)
{
struct tlock *tlck;
struct linelock *llck;
struct lv *lv;
tlck = txLock(tid, ip, mp, tlckDATA);
llck = (struct linelock *) tlck->lock;
if (llck->index >= llck->maxcnt)
llck = txLinelock(llck);
lv = &llck->lv[llck->index];
/*
* Linelock slot size is twice the size of directory table
* slot size. 512 entries per page.
*/
lv->offset = ((index - 2) & 511) >> 1;
lv->length = 1;
llck->index++;
}
/*
* add_index()
*
* Adds an entry to the directory index table. This is used to provide
* each directory entry with a persistent index in which to resume
* directory traversals
*/
static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot)
{
struct super_block *sb = ip->i_sb;
struct jfs_sb_info *sbi = JFS_SBI(sb);
struct jfs_inode_info *jfs_ip = JFS_IP(ip);
u64 blkno;
struct dir_table_slot *dirtab_slot;
u32 index;
struct linelock *llck;
struct lv *lv;
struct metapage *mp;
s64 offset;
uint page_offset;
struct tlock *tlck;
s64 xaddr;
ASSERT(DO_INDEX(ip));
if (jfs_ip->next_index < 2) {
jfs_warn("add_index: next_index = %d. Resetting!",
jfs_ip->next_index);
jfs_ip->next_index = 2;
}
index = jfs_ip->next_index++;
if (index <= MAX_INLINE_DIRTABLE_ENTRY) {
/*
* i_size reflects size of index table, or 8 bytes per entry.
*/
ip->i_size = (loff_t) (index - 1) << 3;
/*
* dir table fits inline within inode
*/
dirtab_slot = &jfs_ip->i_dirtable[index-2];
dirtab_slot->flag = DIR_INDEX_VALID;
dirtab_slot->slot = slot;
DTSaddress(dirtab_slot, bn);
set_cflag(COMMIT_Dirtable, ip);
return index;
}
if (index == (MAX_INLINE_DIRTABLE_ENTRY + 1)) {
struct dir_table_slot temp_table[12];
/*
* It's time to move the inline table to an external
* page and begin to build the xtree
*/
if (dquot_alloc_block(ip, sbi->nbperpage))
goto clean_up;
if (dbAlloc(ip, 0, sbi->nbperpage, &xaddr)) {
dquot_free_block(ip, sbi->nbperpage);
goto clean_up;
}
/*
* Save the table, we're going to overwrite it with the
* xtree root
*/
memcpy(temp_table, &jfs_ip->i_dirtable, sizeof(temp_table));
/*
* Initialize empty x-tree
*/
xtInitRoot(tid, ip);
/*
* Add the first block to the xtree
*/
if (xtInsert(tid, ip, 0, 0, sbi->nbperpage, &xaddr, 0)) {
/* This really shouldn't fail */
jfs_warn("add_index: xtInsert failed!");
memcpy(&jfs_ip->i_dirtable, temp_table,
sizeof (temp_table));
dbFree(ip, xaddr, sbi->nbperpage);
dquot_free_block(ip, sbi->nbperpage);
goto clean_up;
}
ip->i_size = PSIZE;
mp = get_index_page(ip, 0);
if (!mp) {
jfs_err("add_index: get_metapage failed!");
xtTruncate(tid, ip, 0, COMMIT_PWMAP);
memcpy(&jfs_ip->i_dirtable, temp_table,
sizeof (temp_table));
goto clean_up;
}
tlck = txLock(tid, ip, mp, tlckDATA);
llck = (struct linelock *) & tlck->lock;
ASSERT(llck->index == 0);
lv = &llck->lv[0];
lv->offset = 0;
lv->length = 6; /* tlckDATA slot size is 16 bytes */
llck->index++;
memcpy(mp->data, temp_table, sizeof(temp_table));
mark_metapage_dirty(mp);
release_metapage(mp);
/*
* Logging is now directed by xtree tlocks
*/
clear_cflag(COMMIT_Dirtable, ip);
}
offset = (index - 2) * sizeof(struct dir_table_slot);
page_offset = offset & (PSIZE - 1);
blkno = ((offset + 1) >> L2PSIZE) << sbi->l2nbperpage;
if (page_offset == 0) {
/*
* This will be the beginning of a new page
*/
xaddr = 0;
if (xtInsert(tid, ip, 0, blkno, sbi->nbperpage, &xaddr, 0)) {
jfs_warn("add_index: xtInsert failed!");
goto clean_up;
}
ip->i_size += PSIZE;
if ((mp = get_index_page(ip, blkno)))
memset(mp->data, 0, PSIZE); /* Just looks better */
else
xtTruncate(tid, ip, offset, COMMIT_PWMAP);
} else
mp = read_index_page(ip, blkno);
if (!mp) {
jfs_err("add_index: get/read_metapage failed!");
goto clean_up;
}
lock_index(tid, ip, mp, index);
dirtab_slot =
(struct dir_table_slot *) ((char *) mp->data + page_offset);
dirtab_slot->flag = DIR_INDEX_VALID;
dirtab_slot->slot = slot;
DTSaddress(dirtab_slot, bn);
mark_metapage_dirty(mp);
release_metapage(mp);
return index;
clean_up:
jfs_ip->next_index--;
return 0;
}
/*
* free_index()
*
* Marks an entry to the directory index table as free.
*/
static void free_index(tid_t tid, struct inode *ip, u32 index, u32 next)
{
struct dir_table_slot *dirtab_slot;
s64 lblock;
struct metapage *mp = NULL;
dirtab_slot = find_index(ip, index, &mp, &lblock);
if (!dirtab_slot)
return;
dirtab_slot->flag = DIR_INDEX_FREE;
dirtab_slot->slot = dirtab_slot->addr1 = 0;
dirtab_slot->addr2 = cpu_to_le32(next);
if (mp) {
lock_index(tid, ip, mp, index);
mark_metapage_dirty(mp);
release_metapage(mp);
} else
set_cflag(COMMIT_Dirtable, ip);
}
/*
* modify_index()
*
* Changes an entry in the directory index table
*/
static void modify_index(tid_t tid, struct inode *ip, u32 index, s64 bn,
int slot, struct metapage ** mp, s64 *lblock)
{
struct dir_table_slot *dirtab_slot;
dirtab_slot = find_index(ip, index, mp, lblock);
if (!dirtab_slot)
return;
DTSaddress(dirtab_slot, bn);
dirtab_slot->slot = slot;
if (*mp) {
lock_index(tid, ip, *mp, index);
mark_metapage_dirty(*mp);
} else
set_cflag(COMMIT_Dirtable, ip);
}
/*
* read_index()
*
* reads a directory table slot
*/
static int read_index(struct inode *ip, u32 index,
struct dir_table_slot * dirtab_slot)
{
s64 lblock;
struct metapage *mp = NULL;
struct dir_table_slot *slot;
slot = find_index(ip, index, &mp, &lblock);
if (!slot) {
return -EIO;
}
memcpy(dirtab_slot, slot, sizeof(struct dir_table_slot));
if (mp)
release_metapage(mp);
return 0;
}
/*
* dtSearch()
*
* function:
* Search for the entry with specified key
*
* parameter:
*
* return: 0 - search result on stack, leaf page pinned;
* errno - I/O error
*/
int dtSearch(struct inode *ip, struct component_name * key, ino_t * data,
struct btstack * btstack, int flag)
{
int rc = 0;
int cmp = 1; /* init for empty page */
s64 bn;
struct metapage *mp;
dtpage_t *p;
s8 *stbl;
int base, index, lim;
struct btframe *btsp;
pxd_t *pxd;
int psize = 288; /* initial in-line directory */
ino_t inumber;
struct component_name ciKey;
struct super_block *sb = ip->i_sb;
ciKey.name = kmalloc_array(JFS_NAME_MAX + 1, sizeof(wchar_t),
GFP_NOFS);
if (!ciKey.name) {
rc = -ENOMEM;
goto dtSearch_Exit2;
}
/* uppercase search key for c-i directory */
UniStrcpy(ciKey.name, key->name);
ciKey.namlen = key->namlen;
/* only uppercase if case-insensitive support is on */
if ((JFS_SBI(sb)->mntflag & JFS_OS2) == JFS_OS2) {
ciToUpper(&ciKey);
}
BT_CLR(btstack); /* reset stack */
/* init level count for max pages to split */
btstack->nsplit = 1;
/*
* search down tree from root:
*
* between two consecutive entries of <Ki, Pi> and <Kj, Pj> of
* internal page, child page Pi contains entry with k, Ki <= K < Kj.
*
* if entry with search key K is not found
* internal page search find the entry with largest key Ki
* less than K which point to the child page to search;
* leaf page search find the entry with smallest key Kj
* greater than K so that the returned index is the position of
* the entry to be shifted right for insertion of new entry.
* for empty tree, search key is greater than any key of the tree.
*
* by convention, root bn = 0.
*/
for (bn = 0;;) {
/* get/pin the page to search */
DT_GETPAGE(ip, bn, mp, psize, p, rc);
if (rc)
goto dtSearch_Exit1;
/* get sorted entry table of the page */
stbl = DT_GETSTBL(p);
/*
* binary search with search key K on the current page.
*/
for (base = 0, lim = p->header.nextindex; lim; lim >>= 1) {
index = base + (lim >> 1);
if (stbl[index] < 0) {
rc = -EIO;
goto out;
}
if (p->header.flag & BT_LEAF) {
/* uppercase leaf name to compare */
cmp =
ciCompare(&ciKey, p, stbl[index],
JFS_SBI(sb)->mntflag);
} else {
/* router key is in uppercase */
cmp = dtCompare(&ciKey, p, stbl[index]);
}
if (cmp == 0) {
/*
* search hit
*/
/* search hit - leaf page:
* return the entry found
*/
if (p->header.flag & BT_LEAF) {
inumber = le32_to_cpu(
((struct ldtentry *) & p->slot[stbl[index]])->inumber);
/*
* search for JFS_LOOKUP
*/
if (flag == JFS_LOOKUP) {
*data = inumber;
rc = 0;
goto out;
}
/*
* search for JFS_CREATE
*/
if (flag == JFS_CREATE) {
*data = inumber;
rc = -EEXIST;
goto out;
}
/*
* search for JFS_REMOVE or JFS_RENAME
*/
if ((flag == JFS_REMOVE ||
flag == JFS_RENAME) &&
*data != inumber) {
rc = -ESTALE;
goto out;
}
/*
* JFS_REMOVE|JFS_FINDDIR|JFS_RENAME
*/
/* save search result */
*data = inumber;
btsp = btstack->top;
btsp->bn = bn;
btsp->index = index;
btsp->mp = mp;
rc = 0;
goto dtSearch_Exit1;
}
/* search hit - internal page:
* descend/search its child page
*/
goto getChild;
}
if (cmp > 0) {
base = index + 1;
--lim;
}
}
/*
* search miss
*
* base is the smallest index with key (Kj) greater than
* search key (K) and may be zero or (maxindex + 1) index.
*/
/*
* search miss - leaf page
*
* return location of entry (base) where new entry with
* search key K is to be inserted.
*/
if (p->header.flag & BT_LEAF) {
/*
* search for JFS_LOOKUP, JFS_REMOVE, or JFS_RENAME
*/
if (flag == JFS_LOOKUP || flag == JFS_REMOVE ||
flag == JFS_RENAME) {
rc = -ENOENT;
goto out;
}
/*
* search for JFS_CREATE|JFS_FINDDIR:
*
* save search result
*/
*data = 0;
btsp = btstack->top;
btsp->bn = bn;
btsp->index = base;
btsp->mp = mp;
rc = 0;
goto dtSearch_Exit1;
}
/*
* search miss - internal page
*
* if base is non-zero, decrement base by one to get the parent
* entry of the child page to search.
*/
index = base ? base - 1 : base;
/*
* go down to child page
*/
getChild:
/* update max. number of pages to split */
if (BT_STACK_FULL(btstack)) {
/* Something's corrupted, mark filesystem dirty so
* chkdsk will fix it.
*/
jfs_error(sb, "stack overrun!\n");
BT_STACK_DUMP(btstack);
rc = -EIO;
goto out;
}
btstack->nsplit++;
/* push (bn, index) of the parent page/entry */
BT_PUSH(btstack, bn, index);
/* get the child page block number */
pxd = (pxd_t *) & p->slot[stbl[index]];
bn = addressPXD(pxd);
psize = lengthPXD(pxd) << JFS_SBI(ip->i_sb)->l2bsize;
/* unpin the parent page */
DT_PUTPAGE(mp);
}
out:
DT_PUTPAGE(mp);
dtSearch_Exit1:
kfree(ciKey.name);
dtSearch_Exit2:
return rc;
}
/*
* dtInsert()
*
* function: insert an entry to directory tree
*
* parameter:
*
* return: 0 - success;
* errno - failure;
*/
int dtInsert(tid_t tid, struct inode *ip,
struct component_name * name, ino_t * fsn, struct btstack * btstack)
{
int rc = 0;
struct metapage *mp; /* meta-page buffer */
dtpage_t *p; /* base B+-tree index page */
s64 bn;
int index;
struct dtsplit split; /* split information */
ddata_t data;
struct dt_lock *dtlck;
int n;
struct tlock *tlck;
struct lv *lv;
/*
* retrieve search result
*
* dtSearch() returns (leaf page pinned, index at which to insert).
* n.b. dtSearch() may return index of (maxindex + 1) of
* the full page.
*/
DT_GETSEARCH(ip, btstack->top, bn, mp, p, index);
if (p->header.freelist == 0)
return -EINVAL;
/*
* insert entry for new key
*/
if (DO_INDEX(ip)) {
if (JFS_IP(ip)->next_index == DIREND) {
DT_PUTPAGE(mp);
return -EMLINK;
}
n = NDTLEAF(name->namlen);
data.leaf.tid = tid;
data.leaf.ip = ip;
} else {
n = NDTLEAF_LEGACY(name->namlen);
data.leaf.ip = NULL; /* signifies legacy directory format */
}
data.leaf.ino = *fsn;
/*
* leaf page does not have enough room for new entry:
*
* extend/split the leaf page;
*
* dtSplitUp() will insert the entry and unpin the leaf page.
*/
if (n > p->header.freecnt) {
split.mp = mp;
split.index = index;
split.nslot = n;
split.key = name;
split.data = &data;
rc = dtSplitUp(tid, ip, &split, btstack);
return rc;
}
/*
* leaf page does have enough room for new entry:
*
* insert the new data entry into the leaf page;
*/
BT_MARK_DIRTY(mp, ip);
/*
* acquire a transaction lock on the leaf page
*/
tlck = txLock(tid, ip, mp, tlckDTREE | tlckENTRY);
dtlck = (struct dt_lock *) & tlck->lock;
ASSERT(dtlck->index == 0);
lv = & dtlck->lv[0];
/* linelock header */
lv->offset = 0;
lv->length = 1;
dtlck->index++;
dtInsertEntry(p, index, name, &data, &dtlck);
/* linelock stbl of non-root leaf page */
if (!(p->header.flag & BT_ROOT)) {
if (dtlck->index >= dtlck->maxcnt)
dtlck = (struct dt_lock *) txLinelock(dtlck);
lv = & dtlck->lv[dtlck->index];
n = index >> L2DTSLOTSIZE;
lv->offset = p->header.stblindex + n;
lv->length =
((p->header.nextindex - 1) >> L2DTSLOTSIZE) - n + 1;
dtlck->index++;
}
/* unpin the leaf page */
DT_PUTPAGE(mp);
return 0;
}
/*
* dtSplitUp()
*
* function: propagate insertion bottom up;
*
* parameter:
*
* return: 0 - success;
* errno - failure;
* leaf page unpinned;
*/
static int dtSplitUp(tid_t tid,
struct inode *ip, struct dtsplit * split, struct btstack * btstack)
{
struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb);
int rc = 0;
struct metapage *smp;
dtpage_t *sp; /* split page */
struct metapage *rmp;
dtpage_t *rp; /* new right page split from sp */
pxd_t rpxd; /* new right page extent descriptor */
struct metapage *lmp;
dtpage_t *lp; /* left child page */
int skip; /* index of entry of insertion */
struct btframe *parent; /* parent page entry on traverse stack */
s64 xaddr, nxaddr;
int xlen, xsize;
struct pxdlist pxdlist;
pxd_t *pxd;
struct component_name key = { 0, NULL };
ddata_t *data = split->data;
int n;
struct dt_lock *dtlck;
struct tlock *tlck;
struct lv *lv;
int quota_allocation = 0;
/* get split page */
smp = split->mp;
sp = DT_PAGE(ip, smp);
key.name = kmalloc_array(JFS_NAME_MAX + 2, sizeof(wchar_t), GFP_NOFS);
if (!key.name) {
DT_PUTPAGE(smp);
rc = -ENOMEM;
goto dtSplitUp_Exit;
}
/*
* split leaf page
*
* The split routines insert the new entry, and
* acquire txLock as appropriate.
*/
/*
* split root leaf page:
*/
if (sp->header.flag & BT_ROOT) {
/*
* allocate a single extent child page
*/
xlen = 1;
n = sbi->bsize >> L2DTSLOTSIZE;
n -= (n + 31) >> L2DTSLOTSIZE; /* stbl size */
n -= DTROOTMAXSLOT - sp->header.freecnt; /* header + entries */
if (n <= split->nslot)
xlen++;
if ((rc = dbAlloc(ip, 0, (s64) xlen, &xaddr))) {
DT_PUTPAGE(smp);
goto freeKeyName;
}
pxdlist.maxnpxd = 1;
pxdlist.npxd = 0;
pxd = &pxdlist.pxd[0];
PXDaddress(pxd, xaddr);
PXDlength(pxd, xlen);
split->pxdlist = &pxdlist;
rc = dtSplitRoot(tid, ip, split, &rmp);
if (rc)
dbFree(ip, xaddr, xlen);
else
DT_PUTPAGE(rmp);
DT_PUTPAGE(smp);
if (!DO_INDEX(ip))
ip->i_size = xlen << sbi->l2bsize;
goto freeKeyName;
}
/*
* extend first leaf page
*
* extend the 1st extent if less than buffer page size
* (dtExtendPage() reurns leaf page unpinned)
*/
pxd = &sp->header.self;
xlen = lengthPXD(pxd);
xsize = xlen << sbi->l2bsize;
if (xsize < PSIZE) {
xaddr = addressPXD(pxd);
n = xsize >> L2DTSLOTSIZE;
n -= (n + 31) >> L2DTSLOTSIZE; /* stbl size */
if ((n + sp->header.freecnt) <= split->nslot)
n = xlen + (xlen << 1);
else
n = xlen;
/* Allocate blocks to quota. */
rc = dquot_alloc_block(ip, n);
if (rc)
goto extendOut;
quota_allocation += n;
if ((rc = dbReAlloc(sbi->ipbmap, xaddr, (s64) xlen,
(s64) n, &nxaddr)))
goto extendOut;
pxdlist.maxnpxd = 1;
pxdlist.npxd = 0;
pxd = &pxdlist.pxd[0];
PXDaddress(pxd, nxaddr);
PXDlength(pxd, xlen + n);
split->pxdlist = &pxdlist;
if ((rc = dtExtendPage(tid, ip, split, btstack))) {
nxaddr = addressPXD(pxd);
if (xaddr != nxaddr) {
/* free relocated extent */
xlen = lengthPXD(pxd);
dbFree(ip, nxaddr, (s64) xlen);
} else {
/* free extended delta */
xlen = lengthPXD(pxd) - n;
xaddr = addressPXD(pxd) + xlen;
dbFree(ip, xaddr, (s64) n);
}
} else if (!DO_INDEX(ip))
ip->i_size = lengthPXD(pxd) << sbi->l2bsize;
extendOut:
DT_PUTPAGE(smp);
goto freeKeyName;
}
/*
* split leaf page <sp> into <sp> and a new right page <rp>.
*
* return <rp> pinned and its extent descriptor <rpxd>
*/
/*
* allocate new directory page extent and
* new index page(s) to cover page split(s)
*
* allocation hint: ?
*/
n = btstack->nsplit;
pxdlist.maxnpxd = pxdlist.npxd = 0;
xlen = sbi->nbperpage;
for (pxd = pxdlist.pxd; n > 0; n--, pxd++) {
if ((rc = dbAlloc(ip, 0, (s64) xlen, &xaddr)) == 0) {
PXDaddress(pxd, xaddr);
PXDlength(pxd, xlen);
pxdlist.maxnpxd++;
continue;
}
DT_PUTPAGE(smp);
/* undo allocation */
goto splitOut;
}
split->pxdlist = &pxdlist;
if ((rc = dtSplitPage(tid, ip, split, &rmp, &rp, &rpxd))) {
DT_PUTPAGE(smp);
/* undo allocation */
goto splitOut;
}
if (!DO_INDEX(ip))
ip->i_size += PSIZE;
/*
* propagate up the router entry for the leaf page just split
*
* insert a router entry for the new page into the parent page,
* propagate the insert/split up the tree by walking back the stack
* of (bn of parent page, index of child page entry in parent page)
* that were traversed during the search for the page that split.
*
* the propagation of insert/split up the tree stops if the root
* splits or the page inserted into doesn't have to split to hold
* the new entry.
*
* the parent entry for the split page remains the same, and
* a new entry is inserted at its right with the first key and
* block number of the new right page.
*
* There are a maximum of 4 pages pinned at any time:
* two children, left parent and right parent (when the parent splits).
* keep the child pages pinned while working on the parent.
* make sure that all pins are released at exit.
*/
while ((parent = BT_POP(btstack)) != NULL) {
/* parent page specified by stack frame <parent> */
/* keep current child pages (<lp>, <rp>) pinned */
lmp = smp;
lp = sp;
/*
* insert router entry in parent for new right child page <rp>
*/
/* get the parent page <sp> */
DT_GETPAGE(ip, parent->bn, smp, PSIZE, sp, rc);
if (rc) {
DT_PUTPAGE(lmp);
DT_PUTPAGE(rmp);
goto splitOut;
}
/*
* The new key entry goes ONE AFTER the index of parent entry,
* because the split was to the right.
*/
skip = parent->index + 1;
/*
* compute the key for the router entry
*
* key suffix compression:
* for internal pages that have leaf pages as children,
* retain only what's needed to distinguish between
* the new entry and the entry on the page to its left.
* If the keys compare equal, retain the entire key.
*
* note that compression is performed only at computing
* router key at the lowest internal level.
* further compression of the key between pairs of higher
* level internal pages loses too much information and
* the search may fail.
* (e.g., two adjacent leaf pages of {a, ..., x} {xx, ...,}
* results in two adjacent parent entries (a)(xx).
* if split occurs between these two entries, and
* if compression is applied, the router key of parent entry
* of right page (x) will divert search for x into right
* subtree and miss x in the left subtree.)
*
* the entire key must be retained for the next-to-leftmost
* internal key at any level of the tree, or search may fail
* (e.g., ?)
*/
switch (rp->header.flag & BT_TYPE) {
case BT_LEAF:
/*
* compute the length of prefix for suffix compression
* between last entry of left page and first entry
* of right page
*/
if ((sp->header.flag & BT_ROOT && skip > 1) ||
sp->header.prev != 0 || skip > 1) {
/* compute uppercase router prefix key */
rc = ciGetLeafPrefixKey(lp,
lp->header.nextindex-1,
rp, 0, &key,
sbi->mntflag);
if (rc) {
DT_PUTPAGE(lmp);
DT_PUTPAGE(rmp);
DT_PUTPAGE(smp);
goto splitOut;
}
} else {
/* next to leftmost entry of
lowest internal level */
/* compute uppercase router key */
dtGetKey(rp, 0, &key, sbi->mntflag);
key.name[key.namlen] = 0;
if ((sbi->mntflag & JFS_OS2) == JFS_OS2)
ciToUpper(&key);
}
n = NDTINTERNAL(key.namlen);
break;
case BT_INTERNAL:
dtGetKey(rp, 0, &key, sbi->mntflag);
n = NDTINTERNAL(key.namlen);
break;
default:
jfs_err("dtSplitUp(): UFO!");
break;
}
/* unpin left child page */
DT_PUTPAGE(lmp);
/*
* compute the data for the router entry
*/
data->xd = rpxd; /* child page xd */
/*
* parent page is full - split the parent page
*/
if (n > sp->header.freecnt) {
/* init for parent page split */
split->mp = smp;
split->index = skip; /* index at insert */
split->nslot = n;
split->key = &key;
/* split->data = data; */
/* unpin right child page */
DT_PUTPAGE(rmp);
/* The split routines insert the new entry,
* acquire txLock as appropriate.
* return <rp> pinned and its block number <rbn>.
*/
rc = (sp->header.flag & BT_ROOT) ?
dtSplitRoot(tid, ip, split, &rmp) :
dtSplitPage(tid, ip, split, &rmp, &rp, &rpxd);
if (rc) {
DT_PUTPAGE(smp);
goto splitOut;
}
/* smp and rmp are pinned */
}
/*
* parent page is not full - insert router entry in parent page
*/
else {
BT_MARK_DIRTY(smp, ip);
/*
* acquire a transaction lock on the parent page
*/
tlck = txLock(tid, ip, smp, tlckDTREE | tlckENTRY);
dtlck = (struct dt_lock *) & tlck->lock;
ASSERT(dtlck->index == 0);
lv = & dtlck->lv[0];
/* linelock header */
lv->offset = 0;
lv->length = 1;
dtlck->index++;
/* linelock stbl of non-root parent page */
if (!(sp->header.flag & BT_ROOT)) {
lv++;
n = skip >> L2DTSLOTSIZE;
lv->offset = sp->header.stblindex + n;
lv->length =
((sp->header.nextindex -
1) >> L2DTSLOTSIZE) - n + 1;
dtlck->index++;
}
dtInsertEntry(sp, skip, &key, data, &dtlck);
/* exit propagate up */
break;
}
}
/* unpin current split and its right page */
DT_PUTPAGE(smp);
DT_PUTPAGE(rmp);
/*
* free remaining extents allocated for split
*/
splitOut:
n = pxdlist.npxd;
pxd = &pxdlist.pxd[n];
for (; n < pxdlist.maxnpxd; n++, pxd++)
dbFree(ip, addressPXD(pxd), (s64) lengthPXD(pxd));
freeKeyName:
kfree(key.name);
/* Rollback quota allocation */
if (rc && quota_allocation)
dquot_free_block(ip, quota_allocation);
dtSplitUp_Exit:
return rc;
}
/*
* dtSplitPage()
*
* function: Split a non-root page of a btree.
*
* parameter:
*
* return: 0 - success;
* errno - failure;
* return split and new page pinned;
*/
static int dtSplitPage(tid_t tid, struct inode *ip, struct dtsplit * split,
struct metapage ** rmpp, dtpage_t ** rpp, pxd_t * rpxdp)
{
int rc = 0;
struct metapage *smp;
dtpage_t *sp;
struct metapage *rmp;
dtpage_t *rp; /* new right page allocated */
s64 rbn; /* new right page block number */
struct metapage *mp;
dtpage_t *p;
s64 nextbn;
struct pxdlist *pxdlist;
pxd_t *pxd;
int skip, nextindex, half, left, nxt, off, si;
struct ldtentry *ldtentry;
struct idtentry *idtentry;
u8 *stbl;
struct dtslot *f;
int fsi, stblsize;
int n;
struct dt_lock *sdtlck, *rdtlck;
struct tlock *tlck;
struct dt_lock *dtlck;
struct lv *slv, *rlv, *lv;
/* get split page */
smp = split->mp;
sp = DT_PAGE(ip, smp);
/*
* allocate the new right page for the split
*/
pxdlist = split->pxdlist;
pxd = &pxdlist->pxd[pxdlist->npxd];
pxdlist->npxd++;
rbn = addressPXD(pxd);
rmp = get_metapage(ip, rbn, PSIZE, 1);
if (rmp == NULL)
return -EIO;
/* Allocate blocks to quota. */
rc = dquot_alloc_block(ip, lengthPXD(pxd));
if (rc) {
release_metapage(rmp);
return rc;
}
jfs_info("dtSplitPage: ip:0x%p smp:0x%p rmp:0x%p", ip, smp, rmp);
BT_MARK_DIRTY(rmp, ip);
/*
* acquire a transaction lock on the new right page
*/
tlck = txLock(tid, ip, rmp, tlckDTREE | tlckNEW);
rdtlck = (struct dt_lock *) & tlck->lock;
rp = (dtpage_t *) rmp->data;
*rpp = rp;
rp->header.self = *pxd;
BT_MARK_DIRTY(smp, ip);
/*
* acquire a transaction lock on the split page
*
* action:
*/
tlck = txLock(tid, ip, smp, tlckDTREE | tlckENTRY);
sdtlck = (struct dt_lock *) & tlck->lock;
/* linelock header of split page */
ASSERT(sdtlck->index == 0);
slv = & sdtlck->lv[0];
slv->offset = 0;
slv->length = 1;
sdtlck->index++;
/*
* initialize/update sibling pointers between sp and rp
*/
nextbn = le64_to_cpu(sp->header.next);
rp->header.next = cpu_to_le64(nextbn);
rp->header.prev = cpu_to_le64(addressPXD(&sp->header.self));
sp->header.next = cpu_to_le64(rbn);
/*
* initialize new right page
*/
rp->header.flag = sp->header.flag;
/* compute sorted entry table at start of extent data area */
rp->header.nextindex = 0;
rp->header.stblindex = 1;
n = PSIZE >> L2DTSLOTSIZE;
rp->header.maxslot = n;
stblsize = (n + 31) >> L2DTSLOTSIZE; /* in unit of slot */
/* init freelist */
fsi = rp->header.stblindex + stblsize;
rp->header.freelist = fsi;
rp->header.freecnt = rp->header.maxslot - fsi;
/*
* sequential append at tail: append without split
*
* If splitting the last page on a level because of appending
* a entry to it (skip is maxentry), it's likely that the access is
* sequential. Adding an empty page on the side of the level is less
* work and can push the fill factor much higher than normal.
* If we're wrong it's no big deal, we'll just do the split the right
* way next time.
* (It may look like it's equally easy to do a similar hack for
* reverse sorted data, that is, split the tree left,
* but it's not. Be my guest.)
*/
if (nextbn == 0 && split->index == sp->header.nextindex) {
/* linelock header + stbl (first slot) of new page */
rlv = & rdtlck->lv[rdtlck->index];
rlv->offset = 0;
rlv->length = 2;
rdtlck->index++;
/*
* initialize freelist of new right page
*/
f = &rp->slot[fsi];
for (fsi++; fsi < rp->header.maxslot; f++, fsi++)
f->next = fsi;
f->next = -1;
/* insert entry at the first entry of the new right page */
dtInsertEntry(rp, 0, split->key, split->data, &rdtlck);
goto out;
}
/*
* non-sequential insert (at possibly middle page)
*/
/*
* update prev pointer of previous right sibling page;
*/
if (nextbn != 0) {
DT_GETPAGE(ip, nextbn, mp, PSIZE, p, rc);
if (rc) {
discard_metapage(rmp);
return rc;
}
BT_MARK_DIRTY(mp, ip);
/*
* acquire a transaction lock on the next page
*/
tlck = txLock(tid, ip, mp, tlckDTREE | tlckRELINK);
jfs_info("dtSplitPage: tlck = 0x%p, ip = 0x%p, mp=0x%p",
tlck, ip, mp);
dtlck = (struct dt_lock *) & tlck->lock;
/* linelock header of previous right sibling page */
lv = & dtlck->lv[dtlck->index];
lv->offset = 0;
lv->length = 1;
dtlck->index++;
p->header.prev = cpu_to_le64(rbn);
DT_PUTPAGE(mp);
}
/*
* split the data between the split and right pages.
*/
skip = split->index;
half = (PSIZE >> L2DTSLOTSIZE) >> 1; /* swag */
left = 0;
/*
* compute fill factor for split pages
*
* <nxt> traces the next entry to move to rp
* <off> traces the next entry to stay in sp
*/
stbl = (u8 *) & sp->slot[sp->header.stblindex];
nextindex = sp->header.nextindex;
for (nxt = off = 0; nxt < nextindex; ++off) {
if (off == skip)
/* check for fill factor with new entry size */
n = split->nslot;
else {
si = stbl[nxt];
switch (sp->header.flag & BT_TYPE) {
case BT_LEAF:
ldtentry = (struct ldtentry *) & sp->slot[si];
if (DO_INDEX(ip))
n = NDTLEAF(ldtentry->namlen);
else
n = NDTLEAF_LEGACY(ldtentry->
namlen);
break;
case BT_INTERNAL:
idtentry = (struct idtentry *) & sp->slot[si];
n = NDTINTERNAL(idtentry->namlen);
break;
default:
break;
}
++nxt; /* advance to next entry to move in sp */
}
left += n;
if (left >= half)
break;
}
/* <nxt> poins to the 1st entry to move */
/*
* move entries to right page
*
* dtMoveEntry() initializes rp and reserves entry for insertion
*
* split page moved out entries are linelocked;
* new/right page moved in entries are linelocked;
*/
/* linelock header + stbl of new right page */
rlv = & rdtlck->lv[rdtlck->index];
rlv->offset = 0;
rlv->length = 5;
rdtlck->index++;
dtMoveEntry(sp, nxt, rp, &sdtlck, &rdtlck, DO_INDEX(ip));
sp->header.nextindex = nxt;
/*
* finalize freelist of new right page
*/
fsi = rp->header.freelist;
f = &rp->slot[fsi];
for (fsi++; fsi < rp->header.maxslot; f++, fsi++)
f->next = fsi;
f->next = -1;
/*
* Update directory index table for entries now in right page
*/
if ((rp->header.flag & BT_LEAF) && DO_INDEX(ip)) {
s64 lblock;
mp = NULL;
stbl = DT_GETSTBL(rp);
for (n = 0; n < rp->header.nextindex; n++) {
ldtentry = (struct ldtentry *) & rp->slot[stbl[n]];
modify_index(tid, ip, le32_to_cpu(ldtentry->index),
rbn, n, &mp, &lblock);
}
if (mp)
release_metapage(mp);
}
/*
* the skipped index was on the left page,
*/
if (skip <= off) {
/* insert the new entry in the split page */
dtInsertEntry(sp, skip, split->key, split->data, &sdtlck);
/* linelock stbl of split page */
if (sdtlck->index >= sdtlck->maxcnt)
sdtlck = (struct dt_lock *) txLinelock(sdtlck);
slv = & sdtlck->lv[sdtlck->index];
n = skip >> L2DTSLOTSIZE;
slv->offset = sp->header.stblindex + n;
slv->length =
((sp->header.nextindex - 1) >> L2DTSLOTSIZE) - n + 1;
sdtlck->index++;
}
/*
* the skipped index was on the right page,
*/
else {
/* adjust the skip index to reflect the new position */
skip -= nxt;
/* insert the new entry in the right page */
dtInsertEntry(rp, skip, split->key, split->data, &rdtlck);
}
out:
*rmpp = rmp;
*rpxdp = *pxd;
return rc;
}
/*
* dtExtendPage()
*
* function: extend 1st/only directory leaf page
*
* parameter:
*
* return: 0 - success;
* errno - failure;
* return extended page pinned;
*/
static int dtExtendPage(tid_t tid,
struct inode *ip, struct dtsplit * split, struct btstack * btstack)
{
struct super_block *sb = ip->i_sb;
int rc;
struct metapage *smp, *pmp, *mp;
dtpage_t *sp, *pp;
struct pxdlist *pxdlist;
pxd_t *pxd, *tpxd;
int xlen, xsize;
int newstblindex, newstblsize;
int oldstblindex, oldstblsize;
int fsi, last;
struct dtslot *f;
struct btframe *parent;
int n;
struct dt_lock *dtlck;
s64 xaddr, txaddr;
struct tlock *tlck;
struct pxd_lock *pxdlock;
struct lv *lv;
uint type;
struct ldtentry *ldtentry;
u8 *stbl;
/* get page to extend */
smp = split->mp;
sp = DT_PAGE(ip, smp);
/* get parent/root page */
parent = BT_POP(btstack);
DT_GETPAGE(ip, parent->bn, pmp, PSIZE, pp, rc);
if (rc)
return (rc);
/*
* extend the extent
*/
pxdlist = split->pxdlist;
pxd = &pxdlist->pxd[pxdlist->npxd];
pxdlist->npxd++;
xaddr = addressPXD(pxd);
tpxd = &sp->header.self;
txaddr = addressPXD(tpxd);
/* in-place extension */
if (xaddr == txaddr) {
type = tlckEXTEND;
}
/* relocation */
else {
type = tlckNEW;
/* save moved extent descriptor for later free */
tlck = txMaplock(tid, ip, tlckDTREE | tlckRELOCATE);
pxdlock = (struct pxd_lock *) & tlck->lock;
pxdlock->flag = mlckFREEPXD;
pxdlock->pxd = sp->header.self;
pxdlock->index = 1;
/*
* Update directory index table to reflect new page address
*/
if (DO_INDEX(ip)) {
s64 lblock;
mp = NULL;
stbl = DT_GETSTBL(sp);
for (n = 0; n < sp->header.nextindex; n++) {
ldtentry =
(struct ldtentry *) & sp->slot[stbl[n]];
modify_index(tid, ip,
le32_to_cpu(ldtentry->index),
xaddr, n, &mp, &lblock);
}
if (mp)
release_metapage(mp);
}
}
/*
* extend the page
*/
sp->header.self = *pxd;
jfs_info("dtExtendPage: ip:0x%p smp:0x%p sp:0x%p", ip, smp, sp);
BT_MARK_DIRTY(smp, ip);
/*
* acquire a transaction lock on the extended/leaf page
*/
tlck = txLock(tid, ip, smp, tlckDTREE | type);
dtlck = (struct dt_lock *) & tlck->lock;
lv = & dtlck->lv[0];
/* update buffer extent descriptor of extended page */
xlen = lengthPXD(pxd);
xsize = xlen << JFS_SBI(sb)->l2bsize;
/*
* copy old stbl to new stbl at start of extended area
*/
oldstblindex = sp->header.stblindex;
oldstblsize = (sp->header.maxslot + 31) >> L2DTSLOTSIZE;
newstblindex = sp->header.maxslot;
n = xsize >> L2DTSLOTSIZE;
newstblsize = (n + 31) >> L2DTSLOTSIZE;
memcpy(&sp->slot[newstblindex], &sp->slot[oldstblindex],
sp->header.nextindex);
/*
* in-line extension: linelock old area of extended page
*/
if (type == tlckEXTEND) {
/* linelock header */
lv->offset = 0;
lv->length = 1;
dtlck->index++;
lv++;
/* linelock new stbl of extended page */
lv->offset = newstblindex;
lv->length = newstblsize;
}
/*
* relocation: linelock whole relocated area
*/
else {
lv->offset = 0;
lv->length = sp->header.maxslot + newstblsize;
}
dtlck->index++;
sp->header.maxslot = n;
sp->header.stblindex = newstblindex;
/* sp->header.nextindex remains the same */
/*
* add old stbl region at head of freelist
*/
fsi = oldstblindex;
f = &sp->slot[fsi];
last = sp->header.freelist;
for (n = 0; n < oldstblsize; n++, fsi++, f++) {
f->next = last;
last = fsi;
}
sp->header.freelist = last;
sp->header.freecnt += oldstblsize;
/*
* append free region of newly extended area at tail of freelist
*/
/* init free region of newly extended area */
fsi = n = newstblindex + newstblsize;
f = &sp->slot[fsi];
for (fsi++; fsi < sp->header.maxslot; f++, fsi++)
f->next = fsi;
f->next = -1;
/* append new free region at tail of old freelist */
fsi = sp->header.freelist;
if (fsi == -1)
sp->header.freelist = n;
else {
do {
f = &sp->slot[fsi];
fsi = f->next;
} while (fsi != -1);
f->next = n;
}
sp->header.freecnt += sp->header.maxslot - n;
/*
* insert the new entry
*/
dtInsertEntry(sp, split->index, split->key, split->data, &dtlck);
BT_MARK_DIRTY(pmp, ip);
/*
* linelock any freeslots residing in old extent
*/
if (type == tlckEXTEND) {
n = sp->header.maxslot >> 2;
if (sp->header.freelist < n)
dtLinelockFreelist(sp, n, &dtlck);
}
/*
* update parent entry on the parent/root page
*/
/*
* acquire a transaction lock on the parent/root page
*/
tlck = txLock(tid, ip, pmp, tlckDTREE | tlckENTRY);
dtlck = (struct dt_lock *) & tlck->lock;
lv = & dtlck->lv[dtlck->index];
/* linelock parent entry - 1st slot */
lv->offset = 1;
lv->length = 1;
dtlck->index++;
/* update the parent pxd for page extension */
tpxd = (pxd_t *) & pp->slot[1];
*tpxd = *pxd;
DT_PUTPAGE(pmp);
return 0;
}
/*
* dtSplitRoot()
*
* function:
* split the full root page into
* original/root/split page and new right page
* i.e., root remains fixed in tree anchor (inode) and
* the root is copied to a single new right child page
* since root page << non-root page, and
* the split root page contains a single entry for the
* new right child page.
*
* parameter:
*
* return: 0 - success;
* errno - failure;
* return new page pinned;
*/
static int dtSplitRoot(tid_t tid,
struct inode *ip, struct dtsplit * split, struct metapage ** rmpp)
{
struct super_block *sb = ip->i_sb;
struct metapage *smp;
dtroot_t *sp;
struct metapage *rmp;
dtpage_t *rp;
s64 rbn;
int xlen;
int xsize;
struct dtslot *f;
s8 *stbl;
int fsi, stblsize, n;
struct idtentry *s;
pxd_t *ppxd;
struct pxdlist *pxdlist;
pxd_t *pxd;
struct dt_lock *dtlck;
struct tlock *tlck;
struct lv *lv;
int rc;
/* get split root page */
smp = split->mp;
sp = &JFS_IP(ip)->i_dtroot;
/*
* allocate/initialize a single (right) child page
*
* N.B. at first split, a one (or two) block to fit new entry
* is allocated; at subsequent split, a full page is allocated;
*/
pxdlist = split->pxdlist;
pxd = &pxdlist->pxd[pxdlist->npxd];
pxdlist->npxd++;
rbn = addressPXD(pxd);
xlen = lengthPXD(pxd);
xsize = xlen << JFS_SBI(sb)->l2bsize;
rmp = get_metapage(ip, rbn, xsize, 1);
if (!rmp)
return -EIO;
rp = rmp->data;
/* Allocate blocks to quota. */
rc = dquot_alloc_block(ip, lengthPXD(pxd));
if (rc) {
release_metapage(rmp);
return rc;
}
BT_MARK_DIRTY(rmp, ip);
/*
* acquire a transaction lock on the new right page
*/
tlck = txLock(tid, ip, rmp, tlckDTREE | tlckNEW);
dtlck = (struct dt_lock *) & tlck->lock;
rp->header.flag =
(sp->header.flag & BT_LEAF) ? BT_LEAF : BT_INTERNAL;
rp->header.self = *pxd;
/* initialize sibling pointers */
rp->header.next = 0;
rp->header.prev = 0;
/*
* move in-line root page into new right page extent
*/
/* linelock header + copied entries + new stbl (1st slot) in new page */
ASSERT(dtlck->index == 0);
lv = & dtlck->lv[0];
lv->offset = 0;
lv->length = 10; /* 1 + 8 + 1 */
dtlck->index++;
n = xsize >> L2DTSLOTSIZE;
rp->header.maxslot = n;
stblsize = (n + 31) >> L2DTSLOTSIZE;
/* copy old stbl to new stbl at start of extended area */
rp->header.stblindex = DTROOTMAXSLOT;
stbl = (s8 *) & rp->slot[DTROOTMAXSLOT];
memcpy(stbl, sp->header.stbl, sp->header.nextindex);
rp->header.nextindex = sp->header.nextindex;
/* copy old data area to start of new data area */
memcpy(&rp->slot[1], &sp->slot[1], IDATASIZE);
/*
* append free region of newly extended area at tail of freelist
*/
/* init free region of newly extended area */
fsi = n = DTROOTMAXSLOT + stblsize;
f = &rp->slot[fsi];
for (fsi++; fsi < rp->header.maxslot; f++, fsi++)
f->next = fsi;
f->next = -1;
/* append new free region at tail of old freelist */
fsi = sp->header.freelist;
if (fsi == -1)
rp->header.freelist = n;
else {
rp->header.freelist = fsi;
do {
f = &rp->slot[fsi];
fsi = f->next;
} while (fsi >= 0);
f->next = n;
}
rp->header.freecnt = sp->header.freecnt + rp->header.maxslot - n;
/*
* Update directory index table for entries now in right page
*/
if ((rp->header.flag & BT_LEAF) && DO_INDEX(ip)) {
s64 lblock;
struct metapage *mp = NULL;
struct ldtentry *ldtentry;
stbl = DT_GETSTBL(rp);
for (n = 0; n < rp->header.nextindex; n++) {
ldtentry = (struct ldtentry *) & rp->slot[stbl[n]];
modify_index(tid, ip, le32_to_cpu(ldtentry->index),
rbn, n, &mp, &lblock);
}
if (mp)
release_metapage(mp);
}
/*
* insert the new entry into the new right/child page
* (skip index in the new right page will not change)
*/
dtInsertEntry(rp, split->index, split->key, split->data, &dtlck);
/*
* reset parent/root page
*
* set the 1st entry offset to 0, which force the left-most key
* at any level of the tree to be less than any search key.
*
* The btree comparison code guarantees that the left-most key on any
* level of the tree is never used, so it doesn't need to be filled in.
*/
BT_MARK_DIRTY(smp, ip);
/*
* acquire a transaction lock on the root page (in-memory inode)
*/
tlck = txLock(tid, ip, smp, tlckDTREE | tlckNEW | tlckBTROOT);
dtlck = (struct dt_lock *) & tlck->lock;
/* linelock root */
ASSERT(dtlck->index == 0);
lv = & dtlck->lv[0];
lv->offset = 0;
lv->length = DTROOTMAXSLOT;
dtlck->index++;
/* update page header of root */
if (sp->header.flag & BT_LEAF) {
sp->header.flag &= ~BT_LEAF;
sp->header.flag |= BT_INTERNAL;
}
/* init the first entry */
s = (struct idtentry *) & sp->slot[DTENTRYSTART];
ppxd = (pxd_t *) s;
*ppxd = *pxd;
s->next = -1;
s->namlen = 0;
stbl = sp->header.stbl;
stbl[0] = DTENTRYSTART;
sp->header.nextindex = 1;
/* init freelist */
fsi = DTENTRYSTART + 1;
f = &sp->slot[fsi];
/* init free region of remaining area */
for (fsi++; fsi < DTROOTMAXSLOT; f++, fsi++)
f->next = fsi;
f->next = -1;
sp->header.freelist = DTENTRYSTART + 1;
sp->header.freecnt = DTROOTMAXSLOT - (DTENTRYSTART + 1);
*rmpp = rmp;
return 0;
}
/*
* dtDelete()
*
* function: delete the entry(s) referenced by a key.
*
* parameter:
*
* return:
*/
int dtDelete(tid_t tid,
struct inode *ip, struct component_name * key, ino_t * ino, int flag)
{
int rc = 0;
s64 bn;
struct metapage *mp, *imp;
dtpage_t *p;
int index;
struct btstack btstack;
struct dt_lock *dtlck;
struct tlock *tlck;
struct lv *lv;
int i;
struct ldtentry *ldtentry;
u8 *stbl;
u32 table_index, next_index;
struct metapage *nmp;
dtpage_t *np;
/*
* search for the entry to delete:
*
* dtSearch() returns (leaf page pinned, index at which to delete).
*/
if ((rc = dtSearch(ip, key, ino, &btstack, flag)))
return rc;
/* retrieve search result */
DT_GETSEARCH(ip, btstack.top, bn, mp, p, index);
/*
* We need to find put the index of the next entry into the
* directory index table in order to resume a readdir from this
* entry.
*/
if (DO_INDEX(ip)) {
stbl = DT_GETSTBL(p);
ldtentry = (struct ldtentry *) & p->slot[stbl[index]];
table_index = le32_to_cpu(ldtentry->index);
if (index == (p->header.nextindex - 1)) {
/*
* Last entry in this leaf page
*/
if ((p->header.flag & BT_ROOT)
|| (p->header.next == 0))
next_index = -1;
else {
/* Read next leaf page */
DT_GETPAGE(ip, le64_to_cpu(p->header.next),
nmp, PSIZE, np, rc);
if (rc)
next_index = -1;
else {
stbl = DT_GETSTBL(np);
ldtentry =
(struct ldtentry *) & np->
slot[stbl[0]];
next_index =
le32_to_cpu(ldtentry->index);
DT_PUTPAGE(nmp);
}
}
} else {
ldtentry =
(struct ldtentry *) & p->slot[stbl[index + 1]];
next_index = le32_to_cpu(ldtentry->index);
}
free_index(tid, ip, table_index, next_index);
}
/*
* the leaf page becomes empty, delete the page
*/
if (p->header.nextindex == 1) {
/* delete empty page */
rc = dtDeleteUp(tid, ip, mp, p, &btstack);
}
/*
* the leaf page has other entries remaining:
*
* delete the entry from the leaf page.
*/
else {
BT_MARK_DIRTY(mp, ip);
/*
* acquire a transaction lock on the leaf page
*/
tlck = txLock(tid, ip, mp, tlckDTREE | tlckENTRY);
dtlck = (struct dt_lock *) & tlck->lock;
/*
* Do not assume that dtlck->index will be zero. During a
* rename within a directory, this transaction may have
* modified this page already when adding the new entry.
*/
/* linelock header */
if (dtlck->index >= dtlck->maxcnt)
dtlck = (struct dt_lock *) txLinelock(dtlck);
lv = & dtlck->lv[dtlck->index];
lv->offset = 0;
lv->length = 1;
dtlck->index++;
/* linelock stbl of non-root leaf page */
if (!(p->header.flag & BT_ROOT)) {
if (dtlck->index >= dtlck->maxcnt)
dtlck = (struct dt_lock *) txLinelock(dtlck);
lv = & dtlck->lv[dtlck->index];
i = index >> L2DTSLOTSIZE;
lv->offset = p->header.stblindex + i;
lv->length =
((p->header.nextindex - 1) >> L2DTSLOTSIZE) -
i + 1;
dtlck->index++;
}
/* free the leaf entry */
dtDeleteEntry(p, index, &dtlck);
/*
* Update directory index table for entries moved in stbl
*/
if (DO_INDEX(ip) && index < p->header.nextindex) {
s64 lblock;
imp = NULL;
stbl = DT_GETSTBL(p);
for (i = index; i < p->header.nextindex; i++) {
ldtentry =
(struct ldtentry *) & p->slot[stbl[i]];
modify_index(tid, ip,
le32_to_cpu(ldtentry->index),
bn, i, &imp, &lblock);
}
if (imp)
release_metapage(imp);
}
DT_PUTPAGE(mp);
}
return rc;
}
/*
* dtDeleteUp()
*
* function:
* free empty pages as propagating deletion up the tree
*
* parameter:
*
* return:
*/
static int dtDeleteUp(tid_t tid, struct inode *ip,
struct metapage * fmp, dtpage_t * fp, struct btstack * btstack)
{
int rc = 0;
struct metapage *mp;
dtpage_t *p;
int index, nextindex;
int xlen;
struct btframe *parent;
struct dt_lock *dtlck;
struct tlock *tlck;
struct lv *lv;
struct pxd_lock *pxdlock;
int i;
/*
* keep the root leaf page which has become empty
*/
if (BT_IS_ROOT(fmp)) {
/*
* reset the root
*
* dtInitRoot() acquires txlock on the root
*/
dtInitRoot(tid, ip, PARENT(ip));
DT_PUTPAGE(fmp);
return 0;
}
/*
* free the non-root leaf page
*/
/*
* acquire a transaction lock on the page
*
* write FREEXTENT|NOREDOPAGE log record
* N.B. linelock is overlaid as freed extent descriptor, and
* the buffer page is freed;
*/
tlck = txMaplock(tid, ip, tlckDTREE | tlckFREE);
pxdlock = (struct pxd_lock *) & tlck->lock;
pxdlock->flag = mlckFREEPXD;
pxdlock->pxd = fp->header.self;
pxdlock->index = 1;
/* update sibling pointers */
if ((rc = dtRelink(tid, ip, fp))) {
BT_PUTPAGE(fmp);
return rc;
}
xlen = lengthPXD(&fp->header.self);
/* Free quota allocation. */
dquot_free_block(ip, xlen);
/* free/invalidate its buffer page */
discard_metapage(fmp);
/*
* propagate page deletion up the directory tree
*
* If the delete from the parent page makes it empty,
* continue all the way up the tree.
* stop if the root page is reached (which is never deleted) or
* if the entry deletion does not empty the page.
*/
while ((parent = BT_POP(btstack)) != NULL) {
/* pin the parent page <sp> */
DT_GETPAGE(ip, parent->bn, mp, PSIZE, p, rc);
if (rc)
return rc;
/*
* free the extent of the child page deleted
*/
index = parent->index;
/*
* delete the entry for the child page from parent
*/
nextindex = p->header.nextindex;
/*
* the parent has the single entry being deleted:
*
* free the parent page which has become empty.
*/
if (nextindex == 1) {
/*
* keep the root internal page which has become empty
*/
if (p->header.flag & BT_ROOT) {
/*
* reset the root
*
* dtInitRoot() acquires txlock on the root
*/
dtInitRoot(tid, ip, PARENT(ip));
DT_PUTPAGE(mp);
return 0;
}
/*
* free the parent page
*/
else {
/*
* acquire a transaction lock on the page
*
* write FREEXTENT|NOREDOPAGE log record
*/
tlck =
txMaplock(tid, ip,
tlckDTREE | tlckFREE);
pxdlock = (struct pxd_lock *) & tlck->lock;
pxdlock->flag = mlckFREEPXD;
pxdlock->pxd = p->header.self;
pxdlock->index = 1;
/* update sibling pointers */
if ((rc = dtRelink(tid, ip, p))) {
DT_PUTPAGE(mp);
return rc;
}
xlen = lengthPXD(&p->header.self);
/* Free quota allocation */
dquot_free_block(ip, xlen);
/* free/invalidate its buffer page */
discard_metapage(mp);
/* propagate up */
continue;
}
}
/*
* the parent has other entries remaining:
*
* delete the router entry from the parent page.
*/
BT_MARK_DIRTY(mp, ip);
/*
* acquire a transaction lock on the page
*
* action: router entry deletion
*/
tlck = txLock(tid, ip, mp, tlckDTREE | tlckENTRY);
dtlck = (struct dt_lock *) & tlck->lock;
/* linelock header */
if (dtlck->index >= dtlck->maxcnt)
dtlck = (struct dt_lock *) txLinelock(dtlck);
lv = & dtlck->lv[dtlck->index];
lv->offset = 0;
lv->length = 1;
dtlck->index++;
/* linelock stbl of non-root leaf page */
if (!(p->header.flag & BT_ROOT)) {
if (dtlck->index < dtlck->maxcnt)
lv++;
else {
dtlck = (struct dt_lock *) txLinelock(dtlck);
lv = & dtlck->lv[0];
}
i = index >> L2DTSLOTSIZE;
lv->offset = p->header.stblindex + i;
lv->length =
((p->header.nextindex - 1) >> L2DTSLOTSIZE) -
i + 1;
dtlck->index++;
}
/* free the router entry */
dtDeleteEntry(p, index, &dtlck);
/* reset key of new leftmost entry of level (for consistency) */
if (index == 0 &&
((p->header.flag & BT_ROOT) || p->header.prev == 0))
dtTruncateEntry(p, 0, &dtlck);
/* unpin the parent page */
DT_PUTPAGE(mp);
/* exit propagation up */
break;
}
if (!DO_INDEX(ip))
ip->i_size -= PSIZE;
return 0;
}
/*
* dtRelink()
*
* function:
* link around a freed page.
*
* parameter:
* fp: page to be freed
*
* return:
*/
static int dtRelink(tid_t tid, struct inode *ip, dtpage_t * p)
{
int rc;
struct metapage *mp;
s64 nextbn, prevbn;
struct tlock *tlck;
struct dt_lock *dtlck;
struct lv *lv;
nextbn = le64_to_cpu(p->header.next);
prevbn = le64_to_cpu(p->header.prev);
/* update prev pointer of the next page */
if (nextbn != 0) {
DT_GETPAGE(ip, nextbn, mp, PSIZE, p, rc);
if (rc)
return rc;
BT_MARK_DIRTY(mp, ip);
/*
* acquire a transaction lock on the next page
*
* action: update prev pointer;
*/
tlck = txLock(tid, ip, mp, tlckDTREE | tlckRELINK);
jfs_info("dtRelink nextbn: tlck = 0x%p, ip = 0x%p, mp=0x%p",
tlck, ip, mp);
dtlck = (struct dt_lock *) & tlck->lock;
/* linelock header */
if (dtlck->index >= dtlck->maxcnt)
dtlck = (struct dt_lock *) txLinelock(dtlck);
lv = & dtlck->lv[dtlck->index];
lv->offset = 0;
lv->length = 1;
dtlck->index++;
p->header.prev = cpu_to_le64(prevbn);
DT_PUTPAGE(mp);
}
/* update next pointer of the previous page */
if (prevbn != 0) {
DT_GETPAGE(ip, prevbn, mp, PSIZE, p, rc);
if (rc)
return rc;
BT_MARK_DIRTY(mp, ip);
/*
* acquire a transaction lock on the prev page
*
* action: update next pointer;
*/
tlck = txLock(tid, ip, mp, tlckDTREE | tlckRELINK);
jfs_info("dtRelink prevbn: tlck = 0x%p, ip = 0x%p, mp=0x%p",
tlck, ip, mp);
dtlck = (struct dt_lock *) & tlck->lock;
/* linelock header */
if (dtlck->index >= dtlck->maxcnt)
dtlck = (struct dt_lock *) txLinelock(dtlck);
lv = & dtlck->lv[dtlck->index];
lv->offset = 0;
lv->length = 1;
dtlck->index++;
p->header.next = cpu_to_le64(nextbn);
DT_PUTPAGE(mp);
}
return 0;
}
/*
* dtInitRoot()
*
* initialize directory root (inline in inode)
*/
void dtInitRoot(tid_t tid, struct inode *ip, u32 idotdot)
{
struct jfs_inode_info *jfs_ip = JFS_IP(ip);
dtroot_t *p;
int fsi;
struct dtslot *f;
struct tlock *tlck;
struct dt_lock *dtlck;
struct lv *lv;
u16 xflag_save;
/*
* If this was previously an non-empty directory, we need to remove
* the old directory table.
*/
if (DO_INDEX(ip)) {
if (!jfs_dirtable_inline(ip)) {
struct tblock *tblk = tid_to_tblock(tid);
/*
* We're playing games with the tid's xflag. If
* we're removing a regular file, the file's xtree
* is committed with COMMIT_PMAP, but we always
* commit the directories xtree with COMMIT_PWMAP.
*/
xflag_save = tblk->xflag;
tblk->xflag = 0;
/*
* xtTruncate isn't guaranteed to fully truncate
* the xtree. The caller needs to check i_size
* after committing the transaction to see if
* additional truncation is needed. The
* COMMIT_Stale flag tells caller that we
* initiated the truncation.
*/
xtTruncate(tid, ip, 0, COMMIT_PWMAP);
set_cflag(COMMIT_Stale, ip);
tblk->xflag = xflag_save;
} else
ip->i_size = 1;
jfs_ip->next_index = 2;
} else
ip->i_size = IDATASIZE;
/*
* acquire a transaction lock on the root
*
* action: directory initialization;
*/
tlck = txLock(tid, ip, (struct metapage *) & jfs_ip->bxflag,
tlckDTREE | tlckENTRY | tlckBTROOT);
dtlck = (struct dt_lock *) & tlck->lock;
/* linelock root */
ASSERT(dtlck->index == 0);
lv = & dtlck->lv[0];
lv->offset = 0;
lv->length = DTROOTMAXSLOT;
dtlck->index++;
p = &jfs_ip->i_dtroot;
p->header.flag = DXD_INDEX | BT_ROOT | BT_LEAF;
p->header.nextindex = 0;
/* init freelist */
fsi = 1;
f = &p->slot[fsi];
/* init data area of root */
for (fsi++; fsi < DTROOTMAXSLOT; f++, fsi++)
f->next = fsi;
f->next = -1;
p->header.freelist = 1;
p->header.freecnt = 8;
/* init '..' entry */
p->header.idotdot = cpu_to_le32(idotdot);
return;
}
/*
* add_missing_indices()
*
* function: Fix dtree page in which one or more entries has an invalid index.
* fsck.jfs should really fix this, but it currently does not.
* Called from jfs_readdir when bad index is detected.
*/
static int add_missing_indices(struct inode *inode, s64 bn)
{
struct ldtentry *d;
struct dt_lock *dtlck;
int i;
uint index;
struct lv *lv;
struct metapage *mp;
dtpage_t *p;
int rc = 0;
s8 *stbl;
tid_t tid;
struct tlock *tlck;
tid = txBegin(inode->i_sb, 0);
DT_GETPAGE(inode, bn, mp, PSIZE, p, rc);
if (rc) {
printk(KERN_ERR "DT_GETPAGE failed!\n");
goto end;
}
BT_MARK_DIRTY(mp, inode);
ASSERT(p->header.flag & BT_LEAF);
tlck = txLock(tid, inode, mp, tlckDTREE | tlckENTRY);
if (BT_IS_ROOT(mp))
tlck->type |= tlckBTROOT;
dtlck = (struct dt_lock *) &tlck->lock;
stbl = DT_GETSTBL(p);
for (i = 0; i < p->header.nextindex; i++) {
if (stbl[i] < 0) {
jfs_err("jfs: add_missing_indices: Invalid stbl[%d] = %d for inode %ld, block = %lld",
i, stbl[i], (long)inode->i_ino, (long long)bn);
rc = -EIO;
DT_PUTPAGE(mp);
txAbort(tid, 0);
goto end;
}
d = (struct ldtentry *) &p->slot[stbl[i]];
index = le32_to_cpu(d->index);
if ((index < 2) || (index >= JFS_IP(inode)->next_index)) {
d->index = cpu_to_le32(add_index(tid, inode, bn, i));
if (dtlck->index >= dtlck->maxcnt)
dtlck = (struct dt_lock *) txLinelock(dtlck);
lv = &dtlck->lv[dtlck->index];
lv->offset = stbl[i];
lv->length = 1;
dtlck->index++;
}
}
DT_PUTPAGE(mp);
(void) txCommit(tid, 1, &inode, 0);
end:
txEnd(tid);
return rc;
}
/*
* Buffer to hold directory entry info while traversing a dtree page
* before being fed to the filldir function
*/
struct jfs_dirent {
loff_t position;
int ino;
u16 name_len;
char name[];
};
/*
* function to determine next variable-sized jfs_dirent in buffer
*/
static inline struct jfs_dirent *next_jfs_dirent(struct jfs_dirent *dirent)
{
return (struct jfs_dirent *)
((char *)dirent +
((sizeof (struct jfs_dirent) + dirent->name_len + 1 +
sizeof (loff_t) - 1) &
~(sizeof (loff_t) - 1)));
}
/*
* jfs_readdir()
*
* function: read directory entries sequentially
* from the specified entry offset
*
* parameter:
*
* return: offset = (pn, index) of start entry
* of next jfs_readdir()/dtRead()
*/
int jfs_readdir(struct file *file, struct dir_context *ctx)
{
struct inode *ip = file_inode(file);
struct nls_table *codepage = JFS_SBI(ip->i_sb)->nls_tab;
int rc = 0;
loff_t dtpos; /* legacy OS/2 style position */
struct dtoffset {
s16 pn;
s16 index;
s32 unused;
} *dtoffset = (struct dtoffset *) &dtpos;
s64 bn;
struct metapage *mp;
dtpage_t *p;
int index;
s8 *stbl;
struct btstack btstack;
int i, next;
struct ldtentry *d;
struct dtslot *t;
int d_namleft, len, outlen;
unsigned long dirent_buf;
char *name_ptr;
u32 dir_index;
int do_index = 0;
uint loop_count = 0;
struct jfs_dirent *jfs_dirent;
int jfs_dirents;
int overflow, fix_page, page_fixed = 0;
static int unique_pos = 2; /* If we can't fix broken index */
if (ctx->pos == DIREND)
return 0;
if (DO_INDEX(ip)) {
/*
* persistent index is stored in directory entries.
* Special cases: 0 = .
* 1 = ..
* -1 = End of directory
*/
do_index = 1;
dir_index = (u32) ctx->pos;
/*
* NFSv4 reserves cookies 1 and 2 for . and .. so the value
* we return to the vfs is one greater than the one we use
* internally.
*/
if (dir_index)
dir_index--;
if (dir_index > 1) {
struct dir_table_slot dirtab_slot;
if (dtEmpty(ip) ||
(dir_index >= JFS_IP(ip)->next_index)) {
/* Stale position. Directory has shrunk */
ctx->pos = DIREND;
return 0;
}
repeat:
rc = read_index(ip, dir_index, &dirtab_slot);
if (rc) {
ctx->pos = DIREND;
return rc;
}
if (dirtab_slot.flag == DIR_INDEX_FREE) {
if (loop_count++ > JFS_IP(ip)->next_index) {
jfs_err("jfs_readdir detected infinite loop!");
ctx->pos = DIREND;
return 0;
}
dir_index = le32_to_cpu(dirtab_slot.addr2);
if (dir_index == -1) {
ctx->pos = DIREND;
return 0;
}
goto repeat;
}
bn = addressDTS(&dirtab_slot);
index = dirtab_slot.slot;
DT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc) {
ctx->pos = DIREND;
return 0;
}
if (p->header.flag & BT_INTERNAL) {
jfs_err("jfs_readdir: bad index table");
DT_PUTPAGE(mp);
ctx->pos = DIREND;
return 0;
}
} else {
if (dir_index == 0) {
/*
* self "."
*/
ctx->pos = 1;
if (!dir_emit(ctx, ".", 1, ip->i_ino, DT_DIR))
return 0;
}
/*
* parent ".."
*/
ctx->pos = 2;
if (!dir_emit(ctx, "..", 2, PARENT(ip), DT_DIR))
return 0;
/*
* Find first entry of left-most leaf
*/
if (dtEmpty(ip)) {
ctx->pos = DIREND;
return 0;
}
if ((rc = dtReadFirst(ip, &btstack)))
return rc;
DT_GETSEARCH(ip, btstack.top, bn, mp, p, index);
}
} else {
/*
* Legacy filesystem - OS/2 & Linux JFS < 0.3.6
*
* pn = 0; index = 1: First entry "."
* pn = 0; index = 2: Second entry ".."
* pn > 0: Real entries, pn=1 -> leftmost page
* pn = index = -1: No more entries
*/
dtpos = ctx->pos;
if (dtpos < 2) {
/* build "." entry */
ctx->pos = 1;
if (!dir_emit(ctx, ".", 1, ip->i_ino, DT_DIR))
return 0;
dtoffset->index = 2;
ctx->pos = dtpos;
}
if (dtoffset->pn == 0) {
if (dtoffset->index == 2) {
/* build ".." entry */
if (!dir_emit(ctx, "..", 2, PARENT(ip), DT_DIR))
return 0;
} else {
jfs_err("jfs_readdir called with invalid offset!");
}
dtoffset->pn = 1;
dtoffset->index = 0;
ctx->pos = dtpos;
}
if (dtEmpty(ip)) {
ctx->pos = DIREND;
return 0;
}
if ((rc = dtReadNext(ip, &ctx->pos, &btstack))) {
jfs_err("jfs_readdir: unexpected rc = %d from dtReadNext",
rc);
ctx->pos = DIREND;
return 0;
}
/* get start leaf page and index */
DT_GETSEARCH(ip, btstack.top, bn, mp, p, index);
/* offset beyond directory eof ? */
if (bn < 0) {
ctx->pos = DIREND;
return 0;
}
}
dirent_buf = __get_free_page(GFP_KERNEL);
if (dirent_buf == 0) {
DT_PUTPAGE(mp);
jfs_warn("jfs_readdir: __get_free_page failed!");
ctx->pos = DIREND;
return -ENOMEM;
}
while (1) {
jfs_dirent = (struct jfs_dirent *) dirent_buf;
jfs_dirents = 0;
overflow = fix_page = 0;
stbl = DT_GETSTBL(p);
for (i = index; i < p->header.nextindex; i++) {
if (stbl[i] < 0) {
jfs_err("JFS: Invalid stbl[%d] = %d for inode %ld, block = %lld",
i, stbl[i], (long)ip->i_ino, (long long)bn);
free_page(dirent_buf);
DT_PUTPAGE(mp);
return -EIO;
}
d = (struct ldtentry *) & p->slot[stbl[i]];
if (((long) jfs_dirent + d->namlen + 1) >
(dirent_buf + PAGE_SIZE)) {
/* DBCS codepages could overrun dirent_buf */
index = i;
overflow = 1;
break;
}
d_namleft = d->namlen;
name_ptr = jfs_dirent->name;
jfs_dirent->ino = le32_to_cpu(d->inumber);
if (do_index) {
len = min(d_namleft, DTLHDRDATALEN);
jfs_dirent->position = le32_to_cpu(d->index);
/*
* d->index should always be valid, but it
* isn't. fsck.jfs doesn't create the
* directory index for the lost+found
* directory. Rather than let it go,
* we can try to fix it.
*/
if ((jfs_dirent->position < 2) ||
(jfs_dirent->position >=
JFS_IP(ip)->next_index)) {
if (!page_fixed && !isReadOnly(ip)) {
fix_page = 1;
/*
* setting overflow and setting
* index to i will cause the
* same page to be processed
* again starting here
*/
overflow = 1;
index = i;
break;
}
jfs_dirent->position = unique_pos++;
}
/*
* We add 1 to the index because we may
* use a value of 2 internally, and NFSv4
* doesn't like that.
*/
jfs_dirent->position++;
} else {
jfs_dirent->position = dtpos;
len = min(d_namleft, DTLHDRDATALEN_LEGACY);
}
/* copy the name of head/only segment */
outlen = jfs_strfromUCS_le(name_ptr, d->name, len,
codepage);
jfs_dirent->name_len = outlen;
/* copy name in the additional segment(s) */
next = d->next;
while (next >= 0) {
t = (struct dtslot *) & p->slot[next];
name_ptr += outlen;
d_namleft -= len;
/* Sanity Check */
if (d_namleft == 0) {
jfs_error(ip->i_sb,
"JFS:Dtree error: ino = %ld, bn=%lld, index = %d\n",
(long)ip->i_ino,
(long long)bn,
i);
goto skip_one;
}
len = min(d_namleft, DTSLOTDATALEN);
outlen = jfs_strfromUCS_le(name_ptr, t->name,
len, codepage);
jfs_dirent->name_len += outlen;
next = t->next;
}
jfs_dirents++;
jfs_dirent = next_jfs_dirent(jfs_dirent);
skip_one:
if (!do_index)
dtoffset->index++;
}
if (!overflow) {
/* Point to next leaf page */
if (p->header.flag & BT_ROOT)
bn = 0;
else {
bn = le64_to_cpu(p->header.next);
index = 0;
/* update offset (pn:index) for new page */
if (!do_index) {
dtoffset->pn++;
dtoffset->index = 0;
}
}
page_fixed = 0;
}
/* unpin previous leaf page */
DT_PUTPAGE(mp);
jfs_dirent = (struct jfs_dirent *) dirent_buf;
while (jfs_dirents--) {
ctx->pos = jfs_dirent->position;
if (!dir_emit(ctx, jfs_dirent->name,
jfs_dirent->name_len,
jfs_dirent->ino, DT_UNKNOWN))
goto out;
jfs_dirent = next_jfs_dirent(jfs_dirent);
}
if (fix_page) {
if ((rc = add_missing_indices(ip, bn)))
goto out;
page_fixed = 1;
}
if (!overflow && (bn == 0)) {
ctx->pos = DIREND;
break;
}
DT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc) {
free_page(dirent_buf);
return rc;
}
}
out:
free_page(dirent_buf);
return rc;
}
/*
* dtReadFirst()
*
* function: get the leftmost page of the directory
*/
static int dtReadFirst(struct inode *ip, struct btstack * btstack)
{
int rc = 0;
s64 bn;
int psize = 288; /* initial in-line directory */
struct metapage *mp;
dtpage_t *p;
s8 *stbl;
struct btframe *btsp;
pxd_t *xd;
BT_CLR(btstack); /* reset stack */
/*
* descend leftmost path of the tree
*
* by convention, root bn = 0.
*/
for (bn = 0;;) {
DT_GETPAGE(ip, bn, mp, psize, p, rc);
if (rc)
return rc;
/*
* leftmost leaf page
*/
if (p->header.flag & BT_LEAF) {
/* return leftmost entry */
btsp = btstack->top;
btsp->bn = bn;
btsp->index = 0;
btsp->mp = mp;
return 0;
}
/*
* descend down to leftmost child page
*/
if (BT_STACK_FULL(btstack)) {
DT_PUTPAGE(mp);
jfs_error(ip->i_sb, "btstack overrun\n");
BT_STACK_DUMP(btstack);
return -EIO;
}
/* push (bn, index) of the parent page/entry */
BT_PUSH(btstack, bn, 0);
/* get the leftmost entry */
stbl = DT_GETSTBL(p);
if (stbl[0] < 0) {
DT_PUTPAGE(mp);
jfs_error(ip->i_sb, "stbl[0] out of bound\n");
return -EIO;
}
xd = (pxd_t *) & p->slot[stbl[0]];
/* get the child page block address */
bn = addressPXD(xd);
psize = lengthPXD(xd) << JFS_SBI(ip->i_sb)->l2bsize;
/* unpin the parent page */
DT_PUTPAGE(mp);
}
}
/*
* dtReadNext()
*
* function: get the page of the specified offset (pn:index)
*
* return: if (offset > eof), bn = -1;
*
* note: if index > nextindex of the target leaf page,
* start with 1st entry of next leaf page;
*/
static int dtReadNext(struct inode *ip, loff_t * offset,
struct btstack * btstack)
{
int rc = 0;
struct dtoffset {
s16 pn;
s16 index;
s32 unused;
} *dtoffset = (struct dtoffset *) offset;
s64 bn;
struct metapage *mp;
dtpage_t *p;
int index;
int pn;
s8 *stbl;
struct btframe *btsp, *parent;
pxd_t *xd;
/*
* get leftmost leaf page pinned
*/
if ((rc = dtReadFirst(ip, btstack)))
return rc;
/* get leaf page */
DT_GETSEARCH(ip, btstack->top, bn, mp, p, index);
/* get the start offset (pn:index) */
pn = dtoffset->pn - 1; /* Now pn = 0 represents leftmost leaf */
index = dtoffset->index;
/* start at leftmost page ? */
if (pn == 0) {
/* offset beyond eof ? */
if (index < p->header.nextindex)
goto out;
if (p->header.flag & BT_ROOT) {
bn = -1;
goto out;
}
/* start with 1st entry of next leaf page */
dtoffset->pn++;
dtoffset->index = index = 0;
goto a;
}
/* start at non-leftmost page: scan parent pages for large pn */
if (p->header.flag & BT_ROOT) {
bn = -1;
goto out;
}
/* start after next leaf page ? */
if (pn > 1)
goto b;
/* get leaf page pn = 1 */
a:
bn = le64_to_cpu(p->header.next);
/* unpin leaf page */
DT_PUTPAGE(mp);
/* offset beyond eof ? */
if (bn == 0) {
bn = -1;
goto out;
}
goto c;
/*
* scan last internal page level to get target leaf page
*/
b:
/* unpin leftmost leaf page */
DT_PUTPAGE(mp);
/* get left most parent page */
btsp = btstack->top;
parent = btsp - 1;
bn = parent->bn;
DT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc)
return rc;
/* scan parent pages at last internal page level */
while (pn >= p->header.nextindex) {
pn -= p->header.nextindex;
/* get next parent page address */
bn = le64_to_cpu(p->header.next);
/* unpin current parent page */
DT_PUTPAGE(mp);
/* offset beyond eof ? */
if (bn == 0) {
bn = -1;
goto out;
}
/* get next parent page */
DT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc)
return rc;
/* update parent page stack frame */
parent->bn = bn;
}
/* get leaf page address */
stbl = DT_GETSTBL(p);
xd = (pxd_t *) & p->slot[stbl[pn]];
bn = addressPXD(xd);
/* unpin parent page */
DT_PUTPAGE(mp);
/*
* get target leaf page
*/
c:
DT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc)
return rc;
/*
* leaf page has been completed:
* start with 1st entry of next leaf page
*/
if (index >= p->header.nextindex) {
bn = le64_to_cpu(p->header.next);
/* unpin leaf page */
DT_PUTPAGE(mp);
/* offset beyond eof ? */
if (bn == 0) {
bn = -1;
goto out;
}
/* get next leaf page */
DT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc)
return rc;
/* start with 1st entry of next leaf page */
dtoffset->pn++;
dtoffset->index = 0;
}
out:
/* return target leaf page pinned */
btsp = btstack->top;
btsp->bn = bn;
btsp->index = dtoffset->index;
btsp->mp = mp;
return 0;
}
/*
* dtCompare()
*
* function: compare search key with an internal entry
*
* return:
* < 0 if k is < record
* = 0 if k is = record
* > 0 if k is > record
*/
static int dtCompare(struct component_name * key, /* search key */
dtpage_t * p, /* directory page */
int si)
{ /* entry slot index */
wchar_t *kname;
__le16 *name;
int klen, namlen, len, rc;
struct idtentry *ih;
struct dtslot *t;
/*
* force the left-most key on internal pages, at any level of
* the tree, to be less than any search key.
* this obviates having to update the leftmost key on an internal
* page when the user inserts a new key in the tree smaller than
* anything that has been stored.
*
* (? if/when dtSearch() narrows down to 1st entry (index = 0),
* at any internal page at any level of the tree,
* it descends to child of the entry anyway -
* ? make the entry as min size dummy entry)
*
* if (e->index == 0 && h->prevpg == P_INVALID && !(h->flags & BT_LEAF))
* return (1);
*/
kname = key->name;
klen = key->namlen;
ih = (struct idtentry *) & p->slot[si];
si = ih->next;
name = ih->name;
namlen = ih->namlen;
len = min(namlen, DTIHDRDATALEN);
/* compare with head/only segment */
len = min(klen, len);
if ((rc = UniStrncmp_le(kname, name, len)))
return rc;
klen -= len;
namlen -= len;
/* compare with additional segment(s) */
kname += len;
while (klen > 0 && namlen > 0) {
/* compare with next name segment */
t = (struct dtslot *) & p->slot[si];
len = min(namlen, DTSLOTDATALEN);
len = min(klen, len);
name = t->name;
if ((rc = UniStrncmp_le(kname, name, len)))
return rc;
klen -= len;
namlen -= len;
kname += len;
si = t->next;
}
return (klen - namlen);
}
/*
* ciCompare()
*
* function: compare search key with an (leaf/internal) entry
*
* return:
* < 0 if k is < record
* = 0 if k is = record
* > 0 if k is > record
*/
static int ciCompare(struct component_name * key, /* search key */
dtpage_t * p, /* directory page */
int si, /* entry slot index */
int flag)
{
wchar_t *kname, x;
__le16 *name;
int klen, namlen, len, rc;
struct ldtentry *lh;
struct idtentry *ih;
struct dtslot *t;
int i;
/*
* force the left-most key on internal pages, at any level of
* the tree, to be less than any search key.
* this obviates having to update the leftmost key on an internal
* page when the user inserts a new key in the tree smaller than
* anything that has been stored.
*
* (? if/when dtSearch() narrows down to 1st entry (index = 0),
* at any internal page at any level of the tree,
* it descends to child of the entry anyway -
* ? make the entry as min size dummy entry)
*
* if (e->index == 0 && h->prevpg == P_INVALID && !(h->flags & BT_LEAF))
* return (1);
*/
kname = key->name;
klen = key->namlen;
/*
* leaf page entry
*/
if (p->header.flag & BT_LEAF) {
lh = (struct ldtentry *) & p->slot[si];
si = lh->next;
name = lh->name;
namlen = lh->namlen;
if (flag & JFS_DIR_INDEX)
len = min(namlen, DTLHDRDATALEN);
else
len = min(namlen, DTLHDRDATALEN_LEGACY);
}
/*
* internal page entry
*/
else {
ih = (struct idtentry *) & p->slot[si];
si = ih->next;
name = ih->name;
namlen = ih->namlen;
len = min(namlen, DTIHDRDATALEN);
}
/* compare with head/only segment */
len = min(klen, len);
for (i = 0; i < len; i++, kname++, name++) {
/* only uppercase if case-insensitive support is on */
if ((flag & JFS_OS2) == JFS_OS2)
x = UniToupper(le16_to_cpu(*name));
else
x = le16_to_cpu(*name);
if ((rc = *kname - x))
return rc;
}
klen -= len;
namlen -= len;
/* compare with additional segment(s) */
while (klen > 0 && namlen > 0) {
/* compare with next name segment */
t = (struct dtslot *) & p->slot[si];
len = min(namlen, DTSLOTDATALEN);
len = min(klen, len);
name = t->name;
for (i = 0; i < len; i++, kname++, name++) {
/* only uppercase if case-insensitive support is on */
if ((flag & JFS_OS2) == JFS_OS2)
x = UniToupper(le16_to_cpu(*name));
else
x = le16_to_cpu(*name);
if ((rc = *kname - x))
return rc;
}
klen -= len;
namlen -= len;
si = t->next;
}
return (klen - namlen);
}
/*
* ciGetLeafPrefixKey()
*
* function: compute prefix of suffix compression
* from two adjacent leaf entries
* across page boundary
*
* return: non-zero on error
*
*/
static int ciGetLeafPrefixKey(dtpage_t * lp, int li, dtpage_t * rp,
int ri, struct component_name * key, int flag)
{
int klen, namlen;
wchar_t *pl, *pr, *kname;
struct component_name lkey;
struct component_name rkey;
lkey.name = kmalloc_array(JFS_NAME_MAX + 1, sizeof(wchar_t),
GFP_KERNEL);
if (lkey.name == NULL)
return -ENOMEM;
rkey.name = kmalloc_array(JFS_NAME_MAX + 1, sizeof(wchar_t),
GFP_KERNEL);
if (rkey.name == NULL) {
kfree(lkey.name);
return -ENOMEM;
}
/* get left and right key */
dtGetKey(lp, li, &lkey, flag);
lkey.name[lkey.namlen] = 0;
if ((flag & JFS_OS2) == JFS_OS2)
ciToUpper(&lkey);
dtGetKey(rp, ri, &rkey, flag);
rkey.name[rkey.namlen] = 0;
if ((flag & JFS_OS2) == JFS_OS2)
ciToUpper(&rkey);
/* compute prefix */
klen = 0;
kname = key->name;
namlen = min(lkey.namlen, rkey.namlen);
for (pl = lkey.name, pr = rkey.name;
namlen; pl++, pr++, namlen--, klen++, kname++) {
*kname = *pr;
if (*pl != *pr) {
key->namlen = klen + 1;
goto free_names;
}
}
/* l->namlen <= r->namlen since l <= r */
if (lkey.namlen < rkey.namlen) {
*kname = *pr;
key->namlen = klen + 1;
} else /* l->namelen == r->namelen */
key->namlen = klen;
free_names:
kfree(lkey.name);
kfree(rkey.name);
return 0;
}
/*
* dtGetKey()
*
* function: get key of the entry
*/
static void dtGetKey(dtpage_t * p, int i, /* entry index */
struct component_name * key, int flag)
{
int si;
s8 *stbl;
struct ldtentry *lh;
struct idtentry *ih;
struct dtslot *t;
int namlen, len;
wchar_t *kname;
__le16 *name;
/* get entry */
stbl = DT_GETSTBL(p);
si = stbl[i];
if (p->header.flag & BT_LEAF) {
lh = (struct ldtentry *) & p->slot[si];
si = lh->next;
namlen = lh->namlen;
name = lh->name;
if (flag & JFS_DIR_INDEX)
len = min(namlen, DTLHDRDATALEN);
else
len = min(namlen, DTLHDRDATALEN_LEGACY);
} else {
ih = (struct idtentry *) & p->slot[si];
si = ih->next;
namlen = ih->namlen;
name = ih->name;
len = min(namlen, DTIHDRDATALEN);
}
key->namlen = namlen;
kname = key->name;
/*
* move head/only segment
*/
UniStrncpy_from_le(kname, name, len);
/*
* move additional segment(s)
*/
while (si >= 0) {
/* get next segment */
t = &p->slot[si];
kname += len;
namlen -= len;
len = min(namlen, DTSLOTDATALEN);
UniStrncpy_from_le(kname, t->name, len);
si = t->next;
}
}
/*
* dtInsertEntry()
*
* function: allocate free slot(s) and
* write a leaf/internal entry
*
* return: entry slot index
*/
static void dtInsertEntry(dtpage_t * p, int index, struct component_name * key,
ddata_t * data, struct dt_lock ** dtlock)
{
struct dtslot *h, *t;
struct ldtentry *lh = NULL;
struct idtentry *ih = NULL;
int hsi, fsi, klen, len, nextindex;
wchar_t *kname;
__le16 *name;
s8 *stbl;
pxd_t *xd;
struct dt_lock *dtlck = *dtlock;
struct lv *lv;
int xsi, n;
s64 bn = 0;
struct metapage *mp = NULL;
klen = key->namlen;
kname = key->name;
/* allocate a free slot */
hsi = fsi = p->header.freelist;
h = &p->slot[fsi];
p->header.freelist = h->next;
--p->header.freecnt;
/* open new linelock */
if (dtlck->index >= dtlck->maxcnt)
dtlck = (struct dt_lock *) txLinelock(dtlck);
lv = & dtlck->lv[dtlck->index];
lv->offset = hsi;
/* write head/only segment */
if (p->header.flag & BT_LEAF) {
lh = (struct ldtentry *) h;
lh->next = h->next;
lh->inumber = cpu_to_le32(data->leaf.ino);
lh->namlen = klen;
name = lh->name;
if (data->leaf.ip) {
len = min(klen, DTLHDRDATALEN);
if (!(p->header.flag & BT_ROOT))
bn = addressPXD(&p->header.self);
lh->index = cpu_to_le32(add_index(data->leaf.tid,
data->leaf.ip,
bn, index));
} else
len = min(klen, DTLHDRDATALEN_LEGACY);
} else {
ih = (struct idtentry *) h;
ih->next = h->next;
xd = (pxd_t *) ih;
*xd = data->xd;
ih->namlen = klen;
name = ih->name;
len = min(klen, DTIHDRDATALEN);
}
UniStrncpy_to_le(name, kname, len);
n = 1;
xsi = hsi;
/* write additional segment(s) */
t = h;
klen -= len;
while (klen) {
/* get free slot */
fsi = p->header.freelist;
t = &p->slot[fsi];
p->header.freelist = t->next;
--p->header.freecnt;
/* is next slot contiguous ? */
if (fsi != xsi + 1) {
/* close current linelock */
lv->length = n;
dtlck->index++;
/* open new linelock */
if (dtlck->index < dtlck->maxcnt)
lv++;
else {
dtlck = (struct dt_lock *) txLinelock(dtlck);
lv = & dtlck->lv[0];
}
lv->offset = fsi;
n = 0;
}
kname += len;
len = min(klen, DTSLOTDATALEN);
UniStrncpy_to_le(t->name, kname, len);
n++;
xsi = fsi;
klen -= len;
}
/* close current linelock */
lv->length = n;
dtlck->index++;
*dtlock = dtlck;
/* terminate last/only segment */
if (h == t) {
/* single segment entry */
if (p->header.flag & BT_LEAF)
lh->next = -1;
else
ih->next = -1;
} else
/* multi-segment entry */
t->next = -1;
/* if insert into middle, shift right succeeding entries in stbl */
stbl = DT_GETSTBL(p);
nextindex = p->header.nextindex;
if (index < nextindex) {
memmove(stbl + index + 1, stbl + index, nextindex - index);
if ((p->header.flag & BT_LEAF) && data->leaf.ip) {
s64 lblock;
/*
* Need to update slot number for entries that moved
* in the stbl
*/
mp = NULL;
for (n = index + 1; n <= nextindex; n++) {
lh = (struct ldtentry *) & (p->slot[stbl[n]]);
modify_index(data->leaf.tid, data->leaf.ip,
le32_to_cpu(lh->index), bn, n,
&mp, &lblock);
}
if (mp)
release_metapage(mp);
}
}
stbl[index] = hsi;
/* advance next available entry index of stbl */
++p->header.nextindex;
}
/*
* dtMoveEntry()
*
* function: move entries from split/left page to new/right page
*
* nextindex of dst page and freelist/freecnt of both pages
* are updated.
*/
static void dtMoveEntry(dtpage_t * sp, int si, dtpage_t * dp,
struct dt_lock ** sdtlock, struct dt_lock ** ddtlock,
int do_index)
{
int ssi, next; /* src slot index */
int di; /* dst entry index */
int dsi; /* dst slot index */
s8 *sstbl, *dstbl; /* sorted entry table */
int snamlen, len;
struct ldtentry *slh, *dlh = NULL;
struct idtentry *sih, *dih = NULL;
struct dtslot *h, *s, *d;
struct dt_lock *sdtlck = *sdtlock, *ddtlck = *ddtlock;
struct lv *slv, *dlv;
int xssi, ns, nd;
int sfsi;
sstbl = (s8 *) & sp->slot[sp->header.stblindex];
dstbl = (s8 *) & dp->slot[dp->header.stblindex];
dsi = dp->header.freelist; /* first (whole page) free slot */
sfsi = sp->header.freelist;
/* linelock destination entry slot */
dlv = & ddtlck->lv[ddtlck->index];
dlv->offset = dsi;
/* linelock source entry slot */
slv = & sdtlck->lv[sdtlck->index];
slv->offset = sstbl[si];
xssi = slv->offset - 1;
/*
* move entries
*/
ns = nd = 0;
for (di = 0; si < sp->header.nextindex; si++, di++) {
ssi = sstbl[si];
dstbl[di] = dsi;
/* is next slot contiguous ? */
if (ssi != xssi + 1) {
/* close current linelock */
slv->length = ns;
sdtlck->index++;
/* open new linelock */
if (sdtlck->index < sdtlck->maxcnt)
slv++;
else {
sdtlck = (struct dt_lock *) txLinelock(sdtlck);
slv = & sdtlck->lv[0];
}
slv->offset = ssi;
ns = 0;
}
/*
* move head/only segment of an entry
*/
/* get dst slot */
h = d = &dp->slot[dsi];
/* get src slot and move */
s = &sp->slot[ssi];
if (sp->header.flag & BT_LEAF) {
/* get source entry */
slh = (struct ldtentry *) s;
dlh = (struct ldtentry *) h;
snamlen = slh->namlen;
if (do_index) {
len = min(snamlen, DTLHDRDATALEN);
dlh->index = slh->index; /* little-endian */
} else
len = min(snamlen, DTLHDRDATALEN_LEGACY);
memcpy(dlh, slh, 6 + len * 2);
next = slh->next;
/* update dst head/only segment next field */
dsi++;
dlh->next = dsi;
} else {
sih = (struct idtentry *) s;
snamlen = sih->namlen;
len = min(snamlen, DTIHDRDATALEN);
dih = (struct idtentry *) h;
memcpy(dih, sih, 10 + len * 2);
next = sih->next;
dsi++;
dih->next = dsi;
}
/* free src head/only segment */
s->next = sfsi;
s->cnt = 1;
sfsi = ssi;
ns++;
nd++;
xssi = ssi;
/*
* move additional segment(s) of the entry
*/
snamlen -= len;
while ((ssi = next) >= 0) {
/* is next slot contiguous ? */
if (ssi != xssi + 1) {
/* close current linelock */
slv->length = ns;
sdtlck->index++;
/* open new linelock */
if (sdtlck->index < sdtlck->maxcnt)
slv++;
else {
sdtlck =
(struct dt_lock *)
txLinelock(sdtlck);
slv = & sdtlck->lv[0];
}
slv->offset = ssi;
ns = 0;
}
/* get next source segment */
s = &sp->slot[ssi];
/* get next destination free slot */
d++;
len = min(snamlen, DTSLOTDATALEN);
UniStrncpy_le(d->name, s->name, len);
ns++;
nd++;
xssi = ssi;
dsi++;
d->next = dsi;
/* free source segment */
next = s->next;
s->next = sfsi;
s->cnt = 1;
sfsi = ssi;
snamlen -= len;
} /* end while */
/* terminate dst last/only segment */
if (h == d) {
/* single segment entry */
if (dp->header.flag & BT_LEAF)
dlh->next = -1;
else
dih->next = -1;
} else
/* multi-segment entry */
d->next = -1;
} /* end for */
/* close current linelock */
slv->length = ns;
sdtlck->index++;
*sdtlock = sdtlck;
dlv->length = nd;
ddtlck->index++;
*ddtlock = ddtlck;
/* update source header */
sp->header.freelist = sfsi;
sp->header.freecnt += nd;
/* update destination header */
dp->header.nextindex = di;
dp->header.freelist = dsi;
dp->header.freecnt -= nd;
}
/*
* dtDeleteEntry()
*
* function: free a (leaf/internal) entry
*
* log freelist header, stbl, and each segment slot of entry
* (even though last/only segment next field is modified,
* physical image logging requires all segment slots of
* the entry logged to avoid applying previous updates
* to the same slots)
*/
static void dtDeleteEntry(dtpage_t * p, int fi, struct dt_lock ** dtlock)
{
int fsi; /* free entry slot index */
s8 *stbl;
struct dtslot *t;
int si, freecnt;
struct dt_lock *dtlck = *dtlock;
struct lv *lv;
int xsi, n;
/* get free entry slot index */
stbl = DT_GETSTBL(p);
fsi = stbl[fi];
/* open new linelock */
if (dtlck->index >= dtlck->maxcnt)
dtlck = (struct dt_lock *) txLinelock(dtlck);
lv = & dtlck->lv[dtlck->index];
lv->offset = fsi;
/* get the head/only segment */
t = &p->slot[fsi];
if (p->header.flag & BT_LEAF)
si = ((struct ldtentry *) t)->next;
else
si = ((struct idtentry *) t)->next;
t->next = si;
t->cnt = 1;
n = freecnt = 1;
xsi = fsi;
/* find the last/only segment */
while (si >= 0) {
/* is next slot contiguous ? */
if (si != xsi + 1) {
/* close current linelock */
lv->length = n;
dtlck->index++;
/* open new linelock */
if (dtlck->index < dtlck->maxcnt)
lv++;
else {
dtlck = (struct dt_lock *) txLinelock(dtlck);
lv = & dtlck->lv[0];
}
lv->offset = si;
n = 0;
}
n++;
xsi = si;
freecnt++;
t = &p->slot[si];
t->cnt = 1;
si = t->next;
}
/* close current linelock */
lv->length = n;
dtlck->index++;
*dtlock = dtlck;
/* update freelist */
t->next = p->header.freelist;
p->header.freelist = fsi;
p->header.freecnt += freecnt;
/* if delete from middle,
* shift left the succedding entries in the stbl
*/
si = p->header.nextindex;
if (fi < si - 1)
memmove(&stbl[fi], &stbl[fi + 1], si - fi - 1);
p->header.nextindex--;
}
/*
* dtTruncateEntry()
*
* function: truncate a (leaf/internal) entry
*
* log freelist header, stbl, and each segment slot of entry
* (even though last/only segment next field is modified,
* physical image logging requires all segment slots of
* the entry logged to avoid applying previous updates
* to the same slots)
*/
static void dtTruncateEntry(dtpage_t * p, int ti, struct dt_lock ** dtlock)
{
int tsi; /* truncate entry slot index */
s8 *stbl;
struct dtslot *t;
int si, freecnt;
struct dt_lock *dtlck = *dtlock;
struct lv *lv;
int fsi, xsi, n;
/* get free entry slot index */
stbl = DT_GETSTBL(p);
tsi = stbl[ti];
/* open new linelock */
if (dtlck->index >= dtlck->maxcnt)
dtlck = (struct dt_lock *) txLinelock(dtlck);
lv = & dtlck->lv[dtlck->index];
lv->offset = tsi;
/* get the head/only segment */
t = &p->slot[tsi];
ASSERT(p->header.flag & BT_INTERNAL);
((struct idtentry *) t)->namlen = 0;
si = ((struct idtentry *) t)->next;
((struct idtentry *) t)->next = -1;
n = 1;
freecnt = 0;
fsi = si;
xsi = tsi;
/* find the last/only segment */
while (si >= 0) {
/* is next slot contiguous ? */
if (si != xsi + 1) {
/* close current linelock */
lv->length = n;
dtlck->index++;
/* open new linelock */
if (dtlck->index < dtlck->maxcnt)
lv++;
else {
dtlck = (struct dt_lock *) txLinelock(dtlck);
lv = & dtlck->lv[0];
}
lv->offset = si;
n = 0;
}
n++;
xsi = si;
freecnt++;
t = &p->slot[si];
t->cnt = 1;
si = t->next;
}
/* close current linelock */
lv->length = n;
dtlck->index++;
*dtlock = dtlck;
/* update freelist */
if (freecnt == 0)
return;
t->next = p->header.freelist;
p->header.freelist = fsi;
p->header.freecnt += freecnt;
}
/*
* dtLinelockFreelist()
*/
static void dtLinelockFreelist(dtpage_t * p, /* directory page */
int m, /* max slot index */
struct dt_lock ** dtlock)
{
int fsi; /* free entry slot index */
struct dtslot *t;
int si;
struct dt_lock *dtlck = *dtlock;
struct lv *lv;
int xsi, n;
/* get free entry slot index */
fsi = p->header.freelist;
/* open new linelock */
if (dtlck->index >= dtlck->maxcnt)
dtlck = (struct dt_lock *) txLinelock(dtlck);
lv = & dtlck->lv[dtlck->index];
lv->offset = fsi;
n = 1;
xsi = fsi;
t = &p->slot[fsi];
si = t->next;
/* find the last/only segment */
while (si < m && si >= 0) {
/* is next slot contiguous ? */
if (si != xsi + 1) {
/* close current linelock */
lv->length = n;
dtlck->index++;
/* open new linelock */
if (dtlck->index < dtlck->maxcnt)
lv++;
else {
dtlck = (struct dt_lock *) txLinelock(dtlck);
lv = & dtlck->lv[0];
}
lv->offset = si;
n = 0;
}
n++;
xsi = si;
t = &p->slot[si];
si = t->next;
}
/* close current linelock */
lv->length = n;
dtlck->index++;
*dtlock = dtlck;
}
/*
* NAME: dtModify
*
* FUNCTION: Modify the inode number part of a directory entry
*
* PARAMETERS:
* tid - Transaction id
* ip - Inode of parent directory
* key - Name of entry to be modified
* orig_ino - Original inode number expected in entry
* new_ino - New inode number to put into entry
* flag - JFS_RENAME
*
* RETURNS:
* -ESTALE - If entry found does not match orig_ino passed in
* -ENOENT - If no entry can be found to match key
* 0 - If successfully modified entry
*/
int dtModify(tid_t tid, struct inode *ip,
struct component_name * key, ino_t * orig_ino, ino_t new_ino, int flag)
{
int rc;
s64 bn;
struct metapage *mp;
dtpage_t *p;
int index;
struct btstack btstack;
struct tlock *tlck;
struct dt_lock *dtlck;
struct lv *lv;
s8 *stbl;
int entry_si; /* entry slot index */
struct ldtentry *entry;
/*
* search for the entry to modify:
*
* dtSearch() returns (leaf page pinned, index at which to modify).
*/
if ((rc = dtSearch(ip, key, orig_ino, &btstack, flag)))
return rc;
/* retrieve search result */
DT_GETSEARCH(ip, btstack.top, bn, mp, p, index);
BT_MARK_DIRTY(mp, ip);
/*
* acquire a transaction lock on the leaf page of named entry
*/
tlck = txLock(tid, ip, mp, tlckDTREE | tlckENTRY);
dtlck = (struct dt_lock *) & tlck->lock;
/* get slot index of the entry */
stbl = DT_GETSTBL(p);
entry_si = stbl[index];
/* linelock entry */
ASSERT(dtlck->index == 0);
lv = & dtlck->lv[0];
lv->offset = entry_si;
lv->length = 1;
dtlck->index++;
/* get the head/only segment */
entry = (struct ldtentry *) & p->slot[entry_si];
/* substitute the inode number of the entry */
entry->inumber = cpu_to_le32(new_ino);
/* unpin the leaf page */
DT_PUTPAGE(mp);
return 0;
}
]
|
| 74/2 |
2026/05/13 01:25 |
llm |
expert |
0m
Model:
Tokens:
input: 152499
output: 48
thoughts: 3965
Thoughts: **Analysis of the JFS Bug: A Deep Dive**
Okay, let's break this down systematically. The core of the issue seems to be the `DT_GETPAGE` macro and, more specifically, the `DT_GETPAGE` call to `BT_GETPAGE` which then calls `add_missing_indices`. My initial impression is that the assertion failure, `assert(p->header.flag & BT_LEAF)`, is the critical point. As an expert, I'm thinking: this suggests the code is *expecting* a leaf node but encountering something else during a directory traversal, probably due to a corrupted data structure.
My immediate concern is: Is this exploitable, or just a filesystem corruption? Analyzing the code, I see that `stbl[i]` which is the crux of accessing the `slot` array inside the page struct. I am carefully examining the loop conditions and array indexing to confirm there is no out-of-bounds read or write. I'm focusing specifically on how `stblindex` interacts with `DTPAGEMAXSLOT`, `DTPAGEMAXSLOT`, and `p->slot` to ensure memory safety. The variable `stbl[i]` is of type `s8`. This means it has a range between -128 to 127. If `stbl[i]` is negative it will just return `-EIO`, and it's always an in-bounds access to the `p->slot` array with sizes 128 of 32-byte slots.
The code appears to correctly handle error conditions such as an `stblindex` out of expected range. It seems to correctly validate `maxslot` and `nextindex` to prevent out-of-bounds access. The error handling, in the event of an error, such as a corrupt page, involves marking the filesystem as dirty or optionally remounting it as read-only, which, by itself, is not a DoS condition. Now, the `BUG()` assertion failure, however, could lead to a kernel panic if `CONFIG_JFS_DEBUG` is enabled. It's a key point and worth noting that by default `CONFIG_JFS_DEBUG` is not enabled so there is no panic unless syzbot or a test system intentionally enables debugging.
The code's vulnerability, then, isn't a direct memory corruption or DoS in production builds (where `CONFIG_JFS_DEBUG` is disabled), but the corrupted data could cause directory access problems or failures. For an unprivileged user, the bug would be triggered by a carefully constructed JFS image. It means it's a filesystem corruption bug that can be triggered by a malicious file image. I also checked `add_index` and `jfs_readdir` and confirmed the memory operations are within bounds. The critical point is the assertion.
So, summing this up:
* **Exploitable:** No, it's a filesystem corruption.
* **DoS:** No, default build has no panic, only file system corruption.
* **Access:** Yes, any unprivileged user can trigger this if they have access to a malicious filesystem.
I am confident, as the expert in this area, that there is no memory corruption, there's no DoS vulnerability unless the specific debugging option is enabled, but the filesystem corruption is a problem.
|
| 75/2 |
2026/05/13 01:26 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/jfs/jfs_unicode.c IncludeLines:true Name:jfs_strfromUCS_le]
Results: map[SourceCode: 13: /*
14: * NAME: jfs_strfromUCS()
15: *
16: * FUNCTION: Convert little-endian unicode string to character string
17: *
18: */
19: int jfs_strfromUCS_le(char *to, const __le16 * from,
20: int len, struct nls_table *codepage)
21: {
22: int i;
23: int outlen = 0;
24: static int warn_again = 5; /* Only warn up to 5 times total */
25: int warn = !!warn_again; /* once per string */
26:
27: if (codepage) {
28: for (i = 0; (i < len) && from[i]; i++) {
29: int charlen;
30: charlen =
31: codepage->uni2char(le16_to_cpu(from[i]),
32: &to[outlen],
33: NLS_MAX_CHARSET_SIZE);
34: if (charlen > 0)
35: outlen += charlen;
36: else
37: to[outlen++] = '?';
38: }
39: } else {
40: for (i = 0; (i < len) && from[i]; i++) {
41: if (unlikely(le16_to_cpu(from[i]) & 0xff00)) {
42: to[i] = '?';
43: if (unlikely(warn)) {
44: warn--;
45: warn_again--;
46: printk(KERN_ERR
47: "non-latin1 character 0x%x found in JFS file name\n",
48: le16_to_cpu(from[i]));
49: printk(KERN_ERR
50: "mount with iocharset=utf8 to access\n");
51: }
52:
53: }
54: else
55: to[i] = (char) (le16_to_cpu(from[i]));
56: }
57: outlen = i;
58: }
59: to[outlen] = 0;
60: return outlen;
61: }
SourceFile:fs/jfs/jfs_unicode.c]
|
| 76/2 |
2026/05/13 01:26 |
llm |
expert |
0m
Model:
Tokens:
input: 157936
output: 26
thoughts: 1163
Thoughts: **Buffer Overflow Vulnerability in JFS Filesystem: A Deep Dive**
Okay, so I've been digging into this JFS code, and something's not quite right. My initial thought was: `jfs_strfromUCS_le` can write quite a bit, up to `len * NLS_MAX_CHARSET_SIZE` bytes, right? But then I noticed a check in `jfs_readdir`:
```c
if (((long) jfs_dirent + d->namlen + 1) >
(dirent_buf + PAGE_SIZE)) {
```
It seems to be assuming the output length will be no more than `d->namlen`. But hang on⦠`d->namlen` is the *character* length, specifically the number of `__le16` units. If a codepage is in play, each of those little-endian 16-bit characters could expand to multiple bytes, up to `NLS_MAX_CHARSET_SIZE`, and in practice, could be 3, 4, or even 6 bytes for something like UTF-8.
So, if `outlen` can be larger than `d->namlen`, then that function `jfs_strfromUCS_le` could easily write past the `dirent_buf + PAGE_SIZE` boundary! Let's get more concrete, if `d->namlen` is, say, the maximum value it can be, 255 (it's a `u8`), the check in `jfs_readdir` is looking at something like `jfs_dirent + 256 > dirent_buf + PAGE_SIZE`.
If the size check passes, the code proceeds and calls `jfs_strfromUCS_le` with `len = min(d_namleft, DTLHDRDATALEN)`. `DTLHDRDATALEN` is 11, so that function gets called at least once. After the first slot, the code iterates over additional segments of the file name:
```c
next = d->next;
while (next >= 0) {
t = (struct dtslot *) & p->slot[next];
name_ptr += outlen;
d_namleft -= len;
...
len = min(d_namleft, DTSLOTDATALEN);
outlen = jfs_strfromUCS_le(name_ptr, t->name,
len, codepage);
jfs_dirent->name_len += outlen;
next = t->next;
}
```
If we're using a UTF-8 codepage, and each `__le16` character expands to, say, 3 bytes, then `outlen` becomes approximately 3 times `len`. So the total bytes written could be 3 times `d->namlen`. If the first segment name takes up the full 255 slots, then the code could write up to 765 bytes.
Now, if `jfs_dirent` is located, say, 300 bytes before the end of the page buffer (4096 bytes), the initial size check will pass. But after that point the function `jfs_strfromUCS_le` writes 765 bytes, which *definitely* overwrites the buffer past its allocated memory! That's a textbook buffer overflow.
I need to confirm the definitions. Is `d->namlen` in bytes or characters? Checking `jfs_dtree.h`, it's clear that:
```c
struct ldtentry {
__le32 inumber; /* 4: 4-byte aligned */
s8 next; /* 1: */
u8 namlen; /* 1: */
__le16 name[11]; /* 22: 2-byte aligned */
__le32 index; /* 4: index into dir_table */
}; /* (32) */
```
`namlen` is a `u8`. Okay, and from `jfs_strfromUCS_le`:
```c
int jfs_strfromUCS_le(char *to, const __le16 * from,
int len, struct nls_table *codepage)
```
`len` there is the *number* of `__le16` characters. So `d->namlen` is indeed the *character* count. With a UTF-8 codepage, `uni2char` in `jfs_strfromUCS_le` can return
|
| 77/2 |
2026/05/13 01:26 |
tool |
grepper |
0m
Args: map[Expression:DBCS codepages could overrun dirent_buf]
Results: map[Output:fs/jfs/jfs_dtree.c=2714=int jfs_readdir(struct file *file, struct dir_context *ctx)
--
fs/jfs/jfs_dtree.c-2917- (dirent_buf + PAGE_SIZE)) {
fs/jfs/jfs_dtree.c:2918: /* DBCS codepages could overrun dirent_buf */
fs/jfs/jfs_dtree.c-2919- index = i;
]
|
| 78/2 |
2026/05/13 01:26 |
llm |
expert |
1m
Model:
Tokens:
input: 160290
output: 66
thoughts: 8629
Thoughts: **Analysis of the JFS `jfs_readdir` Vulnerability**
My analysis begins with a deep dive into a JFS filesystem bug report, specifically concerning an `ASSERT` failure within the `add_missing_indices` function. While the `ASSERT` itself, as reported by syzbot, is a no-op in production kernels (due to conditional compilation using `CONFIG_JFS_DEBUG`), its presence and surrounding code reveal a critical vulnerability in the `jfs_readdir` function, that can be triggered through a malicious JFS filesystem image. The primary concern is not the `ASSERT` failure itself, but the *consequences* of the code path it guards, particularly when it comes to the handling of internal dtree pages (which contain directory index metadata).
The root of the issue lies in `jfs_readdir`'s incorrect buffer size check when processing directory entries. The function, when reading directory entries, allocates a page-sized buffer (`dirent_buf`) to hold directory entries. The original developer knew that Double Byte Character Sets could cause an overflow, but the check for this condition only accounts for the *number of characters* (`d->namlen`) in the name of the directory entry, not the maximum number of bytes that the name will occupy *after* character encoding. In other words, `jfs_readdir` checks `jfs_dirent + d->namlen + 1 > dirent_buf + PAGE_SIZE`.
The critical flaw stems from the use of multibyte character encodings, such as UTF-8, which is the default in many systems and can be explicitly forced with the "iocharset=utf8" mount option. With UTF-8, a single character can translate to up to 6 bytes in the encoded representation. When `d->namlen` is small, `d->namlen + 1` is not enough to measure the output in bytes, and overflow happens. When a directory entry has a long name containing characters that expand in UTF-8, `jfs_strfromUCS_le` will be called, resulting in the writing of substantially more bytes than the buffer check anticipates. For a `d->namlen` of 255 (maximum), and with UTF-8, the check lets `jfs_strfromUCS_le` write over 1200 bytes past the end of the 4096-byte `dirent_buf` page, triggering a page-level heap buffer overflow. Since the attacker can control both the filename and the *type* of page being processed, this allows for the crafting of JFS images that reliably trigger the vulnerability. The fact that the bug report is focused on an internal page is critical here because it gives the attacker a vector by which they can control and exploit the vulnerability!
Importantly, even if the "ASSERT" were *enabled* (e.g., during kernel debugging with `CONFIG_JFS_DEBUG`), it would be a denial-of-service (kernel panic), preventing further execution. However, in production builds (without `CONFIG_JFS_DEBUG`), the `ASSERT` is compiled out, so the check is bypassed, and the subsequent buffer overflow occurs and can result in kernel memory corruption!
In summary, while the reported `ASSERT` is innocuous in production, the code path that bypasses it triggers a highly exploitable heap buffer overflow. This vulnerability allows an unprivileged user (or a process in a user namespace with mount capabilities) to trigger a buffer overflow in the kernel. A malicious USB drive or network share containing a JFS filesystem can be used to trigger this vulnerability, leading to a system crash, and in the worst-case scenario, to privilege escalation.
|
| 79/2 |
2026/05/13 01:28 |
tool |
set-results |
0m
Args: map[DenialOfService:true Exploitable:true FilesystemTrigger:true NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:true UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
Results: map[DenialOfService:true Exploitable:true FilesystemTrigger:true NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:true UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
|
| 80/2 |
2026/05/13 01:28 |
llm |
expert |
0m
Model:
Tokens:
input: 169825
output: 1010
thoughts: 13
Thoughts: Okay, here's my attempt at summarizing the thought process, as requested, aimed at an expert user:
**Finalizing the Response**
Alright, the data's locked in, the analysis is complete. Now it's time to craft the final response. I've considered all the angles, weighed the implications, and I'm ready to translate this complex information into a clear and compelling narrative. It's about distilling the essence, communicating the nuance, and making sure the conclusion is both sound and readily accessible. Time to synthesize. I'll make sure to cover all the key findings, address the relevant caveats and ensure it adds value to the conversation.
|
| 81/1 |
2026/05/13 01:28 |
action |
format-explanation |
0m
Results: map[Explanation:Based on the analysis of the provided bug report and the JFS source code, here
is the security assessment:
### Root Cause Analysis
The bug report indicates a `BUG()` triggered by an `ASSERT(p->header.flag &
BT_LEAF)` in `add_missing_indices()` (called from `jfs_readdir()`). This happens
when `jfs_readdir()` encounters a corrupted directory index and attempts to fix
it, but the page it is processing is actually an internal B+-tree page
(`BT_INTERNAL`) rather than a leaf page (`BT_LEAF`), or a completely corrupted
page with `p->header.flag == 0`.
However, in JFS, `ASSERT()` is only active if `CONFIG_JFS_DEBUG` is enabled. In
standard production kernel builds (e.g., Ubuntu, Debian, Android),
`CONFIG_JFS_DEBUG` is disabled, meaning the `ASSERT()` macro compiles to a no-op
(`do {} while (0)`).
When the assertion is compiled out, `add_missing_indices()` proceeds to modify
the internal page and returns. `jfs_readdir()` then continues to process the
internal page as if it were a leaf page. This causes it to read `struct
idtentry` structures as `struct ldtentry` structures. Because the layouts
differ, the `namlen` (name length) field of the `ldtentry` overlaps with the
attacker-controlled extent descriptor (`xd`) of the `idtentry`. This allows the
attacker to fully control `d->namlen` (up to 255) and the subsequent `d->name`
characters.
### Exploitation via Buffer Overflow
This leads directly to a highly exploitable buffer overflow in `jfs_readdir()`.
When checking if the new directory entry will fit into the allocated page-sized
buffer (`dirent_buf`), the code does the following:
```c
if (((long) jfs_dirent + d->namlen + 1) > (dirent_buf + PAGE_SIZE)) {
/* DBCS codepages could overrun dirent_buf */
index = i;
overflow = 1;
break;
}
```
The check assumes that the output string length will be roughly equal to
`d->namlen`. However, `d->namlen` is the number of `__le16` characters, not
bytes. When a multibyte NLS codepage is used (like UTF-8, which can be forced by
the attacker by mounting the filesystem with `iocharset=utf8`),
`jfs_strfromUCS_le()` can write up to 3-6 bytes per character.
If `jfs_dirent` is near the end of the page (e.g., 260 bytes remaining) and the
attacker provides `d->namlen = 255`, the check `255 + 1 > 260` is false, so the
loop proceeds. `jfs_strfromUCS_le()` will then convert the 255 characters into
UTF-8, writing up to `255 * 3 = 765` bytes into the buffer. This results in a
**~500-byte out-of-bounds write** past the end of the `dirent_buf` page.
Since `dirent_buf` is allocated via `__get_free_page(GFP_KERNEL)`, this is a
page-level heap buffer overflow. The attacker controls the contents of the
overflow (the UTF-8 encoded characters), making this highly exploitable for
**Privilege Escalation** and **Denial of Service**.
### Security Dimensions
* **Exploitable:** **Yes**. The bug leads to a page-level heap out-of-bounds
write of attacker-controlled data, which can be leveraged for privilege
escalation.
* **Denial of Service:** **Yes**. The out-of-bounds write will corrupt adjacent
kernel memory, leading to a system crash. (In debug builds, the `ASSERT` itself
causes a panic).
* **Accessible From Unprivileged Processes:** **Yes**. Any unprivileged user can
trigger the bug by calling the `readdir` syscall on the mounted malicious JFS
filesystem.
* **Accessible From User Namespaces:** **Yes**. If the filesystem is mounted, it
can be accessed from within a user namespace.
* **Peripheral Trigger:** **Yes**. The bug can be triggered by plugging in a
malicious USB drive formatted with a crafted JFS filesystem.
* **Malicious Filesystem Trigger:** **Yes**. The vulnerability relies on parsing
a maliciously crafted JFS filesystem image.
* **VM Guest / Host / Network / Remote Triggers:** **No**. This is a local
filesystem vulnerability.]
|