diff options
Diffstat (limited to 'drivers/misc/sgi-xp/xpc_uv.c')
| -rw-r--r-- | drivers/misc/sgi-xp/xpc_uv.c | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c index b5bbe59f9c57..8725d5e8ab0c 100644 --- a/drivers/misc/sgi-xp/xpc_uv.c +++ b/drivers/misc/sgi-xp/xpc_uv.c | |||
| @@ -157,22 +157,24 @@ xpc_gru_mq_watchlist_alloc_uv(struct xpc_gru_mq_uv *mq) | |||
| 157 | { | 157 | { |
| 158 | int ret; | 158 | int ret; |
| 159 | 159 | ||
| 160 | #if defined CONFIG_X86_64 | 160 | #if defined CONFIG_IA64_GENERIC || defined CONFIG_IA64_SGI_UV |
| 161 | ret = uv_bios_mq_watchlist_alloc(mq->mmr_blade, uv_gpa(mq->address), | 161 | int mmr_pnode = uv_blade_to_pnode(mq->mmr_blade); |
| 162 | mq->order, &mq->mmr_offset); | 162 | |
| 163 | if (ret < 0) { | 163 | ret = sn_mq_watchlist_alloc(mmr_pnode, (void *)uv_gpa(mq->address), |
| 164 | dev_err(xpc_part, "uv_bios_mq_watchlist_alloc() failed, " | ||
| 165 | "ret=%d\n", ret); | ||
| 166 | return ret; | ||
| 167 | } | ||
| 168 | #elif defined CONFIG_IA64_GENERIC || defined CONFIG_IA64_SGI_UV | ||
| 169 | ret = sn_mq_watchlist_alloc(mq->mmr_blade, (void *)uv_gpa(mq->address), | ||
| 170 | mq->order, &mq->mmr_offset); | 164 | mq->order, &mq->mmr_offset); |
| 171 | if (ret < 0) { | 165 | if (ret < 0) { |
| 172 | dev_err(xpc_part, "sn_mq_watchlist_alloc() failed, ret=%d\n", | 166 | dev_err(xpc_part, "sn_mq_watchlist_alloc() failed, ret=%d\n", |
| 173 | ret); | 167 | ret); |
| 174 | return -EBUSY; | 168 | return -EBUSY; |
| 175 | } | 169 | } |
| 170 | #elif defined CONFIG_X86_64 | ||
| 171 | ret = uv_bios_mq_watchlist_alloc(uv_gpa(mq->address), | ||
| 172 | mq->order, &mq->mmr_offset); | ||
| 173 | if (ret < 0) { | ||
| 174 | dev_err(xpc_part, "uv_bios_mq_watchlist_alloc() failed, " | ||
| 175 | "ret=%d\n", ret); | ||
| 176 | return ret; | ||
| 177 | } | ||
| 176 | #else | 178 | #else |
| 177 | #error not a supported configuration | 179 | #error not a supported configuration |
| 178 | #endif | 180 | #endif |
| @@ -185,12 +187,13 @@ static void | |||
| 185 | xpc_gru_mq_watchlist_free_uv(struct xpc_gru_mq_uv *mq) | 187 | xpc_gru_mq_watchlist_free_uv(struct xpc_gru_mq_uv *mq) |
| 186 | { | 188 | { |
| 187 | int ret; | 189 | int ret; |
| 190 | int mmr_pnode = uv_blade_to_pnode(mq->mmr_blade); | ||
| 188 | 191 | ||
| 189 | #if defined CONFIG_X86_64 | 192 | #if defined CONFIG_X86_64 |
| 190 | ret = uv_bios_mq_watchlist_free(mq->mmr_blade, mq->watchlist_num); | 193 | ret = uv_bios_mq_watchlist_free(mmr_pnode, mq->watchlist_num); |
| 191 | BUG_ON(ret != BIOS_STATUS_SUCCESS); | 194 | BUG_ON(ret != BIOS_STATUS_SUCCESS); |
| 192 | #elif defined CONFIG_IA64_GENERIC || defined CONFIG_IA64_SGI_UV | 195 | #elif defined CONFIG_IA64_GENERIC || defined CONFIG_IA64_SGI_UV |
| 193 | ret = sn_mq_watchlist_free(mq->mmr_blade, mq->watchlist_num); | 196 | ret = sn_mq_watchlist_free(mmr_pnode, mq->watchlist_num); |
| 194 | BUG_ON(ret != SALRET_OK); | 197 | BUG_ON(ret != SALRET_OK); |
| 195 | #else | 198 | #else |
| 196 | #error not a supported configuration | 199 | #error not a supported configuration |
| @@ -204,6 +207,7 @@ xpc_create_gru_mq_uv(unsigned int mq_size, int cpu, char *irq_name, | |||
| 204 | enum xp_retval xp_ret; | 207 | enum xp_retval xp_ret; |
| 205 | int ret; | 208 | int ret; |
| 206 | int nid; | 209 | int nid; |
| 210 | int nasid; | ||
| 207 | int pg_order; | 211 | int pg_order; |
| 208 | struct page *page; | 212 | struct page *page; |
| 209 | struct xpc_gru_mq_uv *mq; | 213 | struct xpc_gru_mq_uv *mq; |
| @@ -259,9 +263,11 @@ xpc_create_gru_mq_uv(unsigned int mq_size, int cpu, char *irq_name, | |||
| 259 | goto out_5; | 263 | goto out_5; |
| 260 | } | 264 | } |
| 261 | 265 | ||
| 266 | nasid = UV_PNODE_TO_NASID(uv_cpu_to_pnode(cpu)); | ||
| 267 | |||
| 262 | mmr_value = (struct uv_IO_APIC_route_entry *)&mq->mmr_value; | 268 | mmr_value = (struct uv_IO_APIC_route_entry *)&mq->mmr_value; |
| 263 | ret = gru_create_message_queue(mq->gru_mq_desc, mq->address, mq_size, | 269 | ret = gru_create_message_queue(mq->gru_mq_desc, mq->address, mq_size, |
| 264 | nid, mmr_value->vector, mmr_value->dest); | 270 | nasid, mmr_value->vector, mmr_value->dest); |
| 265 | if (ret != 0) { | 271 | if (ret != 0) { |
| 266 | dev_err(xpc_part, "gru_create_message_queue() returned " | 272 | dev_err(xpc_part, "gru_create_message_queue() returned " |
| 267 | "error=%d\n", ret); | 273 | "error=%d\n", ret); |
| @@ -946,11 +952,13 @@ xpc_get_fifo_entry_uv(struct xpc_fifo_head_uv *head) | |||
| 946 | head->first = first->next; | 952 | head->first = first->next; |
| 947 | if (head->first == NULL) | 953 | if (head->first == NULL) |
| 948 | head->last = NULL; | 954 | head->last = NULL; |
| 955 | |||
| 956 | head->n_entries--; | ||
| 957 | BUG_ON(head->n_entries < 0); | ||
| 958 | |||
| 959 | first->next = NULL; | ||
| 949 | } | 960 | } |
| 950 | head->n_entries--; | ||
| 951 | BUG_ON(head->n_entries < 0); | ||
| 952 | spin_unlock_irqrestore(&head->lock, irq_flags); | 961 | spin_unlock_irqrestore(&head->lock, irq_flags); |
| 953 | first->next = NULL; | ||
| 954 | return first; | 962 | return first; |
| 955 | } | 963 | } |
| 956 | 964 | ||
| @@ -1019,7 +1027,8 @@ xpc_make_first_contact_uv(struct xpc_partition *part) | |||
| 1019 | xpc_send_activate_IRQ_part_uv(part, &msg, sizeof(msg), | 1027 | xpc_send_activate_IRQ_part_uv(part, &msg, sizeof(msg), |
| 1020 | XPC_ACTIVATE_MQ_MSG_SYNC_ACT_STATE_UV); | 1028 | XPC_ACTIVATE_MQ_MSG_SYNC_ACT_STATE_UV); |
| 1021 | 1029 | ||
| 1022 | while (part->sn.uv.remote_act_state != XPC_P_AS_ACTIVATING) { | 1030 | while (!((part->sn.uv.remote_act_state == XPC_P_AS_ACTIVATING) || |
| 1031 | (part->sn.uv.remote_act_state == XPC_P_AS_ACTIVE))) { | ||
| 1023 | 1032 | ||
| 1024 | dev_dbg(xpc_part, "waiting to make first contact with " | 1033 | dev_dbg(xpc_part, "waiting to make first contact with " |
| 1025 | "partition %d\n", XPC_PARTID(part)); | 1034 | "partition %d\n", XPC_PARTID(part)); |
| @@ -1422,7 +1431,6 @@ xpc_handle_notify_mq_msg_uv(struct xpc_partition *part, | |||
| 1422 | msg_slot = ch_uv->recv_msg_slots + | 1431 | msg_slot = ch_uv->recv_msg_slots + |
| 1423 | (msg->hdr.msg_slot_number % ch->remote_nentries) * ch->entry_size; | 1432 | (msg->hdr.msg_slot_number % ch->remote_nentries) * ch->entry_size; |
| 1424 | 1433 | ||
| 1425 | BUG_ON(msg->hdr.msg_slot_number != msg_slot->hdr.msg_slot_number); | ||
| 1426 | BUG_ON(msg_slot->hdr.size != 0); | 1434 | BUG_ON(msg_slot->hdr.size != 0); |
| 1427 | 1435 | ||
| 1428 | memcpy(msg_slot, msg, msg->hdr.size); | 1436 | memcpy(msg_slot, msg, msg->hdr.size); |
| @@ -1646,8 +1654,6 @@ xpc_received_payload_uv(struct xpc_channel *ch, void *payload) | |||
| 1646 | sizeof(struct xpc_notify_mq_msghdr_uv)); | 1654 | sizeof(struct xpc_notify_mq_msghdr_uv)); |
| 1647 | if (ret != xpSuccess) | 1655 | if (ret != xpSuccess) |
| 1648 | XPC_DEACTIVATE_PARTITION(&xpc_partitions[ch->partid], ret); | 1656 | XPC_DEACTIVATE_PARTITION(&xpc_partitions[ch->partid], ret); |
| 1649 | |||
| 1650 | msg->hdr.msg_slot_number += ch->remote_nentries; | ||
| 1651 | } | 1657 | } |
| 1652 | 1658 | ||
| 1653 | static struct xpc_arch_operations xpc_arch_ops_uv = { | 1659 | static struct xpc_arch_operations xpc_arch_ops_uv = { |
