Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2746633rwd; Mon, 22 May 2023 03:53:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6jbZVI0eJYDP/0/5t1tbejDRR73XTdqLegshk2FldClvpGEbUKnbYKagx0gSCGZyhBZvsF X-Received: by 2002:a05:6a20:7f89:b0:105:e434:6700 with SMTP id d9-20020a056a207f8900b00105e4346700mr10639663pzj.38.1684752809533; Mon, 22 May 2023 03:53:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684752809; cv=none; d=google.com; s=arc-20160816; b=OEz7D6clgg/KJelz8bke48d/dMXk1FYfZAxbiGLzxg6kXMYqoJ+t9M2Vq0puBpsrk0 olHrPwJhpsvMbuBHFVbqtH1kttLP0wCEMjwWs8n4wvuZ5WMHIvqNsCkZiR9ZU/ErAEwK VIp12LMKgu/CqG2FcxZoNvo5VldgjVoYfOAbfvXHoidkDpbsVOArNrb197giBl8F+nI8 F30I/DnoHSXhhet+rvdn8TWwR8G7c/0Vx5HY+bqzA2M6ZGDB8mtaPv7PKRfDaOC7p71C lU/HdTb/yYPbaEUYJxQLtUcsnFRCeGcXXo98YLv3G+IL4sHjlLfmJUNTwjfZHv0luEc6 fgXA== 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=9Kmlo6ZCBjkmXN6T3y03XJrR9HuwFE+uXebCLLUEKWc=; b=s6bMq71KsZJVS5AOWcDreUW9Icx879RMlqqi2LBk2r0dkOlWzttpl1DQJWXRF7GyWx upKkoSQbMLqMDmnQQp85ZsuS1kgjw4epMUdqbzoCHKR3kOH4NoflqY8QGlwNdPHpfqK8 wrXe1L9sMiwWnEU6aMEM2oHX69VdSt+QBAz+wz6Lk9q7c5dHEiDZUP9dGq6ofpStp/fW 9f5IBKRglpwMJJ4sTuZdKwRLEMbPsWHaZNWeAnoekHTZ5JgMMz+RK1JfA6KFRI6b4RVk 042jjpiu3gGECRxuyZ5P+hoib3R3azttrKa9aOec1391Nzmh8SeoNoGYL7nkh6UZU3f3 RktQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=jr47dkIC; 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 x24-20020a63db58000000b0051389efe297si298629pgi.265.2023.05.22.03.53.17; Mon, 22 May 2023 03:53:29 -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=jr47dkIC; 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 S232972AbjEVKwC (ORCPT + 99 others); Mon, 22 May 2023 06:52:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232885AbjEVKvj (ORCPT ); Mon, 22 May 2023 06:51:39 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA893100; Mon, 22 May 2023 03:51:18 -0700 (PDT) Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34M9qg4P025283; Mon, 22 May 2023 10:51:04 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=9Kmlo6ZCBjkmXN6T3y03XJrR9HuwFE+uXebCLLUEKWc=; b=jr47dkICdmjhhzDFIKsksvNwxunKZ4lkXK7WMfk+Kv2XJd52XXZQbJ7RWnjwM5WZbLOM CGa/YQQpyXvd6q+pz1T/s7L2equMdbfXWERr9uydF60cR7K0JMROGK7KBzhmfOnvDB7A HCpKIfu+4yfq8oiJoVfOFWWrJQIWR30wVHZwROGAxoJrpJOE4FKwUHIqsY8JM+3zWxl9 uXnXbfdxnJkZ+X6/q2hAZr3yT/A8yQxd8Ws/LKB6OTXqI1eCZVS/ANIf1yuqnu6aZ+FU z8hODjAUZzJlgHHLU4IT8f9+jxi6LOltsQ06wOwVav/BQEIU7DbMqjkYwGpfQAe9rHKS 1Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3qqawenue2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 22 May 2023 10:51:03 +0000 Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 34MAaIag031931; Mon, 22 May 2023 10:51:02 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3qqawenud2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 22 May 2023 10:51:02 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 34M6Md9P026246; Mon, 22 May 2023 10:51:00 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma03fra.de.ibm.com (PPS) with ESMTPS id 3qppe08rk1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 22 May 2023 10:51:00 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 34MAovm211076336 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 May 2023 10:50:57 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A070920043; Mon, 22 May 2023 10:50:57 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3649520040; Mon, 22 May 2023 10:50:57 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 22 May 2023 10:50:57 +0000 (GMT) From: Niklas Schnelle To: Arnd Bergmann , Dave Airlie , Gerd Hoffmann , David Airlie , Daniel Vetter Cc: Greg Kroah-Hartman , Bjorn Helgaas , =?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 , virtualization@lists.linux-foundation.org, spice-devel@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH v5 09/44] drm: handle HAS_IOPORT dependencies Date: Mon, 22 May 2023 12:50:14 +0200 Message-Id: <20230522105049.1467313-10-schnelle@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230522105049.1467313-1-schnelle@linux.ibm.com> References: <20230522105049.1467313-1-schnelle@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: Yn1aYozOoQRQ35axx6-QJVU4LBPEu3YW X-Proofpoint-GUID: embi3Xmr-Ok9P1L4jvo5o27uBBDwkiPk 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-22_06,2023-05-22_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 adultscore=0 clxscore=1015 malwarescore=0 phishscore=0 spamscore=0 mlxscore=0 priorityscore=1501 bulkscore=0 suspectscore=0 lowpriorityscore=0 mlxlogscore=679 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305220089 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 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 Signed-off-by: Arnd Bergmann Signed-off-by: Niklas Schnelle --- 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(+) 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 #include +#include #include #include @@ -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); } -- 2.39.2