From patchwork Tue Mar 14 12:12:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Schnelle X-Patchwork-Id: 69571 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1721723wrd; Tue, 14 Mar 2023 05:17:55 -0700 (PDT) X-Google-Smtp-Source: AK7set+FBbiwg7mdtOGeaDm0BbwOAcZCtUx+h2jgJz7n/x+k4N8c2EwlkDqZP3IuuBlSpaSVaQeF X-Received: by 2002:a17:902:a50c:b0:19c:be0c:738 with SMTP id s12-20020a170902a50c00b0019cbe0c0738mr31447927plq.59.1678796275230; Tue, 14 Mar 2023 05:17:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678796275; cv=none; d=google.com; s=arc-20160816; b=TuYJMzcoj1VEASJSC7BCeQF3LCbKTkd4qiaU/pWTjZ16IGEl94Nmp0OmNRYba1g5HS EurU6v2lrn0b7V4MQDm4EzFTKZQEE0/e9/B1Nv4v7CwqulXtZZ7k79m3z9yKsZhY/dSl 2LRKUAXUBnNazEAMY+6rPij8kA/Kf7qQMOJp6ijAIp6eKhA3TC5hu3umjandVybcE0p2 NjOCENu2DaWEZr3ycbneHYyUq+5SBeQfg5Fp7ltfJMmy4CKCBRnF1wci4VvK29lOcRmv UOspB/Z1+fCX3G/Qx+RhciNUUHgfoIdG+YSVhEWF5NJfVDtPhTbjK4PZ0jjR952Ls/OS 0/tg== 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=6SLZ7qoXgAVu2cLDL1YGgvUQ7Et8dBu6ruo0LRxOq4Y=; b=IIoaHqsLnM+r0kcOqdTbAHG5ohQWM0iUTlbu6UKPmQLC8PGDAeFqIINh60dC89shLP 4HBRSfww+cNFiQe441Kj18A9oVf06Lhg4cVj3QsVhCi8r0iiTQ1IONdoUS1KggTcL0Ii LL+mGxz3TDeOLAab10+enO0RXEJ/V0A/RXiRmFR9k26kdOyydyl4YKktDEwMC9GMipX4 pqfKvlK5HjMubt6z0eZB0JSNm4jhbPnmgNPPlzvGcbe1kLnrGZCKbF59CXIDvJCYy0OB o24s4/yj4dcx0dbaGTx/qoy9/IyZLISULlATTR2QZmK8sA63fk3wn/flLFdJeNAMaUjh Ra+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=nXHnzk3w; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h14-20020a170902f54e00b001967f72c227si2584664plf.390.2023.03.14.05.17.39; Tue, 14 Mar 2023 05:17:55 -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=nXHnzk3w; 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 S230228AbjCNMPi (ORCPT + 99 others); Tue, 14 Mar 2023 08:15:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231846AbjCNMOk (ORCPT ); Tue, 14 Mar 2023 08:14:40 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC966198F; Tue, 14 Mar 2023 05:13:17 -0700 (PDT) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32EBC3xx012797; Tue, 14 Mar 2023 12:12:48 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=6SLZ7qoXgAVu2cLDL1YGgvUQ7Et8dBu6ruo0LRxOq4Y=; b=nXHnzk3waNC8+ghdHr3yKVMM2CbXdPTfBfQ0rLxEn1+VyRTfC7sypktjZmyvLdHBZWNj BiB3CKSQ1oIk5ybesaMBU/taCkLNm2GAr3dCOXokxODe1x1K9OpH5zCVqCJ0e3VW967n tGRmDJ+qVGm8ibpQs/6pF7II8/RI11Jxrnu/1Q6gsIcyRkFonJC11t85Jo/Bvl6E331R PUcdvY3Jl32iPDGruhKTu0kQVzX+yKxM6r9ycjopu5n3ZXns8ImV9JoiHTp4G9/Lv77W d6wT4cTaYRiIfevGrOAyzpg0VJkHcJHGsWVTPNrEJZQiKHLfcRW50bwL4xt/3+6+6zOQ pQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3paqu91m3x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Mar 2023 12:12:47 +0000 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 32EBscDn017048; Tue, 14 Mar 2023 12:12:47 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3paqu91m1y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Mar 2023 12:12:47 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 32E7uGPZ001011; Tue, 14 Mar 2023 12:12:44 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma03ams.nl.ibm.com (PPS) with ESMTPS id 3p8h96mrw3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Mar 2023 12:12:44 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 32ECCfWe20251178 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Mar 2023 12:12:42 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DDA6F2007A; Tue, 14 Mar 2023 12:12:41 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 728BF2007B; Tue, 14 Mar 2023 12:12:41 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 14 Mar 2023 12:12:41 +0000 (GMT) From: Niklas Schnelle To: Arnd Bergmann , Bjorn Helgaas Cc: Greg Kroah-Hartman , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=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 v3 23/38] PCI/sysfs: Make I/O resource depend on HAS_IOPORT Date: Tue, 14 Mar 2023 13:12:01 +0100 Message-Id: <20230314121216.413434-24-schnelle@linux.ibm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230314121216.413434-1-schnelle@linux.ibm.com> References: <20230314121216.413434-1-schnelle@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: hp-FIPNWUNIA28WYjl4VUnjNjJXOxSom X-Proofpoint-GUID: 4twqkcWQOFPIvY_5cnok_bCwlS_GB72B X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-14_04,2023-03-14_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 suspectscore=0 priorityscore=1501 phishscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303140103 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760345483211466196?= X-GMAIL-MSGID: =?utf-8?q?1760345483211466196?= 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: Niklas Schnelle Acked-by: Bjorn Helgaas --- 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 dd0d9d9bc509..11e92d106761 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,