Message ID | 20230516110038.2413224-8-schnelle@linux.ibm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp354017vqo; Tue, 16 May 2023 04:33:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4pBn1P0V5d2ttuSm6imYs0CsECVFogLokXLNc7SP148XvPZkPKTcnDbmZF2LFRUnLkALbm X-Received: by 2002:a17:90b:4b0f:b0:250:a4f5:fb21 with SMTP id lx15-20020a17090b4b0f00b00250a4f5fb21mr26286101pjb.10.1684236833754; Tue, 16 May 2023 04:33:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684236833; cv=none; d=google.com; s=arc-20160816; b=EeiivAmAAnye5i1iy5r/VBo6DTl7OR72qspaK/4YJBfWH1D9IoiuyYH9CbP0bo3vVm HEVUG/nXCB8qUnIozW2Pk/9e+bTl6TE/R5UNJsRp1fylg4W3MvYskwhBbKctL2AZIjcp cD4lU/3Kgu7XUOEBnhhrfDJIfpvqnC8bVR/XX1ii2HNFdRBXOZU8qeijijKbfXPjuMQV dqWWcXSzBMm4E/9c1w93JVkgJMc4XEGV/bFDu3nZ2mPKU4Kf7/0DzjwrC+MTnFTQMMTI IosHLTXO3aoP14yIuG3PNBNq965mDM+JLgW9pn2Jg1BUxJGiI30doE1Z6exiRs+6aZf4 8XOw== 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=Ev8bpmefO3oAmyABiNql71RTv0bousLYpb/GjqSW9Vk=; b=yDdady6mtNtPZ+uEQHzfLH1gZ4xbcH44O3TEIncMLQuK51h03uy/D+8xBYZg55B2Bh 2tftqKPpCf+6EOUWVWKWjiyuYjHp2/T8jGrxPR4klcDvDezh5797ah5I20NZZtQzdPPc 9IjsfVUW0MQco/Ttz624lO4Jrhi0NKxMStufiSP1ito8O5+F+h7zjOFYCnCEtw2NzlZn oUPQM5Vh2iHzvfd2RELEJryX/42ylfnikHPTuos1pp9pspB9FTt5wWwgJTeeuTQeHB2+ 9PsoBTe85oCa+QtRATn+KGi5+SPCNYzhoJi+dV5P6ddYEBzCy5NCLtCgSAkR1K6KlEC+ 0xwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=UxsF2ZOJ; 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 o6-20020a17090a4e8600b00250db0f5689si1598724pjh.179.2023.05.16.04.33.33; Tue, 16 May 2023 04:33:53 -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=UxsF2ZOJ; 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 S232384AbjEPLCG (ORCPT <rfc822;peekingduck44@gmail.com> + 99 others); Tue, 16 May 2023 07:02:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232568AbjEPLBn (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 16 May 2023 07:01:43 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E03955BE; Tue, 16 May 2023 04:01:12 -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 34GAjFuQ030962; Tue, 16 May 2023 11:00:52 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=Ev8bpmefO3oAmyABiNql71RTv0bousLYpb/GjqSW9Vk=; b=UxsF2ZOJeViMfmseMAISvPUmxMmdAi6A5r5kmwv0n/1Ho26lNsab6l7dV2Y1EjPDwZMz ZlC2xOTfwWcQEGBMN2UnjGTkNcMS2VaCaa5O6WH8UVMBS+M2J0kD+kcSj8rTMdpTO7M2 rfkAbjmshTgP+20caiMoxEFcgzFuQ4bX5r17RK/JCNzZZmIMk2cOzlAPeIC8zC48v7i+ dSdb0WZOqjnf6IYHIqDJipRr+UcdbqKtvDWery0hy3xx+6YakQ/BHCSUY+EiR63pAk7i 7jTlxQkq7KmJ11zufqPK2WbPwOazDh58YwTHS2LfJAgRV5VP8XlBoDVJAdJDVz6ebfMo Ig== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3qm8bn0dw1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 May 2023 11:00:51 +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 34GAksD5004391; Tue, 16 May 2023 11:00:50 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 3qm8bn0dut-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 May 2023 11:00:50 +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 34G7b9Xs031123; Tue, 16 May 2023 11:00:48 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma06ams.nl.ibm.com (PPS) with ESMTPS id 3qj1tdsjr0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 May 2023 11:00:48 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 34GB0jFf8979086 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 16 May 2023 11:00:45 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 804072004D; Tue, 16 May 2023 11:00:45 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 14EC720043; Tue, 16 May 2023 11:00:45 +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:45 +0000 (GMT) From: Niklas Schnelle <schnelle@linux.ibm.com> To: Arnd Bergmann <arnd@arndb.de>, Dave Airlie <airlied@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Bjorn Helgaas <bhelgaas@google.com>, =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>, Mauro Carvalho Chehab <mchehab@kernel.org>, Alan Stern <stern@rowland.harvard.edu>, "Rafael J. Wysocki" <rafael@kernel.org>, Geert Uytterhoeven <geert@linux-m68k.org>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-pci@vger.kernel.org, Arnd Bergmann <arnd@kernel.org>, virtualization@lists.linux-foundation.org, spice-devel@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH v4 07/41] drm: handle HAS_IOPORT dependencies Date: Tue, 16 May 2023 13:00:03 +0200 Message-Id: <20230516110038.2413224-8-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: w3sz8-ToMzSokkTdWpKQ8SoNz85SvyXo X-Proofpoint-ORIG-GUID: L-Vy2aLAmYx74LeQnJJT49DR7ekQwxg7 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=811 impostorscore=0 mlxscore=0 phishscore=0 suspectscore=0 spamscore=0 malwarescore=0 clxscore=1011 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766050321932536826?= X-GMAIL-MSGID: =?utf-8?q?1766050321932536826?= |
Series |
treewide: Remove I/O port accessors for HAS_IOPORT=n
|
|
Commit Message
Niklas Schnelle
May 16, 2023, 11 a.m. UTC
In a future patch HAS_IOPORT=n will result in inb()/outb() and friends not being declared. We thus need to add HAS_IOPORT as dependency for those drivers using them. In the bochs driver there is optional MMIO support detected at runtime, warn if this isn't taken when HAS_IOPORT is not defined. There is also a direct and hard coded use in cirrus.c which according to the comment is only necessary during resume. Let's just skip this as for example s390 which doesn't have I/O port support also doesen't support suspend/resume. Co-developed-by: Arnd Bergmann <arnd@kernel.org> Signed-off-by: Arnd Bergmann <arnd@kernel.org> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com> --- Note: The HAS_IOPORT Kconfig option was added in v6.4-rc1 so per-subsystem patches may be applied independently drivers/gpu/drm/qxl/Kconfig | 1 + drivers/gpu/drm/tiny/bochs.c | 17 +++++++++++++++++ drivers/gpu/drm/tiny/cirrus.c | 2 ++ 3 files changed, 20 insertions(+)
Comments
Hi Am 16.05.23 um 13:00 schrieb Niklas Schnelle: > In a future patch HAS_IOPORT=n will result in inb()/outb() and friends > not being declared. We thus need to add HAS_IOPORT as dependency for > those drivers using them. In the bochs driver there is optional MMIO > support detected at runtime, warn if this isn't taken when > HAS_IOPORT is not defined. > > There is also a direct and hard coded use in cirrus.c which according to > the comment is only necessary during resume. Let's just skip this as > for example s390 which doesn't have I/O port support also doesen't > support suspend/resume. > > Co-developed-by: Arnd Bergmann <arnd@kernel.org> > Signed-off-by: Arnd Bergmann <arnd@kernel.org> > Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com> > --- > Note: The HAS_IOPORT Kconfig option was added in v6.4-rc1 so > per-subsystem patches may be applied independently > > drivers/gpu/drm/qxl/Kconfig | 1 + > drivers/gpu/drm/tiny/bochs.c | 17 +++++++++++++++++ > drivers/gpu/drm/tiny/cirrus.c | 2 ++ There are more invocations in gma500. See[1] [1] https://elixir.bootlin.com/linux/v6.3/source/drivers/gpu/drm/gma500/cdv_device.c#L30 > 3 files changed, 20 insertions(+) > > diff --git a/drivers/gpu/drm/qxl/Kconfig b/drivers/gpu/drm/qxl/Kconfig > index ca3f51c2a8fe..d0e0d440c8d9 100644 > --- a/drivers/gpu/drm/qxl/Kconfig > +++ b/drivers/gpu/drm/qxl/Kconfig > @@ -2,6 +2,7 @@ > config DRM_QXL > tristate "QXL virtual GPU" > depends on DRM && PCI && MMU > + depends on HAS_IOPORT > select DRM_KMS_HELPER > select DRM_TTM > select DRM_TTM_HELPER > diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c > index d254679a136e..3710339407cc 100644 > --- a/drivers/gpu/drm/tiny/bochs.c > +++ b/drivers/gpu/drm/tiny/bochs.c > @@ -2,6 +2,7 @@ > > #include <linux/module.h> > #include <linux/pci.h> > +#include <asm/bug.h> <linux/bug.h> please. Best regards Thomas > > #include <drm/drm_aperture.h> > #include <drm/drm_atomic_helper.h> > @@ -105,7 +106,9 @@ static void bochs_vga_writeb(struct bochs_device *bochs, u16 ioport, u8 val) > > writeb(val, bochs->mmio + offset); > } else { > +#ifdef CONFIG_HAS_IOPORT > outb(val, ioport); > +#endif > } > } > > @@ -119,7 +122,11 @@ static u8 bochs_vga_readb(struct bochs_device *bochs, u16 ioport) > > return readb(bochs->mmio + offset); > } else { > +#ifdef CONFIG_HAS_IOPORT > return inb(ioport); > +#else > + return 0xff; > +#endif > } > } > > @@ -132,8 +139,12 @@ static u16 bochs_dispi_read(struct bochs_device *bochs, u16 reg) > > ret = readw(bochs->mmio + offset); > } else { > +#ifdef CONFIG_HAS_IOPORT > outw(reg, VBE_DISPI_IOPORT_INDEX); > ret = inw(VBE_DISPI_IOPORT_DATA); > +#else > + ret = 0xffff; > +#endif > } > return ret; > } > @@ -145,8 +156,10 @@ static void bochs_dispi_write(struct bochs_device *bochs, u16 reg, u16 val) > > writew(val, bochs->mmio + offset); > } else { > +#ifdef CONFIG_HAS_IOPORT > outw(reg, VBE_DISPI_IOPORT_INDEX); > outw(val, VBE_DISPI_IOPORT_DATA); > +#endif > } > } > > @@ -229,6 +242,10 @@ static int bochs_hw_init(struct drm_device *dev) > return -ENOMEM; > } > } else { > + if (!IS_ENABLED(CONFIG_HAS_IOPORT)) { > + DRM_ERROR("I/O ports are not supported\n"); > + return -EIO; > + } > ioaddr = VBE_DISPI_IOPORT_INDEX; > iosize = 2; > if (!request_region(ioaddr, iosize, "bochs-drm")) { > diff --git a/drivers/gpu/drm/tiny/cirrus.c b/drivers/gpu/drm/tiny/cirrus.c > index 594bc472862f..c65fea049bc7 100644 > --- a/drivers/gpu/drm/tiny/cirrus.c > +++ b/drivers/gpu/drm/tiny/cirrus.c > @@ -508,8 +508,10 @@ static void cirrus_crtc_helper_atomic_enable(struct drm_crtc *crtc, > > cirrus_mode_set(cirrus, &crtc_state->mode); > > +#ifdef CONFIG_HAS_IOPORT > /* Unblank (needed on S3 resume, vgabios doesn't do it then) */ > outb(VGA_AR_ENABLE_DISPLAY, VGA_ATT_W); > +#endif > > drm_dev_exit(idx); > } -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
On Tue, May 16, 2023, at 19:13, Thomas Zimmermann wrote: > > Am 16.05.23 um 13:00 schrieb Niklas Schnelle: >> In a future patch HAS_IOPORT=n will result in inb()/outb() and friends >> not being declared. We thus need to add HAS_IOPORT as dependency for >> those drivers using them. In the bochs driver there is optional MMIO >> support detected at runtime, warn if this isn't taken when >> HAS_IOPORT is not defined. >> >> There is also a direct and hard coded use in cirrus.c which according to >> the comment is only necessary during resume. Let's just skip this as >> for example s390 which doesn't have I/O port support also doesen't >> support suspend/resume. >> >> Co-developed-by: Arnd Bergmann <arnd@kernel.org> >> Signed-off-by: Arnd Bergmann <arnd@kernel.org> >> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com> >> --- >> Note: The HAS_IOPORT Kconfig option was added in v6.4-rc1 so >> per-subsystem patches may be applied independently >> >> drivers/gpu/drm/qxl/Kconfig | 1 + >> drivers/gpu/drm/tiny/bochs.c | 17 +++++++++++++++++ >> drivers/gpu/drm/tiny/cirrus.c | 2 ++ > > There are more invocations in gma500. See[1] > > [1] > https://elixir.bootlin.com/linux/v6.3/source/drivers/gpu/drm/gma500/cdv_device.c#L30 GMA500 already has "depends on X86", so I don't think any changes are needed there -- x86 is already highly dependent on I/O ports for a number of reasons. Arnd
diff --git a/drivers/gpu/drm/qxl/Kconfig b/drivers/gpu/drm/qxl/Kconfig index ca3f51c2a8fe..d0e0d440c8d9 100644 --- a/drivers/gpu/drm/qxl/Kconfig +++ b/drivers/gpu/drm/qxl/Kconfig @@ -2,6 +2,7 @@ config DRM_QXL tristate "QXL virtual GPU" depends on DRM && PCI && MMU + depends on HAS_IOPORT select DRM_KMS_HELPER select DRM_TTM select DRM_TTM_HELPER diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c index d254679a136e..3710339407cc 100644 --- a/drivers/gpu/drm/tiny/bochs.c +++ b/drivers/gpu/drm/tiny/bochs.c @@ -2,6 +2,7 @@ #include <linux/module.h> #include <linux/pci.h> +#include <asm/bug.h> #include <drm/drm_aperture.h> #include <drm/drm_atomic_helper.h> @@ -105,7 +106,9 @@ static void bochs_vga_writeb(struct bochs_device *bochs, u16 ioport, u8 val) writeb(val, bochs->mmio + offset); } else { +#ifdef CONFIG_HAS_IOPORT outb(val, ioport); +#endif } } @@ -119,7 +122,11 @@ static u8 bochs_vga_readb(struct bochs_device *bochs, u16 ioport) return readb(bochs->mmio + offset); } else { +#ifdef CONFIG_HAS_IOPORT return inb(ioport); +#else + return 0xff; +#endif } } @@ -132,8 +139,12 @@ static u16 bochs_dispi_read(struct bochs_device *bochs, u16 reg) ret = readw(bochs->mmio + offset); } else { +#ifdef CONFIG_HAS_IOPORT outw(reg, VBE_DISPI_IOPORT_INDEX); ret = inw(VBE_DISPI_IOPORT_DATA); +#else + ret = 0xffff; +#endif } return ret; } @@ -145,8 +156,10 @@ static void bochs_dispi_write(struct bochs_device *bochs, u16 reg, u16 val) writew(val, bochs->mmio + offset); } else { +#ifdef CONFIG_HAS_IOPORT outw(reg, VBE_DISPI_IOPORT_INDEX); outw(val, VBE_DISPI_IOPORT_DATA); +#endif } } @@ -229,6 +242,10 @@ static int bochs_hw_init(struct drm_device *dev) return -ENOMEM; } } else { + if (!IS_ENABLED(CONFIG_HAS_IOPORT)) { + DRM_ERROR("I/O ports are not supported\n"); + return -EIO; + } ioaddr = VBE_DISPI_IOPORT_INDEX; iosize = 2; if (!request_region(ioaddr, iosize, "bochs-drm")) { diff --git a/drivers/gpu/drm/tiny/cirrus.c b/drivers/gpu/drm/tiny/cirrus.c index 594bc472862f..c65fea049bc7 100644 --- a/drivers/gpu/drm/tiny/cirrus.c +++ b/drivers/gpu/drm/tiny/cirrus.c @@ -508,8 +508,10 @@ static void cirrus_crtc_helper_atomic_enable(struct drm_crtc *crtc, cirrus_mode_set(cirrus, &crtc_state->mode); +#ifdef CONFIG_HAS_IOPORT /* Unblank (needed on S3 resume, vgabios doesn't do it then) */ outb(VGA_AR_ENABLE_DISPLAY, VGA_ATT_W); +#endif drm_dev_exit(idx); }