提交 791185b4 编写于 作者: K Kunkun Jiang 提交者: Zheng Zengkai

Revert "iommu/io-pgtable-arm: Make data access permissions of stage1/2 compatible"

virt inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I61SPO
CVE: NA

--------------------------------

This reverts commit 524f1339.
Signed-off-by: NKunkun Jiang <jiangkunkun@huawei.com>
Reviewed-by: NKeqian Zhu <zhukeqian1@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 1b9d6aea
...@@ -159,23 +159,6 @@ static inline bool iopte_leaf(arm_lpae_iopte pte, int lvl, ...@@ -159,23 +159,6 @@ static inline bool iopte_leaf(arm_lpae_iopte pte, int lvl,
return iopte_type(pte, lvl) == ARM_LPAE_PTE_TYPE_BLOCK; return iopte_type(pte, lvl) == ARM_LPAE_PTE_TYPE_BLOCK;
} }
static inline bool arm_lpae_pte_writable(struct arm_lpae_io_pgtable *data,
arm_lpae_iopte pte, int lvl)
{
if (iopte_leaf(pte, lvl, data->iop.fmt)) {
if (data->iop.fmt == ARM_64_LPAE_S1 ||
data->iop.fmt == ARM_32_LPAE_S1) {
if (!(pte & ARM_LPAE_PTE_AP_RDONLY))
return true;
} else {
if (pte & ARM_LPAE_PTE_HAP_WRITE)
return true;
}
}
return false;
}
static arm_lpae_iopte paddr_to_iopte(phys_addr_t paddr, static arm_lpae_iopte paddr_to_iopte(phys_addr_t paddr,
struct arm_lpae_io_pgtable *data) struct arm_lpae_io_pgtable *data)
{ {
...@@ -769,7 +752,7 @@ static size_t __arm_lpae_split_block(struct arm_lpae_io_pgtable *data, ...@@ -769,7 +752,7 @@ static size_t __arm_lpae_split_block(struct arm_lpae_io_pgtable *data,
if (size == ARM_LPAE_BLOCK_SIZE(lvl, data)) { if (size == ARM_LPAE_BLOCK_SIZE(lvl, data)) {
if (iopte_leaf(pte, lvl, iop->fmt)) { if (iopte_leaf(pte, lvl, iop->fmt)) {
if (lvl == (ARM_LPAE_MAX_LEVELS - 1) || if (lvl == (ARM_LPAE_MAX_LEVELS - 1) ||
!arm_lpae_pte_writable(data, pte, lvl)) (pte & ARM_LPAE_PTE_AP_RDONLY))
return size; return size;
/* We find a writable block, split it. */ /* We find a writable block, split it. */
...@@ -923,7 +906,7 @@ static int __arm_lpae_sync_dirty_log(struct arm_lpae_io_pgtable *data, ...@@ -923,7 +906,7 @@ static int __arm_lpae_sync_dirty_log(struct arm_lpae_io_pgtable *data,
if (size == ARM_LPAE_BLOCK_SIZE(lvl, data)) { if (size == ARM_LPAE_BLOCK_SIZE(lvl, data)) {
if (iopte_leaf(pte, lvl, iop->fmt)) { if (iopte_leaf(pte, lvl, iop->fmt)) {
if (!arm_lpae_pte_writable(data, pte, lvl)) if (pte & ARM_LPAE_PTE_AP_RDONLY)
return 0; return 0;
/* It is writable, set the bitmap */ /* It is writable, set the bitmap */
...@@ -944,7 +927,7 @@ static int __arm_lpae_sync_dirty_log(struct arm_lpae_io_pgtable *data, ...@@ -944,7 +927,7 @@ static int __arm_lpae_sync_dirty_log(struct arm_lpae_io_pgtable *data,
} }
return 0; return 0;
} else if (iopte_leaf(pte, lvl, iop->fmt)) { } else if (iopte_leaf(pte, lvl, iop->fmt)) {
if (!arm_lpae_pte_writable(data, pte, lvl)) if (pte & ARM_LPAE_PTE_AP_RDONLY)
return 0; return 0;
/* Though the size is too small, also set bitmap */ /* Though the size is too small, also set bitmap */
...@@ -1011,7 +994,7 @@ static int __arm_lpae_clear_dirty_log(struct arm_lpae_io_pgtable *data, ...@@ -1011,7 +994,7 @@ static int __arm_lpae_clear_dirty_log(struct arm_lpae_io_pgtable *data,
if (size == ARM_LPAE_BLOCK_SIZE(lvl, data)) { if (size == ARM_LPAE_BLOCK_SIZE(lvl, data)) {
if (iopte_leaf(pte, lvl, iop->fmt)) { if (iopte_leaf(pte, lvl, iop->fmt)) {
if (!arm_lpae_pte_writable(data, pte, lvl)) if (pte & ARM_LPAE_PTE_AP_RDONLY)
return 0; return 0;
/* Ensure all corresponding bits are set */ /* Ensure all corresponding bits are set */
...@@ -1023,11 +1006,7 @@ static int __arm_lpae_clear_dirty_log(struct arm_lpae_io_pgtable *data, ...@@ -1023,11 +1006,7 @@ static int __arm_lpae_clear_dirty_log(struct arm_lpae_io_pgtable *data,
} }
/* Race does not exist */ /* Race does not exist */
if ((data->iop.fmt == ARM_64_LPAE_S1) ||
(data->iop.fmt == ARM_32_LPAE_S1))
pte |= ARM_LPAE_PTE_AP_RDONLY; pte |= ARM_LPAE_PTE_AP_RDONLY;
else
pte &= ~ARM_LPAE_PTE_HAP_WRITE;
__arm_lpae_set_pte(ptep, pte, &iop->cfg); __arm_lpae_set_pte(ptep, pte, &iop->cfg);
return 0; return 0;
} }
...@@ -1044,7 +1023,7 @@ static int __arm_lpae_clear_dirty_log(struct arm_lpae_io_pgtable *data, ...@@ -1044,7 +1023,7 @@ static int __arm_lpae_clear_dirty_log(struct arm_lpae_io_pgtable *data,
return 0; return 0;
} else if (iopte_leaf(pte, lvl, iop->fmt)) { } else if (iopte_leaf(pte, lvl, iop->fmt)) {
/* Though the size is too small, it is already clean */ /* Though the size is too small, it is already clean */
if (!arm_lpae_pte_writable(data, pte, lvl)) if (pte & ARM_LPAE_PTE_AP_RDONLY)
return 0; return 0;
return -EINVAL; return -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册