Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp914690pxb; Fri, 22 Apr 2022 14:11:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxt44/1F+SaJjzQg4Qrl9d0r7ky07XrpdThyp3YWtL27bsfVsi7uYjVtgo+gVzatqVGCHli X-Received: by 2002:a17:90a:8d82:b0:1d2:cd8c:ed6 with SMTP id d2-20020a17090a8d8200b001d2cd8c0ed6mr7572356pjo.63.1650661870245; Fri, 22 Apr 2022 14:11:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650661870; cv=none; d=google.com; s=arc-20160816; b=AyznVO0BiL9TSDUoi6G9SnMVvxQgexhIfLIHEssucQfoXs1Z0ZMuqSwGTpA1d1/dpc x1fC/Ac3VMayFOt+HNRmuRWoTkzLcn/RReJCAPu3+exCNrcFOUeFP2ANw1xAhQy8Tx/g Ha5vpE+v1XHeTQANoqsfYrrgPhZKVd5V21iPyhbpv+/rkvuX82EU1hl86BnT6PqyilTG pBPA7FRB0TMpqMbsbcjxtWgtUvzo67QtfHjKaHI4eGCtWNXq89tfGw+O77DICeihCLTe 50e8EmdiNLbumaeFGDy/wpPiOpuaMn7ZecTgG0eIqpFgw4WA56lIKkAdp71WIdUy8s8S 7LvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=6/WQleWzBeacBOxE0QPY0rywH7q5l/js+j2kCDej7vM=; b=pdqNVYu+o8jXskDedQ7wS1DBXO98f95HBzsA7GUblfHY9A9/2Uir1RHBD5L42QJ5RB TgFz8IeZDlDXcLLsDH6JHaSg6toFx+v/0Io1u56yMJK+bZ5l9MIxSWoIMsbTxAwwY5iA Pg/R5YLkJ3YEaK3J8+g7aqkPyej1PsmSyqbi8gzIfzq/L4fYy1Bvi8qNeaRiSbGyXvax qyJnLQw/1y2P4eZIO/39o/TvN7OSRbqC0vHVHHc0U0Q+a/w1EvI3CCgU9UC9tvOFWnKG ku4Em+qrsZKVtqfgEYwMEv4Id3EDunQg1/OKElajoksPXvvl9/iMTWbd+vx/wfQfgcEp o9gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=KR6Oc94c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id ot2-20020a17090b3b4200b001caa0b8c6f0si729006pjb.18.2022.04.22.14.11.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 14:11:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=KR6Oc94c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8F05F3614B6; Fri, 22 Apr 2022 13:11:12 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447978AbiDVNcC (ORCPT + 99 others); Fri, 22 Apr 2022 09:32:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382090AbiDVNcB (ORCPT ); Fri, 22 Apr 2022 09:32:01 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 902C0583BA; Fri, 22 Apr 2022 06:29:08 -0700 (PDT) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 23MD13mr017475; Fri, 22 Apr 2022 13:29:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=6/WQleWzBeacBOxE0QPY0rywH7q5l/js+j2kCDej7vM=; b=KR6Oc94cWxDvef5FSHbXStRL0A6ogA3nYh3PwCgi+qTJOr1WcFIlkpf8EdMzFLWxqfGe AhsiTTh6LJwnbkBE9FL9J3DmbcWRpB01j5eKTxg16XHj5nildV8SB9ZC1IsT0DsxHI6h +lRAJaVIBf2Q7z62h2hKD/Mt79VblGDy6FSoMJytcyEVc+CZflqEdD/ujAdAGEFxkJQk Br1iZiIgozaBXI787p55Sy+T2N5N8te1f3Fy62nyRJxhwrD8wcSCr3koZOSErAURMnGy cArfs4BV2ah1eHX22rRudEkxRza8oEbdEk2t5QSmlxLXONSZS/h+s/twTWEpXkYSDC6b RA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3fjm2jrp9y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 22 Apr 2022 13:29:04 +0000 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 23MDQYgs011962; Fri, 22 Apr 2022 13:29:04 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com with ESMTP id 3fjm2jrp94-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 22 Apr 2022 13:29:04 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 23MDLxrU004710; Fri, 22 Apr 2022 13:29:02 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma06fra.de.ibm.com with ESMTP id 3ffn2hyg2k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 22 Apr 2022 13:29:01 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 23MDSweC47645114 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 22 Apr 2022 13:28:58 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A8CEB4203F; Fri, 22 Apr 2022 13:28:58 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 624A742041; Fri, 22 Apr 2022 13:28:58 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 22 Apr 2022 13:28:58 +0000 (GMT) From: Niklas Schnelle To: Bjorn Helgaas , Jan Kiszka , Matthew Rosato , Pierre Morel Cc: linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-s390@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v4 0/4] PCI: Rework pci_scan_slot() and isolated PCI functions Date: Fri, 22 Apr 2022 15:28:54 +0200 Message-Id: <20220422132858.1213022-1-schnelle@linux.ibm.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: BiJXaFwkOKe_yRa1zN6quDcUVUuP-_oO X-Proofpoint-ORIG-GUID: oo_Spt01SqxbkLM4ZXlTzAPa7-O5nQzc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-04-22_03,2022-04-22_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 clxscore=1015 lowpriorityscore=0 adultscore=0 suspectscore=0 mlxlogscore=753 spamscore=0 bulkscore=0 phishscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204220058 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Bjorn, Hi Jan, In an earlier version[0], I sought to apply the existing jailhouse special case for isolated PCI functions to s390. As Bjorn noted in[1] there appears to be some potential for cleaning things up and removing duplication though. This series attempts to do this cleanup (Patches 1 and 2) followed by enabling isolated PCI functions for s390 (Patches 3 and 4). If need be I can of course split the cleanup off but for now I kept it as one as that's what I have been testing. Testing: - On s390 with SR-IOV and a ConnectX NIC with PF 1 but not PF 0 passed throug i.e. the isolated function case. Also of course with just VFs and an NVMe. - On x86_64 on a desktop system where ARI is disabled and with an SR-IOV NIC with non-contiguous VFs as well as the usual other PCI devices. Thanks, Niklas Changes v3 -> v4: - Use a do {} while loop in pci_scan_slot() as it is simpler (Bjorn) - Explicitly check "fn == 0" as it is not a pointer or bool (Bjorn) - Keep the "!dev" check in the ARI branch of next_fn() (Bjorn) - Moved the "fn == 0 && !dev" condition out of next_fn() into pci_scan_slot(). This allows us to keep the "!dev" case in the ARI branch and means there are no new conditions in next_fn() making it easier to verify that its behavior is equivalent to the existing code. - Guard the assignment of dev->multifunction with "fn > 0" instead of "nr > 0". This matches the existing logic more closely and works for the jailhouse case which unconditionally sets dev->multifunction for "fn > 0". This also means fn == 0 is the single "first iteration" test. - Remove some unneeded whitespace in patch 2 Changes v2 -> v3: - Removed now unused nr_devs variable (kernel test robot) Niklas Schnelle (4): PCI: Clean up pci_scan_slot() PCI: Move jailhouse's isolated function handling to pci_scan_slot() PCI: Extend isolated function probing to s390 s390/pci: allow zPCI zbus without a function zero arch/s390/pci/pci_bus.c | 82 ++++++++++---------------------------- drivers/pci/probe.c | 65 +++++++++++++----------------- include/linux/hypervisor.h | 8 ++++ 3 files changed, 56 insertions(+), 99 deletions(-) -- 2.32.0