drivers/gpu/drm/i915/selftests/mock_gem_device.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/selftests/mock_gem_device.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/selftests/mock_gem_device.c- Extension
.c- Size
- 7564 bytes
- Lines
- 285
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/pm_domain.hlinux/pm_runtime.hlinux/iommu.hdrm/drm_managed.hdisplay/intel_display_device.hgt/intel_gt.hgt/intel_gt_requests.hgt/mock_engine.hi915_driver.hintel_memory_region.hintel_region_ttm.hmock_request.hmock_gem_device.hmock_gtt.hmock_uncore.hmock_region.hgem/selftests/mock_context.hgem/selftests/mock_gem_object.h
Detected Declarations
function filesfunction mock_device_releasefunction release_devfunction pm_domain_resumefunction pm_domain_suspendfunction mock_gt_probefunction mock_destroy_device
Annotated Snippet
#include <linux/pm_domain.h>
#include <linux/pm_runtime.h>
#include <linux/iommu.h>
#include <drm/drm_managed.h>
#include "display/intel_display_device.h"
#include "gt/intel_gt.h"
#include "gt/intel_gt_requests.h"
#include "gt/mock_engine.h"
#include "i915_driver.h"
#include "intel_memory_region.h"
#include "intel_region_ttm.h"
#include "mock_request.h"
#include "mock_gem_device.h"
#include "mock_gtt.h"
#include "mock_uncore.h"
#include "mock_region.h"
#include "gem/selftests/mock_context.h"
#include "gem/selftests/mock_gem_object.h"
void mock_device_flush(struct drm_i915_private *i915)
{
struct intel_gt *gt = to_gt(i915);
struct intel_engine_cs *engine;
enum intel_engine_id id;
do {
for_each_engine(engine, gt, id)
mock_engine_flush(engine);
} while (intel_gt_retire_requests_timeout(gt, MAX_SCHEDULE_TIMEOUT,
NULL));
}
static void mock_device_release(struct drm_device *dev)
{
struct drm_i915_private *i915 = to_i915(dev);
if (!i915->do_release)
goto out;
mock_device_flush(i915);
intel_gt_driver_remove(to_gt(i915));
i915_gem_drain_workqueue(i915);
mock_fini_ggtt(to_gt(i915)->ggtt);
destroy_workqueue(i915->unordered_wq);
destroy_workqueue(i915->wq);
intel_region_ttm_device_fini(i915);
intel_gt_driver_late_release_all(i915);
intel_memory_regions_driver_release(i915);
drm_mode_config_cleanup(&i915->drm);
out:
i915_params_free(&i915->params);
}
static const struct drm_driver mock_driver = {
.name = "mock",
.driver_features = DRIVER_GEM,
.release = mock_device_release,
};
static void release_dev(struct device *dev)
{
struct pci_dev *pdev = to_pci_dev(dev);
kfree(pdev);
}
static int pm_domain_resume(struct device *dev)
{
return pm_generic_runtime_resume(dev);
}
static int pm_domain_suspend(struct device *dev)
{
return pm_generic_runtime_suspend(dev);
}
static struct dev_pm_domain pm_domain = {
.ops = {
.runtime_suspend = pm_domain_suspend,
.runtime_resume = pm_domain_resume,
Annotation
- Immediate include surface: `linux/pm_domain.h`, `linux/pm_runtime.h`, `linux/iommu.h`, `drm/drm_managed.h`, `display/intel_display_device.h`, `gt/intel_gt.h`, `gt/intel_gt_requests.h`, `gt/mock_engine.h`.
- Detected declarations: `function files`, `function mock_device_release`, `function release_dev`, `function pm_domain_resume`, `function pm_domain_suspend`, `function mock_gt_probe`, `function mock_destroy_device`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.