From nobody Sun Feb 8 22:46:55 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=1738851903; cv=none; d=zohomail.com; s=zohoarc; b=nSps8WAdI3ON+cgcJlTJ1NN0cfTorhLPWt/9I6lI/D41zzSXhU0fhr05fs6dqFRjANrCcni1wuqCQDfMvti9tvWab9ntOw//qNwwnB97mBwmo0pljqCPTapexgC6cMqya8ViGWHqdeLbISUxREAfSy8we9aY5Hu8JAOgX2P1GN0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1738851903; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=pye4F/5Cd7B6ILcQ7uy6RhAoscXnje+gWkCZxwi9eNA=; b=OPrbuQmYBAdTRHbU17BbkhLlg6uMKjEvZ14IKEL05cAmBrl3E9Onuze+zMjWAHh0JK46WYSq+U13cpTnoGRefeo6OgwgNFl07HNw5/bQ+fbjrsm6W0raixGA6n63aWhcZuVCXvSGSDkh518Z8vV5Pr+1c46EITca2PDsC9228nY= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1738851903018252.98106319296448; Thu, 6 Feb 2025 06:25:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tg2my-0002Bi-1h; Thu, 06 Feb 2025 09:23:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tg2mv-00029I-5F for qemu-devel@nongnu.org; Thu, 06 Feb 2025 09:23:29 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tg2ms-0006k9-VM for qemu-devel@nongnu.org; Thu, 06 Feb 2025 09:23:28 -0500 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-269-DQJgYmpFOvm0JRp5PGbtgQ-1; Thu, 06 Feb 2025 09:23:24 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 161911800872; Thu, 6 Feb 2025 14:23:23 +0000 (UTC) Received: from laptop.redhat.com (unknown [10.39.192.9]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8D97D1800267; Thu, 6 Feb 2025 14:23:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1738851806; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pye4F/5Cd7B6ILcQ7uy6RhAoscXnje+gWkCZxwi9eNA=; b=QzBJUSjT5qv+Saqr7CucCaMPRRAQKznyveJHgPjp6GW5BE/lJGixYdy2o9JmAdzD35e/Zp k31EuCs8/o6F0e8vAe3Y0Fg8hMnvSpdbRTsnRH5Q+Rp0LeRFvAtdeDItocDP2JcLVMJfd/ dR9+hHFem67JAAOXeQR93s3S4skymAg= X-MC-Unique: DQJgYmpFOvm0JRp5PGbtgQ-1 X-Mimecast-MFC-AGG-ID: DQJgYmpFOvm0JRp5PGbtgQ From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org, peter.maydell@linaro.org, mst@redhat.com, jasowang@redhat.com, imammedo@redhat.com, peterx@redhat.com, alex.williamson@redhat.com, clg@redhat.com, philmd@linaro.org, zhenzhong.duan@intel.com, ddutile@redhat.com Subject: [PATCH 1/5] hw/virtio/virtio-iommu: Migrate to 3-phase reset Date: Thu, 6 Feb 2025 15:21:52 +0100 Message-ID: <20250206142307.921070-2-eric.auger@redhat.com> In-Reply-To: <20250206142307.921070-1-eric.auger@redhat.com> References: <20250206142307.921070-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.129.124; envelope-from=eric.auger@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1738851904048019000 Content-Type: text/plain; charset="utf-8" Currently the iommu may be reset before the devices it protects. For example this happens with virtio-net. Let's use 3-phase reset mechanism and reset the IOMMU on exit phase intead. Signed-off-by: Eric Auger Acked-by: Michael S. Tsirkin --- hw/virtio/virtio-iommu.c | 9 +++++---- hw/virtio/trace-events | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c index f41104a952..eae3bcedde 100644 --- a/hw/virtio/virtio-iommu.c +++ b/hw/virtio/virtio-iommu.c @@ -1504,11 +1504,11 @@ static void virtio_iommu_device_unrealize(DeviceSta= te *dev) virtio_cleanup(vdev); } =20 -static void virtio_iommu_device_reset(VirtIODevice *vdev) +static void virtio_iommu_device_reset_exit(Object *obj, ResetType type) { - VirtIOIOMMU *s =3D VIRTIO_IOMMU(vdev); + VirtIOIOMMU *s =3D VIRTIO_IOMMU(obj); =20 - trace_virtio_iommu_device_reset(); + trace_virtio_iommu_device_reset_exit(); =20 if (s->domains) { g_tree_destroy(s->domains); @@ -1668,6 +1668,7 @@ static void virtio_iommu_class_init(ObjectClass *klas= s, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); VirtioDeviceClass *vdc =3D VIRTIO_DEVICE_CLASS(klass); + ResettableClass *rc =3D RESETTABLE_CLASS(klass); =20 device_class_set_props(dc, virtio_iommu_properties); dc->vmsd =3D &vmstate_virtio_iommu; @@ -1675,7 +1676,7 @@ static void virtio_iommu_class_init(ObjectClass *klas= s, void *data) set_bit(DEVICE_CATEGORY_MISC, dc->categories); vdc->realize =3D virtio_iommu_device_realize; vdc->unrealize =3D virtio_iommu_device_unrealize; - vdc->reset =3D virtio_iommu_device_reset; + rc->phases.exit =3D virtio_iommu_device_reset_exit; vdc->get_config =3D virtio_iommu_get_config; vdc->set_config =3D virtio_iommu_set_config; vdc->get_features =3D virtio_iommu_get_features; diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events index 04e36ae047..76f0d458b2 100644 --- a/hw/virtio/trace-events +++ b/hw/virtio/trace-events @@ -108,7 +108,7 @@ virtio_pci_notify_write(uint64_t addr, uint64_t val, un= signed int size) "0x%" PR virtio_pci_notify_write_pio(uint64_t addr, uint64_t val, unsigned int size= ) "0x%" PRIx64" =3D 0x%" PRIx64 " (%d)" =20 # hw/virtio/virtio-iommu.c -virtio_iommu_device_reset(void) "reset!" +virtio_iommu_device_reset_exit(void) "reset!" virtio_iommu_system_reset(void) "system reset!" virtio_iommu_get_features(uint64_t features) "device supports features=3D0= x%"PRIx64 virtio_iommu_device_status(uint8_t status) "driver status =3D %d" --=20 2.47.1 From nobody Sun Feb 8 22:46:55 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=1738851859; cv=none; d=zohomail.com; s=zohoarc; b=i7IfD0PeLoBqHIZtxb3NoElgLTDnpbe37D47f/fvNKCo8Sjgca3ahYT9hftG86IHFb1Kx7S7gK+Qu+76yZDcwirRqWk698rYMODJnzImA63qeIIYSVLQT/ZtDnx+4zOeVys/mD28loMlDBgQdOdCEakV9Q30/Fq/sP/3SrFzwPg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1738851859; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=3wXndAjmflDyaWZVw2Zlcb+pij53mML3vSJZl17gfVA=; b=LwcVTfjHl/WhVNSkFRhrNmgAQ1VLawt37d4u8+gti5AAh3sC9zpmYl74bNU46kYDl6gddINN/uhJ1dh2mjDqx/znsvLeZbJjyauzuHIoRXkYCRPEjH2OWdK5Jk3c07q72E7U3OP40RlsbQ4OPQNC1vRTJJ8Mc9MuPh/eyEfsb88= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1738851859578923.6730929232598; Thu, 6 Feb 2025 06:24:19 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tg2n6-0002DB-7z; Thu, 06 Feb 2025 09:23:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tg2n1-0002CV-Gc for qemu-devel@nongnu.org; Thu, 06 Feb 2025 09:23:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tg2mz-0006lj-KA for qemu-devel@nongnu.org; Thu, 06 Feb 2025 09:23:35 -0500 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-495-VrOgwxDEN2SpyiCJb6l-6Q-1; Thu, 06 Feb 2025 09:23:29 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 042D219560B2; Thu, 6 Feb 2025 14:23:28 +0000 (UTC) Received: from laptop.redhat.com (unknown [10.39.192.9]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8FFAB1800360; Thu, 6 Feb 2025 14:23:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1738851812; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3wXndAjmflDyaWZVw2Zlcb+pij53mML3vSJZl17gfVA=; b=Lj3o5EwHMqURmMZLxCxwmHNTL60gxZiEEuB8inUD+U38INKEelkdcPb09OrVA3WBKp8SHI cqsLvZrTGaEnmQaesD19Ed54UBJvedckyFS6Rh3IiSESVB5fjBF62uwqXN9RmSEaGobXVX /+zweN6MrBDoNfD3BNgxo+m9SdF0c7k= X-MC-Unique: VrOgwxDEN2SpyiCJb6l-6Q-1 X-Mimecast-MFC-AGG-ID: VrOgwxDEN2SpyiCJb6l-6Q From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org, peter.maydell@linaro.org, mst@redhat.com, jasowang@redhat.com, imammedo@redhat.com, peterx@redhat.com, alex.williamson@redhat.com, clg@redhat.com, philmd@linaro.org, zhenzhong.duan@intel.com, ddutile@redhat.com Subject: [PATCH 2/5] hw/i386/intel-iommu: Migrate to 3-phase reset Date: Thu, 6 Feb 2025 15:21:53 +0100 Message-ID: <20250206142307.921070-3-eric.auger@redhat.com> In-Reply-To: <20250206142307.921070-1-eric.auger@redhat.com> References: <20250206142307.921070-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.129.124; envelope-from=eric.auger@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1738851860046019000 Content-Type: text/plain; charset="utf-8" Currently the IOMMU may be reset before the devices it protects. For example this happens with virtio-net. Let's use 3-phase reset mechanism and reset the IOMMU on exit phase instead. Signed-off-by: Eric Auger Acked-by: Michael S. Tsirkin --- hw/i386/intel_iommu.c | 8 +++++--- hw/i386/trace-events | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index f366c223d0..21a8bf45f8 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -4697,10 +4697,11 @@ static void vtd_init(IntelIOMMUState *s) /* Should not reset address_spaces when reset because devices will still u= se * the address space they got at first (won't ask the bus again). */ -static void vtd_reset(DeviceState *dev) +static void vtd_reset_exit(Object *obj, ResetType type) { - IntelIOMMUState *s =3D INTEL_IOMMU_DEVICE(dev); + IntelIOMMUState *s =3D INTEL_IOMMU_DEVICE(obj); =20 + trace_vtd_reset_exit(); vtd_init(s); vtd_address_space_refresh_all(s); } @@ -4864,8 +4865,9 @@ static void vtd_class_init(ObjectClass *klass, void *= data) { DeviceClass *dc =3D DEVICE_CLASS(klass); X86IOMMUClass *x86_class =3D X86_IOMMU_DEVICE_CLASS(klass); + ResettableClass *rc =3D RESETTABLE_CLASS(klass); =20 - device_class_set_legacy_reset(dc, vtd_reset); + rc->phases.exit =3D vtd_reset_exit; dc->vmsd =3D &vtd_vmstate; device_class_set_props(dc, vtd_properties); dc->hotpluggable =3D false; diff --git a/hw/i386/trace-events b/hw/i386/trace-events index 53c02d7ac8..ac9e1a10aa 100644 --- a/hw/i386/trace-events +++ b/hw/i386/trace-events @@ -68,6 +68,7 @@ vtd_frr_new(int index, uint64_t hi, uint64_t lo) "index %= d high 0x%"PRIx64" low vtd_warn_invalid_qi_tail(uint16_t tail) "tail 0x%"PRIx16 vtd_warn_ir_vector(uint16_t sid, int index, int vec, int target) "sid 0x%"= PRIx16" index %d vec %d (should be: %d)" vtd_warn_ir_trigger(uint16_t sid, int index, int trig, int target) "sid 0x= %"PRIx16" index %d trigger %d (should be: %d)" +vtd_reset_exit(void) "" =20 # amd_iommu.c amdvi_evntlog_fail(uint64_t addr, uint32_t head) "error: fail to write at = addr 0x%"PRIx64" + offset 0x%"PRIx32 --=20 2.47.1 From nobody Sun Feb 8 22:46:55 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=1738851904; cv=none; d=zohomail.com; s=zohoarc; b=Tv5aEQ8De/bpvgH4yDsD69wE/WXey71wjusVFkl1ZLmikOaIQ3UQeygwV+a6AQsBkrz1tbf6UUNj+BUzuVk3grdkApF2D1bVU0fUVzvzBssOcpHA52Yn3qhVLcuZL5NaDJbnzsFHKg9XopwcUFtivzj2DhbXfCXEPtAOK8PUCfE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1738851904; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=GZbyIXKI1FZ4Jn6pIwE6+ydtpYa2SRS3JE57gu/CUhA=; b=G/PgFS9Eg8NX6+nx+Bnj9bTnwgo6Sgah1JlRfca7k2tqaWbi4pvjpCcBVsddwSZn4FaLj5lP9JzONIE3FsAIEILdmS38/cMNznl2mSMP7QO551emILH6SWkjBRuZDO4iI3kyDO6zPr7BDwi+U0D4r9/mzl6Ywo6gMDRKYfqAvm4= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1738851904120961.1376576513995; Thu, 6 Feb 2025 06:25:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tg2nD-0002G9-04; Thu, 06 Feb 2025 09:23:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tg2nB-0002FG-0r for qemu-devel@nongnu.org; Thu, 06 Feb 2025 09:23:45 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tg2n9-0006ne-8M for qemu-devel@nongnu.org; Thu, 06 Feb 2025 09:23:44 -0500 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-549-R_3ApZWdPwSVLanzbywnhw-1; Thu, 06 Feb 2025 09:23:37 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 79CD31800875; Thu, 6 Feb 2025 14:23:36 +0000 (UTC) Received: from laptop.redhat.com (unknown [10.39.192.9]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7EF051800360; Thu, 6 Feb 2025 14:23:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1738851818; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GZbyIXKI1FZ4Jn6pIwE6+ydtpYa2SRS3JE57gu/CUhA=; b=g5b1tBe1lYNK0e+s+42O+erSXeqTlaXXHo/8nTaaLXk9WfSXJlzYXIbNF2gdim04e3PO2r u/UHipALHzMECZW36sHUGQeYGhaIgxKdssv7OJBiS7HbaXliRZFu5SgjpojodJ7ukOr8Zi uR4/RjuabA1/J0mDi7IAS+XPKr4g3kA= X-MC-Unique: R_3ApZWdPwSVLanzbywnhw-1 X-Mimecast-MFC-AGG-ID: R_3ApZWdPwSVLanzbywnhw From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org, peter.maydell@linaro.org, mst@redhat.com, jasowang@redhat.com, imammedo@redhat.com, peterx@redhat.com, alex.williamson@redhat.com, clg@redhat.com, philmd@linaro.org, zhenzhong.duan@intel.com, ddutile@redhat.com Subject: [PATCH 3/5] hw/i386/intel_iommu: Tear down address spaces before IOMMU reset Date: Thu, 6 Feb 2025 15:21:54 +0100 Message-ID: <20250206142307.921070-4-eric.auger@redhat.com> In-Reply-To: <20250206142307.921070-1-eric.auger@redhat.com> References: <20250206142307.921070-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.129.124; envelope-from=eric.auger@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1738851906189019000 Content-Type: text/plain; charset="utf-8" From: Peter Xu No bug report for this, but logically tearing down of existing address space should happen before reset of IOMMU state / registers, because the current address spaces may still rely on those information. Signed-off-by: Peter Xu Signed-off-by: Eric Auger Acked-by: Michael S. Tsirkin --- hw/i386/intel_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 21a8bf45f8..1bd9ae403b 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -4702,8 +4702,8 @@ static void vtd_reset_exit(Object *obj, ResetType typ= e) IntelIOMMUState *s =3D INTEL_IOMMU_DEVICE(obj); =20 trace_vtd_reset_exit(); - vtd_init(s); vtd_address_space_refresh_all(s); + vtd_init(s); } =20 static AddressSpace *vtd_host_dma_iommu(PCIBus *bus, void *opaque, int dev= fn) --=20 2.47.1 From nobody Sun Feb 8 22:46:55 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=1738851889; cv=none; d=zohomail.com; s=zohoarc; b=fXOUpFeZljC+zJnAd0Bj/lDP8c2CD/d16Nub27p5Pgp56ke50ri5R19afJbi+SM2qodzpNRejsl4o57YldX96t5pipWQSj0J1Bn/dgPbUgQhbSjsmoIm+RO/3362+AtsYoNpI/iscDz9odlvPiWVkq+HlgWzpHo3ojWM+Ru9u1M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1738851889; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=K9BmzrzIx8xbJgcbBJlgaVyGLZPZHzbO44k1rk6hqws=; b=iicW0Wt/1BfCxAUd/Wqzxzllc13fPL8rGfvJSk33rsK5PkEULWLiawrke6fSCBggL9c8hXaI907bAjgzAoT8QHnF/+H3boBb0TFUGPbpNYY58V47CanBuLccmoM5u8IgodIYAzPtjJ21uHZ0f4i46TiefO23CxAZ4a+JeVnEJoU= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1738851889245927.8267946805696; Thu, 6 Feb 2025 06:24:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tg2nE-0002H5-47; Thu, 06 Feb 2025 09:23:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tg2nC-0002Fn-OB for qemu-devel@nongnu.org; Thu, 06 Feb 2025 09:23:46 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tg2nA-0006pa-OO for qemu-devel@nongnu.org; Thu, 06 Feb 2025 09:23:46 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-632-U-H9v37SOp2SzP6sJo32LA-1; Thu, 06 Feb 2025 09:23:42 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2C3281800879; Thu, 6 Feb 2025 14:23:41 +0000 (UTC) Received: from laptop.redhat.com (unknown [10.39.192.9]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 003A41800570; Thu, 6 Feb 2025 14:23:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1738851823; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K9BmzrzIx8xbJgcbBJlgaVyGLZPZHzbO44k1rk6hqws=; b=TlGd/UvCN/AV+U3NAxQhlKXMxQRYOzPUvNa5ZmZfuTw8jaoyATOKi4LuDhZSCiZroyXiN0 itGrTepun8jHId975p2maB/IxuXFnsicl3BfsHQfByeELYo2dZ0x2E4TeLuqkIDOhn1Sew ezzbRD98jNqGkz+2dQsqpCHSG9SrP8w= X-MC-Unique: U-H9v37SOp2SzP6sJo32LA-1 X-Mimecast-MFC-AGG-ID: U-H9v37SOp2SzP6sJo32LA From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org, peter.maydell@linaro.org, mst@redhat.com, jasowang@redhat.com, imammedo@redhat.com, peterx@redhat.com, alex.williamson@redhat.com, clg@redhat.com, philmd@linaro.org, zhenzhong.duan@intel.com, ddutile@redhat.com Subject: [PATCH 4/5] hw/arm/smmuv3: Move reset to exit phase Date: Thu, 6 Feb 2025 15:21:55 +0100 Message-ID: <20250206142307.921070-5-eric.auger@redhat.com> In-Reply-To: <20250206142307.921070-1-eric.auger@redhat.com> References: <20250206142307.921070-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.133.124; envelope-from=eric.auger@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1738851890082019000 Content-Type: text/plain; charset="utf-8" Currently the iommu may be reset before the devices it protects. For example this happens with virtio-scsi-pci. when system_reset is issued from qmp monitor, spurious "virtio: zero sized buffers are not allowed" warnings can be observed. Signed-off-by: Eric Auger Acked-by: Michael S. Tsirkin --- hw/arm/smmuv3.c | 9 +++++---- hw/arm/trace-events | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c index c0cf5df0f6..7522c32b24 100644 --- a/hw/arm/smmuv3.c +++ b/hw/arm/smmuv3.c @@ -1870,13 +1870,14 @@ static void smmu_init_irq(SMMUv3State *s, SysBusDev= ice *dev) } } =20 -static void smmu_reset_hold(Object *obj, ResetType type) +static void smmu_reset_exit(Object *obj, ResetType type) { SMMUv3State *s =3D ARM_SMMUV3(obj); SMMUv3Class *c =3D ARM_SMMUV3_GET_CLASS(s); =20 - if (c->parent_phases.hold) { - c->parent_phases.hold(obj, type); + trace_smmu_reset_exit(); + if (c->parent_phases.exit) { + c->parent_phases.exit(obj, type); } =20 smmuv3_init_regs(s); @@ -1999,7 +2000,7 @@ static void smmuv3_class_init(ObjectClass *klass, voi= d *data) SMMUv3Class *c =3D ARM_SMMUV3_CLASS(klass); =20 dc->vmsd =3D &vmstate_smmuv3; - resettable_class_set_parent_phases(rc, NULL, smmu_reset_hold, NULL, + resettable_class_set_parent_phases(rc, NULL, NULL, smmu_reset_exit, &c->parent_phases); device_class_set_parent_realize(dc, smmu_realize, &c->parent_realize); diff --git a/hw/arm/trace-events b/hw/arm/trace-events index c64ad344bd..7790db780e 100644 --- a/hw/arm/trace-events +++ b/hw/arm/trace-events @@ -56,6 +56,7 @@ smmuv3_config_cache_inv(uint32_t sid) "Config cache INV f= or sid=3D0x%x" smmuv3_notify_flag_add(const char *iommu) "ADD SMMUNotifier node for iommu= mr=3D%s" smmuv3_notify_flag_del(const char *iommu) "DEL SMMUNotifier node for iommu= mr=3D%s" smmuv3_inv_notifiers_iova(const char *name, int asid, int vmid, uint64_t i= ova, uint8_t tg, uint64_t num_pages, int stage) "iommu mr=3D%s asid=3D%d vm= id=3D%d iova=3D0x%"PRIx64" tg=3D%d num_pages=3D0x%"PRIx64" stage=3D%d" +smmu_reset_exit(void) "" =20 # strongarm.c strongarm_uart_update_parameters(const char *label, int speed, char parity= , int data_bits, int stop_bits) "%s speed=3D%d parity=3D%c data=3D%d stop= =3D%d" --=20 2.47.1 From nobody Sun Feb 8 22:46:55 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=1738851890; cv=none; d=zohomail.com; s=zohoarc; b=iEHnAOnteNQEVRTJO4b1EgCOAxVlBFngPkKTjQA4qYK/ijJTe3DSsDVyL51GxF8BCrhu43rC/TuL6O0PBaVp8CVQGMUJg4iDtkbaeIGG5PEqlzfqP66EztqszPiiZ60rW8F3eHbyJg/zhDgteQ78aMm9bnE2MFetTVP4KsyOEMM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1738851890; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=OwJOgKMx0mCJNKFJZr/JfU+XCS/7nyr6ABOgYudzD2Q=; b=eq+BXlqTUy/aHuWK6elUSb33FavESTA8o7i8wwgKFWTOGJ4Oe4sj5/vHgnbHxx9laG4knOuNBgw0kSCfXSQj/+CJiibsJSWldVLFEEyRo9PNWj40RJpkN9HaOkTvcywJ+n0p6fpWNMDeGplMVnZYheqmMmz49E9p1Yqadhc5oF4= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1738851889968396.23382572346156; Thu, 6 Feb 2025 06:24:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tg2nJ-0002JV-1U; Thu, 06 Feb 2025 09:23:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tg2nH-0002J9-Lf for qemu-devel@nongnu.org; Thu, 06 Feb 2025 09:23:51 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tg2nF-0006sf-Ku for qemu-devel@nongnu.org; Thu, 06 Feb 2025 09:23:51 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-120-xMTwQ4UhNNaW5LsjFzlxww-1; Thu, 06 Feb 2025 09:23:47 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E5DD5195608C; Thu, 6 Feb 2025 14:23:45 +0000 (UTC) Received: from laptop.redhat.com (unknown [10.39.192.9]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A929A1800570; Thu, 6 Feb 2025 14:23:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1738851828; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OwJOgKMx0mCJNKFJZr/JfU+XCS/7nyr6ABOgYudzD2Q=; b=d/7g9FtKPPschZC1dIUrVuO7JgOO1CAvwSLfOpB2cw6Gxg6etIMPiJoFD3iTqmYevTS1HG lHFKOga9iJDNpL1EBSZk0fUBStNu/o8VCmjWOLikFykvj4ERy/6NnIpHTqSeA4REeurYs3 k3qewblWzWhK93YevNF9OmHiE6ZZ6oM= X-MC-Unique: xMTwQ4UhNNaW5LsjFzlxww-1 X-Mimecast-MFC-AGG-ID: xMTwQ4UhNNaW5LsjFzlxww From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org, peter.maydell@linaro.org, mst@redhat.com, jasowang@redhat.com, imammedo@redhat.com, peterx@redhat.com, alex.williamson@redhat.com, clg@redhat.com, philmd@linaro.org, zhenzhong.duan@intel.com, ddutile@redhat.com Subject: [PATCH 5/5] hw/vfio/common: Add a trace point in vfio_reset_handler Date: Thu, 6 Feb 2025 15:21:56 +0100 Message-ID: <20250206142307.921070-6-eric.auger@redhat.com> In-Reply-To: <20250206142307.921070-1-eric.auger@redhat.com> References: <20250206142307.921070-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.133.124; envelope-from=eric.auger@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1738851891496019100 Content-Type: text/plain; charset="utf-8" To ease the debug of reset sequence, let's add a trace point in vfio_reset_handler() Signed-off-by: Eric Auger Acked-by: Michael S. Tsirkin Reviewed-by: C=C3=A9dric Le Goater --- hw/vfio/common.c | 1 + hw/vfio/trace-events | 1 + 2 files changed, 2 insertions(+) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index f7499a9b74..173fb3a997 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -1386,6 +1386,7 @@ void vfio_reset_handler(void *opaque) { VFIODevice *vbasedev; =20 + trace_vfio_reset_handler(); QLIST_FOREACH(vbasedev, &vfio_device_list, global_next) { if (vbasedev->dev->realized) { vbasedev->ops->vfio_compute_needs_reset(vbasedev); diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events index cab1cf1de0..c5385e1a4f 100644 --- a/hw/vfio/trace-events +++ b/hw/vfio/trace-events @@ -120,6 +120,7 @@ vfio_get_dev_region(const char *name, int index, uint32= _t type, uint32_t subtype vfio_legacy_dma_unmap_overflow_workaround(void) "" vfio_get_dirty_bitmap(uint64_t iova, uint64_t size, uint64_t bitmap_size, = uint64_t start, uint64_t dirty_pages) "iova=3D0x%"PRIx64" size=3D 0x%"PRIx6= 4" bitmap_size=3D0x%"PRIx64" start=3D0x%"PRIx64" dirty_pages=3D%"PRIu64 vfio_iommu_map_dirty_notify(uint64_t iova_start, uint64_t iova_end) "iommu= dirty @ 0x%"PRIx64" - 0x%"PRIx64 +vfio_reset_handler(void) "" =20 # platform.c vfio_platform_realize(char *name, char *compat) "vfio device %s, compat = =3D %s" --=20 2.47.1