public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: PCI #LOCK assertion
  2002-01-25 18:17 PCI #LOCK assertion chus Medina
@ 2002-01-24 23:43 ` Gérard Roudier
  2002-01-25 18:43 ` Richard B. Johnson
  1 sibling, 0 replies; 4+ messages in thread
From: Gérard Roudier @ 2002-01-24 23:43 UTC (permalink / raw)
  To: chus Medina; +Cc: linux-kernel, chus



On Fri, 25 Jan 2002, chus Medina wrote:

> Hola,
>
> I need to create module to perform atomic transactions through the PCI bus
> between the processor and an IDE hard disk. The PCI bus specifications 2.2
> point to the #LOCK signal to perform such a transaction. Is possible to
> assert the #LOCK signal of the PCI bus using the Linux Kernel? How? I didnt
> see any pointers in include/pci.h or anywhere in the source code.
>
> I will truly appreciate any help/pointers,

This has nothing to do with the kernel.
This only depends on your CPU and on the PCI-HOST bridge of your system.

For example, some (all?) Intel PCI-HOST bridges will translate a LOCK
prefixed memory READ to PCI into a locked PCI transaction. It is also
possible to perform a locked READ/MODIFY transaction to PCI using the
corresponding LOCK prefixed memory instruction.

I suggest you to download PCI-HOST bridge documents from Intel site and
to look into them, if obviously you are interestested in such hardware.

Just, PCI-to-PCI bridges do not carry the PCI LOCK# protocol. As a result
a subsystem relying on PCI LOCK# will not work (as expected) if PCI agents
are talking through a PCI-to-PCI bridge.

  Gérard.


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

* PCI #LOCK assertion
@ 2002-01-25 18:17 chus Medina
  2002-01-24 23:43 ` Gérard Roudier
  2002-01-25 18:43 ` Richard B. Johnson
  0 siblings, 2 replies; 4+ messages in thread
From: chus Medina @ 2002-01-25 18:17 UTC (permalink / raw)
  To: linux-kernel; +Cc: chus


Hola,

I need to create module to perform atomic transactions through the PCI bus 
between the processor and an IDE hard disk. The PCI bus specifications 2.2 
point to the #LOCK signal to perform such a transaction. Is possible to 
assert the #LOCK signal of the PCI bus using the Linux Kernel? How? I didnt 
see any pointers in include/pci.h or anywhere in the source code.

I will truly appreciate any help/pointers,

Jesus



_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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

* Re: PCI #LOCK assertion
  2002-01-25 18:17 PCI #LOCK assertion chus Medina
  2002-01-24 23:43 ` Gérard Roudier
@ 2002-01-25 18:43 ` Richard B. Johnson
  2002-01-27 21:18   ` H. Peter Anvin
  1 sibling, 1 reply; 4+ messages in thread
From: Richard B. Johnson @ 2002-01-25 18:43 UTC (permalink / raw)
  To: chus Medina; +Cc: linux-kernel, chus

On Fri, 25 Jan 2002, chus Medina wrote:

> 
> Hola,
> 
> I need to create module to perform atomic transactions through the PCI bus 
> between the processor and an IDE hard disk. The PCI bus specifications 2.2 
> point to the #LOCK signal to perform such a transaction. Is possible to 
> assert the #LOCK signal of the PCI bus using the Linux Kernel? How? I didnt 
> see any pointers in include/pci.h or anywhere in the source code.
> 
> I will truly appreciate any help/pointers,
> 
> Jesus
> 

On Intel machines, you precede a memory access with the 'lock'
instruction. With CPUs i486, and later, only the accessed page
is locked at that instant. Earlier CPUs locked the whole bus.

The PCI/Bus controller handles the #LOCK signal itself to guarantee
the atomicity of a transaction. You should never have to do this
yourself. If you think you have to, just precede each PCI/Bus
address-space access with the 'lock' instruction. You just make
your own version of the readl/readw/readb/etc macros that are
provided. You may find that this deadlocks, though, and all bets
are off. You may have just locked the PCI/Bus off the bus when
you needed it most!!

If you are finding something 'strange' in your PCI/Bus accesses,
it is probably because you didn't use 'nocache' when you obtained
address-space for your PCI Device, i.e., ioremap_nocache() instead of
ioremap().


Cheers,
Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (797.90 BogoMips).

    I was going to compile a list of innovations that could be
    attributed to Microsoft. Once I realized that Ctrl-Alt-Del
    was handled in the BIOS, I found that there aren't any.



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

* Re: PCI #LOCK assertion
  2002-01-25 18:43 ` Richard B. Johnson
@ 2002-01-27 21:18   ` H. Peter Anvin
  0 siblings, 0 replies; 4+ messages in thread
From: H. Peter Anvin @ 2002-01-27 21:18 UTC (permalink / raw)
  To: linux-kernel

Followup to:  <Pine.LNX.3.95.1020125132236.1362A-100000@chaos.analogic.com>
By author:    "Richard B. Johnson" <root@chaos.analogic.com>
In newsgroup: linux.dev.kernel
> 
> On Intel machines, you precede a memory access with the 'lock'
> instruction. With CPUs i486, and later, only the accessed page
> is locked at that instant. Earlier CPUs locked the whole bus.
> 
> The PCI/Bus controller handles the #LOCK signal itself to guarantee
> the atomicity of a transaction. You should never have to do this
> yourself. If you think you have to, just precede each PCI/Bus
> address-space access with the 'lock' instruction. You just make
> your own version of the readl/readw/readb/etc macros that are
> provided. You may find that this deadlocks, though, and all bets
> are off. You may have just locked the PCI/Bus off the bus when
> you needed it most!!
> 

LOCK on readl/readw/etc is meaningless (might even be an error).  The
*only* case when the lock matters is when transferring
read/modify/write transactions such as "inc", "add", "xchg" (the
latter locks automatically.)

In practice, LOCK# on the PCI bus is so poorly supported that you
can't rely on it anyway (and it causes deadlocks.)  A number of
motherboards have been known not even to wire it up.  LOCK is still
needed for SMP coherency, however.

	-hpa
-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt	<amsp@zytor.com>

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

end of thread, other threads:[~2002-01-27 21:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-01-25 18:17 PCI #LOCK assertion chus Medina
2002-01-24 23:43 ` Gérard Roudier
2002-01-25 18:43 ` Richard B. Johnson
2002-01-27 21:18   ` H. Peter Anvin

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