linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] PCI: xilinx: Keep both legacy and MSI interrupt references.
@ 2016-09-01 10:14 Bharat Kumar Gogada
  2016-09-01 10:14 ` [PATCH 2/6] PCI: Xilinx : Clear interrupt register for invalid interrupt Bharat Kumar Gogada
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Bharat Kumar Gogada @ 2016-09-01 10:14 UTC (permalink / raw)
  To: bhelgaas, soren.brinkmann, christophe.jaillet, grygorii.strashko,
	yinghai, lorenzo.pieralisi, fengguang.wu, michal.simek, arnd
  Cc: linux-arm-kernel, linux-pci, linux-kernel, rgummal, Bharat Kumar Gogada

When built with MSI support the legacy domain reference is being
overwritten with MSI.
Instead creating two separate domains for MSI and legacy interrupts.

Signed-off-by: Bharat Kumar Gogada <bharatku@xilinx.com>
---
 drivers/pci/host/pcie-xilinx.c | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c
index a30e016..bd64677 100644
--- a/drivers/pci/host/pcie-xilinx.c
+++ b/drivers/pci/host/pcie-xilinx.c
@@ -101,7 +101,8 @@
  * @msi_pages: MSI pages
  * @root_busno: Root Bus number
  * @dev: Device pointer
- * @irq_domain: IRQ domain pointer
+ * @msi_domain: MSI IRQ domain pointer
+ * @leg_domain: Legacy IRQ domain pointer
  * @resources: Bus Resources
  */
 struct xilinx_pcie_port {
@@ -110,7 +111,8 @@ struct xilinx_pcie_port {
 	unsigned long msi_pages;
 	u8 root_busno;
 	struct device *dev;
-	struct irq_domain *irq_domain;
+	struct irq_domain *msi_domain;
+	struct irq_domain *leg_domain;
 	struct list_head resources;
 };
 
@@ -281,7 +283,7 @@ static int xilinx_pcie_msi_setup_irq(struct msi_controller *chip,
 	if (hwirq < 0)
 		return hwirq;
 
-	irq = irq_create_mapping(port->irq_domain, hwirq);
+	irq = irq_create_mapping(port->msi_domain, hwirq);
 	if (!irq)
 		return -EINVAL;
 
@@ -443,7 +445,7 @@ static irqreturn_t xilinx_pcie_intr_handler(int irq, void *data)
 			/* Handle INTx Interrupt */
 			val = ((val & XILINX_PCIE_RPIFR1_INTR_MASK) >>
 				XILINX_PCIE_RPIFR1_INTR_SHIFT) + 1;
-			generic_handle_irq(irq_find_mapping(port->irq_domain,
+			generic_handle_irq(irq_find_mapping(port->leg_domain,
 							    val));
 		}
 	}
@@ -526,12 +528,14 @@ static void xilinx_pcie_free_irq_domain(struct xilinx_pcie_port *port)
 	}
 
 	for (i = 0; i < num_irqs; i++) {
-		irq = irq_find_mapping(port->irq_domain, i);
+		irq = irq_find_mapping(port->leg_domain, i);
 		if (irq > 0)
 			irq_dispose_mapping(irq);
 	}
-
-	irq_domain_remove(port->irq_domain);
+	if (port->leg_domain)
+		irq_domain_remove(port->leg_domain);
+	if (port->msi_domain)
+		irq_domain_remove(port->msi_domain);
 }
 
 /**
@@ -553,21 +557,21 @@ static int xilinx_pcie_init_irq_domain(struct xilinx_pcie_port *port)
 		return -ENODEV;
 	}
 
-	port->irq_domain = irq_domain_add_linear(pcie_intc_node, 4,
+	port->leg_domain = irq_domain_add_linear(pcie_intc_node, 4,
 						 &intx_domain_ops,
 						 port);
-	if (!port->irq_domain) {
+	if (!port->leg_domain) {
 		dev_err(dev, "Failed to get a INTx IRQ domain\n");
 		return -ENODEV;
 	}
 
 	/* Setup MSI */
 	if (IS_ENABLED(CONFIG_PCI_MSI)) {
-		port->irq_domain = irq_domain_add_linear(node,
+		port->msi_domain = irq_domain_add_linear(node,
 							 XILINX_NUM_MSI_IRQS,
 							 &msi_domain_ops,
 							 &xilinx_pcie_msi_chip);
-		if (!port->irq_domain) {
+		if (!port->msi_domain) {
 			dev_err(dev, "Failed to get a MSI IRQ domain\n");
 			return -ENODEV;
 		}
-- 
2.1.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/6] PCI: Xilinx : Clear interrupt register for invalid interrupt.
  2016-09-01 10:14 [PATCH 1/6] PCI: xilinx: Keep both legacy and MSI interrupt references Bharat Kumar Gogada
@ 2016-09-01 10:14 ` Bharat Kumar Gogada
  2016-09-01 10:14 ` [PATCH 3/6] PCI: Xilinx: Clear correct msi set bit Bharat Kumar Gogada
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Bharat Kumar Gogada @ 2016-09-01 10:14 UTC (permalink / raw)
  To: bhelgaas, soren.brinkmann, christophe.jaillet, grygorii.strashko,
	yinghai, lorenzo.pieralisi, fengguang.wu, michal.simek, arnd
  Cc: linux-arm-kernel, linux-pci, linux-kernel, rgummal, Bharat Kumar Gogada

The interrupt decode register is not being cleared if
an invalid interrupt arises. This patch adds checks
and clears decode register in this case.

Signed-off-by: Bharat Kumar Gogada <bharatku@xilinx.com>
---
 drivers/pci/host/pcie-xilinx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c
index bd64677..de1c758 100644
--- a/drivers/pci/host/pcie-xilinx.c
+++ b/drivers/pci/host/pcie-xilinx.c
@@ -434,7 +434,7 @@ static irqreturn_t xilinx_pcie_intr_handler(int irq, void *data)
 		/* Check whether interrupt valid */
 		if (!(val & XILINX_PCIE_RPIFR1_INTR_VALID)) {
 			dev_warn(port->dev, "RP Intr FIFO1 read error\n");
-			return IRQ_HANDLED;
+			goto error;
 		}
 
 		if (!(val & XILINX_PCIE_RPIFR1_MSI_INTR)) {
@@ -456,7 +456,7 @@ static irqreturn_t xilinx_pcie_intr_handler(int irq, void *data)
 
 		if (!(val & XILINX_PCIE_RPIFR1_INTR_VALID)) {
 			dev_warn(port->dev, "RP Intr FIFO1 read error\n");
-			return IRQ_HANDLED;
+			goto error;
 		}
 
 		if (val & XILINX_PCIE_RPIFR1_MSI_INTR) {
@@ -501,6 +501,7 @@ static irqreturn_t xilinx_pcie_intr_handler(int irq, void *data)
 	if (status & XILINX_PCIE_INTR_MST_ERRP)
 		dev_warn(port->dev, "Master error poison\n");
 
+error:
 	/* Clear the Interrupt Decode register */
 	pcie_write(port, status, XILINX_PCIE_REG_IDR);
 
-- 
2.1.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/6] PCI: Xilinx: Clear correct msi set bit
  2016-09-01 10:14 [PATCH 1/6] PCI: xilinx: Keep both legacy and MSI interrupt references Bharat Kumar Gogada
  2016-09-01 10:14 ` [PATCH 2/6] PCI: Xilinx : Clear interrupt register for invalid interrupt Bharat Kumar Gogada
