diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /drivers/misc/sgi-xp/xpc_uv.c | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'drivers/misc/sgi-xp/xpc_uv.c')
-rw-r--r-- | drivers/misc/sgi-xp/xpc_uv.c | 88 |
1 files changed, 21 insertions, 67 deletions
diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c index b9e2000969f..17bbacb1b4b 100644 --- a/drivers/misc/sgi-xp/xpc_uv.c +++ b/drivers/misc/sgi-xp/xpc_uv.c | |||
@@ -18,8 +18,6 @@ | |||
18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
19 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
21 | #include <linux/cpu.h> | ||
22 | #include <linux/module.h> | ||
23 | #include <linux/err.h> | 21 | #include <linux/err.h> |
24 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
25 | #include <asm/uv/uv_hub.h> | 23 | #include <asm/uv/uv_hub.h> |
@@ -61,8 +59,6 @@ static struct xpc_heartbeat_uv *xpc_heartbeat_uv; | |||
61 | XPC_NOTIFY_MSG_SIZE_UV) | 59 | XPC_NOTIFY_MSG_SIZE_UV) |
62 | #define XPC_NOTIFY_IRQ_NAME "xpc_notify" | 60 | #define XPC_NOTIFY_IRQ_NAME "xpc_notify" |
63 | 61 | ||
64 | static int xpc_mq_node = -1; | ||
65 | |||
66 | static struct xpc_gru_mq_uv *xpc_activate_mq_uv; | 62 | static struct xpc_gru_mq_uv *xpc_activate_mq_uv; |
67 | static struct xpc_gru_mq_uv *xpc_notify_mq_uv; | 63 | static struct xpc_gru_mq_uv *xpc_notify_mq_uv; |
68 | 64 | ||
@@ -113,8 +109,11 @@ xpc_get_gru_mq_irq_uv(struct xpc_gru_mq_uv *mq, int cpu, char *irq_name) | |||
113 | #if defined CONFIG_X86_64 | 109 | #if defined CONFIG_X86_64 |
114 | mq->irq = uv_setup_irq(irq_name, cpu, mq->mmr_blade, mq->mmr_offset, | 110 | mq->irq = uv_setup_irq(irq_name, cpu, mq->mmr_blade, mq->mmr_offset, |
115 | UV_AFFINITY_CPU); | 111 | UV_AFFINITY_CPU); |
116 | if (mq->irq < 0) | 112 | if (mq->irq < 0) { |
113 | dev_err(xpc_part, "uv_setup_irq() returned error=%d\n", | ||
114 | -mq->irq); | ||
117 | return mq->irq; | 115 | return mq->irq; |
116 | } | ||
118 | 117 | ||
119 | mq->mmr_value = uv_read_global_mmr64(mmr_pnode, mq->mmr_offset); | 118 | mq->mmr_value = uv_read_global_mmr64(mmr_pnode, mq->mmr_offset); |
120 | 119 | ||
@@ -239,9 +238,8 @@ xpc_create_gru_mq_uv(unsigned int mq_size, int cpu, char *irq_name, | |||
239 | mq->mmr_blade = uv_cpu_to_blade_id(cpu); | 238 | mq->mmr_blade = uv_cpu_to_blade_id(cpu); |
240 | 239 | ||
241 | nid = cpu_to_node(cpu); | 240 | nid = cpu_to_node(cpu); |
242 | page = alloc_pages_exact_node(nid, | 241 | page = alloc_pages_exact_node(nid, GFP_KERNEL | __GFP_ZERO | GFP_THISNODE, |
243 | GFP_KERNEL | __GFP_ZERO | GFP_THISNODE, | 242 | pg_order); |
244 | pg_order); | ||
245 | if (page == NULL) { | 243 | if (page == NULL) { |
246 | dev_err(xpc_part, "xpc_create_gru_mq_uv() failed to alloc %d " | 244 | dev_err(xpc_part, "xpc_create_gru_mq_uv() failed to alloc %d " |
247 | "bytes of memory on nid=%d for GRU mq\n", mq_size, nid); | 245 | "bytes of memory on nid=%d for GRU mq\n", mq_size, nid); |
@@ -454,9 +452,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part, | |||
454 | 452 | ||
455 | if (msg->activate_gru_mq_desc_gpa != | 453 | if (msg->activate_gru_mq_desc_gpa != |
456 | part_uv->activate_gru_mq_desc_gpa) { | 454 | part_uv->activate_gru_mq_desc_gpa) { |
457 | spin_lock(&part_uv->flags_lock); | 455 | spin_lock_irqsave(&part_uv->flags_lock, irq_flags); |
458 | part_uv->flags &= ~XPC_P_CACHED_ACTIVATE_GRU_MQ_DESC_UV; | 456 | part_uv->flags &= ~XPC_P_CACHED_ACTIVATE_GRU_MQ_DESC_UV; |
459 | spin_unlock(&part_uv->flags_lock); | 457 | spin_unlock_irqrestore(&part_uv->flags_lock, irq_flags); |
460 | part_uv->activate_gru_mq_desc_gpa = | 458 | part_uv->activate_gru_mq_desc_gpa = |
461 | msg->activate_gru_mq_desc_gpa; | 459 | msg->activate_gru_mq_desc_gpa; |
462 | } | 460 | } |
@@ -1733,50 +1731,9 @@ static struct xpc_arch_operations xpc_arch_ops_uv = { | |||
1733 | .notify_senders_of_disconnect = xpc_notify_senders_of_disconnect_uv, | 1731 | .notify_senders_of_disconnect = xpc_notify_senders_of_disconnect_uv, |
1734 | }; | 1732 | }; |
1735 | 1733 | ||
1736 | static int | ||
1737 | xpc_init_mq_node(int nid) | ||
1738 | { | ||
1739 | int cpu; | ||
1740 | |||
1741 | get_online_cpus(); | ||
1742 | |||
1743 | for_each_cpu(cpu, cpumask_of_node(nid)) { | ||
1744 | xpc_activate_mq_uv = | ||
1745 | xpc_create_gru_mq_uv(XPC_ACTIVATE_MQ_SIZE_UV, nid, | ||
1746 | XPC_ACTIVATE_IRQ_NAME, | ||
1747 | xpc_handle_activate_IRQ_uv); | ||
1748 | if (!IS_ERR(xpc_activate_mq_uv)) | ||
1749 | break; | ||
1750 | } | ||
1751 | if (IS_ERR(xpc_activate_mq_uv)) { | ||
1752 | put_online_cpus(); | ||
1753 | return PTR_ERR(xpc_activate_mq_uv); | ||
1754 | } | ||
1755 | |||
1756 | for_each_cpu(cpu, cpumask_of_node(nid)) { | ||
1757 | xpc_notify_mq_uv = | ||
1758 | xpc_create_gru_mq_uv(XPC_NOTIFY_MQ_SIZE_UV, nid, | ||
1759 | XPC_NOTIFY_IRQ_NAME, | ||
1760 | xpc_handle_notify_IRQ_uv); | ||
1761 | if (!IS_ERR(xpc_notify_mq_uv)) | ||
1762 | break; | ||
1763 | } | ||
1764 | if (IS_ERR(xpc_notify_mq_uv)) { | ||
1765 | xpc_destroy_gru_mq_uv(xpc_activate_mq_uv); | ||
1766 | put_online_cpus(); | ||
1767 | return PTR_ERR(xpc_notify_mq_uv); | ||
1768 | } | ||
1769 | |||
1770 | put_online_cpus(); | ||
1771 | return 0; | ||
1772 | } | ||
1773 | |||
1774 | int | 1734 | int |
1775 | xpc_init_uv(void) | 1735 | xpc_init_uv(void) |
1776 | { | 1736 | { |
1777 | int nid; | ||
1778 | int ret = 0; | ||
1779 | |||
1780 | xpc_arch_ops = xpc_arch_ops_uv; | 1737 | xpc_arch_ops = xpc_arch_ops_uv; |
1781 | 1738 | ||
1782 | if (sizeof(struct xpc_notify_mq_msghdr_uv) > XPC_MSG_HDR_MAX_SIZE) { | 1739 | if (sizeof(struct xpc_notify_mq_msghdr_uv) > XPC_MSG_HDR_MAX_SIZE) { |
@@ -1785,21 +1742,21 @@ xpc_init_uv(void) | |||
1785 | return -E2BIG; | 1742 | return -E2BIG; |
1786 | } | 1743 | } |
1787 | 1744 | ||
1788 | if (xpc_mq_node < 0) | 1745 | xpc_activate_mq_uv = xpc_create_gru_mq_uv(XPC_ACTIVATE_MQ_SIZE_UV, 0, |
1789 | for_each_online_node(nid) { | 1746 | XPC_ACTIVATE_IRQ_NAME, |
1790 | ret = xpc_init_mq_node(nid); | 1747 | xpc_handle_activate_IRQ_uv); |
1791 | 1748 | if (IS_ERR(xpc_activate_mq_uv)) | |
1792 | if (!ret) | 1749 | return PTR_ERR(xpc_activate_mq_uv); |
1793 | break; | ||
1794 | } | ||
1795 | else | ||
1796 | ret = xpc_init_mq_node(xpc_mq_node); | ||
1797 | 1750 | ||
1798 | if (ret < 0) | 1751 | xpc_notify_mq_uv = xpc_create_gru_mq_uv(XPC_NOTIFY_MQ_SIZE_UV, 0, |
1799 | dev_err(xpc_part, "xpc_init_mq_node() returned error=%d\n", | 1752 | XPC_NOTIFY_IRQ_NAME, |
1800 | -ret); | 1753 | xpc_handle_notify_IRQ_uv); |
1754 | if (IS_ERR(xpc_notify_mq_uv)) { | ||
1755 | xpc_destroy_gru_mq_uv(xpc_activate_mq_uv); | ||
1756 | return PTR_ERR(xpc_notify_mq_uv); | ||
1757 | } | ||
1801 | 1758 | ||
1802 | return ret; | 1759 | return 0; |
1803 | } | 1760 | } |
1804 | 1761 | ||
1805 | void | 1762 | void |
@@ -1808,6 +1765,3 @@ xpc_exit_uv(void) | |||
1808 | xpc_destroy_gru_mq_uv(xpc_notify_mq_uv); | 1765 | xpc_destroy_gru_mq_uv(xpc_notify_mq_uv); |
1809 | xpc_destroy_gru_mq_uv(xpc_activate_mq_uv); | 1766 | xpc_destroy_gru_mq_uv(xpc_activate_mq_uv); |
1810 | } | 1767 | } |
1811 | |||
1812 | module_param(xpc_mq_node, int, 0); | ||
1813 | MODULE_PARM_DESC(xpc_mq_node, "Node number on which to allocate message queues."); | ||