From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: "Christian König" <christian.koenig@amd.com>,
"Jocelyn Falempe" <jfalempe@redhat.com>,
"Jani Nikula" <jani.nikula@linux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
"Tvrtko Ursulin" <tursulin@ursulin.net>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Huang Rui" <ray.huang@amd.com>,
"Matthew Auld" <matthew.auld@intel.com>,
"Matthew Brost" <matthew.brost@intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v10 05/10] drm/ttm: Add ttm_bo_kmap_try_from_panic()
Date: Fri, 27 Jun 2025 12:05:33 +0200 [thread overview]
Message-ID: <3c948554-cc0a-4ccd-a010-41260dc7a3b2@linux.intel.com> (raw)
In-Reply-To: <c44f4194-69e5-41bf-bbc6-2e399be2b627@amd.com>
Hey,
On 2025-06-18 15:55, Christian König wrote:
>
>
> On 6/18/25 11:31, Jocelyn Falempe wrote:
>> If the ttm bo is backed by pages, then it's possible to safely kmap
>> one page at a time, using kmap_try_from_panic().
>> Unfortunately there is no way to do the same with ioremap, so it
>> only supports the kmap case.
>> This is needed for proper drm_panic support with xe driver.
>>
>> Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
>
> Reviewed-by: Christian König <christian.koenig@amd.com>
>
> Preferred through drm-misc-next, but feel free to merge it through every branch you want if it makes thinks easier for you.
>
Thanks for the ack there. I had to merge this patch through drm-intel-next-queued because of a rework affecting the series.
Kind regards,
~Maarten
> Regards,
> Christian.
>
>> ---
>>
>> v8:
>> * Added in v8
>>
>> v9:
>> * Fix comment in ttm_bo_kmap_try_from_panic(), this can *only* be called
>> from the panic handler (Christian König)
>>
>> drivers/gpu/drm/ttm/ttm_bo_util.c | 27 +++++++++++++++++++++++++++
>> include/drm/ttm/ttm_bo.h | 1 +
>> 2 files changed, 28 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
>> index 15cab9bda17f..6912e6dfda25 100644
>> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
>> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
>> @@ -377,6 +377,33 @@ static int ttm_bo_kmap_ttm(struct ttm_buffer_object *bo,
>> return (!map->virtual) ? -ENOMEM : 0;
>> }
>>
>> +/**
>> + *
>> + * ttm_bo_kmap_try_from_panic
>> + *
>> + * @bo: The buffer object
>> + * @page: The page to map
>> + *
>> + * Sets up a kernel virtual mapping using kmap_local_page_try_from_panic().
>> + * This should only be called from the panic handler, if you make sure the bo
>> + * is the one being displayed, so is properly allocated, and protected.
>> + *
>> + * Returns the vaddr, that you can use to write to the bo, and that you should
>> + * pass to kunmap_local() when you're done with this page, or NULL if the bo
>> + * is in iomem.
>> + */
>> +void *ttm_bo_kmap_try_from_panic(struct ttm_buffer_object *bo, unsigned long page)
>> +{
>> + if (page + 1 > PFN_UP(bo->resource->size))
>> + return NULL;
>> +
>> + if (!bo->resource->bus.is_iomem && bo->ttm->pages && bo->ttm->pages[page])
>> + return kmap_local_page_try_from_panic(bo->ttm->pages[page]);
>> +
>> + return NULL;
>> +}
>> +EXPORT_SYMBOL(ttm_bo_kmap_try_from_panic);
>> +
>> /**
>> * ttm_bo_kmap
>> *
>> diff --git a/include/drm/ttm/ttm_bo.h b/include/drm/ttm/ttm_bo.h
>> index cf027558b6db..8c0ce3fa077f 100644
>> --- a/include/drm/ttm/ttm_bo.h
>> +++ b/include/drm/ttm/ttm_bo.h
>> @@ -429,6 +429,7 @@ int ttm_bo_init_validate(struct ttm_device *bdev, struct ttm_buffer_object *bo,
>> int ttm_bo_kmap(struct ttm_buffer_object *bo, unsigned long start_page,
>> unsigned long num_pages, struct ttm_bo_kmap_obj *map);
>> void ttm_bo_kunmap(struct ttm_bo_kmap_obj *map);
>> +void *ttm_bo_kmap_try_from_panic(struct ttm_buffer_object *bo, unsigned long page);
>> int ttm_bo_vmap(struct ttm_buffer_object *bo, struct iosys_map *map);
>> void ttm_bo_vunmap(struct ttm_buffer_object *bo, struct iosys_map *map);
>> int ttm_bo_mmap_obj(struct vm_area_struct *vma, struct ttm_buffer_object *bo);
>
next prev parent reply other threads:[~2025-06-27 10:05 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-18 9:31 [PATCH v10 00/10] drm/i915: Add drm_panic support Jocelyn Falempe
2025-06-18 9:31 ` [PATCH v10 01/10] drm/panic: Add a private field to struct drm_scanout_buffer Jocelyn Falempe
2025-06-18 9:31 ` [PATCH v10 02/10] drm/i915/fbdev: Add intel_fbdev_get_map() Jocelyn Falempe
2025-06-18 9:31 ` [PATCH v10 03/10] drm/i915/display/i9xx: Add a disable_tiling() for i9xx planes Jocelyn Falempe
2025-07-19 18:23 ` Ville Syrjälä
2025-07-19 18:30 ` Ville Syrjälä
2025-07-28 11:19 ` Jocelyn Falempe
2025-06-18 9:31 ` [PATCH v10 04/10] drm/i915/display: Add a disable_tiling() for skl planes Jocelyn Falempe
2025-06-18 9:31 ` [PATCH v10 05/10] drm/ttm: Add ttm_bo_kmap_try_from_panic() Jocelyn Falempe
2025-06-18 13:55 ` Christian König
2025-06-18 15:38 ` Jocelyn Falempe
2025-06-27 10:05 ` Maarten Lankhorst [this message]
2025-06-18 9:31 ` [PATCH v10 06/10] drm/i915: Add intel_bo_panic_setup and intel_bo_panic_finish Jocelyn Falempe
2025-06-18 9:31 ` [PATCH v10 07/10] drm/i915/display: Add drm_panic support Jocelyn Falempe
2025-06-18 9:31 ` [PATCH v10 08/10] drm/i915/display: Add drm_panic support for Y-tiling with DPT Jocelyn Falempe
2025-06-18 9:31 ` [PATCH v10 09/10] drm/i915/display: Add drm_panic support for 4-tiling " Jocelyn Falempe
2025-06-18 9:31 ` [PATCH v10 10/10] drm/i915/psr: Add intel_psr2_panic_force_full_update Jocelyn Falempe
2025-06-23 7:40 ` [PATCH v10 00/10] drm/i915: Add drm_panic support Maarten Lankhorst
2025-06-23 10:10 ` Jocelyn Falempe
2025-06-23 12:02 ` Maarten Lankhorst
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=3c948554-cc0a-4ccd-a010-41260dc7a3b2@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--cc=airlied@gmail.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=jfalempe@redhat.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew.auld@intel.com \
--cc=matthew.brost@intel.com \
--cc=mripard@kernel.org \
--cc=ray.huang@amd.com \
--cc=rodrigo.vivi@intel.com \
--cc=simona@ffwll.ch \
--cc=tursulin@ursulin.net \
--cc=tzimmermann@suse.de \
--cc=ville.syrjala@linux.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;
as well as URLs for NNTP newsgroup(s).