xref: /linux/Documentation/gpu/rfc/i915_small_bar.rst (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1*fff1d972SMatthew Auld==========================
2*fff1d972SMatthew AuldI915 Small BAR RFC Section
3*fff1d972SMatthew Auld==========================
4*fff1d972SMatthew AuldStarting from DG2 we will have resizable BAR support for device local-memory(i.e
5*fff1d972SMatthew AuldI915_MEMORY_CLASS_DEVICE), but in some cases the final BAR size might still be
6*fff1d972SMatthew Auldsmaller than the total probed_size. In such cases, only some subset of
7*fff1d972SMatthew AuldI915_MEMORY_CLASS_DEVICE will be CPU accessible(for example the first 256M),
8*fff1d972SMatthew Auldwhile the remainder is only accessible via the GPU.
9*fff1d972SMatthew Auld
10*fff1d972SMatthew AuldI915_GEM_CREATE_EXT_FLAG_NEEDS_CPU_ACCESS flag
11*fff1d972SMatthew Auld----------------------------------------------
12*fff1d972SMatthew AuldNew gem_create_ext flag to tell the kernel that a BO will require CPU access.
13*fff1d972SMatthew AuldThis becomes important when placing an object in I915_MEMORY_CLASS_DEVICE, where
14*fff1d972SMatthew Auldunderneath the device has a small BAR, meaning only some portion of it is CPU
15*fff1d972SMatthew Auldaccessible. Without this flag the kernel will assume that CPU access is not
16*fff1d972SMatthew Auldrequired, and prioritize using the non-CPU visible portion of
17*fff1d972SMatthew AuldI915_MEMORY_CLASS_DEVICE.
18*fff1d972SMatthew Auld
19*fff1d972SMatthew Auld.. kernel-doc:: Documentation/gpu/rfc/i915_small_bar.h
20*fff1d972SMatthew Auld   :functions: __drm_i915_gem_create_ext
21*fff1d972SMatthew Auld
22*fff1d972SMatthew Auldprobed_cpu_visible_size attribute
23*fff1d972SMatthew Auld---------------------------------
24*fff1d972SMatthew AuldNew struct__drm_i915_memory_region attribute which returns the total size of the
25*fff1d972SMatthew AuldCPU accessible portion, for the particular region. This should only be
26*fff1d972SMatthew Auldapplicable for I915_MEMORY_CLASS_DEVICE. We also report the
27*fff1d972SMatthew Auldunallocated_cpu_visible_size, alongside the unallocated_size.
28*fff1d972SMatthew Auld
29*fff1d972SMatthew AuldVulkan will need this as part of creating a separate VkMemoryHeap with the
30*fff1d972SMatthew AuldVK_MEMORY_PROPERTY_HOST_VISIBLE_BIT set, to represent the CPU visible portion,
31*fff1d972SMatthew Auldwhere the total size of the heap needs to be known. It also wants to be able to
32*fff1d972SMatthew Auldgive a rough estimate of how memory can potentially be allocated.
33*fff1d972SMatthew Auld
34*fff1d972SMatthew Auld.. kernel-doc:: Documentation/gpu/rfc/i915_small_bar.h
35*fff1d972SMatthew Auld   :functions: __drm_i915_memory_region_info
36*fff1d972SMatthew Auld
37*fff1d972SMatthew AuldError Capture restrictions
38*fff1d972SMatthew Auld--------------------------
39*fff1d972SMatthew AuldWith error capture we have two new restrictions:
40*fff1d972SMatthew Auld
41*fff1d972SMatthew Auld    1) Error capture is best effort on small BAR systems; if the pages are not
42*fff1d972SMatthew Auld    CPU accessible, at the time of capture, then the kernel is free to skip
43*fff1d972SMatthew Auld    trying to capture them.
44*fff1d972SMatthew Auld
45*fff1d972SMatthew Auld    2) On discrete and newer integrated platforms we now reject error capture
46*fff1d972SMatthew Auld    on recoverable contexts. In the future the kernel may want to blit during
47*fff1d972SMatthew Auld    error capture, when for example something is not currently CPU accessible.
48