From patchwork Thu Jul 6 07:23:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Borntraeger X-Patchwork-Id: 9827547 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 642BF60317 for ; Thu, 6 Jul 2017 07:25:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B999285A5 for ; Thu, 6 Jul 2017 07:25:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 405B2285BE; Thu, 6 Jul 2017 07:25:16 +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 A8DDC285A5 for ; Thu, 6 Jul 2017 07:25:15 +0000 (UTC) Received: from localhost ([::1]:49620 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dT1A2-00036i-RF for patchwork-qemu-devel@patchwork.kernel.org; Thu, 06 Jul 2017 03:25:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49394) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dT18p-00035X-NV for qemu-devel@nongnu.org; Thu, 06 Jul 2017 03:24:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dT18l-0005KK-7r for qemu-devel@nongnu.org; Thu, 06 Jul 2017 03:23:59 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:57087) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dT18k-0005Jm-TG for qemu-devel@nongnu.org; Thu, 06 Jul 2017 03:23:55 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v667NpKC023478 for ; Thu, 6 Jul 2017 03:23:52 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2bh39dwp5f-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 06 Jul 2017 03:23:52 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 6 Jul 2017 08:23:42 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 6 Jul 2017 08:23:40 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v667Nd4e57999402; Thu, 6 Jul 2017 07:23:39 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 86D074C04A; Thu, 6 Jul 2017 08:21:29 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6DA814C044; Thu, 6 Jul 2017 08:21:29 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 6 Jul 2017 08:21:29 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id 8054420F1DF; Thu, 6 Jul 2017 09:23:39 +0200 (CEST) From: Christian Borntraeger To: qemu-devel Date: Thu, 6 Jul 2017 09:23:33 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499325817-9166-1-git-send-email-borntraeger@de.ibm.com> References: <1499325817-9166-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17070607-0012-0000-0000-0000055FCEF2 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17070607-0013-0000-0000-000018D23D81 Message-Id: <1499325817-9166-5-git-send-email-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-06_04:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1707060127 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PULL 4/8] s390x: fix realize inheritance for kvm-flic 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: Christian Borntraeger , Halil Pasic , Cornelia Huck , Alexander Graf , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Halil Pasic Commit f6f4ce4211 ("s390x: add property adapter_routes_max_batch", 2016-12-09) introduces a common realize (intended to be common for all the subclasses) for flic, but fails to make sure the kvm-flic which had its own is actually calling this common realize. This omission fortunately does not result in a grave problem. The common realize was only supposed to catch a possible programming mistake by validating a value of a property set via the compat machine macros. Since there was no programming mistake we don't need this fixed for stable. Let's fix this problem by making sure kvm flic honors the realize of its parent class. Let us also improve on the error message we would hypothetically emit when the validation fails. Signed-off-by: Halil Pasic Fixes: f6f4ce4211 ("s390x: add property adapter_routes_max_batch") Reviewed-by: Dong Jia Shi Reviewed-by: Yi Min Zhao Reviewed-by: Cornelia Huck Signed-off-by: Christian Borntraeger --- hw/intc/s390_flic.c | 4 ++-- hw/intc/s390_flic_kvm.c | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c index a99a350..837158b 100644 --- a/hw/intc/s390_flic.c +++ b/hw/intc/s390_flic.c @@ -101,8 +101,8 @@ static void s390_flic_common_realize(DeviceState *dev, Error **errp) uint32_t max_batch = S390_FLIC_COMMON(dev)->adapter_routes_max_batch; if (max_batch > ADAPTER_ROUTES_MAX_GSI) { - error_setg(errp, "flic adapter_routes_max_batch too big" - "%d (%d allowed)", max_batch, ADAPTER_ROUTES_MAX_GSI); + error_setg(errp, "flic property adapter_routes_max_batch too big" + " (%d > %d)", max_batch, ADAPTER_ROUTES_MAX_GSI); } } diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c index 56f1b81..0bcd49f 100644 --- a/hw/intc/s390_flic_kvm.c +++ b/hw/intc/s390_flic_kvm.c @@ -392,6 +392,17 @@ static const VMStateDescription kvm_s390_flic_vmstate = { } }; +typedef struct KVMS390FLICStateClass { + S390FLICStateClass parent_class; + DeviceRealize parent_realize; +} KVMS390FLICStateClass; + +#define KVM_S390_FLIC_GET_CLASS(obj) \ + OBJECT_GET_CLASS(KVMS390FLICStateClass, (obj), TYPE_KVM_S390_FLIC) + +#define KVM_S390_FLIC_CLASS(klass) \ + OBJECT_CLASS_CHECK(KVMS390FLICStateClass, (klass), TYPE_KVM_S390_FLIC) + static void kvm_s390_flic_realize(DeviceState *dev, Error **errp) { KVMS390FLICState *flic_state = KVM_S390_FLIC(dev); @@ -400,6 +411,10 @@ static void kvm_s390_flic_realize(DeviceState *dev, Error **errp) int ret; Error *errp_local = NULL; + KVM_S390_FLIC_GET_CLASS(dev)->parent_realize(dev, &errp_local); + if (errp_local) { + goto fail; + } flic_state->fd = -1; if (!kvm_check_extension(kvm_state, KVM_CAP_DEVICE_CTRL)) { error_setg_errno(&errp_local, errno, "KVM is missing capability" @@ -454,6 +469,7 @@ static void kvm_s390_flic_class_init(ObjectClass *oc, void *data) DeviceClass *dc = DEVICE_CLASS(oc); S390FLICStateClass *fsc = S390_FLIC_COMMON_CLASS(oc); + KVM_S390_FLIC_CLASS(oc)->parent_realize = dc->realize; dc->realize = kvm_s390_flic_realize; dc->vmsd = &kvm_s390_flic_vmstate; dc->reset = kvm_s390_flic_reset; @@ -468,6 +484,7 @@ static const TypeInfo kvm_s390_flic_info = { .name = TYPE_KVM_S390_FLIC, .parent = TYPE_S390_FLIC_COMMON, .instance_size = sizeof(KVMS390FLICState), + .class_size = sizeof(KVMS390FLICStateClass), .class_init = kvm_s390_flic_class_init, };