From nobody Tue Feb 10 17:13:34 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615916767; cv=none; d=zohomail.com; s=zohoarc; b=epDPfXXxHh/gC9KucmMHFkGLSL1VUS6zh7/X5DYJFSFq1333mx/tKI7s2bI0zM6b4Jg5a2YqckASswFMWQUfF0KKPgQIyxyNW+bLPmxttVOJzkFANKUs8PssTzxy0ZTmvNEMP8CT/tTaAKMfOrdOFs5esyhtfBbsTqBFMpFCL7A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615916767; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qE+G3fG1crWQF3GdwdP2EbVv2gWbZwttd4FsaHhmy1w=; b=ZVW9dUd3KjLGihvGp5z8s7g69PQ9EKOf+Gxux1mQRLFv6IiTHa8UidG7iNR+r8bs3POuQx1q4mkHVq9RX9NRKyBCJ0zBwNdJShxm2G8L5NEhyIpgtTWu0SwA5jy+/tiW2EfrD2Lnq0/s3pEZTqVtygAGrayWBOqx0VsssANyABo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615916767347388.3658287149691; Tue, 16 Mar 2021 10:46:07 -0700 (PDT) Received: from localhost ([::1]:41128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMDle-0007un-6S for importer@patchew.org; Tue, 16 Mar 2021 13:46:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53108) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMDAI-0004Rs-Q5 for qemu-devel@nongnu.org; Tue, 16 Mar 2021 13:07:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:54752) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lMDAG-0005p3-3J for qemu-devel@nongnu.org; Tue, 16 Mar 2021 13:07:30 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-594-8nwOSBraN3GFPza1NUzpKA-1; Tue, 16 Mar 2021 13:07:24 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 58BCB1019985; Tue, 16 Mar 2021 17:07:23 +0000 (UTC) Received: from rhel8vm.home.shazbot.org (ovpn-115-65.phx2.redhat.com [10.3.115.65]) by smtp.corp.redhat.com (Postfix) with ESMTP id 093345D719; Tue, 16 Mar 2021 17:07:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615914447; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qE+G3fG1crWQF3GdwdP2EbVv2gWbZwttd4FsaHhmy1w=; b=JGwM5FWUt9IvSd5wMSXBBu2MWTCEbdJVBEV4Skk11Sq1JPhUhligdAk/x7HtQI9PAk/5i2 uQppP/8pCoZE/IHbRrBK4FckNv0xNNt8wNUgKLk7KYM0HrEDzytVPjkTAo2yXABwCFbQzv 6S5zin6rS6XhH/LX5uI+rBRCE2fjDBU= X-MC-Unique: 8nwOSBraN3GFPza1NUzpKA-1 Subject: [PULL 07/10] vfio: Set the priority of the VFIO VM state change handler explicitly From: Alex Williamson To: qemu-devel@nongnu.org Date: Tue, 16 Mar 2021 11:07:19 -0600 Message-ID: <161591443963.135549.7021340331725127959.stgit@rhel8vm.home.shazbot.org> In-Reply-To: <161591414009.135549.5804863877511053803.stgit@rhel8vm.home.shazbot.org> References: <161591414009.135549.5804863877511053803.stgit@rhel8vm.home.shazbot.org> User-Agent: StGit/0.23 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=alex.williamson@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=alex.williamson@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shenming Lu , Kirti Wankhede , Cornelia Huck Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Shenming Lu In the VFIO VM state change handler when stopping the VM, the _RUNNING bit in device_state is cleared which makes the VFIO device stop, including no longer generating interrupts. Then we can save the pending states of all interrupts in the GIC VM state change handler (on ARM). So we have to set the priority of the VFIO VM state change handler explicitly (like virtio devices) to ensure it is called before the GIC's in saving. Signed-off-by: Shenming Lu Reviewed-by: Kirti Wankhede Reviewed-by: Cornelia Huck Message-Id: <20210310030233.1133-3-lushenming@huawei.com> Signed-off-by: Alex Williamson --- hw/vfio/migration.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index 003786f3cd9a..eafb778947c3 100644 --- a/hw/vfio/migration.c +++ b/hw/vfio/migration.c @@ -862,7 +862,8 @@ static int vfio_migration_init(VFIODevice *vbasedev, register_savevm_live(id, VMSTATE_INSTANCE_ID_ANY, 1, &savevm_vfio_hand= lers, vbasedev); =20 - migration->vm_state =3D qemu_add_vm_change_state_handler(vfio_vmstate_= change, + migration->vm_state =3D qdev_add_vm_change_state_handler(vbasedev->dev, + vfio_vmstate_ch= ange, vbasedev); migration->migration_state.notify =3D vfio_migration_state_notifier; add_migration_state_change_notifier(&migration->migration_state);