Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 154773
b: refs/heads/master
c: 1c5a46e
h: refs/heads/master
i:
  154771: 8b6abdf
v: v3
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Jun 29, 2009
1 parent 1e574fb commit fcaede0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b026fd28ea23af24a3eea6e5be3f3d0193a8e87d
refs/heads/master: 1c5a46ed49e37f56f8aa9000bb1c2ac59670c372
16 changes: 7 additions & 9 deletions trunk/drivers/pci/intel-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1647,20 +1647,18 @@ static int
domain_page_mapping(struct dmar_domain *domain, dma_addr_t iova,
u64 hpa, size_t size, int prot)
{
u64 start_pfn, end_pfn;
unsigned long start_pfn = hpa >> VTD_PAGE_SHIFT;
unsigned long last_pfn = (hpa + size - 1) >> VTD_PAGE_SHIFT;
struct dma_pte *pte;
int index;
int addr_width = agaw_to_width(domain->agaw);
int index = 0;
int addr_width = agaw_to_width(domain->agaw) - VTD_PAGE_SHIFT;

BUG_ON(hpa >> addr_width);
BUG_ON(addr_width < BITS_PER_LONG && last_pfn >> addr_width);

if ((prot & (DMA_PTE_READ|DMA_PTE_WRITE)) == 0)
return -EINVAL;
iova &= PAGE_MASK;
start_pfn = ((u64)hpa) >> VTD_PAGE_SHIFT;
end_pfn = (VTD_PAGE_ALIGN(((u64)hpa) + size)) >> VTD_PAGE_SHIFT;
index = 0;
while (start_pfn < end_pfn) {

while (start_pfn <= last_pfn) {
pte = pfn_to_dma_pte(domain, (iova >> VTD_PAGE_SHIFT) + index);
if (!pte)
return -ENOMEM;
Expand Down

0 comments on commit fcaede0

Please sign in to comment.