From: Nirmoy Das <nirmoy.das@linux.intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>,
Nirmoy Das <nirmoy.das@intel.com>
Cc: intel-xe@lists.freedesktop.org,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Matthew Auld <matthew.auld@intel.com>,
stable@vger.kernel.org
Subject: Re: [PATCH] drm/xe: Carve out wopcm portion from the stolen memory
Date: Mon, 10 Feb 2025 16:09:32 +0100 [thread overview]
Message-ID: <9c548c30-d95d-469f-af49-3b2b15886c31@linux.intel.com> (raw)
In-Reply-To: <qx2azqvhrnpyhyag73mhddkje2s5rvb74uhcnx4fcd6sr6na4l@w45ubhrjcidt>
On 2/7/2025 11:55 PM, Lucas De Marchi wrote:
> On Fri, Feb 07, 2025 at 05:43:34PM +0100, Nirmoy Das wrote:
>> Top of stolen memory is wopcm which shouldn't be accessed so remove
>> that portion of memory from the stolen memory.
>
> humn... we are already doing this for integrated. The copy & paste is
> small here to deserve a refactor, but maybe mention that this is already
> done for integrated and it was missed on the discrete side?
>
>>
>> Fixes: d8b52a02cb40 ("drm/xe: Implement stolen memory.")
>> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> Cc: Matthew Auld <matthew.auld@intel.com>
>> Cc: Lucas De Marchi <lucas.demarchi@intel.com>
>> Cc: <stable@vger.kernel.org> # v6.8+
>
> I'd rather do this 6.11+. It's not important before that as we didn't
> have any platform out of force probe or close to be out of force probe.
>
> We will most likely not be able to apply this patch on 6.8.
>
>> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
>> ---
>> drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c | 54 ++++++++++++++------------
>> 1 file changed, 30 insertions(+), 24 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c b/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c
>> index 423856cc18d4..d414421f8c13 100644
>> --- a/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c
>> +++ b/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c
>> @@ -57,12 +57,35 @@ bool xe_ttm_stolen_cpu_access_needs_ggtt(struct xe_device *xe)
>> return GRAPHICS_VERx100(xe) < 1270 && !IS_DGFX(xe);
>> }
>>
>> +static u32 get_wopcm_size(struct xe_device *xe)
>> +{
>> + u32 wopcm_size;
>> + u64 val;
>> +
>> + val = xe_mmio_read64_2x32(xe_root_tile_mmio(xe), STOLEN_RESERVED);
>> + val = REG_FIELD_GET64(WOPCM_SIZE_MASK, val);
>> +
>> + switch (val) {
>> + case 0x5 ... 0x6:
>> + val--;
>> + fallthrough;
>> + case 0x0 ... 0x3:
>> + wopcm_size = (1U << val) * SZ_1M;
>> + break;
>> + default:
>> + WARN(1, "Missing case wopcm_size=%llx\n", val);
>> + wopcm_size = 0;
>> + }
>> +
>> + return wopcm_size;
>> +}
>
> Please also mention in the commit message the code movement here, that
> is done just for the function to be called by detect_bar2_dgfx()
>
> Other than that, Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Thanks Lucas, sent out a v2 with better commit message and stable tag with 6.11+.
Nirmoy
>
> thanks
> Lucas De Marchi
>
>> +
>> static s64 detect_bar2_dgfx(struct xe_device *xe, struct xe_ttm_stolen_mgr *mgr)
>> {
>> struct xe_tile *tile = xe_device_get_root_tile(xe);
>> struct xe_mmio *mmio = xe_root_tile_mmio(xe);
>> struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
>> - u64 stolen_size;
>> + u64 stolen_size, wopcm_size;
>> u64 tile_offset;
>> u64 tile_size;
>>
>> @@ -74,7 +97,13 @@ static s64 detect_bar2_dgfx(struct xe_device *xe, struct xe_ttm_stolen_mgr *mgr)
>> if (drm_WARN_ON(&xe->drm, tile_size < mgr->stolen_base))
>> return 0;
>>
>> + /* Carve out the top of DSM as it contains the reserved WOPCM region */
>> + wopcm_size = get_wopcm_size(xe);
>> + if (drm_WARN_ON(&xe->drm, !wopcm_size))
>> + return 0;
>> +
>> stolen_size = tile_size - mgr->stolen_base;
>> + stolen_size -= wopcm_size;
>>
>> /* Verify usage fits in the actual resource available */
>> if (mgr->stolen_base + stolen_size <= pci_resource_len(pdev, LMEM_BAR))
>> @@ -89,29 +118,6 @@ static s64 detect_bar2_dgfx(struct xe_device *xe, struct xe_ttm_stolen_mgr *mgr)
>> return ALIGN_DOWN(stolen_size, SZ_1M);
>> }
>>
>> -static u32 get_wopcm_size(struct xe_device *xe)
>> -{
>> - u32 wopcm_size;
>> - u64 val;
>> -
>> - val = xe_mmio_read64_2x32(xe_root_tile_mmio(xe), STOLEN_RESERVED);
>> - val = REG_FIELD_GET64(WOPCM_SIZE_MASK, val);
>> -
>> - switch (val) {
>> - case 0x5 ... 0x6:
>> - val--;
>> - fallthrough;
>> - case 0x0 ... 0x3:
>> - wopcm_size = (1U << val) * SZ_1M;
>> - break;
>> - default:
>> - WARN(1, "Missing case wopcm_size=%llx\n", val);
>> - wopcm_size = 0;
>> - }
>> -
>> - return wopcm_size;
>> -}
>> -
>> static u32 detect_bar2_integrated(struct xe_device *xe, struct xe_ttm_stolen_mgr *mgr)
>> {
>> struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
>> --
>> 2.46.0
>>
next prev parent reply other threads:[~2025-02-10 15:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-07 16:43 [PATCH] drm/xe: Carve out wopcm portion from the stolen memory Nirmoy Das
2025-02-07 18:28 ` ✓ CI.Patch_applied: success for " Patchwork
2025-02-07 18:28 ` ✓ CI.checkpatch: " Patchwork
2025-02-07 18:29 ` ✓ CI.KUnit: " Patchwork
2025-02-07 18:46 ` ✓ CI.Build: " Patchwork
2025-02-07 18:48 ` ✓ CI.Hooks: " Patchwork
2025-02-07 18:49 ` ✓ CI.checksparse: " Patchwork
2025-02-07 22:55 ` [PATCH] " Lucas De Marchi
2025-02-10 15:09 ` Nirmoy Das [this message]
2025-02-08 7:14 ` ✗ Xe.CI.Full: failure for " Patchwork
2025-02-10 6:09 ` ✓ Xe.CI.BAT: success " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9c548c30-d95d-469f-af49-3b2b15886c31@linux.intel.com \
--to=nirmoy.das@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matthew.auld@intel.com \
--cc=nirmoy.das@intel.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.