From patchwork Wed Sep 27 14:56:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 819208 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y2LXj2Tkxz9tXy for ; Thu, 28 Sep 2017 00:57:56 +1000 (AEST) Received: from localhost ([::1]:55148 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxDma-0000a6-Sh for incoming@patchwork.ozlabs.org; Wed, 27 Sep 2017 10:57:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56629) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxDm0-0000Wq-Rh for qemu-devel@nongnu.org; Wed, 27 Sep 2017 10:57:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxDlw-0001Yd-Vq for qemu-devel@nongnu.org; Wed, 27 Sep 2017 10:57:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60459) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dxDlp-0001VG-Im; Wed, 27 Sep 2017 10:57:05 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6B1DD12988B; Wed, 27 Sep 2017 14:57:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6B1DD12988B Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=eric.auger@redhat.com Received: from localhost.localdomain.com (ovpn-116-163.ams2.redhat.com [10.36.116.163]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7EC8094C6D; Wed, 27 Sep 2017 14:57:00 +0000 (UTC) From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, peter.maydell@linaro.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org, wanghaibin.wang@huawei.com Date: Wed, 27 Sep 2017 16:56:43 +0200 Message-Id: <1506524205-20763-2-git-send-email-eric.auger@redhat.com> In-Reply-To: <1506524205-20763-1-git-send-email-eric.auger@redhat.com> References: <1506524205-20763-1-git-send-email-eric.auger@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 27 Sep 2017 14:57:04 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC 1/3] hw/intc/arm_gicv3_its: Don't abort on table save/restore 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: wei@redhat.com, drjones@redhat.com, vijay.kilari@gmail.com, quintela@redhat.com, dgilbert@redhat.com, wu.wubin@huawei.com, christoffer.dall@linaro.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The ITS is not properly reset at the moment. It is possible the GITS_BASER.valid is set and the in-kernel ITS caches are not empty (list of devices, collections, LPIs) while data structures in guest RAM are invalid/inconsistent. For instance, this happens after a guest shutdown -r now or a system reset, if we save the state before the guest re-writes the ITS registers or map devices, the table save ioctl may produce a QEMU abort. Until there is a proper reset implemented, let's unplug the consistency error checking. The reset issue will be fixed in subsequent patches. Signed-off-by: Eric Auger Reported-by: wanghaibin --- this patch would deserve being cc'ed stable (2.10) --- hw/intc/arm_gicv3_its_kvm.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c index 39903d5..120b86d 100644 --- a/hw/intc/arm_gicv3_its_kvm.c +++ b/hw/intc/arm_gicv3_its_kvm.c @@ -64,20 +64,16 @@ static void vm_change_state_handler(void *opaque, int running, { GICv3ITSState *s = (GICv3ITSState *)opaque; Error *err = NULL; - int ret; if (running) { return; } - ret = kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL, - KVM_DEV_ARM_ITS_SAVE_TABLES, NULL, true, &err); + kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL, + KVM_DEV_ARM_ITS_SAVE_TABLES, NULL, true, &err); if (err) { error_report_err(err); } - if (ret < 0 && ret != -EFAULT) { - abort(); - } } static void kvm_arm_its_realize(DeviceState *dev, Error **errp) @@ -157,6 +153,7 @@ static void kvm_arm_its_pre_save(GICv3ITSState *s) */ static void kvm_arm_its_post_load(GICv3ITSState *s) { + Error *err = NULL; int i; if (!s->iidr) { @@ -188,7 +185,11 @@ static void kvm_arm_its_post_load(GICv3ITSState *s) kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL, KVM_DEV_ARM_ITS_RESTORE_TABLES, NULL, true, - &error_abort); + &err); + + if (err) { + error_report_err(err); + } kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS, GITS_CTLR, &s->ctlr, true, &error_abort);