From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: <intel-xe@lists.freedesktop.org>, <matthew.brost@intel.com>,
<maarten.lankhorst@linux.intel.com>, <philippe.lecluse@intel.com>,
<mchehab@kernel.org>
Subject: Re: [Intel-xe] [PATCH 02/37] drm/xe: Implement a local xe_mmio_wait32
Date: Tue, 31 Jan 2023 13:49:02 -0500 [thread overview]
Message-ID: <Y9linmMswlANIT8f@intel.com> (raw)
In-Reply-To: <20230112222538.2000142-3-rodrigo.vivi@intel.com>
On Thu, Jan 12, 2023 at 05:25:03PM -0500, Rodrigo Vivi wrote:
> Then, move the i915_utils.h include to its user.
>
> The overall goal is to kill all the usages of the i915_utils
> stuff.
>
> Yes, wait_for also depends on <linux/delay.h>, so they go
> together to where it is needed. It will be likely needed
> anyway directly for udelay or usleep_range.
>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
Matt, may I convert your gitlab approvals in reviewed-bys?
or do you want to go one by one here in the ml?
> ---
> drivers/gpu/drm/xe/xe_force_wake.c | 6 ++++++
> drivers/gpu/drm/xe/xe_gt_mcr.c | 7 +++++++
> drivers/gpu/drm/xe/xe_guc.c | 7 +++++++
> drivers/gpu/drm/xe/xe_guc_pc.c | 7 +++++++
> drivers/gpu/drm/xe/xe_mmio.h | 29 ++++++++++++++++++++---------
> drivers/gpu/drm/xe/xe_pcode.c | 7 +++++++
> 6 files changed, 54 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_force_wake.c b/drivers/gpu/drm/xe/xe_force_wake.c
> index 5a5b6e3e715d..04b22eeb8ab5 100644
> --- a/drivers/gpu/drm/xe/xe_force_wake.c
> +++ b/drivers/gpu/drm/xe/xe_force_wake.c
> @@ -10,6 +10,12 @@
> #include "xe_mmio.h"
> #include "../i915/gt/intel_gt_regs.h"
>
> +/*
> + * FIXME: This header has been deemed evil and we need to kill it. Temporarily
> + * including so we can use '__mask_next_bit'.
> + */
> +#include "i915_utils.h"
> +
> #define XE_FORCE_WAKE_ACK_TIMEOUT_MS 50
>
> static struct xe_gt *
> diff --git a/drivers/gpu/drm/xe/xe_gt_mcr.c b/drivers/gpu/drm/xe/xe_gt_mcr.c
> index 63829d8c8b54..ce776b260750 100644
> --- a/drivers/gpu/drm/xe/xe_gt_mcr.c
> +++ b/drivers/gpu/drm/xe/xe_gt_mcr.c
> @@ -11,6 +11,13 @@
>
> #include "../i915/gt/intel_gt_regs.h"
>
> +#include <linux/delay.h>
> +/*
> + * FIXME: This header has been deemed evil and we need to kill it. Temporar
> + * including so we can use 'wait_for'.
> + */
> +#include "i915_utils.h"
> +
> /**
> * DOC: GT Multicast/Replicated (MCR) Register Support
> *
> diff --git a/drivers/gpu/drm/xe/xe_guc.c b/drivers/gpu/drm/xe/xe_guc.c
> index b5557375804f..373c94230fc3 100644
> --- a/drivers/gpu/drm/xe/xe_guc.c
> +++ b/drivers/gpu/drm/xe/xe_guc.c
> @@ -22,6 +22,13 @@
> #include "i915_reg_defs.h"
> #include "../i915/gt/intel_gt_regs.h"
>
> +#include <linux/delay.h>
> +/*
> + * FIXME: This header has been deemed evil and we need to kill it. Temporarily
> + * including so we can use 'wait_for' and range_overflow_t.
> + */
> +#include "i915_utils.h"
> +
> /* TODO: move to common file */
> #define GUC_PVC_MOCS_INDEX_MASK REG_GENMASK(25, 24)
> #define PVC_MOCS_UC_INDEX 1
> diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c
> index 38b1275ea655..515b7aab03c3 100644
> --- a/drivers/gpu/drm/xe/xe_guc_pc.c
> +++ b/drivers/gpu/drm/xe/xe_guc_pc.c
> @@ -16,6 +16,13 @@
> #include "i915_reg_defs.h"
> #include "../i915/i915_reg.h"
>
> +#include <linux/delay.h>
> +/*
> + * FIXME: This header has been deemed evil and we need to kill it. Temporarily
> + * including so we can use 'wait_for'.
> + */
> +#include "i915_utils.h"
> +
> #include "../i915/intel_mchbar_regs.h"
> /* For GEN6_RP_STATE_CAP.reg to be merged when the definition moves to Xe */
> #define RP0_MASK REG_GENMASK(7, 0)
> diff --git a/drivers/gpu/drm/xe/xe_mmio.h b/drivers/gpu/drm/xe/xe_mmio.h
> index e7cca6d2f81f..d3bc0989ce2e 100644
> --- a/drivers/gpu/drm/xe/xe_mmio.h
> +++ b/drivers/gpu/drm/xe/xe_mmio.h
> @@ -10,13 +10,6 @@
>
> #include "xe_gt_types.h"
>
> -/*
> - * FIXME: This header has been deemed evil and we need to kill it. Temporarily
> - * including so we can use 'wait_for' and unblock initial development. A follow
> - * should replace 'wait_for' with a sane version and drop including this header.
> - */
> -#include "i915_utils.h"
> -
> struct drm_device;
> struct drm_file;
> struct xe_device;
> @@ -84,8 +77,26 @@ static inline int xe_mmio_wait32(struct xe_gt *gt,
> u32 reg, u32 val,
> u32 mask, u32 timeout_ms)
> {
> - return wait_for((xe_mmio_read32(gt, reg) & mask) == val,
> - timeout_ms);
> + ktime_t cur = ktime_get_raw();
> + const ktime_t end = ktime_add_ms(cur, timeout_ms);
> + s64 wait = 10;
> +
> + for (;;) {
> + if ((xe_mmio_read32(gt, reg) & mask) == val)
> + return 0;
> +
> + cur = ktime_get_raw();
> + if (!ktime_before(cur, end))
> + return -ETIMEDOUT;
> +
> + if (ktime_after(ktime_add_us(cur, wait), end))
> + wait = ktime_us_delta(end, cur);
> +
> + usleep_range(wait, wait << 1);
> + wait <<= 1;
> + }
> +
> + return -ETIMEDOUT;
> }
>
> int xe_mmio_ioctl(struct drm_device *dev, void *data,
> diff --git a/drivers/gpu/drm/xe/xe_pcode.c b/drivers/gpu/drm/xe/xe_pcode.c
> index 236159c8a6c0..313ccd70d1a9 100644
> --- a/drivers/gpu/drm/xe/xe_pcode.c
> +++ b/drivers/gpu/drm/xe/xe_pcode.c
> @@ -11,6 +11,13 @@
>
> #include <linux/errno.h>
>
> +#include <linux/delay.h>
> +/*
> + * FIXME: This header has been deemed evil and we need to kill it. Temporarily
> + * including so we can use 'wait_for'.
> + */
> +#include "i915_utils.h"
> +
> /**
> * DOC: PCODE
> *
> --
> 2.38.1
>
next prev parent reply other threads:[~2023-01-31 18:49 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-12 22:25 [Intel-xe] [PATCH 00/37] Catching up since we went public Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 01/37] drm/msm: Fix compile error Rodrigo Vivi
2023-01-31 18:48 ` Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 02/37] drm/xe: Implement a local xe_mmio_wait32 Rodrigo Vivi
2023-01-31 18:49 ` Rodrigo Vivi [this message]
2023-02-01 4:44 ` Matthew Brost
2023-01-12 22:25 ` [Intel-xe] [PATCH 03/37] drm/xe: Stop using i915's range_overflows_t macro Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 04/37] drm/xe: Let's return last value read on xe_mmio_wait32 Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 05/37] drm/xe: Convert guc_ready to regular xe_mmio_wait32 Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 06/37] drm/xe: Wait for success on guc done Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 07/37] drm/xe: Remove i915_utils dependency from xe_guc_pc Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 08/37] drm/xe: Stop using i915_utils in xe_wopcm Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 09/37] drm/xe: Let's avoid i915_utils in the xe_force_wake Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 10/37] drm/xe: Convert xe_mmio_wait32 to us so we can stop using wait_for_us Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 11/37] drm/xe: Remove i915_utils dependency from xe_pcode Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 12/37] drm/xe/migrate: Add kerneldoc for the migrate subsystem Rodrigo Vivi
2023-01-20 23:03 ` Mauro Carvalho Chehab
2023-01-12 22:25 ` [Intel-xe] [PATCH 13/37] drm/xe: Take memory ref on kernel job creation Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 14/37] drm/xe: Add intel_pps support too Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 15/37] drm/xe: Rework initialisation ordering slightly so we can inherit fb Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 16/37] drm/xe: Implement stolen memory Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 17/37] drm/xe: Allow fbdev to allocate " Rodrigo Vivi
2023-01-24 15:42 ` Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 18/37] drm/xe: Implement initial hw readout for framebuffer Rodrigo Vivi
2023-01-24 15:43 ` Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 19/37] drm/xe: Put DPT into stolen memory, if available Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 20/37] drm/xe: Implement FBC support Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 21/37] drm/i915: Remove i915_drm_suspend_mode Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 22/37] drm/xe: Fix compilation when Xe driver is builtin Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 23/37] drm/xe: Fix dumb bo create Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 24/37] drm/i915: Expand force_probe to block probe of devices as well Rodrigo Vivi
2023-01-20 23:08 ` Mauro Carvalho Chehab
2023-01-12 22:25 ` [Intel-xe] [PATCH 25/37] drm/xe: Introduce force_probe parameter Rodrigo Vivi
2023-01-20 23:07 ` Mauro Carvalho Chehab
2023-01-12 22:25 ` [Intel-xe] [PATCH 26/37] Revert "drm/xe: Validate BO on CPU fault" Rodrigo Vivi
2023-01-24 15:44 ` Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 27/37] drm/xe: Ensure VMA not userptr before calling xe_bo_is_stolen Rodrigo Vivi
2023-02-03 19:56 ` Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 28/37] drm/xe: Don't use engine_mask until after hwconfig parse Rodrigo Vivi
2023-01-31 18:51 ` Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 29/37] drm/xe: Fake pulling gt->info.engine_mask from hwconfig blob Rodrigo Vivi
2023-01-31 19:03 ` Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 30/37] drm/xe/guc: Report submission version of GuC firmware Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 31/37] drm/xe/guc: s/xe_guc_send_mmio/xe_guc_mmio_send Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 32/37] drm/xe/guc: Add support GuC MMIO send / recv Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 33/37] drm/xe: Make FBC check stolen at use time Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 34/37] drm/xe: Move xe_ttm_stolen_mgr_init back Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 35/37] drm/xe: Fix hidden gotcha regression with bo create Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 36/37] drm/xe: Fix xe_mmio_wait32 timeouts Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 37/37] drm/xe: enforce GSMBASE for DG1 instead of BAR2 Rodrigo Vivi
2023-01-24 15:46 ` Rodrigo Vivi
2023-01-24 16:25 ` Lecluse, Philippe
2023-01-31 19:11 ` Rodrigo Vivi
2023-01-31 19:13 ` Rodrigo Vivi
2023-02-01 9:12 ` Matthew Auld
2023-02-01 9:13 ` Matthew Auld
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=Y9linmMswlANIT8f@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matthew.brost@intel.com \
--cc=mchehab@kernel.org \
--cc=philippe.lecluse@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