@ 2016-09-01 10:14 ` Bharat Kumar Gogada
  2016-09-01 10:14 ` [PATCH 4/6] PCI: Xilinx: Dispose MSI virtual irq Bharat Kumar Gogada
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Bharat Kumar Gogada @ 2016-09-01 10:14 UTC (permalink / raw)
  To: bhelgaas, soren.brinkmann, christophe.jaillet, grygorii.strashko,
	yinghai, lorenzo.pieralisi, fengguang.wu, michal.simek, arnd
  Cc: linux-arm-kernel, linux-pci, linux-kernel, rgummal, Bharat Kumar Gogada

Kernel provides virtual irq number at teardown.
Get hwirq number from virtual irq and clear correct
MSI set bit.

Signed-off-by: Bharat Kumar Gogada <bharatku@xilinx.com>
---
 drivers/pci/host/pcie-xilinx.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c
index de1c758..ec2844a 100644
--- a/drivers/pci/host/pcie-xilinx.c
+++ b/drivers/pci/host/pcie-xilinx.c
@@ -221,13 +221,15 @@ static void xilinx_pcie_destroy_msi(unsigned int irq)
 {
 	struct msi_desc *msi;
 	struct xilinx_pcie_port *port;
+	struct irq_data *d = irq_get_irq_data(irq);
+	irq_hw_number_t hwirq = irqd_to_hwirq(d);
 
-	if (!test_bit(irq, msi_irq_in_use)) {
+	if (!test_bit(hwirq, msi_irq_in_use)) {
 		msi = irq_get_msi_desc(irq);
 		port = msi_desc_to_pci_sysdata(msi);
 		dev_err(port->dev, "Trying to free unused MSI#%d\n", irq);
 	} else {
-		clear_bit(irq, msi_irq_in_use);
+		clear_bit(hwirq, msi_irq_in_use);
 	}
 }
 
-- 
2.1.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/6] PCI: Xilinx: Dispose MSI virtual irq
  2016-09-01 10:14 [PATCH 1/6] PCI: xilinx: Keep both legacy and MSI interrupt references Bharat Kumar Gogada
  2016-09-01 10:14 ` [PATCH 2/6] PCI: Xilinx : Clear interrupt register for invalid interrupt Bharat Kumar Gogada
  2016-09-01 10:14 ` [PATCH 3/6] PCI: Xilinx: Clear correct msi set bit Bharat Kumar Gogada
