From patchwork Tue Jul 4 14:07:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Borntraeger X-Patchwork-Id: 9825107 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 7B7B2604D9 for ; Tue, 4 Jul 2017 14:09:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C51427F88 for ; Tue, 4 Jul 2017 14:09:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60C6B2811E; Tue, 4 Jul 2017 14:09:38 +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 1498B27F88 for ; Tue, 4 Jul 2017 14:09:35 +0000 (UTC) Received: from localhost ([::1]:41598 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSOWF-00089t-3V for patchwork-qemu-devel@patchwork.kernel.org; Tue, 04 Jul 2017 10:09:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSOUt-00088i-Vy for qemu-devel@nongnu.org; Tue, 04 Jul 2017 10:08:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSOUp-0003XO-V4 for qemu-devel@nongnu.org; Tue, 04 Jul 2017 10:08:11 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:49034) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSOUp-0003Wk-Kc for qemu-devel@nongnu.org; Tue, 04 Jul 2017 10:08:07 -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 v64E4VIQ000778 for ; Tue, 4 Jul 2017 10:08:06 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2bg6j6jt12-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 04 Jul 2017 10:08:06 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 4 Jul 2017 15:08:03 +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; Tue, 4 Jul 2017 15:08:01 +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 v64E815I5046670; Tue, 4 Jul 2017 14:08:01 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2B4124C044; Tue, 4 Jul 2017 15:05:52 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 140924C04E; Tue, 4 Jul 2017 15:05:52 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 4 Jul 2017 15:05:52 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id A9A9120F67C; Tue, 4 Jul 2017 16:08:00 +0200 (CEST) From: Christian Borntraeger To: qemu-devel Date: Tue, 4 Jul 2017 16:07:56 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499177279-131407-1-git-send-email-borntraeger@de.ibm.com> References: <1499177279-131407-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17070414-0012-0000-0000-0000055E43EA X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17070414-0013-0000-0000-000018D0A7DB Message-Id: <1499177279-131407-5-git-send-email-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-04_09:, , 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-1707040241 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 4/7] 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 it's 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 Signed-off-by: Christian Borntraeger Reviewed-by: Cornelia Huck --- 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 bea3997..535d99d 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, };