Skip to content

Commit cd02e4b

Browse files
shimodaybjorn-helgaas
authored andcommitted
PCI: dwc: Add outbound MSG TLPs support
Add "code" and "routing" into struct dw_pcie_ob_atu_cfg for triggering INTx IRQs by iATU in the PCIe endpoint mode in near the future. PCIE_ATU_INHIBIT_PAYLOAD is set to issue TLP type of Msg instead of MsgD. This implementation supports the data-less messages only for now. Link: https://lore.kernel.org/linux-pci/[email protected] Signed-off-by: Yoshihiro Shimoda <[email protected]> Signed-off-by: Frank Li <[email protected]> Signed-off-by: Krzysztof Wilczyński <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Serge Semin <[email protected]>
1 parent aa85ef6 commit cd02e4b

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,15 +499,20 @@ int dw_pcie_prog_outbound_atu(struct dw_pcie *pci,
499499
dw_pcie_writel_atu_ob(pci, atu->index, PCIE_ATU_UPPER_TARGET,
500500
upper_32_bits(atu->pci_addr));
501501

502-
val = atu->type | PCIE_ATU_FUNC_NUM(atu->func_no);
502+
val = atu->type | atu->routing | PCIE_ATU_FUNC_NUM(atu->func_no);
503503
if (upper_32_bits(limit_addr) > upper_32_bits(cpu_addr) &&
504504
dw_pcie_ver_is_ge(pci, 460A))
505505
val |= PCIE_ATU_INCREASE_REGION_SIZE;
506506
if (dw_pcie_ver_is(pci, 490A))
507507
val = dw_pcie_enable_ecrc(val);
508508
dw_pcie_writel_atu_ob(pci, atu->index, PCIE_ATU_REGION_CTRL1, val);
509509

510-
dw_pcie_writel_atu_ob(pci, atu->index, PCIE_ATU_REGION_CTRL2, PCIE_ATU_ENABLE);
510+
val = PCIE_ATU_ENABLE;
511+
if (atu->type == PCIE_ATU_TYPE_MSG) {
512+
/* The data-less messages only for now */
513+
val |= PCIE_ATU_INHIBIT_PAYLOAD | atu->code;
514+
}
515+
dw_pcie_writel_atu_ob(pci, atu->index, PCIE_ATU_REGION_CTRL2, val);
511516

512517
/*
513518
* Make sure ATU enable takes effect before any subsequent config

drivers/pci/controller/dwc/pcie-designware.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,13 @@
147147
#define PCIE_ATU_TYPE_IO 0x2
148148
#define PCIE_ATU_TYPE_CFG0 0x4
149149
#define PCIE_ATU_TYPE_CFG1 0x5
150+
#define PCIE_ATU_TYPE_MSG 0x10
150151
#define PCIE_ATU_TD BIT(8)
151152
#define PCIE_ATU_FUNC_NUM(pf) ((pf) << 20)
152153
#define PCIE_ATU_REGION_CTRL2 0x004
153154
#define PCIE_ATU_ENABLE BIT(31)
154155
#define PCIE_ATU_BAR_MODE_ENABLE BIT(30)
156+
#define PCIE_ATU_INHIBIT_PAYLOAD BIT(22)
155157
#define PCIE_ATU_FUNC_NUM_MATCH_EN BIT(19)
156158
#define PCIE_ATU_LOWER_BASE 0x008
157159
#define PCIE_ATU_UPPER_BASE 0x00C
@@ -302,6 +304,8 @@ struct dw_pcie_ob_atu_cfg {
302304
int index;
303305
int type;
304306
u8 func_no;
307+
u8 code;
308+
u8 routing;
305309
u64 cpu_addr;
306310
u64 pci_addr;
307311
u64 size;

0 commit comments

Comments
 (0)