forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/misc/sgi-xp/xpc_uv.c
....@@ -22,11 +22,12 @@
2222 #include <linux/module.h>
2323 #include <linux/err.h>
2424 #include <linux/slab.h>
25
+#include <linux/numa.h>
2526 #include <asm/uv/uv_hub.h>
2627 #if defined CONFIG_X86_64
2728 #include <asm/uv/bios.h>
2829 #include <asm/uv/uv_irq.h>
29
-#elif defined CONFIG_IA64_GENERIC || defined CONFIG_IA64_SGI_UV
30
+#elif defined CONFIG_IA64_SGI_UV
3031 #include <asm/sn/intr.h>
3132 #include <asm/sn/sn_sal.h>
3233 #endif
....@@ -34,7 +35,7 @@
3435 #include "../sgi-gru/grukservices.h"
3536 #include "xpc.h"
3637
37
-#if defined CONFIG_IA64_GENERIC || defined CONFIG_IA64_SGI_UV
38
+#if defined CONFIG_IA64_SGI_UV
3839 struct uv_IO_APIC_route_entry {
3940 __u64 vector : 8,
4041 delivery_mode : 3,
....@@ -47,6 +48,8 @@
4748 __reserved_2 : 15,
4849 dest : 32;
4950 };
51
+
52
+#define sn_partition_id 0
5053 #endif
5154
5255 static struct xpc_heartbeat_uv *xpc_heartbeat_uv;
....@@ -61,7 +64,7 @@
6164 XPC_NOTIFY_MSG_SIZE_UV)
6265 #define XPC_NOTIFY_IRQ_NAME "xpc_notify"
6366
64
-static int xpc_mq_node = -1;
67
+static int xpc_mq_node = NUMA_NO_NODE;
6568
6669 static struct xpc_gru_mq_uv *xpc_activate_mq_uv;
6770 static struct xpc_gru_mq_uv *xpc_notify_mq_uv;
....@@ -118,7 +121,7 @@
118121
119122 mq->mmr_value = uv_read_global_mmr64(mmr_pnode, mq->mmr_offset);
120123
121
-#elif defined CONFIG_IA64_GENERIC || defined CONFIG_IA64_SGI_UV
124
+#elif defined CONFIG_IA64_SGI_UV
122125 if (strcmp(irq_name, XPC_ACTIVATE_IRQ_NAME) == 0)
123126 mq->irq = SGI_XPC_ACTIVATE;
124127 else if (strcmp(irq_name, XPC_NOTIFY_IRQ_NAME) == 0)
....@@ -141,7 +144,7 @@
141144 #if defined CONFIG_X86_64
142145 uv_teardown_irq(mq->irq);
143146
144
-#elif defined CONFIG_IA64_GENERIC || defined CONFIG_IA64_SGI_UV
147
+#elif defined CONFIG_IA64_SGI_UV
145148 int mmr_pnode;
146149 unsigned long mmr_value;
147150
....@@ -159,7 +162,7 @@
159162 {
160163 int ret;
161164
162
-#if defined CONFIG_IA64_GENERIC || defined CONFIG_IA64_SGI_UV
165
+#if defined CONFIG_IA64_SGI_UV
163166 int mmr_pnode = uv_blade_to_pnode(mq->mmr_blade);
164167
165168 ret = sn_mq_watchlist_alloc(mmr_pnode, (void *)uv_gpa(mq->address),
....@@ -194,7 +197,7 @@
194197 #if defined CONFIG_X86_64
195198 ret = uv_bios_mq_watchlist_free(mmr_pnode, mq->watchlist_num);
196199 BUG_ON(ret != BIOS_STATUS_SUCCESS);
197
-#elif defined CONFIG_IA64_GENERIC || defined CONFIG_IA64_SGI_UV
200
+#elif defined CONFIG_IA64_SGI_UV
198201 ret = sn_mq_watchlist_free(mmr_pnode, mq->watchlist_num);
199202 BUG_ON(ret != SALRET_OK);
200203 #else
....@@ -571,6 +574,7 @@
571574
572575 xpc_wakeup_channel_mgr(part);
573576 }
577
+ fallthrough;
574578 case XPC_ACTIVATE_MQ_MSG_MARK_ENGAGED_UV:
575579 spin_lock_irqsave(&part_uv->flags_lock, irq_flags);
576580 part_uv->flags |= XPC_P_ENGAGED_UV;
....@@ -692,7 +696,7 @@
692696 if (gru_mq_desc == NULL) {
693697 gru_mq_desc = kmalloc(sizeof(struct
694698 gru_message_queue_desc),
695
- GFP_KERNEL);
699
+ GFP_ATOMIC);
696700 if (gru_mq_desc == NULL) {
697701 ret = xpNoMemory;
698702 goto done;
....@@ -792,7 +796,7 @@
792796 else
793797 ret = xpBiosError;
794798
795
-#elif defined CONFIG_IA64_GENERIC || defined CONFIG_IA64_SGI_UV
799
+#elif defined CONFIG_IA64_SGI_UV
796800 status = sn_partition_reserved_page_pa((u64)buf, cookie, rp_pa, len);
797801 if (status == SALRET_OK)
798802 ret = xpSuccess;
....@@ -1183,7 +1187,7 @@
11831187 {
11841188 struct xpc_channel_uv *ch_uv = &ch->sn.uv;
11851189
1186
- DBUG_ON(!spin_is_locked(&ch->lock));
1190
+ lockdep_assert_held(&ch->lock);
11871191
11881192 kfree(ch_uv->cached_notify_gru_mq_desc);
11891193 ch_uv->cached_notify_gru_mq_desc = NULL;
....@@ -1676,7 +1680,7 @@
16761680 XPC_DEACTIVATE_PARTITION(&xpc_partitions[ch->partid], ret);
16771681 }
16781682
1679
-static struct xpc_arch_operations xpc_arch_ops_uv = {
1683
+static const struct xpc_arch_operations xpc_arch_ops_uv = {
16801684 .setup_partitions = xpc_setup_partitions_uv,
16811685 .teardown_partitions = xpc_teardown_partitions_uv,
16821686 .process_activate_IRQ_rcvd = xpc_process_activate_IRQ_rcvd_uv,