浏览代码

s390/pci_dma: unify label of invalid translation table entries

Newly allocated translation table entries are flagged as invalid
and protected. If an existing translation table entry is invalidated,
the protection flag is left unchanged.

If a page (with invalid and protection flag set) is accessed it's
undefined which type of exception we'll receive.

Make sure to always set the invalid flag only.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Reviewed-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Sebastian Ott 9 年之前
父节点
当前提交
4d5a6b7295
共有 1 个文件被更改,包括 3 次插入4 次删除
  1. 3 4
      arch/s390/pci/pci_dma.c

+ 3 - 4
arch/s390/pci/pci_dma.c

@@ -33,7 +33,7 @@ unsigned long *dma_alloc_cpu_table(void)
 		return NULL;
 		return NULL;
 
 
 	for (entry = table; entry < table + ZPCI_TABLE_ENTRIES; entry++)
 	for (entry = table; entry < table + ZPCI_TABLE_ENTRIES; entry++)
-		*entry = ZPCI_TABLE_INVALID | ZPCI_TABLE_PROTECTED;
+		*entry = ZPCI_TABLE_INVALID;
 	return table;
 	return table;
 }
 }
 
 
@@ -51,7 +51,7 @@ static unsigned long *dma_alloc_page_table(void)
 		return NULL;
 		return NULL;
 
 
 	for (entry = table; entry < table + ZPCI_PT_ENTRIES; entry++)
 	for (entry = table; entry < table + ZPCI_PT_ENTRIES; entry++)
-		*entry = ZPCI_PTE_INVALID | ZPCI_TABLE_PROTECTED;
+		*entry = ZPCI_PTE_INVALID;
 	return table;
 	return table;
 }
 }
 
 
@@ -127,7 +127,6 @@ void dma_update_cpu_trans(unsigned long *dma_table, void *page_addr,
 
 
 	if (flags & ZPCI_PTE_INVALID) {
 	if (flags & ZPCI_PTE_INVALID) {
 		invalidate_pt_entry(entry);
 		invalidate_pt_entry(entry);
-		return;
 	} else {
 	} else {
 		set_pt_pfaa(entry, page_addr);
 		set_pt_pfaa(entry, page_addr);
 		validate_pt_entry(entry);
 		validate_pt_entry(entry);
@@ -311,7 +310,7 @@ static void s390_dma_unmap_pages(struct device *dev, dma_addr_t dma_addr,
 	npages = iommu_num_pages(dma_addr, size, PAGE_SIZE);
 	npages = iommu_num_pages(dma_addr, size, PAGE_SIZE);
 	dma_addr = dma_addr & PAGE_MASK;
 	dma_addr = dma_addr & PAGE_MASK;
 	if (dma_update_trans(zdev, 0, dma_addr, npages * PAGE_SIZE,
 	if (dma_update_trans(zdev, 0, dma_addr, npages * PAGE_SIZE,
-			     ZPCI_TABLE_PROTECTED | ZPCI_PTE_INVALID)) {
+			     ZPCI_PTE_INVALID)) {
 		zpci_err("unmap error:\n");
 		zpci_err("unmap error:\n");
 		zpci_err_hex(&dma_addr, sizeof(dma_addr));
 		zpci_err_hex(&dma_addr, sizeof(dma_addr));
 	}
 	}