@ 2016-09-01 10:14 ` Bharat Kumar Gogada
  2016-09-01 10:14 ` [PATCH 5/6] PCI: Xilinx: Read more than one function per device Bharat Kumar Gogada
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Bharat Kumar Gogada @ 2016-09-01 10:14 UTC (permalink / raw)
  To: bhelgaas, soren.brinkmann, christophe.jaillet, grygorii.strashko,
	yinghai, lorenzo.pieralisi, fengguang.wu, michal.simek, arnd
  Cc: linux-arm-kernel, linux-pci, linux-kernel, rgummal, Bharat Kumar Gogada

Dispose virtual irq being created for MSI interrupts.

Signed-off-by: Bharat Kumar Gogada <bharatku@xilinx.com>
---
 drivers/pci/host/pcie-xilinx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c
index ec2844a..a276fa6 100644
--- a/drivers/pci/host/pcie-xilinx.c
+++ b/drivers/pci/host/pcie-xilinx.c
@@ -261,6 +261,7 @@ static void xilinx_msi_teardown_irq(struct msi_controller *chip,
 				    unsigned int irq)
 {
 	xilinx_pcie_destroy_msi(irq);
+	irq_dispose_mapping(irq);
 }
 
 /**
-- 
2.1.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/6] PCI: Xilinx: Read more than one function per device.
  2016-09-01 10:14 [PATCH 1/6] PCI: xilinx: Keep both legacy and MSI interrupt references Bharat Kumar Gogada
                   ` (2 preceding siblings ...)
  2016-09-01 10:14 ` [PATCH 4/6] PCI: Xilinx: Dispose MSI virtual irq Bharat Kumar Gogada
@ 2016-09-01 10:14 ` Bharat Kumar Gogada
  2016-09-01 10:14 ` [PATCH 6/6] Microblaze: Modify microblaze pci specific code to support multidomain Bharat Kumar Gogada
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Bharat Kumar Gogada @ 2016-09-01 10:14 UTC (permalink / raw)
  To: bhelgaas, soren.brinkmann, christophe.jaillet, grygorii.strashko,
	yinghai, lorenzo.pieralisi, fengguang.wu, michal.simek, arnd
  Cc: linux-arm-kernel, linux-pci, linux-kernel, rgummal, Bharat Kumar Gogada

AXI PCIe supports multifunciton device.
Removing unneccessary condition.

Signed-off-by: Bharat Kumar Gogada <bharatku@xilinx.com>
---
 drivers/pci/host/pcie-xilinx.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c
index a276fa6..58b7a13 100644
--- a/drivers/pci/host/pcie-xilinx.c
+++ b/drivers/pci/host/pcie-xilinx.c
@@ -170,13 +170,6 @@ static bool xilinx_pcie_valid_device(struct pci_bus *bus, unsigned int devfn)
 	if (bus->number == port->root_busno && devfn > 0)
 		return false;
 
-	/*
-	 * Do not read more than one device on the bus directly attached
-	 * to RC.
-	 */
-	if (bus->primary == port->root_busno && devfn > 0)
-		return false;
-
 	return true;
 }
 
