All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cao jin <caoj.fnst@cn.fujitsu.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, Marcel Apfelbaum <marcel@redhat.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v10 1/8] msix: Rename and create a wrapper
Date: Tue, 7 Mar 2017 16:08:32 +0800	[thread overview]
Message-ID: <58BE6A80.7010108@cn.fujitsu.com> (raw)
In-Reply-To: <87tw75il8m.fsf@dusky.pond.sub.org>



On 03/07/2017 03:44 PM, Markus Armbruster wrote:
> Uh, two weeks since your posted this already.  I apologize for taking so
> long to review.
> 
> Cao jin <caoj.fnst@cn.fujitsu.com> writes:
> 
>> Rename msix_init to msix_validate_and_init, and use it from vfio which
>> might get a reasonable -EINVAL.  New a wrapper msix_init which assert the
>> programming error for debug purpose and use it from other devices.
>>
>> CC: Alex Williamson <alex.williamson@redhat.com>
>> CC: Markus Armbruster <armbru@redhat.com>
>> CC: Marcel Apfelbaum <marcel@redhat.com>
>> CC: Michael S. Tsirkin <mst@redhat.com>
>>
>> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
>> ---
>>  hw/pci/msix.c         | 30 +++++++++++++++++++++---------
>>  hw/vfio/pci.c         | 12 ++++++------
>>  include/hw/pci/msix.h |  5 +++++
>>  3 files changed, 32 insertions(+), 15 deletions(-)
>>
>> diff --git a/hw/pci/msix.c b/hw/pci/msix.c
>> index bb54e8b0ac37..2b7541ab2c8d 100644
>> --- a/hw/pci/msix.c
>> +++ b/hw/pci/msix.c
>> @@ -239,6 +239,19 @@ static void msix_mask_all(struct PCIDevice *dev, unsigned nentries)
>>      }
>>  }
>>  
>> +/* Just a wrapper to check the return value */
>> +int msix_init(struct PCIDevice *dev, unsigned short nentries,
>> +              MemoryRegion *table_bar, uint8_t table_bar_nr,
>> +              unsigned table_offset, MemoryRegion *pba_bar,
>> +              uint8_t pba_bar_nr, unsigned pba_offset, uint8_t cap_pos,
>> +              Error **errp)
>> +{
>> +    int ret = msix_validate_and_init(dev, nentries, table_bar, table_bar_nr,
>> +            table_offset, pba_bar, pba_bar_nr, pba_offset, cap_pos, errp);
>> +
>> +    assert(ret != -EINVAL);
>> +    return ret;
>> +}
>>  /*
>>   * Make PCI device @dev MSI-X capable
>>   * @nentries is the max number of MSI-X vectors that the device support.
>> @@ -259,11 +272,11 @@ static void msix_mask_all(struct PCIDevice *dev, unsigned nentries)
>>   * also means a programming error, except device assignment, which can check
>>   * if a real HW is broken.
>>   */
>> -int msix_init(struct PCIDevice *dev, unsigned short nentries,
>> -              MemoryRegion *table_bar, uint8_t table_bar_nr,
>> -              unsigned table_offset, MemoryRegion *pba_bar,
>> -              uint8_t pba_bar_nr, unsigned pba_offset, uint8_t cap_pos,
>> -              Error **errp)
>> +int msix_validate_and_init(struct PCIDevice *dev, unsigned short nentries,
>> +                           MemoryRegion *table_bar, uint8_t table_bar_nr,
>> +                           unsigned table_offset, MemoryRegion *pba_bar,
>> +                           uint8_t pba_bar_nr, unsigned pba_offset,
>> +                           uint8_t cap_pos, Error **errp)
>>  {
>>      int cap;
>>      unsigned table_size, pba_size;
>> @@ -361,10 +374,9 @@ int msix_init_exclusive_bar(PCIDevice *dev, unsigned short nentries,
>>      memory_region_init(&dev->msix_exclusive_bar, OBJECT(dev), name, bar_size);
>>      g_free(name);
>>  
>> -    ret = msix_init(dev, nentries, &dev->msix_exclusive_bar, bar_nr,
>> -                    0, &dev->msix_exclusive_bar,
>> -                    bar_nr, bar_pba_offset,
>> -                    0, errp);
>> +    ret = msix_validate_and_init(dev, nentries, &dev->msix_exclusive_bar,
>> +                                 bar_nr, 0, &dev->msix_exclusive_bar,
>> +                                 bar_nr, bar_pba_offset, 0, errp);
>>      if (ret) {
>>          return ret;
>>      }
> 
> This change assumes that for the callers of msix_exclusive_bar(),
> -EINVAL (capability overlap) is not a programming error.  Is that true?
> 

Oh...it looks as you said. Will revert this part and send a new one
in-reply-to this one.

-- 
Sincerely,
Cao jin

  reply	other threads:[~2017-03-07  8:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-25  8:26 [Qemu-devel] [PATCH v10 0/8] the reset of msix_init series Cao jin
2017-02-25  8:26 ` [Qemu-devel] [PATCH v10 1/8] msix: Rename and create a wrapper Cao jin
2017-03-07  7:44   ` Markus Armbruster
2017-03-07  8:08     ` Cao jin [this message]
2017-03-07  8:27   ` [Qemu-devel] [PATCH v10] msix: rename " Cao jin
2017-03-07  8:33     ` Markus Armbruster
2017-02-25  8:26 ` [Qemu-devel] [PATCH v10 2/8] megasas: change behaviour of msix switch Cao jin
2017-02-25  8:26 ` [Qemu-devel] [PATCH v10 3/8] hcd-xhci: " Cao jin
2017-02-25  8:26 ` [Qemu-devel] [PATCH v10 4/8] megasas: undo the overwrites of msi user configuration Cao jin
2017-02-25  8:26 ` [Qemu-devel] [PATCH v10 5/8] vmxnet3: fix reference leak issue Cao jin
2017-02-25  8:26 ` [Qemu-devel] [PATCH v10 6/8] vmxnet3: remove unnecessary internal msix flag Cao jin
2017-02-25  8:26 ` [Qemu-devel] [PATCH v10 7/8] msi_init: convert assert to return -errno Cao jin
2017-02-25  8:26 ` [Qemu-devel] [PATCH v10 8/8] megasas: remove unnecessary megasas_use_msix() Cao jin
2017-03-06  8:10 ` [Qemu-devel] [PATCH v10 0/8] the reset of msix_init series Cao jin
2017-03-06 15:10   ` Michael S. Tsirkin
2017-04-28  7:45   ` Cao jin

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=58BE6A80.7010108@cn.fujitsu.com \
    --to=caoj.fnst@cn.fujitsu.com \
    --cc=alex.williamson@redhat.com \
    --cc=armbru@redhat.com \
    --cc=marcel@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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.