From patchwork Wed May 10 20:22:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 13237215 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBDCEC7EE24 for ; Wed, 10 May 2023 20:22:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229745AbjEJUW7 (ORCPT ); Wed, 10 May 2023 16:22:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229490AbjEJUW6 (ORCPT ); Wed, 10 May 2023 16:22:58 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 400EB5BAC; Wed, 10 May 2023 13:22:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1683750171; i=deller@gmx.de; bh=71yZV2JQcApfTrhONnETnE0pxU6au3GHH9JpPsMSV8M=; h=X-UI-Sender-Class:Date:From:To:Subject; b=a8Olt5pQW4cifNIfT8BcG8A7JrPDPgYahXCUa1ffGiu7o2B7HIJMDHrbPzdRfFHpZ 6noD0AvQRvT+mKFd3VLY4RTZ7Y5OifB4NTg/MIR7bskITa3BA5dernx1K18dd0XwvY pwJ/RC4jtBztlZB+fOYbiJNF/dSVg0eU1HnONXvq20e9BFZqh7sqaC5acD/cfeE699 GeQzegsLk+bwZJtdlRF64gLdT4G9z0UBixIWjATHyvlbas53vm0h+pHyb9VWeTZr8r cz9nPgQ8T+g4qZPHsOeWADdNdcng3+igBY17jfRniYPH+2BMwf3h94lxwDHLePW9hF swj6YQEYAwiDg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from p100 ([94.134.155.121]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MN5eR-1pfzm344Ht-00J1c8; Wed, 10 May 2023 22:22:51 +0200 Date: Wed, 10 May 2023 22:22:49 +0200 From: Helge Deller To: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-parisc@vger.kernel.org Subject: [PATCH v4] console/parisc: Fix STI console on 64-bit only machines Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Provags-ID: V03:K1:rIdWoNVy91cgDGu3Gry0w7PErslTTUluffCWzE3jtJkBeFXs/HF cpnxEKwAyuQBFteM/KRcR3ZnWt9/R3xXmGo5C3jNuHrUjYr1A2aSDQdM5cAAMx4a1nNtYRN 3rag/kRu2IgaiouuGBnPkbxC2G7/O75fmZvZdVW/VleoJWIAN1N+UX8oy+0mRYJBYQw71pi sqBMtMl1XImtnsDDnWkeg== UI-OutboundReport: notjunk:1;M01:P0:9F5YFsbqeDU=;XA4mvCareI89Z1mVJtWeBiNKle3 9wrGUAcaItYC1e8YJ0ZPXZbu34lJgU+38ZQwyGpNXj8xDT0zbe981pyBszGOe+AQ0lf+jDSUV JekVbYdsX7jRniJeiwaO8PyfBTPuCyoVaqeAuQUfZCPEk69FrnvUDwy2yoPU5lR6grx/0onQD qhFalylogr+SIoaLyJ6FtkcQKmuhmcYnUd2uDq4NYh/zQqysvnLwPFgW3FH01E52dAYoIVQWM 51TWeo9ykvwQjRtUvQK29bHuycLB8dB1iK72llFhvhEq+xi01Oqt8FluDgkWWWnjx1kZd1e8o YS7as9sbp2iqumIUvXsxEGnUIEmH3iPo6T1x4YyFFHb/7EuJRgMlrJ/3Ai8GYrmFmyrazJ8eW pISWhphjudoA0VOVLtPsBuTrHjh6/pUPPLM+m35rWdN6wiPgXJZuVsdf6ZF/TW7j2cN5F2O0t UJqIyw6jKCzn5imxHC/ZgeqjK+pVSOUZdEtgVqQLql8N5/JhjUoqYGvsslDna2MMzfLcjTrwq Sow0YYzeBQEq36Chj23EaiEKiVfdaHtlEI4cfpUiMeRLVE0xWVcdtt/5NgErdK9bqlPW/yeTu KYZ31ylnuZeBEkZCAHAdRIPGONR27LUsOriV1nyL4vDu0vhXBkF250lYlAVDh9cqoI7DNY/sT 8UhXrseQJau7klfLlRDJS/U4UuBotUiBAILZ6Ex9wFpXAwa8xlrfYYr1hXvIFNqqUGX2z5QVT DiZysBur5IhPRVQ5a5KBoTxO5TBiCSh6Kfd0AgqK1iyaDYS1LSERpoAkcoc5pw9JqioWQqnZI D/sE/5tctl6fexygd2Eo+Bxdge8EjDT/Fq6RJfgmZJs5qm17kPIWP9NauoN8nBnnc4i+Dygbn cT5/hscENUKU58p5akFHzuyTJcGBlEYRfpYIBskO89qbGfJinkTuBhou2uIO+rPjDD0wPxfDZ dY69Og== Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Fix the STI console to be able to execute either the 64-bit STI ROM code or the 32-bit STI ROM code. This is necessary on 64-bit only machines (e.g. C8000 workstation) which otherwise won't show the STI text console with HP graphic cards like Visualize-FX5/FX10/FXe. When calling 32-bit code from a 64-bit kernel one may need to copy contents on the CPU stack from high memory down below the 4GB limit. Signed-off-by: Helge Deller --- arch/parisc/include/asm/pdc.h | 4 +- arch/parisc/kernel/firmware.c | 21 +++-- drivers/video/fbdev/stifb.c | 4 +- drivers/video/sticore.c | 159 ++++++++++++++++++++++------------ include/video/sticore.h | 42 ++++----- 5 files changed, 143 insertions(+), 87 deletions(-) v4: resend to avoid merge conflicts, no code changes v3: Fix check for overflow of 32-bit pointers v2: Forward-ported to apply cleanly on drm-misc-next git tree -- 2.38.1 diff --git a/arch/parisc/include/asm/pdc.h b/arch/parisc/include/asm/pdc.h index 2b4fad8328e8..269b9a159f01 100644 --- a/arch/parisc/include/asm/pdc.h +++ b/arch/parisc/include/asm/pdc.h @@ -88,8 +88,8 @@ int pdc_iodc_print(const unsigned char *str, unsigned count); void pdc_emergency_unlock(void); int pdc_sti_call(unsigned long func, unsigned long flags, - unsigned long inptr, unsigned long outputr, - unsigned long glob_cfg); + unsigned long inptr, unsigned long outputr, + unsigned long glob_cfg, int do_call64); int __pdc_cpu_rendezvous(void); void pdc_cpu_rendezvous_lock(void); diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c index cc124d9f1f7f..71ef1640db5a 100644 --- a/arch/parisc/kernel/firmware.c +++ b/arch/parisc/kernel/firmware.c @@ -1389,17 +1389,24 @@ int pdc_iodc_getc(void) } int pdc_sti_call(unsigned long func, unsigned long flags, - unsigned long inptr, unsigned long outputr, - unsigned long glob_cfg) + unsigned long inptr, unsigned long outputr, + unsigned long glob_cfg, int do_call64) { - int retval; + int retval = 0; unsigned long irqflags; - spin_lock_irqsave(&pdc_lock, irqflags); - retval = real32_call(func, flags, inptr, outputr, glob_cfg); - spin_unlock_irqrestore(&pdc_lock, irqflags); + spin_lock_irqsave(&pdc_lock, irqflags); + if (IS_ENABLED(CONFIG_64BIT) && do_call64) { +#ifdef CONFIG_64BIT + retval = real64_call(func, flags, inptr, outputr, glob_cfg); +#else + WARN_ON(1); +#endif + } else + retval = real32_call(func, flags, inptr, outputr, glob_cfg); + spin_unlock_irqrestore(&pdc_lock, irqflags); - return retval; + return retval; } EXPORT_SYMBOL(pdc_sti_call); diff --git a/drivers/video/fbdev/stifb.c b/drivers/video/fbdev/stifb.c index baca6974e288..fe54ca8726e6 100644 --- a/drivers/video/fbdev/stifb.c +++ b/drivers/video/fbdev/stifb.c @@ -71,9 +71,9 @@ #include