-- 
2.1.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 6/6] Microblaze: Modify microblaze pci specific code to support multidomain.
  2016-09-01 10:14 [PATCH 1/6] PCI: xilinx: Keep both legacy and MSI interrupt references Bharat Kumar Gogada
                   ` (3 preceding siblings ...)
  2016-09-01 10:14 ` [PATCH 5/6] PCI: Xilinx: Read more than one function per device Bharat Kumar Gogada
@ 2016-09-01 10:14 ` Bharat Kumar Gogada
  2016-09-12 22:21 ` [PATCH 1/6] PCI: xilinx: Keep both legacy and MSI interrupt references Bjorn Helgaas
  2016-09-13 15:56 ` Bjorn Helgaas
  6 siblings, 0 replies; 11+ messages in thread
From: Bharat Kumar Gogada @ 2016-09-01 10:14 UTC (permalink / raw)
  To: bhelgaas, soren.brinkmann, christophe.jaillet, grygorii.strashko,
	yinghai, lorenzo.pieralisi, fengguang.wu, michal.simek, arnd
  Cc: linux-arm-kernel, linux-pci, linux-kernel, rgummal, Bharat Kumar Gogada

Proc entries will be created for every pci bus.
With current implementation,in multidomain same bus number
will repaeat but in different domain, which causes kernel crash
as already same bus number exists.

Return domain number when kernel requests while creating proc
entries for each bus.

Signed-off-by: Bharat Kumar Gogada <bharatku@xilinx.com>
---
 arch/microblaze/pci/pci-common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 81556b8..7f696f9 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -632,10 +632,10 @@ void pci_process_bridge_OF_ranges(struct pci_controller *hose,
 	}
 }
 
-/* Decide whether to display the domain number in /proc */
+/* Display the domain number in /proc */
 int pci_proc_domain(struct pci_bus *bus)
 {
-	return 0;
+	return pci_domain_nr(bus);
 }
 
 /* This header fixup will do the resource fixup for all devices as they are
-- 
2.1.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/6] PCI: xilinx: Keep both legacy and MSI interrupt references.
  2016-09-01 10:14 [PATCH 1/6] PCI: xilinx: Keep both legacy and MSI interrupt references Bharat Kumar Gogada
                   ` (4 preceding siblings ...)
  2016-09-01 10:14 ` [PATCH 6/6] Microblaze: Modify microblaze pci specific code to support multidomain Bharat Kumar Gogada
@ 2016-09-12 22:21 ` Bjorn Helgaas
  2016-09-13 15:56 ` Bjorn Helgaas
  6 siblings, 0 replies; 11+ messages in thread
From: Bjorn Helgaas @ 2016-09-12 22:21 UTC (permalink / raw)
  To: Bharat Kumar Gogada
  Cc: bhelgaas, soren.brinkmann, christophe.jaillet, grygorii.strashko,
	yinghai, lorenzo.pieralisi, fengguang.wu, michal.simek, arnd,
	Bharat Kumar Gogada, linux-pci, rgummal, linux-kernel,
	linux-arm-kernel

On Thu, Sep 01, 2016 at 03:44:41PM +0530, Bharat Kumar Gogada wrote:
> When built with MSI support the legacy domain reference is being
> overwritten with MSI.
> Instead creating two separate domains for MSI and legacy interrupts.
> 
> Signed-off-by: Bharat Kumar Gogada <bharatku@xilinx.com>

I'm looking for an ack from Michal for these...

> ---
>  drivers/pci/host/pcie-xilinx.c | 26 +++++++++++++++-----------
>  1 file changed, 15 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c
> index a30e016..bd64677 100644
> --- a/drivers/pci/host/pcie-xilinx.c
> +++ b/drivers/pci/host/pcie-xilinx.c
> @@ -101,7 +101,8 @@
>   * @msi_pages: MSI pages
>   * @root_busno: Root Bus number
>   * @dev: Device pointer
> - * @irq_domain: IRQ domain pointer
> + * @msi_domain: MSI IRQ domain pointer
> + * @leg_domain: Legacy IRQ domain pointer
>   * @resources: Bus Resources
>   */
>  struct xilinx_pcie_port {
> @@ -110,7 +111,8 @@ struct xilinx_pcie_port {
>  	unsigned long msi_pages;
>  	u8 root_busno;
>  	struct device *dev;
> -	struct irq_domain *irq_domain;
> +	struct irq_domain *msi_domain;
> +	struct irq_domain *leg_domain;
>  	struct list_head resources;
>  };
>  
> @@ -281,7 +283,7 @@ static int xilinx_pcie_msi_setup_irq(struct msi_controller *chip,
>  	if (hwirq < 0)
>  		return hwirq;
>  
> -	irq = irq_create_mapping(port->irq_domain, hwirq);
> +	irq = irq_create_mapping(port->msi_domain, hwirq);
>  	if (!irq)
>  		return -EINVAL;
>  
> @@ -443,7 +445,7 @@ static irqreturn_t xilinx_pcie_intr_handler(int irq, void *data)
>  			/* Handle INTx Interrupt */
>  			val = ((val & XILINX_PCIE_RPIFR1_INTR_MASK) >>
>  				XILINX_PCIE_RPIFR1_INTR_SHIFT) + 1;
> -			generic_handle_irq(irq_find_mapping(port->irq_domain,
> +			generic_handle_irq(irq_find_mapping(port->leg_domain,
>  							    val));
>  		}
>  	}
> @@ -526,12 +528,14 @@ static void xilinx_pcie_free_irq_domain(struct xilinx_pcie_port *port)
>  	}
>  
>  	for (i = 0; i < num_irqs; i++) {
> -		irq = irq_find_mapping(port->irq_domain, i);
> +		irq = irq_find_mapping(port->leg_domain, i);
>  		if (irq > 0)
>  			irq_dispose_mapping(irq);
>  	}
> -
> -	irq_domain_remove(port->irq_domain);
> +	if (port->leg_domain)
> +		irq_domain_remove(port->leg_domain);
> +	if (port->msi_domain)
> +		irq_domain_remove(port->msi_domain);
>  }
>  
>  /**
> @@ -553,21 +557,21 @@ static int xilinx_pcie_init_irq_domain(struct xilinx_pcie_port *port)
>  		return -ENODEV;
>  	}
>  
> -	port->irq_domain = irq_domain_add_linear(pcie_intc_node, 4,
> +	port->leg_domain = irq_domain_add_linear(pcie_intc_node, 4,
>  						 &intx_domain_ops,
>  						 port);
> -	if (!port->irq_domain) {
> +	if (!port->leg_domain) {
>  		dev_err(dev, "Failed to get a INTx IRQ domain\n");
>  		return -ENODEV;
>  	}
>  
>  	/* Setup MSI */
>  	if (IS_ENABLED(CONFIG_PCI_MSI)) {
> -		port->irq_domain = irq_domain_add_linear(node,
> +		port->msi_domain = irq_domain_add_linear(node,
>  							 XILINX_NUM_MSI_IRQS,
>  							 &msi_domain_ops,
>  							 &xilinx_pcie_msi_chip);
> -		if (!port->irq_domain) {
> +		if (!port->msi_domain) {
>  			dev_err(dev, "Failed to get a MSI IRQ domain\n");
>  			return -ENODEV;
>  		}
> -- 
> 2.1.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/6] PCI: xilinx: Keep both legacy and MSI interrupt references.
  2016-09-01 10:14 [PATCH 1/6] PCI: xilinx: Keep both legacy and MSI interrupt references Bharat Kumar Gogada
                   ` (5 preceding siblings ...)
  2016-09-12 22:21 ` [PATCH 1/6] PCI: xilinx: Keep both legacy and MSI interrupt references Bjorn Helgaas
@ 2016-09-13 15:56 ` Bjorn Helgaas
  2016-09-14 15:32   ` Bharat Kumar Gogada
  6 siblings, 1 reply; 11+ messages in thread
From: Bjorn Helgaas @ 2016-09-13 15:56 UTC (permalink / raw)
  To: Bharat Kumar Gogada
  Cc: bhelgaas, soren.brinkmann, christophe.jaillet, grygorii.strashko,
	yinghai, lorenzo.pieralisi, fengguang.wu, michal.simek, arnd,
	Bharat Kumar Gogada, linux-pci, rgummal, linux-kernel,
	linux-arm-kernel

On Thu, Sep 01, 2016 at 03:44:41PM +0530, Bharat Kumar Gogada wrote:
> When built with MSI support the legacy domain reference is being
> overwritten with MSI.
> Instead creating two separate domains for MSI and legacy interrupts.
> 
> Signed-off-by: Bharat Kumar Gogada <bharatku@xilinx.com>

Applied all these (except [5/6]) with Michal's ack to pci/host-xilinx for
v4.9, thanks!

I already applied Po Liu's patch ("PCI: xilinx: Relax device number
checking to allow SR-IOV") to pci/virtualization.  This is identical to
[5/6], so I dropped [5/6] to avoid a conflict.

> ---
>  drivers/pci/host/pcie-xilinx.c | 26 +++++++++++++++-----------
>  1 file changed, 15 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c
> index a30e016..bd64677 100644
> --- a/drivers/pci/host/pcie-xilinx.c
> +++ b/drivers/pci/host/pcie-xilinx.c
> @@ -101,7 +101,8 @@
>   * @msi_pages: MSI pages
>   * @root_busno: Root Bus number
>   * @dev: Device pointer
> - * @irq_domain: IRQ domain pointer
> + * @msi_domain: MSI IRQ domain pointer
> + * @leg_domain: Legacy IRQ domain pointer
>   * @resources: Bus Resources
>   */
>  struct xilinx_pcie_port {
> @@ -110,7 +111,8 @@ struct xilinx_pcie_port {
>  	unsigned long msi_pages;
>  	u8 root_busno;
>  	struct device *dev;
> -	struct irq_domain *irq_domain;
> +	struct irq_domain *msi_domain;
> +	struct irq_domain *leg_domain;
>  	struct list_head resources;
>  };
>  
> @@ -281,7 +283,7 @@ static int xilinx_pcie_msi_setup_irq(struct msi_controller *chip,
>  	if (hwirq < 0)
>  		return hwirq;
>  
> -	irq = irq_create_mapping(port->irq_domain, hwirq);
> +	irq = irq_create_mapping(port->msi_domain, hwirq);
>  	if (!irq)
>  		return -EINVAL;
>  
> @@ -443,7 +445,7 @@ static irqreturn_t xilinx_pcie_intr_handler(int irq, void *data)
>  			/* Handle INTx Interrupt */
>  			val = ((val & XILINX_PCIE_RPIFR1_INTR_MASK) >>
>  				XILINX_PCIE_RPIFR1_INTR_SHIFT) + 1;
> -			generic_handle_irq(irq_find_mapping(port->irq_domain,
> +			generic_handle_irq(irq_find_mapping(port->leg_domain,
>  							    val));
>  		}
>  	}
> @@ -526,12 +528,14 @@ static void xilinx_pcie_free_irq_domain(struct xilinx_pcie_port *port)
>  	}
>  
>  	for (i = 0; i < num_irqs; i++) {
> -		irq = irq_find_mapping(port->irq_domain, i);
> +		irq = irq_find_mapping(port->leg_domain, i);
>  		if (irq > 0)
>  			irq_dispose_mapping(irq);
>  	}
> -
> -	irq_domain_remove(port->irq_domain);
> +	if (port->leg_domain)
> +		irq_domain_remove(port->leg_domain);
> +	if (port->msi_domain)
> +		irq_domain_remove(port->msi_domain);
>  }
>  
>  /**
> @@ -553,21 +557,21 @@ static int xilinx_pcie_init_irq_domain(struct xilinx_pcie_port *port)
>  		return -ENODEV;
>  	}
>  
> -	port->irq_domain = irq_domain_add_linear(pcie_intc_node, 4,
> +	port->leg_domain = irq_domain_add_linear(pcie_intc_node, 4,
>  						 &intx_domain_ops,
>  						 port);
> -	if (!port->irq_domain) {
> +	if (!port->leg_domain) {
>  		dev_err(dev, "Failed to get a INTx IRQ domain\n");
>  		return -ENODEV;
>  	}
>  
>  	/* Setup MSI */
>  	if (IS_ENABLED(CONFIG_PCI_MSI)) {
> -		port->irq_domain = irq_domain_add_linear(node,
> +		port->msi_domain = irq_domain_add_linear(node,
>  							 XILINX_NUM_MSI_IRQS,
>  							 &msi_domain_ops,
>  							 &xilinx_pcie_msi_chip);
> -		if (!port->irq_domain) {
> +		if (!port->msi_domain) {
>  			dev_err(dev, "Failed to get a MSI IRQ domain\n");
>  			return -ENODEV;
>  		}
> -- 
> 2.1.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH 1/6] PCI: xilinx: Keep both legacy and MSI interrupt references.
  2016-09-13 15:56 ` Bjorn Helgaas
