aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2015-10-26 06:15:28 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2015-11-09 03:10:49 -0500
commit4d5a6b72959601d6c12e7e1ef3aa4132f0a62523 (patch)
treeb933605bce726e3cbfaf0ffba9af73b6400bfeae
parent86b68c3873a82144033a82707781829e3f7b3859 (diff)
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>
-rw-r--r--arch/s390/pci/pci_dma.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c
index 37d10f74425a..e4a3a31fd59a 100644
--- a/arch/s390/pci/pci_dma.c
+++ b/arch/s390/pci/pci_dma.c
@@ -33,7 +33,7 @@ unsigned long *dma_alloc_cpu_table(void)
33 return NULL; 33 return NULL;
34 34
35 for (entry = table; entry < table + ZPCI_TABLE_ENTRIES; entry++) 35 for (entry = table; entry < table + ZPCI_TABLE_ENTRIES; entry++)
36 *entry = ZPCI_TABLE_INVALID | ZPCI_TABLE_PROTECTED; 36 *entry = ZPCI_TABLE_INVALID;
37 return table; 37 return table;
38} 38}
39 39
@@ -51,7 +51,7 @@ static unsigned long *dma_alloc_page_table(void)
51 return NULL; 51 return NULL;
52 52
53 for (entry = table; entry < table + ZPCI_PT_ENTRIES; entry++) 53 for (entry = table; entry < table + ZPCI_PT_ENTRIES; entry++)
54 *entry = ZPCI_PTE_INVALID | ZPCI_TABLE_PROTECTED; 54 *entry = ZPCI_PTE_INVALID;
55 return table; 55 return table;
56} 56}
57 57
@@ -127,7 +127,6 @@ void dma_update_cpu_trans(unsigned long *dma_table, void *page_addr,
127 127
128 if (flags & ZPCI_PTE_INVALID) { 128 if (flags & ZPCI_PTE_INVALID) {
129 invalidate_pt_entry(entry); 129 invalidate_pt_entry(entry);
130 return;
131 } else { 130 } else {
132 set_pt_pfaa(entry, page_addr); 131 set_pt_pfaa(entry, page_addr);
133 validate_pt_entry(entry); 132 validate_pt_entry(entry);
@@ -311,7 +310,7 @@ static void s390_dma_unmap_pages(struct device *dev, dma_addr_t dma_addr,
311 npages = iommu_num_pages(dma_addr, size, PAGE_SIZE); 310 npages = iommu_num_pages(dma_addr, size, PAGE_SIZE);
312 dma_addr = dma_addr & PAGE_MASK; 311 dma_addr = dma_addr & PAGE_MASK;
313 if (dma_update_trans(zdev, 0, dma_addr, npages * PAGE_SIZE, 312 if (dma_update_trans(zdev, 0, dma_addr, npages * PAGE_SIZE,
314 ZPCI_TABLE_PROTECTED | ZPCI_PTE_INVALID)) { 313 ZPCI_PTE_INVALID)) {
315 zpci_err("unmap error:\n"); 314 zpci_err("unmap error:\n");
316 zpci_err_hex(&dma_addr, sizeof(dma_addr)); 315 zpci_err_hex(&dma_addr, sizeof(dma_addr));
317 } 316 }