[PATCH 2/5] drm/xe: Add helper to calculate adjusted register offset
Piotr Piórkowski
piotr.piorkowski at intel.com
Mon Apr 22 10:29:25 UTC 2024
Michal Wajdeczko <michal.wajdeczko at intel.com> wrote on czw [2024-kwi-18 17:27:59 +0200]:
> Our MMIO accessing functions automatically adjust addresses for the
> media registers based on mmio.adj_limit and mmio.adj_offset logic.
> Move it to the separate helper to avoid code duplication and to
> allow using it by the upcoming changes to PF driver code.
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
> ---
> drivers/gpu/drm/xe/xe_mmio.h | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_mmio.h b/drivers/gpu/drm/xe/xe_mmio.h
> index a3cd7b3036c7..7d003bfb91a8 100644
> --- a/drivers/gpu/drm/xe/xe_mmio.h
> +++ b/drivers/gpu/drm/xe/xe_mmio.h
> @@ -36,4 +36,11 @@ u64 xe_mmio_read64_2x32(struct xe_gt *gt, struct xe_reg reg);
> int xe_mmio_wait32(struct xe_gt *gt, struct xe_reg reg, u32 mask, u32 val, u32 timeout_us,
> u32 *out_val, bool atomic);
>
> +static inline u32 xe_mmio_adjusted_addr(struct xe_gt *gt, u32 addr)
> +{
> + if (addr < gt->mmio.adj_limit)
> + addr += gt->mmio.adj_offset;
> + return addr;
> +}
> +
Since you already extracted it, didn't you think to use it in the xe_mmio_[read|write]_* functions ?
Piotr
> #endif
> --
> 2.43.0
>
--
More information about the Intel-xe
mailing list