* [Intel-gfx] [PATCH] drm/i915/display: Fix phys_base to be relative not absolute
@ 2023-11-05 17:27 Paz Zcharya
2023-11-05 18:19 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork
2023-11-15 3:13 ` [Intel-gfx] [PATCH] " Rodrigo Vivi
0 siblings, 2 replies; 11+ messages in thread
From: Paz Zcharya @ 2023-11-05 17:27 UTC (permalink / raw)
To: matthew.auld, Tvrtko Ursulin
Cc: Daniel Vetter, Subrata Banik, dri-devel, linux-kernel,
Rodrigo Vivi, Sean Paul, Andrzej Hajda, Marcin Wojtas,
Drew Davenport, David Airlie, intel-gfx, Paz Zcharya, Nirmoy Das
Fix the value of variable `phys_base` to be the relative offset in
stolen memory, and not the absolute offset of the GSM.
Currently, the value of `phys_base` is set to "Surface Base Address,"
which in the case of Meter Lake is 0xfc00_0000. This causes the
function `i915_gem_object_create_region_at` to fail in line 128, when
it attempts to verify that the range does not overflow:
if (range_overflows(offset, size, resource_size(&mem->region)))
return ERR_PTR(-EINVAL);
where:
offset = 0xfc000000
size = 0x8ca000
mem->region.end + 1 = 0x4400000
mem->region.start = 0x800000
resource_size(&mem->region) = 0x3c00000
call stack:
i915_gem_object_create_region_at
initial_plane_vma
intel_alloc_initial_plane_obj
intel_find_initial_plane_obj
intel_crtc_initial_plane_config
Looking at the flow coming next, we see that `phys_base` is only used
once, in function `_i915_gem_object_stolen_init`, in the context of
the offset *in* the stolen memory. Combining that with an
examinination of the history of the file seems to indicate the
current value set is invalid.
call stack (functions using `phys_base`)
_i915_gem_object_stolen_init
__i915_gem_object_create_region
i915_gem_object_create_region_at
initial_plane_vma
intel_alloc_initial_plane_obj
intel_find_initial_plane_obj
intel_crtc_initial_plane_config
[drm:_i915_gem_object_stolen_init] creating preallocated stolen
object: stolen_offset=0x0000000000000000, size=0x00000000008ca000
Signed-off-by: Paz Zcharya <pazz@chromium.org>
---
drivers/gpu/drm/i915/display/intel_plane_initial.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/display/intel_plane_initial.c b/drivers/gpu/drm/i915/display/intel_plane_initial.c
index a55c09cbd0e4..e696cb13756a 100644
--- a/drivers/gpu/drm/i915/display/intel_plane_initial.c
+++ b/drivers/gpu/drm/i915/display/intel_plane_initial.c
@@ -90,7 +90,7 @@ initial_plane_vma(struct drm_i915_private *i915,
"Using phys_base=%pa, based on initial plane programming\n",
&phys_base);
} else {
- phys_base = base;
+ phys_base = 0;
mem = i915->mm.stolen_region;
}
--
2.42.0.869.gea05f2083d-goog
^ permalink raw reply related [flat|nested] 11+ messages in thread* [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/display: Fix phys_base to be relative not absolute 2023-11-05 17:27 [Intel-gfx] [PATCH] drm/i915/display: Fix phys_base to be relative not absolute Paz Zcharya @ 2023-11-05 18:19 ` Patchwork 2023-11-15 3:13 ` [Intel-gfx] [PATCH] " Rodrigo Vivi 1 sibling, 0 replies; 11+ messages in thread From: Patchwork @ 2023-11-05 18:19 UTC (permalink / raw) To: Paz Zcharya; +Cc: intel-gfx [-- Attachment #1: Type: text/plain, Size: 7264 bytes --] == Series Details == Series: drm/i915/display: Fix phys_base to be relative not absolute URL : https://patchwork.freedesktop.org/series/125992/ State : failure == Summary == CI Bug Log - changes from CI_DRM_13837 -> Patchwork_125992v1 ==================================================== Summary ------- **FAILURE** Serious unknown changes coming with Patchwork_125992v1 absolutely need to be verified manually. If you think the reported changes have nothing to do with the changes introduced in Patchwork_125992v1, please notify your bug team (lgci.bug.filing@intel.com) to allow them to document this new failure mode, which will reduce false positives in CI. External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_125992v1/index.html Participating hosts (33 -> 33) ------------------------------ Additional (2): fi-kbl-soraka fi-hsw-4770 Missing (2): bat-atsm-1 fi-snb-2520m Possible new issues ------------------- Here are the unknown changes that may have been introduced in Patchwork_125992v1: ### IGT changes ### #### Possible regressions #### * igt@i915_suspend@basic-s2idle-without-i915: - bat-rpls-1: [PASS][1] -> [ABORT][2] [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13837/bat-rpls-1/igt@i915_suspend@basic-s2idle-without-i915.html [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_125992v1/bat-rpls-1/igt@i915_suspend@basic-s2idle-without-i915.html Known issues ------------ Here are the changes found in Patchwork_125992v1 that come from known issues: ### IGT changes ### #### Issues hit #### * igt@gem_exec_suspend@basic-s0@lmem0: - bat-dg2-9: [PASS][3] -> [INCOMPLETE][4] ([i915#9275]) [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13837/bat-dg2-9/igt@gem_exec_suspend@basic-s0@lmem0.html [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_125992v1/bat-dg2-9/igt@gem_exec_suspend@basic-s0@lmem0.html * igt@gem_huc_copy@huc-copy: - fi-kbl-soraka: NOTRUN -> [SKIP][5] ([fdo#109271] / [i915#2190]) [5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_125992v1/fi-kbl-soraka/igt@gem_huc_copy@huc-copy.html * igt@gem_lmem_swapping@basic: - fi-kbl-soraka: NOTRUN -> [SKIP][6] ([fdo#109271] / [i915#4613]) +3 other tests skip [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_125992v1/fi-kbl-soraka/igt@gem_lmem_swapping@basic.html * igt@i915_selftest@live@gt_pm: - fi-kbl-soraka: NOTRUN -> [DMESG-FAIL][7] ([i915#1886]) [7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_125992v1/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html * igt@i915_selftest@live@mman: - bat-rpls-1: [PASS][8] -> [TIMEOUT][9] ([i915#6794] / [i915#7392]) [8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13837/bat-rpls-1/igt@i915_selftest@live@mman.html [9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_125992v1/bat-rpls-1/igt@i915_selftest@live@mman.html * igt@kms_addfb_basic@addfb25-y-tiled-small-legacy: - fi-hsw-4770: NOTRUN -> [SKIP][10] ([fdo#109271] / [i915#5190]) [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_125992v1/fi-hsw-4770/igt@kms_addfb_basic@addfb25-y-tiled-small-legacy.html * igt@kms_dsc@dsc-basic: - fi-kbl-soraka: NOTRUN -> [SKIP][11] ([fdo#109271]) +9 other tests skip [11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_125992v1/fi-kbl-soraka/igt@kms_dsc@dsc-basic.html * igt@kms_pipe_crc_basic@compare-crc-sanitycheck-nv12@pipe-a-vga-1: - fi-hsw-4770: NOTRUN -> [SKIP][12] ([fdo#109271]) +12 other tests skip [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_125992v1/fi-hsw-4770/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-nv12@pipe-a-vga-1.html * igt@kms_pipe_crc_basic@suspend-read-crc@pipe-c-dp-1: - bat-dg2-8: NOTRUN -> [INCOMPLETE][13] ([i915#9280]) [13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_125992v1/bat-dg2-8/igt@kms_pipe_crc_basic@suspend-read-crc@pipe-c-dp-1.html * igt@kms_pipe_crc_basic@suspend-read-crc@pipe-c-vga-1: - fi-hsw-4770: NOTRUN -> [DMESG-WARN][14] ([i915#8841]) +6 other tests dmesg-warn [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_125992v1/fi-hsw-4770/igt@kms_pipe_crc_basic@suspend-read-crc@pipe-c-vga-1.html * igt@kms_psr@sprite_plane_onoff: - fi-hsw-4770: NOTRUN -> [SKIP][15] ([fdo#109271] / [i915#1072]) +3 other tests skip [15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_125992v1/fi-hsw-4770/igt@kms_psr@sprite_plane_onoff.html #### Possible fixes #### * igt@gem_exec_suspend@basic-s0@lmem0: - bat-dg2-8: [INCOMPLETE][16] ([i915#9275]) -> [PASS][17] [16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13837/bat-dg2-8/igt@gem_exec_suspend@basic-s0@lmem0.html [17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_125992v1/bat-dg2-8/igt@gem_exec_suspend@basic-s0@lmem0.html * igt@gem_exec_suspend@basic-s3@smem: - fi-rkl-11600: [FAIL][18] ([fdo#103375]) -> [PASS][19] [18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13837/fi-rkl-11600/igt@gem_exec_suspend@basic-s3@smem.html [19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_125992v1/fi-rkl-11600/igt@gem_exec_suspend@basic-s3@smem.html * igt@kms_hdmi_inject@inject-audio: - fi-kbl-guc: [FAIL][20] ([IGT#3]) -> [PASS][21] [20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13837/fi-kbl-guc/igt@kms_hdmi_inject@inject-audio.html [21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_125992v1/fi-kbl-guc/igt@kms_hdmi_inject@inject-audio.html {name}: This element is suppressed. This means it is ignored when computing the status of the difference (SUCCESS, WARNING, or FAILURE). [IGT#3]: https://gitlab.freedesktop.org/drm/igt-gpu-tools/issues/3 [fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375 [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271 [i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072 [i915#1886]: https://gitlab.freedesktop.org/drm/intel/issues/1886 [i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190 [i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613 [i915#5190]: https://gitlab.freedesktop.org/drm/intel/issues/5190 [i915#6794]: https://gitlab.freedesktop.org/drm/intel/issues/6794 [i915#7392]: https://gitlab.freedesktop.org/drm/intel/issues/7392 [i915#8841]: https://gitlab.freedesktop.org/drm/intel/issues/8841 [i915#9275]: https://gitlab.freedesktop.org/drm/intel/issues/9275 [i915#9280]: https://gitlab.freedesktop.org/drm/intel/issues/9280 Build changes ------------- * Linux: CI_DRM_13837 -> Patchwork_125992v1 CI-20190529: 20190529 CI_DRM_13837: 80175dbe2c1caaf93054ea322dd8f79b7bb49509 @ git://anongit.freedesktop.org/gfx-ci/linux IGT_7573: 69485d223b256208614e9949a4a7e84bde52d5f5 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git Patchwork_125992v1: 80175dbe2c1caaf93054ea322dd8f79b7bb49509 @ git://anongit.freedesktop.org/gfx-ci/linux ### Linux commits 3e5c6b01abd0 drm/i915/display: Fix phys_base to be relative not absolute == Logs == For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_125992v1/index.html [-- Attachment #2: Type: text/html, Size: 8665 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Intel-gfx] [PATCH] drm/i915/display: Fix phys_base to be relative not absolute 2023-11-05 17:27 [Intel-gfx] [PATCH] drm/i915/display: Fix phys_base to be relative not absolute Paz Zcharya 2023-11-05 18:19 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork @ 2023-11-15 3:13 ` Rodrigo Vivi 2023-11-17 23:01 ` Paz Zcharya 1 sibling, 1 reply; 11+ messages in thread From: Rodrigo Vivi @ 2023-11-15 3:13 UTC (permalink / raw) To: Paz Zcharya Cc: Andrzej Hajda, Subrata Banik, Tvrtko Ursulin, intel-gfx, linux-kernel, dri-devel, Sean Paul, matthew.auld, Daniel Vetter, Marcin Wojtas, Drew Davenport, David Airlie, Nirmoy Das On Sun, Nov 05, 2023 at 05:27:03PM +0000, Paz Zcharya wrote: > Fix the value of variable `phys_base` to be the relative offset in > stolen memory, and not the absolute offset of the GSM. to me it looks like the other way around. phys_base is the physical base address for the frame_buffer. Setting it to zero doesn't seem to make that relative. And also doesn't look right. > > Currently, the value of `phys_base` is set to "Surface Base Address," > which in the case of Meter Lake is 0xfc00_0000. I don't believe this is a fixed value. IIRC this comes from the register set by video bios, where the idea is to reuse the fb that was used so far. With this in mind I don't understand how that could overflow. Maybe the size of the stolen is not right? maybe the size? maybe different memory region? > This causes the > function `i915_gem_object_create_region_at` to fail in line 128, when > it attempts to verify that the range does not overflow: > > if (range_overflows(offset, size, resource_size(&mem->region))) > return ERR_PTR(-EINVAL); > > where: > offset = 0xfc000000 > size = 0x8ca000 > mem->region.end + 1 = 0x4400000 > mem->region.start = 0x800000 > resource_size(&mem->region) = 0x3c00000 > > call stack: > i915_gem_object_create_region_at > initial_plane_vma > intel_alloc_initial_plane_obj > intel_find_initial_plane_obj > intel_crtc_initial_plane_config > > Looking at the flow coming next, we see that `phys_base` is only used > once, in function `_i915_gem_object_stolen_init`, in the context of > the offset *in* the stolen memory. Combining that with an > examinination of the history of the file seems to indicate the > current value set is invalid. > > call stack (functions using `phys_base`) > _i915_gem_object_stolen_init > __i915_gem_object_create_region > i915_gem_object_create_region_at > initial_plane_vma > intel_alloc_initial_plane_obj > intel_find_initial_plane_obj > intel_crtc_initial_plane_config > > [drm:_i915_gem_object_stolen_init] creating preallocated stolen > object: stolen_offset=0x0000000000000000, size=0x00000000008ca000 > > Signed-off-by: Paz Zcharya <pazz@chromium.org> > --- > > drivers/gpu/drm/i915/display/intel_plane_initial.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_plane_initial.c b/drivers/gpu/drm/i915/display/intel_plane_initial.c > index a55c09cbd0e4..e696cb13756a 100644 > --- a/drivers/gpu/drm/i915/display/intel_plane_initial.c > +++ b/drivers/gpu/drm/i915/display/intel_plane_initial.c > @@ -90,7 +90,7 @@ initial_plane_vma(struct drm_i915_private *i915, > "Using phys_base=%pa, based on initial plane programming\n", > &phys_base); > } else { > - phys_base = base; > + phys_base = 0; > mem = i915->mm.stolen_region; > } > > -- > 2.42.0.869.gea05f2083d-goog > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Intel-gfx] [PATCH] drm/i915/display: Fix phys_base to be relative not absolute 2023-11-15 3:13 ` [Intel-gfx] [PATCH] " Rodrigo Vivi @ 2023-11-17 23:01 ` Paz Zcharya 2023-11-21 12:06 ` Andrzej Hajda 0 siblings, 1 reply; 11+ messages in thread From: Paz Zcharya @ 2023-11-17 23:01 UTC (permalink / raw) To: Rodrigo Vivi Cc: Andrzej Hajda, Subrata Banik, Tvrtko Ursulin, intel-gfx, linux-kernel, dri-devel, Sean Paul, matthew.auld, Daniel Vetter, Marcin Wojtas, Drew Davenport, David Airlie, Nirmoy Das On Tue, Nov 14, 2023 at 10:13:59PM -0500, Rodrigo Vivi wrote: > On Sun, Nov 05, 2023 at 05:27:03PM +0000, Paz Zcharya wrote: > > Fix the value of variable `phys_base` to be the relative offset in > > stolen memory, and not the absolute offset of the GSM. > > to me it looks like the other way around. phys_base is the physical > base address for the frame_buffer. Setting it to zero doesn't seem > to make that relative. And also doesn't look right. > > > > > Currently, the value of `phys_base` is set to "Surface Base Address," > > which in the case of Meter Lake is 0xfc00_0000. > > I don't believe this is a fixed value. IIRC this comes from the register > set by video bios, where the idea is to reuse the fb that was used so > far. > > With this in mind I don't understand how that could overflow. Maybe > the size of the stolen is not right? maybe the size? maybe different > memory region? > Hi Rodrigo, thanks for the great comments. Apologies for using a wrong/confusing terminology. I think 'phys_base' is supposed to be the offset in the GEM BO, where base (or "Surface Base Address") is supposed to be the GTT offset. Other than what I wrote before, I noticed that the function 'i915_vma_pin' which calls to 'i915_gem_gtt_reserve' is the one that binds the right address space in the GTT for that stolen region. I see that in the function 'i915_vma_insert' (full call stack below), where if (flags & PIN_OFFSET_FIXED), then when calling 'i915_gem_gtt_reserve' we add an offset. Specifically in MeteorLake, and specifically when using GOP driver, this offset is equal to 0xfc00_0000. But as you mentioned, this is not strict. The if statement always renders true because in the function 'initial_plane_vma' we always set pinctl = PIN_GLOBAL | PIN_OFFSET_FIXED | base; where pinctl == flags (see file 'intel_plane_initial.c' line 145). Call stack: drm_mm_reserve_node i915_gem_gtt_reserve i915_vma_insert i915_vma_pin_ww i915_vma_pin initial_plane_vma intel_alloc_initial_plane_obj intel_find_initial_plane_obj Therefore, I believe the variable 'phys_base' in the function 'initial_plane_vma,' should be the the offset in the GEM BO and not the GTT offset, and because the base is added later on in the function 'i915_gem_gtt_reserve', this value should not be equal to base and be 0. Hope it makes more sense. > > This causes the > > function `i915_gem_object_create_region_at` to fail in line 128, when > > it attempts to verify that the range does not overflow: > > > > if (range_overflows(offset, size, resource_size(&mem->region))) > > return ERR_PTR(-EINVAL); > > > > where: > > offset = 0xfc000000 > > size = 0x8ca000 > > mem->region.end + 1 = 0x4400000 > > mem->region.start = 0x800000 > > resource_size(&mem->region) = 0x3c00000 > > > > call stack: > > i915_gem_object_create_region_at > > initial_plane_vma > > intel_alloc_initial_plane_obj > > intel_find_initial_plane_obj > > intel_crtc_initial_plane_config > > > > Looking at the flow coming next, we see that `phys_base` is only used > > once, in function `_i915_gem_object_stolen_init`, in the context of > > the offset *in* the stolen memory. Combining that with an > > examinination of the history of the file seems to indicate the > > current value set is invalid. > > > > call stack (functions using `phys_base`) > > _i915_gem_object_stolen_init > > __i915_gem_object_create_region > > i915_gem_object_create_region_at > > initial_plane_vma > > intel_alloc_initial_plane_obj > > intel_find_initial_plane_obj > > intel_crtc_initial_plane_config > > > > [drm:_i915_gem_object_stolen_init] creating preallocated stolen > > object: stolen_offset=0x0000000000000000, size=0x00000000008ca000 > > > > Signed-off-by: Paz Zcharya <pazz@chromium.org> > > --- > > > > drivers/gpu/drm/i915/display/intel_plane_initial.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/i915/display/intel_plane_initial.c b/drivers/gpu/drm/i915/display/intel_plane_initial.c > > index a55c09cbd0e4..e696cb13756a 100644 > > --- a/drivers/gpu/drm/i915/display/intel_plane_initial.c > > +++ b/drivers/gpu/drm/i915/display/intel_plane_initial.c > > @@ -90,7 +90,7 @@ initial_plane_vma(struct drm_i915_private *i915, > > "Using phys_base=%pa, based on initial plane programming\n", > > &phys_base); > > } else { > > - phys_base = base; > > + phys_base = 0; > > mem = i915->mm.stolen_region; > > } > > > > -- > > 2.42.0.869.gea05f2083d-goog > > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Intel-gfx] [PATCH] drm/i915/display: Fix phys_base to be relative not absolute 2023-11-17 23:01 ` Paz Zcharya @ 2023-11-21 12:06 ` Andrzej Hajda 2023-11-22 13:26 ` Andrzej Hajda 0 siblings, 1 reply; 11+ messages in thread From: Andrzej Hajda @ 2023-11-21 12:06 UTC (permalink / raw) To: Paz Zcharya, Rodrigo Vivi Cc: Subrata Banik, Tvrtko Ursulin, intel-gfx, linux-kernel, dri-devel, Sean Paul, matthew.auld, Daniel Vetter, Marcin Wojtas, Drew Davenport, David Airlie, Nirmoy Das On 18.11.2023 00:01, Paz Zcharya wrote: > On Tue, Nov 14, 2023 at 10:13:59PM -0500, Rodrigo Vivi wrote: >> On Sun, Nov 05, 2023 at 05:27:03PM +0000, Paz Zcharya wrote: >>> Fix the value of variable `phys_base` to be the relative offset in >>> stolen memory, and not the absolute offset of the GSM. >> >> to me it looks like the other way around. phys_base is the physical >> base address for the frame_buffer. Setting it to zero doesn't seem >> to make that relative. And also doesn't look right. >> >>> >>> Currently, the value of `phys_base` is set to "Surface Base Address," >>> which in the case of Meter Lake is 0xfc00_0000. >> >> I don't believe this is a fixed value. IIRC this comes from the register >> set by video bios, where the idea is to reuse the fb that was used so >> far. >> >> With this in mind I don't understand how that could overflow. Maybe >> the size of the stolen is not right? maybe the size? maybe different >> memory region? >> > > Hi Rodrigo, thanks for the great comments. > > Apologies for using a wrong/confusing terminology. I think 'phys_base' > is supposed to be the offset in the GEM BO, where base (or > "Surface Base Address") is supposed to be the GTT offset. Since base is taken from PLANE_SURF register it should be resolvable via GGTT to physical address pointing to actual framebuffer. I couldn't find anything in the specs. The simplest approach would be then do the same as in case of DGFX: gen8_pte_t __iomem *gte = to_gt(i915)->ggtt->gsm; gen8_pte_t pte; gte += base / I915_GTT_PAGE_SIZE; pte = ioread64(gte); phys_base = pte & I915_GTT_PAGE_MASK; Regards Andrzej > > Other than what I wrote before, I noticed that the function 'i915_vma_pin' > which calls to 'i915_gem_gtt_reserve' is the one that binds the right > address space in the GTT for that stolen region. > > I see that in the function 'i915_vma_insert' (full call stack below), > where if (flags & PIN_OFFSET_FIXED), then when calling 'i915_gem_gtt_reserve' > we add an offset. > > Specifically in MeteorLake, and specifically when using GOP driver, this > offset is equal to 0xfc00_0000. But as you mentioned, this is not strict. > > The if statement always renders true because in the function > 'initial_plane_vma' we always set > pinctl = PIN_GLOBAL | PIN_OFFSET_FIXED | base; > where pinctl == flags (see file 'intel_plane_initial.c' line 145). > > Call stack: > drm_mm_reserve_node > i915_gem_gtt_reserve > i915_vma_insert > i915_vma_pin_ww > i915_vma_pin > initial_plane_vma > intel_alloc_initial_plane_obj > intel_find_initial_plane_obj > > Therefore, I believe the variable 'phys_base' in the > function 'initial_plane_vma,' should be the the offset in the GEM BO > and not the GTT offset, and because the base is added later on > in the function 'i915_gem_gtt_reserve', this value should not be > equal to base and be 0. > > Hope it makes more sense. > >>> This causes the >>> function `i915_gem_object_create_region_at` to fail in line 128, when >>> it attempts to verify that the range does not overflow: >>> >>> if (range_overflows(offset, size, resource_size(&mem->region))) >>> return ERR_PTR(-EINVAL); >>> >>> where: >>> offset = 0xfc000000 >>> size = 0x8ca000 >>> mem->region.end + 1 = 0x4400000 >>> mem->region.start = 0x800000 >>> resource_size(&mem->region) = 0x3c00000 >>> >>> call stack: >>> i915_gem_object_create_region_at >>> initial_plane_vma >>> intel_alloc_initial_plane_obj >>> intel_find_initial_plane_obj >>> intel_crtc_initial_plane_config >>> >>> Looking at the flow coming next, we see that `phys_base` is only used >>> once, in function `_i915_gem_object_stolen_init`, in the context of >>> the offset *in* the stolen memory. Combining that with an >>> examinination of the history of the file seems to indicate the >>> current value set is invalid. >>> >>> call stack (functions using `phys_base`) >>> _i915_gem_object_stolen_init >>> __i915_gem_object_create_region >>> i915_gem_object_create_region_at >>> initial_plane_vma >>> intel_alloc_initial_plane_obj >>> intel_find_initial_plane_obj >>> intel_crtc_initial_plane_config >>> >>> [drm:_i915_gem_object_stolen_init] creating preallocated stolen >>> object: stolen_offset=0x0000000000000000, size=0x00000000008ca000 >>> >>> Signed-off-by: Paz Zcharya <pazz@chromium.org> >>> --- >>> >>> drivers/gpu/drm/i915/display/intel_plane_initial.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/drivers/gpu/drm/i915/display/intel_plane_initial.c b/drivers/gpu/drm/i915/display/intel_plane_initial.c >>> index a55c09cbd0e4..e696cb13756a 100644 >>> --- a/drivers/gpu/drm/i915/display/intel_plane_initial.c >>> +++ b/drivers/gpu/drm/i915/display/intel_plane_initial.c >>> @@ -90,7 +90,7 @@ initial_plane_vma(struct drm_i915_private *i915, >>> "Using phys_base=%pa, based on initial plane programming\n", >>> &phys_base); >>> } else { >>> - phys_base = base; >>> + phys_base = 0; >>> mem = i915->mm.stolen_region; >>> } >>> >>> -- >>> 2.42.0.869.gea05f2083d-goog >>> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Intel-gfx] [PATCH] drm/i915/display: Fix phys_base to be relative not absolute 2023-11-21 12:06 ` Andrzej Hajda @ 2023-11-22 13:26 ` Andrzej Hajda 2023-11-28 1:20 ` Paz Zcharya 2023-11-28 3:47 ` Paz Zcharya 0 siblings, 2 replies; 11+ messages in thread From: Andrzej Hajda @ 2023-11-22 13:26 UTC (permalink / raw) To: Paz Zcharya, Rodrigo Vivi Cc: Subrata Banik, Tvrtko Ursulin, intel-gfx, linux-kernel, dri-devel, Sean Paul, matthew.auld, Daniel Vetter, Marcin Wojtas, Drew Davenport, David Airlie, Nirmoy Das On 21.11.2023 13:06, Andrzej Hajda wrote: > On 18.11.2023 00:01, Paz Zcharya wrote: >> On Tue, Nov 14, 2023 at 10:13:59PM -0500, Rodrigo Vivi wrote: >>> On Sun, Nov 05, 2023 at 05:27:03PM +0000, Paz Zcharya wrote: >>>> Fix the value of variable `phys_base` to be the relative offset in >>>> stolen memory, and not the absolute offset of the GSM. >>> >>> to me it looks like the other way around. phys_base is the physical >>> base address for the frame_buffer. Setting it to zero doesn't seem >>> to make that relative. And also doesn't look right. >>> >>>> >>>> Currently, the value of `phys_base` is set to "Surface Base Address," >>>> which in the case of Meter Lake is 0xfc00_0000. >>> >>> I don't believe this is a fixed value. IIRC this comes from the register >>> set by video bios, where the idea is to reuse the fb that was used so >>> far. >>> >>> With this in mind I don't understand how that could overflow. Maybe >>> the size of the stolen is not right? maybe the size? maybe different >>> memory region? >>> >> >> Hi Rodrigo, thanks for the great comments. >> >> Apologies for using a wrong/confusing terminology. I think 'phys_base' >> is supposed to be the offset in the GEM BO, where base (or >> "Surface Base Address") is supposed to be the GTT offset. > > Since base is taken from PLANE_SURF register it should be resolvable via > GGTT to physical address pointing to actual framebuffer. > I couldn't find anything in the specs. It was quite cryptic. I meant I have not found anything about assumption from commit history that for iGPU there should be 1:1 mapping, this is why there was an assignment "phys_base = base". Possibly the assumption is not valid anymore for MTL(?). Without the assumption we need to check GGTT to determine phys address. > The simplest approach would be then do the same as in case of DGFX: > gen8_pte_t __iomem *gte = to_gt(i915)->ggtt->gsm; > gen8_pte_t pte; > > gte += base / I915_GTT_PAGE_SIZE; > > pte = ioread64(gte); > phys_base = pte & I915_GTT_PAGE_MASK; > > Regards > Andrzej > > >> >> Other than what I wrote before, I noticed that the function >> 'i915_vma_pin' >> which calls to 'i915_gem_gtt_reserve' is the one that binds the right >> address space in the GTT for that stolen region. >> >> I see that in the function 'i915_vma_insert' (full call stack below), >> where if (flags & PIN_OFFSET_FIXED), then when calling >> 'i915_gem_gtt_reserve' >> we add an offset. >> >> Specifically in MeteorLake, and specifically when using GOP driver, this >> offset is equal to 0xfc00_0000. But as you mentioned, this is not strict. >> >> The if statement always renders true because in the function >> 'initial_plane_vma' we always set >> pinctl = PIN_GLOBAL | PIN_OFFSET_FIXED | base; >> where pinctl == flags (see file 'intel_plane_initial.c' line 145). >> >> Call stack: >> drm_mm_reserve_node >> i915_gem_gtt_reserve >> i915_vma_insert >> i915_vma_pin_ww >> i915_vma_pin >> initial_plane_vma >> intel_alloc_initial_plane_obj >> intel_find_initial_plane_obj >> >> Therefore, I believe the variable 'phys_base' in the >> function 'initial_plane_vma,' should be the the offset in the GEM BO >> and not the GTT offset, and because the base is added later on >> in the function 'i915_gem_gtt_reserve', this value should not be >> equal to base and be 0. >> >> Hope it makes more sense. >> >>>> This causes the >>>> function `i915_gem_object_create_region_at` to fail in line 128, when >>>> it attempts to verify that the range does not overflow: >>>> >>>> if (range_overflows(offset, size, resource_size(&mem->region))) >>>> return ERR_PTR(-EINVAL); >>>> >>>> where: >>>> offset = 0xfc000000 >>>> size = 0x8ca000 >>>> mem->region.end + 1 = 0x4400000 >>>> mem->region.start = 0x800000 >>>> resource_size(&mem->region) = 0x3c00000 >>>> >>>> call stack: >>>> i915_gem_object_create_region_at >>>> initial_plane_vma >>>> intel_alloc_initial_plane_obj >>>> intel_find_initial_plane_obj >>>> intel_crtc_initial_plane_config >>>> >>>> Looking at the flow coming next, we see that `phys_base` is only used >>>> once, in function `_i915_gem_object_stolen_init`, in the context of >>>> the offset *in* the stolen memory. Combining that with an >>>> examinination of the history of the file seems to indicate the >>>> current value set is invalid. >>>> >>>> call stack (functions using `phys_base`) >>>> _i915_gem_object_stolen_init >>>> __i915_gem_object_create_region >>>> i915_gem_object_create_region_at >>>> initial_plane_vma >>>> intel_alloc_initial_plane_obj >>>> intel_find_initial_plane_obj >>>> intel_crtc_initial_plane_config >>>> >>>> [drm:_i915_gem_object_stolen_init] creating preallocated stolen >>>> object: stolen_offset=0x0000000000000000, size=0x00000000008ca000 >>>> >>>> Signed-off-by: Paz Zcharya <pazz@chromium.org> >>>> --- >>>> >>>> drivers/gpu/drm/i915/display/intel_plane_initial.c | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/gpu/drm/i915/display/intel_plane_initial.c >>>> b/drivers/gpu/drm/i915/display/intel_plane_initial.c >>>> index a55c09cbd0e4..e696cb13756a 100644 >>>> --- a/drivers/gpu/drm/i915/display/intel_plane_initial.c >>>> +++ b/drivers/gpu/drm/i915/display/intel_plane_initial.c >>>> @@ -90,7 +90,7 @@ initial_plane_vma(struct drm_i915_private *i915, >>>> "Using phys_base=%pa, based on initial plane >>>> programming\n", >>>> &phys_base); >>>> } else { >>>> - phys_base = base; >>>> + phys_base = 0; >>>> mem = i915->mm.stolen_region; >>>> } >>>> -- >>>> 2.42.0.869.gea05f2083d-goog >>>> > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Intel-gfx] [PATCH] drm/i915/display: Fix phys_base to be relative not absolute 2023-11-22 13:26 ` Andrzej Hajda @ 2023-11-28 1:20 ` Paz Zcharya 2023-11-28 3:47 ` Paz Zcharya 1 sibling, 0 replies; 11+ messages in thread From: Paz Zcharya @ 2023-11-28 1:20 UTC (permalink / raw) To: Andrzej Hajda Cc: Subrata Banik, Tvrtko Ursulin, intel-gfx, Marcin Wojtas, linux-kernel, dri-devel, Sean Paul, matthew.auld, Daniel Vetter, Rodrigo Vivi, Drew Davenport, David Airlie, Nirmoy Das On Wed, Nov 22, 2023 at 02:26:55PM +0100, Andrzej Hajda wrote: > > > On 21.11.2023 13:06, Andrzej Hajda wrote: > > On 18.11.2023 00:01, Paz Zcharya wrote: > > > On Tue, Nov 14, 2023 at 10:13:59PM -0500, Rodrigo Vivi wrote: > > > > On Sun, Nov 05, 2023 at 05:27:03PM +0000, Paz Zcharya wrote: > > > > > > Hi Rodrigo, thanks for the great comments. > > > > > > Apologies for using a wrong/confusing terminology. I think 'phys_base' > > > is supposed to be the offset in the GEM BO, where base (or > > > "Surface Base Address") is supposed to be the GTT offset. > > > > Since base is taken from PLANE_SURF register it should be resolvable via > > GGTT to physical address pointing to actual framebuffer. > > I couldn't find anything in the specs. > > It was quite cryptic. I meant I have not found anything about assumption > from commit history that for iGPU there should be 1:1 mapping, this is why > there was an assignment "phys_base = base". Possibly the assumption is not > valid anymore for MTL(?). > Without the assumption we need to check GGTT to determine phys address. > > > The simplest approach would be then do the same as in case of DGFX: > > gen8_pte_t __iomem *gte = to_gt(i915)->ggtt->gsm; > > gen8_pte_t pte; > > > > gte += base / I915_GTT_PAGE_SIZE; > > > > pte = ioread64(gte); > > phys_base = pte & I915_GTT_PAGE_MASK; > > > > Regards > > Andrzej Hey Andrzej, Sorry for the late response. I was OOO :) I tried using the code you mentioned. It translates (in the very specific case of MTL + GOP driver) to phys_base == 0080_0000h. Unfortunately, it results in a corrupted screen -- the framebuffer is filled with zeros. It seems like `i915_vma_pin_ww` already reserves and binds the GEM BO to the correct address space independently of the value of `phys_base`. The only thing `phys_base` affects is the value of `stolen->start` https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/i915/gem/i915_gem_stolen.c#L747 So it seems to me that the maybe `phys_base` is named incorrectly and that it does not reflect the physical address, but the start offset of i915->mm.stolen_region. I'm happy to run more tests / debug further. Do you have more ideas of things to try? Many thanks, Paz ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Intel-gfx] [PATCH] drm/i915/display: Fix phys_base to be relative not absolute 2023-11-22 13:26 ` Andrzej Hajda 2023-11-28 1:20 ` Paz Zcharya @ 2023-11-28 3:47 ` Paz Zcharya 2023-11-28 11:12 ` Andrzej Hajda 1 sibling, 1 reply; 11+ messages in thread From: Paz Zcharya @ 2023-11-28 3:47 UTC (permalink / raw) To: Andrzej Hajda Cc: Subrata Banik, Tvrtko Ursulin, intel-gfx, Marcin Wojtas, linux-kernel, dri-devel, Sean Paul, matthew.auld, Daniel Vetter, Rodrigo Vivi, Drew Davenport, David Airlie, Nirmoy Das On Mon, Nov 27, 2023 at 8:20 PM Paz Zcharya <pazz@chromium.org> wrote: > > On 21.11.2023 13:06, Andrzej Hajda wrote: > > On 18.11.2023 00:01, Paz Zcharya wrote: > > > On Tue, Nov 14, 2023 at 10:13:59PM -0500, Rodrigo Vivi wrote: > > > > On Sun, Nov 05, 2023 at 05:27:03PM +0000, Paz Zcharya wrote: > > > > > > Hi Rodrigo, thanks for the great comments. > > > > > > Apologies for using a wrong/confusing terminology. I think 'phys_base' > > > is supposed to be the offset in the GEM BO, where base (or > > > "Surface Base Address") is supposed to be the GTT offset. > > > > Since base is taken from PLANE_SURF register it should be resolvable via > > GGTT to physical address pointing to actual framebuffer. > > I couldn't find anything in the specs. > > It was quite cryptic. I meant I have not found anything about assumption > from commit history that for iGPU there should be 1:1 mapping, this is why > there was an assignment "phys_base = base". Possibly the assumption is not > valid anymore for MTL(?). > Without the assumption we need to check GGTT to determine phys address. > > > The simplest approach would be then do the same as in case of DGFX: > > gen8_pte_t __iomem *gte = to_gt(i915)->ggtt->gsm; > > gen8_pte_t pte; > > > > gte += base / I915_GTT_PAGE_SIZE; > > > > pte = ioread64(gte); > > phys_base = pte & I915_GTT_PAGE_MASK; > > > > Regards > > Andrzej Hey Andrzej, On a second thought, what do you think about something like + gen8_pte_t __iomem *gte = to_gt(i915)->ggtt->gsm; + gen8_pte_t pte; + gte += base / I915_GTT_PAGE_SIZE; + pte = ioread64(gte); + pte = pte & I915_GTT_PAGE_MASK; + phys_base = pte - i915->mm.stolen_region->region.start; The only difference is the last line. Based on what I wrote before, I think `phys_base` is named incorrectly and that it does not reflect the physical address, but the start offset of i915->mm.stolen_region. So if we offset the start value of the stolen region, this code looks correct to me (and it also works on my MeteorLake device). What do you think? Many thanks, Paz ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Intel-gfx] [PATCH] drm/i915/display: Fix phys_base to be relative not absolute 2023-11-28 3:47 ` Paz Zcharya @ 2023-11-28 11:12 ` Andrzej Hajda 2023-11-28 11:19 ` Paz Zcharya 2023-11-30 16:24 ` Paz Zcharya 0 siblings, 2 replies; 11+ messages in thread From: Andrzej Hajda @ 2023-11-28 11:12 UTC (permalink / raw) To: Paz Zcharya Cc: Subrata Banik, Tvrtko Ursulin, intel-gfx, Rodrigo Vivi, linux-kernel, dri-devel, Sean Paul, matthew.auld, Daniel Vetter, Marcin Wojtas, Drew Davenport, David Airlie, Nirmoy Das On 28.11.2023 04:47, Paz Zcharya wrote: > > On Mon, Nov 27, 2023 at 8:20 PM Paz Zcharya <pazz@chromium.org> wrote: >> >> On 21.11.2023 13:06, Andrzej Hajda wrote: >>> On 18.11.2023 00:01, Paz Zcharya wrote: >>>> On Tue, Nov 14, 2023 at 10:13:59PM -0500, Rodrigo Vivi wrote: >>>>> On Sun, Nov 05, 2023 at 05:27:03PM +0000, Paz Zcharya wrote: >>>> >>>> Hi Rodrigo, thanks for the great comments. >>>> >>>> Apologies for using a wrong/confusing terminology. I think 'phys_base' >>>> is supposed to be the offset in the GEM BO, where base (or >>>> "Surface Base Address") is supposed to be the GTT offset. >>> >>> Since base is taken from PLANE_SURF register it should be resolvable via >>> GGTT to physical address pointing to actual framebuffer. >>> I couldn't find anything in the specs. >> >> It was quite cryptic. I meant I have not found anything about assumption >> from commit history that for iGPU there should be 1:1 mapping, this is why >> there was an assignment "phys_base = base". Possibly the assumption is not >> valid anymore for MTL(?). >> Without the assumption we need to check GGTT to determine phys address. >> >>> The simplest approach would be then do the same as in case of DGFX: >>> gen8_pte_t __iomem *gte = to_gt(i915)->ggtt->gsm; >>> gen8_pte_t pte; >>> >>> gte += base / I915_GTT_PAGE_SIZE; >>> >>> pte = ioread64(gte); >>> phys_base = pte & I915_GTT_PAGE_MASK; >>> >>> Regards >>> Andrzej > > Hey Andrzej, > > On a second thought, what do you think about something like > > + gen8_pte_t __iomem *gte = to_gt(i915)->ggtt->gsm; > + gen8_pte_t pte; > + gte += base / I915_GTT_PAGE_SIZE; > + pte = ioread64(gte); > + pte = pte & I915_GTT_PAGE_MASK; > + phys_base = pte - i915->mm.stolen_region->region.start; > > The only difference is the last line. Bingo :) It seems to be generic algorithm to get phys_base for all platforms: - on older platforms stolen_region points to system memory which starts at 0, - on DG2 it uses lmem region which starts at 0 as well, - on MTL stolen_region points to stolen-local which starts at 0x800000. So this whole "if (IS_DGFX(i915)) {...} else {...}" could be replaced with sth generic. 1. Find pte. 2. if(IS_DGFX(i915) && pte & GEN12_GGTT_PTE_LM) mem = i915->mm.regions[INTEL_REGION_LMEM_0] else mem = i915->mm.stolen_region 3. phys_base = (pte & I915_GTT_PAGE_MASK) - mem->region.start; Regards Andrzej > > Based on what I wrote before, I think `phys_base` is named incorrectly and > that it does not reflect the physical address, but the start offset of > i915->mm.stolen_region. So if we offset the start value of the stolen > region, this code looks correct to me (and it also works on my > MeteorLake device). > > What do you think? > > > Many thanks, > Paz > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Intel-gfx] [PATCH] drm/i915/display: Fix phys_base to be relative not absolute 2023-11-28 11:12 ` Andrzej Hajda @ 2023-11-28 11:19 ` Paz Zcharya 2023-11-30 16:24 ` Paz Zcharya 1 sibling, 0 replies; 11+ messages in thread From: Paz Zcharya @ 2023-11-28 11:19 UTC (permalink / raw) To: Andrzej Hajda Cc: Subrata Banik, Tvrtko Ursulin, intel-gfx, Rodrigo Vivi, linux-kernel, dri-devel, Sean Paul, matthew.auld, Daniel Vetter, Marcin Wojtas, Drew Davenport, David Airlie, Nirmoy Das On Tue, Nov 28, 2023 at 12:12:08PM +0100, Andrzej Hajda wrote: > On 28.11.2023 04:47, Paz Zcharya wrote: > > > > On Mon, Nov 27, 2023 at 8:20 PM Paz Zcharya <pazz@chromium.org> wrote: > > > > Hey Andrzej, > > > > On a second thought, what do you think about something like > > > > + gen8_pte_t __iomem *gte = to_gt(i915)->ggtt->gsm; > > + gen8_pte_t pte; > > + gte += base / I915_GTT_PAGE_SIZE; > > + pte = ioread64(gte); > > + pte = pte & I915_GTT_PAGE_MASK; > > + phys_base = pte - i915->mm.stolen_region->region.start; > > > > The only difference is the last line. > > Bingo :) It seems to be generic algorithm to get phys_base for all > platforms: > - on older platforms stolen_region points to system memory which starts at > 0, > - on DG2 it uses lmem region which starts at 0 as well, > - on MTL stolen_region points to stolen-local which starts at 0x800000. > > So this whole "if (IS_DGFX(i915)) {...} else {...}" could be replaced > with sth generic. > 1. Find pte. > 2. if(IS_DGFX(i915) && pte & GEN12_GGTT_PTE_LM) mem = > i915->mm.regions[INTEL_REGION_LMEM_0] else mem = i915->mm.stolen_region > 3. phys_base = (pte & I915_GTT_PAGE_MASK) - mem->region.start; > > Regards > Andrzej > > Good stuff!! I'll work on this revision and resubmit. Thank you so much Andrzej! ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Intel-gfx] [PATCH] drm/i915/display: Fix phys_base to be relative not absolute 2023-11-28 11:12 ` Andrzej Hajda 2023-11-28 11:19 ` Paz Zcharya @ 2023-11-30 16:24 ` Paz Zcharya 1 sibling, 0 replies; 11+ messages in thread From: Paz Zcharya @ 2023-11-30 16:24 UTC (permalink / raw) To: Andrzej Hajda Cc: Subrata Banik, Tvrtko Ursulin, intel-gfx, Rodrigo Vivi, linux-kernel, dri-devel, Sean Paul, matthew.auld, Daniel Vetter, Marcin Wojtas, Drew Davenport, David Airlie, Nirmoy Das On Tue, Nov 28, 2023 at 12:12:08PM +0100, Andrzej Hajda wrote: > On 28.11.2023 04:47, Paz Zcharya wrote: > > > > On Mon, Nov 27, 2023 at 8:20 PM Paz Zcharya <pazz@chromium.org> wrote: > > > > > > On 21.11.2023 13:06, Andrzej Hajda wrote: > > > > > > > The simplest approach would be then do the same as in case of DGFX: > > > > gen8_pte_t __iomem *gte = to_gt(i915)->ggtt->gsm; > > > > gen8_pte_t pte; > > > > > > > > gte += base / I915_GTT_PAGE_SIZE; > > > > > > > > pte = ioread64(gte); > > > > phys_base = pte & I915_GTT_PAGE_MASK; > > > > > > > > Regards > > > > Andrzej > > > > Hey Andrzej, > > > > On a second thought, what do you think about something like > > > > + gen8_pte_t __iomem *gte = to_gt(i915)->ggtt->gsm; > > + gen8_pte_t pte; > > + gte += base / I915_GTT_PAGE_SIZE; > > + pte = ioread64(gte); > > + pte = pte & I915_GTT_PAGE_MASK; > > + phys_base = pte - i915->mm.stolen_region->region.start; > > > > The only difference is the last line. > > Bingo :) It seems to be generic algorithm to get phys_base for all > platforms: > - on older platforms stolen_region points to system memory which starts at > 0, > - on DG2 it uses lmem region which starts at 0 as well, > - on MTL stolen_region points to stolen-local which starts at 0x800000. > > So this whole "if (IS_DGFX(i915)) {...} else {...}" could be replaced > with sth generic. > 1. Find pte. > 2. if(IS_DGFX(i915) && pte & GEN12_GGTT_PTE_LM) mem = > i915->mm.regions[INTEL_REGION_LMEM_0] else mem = i915->mm.stolen_region > 3. phys_base = (pte & I915_GTT_PAGE_MASK) - mem->region.start; > > Regards > Andrzej > > Hey Andrzej, I uploaded https://patchwork.freedesktop.org/series/127130/ based on algorithm. Please take a look and let me know if you'd like me to change anything. Really appreciate all of your help! Best, Paz ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2023-11-30 16:25 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-11-05 17:27 [Intel-gfx] [PATCH] drm/i915/display: Fix phys_base to be relative not absolute Paz Zcharya 2023-11-05 18:19 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork 2023-11-15 3:13 ` [Intel-gfx] [PATCH] " Rodrigo Vivi 2023-11-17 23:01 ` Paz Zcharya 2023-11-21 12:06 ` Andrzej Hajda 2023-11-22 13:26 ` Andrzej Hajda 2023-11-28 1:20 ` Paz Zcharya 2023-11-28 3:47 ` Paz Zcharya 2023-11-28 11:12 ` Andrzej Hajda 2023-11-28 11:19 ` Paz Zcharya 2023-11-30 16:24 ` Paz Zcharya
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox