[PATCH 3/4] fsl_msi: enable msi sharing through AMP OSes

2010-04-15 Thread Li Yang
From: Zhao Chenhui 

Make a single PCIe MSI bank shareable through CAMP OSes. The number of
MSI used by each core can be configured by dts file.

Signed-off-by: Zhao Chenhui 
Signed-off-by: Li Yang 
---
 arch/powerpc/sysdev/fsl_msi.c|8 +++-
 arch/powerpc/sysdev/msi_bitmap.c |4 ++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index c46db75..ec5bdb4 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -266,6 +266,8 @@ static int __devinit fsl_of_msi_probe(struct of_device *dev,
const u32 *p;
struct fsl_msi_feature *features = match->data;
struct fsl_msi_cascade_data *cascade_data = NULL;
+   int len;
+   u32 offset;
 
printk(KERN_DEBUG "Setting up Freescale MSI support\n");
 
@@ -325,6 +327,10 @@ static int __devinit fsl_of_msi_probe(struct of_device 
*dev,
err = -EINVAL;
goto error_out;
}
+   offset = 0;
+   p = of_get_property(dev->node, "msi-available-ranges", &len);
+   if (p)
+   offset = *p / IRQS_PER_MSI_REG;
 
count /= sizeof(u32);
for (i = 0; i < count / 2; i++) {
@@ -341,7 +347,7 @@ static int __devinit fsl_of_msi_probe(struct of_device *dev,
err = -ENOMEM;
goto error_out;
}
-   cascade_data->index = i;
+   cascade_data->index = i + offset;
cascade_data->data = msi;
set_irq_data(virt_msir, (void *)cascade_data);
set_irq_chained_handler(virt_msir, fsl_msi_cascade);
diff --git a/arch/powerpc/sysdev/msi_bitmap.c b/arch/powerpc/sysdev/msi_bitmap.c
index 5a32cbe..b41db96 100644
--- a/arch/powerpc/sysdev/msi_bitmap.c
+++ b/arch/powerpc/sysdev/msi_bitmap.c
@@ -95,8 +95,8 @@ int msi_bitmap_reserve_dt_hwirqs(struct msi_bitmap *bmp)
/* Format is: ( )+ */
len /= 2 * sizeof(u32);
for (i = 0; i < len; i++, p += 2) {
-   for (j = 0; j < *(p + 1); j++)
-   bitmap_release_region(bmp->bitmap, *p + j, 0);
+   for (j = *p; j < *(p + 1); j++)
+   bitmap_release_region(bmp->bitmap, j, 0);
}
 
spin_unlock(&bmp->lock);
-- 
1.6.6-rc1.GIT

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 3/4] fsl_msi: enable msi sharing through AMP OSes

2010-04-18 Thread Michael Ellerman
On Fri, 2010-04-16 at 15:34 +0800, Li Yang wrote:
> From: Zhao Chenhui 
> 
> Make a single PCIe MSI bank shareable through CAMP OSes. The number of
> MSI used by each core can be configured by dts file.
> 
> Signed-off-by: Zhao Chenhui 
> Signed-off-by: Li Yang 
> ---
>  arch/powerpc/sysdev/fsl_msi.c|8 +++-
>  arch/powerpc/sysdev/msi_bitmap.c |4 ++--
>  2 files changed, 9 insertions(+), 3 deletions(-)
..
> diff --git a/arch/powerpc/sysdev/msi_bitmap.c 
> b/arch/powerpc/sysdev/msi_bitmap.c
> index 5a32cbe..b41db96 100644
> --- a/arch/powerpc/sysdev/msi_bitmap.c
> +++ b/arch/powerpc/sysdev/msi_bitmap.c
> @@ -95,8 +95,8 @@ int msi_bitmap_reserve_dt_hwirqs(struct msi_bitmap *bmp)
>   /* Format is: ( )+ */
>   len /= 2 * sizeof(u32);
>   for (i = 0; i < len; i++, p += 2) {
> - for (j = 0; j < *(p + 1); j++)
> - bitmap_release_region(bmp->bitmap, *p + j, 0);
> + for (j = *p; j < *(p + 1); j++)
> + bitmap_release_region(bmp->bitmap, j, 0);
>   }
>  
>   spin_unlock(&bmp->lock);

This looks like a bug fix to the msi bitmap code, is it not? Please
split it into a separate commit with an explanatory changelog.

cheers




signature.asc
Description: This is a digitally signed message part
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 3/4] fsl_msi: enable msi sharing through AMP OSes

2010-04-18 Thread Li Yang
On Mon, Apr 19, 2010 at 10:34 AM, Michael Ellerman
 wrote:
> On Fri, 2010-04-16 at 15:34 +0800, Li Yang wrote:
>> From: Zhao Chenhui 
>>
>> Make a single PCIe MSI bank shareable through CAMP OSes. The number of
>> MSI used by each core can be configured by dts file.
>>
>> Signed-off-by: Zhao Chenhui 
>> Signed-off-by: Li Yang 
>> ---
>>  arch/powerpc/sysdev/fsl_msi.c    |    8 +++-
>>  arch/powerpc/sysdev/msi_bitmap.c |    4 ++--
>>  2 files changed, 9 insertions(+), 3 deletions(-)
> ..
>> diff --git a/arch/powerpc/sysdev/msi_bitmap.c 
>> b/arch/powerpc/sysdev/msi_bitmap.c
>> index 5a32cbe..b41db96 100644
>> --- a/arch/powerpc/sysdev/msi_bitmap.c
>> +++ b/arch/powerpc/sysdev/msi_bitmap.c
>> @@ -95,8 +95,8 @@ int msi_bitmap_reserve_dt_hwirqs(struct msi_bitmap *bmp)
>>       /* Format is: ( )+ */
>>       len /= 2 * sizeof(u32);
>>       for (i = 0; i < len; i++, p += 2) {
>> -             for (j = 0; j < *(p + 1); j++)
>> -                     bitmap_release_region(bmp->bitmap, *p + j, 0);
>> +             for (j = *p; j < *(p + 1); j++)
>> +                     bitmap_release_region(bmp->bitmap, j, 0);
>>       }
>>
>>       spin_unlock(&bmp->lock);
>
> This looks like a bug fix to the msi bitmap code, is it not? Please
> split it into a separate commit with an explanatory changelog.

Oops.  We thought the property to be {start end} by mistake.  The
change shouldn't be needed.

Thanks,
Leo
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev