Powerpc MSI Implementation (.. again)
cover Powerpc MSI Implementation (.. again)
MSI again, one (?) more time.
Not much left todo:
* Needs a good read to check everything makes sense
* We might want to save the irq type in the mpic ht backend
* RTAS code needs to be tested
cheers
PATCH 1/9 Add #defines for Hypertransport MSI fields
Add a few #defines for grabbing and working with the address fields in a HT_CAPTYPE_MSI_MAPPING capability. All from the HT spec v3.00.
---
include/linux/pci_regs.h | 7 +++++++ 1 file changed, 7 insertions(+)
include/linux/pci_regs.h +7 -0
@@ -487,6 +487,13 @@#define HT_CAPTYPE_UNITID_CLUMP 0x90/* Unit ID clumping */ #define HT_CAPTYPE_EXTCONF 0x98/* Extended Configuration Space Access */ #define HT_CAPTYPE_MSI_MAPPING 0xA8/* MSI Mapping Capability */ +#define HT_MSI_FLAGS 0x02/* Offset to flags */ +#define HT_MSI_FLAGS_ENABLE 0x1/* Mapping enable */ +#define HT_MSI_FLAGS_FIXED 0x2/* Fixed mapping only */ +#define HT_MSI_FIXED_ADDR 0x00000000FEE00000ULL/* Fixed addr */ +#define HT_MSI_ADDR_LO 0x04/* Offset to low addr bits */ +#define HT_MSI_ADDR_LO_MASK 0xFFF00000/* Low address bit mask */ +#define HT_MSI_ADDR_HI 0x08/* Offset to high addr bits */ #define HT_CAPTYPE_DIRECT_ROUTE 0xB0/* Direct routing configuration */ #define HT_CAPTYPE_VCSET 0xB8/* Virtual Channel configuration */ #define HT_CAPTYPE_ERROR_RETRY 0xC0/* Retry on error configuration */
PATCH 2/9 Rip out the existing powerpc msi stubs
In reply to Michael EllermanRip out the existing powerpc msi stubs. These were the start of an implementation based on ppc_md calls, but were never used.
---
arch/powerpc/kernel/irq.c | 28 ---------------------------- include/asm-powerpc/machdep.h | 5 ----- 2 files changed, 33 deletions(-)
arch/powerpc/kernel/irq.c +0 -28
@@ -945,34 +945,6 @@ arch_initcall(irq_late_init);#endif /* CONFIG_PPC_MERGE */ -#ifdef CONFIG_PCI_MSI -int pci_enable_msi (struct pci_dev * pdev) -{ -if (ppc_md.enable_msi) -return ppc_md.enable_msi (pdev); -else -return -1 ; -} -EXPORT_SYMBOL (pci_enable_msi); - -void pci_disable_msi (struct pci_dev * pdev) -{ -if (ppc_md.disable_msi) - ppc_md.disable_msi (pdev); -} -EXPORT_SYMBOL (pci_disable_msi); - -void pci_scan_msi_device (struct pci_dev *dev) {} -int pci_enable_msix (struct pci_dev * dev,struct msix_entry *entries,int nvec) {return -1 ;} -void pci_disable_msix (struct pci_dev *dev) {} -void msi_remove_pci_irq_vectors (struct pci_dev *dev) {} -void disable_msi_mode (struct pci_dev *dev,int pos,int type) {} -void pci_no_msi (void ) {} -EXPORT_SYMBOL (pci_enable_msix); -EXPORT_SYMBOL (pci_disable_msix); - -#endif -#ifdef CONFIG_PPC64 static int __init setup_noirqdistrib (char *str) {
include/asm-powerpc/machdep.h +0 -5
@@ -243,11 +243,6 @@ struct machdep_calls {*/ void (*machine_kexec)(struct kimage *image);#endif /* CONFIG_KEXEC */ - -#ifdef CONFIG_PCI_MSI -int (*enable_msi)(struct pci_dev *pdev); -void (*disable_msi)(struct pci_dev *pdev); -#endif /* CONFIG_PCI_MSI */ };extern void power4_idle (void );
PATCH 3/9 Powerpc MSI implementation
In reply to Michael EllermanPowerpc MSI implementation, based on a collection of "ops" callbacks. We have to take the ops approach to accomodate RTAS, where firmware handles almost all details of MSI setup/teardown. Bare-metal MSI can be accomodated also.
---
arch/powerpc/kernel/msi.c | 322 ++++++++++++++++++++++++++++++++++++++++++ include/asm-powerpc/machdep.h | 6 include/asm-powerpc/msi.h | 173 ++++++++++++++++++++++ include/linux/pci.h | 7 4 files changed, 508 insertions(+)
arch/powerpc/kernel/msi.c new file +322 -0
@@ -0,0 +1,322 @@ +/* +* Copyright 2006 (C), Michael Ellerman, IBM Corporation. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +*/ + +#undef DEBUG + +#include <linux/kernel.h> +#include <linux/slab.h> +#include <asm/msi.h> +#include <asm/machdep.h> + +static struct ppc_msi_ops *get_msi_ops (struct pci_dev *pdev) +{ +if (ppc_md.get_msi_ops) +return ppc_md.get_msi_ops (pdev); + +return NULL ; +} + +/* Activated by pci=nomsi on the command line. */ +static int no_msi; + +void pci_no_msi (void ) +{ +msi_debug ("MSI disabled by user\n" ); + no_msi =1 ; +} + + +/* msi_info helpers */ + +static int alloc_msi_info (struct pci_dev *pdev,int num, +struct msix_entry *entries,int type) +{ +struct msi_info *info; +unsigned int entries_size; + + entries_size =sizeof (struct msix_entry ) * num; + + info =kzalloc (sizeof (struct msi_info ) + entries_size,GFP_KERNEL ); +if (!info) { +msi_debug ("kzalloc failed for %s\n" ,pci_name (pdev)); +return -ENOMEM ; + } + + info->type = type; + info->num = num; + info->entries = (struct msix_entry *)(info +1 ); +memcpy (info->entries, entries, entries_size); + +BUG_ON (pdev->msi_info);/* don't leak info structs */ + pdev->msi_info = info; + +return 0 ; +} + +static struct msi_info *get_msi_info (struct pci_dev *pdev) +{ +return pdev->msi_info; +} + +static void free_msi_info (struct pci_dev *pdev) +{ +kfree (pdev->msi_info); + pdev->msi_info =NULL ; +} + + +/* Generic helpers */ + +static int generic_msi_enable (struct pci_dev *pdev,int nvec, +struct msix_entry *entries,int type) +{ +struct ppc_msi_ops *ops; +int i, rc; + +if (no_msi || !pdev || !entries || !nvec ||get_msi_info (pdev)) { +msi_debug ("precondition failed for %p\n" , pdev); +return -EINVAL ; + } + + ops =get_msi_ops (pdev); +if (!ops) { +msi_debug ("no ops for %s\n" ,pci_name (pdev)); +return -EINVAL ; + } + +for (i =0 ; i < nvec; i++) + entries[i].vector =NO_IRQ ; + + rc = ops->check (pdev, nvec, entries, type); +if (rc) { +msi_debug ("check failed (%d) for %s\n" , rc,pci_name (pdev)); +return rc; + } + + rc =alloc_msi_info (pdev, nvec, entries, type); +if (rc) +return rc; + + rc = ops->alloc (pdev, nvec, entries, type); +if (rc) { +msi_debug ("alloc failed (%d) for %s\n" , rc,pci_name (pdev)); + goto out_free_info; + } + +if (ops->enable) { + rc = ops->enable (pdev, nvec, entries, type); +if (rc) { +msi_debug ("enable failed (%d) for %s\n" , rc, +pci_name (pdev)); + goto out_ops_free; + } + } + +pci_intx (pdev,0 ); + +return 0 ; + + out_ops_free: + ops->free (pdev, nvec, entries, type); + out_free_info: +free_msi_info (pdev); + +return rc; +} + +static int generic_msi_disable (struct pci_dev *pdev,int type) +{ +struct ppc_msi_ops *ops; +struct msi_info *info; + +if (no_msi || !pdev) { +msi_debug ("precondition failed for %p\n" , pdev); +return -1 ; + } + + info =get_msi_info (pdev); +if (!info) { +msi_debug ("No info for %s\n" ,pci_name (pdev)); +return -1 ; + } + + ops =get_msi_ops (pdev); +if (!ops) { +msi_debug ("no ops for %s\n" ,pci_name (pdev)); +return -1 ; + } + +if (ops->disable) + ops->disable (pdev, info->num, info->entries, type); + + ops->free (pdev, info->num, info->entries, type); + +pci_intx (pdev,1 ); + +return 0 ; +} + + +/* MSI */ + +int pci_enable_msi (struct pci_dev *pdev) +{ +struct msix_entry entry; +int rc; + + entry.entry =0 ; + + rc =generic_msi_enable (pdev,1 , &entry,PCI_CAP_ID_MSI ); +if (rc) +return rc; + +get_msi_info (pdev)->saved_irq = pdev->irq; + pdev->irq = entry.vector; + pdev->msi_enabled =1 ; + +return 0 ; +} +EXPORT_SYMBOL_GPL (pci_enable_msi); + +void pci_disable_msi (struct pci_dev *pdev) +{ +if (generic_msi_disable (pdev,PCI_CAP_ID_MSI ) !=0 ) +return ; + + pdev->irq =get_msi_info (pdev)->saved_irq; +free_msi_info (pdev); + pdev->msi_enabled =0 ; +} +EXPORT_SYMBOL_GPL (pci_disable_msi); + + +/* MSI-X */ + +int pci_enable_msix (struct pci_dev *pdev,struct msix_entry *entries,int nvec) +{ +int rc; + + rc =generic_msi_enable (pdev, nvec, entries,PCI_CAP_ID_MSIX ); +if (rc) +return rc; + + pdev->msix_enabled =1 ; +return 0 ; +} +EXPORT_SYMBOL_GPL (pci_enable_msix); + +void pci_disable_msix (struct pci_dev *pdev) +{ +if (generic_msi_disable (pdev,PCI_CAP_ID_MSIX ) !=0 ) +return ; + +free_msi_info (pdev); + pdev->msix_enabled =0 ; +} +EXPORT_SYMBOL_GPL (pci_disable_msix); + + +/* Stubs for now */ + +void disable_msi_mode (struct pci_dev *dev,int pos,int type) +{ +return ; +} + +void pci_scan_msi_device (struct pci_dev *dev) +{ +return ; +} + +void msi_remove_pci_irq_vectors (struct pci_dev * dev) +{ +return ; +} + + +/* Bare metal enable/disable */ + +int msi_raw_enable (struct pci_dev *pdev,int num, +struct msix_entry *entries,int type) +{ +struct ppc_msi_ops *ops; +struct msi_msg msg; +int pos; +u16 control; + + pos =pci_find_capability (pdev, type); +if (!pos) { +msi_debug ("cap (%d) not found for %s\n" , type,pci_name (pdev)); +return -1 ; + } + + ops =get_msi_ops (pdev); +BUG_ON (!ops); + +pci_read_config_word (pdev, pos +PCI_MSI_FLAGS , &control); + +switch (type) { +case PCI_CAP_ID_MSI : +BUG_ON (!ops->setup_msi_msg); + + ops->setup_msi_msg (pdev, &entries[0 ], &msg, type); + +pci_write_config_dword (pdev, pos +PCI_MSI_ADDRESS_LO , + msg.address_lo); + +if (control &PCI_MSI_FLAGS_64BIT ) { +pci_write_config_dword (pdev, pos +PCI_MSI_ADDRESS_HI , + msg.address_hi); +pci_write_config_dword (pdev, pos +PCI_MSI_DATA_64 , + msg.data); + }else { +pci_write_config_dword (pdev, pos +PCI_MSI_DATA_32 , + msg.data); + } + + control |=PCI_MSI_FLAGS_ENABLE ; +break ; +case PCI_CAP_ID_MSIX : +WARN_ON (1 );/* XXX implement me */ +return -1 ; +default : +BUG (); + } + +pci_write_config_word (pdev, pos +PCI_MSI_FLAGS , control); + +return 0 ; +} + +void msi_raw_disable (struct pci_dev *pdev,int num, +struct msix_entry *entries,int type) +{ +int pos; +u16 control; + + pos =pci_find_capability (pdev, type); +BUG_ON (!pos); + +pci_read_config_word (pdev, pos +PCI_MSI_FLAGS , &control); + +switch (type) { +case PCI_CAP_ID_MSI : + control &= ~PCI_MSI_FLAGS_ENABLE ; +break ; +case PCI_CAP_ID_MSIX : + control &= ~PCI_MSIX_FLAGS_ENABLE ; +break ; +default : +BUG (); + } + +pci_write_config_word (pdev, pos +PCI_MSI_FLAGS , control); + +return ; +}
include/asm-powerpc/machdep.h +6 -0
@@ -30,6 +30,9 @@ struct pci_controller;#ifdef CONFIG_KEXEC struct kimage ;#endif +#ifdef CONFIG_PCI_MSI +struct ppc_msi_ops ; +#endif #ifdef CONFIG_SMP struct smp_ops_t {
@@ -111,6 +114,9 @@ struct machdep_calls {void (*pcibios_fixup)(void );int (*pci_probe_mode)(struct pci_bus *);void (*pci_irq_fixup)(struct pci_dev *dev); +#ifdef CONFIG_PCI_MSI +struct ppc_msi_ops * (*get_msi_ops)(struct pci_dev *pdev); +#endif /* To setup PHBs when using automatic OF platform driver for PCI */ int (*pci_setup_phb)(struct pci_controller *host);
include/asm-powerpc/msi.h new file +173 -0
173 lines not on this page · raw message
include/linux/pci.h +7 -0
@@ -107,6 +107,10 @@ struct pci_cap_saved_state {u32 data[0 ]; }; +#if defined(CONFIG_PCI_MSI ) && defined(CONFIG_PPC_MERGE ) +struct msi_info ; +#endif +/* * The pci_dev structure is used to describe PCI devices. */
@@ -174,6 +178,9 @@ struct pci_dev {struct bin_attribute *rom_attr;/* attribute descriptor for sysfs ROM entry */ int rom_attr_enabled;/* has display of the rom attribute been enabled? */ struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE ];/* sysfs file for resources */ +#if defined(CONFIG_PCI_MSI ) && defined(CONFIG_PPC_MERGE ) +struct msi_info *msi_info; +#endif };#define pci_dev_g (n) list_entry(n, struct pci_dev, global_list)
PATCH 4/9 Enable MSI on Powerpc
In reply to Michael EllermanAllow PCI_MSI to build on Powerpc.
We still need CONFIG_POWERPC.
---
arch/powerpc/kernel/Makefile | 5 +++++ drivers/pci/Kconfig | 2 +- drivers/pci/Makefile | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-)
arch/powerpc/kernel/Makefile +5 -0
@@ -65,6 +65,11 @@ obj-$(CONFIG_MODULES) += $(module-y) pci64-$(CONFIG_PPC64) += pci_64.o pci_dn.o pci32-$(CONFIG_PPC32) := pci_32.o obj-$(CONFIG_PCI) += $(pci64-y) $(pci32-y) + +msiobj-y := msi.o +msiobj-$(CONFIG_PPC_RTAS) += msi-rtas.o +obj-$(CONFIG_PCI_MSI) += $(msiobj-y) + kexec-$(CONFIG_PPC64) := machine_kexec_64.o kexec-$(CONFIG_PPC32) := machine_kexec_32.o obj-$(CONFIG_KEXEC) += machine_kexec.o crash.o $(kexec-y)
drivers/pci/Kconfig +1 -1
@@ -4,7 +4,7 @@ config PCI_MSI bool "Message Signaled Interrupts (MSI and MSI-X)" depends on PCI - depends on (X86_LOCAL_APIC && X86_IO_APIC) || IA64 + depends on (X86_LOCAL_APIC && X86_IO_APIC) || IA64 || PPC_MERGE help This allows device drivers to enable MSI (Message Signaled Interrupts). Message Signaled Interrupts enable a device to
drivers/pci/Makefile +3 -1
@@ -14,8 +14,10 @@ obj-$(CONFIG_HOTPLUG) += hotplug.o # Build the PCI Hotplug drivers if we were asked to obj-$(CONFIG_HOTPLUG_PCI) += hotplug/ -# Build the PCI MSI interrupt support +# Build the PCI MSI interrupt support, but not for arch/powerpc +ifndef CONFIG_PPC_MERGE obj-$(CONFIG_PCI_MSI) += msi.o +endif # Build the Hypertransport interrupt support obj-$(CONFIG_HT_IRQ) += htirq.o
PATCH 5/9 RTAS MSI implementation
In reply to Michael EllermanPowerpc MSI support via RTAS. Based on Jake's code.
---
arch/powerpc/kernel/msi-rtas.c | 265 +++++++++++++++++++++++++++++++++++++++++ include/asm-powerpc/msi.h | 6 2 files changed, 271 insertions(+)
arch/powerpc/kernel/msi-rtas.c new file +265 -0
@@ -0,0 +1,265 @@ +/* +* Copyright (C) 2006 Jake Moilanen <[email protected]>, IBM Corp. +* Copyright (C) 2006 Michael Ellerman, IBM Corp. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 of the +* License. +* +*/ + +#undef DEBUG + +#include <linux/irq.h> +#include <asm/msi.h> +#include <asm/rtas.h> +#include <asm/hw_irq.h> +#include <asm/ppc-pci.h> + +static int query_token, change_token; + +#define RTAS_QUERY_MSI_FN 0 +#define RTAS_CHANGE_MSI_FN 1 +#define RTAS_RESET_MSI_FN 2 + + +static struct pci_dn *get_pdn (struct pci_dev *pdev) +{ +struct device_node *dn; +struct pci_dn *pdn; + + dn =pci_device_to_OF_node (pdev); +if (!dn) { +msi_debug ("No OF device node for %s\n" ,pci_name (pdev)); +return NULL ; + } + + pdn =PCI_DN (dn); +if (!pdn) { +msi_debug ("No PCI DN for %s\n" ,pci_name (pdev)); +return NULL ; + } + +return pdn; +} + +/* RTAS Helpers */ + +static int rtas_change_msi (struct pci_dn *pdn,u32 function,u32 num_irqs) +{ +u32 addr, seq_num, rtas_ret[2 ]; +unsigned long buid; +int rc; + + addr =rtas_config_addr (pdn->busno, pdn->devfn,0 ); + buid = pdn->phb->buid; + + seq_num =1 ; +do { + rc =rtas_call (change_token,6 ,3 , rtas_ret, addr, +BUID_HI (buid),BUID_LO (buid), + function, num_irqs, seq_num); + + seq_num = rtas_ret[1 ]; + }while (rtas_busy_delay (rc)); + +if (rc) { +msi_debug ("error (%d) for %s\n" , rc,pci_name (pdn->pcidev)); +return rc; + } + +return rtas_ret[0 ]; +} + +static int rtas_query_irq_number (struct pci_dn *pdn,int offset) +{ +u32 addr, rtas_ret[2 ]; +unsigned long buid; +int rc; + + addr =rtas_config_addr (pdn->busno, pdn->devfn,0 ); + buid = pdn->phb->buid; + +do { + rc =rtas_call (query_token,4 ,3 , rtas_ret, addr, +BUID_HI (buid),BUID_LO (buid), offset); + }while (rtas_busy_delay (rc)); + +if (rc) { +msi_debug ("error (%d) querying source number for %s\n" , + rc,pci_name (pdn->pcidev)); +return rc; + } + +return rtas_ret[0 ]; +} + +/* +* The spec gives firmware the option to enable either MSI or MSI-X, +* this doesn't wash with the Linux API. For the time beinging, we +* kludge around that by checking ourselves the right type is enabled. +*/ +static int check_msi_type (struct pci_dev *pdev,int type) +{ +int pos, msi_enabled, msix_enabled; +u16 reg; + + pos =pci_find_capability (pdev,PCI_CAP_ID_MSI ); +if (!pos) { +msi_debug ("cap (%d) not found for %s\n" , type,pci_name (pdev)); +return -1 ; + } + +pci_read_config_word (pdev, pos +PCI_MSI_FLAGS , ®); + + msi_enabled = msix_enabled =0 ; + +if (reg &PCI_MSI_FLAGS_ENABLE ) + msi_enabled =1 ; + +if (reg &PCI_MSIX_FLAGS_ENABLE ) + msix_enabled =1 ; + +if (type ==PCI_CAP_ID_MSI && (msix_enabled || !msi_enabled)) { +msi_debug ("Expected MSI but got %s.\n" , + msix_enabled ?"MSI-X" :"none" ); +return -1 ; + } + +if (type ==PCI_CAP_ID_MSIX && (msi_enabled || !msix_enabled)) { +msi_debug ("Expected MSI-X but got %s.\n" , + msi_enabled ?"MSI" :"none" ); +return -1 ; + } + +return 0 ; +} + +static void msi_rtas_free (struct pci_dev *pdev,int num, +struct msix_entry *entries,int type) +{ +struct pci_dn *pdn; +int i; + + pdn =get_pdn (pdev); +if (!pdn) +return ; + +for (i =0 ; i < num; i++) { +irq_dispose_mapping (entries[i].vector); + } + +if (rtas_change_msi (pdn,RTAS_CHANGE_MSI_FN ,0 ) !=0 ) { +msi_debug ("Setting MSIs to 0 failed!\n" ); +BUG (); + } +} + +static int msi_rtas_check (struct pci_dev *pdev,int num, +struct msix_entry *entries,int type) +{ +struct device_node *dn; +int i; + +/* We must have a pci_dn for the RTAS code. */ +if (!get_pdn (pdev)) +return -1 ; + + dn =pci_device_to_OF_node (pdev); +if (!of_find_property (dn,"ibm,req#msi" ,NULL )) { +msi_debug ("No ibm,req#msi for %s\n" ,pci_name (pdev)); +return -1 ; + } + +/* +* Firmware gives us no control over which entries are allocated +* for MSI-X, it seems to assume we want 0 - n. For now just insist +* that the entries array entry members are 0 - n. +*/ +for (i =0 ; i < num; i++) { +if (entries[i].entry != i) { +msi_debug ("entries[%d].entry (%d) != %d\n" , i, + entries[i].entry, i); +return -1 ; + } + } + +return 0 ; +} + +static int msi_rtas_alloc (struct pci_dev *pdev,int num, +struct msix_entry *entries,int type) +{ +struct pci_dn *pdn; +int hwirq, virq, i; + + pdn =get_pdn (pdev); +if (!pdn) +return -1 ; + +/* +* In the case of an error it's not clear whether the device is left +* with MSI enabled or not, I think we should explicitly disable. +*/ +if (rtas_change_msi (pdn,RTAS_CHANGE_MSI_FN , num) != num) { +msi_debug ("rtas_change_msi() failed for %s\n" ,pci_name (pdev)); + goto out_free; + } + +if (check_msi_type (pdev, type)) + goto out_free; + +for (i =0 ; i < num; i++) { + hwirq =rtas_query_irq_number (pdn, i); +if (hwirq <0 ) { +msi_debug ("error (%d) getting hwirq for %s\n" , + hwirq,pci_name (pdev)); + goto out_free; + } + + virq =irq_create_mapping (NULL , hwirq); + +if (virq ==NO_IRQ ) { +msi_debug ("Failed mapping hwirq %d\n" , hwirq); + goto out_free; + } + + entries[i].vector = virq; + } + +return 0 ; + + out_free: +msi_rtas_free (pdev, num, entries, type); +return -1 ; +} + +static struct ppc_msi_ops rtas_msi_ops = { + .check = msi_rtas_check, + .alloc = msi_rtas_alloc, + .free = msi_rtas_free +}; + +static struct ppc_msi_ops *rtas_get_msi_ops (struct pci_dev *pdev) +{ +return &rtas_msi_ops; +} + +int msi_rtas_init (void ) +{ + query_token =rtas_token ("ibm,query-interrupt-source-number" ); + change_token =rtas_token ("ibm,change-msi" ); + +if ((query_token ==RTAS_UNKNOWN_SERVICE ) || + (change_token ==RTAS_UNKNOWN_SERVICE )) { +msi_debug ("Couldn't find RTAS tokens, no MSI support.\n" ); +return -1 ; + } + +msi_debug ("Registering RTAS MSI ops.\n" ); + + ppc_md.get_msi_ops = rtas_get_msi_ops; + +return 0 ; +}
include/asm-powerpc/msi.h +6 -0
@@ -168,6 +168,12 @@ extern void msi_raw_disable(struct pci_d #define msi_debug(fmt, args...) \ pr_debug("MSI:%s:%d: " fmt, __FUNCTION__, __LINE__, ## args) +#ifdef CONFIG_PCI_MSI +extern int msi_rtas_init (void ); +#else +static inline int msi_rtas_init (void ) {return -1 ; }; +#endif +#endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_MSI_H */
PATCH 6/9 MPIC MSI allocator
In reply to Michael EllermanTo support MSI on MPIC we need a way to reserve and allocate hardware irq numbers, this patch implements an allocator for that. It looks like we'll end up with several backends based on the MPIC, so the allocator is attached to the struct mpic, not the msi backend.
---
arch/powerpc/sysdev/Makefile | 5 + arch/powerpc/sysdev/mpic.c | 4 + arch/powerpc/sysdev/mpic.h | 30 +++++++ arch/powerpc/sysdev/mpic_msi.c | 160 +++++++++++++++++++++++++++++++++++++++++ include/asm-powerpc/mpic.h | 5 + 5 files changed, 203 insertions(+), 1 deletion(-)
arch/powerpc/sysdev/Makefile +4 -1
@@ -2,7 +2,10 @@ ifeq ($(CONFIG_PPC64),y) EXTRA_CFLAGS += -mno-minimal-toc endif -obj-$(CONFIG_MPIC) += mpic.o +mpic-obj-y := mpic.o +mpic-obj-$(CONFIG_PCI_MSI) += mpic_msi.o +obj-$(CONFIG_MPIC) += $(mpic-obj-y) + obj-$(CONFIG_PPC_INDIRECT_PCI) += indirect_pci.o obj-$(CONFIG_PPC_MPC106) += grackle.o obj-$(CONFIG_PPC_DCR) += dcr.o dcr-low.o
arch/powerpc/sysdev/mpic.c +4 -0
@@ -36,6 +36,8 @@#include <asm/mpic.h> #include <asm/smp.h> +#include "mpic.h" +#ifdef DEBUG #define DBG(fmt...) printk(fmt)#else
@@ -825,6 +827,8 @@ static int mpic_host_map(struct irq_hostif (hw >= mpic->irq_count)return -EINVAL ; +mpic_msi_reserve_hwirq (mpic, hw); +/* Default chip */ chip = &mpic->hc_irq;
arch/powerpc/sysdev/mpic.h new file +30 -0
@@ -0,0 +1,30 @@ +#ifndef _POWERPC_SYSDEV_MPIC_H +#define _POWERPC_SYSDEV_MPIC_H + +/* +* Copyright (C) 2006 Michael Ellerman, IBM Corp. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 of the +* License. +* +*/ + +#include <linux/bitmap.h> +#include <asm/msi.h> + +#ifdef CONFIG_PCI_MSI +extern int mpic_msi_init_allocator (struct mpic *mpic); +extern void mpic_msi_reserve_hwirq (struct mpic *mpic,irq_hw_number_t hwirq); +extern irq_hw_number_t mpic_msi_alloc_hwirqs (struct mpic *mpic,int num); +extern void mpic_msi_free_hwirqs (struct mpic *mpic,int offset,int num); +#else +static inline void mpic_msi_reserve_hwirq (struct mpic *mpic, +irq_hw_number_t hwirq) +{ +return ; +} +#endif + +#endif /* _POWERPC_SYSDEV_MPIC_H */
arch/powerpc/sysdev/mpic_msi.c new file +160 -0
160 lines not on this page · raw message
include/asm-powerpc/mpic.h +5 -0
@@ -300,6 +300,11 @@ struct mpicu32 *hw_set;#endif +#ifdef CONFIG_PCI_MSI +spinlock_t bitmap_lock; +unsigned long *hwirq_bitmap; +#endif +/* link */ struct mpic *next; };
Re: [PATCH 6/9] MPIC MSI allocator
Quoted 7 lines · On Wed, 13 Dec 2006 21:40:03 +1100 Michael Ellerman <[email protected]>…
To support MSI on MPIC we need a way to reserve and allocate hardware irq numbers, this patch implements an allocator for that. It looks like we'll end up with several backends based on the MPIC, so the allocator is attached to the struct mpic, not the msi backend.
Signed-off-by Michael Ellerman <[email protected]>
arch/powerpc/sysdev/mpic_msi.c line 85
Quoted 9 lines
arch/powerpc/sysdev/mpic_msi.c new file +9
-0+static void mpic_msi_auto_reserve_hwirqs (struct mpic *mpic) +{ +irq_hw_number_t hwirq; +struct irq_host_ops *ops = mpic->irqhost->ops; +struct device_node *np; +int flags, index, i; +struct of_irq oirq; + +/* Reserve source numbers we know are reserved in the HW */
How do we know? Reserved on what HW? Sure looks system/platform dependent to me.
arch/powerpc/sysdev/mpic_msi.c line 88
Quoted 3 lines
arch/powerpc/sysdev/mpic_msi.c new file +3
-0+for (i =0 ; i <8 ; i++) +__mpic_msi_reserve_hwirq (mpic, i); +for (i =42 ; i <26 ; i++)
^^^^^^^^^^^^^^^
Is this some sort of check to see if we're awake? :)
arch/powerpc/sysdev/mpic_msi.c line 91
Quoted 3 lines
arch/powerpc/sysdev/mpic_msi.c new file +3
-0+__mpic_msi_reserve_hwirq (mpic, i); +for (i =100 ; i <105 ; i++) +__mpic_msi_reserve_hwirq (mpic, i);
-Olof
Re: [PATCH 6/9] MPIC MSI allocator
Quoted 22 lines · Olof Johansson
Quoted 7 lines · On Wed, 13 Dec 2006 21:40:03 +1100 Michael Ellerman <[email protected]>…
To support MSI on MPIC we need a way to reserve and allocate hardware irq numbers, this patch implements an allocator for that. It looks like we'll end up with several backends based on the MPIC, so the allocator is attached to the struct mpic, not the msi backend.
Signed-off-by Michael Ellerman <[email protected]>arch/powerpc/sysdev/mpic_msi.c line 85
Quoted 9 lines
arch/powerpc/sysdev/mpic_msi.c new file +9
-0+static void mpic_msi_auto_reserve_hwirqs (struct mpic *mpic) +{ +irq_hw_number_t hwirq; +struct irq_host_ops *ops = mpic->irqhost->ops; +struct device_node *np; +int flags, index, i; +struct of_irq oirq; + +/* Reserve source numbers we know are reserved in the HW */ How do we know? Reserved on what HW? Sure looks system/platform dependent to me.
Quoted 6 lines
arch/powerpc/sysdev/mpic_msi.c line 88
Quoted 3 lines
arch/powerpc/sysdev/mpic_msi.c new file +3
-0+for (i =0 ; i <8 ; i++) +__mpic_msi_reserve_hwirq (mpic, i); +for (i =42 ; i <26 ; i++)^^^^^^^^^^^^^^^Is this some sort of check to see if we're awake? :)
This code in MPIC currently is only ever used on U3/U4 and so that code reserves IRQs we know are used for U3/U4 internal IRQs and not available for HT interrupts (or MSIs). The code, then, does a second pass also exclusing all IRQs for all devices in the device-tree.
This is a "hack" that works until device-trees provide the right property we have defined for mpic to indicate what range of irqs is to be used for MSIs.
Ben.
Re: [PATCH 6/9] MPIC MSI allocator
Quoted 8 lines · On Thu, 14 Dec 2006 10:25:44 +1100 Benjamin Herrenschmidt…
This code in MPIC currently is only ever used on U3/U4 and so that code reserves IRQs we know are used for U3/U4 internal IRQs and not available for HT interrupts (or MSIs). The code, then, does a second pass also exclusing all IRQs for all devices in the device-tree.
This is a "hack" that works until device-trees provide the right property we have defined for mpic to indicate what range of irqs is to be used for MSIs.
So make the platform register the range of (possibly) usable MSI addresses instead of adding a nasty hack like that to the mpic driver.
Adding numeric constants like that (completely without comments as to where they came from) in a function called mpic_msi_auto_reserve_hwirqs() is just too ugly.
-Olof
Re: [PATCH 6/9] MPIC MSI allocator
Quoted 3 lines
So make the platform register the range of (possibly) usable MSI addresses instead of adding a nasty hack like that to the mpic driver.
The hack is not that nasty... it's only ever run on U3/U4 on which it's actually correct, at least if Michael did what I told him to do which is to test the MPIC_BROKEN_U3 bit :-)
Quoted 3 lines
Adding numeric constants like that (completely without comments as to where they came from) in a function called
mpic_msi_auto_reserve_hwirqs()is just too ugly.
Yes, it should be mpic_msi_reserve_u3u4_irqs() or something like that.
Ben.
Re: [PATCH 6/9] MPIC MSI allocator
Quoted 6 lines · Benjamin Herrenschmidt
Quoted 2 lines
So make the platform register the range of (possibly) usable MSI addresses instead of adding a nasty hack like that to the mpic driver.
The hack is not that nasty... it's only ever run on U3/U4 on which it's actually correct, at least if Michael did what I told him to do which is to test the
MPIC_BROKEN_U3bit :-)
Nah I didn't make it U3/U4 specific, although I could. If we do that, then I think the logic needs to be:
if get_property("msi_available")
mpic_msi_reserve_dt_irqs()
elif is_u3_or_u4()
mpic_msi_reserve_u3u4_irqs()
else
return error
Because if we don't have a firmware property, and we don't make an educated guess at what's reserved, then there's a very good chance our first MSI will get hwirq 0 and that it won't work.
As far as putting hacks in the MPIC driver .. have you read it lately? ;) But seriously, I think if there's anyway these magic numbers should be, it is in this code, not the platform code.
cheers
Signature · 8 lines
Michael Ellerman OzLabs, IBM Australia Development Lab wwweb: http://michael.ellerman.id.au phone: +61 2 6212 1183 (tie line 70 21183) We do not inherit the earth from our ancestors, we borrow it from our children. - S.M.A.R.T Person
Re: [PATCH 6/9] MPIC MSI allocator
Quoted 3 lines
if
get_property("msi_available")
mpic_msi_reserve_dt_irqs()
available-msi is a better name now that I think of it, or better even:
"msi-ranges"
Quoted 5 lines
elif
is_u3_or_u4()mpic_msi_reserve_u3u4_irqs()else
return error
Quoted 7 lines
Because if we don't have a firmware property, and we don't make an educated guess at what's reserved, then there's a very good chance our first MSI will get hwirq 0 and that it won't work.
As far as putting hacks in the MPIC driver .. have you read it lately? ;) But seriously, I think if there's anyway these magic numbers should be, it is in this code, not the platform code.
Ben.
Re: [PATCH 6/9] MPIC MSI allocator
Quoted 5 lines · Benjamin Herrenschmidt
Quoted 2 lines
if
get_property("msi_available")
mpic_msi_reserve_dt_irqs()available-msi is a better name now that I think of it, or better even:
"msi-ranges"
"msi-ranges" is ambiguous, are the ranges available or reserved?
How about "msi-available-ranges" :D
cheers
Signature · 8 lines
Michael Ellerman OzLabs, IBM Australia Development Lab wwweb: http://michael.ellerman.id.au phone: +61 2 6212 1183 (tie line 70 21183) We do not inherit the earth from our ancestors, we borrow it from our children. - S.M.A.R.T Person
Re: [PATCH 6/9] MPIC MSI allocator
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
if
get_property("msi_available")
mpic_msi_reserve_dt_irqs()available-msi is a better name now that I think of it, or better even:
"msi-ranges""msi-ranges" is ambiguous, are the ranges available or reserved?
How about "msi-available-ranges" :D
The property describes vectors that are not (yet) in use by the hardware; so let's do "available-vectors"?
Segher
Re: [PATCH 6/9] MPIC MSI allocator
Quoted 7 lines · Segher Boessenkool
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
if
get_property("msi_available")
mpic_msi_reserve_dt_irqs()available-msi is a better name now that I think of it, or better even:
"msi-ranges"
Quoted 6 lines
Quoted 3 lines
"msi-ranges" is ambiguous, are the ranges available or reserved?
How about "msi-available-ranges" :D
The property describes vectors that are not (yet) in use by the hardware; so let's do "available-vectors"?
If we are going to be pedantic, it should be msi-available-sources :-)
Ben.
Re: [PATCH 6/9] MPIC MSI allocator
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
"msi-ranges" is ambiguous, are the ranges available or reserved?
How about "msi-available-ranges" :D
The property describes vectors that are not (yet) in use by the hardware; so let's do "available-vectors"?
If we are going to be pedantic, it should be msi-available-sources :-)
But a) it's not really MSI-only, and b) they're not source numbers, but delivery vector numbers (yeah, those are almost the same on U3/U4, but hey).
Segher
Re: [PATCH 6/9] MPIC MSI allocator
Quoted 4 lines · Segher Boessenkool
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
"msi-ranges" is ambiguous, are the ranges available or reserved?
How about "msi-available-ranges" :D
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
The property describes vectors that are not (yet) in use by the hardware; so let's do "available-vectors"?
If we are going to be pedantic, it should be msi-available-sources :-)
But a) it's not really MSI-only, and b) they're not source numbers, but delivery vector numbers (yeah, those are almost the same on U3/U4, but hey).
OK I'm gonna lock you two in a padded room, and whoever comes out alive gets to name the property, OK? Then let me know what it is and I'll update the freakin code!
:D
cheers
Signature · 8 lines
Michael Ellerman OzLabs, IBM Australia Development Lab wwweb: http://michael.ellerman.id.au phone: +61 2 6212 1183 (tie line 70 21183) We do not inherit the earth from our ancestors, we borrow it from our children. - S.M.A.R.T Person
Re: [PATCH 6/9] MPIC MSI allocator
In reply to Segher BoessenkoolQuoted 4 lines · Segher Boessenkool
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
"msi-ranges" is ambiguous, are the ranges available or reserved?
How about "msi-available-ranges" :D
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
The property describes vectors that are not (yet) in use by the hardware; so let's do "available-vectors"?
If we are going to be pedantic, it should be msi-available-sources :-)
But a) it's not really MSI-only, and b) they're not source numbers, but delivery vector numbers (yeah, those are almost the same on U3/U4, but hey).
Actually, they aren't vector numbers, those are what you program in the MPIC itself to be emited. Thus they are source numbers according to the last time I read the docs :-) Not that it matters anyway :-)
Ben.
Re: [PATCH 6/9] MPIC MSI allocator
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
If we are going to be pedantic, it should be msi-available-sources :-)
But a) it's not really MSI-only, and b) they're not source numbers, but delivery vector numbers (yeah, those are almost the same on U3/U4, but hey).
Actually, they aren't vector numbers, those are what you program in the MPIC itself to be emited. Thus they are source numbers according to the last time I read the docs :-) Not that it matters anyway :-)
Yeah, my bad.
So how about:
"available-interrupts" denotes the input numbers to an interrupt controller that the OS can freely assign. This naming fits in well with the other interrupt property names, and the semantics are nicely generic.
"msi-ranges", if present, denotes the ranges of input interrupt numbers that can be used for MSIs (does this fit what you need well, Olof?)
Segher
Re: [PATCH 6/9] MPIC MSI allocator
Quoted 3 lines · On Fri, 15 Dec 2006 03:58:57 +0100 Segher Boessenkool…
"msi-ranges", if present, denotes the ranges of input interrupt numbers that can be used for MSIs (does this fit what you need well, Olof?)
Yep, sounds good to me!
-Olof
Re: [PATCH 6/9] MPIC MSI allocator
In reply to Michael EllermanQuoted 6 lines · On Thu, 14 Dec 2006 11:59:00 +1100 Michael Ellerman <[email protected]>…
Nah I didn't make it U3/U4 specific, although I could. If we do that, then I think the logic needs to be:
if
get_property("msi_available")
mpic_msi_reserve_dt_irqs()
elifis_u3_or_u4()
Quoted 7 lines
mpic_msi_reserve_u3u4_irqs()else
return errorBecause if we don't have a firmware property, and we don't make an educated guess at what's reserved, then there's a very good chance our first MSI will get hwirq 0 and that it won't work.
Looks like a good solution to me.
Quoted 3 lines
As far as putting hacks in the MPIC driver .. have you read it lately? ;) But seriously, I think if there's anyway these magic numbers should be, it is in this code, not the platform code.
It used to be fairly OK, but the TSI merge really pushed it over the edge, obfuscation-wise. :(
But that's no excuse to make it worse than it has to be.
-Olof
Re: [PATCH 6/9] MPIC MSI allocator
In reply to Olof JohanssonQuoted 9 lines · Olof Johansson
Quoted 6 lines · On Wed, 13 Dec 2006 21:40:03 +1100 Michael Ellerman <[email protected]>…
To support MSI on MPIC we need a way to reserve and allocate hardware irq numbers, this patch implements an allocator for that. It looks like we'll end up with several backends based on the MPIC, so the allocator is attached to the struct mpic, not the msi backend.
Signed-off-by Michael Ellerman <[email protected]>
Quoted 12 lines
arch/powerpc/sysdev/mpic_msi.c line 85
Quoted 9 lines
arch/powerpc/sysdev/mpic_msi.c new file +9
-0+static void mpic_msi_auto_reserve_hwirqs (struct mpic *mpic) +{ +irq_hw_number_t hwirq; +struct irq_host_ops *ops = mpic->irqhost->ops; +struct device_node *np; +int flags, index, i; +struct of_irq oirq; + +/* Reserve source numbers we know are reserved in the HW */ How do we know? Reserved on what HW? Sure looks system/platform dependent to me.
I agree. It's a fall-back position, we first check for the "msi-available" property, and if that's not there we try to guess. New firmwares should define "msi-available", but we don't want to wait for that to happen, if it really bothers you we could have a CONFIG_MPIC_MSI_DODGY_ALLOCATOR_GUESSING_ENABLE :)
So 0-7, 42-45 and 100-104 are known to be reserved on various revisions of MPIC (and if there's more we can add them), and then we go through the whole device tree and reserve anything that's already got an irq mapped.
Quoted 7 lines
arch/powerpc/sysdev/mpic_msi.c line 88
Quoted 4 lines
arch/powerpc/sysdev/mpic_msi.c new file +3
-0+for (i =0 ; i <8 ; i++) +__mpic_msi_reserve_hwirq (mpic, i); +for (i =42 ; i <26 ; i++)^^^^^^^^^^^^^^^Is this some sort of check to see if we're awake? :)
Hehe. No it's proof that I wasn't awake when I wrote it, that's late night hacking for you :)
cheers
Signature · 8 lines
Michael Ellerman OzLabs, IBM Australia Development Lab wwweb: http://michael.ellerman.id.au phone: +61 2 6212 1183 (tie line 70 21183) We do not inherit the earth from our ancestors, we borrow it from our children. - S.M.A.R.T Person
PATCH 7/9 MPIC MSI backend
In reply to Michael EllermanMPIC MSI backend. Based on code from Segher, heavily hacked by me. Renamed to mpic_htmsi, as it only deals with MSI over Hypertransport.
We properly discover the HT magic address by reading the config space. Now have an irq allocator we can support > 1 MSI, and we don't reuse the LSI.
Tested, succesfully getting MSIs from the tg3 via HT/PCI-X on a JS21 running SLOF. Successive insmod/rmmods working too.
---
arch/powerpc/sysdev/Makefile | 2 arch/powerpc/sysdev/mpic.h | 7 + arch/powerpc/sysdev/mpic_htmsi.c | 193 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 201 insertions(+), 1 deletion(-)
arch/powerpc/sysdev/Makefile +1 -1
@@ -3,7 +3,7 @@ EXTRA_CFLAGS += -mno-minimal-toc endif mpic-obj-y := mpic.o -mpic-obj-$(CONFIG_PCI_MSI) += mpic_msi.o +mpic-obj-$(CONFIG_PCI_MSI) += mpic_msi.o mpic_htmsi.o obj-$(CONFIG_MPIC) += $(mpic-obj-y) obj-$(CONFIG_PPC_INDIRECT_PCI) += indirect_pci.o
arch/powerpc/sysdev/mpic.h +7 -0
@@ -15,11 +15,18 @@#include <asm/msi.h> #ifdef CONFIG_PCI_MSI +extern int mpic_htmsi_init (struct mpic *mpic); +extern int mpic_msi_init_allocator (struct mpic *mpic);extern void mpic_msi_reserve_hwirq (struct mpic *mpic,irq_hw_number_t hwirq);extern irq_hw_number_t mpic_msi_alloc_hwirqs (struct mpic *mpic,int num);extern void mpic_msi_free_hwirqs (struct mpic *mpic,int offset,int num);#else +static inline int mpic_htmsi_init (struct mpic *mpic) +{ +return -1 ; +} +static inline void mpic_msi_reserve_hwirq (struct mpic *mpic,irq_hw_number_t hwirq) {
arch/powerpc/sysdev/mpic_htmsi.c new file +193 -0
193 lines not on this page · raw message
PATCH 8/9 Activate MSI on Powerpc
In reply to Michael EllermanHook up a few platforms to use the appropriate MSI backend.
---
arch/powerpc/platforms/pseries/setup.c | 2 ++ arch/powerpc/sysdev/mpic.c | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-)
arch/powerpc/platforms/pseries/setup.c +2 -0
@@ -65,6 +65,7 @@#include <asm/i8259.h> #include <asm/udbg.h> #include <asm/smp.h> +#include <asm/msi.h> #include "plpar_wrappers.h" #include "ras.h"
@@ -284,6 +285,7 @@ static void __init pseries_discover_pic(#ifdef CONFIG_SMP smp_init_pseries_xics ();#endif +msi_rtas_init ();return ; } }
arch/powerpc/sysdev/mpic.c +4 -2
@@ -1126,8 +1126,10 @@ void __init mpic_init(struct mpic *mpic)/* Do the HT PIC fixups on U3 broken mpic */ DBG ("MPIC flags: %x\n" , mpic->flags); -if ((mpic->flags &MPIC_BROKEN_U3 ) && (mpic->flags &MPIC_PRIMARY )) -mpic_scan_ht_pics (mpic); +if ((mpic->flags &MPIC_BROKEN_U3 ) && (mpic->flags &MPIC_PRIMARY )) { +mpic_scan_ht_pics (mpic); +mpic_htmsi_init (mpic); + }for (i =0 ; i < mpic->num_sources; i++) {/* start with vector = source number, and masked */
PATCH 9/9 Enable MSI mappings for MPIC
In reply to Michael EllermanOn some Apple machines the HT MSI mappings are not enabled by firmware, so we need to do it by hand.
---
arch/powerpc/sysdev/mpic.c | 49 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-)
arch/powerpc/sysdev/mpic.c +47 -2
@@ -377,7 +377,51 @@ static void mpic_shutdown_ht_interrupt(sspin_unlock_irqrestore (&mpic->fixup_lock, flags); } -static void __init mpic_scan_ht_pic (struct mpic *mpic,u8 __iomem *devbase, +#ifdef CONFIG_PCI_MSI +static void __init mpic_setup_ht_msi (struct mpic *mpic,u8 __iomem *devbase, +unsigned int devfn) +{ +u8 __iomem *base; +u8 pos, flags; +u64 addr =0 ; + +for (pos =readb (devbase +PCI_CAPABILITY_LIST ); pos !=0 ; + pos =readb (devbase + pos +PCI_CAP_LIST_NEXT )) { +u8 id =readb (devbase + pos +PCI_CAP_LIST_ID ); +if (id ==PCI_CAP_ID_HT ) { + id =readb (devbase + pos +3 ); +if ((id &0xF8 ) ==HT_CAPTYPE_MSI_MAPPING ) +break ; + } + } + +if (pos ==0 ) +return ; + + base = devbase + pos; + + flags =readb (base +HT_MSI_FLAGS ); +if (!(flags &HT_MSI_FLAGS_FIXED )) { + addr =readl (base +HT_MSI_ADDR_LO ) &HT_MSI_ADDR_LO_MASK ; + addr = addr | ((u64 )readl (base +HT_MSI_ADDR_HI ) <<32 ); + } + +printk (KERN_INFO "mpic: - HT:%02x.%x %s MSI mapping found @ 0x%lx\n" , +PCI_SLOT (devfn),PCI_FUNC (devfn), + flags &HT_MSI_FLAGS_ENABLE ?"enabled" :"disabled" , addr); + +if (!(flags &HT_MSI_FLAGS_ENABLE )) +writeb (flags |HT_MSI_FLAGS_ENABLE , base +HT_MSI_FLAGS ); +} +#else +static void __init mpic_setup_ht_msi (struct mpic *mpic,u8 __iomem *devbase, +unsigned int devfn) +{ +return ; +} +#endif + +static void __init mpic_setup_ht_pic (struct mpic *mpic,u8 __iomem *devbase,unsigned int devfn,u32 vdid) {int i, irq, n;
@@ -467,7 +511,8 @@ static void __init mpic_scan_ht_pics(strif (!(s &PCI_STATUS_CAP_LIST )) goto next; -mpic_scan_ht_pic (mpic, devbase, devfn, l); +mpic_setup_ht_pic (mpic, devbase, devfn, l); +mpic_setup_ht_msi (mpic, devbase, devfn); next:/* next device, if function 0 */