linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Schmitz <schmitzmic@gmail.com>
To: Finn Thain <fthain@telegraphics.com.au>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Tejun Heo <tj@kernel.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	linux-ide@vger.kernel.org,
	Linux/m68k <linux-m68k@lists.linux-m68k.org>,
	Linux Kernel Development <linux-kernel@vger.kernel.org>,
	Andreas Schwab <schwab@linux-m68k.org>
Subject: Re: [PATCH 0/3] ata: add m68k/Atari Falcon PATA support
Date: Sat, 14 Jan 2017 21:55:07 +1300	[thread overview]
Message-ID: <c55cb48c-7200-9577-974b-3c080e141907@gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1701111053340.22260@nippy.intranet>

Hi Finn,

Am 13.01.2017 um 15:33 schrieb Finn Thain:

>> The case I'm worried about is both IDE and SCSI raising an interrupt. We 
>> don't currently mask the IDE/ST-DMA interrupt so a stacked interrupt 
>> must be processed in the same pass as the initial interrupt or it will 
>> get dropped. We'd have to peek at the DMA registers to check the SCSI or 
>> floppy interrupt status, and we just can't safely do that. So races of 
>> this kind are currently prevented by including IDE in the IRQ locking 
>> process.
>>
>> Whether it's possible to mask the interrupt, do one pass, unmask and 
>> process the second interrupt I don't know.
> 
> Would that require handling the SCSI DMA interrupt in the first pass? Or 
> handling IDE first, and ensuring that the IDE handler does not access 
> ST-DMA registers? What about FDC?

Handling the IDE interrupt first I think, then looking at the DMA (for
SCSI or FDC).

> The atari_scsi handler accesses the ST-DMA registers; it can do so because 
> it knows that any DMA must have completed -- it can infer this because a 
> simultaneous pending interrupt from FDC or IDE is impossible due to 
> stdma_lock().

libata dropped the locking (and does not use IDE interrupts at present
so it seems to be safe. Still testing - I've seen IO errors, and that's
a bit of a worry).

> Your suggestion would seem to allow other pending interrupts, hence the 
> atari_scsi interrupt handler logic has to be tossed out. What logic would 
> replace it?

I need to think about that some more - if no DMA is in progress we can
safely peek at the SCSI registers. So the logic could be changed to test
for DMA operation first, and just try and service the interrupt if DMA
wasn't active.

If DMA has been in progress, I'm not sure that we can figure out if it's
still active from looking at the status register (that is, whether bits
0 or 1 are set while DMA is ongoing). We'd have to peek at the DMA
status register (or DMA address registers) without first stopping DMA,
which the current driver does. The docs seem to advise against that.
If DMA was in progress, stopping it would likely leave us with residual
bytes to be transferred - we'd have to handle that transfer as we would
any other DMA error (from memory, probably best to retry the entire
command, or transfer the remaining bytes using PIO if we're sure no
bytes have been lost).

> If all else fails, perhaps we could inhibit DMA entirely when the new ATA 
> driver is loaded. Then we can just dispatch the ST-DMA irq like a shared 
> irq. I'm sure that atari_scsi can work without DMA. No idea about the FDC 
> driver though (ataflop.c).

Yes, SCSI can work using PIO but's it a real dog. Been there, done that
(about 20 years ago). I know nothing about the FDC chip though.

> Another solution would be to dedicate the DMA function to atari_scsi, and 
> then mask the FDC and IDE interrupts during each DMA transfer. But once 
> again, this would mean changing the FDC driver to eliminate DMA, if that 
> is possible. From the schematic it looks the the FDC chip, "AJAX", is 
> another custom ...
> http://dev-docs.atariforge.org/files/Falcon030_Schematic.pdf
> 
> Unfortunately my grasp of the ST hardware reflects my inability to read 
> German; those who can may want to take a look at "ATARI Profibuch 
> ST-STE-TT.pdf".

I'll reread the ST-DMA description (and the FDC one).

Let me know if you think this could work ...

Cheers,

	Michael

  reply	other threads:[~2017-01-14  8:55 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20161230140139epcas5p160eda5a6a77be084e21f12002c85cc2a@epcas5p1.samsung.com>
2016-12-30 14:01 ` [PATCH 0/3] ata: add m68k/Atari Falcon PATA support Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20161230140141epcas5p161d9467e10e294f502863b5347e351d5@epcas5p1.samsung.com>
2016-12-30 14:01     ` [PATCH 1/3] ata: allow subsystem to be used on m68k arch Bartlomiej Zolnierkiewicz
2016-12-30 14:12       ` Christoph Hellwig
     [not found]         ` <CGME20161230171438epcas1p3c1d8ea8e4c77d796b81f7130c5e61d3f@epcas1p3.samsung.com>
2016-12-30 17:14           ` Bartlomiej Zolnierkiewicz
2017-01-08 10:08             ` Christoph Hellwig
     [not found]               ` <CGME20170109160128epcas1p36a0a8f79b32e5024ffa480fd848e3a79@epcas1p3.samsung.com>
2017-01-09 16:01                 ` Bartlomiej Zolnierkiewicz
2017-01-09 16:15       ` Geert Uytterhoeven
     [not found]   ` <CGME20161230140144epcas1p2ada13244f4ba5b45ed903ab7d614f6db@epcas1p2.samsung.com>
2016-12-30 14:01     ` [PATCH 2/3] ata: pass queued command to ->sff_data_xfer method Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20161230140147epcas5p1fa7e99f39921a8ee90aabd59ff7b7645@epcas5p1.samsung.com>
2016-12-30 14:01     ` [PATCH 3/3] ata: add Atari Falcon PATA controller driver Bartlomiej Zolnierkiewicz
2017-01-03 10:49   ` [PATCH 0/3] ata: add m68k/Atari Falcon PATA support Geert Uytterhoeven
2017-01-09 16:11     ` Bartlomiej Zolnierkiewicz
2017-01-10 16:09       ` Tejun Heo
2017-01-05 21:01   ` Michael Schmitz
2017-01-10 12:53     ` Bartlomiej Zolnierkiewicz
2017-01-10 20:02       ` Michael Schmitz
2017-01-13  2:33         ` Finn Thain
2017-01-14  8:55           ` Michael Schmitz [this message]
2017-01-14 23:47             ` Finn Thain
2017-01-15  1:48               ` Michael Schmitz
2017-01-15  4:42                 ` Finn Thain
2017-01-20  7:49                   ` Michael Schmitz
2017-01-21  7:37                     ` Finn Thain
2017-01-23  8:04                       ` Michael Schmitz
2017-01-26  8:47                         ` Finn Thain
2017-01-26  9:03                           ` Geert Uytterhoeven
2017-01-27  1:41                             ` Finn Thain
2017-01-27  4:28                           ` Michael Schmitz
2017-02-01  8:40                             ` Finn Thain
2017-02-01  8:45                               ` Geert Uytterhoeven
2017-02-02  7:48                               ` Michael Schmitz
2017-01-10 16:11   ` Tejun Heo
2017-02-15  8:45   ` Geert Uytterhoeven
2017-02-20 18:15     ` Bartlomiej Zolnierkiewicz
2017-02-21 22:18       ` Tejun Heo

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=c55cb48c-7200-9577-974b-3c080e141907@gmail.com \
    --to=schmitzmic@gmail.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=fthain@telegraphics.com.au \
    --cc=geert@linux-m68k.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=schwab@linux-m68k.org \
    --cc=tj@kernel.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).