From patchwork Tue May 21 12:14:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Schnelle X-Patchwork-Id: 13669370 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 1FF7476410; Tue, 21 May 2024 12:15:35 +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=1716293737; cv=none; b=m0uPGH6QjaTcFYUWAgMgZoNITM7A/2SY8s39HEAwShqQVhgB+QOCQc7InZsxZ6I9XD1IkmxvcGOCOXkpnmsMroq8JrllAS+qGGm+napvRGiFXPDNy2h1MwZnQ9osAqKK33MC2zE6+speKO3cZXwspZ40eGTTNhIcma1p9blitqs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716293737; c=relaxed/simple; bh=dAABayEDOSfEypk9NTThYmbaf19C4af1A3Lunw+eFII=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HxIqEX0pcZ5ebfsFWgpsM6HH+BDSaClzrgso/DcEqWiEu2PWz3JrDjojkwgldasNJpZ0GEu2ZMyiRlmZgaW/RYo6fwiKsX+wo7l5LQLhfxjq1/NyPOr3hpi3BwtyPD3auKRpBwo73majqb+XpmkACixI+VAhh63q3JvCqQfir9s= 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=CZEqcH/E; 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="CZEqcH/E" Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44LCCg1B012068; Tue, 21 May 2024 12:15: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=0xh5DBvKXFg7KZScVHo4DoheXvv3/yC0K5O0DOCG9Aw=; b=CZEqcH/EUZ9mnj0rAgEwUYGIgej49SZkWgf+YKKe0YHZui0yEyhy8Rvu0AP4WJ/Lq3zQ SUYx+L8WbR9tOKxIaFQncEEBVXNg5C/8E52/8ZfWuzczqEhqhJW0b/vEoFxA4VMGEhBD b5SibtQl/GakTDEXzUXd3eZniJF7nmfps9wpxJT1UOkHr4Pu83SAvucbo8qTduJIfijL oZVyMkb3KDF8bBL8/DYranK4DcF/wF2Y4PZpZ/D+bx1klfDExFNgqMiQ8hW0shlNLYWS LxRW20x2qQV9VkvFAkOFcrJSaKNjm2jAZl5duqsbIV0/f7WFFQCbc6n9H1CylXzVSAlS MQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3y8udsr0cy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 12:15:34 +0000 Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 44LCFYac017446; Tue, 21 May 2024 12:15: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 3y8udsr0ct-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 12:15:34 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 44LAHaTG000887; Tue, 21 May 2024 12:15:33 GMT Received: from smtprelay01.wdc07v.mail.ibm.com ([172.16.1.68]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3y77205pj3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 12:15:33 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay01.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 44LCFToo50201236 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 May 2024 12:15:32 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D53695805E; Tue, 21 May 2024 12:15:29 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 11D9858043; Tue, 21 May 2024 12:15:28 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Tue, 21 May 2024 12:15:27 +0000 (GMT) From: Niklas Schnelle Date: Tue, 21 May 2024 14:14:57 +0200 Subject: [PATCH 1/3] 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: <20240521-vfio_pci_mmap-v1-1-2f6315e0054e@linux.ibm.com> References: <20240521-vfio_pci_mmap-v1-0-2f6315e0054e@linux.ibm.com> In-Reply-To: <20240521-vfio_pci_mmap-v1-0-2f6315e0054e@linux.ibm.com> To: 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=1882; i=schnelle@linux.ibm.com; h=from:subject:message-id; bh=dAABayEDOSfEypk9NTThYmbaf19C4af1A3Lunw+eFII=; b=owGbwMvMwCH2Wz534YHOJ2GMp9WSGNJ8JkS7cflp7L3LErOJ8ULm7tiGrYtO7JrwtulZYPWpJ zs+10Zu6ChlYRDjYJAVU2RZ1OXst65giumeoP4OmDmsTCBDGLg4BWAi5XKMDDcWe/xI3aTxtm3y tSyZd3seCb3+u05pfU/jzS0vp6wprmZlZFgz+VX+AamY9PBE163XPPa2LZ16xOmJQJt+Z3Hrpxe FvGwA X-Developer-Key: i=schnelle@linux.ibm.com; a=openpgp; fpr=9DB000B2D2752030A5F72DDCAFE43F15E8C26090 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: mKSek11CftSv1bSJDKmIIgkbryhBnIFl X-Proofpoint-GUID: b6UkesWe_d7WXLuxNf71rkWASCJrfMBb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-21_08,2024-05-21_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 mlxlogscore=931 mlxscore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 adultscore=0 malwarescore=0 clxscore=1015 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405210092 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(). Signed-off-by: Niklas Schnelle Reviewed-by: Jason Gunthorpe --- 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 a90499c087f0..217defbcb4f1 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->vm_mm, mmio_addr, &ptep, &ptl); - if (ret) - goto out_unlock_mmap; + if (ret) { + fixup_user_fault(vma->vm_mm, mmio_addr, FAULT_FLAG_WRITE, NULL); + ret = follow_pte(vma->vm_mm, 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->vm_mm, mmio_addr, &ptep, &ptl); - if (ret) - goto out_unlock_mmap; + if (ret) { + fixup_user_fault(vma->vm_mm, mmio_addr, 0, NULL); + ret = follow_pte(vma->vm_mm, 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 Tue May 21 12:14:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Schnelle X-Patchwork-Id: 13669371 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 3B680770FB; Tue, 21 May 2024 12:15: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=1716293739; cv=none; b=HHKsuEY6Ep9pld7A377Xf3War4aktw6dsiVQxrgsAmdwi8PAZuQDvMySyY58/lSIAK/+LUND1VAqfi0cui25SgahePnGvyzkfiN+Arssgel4Q19a8rt8L+3s3Kl3E3pzsHDDALxcazxucptAA4h/NUMtazZ+rGQOQaLdRBdG01c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716293739; c=relaxed/simple; bh=F1bkIcFhsc+WCTlsr4eJ7l4akJcC8VDnitAlvww5xFo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JMmgA06Q64IJmCiCf+Ayu0Gyr15ESyX9ETF6OD5CH9L4YGfsmrKxNA1GL7trqYkDlOj9+4yuJ4h3OcScTL9bXGQoRiTQ4GohJR2Lk1sh+PYauzpgei4lTBWqgX0vUnpA8SsNBc9sfQLKjWzG0gAnK5cFH3AGVWs/9c3GHDvJcC4= 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=gD7D1JLL; 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="gD7D1JLL" Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44LCDs7E014160; Tue, 21 May 2024 12:15:37 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=O14Ca6VP2DxWUHw2XmaewgHbuznspydEume4f/0C7Dw=; b=gD7D1JLLmAeTWEocLEWzZb8rE94j2unfOlbyjKHIejMhc4ffq5T+N/5ntZafzXsHGk76 +VRLXQoFeNnjv1ml+pUstTWM9XgTokv82N/Fg4NleWHz14vlA4+gxIKVkWeFmcM6O1UA Gmz8nn9nWtFzq1Ra+F+P1P3F6AcvcqwioUCLdHkoU4j0ZWAo+Ra9ztIlO1gIytjdWDcH dwHqzwR96xM5j7OXBvqnb5RFd5mHqTI3azRCc7tsKTWe+Q1+O+MgSLoy/XdRf6CbcCA2 TI+jyTFiAl70oqGUmKGuY3eL6hfyb1YSzhDd2ywrHsi6ud6AfLinkZToEYTQdlpdRNll FA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3y8udsr0d5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 12:15:37 +0000 Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 44LCFa8w017538; Tue, 21 May 2024 12:15: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 3y8udsr0d2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 12:15:36 +0000 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 44LAIuA5022240; Tue, 21 May 2024 12:15:36 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3y76ntnsfk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 12:15:36 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 44LCFXBT5571110 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 May 2024 12:15:35 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DD38A58043; Tue, 21 May 2024 12:15:31 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 19FDF5805F; Tue, 21 May 2024 12:15:30 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Tue, 21 May 2024 12:15:29 +0000 (GMT) From: Niklas Schnelle Date: Tue, 21 May 2024 14:14:58 +0200 Subject: [PATCH 2/3] vfio/pci: Tolerate oversized BARs by disallowing mmap Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240521-vfio_pci_mmap-v1-2-2f6315e0054e@linux.ibm.com> References: <20240521-vfio_pci_mmap-v1-0-2f6315e0054e@linux.ibm.com> In-Reply-To: <20240521-vfio_pci_mmap-v1-0-2f6315e0054e@linux.ibm.com> To: 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=1929; i=schnelle@linux.ibm.com; h=from:subject:message-id; bh=F1bkIcFhsc+WCTlsr4eJ7l4akJcC8VDnitAlvww5xFo=; b=owGbwMvMwCH2Wz534YHOJ2GMp9WSGNJ8JsRsz7t0puXG/xVKUQ9eO53uy38zJ23NA6HFL38YM X19/jPesKOUhUGMg0FWTJFlUZez37qCKaZ7gvo7YOawMoEMYeDiFICJcK9kZLgmHFufp+YXH8RW PUlj6XeuNYdrH55eWMze4vdGPeV9mjAjw6Kt/C9Od/yfI372nOaqqOwnDxef5tGfvlbtU7hl6rb yLi4A X-Developer-Key: i=schnelle@linux.ibm.com; a=openpgp; fpr=9DB000B2D2752030A5F72DDCAFE43F15E8C26090 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: dv9Fd_7kAZzVIY9SolYITNrVsyt9CAZX X-Proofpoint-GUID: 2k2j5Afp6oqBgKq_rssQQsCVkAAqUFz_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-21_08,2024-05-21_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 adultscore=0 malwarescore=0 clxscore=1015 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405210092 On s390 there is a virtual PCI device called ISM which has a few rather annoying oddities. For one it claims to have a 256 TiB PCI BAR (not a typo) which leads to any attempt to mmap() it failing during vmap. Even if one tried to map this "BAR" only partially the mapping would not be usable on systems with MIO support enabled however. 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 by user-space when MIO is in use. If this device needs to be accessed by user-space it will thus need a vfio-pci variant driver. Until then work around both issues by excluding resources which don't fit between IOREMAP_START and IOREMAP_END in vfio_pci_probe_mmaps(). Signed-off-by: Niklas Schnelle Reviewed-by: Jason Gunthorpe --- drivers/vfio/pci/vfio_pci_core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c index d94d61b92c1a..23961299b695 100644 --- a/drivers/vfio/pci/vfio_pci_core.c +++ b/drivers/vfio/pci/vfio_pci_core.c @@ -28,6 +28,7 @@ #include #include #include +#include #if IS_ENABLED(CONFIG_EEH) #include #endif @@ -129,9 +130,12 @@ 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. + * cause us to do that. There is also at least one + * device which advertises a resource too large to + * ioremap(). */ - if (!resource_size(res)) + if (!resource_size(res) || + resource_size(res) > (IOREMAP_END + 1 - IOREMAP_START)) goto no_mmap; if (resource_size(res) >= PAGE_SIZE) { From patchwork Tue May 21 12:14:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Schnelle X-Patchwork-Id: 13669372 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 7DC7477118; Tue, 21 May 2024 12:15:39 +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=1716293741; cv=none; b=GwBwajtrtetFCS2uCQwWf1oZYqGbMI6YhPxm7ZERCqoBLlHUamqcUSEDtmqOqLE/x0i0+c+ChSD+jhfrI3u2IMrAzfGvs8Vt8dOBBf7Vp/Mqlh4KwS6FVljh+aTD7sXnnctZIpH1SBq+9q9miyWcF16XTQKXZyNKy+CToC6WZSA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716293741; c=relaxed/simple; bh=r6NUAZTvpLRwycDnLcFtYRyW2y8FYnVfEO5UQERDHKw=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=dVw6ZBgLVceZB/Hhsmq+fx4vTox43d5M0E+faIyOxA6KPGlrVuUVQleQyR1cOhTeAgYNvBcwRM5MnZJebljH8bWd/LnGce30mhq740ji1+IP9/9eBkxXibOWubhY1xN6zs/D5S2Vnl7KnXjg+KveNxygoMP/3m+o0haIb0kZu7E= 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=rrBAZyoz; 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="rrBAZyoz" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44LC3Fhg025469; Tue, 21 May 2024 12:15:38 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=Buw4eF8ZL2S9x7Ww4CLjvGShtmwTm3IYHiPIwey83ws=; b=rrBAZyoztA4t5GokwFz3tfE8lkXPoI+SdvtT6BhBG67A+L6T4L5DNryveAH1PDXYWuWx wnB3q+85QghQxCNFqDE3B1VsdFsvNz34ClB+B8HGHHC1iylLbWbBETKEEfqGM5qplBUj OWcToXGC0kEtYt/WVcq1KSXFiIbYisVzZwrewgln1VpCxjDKAl7UraStiZ00bZOToUYQ pRnEdQnlQmgXBx3qvyIm9Ux1h6zc3hja9h7kw++y24w0OPXAPGcrap0bPcInPckwP3Ck r3yayo7y4P8H6HYdbdGFXIWVbCDKkfWldwYRLmtxIb5mETZaXt44W7DDexSR48oI3m7+ cQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3y8u92g1a1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 12:15:38 +0000 Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 44LCFbgB011685; Tue, 21 May 2024 12:15:37 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 3y8u92g19x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 12:15:37 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 44LBHFfV026447; Tue, 21 May 2024 12:15:37 GMT Received: from smtprelay02.dal12v.mail.ibm.com ([172.16.1.4]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3y785mddjb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 12:15:37 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay02.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 44LCFXRF31851198 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 May 2024 12:15:36 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E44C158069; Tue, 21 May 2024 12:15:33 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 21F555805D; Tue, 21 May 2024 12:15:32 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Tue, 21 May 2024 12:15:31 +0000 (GMT) From: Niklas Schnelle Date: Tue, 21 May 2024 14:14:59 +0200 Subject: [PATCH 3/3] vfio/pci: Enable VFIO_PCI_MMAP for s390 Message-Id: <20240521-vfio_pci_mmap-v1-3-2f6315e0054e@linux.ibm.com> References: <20240521-vfio_pci_mmap-v1-0-2f6315e0054e@linux.ibm.com> In-Reply-To: <20240521-vfio_pci_mmap-v1-0-2f6315e0054e@linux.ibm.com> To: 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=1087; i=schnelle@linux.ibm.com; h=from:subject:message-id; bh=r6NUAZTvpLRwycDnLcFtYRyW2y8FYnVfEO5UQERDHKw=; b=owGbwMvMwCH2Wz534YHOJ2GMp9WSGNJ8JsROmrSjg9v4Vc2fCiYpgwT/nr21IveULA/+ZuoUb bYJWzyjo5SFQYyDQVZMkWVRl7PfuoIppnuC+jtg5rAygQxh4OIUgInEujAynN380stzYUT9gVh+ 5TkMzkcmp/OlVHXcVb8q729qorhkLiPDoQ9G2aE7uvRiW3le35z4//UUg6nZdiYLTf5uW2WanLO LFwA= X-Developer-Key: i=schnelle@linux.ibm.com; a=openpgp; fpr=9DB000B2D2752030A5F72DDCAFE43F15E8C26090 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: wWG7Pd-2LYWqFNMnvba9PHpu2T7OhGcg X-Proofpoint-GUID: H6MTPEmJ4HJTX3Ccmqq9R31R2j9QU6SO 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.650,FMLib:17.12.28.16 definitions=2024-05-21_07,2024-05-21_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 suspectscore=0 mlxlogscore=629 priorityscore=1501 mlxscore=0 lowpriorityscore=0 bulkscore=0 impostorscore=0 clxscore=1015 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405210091 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 VFIO_PCI_MMAP can be enabled on all s390 systems with native PCI allowing vfio-pci user-space applications direct access to mapped resources. Link: https://lore.kernel.org/all/c5ba134a1d4f4465b5956027e6a4ea6f6beff969.camel@linux.ibm.com/ Signed-off-by: Niklas Schnelle --- drivers/vfio/pci/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vfio/pci/Kconfig b/drivers/vfio/pci/Kconfig index 15821a2d77d2..814aa0941d61 100644 --- a/drivers/vfio/pci/Kconfig +++ b/drivers/vfio/pci/Kconfig @@ -8,7 +8,7 @@ config VFIO_PCI_CORE select IRQ_BYPASS_MANAGER config VFIO_PCI_MMAP - def_bool y if !S390 + def_bool y depends on VFIO_PCI_CORE config VFIO_PCI_INTX