mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2.6.15.3] alpha/pci: set cache line size for cards ignored  by SRM
@ 2006-02-07 22:54 Gabriele Gorla
  2006-02-08  8:38 ` Ivan Kokshaysky
  0 siblings, 1 reply; 3+ messages in thread
From: Gabriele Gorla @ 2006-02-07 22:54 UTC (permalink / raw)
  To: ink, rth, gregkh; +Cc: linux-kernel

From: Gabriele Gorla <gorlik@yahoo.com>

Set the cache line size in the PCI configuration space to a reasonable
value. SRM does not seem to set this register for the PCI cards that it
does not recognize. This makes drivers that expect cache line size to be
set by the card bios work on alpha.

Signed-off-by: Gabriele Gorla <gorlik@yahoo.com>

---

--- linux-2.6.15.3/arch/alpha/kernel/pci.c.orig 2006-02-07 14:24:59 -0800
+++ linux-2.6.15.3/arch/alpha/kernel/pci.c      2006-02-07 14:19:59 -0800
@@ -108,11 +108,24 @@ static void __init
 pcibios_fixup_final(struct pci_dev *dev)
 {
        unsigned int class = dev->class >> 8;
+       u8 cache_line_size;

        if (class == PCI_CLASS_BRIDGE_ISA || class ==
PCI_CLASS_BRIDGE_EISA) {
                dev->dma_mask = MAX_ISA_DMA_ADDRESS - 1;
                isa_bridge = dev;
        }
+
+       /* if the cache line is not set by SRM attempt to fix it */
+       pci_read_config_byte(dev, PCI_CACHE_LINE_SIZE, &cache_line_size);
+       if(cache_line_size == 0) {
+               pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE,
+                                     L1_CACHE_BYTES >> 2);
+               pci_read_config_byte(dev, PCI_CACHE_LINE_SIZE,
+                                    &cache_line_size);
+               if(cache_line_size == (L1_CACHE_BYTES >> 2) )
+                       printk("PCI: Setting cache line size of device %s"
+                              " to %d\n", pci_name(dev), L1_CACHE_BYTES );
+       }
 }
 DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_final);



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

* Re: [PATCH 2.6.15.3] alpha/pci: set cache line size for cards ignored by SRM
  2006-02-07 22:54 [PATCH 2.6.15.3] alpha/pci: set cache line size for cards ignored by SRM Gabriele Gorla
@ 2006-02-08  8:38 ` Ivan Kokshaysky
  2006-02-13  2:17   ` Gabriele Gorla
  0 siblings, 1 reply; 3+ messages in thread
From: Ivan Kokshaysky @ 2006-02-08  8:38 UTC (permalink / raw)
  To: Gabriele Gorla; +Cc: rth, gregkh, linux-kernel, Andrew Morton

On Tue, Feb 07, 2006 at 02:54:43PM -0800, Gabriele Gorla wrote:
> Set the cache line size in the PCI configuration space to a reasonable
> value. SRM does not seem to set this register for the PCI cards that it
> does not recognize. This makes drivers that expect cache line size to be
> set by the card bios work on alpha.

I don't see such drivers in the mainline.

Anyhow, the PCI_CACHE_LINE_SIZE setting is critical only for devices
that do memory-write-invalidate. In this case a driver must call
pci_set_mwi() which takes care of PCI_CACHE_LINE_SIZE.

The patch is NAKed.

Ivan.

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

* Re: [PATCH 2.6.15.3] alpha/pci: set cache line size for cards  ignored by SRM
  2006-02-08  8:38 ` Ivan Kokshaysky
@ 2006-02-13  2:17   ` Gabriele Gorla
  0 siblings, 0 replies; 3+ messages in thread
From: Gabriele Gorla @ 2006-02-13  2:17 UTC (permalink / raw)
  To: Ivan Kokshaysky; +Cc: Gabriele Gorla, rth, gregkh, linux-kernel, Andrew Morton

> On Tue, Feb 07, 2006 at 02:54:43PM -0800, Gabriele Gorla wrote:
>> Set the cache line size in the PCI configuration space to a reasonable
>> value. SRM does not seem to set this register for the PCI cards that it
>> does not recognize. This makes drivers that expect cache line size to be
>> set by the card bios work on alpha.
>
> I don't see such drivers in the mainline.
that sata_sil driver uses the cache line register to tune some FIFO
registers.

> Anyhow, the PCI_CACHE_LINE_SIZE setting is critical only for devices
> that do memory-write-invalidate. In this case a driver must call
> pci_set_mwi() which takes care of PCI_CACHE_LINE_SIZE.
sata_sil is not capable of MWI so it does not call pci_set_mwi()

I looked at the config space on a PC and alpha before the sata_sil driver
is loaded and it is different.
I suspect on the PC the system bios or the card bios set up this register
during post.

The sata_sil driver may not be doing the correct thing, however it seems
reasonable to assume that the device is configured properly (by system
bios or kernel fixup) before the driver init code executes.
This seems the same behavior of ppc and sparc64 pci code as well.

thanks,
GG


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

end of thread, other threads:[~2006-02-13  2:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-07 22:54 [PATCH 2.6.15.3] alpha/pci: set cache line size for cards ignored by SRM Gabriele Gorla
2006-02-08  8:38 ` Ivan Kokshaysky
2006-02-13  2:17   ` Gabriele Gorla

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®