@ 2016-09-14 15:32   ` Bharat Kumar Gogada
  2016-09-14 19:17     ` Bjorn Helgaas
  0 siblings, 1 reply; 11+ messages in thread
From: Bharat Kumar Gogada @ 2016-09-14 15:32 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: bhelgaas, Soren Brinkmann, christophe.jaillet, grygorii.strashko,
	yinghai, lorenzo.pieralisi, fengguang.wu, Michal Simek, arnd,
	linux-pci, Ravikiran Gummaluri, linux-kernel, linux-arm-kernel

On Thu, Sep 01, 2016 at 03:44:41PM +0530, Bharat Kumar Gogada wrote:
> When built with MSI support the legacy domain reference is being 
> overwritten with MSI.
> Instead creating two separate domains for MSI and legacy interrupts.
> 
> Signed-off-by: Bharat Kumar Gogada <bharatku@xilinx.com>

Applied all these (except [5/6]) with Michal's ack to pci/host-xilinx for v4.9, thanks!

I already applied Po Liu's patch ("PCI: xilinx: Relax device number checking to allow SR-IOV") to pci/virtualization.  This is identical to [5/6], so I dropped [5/6] to avoid a conflict.

Thanks Bjorn. 
Some how I couldn't find Po Liu's patch, can you provide git link of patch that was applied. 
Hope it wouldn't take much time of you. 

