Skip to contentSkip to conversation

PCI: Handle case when no pci device can provide cache line size hint

PATCH Applied Csaba Henk 3 participants 3 messages Dec 15, 2009 – Dec 16, 2009 PCI

lore
Share & tools
lore

Csaba Henk

author
#0 lore raw

PATCH 1/1 PCI: Handle case when no pci device can provide cache line size hint

Prior to this patch, if pci_read_config_byte(dev, PCI_CACHE_LINE_SIZE, ...) returns 0 for all dev, pci_cache_line_size ends up set to zero (instead of pci_dfl_cache_line_size).

This patch ensures the pci_cache_line_size = pci_dfl_cache_line_size setting in the above scenario.

This happens in case of a kvm-88 guest (where, consequently, the rtl8139 NIC failed to initialize).

---
 drivers/pci/quirks.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/pci/quirks.c +1 -1
index 7cfa7c3..f70f4e2 100644
@@ -2629,7 +2629,7 @@ static int __init pci_apply_final_quirks(void)
 	if (!pci_cache_line_size) {
 		printk(KERN_DEBUG "PCI: CLS %u bytes, default %u\n",
 		       cls << 2, pci_dfl_cache_line_size << 2);
-		pci_cache_line_size = cls;
+		pci_cache_line_size = cls ? cls : pci_dfl_cache_line_size;
 	}
 
 	return 0;
Signature · 1 line
1.6.5.6
Acked-by on v1 1/1
#1 lore raw

Hello,

Quoted 20 lines · Csaba Henk

Prior to this patch, if pci_read_config_byte(dev, PCI_CACHE_LINE_SIZE, ...) returns 0 for all dev, pci_cache_line_size ends up set to zero (instead of pci_dfl_cache_line_size).

This patch ensures the pci_cache_line_size = pci_dfl_cache_line_size setting in the above scenario.

This happens in case of a kvm-88 guest (where, consequently, the rtl8139 NIC failed to initialize).

---
 drivers/pci/quirks.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/pci/quirks.c +0 -0
index 7cfa7c3..f70f4e2 100644

drivers/pci/quirks.c static int __init pci_apply_final_quirks(void) · line 2632

Quoted 5 lines
drivers/pci/quirks.c +1 -1
@@ -2629,7 +2629,7 @@ static int __init pci_apply_final_quirks(void)
 	if (!pci_cache_line_size) {
 		printk(KERN_DEBUG "PCI: CLS %u bytes, default %u\n",
 		       cls << 2, pci_dfl_cache_line_size << 2);
-		pci_cache_line_size = cls;
+		pci_cache_line_size = cls ? cls : pci_dfl_cache_line_size;

Oh, so, all CLS values are zero? I've never thought of that.

Thanks.

Signature · 1 line
tejun
Applied
#2 lore raw
In reply to Csaba Henk
Quoted 20 lines · On Tue, 15 Dec 2009 17:55:25 +0530 Csaba Henk <[email protected]> wrote:

Prior to this patch, if pci_read_config_byte(dev, PCI_CACHE_LINE_SIZE, ...) returns 0 for all dev, pci_cache_line_size ends up set to zero (instead of pci_dfl_cache_line_size).

This patch ensures the pci_cache_line_size = pci_dfl_cache_line_size setting in the above scenario.

This happens in case of a kvm-88 guest (where, consequently, the rtl8139 NIC failed to initialize).

---
 drivers/pci/quirks.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/pci/quirks.c +0 -0
index 7cfa7c3..f70f4e2 100644

drivers/pci/quirks.c static int __init pci_apply_final_quirks(void) · line 2635

Quoted 8 lines
drivers/pci/quirks.c +1 -1
@@ -2629,7 +2629,7 @@ static int __init pci_apply_final_quirks(void)
 	if (!pci_cache_line_size) {
 		printk(KERN_DEBUG "PCI: CLS %u bytes, default %u\n",
 		       cls << 2, pci_dfl_cache_line_size << 2);
-		pci_cache_line_size = cls;
+		pci_cache_line_size = cls ? cls :
 pci_dfl_cache_line_size; }
 
 	return 0;

Applied, thanks.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center