Commit d66ac475 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6

* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6:
  [SPARC64]: Fix several bugs in MSI handling.
  [SPARC64]: Fix type and constant sizes wrt. sun4u IMAP/ICLR handling.
parents 0ee13079 5f92c329
...@@ -217,8 +217,27 @@ struct irq_handler_data { ...@@ -217,8 +217,27 @@ struct irq_handler_data {
void (*pre_handler)(unsigned int, void *, void *); void (*pre_handler)(unsigned int, void *, void *);
void *pre_handler_arg1; void *pre_handler_arg1;
void *pre_handler_arg2; void *pre_handler_arg2;
u32 msi;
}; };
void sparc64_set_msi(unsigned int virt_irq, u32 msi)
{
struct irq_handler_data *data = get_irq_chip_data(virt_irq);
if (data)
data->msi = msi;
}
u32 sparc64_get_msi(unsigned int virt_irq)
{
struct irq_handler_data *data = get_irq_chip_data(virt_irq);
if (data)
return data->msi;
return 0xffffffff;
}
static inline struct ino_bucket *virt_irq_to_bucket(unsigned int virt_irq) static inline struct ino_bucket *virt_irq_to_bucket(unsigned int virt_irq)
{ {
unsigned int real_irq = virt_to_real_irq(virt_irq); unsigned int real_irq = virt_to_real_irq(virt_irq);
...@@ -308,7 +327,7 @@ static void sun4u_irq_disable(unsigned int virt_irq) ...@@ -308,7 +327,7 @@ static void sun4u_irq_disable(unsigned int virt_irq)
if (likely(data)) { if (likely(data)) {
unsigned long imap = data->imap; unsigned long imap = data->imap;
u32 tmp = upa_readq(imap); unsigned long tmp = upa_readq(imap);
tmp &= ~IMAP_VALID; tmp &= ~IMAP_VALID;
upa_writeq(tmp, imap); upa_writeq(tmp, imap);
...@@ -741,7 +760,7 @@ unsigned int sun4v_build_msi(u32 devhandle, unsigned int *virt_irq_p, ...@@ -741,7 +760,7 @@ unsigned int sun4v_build_msi(u32 devhandle, unsigned int *virt_irq_p,
break; break;
} }
if (devino >= msi_end) if (devino >= msi_end)
return 0; return -ENOSPC;
sysino = sun4v_devino_to_sysino(devhandle, devino); sysino = sun4v_devino_to_sysino(devhandle, devino);
bucket = &ivector_table[sysino]; bucket = &ivector_table[sysino];
...@@ -755,8 +774,8 @@ unsigned int sun4v_build_msi(u32 devhandle, unsigned int *virt_irq_p, ...@@ -755,8 +774,8 @@ unsigned int sun4v_build_msi(u32 devhandle, unsigned int *virt_irq_p,
data = kzalloc(sizeof(struct irq_handler_data), GFP_ATOMIC); data = kzalloc(sizeof(struct irq_handler_data), GFP_ATOMIC);
if (unlikely(!data)) { if (unlikely(!data)) {
prom_printf("IRQ: kzalloc(irq_handler_data) failed.\n"); virt_irq_free(*virt_irq_p);
prom_halt(); return -ENOMEM;
} }
set_irq_chip_data(bucket->virt_irq, data); set_irq_chip_data(bucket->virt_irq, data);
......
...@@ -393,7 +393,6 @@ struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm, ...@@ -393,7 +393,6 @@ struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
sd->host_controller = pbm; sd->host_controller = pbm;
sd->prom_node = node; sd->prom_node = node;
sd->op = of_find_device_by_node(node); sd->op = of_find_device_by_node(node);
sd->msi_num = 0xffffffff;
sd = &sd->op->dev.archdata; sd = &sd->op->dev.archdata;
sd->iommu = pbm->iommu; sd->iommu = pbm->iommu;
......
...@@ -940,13 +940,13 @@ static int pci_sun4v_setup_msi_irq(unsigned int *virt_irq_p, ...@@ -940,13 +940,13 @@ static int pci_sun4v_setup_msi_irq(unsigned int *virt_irq_p,
if (msi_num < 0) if (msi_num < 0)
return msi_num; return msi_num;
devino = sun4v_build_msi(pbm->devhandle, virt_irq_p, err = sun4v_build_msi(pbm->devhandle, virt_irq_p,
pbm->msiq_first_devino, pbm->msiq_first_devino,
(pbm->msiq_first_devino + (pbm->msiq_first_devino +
pbm->msiq_num)); pbm->msiq_num));
err = -ENOMEM; if (err < 0)
if (!devino)
goto out_err; goto out_err;
devino = err;
msiqid = ((devino - pbm->msiq_first_devino) + msiqid = ((devino - pbm->msiq_first_devino) +
pbm->msiq_first); pbm->msiq_first);
...@@ -971,7 +971,7 @@ static int pci_sun4v_setup_msi_irq(unsigned int *virt_irq_p, ...@@ -971,7 +971,7 @@ static int pci_sun4v_setup_msi_irq(unsigned int *virt_irq_p,
if (pci_sun4v_msi_setvalid(pbm->devhandle, msi_num, HV_MSIVALID_VALID)) if (pci_sun4v_msi_setvalid(pbm->devhandle, msi_num, HV_MSIVALID_VALID))
goto out_err; goto out_err;
pdev->dev.archdata.msi_num = msi_num; sparc64_set_msi(*virt_irq_p, msi_num);
if (entry->msi_attrib.is_64) { if (entry->msi_attrib.is_64) {
msg.address_hi = pbm->msi64_start >> 32; msg.address_hi = pbm->msi64_start >> 32;
...@@ -993,8 +993,6 @@ static int pci_sun4v_setup_msi_irq(unsigned int *virt_irq_p, ...@@ -993,8 +993,6 @@ static int pci_sun4v_setup_msi_irq(unsigned int *virt_irq_p,
out_err: out_err:
free_msi(pbm, msi_num); free_msi(pbm, msi_num);
sun4v_destroy_msi(*virt_irq_p);
*virt_irq_p = 0;
return err; return err;
} }
...@@ -1006,7 +1004,7 @@ static void pci_sun4v_teardown_msi_irq(unsigned int virt_irq, ...@@ -1006,7 +1004,7 @@ static void pci_sun4v_teardown_msi_irq(unsigned int virt_irq,
unsigned long msiqid, err; unsigned long msiqid, err;
unsigned int msi_num; unsigned int msi_num;
msi_num = pdev->dev.archdata.msi_num; msi_num = sparc64_get_msi(virt_irq);
err = pci_sun4v_msi_getmsiq(pbm->devhandle, msi_num, &msiqid); err = pci_sun4v_msi_getmsiq(pbm->devhandle, msi_num, &msiqid);
if (err) { if (err) {
printk(KERN_ERR "%s: getmsiq gives error %lu\n", printk(KERN_ERR "%s: getmsiq gives error %lu\n",
......
...@@ -16,8 +16,6 @@ struct dev_archdata { ...@@ -16,8 +16,6 @@ struct dev_archdata {
struct device_node *prom_node; struct device_node *prom_node;
struct of_device *op; struct of_device *op;
unsigned int msi_num;
}; };
#endif /* _ASM_SPARC64_DEVICE_H */ #endif /* _ASM_SPARC64_DEVICE_H */
...@@ -16,21 +16,21 @@ ...@@ -16,21 +16,21 @@
#include <asm/ptrace.h> #include <asm/ptrace.h>
/* IMAP/ICLR register defines */ /* IMAP/ICLR register defines */
#define IMAP_VALID 0x80000000 /* IRQ Enabled */ #define IMAP_VALID 0x80000000UL /* IRQ Enabled */
#define IMAP_TID_UPA 0x7c000000 /* UPA TargetID */ #define IMAP_TID_UPA 0x7c000000UL /* UPA TargetID */
#define IMAP_TID_JBUS 0x7c000000 /* JBUS TargetID */ #define IMAP_TID_JBUS 0x7c000000UL /* JBUS TargetID */
#define IMAP_TID_SHIFT 26 #define IMAP_TID_SHIFT 26
#define IMAP_AID_SAFARI 0x7c000000 /* Safari AgentID */ #define IMAP_AID_SAFARI 0x7c000000UL /* Safari AgentID */
#define IMAP_AID_SHIFT 26 #define IMAP_AID_SHIFT 26
#define IMAP_NID_SAFARI 0x03e00000 /* Safari NodeID */ #define IMAP_NID_SAFARI 0x03e00000UL /* Safari NodeID */
#define IMAP_NID_SHIFT 21 #define IMAP_NID_SHIFT 21
#define IMAP_IGN 0x000007c0 /* IRQ Group Number */ #define IMAP_IGN 0x000007c0UL /* IRQ Group Number */
#define IMAP_INO 0x0000003f /* IRQ Number */ #define IMAP_INO 0x0000003fUL /* IRQ Number */
#define IMAP_INR 0x000007ff /* Full interrupt number*/ #define IMAP_INR 0x000007ffUL /* Full interrupt number*/
#define ICLR_IDLE 0x00000000 /* Idle state */ #define ICLR_IDLE 0x00000000UL /* Idle state */
#define ICLR_TRANSMIT 0x00000001 /* Transmit state */ #define ICLR_TRANSMIT 0x00000001UL /* Transmit state */
#define ICLR_PENDING 0x00000003 /* Pending state */ #define ICLR_PENDING 0x00000003UL /* Pending state */
/* The largest number of unique interrupt sources we support. /* The largest number of unique interrupt sources we support.
* If this needs to ever be larger than 255, you need to change * If this needs to ever be larger than 255, you need to change
...@@ -53,6 +53,9 @@ extern unsigned int sun4v_build_msi(u32 devhandle, unsigned int *virt_irq_p, ...@@ -53,6 +53,9 @@ extern unsigned int sun4v_build_msi(u32 devhandle, unsigned int *virt_irq_p,
extern void sun4v_destroy_msi(unsigned int virt_irq); extern void sun4v_destroy_msi(unsigned int virt_irq);
extern unsigned int sbus_build_irq(void *sbus, unsigned int ino); extern unsigned int sbus_build_irq(void *sbus, unsigned int ino);
extern void sparc64_set_msi(unsigned int virt_irq, u32 msi);
extern u32 sparc64_get_msi(unsigned int virt_irq);
extern void fixup_irqs(void); extern void fixup_irqs(void);
static __inline__ void set_softint(unsigned long bits) static __inline__ void set_softint(unsigned long bits)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment