Skip to content

Commit 1195c10

Browse files
MinghuanLianbjorn-helgaas
authored andcommitted
PCI: layerscape: Fix MSG TLP drop setting
Some kinds of Layerscape PCIe controllers will forward the received message TLPs to system application address space, which could corrupt system memory or lead to a system hang. Enable MSG_DROP to fix this issue. Signed-off-by: Minghuan Lian <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent 79e3f4a commit 1195c10

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

drivers/pci/host/pci-layerscape.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@ static void ls_pcie_fix_class(struct ls_pcie *pcie)
7777
iowrite16(PCI_CLASS_BRIDGE_PCI, pcie->dbi + PCI_CLASS_DEVICE);
7878
}
7979

80+
/* Drop MSG TLP except for Vendor MSG */
81+
static void ls_pcie_drop_msg_tlp(struct ls_pcie *pcie)
82+
{
83+
u32 val;
84+
85+
val = ioread32(pcie->dbi + PCIE_STRFMR1);
86+
val &= 0xDFFFFFFF;
87+
iowrite32(val, pcie->dbi + PCIE_STRFMR1);
88+
}
89+
8090
static int ls1021_pcie_link_up(struct pcie_port *pp)
8191
{
8292
u32 state;
@@ -97,7 +107,7 @@ static int ls1021_pcie_link_up(struct pcie_port *pp)
97107
static void ls1021_pcie_host_init(struct pcie_port *pp)
98108
{
99109
struct ls_pcie *pcie = to_ls_pcie(pp);
100-
u32 val, index[2];
110+
u32 index[2];
101111

102112
pcie->scfg = syscon_regmap_lookup_by_phandle(pp->dev->of_node,
103113
"fsl,pcie-scfg");
@@ -116,13 +126,7 @@ static void ls1021_pcie_host_init(struct pcie_port *pp)
116126

117127
dw_pcie_setup_rc(pp);
118128

119-
/*
120-
* LS1021A Workaround for internal TKT228622
121-
* to fix the INTx hang issue
122-
*/
123-
val = ioread32(pcie->dbi + PCIE_STRFMR1);
124-
val &= 0xffff;
125-
iowrite32(val, pcie->dbi + PCIE_STRFMR1);
129+
ls_pcie_drop_msg_tlp(pcie);
126130
}
127131

128132
static int ls_pcie_link_up(struct pcie_port *pp)
@@ -147,6 +151,7 @@ static void ls_pcie_host_init(struct pcie_port *pp)
147151
iowrite32(1, pcie->dbi + PCIE_DBI_RO_WR_EN);
148152
ls_pcie_fix_class(pcie);
149153
ls_pcie_clear_multifunction(pcie);
154+
ls_pcie_drop_msg_tlp(pcie);
150155
iowrite32(0, pcie->dbi + PCIE_DBI_RO_WR_EN);
151156
}
152157

0 commit comments

Comments
 (0)