Skip to content

Commit 1c63df2

Browse files
committed
Merge tag 'pci-v7.0-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci
Pull pci fixes from Bjorn Helgaas: - Update MAINTAINERS email address (Shawn Guo) - Refresh cached Endpoint driver MSI Message Address to fix a v7.0 regression when kernel changes the address after firmware has configured it (Niklas Cassel) - Flush Endpoint MSI-X writes so they complete before the outbound ATU entry is unmapped (Niklas Cassel) - Correct the PCI_CAP_EXP_ENDPOINT_SIZEOF_V2 value, which broke VMM use of PCI capabilities (Bjorn Helgaas) * tag 'pci-v7.0-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci: PCI: Correct PCI_CAP_EXP_ENDPOINT_SIZEOF_V2 value PCI: dwc: ep: Flush MSI-X write before unmapping its ATU entry PCI: dwc: ep: Refresh MSI Message Address cache on change MAINTAINERS: Update Shawn Guo's address for HiSilicon PCIe controller driver
2 parents aed968f + 3919599 commit 1c63df2

3 files changed

Lines changed: 18 additions & 11 deletions

File tree

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20507,7 +20507,7 @@ F: Documentation/devicetree/bindings/pci/hisilicon,kirin-pcie.yaml
2050720507
F: drivers/pci/controller/dwc/pcie-kirin.c
2050820508

2050920509
PCIE DRIVER FOR HISILICON STB
20510-
M: Shawn Guo <shawn.guo@linaro.org>
20510+
M: Shawn Guo <shawnguo@kernel.org>
2051120511
L: linux-pci@vger.kernel.org
2051220512
S: Maintained
2051320513
F: Documentation/devicetree/bindings/pci/hisilicon-histb-pcie.txt

drivers/pci/controller/dwc/pcie-designware-ep.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,19 @@ int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no,
905905
* supported, so we avoid reprogramming the region on every MSI,
906906
* specifically unmapping immediately after writel().
907907
*/
908+
if (ep->msi_iatu_mapped && (ep->msi_msg_addr != msg_addr ||
909+
ep->msi_map_size != map_size)) {
910+
/*
911+
* The host changed the MSI target address or the required
912+
* mapping size changed. Reprogramming the iATU when there are
913+
* operations in flight is unsafe on this controller. However,
914+
* there is no unified way to check if we have operations in
915+
* flight, thus we don't know if we should WARN() or not.
916+
*/
917+
dw_pcie_ep_unmap_addr(epc, func_no, 0, ep->msi_mem_phys);
918+
ep->msi_iatu_mapped = false;
919+
}
920+
908921
if (!ep->msi_iatu_mapped) {
909922
ret = dw_pcie_ep_map_addr(epc, func_no, 0,
910923
ep->msi_mem_phys, msg_addr,
@@ -915,15 +928,6 @@ int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no,
915928
ep->msi_iatu_mapped = true;
916929
ep->msi_msg_addr = msg_addr;
917930
ep->msi_map_size = map_size;
918-
} else if (WARN_ON_ONCE(ep->msi_msg_addr != msg_addr ||
919-
ep->msi_map_size != map_size)) {
920-
/*
921-
* The host changed the MSI target address or the required
922-
* mapping size changed. Reprogramming the iATU at runtime is
923-
* unsafe on this controller, so bail out instead of trying to
924-
* update the existing region.
925-
*/
926-
return -EINVAL;
927931
}
928932

929933
writel(msg_data | (interrupt_num - 1), ep->msi_mem + offset);
@@ -1010,6 +1014,9 @@ int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no,
10101014

10111015
writel(msg_data, ep->msi_mem + offset);
10121016

1017+
/* flush posted write before unmap */
1018+
readl(ep->msi_mem + offset);
1019+
10131020
dw_pcie_ep_unmap_addr(epc, func_no, 0, ep->msi_mem_phys);
10141021

10151022
return 0;

include/uapi/linux/pci_regs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@
712712
#define PCI_EXP_LNKCTL2_HASD 0x0020 /* HW Autonomous Speed Disable */
713713
#define PCI_EXP_LNKSTA2 0x32 /* Link Status 2 */
714714
#define PCI_EXP_LNKSTA2_FLIT 0x0400 /* Flit Mode Status */
715-
#define PCI_CAP_EXP_ENDPOINT_SIZEOF_V2 0x32 /* end of v2 EPs w/ link */
715+
#define PCI_CAP_EXP_ENDPOINT_SIZEOF_V2 0x34 /* end of v2 EPs w/ link */
716716
#define PCI_EXP_SLTCAP2 0x34 /* Slot Capabilities 2 */
717717
#define PCI_EXP_SLTCAP2_IBPD 0x00000001 /* In-band PD Disable Supported */
718718
#define PCI_EXP_SLTCTL2 0x38 /* Slot Control 2 */

0 commit comments

Comments
 (0)