aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/apic/io_apic.c
diff options
context:
space:
mode:
authorJoerg Roedel <joro@8bytes.org>2012-09-26 06:44:49 -0400
committerJoerg Roedel <joro@8bytes.org>2013-01-28 06:42:48 -0500
commit7601384f91be1a5ea60cb4ef6e28cad628e6cd1e (patch)
treec5dd95d5edb2d89aad2f7df7f70f6897c44beec8 /arch/x86/kernel/apic/io_apic.c
parent2976fd8417f5744de3bb9109e4f30f353a36b1c0 (diff)
x86, msi: Introduce x86_msi.compose_msi_msg call-back
This call-back points to the right function for initializing the msi_msg structure. The old code for msi_msg generation was split up into the irq-remapped and the default case. The irq-remapped case just calls into the specific Intel or AMD implementation when the device is behind an IOMMU. Otherwise the default function is called. Signed-off-by: Joerg Roedel <joro@8bytes.org> Acked-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'arch/x86/kernel/apic/io_apic.c')
-rw-r--r--arch/x86/kernel/apic/io_apic.c57
1 files changed, 30 insertions, 27 deletions
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 372512219a9b..b832810d28f0 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -3019,37 +3019,16 @@ void destroy_irqs(unsigned int irq, unsigned int count)
3019/* 3019/*
3020 * MSI message composition 3020 * MSI message composition
3021 */ 3021 */
3022#ifdef CONFIG_PCI_MSI 3022void native_compose_msi_msg(struct pci_dev *pdev,
3023static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, 3023 unsigned int irq, unsigned int dest,
3024 struct msi_msg *msg, u8 hpet_id) 3024 struct msi_msg *msg, u8 hpet_id)
3025{ 3025{
3026 struct irq_cfg *cfg; 3026 struct irq_cfg *cfg = irq_cfg(irq);
3027 int err;
3028 unsigned dest;
3029 3027
3030 if (disable_apic) 3028 msg->address_hi = MSI_ADDR_BASE_HI;
3031 return -ENXIO;
3032
3033 cfg = irq_cfg(irq);
3034 err = assign_irq_vector(irq, cfg, apic->target_cpus());
3035 if (err)
3036 return err;
3037
3038 err = apic->cpu_mask_to_apicid_and(cfg->domain,
3039 apic->target_cpus(), &dest);
3040 if (err)
3041 return err;
3042
3043 if (irq_remapped(cfg)) {
3044 compose_remapped_msi_msg(pdev, irq, dest, msg, hpet_id);
3045 return 0;
3046 }
3047 3029
3048 if (x2apic_enabled()) 3030 if (x2apic_enabled())
3049 msg->address_hi = MSI_ADDR_BASE_HI | 3031 msg->address_hi |= MSI_ADDR_EXT_DEST_ID(dest);
3050 MSI_ADDR_EXT_DEST_ID(dest);
3051 else
3052 msg->address_hi = MSI_ADDR_BASE_HI;
3053 3032
3054 msg->address_lo = 3033 msg->address_lo =
3055 MSI_ADDR_BASE_LO | 3034 MSI_ADDR_BASE_LO |
@@ -3068,6 +3047,30 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq,
3068 MSI_DATA_DELIVERY_FIXED: 3047 MSI_DATA_DELIVERY_FIXED:
3069 MSI_DATA_DELIVERY_LOWPRI) | 3048 MSI_DATA_DELIVERY_LOWPRI) |
3070 MSI_DATA_VECTOR(cfg->vector); 3049 MSI_DATA_VECTOR(cfg->vector);
3050}
3051
3052#ifdef CONFIG_PCI_MSI
3053static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq,
3054 struct msi_msg *msg, u8 hpet_id)
3055{
3056 struct irq_cfg *cfg;
3057 int err;
3058 unsigned dest;
3059
3060 if (disable_apic)
3061 return -ENXIO;
3062
3063 cfg = irq_cfg(irq);
3064 err = assign_irq_vector(irq, cfg, apic->target_cpus());
3065 if (err)
3066 return err;
3067
3068 err = apic->cpu_mask_to_apicid_and(cfg->domain,
3069 apic->target_cpus(), &dest);
3070 if (err)
3071 return err;
3072
3073 x86_msi.compose_msi_msg(pdev, irq, dest, msg, hpet_id);
3071 3074
3072 return 0; 3075 return 0;
3073} 3076}