From patchwork Tue Jul 4 14:07:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Borntraeger X-Patchwork-Id: 9825105 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 24592603B5 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 14AD6280B0 for ; Tue, 4 Jul 2017 14:09:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 094862811E; 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 23F572836F for ; Tue, 4 Jul 2017 14:09:36 +0000 (UTC) Received: from localhost ([::1]:41599 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSOWF-0008AS-98 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]:53126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSOUt-00088j-W9 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-0003XI-Ti for qemu-devel@nongnu.org; Tue, 04 Jul 2017 10:08:12 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:53349) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSOUp-0003Wi-Jh for qemu-devel@nongnu.org; Tue, 04 Jul 2017 10:08:07 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v64E4VgZ134827 for ; Tue, 4 Jul 2017 10:08:06 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2bg8uv0vv4-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 04 Jul 2017 10:08:05 -0400 Received: from localhost by e06smtp14.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 b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 4 Jul 2017 15:08:01 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v64E80SE38338624; Tue, 4 Jul 2017 14:08:00 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 15C49A405B; Tue, 4 Jul 2017 15:05:28 +0100 (BST) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 04380A404D; Tue, 4 Jul 2017 15:05:28 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 4 Jul 2017 15:05:27 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id 6A43620F67D; Tue, 4 Jul 2017 16:08:00 +0200 (CEST) From: Christian Borntraeger To: qemu-devel Date: Tue, 4 Jul 2017 16:07:55 +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-0016-0000-0000-000004CE4796 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17070414-0017-0000-0000-00002801A96F Message-Id: <1499177279-131407-4-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 3/7] s390x: fix error propagation in kvm-flic's realize 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 From the moment it was introduced by commit a2875e6f98 ("s390x/kvm: implement floating-interrupt controller device", 2013-07-16) the kvm-flic is not making realize fail properly in case it's impossible to create the KVM device which basically serves as a backend and is absolutely essential for having an operational kvm-flic. Let's fix this by making sure we do proper error propagation in realize. Signed-off-by: Halil Pasic Fixes: a2875e6f98 "s390x/kvm: implement floating-interrupt controller device" Reviewed-by: Dong Jia Shi Reviewed-by: Yi Min Zhao Signed-off-by: Christian Borntraeger --- hw/intc/s390_flic_kvm.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c index b4c61d8..bea3997 100644 --- a/hw/intc/s390_flic_kvm.c +++ b/hw/intc/s390_flic_kvm.c @@ -15,6 +15,7 @@ #include "cpu.h" #include #include "qemu/error-report.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "sysemu/kvm.h" #include "hw/s390x/s390_flic.h" @@ -397,18 +398,22 @@ static void kvm_s390_flic_realize(DeviceState *dev, Error **errp) struct kvm_create_device cd = {0}; struct kvm_device_attr test_attr = {0}; int ret; + Error *errp_local = NULL; flic_state->fd = -1; if (!kvm_check_extension(kvm_state, KVM_CAP_DEVICE_CTRL)) { + error_setg_errno(&errp_local, errno, "KVM is missing capability" + " KVM_CAP_DEVICE_CTRL"); trace_flic_no_device_api(errno); - return; + goto fail; } cd.type = KVM_DEV_TYPE_FLIC; ret = kvm_vm_ioctl(kvm_state, KVM_CREATE_DEVICE, &cd); if (ret < 0) { - trace_flic_create_device(errno); - return; + error_setg_errno(&errp_local, errno, "Creating the KVM device failed"); + trace_flic_no_device_api(errno); + goto fail; } flic_state->fd = cd.fd; @@ -417,6 +422,9 @@ static void kvm_s390_flic_realize(DeviceState *dev, Error **errp) flic_state->clear_io_supported = !ioctl(flic_state->fd, KVM_HAS_DEVICE_ATTR, test_attr); + return; +fail: + error_propagate(errp, errp_local); } static void kvm_s390_flic_reset(DeviceState *dev)