浏览代码

PCI: ECAM: Map config region with pci_remap_cfgspace()

The current ECAM kernel implementation uses ioremap() to map the ECAM
configuration space memory region; this is not safe in that on some
architectures the ioremap interface provides mappings that allow posted
write transactions. This, as highlighted in the PCIe specifications (4.0 -
Rev0.3, "Ordering Considerations for the Enhanced Configuration Address
Mechanism"), can create ordering issues for software because posted writes
transactions on the CPU host bus are non posted in the PCI express fabric.

Update the ioremap() interface to use pci_remap_cfgspace() whose mapping
attributes guarantee that non-posted writes transactions are issued for
memory writes within the ECAM memory mapped address region.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Jayachandran C <jnair@caviumnetworks.com>
Lorenzo Pieralisi 8 年之前
父节点
当前提交
053497cec7
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      drivers/pci/ecam.c

+ 4 - 2
drivers/pci/ecam.c

@@ -84,12 +84,14 @@ struct pci_config_window *pci_ecam_create(struct device *dev,
 		if (!cfg->winp)
 		if (!cfg->winp)
 			goto err_exit_malloc;
 			goto err_exit_malloc;
 		for (i = 0; i < bus_range; i++) {
 		for (i = 0; i < bus_range; i++) {
-			cfg->winp[i] = ioremap(cfgres->start + i * bsz, bsz);
+			cfg->winp[i] =
+				pci_remap_cfgspace(cfgres->start + i * bsz,
+						   bsz);
 			if (!cfg->winp[i])
 			if (!cfg->winp[i])
 				goto err_exit_iomap;
 				goto err_exit_iomap;
 		}
 		}
 	} else {
 	} else {
-		cfg->win = ioremap(cfgres->start, bus_range * bsz);
+		cfg->win = pci_remap_cfgspace(cfgres->start, bus_range * bsz);
 		if (!cfg->win)
 		if (!cfg->win)
 			goto err_exit_iomap;
 			goto err_exit_iomap;
 	}
 	}