| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Trapped io support |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2008 Magnus Damm |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Intercept io operations by trapping. |
|---|
| 7 | | - * |
|---|
| 8 | | - * This file is subject to the terms and conditions of the GNU General Public |
|---|
| 9 | | - * License. See the file "COPYING" in the main directory of this archive |
|---|
| 10 | | - * for more details. |
|---|
| 11 | 8 | */ |
|---|
| 12 | 9 | #include <linux/kernel.h> |
|---|
| 13 | 10 | #include <linux/mm.h> |
|---|
| .. | .. |
|---|
| 102 | 99 | |
|---|
| 103 | 100 | return 0; |
|---|
| 104 | 101 | bad: |
|---|
| 105 | | - pr_warning("unable to install trapped io filter\n"); |
|---|
| 102 | + pr_warn("unable to install trapped io filter\n"); |
|---|
| 106 | 103 | return -1; |
|---|
| 107 | 104 | } |
|---|
| 108 | | -EXPORT_SYMBOL_GPL(register_trapped_io); |
|---|
| 109 | 105 | |
|---|
| 110 | 106 | void __iomem *match_trapped_io_handler(struct list_head *list, |
|---|
| 111 | 107 | unsigned long offset, |
|---|
| .. | .. |
|---|
| 134 | 130 | spin_unlock_irqrestore(&trapped_lock, flags); |
|---|
| 135 | 131 | return NULL; |
|---|
| 136 | 132 | } |
|---|
| 137 | | -EXPORT_SYMBOL_GPL(match_trapped_io_handler); |
|---|
| 138 | 133 | |
|---|
| 139 | 134 | static struct trapped_io *lookup_tiop(unsigned long address) |
|---|
| 140 | 135 | { |
|---|
| 141 | 136 | pgd_t *pgd_k; |
|---|
| 137 | + p4d_t *p4d_k; |
|---|
| 142 | 138 | pud_t *pud_k; |
|---|
| 143 | 139 | pmd_t *pmd_k; |
|---|
| 144 | 140 | pte_t *pte_k; |
|---|
| .. | .. |
|---|
| 148 | 144 | if (!pgd_present(*pgd_k)) |
|---|
| 149 | 145 | return NULL; |
|---|
| 150 | 146 | |
|---|
| 151 | | - pud_k = pud_offset(pgd_k, address); |
|---|
| 147 | + p4d_k = p4d_offset(pgd_k, address); |
|---|
| 148 | + if (!p4d_present(*p4d_k)) |
|---|
| 149 | + return NULL; |
|---|
| 150 | + |
|---|
| 151 | + pud_k = pud_offset(p4d_k, address); |
|---|
| 152 | 152 | if (!pud_present(*pud_k)) |
|---|
| 153 | 153 | return NULL; |
|---|
| 154 | 154 | |
|---|