From patchwork Thu Jan 11 03:04:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dong Jia Shi X-Patchwork-Id: 10156871 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D3C5660231 for ; Thu, 11 Jan 2018 03:10:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6CE628571 for ; Thu, 11 Jan 2018 03:10:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB7BB285BE; Thu, 11 Jan 2018 03:10:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 54BF428571 for ; Thu, 11 Jan 2018 03:10:18 +0000 (UTC) Received: from localhost ([::1]:34180 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZTFx-0000oa-HB for patchwork-qemu-devel@patchwork.kernel.org; Wed, 10 Jan 2018 22:10:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44438) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZTB8-0004th-CR for qemu-devel@nongnu.org; Wed, 10 Jan 2018 22:05:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eZTB6-000313-C7 for qemu-devel@nongnu.org; Wed, 10 Jan 2018 22:05:18 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:54026) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eZTB5-0002yc-Hn for qemu-devel@nongnu.org; Wed, 10 Jan 2018 22:05:15 -0500 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w0B34DiZ061209 for ; Wed, 10 Jan 2018 22:05:13 -0500 Received: from e38.co.us.ibm.com (e38.co.us.ibm.com [32.97.110.159]) by mx0a-001b2d01.pphosted.com with ESMTP id 2fduc6sqpe-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 10 Jan 2018 22:05:12 -0500 Received: from localhost by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 10 Jan 2018 20:05:11 -0700 Received: from b03cxnp08025.gho.boulder.ibm.com (9.17.130.17) by e38.co.us.ibm.com (192.168.1.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 10 Jan 2018 20:05:09 -0700 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w0B359wN8323578; Wed, 10 Jan 2018 20:05:09 -0700 Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2666EC604A; Wed, 10 Jan 2018 20:05:09 -0700 (MST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP id 4E291C6047; Wed, 10 Jan 2018 20:05:07 -0700 (MST) From: Dong Jia Shi To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, kvm@vger.kernel.org, qemu-devel@nongnu.org, qemu-s390x@nongnu.org Date: Thu, 11 Jan 2018 04:04:56 +0100 X-Mailer: git-send-email 2.13.5 In-Reply-To: <20180111030459.33757-1-bjsdjshi@linux.vnet.ibm.com> References: <20180111030459.33757-1-bjsdjshi@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18011103-0028-0000-0000-000008F8C150 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008357; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000245; SDB=6.00973252; UDB=6.00493124; IPR=6.00753202; MB=3.00018971; MTD=3.00000008; XFM=3.00000015; UTC=2018-01-11 03:05:11 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18011103-0029-0000-0000-00003915E449 Message-Id: <20180111030459.33757-3-bjsdjshi@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-01-11_02:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1801110036 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [RFC PATCH 2/5] vfio/ccw: get schib region info X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: borntraeger@de.ibm.com, bjsdjshi@linux.vnet.ibm.com, cohuck@redhat.com, pmorel@linux.vnet.ibm.com, pasic@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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)