From: Cao jin <caoj.fnst@cn.fujitsu.com>
To: qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
Hannes Reinecke <hare@suse.de>,
Paolo Bonzini <pbonzini@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Marcel Apfelbaum <marcel@redhat.com>
Subject: [Qemu-devel] [PATCH v7 04/10] megasas: change behaviour of msix switch
Date: Mon, 14 Nov 2016 15:25:34 +0800 [thread overview]
Message-ID: <1479108340-3453-5-git-send-email-caoj.fnst@cn.fujitsu.com> (raw)
In-Reply-To: <1479108340-3453-1-git-send-email-caoj.fnst@cn.fujitsu.com>
Resolve the TODO, msix=auto means msix on; if user specify msix=on,
then device creation fail on msix_init failure.
Also undo the overwrites of user configuration of msix.
CC: Michael S. Tsirkin <mst@redhat.com>
CC: Hannes Reinecke <hare@suse.de>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: Markus Armbruster <armbru@redhat.com>
CC: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
---
hw/scsi/megasas.c | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index fada834..6cef9a3 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -2353,19 +2353,31 @@ static void megasas_scsi_realize(PCIDevice *dev, Error **errp)
memory_region_init_io(&s->mmio_io, OBJECT(s), &megasas_mmio_ops, s,
"megasas-mmio", 0x4000);
+ if (megasas_use_msix(s)) {
+ ret = msix_init(dev, 15, &s->mmio_io, b->mmio_bar, 0x2000,
+ &s->mmio_io, b->mmio_bar, 0x3800, 0x68, &err);
+ /* Any error other than -ENOTSUP(board's MSI support is broken)
+ * is a programming error */
+ assert(!ret || ret == -ENOTSUP);
+ if (ret && s->msix == ON_OFF_AUTO_ON) {
+ /* Can't satisfy user's explicit msix=on request, fail */
+ error_append_hint(&err, "You have to use msix=auto (default) or "
+ "msix=off with this machine type.\n");
+ /* No instance_finalize method, need to free the resource here */
+ object_unref(OBJECT(&s->mmio_io));
+ error_propagate(errp, err);
+ return;
+ }
+ assert(!err || s->msix == ON_OFF_AUTO_AUTO);
+ /* With msix=auto, we fall back to MSI off silently */
+ error_free(err);
+ }
+
memory_region_init_io(&s->port_io, OBJECT(s), &megasas_port_ops, s,
"megasas-io", 256);
memory_region_init_io(&s->queue_io, OBJECT(s), &megasas_queue_ops, s,
"megasas-queue", 0x40000);
- if (megasas_use_msix(s) &&
- msix_init(dev, 15, &s->mmio_io, b->mmio_bar, 0x2000,
- &s->mmio_io, b->mmio_bar, 0x3800, 0x68, &err)) {
- /*TODO: check msix_init's error, and should fail on msix=on */
- error_report_err(err);
- s->msix = ON_OFF_AUTO_OFF;
- }
-
if (pci_is_express(dev)) {
pcie_endpoint_cap_init(dev, 0xa0);
}
--
2.1.0
next prev parent reply other threads:[~2016-11-14 7:23 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-14 7:25 [Qemu-devel] [PATCH v7 00/10] Convert msix_init() to error Cao jin
2016-11-14 7:25 ` [Qemu-devel] [PATCH v7 01/10] msix: Follow CODING_STYLE Cao jin
2016-11-14 7:25 ` [Qemu-devel] [PATCH v7 02/10] hcd-xhci: check & correct param before using it Cao jin
2016-11-17 13:48 ` Markus Armbruster
2016-11-14 7:25 ` [Qemu-devel] [PATCH v7 03/10] pci: Convert msix_init() to Error and fix callers to check it Cao jin
2017-01-10 17:54 ` Michael S. Tsirkin
2017-01-10 17:58 ` Paolo Bonzini
2017-01-10 19:21 ` Michael S. Tsirkin
2017-01-11 9:55 ` Markus Armbruster
2017-01-12 15:08 ` Michael S. Tsirkin
2017-01-12 14:58 ` Michael S. Tsirkin
2016-11-14 7:25 ` Cao jin [this message]
2016-11-14 7:25 ` [Qemu-devel] [PATCH v7 05/10] hcd-xhci: change behaviour of msix switch Cao jin
2016-11-14 7:25 ` [Qemu-devel] [PATCH v7 06/10] megasas: remove unnecessary megasas_use_msix() Cao jin
2016-11-14 7:25 ` [Qemu-devel] [PATCH v7 07/10] megasas: undo the overwrites of msi user configuration Cao jin
2016-11-14 7:25 ` [Qemu-devel] [PATCH v7 08/10] vmxnet3: fix reference leak issue Cao jin
2016-11-14 7:25 ` [Qemu-devel] [PATCH v7 09/10] vmxnet3: remove unnecessary internal msix flag Cao jin
2016-11-14 7:25 ` [Qemu-devel] [PATCH v7 10/10] msi_init: convert assert to return -errno Cao jin
2016-11-14 23:22 ` [Qemu-devel] [PATCH v7 00/10] Convert msix_init() to error Michael S. Tsirkin
2016-12-21 6:16 ` Cao jin
2016-12-21 10:43 ` Marcel Apfelbaum
2017-01-09 21:45 ` Michael S. Tsirkin
2017-01-10 10:06 ` Markus Armbruster
2017-01-10 14:38 ` Michael S. Tsirkin
2017-01-10 15:38 ` Paolo Bonzini
2017-01-10 16:19 ` Markus Armbruster
2017-01-10 16:28 ` Paolo Bonzini
2017-01-11 15:25 ` 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=1479108340-3453-5-git-send-email-caoj.fnst@cn.fujitsu.com \
--to=caoj.fnst@cn.fujitsu.com \
--cc=armbru@redhat.com \
--cc=hare@suse.de \
--cc=marcel@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 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).