Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
79ab592c
Commit
79ab592c
authored
Sep 07, 2017
by
Bjorn Helgaas
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'pci/msi' into next
* pci/msi: PCI/MSI: Assume MSIs use real Requester ID, not an alias
parents
33db87de
235b2c77
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
5 deletions
+22
-5
drivers/pci/msi.c
drivers/pci/msi.c
+22
-5
No files found.
drivers/pci/msi.c
View file @
79ab592c
...
@@ -1458,13 +1458,30 @@ struct irq_domain *pci_msi_create_irq_domain(struct fwnode_handle *fwnode,
...
@@ -1458,13 +1458,30 @@ struct irq_domain *pci_msi_create_irq_domain(struct fwnode_handle *fwnode,
}
}
EXPORT_SYMBOL_GPL
(
pci_msi_create_irq_domain
);
EXPORT_SYMBOL_GPL
(
pci_msi_create_irq_domain
);
/*
* Users of the generic MSI infrastructure expect a device to have a single ID,
* so with DMA aliases we have to pick the least-worst compromise. Devices with
* DMA phantom functions tend to still emit MSIs from the real function number,
* so we ignore those and only consider topological aliases where either the
* alias device or RID appears on a different bus number. We also make the
* reasonable assumption that bridges are walked in an upstream direction (so
* the last one seen wins), and the much braver assumption that the most likely
* case is that of PCI->PCIe so we should always use the alias RID. This echoes
* the logic from intel_irq_remapping's set_msi_sid(), which presumably works
* well enough in practice; in the face of the horrible PCIe<->PCI-X conditions
* for taking ownership all we can really do is close our eyes and hope...
*/
static
int
get_msi_id_cb
(
struct
pci_dev
*
pdev
,
u16
alias
,
void
*
data
)
static
int
get_msi_id_cb
(
struct
pci_dev
*
pdev
,
u16
alias
,
void
*
data
)
{
{
u32
*
pa
=
data
;
u32
*
pa
=
data
;
u8
bus
=
PCI_BUS_NUM
(
*
pa
);
if
(
pdev
->
bus
->
number
!=
bus
||
PCI_BUS_NUM
(
alias
)
!=
bus
)
*
pa
=
alias
;
*
pa
=
alias
;
return
0
;
return
0
;
}
}
/**
/**
* pci_msi_domain_get_msi_rid - Get the MSI requester id (RID)
* pci_msi_domain_get_msi_rid - Get the MSI requester id (RID)
* @domain: The interrupt domain
* @domain: The interrupt domain
...
@@ -1478,7 +1495,7 @@ static int get_msi_id_cb(struct pci_dev *pdev, u16 alias, void *data)
...
@@ -1478,7 +1495,7 @@ static int get_msi_id_cb(struct pci_dev *pdev, u16 alias, void *data)
u32
pci_msi_domain_get_msi_rid
(
struct
irq_domain
*
domain
,
struct
pci_dev
*
pdev
)
u32
pci_msi_domain_get_msi_rid
(
struct
irq_domain
*
domain
,
struct
pci_dev
*
pdev
)
{
{
struct
device_node
*
of_node
;
struct
device_node
*
of_node
;
u32
rid
=
0
;
u32
rid
=
PCI_DEVID
(
pdev
->
bus
->
number
,
pdev
->
devfn
)
;
pci_for_each_dma_alias
(
pdev
,
get_msi_id_cb
,
&
rid
);
pci_for_each_dma_alias
(
pdev
,
get_msi_id_cb
,
&
rid
);
...
@@ -1494,14 +1511,14 @@ u32 pci_msi_domain_get_msi_rid(struct irq_domain *domain, struct pci_dev *pdev)
...
@@ -1494,14 +1511,14 @@ u32 pci_msi_domain_get_msi_rid(struct irq_domain *domain, struct pci_dev *pdev)
* @pdev: The PCI device
* @pdev: The PCI device
*
*
* Use the firmware data to find a device-specific MSI domain
* Use the firmware data to find a device-specific MSI domain
* (i.e. not one that is s
te
as a default).
* (i.e. not one that is s
et
as a default).
*
*
* Returns: The coresponding MSI domain or NULL if none has been found.
* Returns: The cor
r
esponding MSI domain or NULL if none has been found.
*/
*/
struct
irq_domain
*
pci_msi_get_device_domain
(
struct
pci_dev
*
pdev
)
struct
irq_domain
*
pci_msi_get_device_domain
(
struct
pci_dev
*
pdev
)
{
{
struct
irq_domain
*
dom
;
struct
irq_domain
*
dom
;
u32
rid
=
0
;
u32
rid
=
PCI_DEVID
(
pdev
->
bus
->
number
,
pdev
->
devfn
)
;
pci_for_each_dma_alias
(
pdev
,
get_msi_id_cb
,
&
rid
);
pci_for_each_dma_alias
(
pdev
,
get_msi_id_cb
,
&
rid
);
dom
=
of_msi_map_get_device_domain
(
&
pdev
->
dev
,
rid
);
dom
=
of_msi_map_get_device_domain
(
&
pdev
->
dev
,
rid
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment