Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1446437
| From | Eric Auger <eric.auger@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v11 02/10] genirq/msi: msi_compose wrapper |
| Date | 2016-07-19 15:10 +0200 |
| Message-ID | <rWCWC-4qE-21@gated-at.bofh.it> (permalink) |
| References | <rWCWB-4qE-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Currently the MSI message is composed by directly calling
irq_chip_compose_msi_msg and erased by setting the memory to zero.
On some platforms, we will need to complexify this composition to
properly handle MSI emission through IOMMU. Also we will need to track
when the MSI message is erased.
We propose to introduce a common wrapper for actual composition and
erasure, msi_compose.
Signed-off-by: Eric Auger <eric.auger@redhat.com>
---
v4 -> v5:
- just introduce the msi-compose wrapper without adding new
functionalities
v3 -> v4:
- that code was formely in irq-gic-common.c
"irqchip/gicv2m/v3-its-pci-msi: IOMMU map the MSI frame when needed"
also the [un]mapping was done in irq_write_msi_msg; now done on compose
v2 -> v3:
- protect iova/addr manipulation with CONFIG_ARCH_DMA_ADDR_T_64BIT and
CONFIG_PHYS_ADDR_T_64BIT
- only expose gic_pci_msi_domain_write_msg in case CONFIG_IOMMU_API &
CONFIG_PCI_MSI_IRQ_DOMAIN are set.
- gic_set/unset_msi_addr duly become static
---
kernel/irq/msi.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
index 9b0ba4a..72bf4d6 100644
--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -55,6 +55,19 @@ static inline void irq_chip_write_msi_msg(struct irq_data *data,
data->chip->irq_write_msi_msg(data, msg);
}
+static int msi_compose(struct irq_data *irq_data,
+ struct msi_msg *msg, bool erase)
+{
+ int ret = 0;
+
+ if (erase)
+ memset(msg, 0, sizeof(*msg));
+ else
+ ret = irq_chip_compose_msi_msg(irq_data, msg);
+
+ return ret;
+}
+
/**
* msi_domain_set_affinity - Generic affinity setter function for MSI domains
* @irq_data: The irq data associated to the interrupt
@@ -73,7 +86,7 @@ int msi_domain_set_affinity(struct irq_data *irq_data,
ret = parent->chip->irq_set_affinity(parent, mask, force);
if (ret >= 0 && ret != IRQ_SET_MASK_OK_DONE) {
- BUG_ON(irq_chip_compose_msi_msg(irq_data, &msg));
+ BUG_ON(msi_compose(irq_data, &msg, false));
irq_chip_write_msi_msg(irq_data, &msg);
}
@@ -85,7 +98,7 @@ static void msi_domain_activate(struct irq_domain *domain,
{
struct msi_msg msg;
- BUG_ON(irq_chip_compose_msi_msg(irq_data, &msg));
+ BUG_ON(msi_compose(irq_data, &msg, false));
irq_chip_write_msi_msg(irq_data, &msg);
}
@@ -94,7 +107,7 @@ static void msi_domain_deactivate(struct irq_domain *domain,
{
struct msi_msg msg;
- memset(&msg, 0, sizeof(msg));
+ msi_compose(irq_data, &msg, true);
irq_chip_write_msi_msg(irq_data, &msg);
}
--
1.9.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v11 00/10] KVM PCIe/MSI passthrough on ARM/ARM64: kernel part 2/3: msi changes Eric Auger <eric.auger@redhat.com> - 2016-07-19 15:10 +0200
[PATCH v11 02/10] genirq/msi: msi_compose wrapper Eric Auger <eric.auger@redhat.com> - 2016-07-19 15:10 +0200
[PATCH v11 09/10] genirq/msi: map/unmap the MSI doorbells on msi_domain_alloc/free_irqs Eric Auger <eric.auger@redhat.com> - 2016-07-19 15:10 +0200
Re: [PATCH v11 09/10] genirq/msi: map/unmap the MSI doorbells on msi_domain_alloc/free_irqs Thomas Gleixner <tglx@linutronix.de> - 2016-07-20 11:10 +0200
Re: [PATCH v11 09/10] genirq/msi: map/unmap the MSI doorbells on msi_domain_alloc/free_irqs Auger Eric <eric.auger@redhat.com> - 2016-07-25 18:30 +0200
[PATCH v11 10/10] genirq/msi: use the MSI doorbell's IOVA when requested Eric Auger <eric.auger@redhat.com> - 2016-07-19 15:10 +0200
Re: [PATCH v11 10/10] genirq/msi: use the MSI doorbell's IOVA when requested Thomas Gleixner <tglx@linutronix.de> - 2016-07-20 11:20 +0200
Re: [PATCH v11 10/10] genirq/msi: use the MSI doorbell's IOVA when requested Auger Eric <eric.auger@redhat.com> - 2016-07-25 18:40 +0200
[PATCH v11 08/10] irqchip/gicv3-its: register the MSI global doorbell Eric Auger <eric.auger@redhat.com> - 2016-07-19 15:10 +0200
[PATCH v11 06/10] genirq/msi-doorbell: msi_doorbell_safe Eric Auger <eric.auger@redhat.com> - 2016-07-19 15:10 +0200
Re: [PATCH v11 06/10] genirq/msi-doorbell: msi_doorbell_safe Thomas Gleixner <tglx@linutronix.de> - 2016-07-20 10:20 +0200
Re: [PATCH v11 06/10] genirq/msi-doorbell: msi_doorbell_safe Auger Eric <eric.auger@redhat.com> - 2016-07-21 15:40 +0200
Re: [PATCH v11 06/10] genirq/msi-doorbell: msi_doorbell_safe Thomas Gleixner <tglx@linutronix.de> - 2016-07-22 14:50 +0200
Re: [PATCH v11 06/10] genirq/msi-doorbell: msi_doorbell_safe Auger Eric <eric.auger@redhat.com> - 2016-07-22 16:10 +0200
[PATCH v11 01/10] genirq/msi: export msi_get_domain_info Eric Auger <eric.auger@redhat.com> - 2016-07-19 15:10 +0200
csiph-web