Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp487397rwd; Tue, 16 May 2023 04:04:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4EffxQlR2snASQsAgqpIKISEvsw5nCx0/ACcliWUqSxgAn4jtr+H71/6iDRtipLsr1fJFK X-Received: by 2002:a17:902:6a8a:b0:1ae:3bfb:f58b with SMTP id n10-20020a1709026a8a00b001ae3bfbf58bmr1030361plk.64.1684235063759; Tue, 16 May 2023 04:04:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684235063; cv=none; d=google.com; s=arc-20160816; b=ZJeIIG8I5JisJZQrryzQmpUNooTX9z0wG3fJXkDK+aLcuhtK6stodYsb+0O0nHNQzT 8NQkX7UgUwnGsOTGIX3OITms49P7ertekG9IuBZn3DWkP/GFQ1MmynzFWyvwGjBvQNX1 D61SsJUiRssUjPAh039DZhEAQ4XGhtopJzkNuXrfNWDs8305xT8VAOh0uHCnIZ7s4mRJ oy4SN/DWR4cOs5CPjp367Zs1r8ZWc5/1RAxOqbwz7H+AylFq8+mBOG62G9+z/raHBZQb PgnvnQ15ARhTaR1v+D5ZCFuujHtDD9+4sPkZ7oc7eh24JNWbS06rJFmjeXr4gIdu6Gja MuJQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IvuTC+9+xPqLTRzivlpLhSDho75SNKtL60YOpEBVWFw=; b=XBgeqzHLTr+qg148tZeKPM+acwYjNwyfqNrZ2huVfikWyT1vRrN/xtCsgCahL7T2Oc CIL+PL3kkY9tBBpC43ckn7Ti8TOC5Tu/6/9RnkCdZyuB6DlGUpGkLoFVfvP9LnaePnU9 vqbEfdm9X7OW07wlhxnILb/8Cz0OkKLsQEm+9Fr/gFYtrc7hiYYzWoQ0DKqriGjq1YGT ELQuYxim/e5G8S1j19bBRdZH43+HIyznFfjyZd9xIkL8mWL5248qNFoHNXJROpjkqpuA X/bz4LsDIbJL8W/X+T/x/PImxsEtmgZVhZoawIHYel3pMSprrzE56j0BnNG94kn4SORU 7z2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=XyPGQ70r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m9-20020a170902db0900b001aaeed1a0e3si19534992plx.487.2023.05.16.04.04.10; Tue, 16 May 2023 04:04:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=XyPGQ70r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232632AbjEPLC5 (ORCPT + 99 others); Tue, 16 May 2023 07:02:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232569AbjEPLCJ (ORCPT ); Tue, 16 May 2023 07:02:09 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 869CC5B9D; Tue, 16 May 2023 04:01:18 -0700 (PDT) Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34GAjGTt030992; Tue, 16 May 2023 11:01:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=IvuTC+9+xPqLTRzivlpLhSDho75SNKtL60YOpEBVWFw=; b=XyPGQ70rF991yJdU1Ojrm4SCG1Ng4ejnBze0zrWMVbFQBvS0ULuVtQ0+Ly5tXQ8vFgrr MFBJzwnZvtKvmbxn/cMZDszjUMkos8huEanAwDFr8VtXpway1E2H8RNf5551wmk620J9 N400GnXGWpT2z4dPkNNkRPA52ecxs51kGYPX1WpZYga9s3mfsciHj2wMyspv0DMcXDi7 i97Vu+YEvgzqiG8vDy0WHmmJJpbh6RkijT3ael+qYsmv0JPOdqaqeuPGGgasxVqz0kjs f+TCh5pbhzcy0kf7paDrPeYB+kJd0W4Oas45q8RSCt8MQ/F4RhWsZqQU9QJanKQdYy1h +A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3qm8bn0e5w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 May 2023 11:01:05 +0000 Received: from m0353722.ppops.net (m0353722.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 34GArIPK029013; Tue, 16 May 2023 11:01:04 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3qm8bn0e4w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 May 2023 11:01:04 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 34G0lQ1J005719; Tue, 16 May 2023 11:01:02 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma06ams.nl.ibm.com (PPS) with ESMTPS id 3qj1tdsjrd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 May 2023 11:01:02 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 34GB10KN22348382 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 16 May 2023 11:01:00 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2562D2004D; Tue, 16 May 2023 11:01:00 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B7ED420043; Tue, 16 May 2023 11:00:59 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 16 May 2023 11:00:59 +0000 (GMT) From: Niklas Schnelle To: Arnd Bergmann , Bjorn Helgaas Cc: Greg Kroah-Hartman , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Mauro Carvalho Chehab , Alan Stern , "Rafael J. Wysocki" , Geert Uytterhoeven , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-pci@vger.kernel.org, Arnd Bergmann Subject: [PATCH v4 23/41] PCI/sysfs: Make I/O resource depend on HAS_IOPORT Date: Tue, 16 May 2023 13:00:19 +0200 Message-Id: <20230516110038.2413224-24-schnelle@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230516110038.2413224-1-schnelle@linux.ibm.com> References: <20230516110038.2413224-1-schnelle@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: OLo68HowTLZHx4YJ1_lJM43A-3UhH6yK X-Proofpoint-ORIG-GUID: lR55QLkEIe6CUUxEwyKsduysU9v-t6G0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-16_04,2023-05-16_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=999 impostorscore=0 mlxscore=0 phishscore=0 suspectscore=0 spamscore=0 malwarescore=0 clxscore=1015 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305160089 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 If legacy I/O spaces are not supported simply return an error when trying to access them via pci_resource_io(). This allows inb() and friends to become undefined when they are known at compile time to be non-functional in a later patch. Co-developed-by: Arnd Bergmann Signed-off-by: Arnd Bergmann Acked-by: Bjorn Helgaas Signed-off-by: Niklas Schnelle --- Note: The HAS_IOPORT Kconfig option was added in v6.4-rc1 so per-subsystem patches may be applied independently drivers/pci/pci-sysfs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index ab32a91f287b..d9eede2dbc0e 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -1083,6 +1083,7 @@ static ssize_t pci_resource_io(struct file *filp, struct kobject *kobj, struct bin_attribute *attr, char *buf, loff_t off, size_t count, bool write) { +#ifdef CONFIG_HAS_IOPORT struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj)); int bar = (unsigned long)attr->private; unsigned long port = off; @@ -1116,6 +1117,9 @@ static ssize_t pci_resource_io(struct file *filp, struct kobject *kobj, return 4; } return -EINVAL; +#else + return -ENXIO; +#endif } static ssize_t pci_read_resource_io(struct file *filp, struct kobject *kobj, -- 2.39.2