mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Busmaster DMA broken in 2.4.18 on Alpha
@ 2002-03-11  9:57 Jochen Friedrich
  2002-03-11 11:45 ` Kurt Garloff
  0 siblings, 1 reply; 10+ messages in thread
From: Jochen Friedrich @ 2002-03-11  9:57 UTC (permalink / raw)
  To: linux-kernel

Hi,

it looks like the change to pci_iommu.c in 2.4.18 breaks busmaster DMA for
alpha. The reason is that ISA_DMA_MASK is now 0xffffffff instead of
0x00ffffff as it was before. So the allocated memory is no longer
reachable from the ISA card.

I had to revert this change to make my ISA token ring card (tms380 based)
work again on alpha.

Cheers,
Jochen


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Busmaster DMA broken in 2.4.18 on Alpha
  2002-03-11  9:57 Busmaster DMA broken in 2.4.18 on Alpha Jochen Friedrich
@ 2002-03-11 11:45 ` Kurt Garloff
  2002-03-11 13:53   ` Jochen Friedrich
  2002-03-11 14:10   ` Ivan Kokshaysky
  0 siblings, 2 replies; 10+ messages in thread
From: Kurt Garloff @ 2002-03-11 11:45 UTC (permalink / raw)
  To: Jochen Friedrich
  Cc: linux-kernel, Ivan Kokshaysky, Jay Estabrook, Richard Henderson