Thanks & Regards,
Bharat

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/6] PCI: xilinx: Keep both legacy and MSI interrupt references.
  2016-09-14 15:32   ` Bharat Kumar Gogada
@ 2016-09-14 19:17     ` Bjorn Helgaas
  2016-09-15  5:09       ` Bharat Kumar Gogada
  0 siblings, 1 reply; 11+ messages in thread
From: Bjorn Helgaas @ 2016-09-14 19:17 UTC (permalink / raw)
  To: Bharat Kumar Gogada
  Cc: bhelgaas, Soren Brinkmann, christophe.jaillet, grygorii.strashko,
	yinghai, lorenzo.pieralisi, fengguang.wu, Michal Simek, arnd,
	linux-pci, Ravikiran Gummaluri, linux-kernel, linux-arm-kernel

On Wed, Sep 14, 2016 at 03:32:44PM +0000, Bharat Kumar Gogada wrote:
> On Thu, Sep 01, 2016 at 03:44:41PM +0530, Bharat Kumar Gogada wrote:
> > When built with MSI support the legacy domain reference is being 
> > overwritten with MSI.
> > Instead creating two separate domains for MSI and legacy interrupts.
> > 
> > Signed-off-by: Bharat Kumar Gogada <bharatku@xilinx.com>
> 
> Applied all these (except [5/6]) with Michal's ack to pci/host-xilinx for v4.9, thanks!
> 
> I already applied Po Liu's patch ("PCI: xilinx: Relax device number checking to allow SR-IOV") to pci/virtualization.  This is identical to [5/6], so I dropped [5/6] to avoid a conflict.
> 
> Thanks Bjorn. 
> Some how I couldn't find Po Liu's patch, can you provide git link of patch that was applied. 

Sure, here it is: https://git.kernel.org/cgit/linux/kernel/git/helgaas/pci.git/commit/?h=pci/virtualization&id=8e7ca8ca5fd8a3242289105723c429733be8b73b

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH 1/6] PCI: xilinx: Keep both legacy and MSI interrupt references.
  2016-09-14 19:17     ` Bjorn Helgaas
