9front - general discussion about 9front
 help / color / mirror / Atom feed
From: cinap_lenrek@felloff.net
To: 9front@9front.org
Subject: Re: [9front] BUG: thinclient not booting with usbehci,usbohci
Date: Sun, 10 Jan 2021 00:09:04 +0100	[thread overview]
Message-ID: <B7D9832A601B87280FEB076260290D74@felloff.net> (raw)
In-Reply-To: <06028168ED7BF4EA92B2E90BB23E173B@kamalatta.ddnss.de>

of course, please try.

i want to fix this for everyone, not just your personal machine :)

there might be some problems in the ehci or ohci initialization
that fails to recover the controller when busmaster has been
disabled before.

it would be great to investigate here instead of removing
the call to pcireset(), as it provides some safety.

the issue is that pci devices might be in a unknown state,
potentially fetching garbage dma descriptors from main memory
that we think is free to use.

the usual approach in drivers is to first reset the device
and bring it to a known state before enabling busmaster.

the call to pcireset() ensures that this is the case.
turn everything off, and then each driver carefully
reenables it when the device is ready.

maybe the first task would be to figure out which of the
controllers causes the problems (and which does does NOT).
if it is the ohci or ehci controllers.

we can selectively keep the busmaster on by editing
/sys/src/9/port/pci.c:

void
pcireset(void)
{
	Pcidev *p;

	for(p = pcilist; p != nil; p = p->list) {
		/* don't mess with the bridges */
		if(p->ccrb == 0x06)
			continue;

+		if(p->ccrb == Pcibcserial && p->ccru == Pciscusb){
+			switch(p->ccrp){
+			// case 0x30:	/* XHCI */
+			case 0x20:	/* EHCI */
+			// case 0x10:	/* OHCI */
+			// case 0x00:	/* UHCI */
+				continue;
+			}
+		}

		pcidisable(p);
	}
}

this skips the EHCI controllers, keeping its busmaster enable on.

in a second test, comment out the case 0x20 and remove comment
for case 0x10, so that the OHCI controller is kept untouched
instead of the ehci.

and last, try both cases...

that way we might be able to reduce the problem to one specifc
controller type and then start investigating there.

it is possible that when we disable the musmaster flag,
that the host controller gets a transaction abort and
raises an Host error that our driver didnt mask or clear
when our driver enables the device. this is what the
the other code from the preivous mail does.

--
cinap

  reply	other threads:[~2021-01-09 23:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-09  9:22 stevie
2021-01-09  9:46 ` stevie
2021-01-09 17:12   ` cinap_lenrek
2021-01-09 18:29     ` stevie
2021-01-09 23:09       ` cinap_lenrek [this message]
2021-01-10  9:29         ` stevie
2021-01-10 19:34           ` cinap_lenrek

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=B7D9832A601B87280FEB076260290D74@felloff.net \
    --to=cinap_lenrek@felloff.net \
    --cc=9front@9front.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).