All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sheng Yang <sheng@linux.intel.com>
To: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: Avi Kivity <avi@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	kvm@vger.kernel.org, Matthew Wilcox <willy@linux.intel.com>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	linux-pci@vger.kernel.org
Subject: Re: [PATCH 2/5] PCI: Add mask bit definition for MSI-X table
Date: Fri, 5 Nov 2010 10:49:19 +0800	[thread overview]
Message-ID: <201011051049.19872.sheng@linux.intel.com> (raw)
In-Reply-To: <4CD3546B.60909@jp.fujitsu.com>

On Friday 05 November 2010 08:48:43 Hidetoshi Seto wrote:
> (2010/11/04 15:15), Sheng Yang wrote:
> > Then we can use it instead of magic number 1.
> > 
> > Cc: Matthew Wilcox <willy@linux.intel.com>
> > Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
> > Cc: linux-pci@vger.kernel.org
> > Signed-off-by: Sheng Yang <sheng@linux.intel.com>
> > ---
> > 
> >  drivers/pci/msi.c        |    4 ++--
> >  include/linux/pci_regs.h |    1 +
> >  2 files changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> > index 69b7be3..673e7dc 100644
> > --- a/drivers/pci/msi.c
> > +++ b/drivers/pci/msi.c
> > @@ -158,7 +158,7 @@ static u32 __msix_mask_irq(struct msi_desc *desc, u32
> > flag)
> > 
> >  	u32 mask_bits = desc->masked;
> >  	unsigned offset = desc->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE +
> >  	
> >  						PCI_MSIX_ENTRY_VECTOR_CTRL;
> > 
> > -	mask_bits &= ~1;
> > +	mask_bits &= ~PCI_MSIX_ENTRY_CTRL_MASKBIT;
> > 
> >  	mask_bits |= flag;
> >  	writel(mask_bits, desc->mask_base + offset);
> > 
> > @@ -185,7 +185,7 @@ static void msi_set_mask_bit(unsigned irq, u32 flag)
> > 
> >  void mask_msi_irq(unsigned int irq)
> >  {
> > 
> > -	msi_set_mask_bit(irq, 1);
> > +	msi_set_mask_bit(irq, PCI_MSIX_ENTRY_CTRL_MASKBIT);
> > 
> >  }
> >  
> >  void unmask_msi_irq(unsigned int irq)
> 
> This hunk is not good, because the function msi_set_mask_bit() is
> not only for MSI-X but also for MSI, so the number 0/1 here works
> as like as false/true:
> 
>  static void msi_set_mask_bit(struct irq_data *data, u32 flag)
>  {
>  	struct msi_desc *desc = irq_data_get_msi(data);
> 
>  	if (desc->msi_attrib.is_msix) {
>  		msix_mask_irq(desc, flag);
>  		readl(desc->mask_base);         /* Flush write to device */
>  	} else {
>  		unsigned offset = data->irq - desc->dev->irq;
>  		msi_mask_irq(desc, 1 << offset, flag << offset);
>  	}
>  }
> 
> > diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
> > index acfc224..ff51632 100644
> > --- a/include/linux/pci_regs.h
> > +++ b/include/linux/pci_regs.h
> > @@ -313,6 +313,7 @@
> > 
> >  #define  PCI_MSIX_ENTRY_UPPER_ADDR	4
> >  #define  PCI_MSIX_ENTRY_DATA		8
> >  #define  PCI_MSIX_ENTRY_VECTOR_CTRL	12
> > 
> > +#define   PCI_MSIX_ENTRY_CTRL_MASKBIT	1
> > 
> >  /* CompactPCI Hotswap Register */
> 
> So I recommend you to have a patch with the above hunk for header
> plus a change like:
> 
>  -	mask_bits &= ~1;
>  - 	mask_bits |= flag;
>  +	mask_bits &= ~PCI_MSIX_ENTRY_CTRL_MASKBIT;
>  + 	mask_bits |= PCI_MSIX_ENTRY_CTRL_MASKBIT & !!flag;
> 
> Anyway thank you very much for doing this work.

Good suggestion. Would update it.
> 
> Reviewed-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>

--
regards
Yang, Sheng

> 
> Thanks,
> H.Seto

  reply	other threads:[~2010-11-05  2:49 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-04  6:15 [PATCH 0/5 v3] MSI-X mask supporting for assigned device(kernel) Sheng Yang
2010-11-04  6:15 ` [PATCH 1/5] PCI: MSI: Move MSI-X entry definition to pci_regs.h Sheng Yang
2010-11-05  0:43   ` Hidetoshi Seto
2010-11-04  6:15 ` [PATCH 2/5] PCI: Add mask bit definition for MSI-X table Sheng Yang
2010-11-04  9:50   ` Michael S. Tsirkin
2010-11-05  2:48     ` Sheng Yang
2010-11-05  0:48   ` Hidetoshi Seto
2010-11-05  2:49     ` Sheng Yang [this message]
2010-11-04  6:15 ` [PATCH 3/5] KVM: Move struct kvm_io_device to kvm_host.h Sheng Yang
2010-11-04  6:15 ` [PATCH 4/5] KVM: Add kvm_get_irq_routing_entry() func Sheng Yang
2010-11-04  6:15 ` [PATCH 5/5] KVM: assigned dev: MSI-X mask support Sheng Yang
2010-11-04 10:43   ` Michael S. Tsirkin
2010-11-05  2:44     ` Sheng Yang
2010-11-05  4:20       ` Sheng Yang
2010-11-05  7:16         ` Sheng Yang
2010-11-05  8:51           ` Michael S. Tsirkin
2010-11-05 10:54             ` Sheng Yang
2010-11-05  8:43       ` Michael S. Tsirkin
2010-11-05 10:53         ` Sheng Yang
2010-11-05 12:01           ` Sheng Yang
2010-11-05 13:29             ` Michael S. Tsirkin
2010-11-05 13:27           ` Michael S. Tsirkin
2010-11-08  3:18             ` Sheng Yang
2010-11-08  6:42               ` Michael S. Tsirkin
2010-11-06  0:24           ` Marcelo Tosatti
2010-11-08  5:41             ` Sheng Yang
2010-11-09 14:08               ` Marcelo Tosatti
2010-11-06  0:27 ` [PATCH 0/5 v3] MSI-X mask supporting for assigned device(kernel) Marcelo Tosatti
2010-11-08  0:51   ` Sheng Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201011051049.19872.sheng@linux.intel.com \
    --to=sheng@linux.intel.com \
    --cc=avi@redhat.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=seto.hidetoshi@jp.fujitsu.com \
    --cc=willy@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.