diff options
author | Joerg Roedel <jroedel@suse.de> | 2015-11-17 18:11:37 +0300 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2015-12-14 17:39:34 +0300 |
commit | 43c0ea20de4de8e2d753dff0e76129c4febafffa (patch) | |
tree | 19e529231c3ccca18b823329f72f5bcfb1529880 /drivers/iommu/amd_iommu_v2.c | |
parent | 7f8312a3b31de5676144d9e75f2f2647c8b4b769 (diff) | |
download | linux-43c0ea20de4de8e2d753dff0e76129c4febafffa.tar.xz |
iommu/amd: Correctly set flags for handle_mm_fault call
Instead of just checking for a write access, calculate the
flags that are passed to handle_mm_fault() more precisly and
use the pre-defined macros.
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Acked-By: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/amd_iommu_v2.c')
-rw-r--r-- | drivers/iommu/amd_iommu_v2.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c index 7caf2fa237f2..a7edbd6851c4 100644 --- a/drivers/iommu/amd_iommu_v2.c +++ b/drivers/iommu/amd_iommu_v2.c @@ -513,16 +513,20 @@ static bool access_error(struct vm_area_struct *vma, struct fault *fault) static void do_fault(struct work_struct *work) { struct fault *fault = container_of(work, struct fault, work); - struct mm_struct *mm; struct vm_area_struct *vma; + unsigned int flags = 0; + struct mm_struct *mm; u64 address; - int ret, write; - - write = !!(fault->flags & PPR_FAULT_WRITE); + int ret; mm = fault->state->mm; address = fault->address; + if (fault->flags & PPR_FAULT_USER) + flags |= FAULT_FLAG_USER; + if (fault->flags & PPR_FAULT_WRITE) + flags |= FAULT_FLAG_WRITE; + down_read(&mm->mmap_sem); vma = find_extend_vma(mm, address); if (!vma || address < vma->vm_start) { @@ -539,7 +543,7 @@ static void do_fault(struct work_struct *work) goto out; } - ret = handle_mm_fault(mm, vma, address, write); + ret = handle_mm_fault(mm, vma, address, flags); if (ret & VM_FAULT_ERROR) { /* failed to service fault */ up_read(&mm->mmap_sem); |