Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1282952 > unrolled thread

[PATCH 0/3] fixes to support multi-functions device

Started byLey Foon Tan <lftan@altera.com>
First post2015-12-03 12:20 +0100
Last post2015-12-07 02:50 +0100
Articles 5 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/3] fixes to support multi-functions device Ley Foon Tan <lftan@altera.com> - 2015-12-03 12:20 +0100
    [PATCH 3/3] PCI: altera: fix error when INTX is 4 Ley Foon Tan <lftan@altera.com> - 2015-12-03 12:20 +0100
    [PATCH 2/3] PCI: altera: check TLP completion status Ley Foon Tan <lftan@altera.com> - 2015-12-03 12:20 +0100
    Re: [PATCH 0/3] fixes to support multi-functions device Bjorn Helgaas <helgaas@kernel.org> - 2015-12-04 23:30 +0100
      Re: [PATCH 0/3] fixes to support multi-functions device Ley Foon Tan <lftan@altera.com> - 2015-12-07 02:50 +0100

#1282952 — [PATCH 0/3] fixes to support multi-functions device

FromLey Foon Tan <lftan@altera.com>
Date2015-12-03 12:20 +0100
Subject[PATCH 0/3] fixes to support multi-functions device
Message-ID<qBA5A-4dT-5@gated-at.bofh.it>
This series of patch fixes the issues when work with multi-functions PCIe
devices. Host controller can't access to endpoint with non-zero devfn, due to
incorrect rootport devfn. It also add checking for TLP status and fix issue in
interrupt probing.

Tested on Ethernet adapter card with multi-functions enabled.

Ley Foon Tan (3):
  PCI: altera: fix incorrect devfn for requester ID
  PCI: altera: check TLP completion status
  PCI: altera: fix error when INTX is 4

 drivers/pci/host/pcie-altera.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

-- 
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1282953 — [PATCH 3/3] PCI: altera: fix error when INTX is 4

FromLey Foon Tan <lftan@altera.com>
Date2015-12-03 12:20 +0100
Subject[PATCH 3/3] PCI: altera: fix error when INTX is 4
Message-ID<qBA5B-4dT-23@gated-at.bofh.it>
In reply to#1282952
PCI interrupt lines start at 1, not at 0. So, creates additional one
interrupt when register for irq domain.

Error when PCIe devices have 4 INTX:
WARNING: CPU: 1 PID: 1 at kernel/irq/irqdomain.c:280
	irq_domain_associate+0x17c/0x1cc()
error: hwirq 0x4 is too large for dummy

Tested on Ethernet adapter card with multi-functions.

Signed-off-by: Ley Foon Tan <lftan@altera.com>
---
 drivers/pci/host/pcie-altera.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/host/pcie-altera.c b/drivers/pci/host/pcie-altera.c
index e4176b3..1a2d4a6 100644
--- a/drivers/pci/host/pcie-altera.c
+++ b/drivers/pci/host/pcie-altera.c
@@ -467,7 +467,7 @@ static int altera_pcie_init_irq_domain(struct altera_pcie *pcie)
 	struct device_node *node = dev->of_node;
 
 	/* Setup INTx */
