Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Iddamsetty, Aravind" <aravind.iddamsetty@intel.com>
To: "Ruhl, Michael J" <michael.j.ruhl@intel.com>,
	"intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>
Cc: "Roper, Matthew D" <matthew.d.roper@intel.com>,
	"Auld, Matthew" <matthew.auld@intel.com>
Subject: Re: [Intel-xe] [PATCH 1/1] drm/xe: Fix stolen memory size calculation
Date: Mon, 12 Jun 2023 20:34:42 +0530	[thread overview]
Message-ID: <bfa7f6cd-3cca-7c3f-413b-25f8c50b41dc@intel.com> (raw)
In-Reply-To: <IA1PR11MB6418E0AF6621EE62DF042E06C154A@IA1PR11MB6418.namprd11.prod.outlook.com>



On 12-06-2023 19:59, Ruhl, Michael J wrote:
>> -----Original Message-----
>> From: Intel-xe <intel-xe-bounces@lists.freedesktop.org> On Behalf Of
>> Aravind Iddamsetty
>> Sent: Friday, June 9, 2023 2:53 PM
>> To: intel-xe@lists.freedesktop.org
>> Cc: Roper, Matthew D <matthew.d.roper@intel.com>
>> Subject: [Intel-xe] [PATCH 1/1] drm/xe: Fix stolen memory size calculation
>>
>> The stolen memory base should be derived from GSMBASE or
>> FLAT_CCS_BASE_ADDR when flat ccs is applicable.
>>
>> Fixes: acf067c2f5a5 ("drm/xe: Implement stolen memory.")
>>
>> Signed-off-by: Aravind Iddamsetty <aravind.iddamsetty@intel.com>
>> ---
>> drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c | 7 +++----
>> 1 file changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c
>> b/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c
>> index 21ecc734f10a..29ce69bf8200 100644
>> --- a/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c
>> +++ b/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c
>> @@ -54,7 +54,6 @@ bool xe_ttm_stolen_cpu_access_needs_ggtt(struct
>> xe_device *xe)
>> 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_gt *mmio = xe_root_mmio_gt(xe);
>> 	struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
>> 	u64 stolen_size;
>> 	u64 tile_offset;
>> @@ -66,12 +65,12 @@ static s64 detect_bar2_dgfx(struct xe_device *xe,
>> struct xe_ttm_stolen_mgr *mgr)
>> 		return 0;
>> 	}
>>
>> -	/* Use DSM base address instead for stolen memory */
>> -	mgr->stolen_base = (xe_mmio_read64(mmio, DSMBASE) & >BDSM_MASK) - tile_offset;
>> +	/* stolen base should be at end of usable vram */
>> +	mgr->stolen_base = vram_size;
> 
> Hi Arvind,
> 
> The stolen memory in i915 is not calculated like this.  It uses the DSMBASE for the offset like the
> current code.
> 
> The lmem size includes the CSS sizing, but that is for the LMEM memory region.
> 
> This is calculating and creating the "stolen" region for use in kernel space.  If the offset includes the CSS space,
> won't the DSM usage be in the wrong place?

I didn't realize until you mentioned here we wanted to carve out usable
stolen in which case what I did is wrong, makes sense.

but why is that we are doing only on root tile even remote tile has
stolen area right?

Thanks,
Aravind.
> 
>> 	if (drm_WARN_ON(&xe->drm, tile_size < mgr->stolen_base))
>> 		return 0;
>>
>> -	stolen_size = tile_size - mgr->stolen_base;
>> +	stolen_size = tile_size - vram_size;
> 
> The tile size was picked to work with devices that do not have tile information (pci_resource _len used).  vram_size
> can be wrong in those instances.
> 
> My original patch set used the vram_size, but that was not accurate for this usage.
> 
> Are you seeing an issue with the current code?
> 
> Thanks
> 
> Mike
> 
>> 	/* Verify usage fits in the actual resource available */
>> 	if (mgr->stolen_base + stolen_size <= pci_resource_len(pdev, >GEN12_LMEM_BAR))
>> --
>> 2.25.1
> 

  reply	other threads:[~2023-06-12 15:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09 18:52 [Intel-xe] [PATCH 0/1] Fix stolen memory size calculation Aravind Iddamsetty
2023-06-09 18:52 ` [Intel-xe] [PATCH 1/1] drm/xe: " Aravind Iddamsetty
2023-06-12 14:29   ` Ruhl, Michael J
2023-06-12 15:04     ` Iddamsetty, Aravind [this message]
2023-06-12 15:55       ` Matthew Auld
2023-06-12 16:57         ` Ruhl, Michael J
2023-06-09 19:12 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
2023-06-09 19:12 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-06-09 19:13 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-06-09 19:17 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-06-09 19:17 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-06-09 19:19 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-06-09 19:53 ` [Intel-xe] ○ CI.BAT: info " 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=bfa7f6cd-3cca-7c3f-413b-25f8c50b41dc@intel.com \
    --to=aravind.iddamsetty@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --cc=matthew.d.roper@intel.com \
    --cc=michael.j.ruhl@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox