From nobody Wed Nov 12 10:22:12 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=de.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1569850491; cv=none; d=zoho.com; s=zohoarc; b=dl41my8JNNRdUKHOhBva/RY2jssORbDe/hmxtSA1KXgTXdf2FYDUe6qpsrMNTOzlTJMi9ot4QzFnhw7LMxHsHJjtWeYQpJpIyqYJbbOzBJzqrUcOFxb2m3YG1w8qz4V+TZeOA5qKnq1mVs84XFywOGJgmVEvL3XIxdlEH5phFD0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569850491; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=osxJu3uFNMgAspYGsHVdUE0+ODrMI9Fu8Mkd/jkb3Rw=; b=nalXpKwBGjVGfPvvWfTyWSws7DXLZa3rquaHEwyAw9GGHukGQ5oLXROfWgIDzLzF+bpCShtniYbmZME3U68gC4mG3OM7m17mPxv90FNREccD1h6gAdsbuFyZQUvqEFuLCKvrzxBWGdkSXgqBrhNaKV3yeAOauT4/WXuOW36cMIU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569850491495857.0376761775519; Mon, 30 Sep 2019 06:34:51 -0700 (PDT) Received: from localhost ([::1]:52526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iEvp9-0003Ql-HU for importer@patchew.org; Mon, 30 Sep 2019 09:34:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42395) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iEvbJ-0004PK-TD for qemu-devel@nongnu.org; Mon, 30 Sep 2019 09:20:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iEvbH-0005BU-GB for qemu-devel@nongnu.org; Mon, 30 Sep 2019 09:20:29 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:57464) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iEvb9-00051C-4o for qemu-devel@nongnu.org; Mon, 30 Sep 2019 09:20:21 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8UDI4ng134331 for ; Mon, 30 Sep 2019 09:20:07 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2vbhfb3e1t-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 30 Sep 2019 09:20:07 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 30 Sep 2019 14:20:01 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 30 Sep 2019 14:19:57 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8UDJuNf60162264 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 30 Sep 2019 13:19:56 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 58C9F52050; Mon, 30 Sep 2019 13:19:56 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id 43DC45204F; Mon, 30 Sep 2019 13:19:56 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id 0486BE01C8; Mon, 30 Sep 2019 15:19:56 +0200 (CEST) From: Christian Borntraeger To: Peter Maydell Subject: [PULL 02/12] s390: PCI: fix IOMMU region init Date: Mon, 30 Sep 2019 15:19:45 +0200 X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190930131955.101131-1-borntraeger@de.ibm.com> References: <20190930131955.101131-1-borntraeger@de.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 19093013-0008-0000-0000-0000031C6F98 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19093013-0009-0000-0000-00004A3B15FD Message-Id: <20190930131955.101131-3-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-09-30_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909300138 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Boris Fiuczynski , Janosch Frank , Matthew Rosato , David Hildenbrand , Pierre Morel , Stefan Zimmerman , Cornelia Huck , qemu-devel , qemu-stable@nongnu.org, Halil Pasic , Christian Borntraeger , qemu-s390x , kvm@vger.kernel.org, Igor Mammedov , Paolo Bonzini , Claudio Imbrenda , Collin Walling , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Matthew Rosato The fix in dbe9cf606c shrinks the IOMMU memory region to a size that seems reasonable on the surface, however is actually too small as it is based against a 0-mapped address space. This causes breakage with small guests as they can overrun the IOMMU window. Let's go back to the prior method of initializing iommu for now. Fixes: dbe9cf606c ("s390x/pci: Set the iommu region size mpcifc request") Cc: qemu-stable@nongnu.org Reviewed-by: Pierre Morel Reported-by: Boris Fiuczynski Tested-by: Boris Fiuczynski Reported-by: Stefan Zimmerman Signed-off-by: Matthew Rosato Message-Id: <1569507036-15314-1-git-send-email-mjrosato@linux.ibm.com> Signed-off-by: Christian Borntraeger --- hw/s390x/s390-pci-bus.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 963a41c7f532..2d2f4a7c419c 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -695,10 +695,15 @@ static const MemoryRegionOps s390_msi_ctrl_ops =3D { =20 void s390_pci_iommu_enable(S390PCIIOMMU *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), TYPE_S390_IOMMU_MEMORY_REGION, OBJECT(&iommu-= >mr), - name, iommu->pal - iommu->pba + 1); + name, iommu->pal + 1); iommu->enabled =3D true; memory_region_add_subregion(&iommu->mr, 0, MEMORY_REGION(&iommu->iommu= _mr)); g_free(name); --=20 2.21.0