From patchwork Tue May 9 18:24:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 13236074 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 5A919C77B75 for ; Tue, 9 May 2023 18:24:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229643AbjEISYi (ORCPT ); Tue, 9 May 2023 14:24:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234570AbjEISYh (ORCPT ); Tue, 9 May 2023 14:24:37 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D99C53C16; Tue, 9 May 2023 11:24:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1683656668; i=deller@gmx.de; bh=GiWI3Edh7sWglYAYGfC4soQTRvcJh05ZXPMtNAs7CPo=; h=X-UI-Sender-Class:Date:From:To:Subject; b=YIaZnbqpWbHQnj57JjLFarePBGhZz9vQPTqgrUy1rlBKUoBVk6aRSh75KmiOt1NwB g7ndRev9cVQ1IvhPm9vF7nbasvV18+Jbop7axwQV+XfvhTXdShG+ttGO1XF039gt5q gf2q4+RQUjYTkGgYHfDC/hk9iEJ8rFQrAjHzd+LWoMbK32cWEEAQrL00QU8exQ2JDK BitmIIvycdtCmAYyPSGxpEr/J55u8Cb9TvVCoxg1zZC24OJyKhU9hdjWT9UgGfKBZp nEfHjNN/g4pbXP+Npj0osN3sv1W194NMcGeddAi22MYCEuzgDWJa7AdkI1zbqnM8Bp N6oU/P5lQErGA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from p100 ([94.134.153.17]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MNbkp-1pY3EN0BHH-00P93o; Tue, 09 May 2023 20:24:28 +0200 Date: Tue, 9 May 2023 20:24:26 +0200 From: Helge Deller To: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-parisc@vger.kernel.org Subject: [PATCH v2] console/parisc: Fix STI console on 64-bit only machines Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Provags-ID: V03:K1:MdiJgZwW+w4XLsQvnDIcAS/cQOITDS/Fpg79dBvIw3uUj3Aomu6 CUNlne8ygvlwkIEGYXstDGt4Aq5qNZHroPjjkV0Y6tAJq6FjhYSItx8kHMuopRjNa2GwaJO kXEfhSBL+3KhTwtBkEaJ/9ebAeHIA2ITxzCx8n8novgLtN0d4zlKC8giv1EnCRplKLQeu79 25nL6qXGQRNNijyvqCxGA== UI-OutboundReport: notjunk:1;M01:P0:mrmTAc71410=;I3cGAZLmP7XpexHLkKLjIW5nGuW u94fc6En8fYstfAGFeJFucCoI2O8w7xP1gizwzYfBck+oQcRbWaCY7BK2GGB66NsEvAgp9gMb ZBheXQdA+P6ujDP6ubwsdeOmYyROUJLq9FHlN46BZ9ZVtUmxDHrFl0cw3uyyOHvh1DzGul1wd 0Xj0zvdMr/tL5bCE5rw/US/XB4A2b4V5JARGrGMmOqHjyocyItahZgGH1pwVFBASr5qHaooT6 XCdxI8ncgFHka7oaPqvyNEpVk4hDpdkfYXll/cUAgw3uMOisaYcNsLKoUYZenhX5QrrlQiCTa aaoRhqbfWhGy4UWJ1IWgX+/9NiRj9FJ1FafUUACvKX+5yRlM3yddg2ED38BZ0XPqHRxtv58B+ xdWmJ4hiIIlzOxDigDzkCQ9JZcaNEqw0LNrWji34ZEvBgF4Fxk4s7G8I1dtT6lPXjnxKWaVXB wa/lMj5P7ed0eeM6Goxz5owIgSJFHpuZ/cueXBHTYY3r8e0ZNJblbbl91wz3ZYhL6gpaAqI6w m2KdVf0HcfuRitki8FPMtBDYLYEsgXbLKplbYLDt05Q8AIKsT5xo5UPehRUypPg6LV2XWxFlE /X+CIh1H3KOHtteTEYVgA1MpfyK1zNufTOur+nD1W0J5knUt6G9D3WutBElEn3vBs+arv0a26 KaUY7vwUNnYmo9lvYCy0TNdwZjMbbHU9SMwXzOehVTvLzyJJtqAJUQI8YN1A7nwFIDNvs0NE2 iZXdXqRcIpVuTGF1IXzIC/zFzJB0tpiNDy4inyrnmcdjzKQGNd2xq0DLXDsJ3DnrzbvTZPE/I 8c3PtJSrTn986ZDRTH92+7QX2evhjsHaE/ixtPa7xVCaWbIsUI50zbITOlpC/YJAWJ16ONjam OI9lsn453qClcFrx+blaeRE2o8Uc4ZniponaP2bMZmoOOWi0RP5IFGHFFcXWhRt6OqhohJU0u G9rGznibhl2WLqWm6Ttl1pX0L8g= Precedence: bulk List-ID: X-Mailing-List: linux-parisc@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 on 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 --- v2: Forward-ported to apply cleanly on drm-misc-next git tree 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