Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I hear a lot about PCI quirks when reading about the Linux kernel, but no website explains or defines PCI quirks. What are PCI quirks?

share|improve this question
1  
A quirk is just a non-intuitive inconsistency. It's not a technical term. We would probably need to see the text you're referring to in order to elaborate on what they're saying. Though there is a file that provides routines drivers can use to work around various quirks they've ran into over the years. But ultimately, it's just an informal term used in the same sense as the regular English language term. –  Bratchley Jul 17 '13 at 16:11
1  
If you're really curious, that file is pretty well commented explaining what each routine does. –  Bratchley Jul 17 '13 at 16:12

1 Answer 1

up vote 8 down vote accepted

"Quirks" are attributes of a device that are considered to be noncompliant with expected operation.

Here's an example from quirks.c:

/* The Mellanox Tavor device gives false positive parity errors
 * Mark this device with a broken_parity_status, to allow
 * PCI scanning code to "skip" this now blacklisted device.
 */
static void quirk_mellanox_tavor(struct pci_dev *dev)
{
        dev->broken_parity_status = 1;  /* This device gives false positives */
}

This is a "quirk" as the device reports spurious errors. When this device is operative, the quirk sets certain attributes that make other parts of the kernel act differently (perhaps by ignoring spurious errors, or by working around a known issue).

Not all quirks in the Linux kernel are like this, though. Instead of simply disabling the affected feature, some try to work around it, for example:

/*
 * Some CS5536 BIOSes (for example, the Soekris NET5501 board w/ comBIOS
 * ver. 1.33  20070103) don't set the correct ISA PCI region header info.
 * BAR0 should be 8 bytes; instead, it may be set to something like 8k
 * (which conflicts w/ BAR1's memory range).
 */
static void quirk_cs5536_vsa(struct pci_dev *dev)
{
        if (pci_resource_len(dev, 0) != 8) {
                struct resource *res = &dev->resource[0];
                res->end = res->start + 8 - 1;
                dev_info(&dev->dev, "CS5536 ISA bridge bug detected "
                                "(incorrect header); workaround applied.\n");
        }
}
share|improve this answer
    
Thanks for the thorough answer! I learned a lot. –  Devyn Collier Johnson Jul 17 '13 at 19:34
    
@Chris Down - how would I notice that my device has PCI quirks? And what would happen, if I disable PCI quirk workarounds in the kernel? –  Martin Vegter Sep 28 at 12:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.