Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753778AbeAKDGg (ORCPT + 1 other); Wed, 10 Jan 2018 22:06:36 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:60208 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753990AbeAKDFN (ORCPT ); Wed, 10 Jan 2018 22:05:13 -0500 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 Cc: cohuck@redhat.com, borntraeger@de.ibm.com, bjsdjshi@linux.vnet.ibm.com, pasic@linux.vnet.ibm.com, pmorel@linux.vnet.ibm.com Subject: [RFC PATCH 2/5] vfio/ccw: get schib region info 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 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: 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) -- 2.13.5