From patchwork Tue Mar 14 12:11:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Schnelle X-Patchwork-Id: 69557 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1721065wrd; Tue, 14 Mar 2023 05:16:35 -0700 (PDT) X-Google-Smtp-Source: AK7set8DZWjbEolsXqRfmn+qyvbVh3tU6vTz34j7hUzeGwp9ouiAO4KPL/gd6Yroyqek6911ZkPo X-Received: by 2002:a05:6a20:144f:b0:d4:de2d:b9d8 with SMTP id a15-20020a056a20144f00b000d4de2db9d8mr5448966pzi.29.1678796195024; Tue, 14 Mar 2023 05:16:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678796195; cv=none; d=google.com; s=arc-20160816; b=YA1Maaz34KzFp2WuSvkuZ1eWvzZG+KpJT6kdnydumhI2w6mqPkg/67MIfLkSuru0mN bMfOi8s5dzkJjW8QKT436B7l7ycVHZhWOP2gbOhfJKI3PZnPYUBV4MfQgKQ6d2cTuMUR eJi8xxAbic3J9CV1iROKYevmNm3RpPH1+LDkaCdH/3+YgeQ5zbaAlhrI119sKppLJnmh tvY1vJ8zaJ9lUi6NqMWYHqnlWVrqA6q80MI8fXE475Z+5fK/R8dS4sSm1Z8DX+aE3c1P x+PI5HtMlXeLyQfLECIp/YdWd6plehS6+tEH2KNWE9uVQB18KZl2/hYmwRi3Eb3nHsbN pnOA== 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=NdgmMlIoea7vJyu4oX4UGluHVaQmygSR6zFwM3C2qWw=; b=Zir0VKuYNeNtlrF718Z7Bi6opqnDKvT17rVsmRJ8Ip7tTV2+HXwLRyKZDyk+HtKKM7 1m9kpFRUFkgkIhzJm7qU5A1doJAzpNtG5QEurq3wDjJ5U0ESZzIL+Tm3RKiRhqvl23h1 z6e5wmOvLFSlY0xV724aWual9RJw4WACR4iSi+Zi34Z0zjfXZ5SotZaVjqG9hWYEvBTU FUlJUhURa2E/62cEAz3Ldt/B2jsJNpnturm0XgIP6uU4ox2ZLJu/8XOYCUnZLQi/QHHN LDHwZ0cC3Dt1W6l4cJ8fIYY27Yb4EDCXUi5ia7Q4aBtQZFYhYC6H43mcJBD2ySdxsslw yHTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=rugV2xCr; 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 y7-20020a623207000000b005a8a1ea9ab9si2043609pfy.370.2023.03.14.05.16.21; Tue, 14 Mar 2023 05:16:34 -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=rugV2xCr; 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 S230093AbjCNMNW (ORCPT + 99 others); Tue, 14 Mar 2023 08:13:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229962AbjCNMNQ (ORCPT ); Tue, 14 Mar 2023 08:13:16 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5345C74DEE; Tue, 14 Mar 2023 05:12:45 -0700 (PDT) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32EBv91v021398; Tue, 14 Mar 2023 12:12:32 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=NdgmMlIoea7vJyu4oX4UGluHVaQmygSR6zFwM3C2qWw=; b=rugV2xCrbZC2AC3daXfZeZZ4C8YQFuyY1jm9vVzG+pqQxYX5GVR1AZxrtpmXGLKb64sq 2NNWolcnl4Pze2jdOQQrp1cvDaI4e0uuJmQpKb1UXZXxN/npZ9JLmsSJxdwNxe4ecnp4 LJq4Bavr/tBBVFb0Ic5LaO6zrBF6ZW5MSrtJq2/frTUcsR6dOaXxkxvnpIXZrYz8O4VO NNU9/lnd6NfmIdEvF7Hn1O0avCSPxnX0dMjBQ5+GoKYlgMPjzeQ5yU2kBMZcEJa33mSY 74GRRQ9iBJ09OettwUNJFqjuDGcpI/p/CbVsa2P3FNW9FsXiMGLMQl5DvtimlxVw55vB rw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3papenbxj8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Mar 2023 12:12:32 +0000 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 32E9bfU1027062; Tue, 14 Mar 2023 12:12:31 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3papenbxh4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Mar 2023 12:12:31 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 32E8XmM3029496; Tue, 14 Mar 2023 12:12:29 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma06fra.de.ibm.com (PPS) with ESMTPS id 3p8gwfks4x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Mar 2023 12:12:29 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 32ECCQIC17236240 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Mar 2023 12:12:26 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9FA742007D; Tue, 14 Mar 2023 12:12:26 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1977F2007C; Tue, 14 Mar 2023 12:12:26 +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:26 +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_Kleine-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 v3 07/38] drm: handle HAS_IOPORT dependencies Date: Tue, 14 Mar 2023 13:11:45 +0100 Message-Id: <20230314121216.413434-8-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: PlSVZJS_jwBDQj_1Psq3uoo-swEz2CGf X-Proofpoint-GUID: 75W8jY6oJVtl2VT6uX7aBB4ogE891Uc4 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_06,2023-03-14_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 mlxlogscore=654 mlxscore=0 adultscore=0 phishscore=0 impostorscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1011 priorityscore=1501 spamscore=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,RCVD_IN_MSPIKE_H2,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?1760345399069309086?= X-GMAIL-MSGID: =?utf-8?q?1760345399069309086?= 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: Niklas Schnelle --- drivers/gpu/drm/qxl/Kconfig | 1 + drivers/gpu/drm/tiny/bochs.c | 19 +++++++++++++++++++ drivers/gpu/drm/tiny/cirrus.c | 2 ++ 3 files changed, 22 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 024346054c70..da4a5d53b003 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,11 @@ static void bochs_vga_writeb(struct bochs_device *bochs, u16 ioport, u8 val) writeb(val, bochs->mmio + offset); } else { +#ifdef HAS_IOPORT outb(val, ioport); +#else + WARN_ONCE(1, "Non-MMIO bochs device needs HAS_IOPORT"); +#endif } } @@ -119,7 +124,12 @@ static u8 bochs_vga_readb(struct bochs_device *bochs, u16 ioport) return readb(bochs->mmio + offset); } else { +#ifdef HAS_IOPORT return inb(ioport); +#else + WARN_ONCE(1, "Non-MMIO bochs device needs HAS_IOPORT"); + return 0xff; +#endif } } @@ -132,8 +142,13 @@ static u16 bochs_dispi_read(struct bochs_device *bochs, u16 reg) ret = readw(bochs->mmio + offset); } else { +#ifdef HAS_IOPORT outw(reg, VBE_DISPI_IOPORT_INDEX); ret = inw(VBE_DISPI_IOPORT_DATA); +#else + WARN_ONCE(1, "Non-MMIO bochs device needs HAS_IOPORT"); + ret = 0xffff; +#endif } return ret; } @@ -145,8 +160,12 @@ static void bochs_dispi_write(struct bochs_device *bochs, u16 reg, u16 val) writew(val, bochs->mmio + offset); } else { +#ifdef HAS_IOPORT outw(reg, VBE_DISPI_IOPORT_INDEX); outw(val, VBE_DISPI_IOPORT_DATA); +#else + WARN_ONCE(1, "Non-MMIO bochs device needs HAS_IOPORT"); +#endif } } diff --git a/drivers/gpu/drm/tiny/cirrus.c b/drivers/gpu/drm/tiny/cirrus.c index accfa52e78c5..9da89732c5ac 100644 --- a/drivers/gpu/drm/tiny/cirrus.c +++ b/drivers/gpu/drm/tiny/cirrus.c @@ -308,8 +308,10 @@ static int cirrus_mode_set(struct cirrus_device *cirrus, cirrus_set_start_address(cirrus, 0); +#ifdef CONFIG_HAS_IOPORT /* Unblank (needed on S3 resume, vgabios doesn't do it then) */ outb(0x20, 0x3c0); +#endif drm_dev_exit(idx); return 0;