From: "Mallesh, Koujalagi" <mallesh.koujalagi@intel.com>
To: Raag Jadav <raag.jadav@intel.com>, <intel-xe@lists.freedesktop.org>
Cc: <rodrigo.vivi@intel.com>, <riana.tauro@intel.com>,
<michal.wajdeczko@intel.com>, <matthew.d.roper@intel.com>,
<umesh.nerlige.ramappa@intel.com>, <soham.purkait@intel.com>,
<anoop.c.vijay@intel.com>
Subject: Re: [v1,2/4] drm/xe/sysctrl: Add system controller interrupt handler
Date: Tue, 20 Jan 2026 14:00:17 +0530 [thread overview]
Message-ID: <53ed39da-58cb-473b-8510-da6bb4e4cf21@intel.com> (raw)
In-Reply-To: <20260116093432.914040-3-raag.jadav@intel.com>
Hi Raag,
On 16-01-2026 03:03 pm, Raag Jadav wrote:
> Add system controller interrupt handler which is denoted by 11th bit in
> GFX master interrupt register. While at it, add ordered workqueue for
> scheduling system controller work.
>
> Co-developed-by: Soham Purkait <soham.purkait@intel.com>
> Signed-off-by: Soham Purkait <soham.purkait@intel.com>
> Signed-off-by: Raag Jadav <raag.jadav@intel.com>
> ---
> drivers/gpu/drm/xe/regs/xe_irq_regs.h | 1 +
> drivers/gpu/drm/xe/xe_irq.c | 2 ++
> drivers/gpu/drm/xe/xe_sysctrl.c | 39 +++++++++++++++++++++++++++
> drivers/gpu/drm/xe/xe_sysctrl.h | 3 +++
> drivers/gpu/drm/xe/xe_sysctrl_types.h | 7 +++++
> 5 files changed, 52 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/regs/xe_irq_regs.h b/drivers/gpu/drm/xe/regs/xe_irq_regs.h
> index 9d74f454d3ff..1d6b976c4de0 100644
> --- a/drivers/gpu/drm/xe/regs/xe_irq_regs.h
> +++ b/drivers/gpu/drm/xe/regs/xe_irq_regs.h
> @@ -22,6 +22,7 @@
> #define DISPLAY_IRQ REG_BIT(16)
> #define SOC_H2DMEMINT_IRQ REG_BIT(13)
> #define I2C_IRQ REG_BIT(12)
> +#define SYSCTRL_IRQ REG_BIT(11)
> #define GT_DW_IRQ(x) REG_BIT(x)
>
> /*
> diff --git a/drivers/gpu/drm/xe/xe_irq.c b/drivers/gpu/drm/xe/xe_irq.c
> index 7560a45f7f64..9e49e2241da4 100644
> --- a/drivers/gpu/drm/xe/xe_irq.c
> +++ b/drivers/gpu/drm/xe/xe_irq.c
> @@ -24,6 +24,7 @@
> #include "xe_mmio.h"
> #include "xe_pxp.h"
> #include "xe_sriov.h"
> +#include "xe_sysctrl.h"
> #include "xe_tile.h"
>
> /*
> @@ -525,6 +526,7 @@ static irqreturn_t dg1_irq_handler(int irq, void *arg)
> xe_heci_csc_irq_handler(xe, master_ctl);
> xe_display_irq_handler(xe, master_ctl);
> xe_i2c_irq_handler(xe, master_ctl);
> + xe_sysctrl_irq_handler(xe, master_ctl);
> xe_mert_irq_handler(xe, master_ctl);
> gu_misc_iir = gu_misc_irq_ack(xe, master_ctl);
> }
> diff --git a/drivers/gpu/drm/xe/xe_sysctrl.c b/drivers/gpu/drm/xe/xe_sysctrl.c
> index 8daab7703247..1d78916dd6ad 100644
> --- a/drivers/gpu/drm/xe/xe_sysctrl.c
> +++ b/drivers/gpu/drm/xe/xe_sysctrl.c
> @@ -7,6 +7,7 @@
> #include <linux/device.h>
> #include <linux/mutex.h>
>
> +#include "regs/xe_irq_regs.h"
> #include "regs/xe_sysctrl_regs.h"
> #include "xe_device.h"
> #include "xe_printk.h"
> @@ -27,9 +28,17 @@
> * with the System Controller through the mailbox.
> */
>
> +static void xe_sysctrl_work(struct work_struct *work)
> +{
> +}
> +
> static void xe_sysctrl_fini(void *arg)
> {
> struct xe_device *xe = arg;
> + struct xe_sysctrl *sc = &xe->sc;
> +
> + cancel_work_sync(&sc->work);
> + destroy_workqueue(sc->wq);
>
> xe->soc_remapper.set_sysctrl_region(xe, 0);
> }
> @@ -56,6 +65,14 @@ int xe_sysctrl_init(struct xe_device *xe)
>
> xe->soc_remapper.set_sysctrl_region(xe, SYSCTRL_MAILBOX_INDEX);
>
> + INIT_WORK(&sc->work, xe_sysctrl_work);
> +
> + sc->wq = alloc_ordered_workqueue("sysctrl-ordered-wq", 0);
> + if (!sc->wq) {
> + ret = -ENOMEM;
> + goto err_sysctrl_fini;
> + }
> +
> ret = devm_add_action_or_reset(xe->drm.dev, xe_sysctrl_fini, xe);
> if (ret)
> return ret;
> @@ -67,4 +84,26 @@ int xe_sysctrl_init(struct xe_device *xe)
> xe_sysctrl_mailbox_init(sc);
>
> return 0;
> +
> +err_sysctrl_fini:
> + xe_sysctrl_fini(xe);
> + return ret;
> +}
> +
> +/**
> + * xe_sysctrl_irq_handler: Handler for System Controller interrupts
> + * @xe: xe device instance
> + * @master_ctl: interrupt register
> + *
> + * Handle interrupts generated by System Controller.
> + */
> +void xe_sysctrl_irq_handler(struct xe_device *xe, u32 master_ctl)
> +{
> + struct xe_sysctrl *sc = &xe->sc;
> +
> + if (!xe->info.has_sysctrl)
> + return;
> +
> + if (master_ctl & SYSCTRL_IRQ)
> + queue_work(sc->wq, &sc->work);
> }
The interrupt handler could be called before initialization completes
which cause a null pointer deference when we access sc->wq.
Thanks
-/Mallesh
> diff --git a/drivers/gpu/drm/xe/xe_sysctrl.h b/drivers/gpu/drm/xe/xe_sysctrl.h
> index ee7826fe4c98..5919310b9db9 100644
> --- a/drivers/gpu/drm/xe/xe_sysctrl.h
> +++ b/drivers/gpu/drm/xe/xe_sysctrl.h
> @@ -6,8 +6,11 @@
> #ifndef _XE_SYSCTRL_H_
> #define _XE_SYSCTRL_H_
>
> +#include <linux/types.h>
> +
> struct xe_device;
>
> int xe_sysctrl_init(struct xe_device *xe);
> +void xe_sysctrl_irq_handler(struct xe_device *xe, u32 master_ctl);
>
> #endif /* _XE_SYSCTRL_H_ */
> diff --git a/drivers/gpu/drm/xe/xe_sysctrl_types.h b/drivers/gpu/drm/xe/xe_sysctrl_types.h
> index 88a34967688b..14fc80dfee6e 100644
> --- a/drivers/gpu/drm/xe/xe_sysctrl_types.h
> +++ b/drivers/gpu/drm/xe/xe_sysctrl_types.h
> @@ -8,6 +8,7 @@
>
> #include <linux/mutex.h>
> #include <linux/types.h>
> +#include <linux/workqueue_types.h>
>
> /**
> * struct xe_sysctrl - System Controller driver context
> @@ -18,6 +19,12 @@ struct xe_sysctrl {
>
> /** @phase_bit: MKHI message boundary phase toggle bit */
> u32 phase_bit;
> +
> + /** @wq: Queue for sysctrl work */
> + struct workqueue_struct *wq;
> +
> + /** @work: Worker for pending events */
> + struct work_struct work;
> };
>
> #endif /* _XE_SYSCTRL_TYPES_H_ */
next prev parent reply other threads:[~2026-01-20 8:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-16 9:33 [PATCH v1 0/4] Introduce Xe Correctable Error Handling Raag Jadav
2026-01-16 9:33 ` [PATCH v1 1/4] drm/xe/sysctrl: Add System Controller Raag Jadav
2026-01-16 9:33 ` [PATCH v1 2/4] drm/xe/sysctrl: Add system controller interrupt handler Raag Jadav
2026-01-16 21:30 ` Matthew Brost
2026-01-17 7:13 ` Raag Jadav
2026-01-20 8:30 ` Mallesh, Koujalagi [this message]
2026-01-20 12:05 ` [v1,2/4] " Raag Jadav
2026-01-16 9:33 ` [PATCH v1 3/4] drm/xe/sysctrl: Add system controller event support Raag Jadav
2026-01-20 8:46 ` [v1,3/4] " Mallesh, Koujalagi
2026-01-20 12:10 ` Raag Jadav
2026-01-16 9:33 ` [PATCH v1 4/4] drm/xe/ras: Introduce correctable error handling Raag Jadav
2026-01-20 8:51 ` [v1,4/4] " Mallesh, Koujalagi
2026-01-20 12:17 ` Raag Jadav
2026-01-16 10:08 ` ✗ CI.checkpatch: warning for Introduce Xe Correctable Error Handling Patchwork
2026-01-16 10:09 ` ✓ CI.KUnit: success " Patchwork
2026-01-16 11:02 ` ✓ Xe.CI.BAT: " Patchwork
2026-01-16 14:25 ` ✓ Xe.CI.Full: " 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=53ed39da-58cb-473b-8510-da6bb4e4cf21@intel.com \
--to=mallesh.koujalagi@intel.com \
--cc=anoop.c.vijay@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.d.roper@intel.com \
--cc=michal.wajdeczko@intel.com \
--cc=raag.jadav@intel.com \
--cc=riana.tauro@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=soham.purkait@intel.com \
--cc=umesh.nerlige.ramappa@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