Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1277118
| From | Ondrej Zary <linux@rainbow-software.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers |
| Date | 2015-11-25 10:10 +0100 |
| Message-ID | <qyEfo-48i-29@gated-at.bofh.it> (permalink) |
| References | <qw6Bc-vx-5@gated-at.bofh.it> <qytDj-5dS-3@gated-at.bofh.it> <qyxQC-89y-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wednesday 25 November 2015, Finn Thain wrote:
>
> On Tue, 24 Nov 2015, Ondrej Zary wrote:
>
> > On Tuesday 24 November 2015 10:13:17 Finn Thain wrote:
> > >
> > > On Tue, 24 Nov 2015, Ondrej Zary wrote:
> > >
> > > > On Tuesday 24 November 2015, Finn Thain wrote:
> > > > >
> > > > > On Mon, 23 Nov 2015, Ondrej Zary wrote:
> > > > >
> > > > > >
> > > > > > PDMA seems to be broken in multiple ways. NCR5380_pread cannot
> > > > > > process less than 128 bytes. In fact, 53C400 datasheet says that
> > > > > > it's HW limitation: non-modulo-128-byte transfers should use
> > > > > > PIO.
> > > > > >
> > > > > > Adding
> > > > > > transfersize = round_down(transfersize, 128);
> > > > > > to generic_NCR5380_dma_xfer_len() improves the situation a bit.
> > > > > >
> > > > > > After modprobe, some small reads (8, 4, 24 and 64 bytes) are
> > > > > > done using PIO, then eight 512-byte reads using PDMA and then it
> > > > > > fails on a 254-byte read. First 128 bytes are read using PDMA
> > > > > > and the next PDMA operation hangs waiting forever for the host
> > > > > > buffer to be ready.
> > > > > >
> > > > >
> > > > > A 128-byte PDMA receive followed by 126-byte PDMA receive? I don't
> > > > > see how that is possible given round_down(126, 128) == 0. Was this
> > > > > the actual 'len' argument to NCR5380_pread() in g_NCR5380.c?
> > > >
> > > > No 126-byte PDMA. The 126 bytes were probably lost (or mixed with
> > > > the next read?).
> > > [...]
> > > > The next read was also 254 bytes so another 128-byte PDMA transfer.
> > > >
> > > > Then modified NCR5380_information_transfer() to transfer the
> > > > remaining data (126 bytes in this case) using PIO. It did not help,
> > > > the next PDMA transfer failed too.
> > > >
> > >
> > > AFAICT, no change to NCR5380_information_transfer() should be needed.
> > > It was always meant to cope with the need to split a transfer between
> > > (P)DMA and PIO.
> >
> > Instead of fixing split transfers, simply forced everything
> > non-modulo-128 to PIO:
>
> The need to split a transfer arises from early chip errata relating to DMA
> and the workarounds for them (see the comments in the source). That's why
> I believe that the driver was meant to be cope with this. But I don't have
> any experimental evidence for it.
>
> I'm almost certain that these errata aren't applicable to your hardware.
> So I don't have any reason to think that your card will allow part of a
> transfer to be performed with PDMA and the rest with PIO. So I don't
> really object to the patch.
>
> But I don't understand the need for it either: I have no idea what state
> the driver, chip and scsi bus were in when the 126-byte PIO transfer
> failed. If the PIO transfer didn't succeed then the entire command should
> have failed.
The patch was just a quick hack to confirm that PDMA is not completely broken.
Now we know that it mostly works so I can investigate the partial PIO problem.
> > --- a/drivers/scsi/g_NCR5380.c
> > +++ b/drivers/scsi/g_NCR5380.c
> > @@ -703,6 +703,10 @@ static int generic_NCR5380_dma_xfer_len(struct scsi_cmnd *cmd)
> > !(cmd->SCp.this_residual % transfersize))
> > transfersize = 32 * 1024;
> >
> > + /* 53C400 datasheet: non-modulo-128-byte transfers should use PIO */
>
> Do you have a download link for this datasheet?
http://bitsavers.trailing-edge.com/pdf/ncr/scsi/NCR_53C400.pdf
53C400A datasheet would be great too but haven't found any.
I think that PDMA should work with 53C400A too but seems that the driver was
never able to do it.
Although there is code for port-mapped transfer in NCR5380_pread(),
NCR53C400_register_offset is defined to 0 in the port-mapped case. The C400_
register offsets are thus defined with negative offset:
#define C400_CONTROL_STATUS_REG NCR53C400_register_offset-8
#define C400_BLOCK_COUNTER_REG NCR53C400_register_offset-7
#define C400_RESUME_TRANSFER_REG NCR53C400_register_offset-6
#define C400_HOST_BUFFER NCR53C400_register_offset-4
This is probably OK for a port-mapped 53C400 (such card must have some glue
decoding logic as the 53C400 chip itself can do memory-mapping only) because:
/*
* On NCR53C400 boards, NCR5380 registers are mapped 8 past
* the base address.
*/
if (overrides[current_override].board == BOARD_NCR53C400)
instance->io_port += 8;
This means that on a 53C400, first 5380 register will be at base+8 and first
C400_ register at base.
But on a 53C400A, the 5380 registers are mapped on the base address so the
C400_ registers would be below the base, which is obviously wrong. I hope that
PDMA will work if I fix the C400_ registers mapping.
> > + if (transfersize % 128)
> > + transfersize = 0;
> > +
> > return transfersize;
> > }
> >
> > It seems to work and greatly improves performance:
> > # hdparm -t --direct /dev/sdb
> >
> > /dev/sdb:
> > Timing O_DIRECT disk reads: 4 MB in 4.84 seconds = 846.15 kB/sec
> >
>
> Sounds about right...
>
--
Ondrej Zary
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-11-18 10:20 +0100
[PATCH 04/71] ncr5380: Remove more pointless macros Finn Thain <fthain@telegraphics.com.au> - 2015-11-18 10:30 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-18 12:40 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-11-19 03:30 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Michael Schmitz <schmitzmic@gmail.com> - 2015-11-19 04:00 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-19 08:50 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-20 00:00 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-11-20 02:50 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-11-20 08:30 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Christoph Hellwig <hch@infradead.org> - 2015-11-20 08:40 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-11-20 09:20 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-20 10:20 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Christoph Hellwig <hch@infradead.org> - 2015-11-20 11:10 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-11-20 12:00 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Christoph Hellwig <hch@infradead.org> - 2015-11-20 12:50 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-20 12:50 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Geert Uytterhoeven <geert@linux-m68k.org> - 2015-11-20 13:30 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-20 13:50 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-20 08:40 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-20 19:30 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-11-21 03:10 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-21 14:10 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-22 00:10 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-11-22 00:40 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-24 00:00 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-11-24 02:30 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-24 09:10 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-11-24 10:20 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-24 13:10 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-24 19:10 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-24 22:50 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-11-25 03:20 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-25 10:10 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-11-25 13:00 +0100
Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-11-26 00:10 +0100
[PATCH 72/71] ncr5380: Fix pseudo-DMA Ondrej Zary <linux@rainbow-software.org> - 2015-11-25 22:40 +0100
[RFC PATCH 73/71] ncr5380: Use runtime register mapping Ondrej Zary <linux@rainbow-software.org> - 2015-11-29 10:50 +0100
Re: [RFC PATCH 73/71] ncr5380: Use runtime register mapping Finn Thain <fthain@telegraphics.com.au> - 2015-11-30 13:00 +0100
[RFC PATCH 74/71] ncr5380: Enable PDMA for NCR53C400A Ondrej Zary <linux@rainbow-software.org> - 2015-11-29 10:50 +0100
Re: [RFC PATCH 74/71] ncr5380: Enable PDMA for NCR53C400A Finn Thain <fthain@telegraphics.com.au> - 2015-11-30 13:00 +0100
Re: [RFC PATCH 74/71] ncr5380: Enable PDMA for NCR53C400A Finn Thain <fthain@telegraphics.com.au> - 2015-11-30 13:10 +0100
Re: [RFC PATCH 74/71] ncr5380: Enable PDMA for NCR53C400A Ondrej Zary <linux@rainbow-software.org> - 2015-11-30 14:50 +0100
[RFC PATCH 75/71] ncr5380: Remove FLAG_DTC3181E Ondrej Zary <linux@rainbow-software.org> - 2015-11-29 11:10 +0100
Re: [RFC PATCH 75/71] ncr5380: Remove FLAG_DTC3181E Finn Thain <fthain@telegraphics.com.au> - 2015-11-30 06:00 +0100
csiph-web