{"id":2222263,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2222263/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260411022618.2136588-6-kshk@linux.ibm.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.1/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260411022618.2136588-6-kshk@linux.ibm.com>","date":"2026-04-11T02:26:08","name":"[v2,05/15] s390x/pci: Move iotlb from S390PCIIOMMU to S390PCIBusDevice","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"d25d41bf04e8b3813417680f762b6641193f09fd","submitter":{"id":90249,"url":"http://patchwork.ozlabs.org/api/1.1/people/90249/?format=json","name":"Konstantin Shkolnyy","email":"kshk@linux.ibm.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260411022618.2136588-6-kshk@linux.ibm.com/mbox/","series":[{"id":499525,"url":"http://patchwork.ozlabs.org/api/1.1/series/499525/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=499525","date":"2026-04-11T02:26:13","name":"s390x/pci: Implement migration for emulated devices","version":2,"mbox":"http://patchwork.ozlabs.org/series/499525/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2222263/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2222263/checks/","tags":{},"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256\n header.s=pp1 header.b=oKxrMxSe;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fsyKz1hfyz1yH2\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 11 Apr 2026 12:29:27 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wBO3u-00026e-K5; Fri, 10 Apr 2026 22:27:06 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <kshk@linux.ibm.com>)\n id 1wBO3r-00022P-HW; Fri, 10 Apr 2026 22:27:03 -0400","from mx0b-001b2d01.pphosted.com ([148.163.158.5])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <kshk@linux.ibm.com>)\n id 1wBO3o-0000M8-K5; Fri, 10 Apr 2026 22:27:03 -0400","from pps.filterd (m0356516.ppops.net [127.0.0.1])\n by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 63B1g5ak2420237; Sat, 11 Apr 2026 02:26:57 GMT","from ppma13.dal12v.mail.ibm.com\n (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221])\n by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4dfbqk87ex-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Sat, 11 Apr 2026 02:26:57 +0000 (GMT)","from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1])\n by ppma13.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id\n 63B0M3Mi018987;\n Sat, 11 Apr 2026 02:26:56 GMT","from smtprelay06.wdc07v.mail.ibm.com ([172.16.1.73])\n by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4dcme9u236-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Sat, 11 Apr 2026 02:26:56 +0000","from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com\n [10.39.53.230])\n by smtprelay06.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n 63B2Qs9d30409222\n (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);\n Sat, 11 Apr 2026 02:26:54 GMT","from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id B940E5805A;\n Sat, 11 Apr 2026 02:26:54 +0000 (GMT)","from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id 2A7A558054;\n Sat, 11 Apr 2026 02:26:54 +0000 (GMT)","from WIN-DU0DFC9G5VV.ibm.com (unknown [9.61.252.248])\n by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP;\n Sat, 11 Apr 2026 02:26:54 +0000 (GMT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc\n :content-transfer-encoding:date:from:in-reply-to:message-id\n :mime-version:references:subject:to; s=pp1; bh=wxsDkoxMgmqPvy/Tm\n rdPLZWJFFKC712PZ5X5MHIUL4o=; b=oKxrMxSe82N4ns2PjcnXxCo+vBgWeiIdB\n rlv82s2qqiJYFD9k09VKNyzEg/lW/ke2u/NIXubjd1HARrf8G2iv/iKnu3uFI7Zd\n xc5jukrmzLN1ai5ATjkEtuBIZrZ0Mj+Girzh4utT+ZOX5jmMlAwvRsJ/uexjetGL\n WOFmO6IbQteWWdHqSbfjVTCgxa8wzJOouo2jfGw8akwr1biLEGipoRt6QDkHAc6B\n TlRGtqW11AzWtqZcYP8RcE6HzXR+aVV//J6LMN7dMdWgOj1tOnlGQ1hwZs4D6Dj8\n uSb+IsDntOiyVKfI7Rxd77SnS87PkTkRnASVsnpFM4PwNo55cgcVg==","From":"Konstantin Shkolnyy <kshk@linux.ibm.com>","To":"mjrosato@linux.ibm.com","Cc":"alifm@linux.ibm.com, richard.henderson@linaro.org, iii@linux.ibm.com,\n david@kernel.org, cohuck@redhat.com, pasic@linux.ibm.com,\n borntraeger@linux.ibm.com, qemu-s390x@nongnu.org,\n qemu-devel@nongnu.org, Konstantin Shkolnyy <kshk@linux.ibm.com>","Subject":"[PATCH v2 05/15] s390x/pci: Move iotlb from S390PCIIOMMU to\n S390PCIBusDevice","Date":"Fri, 10 Apr 2026 21:26:08 -0500","Message-Id":"<20260411022618.2136588-6-kshk@linux.ibm.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20260411022618.2136588-1-kshk@linux.ibm.com>","References":"<20260411022618.2136588-1-kshk@linux.ibm.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-TM-AS-GCONF":"00","X-Authority-Analysis":"v=2.4 cv=I+9Vgtgg c=1 sm=1 tr=0 ts=69d9b171 cx=c_pps\n a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17\n a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22\n a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VnNF1IyMAAAA:8 a=frKy0Gi9Nncm8Rs_nZ4A:9","X-Proofpoint-GUID":"nlLwzksz-rbHyqwb7h_WAwelE5wWYVIm","X-Proofpoint-Spam-Details-Enc":"AW1haW4tMjYwNDExMDAxNiBTYWx0ZWRfXy9vU91lA86Nc\n 2e73Nc/h0UnoFauzDgkJpoRZOCD6dO7g0yBTr6eI+07tjrrZuZ4XO9NwQuUIbWA4QRoP9tFeTW+\n grk18ae1ssC3M1VDKLsJpz34XxMjXvbmP5q6YsacUbGN8XpX8RIj4dQQdTjmFVSPJBJEkHRXSxi\n WI+W3GfIpRFL+IEs96z7DH5n9ACPHOEVSogowsXusknwwJxoKuEPsw2Dr7k99//bjMopvorr91K\n MtLtm27GE/zUxjufdzElpT8UnkqcKw5xB+3xyHhG1D6667zUHcX9hjcJ0ZJH791IwHTUe3+A11z\n jPECqJFz6zdulGLv46hsqsEle0TrVpw0dKPREWT+bU/7FDE4d8lFoFor4be9s+oFEuAQKBmY4QS\n JxqfJuNAkWu+LWpvOj4v9IZjNoLMeX+B9oQLtNlIstr7PNA9hF4yv/APXZlU6pyK8wxqTq77Ti0\n hoNoqU+zl23r7qgRT3Q==","X-Proofpoint-ORIG-GUID":"nlLwzksz-rbHyqwb7h_WAwelE5wWYVIm","X-Proofpoint-Virus-Version":"vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-04-10_07,2026-04-09_02,2025-10-01_01","X-Proofpoint-Spam-Details":"rule=outbound_notspam policy=outbound score=0\n priorityscore=1501 impostorscore=0 bulkscore=0 suspectscore=0 adultscore=0\n lowpriorityscore=0 spamscore=0 malwarescore=0 clxscore=1015 phishscore=0\n classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0\n reason=mlx scancount=1 engine=8.22.0-2604010000 definitions=main-2604110016","Received-SPF":"pass client-ip=148.163.158.5; envelope-from=kshk@linux.ibm.com;\n helo=mx0b-001b2d01.pphosted.com","X-Spam_score_int":"-26","X-Spam_score":"-2.7","X-Spam_bar":"--","X-Spam_report":"(-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7,\n RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,\n 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":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"This field is only used when S390PCIBusDevice exists, so it can be moved\nthere to simplify S390PCIIOMMU which purpose is just to store the \"root\"\nAddressSpace.\n\nSigned-off-by: Konstantin Shkolnyy <kshk@linux.ibm.com>\n---\n hw/s390x/s390-pci-bus.c         | 10 +++++-----\n hw/s390x/s390-pci-inst.c        |  6 +++---\n include/hw/s390x/s390-pci-bus.h |  2 +-\n 3 files changed, 9 insertions(+), 9 deletions(-)","diff":"diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c\nindex 117fd8136e..3f3123e62a 100644\n--- a/hw/s390x/s390-pci-bus.c\n+++ b/hw/s390x/s390-pci-bus.c\n@@ -569,7 +569,7 @@ static IOMMUTLBEntry s390_translate_iommu(IOMMUMemoryRegion *mr, hwaddr addr,\n         goto err;\n     }\n \n-    entry = g_hash_table_lookup(iommu->iotlb, &iova);\n+    entry = g_hash_table_lookup(pbdev->iotlb, &iova);\n     if (entry) {\n         ret.iova = entry->iova;\n         ret.translated_addr = entry->translated_addr;\n@@ -669,8 +669,6 @@ static S390PCIIOMMU *s390_pci_get_iommu(S390pciState *s, PCIBus *bus,\n                                         PCI_FUNC(devfn));\n         memory_region_init(&iommu->mr, OBJECT(iommu), mr_name, UINT64_MAX);\n         address_space_init(&iommu->as, &iommu->mr, as_name);\n-        iommu->iotlb = g_hash_table_new_full(g_int64_hash, g_int64_equal,\n-                                             NULL, g_free);\n         table->iommu[PCI_SLOT(devfn)] = iommu;\n \n         g_free(mr_name);\n@@ -805,7 +803,7 @@ void s390_pci_iommu_disable(S390PCIBusDevice *pbdev)\n {\n     S390PCIIOMMU *iommu = pbdev->iommu;\n     iommu->enabled = false;\n-    g_hash_table_remove_all(iommu->iotlb);\n+    g_hash_table_remove_all(pbdev->iotlb);\n     if (pbdev->dm_mr) {\n         memory_region_del_subregion(&iommu->mr, pbdev->dm_mr);\n         object_unparent(OBJECT(pbdev->dm_mr));\n@@ -829,7 +827,6 @@ static void s390_pci_iommu_free(S390pciState *s, PCIBus *bus, int32_t devfn)\n     }\n \n     table->iommu[PCI_SLOT(devfn)] = NULL;\n-    g_hash_table_destroy(iommu->iotlb);\n     /*\n      * An attached PCI device may have memory listeners, eg. VFIO PCI.\n      * The associated subregion will already have been unmapped in\n@@ -1251,6 +1248,8 @@ static void s390_pcihost_plug(HotplugHandler *hotplug_dev, DeviceState *dev,\n         /* the allocated idx is actually getting used */\n         s->next_idx = (pbdev->idx + 1) & FH_MASK_INDEX;\n         pbdev->fh = pbdev->idx;\n+        pbdev->iotlb = g_hash_table_new_full(g_int64_hash, g_int64_equal,\n+                                             NULL, g_free);\n         QTAILQ_INSERT_TAIL(&s->zpci_devs, pbdev, link);\n         g_hash_table_insert(s->zpci_table, &pbdev->idx, pbdev);\n     } else {\n@@ -1293,6 +1292,7 @@ static void s390_pcihost_unplug(HotplugHandler *hotplug_dev, DeviceState *dev,\n         if (pbdev->iommu && pbdev->iommu->dma_limit) {\n             s390_pci_end_dma_count(s, pbdev->iommu->dma_limit);\n         }\n+        g_hash_table_destroy(pbdev->iotlb);\n         qdev_unrealize(dev);\n     }\n }\ndiff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c\nindex 834a0aec95..8349b44dd4 100644\n--- a/hw/s390x/s390-pci-inst.c\n+++ b/hw/s390x/s390-pci-inst.c\n@@ -617,7 +617,7 @@ uint32_t s390_pci_update_iotlb(S390PCIBusDevice *pbdev,\n                                S390IOTLBEntry *entry)\n {\n     S390PCIIOMMU *iommu = pbdev->iommu;\n-    S390IOTLBEntry *cache = g_hash_table_lookup(iommu->iotlb, &entry->iova);\n+    S390IOTLBEntry *cache = g_hash_table_lookup(pbdev->iotlb, &entry->iova);\n     IOMMUTLBEvent event = {\n         .type = entry->perm ? IOMMU_NOTIFIER_MAP : IOMMU_NOTIFIER_UNMAP,\n         .entry = {\n@@ -633,7 +633,7 @@ uint32_t s390_pci_update_iotlb(S390PCIBusDevice *pbdev,\n         if (!cache) {\n             goto out;\n         }\n-        g_hash_table_remove(iommu->iotlb, &entry->iova);\n+        g_hash_table_remove(pbdev->iotlb, &entry->iova);\n         inc_dma_avail(iommu);\n         /* Don't notify the iommu yet, maybe we can bundle contiguous unmaps */\n         goto out;\n@@ -656,7 +656,7 @@ uint32_t s390_pci_update_iotlb(S390PCIBusDevice *pbdev,\n         cache->translated_addr = entry->translated_addr;\n         cache->len = TARGET_PAGE_SIZE;\n         cache->perm = entry->perm;\n-        g_hash_table_replace(iommu->iotlb, &cache->iova, cache);\n+        g_hash_table_replace(pbdev->iotlb, &cache->iova, cache);\n         dec_dma_avail(iommu);\n     }\n \ndiff --git a/include/hw/s390x/s390-pci-bus.h b/include/hw/s390x/s390-pci-bus.h\nindex f310672584..d9bafd6859 100644\n--- a/include/hw/s390x/s390-pci-bus.h\n+++ b/include/hw/s390x/s390-pci-bus.h\n@@ -281,7 +281,6 @@ struct S390PCIIOMMU {\n     uint64_t pba;\n     uint64_t pal;\n     uint64_t max_dma_limit;\n-    GHashTable *iotlb;\n     S390PCIDMACount *dma_limit;\n };\n \n@@ -354,6 +353,7 @@ struct S390PCIBusDevice {\n     S390PCIIOMMU *iommu;\n     IOMMUMemoryRegion iommu_mr;\n     MemoryRegion *dm_mr;\n+    GHashTable *iotlb;\n     MemoryRegion msix_notify_mr;\n     IndAddr *summary_ind;\n     IndAddr *indicator;\n","prefixes":["v2","05/15"]}