[SPARC64]: Fix for Niagara memory corruption.
On some sun4v systems, after netboot the ethernet controller and it's DMA mappings can be left active. The net result is that the kernel can end up using memory the ethernet controller will continue to DMA into, resulting in corruption. To deal with this, we are more careful about importing IOMMU translations which OBP has left in the IO-TLB. If the mapping maps into an area the firmware claimed was free and available memory for the kernel to use, we demap instead of import that IOMMU entry. This is going to cause the network chip to take a PCI master abort on the next DMA it attempts, if it has been left going like this. All tests show that this is handled properly by the PCI layer and the e1000 drivers. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
486ad10a7e
commit
c2a5a46be4
@@ -988,8 +988,13 @@ static unsigned long probe_existing_entries(struct pci_pbm_info *pbm,
|
||||
HV_PCI_TSBID(0, i),
|
||||
&io_attrs, &ra);
|
||||
if (ret == HV_EOK) {
|
||||
cnt++;
|
||||
__set_bit(i, arena->map);
|
||||
if (page_in_phys_avail(ra)) {
|
||||
pci_sun4v_iommu_demap(devhandle,
|
||||
HV_PCI_TSBID(0, i), 1);
|
||||
} else {
|
||||
cnt++;
|
||||
__set_bit(i, arena->map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1062,9 +1067,9 @@ static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm)
|
||||
iommu->arena.limit = num_tsb_entries;
|
||||
|
||||
sz = probe_existing_entries(pbm, iommu);
|
||||
|
||||
printk("%s: TSB entries [%lu], existing mapings [%lu]\n",
|
||||
pbm->name, num_tsb_entries, sz);
|
||||
if (sz)
|
||||
printk("%s: Imported %lu TSB entries from OBP\n",
|
||||
pbm->name, sz);
|
||||
}
|
||||
|
||||
static void pci_sun4v_get_bus_range(struct pci_pbm_info *pbm)
|
||||
|
Reference in New Issue
Block a user