From patchwork Wed Jun 26 11:15:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Schnelle X-Patchwork-Id: 13712745 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 62D21148FE3; Wed, 26 Jun 2024 11:16:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719400600; cv=none; b=rbnJJperLbp8FUGwgLVqCiCXJfj5lxBWBl8zP03GlNuDY0mTJan4HEJJlWih0nSKtCnObl3Q5DQ/+plYph2zriT+3A0mn/RvY70aWgkaCkpPwYK9GHAJK5JbvngrVrnxbHVkrQ9cMDB9UMZLkNZpY3RlUoHUz8Vy4hLjF7augJE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719400600; c=relaxed/simple; bh=kmttkYcl7RaIqBVfs1vIdHpH/R3f9A14cvLyhdB1rck=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rDp7leBcv49HcQE8esbbCM+IdLD0Fc1vH4KNB2xBJ8gfGIBOnKccxIJSMSrHfjI0OiCsV/wr6mpEolwsy6/8G2CiWTWh80fEpL8VDn7N9AsYCLaBK+T7yLNkrqHZ4Mko6qi8935pUgfhGxNgXcSBcvEWhjocn89q2QdLEhEWK+w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=OEKWQBcL; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="OEKWQBcL" Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45QAQoYD023768; Wed, 26 Jun 2024 11:16:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :date:subject:mime-version:content-type :content-transfer-encoding:message-id:references:in-reply-to:to :cc; s=pp1; bh=LTrthfU6+VvQnNM7AhQqXcpa/YUXxL1CYEpRBlk6l6E=; b=O EKWQBcLNuX0DAcZuh73Q789AmQK9/Ienszwx+omqKbrnEECO8mrCl/51/jFycsGD s4a58w9GtlHdDfWTKPyXBnxz6SOrdy3JDAawEiaFufusWYcdIbRmWdk2n3n+Od0b 6/K81e0TTAbLyNT5/GrwjeXHKbjjfN1BOzYxFql/c8qyaRjfDUuyAg4fO90KTNJQ Z/Sgks64qsKWubaxdEWpFEd65s+Edj+oLd/LUNCHcCtkZbfTIKEEdoH403ZLPELt sw2rrejg2kk5vcHmxxaW3YspbzBT9vXnA0bGotB2MtkEx/ncpxdwlfjSbalLogL8 SRPqxkNI0UTvO3lKRC6nQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 400gcr8922-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Jun 2024 11:16:32 +0000 (GMT) Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45QBGWKd007055; Wed, 26 Jun 2024 11:16:32 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 400gcr8920-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Jun 2024 11:16:32 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45Q90k98019625; Wed, 26 Jun 2024 11:16:31 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yx9xq4469-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Jun 2024 11:16:31 +0000 Received: from smtpav05.wdc07v.mail.ibm.com (smtpav05.wdc07v.mail.ibm.com [10.39.53.232]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45QBGRTM62587380 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2024 11:16:29 GMT Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8EF195805F; Wed, 26 Jun 2024 11:16:27 +0000 (GMT) Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D3CE058067; Wed, 26 Jun 2024 11:16:24 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav05.wdc07v.mail.ibm.com (Postfix) with ESMTP; Wed, 26 Jun 2024 11:16:24 +0000 (GMT) From: Niklas Schnelle Date: Wed, 26 Jun 2024 13:15:48 +0200 Subject: [PATCH v4 1/4] s390/pci: Fix s390_mmio_read/write syscall page fault handling Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240626-vfio_pci_mmap-v4-1-7f038870f022@linux.ibm.com> References: <20240626-vfio_pci_mmap-v4-0-7f038870f022@linux.ibm.com> In-Reply-To: <20240626-vfio_pci_mmap-v4-0-7f038870f022@linux.ibm.com> To: Bjorn Helgaas , Christoph Hellwig , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Alex Williamson , Gerd Bayer , Matthew Rosato , Jason Gunthorpe Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Niklas Schnelle , Jason Gunthorpe X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1957; i=schnelle@linux.ibm.com; h=from:subject:message-id; bh=kmttkYcl7RaIqBVfs1vIdHpH/R3f9A14cvLyhdB1rck=; b=owGbwMvMwCH2Wz534YHOJ2GMp9WSGNKqf+TadMicifwhL3B7RYsfo3DcI5mN3DpqCr99jrL5/ jHa80q/o5SFQYyDQVZMkWVRl7PfuoIppnuC+jtg5rAygQxh4OIUgIkovmP4X6+ndrP6138JgwsM IX0y56rK9/FesnoR4DJxC+u1Hy4PWhgZ1h6/8LI795GCPtvNm/bXdn74EZ73vqq/36lH7cGtqbK uTAA= X-Developer-Key: i=schnelle@linux.ibm.com; a=openpgp; fpr=9DB000B2D2752030A5F72DDCAFE43F15E8C26090 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 7XxvmvvyIO5taVuYVVj84sYjLGeEanp6 X-Proofpoint-ORIG-GUID: ZNdf76wXQ_Bmd1EXEhx57NrQHmzS9Jl_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-26_04,2024-06-25_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 spamscore=0 mlxscore=0 adultscore=0 clxscore=1015 mlxlogscore=953 bulkscore=0 lowpriorityscore=0 malwarescore=0 suspectscore=0 impostorscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406260078 The s390 MMIO syscalls when using the classic PCI instructions do not cause a page fault when follow_pte() fails due to the page not being present. Besides being a general deficiency this breaks vfio-pci's mmap() handling once VFIO_PCI_MMAP gets enabled as this lazily maps on first access. Fix this by following a failed follow_pte() with fixup_user_page() and retrying the follow_pte(). Reviewed-by: Jason Gunthorpe Reviewed-by: Matthew Rosato Signed-off-by: Niklas Schnelle --- arch/s390/pci/pci_mmio.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/arch/s390/pci/pci_mmio.c b/arch/s390/pci/pci_mmio.c index 5398729bfe1b..80c21b1a101c 100644 --- a/arch/s390/pci/pci_mmio.c +++ b/arch/s390/pci/pci_mmio.c @@ -170,8 +170,12 @@ SYSCALL_DEFINE3(s390_pci_mmio_write, unsigned long, mmio_addr, goto out_unlock_mmap; ret = follow_pte(vma, mmio_addr, &ptep, &ptl); - if (ret) - goto out_unlock_mmap; + if (ret) { + fixup_user_fault(current->mm, mmio_addr, FAULT_FLAG_WRITE, NULL); + ret = follow_pte(vma, mmio_addr, &ptep, &ptl); + if (ret) + goto out_unlock_mmap; + } io_addr = (void __iomem *)((pte_pfn(*ptep) << PAGE_SHIFT) | (mmio_addr & ~PAGE_MASK)); @@ -305,12 +309,16 @@ SYSCALL_DEFINE3(s390_pci_mmio_read, unsigned long, mmio_addr, if (!(vma->vm_flags & (VM_IO | VM_PFNMAP))) goto out_unlock_mmap; ret = -EACCES; - if (!(vma->vm_flags & VM_WRITE)) + if (!(vma->vm_flags & VM_READ)) goto out_unlock_mmap; ret = follow_pte(vma, mmio_addr, &ptep, &ptl); - if (ret) - goto out_unlock_mmap; + if (ret) { + fixup_user_fault(current->mm, mmio_addr, 0, NULL); + ret = follow_pte(vma, mmio_addr, &ptep, &ptl); + if (ret) + goto out_unlock_mmap; + } io_addr = (void __iomem *)((pte_pfn(*ptep) << PAGE_SHIFT) | (mmio_addr & ~PAGE_MASK)); From patchwork Wed Jun 26 11:15:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Schnelle X-Patchwork-Id: 13712747 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 608E217FAD7; Wed, 26 Jun 2024 11:16:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719400604; cv=none; b=PfN5mcRy/Hfr9hmofASleVtFEExE4UeAFUu0TyS//iiQAYYVfxEptXT9eYMPSUrRTUniOs9QWHEaEPjdXr6oVUr8NURI1TzDEi+7Ir/U6NPJ8lXtj2RQpROFE1tfdTke3ll3shhHZ8kr0fGjzwht/1cLxVpEk1AtBhzdNrexDGI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719400604; c=relaxed/simple; bh=CYzstYaaXSrnMozeJlgiNEPXqNaJBsBlSJh01euI9Zs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=h3gK1NPJ1YQ/NbNk37p6QYPuhAbQ/9scAc7+rjvOEHpY0IIoP+S1nEhN+fht5JJ/NYX9spUH4MJj9oESXn7EAoF64szdC5TjtBAvJiCNcGKst03bcQLEJx2entfZTIsrtSPrBdwaKJXVeoNRGi+a3tKKKoTGZaEHUTYhIIJto2I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=XlxZuhxT; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="XlxZuhxT" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45QAPuZt014840; Wed, 26 Jun 2024 11:16:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :date:subject:mime-version:content-type :content-transfer-encoding:message-id:references:in-reply-to:to :cc; s=pp1; bh=H5AK9apvNg9/u4BFixoBzh3CCHMZysGgdrjaBm/PYyw=; b=X lxZuhxTkmsxm5pN0H0vOQPxivi6swB/0GtynDcfTo5vY2/zNFvD2qK72XKKOTVmq pJO8NRw4DJgbkTHdys0e4ONSmS3UjnMCah9Zbe5iERnr/D/JESXV8y+/6ECautk7 hD7ogYAvUSfchfqpXqKzQZDUtWRVSd6F7BsAcsrnzrfA0BmKCYAyEyr09EIiEnI7 xsQ7huhkakn01PuOiIicvKr60fp7SoyQYR2/T72THMTvupXRwE49cGgaGv6fuByi TpvjxV2aJtzwvhMdjeNCYLbzaG0IZZF81/CKPr/w9XClGRlf9GHx7QMuSOcEM44e FTjlqaRk0rEVORjyXaxZg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 400fgngcmy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Jun 2024 11:16:35 +0000 (GMT) Received: from m0360072.ppops.net (m0360072.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45QBGR5B027105; Wed, 26 Jun 2024 11:16:34 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 400fgngcmw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Jun 2024 11:16:34 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45QB3QFL018096; Wed, 26 Jun 2024 11:16:33 GMT Received: from smtprelay07.dal12v.mail.ibm.com ([172.16.1.9]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yx8xucb6f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Jun 2024 11:16:33 +0000 Received: from smtpav05.wdc07v.mail.ibm.com (smtpav05.wdc07v.mail.ibm.com [10.39.53.232]) by smtprelay07.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45QBGU0P36897260 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2024 11:16:32 GMT Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8EDD758043; Wed, 26 Jun 2024 11:16:30 +0000 (GMT) Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DAA065805D; Wed, 26 Jun 2024 11:16:27 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav05.wdc07v.mail.ibm.com (Postfix) with ESMTP; Wed, 26 Jun 2024 11:16:27 +0000 (GMT) From: Niklas Schnelle Date: Wed, 26 Jun 2024 13:15:49 +0200 Subject: [PATCH v4 2/4] s390/pci: Add quirk support and set pdev-non_compliant_bars for ISM devices Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240626-vfio_pci_mmap-v4-2-7f038870f022@linux.ibm.com> References: <20240626-vfio_pci_mmap-v4-0-7f038870f022@linux.ibm.com> In-Reply-To: <20240626-vfio_pci_mmap-v4-0-7f038870f022@linux.ibm.com> To: Bjorn Helgaas , Christoph Hellwig , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Alex Williamson , Gerd Bayer , Matthew Rosato , Jason Gunthorpe Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Niklas Schnelle X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=4182; i=schnelle@linux.ibm.com; h=from:subject:message-id; bh=CYzstYaaXSrnMozeJlgiNEPXqNaJBsBlSJh01euI9Zs=; b=owGbwMvMwCH2Wz534YHOJ2GMp9WSGNKqfxTrb5y5aVvb4u1OAkrvZP/tnM3dlbowJE+GaUKXS YuFfGBcRykLgxgHg6yYIsuiLme/dQVTTPcE9XfAzGFlAhnCwMUpABPJucbIsJFTwEPjSML3fDeX LT8KfQN1XLZub+Yxmiu1SyPza3+TOMP/wJ36PY+sDfIfyMy3yOf49k3O8fZ+/pbsiU3GZbny6uu 4AA== X-Developer-Key: i=schnelle@linux.ibm.com; a=openpgp; fpr=9DB000B2D2752030A5F72DDCAFE43F15E8C26090 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: R2DKuAR0ZnNaoG1kPepi8fNgl250LMcz X-Proofpoint-GUID: A1LxgYlOGPctqWHp4KmZeVeD-0AiU3sG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-26_05,2024-06-25_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 bulkscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406260082 On s390 there is a virtual PCI device called ISM which has a few pecularities. For one it claims to have a 256 TiB PCI BAR which leads to any attempt to ioremap() in its entirety failing. This is problematic since mapping the whole BAR is the default behavior of for example QEMU with VFIO_PCI_MMAP enabled. Even if one tried to map this BAR only partially the mapping would not be usable on systems with MIO support enabled unless using the function handle based PCI instructions directly. This is because of another oddity in that this virtual PCI device does not support the newer memory I/O (MIO) PCI instructions and legacy PCI instructions are not accessible through writeq()/readq() or by user-space when MIO is in use. Indicate that ISM's BAR is special and does not conform to PCI BAR expectations by setting pdev->non_compliant_bars such that drivers not specifically developed for ISM can easily ignore it. To this end add basic PCI quirks support modeled after x86's arch/x86/pci/fixup.c and move the ISM device's PCI ID to the common header to make it accessible. Also enable CONFIG_PCI_QUIRKS whenever CONFIG_PCI is enabled. Signed-off-by: Niklas Schnelle Acked-by: Alexandra Winter --- arch/s390/Kconfig | 4 +--- arch/s390/pci/Makefile | 2 +- arch/s390/pci/pci_fixup.c | 23 +++++++++++++++++++++++ drivers/s390/net/ism_drv.c | 1 - include/linux/pci_ids.h | 1 + 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index c59d2b54df49..8332ba71465e 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -41,9 +41,6 @@ config AUDIT_ARCH config NO_IOPORT_MAP def_bool y -config PCI_QUIRKS - def_bool n - config ARCH_SUPPORTS_UPROBES def_bool y @@ -234,6 +231,7 @@ config S390 select PCI_DOMAINS if PCI select PCI_MSI if PCI select PCI_MSI_ARCH_FALLBACKS if PCI_MSI + select PCI_QUIRKS if PCI select SPARSE_IRQ select SWIOTLB select SYSCTL_EXCEPTION_TRACE diff --git a/arch/s390/pci/Makefile b/arch/s390/pci/Makefile index 0547a10406e7..03d96c76c21a 100644 --- a/arch/s390/pci/Makefile +++ b/arch/s390/pci/Makefile @@ -5,5 +5,5 @@ obj-$(CONFIG_PCI) += pci.o pci_irq.o pci_clp.o pci_sysfs.o \ pci_event.o pci_debug.o pci_insn.o pci_mmio.o \ - pci_bus.o pci_kvm_hook.o + pci_bus.o pci_kvm_hook.o pci_fixup.o obj-$(CONFIG_PCI_IOV) += pci_iov.o diff --git a/arch/s390/pci/pci_fixup.c b/arch/s390/pci/pci_fixup.c new file mode 100644 index 000000000000..61045348f20a --- /dev/null +++ b/arch/s390/pci/pci_fixup.c @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Exceptions for specific devices, + * + * Copyright IBM Corp. 2024 + * + * Author(s): + * Niklas Schnelle + */ +#include + +static void zpci_ism_bar_no_mmap(struct pci_dev *pdev) +{ + /* + * ISM's BAR is special. Drivers written for ISM know + * how to handle this but others need to be aware of their + * special nature e.g. to prevent attempts to mmap() it. + */ + pdev->non_compliant_bars = 1; +} +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_IBM, + PCI_DEVICE_ID_IBM_ISM, + zpci_ism_bar_no_mmap); diff --git a/drivers/s390/net/ism_drv.c b/drivers/s390/net/ism_drv.c index e36e3ea165d3..d32633ed9fa8 100644 --- a/drivers/s390/net/ism_drv.c +++ b/drivers/s390/net/ism_drv.c @@ -20,7 +20,6 @@ MODULE_DESCRIPTION("ISM driver for s390"); MODULE_LICENSE("GPL"); -#define PCI_DEVICE_ID_IBM_ISM 0x04ED #define DRV_NAME "ism" static const struct pci_device_id ism_device_table[] = { diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 942a587bb97e..d730fce2113f 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -517,6 +517,7 @@ #define PCI_DEVICE_ID_IBM_ICOM_V2_ONE_PORT_RVX_ONE_PORT_MDM 0x0251 #define PCI_DEVICE_ID_IBM_ICOM_V2_ONE_PORT_RVX_ONE_PORT_MDM_PCIE 0x0361 #define PCI_DEVICE_ID_IBM_ICOM_FOUR_PORT_MODEL 0x252 +#define PCI_DEVICE_ID_IBM_ISM 0x04ED #define PCI_SUBVENDOR_ID_IBM 0x1014 #define PCI_SUBDEVICE_ID_IBM_SATURN_SERIAL_ONE_PORT 0x03d4 From patchwork Wed Jun 26 11:15:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Schnelle X-Patchwork-Id: 13712748 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD9F4181335; Wed, 26 Jun 2024 11:16:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719400607; cv=none; b=b55cDv2SaZeNwJ9er7VEMPn/flTKo5EDpN3eKHmmMch9Juqe9FlNaEKTBBQ8NzUjdDkALqHnvMsU/j4bO1BQO3nnlBm2zKpVkc3Cji8ZCUXj9Vu3YLM7QX6CGINpCackxsvMjwYdoWDmvt4ut24RX4fg78knYwrImpdxAwXC4d8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719400607; c=relaxed/simple; bh=FGKEpTleFBSSK7WUxdG/8JzLVsEa4P9Al0JqlCWeNms=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QagmcUu30PBi/GTl8j8W1un9Cppo3/h6CXYPaik+6X4WmgwYASSdU23CtjsBvjm3Oa8PGoF5w8azODlomjIyYQwZEepZqCTMNK15EqMZbPL1BMOk5hIJbW0HAA4Xp7F6PwDXDlXQNny5pC+nVJzqqZFWBOcmD4F2hk/pzpK7g+g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=KpUfueRC; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="KpUfueRC" Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45QAx4P1014733; Wed, 26 Jun 2024 11:16:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :date:subject:mime-version:content-type :content-transfer-encoding:message-id:references:in-reply-to:to :cc; s=pp1; bh=CRbUUMxJyaC8a9NNtMcOFepASjt8GcUVVwxXCIDFCfA=; b=K pUfueRCBs54kLwuO7NCwNU6TIDg9yPuppEnqW32rBXYAYPEVVCaCP85PuQg3inyc lNp6xzUNzMrFYR8h0iuKTRSpSoZsr8T9SGQaXkCXb0px1EivXxAn6ScVVi0I2xaX KMV1WVHHBZkL58O/RjPW1yFNgCPGxjMgHFULhtKduP426kJJtZ75Y4eDM+wd9U7X DBPMDe3w+L/E+yATrozDgQ2RzMkJt3d8rBYJTSMGQ5fxpKOGhHtQ3lrJCRbdqipg QBgd4SYOPnUNUX2yAC0XeVzHpwQN+iIKfAgXqUoijc3WG6zQiutUaDjnbSqwvdFl yZOf/oBBB3mwCaHYNeYKA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 400hq801ge-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Jun 2024 11:16:38 +0000 (GMT) Received: from m0353723.ppops.net (m0353723.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45QBBoSm032658; Wed, 26 Jun 2024 11:16:37 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 400hq801gc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Jun 2024 11:16:37 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45QApCpB018131; Wed, 26 Jun 2024 11:16:37 GMT Received: from smtprelay03.wdc07v.mail.ibm.com ([172.16.1.70]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yx8xucb6s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Jun 2024 11:16:37 +0000 Received: from smtpav05.wdc07v.mail.ibm.com (smtpav05.wdc07v.mail.ibm.com [10.39.53.232]) by smtprelay03.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45QBGXqV26411660 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2024 11:16:35 GMT Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8D1C258043; Wed, 26 Jun 2024 11:16:33 +0000 (GMT) Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DA72C5805F; Wed, 26 Jun 2024 11:16:30 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav05.wdc07v.mail.ibm.com (Postfix) with ESMTP; Wed, 26 Jun 2024 11:16:30 +0000 (GMT) From: Niklas Schnelle Date: Wed, 26 Jun 2024 13:15:50 +0200 Subject: [PATCH v4 3/4] vfio/pci: Disable mmap() non-compliant BARs Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240626-vfio_pci_mmap-v4-3-7f038870f022@linux.ibm.com> References: <20240626-vfio_pci_mmap-v4-0-7f038870f022@linux.ibm.com> In-Reply-To: <20240626-vfio_pci_mmap-v4-0-7f038870f022@linux.ibm.com> To: Bjorn Helgaas , Christoph Hellwig , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Alex Williamson , Gerd Bayer , Matthew Rosato , Jason Gunthorpe Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Niklas Schnelle X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1430; i=schnelle@linux.ibm.com; h=from:subject:message-id; bh=FGKEpTleFBSSK7WUxdG/8JzLVsEa4P9Al0JqlCWeNms=; b=owGbwMvMwCH2Wz534YHOJ2GMp9WSGNKqf1SGnPmhwH/3DufOxBtPHKfP0Knnk/rYaMqjpbfw/ ZnF/r8vd5SyMIhxMMiKKbIs6nL2W1cwxXRPUH8HzBxWJpAhDFycAjCRg7oMfzh/ztbq47pecvFg aZRrlbPApnyxA633Hvx02jkzdQ+PfREjw6a1fGkpnQ4Kc1bYmFm/VRbO2lgTtEhmsqpXh9kJg4J YfgA= X-Developer-Key: i=schnelle@linux.ibm.com; a=openpgp; fpr=9DB000B2D2752030A5F72DDCAFE43F15E8C26090 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 5xPhy27Id4zsREc5JTQQScMMW9FJVpoF X-Proofpoint-GUID: 9I-fN2YW-onVCe69b-p7MwxO01tNXvcx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-26_05,2024-06-25_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 phishscore=0 lowpriorityscore=0 adultscore=0 spamscore=0 suspectscore=0 mlxlogscore=774 impostorscore=0 mlxscore=0 priorityscore=1501 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406260082 When VFIO_PCI_MMAP is enabled for s390 in a future commit and the ISM device is passed-through to a KVM guest QEMU attempts to eagerly mmap() its BAR. This fails because the 256 TiB large BAR does not fit in the virtual map. Besides this issue mmap() of the ISM device's BAR is not useful either as even a partial mapping won't be usable from user-space without a vfio-pci variant driver. A previous commit ensures that pdev-> non_compliant_bars is set for ISM so use this to disallow mmap() with the expecation that mmap() of non-compliant BARs is not advisable in the general case either. Signed-off-by: Niklas Schnelle --- drivers/vfio/pci/vfio_pci_core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c index 987c7921affa..0e9d46575776 100644 --- a/drivers/vfio/pci/vfio_pci_core.c +++ b/drivers/vfio/pci/vfio_pci_core.c @@ -128,10 +128,9 @@ static void vfio_pci_probe_mmaps(struct vfio_pci_core_device *vdev) /* * The PCI core shouldn't set up a resource with a - * type but zero size. But there may be bugs that - * cause us to do that. + * type but zero size or non-compliant BARs. */ - if (!resource_size(res)) + if (!resource_size(res) || vdev->pdev->non_compliant_bars) goto no_mmap; if (resource_size(res) >= PAGE_SIZE) { From patchwork Wed Jun 26 11:15:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Schnelle X-Patchwork-Id: 13712749 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02778181B87; Wed, 26 Jun 2024 11:16:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719400608; cv=none; b=i8NzdKih6z9PY1Sw8n0C8JxLSlyesrjzPxJJpORrFZnDcpAXVXNL/ClcqYLk3ex/G+3b2+OR/rY6yBJF7mhC5jag7xlLM4U1CNnGaYUtnDdEBcjPO04BRrK5YQ5r7ixlFoWG4TPeO6dfXBYeF4GxBnwNotfhNYDgsAS5BfId8Zc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719400608; c=relaxed/simple; bh=+mwCt0KjL/HCJrkvf+Tt2TRp3JF3pn6sfN6Ag8jhg2g=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=r2OcBKDTBQRaUNrUikPk7CXMEDZj7gyHxmJdTi3XXuLobfUwrxMob9O3r9iUqw+yWCJFuLZEzEx0yB+5GgHP1yS2rN35vIoXXB8rI93vDxK1mrc5oWCID67d+ZECNIKokcYU6lb0boQGx1lrrcqzO4MfkowKeJ4ZbspgHSsDhxk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=jr2pO+dv; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="jr2pO+dv" Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45QB0ARH008665; Wed, 26 Jun 2024 11:16:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :date:subject:content-type:message-id:references:in-reply-to:to :cc:content-transfer-encoding:mime-version; s=pp1; bh=3xZ/9RZVyZ OhI74Mwtm9Euz5t7EvcqdCMJRHM/H3PGE=; b=jr2pO+dvPgwi4YfgP+6ZXlORgX FN+1R6hwBqkjyDCqQLzCFrfMPN6zf7oJskv8ZuaroV/Ql7itA53/4qewFlmp8hIi 50sIqSFmeGGBJuplYIe3iVMcNPXe9XyLooC4sMEwaoZRyLP1izucaYBcVYR7WJRV /9mDm0GPPCarZc9vMwbo7GnygnCZPrHkxRpqyNC5RunfTNmB3vCt03i575lRHoMt b3b5Op1fdBrVNBpir+allfK0xkf9Y1VvFbJd47QAVUwHmwa9BJQXIrj6EkfwpX2/ QfV9F2zNqCSFb+fwkvsI8fF3pAeoZrdNHUuVDIOiyUmvMKfFoVXaoZT0auXA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 400hq681h5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Jun 2024 11:16:41 +0000 (GMT) Received: from m0353722.ppops.net (m0353722.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45QBGek8000714; Wed, 26 Jun 2024 11:16:40 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 400hq681h2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Jun 2024 11:16:40 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45QB09jh018103; Wed, 26 Jun 2024 11:16:40 GMT Received: from smtprelay06.wdc07v.mail.ibm.com ([172.16.1.73]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yx8xucb71-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Jun 2024 11:16:40 +0000 Received: from smtpav05.wdc07v.mail.ibm.com (smtpav05.wdc07v.mail.ibm.com [10.39.53.232]) by smtprelay06.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45QBGadw19923570 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2024 11:16:38 GMT Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8CEFD58053; Wed, 26 Jun 2024 11:16:36 +0000 (GMT) Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D8C5958059; Wed, 26 Jun 2024 11:16:33 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav05.wdc07v.mail.ibm.com (Postfix) with ESMTP; Wed, 26 Jun 2024 11:16:33 +0000 (GMT) From: Niklas Schnelle Date: Wed, 26 Jun 2024 13:15:51 +0200 Subject: [PATCH v4 4/4] vfio/pci: Enable PCI resource mmap() on s390 and remove VFIO_PCI_MMAP Message-Id: <20240626-vfio_pci_mmap-v4-4-7f038870f022@linux.ibm.com> References: <20240626-vfio_pci_mmap-v4-0-7f038870f022@linux.ibm.com> In-Reply-To: <20240626-vfio_pci_mmap-v4-0-7f038870f022@linux.ibm.com> To: Bjorn Helgaas , Christoph Hellwig , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Alex Williamson , Gerd Bayer , Matthew Rosato , Jason Gunthorpe Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Niklas Schnelle , Jason Gunthorpe X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1848; i=schnelle@linux.ibm.com; h=from:subject:message-id; bh=+mwCt0KjL/HCJrkvf+Tt2TRp3JF3pn6sfN6Ag8jhg2g=; b=owGbwMvMwCH2Wz534YHOJ2GMp9WSGNKqfzTE27dlhUz80nRM6ljXoarZr5fPTi8+4Dd/9qnG4 Ljq4vP3O0pZGMQ4GGTFFFkWdTn7rSuYYronqL8DZg4rE8gQBi5OAZjIt5WMDD/XL03vlmIt6vJ4 VZFx9IGB3U8Js4m3F7xNXiMcdSpm/3RGhj8izAdjZVr1VRm551sqdmi+Mes6/pJN02rJy1XSaw7 85wQA X-Developer-Key: i=schnelle@linux.ibm.com; a=openpgp; fpr=9DB000B2D2752030A5F72DDCAFE43F15E8C26090 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: leImJWFe1E6NHv27ByZKgxfFYxT7_oZU X-Proofpoint-ORIG-GUID: Sv4DQYDvfHDxVbJu8Ms9huLczwKsS2rQ X-Proofpoint-UnRewURL: 0 URL was un-rewritten Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-26_05,2024-06-25_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxscore=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 mlxlogscore=739 suspectscore=0 adultscore=0 phishscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406260082 With the introduction of memory I/O (MIO) instructions enbaled in commit 71ba41c9b1d9 ("s390/pci: provide support for MIO instructions") s390 gained support for direct user-space access to mapped PCI resources. Even without those however user-space can access mapped PCI resources via the s390 specific MMIO syscalls. Thus mmap() can and should be supported on all s390 systems with native PCI. Since VFIO_PCI_MMAP enablement for s390 would make it unconditionally true and thus pointless just remove it entirely. Link: https://lore.kernel.org/all/c5ba134a1d4f4465b5956027e6a4ea6f6beff969.camel@linux.ibm.com/ Suggested-by: Jason Gunthorpe Reviewed-by: Matthew Rosato Reviewed-by: Jason Gunthorpe Signed-off-by: Niklas Schnelle Acked-by: Alex Williamson --- drivers/vfio/pci/Kconfig | 4 ---- drivers/vfio/pci/vfio_pci_core.c | 3 --- 2 files changed, 7 deletions(-) diff --git a/drivers/vfio/pci/Kconfig b/drivers/vfio/pci/Kconfig index bf50ffa10bde..c3bcb6911c53 100644 --- a/drivers/vfio/pci/Kconfig +++ b/drivers/vfio/pci/Kconfig @@ -7,10 +7,6 @@ config VFIO_PCI_CORE select VFIO_VIRQFD select IRQ_BYPASS_MANAGER -config VFIO_PCI_MMAP - def_bool y if !S390 - depends on VFIO_PCI_CORE - config VFIO_PCI_INTX def_bool y if !S390 depends on VFIO_PCI_CORE diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c index 0e9d46575776..c08d0f7bb500 100644 --- a/drivers/vfio/pci/vfio_pci_core.c +++ b/drivers/vfio/pci/vfio_pci_core.c @@ -120,9 +120,6 @@ static void vfio_pci_probe_mmaps(struct vfio_pci_core_device *vdev) res = &vdev->pdev->resource[bar]; - if (!IS_ENABLED(CONFIG_VFIO_PCI_MMAP)) - goto no_mmap; - if (!(res->flags & IORESOURCE_MEM)) goto no_mmap;