linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5/5] s390/MSI: Fix msi mask issue
@ 2014-06-19  8:31 Yijing Wang
  2014-06-23 10:47 ` Sebastian Ott
  2014-07-03 23:57 ` Bjorn Helgaas
  0 siblings, 2 replies; 4+ messages in thread
From: Yijing Wang @ 2014-06-19  8:31 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Sebastian Ott, Gerald Schaefer, Martin Schwidefsky,
	Heiko Carstens, linux-s390, linux-pci, Wuyun, Xinwei Hu,
	Yijing Wang

Maskbit in msi_attrib indicates MSI whether
support mask-pending bit. It is read only,
should save mask state in masked.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/s390/pci/pci.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index bdf0257..4651d6b 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -263,7 +263,7 @@ static int zpci_msi_set_mask_bits(struct msi_desc *msi, u32 mask, u32 flag)
 	} else
 		return 0;
 
-	msi->msi_attrib.maskbit = !!flag;
+	msi->masked = !!flag;
 	return 1;
 }
 
-- 
1.7.1



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

* Re: [PATCH 5/5] s390/MSI: Fix msi mask issue
  2014-06-19  8:31 [PATCH 5/5] s390/MSI: Fix msi mask issue Yijing Wang
@ 2014-06-23 10:47 ` Sebastian Ott
  2014-07-03 23:57 ` Bjorn Helgaas
  1 sibling, 0 replies; 4+ messages in thread
From: Sebastian Ott @ 2014-06-23 10:47 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Gerald Schaefer, Martin Schwidefsky,
	Heiko Carstens, linux-s390, linux-pci, Wuyun, Xinwei Hu

On Thu, 19 Jun 2014, Yijing Wang wrote:

> Maskbit in msi_attrib indicates MSI whether
> support mask-pending bit. It is read only,
> should save mask state in masked.
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> ---
>  arch/s390/pci/pci.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
> index bdf0257..4651d6b 100644
> --- a/arch/s390/pci/pci.c
> +++ b/arch/s390/pci/pci.c
> @@ -263,7 +263,7 @@ static int zpci_msi_set_mask_bits(struct msi_desc *msi, u32 mask, u32 flag)
>  	} else
>  		return 0;
> 
> -	msi->msi_attrib.maskbit = !!flag;
> +	msi->masked = !!flag;
>  	return 1;
>  }
> 
> -- 
> 1.7.1
> 
> 
> 
Applied, thanks!
Sebastian


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

* Re: [PATCH 5/5] s390/MSI: Fix msi mask issue
  2014-06-19  8:31 [PATCH 5/5] s390/MSI: Fix msi mask issue Yijing Wang
  2014-06-23 10:47 ` Sebastian Ott
@ 2014-07-03 23:57 ` Bjorn Helgaas
  2014-07-04  1:53   ` Yijing Wang
  1 sibling, 1 reply; 4+ messages in thread
From: Bjorn Helgaas @ 2014-07-03 23:57 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Sebastian Ott, Gerald Schaefer, Martin Schwidefsky,
	Heiko Carstens, linux-s390, linux-pci, Wuyun, Xinwei Hu

On Thu, Jun 19, 2014 at 04:31:14PM +0800, Yijing Wang wrote:
> Maskbit in msi_attrib indicates MSI whether
> support mask-pending bit. It is read only,
> should save mask state in masked.
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> ---
>  arch/s390/pci/pci.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
> index bdf0257..4651d6b 100644
> --- a/arch/s390/pci/pci.c
> +++ b/arch/s390/pci/pci.c
> @@ -263,7 +263,7 @@ static int zpci_msi_set_mask_bits(struct msi_desc *msi, u32 mask, u32 flag)
>  	} else
>  		return 0;
>  
> -	msi->msi_attrib.maskbit = !!flag;
> +	msi->masked = !!flag;

This doesn't look right.  For MSI-X, you just overwrote the previous update
of msi->masked:

    if (msi->msi_attrib.is_msix) {
	...
	msi->masked = readl(msi->mask_base + offset);

Maybe the update values end up being the same, but why do it twice?

Also, the MSI mask bits are 32-bit field that can individually mask any
subset of the 32 possible MSI vectors, and you collapsed this down to a
single bit, so msi->masked no longer contains that information.

Maybe none of this matters because all the zpci_msi_set_mask_bits() uses
seem to be for a single bit, but the name says "mask_*bits*" and the
msi->masked field is generic and covers multiple MSI vectors in general.

>  	return 1;
>  }
>  
> -- 
> 1.7.1
> 
> 

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

* Re: [PATCH 5/5] s390/MSI: Fix msi mask issue
  2014-07-03 23:57 ` Bjorn Helgaas
@ 2014-07-04  1:53   ` Yijing Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Yijing Wang @ 2014-07-04  1:53 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Sebastian Ott, Gerald Schaefer, Martin Schwidefsky,
	Heiko Carstens, linux-s390, linux-pci, Wuyun, Xinwei Hu

>> @@ -263,7 +263,7 @@ static int zpci_msi_set_mask_bits(struct msi_desc *msi, u32 mask, u32 flag)
>>  	} else
>>  		return 0;
>>  
>> -	msi->msi_attrib.maskbit = !!flag;
>> +	msi->masked = !!flag;
> 
> This doesn't look right.  For MSI-X, you just overwrote the previous update
> of msi->masked:
> 
>     if (msi->msi_attrib.is_msix) {
> 	...
> 	msi->masked = readl(msi->mask_base + offset);
> 
> Maybe the update values end up being the same, but why do it twice?

Hi Bjorn, this code is some difficult to understand. I guess it's for save
MSI mask status, for MSI-X, do this twice, maybe this line should move up int to
MSI if ()...

Because I don't have the platform to test, so I do not want to change the code logic,
what I am sure is save the flag status in msi->msi_attrib.maskbit  is wrong.
So I change this like:
	msi->masked = !!flag;

Sebastian may know why do it like this.

Besides, I think we can use MSI code driver interface mask_msi_irq() and unmask_msi_irq()
to replace zpci_enable_irq() and zpci_disable_irq().

> 
> Also, the MSI mask bits are 32-bit field that can individually mask any
> subset of the 32 possible MSI vectors, and you collapsed this down to a
> single bit, so msi->masked no longer contains that information.
> 
> Maybe none of this matters because all the zpci_msi_set_mask_bits() uses
> seem to be for a single bit, but the name says "mask_*bits*" and the
> msi->masked field is generic and covers multiple MSI vectors in general.

Yes, it always uses single bit here, as you said, this code has some problems for
multiple MSI, although it may does not use it.

I will try to send a new patch fix the original problem.

Thanks!
Yijing.
> 
>>  	return 1;
>>  }
>>  
>> -- 
>> 1.7.1
>>
>>
> 
> .
> 


-- 
Thanks!
Yijing


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

end of thread, other threads:[~2014-07-04  1:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-19  8:31 [PATCH 5/5] s390/MSI: Fix msi mask issue Yijing Wang
2014-06-23 10:47 ` Sebastian Ott
2014-07-03 23:57 ` Bjorn Helgaas
2014-07-04  1:53   ` Yijing Wang

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