linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Ulrich Teichert <krypton@ulrich-teichert.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	linux-serial@vger.kernel.org,
	Russell King <rmk+kernel@armlinux.org.uk>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Matt Turner <mattst88@gmail.com>,
	linux-alpha@vger.kernel.org,
	Lino Sanfilippo <LinoSanfilippo@gmx.de>,
	Philipp Rosenberger <p.rosenberger@kunbus.com>,
	John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Subject: Re: [PATCH] serial: 8250: Move alpha-specific quirk out of the core
Date: Sat, 18 Dec 2021 10:06:01 +0100	[thread overview]
Message-ID: <20211218090601.GA1016@wunner.de> (raw)
In-Reply-To: <202112162036.1BGKaKGI003165@valdese.nms.ulrich-teichert.org>

On Thu, Dec 16, 2021 at 09:36:20PM +0100, Ulrich Teichert wrote:
> > struct uart_8250_port contains mcr_mask and mcr_force members whose
> > sole purpose is to work around an alpha-specific quirk.  This code
> > doesn't belong in the core where it is executed by everyone else,
> > so move it to a proper ->set_mctrl callback which is used on alpha only.
[...]
> > The quirk applies to non-PCI alphas and arch/alpha/Kconfig specifies
> > "select FORCE_PCI if !ALPHA_JENSEN".  So apparently the only affected
> > machine is the EISA-based Jensen that Linus was working on back then:
[...]
> > Up until now the quirk is not applied unless CONFIG_PCI is disabled.
> > If users forget to do that, the serial ports aren't usable on Jensen
> > and the machine may not boot in the first place.  Avoid by confining
> > the quirk to CONFIG_ALPHA_JENSEN instead.
> 
> Wouldn't that mean that you can't use a generic Alpha kernel on the Jensen
> anymore? CONFIG_ALPHA_JENSEN is only set if you specifically select the
> Jensen as target, not when you build a generic kernel. That would be a step
> back in my opinion, as the Debian generic kernel from debian-ports did
> as least boot up on real hardware and the serial console worked just fine

The generic Alpha kernel has CONFIG_PCI=y, so the quirk is not applied,
both with and without the present patch.

You should be able to trigger the lockup that the quirk seeks to avoid
by closing the tty of either of the serial ports.  E.g., if you're using
the serial console, "cat" something to the other serial port's tty.
That will clear TIOCM_OUT2 in serial8250_do_shutdown() and should thus
provoke the lockup.  Alternatively, compile and run the little program
below on the Jensen.  (Pass a serial port tty as argument.)

Should you not be able to reproduce the lockup, then the quirk wouldn't
be necessary anymore and could be removed.

Thanks!

Lukas

-- >8 --

#include <unistd.h>
#include <termios.h>
#include <fcntl.h>
#include <sys/ioctl.h>

#define TIOCM_OUT1	0x2000
#define TIOCM_OUT2	0x4000

int main(int argc, char* argv[]) {
	int fd, ret, flags;

	if (argc < 2)
		return 1;

	fd = open(argv[1], O_RDWR);
	if (fd < 0)
		return 2;

	ret = ioctl(fd, TIOCMGET, &flags);
	if (ret < 0)
		goto close;

	flags &= ~(TIOCM_OUT1 | TIOCM_OUT2);
	ret = ioctl(fd, TIOCMSET, &flags);

close:
	close(fd);

	return ret;
}

  parent reply	other threads:[~2021-12-18  9:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-16 17:52 [PATCH] serial: 8250: Move alpha-specific quirk out of the core Lukas Wunner
2021-12-16 20:36 ` Ulrich Teichert
2021-12-16 21:58   ` John Paul Adrian Glaubitz
2021-12-19 17:41     ` Ulrich Teichert
2021-12-18  9:06   ` Lukas Wunner [this message]
2021-12-19 17:37     ` Ulrich Teichert
2021-12-28 17:33       ` Lukas Wunner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211218090601.GA1016@wunner.de \
    --to=lukas@wunner.de \
    --cc=LinoSanfilippo@gmx.de \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=ink@jurassic.park.msu.ru \
    --cc=jirislaby@kernel.org \
    --cc=krypton@ulrich-teichert.org \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mattst88@gmail.com \
    --cc=p.rosenberger@kunbus.com \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=rth@twiddle.net \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).