From nobody Sat Nov 15 01:20:30 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1758117730487579.1397775731253; Wed, 17 Sep 2025 07:02:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uyrsi-0002Nx-JD; Wed, 17 Sep 2025 09:07:32 -0400 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 1uyrpm-0005wN-KW; Wed, 17 Sep 2025 09:04:36 -0400 Received: from www3579.sakura.ne.jp ([49.212.243.89]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uyrpj-0005xa-AN; Wed, 17 Sep 2025 09:04:29 -0400 Received: from h205.csg.ci.i.u-tokyo.ac.jp (h205.csg.ci.i.u-tokyo.ac.jp [133.11.54.205]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 58HCuN6h008967 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 17 Sep 2025 21:56:33 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=KPkgneIU/Kxw3przf+/EO57BUaP8vFhAy1Y4oUYjPZY=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Date:Subject:Message-Id:To; s=rs20250326; t=1758113794; v=1; b=p6CW3wGmzP/3BPNGDz1fVZLaV3/Flytml54QCdn8QBKxE6XKmetfZg+fVzt4n3th uEh/vkZLkgUVKsYEiLky4LLz2fap1aN0EvqGq1e9vNVAWzWcfgG6K6sA+bGk5P2n NvwF1DofnV5zwtMCEMIMrFE+9IU3tr5uTUhEGBa1t0tzJVVE/307LUt11ZJe1odm n+Pr7o9eLkl6ZOYsvA0KBY13AXAqTmHrZ3Ar7hNmBQB5yMJeAkQG3AvdEXy6djmz kH08sM2K4Hw+w6MGKkARhjxu6TBl4+r0aA38T1JSM5QVjwgYa0TiThAAholfXC6N M6bs5/EkJjSFRjC8tqNnhQ== From: Akihiko Odaki Date: Wed, 17 Sep 2025 21:56:15 +0900 Subject: [PATCH 03/35] vfio: Use address_space_get_path() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250917-qom-v1-3-7262db7b0a84@rsg.ci.i.u-tokyo.ac.jp> References: <20250917-qom-v1-0-7262db7b0a84@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20250917-qom-v1-0-7262db7b0a84@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: Richard Henderson , Peter Maydell , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Steven Lee , Troy Lee , Jamin Lin , Andrew Jeffery , Joel Stanley , Eric Auger , Helge Deller , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Herv=C3=A9_Poussineau?= , Aleksandar Rikalo , "Edgar E. Iglesias" , Alistair Francis , Ninad Palsule , Paolo Bonzini , Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Jason Wang , Yi Liu , =?utf-8?q?Cl=C3=A9ment_Mathieu--Drif?= , Nicholas Piggin , Aditya Gupta , Gautam Menghani , Song Gao , Bibo Mao , Jiaxun Yang , Jonathan Cameron , Fan Ni , David Hildenbrand , Igor Mammedov , Xiao Guangrong , Beniamino Galvani , Strahinja Jankovic , Subbaraya Sundeep , Jan Kiszka , Laurent Vivier , Andrey Smirnov , Aurelien Jarno , BALATON Zoltan , Bernhard Beschow , Harsh Prateek Bora , Elena Ufimtseva , Jagannathan Raman , Palmer Dabbelt , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Matthew Rosato , Eric Farman , Thomas Huth , Halil Pasic , Christian Borntraeger , Ilya Leoshkevich , Fam Zheng , Bin Meng , Mark Cave-Ayland , Artyom Tarasenko , Peter Xu , Marcelo Tosatti , Max Filippov , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, qemu-block@nongnu.org, kvm@vger.kernel.org, Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Stefano Garzarella , Alistair Francis , Akihiko Odaki X-Mailer: b4 0.15-dev-179e8 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=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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-ZM-MESSAGEID: 1758117737723116600 The name field of an QOM-ified AddressSpace represents a property name, which may not be sufficient to identify the AddressSpace. Use address_space_get_path() instead. Signed-off-by: Akihiko Odaki Reviewed-by: C=C3=A9dric Le Goater --- hw/vfio/listener.c | 8 ++++++-- hw/virtio/vhost-vdpa.c | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c index f498e23a9374..d0418db28c8b 100644 --- a/hw/vfio/listener.c +++ b/hw/vfio/listener.c @@ -137,9 +137,11 @@ static void vfio_iommu_map_notify(IOMMUNotifier *n, IO= MMUTLBEntry *iotlb) iova, iova + iotlb->addr_mask); =20 if (iotlb->target_as !=3D &address_space_memory) { + g_autofree char *path =3D address_space_get_path(iotlb->target_as); + error_setg(&local_err, "Wrong target AS \"%s\", only system memory is allowed", - iotlb->target_as->name ? iotlb->target_as->name : "none= "); + path); if (migration_is_running()) { migration_file_set_error(-EINVAL, local_err); } else { @@ -1060,9 +1062,11 @@ static void vfio_iommu_map_dirty_notify(IOMMUNotifie= r *n, IOMMUTLBEntry *iotlb) trace_vfio_iommu_map_dirty_notify(iova, iova + iotlb->addr_mask); =20 if (iotlb->target_as !=3D &address_space_memory) { + g_autofree char *path =3D address_space_get_path(iotlb->target_as); + error_setg(&local_err, "Wrong target AS \"%s\", only system memory is allowed", - iotlb->target_as->name ? iotlb->target_as->name : "none= "); + path); goto out; } =20 diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 7061b6e1a386..7ed639358458 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -213,8 +213,10 @@ static void vhost_vdpa_iommu_map_notify(IOMMUNotifier = *n, IOMMUTLBEntry *iotlb) hwaddr xlat; =20 if (iotlb->target_as !=3D &address_space_memory) { + g_autofree char *path =3D address_space_get_path(iotlb->target_as); + error_report("Wrong target AS \"%s\", only system memory is allowe= d", - iotlb->target_as->name ? iotlb->target_as->name : "no= ne"); + path); return; } RCU_READ_LOCK_GUARD(); --=20 2.51.0