linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/powernv: Fix next available MSI IRQ
@ 2013-03-05  6:59 Gavin Shan
  2013-03-06  3:24 ` Michael Ellerman
  0 siblings, 1 reply; 3+ messages in thread
From: Gavin Shan @ 2013-03-05  6:59 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Gavin Shan

The allocation of MSI is implemented based on bitmap and working
like the mechanism of strict round through the traced next available
cursor. However, the next available MSI is never updated in current
implementation. The patch fixes the issue.

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/powernv/pci.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index 6f464dc..9cf18c4 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -66,6 +66,11 @@ static unsigned int pnv_get_one_msi(struct pnv_phb *phb)
 		rc = 0;
 		goto out;
 	}
+
+	if (id >= phb->msi_count - 1)
+		phb->msi_next = 0;
+	else
+		phb->msi_next = id + 1;
 	__set_bit(id, phb->msi_map);
 	rc = id + phb->msi_base;
 out:
-- 
1.7.5.4

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

* Re: [PATCH] powerpc/powernv: Fix next available MSI IRQ
  2013-03-05  6:59 [PATCH] powerpc/powernv: Fix next available MSI IRQ Gavin Shan
@ 2013-03-06  3:24 ` Michael Ellerman
  2013-03-06  4:09   ` Gavin Shan
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Ellerman @ 2013-03-06  3:24 UTC (permalink / raw)
  To: Gavin Shan; +Cc: linuxppc-dev

On Tue, Mar 05, 2013 at 02:59:16PM +0800, Gavin Shan wrote:
> The allocation of MSI is implemented based on bitmap and working
> like the mechanism of strict round through the traced next available
> cursor. However, the next available MSI is never updated in current
> implementation. The patch fixes the issue.
> 
> Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
> ---
>  arch/powerpc/platforms/powernv/pci.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
> index 6f464dc..9cf18c4 100644
> --- a/arch/powerpc/platforms/powernv/pci.c
> +++ b/arch/powerpc/platforms/powernv/pci.c
> @@ -66,6 +66,11 @@ static unsigned int pnv_get_one_msi(struct pnv_phb *phb)
>  		rc = 0;
>  		goto out;
>  	}
> +
> +	if (id >= phb->msi_count - 1)
> +		phb->msi_next = 0;
> +	else
> +		phb->msi_next = id + 1;
>  	__set_bit(id, phb->msi_map);


There is code in arch/powerpc/sysdev/msi_bitmap.c that implements a
bitmap allocator for MSI. It may not do what you need but please take a
look at it if you haven't already.

cheers

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

* Re: [PATCH] powerpc/powernv: Fix next available MSI IRQ
  2013-03-06  3:24 ` Michael Ellerman
@ 2013-03-06  4:09   ` Gavin Shan
  0 siblings, 0 replies; 3+ messages in thread
From: Gavin Shan @ 2013-03-06  4:09 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Gavin Shan

On Wed, Mar 06, 2013 at 02:24:54PM +1100, Michael Ellerman wrote:
>On Tue, Mar 05, 2013 at 02:59:16PM +0800, Gavin Shan wrote:
>> The allocation of MSI is implemented based on bitmap and working
>> like the mechanism of strict round through the traced next available
>> cursor. However, the next available MSI is never updated in current
>> implementation. The patch fixes the issue.
>> 
>> Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
>> ---
>>  arch/powerpc/platforms/powernv/pci.c |    5 +++++
>>  1 files changed, 5 insertions(+), 0 deletions(-)
>> 
>> diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
>> index 6f464dc..9cf18c4 100644
>> --- a/arch/powerpc/platforms/powernv/pci.c
>> +++ b/arch/powerpc/platforms/powernv/pci.c
>> @@ -66,6 +66,11 @@ static unsigned int pnv_get_one_msi(struct pnv_phb *phb)
>>  		rc = 0;
>>  		goto out;
>>  	}
>> +
>> +	if (id >= phb->msi_count - 1)
>> +		phb->msi_next = 0;
>> +	else
>> +		phb->msi_next = id + 1;
>>  	__set_bit(id, phb->msi_map);
>
>
>There is code in arch/powerpc/sysdev/msi_bitmap.c that implements a
>bitmap allocator for MSI. It may not do what you need but please take a
>look at it if you haven't already.
>

Thanks, Michael. I neve know that you've implemented bitmaps to manage
MSI interrupts. It seems arch/powerpc/sysdev/msi_bitmap.c meets our
requirment here except that needs device tree node. Fortunately, we
can set the corresponding device tree node to NULL and functions playing
with the device tree nodes (of_node_get/of_node_put) works well for NULL
device tree node.

I'll update powernv platform to use msi_bitmap.c to manage it MSI interrupts.

Thanks,
Gavin

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

end of thread, other threads:[~2013-03-06  4:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-05  6:59 [PATCH] powerpc/powernv: Fix next available MSI IRQ Gavin Shan
2013-03-06  3:24 ` Michael Ellerman
2013-03-06  4:09   ` Gavin Shan

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).