From patchwork Wed May 10 20:04:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 13237208 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ABA4AC7EE22 for ; Wed, 10 May 2023 20:04:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8EE6F10E515; Wed, 10 May 2023 20:04:24 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id B98CD10E515 for ; Wed, 10 May 2023 20:04:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1683749060; i=deller@gmx.de; bh=nTCvHy9/JOb5ufHMih/Ur+xSNY4cEQR1MIROSz16dJE=; h=X-UI-Sender-Class:Date:From:To:Subject; b=CzgQ0mXMAus38b8EUnLwJ6fmdcu4pVyJrjApJCEHL6edP17bLXphwAuerqqnVS6zX 1/tLS6AVKHQxHIpFEkVVrua5edACPcIR9pO0qvXAQeQOiBtqQ43sdkhFy64KTGzUO/ jvxoHk/mawhDvJG9cDWsd5pRB1957bRLu58lLg9nt/j2O4yoOwLhKWDqQg+NSJiXg8 3f3M+VFDZKz7WS+hC2sYzMhxFD0j3ITJTNWaFuB7+sUaIag2jQHgds5USsHMsxlO3F 5YVItQyYcgeWS+Tr5klUqN5S+qxQUHh6jz86UOOlYNmXE/LDApY9Btm7vsW3Udxjd5 0mAelzp/9f05Q== 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 1Mo6qv-1qXDTj1qKR-00pdZc; Wed, 10 May 2023 22:04:20 +0200 Date: Wed, 10 May 2023 22:04:18 +0200 From: Helge Deller To: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-parisc@vger.kernel.org Subject: [PATCH v3] console/parisc: Fix STI console on 64-bit only machines Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Provags-ID: V03:K1:JJdXvpMUrlnm1ITBTrxlxT1XXQ4ty/uItCu0l2pHgS1S5hm77ml Q3/dRoTp4NKWudGiXyTfWjPyvZeIrZlx82UzxEKIVI7CmUbNA/NZOqgGjASRE7ZwJTgUfVM Rn52t6VWRGmcyjhmNyPOB8FQukVUCQP23GB9MhkIy55KZYii4pSr+tHstFVq2D28hcUiZWi RkfmKTzI456lPmDrMyz/g== UI-OutboundReport: notjunk:1;M01:P0:aQcZVFdrWoE=;mDao+9GYfezjRIZMxD2kmWyfqW5 i9zWTxbwthdGAQIIvEdwux65BcPm9gYcEYGn6gyMCILHEZz4mrsk1kWZNQ5i9WVWkmanUngwV rlZnzH9XXC9lhli/ZztYYCfuES3627v+3pt+Qje/EYKeR6aodTvZMt+HqobXdgaKuzu/z5OtH BNrzbQN1Cr4LGqYBpbFI87Cp4vSfJ2t1akNuIXfq5cncAfAb/nym8t+6dahf5dvbG1wL8wDsd MobAMMPJqmDXUIL390IDQ0NY+txB1snr3Vol+U+8G/whGt90A14L+eGtN7IOOx3GWr1MOCQzn xDxcKmlFNEEj1M/WasbBQtgRzCd7U4O84AuMf10bxnjEbfxT2731hkjJbIVRQh+csUPYifqT+ pZzBWi3JuHOEXfc0APWZNC41PLJcIkBTVYDFgohVjqHxuobTLnveasbqFlCQ/2KLcsIzrfRHx ScTxohMdLsiDVL1/23+a+zaBklfM0N3TYWHB8l7YODewSVmPxoWRVIDzZl86QUmr9Cw/hM8xS AeQ/rMVM5q7wdYO1rO+IwreWItU3tw8Xl9dXIhtFb2doZ0NeuCryHBzZH84YouuhWcbkAgKiV fdNccRH4S4y1k5Zx69/7w1UyjK13dIL4qaR8cD4LCqo+7gyeEAUcZLAhN0I3tg3r8R1avYnrE gmanGcXXMi2QMZO5xGQ3n/bYAc51cSlrJzlp7lW06BlGsvPnRLeMIbnyViDREgJNA8l7bZRLR YD2teoghbrQ83tCOc0SWRJN6H+c03Ad+hFFntovqjRBut2b7x+bj39A0WMYrwrqLQAO55zFFn mN3PhojTz7G+qTVHLxvUkO1+RYqEReqW+Pd8aXiltYTLJIzv/WEq97bGCr305mPjbJxQvvimv Zc00z7VkGsnJMmVJvnWjqwRpGqFxqpaO/g4+G/nSySfhtQmD3iLHUeZ64AE06lz9cQ1mIHUuJ 1n21mz2pEbcIrgOSdWB7jM+808I= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- v3: Fix check for overflow of 32-bit pointers 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