Lines 3336-3341
static struct pci_dev *pci_func_0_dma_source(struct pci_dev *dev)
Link Here
|
3336 |
return pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn), 0)); |
3336 |
return pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn), 0)); |
3337 |
} |
3337 |
} |
3338 |
|
3338 |
|
|
|
3339 |
/* Table of source functions for real devices. The DMA requests for the |
3340 |
* device are tagged with a different real function as source. This is |
3341 |
* relevant to multifunction devices. |
3342 |
*/ |
3339 |
static const struct pci_dev_dma_source { |
3343 |
static const struct pci_dev_dma_source { |
3340 |
u16 vendor; |
3344 |
u16 vendor; |
3341 |
u16 device; |
3345 |
u16 device; |
Lines 3362-3368
static const struct pci_dev_dma_source {
Link Here
|
3362 |
* the device doing the DMA, but sometimes hardware is broken and will |
3366 |
* the device doing the DMA, but sometimes hardware is broken and will |
3363 |
* tag the DMA as being sourced from a different device. This function |
3367 |
* tag the DMA as being sourced from a different device. This function |
3364 |
* allows that translation. Note that the reference count of the |
3368 |
* allows that translation. Note that the reference count of the |
3365 |
* returned device is incremented on all paths. |
3369 |
* returned device is incremented on all paths. Translation is done when |
|
|
3370 |
* the device is added to an IOMMU group. |
3366 |
*/ |
3371 |
*/ |
3367 |
struct pci_dev *pci_get_dma_source(struct pci_dev *dev) |
3372 |
struct pci_dev *pci_get_dma_source(struct pci_dev *dev) |
3368 |
{ |
3373 |
{ |
Lines 3423-3428
static int pci_quirk_amd_sb_acs(struct pci_dev *dev, u16 acs_flags)
Link Here
|
3423 |
#endif |
3428 |
#endif |
3424 |
} |
3429 |
} |
3425 |
|
3430 |
|
|
|
3431 |
/* Table of multiple requester IDs, aka ghost DMA source functions. |
3432 |
* Devices that may need this quirk show the following behaviour: |
3433 |
* 1. the device may use multiple PCI requester IDs during operation, |
3434 |
* (eg. one pci transaction uses xx:yy.0, the next uses xx:yy.1) |
3435 |
* 2. the requester ID may point to an absent/ghost device. |
3436 |
* (eg. lspci does not show xx:yy.1 to be present) |
3437 |
* |
3438 |
* The bitmap contains ALL of the functions used as requester IDs by the |
3439 |
* device, including the one known to 'lspci'. If the func is known to 'lspci', |
3440 |
* but not used for DMA, don't include it. |
3441 |
* See https://bugzilla.redhat.com/show_bug.cgi?id=757166, |
3442 |
* https://bugzilla.kernel.org/show_bug.cgi?id=42679 |
3443 |
* https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1089768 |
3444 |
*/ |
3445 |
static const struct pci_dev_dma_multi_source_map { |
3446 |
u16 vendor; |
3447 |
u16 device; |
3448 |
u8 func_map; /* bit map. lsb is fn 0. */ |
3449 |
} pci_dev_dma_multi_source_map[] = { |
3450 |
/* Reported by Patrick Bregman |
3451 |
* https://bugzilla.redhat.com/show_bug.cgi?id=863653 */ |
3452 |
{ PCI_VENDOR_ID_MARVELL_EXT, 0x9120, (1<<0)|(1<<1)}, |
3453 |
|
3454 |
/* Reported by Paweł Żak, Korneliusz Jarzębski, Daniel Mayer |
3455 |
* https://bugzilla.kernel.org/show_bug.cgi?id=42679 and by |
3456 |
* Justin Piszcz https://lkml.org/lkml/2012/11/24/94 */ |
3457 |
{ PCI_VENDOR_ID_MARVELL_EXT, 0x9123, (1<<0)|(1<<1)}, |
3458 |
|
3459 |
/* Used in a patch by Ying Chu |
3460 |
* https://bugzilla.redhat.com/show_bug.cgi?id=757166 */ |
3461 |
{ PCI_VENDOR_ID_MARVELL_EXT, 0x9125, (1<<0)|(1<<1)}, |
3462 |
|
3463 |
/* Reported by Robert Cicconetti |
3464 |
* https://bugzilla.kernel.org/show_bug.cgi?id=42679 and by |
3465 |
* Fernando https://bugzilla.redhat.com/show_bug.cgi?id=757166 */ |
3466 |
{ PCI_VENDOR_ID_MARVELL_EXT, 0x9128, (1<<0)|(1<<1)}, |
3467 |
|
3468 |
/* Reported by Stijn Tintel |
3469 |
* https://bugzilla.kernel.org/show_bug.cgi?id=42679 */ |
3470 |
{ PCI_VENDOR_ID_MARVELL_EXT, 0x9130, (1<<0)|(1<<1)}, |
3471 |
|
3472 |
/* Reported by Gaudenz Steinlin |
3473 |
* https://lkml.org/lkml/2013/3/5/288 */ |
3474 |
{ PCI_VENDOR_ID_MARVELL_EXT, 0x9143, (1<<0)|(1<<1)}, |
3475 |
|
3476 |
/* Reported by Andrew Cooks |
3477 |
* https://bugzilla.kernel.org/show_bug.cgi?id=42679 */ |
3478 |
{ PCI_VENDOR_ID_MARVELL_EXT, 0x9172, (1<<0)|(1<<1)}, |
3479 |
|
3480 |
/* Reported by Martin Öhrling |
3481 |
* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c28 */ |
3482 |
{ PCI_VENDOR_ID_MARVELL_EXT, 0x9230, (1<<0)|(1<<1)}, |
3483 |
|
3484 |
{ 0 } |
3485 |
}; |
3486 |
|
3487 |
/* |
3488 |
* The mapping of quirky requester ids is used when the device driver sets up |
3489 |
* dma, if iommu is enabled. |
3490 |
*/ |
3491 |
u8 pci_multi_requesters(struct pci_dev *dev) |
3492 |
{ |
3493 |
const struct pci_dev_dma_multi_source_map *i; |
3494 |
|
3495 |
for (i = pci_dev_dma_multi_source_map; i->func_map; i++) { |
3496 |
if ((i->vendor == dev->vendor || |
3497 |
i->vendor == (u16)PCI_ANY_ID) && |
3498 |
(i->device == dev->device || |
3499 |
i->device == (u16)PCI_ANY_ID)) { |
3500 |
return i->func_map; |
3501 |
} |
3502 |
} |
3503 |
return 0; |
3504 |
} |
3505 |
|
3506 |
/* These are one-to-one translations for devices that use a single incorrect |
3507 |
* requester ID. The requester id may not be the BDF of a real device. |
3508 |
*/ |
3509 |
static const struct pci_dev_dma_source_map { |
3510 |
u16 vendor; |
3511 |
u16 device; |
3512 |
u8 devfn; |
3513 |
u8 dma_devfn; |
3514 |
} pci_dev_dma_source_map[] = { |
3515 |
/* Ricoh IEEE 1394 Controller */ |
3516 |
{ |
3517 |
PCI_VENDOR_ID_RICOH, |
3518 |
0xe832, |
3519 |
PCI_DEVFN(0x00, 3), |
3520 |
PCI_DEVFN(0x00, 0) |
3521 |
}, |
3522 |
|
3523 |
/* Nils Caspar - Adaptec 3405 |
3524 |
* http://www.mail-archive.com/centos@centos.org/msg90986.html |
3525 |
* Jonathan McCune |
3526 |
* http://old-list-archives.xen.org/archives/html/xen-users/2010-04/msg00535.html */ |
3527 |
{ |
3528 |
PCI_VENDOR_ID_ADAPTEC2, |
3529 |
0x028b, |
3530 |
PCI_DEVFN(0x0e, 0), |
3531 |
PCI_DEVFN(0x01, 0) |
3532 |
}, |
3533 |
|
3534 |
/* Mateusz Murawski - LSI SAS based MegaRAID |
3535 |
* https://lkml.org/lkml/2011/9/12/104 |
3536 |
* M. Nunberg - Dell PERC 5/i Integrated RAID Controller |
3537 |
* http://lists.xen.org/archives/html/xen-devel/2010-05/msg01563.html */ |
3538 |
{ |
3539 |
PCI_VENDOR_ID_LSI_LOGIC, |
3540 |
0x0411, |
3541 |
PCI_DEVFN(0x0e, 0), |
3542 |
PCI_DEVFN(0x08, 0) |
3543 |
}, |
3544 |
|
3545 |
/* Steven Dake, Markus Stockhausen - Mellanox 26428 |
3546 |
* https://bugzilla.redhat.com/show_bug.cgi?id=713774 |
3547 |
* Note: mellanox uses decimal product numbers, convert to hex for PCI |
3548 |
* device ID. ie. 26428 == 0x673c */ |
3549 |
{ |
3550 |
PCI_VENDOR_ID_MELLANOX, |
3551 |
0x673c, |
3552 |
PCI_DEVFN(0x00, 0), |
3553 |
PCI_DEVFN(0x00, 6) |
3554 |
}, |
3555 |
|
3556 |
{ 0 } |
3557 |
}; |
3558 |
|
3559 |
u8 pci_requester(struct pci_dev *dev) |
3560 |
{ |
3561 |
const struct pci_dev_dma_source_map *i; |
3562 |
|
3563 |
for (i = pci_dev_dma_source_map; i->vendor; i++) { |
3564 |
if ((i->vendor == dev->vendor) && |
3565 |
(i->device == dev->device) && |
3566 |
(i->devfn == dev->devfn)) { |
3567 |
return i->dma_devfn; |
3568 |
} |
3569 |
} |
3570 |
return dev->devfn; |
3571 |
} |
3572 |
|
3426 |
static const struct pci_dev_acs_enabled { |
3573 |
static const struct pci_dev_acs_enabled { |
3427 |
u16 vendor; |
3574 |
u16 vendor; |
3428 |
u16 device; |
3575 |
u16 device; |