提交 9e7f9178 编写于 作者: B Boqun Feng 提交者: Lorenzo Pieralisi

PCI: hv: Set up MSI domain at bridge probing time

Since PCI_HYPERV depends on PCI_MSI_IRQ_DOMAIN which selects
GENERIC_MSI_IRQ_DOMAIN, we can use dev_set_msi_domain() to set up the
MSI domain at probing time, and this works for both x86 and ARM64.

Therefore use it as the preparation for ARM64 Hyper-V PCI support.

As a result, no longer need to maintain ->fwnode in x86 specific
pci_sysdata, and make hv_pcibus_device own it instead.

Link: https://lore.kernel.org/r/20210726180657.142727-8-boqun.feng@gmail.comSigned-off-by: NBoqun Feng <boqun.feng@gmail.com>
Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
上级 38c0d266
...@@ -450,6 +450,7 @@ enum hv_pcibus_state { ...@@ -450,6 +450,7 @@ enum hv_pcibus_state {
struct hv_pcibus_device { struct hv_pcibus_device {
struct pci_sysdata sysdata; struct pci_sysdata sysdata;
struct pci_host_bridge *bridge; struct pci_host_bridge *bridge;
struct fwnode_handle *fwnode;
/* Protocol version negotiated with the host */ /* Protocol version negotiated with the host */
enum pci_protocol_version_t protocol_version; enum pci_protocol_version_t protocol_version;
enum hv_pcibus_state state; enum hv_pcibus_state state;
...@@ -1565,7 +1566,7 @@ static int hv_pcie_init_irq_domain(struct hv_pcibus_device *hbus) ...@@ -1565,7 +1566,7 @@ static int hv_pcie_init_irq_domain(struct hv_pcibus_device *hbus)
hbus->msi_info.handler = handle_edge_irq; hbus->msi_info.handler = handle_edge_irq;
hbus->msi_info.handler_name = "edge"; hbus->msi_info.handler_name = "edge";
hbus->msi_info.data = hbus; hbus->msi_info.data = hbus;
hbus->irq_domain = pci_msi_create_irq_domain(hbus->sysdata.fwnode, hbus->irq_domain = pci_msi_create_irq_domain(hbus->fwnode,
&hbus->msi_info, &hbus->msi_info,
x86_vector_domain); x86_vector_domain);
if (!hbus->irq_domain) { if (!hbus->irq_domain) {
...@@ -1574,6 +1575,8 @@ static int hv_pcie_init_irq_domain(struct hv_pcibus_device *hbus) ...@@ -1574,6 +1575,8 @@ static int hv_pcie_init_irq_domain(struct hv_pcibus_device *hbus)
return -ENODEV; return -ENODEV;
} }
dev_set_msi_domain(&hbus->bridge->dev, hbus->irq_domain);
return 0; return 0;
} }
...@@ -3118,9 +3121,9 @@ static int hv_pci_probe(struct hv_device *hdev, ...@@ -3118,9 +3121,9 @@ static int hv_pci_probe(struct hv_device *hdev,
goto unmap; goto unmap;
} }
hbus->sysdata.fwnode = irq_domain_alloc_named_fwnode(name); hbus->fwnode = irq_domain_alloc_named_fwnode(name);
kfree(name); kfree(name);
if (!hbus->sysdata.fwnode) { if (!hbus->fwnode) {
ret = -ENOMEM; ret = -ENOMEM;
goto unmap; goto unmap;
} }
...@@ -3198,7 +3201,7 @@ static int hv_pci_probe(struct hv_device *hdev, ...@@ -3198,7 +3201,7 @@ static int hv_pci_probe(struct hv_device *hdev,
free_irq_domain: free_irq_domain:
irq_domain_remove(hbus->irq_domain); irq_domain_remove(hbus->irq_domain);
free_fwnode: free_fwnode:
irq_domain_free_fwnode(hbus->sysdata.fwnode); irq_domain_free_fwnode(hbus->fwnode);
unmap: unmap:
iounmap(hbus->cfg_addr); iounmap(hbus->cfg_addr);
free_config: free_config:
...@@ -3314,7 +3317,7 @@ static int hv_pci_remove(struct hv_device *hdev) ...@@ -3314,7 +3317,7 @@ static int hv_pci_remove(struct hv_device *hdev)
hv_free_config_window(hbus); hv_free_config_window(hbus);
hv_pci_free_bridge_windows(hbus); hv_pci_free_bridge_windows(hbus);
irq_domain_remove(hbus->irq_domain); irq_domain_remove(hbus->irq_domain);
irq_domain_free_fwnode(hbus->sysdata.fwnode); irq_domain_free_fwnode(hbus->fwnode);
hv_put_dom_num(hbus->bridge->domain_nr); hv_put_dom_num(hbus->bridge->domain_nr);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册