Skip to contentSkip to conversation

PCI Express support for 2.4 kernel

DISCUSSION Andi Kleen 3 participants 7 messages Dec 15, 2003 – Dec 17, 2003 19 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

Andi Kleen

author
#3 lore raw
Quoted 8 lines · Vladimir Kondratiev

As I explained in comment to function, it is not really critical. The problem is, there is no generic way (or I don't know it) to recognize PCI-E. One suggest to go over all devices and see whether PCI-E capability present for at least one of them. I don't think it is good way to do. Sanity check do pretty good job here. If it is not PCI-E platform, this address in physical memory will not be connected to anything real. You will get 0xff's.

I don't think that's a good assumption. There will be surely be some machine that has an mapping there. You will need to find some fool proof way to detect the presence of PCI-Express. Otherwise it will likely fail the number one criterium for merging ("it shall not break anything else")

And in general new development should be done in 2.6 first...

-Andi

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#10 lore raw

Review

Quoted 6 lines · Vladimir Kondratiev

#define PCI_PROBE_CONF1 0x0002
#define PCI_PROBE_CONF2 0x0004

(quoted diff) +4 -0
+
+#ifdef CONFIG_PCI_EXPRESS
+#define PCI_PROBE_EXP		0x0008
+#endif

Drop the #ifdef here.

Review

Quoted 3 lines
(quoted diff) +3 -0
+#ifdef CONFIG_PCI_EXPRESS
+#include <asm/fixmap.h>
+#endif

Same here.

Review

Quoted 7 lines
(quoted diff) +7 -0
+static inline void pci_exp_set_dev_base(int bus, int dev, int fn)
+{
+	u32 dev_base = (bus << 20) | (dev << 15) | (fn << 12);
+	if (dev_base != pcie_last_accessed_device) {
+		pcie_last_accessed_device = dev_base;
+		set_fixmap_nocache(FIX_PCIE_CONFIG, rrbar_phys | dev_base);
+	}

When you use one fix map per CPU you can avoid the lock. All that would be needed would be a local_irq_disable()/enable() then. While normally config space accesses should not be performance critical sometimes they are done frequently to work around hardware bugs.

I still think it would be better to cache mappings and use a hash table though ...

-Andi

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#13 lore raw
Quoted 6 lines · Vladimir Kondratiev
Quoted 1 line

Yes, separation into generic and platform specific part seems nice, but besides memory mapping and locking, all you have is very simple arithmetic. Does it worth the work for separation?

For 64-bit world, agree, it could and should be done uniform.

Could you put the relevant code into an asm/ file for 2.6 then please?

Background: x86-64 shares the PCI code with i386 which just works for both 32bit and 64bit currently. If it is all changeable in the asm/ file then I won't need to change it later again. Of course the fixmap would work for x86-64 too, but just mapping the 256MB is much nicer and preferable.

-Andi

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#20 lore raw
Quoted 3 lines · Alan Cox

And X11 will want to access it via /proc interfaces. And someone will eventually go and design a different way to access PCI-EX for their hardware 8)

It would be nice if it did. Just currently it uses racy port accesses from user space :-(

-Andi

#21 lore raw
Quoted 7 lines · Andi Kleen
Quoted 3 lines · Alan Cox

And X11 will want to access it via /proc interfaces. And someone will eventually go and design a different way to access PCI-EX for their hardware 8)

It would be nice if it did. Just currently it uses racy port accesses from user space :-(

Depends what patches you applied and how you built it 8) However XFree meets hotplug is so unfunny its not good to consider before dinner, nor XFree meets irqs or XFree meets SAK and high security models.

Linus had a nice comment that the basic DRI/fb modules should be dealing with the PCI layer and perhaps exposing the DMA engine for newer cards (to trusted parties). For older cards there are all sorts of reasons you don't want to do this on the performance side but even then a driver which refused to free up the PCI map space until X noticed the file handle was returning errors and selected EOF would make a lot of the stuff sort out.

Maybe in part the GGI folks were right all those years ago. We had two extreme views and the middle may be closer

Alan

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#24 lore raw
Quoted 6 lines · Vladimir Kondratiev
Quoted 1 line

I thought this way also. But I found that it is not. You may know several chipsets,
and do per-chipset stuff, but there is no generic procedure. At least authors of PCI-E
don't know (it is nice to have access to the authors ;-) ).

This sounds like a serious design flaw in PCI-Express. Can you ask them to address this before it is too late?

-Andi

#25 lore raw

You know, I am also thinking in this direction. I already started conversation to implement some standard method.

Vladimir.

Quoted 16 lines · Andi Kleen
Quoted 7 lines · Vladimir Kondratiev

I thought this way also. But I found that it is not. You may know several chipsets,
and do per-chipset stuff, but there is no generic procedure. At least authors of PCI-E
don't know (it is nice to have access to the authors ;-) ).

This sounds like a serious design flaw in PCI-Express. Can you ask them to address this before it is too late?

-Andi