drivers/gpu/drm/vboxvideo/hgsmi_base.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/vboxvideo/hgsmi_base.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/vboxvideo/hgsmi_base.c- Extension
.c- Size
- 4625 bytes
- Lines
- 184
- Domain
- Driver Families
- Bucket
- drivers/gpu
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/vbox_err.hvbox_drv.hvboxvideo_guest.hvboxvideo_vbe.hhgsmi_channels.hhgsmi_ch_setup.h
Detected Declarations
function hgsmi_report_flags_locationfunction hgsmi_send_caps_infofunction hgsmi_test_query_conffunction hgsmi_query_conffunction hgsmi_update_pointer_shape
Annotated Snippet
// SPDX-License-Identifier: MIT
/* Copyright (C) 2006-2017 Oracle Corporation */
#include <linux/vbox_err.h>
#include "vbox_drv.h"
#include "vboxvideo_guest.h"
#include "vboxvideo_vbe.h"
#include "hgsmi_channels.h"
#include "hgsmi_ch_setup.h"
/**
* hgsmi_report_flags_location - Inform the host of the location of
* the host flags in VRAM via an HGSMI cmd.
* Return: 0 or negative errno value.
* @ctx: The context of the guest heap to use.
* @location: The offset chosen for the flags within guest VRAM.
*/
int hgsmi_report_flags_location(struct gen_pool *ctx, u32 location)
{
struct hgsmi_buffer_location *p;
p = hgsmi_buffer_alloc(ctx, sizeof(*p), HGSMI_CH_HGSMI,
HGSMI_CC_HOST_FLAGS_LOCATION);
if (!p)
return -ENOMEM;
p->buf_location = location;
p->buf_len = sizeof(struct hgsmi_host_flags);
hgsmi_buffer_submit(ctx, p);
hgsmi_buffer_free(ctx, p);
return 0;
}
/**
* hgsmi_send_caps_info - Notify the host of HGSMI-related guest capabilities
* via an HGSMI command.
* Return: 0 or negative errno value.
* @ctx: The context of the guest heap to use.
* @caps: The capabilities to report, see vbva_caps.
*/
int hgsmi_send_caps_info(struct gen_pool *ctx, u32 caps)
{
struct vbva_caps *p;
p = hgsmi_buffer_alloc(ctx, sizeof(*p), HGSMI_CH_VBVA, VBVA_INFO_CAPS);
if (!p)
return -ENOMEM;
p->rc = VERR_NOT_IMPLEMENTED;
p->caps = caps;
hgsmi_buffer_submit(ctx, p);
WARN_ON_ONCE(p->rc < 0);
hgsmi_buffer_free(ctx, p);
return 0;
}
int hgsmi_test_query_conf(struct gen_pool *ctx)
{
u32 value = 0;
int ret;
ret = hgsmi_query_conf(ctx, U32_MAX, &value);
if (ret)
return ret;
return value == U32_MAX ? 0 : -EIO;
}
/**
* hgsmi_query_conf - Query the host for an HGSMI configuration
* parameter via an HGSMI command.
* Return: 0 or negative errno value.
* @ctx: The context containing the heap used.
* @index: The index of the parameter to query.
* @value_ret: Where to store the value of the parameter on success.
*/
int hgsmi_query_conf(struct gen_pool *ctx, u32 index, u32 *value_ret)
{
struct vbva_conf32 *p;
p = hgsmi_buffer_alloc(ctx, sizeof(*p), HGSMI_CH_VBVA,
VBVA_QUERY_CONF32);
if (!p)
return -ENOMEM;
Annotation
- Immediate include surface: `linux/vbox_err.h`, `vbox_drv.h`, `vboxvideo_guest.h`, `vboxvideo_vbe.h`, `hgsmi_channels.h`, `hgsmi_ch_setup.h`.
- Detected declarations: `function hgsmi_report_flags_location`, `function hgsmi_send_caps_info`, `function hgsmi_test_query_conf`, `function hgsmi_query_conf`, `function hgsmi_update_pointer_shape`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
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.