lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4f70a38490b12d13858f45f3e7a531bf5dc2162d.camel@physik.fu-berlin.de>
Date: Wed, 12 Nov 2025 22:31:33 +0100
From: John Paul Adrian Glaubitz <glaubitz@...sik.fu-berlin.de>
To: Florian Fuchs <fuchsfl@...il.com>
Cc: Yoshinori Sato <ysato@...rs.sourceforge.jp>, Rich Felker
 <dalias@...c.org>, 	linux-sh@...r.kernel.org, linux-kernel@...r.kernel.org,
 Artur Rojek	 <contact@...ur-rojek.eu>
Subject: Re: [PATCH] sh: maple: fix empty port handling

Hi Florian.

On Wed, 2025-11-12 at 20:04 +0100, Florian Fuchs wrote:
> Handle timeout response from empty ports of the maple bus to prevent a
> stuck maple_sentq and a blocked maple bus.
> 
> When only some ports are used, e.g. if only keyboard is connected and the
> other ports are empty, the device tends to timeout and return 0xff for
> the empty port. This needs to be handled, just like the
> MAPLE_RESPONSE_NONE response, to detect empty ports and to have usable
> peripherals, if not all of the ports are utilized. Previously, an empty
> port resulted in a never cleared maple_sentq which totally blocked the
> maple bus to be used.
> 
> Signed-off-by: Florian Fuchs <fuchsfl@...il.com>
> ---
> Note: This patch was tested on real Sega Dreamcast hardware and resulted
> in a usable keyboard, even when only 1 or 2 ports where populated. The
> hot-plugging of the keyboard does also work fine.
> 
> The description of the timeout response can be obtained on the bottom of
> of the page: https://mc.pp.se/dc/maplebus.html: "If no response is
> received before the timeout, a word with all bits set (FFFFFFFF) is
> written at the Result address."
> 
>  drivers/sh/maple/maple.c | 1 +
>  include/linux/maple.h    | 3 ++-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
> index 6dc0549f7900..3d6c716cfc98 100644
> --- a/drivers/sh/maple/maple.c
> +++ b/drivers/sh/maple/maple.c
> @@ -649,6 +649,7 @@ static void maple_dma_handler(struct work_struct *work)
>  			list_del_init(&mq->list);
>  			switch (code) {
>  			case MAPLE_RESPONSE_NONE:
> +			case MAPLE_RESPONSE_TIMEOUT:
>  				maple_response_none(mdev);
>  				break;
>  
> diff --git a/include/linux/maple.h b/include/linux/maple.h
> index 3be4e567473c..4ae3cc6678a8 100644
> --- a/include/linux/maple.h
> +++ b/include/linux/maple.h
> @@ -27,7 +27,8 @@ enum maple_code {
>  	MAPLE_COMMAND_BWRITE,
>  	MAPLE_COMMAND_BSYNC,
>  	MAPLE_COMMAND_SETCOND,
> -	MAPLE_COMMAND_MICCONTROL
> +	MAPLE_COMMAND_MICCONTROL,
> +	MAPLE_RESPONSE_TIMEOUT = 255
>  };
>  
>  enum maple_file_errors {
> 
> base-commit: 24172e0d79900908cf5ebf366600616d29c9b417

Thanks for your patch! I'll try to get it reviewed in the weekend.

In the meantime, I'll like to add Artur Rojek who did some work for Linux on the
Dreamcast as well if I remember correctly. Maybe he could test your patch as I
currently don't have my Dreamcast set up for testing.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