From nobody Thu Oct 22 19:24:52 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=1791570593; cv=none; d=zohomail.com; s=zohoarc; b=KjEh2aypWAocFVxQSN6GCFPydSvEb4f/fkeg4/+hx6q7sF9hEVXu7ZG1VH59WWAJniwgUoz0+BJcU3MNryNV8q1pgllND/qAl5hzgKee5TuzkD/3T6RpdFc3NPhQccDFajCJBNeC7WcMgyjshEYTg40+6xak8M3M0p0TjoqQCXc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791570593; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=dgfHwCZ9WokCdyBVnLFCvza36SUkmwYZd5Unuc5wUdc=; b=MbbHC5A1Hch994J7wW7GFKNY7m5EZHW8yNrQkNE6oIdcjn0DUn5yP46MT2/JdzsgNANkBNn7z43W/0O6l0Oqp7YFecuVLQT/qBacqS+ewabbGdZHuTbIhxSdMMNEyM9KjUw2fszm5y2srIlUxMJaW3PXuJ0r14ypaCMHIxO96F0= 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 1791570593870648.3249778527568; Fri, 9 Oct 2026 11:29:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xFFKg-0000Pd-NE; Fri, 09 Oct 2026 14:28:38 -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 1xFFKe-0000OC-1r; Fri, 09 Oct 2026 14:28:36 -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 1xFFKb-0001dx-Td; Fri, 09 Oct 2026 14:28:35 -0400 Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 699HZxHV3128435; Fri, 9 Oct 2026 18:28:32 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4h74tcg8jw-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:31 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 699H8G4b1206683; Fri, 9 Oct 2026 18:28:30 GMT Received: from smtprelay02.dal12v.mail.ibm.com ([172.16.1.4]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4h6hsnm7n6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:30 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay02.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 699ISS0E24379934 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Oct 2026 18:28:29 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AEA915805C; Fri, 9 Oct 2026 18:28:28 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8EF7758054; Fri, 9 Oct 2026 18:28:27 +0000 (GMT) Received: from li-479af74c-31f9-11b2-a85c-e4ddee11713b.ibm.com.com (unknown [9.61.5.156]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 9 Oct 2026 18:28:27 +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=dgfHwCZ9WokCdyBVn LFCvza36SUkmwYZd5Unuc5wUdc=; b=VpHRsgpTpjGHGOv284RNAFoq4oIAARFLq OyVIoYoM7CEPrVyuRjJeDLlIYcbJNJE83h/s0OAsvyXrt+B+EEQUCevl9nB9zWpy heRElr4YiVH7HeNYcXc8YIs0rCs3bjGji0r+RRwjrhqrw41Tw4Dh/6xI33Jq4fMx 41WQAn2rvcmLJiVbbAXPGFc/PZPeemU8lb0ZtlQy/jcNmW0cCAFhvBl9c9ROom52 0O7QHeUcaoQ3fSq8iAnYgiz0DbKiEzDZ4oHZ277TCHzFVM/30kEMapyoPdMAcMin CCvDRZ9n73RAk2ypmkIXeSkaUhqIW6aFhVWeHe4MKh+nNwhmJALMg== From: Eric Farman To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Matthew Rosato , Cornelia Huck , Konstantin Shkolnyy , Eric Farman Subject: [PULL 01/19] s390x/pci: implement IOMMU replay Date: Fri, 9 Oct 2026 14:28:07 -0400 Message-ID: <20261009182825.148054-2-farman@linux.ibm.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009182825.148054-1-farman@linux.ibm.com> References: <20261009182825.148054-1-farman@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX0abIWrVI05/0 or4LgxvWXhiubtdMWFKjLQ2/yl53y2SsDYum88yhff5L1W46gHHZxm0aqjMadjmhskuyfQvShFL LSze1QEUYtF+P6BvQjOQ9ypXYW0pHlQgqMFL0+De963LWDPOeCXAGZvZrg4EZpdy/XIlXAjAs3B iokKlGi/h2OUnCjgComLY1I80jwpAM4CjO39t5bipJp7SbPX2N1PA+q5tR1eTDakaqipUtztmcV 6HxNECqYjxfXD866aNH33gW3t83MwVCPx3X6bhgebiAR9AHCiLjcfebYVVB7bvSDeQeFKW7MJRi AW/pgYG5quStTwrUhP1t8ko8gTSRqxoIUZ3h+sVxWF9L/pzWgXRxgfizV40E8ZhrFMVhnTO/YLW JLG/sayHzs9DZRDjdbsCEO3dr+xYy07t1cCngpf4/W+OKWjJFMfM9EgvbrNPp5pZRsZ3nzbP/T1 iBJ0qqqJ7ArJFTEpxww== X-Proofpoint-Spam-Info: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX01X2R+45Chd3 Cb2P0URmCADqdysx5h5Ibi/m8UxZ6Z1sgQ0xqdrNXmweqPrSAS2RyoyrQQVRRRasd1rZmWprXlN LDenG+gZEykhv4w80Rae/MpiyWhBqfs= X-Proofpoint-GUID: FH2CLTbDXxEMrYD_SK7y6Radd8vwoTXb X-Proofpoint-ORIG-GUID: FH2CLTbDXxEMrYD_SK7y6Radd8vwoTXb X-Authority-Analysis: v=2.4 cv=Yu+a1IYX c=1 sm=1 tr=0 ts=6ac9324f cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=660iZSQnnn4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=uoNow8biE-CX8mucm5YA:9 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-10-09_05,2026-10-09_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 phishscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610090072 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=farman@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.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.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: 1791570595865158500 Content-Type: text/plain; charset="utf-8" From: Matthew Rosato There are a few scenarios where IOMMU replay can potentially be needed for zPCI device, namely VFIO device reset scenarios where the guest continues running and expects the contents of its IOMMU to be replayed upon IOAT re-registration and migration scenarios where the destination must reconstruct the IOMMU on the destination. zPCI migration is not supported yet, but the IOMMU replay function is implemented so that it can be called both from IOMMUMemoryRegionClass now and migration post_load later. Signed-off-by: Matthew Rosato Signed-off-by: Konstantin Shkolnyy Reviewed-by: Farhan Ali Link: https://lore.kernel.org/qemu-devel/20261006001643.420929-2-kshk@linux= .ibm.com Signed-off-by: Eric Farman --- hw/s390x/s390-pci-bus.c | 71 +++++++++++++++++++++++++++++--- hw/s390x/s390-pci-inst.c | 4 +- include/hw/s390x/s390-pci-inst.h | 1 + 3 files changed, 69 insertions(+), 7 deletions(-) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 2eb4e8cec4..b3f7b59422 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -593,14 +593,75 @@ err: return ret; } =20 -static void s390_pci_iommu_replay(IOMMUMemoryRegion *iommu, +static void s390_pci_ioat_replay(S390PCIIOMMU *iommu) +{ + S390PCIBusDevice *pbdev =3D iommu->pbdev; + S390IOTLBEntry entry; + uint16_t error =3D 0; + uint32_t dma_avail; + hwaddr curr, end; + + curr =3D iommu->pba; + end =3D iommu->pal; + + if (iommu->dm_mr || !pbdev) { + /* If direct mapping is used, there are no guest tables to replay = */ + return; + } + + if (iommu->dma_limit) { + dma_avail =3D iommu->dma_limit->avail; + } else { + dma_avail =3D 1; + } + + while (curr < end) { + error =3D s390_guest_io_table_walk(iommu->g_iota, curr, &entry); + if (error) { + pbdev->state =3D ZPCI_FS_ERROR; + s390_pci_generate_error_event(error, pbdev->fh, pbdev->fid, cu= rr, + 0); + error_report("Failure to walk table during iommu remap"); + return; + } + + /* Advance to next frame boundary if start was not frame-aligned */ + curr =3D QEMU_ALIGN_UP(curr + 1, entry.len); + if (entry.perm !=3D IOMMU_NONE) { + while (entry.iova < curr && entry.iova < end) { + if (dma_avail > 0) { + dma_avail =3D s390_pci_update_iotlb(iommu, &entry); + } else { + /* + * There is no reliable method to request the guest to + * release mappings other than in response to a RPCIT + * instruction; generate a permanent error condition a= nd + * require the device to be completely re-initialized = from + * the guest side. + */ + pbdev->state =3D ZPCI_FS_ERROR; + s390_pci_generate_error_event(ERR_EVENT_PERMERR, pbdev= ->fh, + pbdev->fid, 0, 0); + error_report("DMA mappings exhausted: iommu remap fail= ed"); + return; + } + entry.iova +=3D TARGET_PAGE_SIZE; + entry.translated_addr +=3D TARGET_PAGE_SIZE; + } + } + } +} + +static void s390_pci_iommu_replay(IOMMUMemoryRegion *mr, IOMMUNotifier *notifier) { - /* It's impossible to plug a pci device on s390x that already has iommu - * mappings which need to be replayed, that is due to the "one iommu p= er - * zpci device" construct. But when we support migration of vfio-pci - * devices in future, we need to revisit this. + S390PCIIOMMU *iommu =3D container_of(mr, S390PCIIOMMU, iommu_mr); + + /* + * The notifier argument is not used directly; s390_pci_ioat_replay() + * broadcasts via memory_region_notify_iommu() instead. */ + s390_pci_ioat_replay(iommu); } =20 static S390PCIIOMMU *s390_pci_get_iommu(S390pciState *s, PCIBus *bus, diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index 09026360d4..285ff0e089 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -630,8 +630,8 @@ int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint8= _t r2, uintptr_t ra) return 0; } =20 -static uint32_t s390_pci_update_iotlb(S390PCIIOMMU *iommu, - S390IOTLBEntry *entry) +uint32_t s390_pci_update_iotlb(S390PCIIOMMU *iommu, + S390IOTLBEntry *entry) { S390IOTLBEntry *cache =3D g_hash_table_lookup(iommu->iotlb, &entry->io= va); IOMMUTLBEvent event =3D { diff --git a/include/hw/s390x/s390-pci-inst.h b/include/hw/s390x/s390-pci-i= nst.h index 5cb8da540b..c782990e3b 100644 --- a/include/hw/s390x/s390-pci-inst.h +++ b/include/hw/s390x/s390-pci-inst.h @@ -111,6 +111,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint6= 4_t fiba, uint8_t ar, int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t = ar, uintptr_t ra); void fmb_timer_free(S390PCIBusDevice *pbdev); +uint32_t s390_pci_update_iotlb(S390PCIIOMMU *iommu, S390IOTLBEntry *entry); =20 #define ZPCI_IO_BAR_MIN 0 #define ZPCI_IO_BAR_MAX 5 --=20 2.56.0 From nobody Thu Oct 22 19:24:52 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=1791570566; cv=none; d=zohomail.com; s=zohoarc; b=MCq4TRMaDcO1RypH/6IRRLcEz7mY7bnroIq4RjcQDltj2dfOIHYG/DMIiOZvOQkdZUjcm+0TKMnhdlURicVu1xhqComcj33p3/dGF9bFy8IREJugk8WJ32FtIcoe+z16mRTlMq3v75zGAycJ1inSe1f9cGUJJhbt7UclbT397ts= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791570566; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=RG6KFTWrQnKyHWlqLFSiZNby/E+viNlZMhJLoSKV3g8=; b=bC705h0zldKmjhulxvvx2RGcuo/hrKpyiJT65ZKtWNmqWyg/BguE/J6irW3TyP8hGGsgHCt5RcUrYaTuBSTGu6WgtQufFR11u5EJ/xCvVENiGi0w6+k8LB3F5n5CuTmGNLI9WR7cdwUVro8ynMkmpmAihxdUmUSu5rghWEYMhn4= 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 1791570566741717.762939754434; Fri, 9 Oct 2026 11:29:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xFFKf-0000OY-8Z; Fri, 09 Oct 2026 14:28:37 -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 1xFFKd-0000Nt-61; Fri, 09 Oct 2026 14:28:35 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xFFKb-0001do-GS; Fri, 09 Oct 2026 14:28:34 -0400 Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 699Ha6IA592907; Fri, 9 Oct 2026 18:28:31 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4h74tdg8an-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:31 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 699H8KCg1206845; Fri, 9 Oct 2026 18:28:31 GMT Received: from smtprelay05.wdc07v.mail.ibm.com ([172.16.1.72]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4h6hsnm7nb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:31 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay05.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 699ISUZK60883282 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Oct 2026 18:28:30 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E94BC5805A; Fri, 9 Oct 2026 18:28:29 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E183158054; Fri, 9 Oct 2026 18:28:28 +0000 (GMT) Received: from li-479af74c-31f9-11b2-a85c-e4ddee11713b.ibm.com.com (unknown [9.61.5.156]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 9 Oct 2026 18:28:28 +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=RG6KFTWrQnKyHWlqL FSiZNby/E+viNlZMhJLoSKV3g8=; b=Q5UGKfdDI0qssYO6/v5lo12u1b72KZp7w yabijTJhlwmL3+VFTxivhVSloIFFjWvmAUU1Y4rXNYgbKf/6XmehRNhvUtPG1iOQ xwgjrh/nW7W0n/n6nfIw10dWbXz1SBQY2R3h+ehxmOkJSj/4uBcxSF7+5yIMtaRN 0cHgOZMhaJgPgTGUf/q9rCDb5Nk3EmSYtlvvGzCLejXgMNl+dticsHDRZvwxFlZz BIwCUWDZOliTZIb40/ee+1afHIJ0TDdnj5ppx6TuO74k/QaPqZPKkAAi1rSH4wuV nMxJafBTFfYTRPz0Ye5L3jPDPNfUQEIfqhBVYzpx4nz30+EAU4l7Q== From: Eric Farman To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Matthew Rosato , Cornelia Huck , Konstantin Shkolnyy , Eric Farman Subject: [PULL 02/19] s390x/pci: Create function to contain translation status check Date: Fri, 9 Oct 2026 14:28:08 -0400 Message-ID: <20261009182825.148054-3-farman@linux.ibm.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009182825.148054-1-farman@linux.ibm.com> References: <20261009182825.148054-1-farman@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfXzuj3qa+GWXuC jNtf13ZQ3LgReEIdjQMK0tiQadKRd6oSUASa2h+jLjbLfzPyqqydz7KKOcCU6YwQDIPAwfQauxF 79kjtkEQPTzsuhJ5680UB5foyn2LUZrN56fvlvlrr6cmH9d98bN7OMRh6TzLdL4LnUViLZKhgw+ m0mzzW/8h1kMEYICE0R0ciktBzOKEHF9ydFF+h9uKKZ7xK5S9fqN162SSqzZz+cjgPSha8eENWS MFIpUKuQTEpFTRNwFfgXZgrcmOGvsCqCxAaTaH9BbMC4PP4VouEm8cMO52L6XHxLN4qzs8gSKmn xZBv3Phe/LV/p/y+Ymvp4pQl7EeS2GMbuvktW7zxhj/GZDMXcQO9fKl+zqW7ZZBeOsYsTSbuwdC sOtgczDliMzBDkfuhFjO2qs8jMY9rx2TFu2ck7j4KYReXuL8d2dI8ScyLhOFv4zOPoivYCNT6jy aCOp9FZE1ao9hni9NEw== X-Authority-Analysis: v=2.4 cv=FqWQbGrq c=1 sm=1 tr=0 ts=6ac9324f cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=660iZSQnnn4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=lxH2FGwE2Re4nIR70o8A:9 X-Proofpoint-GUID: aftSngkBhT2_Bsaoeve6i0TiNhtG7dqF X-Proofpoint-Spam-Info: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX462ogUBuSdDn G/9hNHYzaJhfNop01AFBrQ+2RrIxCVHye9H2cvNpTtgSEr82HHQkH1I6a2Uu3DoKi+PbfXlWyna 5SXeah2XNCkOlqSDzzH2mYYT5LbxcOs= X-Proofpoint-ORIG-GUID: aftSngkBhT2_Bsaoeve6i0TiNhtG7dqF 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-10-09_05,2026-10-09_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 suspectscore=0 priorityscore=1501 impostorscore=0 adultscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610090072 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.158.5; envelope-from=farman@linux.ibm.com; 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, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=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.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: 1791570567289158500 Content-Type: text/plain; charset="utf-8" From: Konstantin Shkolnyy Make it more clear what the bit means, and the new function will be called from yet another place in the future. Reviewed-by: Christian Borntraeger Reviewed-by: Matthew Rosato Reviewed-by: Farhan Ali Signed-off-by: Konstantin Shkolnyy Link: https://lore.kernel.org/qemu-devel/20261006001643.420929-3-kshk@linux= .ibm.com Signed-off-by: Eric Farman --- hw/s390x/s390-pci-inst.c | 7 ++++++- include/hw/s390x/s390-pci-bus.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index 285ff0e089..c5d87aa615 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -1025,6 +1025,11 @@ int pci_dereg_irqs(S390PCIBusDevice *pbdev) return 0; } =20 +bool s390_pci_is_translation_enabled(uint64_t g_iota) +{ + return ((g_iota >> 11) & 0x1) !=3D 0; /* "T" bit */ +} + static int reg_ioat(CPUS390XState *env, S390PCIBusDevice *pbdev, ZpciFib f= ib, uintptr_t ra) { @@ -1033,7 +1038,7 @@ static int reg_ioat(CPUS390XState *env, S390PCIBusDev= ice *pbdev, ZpciFib fib, uint64_t pal =3D ldq_be_p(&fib.pal); uint64_t g_iota =3D ldq_be_p(&fib.iota); uint8_t dt =3D (g_iota >> 2) & 0x7; - uint8_t t =3D (g_iota >> 11) & 0x1; + bool t =3D s390_pci_is_translation_enabled(g_iota); =20 pba &=3D ~0xfff; pal |=3D 0xfff; diff --git a/include/hw/s390x/s390-pci-bus.h b/include/hw/s390x/s390-pci-bu= s.h index f182bab246..a732ad652b 100644 --- a/include/hw/s390x/s390-pci-bus.h +++ b/include/hw/s390x/s390-pci-bus.h @@ -391,6 +391,7 @@ int pci_chsc_sei_nt2_get_event(void *res); int pci_chsc_sei_nt2_have_event(void); void s390_pci_sclp_configure(SCCB *sccb); void s390_pci_sclp_deconfigure(SCCB *sccb); +bool s390_pci_is_translation_enabled(uint64_t g_iota); void s390_pci_iommu_enable(S390PCIIOMMU *iommu); void s390_pci_iommu_direct_map_enable(S390PCIIOMMU *iommu); void s390_pci_iommu_disable(S390PCIIOMMU *iommu); --=20 2.56.0 From nobody Thu Oct 22 19:24:52 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=1791570673; cv=none; d=zohomail.com; s=zohoarc; b=n+98q96u0bt2+smji2wiqgPg7De7Yjp9od6hxjZCtfDDwK0agwWyQFoJ+H19zci5RzkUGq9M8gH2sf7mdWWWPhB1CicvA5jtF9o8MCIXxxDQpREBYdO/PPxBqUO7cn64Som9OaX1/IyCspUXBj3fH66L2ymDOZY6bQgtem5xNos= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791570673; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6/4plmZZhumT7WGhV3jiRvgbXYPg6r9h8y6yl0Pat1U=; b=LqqqB6K6GHxLpB4wdtlmy2mXz7xzClWEdI0t3RR1kC7XpEf06W8/vzTqxhcuXhtBsFRqisidBFvfcJSzM7/FvgKiIKMpWbZ2WWLsF3EPAWAa9sEplDSqPNkHf4G4XUzry/13Y2X8TLfkxHp+0K/RQNuGwIoiv8yOSo0q7vLZi7M= 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 1791570673654432.599732112687; Fri, 9 Oct 2026 11:31:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xFFKi-0000Qq-9X; Fri, 09 Oct 2026 14:28:40 -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 1xFFKf-0000P8-RA; Fri, 09 Oct 2026 14:28:37 -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 1xFFKd-0001eF-Cv; Fri, 09 Oct 2026 14:28:37 -0400 Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 699Ha1LF699164; Fri, 9 Oct 2026 18:28:33 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4h74ter8q6-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:33 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 699H8SNm4126033; Fri, 9 Oct 2026 18:28:32 GMT Received: from smtprelay06.wdc07v.mail.ibm.com ([172.16.1.73]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4h5f3u45mp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:32 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay06.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 699ISVX528115496 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Oct 2026 18:28:31 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 593065805A; Fri, 9 Oct 2026 18:28:31 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 287A558054; Fri, 9 Oct 2026 18:28:30 +0000 (GMT) Received: from li-479af74c-31f9-11b2-a85c-e4ddee11713b.ibm.com.com (unknown [9.61.5.156]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 9 Oct 2026 18:28:30 +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=6/4plmZZhumT7WGhV 3jiRvgbXYPg6r9h8y6yl0Pat1U=; b=bAX1RDoebT7Wg0LLoxUYlAWfDWEdiQBV/ UKmyBLzgyAmLZwQ0XBZA8VHvlOwbOFM/NXZZc1q0RcQdjF6I9vvmCsC9i9beuUWR fFgDaDG2NDXdmyXaZr10dV3eOV2Ei0ZusP9NYx4G6QE+3HkYleUPQV/jpKV9gI5A aYKFuYtclaC6Uid1R8gdLm/n+sVffvBLeDL1WrHxtFBgxsdBkmt17f2invbYNM82 fM/2/C33OkCs7ZdpfY50uGQCSXyhPdNFmBrnTkBsMoi2QTcE7sPUqii6e+A1zLeX YLkEe0sZuOFxmgf+/prQRj1RrAuA0q9I5mDXUSeiyF2Wz+3kmzPJg== From: Eric Farman To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Matthew Rosato , Cornelia Huck , Konstantin Shkolnyy , Eric Farman Subject: [PULL 03/19] s390x/pci: Move iommu_mr from S390PCIIOMMU to S390PCIBusDevice Date: Fri, 9 Oct 2026 14:28:09 -0400 Message-ID: <20261009182825.148054-4-farman@linux.ibm.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009182825.148054-1-farman@linux.ibm.com> References: <20261009182825.148054-1-farman@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Info: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfXzNNjui08bgmJ uZhtGCy/pl6fbtau20rtrSy+k2CjWtFdSafuOUW5nsPapOnKooJ4VtD+/Ogrpxt9Vvb8WE2RsVe ElJaIC0rUv3BoyMbmeY1xLfYaJkvXxM= X-Proofpoint-GUID: dTK5N5ramsValGmDm4dN71d_j2Kk-R6T X-Authority-Analysis: v=2.4 cv=P42vFSAu c=1 sm=1 tr=0 ts=6ac93251 cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=660iZSQnnn4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=E7Q9Gpuie88_50F72KoA:9 X-Proofpoint-ORIG-GUID: dTK5N5ramsValGmDm4dN71d_j2Kk-R6T X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX62nR7L8B4wpe FN2EGKckqJbXpTcHu0t5RgQY6o4LxbgR8CfTmJsOY8hPlKkn5MGpv4lz9/Fk4AMwUeeiRhJpQFI e5rU3ONpELgoyXOUGy0w+luKy0oQGqg1Ajd7DeTC4FkkdcyEnXM0owlN0xoywRl38hUGG10uB93 C3Guk535XvYvv98mEVgHlUtQ7uTzeWkoftotbQyRbtOpXbBwbdMRQswl1IA+b8h+EQQYB3IiK9l AVqEZJbe2+Q1zLzk7INN0aI5Q6rh6o/7LfGrJ26IChUsadFZkJ6p7Uzp5rf64hnDew2BSQ0dz9o SPuja3D3A6eMREt2gL5yo470pb4dueZo0NbtjMLDLtgUc5PR3dxpJtKUEyJfnjiB7xgZaHXkyOK booJpbfOZhKi9B2XxCuKNNG4eYCzbnZkixhSmCcmlcPgiIkn9XqglEnmaBeMFPpDzXyio4El4J5 eReUAJxcrzRYNVVufiQ== 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-10-09_05,2026-10-09_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 suspectscore=0 spamscore=0 phishscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 impostorscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610090072 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=farman@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.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.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: 1791570675287158500 Content-Type: text/plain; charset="utf-8" From: Konstantin Shkolnyy This field is only used when S390PCIBusDevice exists, so it can be moved there to simplify S390PCIIOMMU towards a structure that contains only the IOMMU container information needed by the PCI layer for a given slot. Reviewed-by: Farhan Ali Reviewed-by: Matthew Rosato Signed-off-by: Konstantin Shkolnyy Link: https://lore.kernel.org/qemu-devel/20261006001643.420929-4-kshk@linux= .ibm.com Signed-off-by: Eric Farman --- hw/s390x/s390-pci-bus.c | 35 +++++++++++++++++--------------- hw/s390x/s390-pci-inst.c | 28 +++++++++++++------------ include/hw/s390x/s390-pci-bus.h | 6 +++--- include/hw/s390x/s390-pci-inst.h | 4 ++-- 4 files changed, 39 insertions(+), 34 deletions(-) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index b3f7b59422..e709d6e478 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -207,7 +207,7 @@ void s390_pci_sclp_deconfigure(SCCB *sccb) pci_dereg_irqs(pbdev); } if (pbdev->iommu->enabled) { - pci_dereg_ioat(pbdev->iommu); + pci_dereg_ioat(pbdev); } pbdev->state =3D ZPCI_FS_STANDBY; rc =3D SCLP_RC_NORMAL_COMPLETION; @@ -539,7 +539,8 @@ uint16_t s390_guest_io_table_walk(uint64_t g_iota, hwad= dr addr, static IOMMUTLBEntry s390_translate_iommu(IOMMUMemoryRegion *mr, hwaddr ad= dr, IOMMUAccessFlags flag, int iommu= _idx) { - S390PCIIOMMU *iommu =3D container_of(mr, S390PCIIOMMU, iommu_mr); + S390PCIBusDevice *pbdev =3D container_of(mr, S390PCIBusDevice, iommu_m= r); + S390PCIIOMMU *iommu =3D pbdev->iommu; S390IOTLBEntry *entry; uint64_t iova =3D addr & TARGET_PAGE_MASK; uint16_t error =3D 0; @@ -593,18 +594,18 @@ err: return ret; } =20 -static void s390_pci_ioat_replay(S390PCIIOMMU *iommu) +static void s390_pci_ioat_replay(S390PCIBusDevice *pbdev) { - S390PCIBusDevice *pbdev =3D iommu->pbdev; S390IOTLBEntry entry; uint16_t error =3D 0; uint32_t dma_avail; hwaddr curr, end; + S390PCIIOMMU *iommu =3D pbdev->iommu; =20 curr =3D iommu->pba; end =3D iommu->pal; =20 - if (iommu->dm_mr || !pbdev) { + if (iommu->dm_mr) { /* If direct mapping is used, there are no guest tables to replay = */ return; } @@ -630,7 +631,7 @@ static void s390_pci_ioat_replay(S390PCIIOMMU *iommu) if (entry.perm !=3D IOMMU_NONE) { while (entry.iova < curr && entry.iova < end) { if (dma_avail > 0) { - dma_avail =3D s390_pci_update_iotlb(iommu, &entry); + dma_avail =3D s390_pci_update_iotlb(pbdev, &entry); } else { /* * There is no reliable method to request the guest to @@ -655,13 +656,13 @@ static void s390_pci_ioat_replay(S390PCIIOMMU *iommu) static void s390_pci_iommu_replay(IOMMUMemoryRegion *mr, IOMMUNotifier *notifier) { - S390PCIIOMMU *iommu =3D container_of(mr, S390PCIIOMMU, iommu_mr); + S390PCIBusDevice *pbdev =3D container_of(mr, S390PCIBusDevice, iommu_m= r); =20 /* * The notifier argument is not used directly; s390_pci_ioat_replay() * broadcasts via memory_region_notify_iommu() instead. */ - s390_pci_ioat_replay(iommu); + s390_pci_ioat_replay(pbdev); } =20 static S390PCIIOMMU *s390_pci_get_iommu(S390pciState *s, PCIBus *bus, @@ -783,19 +784,20 @@ static const MemoryRegionOps s390_msi_ctrl_ops =3D { .endianness =3D DEVICE_LITTLE_ENDIAN, }; =20 -void s390_pci_iommu_enable(S390PCIIOMMU *iommu) +void s390_pci_iommu_enable(S390PCIBusDevice *pbdev) { + S390PCIIOMMU *iommu =3D pbdev->iommu; /* * The iommu region is initialized against a 0-mapped address space, * so the smallest IOMMU region we can define runs from 0 to the end * of the PCI address space. */ char *name =3D g_strdup_printf("iommu-s390-%04x", iommu->pbdev->uid); - memory_region_init_iommu(&iommu->iommu_mr, sizeof(iommu->iommu_mr), + memory_region_init_iommu(&pbdev->iommu_mr, sizeof(pbdev->iommu_mr), TYPE_S390_IOMMU_MEMORY_REGION, OBJECT(&iommu-= >mr), name, iommu->pal + 1); iommu->enabled =3D true; - memory_region_add_subregion(&iommu->mr, 0, MEMORY_REGION(&iommu->iommu= _mr)); + memory_region_add_subregion(&iommu->mr, 0, MEMORY_REGION(&pbdev->iommu= _mr)); g_free(name); } =20 @@ -821,8 +823,9 @@ void s390_pci_iommu_direct_map_enable(S390PCIIOMMU *iom= mu) iommu->dm_mr); } =20 -void s390_pci_iommu_disable(S390PCIIOMMU *iommu) +void s390_pci_iommu_disable(S390PCIBusDevice *pbdev) { + S390PCIIOMMU *iommu =3D pbdev->iommu; iommu->enabled =3D false; g_hash_table_remove_all(iommu->iotlb); if (iommu->dm_mr) { @@ -832,8 +835,8 @@ void s390_pci_iommu_disable(S390PCIIOMMU *iommu) iommu->dm_mr =3D NULL; } else { memory_region_del_subregion(&iommu->mr, - MEMORY_REGION(&iommu->iommu_mr)); - object_unparent(OBJECT(&iommu->iommu_mr)); + MEMORY_REGION(&pbdev->iommu_mr)); + object_unparent(OBJECT(&pbdev->iommu_mr)); } } =20 @@ -1432,7 +1435,7 @@ static void s390_pcihost_reset(DeviceState *dev) pci_dereg_irqs(pbdev); } if (pbdev->iommu->enabled) { - pci_dereg_ioat(pbdev->iommu); + pci_dereg_ioat(pbdev); } pbdev->state =3D ZPCI_FS_STANDBY; s390_pci_perform_unplug(pbdev); @@ -1573,7 +1576,7 @@ static void s390_pci_device_reset(DeviceState *dev) pci_dereg_irqs(pbdev); } if (pbdev->iommu->enabled) { - pci_dereg_ioat(pbdev->iommu); + pci_dereg_ioat(pbdev); } =20 fmb_timer_free(pbdev); diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index c5d87aa615..50514d02a6 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -630,9 +630,10 @@ int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint= 8_t r2, uintptr_t ra) return 0; } =20 -uint32_t s390_pci_update_iotlb(S390PCIIOMMU *iommu, +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); IOMMUTLBEvent event =3D { .type =3D entry->perm ? IOMMU_NOTIFIER_MAP : IOMMU_NOTIFIER_UNMAP, @@ -663,7 +664,7 @@ uint32_t s390_pci_update_iotlb(S390PCIIOMMU *iommu, =20 event.type =3D IOMMU_NOTIFIER_UNMAP; event.entry.perm =3D IOMMU_NONE; - memory_region_notify_iommu(&iommu->iommu_mr, 0, event); + memory_region_notify_iommu(&pbdev->iommu_mr, 0, event); event.type =3D IOMMU_NOTIFIER_MAP; event.entry.perm =3D entry->perm; } else { @@ -683,13 +684,13 @@ uint32_t s390_pci_update_iotlb(S390PCIIOMMU *iommu, * All associated iotlb entries have already been cleared, trigger the * unmaps. */ - memory_region_notify_iommu(&iommu->iommu_mr, 0, event); + memory_region_notify_iommu(&pbdev->iommu_mr, 0, event); =20 out: return iommu->dma_limit ? iommu->dma_limit->avail : 1; } =20 -static void s390_pci_batch_unmap(S390PCIIOMMU *iommu, uint64_t iova, +static void s390_pci_batch_unmap(S390PCIBusDevice *pbdev, uint64_t iova, uint64_t len) { uint64_t remain =3D len, start =3D iova, end =3D start + len - 1, mask= , size; @@ -707,7 +708,7 @@ static void s390_pci_batch_unmap(S390PCIIOMMU *iommu, u= int64_t iova, size =3D mask + 1; event.entry.iova =3D start; event.entry.addr_mask =3D mask; - memory_region_notify_iommu(&iommu->iommu_mr, 0, event); + memory_region_notify_iommu(&pbdev->iommu_mr, 0, event); start +=3D size; remain -=3D size; } @@ -804,7 +805,7 @@ int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_= t r2, uintptr_t ra) coalesce +=3D entry.len; } else if (coalesce > 0) { /* Unleash the coalesced unmap before processing a new map */ - s390_pci_batch_unmap(iommu, iova, coalesce); + s390_pci_batch_unmap(pbdev, iova, coalesce); coalesce =3D 0; } =20 @@ -812,7 +813,7 @@ int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_= t r2, uintptr_t ra) start =3D QEMU_ALIGN_UP(start + 1, entry.len); while (entry.iova < start && entry.iova < end) { if (dma_avail > 0 || entry.perm =3D=3D IOMMU_NONE) { - dma_avail =3D s390_pci_update_iotlb(iommu, &entry); + dma_avail =3D s390_pci_update_iotlb(pbdev, &entry); entry.iova +=3D TARGET_PAGE_SIZE; entry.translated_addr +=3D TARGET_PAGE_SIZE; } else { @@ -828,7 +829,7 @@ int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_= t r2, uintptr_t ra) } if (coalesce) { /* Unleash the coalesced unmap before finishing rpcit */ - s390_pci_batch_unmap(iommu, iova, coalesce); + s390_pci_batch_unmap(pbdev, iova, coalesce); coalesce =3D 0; } if (again && dma_avail > 0) @@ -1079,7 +1080,7 @@ static int reg_ioat(CPUS390XState *env, S390PCIBusDev= ice *pbdev, ZpciFib fib, iommu->g_iota =3D g_iota; =20 if (t) { - s390_pci_iommu_enable(iommu); + s390_pci_iommu_enable(pbdev); } else { s390_pci_iommu_direct_map_enable(iommu); } @@ -1087,9 +1088,10 @@ static int reg_ioat(CPUS390XState *env, S390PCIBusDe= vice *pbdev, ZpciFib fib, return 0; } =20 -void pci_dereg_ioat(S390PCIIOMMU *iommu) +void pci_dereg_ioat(S390PCIBusDevice *pbdev) { - s390_pci_iommu_disable(iommu); + S390PCIIOMMU *iommu =3D pbdev->iommu; + s390_pci_iommu_disable(pbdev); iommu->pba =3D 0; iommu->pal =3D 0; iommu->g_iota =3D 0; @@ -1313,7 +1315,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uin= t64_t fiba, uint8_t ar, cc =3D ZPCI_PCI_LS_ERR; s390_set_status_code(env, r1, ZPCI_MOD_ST_SEQUENCE); } else { - pci_dereg_ioat(pbdev->iommu); + pci_dereg_ioat(pbdev); } break; case ZPCI_MOD_FC_REREG_IOAT: @@ -1324,7 +1326,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uin= t64_t fiba, uint8_t ar, cc =3D ZPCI_PCI_LS_ERR; s390_set_status_code(env, r1, ZPCI_MOD_ST_SEQUENCE); } else { - pci_dereg_ioat(pbdev->iommu); + pci_dereg_ioat(pbdev); if (reg_ioat(env, pbdev, fib, ra)) { cc =3D ZPCI_PCI_LS_ERR; s390_set_status_code(env, r1, ZPCI_MOD_ST_INSUF_RES); diff --git a/include/hw/s390x/s390-pci-bus.h b/include/hw/s390x/s390-pci-bu= s.h index a732ad652b..74f559deaf 100644 --- a/include/hw/s390x/s390-pci-bus.h +++ b/include/hw/s390x/s390-pci-bus.h @@ -277,7 +277,6 @@ struct S390PCIIOMMU { S390PCIBusDevice *pbdev; AddressSpace as; MemoryRegion mr; - IOMMUMemoryRegion iommu_mr; MemoryRegion *dm_mr; bool enabled; uint64_t g_iota; @@ -355,6 +354,7 @@ struct S390PCIBusDevice { S390MsixInfo msix; AdapterRoutes routes; S390PCIIOMMU *iommu; + IOMMUMemoryRegion iommu_mr; MemoryRegion msix_notify_mr; IndAddr *summary_ind; IndAddr *indicator; @@ -392,9 +392,9 @@ int pci_chsc_sei_nt2_have_event(void); void s390_pci_sclp_configure(SCCB *sccb); void s390_pci_sclp_deconfigure(SCCB *sccb); bool s390_pci_is_translation_enabled(uint64_t g_iota); -void s390_pci_iommu_enable(S390PCIIOMMU *iommu); +void s390_pci_iommu_enable(S390PCIBusDevice *pbdev); void s390_pci_iommu_direct_map_enable(S390PCIIOMMU *iommu); -void s390_pci_iommu_disable(S390PCIIOMMU *iommu); +void s390_pci_iommu_disable(S390PCIBusDevice *pbdev); void s390_pci_generate_error_event(uint16_t pec, uint32_t fh, uint32_t fid, uint64_t faddr, uint32_t e); uint16_t s390_guest_io_table_walk(uint64_t g_iota, hwaddr addr, diff --git a/include/hw/s390x/s390-pci-inst.h b/include/hw/s390x/s390-pci-i= nst.h index c782990e3b..38268c256e 100644 --- a/include/hw/s390x/s390-pci-inst.h +++ b/include/hw/s390x/s390-pci-inst.h @@ -99,7 +99,7 @@ typedef struct ZpciFib { } QEMU_PACKED ZpciFib; =20 int pci_dereg_irqs(S390PCIBusDevice *pbdev); -void pci_dereg_ioat(S390PCIIOMMU *iommu); +void pci_dereg_ioat(S390PCIBusDevice *pbdev); int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra); int pcilg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2, uintptr_t ra); int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2, uintptr_t ra= ); @@ -111,7 +111,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint6= 4_t fiba, uint8_t ar, int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t = ar, uintptr_t ra); void fmb_timer_free(S390PCIBusDevice *pbdev); -uint32_t s390_pci_update_iotlb(S390PCIIOMMU *iommu, S390IOTLBEntry *entry); +uint32_t s390_pci_update_iotlb(S390PCIBusDevice *pbdev, S390IOTLBEntry *en= try); =20 #define ZPCI_IO_BAR_MIN 0 #define ZPCI_IO_BAR_MAX 5 --=20 2.56.0 From nobody Thu Oct 22 19:24:52 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=1791570566; cv=none; d=zohomail.com; s=zohoarc; b=G+RXAlIMf+BJDPN6WsUKZun1y/JWhfl4OR94CThGoPVNeY9mtTD78L9gzCky71zU4BtlVjeXLnV/rOd8XERE1325Se112z0ahqpxeJxRP3sGYkcojj5eOWHRa71LTab9gDfBU1CFPqy1TVDGrMeBX4r7T/o80HdlWyKaAX8vAWA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791570566; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=27yIzJ88BlNfQtGowHvDle4zbV1oDjba31jt/1ZynH4=; b=jQt+nb5RK/k12Qjed8LS4IAfmwFw1OKCSlupXd8ytlKD/pWmhEnmYGURbdETuqTC2pE5ZAo0z8vsJ4HoY+n5Y9ytv5CtrzqpbC1g2uhrEi6SrGc6xngqD4StxB1Lj4jDON0rpkFW3FFQIDri5BgV4jXR5/LrjefRXLwa4MEZ3dg= 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 1791570566010809.8181972239782; Fri, 9 Oct 2026 11:29:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xFFKh-0000Pl-B9; Fri, 09 Oct 2026 14:28:39 -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 1xFFKf-0000OV-6A; Fri, 09 Oct 2026 14:28:37 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xFFKd-0001eH-Ce; Fri, 09 Oct 2026 14:28:36 -0400 Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 699Ha5Rn592884; Fri, 9 Oct 2026 18:28:34 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4h74tdg8av-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:34 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 699HN8iS1169766; Fri, 9 Oct 2026 18:28:33 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([172.16.1.74]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4h5s351wpk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:33 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 699ISWEM13828822 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Oct 2026 18:28:32 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6B26D5805A; Fri, 9 Oct 2026 18:28:32 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8BC0558054; Fri, 9 Oct 2026 18:28:31 +0000 (GMT) Received: from li-479af74c-31f9-11b2-a85c-e4ddee11713b.ibm.com.com (unknown [9.61.5.156]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 9 Oct 2026 18:28:31 +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=27yIzJ88BlNfQtGow HvDle4zbV1oDjba31jt/1ZynH4=; b=j4lJUxlxr8wepuufw+onepx51mTTJdJJI HHJrSy68ImdzS0duwFovepz1OCAYaiuDz4JknNwYP9hz7KvXerzdLRU8QloA9Qfu a2C+JX4IY/yric+PLO13m/CVi3hf7nWM6jzlwPI0zqwSdsqdt1WsrST1Q/D9pmXS XWIqTwHBbpahz0oNz4OmAk65yORUlLmG9CJ0lMq4hTyLYh8pGiT2eKnVqdMG5QYk f8gKkwuUs4lj6aWrgsqqQDsCEvRlkqqfJTn/Jftb+zWUZqHvjzS0Kvm06RdlQseV YPcKxVE5Fi1j68hN0vap6AdPns7db/xTv9D43EkY+fCRKMEM0qTxA== From: Eric Farman To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Matthew Rosato , Cornelia Huck , Konstantin Shkolnyy , Eric Farman Subject: [PULL 04/19] s390x/pci: Move dm_mr from S390PCIIOMMU to S390PCIBusDevice Date: Fri, 9 Oct 2026 14:28:10 -0400 Message-ID: <20261009182825.148054-5-farman@linux.ibm.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009182825.148054-1-farman@linux.ibm.com> References: <20261009182825.148054-1-farman@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX5E8KqHvJsU5M cw23bJxDdyc9kVwRROSLUkA9xWaFbjG4aHtTEVFXyuiFU13Z2n5chJdq/BHjVoPJkyPhpp4Ni04 emyGnqroJ0cc92uRZuEt5cXpq7W8tZO1Drp3GBGj1L4rZa8AYZCVs6sYjZ8piG8BnsLc69ai1q+ 8eq2KDH2YPgdHN1z2dbBMaeYNzFWWUSe/F7ex5MAcws4TPdzCKWKVcSzlPR5awn5xOYIndVkJ8R eVHl8qXMcP4mRoRJr27LR1xW+MjTNO8+vNRkOR9u04YXsf7SGua8s4GMk3eEwLvVdHv3VVE7/ZQ 7IeNVaKsS2KEQ3/+HgTo8ys56pkz9QhCV3Mh4f9lxo81wPCu5EjJEm5eE+vjtfoSBqE5Lnq2tze 0hEViPtrGJGYEicbSFkguatXHVa003JdjgApw/g55iMy1jZ3Bv7tUOFp+IdLQpsQAcJwoJJEp0V qhbyFSZUPxYZOzaUgdg== X-Authority-Analysis: v=2.4 cv=FqWQbGrq c=1 sm=1 tr=0 ts=6ac93252 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=660iZSQnnn4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=jDWEBKAz6ZLYevfwb9sA:9 X-Proofpoint-GUID: ASgU2g5N7sqKo34_Qa0x-CRsBiOjYu8J X-Proofpoint-Spam-Info: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX5YRfTYJgUyJZ tKxYZ2pwXsu8wX6EQKSblax+5XIHMlwyF+AEq9wQmkNoSQRr5UUU8wHTBVDAyK5kHJpgyMW8L7/ 4auMwOJDQ7FDkK+nX+X3nq25UjxKwZg= X-Proofpoint-ORIG-GUID: ASgU2g5N7sqKo34_Qa0x-CRsBiOjYu8J 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-10-09_05,2026-10-09_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 suspectscore=0 priorityscore=1501 impostorscore=0 adultscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610090072 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.158.5; envelope-from=farman@linux.ibm.com; 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, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=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.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: 1791570567242158500 Content-Type: text/plain; charset="utf-8" From: Konstantin Shkolnyy This field is only used when S390PCIBusDevice exists, so it can be moved there to simplify to simplify S390PCIIOMMU towards a structure that contains only the IOMMU container information needed by the PCI layer for a given slot. Reviewed-by: Farhan Ali Reviewed-by: Matthew Rosato Signed-off-by: Konstantin Shkolnyy Link: https://lore.kernel.org/qemu-devel/20261006001643.420929-5-kshk@linux= .ibm.com Signed-off-by: Eric Farman --- hw/s390x/s390-pci-bus.c | 21 +++++++++++---------- hw/s390x/s390-pci-inst.c | 2 +- include/hw/s390x/s390-pci-bus.h | 4 ++-- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index e709d6e478..99122716d7 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -605,7 +605,7 @@ static void s390_pci_ioat_replay(S390PCIBusDevice *pbde= v) curr =3D iommu->pba; end =3D iommu->pal; =20 - if (iommu->dm_mr) { + if (pbdev->dm_mr) { /* If direct mapping is used, there are no guest tables to replay = */ return; } @@ -801,8 +801,9 @@ void s390_pci_iommu_enable(S390PCIBusDevice *pbdev) g_free(name); } =20 -void s390_pci_iommu_direct_map_enable(S390PCIIOMMU *iommu) +void s390_pci_iommu_direct_map_enable(S390PCIBusDevice *pbdev) { + S390PCIIOMMU *iommu =3D pbdev->iommu; MachineState *ms =3D MACHINE(qdev_get_machine()); S390CcwMachineState *s390ms =3D S390_CCW_MACHINE(ms); =20 @@ -814,13 +815,13 @@ void s390_pci_iommu_direct_map_enable(S390PCIIOMMU *i= ommu) g_autofree char *name =3D g_strdup_printf("iommu-dm-s390-%04x", iommu->pbdev->uid); =20 - iommu->dm_mr =3D g_malloc0(sizeof(*iommu->dm_mr)); - memory_region_init_alias(iommu->dm_mr, OBJECT(&iommu->mr), name, + pbdev->dm_mr =3D g_malloc0(sizeof(*pbdev->dm_mr)); + memory_region_init_alias(pbdev->dm_mr, OBJECT(&iommu->mr), name, get_system_memory(), 0, s390_get_memory_limit(s390ms)); iommu->enabled =3D true; memory_region_add_subregion(&iommu->mr, iommu->pbdev->zpci_fn.sdma, - iommu->dm_mr); + pbdev->dm_mr); } =20 void s390_pci_iommu_disable(S390PCIBusDevice *pbdev) @@ -828,11 +829,11 @@ void s390_pci_iommu_disable(S390PCIBusDevice *pbdev) S390PCIIOMMU *iommu =3D pbdev->iommu; iommu->enabled =3D false; g_hash_table_remove_all(iommu->iotlb); - if (iommu->dm_mr) { - memory_region_del_subregion(&iommu->mr, iommu->dm_mr); - object_unparent(OBJECT(iommu->dm_mr)); - g_free(iommu->dm_mr); - iommu->dm_mr =3D NULL; + if (pbdev->dm_mr) { + memory_region_del_subregion(&iommu->mr, pbdev->dm_mr); + object_unparent(OBJECT(pbdev->dm_mr)); + g_free(pbdev->dm_mr); + pbdev->dm_mr =3D NULL; } else { memory_region_del_subregion(&iommu->mr, MEMORY_REGION(&pbdev->iommu_mr)); diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index 50514d02a6..f9907c7d5c 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -1082,7 +1082,7 @@ static int reg_ioat(CPUS390XState *env, S390PCIBusDev= ice *pbdev, ZpciFib fib, if (t) { s390_pci_iommu_enable(pbdev); } else { - s390_pci_iommu_direct_map_enable(iommu); + s390_pci_iommu_direct_map_enable(pbdev); } =20 return 0; diff --git a/include/hw/s390x/s390-pci-bus.h b/include/hw/s390x/s390-pci-bu= s.h index 74f559deaf..b74cc654bb 100644 --- a/include/hw/s390x/s390-pci-bus.h +++ b/include/hw/s390x/s390-pci-bus.h @@ -277,7 +277,6 @@ struct S390PCIIOMMU { S390PCIBusDevice *pbdev; AddressSpace as; MemoryRegion mr; - MemoryRegion *dm_mr; bool enabled; uint64_t g_iota; uint64_t pba; @@ -355,6 +354,7 @@ struct S390PCIBusDevice { AdapterRoutes routes; S390PCIIOMMU *iommu; IOMMUMemoryRegion iommu_mr; + MemoryRegion *dm_mr; MemoryRegion msix_notify_mr; IndAddr *summary_ind; IndAddr *indicator; @@ -393,7 +393,7 @@ void s390_pci_sclp_configure(SCCB *sccb); void s390_pci_sclp_deconfigure(SCCB *sccb); bool s390_pci_is_translation_enabled(uint64_t g_iota); void s390_pci_iommu_enable(S390PCIBusDevice *pbdev); -void s390_pci_iommu_direct_map_enable(S390PCIIOMMU *iommu); +void s390_pci_iommu_direct_map_enable(S390PCIBusDevice *pbdev); void s390_pci_iommu_disable(S390PCIBusDevice *pbdev); void s390_pci_generate_error_event(uint16_t pec, uint32_t fh, uint32_t fid, uint64_t faddr, uint32_t e); --=20 2.56.0 From nobody Thu Oct 22 19:24:52 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=1791570610; cv=none; d=zohomail.com; s=zohoarc; b=WEcp++PyxVWXzOs6l9BqzxVveW0eGe+xIEuMA4fPWJ0pZJ1XDGdj/2CPk2Z/rWmoFs8JM8jDDqu4UVRfhOVlS4wpya8SxAA+WEi4V4ST6xyb3BgncUFr7TtbWZBiqqD7m333bUVcNp3/TA2GR9WaMG/u4aKLn51wj1fn5w1sfLw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791570610; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=g0emPIDev7MT/RW2fUVWfHMFPYTYIbo196HZQZNFaS8=; b=VUj+LleRi9dfKz/vj04qVjJo1qVAqVrrIHdXTd3SCNe8Iu0G9OQnW16aqToIWcu+uC+IkwzLDfQ3mhXi+YR3NX87eabRfkmJbs+/ST1UXk0QPbzsH4dr5M/FHup7nYgtEnDkGdGX31Pb5u08D4bHYVkOBlbCnyEok4CgfHptWCs= 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 1791570610498463.5418614712165; Fri, 9 Oct 2026 11:30:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xFFKi-0000RN-W7; Fri, 09 Oct 2026 14:28:41 -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 1xFFKh-0000Pm-Dd; Fri, 09 Oct 2026 14:28:39 -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 1xFFKf-0001el-JA; Fri, 09 Oct 2026 14:28:39 -0400 Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 699Ha2at699195; Fri, 9 Oct 2026 18:28:35 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4h74ter8qc-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:35 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 699H8Him1204276; Fri, 9 Oct 2026 18:28:34 GMT Received: from smtprelay03.dal12v.mail.ibm.com ([172.16.1.5]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4h6x1y9rxw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:34 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay03.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 699ISXBs5440182 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Oct 2026 18:28:34 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BCA9A5805A; Fri, 9 Oct 2026 18:28:33 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9DFB95805D; Fri, 9 Oct 2026 18:28:32 +0000 (GMT) Received: from li-479af74c-31f9-11b2-a85c-e4ddee11713b.ibm.com.com (unknown [9.61.5.156]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 9 Oct 2026 18:28:32 +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=g0emPIDev7MT/RW2f UVWfHMFPYTYIbo196HZQZNFaS8=; b=LqPBMBmKw16X/+/39+baxycYD4JcYo1Da u3FnPMdnngdRNoAXI83cnHYmyGYjdFOLqWNhHcclNZW7W9LyWwufS9LmNjmoKM6b Yo+HHe4bjMl8WuRnagZefY83NSIrc/h8Cfz73CFjC5xz0OG/D6WlDsvBntGZpMyi VaCtLkhaXcCFCSNWdfdBJ4treHATg5xTvPd3Aw7WCzqmDVxJBVztOdqRfRVAiOVD Bib1sd7z6R1wPQsp0TS8lGlQ66TzLyWrfJ9jWF7+OHjp2AZmHjqbZD7w1vpH9qLK Gjb2Y/nVipq742fKGAihfjPbr8pjdm1fmbxOEHuF/x5Z7plIQpjtQ== From: Eric Farman To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Matthew Rosato , Cornelia Huck , Konstantin Shkolnyy , Eric Farman Subject: [PULL 05/19] s390x/pci: Move iotlb from S390PCIIOMMU to S390PCIBusDevice Date: Fri, 9 Oct 2026 14:28:11 -0400 Message-ID: <20261009182825.148054-6-farman@linux.ibm.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009182825.148054-1-farman@linux.ibm.com> References: <20261009182825.148054-1-farman@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Info: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX8L6X038LGWiI j6LyWmL3Lb0cH4+WRtIeYkFQ4XxIhPAnYYw4Q07ZG9elTQOi9jMwvfjjAmFwamfPQ1LTnAMkVR4 dcDSMTdAPghlbalcIuQhWSbadwEs7bs= X-Proofpoint-GUID: mYnEq_Y1BN2ii5SrFDxlpeRjYtSiF6Ly X-Authority-Analysis: v=2.4 cv=P42vFSAu c=1 sm=1 tr=0 ts=6ac93253 cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=660iZSQnnn4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=aa0cxrGLn-JNQd9UaooA:9 X-Proofpoint-ORIG-GUID: mYnEq_Y1BN2ii5SrFDxlpeRjYtSiF6Ly X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX1dLBNWZYWH5n 0IU1AjSopbP8j6r0FCP4TMWlA/nujtONNaMQQmTkTjUGuL5FqEqMz8dffPK69E5uvt7ZTjvxLr8 IVGBfuur2HgArOY7XzhSPIc9ScGWFMGFXE/0CfaePuylPVjDn8QXJxUph0rTjoVHGF5cWtyPq2+ CPhlWdsE8KfpIGRDQPREoXiTMTbbShFvIoBL1J6GmDiuRmv2nOoJ7d0E5B/HlwRvk+x2/AdlgCk ky+g8vhIA5zaUOQ0dB4z/EOgOT9NlgbsQXv4cQS4D6g7ocWlkugb+WoRGzOT1HEEbMAnXuxEFaF zrhMxs8XRkdxiWD58hNfFLTwAa1y5oIRMK3gvr6LbEjIY3urmyzghAgw7qrhiFhSnvF3NpujahC hg7UL6RyCRkB/cDkFmzkSiAtpjXpGlwgK49f/OlArs+Q8jM+FQ41IBsroj2mvR4GBmqvITwmquz Lg8UpyHgKQILkfkbtJA== 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-10-09_05,2026-10-09_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 suspectscore=0 spamscore=0 phishscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 impostorscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610090072 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=farman@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.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.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: 1791570612034158500 Content-Type: text/plain; charset="utf-8" From: Konstantin Shkolnyy This field is only used when S390PCIBusDevice exists, so it can be moved there to simplify S390PCIIOMMU towards a structure that contains only the IOMMU container information needed by the PCI layer for a given slot. Reviewed-by: Farhan Ali Reviewed-by: Matthew Rosato Signed-off-by: Konstantin Shkolnyy Link: https://lore.kernel.org/qemu-devel/20261006001643.420929-6-kshk@linux= .ibm.com Signed-off-by: Eric Farman --- 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 99122716d7..850b4452a5 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; @@ -692,8 +692,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); @@ -828,7 +826,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)); @@ -852,7 +850,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 @@ -1274,6 +1271,8 @@ static void s390_pcihost_plug(const HotplugHandler *h= otplug_dev, DeviceState *de /* 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 { @@ -1316,6 +1315,7 @@ static void s390_pcihost_unplug(const HotplugHandler = *hotplug_dev, DeviceState * 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 f9907c7d5c..30114abd43 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; @@ -677,7 +677,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); } =20 /* diff --git a/include/hw/s390x/s390-pci-bus.h b/include/hw/s390x/s390-pci-bu= s.h index b74cc654bb..7fbe80be16 100644 --- a/include/hw/s390x/s390-pci-bus.h +++ b/include/hw/s390x/s390-pci-bus.h @@ -282,7 +282,6 @@ struct S390PCIIOMMU { uint64_t pba; uint64_t pal; uint64_t max_dma_limit; - GHashTable *iotlb; S390PCIDMACount *dma_limit; }; =20 @@ -355,6 +354,7 @@ struct S390PCIBusDevice { S390PCIIOMMU *iommu; IOMMUMemoryRegion iommu_mr; MemoryRegion *dm_mr; + GHashTable *iotlb; MemoryRegion msix_notify_mr; IndAddr *summary_ind; IndAddr *indicator; --=20 2.56.0 From nobody Thu Oct 22 19:24:52 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=1791570662; cv=none; d=zohomail.com; s=zohoarc; b=jlbNG0M/gThk/yHGhBB10ADwSbfdy6YuP9nXWGmTq+YTWWGGYy63z7XLp1ENo8yrAz38qNDrNFF1VUtsk/T3D8C5EZpOo0z+mnKSBRhxJiSOlYZVCGFcd6+JuWn0Y2BTAmZF9ohExxieFdtgpE8KlrRzf0LM8FOjBCH3IrEdTFM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791570662; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=spS0XqtG3/bUtgMt/EPmwS6izUlApmCoMAwQSt1bbIk=; b=DzB+xUivf7HEW3JEShfJ54PptNF45PI9UPKjGmNK3d3cGuLUu83h33nS6srnjPYLlfgyy50lkBh5SKAV5vpBzF/ILEavZJi4ukQtCSch5o5eFbhs5bcZTN9K1zZevmYeXa1gT910WUiMQTQ59+wnbTHJvRJ8F89Oxj1emcWzfsQ= 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 1791570661993624.3639124708843; Fri, 9 Oct 2026 11:31:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xFFKl-0000T1-JW; Fri, 09 Oct 2026 14:28:43 -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 1xFFKi-0000RC-SS; Fri, 09 Oct 2026 14:28:40 -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 1xFFKh-0001f5-0K; Fri, 09 Oct 2026 14:28:40 -0400 Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 699HZq1n3128292; Fri, 9 Oct 2026 18:28:37 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 4h74tcg8kc-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:37 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 699H8Edx1142913; Fri, 9 Oct 2026 18:28:36 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4h6udd2axn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:36 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 699ISYKj20644364 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Oct 2026 18:28:35 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CD69E58062; Fri, 9 Oct 2026 18:28:34 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EF0F15805C; Fri, 9 Oct 2026 18:28:33 +0000 (GMT) Received: from li-479af74c-31f9-11b2-a85c-e4ddee11713b.ibm.com.com (unknown [9.61.5.156]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 9 Oct 2026 18:28:33 +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=spS0XqtG3/bUtgMt/ EPmwS6izUlApmCoMAwQSt1bbIk=; b=X9sftSDwuVq6N0aQ+5Dw2Kr7W6AT7mcv5 CjgURePTwZOrgrg4QoYO3ue58J/5Y4ILVhbVzV9+rLA9jf633ImafOnq1uYh8LJW Z3TVHDyu4WzPkfa2xxudJAdq9V/gDB0f79R7kuN5Pd05keSRXajkLta3fbYlaZSP i7ngFuamBpMqaYY08qYS4diccuYRcppBWRh2wCF8mBsetf8iqbn/aJeET0ZBCTut ij+I1q49vcPToLK8GDla9CSaYjLMg4VOII2qY0B2HIFQcca/Ri8tBEfi72wW9hLI 3vTa3FcfCxQSHU2h4ngQmVmqwIT2OO3qDhZA8TMkdqJfX/fu52oMA== From: Eric Farman To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Matthew Rosato , Cornelia Huck , Konstantin Shkolnyy , Eric Farman Subject: [PULL 06/19] s390x/pci: Remove a ptr to S390PCIBusDevice from S390PCIIOMMU Date: Fri, 9 Oct 2026 14:28:12 -0400 Message-ID: <20261009182825.148054-7-farman@linux.ibm.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009182825.148054-1-farman@linux.ibm.com> References: <20261009182825.148054-1-farman@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfXw4Ye5SJAIIIj uG83Sj4cmBSIhIlaO/YOqlBIWgYglgu/l8HRqJNpeqkqltnJdSw22bf2k6c3lb4YbIo/0agw0H+ zzjpxeB1iCCAGyrWV+nyERkLIbSwOK5mJ6MV6zKF8TVOEXj23DxYDGTL7kCUE4mBkckNsSmzQyj ZT8u4THUlShrID/DKcHTvxTxHFxsbyLp/QaGBWmaKoQ3FxNHn07AqWYvnJDdEk/B6Baqr99ZiUF jmPXG3RPl2e3FH+NZqtLBrh6g86FkIMpluNFm/dvXKWM4cTr8MV3TKR6RnZdpFEXf3msOezen2v kFEnyQF0L1wAE6XPTYWR6zbu/zMx2U3t2SbzQC9IoLv6NicKzB4m7+5t62tWhayKzzIFlNhcJrL NjTTkasr4AOFrLHIHPrF14nhwGBdgLrgSmixA/Hz6uQ1mpNXBSKAuFhC/HjBatKlD0PIrmpaXPv ax8+jzc3sk9mQinvSfg== X-Proofpoint-Spam-Info: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX4xek4E92zWqQ 5QGtUjytAfAQY6OfFLatmfcPzhkMi89qYKTgoACwAYrVn4rFlBxe9hJKInsRnt6XwnOH/gTMvpf 6IXqFSdMI3FmzEj5OtfDtaVSNhH4U5I= X-Proofpoint-GUID: CE9EfyqDEkU0mmq73wmVf563-6dc-1sP X-Proofpoint-ORIG-GUID: CE9EfyqDEkU0mmq73wmVf563-6dc-1sP X-Authority-Analysis: v=2.4 cv=Yu+a1IYX c=1 sm=1 tr=0 ts=6ac93255 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=660iZSQnnn4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=yINFAIt2aqTEABBYJGoA:9 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-10-09_05,2026-10-09_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 phishscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610090072 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=farman@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.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.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: 1791570663118158501 Content-Type: text/plain; charset="utf-8" From: Konstantin Shkolnyy This pointer is no longer used, after fields were moved from S390PCIIOMMU to S390PCIBusDevice. Reviewed-by: Farhan Ali Reviewed-by: Matthew Rosato Signed-off-by: Konstantin Shkolnyy Link: https://lore.kernel.org/qemu-devel/20261006001643.420929-7-kshk@linux= .ibm.com Signed-off-by: Eric Farman --- hw/s390x/s390-pci-bus.c | 15 +++++++-------- include/hw/s390x/s390-pci-bus.h | 1 - 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 850b4452a5..d74d0c4925 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -552,7 +552,7 @@ static IOMMUTLBEntry s390_translate_iommu(IOMMUMemoryRe= gion *mr, hwaddr addr, .perm =3D IOMMU_NONE, }; =20 - switch (iommu->pbdev->state) { + switch (pbdev->state) { case ZPCI_FS_ENABLED: case ZPCI_FS_BLOCKED: if (!iommu->enabled) { @@ -587,9 +587,9 @@ static IOMMUTLBEntry s390_translate_iommu(IOMMUMemoryRe= gion *mr, hwaddr addr, } err: if (error) { - iommu->pbdev->state =3D ZPCI_FS_ERROR; - s390_pci_generate_error_event(error, iommu->pbdev->fh, - iommu->pbdev->fid, addr, 0); + pbdev->state =3D ZPCI_FS_ERROR; + s390_pci_generate_error_event(error, pbdev->fh, + pbdev->fid, addr, 0); } return ret; } @@ -790,7 +790,7 @@ void s390_pci_iommu_enable(S390PCIBusDevice *pbdev) * so the smallest IOMMU region we can define runs from 0 to the end * of the PCI address space. */ - char *name =3D g_strdup_printf("iommu-s390-%04x", iommu->pbdev->uid); + char *name =3D g_strdup_printf("iommu-s390-%04x", pbdev->uid); memory_region_init_iommu(&pbdev->iommu_mr, sizeof(pbdev->iommu_mr), TYPE_S390_IOMMU_MEMORY_REGION, OBJECT(&iommu-= >mr), name, iommu->pal + 1); @@ -811,14 +811,14 @@ void s390_pci_iommu_direct_map_enable(S390PCIBusDevic= e *pbdev) * IOVA X + SDMA. VFIO will handle pinning via its memory listener. */ g_autofree char *name =3D g_strdup_printf("iommu-dm-s390-%04x", - iommu->pbdev->uid); + pbdev->uid); =20 pbdev->dm_mr =3D g_malloc0(sizeof(*pbdev->dm_mr)); memory_region_init_alias(pbdev->dm_mr, OBJECT(&iommu->mr), name, get_system_memory(), 0, s390_get_memory_limit(s390ms)); iommu->enabled =3D true; - memory_region_add_subregion(&iommu->mr, iommu->pbdev->zpci_fn.sdma, + memory_region_add_subregion(&iommu->mr, pbdev->zpci_fn.sdma, pbdev->dm_mr); } =20 @@ -1210,7 +1210,6 @@ static void s390_pcihost_plug(const HotplugHandler *h= otplug_dev, DeviceState *de =20 pbdev->pdev =3D pdev; pbdev->iommu =3D s390_pci_get_iommu(s, pci_get_bus(pdev), pdev->de= vfn); - pbdev->iommu->pbdev =3D pbdev; pbdev->state =3D ZPCI_FS_DISABLED; set_pbdev_info(pbdev); =20 diff --git a/include/hw/s390x/s390-pci-bus.h b/include/hw/s390x/s390-pci-bu= s.h index 7fbe80be16..d67daeb34d 100644 --- a/include/hw/s390x/s390-pci-bus.h +++ b/include/hw/s390x/s390-pci-bus.h @@ -274,7 +274,6 @@ typedef struct S390PCIDMACount { =20 struct S390PCIIOMMU { Object parent_obj; - S390PCIBusDevice *pbdev; AddressSpace as; MemoryRegion mr; bool enabled; --=20 2.56.0 From nobody Thu Oct 22 19:24:52 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=1791570626; cv=none; d=zohomail.com; s=zohoarc; b=P0judJM17CKUxIVEqGQvl2WQKYiNT/ETuH7VySnF4Hti4oGcjjyA722AyD2nlwGCdufwPUoXN6dCsT631IdI0zSVCfCL4EcqCbdan7OvUeGy0RU8Vl0hEoBcttQduTSnP5M57o4BrTSv9dJKkUNK6k/dE9fb75VF1j/Gyk6FIiE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791570626; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/R1jV4bvhICiNXxcxu5gq03iIy7JoIeiYQZy5TolR+Y=; b=j2/nBVy1hPDTmUpFGS8tX9Lrs3jV+hdjG+77g8lUOHO7ASy8f4UOuM5oi1IaUw2CQaR6Gx2VeTBKEBXxqqFGXsuk2U0fqE8E3sw4q3ANyvBpeiI9WLPTAlAXOBTvC4qn/2rSULgoQwTTWwxqhlLoUigKSGgSeqcRH6MsgL3l0YY= 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 1791570626429333.67911978631014; Fri, 9 Oct 2026 11:30:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xFFKl-0000Ss-0N; Fri, 09 Oct 2026 14:28:43 -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 1xFFKj-0000SD-BR; Fri, 09 Oct 2026 14:28:41 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xFFKh-0001fA-DK; Fri, 09 Oct 2026 14:28:41 -0400 Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 699HZtUe592640; Fri, 9 Oct 2026 18:28:38 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4h74tdg8b1-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:38 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 699H8OsO1207063; Fri, 9 Oct 2026 18:28:37 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([172.16.1.8]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4h6hsnm7nn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:37 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 699ISaej12387062 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Oct 2026 18:28:36 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 049C25805D; Fri, 9 Oct 2026 18:28:36 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0B8885805A; Fri, 9 Oct 2026 18:28:35 +0000 (GMT) Received: from li-479af74c-31f9-11b2-a85c-e4ddee11713b.ibm.com.com (unknown [9.61.5.156]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 9 Oct 2026 18:28:34 +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=/R1jV4bvhICiNXxcx u5gq03iIy7JoIeiYQZy5TolR+Y=; b=OylqPIM4CVkQVQsBOa/w/zq7kk+JXYQ6l K2UDHdhAiXd3ryaTvkUASJR6cy+hjnZcV2QzGFINC6zfybgkCLyduV/SQ8Y0l1nE dWJoFyaF+I+qUuQpUpgq+BKt4Zerp8M6dfJJ3NIHPXNgctHpjvGG1giP4wZQ3RG9 gT2HoeQVgsaL+Thor7H5aup+uQw88dCsl7Pl62pAr8hPNhPGZq/9IdyQHjAPnHUe MJK1VlMOFUzEId4nYK6QD3rHp6v6ok/MHpS/oOcNly+a7f9hm6EZpWoUE0/fXF0b 2okJPbADxTYi8wCEb+bJWJR+E4oLn1f/byL8xCUiiUpAWkmyWCj8g== From: Eric Farman To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Matthew Rosato , Cornelia Huck , Konstantin Shkolnyy , Eric Farman Subject: [PULL 07/19] s390x/pci: Move/rename enabled from S390PCIIOMMU to S390PCIBusDevice Date: Fri, 9 Oct 2026 14:28:13 -0400 Message-ID: <20261009182825.148054-8-farman@linux.ibm.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009182825.148054-1-farman@linux.ibm.com> References: <20261009182825.148054-1-farman@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX3I3DTTSxPhT1 V8c4qyqguAEx5xi9PbX1Nl2lHXF4DMWfTjju4V9VGxZCn4pcUBUzaBx2aRRhtTlueeIR3YuUFV9 BACDtNykaBLu4bo7hKMYBZ9AvkVi1kwo/A7O0IQ4XuTyOE6rwaAPYWbzEhrc+tIkG0xG721rcCa TKwF7e2cX1sI9TAI0HK4nXabSEKbPa26Xv2mrQUEMndYqNdj/3crWuCQ1I5ZlzZNheLfO/DGBhg dcCsCEti/UtbyV6FhfuXGbhb83EDnyk2EOq3A8afcb/Y5jfZbgE6RmweCEiSuxuXJZB800G8OBa i7ay6DL2nwxee6P9tY+KSCpetbjlNCe62hVYp1uhXHF9SdrsYljhwi1K3D9Ex+RJx+ISsMxaoBJ D2p0uRQnR7OJQQ2tS/u2IeYMlw0KIxgaFCN/lfqsk46Xg2b1fLqjBIQUxECPaOUKxX0eR3dTL71 1YP+fXU121olKFUmjMw== X-Authority-Analysis: v=2.4 cv=FqWQbGrq c=1 sm=1 tr=0 ts=6ac93256 cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=660iZSQnnn4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=i0DCopz73FH-yKe2uwYA:9 X-Proofpoint-GUID: s0zYXpoLDsFYTPHVfSAUG1U9Y-IHBYbh X-Proofpoint-Spam-Info: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfXy4F1U+Q+GidC LNxNKYGBWsP2OzV7QEQk/EP9TFfu/1KMU0bASA71SNyKm+ZTnTMr+Z684jguv8lWorQ4KE6w0V1 tDa6sJHgREQObbia7hDfjrVYXzdh+5A= X-Proofpoint-ORIG-GUID: s0zYXpoLDsFYTPHVfSAUG1U9Y-IHBYbh 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-10-09_05,2026-10-09_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 suspectscore=0 priorityscore=1501 impostorscore=0 adultscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610090072 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.158.5; envelope-from=farman@linux.ibm.com; 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, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=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.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: 1791570628377158500 Content-Type: text/plain; charset="utf-8" From: Konstantin Shkolnyy This field is only used when S390PCIBusDevice exists, so it can be moved there to simplify S390PCIIOMMU towards a structure that contains only the I= OMMU container information needed by the PCI layer for a given slot. This also allows to save/restore this field during migration. Reviewed-by: Farhan Ali Reviewed-by: Matthew Rosato Signed-off-by: Konstantin Shkolnyy Link: https://lore.kernel.org/qemu-devel/20261006001643.420929-8-kshk@linux= .ibm.com Signed-off-by: Eric Farman --- hw/s390x/s390-pci-bus.c | 14 +++++++------- hw/s390x/s390-pci-inst.c | 8 ++++---- include/hw/s390x/s390-pci-bus.h | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index d74d0c4925..3a071eab54 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -206,7 +206,7 @@ void s390_pci_sclp_deconfigure(SCCB *sccb) } else if (pbdev->summary_ind) { pci_dereg_irqs(pbdev); } - if (pbdev->iommu->enabled) { + if (pbdev->iommu_enabled) { pci_dereg_ioat(pbdev); } pbdev->state =3D ZPCI_FS_STANDBY; @@ -555,7 +555,7 @@ static IOMMUTLBEntry s390_translate_iommu(IOMMUMemoryRe= gion *mr, hwaddr addr, switch (pbdev->state) { case ZPCI_FS_ENABLED: case ZPCI_FS_BLOCKED: - if (!iommu->enabled) { + if (!pbdev->iommu_enabled) { return ret; } break; @@ -794,7 +794,7 @@ void s390_pci_iommu_enable(S390PCIBusDevice *pbdev) memory_region_init_iommu(&pbdev->iommu_mr, sizeof(pbdev->iommu_mr), TYPE_S390_IOMMU_MEMORY_REGION, OBJECT(&iommu-= >mr), name, iommu->pal + 1); - iommu->enabled =3D true; + pbdev->iommu_enabled =3D true; memory_region_add_subregion(&iommu->mr, 0, MEMORY_REGION(&pbdev->iommu= _mr)); g_free(name); } @@ -817,7 +817,7 @@ void s390_pci_iommu_direct_map_enable(S390PCIBusDevice = *pbdev) memory_region_init_alias(pbdev->dm_mr, OBJECT(&iommu->mr), name, get_system_memory(), 0, s390_get_memory_limit(s390ms)); - iommu->enabled =3D true; + pbdev->iommu_enabled =3D true; memory_region_add_subregion(&iommu->mr, pbdev->zpci_fn.sdma, pbdev->dm_mr); } @@ -825,7 +825,7 @@ void s390_pci_iommu_direct_map_enable(S390PCIBusDevice = *pbdev) void s390_pci_iommu_disable(S390PCIBusDevice *pbdev) { S390PCIIOMMU *iommu =3D pbdev->iommu; - iommu->enabled =3D false; + pbdev->iommu_enabled =3D false; g_hash_table_remove_all(pbdev->iotlb); if (pbdev->dm_mr) { memory_region_del_subregion(&iommu->mr, pbdev->dm_mr); @@ -1434,7 +1434,7 @@ static void s390_pcihost_reset(DeviceState *dev) } else if (pbdev->summary_ind) { pci_dereg_irqs(pbdev); } - if (pbdev->iommu->enabled) { + if (pbdev->iommu_enabled) { pci_dereg_ioat(pbdev); } pbdev->state =3D ZPCI_FS_STANDBY; @@ -1575,7 +1575,7 @@ static void s390_pci_device_reset(DeviceState *dev) } else if (pbdev->summary_ind) { pci_dereg_irqs(pbdev); } - if (pbdev->iommu->enabled) { + if (pbdev->iommu_enabled) { pci_dereg_ioat(pbdev); } =20 diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index 30114abd43..c1d9be232a 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -1299,7 +1299,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uin= t64_t fiba, uint8_t ar, if (dmaas !=3D 0) { cc =3D ZPCI_PCI_LS_ERR; s390_set_status_code(env, r1, ZPCI_MOD_ST_DMAAS_INVAL); - } else if (pbdev->iommu->enabled) { + } else if (pbdev->iommu_enabled) { cc =3D ZPCI_PCI_LS_ERR; s390_set_status_code(env, r1, ZPCI_MOD_ST_SEQUENCE); } else if (reg_ioat(env, pbdev, fib, ra)) { @@ -1311,7 +1311,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uin= t64_t fiba, uint8_t ar, if (dmaas !=3D 0) { cc =3D ZPCI_PCI_LS_ERR; s390_set_status_code(env, r1, ZPCI_MOD_ST_DMAAS_INVAL); - } else if (!pbdev->iommu->enabled) { + } else if (!pbdev->iommu_enabled) { cc =3D ZPCI_PCI_LS_ERR; s390_set_status_code(env, r1, ZPCI_MOD_ST_SEQUENCE); } else { @@ -1322,7 +1322,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uin= t64_t fiba, uint8_t ar, if (dmaas !=3D 0) { cc =3D ZPCI_PCI_LS_ERR; s390_set_status_code(env, r1, ZPCI_MOD_ST_DMAAS_INVAL); - } else if (!pbdev->iommu->enabled) { + } else if (!pbdev->iommu_enabled) { cc =3D ZPCI_PCI_LS_ERR; s390_set_status_code(env, r1, ZPCI_MOD_ST_SEQUENCE); } else { @@ -1452,7 +1452,7 @@ int stpcifc_service_call(S390CPU *cpu, uint8_t r1, ui= nt64_t fiba, uint8_t ar, /* fallthrough */ case ZPCI_FS_ENABLED: fib.fc |=3D 0x80; - if (pbdev->iommu->enabled) { + if (pbdev->iommu_enabled) { fib.fc |=3D 0x10; } if (!(fh & FH_MASK_ENABLE)) { diff --git a/include/hw/s390x/s390-pci-bus.h b/include/hw/s390x/s390-pci-bu= s.h index d67daeb34d..b851295b44 100644 --- a/include/hw/s390x/s390-pci-bus.h +++ b/include/hw/s390x/s390-pci-bus.h @@ -276,7 +276,6 @@ struct S390PCIIOMMU { Object parent_obj; AddressSpace as; MemoryRegion mr; - bool enabled; uint64_t g_iota; uint64_t pba; uint64_t pal; @@ -351,6 +350,7 @@ struct S390PCIBusDevice { S390MsixInfo msix; AdapterRoutes routes; S390PCIIOMMU *iommu; + bool iommu_enabled; IOMMUMemoryRegion iommu_mr; MemoryRegion *dm_mr; GHashTable *iotlb; --=20 2.56.0 From nobody Thu Oct 22 19:24:52 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=1791570823; cv=none; d=zohomail.com; s=zohoarc; b=D2Fiop+5lpm2DS8yviMHgocDRebBwwVgtiYuDDFnUzmtGRbunoG2q9YQHYg/lqtjrQnFaNfiH8ZXZM0asQFo+xz2LnJ0wyJ0Dk9QD7S9VyDnn4i7EHnqdNp/sep4Ei9KKC/0ADljFuTgVzgDcQHI2vyr8OXeLHm9sOCSPoWxAUc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791570823; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=EsmBvIb9MfaQGLiwIbqUiWOxkiWhmdQMxm0c8YSMkws=; b=YNQXAzBKzHlPBOCt9zhBTU202o25LRxcUlBMlnzm7vNfMkoSY+c4Hpa8SHyRb6+scrmfMspCoF67j/dIM2RsXY7Ru9vLxRvvs10V2cTUOroORL6LjbGPSwUj+uhsVw7/HzmokCW/tdWgGQa97z2AxbGLsNggdb7YGDJeYTf6lDY= 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 1791570823664719.434679781051; Fri, 9 Oct 2026 11:33:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xFFKn-0000VY-4L; Fri, 09 Oct 2026 14:28:45 -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 1xFFKl-0000Sx-FC; Fri, 09 Oct 2026 14:28:43 -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 1xFFKj-0001fQ-Fa; Fri, 09 Oct 2026 14:28:43 -0400 Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 699Ha2wL699175; Fri, 9 Oct 2026 18:28:40 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4h74ter8qj-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:39 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 699HNAB41169800; Fri, 9 Oct 2026 18:28:38 GMT Received: from smtprelay07.dal12v.mail.ibm.com ([172.16.1.9]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4h5s351wpt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:38 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay07.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 699ISbCO6816460 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Oct 2026 18:28:37 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4AF4F58054; Fri, 9 Oct 2026 18:28:37 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 458075805A; Fri, 9 Oct 2026 18:28:36 +0000 (GMT) Received: from li-479af74c-31f9-11b2-a85c-e4ddee11713b.ibm.com.com (unknown [9.61.5.156]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 9 Oct 2026 18:28:36 +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=EsmBvIb9MfaQGLiwI bqUiWOxkiWhmdQMxm0c8YSMkws=; b=GjAWXZuP5i9XkOieyO3lZU9YkOVsDBVvi VQfL/+D4ttWW5wSWGgXBsUU0XQj8K0+aJ77JCW+EPf7+h7YfkYwXYjuFoMfeo3e9 LmmXtaheoiSIM92EXqpw5TZHStnsooTEdPiyEZFj6qGj7m3H49q28fy/Zt6XokMZ OvY3FlCPfeDhW9eWK9r+uByHtuxqFl+Yzrd/RUj6I047wPvHhB4tnkxuTpBPryo/ UuAnIKxtNgYN36/U+on/D+x7oviXtpkQ2pf1eU2v2niQ/pbZW4OcT3Y/6NjEHl0m rL78ArdEvSeqjb8qQb7Hbhrotko3MQlThzCzDG0F8PwVWJh1l4Ghw== From: Eric Farman To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Matthew Rosato , Cornelia Huck , Konstantin Shkolnyy , Eric Farman Subject: [PULL 08/19] s390x/pci: Move dma_limit from S390PCIIOMMU to S390PCIBusDevice Date: Fri, 9 Oct 2026 14:28:14 -0400 Message-ID: <20261009182825.148054-9-farman@linux.ibm.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009182825.148054-1-farman@linux.ibm.com> References: <20261009182825.148054-1-farman@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Info: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfXzLjzh+xzYUiU wGarTmme5griBziXbmkCuo/Yb42O8sAO9MJaaM8nmo+WrLHhCtWkhhRQyvtiaue+zchhhAmHJXD wz4pGeBuvPUE+Qm4W/A01UEY+c7FQX0= X-Proofpoint-GUID: -gB1BCtKLmeX0mYS5uDMYpJrG-13TIL1 X-Authority-Analysis: v=2.4 cv=P42vFSAu c=1 sm=1 tr=0 ts=6ac93257 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=660iZSQnnn4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=WVqpMwhuJbQVQ5-U79kA:9 X-Proofpoint-ORIG-GUID: -gB1BCtKLmeX0mYS5uDMYpJrG-13TIL1 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfXx7pgm1OumtO8 XbhWGiimtfDbBS6nyDLt1K8npWJ8FNxYgOLyjQPzinODFC/iwPVQTZ7bJbw231y8W5LpPU+J8EK zSYw3Av+iRLafUP1/OuX8jUhevlNQTGw8FKeUF6EXHzjUwj9NWK5p6+XGtimJSKyA0XiH0hAxfL piXJo3x9cEJBlQx31Hh9oSTJMMBRQP7z6qYs2cjKqv6w44KL97+0WwJRM2p7gYdkdwTcDqPgODz Sv406ANqkInjJJlGe15TMb7/1ACwPU5WZXl22H0w30+ozPqw7tn9pDAX8lkUxkCZTZDslbmnw3u hFPZnBGAxY2/ZGCVaKNLxDaGDJ5rHyVtb+Zfp9VCKvJyO13IxoHaRg13OVPbtnsOKg3xxy98rQJ yfLJVvFtFbsQu0VvW9BL3l83nXs0EsXWLG8N2MXiPZED5M5LsJC/D/Btqqo5mNfeW5JquDbVu2g Y8Hf33uCPZO/ub793wA== 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-10-09_05,2026-10-09_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 suspectscore=0 spamscore=0 phishscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 impostorscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610090072 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=farman@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.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.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: 1791570823944158500 Content-Type: text/plain; charset="utf-8" From: Konstantin Shkolnyy This field is only used when S390PCIBusDevice exists, so it can be moved there to simplify S390PCIIOMMU towards a structure that contains only the IOMMU container information needed by the PCI layer for a given slot. Reviewed-by: Farhan Ali Reviewed-by: Matthew Rosato Signed-off-by: Konstantin Shkolnyy Link: https://lore.kernel.org/qemu-devel/20261006001643.420929-9-kshk@linux= .ibm.com Signed-off-by: Eric Farman --- hw/s390x/s390-pci-bus.c | 10 +++++----- hw/s390x/s390-pci-inst.c | 23 +++++++++++------------ include/hw/s390x/s390-pci-bus.h | 2 +- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 3a071eab54..53af08018d 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -610,8 +610,8 @@ static void s390_pci_ioat_replay(S390PCIBusDevice *pbde= v) return; } =20 - if (iommu->dma_limit) { - dma_avail =3D iommu->dma_limit->avail; + if (pbdev->dma_limit) { + dma_avail =3D pbdev->dma_limit->avail; } else { dma_avail =3D 1; } @@ -1233,7 +1233,7 @@ static void s390_pcihost_plug(const HotplugHandler *h= otplug_dev, DeviceState *de pbdev->forwarding_assist =3D false; } } - pbdev->iommu->dma_limit =3D s390_pci_start_dma_count(s, pbdev); + pbdev->dma_limit =3D s390_pci_start_dma_count(s, pbdev); /* Fill in CLP information passed via the vfio region */ s390_pci_get_clp_info(pbdev); if (!pbdev->interp) { @@ -1311,8 +1311,8 @@ static void s390_pcihost_unplug(const HotplugHandler = *hotplug_dev, DeviceState * pbdev->fid =3D 0; QTAILQ_REMOVE(&s->zpci_devs, pbdev, link); g_hash_table_remove(s->zpci_table, &pbdev->idx); - if (pbdev->iommu && pbdev->iommu->dma_limit) { - s390_pci_end_dma_count(s, pbdev->iommu->dma_limit); + if (pbdev->dma_limit) { + s390_pci_end_dma_count(s, pbdev->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 c1d9be232a..fa18ad2617 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -28,17 +28,17 @@ =20 #include "trace.h" =20 -static inline void inc_dma_avail(S390PCIIOMMU *iommu) +static inline void inc_dma_avail(S390PCIBusDevice *pbdev) { - if (iommu->dma_limit) { - iommu->dma_limit->avail++; + if (pbdev->dma_limit) { + pbdev->dma_limit->avail++; } } =20 -static inline void dec_dma_avail(S390PCIIOMMU *iommu) +static inline void dec_dma_avail(S390PCIBusDevice *pbdev) { - if (iommu->dma_limit) { - iommu->dma_limit->avail--; + if (pbdev->dma_limit) { + pbdev->dma_limit->avail--; } } =20 @@ -633,7 +633,6 @@ int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint8= _t r2, uintptr_t ra) uint32_t s390_pci_update_iotlb(S390PCIBusDevice *pbdev, S390IOTLBEntry *entry) { - S390PCIIOMMU *iommu =3D pbdev->iommu; 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, @@ -651,7 +650,7 @@ uint32_t s390_pci_update_iotlb(S390PCIBusDevice *pbdev, goto out; } g_hash_table_remove(pbdev->iotlb, &entry->iova); - inc_dma_avail(iommu); + inc_dma_avail(pbdev); /* Don't notify the iommu yet, maybe we can bundle contiguous unma= ps */ goto out; } else { @@ -669,7 +668,7 @@ uint32_t s390_pci_update_iotlb(S390PCIBusDevice *pbdev, event.entry.perm =3D entry->perm; } else { /* invalid->valid transitions consume a new DMA slot */ - dec_dma_avail(iommu); + dec_dma_avail(pbdev); } =20 cache =3D g_new(S390IOTLBEntry, 1); @@ -687,7 +686,7 @@ uint32_t s390_pci_update_iotlb(S390PCIBusDevice *pbdev, memory_region_notify_iommu(&pbdev->iommu_mr, 0, event); =20 out: - return iommu->dma_limit ? iommu->dma_limit->avail : 1; + return pbdev->dma_limit ? pbdev->dma_limit->avail : 1; } =20 static void s390_pci_batch_unmap(S390PCIBusDevice *pbdev, uint64_t iova, @@ -764,8 +763,8 @@ int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_= t r2, uintptr_t ra) } =20 iommu =3D pbdev->iommu; - if (iommu->dma_limit) { - dma_avail =3D iommu->dma_limit->avail; + if (pbdev->dma_limit) { + dma_avail =3D pbdev->dma_limit->avail; } else { dma_avail =3D 1; } diff --git a/include/hw/s390x/s390-pci-bus.h b/include/hw/s390x/s390-pci-bu= s.h index b851295b44..00e7e456e7 100644 --- a/include/hw/s390x/s390-pci-bus.h +++ b/include/hw/s390x/s390-pci-bus.h @@ -280,7 +280,6 @@ struct S390PCIIOMMU { uint64_t pba; uint64_t pal; uint64_t max_dma_limit; - S390PCIDMACount *dma_limit; }; =20 typedef struct S390PCIIOMMUTable { @@ -354,6 +353,7 @@ struct S390PCIBusDevice { IOMMUMemoryRegion iommu_mr; MemoryRegion *dm_mr; GHashTable *iotlb; + S390PCIDMACount *dma_limit; MemoryRegion msix_notify_mr; IndAddr *summary_ind; IndAddr *indicator; --=20 2.56.0 From nobody Thu Oct 22 19:24:52 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=1791570836; cv=none; d=zohomail.com; s=zohoarc; b=OqTbpe9Ghd76+c7eQCw3C67Nm2ID1/jDiG5WYK9qeHAJrIS+Mx7z7sIaP+lr+bIu3UjQiZyD7wXnwnGmEUR3oBbx1Zt21VPZ8mbtJmwBBgeoPsk3Q5w7l1Kv4N0yKqUW7BUp4IYnA0MFn+fi/9wMfiQSe2kavSuhtz9fSp+I5eY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791570836; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SZ90Ivoo72Dpsu4g2kfx2QZBDACQ1lmO09KZObr2mAc=; b=TMpkRqa8kNsdhmSmtBL0MucCImUnmMk15TW2ObGb+8KLuI9yuRO4ZOQFN/jyph26YdoYh4GXyASo8CCmLN/Tj1i5id9Gwxd7vI/h9ioPBtTDM5FaUyt9iBPUDhyUFJHw8G95U2Mxo+FjdycpZn87E6g6DE3BLJD7rgxU/GvrwRo= 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 1791570836986510.1553405590156; Fri, 9 Oct 2026 11:33:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xFFKn-0000W2-QR; Fri, 09 Oct 2026 14:28:45 -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 1xFFKl-0000Sw-BZ; Fri, 09 Oct 2026 14:28:43 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xFFKj-0001fV-K4; Fri, 09 Oct 2026 14:28:43 -0400 Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 699Ha0Nm3714605; Fri, 9 Oct 2026 18:28:40 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 4h74ter881-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:40 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 699H8Giw1142937; Fri, 9 Oct 2026 18:28:39 GMT Received: from smtprelay01.wdc07v.mail.ibm.com ([172.16.1.68]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4h6udd2axu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:39 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay01.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 699IScNe61473262 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Oct 2026 18:28:38 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9EC405805A; Fri, 9 Oct 2026 18:28:38 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7D01C5805D; Fri, 9 Oct 2026 18:28:37 +0000 (GMT) Received: from li-479af74c-31f9-11b2-a85c-e4ddee11713b.ibm.com.com (unknown [9.61.5.156]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 9 Oct 2026 18:28:37 +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=SZ90Ivoo72Dpsu4g2 kfx2QZBDACQ1lmO09KZObr2mAc=; b=kWYz5Jxm/dqFx4SwXLKjqN2lasHX6vM08 4u+O86aVm3TaLYMgCEDsFSXapFjGfiWsjGb+bqGdXHYFzdpmFfqbidghXXBxiOAq nmx7d6zgIsZ+rlRgF842xVZsu0RX04Y/xa5UCHcXcx4VfDmHUYspHxN++gi+fn22 DTAfzVIGYwoO+WNTrLeXg5kDw6zz0dOOueEYRsfH2VcwQITCVQ3yZjl1nU83EQNc G/QKBnkkrlfa88g6aChDE+8+IBSAn5tZCFtUD7h99xVdohbb2kv5OCvSAFnUnyIe 59/50HFWjryJbXyoJ5lHYGDW8oYqzCp7zI5zSTpuv1hmPkaHtVLdQ== From: Eric Farman To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Matthew Rosato , Cornelia Huck , Konstantin Shkolnyy , Eric Farman Subject: [PULL 09/19] s390x/pci: Move g_iota from S390PCIIOMMU to S390PCIBusDevice Date: Fri, 9 Oct 2026 14:28:15 -0400 Message-ID: <20261009182825.148054-10-farman@linux.ibm.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009182825.148054-1-farman@linux.ibm.com> References: <20261009182825.148054-1-farman@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: HjV9cZTiidT2466wxHq3-H8p_fCTFzki X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX2lUySoIFiTUz dI9bos2ElNx2vff94692np5jo7kSn6IjzPLl3DRkeXgmJ6lCxN7oIBJMFb5lv2kSpXhHfY5iG+Q Mk+niqjS+2q/MbtmCT010xp6woCZFHJAEj/Wi2qmJJrU1p4Vt+gK6xGk0t0P7yic321Ji0MhaP7 zpzSXQ0CxNZWgaYUohfcKtGpB5L10ICBRx9DjaFTyjvyH1WqlmikTCzNPOkNtfI48SwdSwukcmp XAv9NQNO+p9qVrFK8shJPf46ASxXdI5OmsQC7UZhQ7kK4VHQ+34Ze3ddBVUcEKo8D8bpqXdxCdq xakdFfdnPjQm5WmlxK3wvUFDNbi48gfZwuUyfqXbf/HbPwDyU89+G4s/nJXs/cDyAhoWO7AHlRW sWBLgu872txW5pbF6/RSflQnDSIStASYDtrTdVCgbab6XOar5S8zNLvjqR4/wcLUCtBKRToMgS/ KN47wsLTq2NKv0Tc7fA== X-Proofpoint-GUID: HjV9cZTiidT2466wxHq3-H8p_fCTFzki X-Proofpoint-Spam-Info: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX42oPyTC96qF9 PVnc+KoYeTcxov6+AEWdmDHoZ63ZWq7rtc5OUlod6pjYUZp8197opjtlUIkvez24dkVZCTdsBC3 iwlfAecnqpZJAJe+aBJ5f8APsamshpY= X-Authority-Analysis: v=2.4 cv=Nf1zRGD4 c=1 sm=1 tr=0 ts=6ac93258 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=660iZSQnnn4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=eCYPC3wdSG4xViznilUA:9 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-10-09_05,2026-10-09_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 bulkscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 lowpriorityscore=0 impostorscore=0 adultscore=0 suspectscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610090072 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.158.5; envelope-from=farman@linux.ibm.com; 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, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=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.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: 1791570838269158501 Content-Type: text/plain; charset="utf-8" From: Konstantin Shkolnyy This field is only used when S390PCIBusDevice exists, so it can be moved there to simplify S390PCIIOMMU towards a structure that contains only the IOMMU container information needed by the PCI layer for a given slot. This also allows to save/restore this field during migration. Reviewed-by: Farhan Ali Reviewed-by: Matthew Rosato Signed-off-by: Konstantin Shkolnyy Link: https://lore.kernel.org/qemu-devel/20261006001643.420929-10-kshk@linu= x.ibm.com Signed-off-by: Eric Farman --- hw/s390x/s390-pci-bus.c | 2 +- hw/s390x/s390-pci-inst.c | 10 +++++----- include/hw/s390x/s390-pci-bus.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 53af08018d..88ffa93977 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -617,7 +617,7 @@ static void s390_pci_ioat_replay(S390PCIBusDevice *pbde= v) } =20 while (curr < end) { - error =3D s390_guest_io_table_walk(iommu->g_iota, curr, &entry); + error =3D s390_guest_io_table_walk(pbdev->g_iota, curr, &entry); if (error) { pbdev->state =3D ZPCI_FS_ERROR; s390_pci_generate_error_event(error, pbdev->fh, pbdev->fid, cu= rr, diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index fa18ad2617..3163539ead 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -768,7 +768,7 @@ int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_= t r2, uintptr_t ra) } else { dma_avail =3D 1; } - if (!iommu->g_iota) { + if (!pbdev->g_iota) { error =3D ERR_EVENT_INVALAS; goto err; } @@ -788,7 +788,7 @@ int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_= t r2, uintptr_t ra) start =3D sstart; again =3D false; while (start < end) { - error =3D s390_guest_io_table_walk(iommu->g_iota, start, &entry); + error =3D s390_guest_io_table_walk(pbdev->g_iota, start, &entry); if (error) { break; } @@ -1076,7 +1076,7 @@ static int reg_ioat(CPUS390XState *env, S390PCIBusDev= ice *pbdev, ZpciFib fib, =20 iommu->pba =3D pba; iommu->pal =3D pal; - iommu->g_iota =3D g_iota; + pbdev->g_iota =3D g_iota; =20 if (t) { s390_pci_iommu_enable(pbdev); @@ -1093,7 +1093,7 @@ void pci_dereg_ioat(S390PCIBusDevice *pbdev) s390_pci_iommu_disable(pbdev); iommu->pba =3D 0; iommu->pal =3D 0; - iommu->g_iota =3D 0; + pbdev->g_iota =3D 0; } =20 void fmb_timer_free(S390PCIBusDevice *pbdev) @@ -1466,7 +1466,7 @@ int stpcifc_service_call(S390CPU *cpu, uint8_t r1, ui= nt64_t fiba, uint8_t ar, =20 stq_be_p(&fib.pba, pbdev->iommu->pba); stq_be_p(&fib.pal, pbdev->iommu->pal); - stq_be_p(&fib.iota, pbdev->iommu->g_iota); + stq_be_p(&fib.iota, pbdev->g_iota); stq_be_p(&fib.aibv, pbdev->routes.adapter.ind_addr); stq_be_p(&fib.aisb, pbdev->routes.adapter.summary_addr); stq_be_p(&fib.fmb_addr, pbdev->fmb_addr); diff --git a/include/hw/s390x/s390-pci-bus.h b/include/hw/s390x/s390-pci-bu= s.h index 00e7e456e7..1bb1b87d52 100644 --- a/include/hw/s390x/s390-pci-bus.h +++ b/include/hw/s390x/s390-pci-bus.h @@ -276,7 +276,6 @@ struct S390PCIIOMMU { Object parent_obj; AddressSpace as; MemoryRegion mr; - uint64_t g_iota; uint64_t pba; uint64_t pal; uint64_t max_dma_limit; @@ -353,6 +352,7 @@ struct S390PCIBusDevice { IOMMUMemoryRegion iommu_mr; MemoryRegion *dm_mr; GHashTable *iotlb; + uint64_t g_iota; S390PCIDMACount *dma_limit; MemoryRegion msix_notify_mr; IndAddr *summary_ind; --=20 2.56.0 From nobody Thu Oct 22 19:24:52 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=1791570637; cv=none; d=zohomail.com; s=zohoarc; b=ABhIYvugQgarlsIkQVjOo2lpgDT15gcPELhOAOmiEmJD64cxDqB6Gd2FAfrzndPZatkVs0jk09Ml8IcvqvifaU0ceaDmiuXO5ZVBqtJQqTIFM/VCGHU12ttLhnGpnUV9VBDvqTIqJLFigy9WEZZBOMKtZFB+udZmX1ZtOD79oAs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791570637; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=GHT8+IyQaitbPXrd3fTw7v3FivE0wPnMxeOpHD6ebUM=; b=RMDUfhTBtUIyeSDreMeSDj5m2Bj59238JEwNUFBqieQJRMx730/lIPlAb45ORnwHdqRTi4XyvNlkssSN64ldJwqLvGrj8kRjIE8TOejpJfrHNd9d/FZ2NbtVcNLOm2wb48soPdF1xJOpJqIGpIdt5w9uOsmPJSpAHFyo8orohzk= 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 1791570637695981.8097852352554; Fri, 9 Oct 2026 11:30:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xFFKu-0000Z1-Ut; Fri, 09 Oct 2026 14:28:54 -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 1xFFKo-0000Wd-VV; Fri, 09 Oct 2026 14:28:47 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xFFKl-0001fy-UH; Fri, 09 Oct 2026 14:28:45 -0400 Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 699Ha6W1736856; Fri, 9 Oct 2026 18:28:42 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4h74tdr88h-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:42 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 699H8GKO1162533; Fri, 9 Oct 2026 18:28:41 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([172.16.1.69]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4h6v76t5ff-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:41 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 699ISd8Z30868216 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Oct 2026 18:28:40 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D542758054; Fri, 9 Oct 2026 18:28:39 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D18FD5805A; Fri, 9 Oct 2026 18:28:38 +0000 (GMT) Received: from li-479af74c-31f9-11b2-a85c-e4ddee11713b.ibm.com.com (unknown [9.61.5.156]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 9 Oct 2026 18:28:38 +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=GHT8+IyQaitbPXrd3 fTw7v3FivE0wPnMxeOpHD6ebUM=; b=YHDnUJhBK+cSVjW6OUBoudJwIz70FcZU+ EvkxiTHrKmRzHLSt+6nKY2bjCg+kX61Arlp/fDQAUxYFmLSDhbglhqJcGGG1SNKY m/lVA0pxoteNtd/OsL3GHGjPpn6t8peMJZzYA4PgAdki+6rMya2OtfMbalePB8IN eojhK3apfYt6S5IaShm+h9brjzui+wuC+esOaVLB5d3VF8/i7qbadUE0KLtCygvr L3RkBVMP+3laENXN3SXCJhq5wB//CPuQ4d7GNnoY5GaG6HI9XqCcJczWTPQVPqDY 4PppDJade7i2N9oZcI1bi266LanzQjA4MdsULaP0a1FjP/jZouZFA== From: Eric Farman To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Matthew Rosato , Cornelia Huck , Konstantin Shkolnyy , Eric Farman Subject: [PULL 10/19] s390x/pci: Move pba from S390PCIIOMMU to S390PCIBusDevice Date: Fri, 9 Oct 2026 14:28:16 -0400 Message-ID: <20261009182825.148054-11-farman@linux.ibm.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009182825.148054-1-farman@linux.ibm.com> References: <20261009182825.148054-1-farman@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Authority-Analysis: v=2.4 cv=JL6uIMKb c=1 sm=1 tr=0 ts=6ac9325a cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=660iZSQnnn4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=THYS1zffzJpO_GefUMYA:9 X-Proofpoint-ORIG-GUID: uGOYk6Kpl0N4RJQcCqcPtoIE-qmpVpsN X-Proofpoint-GUID: uGOYk6Kpl0N4RJQcCqcPtoIE-qmpVpsN X-Proofpoint-Spam-Info: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfXz+K9peHdiClE wufqaki54Vi+8ljRrd/9uMjgc0TCyT7LEejpxI7zVACZfdj6mrz5vH+GktR0a5F5+f3gAB+Zq9H 3tPbJTX4N3jBYjwp0nxeG3MTGB4nGbo= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfXwWi+OfjXEZHZ XOF81S6Sz9uUQubN9awFAZcdiLudtdLnyn4x7fMjvMOPeyQtQ3/bUoDZE5V8OET54/cCmZgJLk0 BUyOWnZ6QApDM00LjbgrQRWvXPGuyCG3gXUP8UDoSkamA2BOvz6K5GgWIMOYOrndVboln0PWJgX uMqbRUS/KORkkW1O4Gpyqc+uRryfTOqBoRH/zzCqMim0bdmlBwHM943VjiATUGOrDScrnwxNzMB Alf1c6LOMYt0fCTTCVzF8+OMDkim0Gb8Hy0ymw74P2h8s9gJY/R+BctWBmQaKIq3baKceIqQV2F 5G1hAL+jdahQYQY7uqpO+7z6phas7YEYPLDeaSzLUiMt9sGoQKvG1ObwyygJg1tP482JoO033i9 xfx0bXVBXs4ITSuxlc9SDNtvTYljcgluykbMoDnx5CfyfI0SmLVWPdUuX5mNBXFsF6fwmA+O2Oi IqdS3S+B55HyANKYwrg== 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-10-09_05,2026-10-09_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 bulkscore=0 impostorscore=0 adultscore=0 lowpriorityscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610090072 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.158.5; envelope-from=farman@linux.ibm.com; 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, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=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.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: 1791570638597158500 Content-Type: text/plain; charset="utf-8" From: Konstantin Shkolnyy This field is only used when S390PCIBusDevice exists, so it can be moved there to simplify S390PCIIOMMU towards a structure that contains only the IOMMU container information needed by the PCI layer for a given slot. This also allows to save/restore this field during migration. Reviewed-by: Farhan Ali Reviewed-by: Matthew Rosato Signed-off-by: Konstantin Shkolnyy Link: https://lore.kernel.org/qemu-devel/20261006001643.420929-11-kshk@linu= x.ibm.com Signed-off-by: Eric Farman --- hw/s390x/s390-pci-bus.c | 4 ++-- hw/s390x/s390-pci-inst.c | 10 +++++----- include/hw/s390x/s390-pci-bus.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 88ffa93977..b0aaea49cf 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -565,7 +565,7 @@ static IOMMUTLBEntry s390_translate_iommu(IOMMUMemoryRe= gion *mr, hwaddr addr, =20 trace_s390_pci_iommu_xlate(addr); =20 - if (addr < iommu->pba || addr > iommu->pal) { + if (addr < pbdev->pba || addr > iommu->pal) { error =3D ERR_EVENT_OORANGE; goto err; } @@ -602,7 +602,7 @@ static void s390_pci_ioat_replay(S390PCIBusDevice *pbde= v) hwaddr curr, end; S390PCIIOMMU *iommu =3D pbdev->iommu; =20 - curr =3D iommu->pba; + curr =3D pbdev->pba; end =3D iommu->pal; =20 if (pbdev->dm_mr) { diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index 3163539ead..1006b409e4 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -773,7 +773,7 @@ int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_= t r2, uintptr_t ra) goto err; } =20 - if (end < start || end < iommu->pba || start > iommu->pal) { + if (end < start || end < pbdev->pba || start > iommu->pal) { error =3D ERR_EVENT_OORANGE; goto err; } @@ -781,7 +781,7 @@ int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_= t r2, uintptr_t ra) * If the specified range at least partially overlaps the registered * aperture, clamp the request to the aperture and ignore the rest. */ - sstart =3D MAX(start, iommu->pba); + sstart =3D MAX(start, pbdev->pba); end =3D MIN(end, iommu->pal + 1); =20 retry: @@ -1074,7 +1074,7 @@ static int reg_ioat(CPUS390XState *env, S390PCIBusDev= ice *pbdev, ZpciFib fib, return -EINVAL; } =20 - iommu->pba =3D pba; + pbdev->pba =3D pba; iommu->pal =3D pal; pbdev->g_iota =3D g_iota; =20 @@ -1091,7 +1091,7 @@ void pci_dereg_ioat(S390PCIBusDevice *pbdev) { S390PCIIOMMU *iommu =3D pbdev->iommu; s390_pci_iommu_disable(pbdev); - iommu->pba =3D 0; + pbdev->pba =3D 0; iommu->pal =3D 0; pbdev->g_iota =3D 0; } @@ -1464,7 +1464,7 @@ int stpcifc_service_call(S390CPU *cpu, uint8_t r1, ui= nt64_t fiba, uint8_t ar, return 0; } =20 - stq_be_p(&fib.pba, pbdev->iommu->pba); + stq_be_p(&fib.pba, pbdev->pba); stq_be_p(&fib.pal, pbdev->iommu->pal); stq_be_p(&fib.iota, pbdev->g_iota); stq_be_p(&fib.aibv, pbdev->routes.adapter.ind_addr); diff --git a/include/hw/s390x/s390-pci-bus.h b/include/hw/s390x/s390-pci-bu= s.h index 1bb1b87d52..82e79885e4 100644 --- a/include/hw/s390x/s390-pci-bus.h +++ b/include/hw/s390x/s390-pci-bus.h @@ -276,7 +276,6 @@ struct S390PCIIOMMU { Object parent_obj; AddressSpace as; MemoryRegion mr; - uint64_t pba; uint64_t pal; uint64_t max_dma_limit; }; @@ -353,6 +352,7 @@ struct S390PCIBusDevice { MemoryRegion *dm_mr; GHashTable *iotlb; uint64_t g_iota; + uint64_t pba; S390PCIDMACount *dma_limit; MemoryRegion msix_notify_mr; IndAddr *summary_ind; --=20 2.56.0 From nobody Thu Oct 22 19:24:52 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=1791570566; cv=none; d=zohomail.com; s=zohoarc; b=M0/HzlW6oDY7j/jjUJCbiZger0W6zbkPc2K7PJUAllVNudc2UPSToT2xXBXFGFiQBuPLNnwnUK/I3KDRN+gI55/z1y8W7e3IqTtfHQiCRPAJo2WZFtC640dynA4rsgeanUFWJRIzaWYvCjIkjsmw+TBskKzDnLI1Nr8MadbFVpA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791570566; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=kYiGpnjemAmPwHbfUpSwmgYhufUW1ViHpvloYYH1otw=; b=d4BlGUvGn4Oanlub7lVs56a5z9YxMJOn+L1+9yC+ueSACdHH0Vn7zbGcRnUldj1b2NrVnGOe4DztHljJZDleyzzYoxxVNC+V+Yc6ie3JQU025z79V2xS6tbVIGXyvqdO5kclDdFwY+lXmis/FHN74ObrNfArYoAwzsd1OiUzAMs= 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 179157056596610.945512161231136; Fri, 9 Oct 2026 11:29:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xFFKw-0000ZA-QK; Fri, 09 Oct 2026 14:28:54 -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 1xFFKo-0000We-W3; Fri, 09 Oct 2026 14:28:47 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xFFKm-0001g8-8D; Fri, 09 Oct 2026 14:28:46 -0400 Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 699Ha5Rp592884; Fri, 9 Oct 2026 18:28:43 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4h74tdg8be-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:42 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 699H8GKP1162533; Fri, 9 Oct 2026 18:28:42 GMT Received: from smtprelay02.dal12v.mail.ibm.com ([172.16.1.4]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4h6v76t5fh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:42 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay02.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 699ISfRh31916582 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Oct 2026 18:28:41 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 16F3958054; Fri, 9 Oct 2026 18:28:41 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1139F5805A; Fri, 9 Oct 2026 18:28:40 +0000 (GMT) Received: from li-479af74c-31f9-11b2-a85c-e4ddee11713b.ibm.com.com (unknown [9.61.5.156]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 9 Oct 2026 18:28:39 +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=kYiGpnjemAmPwHbfU pSwmgYhufUW1ViHpvloYYH1otw=; b=iTf1SvrvACN9mcFtIziyFYwjW15cAd82L pxr9tIRvP/mr5PoZMxWzmXHwctUSqAOrt6j+UKamWOdPIDObwR3+2kqQHf2t30JC 0mIqArq9ZJIw7aWxjnjLOhcL49+dq3hB0yavB2gY15U0jfitf5WQ2ZuaZp3ZqkHP OWwP5swdo8qhbgPrISJS4wMh07vxxphotmruuPkY2uBEWL/21uqV430p7CkYskys bMIPjMcQIipUrM21EAXCsnBm8w8J0J0Z3+y8saxVSkDXeqwyPt7mp/sDbG2Q+XND 314baYejHTIJ69KrZmJS9QHsr92UcnNAII405AQVWuLOi7bt4wHeg== From: Eric Farman To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Matthew Rosato , Cornelia Huck , Konstantin Shkolnyy , Eric Farman Subject: [PULL 11/19] s390x/pci: Move pal from S390PCIIOMMU to S390PCIBusDevice Date: Fri, 9 Oct 2026 14:28:17 -0400 Message-ID: <20261009182825.148054-12-farman@linux.ibm.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009182825.148054-1-farman@linux.ibm.com> References: <20261009182825.148054-1-farman@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfXztHZKGW1OMxb ai9FHeGFFP1X2zObpd6UdM0dXoEgWXAZ0tizpvPhfWU0G96V4R2P/GEo+JOfmpMGdeeflf/Knho ybPxaapikZY2UuKhxxc97LMpuTR4ZNVOvMyAs4FVRqUqA3BsLWNBc7NxMObaEmeYwwTAXsErhpi ExexcdofnRBIW9DdOBGfWa49gccJbs1tYl9JMgb4nWALHSczCb9gJ0YbMImud+XMT94CXoEns6N Eth/lnUCf41fM7cFQ/kfRFyelAHuAAFXxSng+vssAzBvXscjMotZgvQlHMGI5aP4RXe35b0twge DYxkXDQ5mdrhcrFb3K6GGGtJd5t6v2ZgaHLKsIeEaayDKJ2wDnta1GXYik13tGFJ5Z2McKRX5RG ElJvdM+67E3Go3aj4LZbSBhReMOC7JfCx88w5Jvcnh4xzgfMggqYaHzUuFM4s0WE1hOH0w3h2iC y1/9g9TMXEqB1G3bVhg== X-Authority-Analysis: v=2.4 cv=FqWQbGrq c=1 sm=1 tr=0 ts=6ac9325b cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=660iZSQnnn4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=WfwOUNX5pORHP_P-vIkA:9 X-Proofpoint-GUID: UYeuFSx2MHmuG2dZdN2wlc_2LueL4D6z X-Proofpoint-Spam-Info: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX3ifqOouWJmpD w4JAVyW6BtirJQBeGvZ7dd0SJX1EyIvfaVncQhN/AmKBsfY1QXhuee2cG1d5TAIabjurgtD5KLc wuOs0Yn6P0gCiM01loFiSmoy3YyLmzo= X-Proofpoint-ORIG-GUID: UYeuFSx2MHmuG2dZdN2wlc_2LueL4D6z 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-10-09_05,2026-10-09_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 suspectscore=0 priorityscore=1501 impostorscore=0 adultscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610090072 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.158.5; envelope-from=farman@linux.ibm.com; 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, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=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.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: 1791570567241158501 Content-Type: text/plain; charset="utf-8" From: Konstantin Shkolnyy This field is only used when S390PCIBusDevice exists, so it can be moved there to simplify S390PCIIOMMU towards a structure that contains only the IOMMU container information needed by the PCI layer for a given slot. This also allows to save/restore this field during migration. Reviewed-by: Farhan Ali Reviewed-by: Matthew Rosato Signed-off-by: Konstantin Shkolnyy Link: https://lore.kernel.org/qemu-devel/20261006001643.420929-12-kshk@linu= x.ibm.com Signed-off-by: Eric Farman --- hw/s390x/s390-pci-bus.c | 8 +++----- hw/s390x/s390-pci-inst.c | 14 +++++--------- include/hw/s390x/s390-pci-bus.h | 2 +- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index b0aaea49cf..799e596fec 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -540,7 +540,6 @@ static IOMMUTLBEntry s390_translate_iommu(IOMMUMemoryRe= gion *mr, hwaddr addr, IOMMUAccessFlags flag, int iommu= _idx) { S390PCIBusDevice *pbdev =3D container_of(mr, S390PCIBusDevice, iommu_m= r); - S390PCIIOMMU *iommu =3D pbdev->iommu; S390IOTLBEntry *entry; uint64_t iova =3D addr & TARGET_PAGE_MASK; uint16_t error =3D 0; @@ -565,7 +564,7 @@ static IOMMUTLBEntry s390_translate_iommu(IOMMUMemoryRe= gion *mr, hwaddr addr, =20 trace_s390_pci_iommu_xlate(addr); =20 - if (addr < pbdev->pba || addr > iommu->pal) { + if (addr < pbdev->pba || addr > pbdev->pal) { error =3D ERR_EVENT_OORANGE; goto err; } @@ -600,10 +599,9 @@ static void s390_pci_ioat_replay(S390PCIBusDevice *pbd= ev) uint16_t error =3D 0; uint32_t dma_avail; hwaddr curr, end; - S390PCIIOMMU *iommu =3D pbdev->iommu; =20 curr =3D pbdev->pba; - end =3D iommu->pal; + end =3D pbdev->pal; =20 if (pbdev->dm_mr) { /* If direct mapping is used, there are no guest tables to replay = */ @@ -793,7 +791,7 @@ void s390_pci_iommu_enable(S390PCIBusDevice *pbdev) char *name =3D g_strdup_printf("iommu-s390-%04x", pbdev->uid); memory_region_init_iommu(&pbdev->iommu_mr, sizeof(pbdev->iommu_mr), TYPE_S390_IOMMU_MEMORY_REGION, OBJECT(&iommu-= >mr), - name, iommu->pal + 1); + name, pbdev->pal + 1); pbdev->iommu_enabled =3D true; memory_region_add_subregion(&iommu->mr, 0, MEMORY_REGION(&pbdev->iommu= _mr)); g_free(name); diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index 1006b409e4..98380526d1 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -720,7 +720,6 @@ int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_= t r2, uintptr_t ra) uint32_t fh; uint16_t error =3D 0; S390PCIBusDevice *pbdev; - S390PCIIOMMU *iommu; S390IOTLBEntry entry; hwaddr start, end, sstart; uint32_t dma_avail; @@ -762,7 +761,6 @@ int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_= t r2, uintptr_t ra) break; } =20 - iommu =3D pbdev->iommu; if (pbdev->dma_limit) { dma_avail =3D pbdev->dma_limit->avail; } else { @@ -773,7 +771,7 @@ int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_= t r2, uintptr_t ra) goto err; } =20 - if (end < start || end < pbdev->pba || start > iommu->pal) { + if (end < start || end < pbdev->pba || start > pbdev->pal) { error =3D ERR_EVENT_OORANGE; goto err; } @@ -782,7 +780,7 @@ int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_= t r2, uintptr_t ra) * aperture, clamp the request to the aperture and ignore the rest. */ sstart =3D MAX(start, pbdev->pba); - end =3D MIN(end, iommu->pal + 1); + end =3D MIN(end, pbdev->pal + 1); =20 retry: start =3D sstart; @@ -1033,7 +1031,6 @@ bool s390_pci_is_translation_enabled(uint64_t g_iota) static int reg_ioat(CPUS390XState *env, S390PCIBusDevice *pbdev, ZpciFib f= ib, uintptr_t ra) { - S390PCIIOMMU *iommu =3D pbdev->iommu; uint64_t pba =3D ldq_be_p(&fib.pba); uint64_t pal =3D ldq_be_p(&fib.pal); uint64_t g_iota =3D ldq_be_p(&fib.iota); @@ -1075,7 +1072,7 @@ static int reg_ioat(CPUS390XState *env, S390PCIBusDev= ice *pbdev, ZpciFib fib, } =20 pbdev->pba =3D pba; - iommu->pal =3D pal; + pbdev->pal =3D pal; pbdev->g_iota =3D g_iota; =20 if (t) { @@ -1089,10 +1086,9 @@ static int reg_ioat(CPUS390XState *env, S390PCIBusDe= vice *pbdev, ZpciFib fib, =20 void pci_dereg_ioat(S390PCIBusDevice *pbdev) { - S390PCIIOMMU *iommu =3D pbdev->iommu; s390_pci_iommu_disable(pbdev); pbdev->pba =3D 0; - iommu->pal =3D 0; + pbdev->pal =3D 0; pbdev->g_iota =3D 0; } =20 @@ -1465,7 +1461,7 @@ int stpcifc_service_call(S390CPU *cpu, uint8_t r1, ui= nt64_t fiba, uint8_t ar, } =20 stq_be_p(&fib.pba, pbdev->pba); - stq_be_p(&fib.pal, pbdev->iommu->pal); + stq_be_p(&fib.pal, pbdev->pal); stq_be_p(&fib.iota, pbdev->g_iota); stq_be_p(&fib.aibv, pbdev->routes.adapter.ind_addr); stq_be_p(&fib.aisb, pbdev->routes.adapter.summary_addr); diff --git a/include/hw/s390x/s390-pci-bus.h b/include/hw/s390x/s390-pci-bu= s.h index 82e79885e4..9332763522 100644 --- a/include/hw/s390x/s390-pci-bus.h +++ b/include/hw/s390x/s390-pci-bus.h @@ -276,7 +276,6 @@ struct S390PCIIOMMU { Object parent_obj; AddressSpace as; MemoryRegion mr; - uint64_t pal; uint64_t max_dma_limit; }; =20 @@ -353,6 +352,7 @@ struct S390PCIBusDevice { GHashTable *iotlb; uint64_t g_iota; uint64_t pba; + uint64_t pal; S390PCIDMACount *dma_limit; MemoryRegion msix_notify_mr; IndAddr *summary_ind; --=20 2.56.0 From nobody Thu Oct 22 19:24:52 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=1791570640; cv=none; d=zohomail.com; s=zohoarc; b=S+rTHVOenKr2b9m10EVR3XHcX9kAhZYyDEmX0HfhV0wVAjjJ3vuKCC1ihBBxkS/Dg5g3b+Ct8/K8iSM0qmuPtOnF2p/s8qKFAVVwz1G9pdeO1hcDXamZYbCPu5hwBfpovRuOa1fkhoWkViiT/sG5R0DjOzu0rHSlLs21tv/WcA4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791570640; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4nRQdjxnHZEozz+dqSC4RfhZ5eBX9sQ5dAGYRK63kKs=; b=i65LAahLUWGf6QykEBNR8+MjG9Eew6yoaOquBmcZn4uZnaiMMwXm3/EGSkUL8IzPg+orSNNZLhMw+ggcchJX1tiZVXz0prAGEDfqzIyiA+pPTRoIwbiOSmAzcwxayMKW3CeQU333a6vDRF3t7frtTjT2qV0z91ixFs7bncKyTfY= 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 179157064006339.63354435025326; Fri, 9 Oct 2026 11:30:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xFFL5-0000gF-Ln; Fri, 09 Oct 2026 14:29:03 -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 1xFFKq-0000YA-Ic; Fri, 09 Oct 2026 14:28:50 -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 1xFFKo-0001gQ-Qj; Fri, 09 Oct 2026 14:28:48 -0400 Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 699Ha1FM699055; Fri, 9 Oct 2026 18:28:44 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4h74ter8qx-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:44 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 699H8G4c1206683; Fri, 9 Oct 2026 18:28:43 GMT Received: from smtprelay04.wdc07v.mail.ibm.com ([172.16.1.71]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4h6hsnm7nx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:43 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay04.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 699ISgc021430744 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Oct 2026 18:28:42 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 266D358054; Fri, 9 Oct 2026 18:28:42 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 494D05805A; Fri, 9 Oct 2026 18:28:41 +0000 (GMT) Received: from li-479af74c-31f9-11b2-a85c-e4ddee11713b.ibm.com.com (unknown [9.61.5.156]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 9 Oct 2026 18:28:41 +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=4nRQdjxnHZEozz+dq SC4RfhZ5eBX9sQ5dAGYRK63kKs=; b=g0Sa6mw7eH/PicF3iTp0JwuCofF8rJHhV p+7dYoukojtWQC+QiLUmOu7XiSH4+2K5FAKxM+9JJb9VsAb/adRinHPOO8oavP9w 5t5i6ln75e08tjNXnhGsS0QV4HXzr8TT6IHnNQmNLJQQcIjrUhxIplnJDWAf5NiQ IlTFWHKf8vZObr2wnoSVDgKy8lo1cJsZHCGOcilKBubCtGBKa2WkPyAOywDRag73 2c7B0WC/7tJHlunI73p3QG0+w67lbzHYUeMxxakHPly4SzwRqBS5oP+Pf1VcSdgQ Q3ZH8YcPfidTu7iAYuJOvAoFbzsL6u3qX1SsfHvMYO89JpwoB7y6A== From: Eric Farman To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Matthew Rosato , Cornelia Huck , Konstantin Shkolnyy , Eric Farman Subject: [PULL 12/19] s390x/pci: Move max_dma_limit from S390PCIIOMMU to S390PCIBusDevice Date: Fri, 9 Oct 2026 14:28:18 -0400 Message-ID: <20261009182825.148054-13-farman@linux.ibm.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009182825.148054-1-farman@linux.ibm.com> References: <20261009182825.148054-1-farman@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Info: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX4mL7R1pdnvnj 52CfZ52XMybXBzSqMuD3d2mkYmThwOFOQjq0okHmU/UyovM7LRktAQJ4nAO0rSfC040ZE627wfi HHFT0u9AAz+Qmy9cHWJQR4Sdr3qbI20= X-Proofpoint-GUID: 5Bj8mdlgmjaVfpEdtiGkPBgJpezo7hMA X-Authority-Analysis: v=2.4 cv=P42vFSAu c=1 sm=1 tr=0 ts=6ac9325c cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=660iZSQnnn4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=H9rQf2XcI7Xh5L5g7L0A:9 X-Proofpoint-ORIG-GUID: 5Bj8mdlgmjaVfpEdtiGkPBgJpezo7hMA X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX3Km2aEbHF5CR g2XFKDgUm0RQjIc6wLbXW1q+IviI7Pv4pivf4XNkKyyS4kZ9VravsFhfGUxW+vpefTTW1fl+z3r yoxreOVxE8KjqLTo9WXSW2zr9e0WoIHAVsEhOEv3GXImVmYsgldCXn075Vtdobqtf+XBJR4AEf1 vP+EsLmNtriO03juvRVWIaXX39YGOV0LTDxKi4ScjSk8DeKlXrGLhw27O47jhKEG6S1qzLe+0VN u8fE34dkQ1aZTBaGyUpYJVb8/Cr0cqTPBidpKTABlZpCs+CPtXhFQX0TBpzxqMa4Fjvk9952zaR XUMIuGMIVnhtXsoGb8UuWsgcaSOK7vfNmqZPH0rD8ZGIFV2p1H7q1LcCCCAKUO4in0ihyqhxqbJ E2BOjI+T8jlAfcuPMyLZZxEYGVdf+rnD2Xv4V7POBRlhj9IPHZ6Y90EnF7//pkpqy8KxXLNON1b WIhTqoXLfovza6v2m0Q== 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-10-09_05,2026-10-09_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 suspectscore=0 spamscore=0 phishscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 impostorscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610090072 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=farman@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.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.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: 1791570640631158500 Content-Type: text/plain; charset="utf-8" From: Konstantin Shkolnyy This field is only used when S390PCIBusDevice exists, so it can be moved there to simplify S390PCIIOMMU towards a structure that contains only the IOMMU container information needed by the PCI layer for a given slot. Reviewed-by: Farhan Ali Reviewed-by: Matthew Rosato Signed-off-by: Konstantin Shkolnyy Link: https://lore.kernel.org/qemu-devel/20261006001643.420929-13-kshk@linu= x.ibm.com Signed-off-by: Eric Farman --- hw/s390x/s390-pci-vfio.c | 4 ++-- include/hw/s390x/s390-pci-bus.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/s390x/s390-pci-vfio.c b/hw/s390x/s390-pci-vfio.c index db6de00bd2..a035ba5b2c 100644 --- a/hw/s390x/s390-pci-vfio.c +++ b/hw/s390x/s390-pci-vfio.c @@ -90,7 +90,7 @@ S390PCIDMACount *s390_pci_start_dma_count(S390pciState *s, cnt->users =3D 1; cnt->avail =3D avail; QTAILQ_INSERT_TAIL(&s->zpci_dma_limit, cnt, link); - pbdev->iommu->max_dma_limit =3D avail; + pbdev->max_dma_limit =3D avail; return cnt; } =20 @@ -152,7 +152,7 @@ static void s390_pci_read_base(S390PCIBusDevice *pbdev, * to request that the guest free DMA mappings as necessary. */ if (!pbdev->rtr_avail) { - vfio_size =3D pbdev->iommu->max_dma_limit << qemu_target_page_bits= (); + vfio_size =3D pbdev->max_dma_limit << qemu_target_page_bits(); if (vfio_size > 0 && vfio_size < cap->end_dma - cap->start_dma + 1= ) { pbdev->zpci_fn.edma =3D cap->start_dma + vfio_size - 1; } diff --git a/include/hw/s390x/s390-pci-bus.h b/include/hw/s390x/s390-pci-bu= s.h index 9332763522..c7fa7b9514 100644 --- a/include/hw/s390x/s390-pci-bus.h +++ b/include/hw/s390x/s390-pci-bus.h @@ -276,7 +276,6 @@ struct S390PCIIOMMU { Object parent_obj; AddressSpace as; MemoryRegion mr; - uint64_t max_dma_limit; }; =20 typedef struct S390PCIIOMMUTable { @@ -353,6 +352,7 @@ struct S390PCIBusDevice { uint64_t g_iota; uint64_t pba; uint64_t pal; + uint64_t max_dma_limit; S390PCIDMACount *dma_limit; MemoryRegion msix_notify_mr; IndAddr *summary_ind; --=20 2.56.0 From nobody Thu Oct 22 19:24:52 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=1791570678; cv=none; d=zohomail.com; s=zohoarc; b=FLtK1EYCjT2DxBJww6G0AViP6BEMEUYWEg7boebnv0e5bz7VmlBQqaxZ27O6TYFIvjLAslJCTzqmWfBGqja4TUUDY3xd5i0f+jtpwf7gMcMlHTyRHzfoRoDVy8ENS7rmdgyjHwji+jnXp2dM+1o/hQ95KtY485UjZwNch279LQY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791570678; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=pL2hA9L+liZfL864ut4GIWMcI/zNawbAGRU46zM/+Js=; b=liGcORpOd5ItlcCy0hZihR5/1uJYvz3x5V0H84yIVePoLoRFmOA4paXB1tjXiuVguGRXUqLf10qmBMLkdj5+R5O+I3g1k2QnDStekEtMZFfgGHU9Bszr1h7SoUcOL1Sur1RvmJAn3MBF7LQhuDvBMbCOY/+r4CUMm10SJHai3T0= 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 17915706781001020.055317130765; Fri, 9 Oct 2026 11:31:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xFFL1-0000az-0g; Fri, 09 Oct 2026 14:28:59 -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 1xFFKr-0000YK-05; Fri, 09 Oct 2026 14:28:50 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xFFKp-0001gf-1i; Fri, 09 Oct 2026 14:28:48 -0400 Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 699Ha4ZH3714694; Fri, 9 Oct 2026 18:28:45 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4h74ter889-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:45 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 699H8JEj1162579; Fri, 9 Oct 2026 18:28:45 GMT Received: from smtprelay05.wdc07v.mail.ibm.com ([172.16.1.72]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4h6v76t5fp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:45 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay05.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 699IShdm17171184 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Oct 2026 18:28:43 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6EBC05805D; Fri, 9 Oct 2026 18:28:43 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 57EDA58054; Fri, 9 Oct 2026 18:28:42 +0000 (GMT) Received: from li-479af74c-31f9-11b2-a85c-e4ddee11713b.ibm.com.com (unknown [9.61.5.156]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 9 Oct 2026 18:28:42 +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=pL2hA9L+liZfL864u t4GIWMcI/zNawbAGRU46zM/+Js=; b=W6Dcshjost+iaAyIkjObESdeiL0URXDoE YBj5bxK3tFx8LoszZEShkmVJ+rb7129vaO8Jd8Un/omTUcraH5NP7YdgtS+sCD5/ y6c34NZMIO/pi9co5hfIwXGMNgtA4dlsdoMSO+ccyw+FZXUDtMNc20C6x8v2AKns jlIioInPxy+kV+4k5Ombs886tb3ihiDxaq9jcZdEJa8lPZ511HDqSTKeQWZUceyx gZpQeuVeImdwYvnuiab6WtegwSxICCmzbSHOgAJ9lszn2tXWUXXZkhGmlZiXy6ju edku8BG2AEV+B4/OzQyGF7yc6KCeX2k+L+G0Un6o53TgA3Jzf720w== From: Eric Farman To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Matthew Rosato , Cornelia Huck , Konstantin Shkolnyy , Eric Farman Subject: [PULL 13/19] s390x/pci: Add a comment explaining S390PCIIOMMU purpose Date: Fri, 9 Oct 2026 14:28:19 -0400 Message-ID: <20261009182825.148054-14-farman@linux.ibm.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009182825.148054-1-farman@linux.ibm.com> References: <20261009182825.148054-1-farman@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: Nrc-YUDXN-M80N26nGE3bt0j-o6QfeyL X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX2b54VQhGE1bB dsRetbeZ6XEUCg9d/SPc1Nu4OIjlVsqJiq97WiMACidF4AdZR0pyKABp/kUwjyV6Xcb/XFJemPG sRdah7I/vobu5Vq7Ku10Xjp2E7PuTpcwF5W3DzVmRT0yUxdEQCu0/sObkO/MKSbdBMUfzRTrDnR DUkFPz5BRvCp/X5TwJX+CwQTTivm2LwYWsqbXxPqLXyMlh27+xYX3TRQMd1vRZwx+NfX8fA2Xe9 EI0thORPoWCFwiHgkt4xSGn11OahNaVx/XA/nXcSHVAk01OGFwc7ALG/WERg1tyM3fXSOJZtFbg Hcu8jr9BMhatJm9H5swAUVL5FXZ+1R9ML7sYGkPlJRqLhp8cyGtGy7IWi/jtCg9INne76pxsqyW UZCZcB6BZ815QMqoihl52Iffa6+wIDOmbsa61DD+yMt/gF9NopLaoR269OelzDLhY+ATDviyPZo Ps35Iov4jEN5IAC+Y5w== X-Proofpoint-GUID: Nrc-YUDXN-M80N26nGE3bt0j-o6QfeyL X-Proofpoint-Spam-Info: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX+7vE1ZeQX8ru xy9pMMPnVVBnbHV/qRYZqVTTRc0CJs7qdr6IXEYFbLCTvRTiQrxpWcBIRDq1Y5SsW81ON1tiUEH sO7ZzdaEIs2N7kHtDL2Q2mhFP5jPJvs= X-Authority-Analysis: v=2.4 cv=Nf1zRGD4 c=1 sm=1 tr=0 ts=6ac9325d cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=660iZSQnnn4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=ZRniq8bwHbVzLMTk7X8A:9 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-10-09_05,2026-10-09_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 bulkscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 lowpriorityscore=0 impostorscore=0 adultscore=0 suspectscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610090072 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.158.5; envelope-from=farman@linux.ibm.com; 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, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=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.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: 1791570679306158500 Content-Type: text/plain; charset="utf-8" From: Konstantin Shkolnyy Now that S390PCIIOMMU had been reduced to only the IOMMU container information needed by the PCI layer for the associated slot, add a comment explaining the purpose of the structure. Reviewed-by: Matthew Rosato Signed-off-by: Konstantin Shkolnyy Link: https://lore.kernel.org/qemu-devel/20261006001643.420929-14-kshk@linu= x.ibm.com Signed-off-by: Eric Farman --- include/hw/s390x/s390-pci-bus.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/hw/s390x/s390-pci-bus.h b/include/hw/s390x/s390-pci-bu= s.h index c7fa7b9514..5c2d07e38e 100644 --- a/include/hw/s390x/s390-pci-bus.h +++ b/include/hw/s390x/s390-pci-bus.h @@ -272,6 +272,14 @@ typedef struct S390PCIDMACount { QTAILQ_ENTRY(S390PCIDMACount) link; } S390PCIDMACount; =20 +/* + * This structure holds the AddressSpace for a PCI device slot. It must be + * allocated before PCIDevice registration completes, specifically to sati= sfy + * the get_address_space IOMMU callback invoked by do_pci_register_device(= ). + * The root MemoryRegion is otherwise empty; DMA translations only become + * functional once the guest configures the device, at which point + * s390_pci_iommu_enable() registers the zPCI translation subregions benea= th it. + */ struct S390PCIIOMMU { Object parent_obj; AddressSpace as; --=20 2.56.0 From nobody Thu Oct 22 19:24:52 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=1791570600; cv=none; d=zohomail.com; s=zohoarc; b=Zo4SNXyjYv/5CMFyVYzSuQqqUOGrbOwEGL8uZrStZelB34FLWipVJWZvftXvVeHNkdXSKgRsBjNRFYmKgfAjUs9H5fNGPXpU5vTUBHwTCVEKwcoqOem5MeYFOviO1/BBGEH9mzU2lAZ0ov2tyEjPKMrSH7FagMfoMSLK+PMOodU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791570600; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=L3dCY6wl3WogHd9XRJq6dSFqSWcvR331enqF8OsDAx0=; b=O+e41p33uHTifFTZak37cYxu47na8ARPyGXUGZgecmbZgs+hVwOAM7cak/gOcJsGdH3+t2FZ5+r8P5hPKJBei/BaPGe5RPOZpX+FsmDCUSfoDfhzDlNWuB30hDSL3Z/tC8NwlGKSMI9iUmiChCF7wd5SJsrErw1TiZflxrnr4u0= 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 1791570600254894.8742582695943; Fri, 9 Oct 2026 11:30:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xFFKz-0000al-2d; Fri, 09 Oct 2026 14:28:58 -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 1xFFKs-0000YL-IF; Fri, 09 Oct 2026 14:28:50 -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 1xFFKq-0001h1-L5; Fri, 09 Oct 2026 14:28:50 -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 699Ha4Um806487; Fri, 9 Oct 2026 18:28:47 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4h74tdg8rr-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:46 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 699H8E4a1162502; Fri, 9 Oct 2026 18:28:46 GMT Received: from smtprelay06.wdc07v.mail.ibm.com ([172.16.1.73]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4h6v76t5fq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:46 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay06.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 699ISiYN26542754 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Oct 2026 18:28:44 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A46A358054; Fri, 9 Oct 2026 18:28:44 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B93315805A; Fri, 9 Oct 2026 18:28:43 +0000 (GMT) Received: from li-479af74c-31f9-11b2-a85c-e4ddee11713b.ibm.com.com (unknown [9.61.5.156]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 9 Oct 2026 18:28:43 +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=L3dCY6wl3WogHd9XR Jq6dSFqSWcvR331enqF8OsDAx0=; b=N6qaKJDoJiHQeb57NCO2pGd4cEDGKORoe POA5H2aIwwNCmU25nPpbLPuA/bhJ4TyXVBqYZINlN7LBcjcmO9vKe8xVH9/2MPrc BIPYGDClpVwRaFKHFymYXSLTduswLPGJseZTxr9hlruJrrDFgz9U8YXZAbIEX7xO R2VHKlKIuI9QzDYiBSRXQoKmYPu7E2sdsI60FQb5KaqQa7UcEucv2K8nN1m7vyZv R4eqCiN7OEo5vBL61vZ9rQvD7VCsE6kMUDpqHRBrQRIvoS2kmp6ngMjVTlSjDK46 MM4anWuev+ChYj5+uL4+pN5V8BDqQ02L2yxjlmVzu7kHzQ0SxnZbw== From: Eric Farman To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Matthew Rosato , Cornelia Huck , Konstantin Shkolnyy , Eric Farman Subject: [PULL 14/19] s390x/pci: Move ioat sanity checks into new function, add error message Date: Fri, 9 Oct 2026 14:28:20 -0400 Message-ID: <20261009182825.148054-15-farman@linux.ibm.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009182825.148054-1-farman@linux.ibm.com> References: <20261009182825.148054-1-farman@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Authority-Analysis: v=2.4 cv=LqkHWXdc c=1 sm=1 tr=0 ts=6ac9325e cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=660iZSQnnn4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=3pFs7uzPxsaeADVYgZ0A:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX8Fpp+J/B6C0f dSEBDYwKyb3YMqDx3+h3eqNWP+Y6ZVOoobqotQMILeLRND3IBh8tAd6An84Q+rcazbH3ustCjgI /9LgASX4isxzt+5XqL8ZB7p8rIobk+GLy3ARCeNKz3OBzZzuqo5ZkDLzdtXX7W+sPUpsUDGxvaY 9ow4fSKWhYrtwJ7APYvFs9563Y6udnRNsuer1+l/Iw9DgeLR+Y0clypdOVvfeRUCEQ7tKsdqFBK NPwXIabvcNv4MlV47jk8kIEGgfLanKlIT7faKV1s9yjGTmvXttklEr0Evybf/HqanK6vWvpn6cW y3kHYyh7BLtjXSRkKHalUMy4XEVJ1i1lTI7tSYxAJEGqiRYPAuQ7plBmTvop32A6kTCslUygIW+ Pg5+2ZPvMpLIn4l84AnkHNrgj6c5Fqf0HXPVbRafXS28u6xDeNUufzdLrD8iWGoZUroGVCWMJy5 3K6jbf3PF+vHEoAuUxw== X-Proofpoint-GUID: Bl_Jw4AZylTicMUrK926OoEz08JR5QyV X-Proofpoint-Spam-Info: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX8HYi6aM9lWzD ShkaYELWYSryMR96ksLAtsKUGK74ByKTLaV2b6EQxMIzi2hpwCN3iVa+ccQesD3vRHa/lopDYwL xXBDv8imp8yXpDIFgsOyO4tgiGdoXA4= X-Proofpoint-ORIG-GUID: Bl_Jw4AZylTicMUrK926OoEz08JR5QyV 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-10-09_05,2026-10-09_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 phishscore=0 adultscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610090072 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=farman@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.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.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: 1791570602034158500 Content-Type: text/plain; charset="utf-8" From: Konstantin Shkolnyy Extract the pba, pal and g_iota checks from reg_ioat() into a function. Make it external so that it can also be used in a follow up change. Provide a new error message to the path that didn't have it. Signed-off-by: Konstantin Shkolnyy Reviewed-by: Matthew Rosato Link: https://lore.kernel.org/qemu-devel/20261006001643.420929-15-kshk@linu= x.ibm.com Signed-off-by: Eric Farman --- hw/s390x/s390-pci-inst.c | 54 ++++++++++++++++++++------------ include/hw/s390x/s390-pci-inst.h | 2 ++ 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index 98380526d1..98b0ac4990 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -1028,32 +1028,26 @@ bool s390_pci_is_translation_enabled(uint64_t g_iot= a) return ((g_iota >> 11) & 0x1) !=3D 0; /* "T" bit */ } =20 -static int reg_ioat(CPUS390XState *env, S390PCIBusDevice *pbdev, ZpciFib f= ib, - uintptr_t ra) +bool s390_pci_ioat_validate(S390PCIBusDevice *pbdev, uint64_t pba, + uint64_t pal, uint64_t g_iota, Error **errp) { - uint64_t pba =3D ldq_be_p(&fib.pba); - uint64_t pal =3D ldq_be_p(&fib.pal); - uint64_t g_iota =3D ldq_be_p(&fib.iota); uint8_t dt =3D (g_iota >> 2) & 0x7; bool t =3D s390_pci_is_translation_enabled(g_iota); =20 - pba &=3D ~0xfff; - pal |=3D 0xfff; if (pba > pal || pba < pbdev->zpci_fn.sdma || pal > pbdev->zpci_fn.edm= a) { - s390_program_interrupt(env, PGM_OPERAND, ra); - return -EINVAL; + error_setg(errp, + "ioat pba 0x%"PRIx64" pal 0x%"PRIx64" out of device dma= range" + " [0x%"PRIx64" 0x%"PRIx64"]", + pba, pal, pbdev->zpci_fn.sdma, pbdev->zpci_fn.edma); + return false; } - /* currently we only support designation type 1 with translation */ if (t && dt !=3D ZPCI_IOTA_RTTO) { - qemu_log_mask(LOG_GUEST_ERROR, - "unsupported ioat dt %d t %d\n", dt, t); - s390_program_interrupt(env, PGM_OPERAND, ra); - return -EINVAL; + error_setg(errp, "unsupported ioat dt %d t %d", dt, t); + return false; } else if (!t && !pbdev->rtr_avail) { - qemu_log_mask(LOG_GUEST_ERROR, "relaxed translation not allowed\n"= ); - s390_program_interrupt(env, PGM_OPERAND, ra); - return -EINVAL; + error_setg(errp, "relaxed translation not allowed"); + return false; } =20 /* @@ -1064,9 +1058,29 @@ static int reg_ioat(CPUS390XState *env, S390PCIBusDe= vice *pbdev, ZpciFib fib, * to QEMU for additional IOAT regions. */ if (t && pal >=3D ZPCI_TABLE_SIZE_RT) { - qemu_log_mask(LOG_GUEST_ERROR, - "ioat pal 0x%"PRIx64" exceeds max translatable addre= ss\n", - pal); + error_setg(errp, + "ioat pal 0x%"PRIx64" exceeds max translatable address", + pal); + return false; + } + return true; +} + +static int reg_ioat(CPUS390XState *env, S390PCIBusDevice *pbdev, ZpciFib f= ib, + uintptr_t ra) +{ + Error *err =3D NULL; + uint64_t pba =3D ldq_be_p(&fib.pba); + uint64_t pal =3D ldq_be_p(&fib.pal); + uint64_t g_iota =3D ldq_be_p(&fib.iota); + bool t =3D s390_pci_is_translation_enabled(g_iota); + + pba &=3D ~0xfff; + pal |=3D 0xfff; + + if (!s390_pci_ioat_validate(pbdev, pba, pal, g_iota, &err)) { + qemu_log_mask(LOG_GUEST_ERROR, "%s\n", error_get_pretty(err)); + error_free(err); s390_program_interrupt(env, PGM_OPERAND, ra); return -EINVAL; } diff --git a/include/hw/s390x/s390-pci-inst.h b/include/hw/s390x/s390-pci-i= nst.h index 38268c256e..3493d2ced0 100644 --- a/include/hw/s390x/s390-pci-inst.h +++ b/include/hw/s390x/s390-pci-inst.h @@ -100,6 +100,8 @@ typedef struct ZpciFib { =20 int pci_dereg_irqs(S390PCIBusDevice *pbdev); void pci_dereg_ioat(S390PCIBusDevice *pbdev); +bool s390_pci_ioat_validate(S390PCIBusDevice *pbdev, uint64_t pba, + uint64_t pal, uint64_t g_iota, Error **errp); int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra); int pcilg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2, uintptr_t ra); int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2, uintptr_t ra= ); --=20 2.56.0 From nobody Thu Oct 22 19:24:52 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=1791570637; cv=none; d=zohomail.com; s=zohoarc; b=W+RrYaFbFCPU73+lMsiceIu2MKxuAMkZmsNRdpapl8aN+ywMij/9M28Q2WYmNSYlc3jOY7PNYQQW7qGfi2GEQBQaZ6reyRQ5SYD0EMVVIo+YA6QYgW8QoumZJZx1mZJPUITE6e/FrParhjT/k+7FLk06sggGzECJON65sY6A7jQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791570637; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZRPgz6qR933JQAUhfJnauJMw5nsKnr1kch91eypDPkg=; b=POU6LfKmIgOd8H8PBGFf3f0kMXFQBCki4KHk8f4N/zNaNXay2V608xmgW45ZmPQUCoSIR3NbQw1qTY9XUXnEAz2JB/VZnrEYV2KOQTiO7uLT7vdeBdfs8dm+al541t0Z1WWhIIFv4ussa0VcBGcMvJQqWPz8inj9uNGCb5DSEok= 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 1791570637376712.8796617193277; Fri, 9 Oct 2026 11:30:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xFFL5-0000gA-9l; Fri, 09 Oct 2026 14:29:03 -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 1xFFKt-0000Yd-1a; Fri, 09 Oct 2026 14:28:52 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xFFKr-0001hD-Bs; Fri, 09 Oct 2026 14:28:50 -0400 Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 699Ha4Xi3714688; Fri, 9 Oct 2026 18:28:48 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4h74ter88f-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:47 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 699H8OIl4125988; Fri, 9 Oct 2026 18:28:47 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([172.16.1.74]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4h5f3u45nb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:47 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 699ISjCs197260 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Oct 2026 18:28:45 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B1D385805A; Fri, 9 Oct 2026 18:28:45 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D55D958054; Fri, 9 Oct 2026 18:28:44 +0000 (GMT) Received: from li-479af74c-31f9-11b2-a85c-e4ddee11713b.ibm.com.com (unknown [9.61.5.156]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 9 Oct 2026 18:28:44 +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=ZRPgz6qR933JQAUhf JnauJMw5nsKnr1kch91eypDPkg=; b=Pa9/ionLOXWf07LDTRZw0Mz2FiGiYgETi 7EDEXlJE/t4pIHETFvWJpBXozUZS5mm4KDkc9RS5pjpmgNTWCrLPQRqHeZw5v8M+ 6SboBQvZITxovw+rud74+mEWMZyHmMMV3S1n/SVlBfvETXfIQRGvuOxPFbPCIGu8 Ud74WFsNhzQFU/LoQvjP6UkWOBPdwp8yHdm8Q44vMQNDNspPSfeqr/9hmFBZuR5h Wuzgfydwi3JI/oc9ygLbn8+R6uLKk5W0cDGN7QG4AcRFfbjYi8AaohIo829Qb/fv 3mV9XrkeA684savzLm1He+mznnlRJx26WDr3HydwRLZ8n6AmMsDig== From: Eric Farman To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Matthew Rosato , Cornelia Huck , Konstantin Shkolnyy , Eric Farman Subject: [PULL 15/19] s390x/pci: Provide each zpci device with a unique stable bus "path" Date: Fri, 9 Oct 2026 14:28:21 -0400 Message-ID: <20261009182825.148054-16-farman@linux.ibm.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009182825.148054-1-farman@linux.ibm.com> References: <20261009182825.148054-1-farman@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: QdWxz4K78jNG_kSja1XQyc3OUh6jD8g4 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfXwj4ES9EtUoEE 07QJUtnEVbEeDmgheuRT8OjOq4EOxPhdPLaIkTcG45Myw0MoUFlAb0TEz07LHIoY179aHmeM75O loomHWUuYZvY4laU5aeAfB1Suwd9pbiKFyTbc7L+OUJTe1hU53rhxvseh5bgjuDQYNqCk0vdJH2 1ufgQ9oIRREjIvyQtbUvkeckTPJQZoR6tHXjMlxIXuU90c10iKybvsvey3MK3aYcaYN9j8WHB6I wt3ieE+nbgwuUYaVplgx50+oSpu6lfQrZPxypggTJGsWJBMezhYxBgfErJEud/phzimqIcX0QWh LDjfHPvWVHaZkN1+EHwEsP+ob2UB3oyvRPc+u+VbNNWKA8kzsHdkxRmFw3yBXqq/1iZ+v7nwkM1 9mwy33gm6sU1xGkwR7eQWrYZXzrKkRlql7aW6WaLvH8X6ld2ipZ0kwHmYi7ncagYEbMtFu2gPy7 lttWoyqYOI9pxWHi3eA== X-Proofpoint-GUID: QdWxz4K78jNG_kSja1XQyc3OUh6jD8g4 X-Proofpoint-Spam-Info: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX8VRf9sM4DvZC nOMTzl8EItkRaOTPcycIfoIumlx8GFYPy1/fThbWiYr+6lCn5IV4+59CeV0mVrSbwI/V1NB+Uhg lD++0HDUeNgMkvsu4KxBWDIypJDNnlQ= X-Authority-Analysis: v=2.4 cv=Nf1zRGD4 c=1 sm=1 tr=0 ts=6ac93260 cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=660iZSQnnn4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=X9i1E-zOIupQ93g3ad8A:9 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-10-09_05,2026-10-09_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 bulkscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 lowpriorityscore=0 impostorscore=0 adultscore=0 suspectscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610090072 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.158.5; envelope-from=farman@linux.ibm.com; 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, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=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.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: 1791570638584158500 Content-Type: text/plain; charset="utf-8" From: Konstantin Shkolnyy This is necessary for the follow-on migration support. The new unique UID-based bus "path" is used as part of idstr in the migration stream, making idstr unique and instance_id always 0. For migration to succeed, (idstr+instance_id) must match those generated during QEMU start. Without unique idstr, QEMU will generate variable instance_id to distinguish devices, and that instance_id can change if a device is unplugged and plugged back, preventing migration. Signed-off-by: Konstantin Shkolnyy Reviewed-by: Farhan Ali Reviewed-by: Matthew Rosato Link: https://lore.kernel.org/qemu-devel/20261006001643.420929-16-kshk@linu= x.ibm.com Signed-off-by: Eric Farman --- hw/s390x/s390-pci-bus.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 799e596fec..7dff771ee6 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -1474,10 +1474,33 @@ static const TypeInfo s390_pcihost_info =3D { } }; =20 +/* Return a unique bus "path" for zpci device */ +static char *s390_pci_bus_get_dev_path(DeviceState *dev) +{ + S390PCIBusDevice *pbdev =3D S390_PCI_DEVICE(dev); + return g_strdup_printf("uid-%04x", pbdev->uid); +} + +static void s390_pcibus_class_init(ObjectClass *oc, const void *data) +{ + BusClass *bc =3D BUS_CLASS(oc); + bc->get_dev_path =3D s390_pci_bus_get_dev_path; +} + static const TypeInfo s390_pcibus_info =3D { .name =3D TYPE_S390_PCI_BUS, .parent =3D TYPE_BUS, .instance_size =3D sizeof(S390PCIBus), + /* + * Implement get_dev_path() to provide each zpci device with a unique + * stable UID-based bus "path". The "path" is used as part of idstr in= the + * migration stream, making idstr unique and instance_id always 0. + * For migration to succeed, (idstr+instance_id) must match those gene= rated + * during QEMU start. Without unique idstr, QEMU will generate variable + * instance_id to distinguish devices, and that instance_id can change + * if a device is unplugged and plugged back, preventing migration. + */ + .class_init =3D s390_pcibus_class_init, }; =20 static uint16_t s390_pci_generate_uid(S390pciState *s) --=20 2.56.0 From nobody Thu Oct 22 19:24:52 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=1791570822; cv=none; d=zohomail.com; s=zohoarc; b=EuOxiVs5MAIw+9Bnugkg1Zax+XxFeDDwydnLO48ZhK6NgSsFrWdcKuTPEK6oUALnXic1WSkhTNGko3vEOJdwDoxoyh/KKwuG0yjVflfEjiTnBmkCkwh6xNrbT/pGq8S+f54RqEJ57z2YTwtpiaOJ3yiwyWVBFEwaFNsaR2J8v6k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791570822; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VHEfMLLqon0DN6O+gQGsg2niW3waqZJEF+ht0JBWtKs=; b=N6h6d4WTSHnsKhgpu0AJ24mJBoj0nNnuIRUagnB+u8x+NOBpkOx5kYBvPE4+4/rAlYkjkLrcG4HQuh+P1U2El1vFabneIAwKti/Cw4tA1eH0gXN/6nplk9cGOy6JTN2VX+MZ3wa2RpRhelJXxsNyf+XGQEKHiE5/LE8yKghhIFw= 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 1791570822098868.7758053635168; Fri, 9 Oct 2026 11:33:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xFFL3-0000cq-7V; Fri, 09 Oct 2026 14:29:01 -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 1xFFKx-0000Zg-ET; Fri, 09 Oct 2026 14:28:56 -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 1xFFKs-0001hV-ND; Fri, 09 Oct 2026 14:28:55 -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 699HZtv1806271; Fri, 9 Oct 2026 18:28:49 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4h74tdg8ru-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:48 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 699H8P9m4125998; Fri, 9 Oct 2026 18:28:48 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4h5f3u45ne-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:48 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 699ISlJJ24248978 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Oct 2026 18:28:47 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DC8C358054; Fri, 9 Oct 2026 18:28:46 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E57435805A; Fri, 9 Oct 2026 18:28:45 +0000 (GMT) Received: from li-479af74c-31f9-11b2-a85c-e4ddee11713b.ibm.com.com (unknown [9.61.5.156]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 9 Oct 2026 18:28:45 +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=VHEfMLLqon0DN6O+g QGsg2niW3waqZJEF+ht0JBWtKs=; b=LwYK3qZJ0s5mzNG5sqtBa5ZQcxpWaGxEk bP5LnqnWVQVLFUXQDwN6PAcs2mVrrMoHMrXPpR0rzdNuZualcwJgGhwMARvt+9Dt gOGB9xYyvaBi2A2rPvaxIbsbnuc5WKYY65FPu3cP7dU9eKLLpjcliVoBHt9BsoFg DuaQc1/XOOvK1xKQVTFX5QWekEXzcrogYJtEzrF+f08oXAKPNA12aKiB0BlE/dFY HsmHn+7cUx+gzFzIZFIFTs6jGvK3OVF7gyeSocTTSBAS1wd3spN/+jJZ5kwZsefW 4OceXEKP+1uLbiB3qK9ORlZ5/8IieajW0rDUcKZP+/e+5dr8tH18g== From: Eric Farman To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Matthew Rosato , Cornelia Huck , Konstantin Shkolnyy , Eric Farman Subject: [PULL 16/19] s390x/pci: Implement migration for emulated devices Date: Fri, 9 Oct 2026 14:28:22 -0400 Message-ID: <20261009182825.148054-17-farman@linux.ibm.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009182825.148054-1-farman@linux.ibm.com> References: <20261009182825.148054-1-farman@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Authority-Analysis: v=2.4 cv=LqkHWXdc c=1 sm=1 tr=0 ts=6ac93261 cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=660iZSQnnn4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=SYYICNKFp82yG71YkvsA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX8arUgpKB0A8l 4Je5PNGXQNbgp1Q4TKlG+o7n5/yI7gEo8vcxfeopNpQUTykNyrt5lMzpF5if3QmoI30OHtATvOv zlNHFso5hvWA0ZR/DWRd3C6HyB8Rv5UysN+mu1R6u/Jig0Uf0bPoe14yvmiJ2/pfw6EsMjhWAsc SyHcbyjWtL//pZNUi4UZ3oSmpB7oUGxWlQZp+rGH1S6H9qwAY5b332y/6s4w5vyoyk7y9JyxE6R U+BiJjKPkQiIwjCnMfbWCz5w+77nFEEyqYYJDN1ynC6Sqtt0OD9AdAtNAfYbfw+oGEoXmxe16Rn wNSoUUzTKI5Z0QVxoYwrLaAmQx6KXJwwx1oJp5fsbUtXjPNBMcwGbsdyzOuhAaYZ4JT+nuv2M5o 7h8c/pMkaomDbolH9TN5kvPqOlSOCKFTXySlPaSt+toj36uHHzF1Jrl91L8uQvq2RojBHX23jFo UGlGmQYkaf0H8gKD4IA== X-Proofpoint-GUID: kXpY6DPSrx2Cal2MFcAj_mOGdCrcS1Mp X-Proofpoint-Spam-Info: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfXwV5VEdMHtbkV WgskfFCLyr3z+C+72FQMHb0LicAr6TUPMNwrK9BoYEqNnNeXJV8ClyHtyOU59spgBf/kiBG152S efHXQIqB/vJRB1uu8yRuJSbelUtyzPA= X-Proofpoint-ORIG-GUID: kXpY6DPSrx2Cal2MFcAj_mOGdCrcS1Mp 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-10-09_05,2026-10-09_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 phishscore=0 adultscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610090072 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=farman@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.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.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: 1791570824096158500 Content-Type: text/plain; charset="utf-8" From: Konstantin Shkolnyy Implement zPCI device state migration, consequently enabling migration of VMs that have emulated PCI devices, whether virtio or not. Migration is allowed for devices whose function handle has the FH_SHM_EMUL bit set. For these devices QEMU will save and restore the state of its zPCI emulator. This will enable emulated PCI migration starting with s390-ccw-virtio-11.2. Passthrough devices will continue to block migration. Signed-off-by: Konstantin Shkolnyy Reviewed-by: Farhan Ali Reviewed-by: Matthew Rosato Link: https://lore.kernel.org/qemu-devel/20261006001643.420929-17-kshk@linu= x.ibm.com Signed-off-by: Eric Farman --- hw/s390x/s390-pci-bus.c | 346 ++++++++++++++++++++++++++++++- hw/s390x/s390-pci-inst.c | 2 +- hw/s390x/s390-virtio-ccw.c | 4 + include/hw/s390x/s390-pci-bus.h | 9 +- include/hw/s390x/s390-pci-inst.h | 1 + 5 files changed, 353 insertions(+), 9 deletions(-) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 7dff771ee6..5f8712ac76 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -26,6 +26,8 @@ #include "hw/pci/pci_bridge.h" #include "hw/pci/msi.h" #include "exec/cpu-common.h" +#include "migration/blocker.h" +#include "migration/vmstate.h" #include "qemu/error-report.h" #include "qemu/module.h" #include "system/physmem.h" @@ -927,6 +929,8 @@ static void set_pbdev_info(S390PCIBusDevice *pbdev) pbdev->pci_group =3D s390_group_find(ZPCI_DEFAULT_FN_GRP); } =20 +static const VMStateDescription s390_pcihost_vmstate; + static void s390_pcihost_realize(DeviceState *dev, Error **errp) { PCIBus *b; @@ -961,6 +965,7 @@ static void s390_pcihost_realize(DeviceState *dev, Erro= r **errp) s390_pci_init_default_group(); css_register_io_adapters(CSS_IO_ADAPTER_PCI, true, false, S390_ADAPTER_SUPPRESSIBLE, errp); + vmstate_register(VMSTATE_IF(dev), 0, &s390_pcihost_vmstate, s); s390_pcihost_kvm_realize(); } =20 @@ -1139,12 +1144,47 @@ static int s390_pci_interp_plug(S390pciState *s, S3= 90PCIBusDevice *pbdev) return 0; } =20 +static int s390_set_zpci_migration_blocker(S390PCIBusDevice *pbdev, + S390pciState *s, Error **errp) +{ + if (s->zpci_migr_enabled) { + return 0; + } + error_setg(&pbdev->zpci_migr_blocker, + "Migration blocked on this machine type by zPCI device " + "uid %d", pbdev->uid); + return migrate_add_blocker(&pbdev->zpci_migr_blocker, errp); +} + +static void s390_clear_zpci_migration_blocker(S390PCIBusDevice *pbdev) +{ + migrate_del_blocker(&pbdev->zpci_migr_blocker); +} + +static int s390_set_passthrough_migration_blocker(S390PCIBusDevice *pbdev, + Error **errp) +{ + if (pbdev->fh & FH_SHM_EMUL) { + return 0; + } + error_setg(&pbdev->passthrough_migr_blocker, + "Migration blocked by passthrough zPCI device uid %d", + pbdev->uid); + return migrate_add_blocker(&pbdev->passthrough_migr_blocker, errp); +} + +static void s390_clear_passthrough_migration_blocker(S390PCIBusDevice *pbd= ev) +{ + migrate_del_blocker(&pbdev->passthrough_migr_blocker); +} + static void s390_pcihost_plug(const HotplugHandler *hotplug_dev, DeviceSta= te *dev, Error **errp) { S390pciState *s =3D S390_PCI_HOST_BRIDGE(hotplug_dev); PCIDevice *pdev =3D NULL; S390PCIBusDevice *pbdev =3D NULL; + bool auto_pbdev =3D false; int rc; =20 if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_BRIDGE)) { @@ -1204,6 +1244,7 @@ static void s390_pcihost_plug(const HotplugHandler *h= otplug_dev, DeviceState *de if (!pbdev) { return; } + auto_pbdev =3D true; } =20 pbdev->pdev =3D pdev; @@ -1223,7 +1264,7 @@ static void s390_pcihost_plug(const HotplugHandler *h= otplug_dev, DeviceState *de if (rc) { error_setg(errp, "Plug failed for zPCI device in " "interpretation mode: %d", rc); - return; + goto err_unlink_pbdev; } } else { trace_s390_pcihost("zPCI interpretation missing"); @@ -1252,16 +1293,46 @@ static void s390_pcihost_plug(const HotplugHandler = *hotplug_dev, DeviceState *de pbdev->rtr_avail =3D false; } =20 + if (s390_set_passthrough_migration_blocker(pbdev, errp) !=3D 0) { + goto err_unlink_pbdev; + } + if (s390_pci_msix_init(pbdev) && !pbdev->interp) { error_setg(errp, "MSI-X support is mandatory " "in the S390 architecture"); - return; + s390_clear_passthrough_migration_blocker(pbdev); + goto err_unlink_pbdev; } =20 if (dev->hotplugged) { s390_pci_generate_plug_event(HP_EVENT_TO_CONFIGURED , pbdev->fh, pbdev->fid); } + return; + +err_unlink_pbdev: + if (pbdev->pft =3D=3D ZPCI_PFT_ISM) { + notifier_remove(&pbdev->shutdown_notifier); + } + if (pbdev->dma_limit) { + s390_pci_end_dma_count(s, pbdev->dma_limit); + pbdev->dma_limit =3D NULL; + } + pbdev->fh &=3D ~FH_MASK_SHM; + pbdev->iommu =3D NULL; + pbdev->pdev =3D NULL; + pbdev->state =3D ZPCI_FS_RESERVED; + if (auto_pbdev) { + QTAILQ_REMOVE(&s->zpci_devs, pbdev, link); + if (g_hash_table_lookup(s->zpci_table, &pbdev->idx) =3D=3D pbd= ev) { + g_hash_table_remove(s->zpci_table, &pbdev->idx); + } + g_hash_table_destroy(pbdev->iotlb); + s390_clear_zpci_migration_blocker(pbdev); + qdev_unrealize(DEVICE(pbdev)); + object_unparent(OBJECT(pbdev)); + } + return; } else if (object_dynamic_cast(OBJECT(dev), TYPE_S390_PCI_DEVICE)) { pbdev =3D S390_PCI_DEVICE(dev); =20 @@ -1272,6 +1343,12 @@ static void s390_pcihost_plug(const HotplugHandler *= hotplug_dev, DeviceState *de NULL, g_free); QTAILQ_INSERT_TAIL(&s->zpci_devs, pbdev, link); g_hash_table_insert(s->zpci_table, &pbdev->idx, pbdev); + if (s390_set_zpci_migration_blocker(pbdev, s, errp) !=3D 0) { + g_hash_table_remove(s->zpci_table, &pbdev->idx); + QTAILQ_REMOVE(&s->zpci_devs, pbdev, link); + g_hash_table_destroy(pbdev->iotlb); + return; + } } else { g_assert_not_reached(); } @@ -1294,6 +1371,8 @@ static void s390_pcihost_unplug(const HotplugHandler = *hotplug_dev, DeviceState * return; } =20 + s390_clear_passthrough_migration_blocker(pbdev); + s390_pci_generate_plug_event(HP_EVENT_STANDBY_TO_RESERVED, pbdev->fh, pbdev->fid); bus =3D pci_get_bus(pci_dev); @@ -1313,6 +1392,7 @@ static void s390_pcihost_unplug(const HotplugHandler = *hotplug_dev, DeviceState * s390_pci_end_dma_count(s, pbdev->dma_limit); } g_hash_table_destroy(pbdev->iotlb); + s390_clear_zpci_migration_blocker(pbdev); qdev_unrealize(dev); } } @@ -1417,6 +1497,16 @@ void s390_pci_ism_reset(void) } } =20 +static void s390_pci_clear_pending_sei(S390pciState *s) +{ + SeiContainer *sei_cont; + + while ((sei_cont =3D QTAILQ_FIRST(&s->pending_sei))) { + QTAILQ_REMOVE(&s->pending_sei, sei_cont, link); + g_free(sei_cont); + } +} + static void s390_pcihost_reset(DeviceState *dev) { S390pciState *s =3D S390_PCI_HOST_BRIDGE(dev); @@ -1440,6 +1530,8 @@ static void s390_pcihost_reset(DeviceState *dev) } } =20 + s390_pci_clear_pending_sei(s); + /* * When resetting a PCI bridge, the assigned numbers are set to 0. So * on every system reset, we also have to reassign numbers. @@ -1448,6 +1540,109 @@ static void s390_pcihost_reset(DeviceState *dev) pci_for_each_device_under_bus(bus, s390_pci_enumerate_bridge, s); } =20 +/* + * TYPE_S390_PCI_HOST_BRIDGE device state migration is registered via + * vmstate_register() rather than dc->vmsd because dc->vmsd is already ass= igned + * by our base, TYPE_PCI_HOST_BRIDGE, to &vmstate_pcihost which migrates + * PCIHostState.config_reg. There is no mechanism to add a subclass vmsd t= o the + * parent's. + */ +static bool s390_pcihost_vmstate_needed(void *opaque) +{ + S390pciState *s =3D S390_PCI_HOST_BRIDGE(opaque); + return s->zpci_migr_enabled; +} + +static bool s390_pcihost_pending_sei_vmstate_needed(void *opaque) +{ + S390pciState *s =3D S390_PCI_HOST_BRIDGE(opaque); + return s->zpci_migr_enabled && !QTAILQ_EMPTY(&s->pending_sei); +} + +/* Per-element descriptor for pending_sei list */ +static const VMStateDescription vmstate_sei_container =3D { + .name =3D "s390_sei_container", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (const VMStateField[]) { + VMSTATE_UINT32(fid, SeiContainer), + VMSTATE_UINT32(fh, SeiContainer), + VMSTATE_UINT8(cc, SeiContainer), + VMSTATE_UINT16(pec, SeiContainer), + VMSTATE_UINT64(faddr, SeiContainer), + VMSTATE_UINT32(e, SeiContainer), + VMSTATE_END_OF_LIST() + } +}; + +/* + * When pending_sei load is executed, pending_sei can already contain SEIs + * generated here in the target QEMU, for example, by state loads of zpci + * devices. A dumb load here would place the older SEIs from the source QE= MU + * after the new SEIs. To fix this, we have pre_load() stash the new SEIs = from + * pending_sei and post_load() unstash them after the old ones. + */ +static void s390_pci_move_sei_list(SeiContainerList *dst, SeiContainerList= *src) +{ + SeiContainer *sei_cont; + + while ((sei_cont =3D QTAILQ_FIRST(src))) { + QTAILQ_REMOVE(src, sei_cont, link); + QTAILQ_INSERT_TAIL(dst, sei_cont, link); + } +} + +static int s390_pcihost_pending_sei_vmstate_pre_load(void *opaque) +{ + S390pciState *s =3D S390_PCI_HOST_BRIDGE(opaque); + + QTAILQ_INIT(&s->pending_sei_stash); + s390_pci_move_sei_list(&s->pending_sei_stash, &s->pending_sei); + return 0; +} + +static int s390_pcihost_pending_sei_vmstate_post_load(void *opaque, + int version_id) +{ + S390pciState *s =3D S390_PCI_HOST_BRIDGE(opaque); + + s390_pci_move_sei_list(&s->pending_sei, &s->pending_sei_stash); + return 0; +} + +static const VMStateDescription s390_pcihost_pending_sei_vmstate =3D { + .name =3D TYPE_S390_PCI_HOST_BRIDGE "/pending-sei", + .version_id =3D 1, + .minimum_version_id =3D 1, + .needed =3D s390_pcihost_pending_sei_vmstate_needed, + .pre_load =3D s390_pcihost_pending_sei_vmstate_pre_load, + .post_load =3D s390_pcihost_pending_sei_vmstate_post_load, + .fields =3D (const VMStateField[]) { + VMSTATE_QTAILQ_V(pending_sei, S390pciState, 1, + vmstate_sei_container, SeiContainer, link), + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription s390_pcihost_vmstate =3D { + .name =3D TYPE_S390_PCI_HOST_BRIDGE, + .version_id =3D 1, + .minimum_version_id =3D 1, + .needed =3D s390_pcihost_vmstate_needed, + .fields =3D (const VMStateField[]) { + VMSTATE_END_OF_LIST() + }, + .subsections =3D (const VMStateDescription * const []) { + &s390_pcihost_pending_sei_vmstate, + NULL + } +}; + +static const Property phb_props[] =3D { + DEFINE_PROP_BOOL("x-zpci-migr-enabled", S390pciState, + zpci_migr_enabled, true), +}; + static void s390_pcihost_class_init(ObjectClass *klass, const void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -1461,6 +1656,7 @@ static void s390_pcihost_class_init(ObjectClass *klas= s, const void *data) hc->unplug_request =3D s390_pcihost_unplug_request; hc->unplug =3D s390_pcihost_unplug; msi_nonbroken =3D true; + device_class_set_props(dc, phb_props); } =20 static const TypeInfo s390_pcihost_info =3D { @@ -1646,13 +1842,149 @@ static const Property s390_pci_device_properties[]= =3D { true), }; =20 -static const VMStateDescription s390_pci_device_vmstate =3D { - .name =3D TYPE_S390_PCI_DEVICE, +static int s390_pci_device_pre_load(void *opaque) +{ + S390PCIBusDevice *pbdev =3D S390_PCI_DEVICE(opaque); + S390PCIBusDevice *found_pbdev; + + /* + * Because state loading can change pbdev->idx make sure pbdev is remo= ved + * from the table before that happens. The table type used stores a po= inter + * to pbdev->idx and becomes corrupt if idx is changed from outside. B= ut be + * careful to not remove instead another pbdev whose state might have = been + * loaded earlier and that got assigned this idx value and had therefo= re + * already replaced our pbdev in the table. post_load() will reinsert = our + * pbdev into the table. (found_pbdev could even be 0 if a previous + * vmstate_load_vmsd() on this device failed before reaching post_load= ().) + */ + found_pbdev =3D g_hash_table_lookup(s390_get_phb()->zpci_table, &pbdev= ->idx); + if (found_pbdev =3D=3D pbdev) { + g_hash_table_remove(s390_get_phb()->zpci_table, &pbdev->idx); + } + + return 0; +} + +static bool s390_pci_device_post_load_errp(void *opaque, int version_id, + Error **errp) +{ + S390PCIBusDevice *pbdev =3D S390_PCI_DEVICE(opaque); + /* - * TODO: add state handling here, so migration works at least with - * emulated pci devices on s390x + * Guard against the scenario that s390_pcihost_plug() of the target P= CI + * device succeeded in the source QEMU, but failed on this destination + * QEMU, before migration state load. In this case we'll find !pbdev->= pdev + * but the pbdev->state !=3D ZPCI_FS_RESERVED as just loaded from the = stream. + * Such value combination is invalid and migration should fail. */ - .unmigratable =3D 1, + if (pbdev->state !=3D ZPCI_FS_RESERVED && !pbdev->pdev) { + error_setg(errp, "zpci device uid 0x%x state %d has no PCI device", + pbdev->uid, pbdev->state); + return false; + } + + pbdev->zpci_fn.fid =3D pbdev->fid; + pbdev->zpci_fn.uid =3D pbdev->uid; + + /* + * Now that pbdev->idx has been loaded, use it to place pbdev back into + * the table. This may replace a different not-yet-state-loaded pbdev, + * but pre_load() handles this case. + */ + g_hash_table_replace(s390_get_phb()->zpci_table, &pbdev->idx, pbdev); + + /* + * Regenerate IOMMU state, including IOTLB contents and QEMU memory re= gions. + */ + if (pbdev->iommu_enabled) { + if (!pbdev->iommu) { + error_setg(errp, "iommu is NULL"); + return false; + } + if (!s390_pci_ioat_validate(pbdev, pbdev->pba, pbdev->pal, + pbdev->g_iota, errp)) { + error_prepend(errp, "migration stream error: "); + return false; + } + if (s390_pci_is_translation_enabled(pbdev->g_iota)) { + s390_pci_iommu_enable(pbdev); + s390_pci_ioat_replay(pbdev); + } else { + /* + * TODO: if/when either emulated devices are allowed to set + * rtr_avail or migration of VFIO devices is added, this path + * will need to call s390_pci_iommu_direct_map_enable(pbdev). + */ + g_assert_not_reached(); + } + } + + /* + * Guest sets fmb_addr by mpcifc.ZPCI_MOD_FC_SET_MEASURE instruction, + * whose handler consequently starts fmb_timer. We may need to restart= it. + */ + if (pbdev->fmb_addr) { + if (pbdev->fmb_timer) { + error_setg(errp, "fmb_timer is not NULL"); + return false; + } + if (!pbdev->pci_group) { + error_setg(errp, "pci_group is NULL"); + return false; + } + pbdev->fmb_timer =3D timer_new_ms(QEMU_CLOCK_VIRTUAL, + fmb_update, pbdev); + timer_mod(pbdev->fmb_timer, + qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + + pbdev->pci_group->zpci_group.mui); + } + return true; +} + +static const VMStateDescription s390_pci_device_vmstate =3D { + .name =3D TYPE_S390_PCI_DEVICE, + .version_id =3D 1, + .minimum_version_id =3D 1, + .priority =3D MIG_PRI_IOMMU, + .pre_load =3D s390_pci_device_pre_load, + .post_load_errp =3D s390_pci_device_post_load_errp, + .fields =3D (const VMStateField[]) { + VMSTATE_UINT32(state, S390PCIBusDevice), + VMSTATE_UINT16(uid, S390PCIBusDevice), + VMSTATE_UINT32(idx, S390PCIBusDevice), + VMSTATE_UINT32(fh, S390PCIBusDevice), + VMSTATE_UINT32(fid, S390PCIBusDevice), + VMSTATE_BOOL(fid_defined, S390PCIBusDevice), + VMSTATE_UINT64(fmb_addr, S390PCIBusDevice), + VMSTATE_UINT32(fmb.format, S390PCIBusDevice), + VMSTATE_UINT32(fmb.sample, S390PCIBusDevice), + VMSTATE_UINT64(fmb.last_update, S390PCIBusDevice), + VMSTATE_UINT64_ARRAY(fmb.counter, S390PCIBusDevice, + ARRAY_SIZE(((S390PCIBusDevice *)0)->fmb.counter)), + VMSTATE_UINT64(fmb.fmt0.dma_rbytes, S390PCIBusDevice), + VMSTATE_UINT64(fmb.fmt0.dma_wbytes, S390PCIBusDevice), + VMSTATE_UINT8(isc, S390PCIBusDevice), + VMSTATE_UINT16(noi, S390PCIBusDevice), + VMSTATE_UINT8(sum, S390PCIBusDevice), + VMSTATE_UINT8(pft, S390PCIBusDevice), + VMSTATE_UINT64(routes.adapter.ind_addr, S390PCIBusDevice), + VMSTATE_UINT64(routes.adapter.summary_addr, S390PCIBusDevice), + VMSTATE_UINT64(routes.adapter.ind_offset, S390PCIBusDevice), + VMSTATE_UINT32(routes.adapter.summary_offset, S390PCIBusDevice), + VMSTATE_UINT32(routes.adapter.adapter_id, S390PCIBusDevice), + VMSTATE_BOOL(iommu_enabled, S390PCIBusDevice), + VMSTATE_UINT64(g_iota, S390PCIBusDevice), + VMSTATE_UINT64(pba, S390PCIBusDevice), + VMSTATE_UINT64(pal, S390PCIBusDevice), + VMSTATE_PTR_TO_IND_ADDR(summary_ind, S390PCIBusDevice), + VMSTATE_PTR_TO_IND_ADDR(indicator, S390PCIBusDevice), + VMSTATE_BOOL(unplug_requested, S390PCIBusDevice), + VMSTATE_BOOL(interp, S390PCIBusDevice), + VMSTATE_BOOL(forwarding_assist, S390PCIBusDevice), + VMSTATE_BOOL(aif, S390PCIBusDevice), + VMSTATE_BOOL(rtr_avail, S390PCIBusDevice), + VMSTATE_END_OF_LIST() + } }; =20 static void s390_pci_device_class_init(ObjectClass *klass, const void *dat= a) diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index 98b0ac4990..f620d45e6c 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -1156,7 +1156,7 @@ static int fmb_do_update(S390PCIBusDevice *pbdev, int= offset, uint64_t val, return ret; } =20 -static void fmb_update(void *opaque) +void fmb_update(void *opaque) { S390PCIBusDevice *pbdev =3D opaque; int64_t t =3D qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL); diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 9e2db872fb..fda5ecc9ad 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -1018,12 +1018,16 @@ static void ccw_machine_11_1_instance_options(Machi= neState *machine) static void ccw_machine_11_1_class_options(MachineClass *mc) { S390CcwMachineClass *s390mc =3D S390_CCW_MACHINE_CLASS(mc); + static GlobalProperty compat[] =3D { + { TYPE_S390_PCI_HOST_BRIDGE, "x-zpci-migr-enabled", "off" }, + }; =20 s390mc->use_certs =3D false; s390mc->use_secure =3D false; =20 ccw_machine_11_2_class_options(mc); compat_props_add(mc->compat_props, hw_compat_11_1, hw_compat_11_1_len); + compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); } DEFINE_CCW_MACHINE(11, 1); =20 diff --git a/include/hw/s390x/s390-pci-bus.h b/include/hw/s390x/s390-pci-bu= s.h index 5c2d07e38e..71f956700b 100644 --- a/include/hw/s390x/s390-pci-bus.h +++ b/include/hw/s390x/s390-pci-bus.h @@ -338,6 +338,8 @@ struct S390PCIBusDevice { uint16_t uid; uint32_t idx; uint32_t fh; + Error *zpci_migr_blocker; /* machines 11.1 or older */ + Error *passthrough_migr_blocker; uint32_t fid; bool fid_defined; uint64_t fmb_addr; @@ -379,6 +381,8 @@ struct S390PCIBus { BusState qbus; }; =20 +typedef QTAILQ_HEAD(SeiContainerList, SeiContainer) SeiContainerList; + struct S390pciState { PCIHostState parent_obj; uint32_t next_idx; @@ -386,11 +390,14 @@ struct S390pciState { S390PCIBus *bus; GHashTable *iommu_table; GHashTable *zpci_table; - QTAILQ_HEAD(, SeiContainer) pending_sei; + SeiContainerList pending_sei; + /* Only used temporarily between migration pre_load and post_load. */ + SeiContainerList pending_sei_stash; QTAILQ_HEAD(, S390PCIBusDevice) zpci_devs; QTAILQ_HEAD(, S390PCIDMACount) zpci_dma_limit; QTAILQ_HEAD(, S390PCIGroup) zpci_groups; uint8_t next_sim_grp; + bool zpci_migr_enabled; }; =20 S390pciState *s390_get_phb(void); diff --git a/include/hw/s390x/s390-pci-inst.h b/include/hw/s390x/s390-pci-i= nst.h index 3493d2ced0..e31497069b 100644 --- a/include/hw/s390x/s390-pci-inst.h +++ b/include/hw/s390x/s390-pci-inst.h @@ -113,6 +113,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint6= 4_t fiba, uint8_t ar, int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t = ar, uintptr_t ra); void fmb_timer_free(S390PCIBusDevice *pbdev); +void fmb_update(void *opaque); uint32_t s390_pci_update_iotlb(S390PCIBusDevice *pbdev, S390IOTLBEntry *en= try); =20 #define ZPCI_IO_BAR_MIN 0 --=20 2.56.0 From nobody Thu Oct 22 19:24:52 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=1791570605; cv=none; d=zohomail.com; s=zohoarc; b=Crig5ro96VEWDyzke3moRLTK7ofsaumiJ6W0hw4++s56lY0IEWlYXYQNgf+JRZ6LC0CyGJulcxih88CpW7b2DKFuqd1F33K5CltH3dMYimkWttoEVSO7GneUfnMIkqsZucWFeddigEWwqn0UxVVQ5EpqmEPlpT1sbs9wUmM0h7Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791570605; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=XFK7UJV/D2DXPNkSxez4UhlEKkbmpxIhjeS+aG+CeS0=; b=WtiVY18wFX42xRqR4Ep4PrqHvbRWhcd6PaquX7yPC40PhvzExSa8e2S9gzGfvFL5yhVy9Xc0RY46VCXR7ev4LjCmB/o4twN7vFfP7iMmTt2Izx34EmdQ+IkQSlqn0q7Sdx+FoY1oO3iDAmFktErKCwQf8J1VzExDhfxbJBG4AQU= 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 1791570605358537.5278758870705; Fri, 9 Oct 2026 11:30:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xFFL3-0000du-Rs; Fri, 09 Oct 2026 14:29:01 -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 1xFFKy-0000Zw-9C; Fri, 09 Oct 2026 14:28:56 -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 1xFFKu-0001ho-Vc; Fri, 09 Oct 2026 14:28:56 -0400 Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 699HZq1p3128292; Fri, 9 Oct 2026 18:28:50 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 4h74tcg8m4-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:50 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 699H8GNS1142940; Fri, 9 Oct 2026 18:28:49 GMT Received: from smtprelay05.dal12v.mail.ibm.com ([172.16.1.7]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4h6udd2aym-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:49 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 699ISme625100812 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Oct 2026 18:28:48 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EA8C65805F; Fri, 9 Oct 2026 18:28:47 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1A9CE5805A; Fri, 9 Oct 2026 18:28:47 +0000 (GMT) Received: from li-479af74c-31f9-11b2-a85c-e4ddee11713b.ibm.com.com (unknown [9.61.5.156]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 9 Oct 2026 18:28:46 +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=XFK7UJV/D2DXPNkSx ez4UhlEKkbmpxIhjeS+aG+CeS0=; b=eJ88y47U9k0iJq3etcWHoOV0j08yoIdRf 3lRfKiLoMmb7tU9qtDij0RwXzsaQ4BFp/OE3xkfRKvC9qxcoNnehbAmntY2ChRVz zj0RlwaKUQprH0BkdF/vP+uTLdeXk0edXOG5WzwLqBi+Ip2DULmHJUDna7+2Nm7h INuLq8PQ5U+k6XhId6v/8wavKbdrdkaF2hf5rAHYHujl4r2QFRRMYMlNq1ktE1fI Bb7EKmdW+ZKjeN70+GGN5a8QDDmCdfwXtBNncA/NSl6cWjEDE97ZGYFIysvpsKyj /UNxgrlLM4W/NDM6otWnwRGzm68xO4tAPXejUL5RI2dd65xZJlEKQ== From: Eric Farman To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Matthew Rosato , Cornelia Huck , Konstantin Shkolnyy , Eric Farman Subject: [PULL 17/19] s390x/pci: Create function to contain fmb_timer start Date: Fri, 9 Oct 2026 14:28:23 -0400 Message-ID: <20261009182825.148054-18-farman@linux.ibm.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009182825.148054-1-farman@linux.ibm.com> References: <20261009182825.148054-1-farman@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfXy48GeUN1rRjI NrA89d3cHXeSJk4tq3sczNmJE0W5QtGtK7JFWvwCJCUtKMxmlfdxi410n9rQRAp2omMahDw1AkV mfPHDneQQDEU1gHRGZYDRGoHzWuiNyq3Si8h3atNQeSr6duxIlpN8Nfa52sg/Uivxm1Pg1/c6Am H8OJKdqq9ResL7uJzn2Y0v+swuakggelcSq2nM3mgfP+tv402zTyFh8Yl1iOIiBuS+AFoIKpqFp nD+KfyV03tD3PSLs7xn5+Go7AkfD/r0vjH5QjHgo9dB68XTQGsO4CCRWwhEiOCj/hEI/45C1ZME UwynqvSt/Je9B3oXjkX2LDqYl2TjVohqCtOh3jy/+cOvC3CS2GomfTw8AgGcm0AnU300iTtK8w1 f5NsI70OWu9grspRwog7rfOaqGgiDTTy1sCcVAUj7u0Gg4OISjuqcryOwB83H+QU+8zuxwTaCIc zLRXOna+rUp/GMPqIHQ== X-Proofpoint-Spam-Info: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX/NKUbCivcLv+ kI4gHiyOBQ7/QeQNfETfO9lmPoPUaoY3LrUItYs97r4VuuTXyoXtFMh6nfjxwZVOUty3+eQMLK3 0so1oFQV9yccJ/pq8/t5wX3CJCrOw9o= X-Proofpoint-GUID: Hlc9LTC6XyAaAV_q6A_SSvqPmqXJSV4C X-Proofpoint-ORIG-GUID: Hlc9LTC6XyAaAV_q6A_SSvqPmqXJSV4C X-Authority-Analysis: v=2.4 cv=Yu+a1IYX c=1 sm=1 tr=0 ts=6ac93262 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=660iZSQnnn4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=Q_XnuvSB35syRjF9fnEA:9 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-10-09_05,2026-10-09_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 phishscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610090072 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=farman@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.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.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: 1791570606151158500 Content-Type: text/plain; charset="utf-8" From: Konstantin Shkolnyy fmb_timer is now started in 3 different places. The new function will encapsulate that to make sure mui is added in all cases. Reviewed-by: Matthew Rosato Signed-off-by: Konstantin Shkolnyy Link: https://lore.kernel.org/qemu-devel/20261006001643.420929-18-kshk@linu= x.ibm.com Signed-off-by: Eric Farman --- hw/s390x/s390-pci-bus.c | 5 ++--- hw/s390x/s390-pci-inst.c | 14 ++++++++++---- include/hw/s390x/s390-pci-inst.h | 1 + 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 5f8712ac76..b8bb663113 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -1934,9 +1934,8 @@ static bool s390_pci_device_post_load_errp(void *opaq= ue, int version_id, } pbdev->fmb_timer =3D timer_new_ms(QEMU_CLOCK_VIRTUAL, fmb_update, pbdev); - timer_mod(pbdev->fmb_timer, - qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + - pbdev->pci_group->zpci_group.mui); + s390_pci_schedule_fmb_timer(pbdev, + qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL)); } return true; } diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index f620d45e6c..e56382b8be 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -1156,9 +1156,16 @@ static int fmb_do_update(S390PCIBusDevice *pbdev, in= t offset, uint64_t val, return ret; } =20 +void s390_pci_schedule_fmb_timer(S390PCIBusDevice *pbdev, uint64_t start) +{ + timer_mod(pbdev->fmb_timer, start + pbdev->pci_group->zpci_group.mui); +} + void fmb_update(void *opaque) { S390PCIBusDevice *pbdev =3D opaque; + + /* Must be read before updating U bit */ int64_t t =3D qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL); int i; =20 @@ -1195,7 +1202,7 @@ void fmb_update(void *opaque) sizeof(pbdev->fmb.last_update))) { return; } - timer_mod(pbdev->fmb_timer, t + pbdev->pci_group->zpci_group.mui); + s390_pci_schedule_fmb_timer(pbdev, t); } =20 static int mpcifc_reg_int_interp(S390PCIBusDevice *pbdev, ZpciFib *fib) @@ -1388,9 +1395,8 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uin= t64_t fiba, uint8_t ar, timer_del(pbdev->fmb_timer); } pbdev->fmb_addr =3D fmb_addr; - timer_mod(pbdev->fmb_timer, - qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + - pbdev->pci_group->zpci_group.mui); + s390_pci_schedule_fmb_timer(pbdev, + qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL)); break; } default: diff --git a/include/hw/s390x/s390-pci-inst.h b/include/hw/s390x/s390-pci-i= nst.h index e31497069b..0c27e5bcfb 100644 --- a/include/hw/s390x/s390-pci-inst.h +++ b/include/hw/s390x/s390-pci-inst.h @@ -114,6 +114,7 @@ int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint= 64_t fiba, uint8_t ar, uintptr_t ra); void fmb_timer_free(S390PCIBusDevice *pbdev); void fmb_update(void *opaque); +void s390_pci_schedule_fmb_timer(S390PCIBusDevice *pbdev, uint64_t start); uint32_t s390_pci_update_iotlb(S390PCIBusDevice *pbdev, S390IOTLBEntry *en= try); =20 #define ZPCI_IO_BAR_MIN 0 --=20 2.56.0 From nobody Thu Oct 22 19:24:52 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=1791570840; cv=none; d=zohomail.com; s=zohoarc; b=N+DfXpybHJylodk3253nlywDgnWdfVgi9OUjncUST0tS7CVVSHUZVtCOZwgYWec6ErB2VZTEbKMX9eZvSnpsgqc2oY02Xg+oVETPD9l6HW3ZYlCu7A3gxiTUctaCxZAomkx/Ea3nU4KuURD+tiTQRqMw3wdHRmP3mmZ5mxCMa38= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791570840; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mkwH2saz8NPQ/D7fkr2AW/RWG2C8lvvyhfMKM9YrfFM=; b=brVOLkakHkMvggDzbpXfEGHruhpeHoC1rWJpzkKA4iKgMIQ99AXqzLvcBQRTGTycoVWp2F9ZhbOBeG1kDgQtDxmQyOTnAk6+06K556I7De5wcwfNmFJtY/ZKOAqXfX3odc4a9mkGg6xHoDTx+EZaijt/ZtUdTdnjhF9lzadaDaI= 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 1791570840664713.6193591190191; Fri, 9 Oct 2026 11:34:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xFFL7-0000iK-He; Fri, 09 Oct 2026 14:29:05 -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 1xFFKw-0000ZT-SZ; Fri, 09 Oct 2026 14:28:54 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xFFKv-0001ht-0F; Fri, 09 Oct 2026 14:28:54 -0400 Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 699Ha6713714773; Fri, 9 Oct 2026 18:28:51 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 4h74ter88m-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:50 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 699H8Ee31142913; Fri, 9 Oct 2026 18:28:50 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([172.16.1.8]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4h6udd2ayt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:50 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 699ISngL24052358 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Oct 2026 18:28:49 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 088CD58054; Fri, 9 Oct 2026 18:28:49 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2B51A5805A; Fri, 9 Oct 2026 18:28:48 +0000 (GMT) Received: from li-479af74c-31f9-11b2-a85c-e4ddee11713b.ibm.com.com (unknown [9.61.5.156]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 9 Oct 2026 18:28:48 +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=mkwH2saz8NPQ/D7fk r2AW/RWG2C8lvvyhfMKM9YrfFM=; b=isNxU5xMdUVvpOb+IcdsJ9Bavu9/S/+ug 0JOoQiFm45hj8GT71OykfkCEMN9k9L6GxQC9skmORcZb27y/mxrFjeMdzE0NAPf9 PQ99fOjbOkoCmH56idEdWnYgYuk2T3/LsmaW05kp6Kdmfc3ZomJMst9voiT0V7ms wcdsbPTmM2ykjZXw3bnug2+BK+m2+0BebImhL2Jpw4m8oxzxXf+nqj6x9ZEPkiYx REc+MYhES0I9pjPKC9cGswNKiSyWBwfc+NLhGZlf4XLDs/lVhE21pRIFh9ZJeKtG PtpRpcQSr+Tr2YyUpPZ5M/8yY39mOvpQiJYXAGdFVa49XUOejBN2w== From: Eric Farman To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Matthew Rosato , Cornelia Huck , Farhan Ali , Eric Farman Subject: [PULL 18/19] s390x/pci: Add PCI error handling for vfio pci devices Date: Fri, 9 Oct 2026 14:28:24 -0400 Message-ID: <20261009182825.148054-19-farman@linux.ibm.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009182825.148054-1-farman@linux.ibm.com> References: <20261009182825.148054-1-farman@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: rzDFpYdWkSrC57FixGSmKY5L2R4UPRDE X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfXyrBkcvQQ4Qob aobA3GcvrcFBZa19xnwJRhaXR6SEEEY1O/02JKXfiWDroVh8ys+jI+ax1I7nuXzyrtLXYLgHsAR Ee6Lq4dAVulxkPJGuWoCJQ0Ojs5Up4mQrYN3KktS1IkNVH1Jr3+HwSCiQqmgx02V3wXTzGXT5JA YnBYXpfsdJ7Mr/HbdF56F8h086FH4zItlJeQRBT5zDZuofP+z088THs0YNmALtzigqoKc9BIWyQ yliS3Rs/5b6fY0U0U7GzswrdSN1S2vTZC8BPpVeWrJh+GnSKXvWGc7hTFpCEqCvuy8Ytp3n+tLY RAcFbuvPk0434jzOKXwXa+xShMu6DGO3+H0jf7yMG6fLpk98OJhHDNh3LTXA9VHqNeUrzHREe5p FuFTEBFaRc+TlxB98n5Mt1e23XDPhD9uWNN7N1EvAhVGRzlgy3VrrvIvJ9xGuSAqSRflYqBI8jZ dbIB9x61twOxpbJuBLQ== X-Proofpoint-GUID: rzDFpYdWkSrC57FixGSmKY5L2R4UPRDE X-Proofpoint-Spam-Info: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX1rXSHNolCg8h yqawBYRfVDIQlbKMapP9eQLmoUDYejZOnX56R+j8kYQZ5wHZYoO+YLF89/y+kQE9XLfcP6pbI/r CgpD5sBuxZ+yzuL7FGHQitnkbhlj8IQ= X-Authority-Analysis: v=2.4 cv=Nf1zRGD4 c=1 sm=1 tr=0 ts=6ac93263 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=660iZSQnnn4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=kH9A0MViX-lNxfKOOeYA:9 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-10-09_05,2026-10-09_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 bulkscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 lowpriorityscore=0 impostorscore=0 adultscore=0 suspectscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610090072 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.158.5; envelope-from=farman@linux.ibm.com; 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, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=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.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: 1791570842417158500 Content-Type: text/plain; charset="utf-8" From: Farhan Ali Add an s390x specific handler for vfio error notifier. For s390x pci device= s, we have platform specific error information. We need to retrieve this error information for passthrough devices. This is done via a VFIO_DEVICE_FEATURE ioctl which exposes that information. Once this error information is retrieved we can then inject an error into the guest, and let the guest drive the recovery. Signed-off-by: Farhan Ali Reviewed-by: Matthew Rosato Link: https://lore.kernel.org/qemu-devel/20261005174314.871-2-alifm@linux.i= bm.com Signed-off-by: Eric Farman --- hw/s390x/s390-pci-bus.c | 6 ++ hw/s390x/s390-pci-vfio-stubs.c | 6 ++ hw/s390x/s390-pci-vfio.c | 123 +++++++++++++++++++++++++++++++ include/hw/s390x/s390-pci-bus.h | 1 + include/hw/s390x/s390-pci-vfio.h | 1 + 5 files changed, 137 insertions(+) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index b8bb663113..53ed79d17a 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -1185,6 +1185,7 @@ static void s390_pcihost_plug(const HotplugHandler *h= otplug_dev, DeviceState *de PCIDevice *pdev =3D NULL; S390PCIBusDevice *pbdev =3D NULL; bool auto_pbdev =3D false; + Error *local_err =3D NULL; int rc; =20 if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_BRIDGE)) { @@ -1275,6 +1276,11 @@ static void s390_pcihost_plug(const HotplugHandler *= hotplug_dev, DeviceState *de pbdev->dma_limit =3D s390_pci_start_dma_count(s, pbdev); /* Fill in CLP information passed via the vfio region */ s390_pci_get_clp_info(pbdev); + /* Setup error handler for error recovery */ + if (!s390_pci_setup_err_handler(pbdev, &local_err)) { + warn_report_err(local_err); + } + if (!pbdev->interp) { /* Do vfio passthrough but intercept for I/O */ pbdev->fh |=3D FH_SHM_VFIO; diff --git a/hw/s390x/s390-pci-vfio-stubs.c b/hw/s390x/s390-pci-vfio-stubs.c index d9882b7aad..9fc84ca135 100644 --- a/hw/s390x/s390-pci-vfio-stubs.c +++ b/hw/s390x/s390-pci-vfio-stubs.c @@ -30,3 +30,9 @@ bool s390_pci_get_host_fh(S390PCIBusDevice *pbdev, uint32= _t *fh) void s390_pci_get_clp_info(S390PCIBusDevice *pbdev) { } + +bool s390_pci_setup_err_handler(S390PCIBusDevice *pbdev, Error **errp) +{ + error_setg(errp, "VFIO not available, cannot setup error handler"); + return false; +} diff --git a/hw/s390x/s390-pci-vfio.c b/hw/s390x/s390-pci-vfio.c index a035ba5b2c..e65e2be473 100644 --- a/hw/s390x/s390-pci-vfio.c +++ b/hw/s390x/s390-pci-vfio.c @@ -10,6 +10,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/error-report.h" =20 #include #include @@ -105,6 +106,80 @@ void s390_pci_end_dma_count(S390pciState *s, S390PCIDM= ACount *cnt) } } =20 +static int s390_pci_get_feature_err(VFIOPCIDevice *vfio_pci, + PciCcdfErr *ccdf, + uint32_t ccdf_err_length, + Error **errp) +{ + ERRP_GUARD(); + int ret; + size_t total_size; + struct vfio_device_feature_zpci_err *err; + g_autofree void *buf =3D NULL; + g_autofree struct vfio_device_feature *feature =3D NULL; + + total_size =3D sizeof(*feature) + sizeof(*err); + feature =3D g_malloc(total_size); + feature->argsz =3D total_size; + feature->flags =3D VFIO_DEVICE_FEATURE_GET | VFIO_DEVICE_FEATURE_ZPCI_= ERROR; + + buf =3D g_malloc(ccdf_err_length); + err =3D (void *)feature->data; + err->data =3D (uint64_t)buf; + ret =3D vfio_device_get_feature(&vfio_pci->vbasedev, feature); + + if (ret) { + if (ret =3D=3D -ENOMSG) { + return 0; + } + error_setg(errp, "Failed feature get VFIO_DEVICE_FEATURE_ZPCI_ERRO= R" + " (rc=3D%d)", ret); + return ret; + } + + memcpy(ccdf, buf, ccdf_err_length); + + return 1; +} + +static void s390_pci_err_handler(void *opaque) +{ + VFIOPCIDevice *vfio_pci; + S390PCIBusDevice *pbdev; + Error *local_err =3D NULL; + PciCcdfErr ccdf; + int ret =3D 0; + + vfio_pci =3D opaque; + if (!event_notifier_test_and_clear(&vfio_pci->err_notifier)) { + return; + } + + pbdev =3D s390_pci_find_dev_by_pci(s390_get_phb(), PCI_DEVICE(vfio_pci= )); + + if (!pbdev) { + error_report("No matching zpci device found"); + return; + } + pbdev->state =3D ZPCI_FS_ERROR; + + do { + ret =3D s390_pci_get_feature_err(vfio_pci, &ccdf, + pbdev->ccdf_err_length, &local_err); + if (ret < 0) { + error_report_err(local_err); + break; + } + + if (ret > 0) { + s390_pci_generate_error_event(ccdf.pec, pbdev->fh, pbdev->fid, + ccdf.faddr, ccdf.e); + } + } while (ret > 0); + + return; +} + static void s390_pci_read_base(S390PCIBusDevice *pbdev, struct vfio_device_info *info) { @@ -134,6 +209,10 @@ static void s390_pci_read_base(S390PCIBusDevice *pbdev, /* Store function type separately for type-specific behavior */ pbdev->pft =3D cap->pft; =20 + if (hdr->version >=3D 3) { + pbdev->ccdf_err_length =3D cap->ccdf_err_length; + } + /* * If the device is a passthrough ISM device, disallow relaxed * translation. @@ -371,3 +450,47 @@ void s390_pci_get_clp_info(S390PCIBusDevice *pbdev) s390_pci_read_util(pbdev, info); s390_pci_read_pfip(pbdev, info); } + +bool s390_pci_setup_err_handler(S390PCIBusDevice *pbdev, Error **errp) +{ + int ret; + int32_t fd; + VFIOPCIDevice *vfio_pci =3D VFIO_PCI_DEVICE(pbdev->pdev); + uint64_t buf[DIV_ROUND_UP(sizeof(struct vfio_device_feature), + sizeof(uint64_t))] =3D {}; + struct vfio_device_feature *feature =3D (struct vfio_device_feature *)= buf; + + feature->argsz =3D sizeof(buf); + feature->flags =3D VFIO_DEVICE_FEATURE_PROBE | VFIO_DEVICE_FEATURE_ZPC= I_ERROR; + + ret =3D vfio_device_get_feature(&vfio_pci->vbasedev, feature); + + if (ret !=3D 0) { + if (ret =3D=3D -ENOTTY) { + error_setg(errp, "Automated error recovery unavailable for dev= ice"); + } else { + error_setg(errp, + "Failed to probe for VFIO_DEVICE_FEATURE_ZPCI_ERROR= (ret=3D%d)", + ret); + } + return false; + } + + if (sizeof(PciCcdfErr) !=3D pbdev->ccdf_err_length) { + error_setg(errp, + "CCDF size mismatch expected size=3D%zu, provided size= =3D%d", + sizeof(PciCcdfErr), pbdev->ccdf_err_length); + return false; + } + + if (!vfio_pci->pci_aer) { + error_setg(errp, "%s: VFIO error notifier not registered for devic= e", + vfio_pci->vbasedev.name); + return false; + } + + fd =3D event_notifier_get_fd(&vfio_pci->err_notifier); + qemu_set_fd_handler(fd, s390_pci_err_handler, NULL, vfio_pci); + + return true; +} diff --git a/include/hw/s390x/s390-pci-bus.h b/include/hw/s390x/s390-pci-bu= s.h index 71f956700b..b9c9926910 100644 --- a/include/hw/s390x/s390-pci-bus.h +++ b/include/hw/s390x/s390-pci-bus.h @@ -374,6 +374,7 @@ struct S390PCIBusDevice { bool forwarding_assist; bool aif; bool rtr_avail; + uint32_t ccdf_err_length; QTAILQ_ENTRY(S390PCIBusDevice) link; }; =20 diff --git a/include/hw/s390x/s390-pci-vfio.h b/include/hw/s390x/s390-pci-v= fio.h index f7d6149daf..c7886b63ea 100644 --- a/include/hw/s390x/s390-pci-vfio.h +++ b/include/hw/s390x/s390-pci-vfio.h @@ -20,5 +20,6 @@ S390PCIDMACount *s390_pci_start_dma_count(S390pciState *s, void s390_pci_end_dma_count(S390pciState *s, S390PCIDMACount *cnt); bool s390_pci_get_host_fh(S390PCIBusDevice *pbdev, uint32_t *fh); void s390_pci_get_clp_info(S390PCIBusDevice *pbdev); +bool s390_pci_setup_err_handler(S390PCIBusDevice *pbdev, Error **errp); =20 #endif --=20 2.56.0 From nobody Thu Oct 22 19:24:52 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=1791570842; cv=none; d=zohomail.com; s=zohoarc; b=NLp7+Qc9DaXnEReQqEhRYYgEeBm7gQ38dQUg+hNSqJ9P3+6v/MyT7qzjCaspNvaynA29KZL5qPXJ8bvE4NA3a2Kyf3sW4AUZVCnEBAl69EB6WOzs3q76fLCwO/TgxXOin8Iuxxi1tQDLTNzcV1JS4a7+CvXH2eIQ81z3g/SCC14= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1791570842; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=JJxtrGwYI1kyFPZ/xdVJwpKY+R482bJ/wM3Gp3RXhao=; b=jkc2tBvgomNN8ABPmvm7PN5XohigswdJ3oGRHZwXMJ40suMZjD5iafhfZqdcpG/auiWP5SukhP3rsmiusVqP1UpgFHn3oxsr9zb4nlociC+Y8OUlySqjTrKjockxNSZ5SyKPiRXoNfWji9fJbX2riyngTel02BGD0wuGmOfLEhg= 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 1791570842283866.5685133966504; Fri, 9 Oct 2026 11:34:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xFFL7-0000id-Uo; Fri, 09 Oct 2026 14:29:05 -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 1xFFKy-0000Zv-8O; Fri, 09 Oct 2026 14:28:56 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xFFKv-0001hz-La; Fri, 09 Oct 2026 14:28:56 -0400 Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 699Ha5Rq592884; Fri, 9 Oct 2026 18:28:52 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4h74tdg8by-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:52 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 699H8QGk4126010; Fri, 9 Oct 2026 18:28:51 GMT Received: from smtprelay07.dal12v.mail.ibm.com ([172.16.1.9]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4h5f3u45nq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Oct 2026 18:28:51 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay07.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 699ISoFQ32178850 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Oct 2026 18:28:50 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 66B7A5805F; Fri, 9 Oct 2026 18:28:50 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4767958064; Fri, 9 Oct 2026 18:28:49 +0000 (GMT) Received: from li-479af74c-31f9-11b2-a85c-e4ddee11713b.ibm.com.com (unknown [9.61.5.156]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 9 Oct 2026 18:28:49 +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=JJxtrGwYI1kyFPZ/x dVJwpKY+R482bJ/wM3Gp3RXhao=; b=Wg7jsqEjHq1yR2ltZP68TkaB7NpQmj5PH rkUF49VP7P4qAtFioRqrBwdw5lhf6DtiG0sJDe1BU9ltUjiFuJ+Gj3FyCFKDKwhp 0iSIPhiUYJ7ky58qrNmXTM3/1BtQ3lZilUwmASredFOli+1pZPx6mL0Jp5ylLwut 62QrPnWqK9oteEupGinIAK6CXjatPR0RJaRfAr8Nx87/eBg45i1yV2DkGx7FOiw5 4v3RCoiSSqm2U+H7U7Rqdq9/+auzIHESrbzFeE2S/BmmZclV02Y8xPGIG5jCcudY 46C2dr9eBPsmr6oju1No7Qdt6edXD0sYj9bbh0+Pi+Rhx2qxOyZ9Q== From: Eric Farman To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Matthew Rosato , Cornelia Huck , Farhan Ali , Eric Farman Subject: [PULL 19/19] s390x/pci: Reset a device in error state Date: Fri, 9 Oct 2026 14:28:25 -0400 Message-ID: <20261009182825.148054-20-farman@linux.ibm.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009182825.148054-1-farman@linux.ibm.com> References: <20261009182825.148054-1-farman@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX99CFAigjLw+H bNkzAmOEV5qRLHg1fkR1RZh5Za49pGfO9iH5NiMsGuWr3HLy86+MbtKAp3dWZNQG4SffxijF8mH vcWtLXwAFi9ZAXNGkAJqaUsOXXhJHkd1mG55O3DE7fi6+vYTByUU/6qI+dxkAZzCl+XEB/GTPqn HdpXz8P4Fyr/PKThD1OSi9YvTMWvtC3vkTiEANtLO6xB/IF+i4lZitCas7xslYqUcumtEmJixxd ZKqq8cuw7xxdvnn+dq5XyHvmzHSKyNLGSx4LzzZlGyM5FitJDdkKglAGNpM/lB0kWvm6S0+RAg2 0unYSXYdMyiR/4ANd8jzteqGsPLCrNX4icGC2IJ3Y2xAguU5qxgh8GiQqAQ5kHr9RfsqxusN2P1 i/f9IcTEOybvtORfFI53g6yFspA6fs4qSX9JBzv+Zv87WoekaOUfI+JSBIeIGJzJfXoLj/j5t0Q vp265fuNv8Lh9dtw7kQ== X-Authority-Analysis: v=2.4 cv=FqWQbGrq c=1 sm=1 tr=0 ts=6ac93264 cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=660iZSQnnn4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=FuZLNSxbJke2QbDKExoA:9 X-Proofpoint-GUID: aBdg1ijXhkWhJNCMFuhw3005Dd1ShxA1 X-Proofpoint-Spam-Info: AW1haW4tMjYxMDA5MDA3MiBTYWx0ZWRfX1/zNg7B6Rsgv N4pb0fj+f0Nd0wlGLq+xlYG0t4At0j/Qc41bOVhMgJxaKT/mAIC2G72BCphVahmcPe8cwGSLTCW xPYEN9SB2JwtYypoc+RKpDsjYGHx3BY= X-Proofpoint-ORIG-GUID: aBdg1ijXhkWhJNCMFuhw3005Dd1ShxA1 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-10-09_05,2026-10-09_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 suspectscore=0 priorityscore=1501 impostorscore=0 adultscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610090072 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.158.5; envelope-from=farman@linux.ibm.com; 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, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=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.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: 1791570844330158500 Content-Type: text/plain; charset="utf-8" From: Farhan Ali For passthrough devices in error state, for a guest driven reset of the device we can attempt a reset to recover the device. A reset of the device will trigger a CLP disable/enable cycle on the host to bring the device into a recovered state. Signed-off-by: Farhan Ali Reviewed-by: Matthew Rosato Link: https://lore.kernel.org/qemu-devel/20261005174314.871-3-alifm@linux.i= bm.com Signed-off-by: Eric Farman --- hw/s390x/s390-pci-bus.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 53ed79d17a..2724b27ec2 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -1786,6 +1786,21 @@ static void s390_pci_device_reset(DeviceState *dev) return; case ZPCI_FS_STANDBY: break; + case ZPCI_FS_ERROR: + /* + * Attempt a reset to recover the device. A device in ERROR state + * can be transitioned to ENABLED or DISABLED state via guest + * driven actions. Since this code path is also executed on + * subsystem_reset() and the expected state of a configured device + * after subsystem_reset() is to be in a DISABLED state, we need to + * transition from ERROR to DISABLED. + * + * Linux guests drive the state transition from ERROR to DISABLED + * via CLP_SET_DISABLE_PCI_FN. So it should be safe to transition + * from ERROR to DISABLED state. + */ + pci_device_reset(pbdev->pdev); + /* fallthrough */ default: pbdev->fh &=3D ~FH_MASK_ENABLE; pbdev->state =3D ZPCI_FS_DISABLED; --=20 2.56.0