drivers/misc/sgi-xp/xpc_uv.c
Source file repositories/reference/linux-study-clean/drivers/misc/sgi-xp/xpc_uv.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/misc/sgi-xp/xpc_uv.c- Extension
.c- Size
- 45653 bytes
- Lines
- 1729
- Domain
- Driver Families
- Bucket
- drivers/misc
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/mm.hlinux/interrupt.hlinux/delay.hlinux/device.hlinux/cpu.hlinux/module.hlinux/err.hlinux/slab.hlinux/numa.hasm/uv/uv_hub.hasm/uv/bios.hasm/uv/uv_irq.h../sgi-gru/gru.h../sgi-gru/grukservices.hxpc.h
Detected Declarations
function xpc_setup_partitions_uvfunction xpc_teardown_partitions_uvfunction xpc_get_gru_mq_irq_uvfunction xpc_release_gru_mq_irq_uvfunction xpc_gru_mq_watchlist_alloc_uvfunction xpc_gru_mq_watchlist_free_uvfunction xpc_create_gru_mq_uvfunction xpc_destroy_gru_mq_uvfunction xpc_send_gru_msgfunction xpc_process_activate_IRQ_rcvd_uvfunction xpc_handle_activate_mq_msg_uvfunction xpc_handle_activate_IRQ_uvfunction xpc_cache_remote_gru_mq_desc_uvfunction xpc_send_activate_IRQ_uvfunction xpc_send_activate_IRQ_part_uvfunction xpc_send_activate_IRQ_ch_uvfunction xpc_send_local_activate_IRQ_uvfunction xpc_get_partition_rsvd_page_pa_uvfunction xpc_setup_rsvd_page_uvfunction xpc_allow_hb_uvfunction xpc_offline_heartbeat_uvfunction xpc_online_heartbeat_uvfunction xpc_heartbeat_init_uvfunction xpc_heartbeat_exit_uvfunction xpc_get_remote_heartbeat_uvfunction xpc_request_partition_activation_uvfunction xpc_request_partition_reactivation_uvfunction xpc_request_partition_deactivation_uvfunction xpc_cancel_partition_deactivation_request_uvfunction xpc_init_fifo_uvfunction xpc_get_fifo_entry_uvfunction xpc_put_fifo_entry_uvfunction xpc_n_of_fifo_entries_uvfunction xpc_setup_ch_structures_uvfunction xpc_teardown_ch_structures_uvfunction xpc_make_first_contact_uvfunction xpc_get_chctl_all_flags_uvfunction xpc_allocate_send_msg_slot_uvfunction xpc_allocate_recv_msg_slot_uvfunction xpc_setup_msg_structures_uvfunction xpc_teardown_msg_structures_uvfunction xpc_send_chctl_closerequest_uvfunction xpc_send_chctl_closereply_uvfunction xpc_send_chctl_openrequest_uvfunction xpc_send_chctl_openreply_uvfunction xpc_send_chctl_opencomplete_uvfunction xpc_send_chctl_local_msgrequest_uvfunction xpc_save_remote_msgqueue_pa_uv
Annotated Snippet
if (part_uv->cached_activate_gru_mq_desc != NULL) {
mutex_lock(&part_uv->cached_activate_gru_mq_desc_mutex);
spin_lock_irqsave(&part_uv->flags_lock, irq_flags);
part_uv->flags &= ~XPC_P_CACHED_ACTIVATE_GRU_MQ_DESC_UV;
spin_unlock_irqrestore(&part_uv->flags_lock, irq_flags);
kfree(part_uv->cached_activate_gru_mq_desc);
part_uv->cached_activate_gru_mq_desc = NULL;
mutex_unlock(&part_uv->
cached_activate_gru_mq_desc_mutex);
}
}
}
static int
xpc_get_gru_mq_irq_uv(struct xpc_gru_mq_uv *mq, int cpu, char *irq_name)
{
int mmr_pnode = uv_blade_to_pnode(mq->mmr_blade);
mq->irq = uv_setup_irq(irq_name, cpu, mq->mmr_blade, mq->mmr_offset,
UV_AFFINITY_CPU);
if (mq->irq < 0)
return mq->irq;
mq->mmr_value = uv_read_global_mmr64(mmr_pnode, mq->mmr_offset);
return 0;
}
static void
xpc_release_gru_mq_irq_uv(struct xpc_gru_mq_uv *mq)
{
uv_teardown_irq(mq->irq);
}
static int
xpc_gru_mq_watchlist_alloc_uv(struct xpc_gru_mq_uv *mq)
{
int ret;
ret = uv_bios_mq_watchlist_alloc(uv_gpa(mq->address),
mq->order, &mq->mmr_offset);
if (ret < 0) {
dev_err(xpc_part, "uv_bios_mq_watchlist_alloc() failed, "
"ret=%d\n", ret);
return ret;
}
mq->watchlist_num = ret;
return 0;
}
static void
xpc_gru_mq_watchlist_free_uv(struct xpc_gru_mq_uv *mq)
{
int ret;
int mmr_pnode = uv_blade_to_pnode(mq->mmr_blade);
ret = uv_bios_mq_watchlist_free(mmr_pnode, mq->watchlist_num);
BUG_ON(ret != BIOS_STATUS_SUCCESS);
}
static struct xpc_gru_mq_uv *
xpc_create_gru_mq_uv(unsigned int mq_size, int cpu, char *irq_name,
irq_handler_t irq_handler)
{
enum xp_retval xp_ret;
int ret;
int nid;
int nasid;
int pg_order;
struct page *page;
struct xpc_gru_mq_uv *mq;
struct uv_IO_APIC_route_entry *mmr_value;
mq = kmalloc_obj(struct xpc_gru_mq_uv);
if (mq == NULL) {
dev_err(xpc_part, "xpc_create_gru_mq_uv() failed to kmalloc() "
"a xpc_gru_mq_uv structure\n");
ret = -ENOMEM;
goto out_0;
}
mq->gru_mq_desc = kzalloc_obj(struct gru_message_queue_desc);
if (mq->gru_mq_desc == NULL) {
dev_err(xpc_part, "xpc_create_gru_mq_uv() failed to kmalloc() "
"a gru_message_queue_desc structure\n");
ret = -ENOMEM;
goto out_1;
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/mm.h`, `linux/interrupt.h`, `linux/delay.h`, `linux/device.h`, `linux/cpu.h`, `linux/module.h`, `linux/err.h`.
- Detected declarations: `function xpc_setup_partitions_uv`, `function xpc_teardown_partitions_uv`, `function xpc_get_gru_mq_irq_uv`, `function xpc_release_gru_mq_irq_uv`, `function xpc_gru_mq_watchlist_alloc_uv`, `function xpc_gru_mq_watchlist_free_uv`, `function xpc_create_gru_mq_uv`, `function xpc_destroy_gru_mq_uv`, `function xpc_send_gru_msg`, `function xpc_process_activate_IRQ_rcvd_uv`.
- Atlas domain: Driver Families / drivers/misc.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.