From: Marcel Apfelbaum <marcel@redhat.com>
To: Cao jin <caoj.fnst@cn.fujitsu.com>, qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>, John Snow <jsnow@redhat.com>,
Dmitry Fleytman <dmitry@daynix.com>,
Jason Wang <jasowang@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Hannes Reinecke <hare@suse.de>,
Paolo Bonzini <pbonzini@redhat.com>,
Alex Williamson <alex.williamson@redhat.com>,
Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v8 12/17] pci: Convert msi_init() to Error and fix callers to check it
Date: Mon, 13 Jun 2016 14:55:44 +0300 [thread overview]
Message-ID: <575E9F40.7020009@redhat.com> (raw)
In-Reply-To: <575E944E.6030707@cn.fujitsu.com>
On 06/13/2016 02:09 PM, Cao jin wrote:
>
>
> On 06/13/2016 06:16 PM, Marcel Apfelbaum wrote:
>> On 06/10/2016 12:54 PM, Cao jin wrote:
>
>>> diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
>>> index 692283f..a06d184 100644
>>> --- a/hw/net/e1000e.c
>>> +++ b/hw/net/e1000e.c
>>> @@ -268,13 +268,9 @@ e1000e_init_msi(E1000EState *s)
>>> {
>>> int res;
>>>
>>> - res = msi_init(PCI_DEVICE(s),
>>> - 0xD0, /* MSI capability offset */
>>> - 1, /* MAC MSI interrupts */
>>> - true, /* 64-bit message addresses supported */
>>> - false); /* Per vector mask supported */
>>> + res = msi_init(PCI_DEVICE(s), 0xD0, 1, true, false, NULL);
>>>
>>
>> Why did you chose to remove author's comments?
>>
>
> Because msi_init() has its function comments now, which is the same is the author`s comments, I guess author add these comments because function has no comment before, remove comments also is to save
> screen space:)
>
> some macros of some devices is also unnecessary I think, because we have comments of msi_init().
>
Right.
>>> +
>>> +#define VMXNET3_USE_64BIT (true)
>>> +#define VMXNET3_PER_VECTOR_MASK (false)
>>> +
>
> like these macros, but it does't take too much space as above one I feel, so I didn't touch them.
>
>>> @@ -56,14 +57,17 @@ static int xio3130_upstream_initfn(PCIDevice *d)
>>> {
>>> PCIEPort *p = PCIE_PORT(d);
>>> int rc;
>>> + Error *err = NULL;
>>>
>>> pci_bridge_initfn(d, TYPE_PCIE_BUS);
>>> pcie_port_init_reg(d);
>>>
>>> rc = msi_init(d, XIO3130_MSI_OFFSET, XIO3130_MSI_NR_VECTOR,
>>> XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_64BIT,
>>> - XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_MASKBIT);
>>> + XIO3130_MSI_SUPPORTED_FLAGS &
>>> PCI_MSI_FLAGS_MASKBIT, &err);
>>> if (rc < 0) {
>>> + assert(rc == -ENOTSUP);
>>> + error_report_err(err);
>>
>> Hi Jin, Markus
>>
>> It looks a little weird to me to check for negative error code
>> and then assert for a specific error as the only "valid error".
>> Maybe we should assert inside msi_init to leave the callers "clean"?
>>
> Hi Marcel,
>
> I think it is because: except assigned device(vfio), the emulated pci devices won`t have config space overlapped(-EINVAL), unless programming error.
>
Understood, thanks for the explanation.
For the PCI part:
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Thanks,
Marcel
> If implemented as you said, I guess there need a judgement (if..else..) to check if current device is assigned in msi_init(), or else assert the error
>
>> I am well aware a lot of time was spent for this series, but I just
>> spotted it and I want to be sure we are doing it right.
>>
>> Thanks,
>> Marcel
>>
>
next prev parent reply other threads:[~2016-06-13 11:55 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-10 9:54 [Qemu-devel] [PATCH v8 00/17] Add param Error ** for msi_init() Cao jin
2016-06-10 9:54 ` [Qemu-devel] [PATCH v8 01/17] pci core: assert ENOSPC when add capability Cao jin
2016-06-10 9:54 ` [Qemu-devel] [PATCH v8 02/17] fix some coding style problems Cao jin
2016-06-10 9:54 ` [Qemu-devel] [PATCH v8 03/17] change pvscsi_init_msi() type to void Cao jin
2016-06-10 9:54 ` [Qemu-devel] [PATCH v8 04/17] megasas: Fix check for msi_init() failure Cao jin
2016-06-10 9:54 ` [Qemu-devel] [PATCH v8 05/17] mptsas: change .realize function name Cao jin
2016-06-10 9:54 ` [Qemu-devel] [PATCH v8 06/17] usb xhci: change msi/msix property type Cao jin
2016-06-10 9:54 ` [Qemu-devel] [PATCH v8 07/17] intel-hda: change msi " Cao jin
2016-06-10 9:54 ` [Qemu-devel] [PATCH v8 08/17] mptsas: " Cao jin
2016-06-10 9:54 ` [Qemu-devel] [PATCH v8 09/17] megasas: change msi/msix " Cao jin
2016-06-10 9:54 ` [Qemu-devel] [PATCH v8 10/17] pci bridge dev: change msi " Cao jin
2016-06-13 9:35 ` Marcel Apfelbaum
2016-06-10 9:54 ` [Qemu-devel] [PATCH v8 11/17] msi_init: change return value to 0 on success Cao jin
2016-06-13 9:38 ` Marcel Apfelbaum
2016-06-10 9:54 ` [Qemu-devel] [PATCH v8 12/17] pci: Convert msi_init() to Error and fix callers to check it Cao jin
2016-06-13 10:16 ` Marcel Apfelbaum
2016-06-13 11:07 ` Markus Armbruster
2016-06-13 11:53 ` Marcel Apfelbaum
2016-06-13 11:09 ` Cao jin
2016-06-13 11:55 ` Marcel Apfelbaum [this message]
2016-06-10 9:54 ` [Qemu-devel] [PATCH v8 13/17] megasas: remove unnecessary megasas_use_msi() Cao jin
2016-06-10 9:54 ` [Qemu-devel] [PATCH v8 14/17] mptsas: remove unnecessary internal msi state flag Cao jin
2016-06-10 9:54 ` [Qemu-devel] [PATCH v8 15/17] vmw_pvscsi: " Cao jin
2016-06-13 19:42 ` Michael S. Tsirkin
2016-06-14 8:12 ` Markus Armbruster
2016-06-14 9:31 ` Cao jin
2016-06-10 9:54 ` [Qemu-devel] [PATCH v8 16/17] vmxnet3: " Cao jin
2016-06-13 8:47 ` Markus Armbruster
2016-06-13 9:31 ` Cao jin
2016-06-10 9:54 ` [Qemu-devel] [PATCH v8 17/17] e1000e: " Cao jin
2016-06-13 8:48 ` [Qemu-devel] [PATCH v8 00/17] Add param Error ** for msi_init() Markus Armbruster
2016-06-13 9:15 ` Cao jin
2016-06-13 19:45 ` Michael S. Tsirkin
2016-06-13 20:31 ` Michael S. Tsirkin
2016-06-14 9:35 ` 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=575E9F40.7020009@redhat.com \
--to=marcel@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=armbru@redhat.com \
--cc=caoj.fnst@cn.fujitsu.com \
--cc=dmitry@daynix.com \
--cc=hare@suse.de \
--cc=jasowang@redhat.com \
--cc=jsnow@redhat.com \
--cc=kraxel@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@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.