[-- Attachment #1: Type: text/plain, Size: 1808 bytes --]

Hi Jochen,

On Mon, Mar 11, 2002 at 10:57:40AM +0100, Jochen Friedrich wrote:
> it looks like the change to pci_iommu.c in 2.4.18 breaks busmaster DMA for
> alpha. The reason is that ISA_DMA_MASK is now 0xffffffff instead of
> 0x00ffffff as it was before. So the allocated memory is no longer
> reachable from the ISA card.
> 
> I had to revert this change to make my ISA token ring card (tms380 based)
> work again on alpha.

You have a Miata mainboard, right?

The problem is that the chipset does corrupt data when you do busmaster DMA
read (from memory) over an 8k page boundary on the primary PCI bus.
(Secondary is not affected.)
Therefore you could e.g. not use IDE DMA on Miata.

I created a workaround specific to the ide-dma driver, but Ivan came up with
a much more general and better solution:
The PCI mapping via tbia is not used any more, but instead the PCI monster
window, which can map up to 4GB into PCI space. (Miata can theoretically have
6GB, but I did not yet hear any complaints.) 
It first broke floppy support as the pci_map would fail. The floppy chip is
an ISA device. But it can address full 32bit on Miata, so the ISA_DMA_MASK
was adapted to this.
(Ivan, correct me if I got the details wrong.)

Unfortunately, your ISA card does not seem to be able to address 32 bits.
(I guess no non-on-chip ISA adapter will.)

Seems we need two different ISA_DMA_MASKS ...

Maybe it would be easier to special case the floppy driver's calls to
pci_map when a Miata(21174) has been detected and the workaround been
applied.

Regards,
-- 
Kurt Garloff  <garloff@suse.de>                          Eindhoven, NL
GPG key: See mail header, key servers         Linux kernel development
SuSE Linux AG, Nuernberg, DE                            SCSI, Security

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Busmaster DMA broken in 2.4.18 on Alpha
  2002-03-11 11:45 ` Kurt Garloff
@ 2002-03-11 13:53   ` Jochen Friedrich
  2002-03-11 14:10   ` Ivan Kokshaysky
  1 sibling, 0 replies; 10+ messages in thread
From: Jochen Friedrich @ 2002-03-11 13:53 UTC (permalink / raw)
  To: Kurt Garloff
  Cc: linux-kernel, Ivan Kokshaysky, Jay Estabrook, Richard Henderson

Hi Kurt,

> You have a Miata mainboard, right?

Nope. It's an Avanti board (Alpha Server 400).

> Unfortunately, your ISA card does not seem to be able to address 32 bits.
> (I guess no non-on-chip ISA adapter will.)

IIRC, the ISA bus only has a 24bit address bus.

> Seems we need two different ISA_DMA_MASKS ...

Looks like it.

Cheers,
--jochen


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Busmaster DMA broken in 2.4.18 on Alpha
  2002-03-11 11:45 ` Kurt Garloff
  2002-03-11 13:53   ` Jochen Friedrich
@ 2002-03-11 14:10   ` Ivan Kokshaysky
  2002-03-11 14:32     ` Jochen Friedrich
                       ` (2 more replies)
  1 sibling, 3 replies; 10+ messages in thread
From: Ivan Kokshaysky @ 2002-03-11 14:10 UTC (permalink / raw)
  To: Kurt Garloff, Jochen Friedrich, linux-kernel, Jay Estabrook,
	Richard Henderson

On Mon, Mar 11, 2002 at 12:45:11PM +0100, Kurt Garloff wrote:
> Unfortunately, your ISA card does not seem to be able to address 32 bits.
> (I guess no non-on-chip ISA adapter will.)

No, the ability to address 32 bits is property of an ISA bridge, not
of any particular ISA card or device. Most alphas do have 32-bit ISA DMA.

For that particular driver the following hack should work.
However, ideally we should have ISA_DMA_MASK in asm/dma.h defined
for all architectures...

Ivan.

--- linux/drivers/net/tokenring/tms380tr.h.orig	Fri May 25 20:58:07 2001
+++ linux/drivers/net/tokenring/tms380tr.h	Mon Mar 11 15:52:06 2002
@@ -462,7 +462,12 @@ typedef struct {
 				  */
 
 /* XXX is there some better way to do this? */
+#if defined(__alpha__)
+#define ISA_MAX_ADDRESS	(MAX_DMA_ADDRESS - IDENT_ADDR - 1 < 0xffffffff ? \
+			 MAX_DMA_ADDRESS - IDENT_ADDR - 1 : 0xffffffff)
+#else
 #define ISA_MAX_ADDRESS 	0x00ffffff
+#endif
 #define PCI_MAX_ADDRESS		0xffffffff
 
 #pragma pack(1)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Busmaster DMA broken in 2.4.18 on Alpha
  2002-03-11 14:10   ` Ivan Kokshaysky
@ 2002-03-11 14:32     ` Jochen Friedrich
  2002-03-11 15:02     ` Jay Estabrook
  2002-03-11 15:16     ` David S. Miller
  2 siblings, 0 replies; 10+ messages in thread
From: Jochen Friedrich @ 2002-03-11 14:32 UTC (permalink / raw)
  To: Ivan Kokshaysky
  Cc: Kurt Garloff, linux-kernel, Jay Estabrook, Richard Henderson

Hi Ivan,

> No, the ability to address 32 bits is property of an ISA bridge, not
> of any particular ISA card or device. Most alphas do have 32-bit ISA DMA.

This is wrong for bus master DMA. tms380tr.c sets DMA_MODE_CASCADE and the
addressing is done by the ISA card. As the card only has 24bit, the DMA is
limited to 24 bits.

Your patch would only cause a machine check, but DMA still wouldn't work.

Cheers,
--jochen


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Busmaster DMA broken in 2.4.18 on Alpha
  2002-03-11 14:10   ` Ivan Kokshaysky
  2002-03-11 14:32     ` Jochen Friedrich
@ 2002-03-11 15:02     ` Jay Estabrook
  2002-03-11 15:45       ` Alan Cox
  2002-03-11 16:04       ` Ivan Kokshaysky
  2002-03-11 15:16     ` David S. Miller
  2 siblings, 2 replies; 10+ messages in thread
From: Jay Estabrook @ 2002-03-11 15:02 UTC (permalink / raw)
  To: Ivan Kokshaysky
  Cc: Kurt Garloff, Jochen Friedrich, linux-kernel, Richard Henderson

On Mon, Mar 11, 2002 at 05:10:58PM +0300, Ivan Kokshaysky wrote:
> On Mon, Mar 11, 2002 at 12:45:11PM +0100, Kurt Garloff wrote:
> > Unfortunately, your ISA card does not seem to be able to address 32 bits.
> > (I guess no non-on-chip ISA adapter will.)
> 
> No, the ability to address 32 bits is property of an ISA bridge, not
> of any particular ISA card or device. 

That's not quite true, either.

There are ISA cards, regardless of what ISA bus machine they are
plugged into, that are able to generate only something less than
32-bits worth of address. I believe that the Adaptec 1540 SCSI
controller is one of these, since I had some exposure to its
limitations a while ago; it can generate only 24-bit addresses, IIRC.

Since ISA devices don't have pci_dev structures, there's (currently)
no way to pass an ISA device-dependent DMA mask to the IOMMU routines.
Perhaps there needs to be an addition to the API that would allow
for this (pci_set_isa_device_dma_mask()) ???

> Most alphas do have 32-bit ISA DMA.

True. For those notable exceptions (XL, Ruffian, Nautilus), we can still
depend on the MAX_DMA_ADDRESS to override any device-dependent mask.

--Jay++

-----------------------------------------------------------------------------
Jay A Estabrook                            Alpha Engineering - LINUX Project
Compaq Computer Corp. - MRO1-2/K15         (508) 467-2080
200 Forest Street, Marlboro MA 01752       Jay.Estabrook@compaq.com
-----------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Busmaster DMA broken in 2.4.18 on Alpha
  2002-03-11 14:10   ` Ivan Kokshaysky
  2002-03-11 14:32     ` Jochen Friedrich
  2002-03-11 15:02     ` Jay Estabrook
@ 2002-03-11 15:16     ` David S. Miller
  2002-03-11 15:44       ` Jay Estabrook
  2 siblings, 1 reply; 10+ messages in thread
From: David S. Miller @ 2002-03-11 15:16 UTC (permalink / raw)
  To: Jay.Estabrook; +Cc: ink, garloff, jochen, linux-kernel, rth

   From: Jay Estabrook <Jay.Estabrook@compaq.com>
   Date: Mon, 11 Mar 2002 10:02:00 -0500
   
   Since ISA devices don't have pci_dev structures, there's (currently)
   no way to pass an ISA device-dependent DMA mask to the IOMMU routines.
   Perhaps there needs to be an addition to the API that would allow
   for this (pci_set_isa_device_dma_mask()) ???

What you could do currently is whip up a dummy pci_dev structure with
the mask you want and pass that into the PCI dma routines.  So you
could, for example, default to 24-bit DMA mask when you get "NULL"
as pci_dev, but cook up a special one using a 32-bit DMA mask for the
floppy ISA device in question.

The idea in 2.5.x is to move to a generic struct device, at which time
something like this can be done much more cleanly.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Busmaster DMA broken in 2.4.18 on Alpha
  2002-03-11 15:16     ` David S. Miller
@ 2002-03-11 15:44       ` Jay Estabrook
  0 siblings, 0 replies; 10+ messages in thread
From: Jay Estabrook @ 2002-03-11 15:44 UTC (permalink / raw)
  To: David S. Miller; +Cc: ink, garloff, jochen, linux-kernel, rth

On Mon, Mar 11, 2002 at 07:16:56AM -0800, David S. Miller wrote:
>    From: Jay Estabrook <Jay.Estabrook@compaq.com>
>    Date: Mon, 11 Mar 2002 10:02:00 -0500
>    
>    Since ISA devices don't have pci_dev structures, there's (currently)
>    no way to pass an ISA device-dependent DMA mask to the IOMMU routines.
>    Perhaps there needs to be an addition to the API that would allow
>    for this (pci_set_isa_device_dma_mask()) ???
> 
> What you could do currently is whip up a dummy pci_dev structure with
> the mask you want and pass that into the PCI dma routines.  So you
> could, for example, default to 24-bit DMA mask when you get "NULL"
> as pci_dev, but cook up a special one using a 32-bit DMA mask for the
> floppy ISA device in question.

Yup, that'd work, though it would put the floppy's resources in with
the PCI devices, rather than kept separate as ISA. Should work fine,
though.

> The idea in 2.5.x is to move to a generic struct device, at which time
> something like this can be done much more cleanly.

Sounds good, if only it'd compile on Alpha... ;-}

--Jay++

-----------------------------------------------------------------------------
Jay A Estabrook                            Alpha Engineering - LINUX Project
Compaq Computer Corp. - MRO1-2/K15         (508) 467-2080
200 Forest Street, Marlboro MA 01752       Jay.Estabrook@compaq.com
-----------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Busmaster DMA broken in 2.4.18 on Alpha
  2002-03-11 15:02     ` Jay Estabrook
@ 2002-03-11 15:45       ` Alan Cox
  2002-03-11 16:04       ` Ivan Kokshaysky
  1 sibling, 0 replies; 10+ messages in thread
From: Alan Cox @ 2002-03-11 15:45 UTC (permalink / raw)
  To: Jay Estabrook
  Cc: Ivan Kokshaysky, Kurt Garloff, Jochen Friedrich, linux-kernel,
	Richard Henderson

> There are ISA cards, regardless of what ISA bus machine they are
> plugged into, that are able to generate only something less than
> 32-bits worth of address. I believe that the Adaptec 1540 SCSI

All busmasters in fact. There are only 24 address wires on the ISA bus. That
covers stuff from tpqic02 through pcnet/isa, lance and aha154x.

Alan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Busmaster DMA broken in 2.4.18 on Alpha
  2002-03-11 15:02     ` Jay Estabrook
  2002-03-11 15:45       ` Alan Cox
@ 2002-03-11 16:04       ` Ivan Kokshaysky
  1 sibling, 0 replies; 10+ messages in thread
From: Ivan Kokshaysky @ 2002-03-11 16:04 UTC (permalink / raw)
  To: Jay Estabrook
  Cc: Kurt Garloff, Jochen Friedrich, linux-kernel, Richard Henderson

On Mon, Mar 11, 2002 at 10:02:00AM -0500, Jay Estabrook wrote:
> There are ISA cards, regardless of what ISA bus machine they are
> plugged into, that are able to generate only something less than
> 32-bits worth of address.

Indeed, I missed that.

> Since ISA devices don't have pci_dev structures, there's (currently)
> no way to pass an ISA device-dependent DMA mask to the IOMMU routines.
> Perhaps there needs to be an addition to the API that would allow
> for this (pci_set_isa_device_dma_mask()) ???

Yes, it would be nice to have something like this.

Another workaround also seems to be possible - for ISA devices
use mask other than 0x00ffffff _only_ if we don't have working
IOMMU. This doesn't help to get older Miatas work with such
type of ISA cards though...

Ivan.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2002-03-11 18:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-11  9:57 Busmaster DMA broken in 2.4.18 on Alpha Jochen Friedrich
2002-03-11 11:45 ` Kurt Garloff
2002-03-11 13:53   ` Jochen Friedrich
2002-03-11 14:10   ` Ivan Kokshaysky
2002-03-11 14:32     ` Jochen Friedrich
2002-03-11 15:02     ` Jay Estabrook
2002-03-11 15:45       ` Alan Cox
2002-03-11 16:04       ` Ivan Kokshaysky
2002-03-11 15:16     ` David S. Miller
2002-03-11 15:44       ` Jay Estabrook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®