@ 2016-09-15  5:09       ` Bharat Kumar Gogada
  0 siblings, 0 replies; 11+ messages in thread
From: Bharat Kumar Gogada @ 2016-09-15  5:09 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: bhelgaas, Soren Brinkmann, christophe.jaillet, grygorii.strashko,
	yinghai, lorenzo.pieralisi, fengguang.wu, Michal Simek, arnd,
	linux-pci, Ravikiran Gummaluri, linux-kernel, linux-arm-kernel

On Wed, Sep 14, 2016 at 03:32:44PM +0000, Bharat Kumar Gogada wrote:
> On Thu, Sep 01, 2016 at 03:44:41PM +0530, Bharat Kumar Gogada wrote:
> > When built with MSI support the legacy domain reference is being 
> > overwritten with MSI.
> > Instead creating two separate domains for MSI and legacy interrupts.
> > 
> > Signed-off-by: Bharat Kumar Gogada <bharatku@xilinx.com>
> 
> Applied all these (except [5/6]) with Michal's ack to pci/host-xilinx for v4.9, thanks!
> 
> I already applied Po Liu's patch ("PCI: xilinx: Relax device number checking to allow SR-IOV") to pci/virtualization.  This is identical to [5/6], so I dropped [5/6] to avoid a conflict.
> 
> Thanks Bjorn. 
> Some how I couldn't find Po Liu's patch, can you provide git link of patch that was applied. 

Sure, here it is: https://git.kernel.org/cgit/linux/kernel/git/helgaas/pci.git/commit/?h=pci/virtualization&id=8e7ca8ca5fd8a3242289105723c429733be8b73b

Thanks Bjorn, this patch is similar to [5/6] patch. 

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-09-15  5:09 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-01 10:14 [PATCH 1/6] PCI: xilinx: Keep both legacy and MSI interrupt references Bharat Kumar Gogada
2016-09-01 10:14 ` [PATCH 2/6] PCI: Xilinx : Clear interrupt register for invalid interrupt Bharat Kumar Gogada
2016-09-01 10:14 ` [PATCH 3/6] PCI: Xilinx: Clear correct msi set bit Bharat Kumar Gogada
2016-09-01 10:14 ` [PATCH 4/6] PCI: Xilinx: Dispose MSI virtual irq Bharat Kumar Gogada
2016-09-01 10:14 ` [PATCH 5/6] PCI: Xilinx: Read more than one function per device Bharat Kumar Gogada
2016-09-01 10:14 ` [PATCH 6/6] Microblaze: Modify microblaze pci specific code to support multidomain Bharat Kumar Gogada
2016-09-12 22:21 ` [PATCH 1/6] PCI: xilinx: Keep both legacy and MSI interrupt references Bjorn Helgaas
2016-09-13 15:56 ` Bjorn Helgaas
2016-09-14 15:32   ` Bharat Kumar Gogada
2016-09-14 19:17     ` Bjorn Helgaas
2016-09-15  5:09       ` Bharat Kumar Gogada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).