qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org,
	kvm@vger.kernel.org, qemu-devel@nongnu.org,
	qemu-s390x@nongnu.org
Cc: cohuck@redhat.com, borntraeger@de.ibm.com,
	bjsdjshi@linux.vnet.ibm.com, pasic@linux.vnet.ibm.com,
	pmorel@linux.vnet.ibm.com
Subject: [Qemu-devel] [RFC PATCH 2/5] vfio/ccw: get schib region info
Date: Thu, 11 Jan 2018 04:04:56 +0100	[thread overview]
Message-ID: <20180111030459.33757-3-bjsdjshi@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180111030459.33757-1-bjsdjshi@linux.vnet.ibm.com>

vfio-ccw provides an MMIO region for store subchannel
information. We fetch this information via ioctls here,
then we can use it to update schib for virtual subchannels
later on.

While we are at it, also modify the comment and error
message for the config region a bit, to make these unified
with the schib likeness.

Signed-off-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
---
 hw/vfio/ccw.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
index 16713f2c52..e673695509 100644
--- a/hw/vfio/ccw.c
+++ b/hw/vfio/ccw.c
@@ -32,6 +32,10 @@ typedef struct VFIOCCWDevice {
     uint64_t io_region_offset;
     struct ccw_io_region *io_region;
     EventNotifier io_notifier;
+
+    uint64_t schib_region_size;
+    uint64_t schib_region_offset;
+    struct ccw_schib_region *schib_region;
 } VFIOCCWDevice;
 
 static void vfio_ccw_compute_needs_reset(VFIODevice *vdev)
@@ -268,9 +272,10 @@ static void vfio_ccw_get_region(VFIOCCWDevice *vcdev, Error **errp)
         return;
     }
 
+    /* Get I/O region info. */
     ret = vfio_get_region_info(vdev, VFIO_CCW_CONFIG_REGION_INDEX, &info);
     if (ret) {
-        error_setg_errno(errp, -ret, "vfio: Error getting config info");
+        error_setg_errno(errp, -ret, "vfio: Error getting config region info");
         return;
     }
 
@@ -283,13 +288,30 @@ static void vfio_ccw_get_region(VFIOCCWDevice *vcdev, Error **errp)
 
     vcdev->io_region_offset = info->offset;
     vcdev->io_region = g_malloc0(info->size);
+    g_free(info);
 
+    /* Get SCHIB region info. */
+    ret = vfio_get_region_info(vdev, VFIO_CCW_SCHIB_REGION_INDEX, &info);
+    if (ret) {
+        error_setg_errno(errp, -ret, "vfio: Error getting schib region info");
+        return;
+    }
+
+    vcdev->schib_region_size = info->size;
+    if (sizeof(*vcdev->schib_region) != vcdev->schib_region_size) {
+        error_setg(errp, "vfio: Unexpected size of the schib region");
+        g_free(info);
+        return;
+    }
+    vcdev->schib_region_offset = info->offset;
+    vcdev->schib_region = g_malloc0(info->size);
     g_free(info);
 }
 
 static void vfio_ccw_put_region(VFIOCCWDevice *vcdev)
 {
     g_free(vcdev->io_region);
+    g_free(vcdev->schib_region);
 }
 
 static void vfio_put_device(VFIOCCWDevice *vcdev)
-- 
2.13.5

  parent reply	other threads:[~2018-01-11  3:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-11  3:04 [Qemu-devel] [RFC PATCH 0/5] vfio/ccw: basic channel path event handling Dong Jia Shi
2018-01-11  3:04 ` [Qemu-devel] [RFC PATCH 1/5] vfio: linux-headers update for vfio-ccw Dong Jia Shi
2018-01-11  3:04 ` Dong Jia Shi [this message]
2018-01-11  3:04 ` [Qemu-devel] [RFC PATCH 3/5] vfio/ccw: get irq info and set up handler for chp irq Dong Jia Shi
2018-01-11  3:04 ` [Qemu-devel] [RFC PATCH 4/5] vfio/ccw: update subchanel information block lazily Dong Jia Shi
2018-01-11  3:04 ` [Qemu-devel] [RFC PATCH 5/5] vfio/ccw: build schib with real schib information Dong Jia Shi

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=20180111030459.33757-3-bjsdjshi@linux.vnet.ibm.com \
    --to=bjsdjshi@linux.vnet.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pasic@linux.vnet.ibm.com \
    --cc=pmorel@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@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).