forked from torvalds/linux
Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
PCI: hv: Make the code arch neutral
This patch makes the Hyper-V vPCI code architectural neutral by introducing an irqchip that takes care of architectural dependencies. This allows for the implementation of Hyper-V vPCI for other architecture such as ARM64. There are no functional changes expected from this patch. Signed-off-by: Sunil Muthuswamy <sunilmut@microsoft.com>
- Loading branch information
1 parent
e4e737b
commit 8f266a9b41d3dfc1600cecaba80ea116dc6edf27
Showing
8 changed files
with
141 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| // SPDX-License-Identifier: GPL-2.0 | ||
|
|
||
| /* | ||
| * Hyper-V vPCI irqchip. | ||
| * | ||
| * Copyright (C) 2021, Microsoft, Inc. | ||
| * | ||
| * Author : Sunil Muthuswamy <sunilmut@microsoft.com> | ||
| */ | ||
|
|
||
| #include <asm/mshyperv.h> | ||
| #include <linux/acpi.h> | ||
| #include <linux/irqdomain.h> | ||
| #include <linux/irq.h> | ||
| #include <linux/msi.h> | ||
|
|
||
| #ifdef CONFIG_X86_64 | ||
| int hv_pci_irqchip_init(struct irq_domain **parent_domain, | ||
| bool *fasteoi_handler, | ||
| u8 *delivery_mode) | ||
| { | ||
| *parent_domain = x86_vector_domain; | ||
| *fasteoi_handler = false; | ||
| *delivery_mode = APIC_DELIVERY_MODE_FIXED; | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| void hv_pci_irqchip_free(void) {} | ||
|
|
||
| unsigned int hv_msi_get_int_vector(struct irq_data *data) | ||
| { | ||
| struct irq_cfg *cfg = irqd_cfg(data); | ||
|
|
||
| return cfg->vector; | ||
| } | ||
|
|
||
| void hv_set_msi_entry_from_desc(union hv_msi_entry *msi_entry, | ||
| struct msi_desc *msi_desc) | ||
| { | ||
| msi_entry->address.as_uint32 = msi_desc->msg.address_lo; | ||
| msi_entry->data.as_uint32 = msi_desc->msg.data; | ||
| } | ||
|
|
||
| int hv_msi_prepare(struct irq_domain *domain, struct device *dev, | ||
| int nvec, msi_alloc_info_t *info) | ||
| { | ||
| return pci_msi_prepare(domain, dev, nvec, info); | ||
| } | ||
|
|
||
| #endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| /* SPDX-License-Identifier: GPL-2.0 */ | ||
|
|
||
| /* | ||
| * Architecture specific vector management for the Hyper-V vPCI. | ||
| * | ||
| * Copyright (C) 2021, Microsoft, Inc. | ||
| * | ||
| * Author : Sunil Muthuswamy <sunilmut@microsoft.com> | ||
| */ | ||
|
|
||
| int hv_pci_irqchip_init(struct irq_domain **parent_domain, | ||
| bool *fasteoi_handler, | ||
| u8 *delivery_mode); | ||
|
|
||
| void hv_pci_irqchip_free(void); | ||
| unsigned int hv_msi_get_int_vector(struct irq_data *data); | ||
| void hv_set_msi_entry_from_desc(union hv_msi_entry *msi_entry, | ||
| struct msi_desc *msi_desc); | ||
|
|
||
| int hv_msi_prepare(struct irq_domain *domain, struct device *dev, | ||
| int nvec, msi_alloc_info_t *info); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters