From nobody Mon Sep 21 02:43: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=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1785811544; cv=none; d=zohomail.com; s=zohoarc; b=CL8oy/3VhuQIOnSxVpPzW1FdwFlTMXx4JurTa8ehUZM0+tlPrcTJFQf37yrgIRfbrZI5+ozP6aKZGd0ZuW7X6WewU6QZRoqG6ISBWrnPhENpgd0wO/SZKlKRrdpai+g1Oe1srWC39iJ/7VTcFlY48Uxo1RjGqXxIoTDtSuDREiM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785811544; h=Content-Transfer-Encoding:Cc:Cc: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; bh=7N73A6PcD+EWNkKQvereu8k9K4k0YmjNl10M8genbuk=; b=jPXtuFfLchhaPKZwoxV9+fJ0oEBW2y33CX7U4a42a5qcADAyGw4XXE8Ah4mimmORH6huyT5KZDz0kpc/xmgeQHCubiDXmgeZ/KelrKgAgOwMmRN0JYJnkV0xHY9nw/TLquJEw8ZJVyOWnMAn37HDAiP1hYwIlLU68MSrQU08zes= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785811544144869.9134983505232; Mon, 3 Aug 2026 19:45:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wr59T-0005iM-Si; Mon, 03 Aug 2026 22:45:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wr59J-0005eq-OE; Mon, 03 Aug 2026 22:45:03 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wr59H-0005Cg-5Z; Mon, 03 Aug 2026 22:45:01 -0400 Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6741J4Fa3633768; Tue, 4 Aug 2026 02:44:55 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fs8a3urcv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 04 Aug 2026 02:44:55 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 6742fPa1032351; Tue, 4 Aug 2026 02:44:54 GMT Received: from smtprelay03.dal12v.mail.ibm.com ([172.16.1.5]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fsv4k03kt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 04 Aug 2026 02:44:54 +0000 (GMT) Received: from smtpav04.wdc07v.mail.ibm.com (smtpav04.wdc07v.mail.ibm.com [10.39.53.231]) by smtprelay03.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6742iq4I27394566 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 4 Aug 2026 02:44:53 GMT Received: from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D1EFE58050; Tue, 4 Aug 2026 02:44:52 +0000 (GMT) Received: from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3937958045; Tue, 4 Aug 2026 02:44:52 +0000 (GMT) Received: from WIN-DU0DFC9G5VV.ibm.com (unknown [9.61.249.58]) by smtpav04.wdc07v.mail.ibm.com (Postfix) with ESMTP; Tue, 4 Aug 2026 02:44:52 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=7N73A6PcD+EWNkKQv ereu8k9K4k0YmjNl10M8genbuk=; b=Y+DhBGaTcQ60RRzqE8AVynMry7ONyooEZ 4gobHvSyJmdYkEdks9W3lBBOI9xBJcTwOiulQ8kCCRvvsxmlQN3DN46blmz68S5g fCrbtkovhWwjjBJVUNnf3uyj8tEagHIrIYgpLJeRr9dJcZMW31YMqxOhmkdT8+Ax g0GBosrVsp5B9jypZDwggTsiiSBA3Go+P3Jno5Qv7wH0MBgRt8qz97KF8yqDYhUJ fvsWCYegiph+0TWIpyQ4nrGBYEArZ2fhfGFmeqheFnVf8fOaiH+KdbbjedpzxdBf Zdvl48Cc8bv3ugAESmPhjMTk8OWjJsAD9x5DekN8fsHc1KJCldD+w== From: Konstantin Shkolnyy To: mjrosato@linux.ibm.com Cc: alifm@linux.ibm.com, farman@linux.ibm.com, richard.henderson@linaro.org, iii@linux.ibm.com, david@kernel.org, cohuck@redhat.com, pasic@linux.ibm.com, borntraeger@linux.ibm.com, qemu-s390x@nongnu.org, qemu-devel@nongnu.org, Konstantin Shkolnyy Subject: [PATCH v5 05/15] s390x/pci: Move iotlb from S390PCIIOMMU to S390PCIBusDevice Date: Mon, 3 Aug 2026 21:44:33 -0500 Message-Id: <20260804024443.56445-6-kshk@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260804024443.56445-1-kshk@linux.ibm.com> References: <20260804024443.56445-1-kshk@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Authority-Analysis: v=2.4 cv=E6P9Y6dl c=1 sm=1 tr=0 ts=6a715227 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=Sv0fKeRqtYgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=VnNF1IyMAAAA:8 a=frKy0Gi9Nncm8Rs_nZ4A:9 X-Proofpoint-ORIG-GUID: TFg_kNSTe2W-S5eSpHpClXYrWmywvctm X-Proofpoint-GUID: TFg_kNSTe2W-S5eSpHpClXYrWmywvctm X-Proofpoint-Spam-Info: AW1haW4tMjYwODA0MDAxNiBTYWx0ZWRfXxKmnb2C273mi sMMAxf+OavpEkiDINReeKdckvnuRHOVcM7D+6D2PB9al5XuJJtFb8Dy7aBiOcv68T8Y2Nco2SD5 eD78viLgiaoUKSyiPdNcCzcDdPbSzSg= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODA0MDAxNiBTYWx0ZWRfX0IQAi+x4Dusw DSk0Yma4ZHPVm3QvM0hd1rdM2rNDOf6We36pv6QIapcGRjUp1k5X1FsVvFcBAmQCJTqoyyRkjCI klBC8vW2l1tAuhfGunBbUXCVRJ6UvbpXjibSW2TB7nGgc9+JAkd4UQ3VASzAx+zk0HRgYc10L8j ngpFFq/zaHbmUP9iDPik0Fvfmj2JyAdQKoadmyoMGD6oXOgGw891BjWhCX6zyi3plw5TaQ26H7j WzJ530YR+cM519WRB7sXgbYYqSJe+v8IMYkv6+sA1H/8Ozxxclm9uUHSOapuLF0AA48tZqz6U9H B5DkdVWwCEZbEtag/oXFM6jH9KMU9Mjt8p14A3nfvyjOX1DBLBTDt3LokhzohKMNHUNuI3aryTz omW/P33JBJRJ0Z0KLTSGhYUTXgZE0x0u0qNOJkAlMWRdvt1i/QQMWakoZIcXL8QSmCSCuxn8lCk uDvsTwJN8t3IDamzy3Q== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-04_01,2026-08-03_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1015 lowpriorityscore=0 priorityscore=1501 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 impostorscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608040016 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=lists1p.gnu.org; Received-SPF: pass client-ip=148.163.156.1; envelope-from=kshk@linux.ibm.com; helo=mx0a-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, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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 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 @ibm.com) X-ZM-MESSAGEID: 1785811546910158501 Content-Type: text/plain; charset="utf-8" This field is only used when S390PCIBusDevice exists, so it can be moved there to simplify S390PCIIOMMU which purpose is just to store the "root" AddressSpace. Signed-off-by: Konstantin Shkolnyy --- hw/s390x/s390-pci-bus.c | 10 +++++----- hw/s390x/s390-pci-inst.c | 6 +++--- include/hw/s390x/s390-pci-bus.h | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 5c551196bf..a08f226ef8 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -570,7 +570,7 @@ static IOMMUTLBEntry s390_translate_iommu(IOMMUMemoryRe= gion *mr, hwaddr addr, goto err; } =20 - entry =3D g_hash_table_lookup(iommu->iotlb, &iova); + entry =3D g_hash_table_lookup(pbdev->iotlb, &iova); if (entry) { ret.iova =3D entry->iova; ret.translated_addr =3D entry->translated_addr; @@ -682,8 +682,6 @@ static S390PCIIOMMU *s390_pci_get_iommu(S390pciState *s= , PCIBus *bus, PCI_FUNC(devfn)); memory_region_init(&iommu->mr, OBJECT(iommu), mr_name, UINT64_MAX); address_space_init(&iommu->as, &iommu->mr, as_name); - iommu->iotlb =3D g_hash_table_new_full(g_int64_hash, g_int64_equal, - NULL, g_free); table->iommu[PCI_SLOT(devfn)] =3D iommu; =20 g_free(mr_name); @@ -818,7 +816,7 @@ void s390_pci_iommu_disable(S390PCIBusDevice *pbdev) { S390PCIIOMMU *iommu =3D pbdev->iommu; iommu->enabled =3D false; - g_hash_table_remove_all(iommu->iotlb); + g_hash_table_remove_all(pbdev->iotlb); if (pbdev->dm_mr) { memory_region_del_subregion(&iommu->mr, pbdev->dm_mr); object_unparent(OBJECT(pbdev->dm_mr)); @@ -842,7 +840,6 @@ static void s390_pci_iommu_free(S390pciState *s, PCIBus= *bus, int32_t devfn) } =20 table->iommu[PCI_SLOT(devfn)] =3D NULL; - g_hash_table_destroy(iommu->iotlb); /* * An attached PCI device may have memory listeners, eg. VFIO PCI. * The associated subregion will already have been unmapped in @@ -1264,6 +1261,8 @@ static void s390_pcihost_plug(HotplugHandler *hotplug= _dev, DeviceState *dev, /* the allocated idx is actually getting used */ s->next_idx =3D (pbdev->idx + 1) & FH_MASK_INDEX; pbdev->fh =3D pbdev->idx; + pbdev->iotlb =3D g_hash_table_new_full(g_int64_hash, g_int64_equal, + NULL, g_free); QTAILQ_INSERT_TAIL(&s->zpci_devs, pbdev, link); g_hash_table_insert(s->zpci_table, &pbdev->idx, pbdev); } else { @@ -1306,6 +1305,7 @@ static void s390_pcihost_unplug(HotplugHandler *hotpl= ug_dev, DeviceState *dev, if (pbdev->iommu && pbdev->iommu->dma_limit) { s390_pci_end_dma_count(s, pbdev->iommu->dma_limit); } + g_hash_table_destroy(pbdev->iotlb); qdev_unrealize(dev); } } diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index 582e93a741..f648afb401 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -634,7 +634,7 @@ uint32_t s390_pci_update_iotlb(S390PCIBusDevice *pbdev, S390IOTLBEntry *entry) { S390PCIIOMMU *iommu =3D pbdev->iommu; - S390IOTLBEntry *cache =3D g_hash_table_lookup(iommu->iotlb, &entry->io= va); + S390IOTLBEntry *cache =3D g_hash_table_lookup(pbdev->iotlb, &entry->io= va); IOMMUTLBEvent event =3D { .type =3D entry->perm ? IOMMU_NOTIFIER_MAP : IOMMU_NOTIFIER_UNMAP, .entry =3D { @@ -650,7 +650,7 @@ uint32_t s390_pci_update_iotlb(S390PCIBusDevice *pbdev, if (!cache) { goto out; } - g_hash_table_remove(iommu->iotlb, &entry->iova); + g_hash_table_remove(pbdev->iotlb, &entry->iova); inc_dma_avail(iommu); /* Don't notify the iommu yet, maybe we can bundle contiguous unma= ps */ goto out; @@ -673,7 +673,7 @@ uint32_t s390_pci_update_iotlb(S390PCIBusDevice *pbdev, cache->translated_addr =3D entry->translated_addr; cache->len =3D TARGET_PAGE_SIZE; cache->perm =3D entry->perm; - g_hash_table_replace(iommu->iotlb, &cache->iova, cache); + g_hash_table_replace(pbdev->iotlb, &cache->iova, cache); dec_dma_avail(iommu); } =20 diff --git a/include/hw/s390x/s390-pci-bus.h b/include/hw/s390x/s390-pci-bu= s.h index f310672584..d9bafd6859 100644 --- a/include/hw/s390x/s390-pci-bus.h +++ b/include/hw/s390x/s390-pci-bus.h @@ -281,7 +281,6 @@ struct S390PCIIOMMU { uint64_t pba; uint64_t pal; uint64_t max_dma_limit; - GHashTable *iotlb; S390PCIDMACount *dma_limit; }; =20 @@ -354,6 +353,7 @@ struct S390PCIBusDevice { S390PCIIOMMU *iommu; IOMMUMemoryRegion iommu_mr; MemoryRegion *dm_mr; + GHashTable *iotlb; MemoryRegion msix_notify_mr; IndAddr *summary_ind; IndAddr *indicator; --=20 2.34.1