-	pcie->irq_domain = irq_domain_add_linear(node, INTX_NUM,
+	pcie->irq_domain = irq_domain_add_linear(node, INTX_NUM + 1,
 					&intx_domain_ops, pcie);
 	if (!pcie->irq_domain) {
 		dev_err(dev, "Failed to get a INTx IRQ domain\n");
-- 
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1282954 — [PATCH 2/3] PCI: altera: check TLP completion status

FromLey Foon Tan <lftan@altera.com>
Date2015-12-03 12:20 +0100
Subject[PATCH 2/3] PCI: altera: check TLP completion status
Message-ID<qBA5A-4dT-19@gated-at.bofh.it>
In reply to#1282952
Check TLP packet successful completion status. This fix the issue when
accessing multi-function devices in enumeration process, TLP will return
error when accessing non-exist function number. Returns PCI error code
instead of generic errno.

Tested on Ethernet adapter card with multi-functions.

Signed-off-by: Ley Foon Tan <lftan@altera.com>
---
 drivers/pci/host/pcie-altera.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/host/pcie-altera.c b/drivers/pci/host/pcie-altera.c
index f05180f..e4176b3 100644
--- a/drivers/pci/host/pcie-altera.c
+++ b/drivers/pci/host/pcie-altera.c
@@ -55,6 +55,7 @@
 #define TLP_CFG_DW2(bus, devfn, offset)	\
 				(((bus) << 24) | ((devfn) << 16) | (offset))
 #define TLP_REQ_ID(bus, devfn)		(((bus) << 8) | (devfn))
+#define TLP_COMP_STATUS(s)		(((s) >> 12) & 7)
 #define TLP_HDR_SIZE			3
 #define TLP_LOOP			500
 #define RP_DEVFN			0
@@ -171,6 +172,7 @@ static int tlp_read_packet(struct altera_pcie *pcie, u32 *value)
 	bool sop = 0;
 	u32 ctrl;
 	u32 reg0, reg1;
+	u32 comp_status = 1;
 
 	/*
 	 * Minimum 2 loops to read TLP headers and 1 loop to read data
@@ -182,19 +184,25 @@ static int tlp_read_packet(struct altera_pcie *pcie, u32 *value)
 			reg0 = cra_readl(pcie, RP_RXCPL_REG0);
 			reg1 = cra_readl(pcie, RP_RXCPL_REG1);
 
-			if (ctrl & RP_RXCPL_SOP)
+			if (ctrl & RP_RXCPL_SOP) {
 				sop = true;
+				comp_status = TLP_COMP_STATUS(reg1);
+			}
 
 			if (ctrl & RP_RXCPL_EOP) {
-				if (value)
-					*value = reg0;
-				return PCIBIOS_SUCCESSFUL;
+				if (!comp_status) {
+					if (value)
+						*value = reg0;
+					return PCIBIOS_SUCCESSFUL;
+				} else {
+					return PCIBIOS_DEVICE_NOT_FOUND;
+				}
 			}
 		}
 		udelay(5);
 	}
 
-	return -ENOENT;
+	return PCIBIOS_DEVICE_NOT_FOUND;
 }
 
 static void tlp_write_packet(struct altera_pcie *pcie, u32 *headers,
-- 
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1284302

FromBjorn Helgaas <helgaas@kernel.org>
Date2015-12-04 23:30 +0100
Message-ID<qC71w-et-15@gated-at.bofh.it>
In reply to#1282952
On Thu, Dec 03, 2015 at 07:17:51PM +0800, Ley Foon Tan wrote:
> This series of patch fixes the issues when work with multi-functions PCIe
> devices. Host controller can't access to endpoint with non-zero devfn, due to
> incorrect rootport devfn. It also add checking for TLP status and fix issue in
> interrupt probing.
> 
> Tested on Ethernet adapter card with multi-functions enabled.
> 
> Ley Foon Tan (3):
>   PCI: altera: fix incorrect devfn for requester ID
>   PCI: altera: check TLP completion status
>   PCI: altera: fix error when INTX is 4
> 
>  drivers/pci/host/pcie-altera.c | 25 +++++++++++++++++--------
>  1 file changed, 17 insertions(+), 8 deletions(-)

We initially merged the Altera driver for v4.4-rc1, it looks like
it's not really useful without these changes, and there's no danger of
breaking anything in the field, so I put these on my for-linus branch
and will ask Linus to pull them before v4.4.  Thanks!

Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1284960

FromLey Foon Tan <lftan@altera.com>
Date2015-12-07 02:50 +0100
Message-ID<qCT6a-6jq-3@gated-at.bofh.it>
In reply to#1284302
On Sat, Dec 5, 2015 at 6:28 AM, Bjorn Helgaas <helgaas@kernel.org> wrote:
> On Thu, Dec 03, 2015 at 07:17:51PM +0800, Ley Foon Tan wrote:
>> This series of patch fixes the issues when work with multi-functions PCIe
>> devices. Host controller can't access to endpoint with non-zero devfn, due to
>> incorrect rootport devfn. It also add checking for TLP status and fix issue in
>> interrupt probing.
>>
>> Tested on Ethernet adapter card with multi-functions enabled.
>>
>> Ley Foon Tan (3):
>>   PCI: altera: fix incorrect devfn for requester ID
>>   PCI: altera: check TLP completion status
>>   PCI: altera: fix error when INTX is 4
>>
>>  drivers/pci/host/pcie-altera.c | 25 +++++++++++++++++--------
>>  1 file changed, 17 insertions(+), 8 deletions(-)
>
> We initially merged the Altera driver for v4.4-rc1, it looks like
> it's not really useful without these changes, and there's no danger of
> breaking anything in the field, so I put these on my for-linus branch
> and will ask Linus to pull them before v4.4.  Thanks!
>
That's great!
Thanks.

Regards
Ley Foon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web