Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: "Anoop, Vijay" <anoop.c.vijay@intel.com>,
	<intel-xe@lists.freedesktop.org>
Cc: <umesh.nerlige.ramappa@intel.com>, <badal.nilawar@intel.com>,
	<rodrigo.vivi@intel.com>, <aravind.iddamsetty@intel.com>,
	<riana.tauro@intel.com>, <anshuman.gupta@intel.com>,
	<matthew.d.roper@intel.com>, <michael.j.ruhl@intel.com>,
	<paul.e.luse@intel.com>, <mohamed.mansoor.v@intel.com>,
	<kam.nasim@intel.com>
Subject: Re: [PATCH v7 4/6] drm/xe/sysctrl: Add System Controller initialization
Date: Fri, 30 Jan 2026 00:11:30 +0100	[thread overview]
Message-ID: <bcb3d5ae-f4cd-46ff-ad20-cbbc0e44cb64@intel.com> (raw)
In-Reply-To: <20260129121044.3670780-12-anoop.c.vijay@intel.com>



On 1/29/2026 1:10 PM, Anoop, Vijay wrote:
> From: Anoop Vijay <anoop.c.vijay@intel.com>
> 
> Add top-level System Controller initialization and cleanup:
> - SOC remapper region configuration
> - Mailbox initialization
> - Resource cleanup on driver unload
> 
> Signed-off-by: Anoop Vijay <anoop.c.vijay@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_sysctrl.c | 80 +++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/xe/xe_sysctrl.h | 13 ++++++
>  2 files changed, 93 insertions(+)
>  create mode 100644 drivers/gpu/drm/xe/xe_sysctrl.c
>  create mode 100644 drivers/gpu/drm/xe/xe_sysctrl.h
> 
> diff --git a/drivers/gpu/drm/xe/xe_sysctrl.c b/drivers/gpu/drm/xe/xe_sysctrl.c
> new file mode 100644
> index 000000000000..430bccbdc3b9
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/xe_sysctrl.c
> @@ -0,0 +1,80 @@
> +// SPDX-License-Identifier: MIT
> +/*
> + * Copyright © 2026 Intel Corporation
> + */
> +
> +#include <drm/drm_managed.h>
> +#include <linux/device.h>
> +#include <linux/mutex.h>

usually we put linux includes first, before drm includes

> +
> +#include "regs/xe_sysctrl_regs.h"
> +#include "xe_device.h"
> +#include "xe_mmio.h"
> +#include "xe_printk.h"
> +#include "xe_soc_remapper.h"
> +#include "xe_sysctrl.h"
> +#include "xe_sysctrl_mailbox.h"
> +#include "xe_sysctrl_types.h"
> +
> +/**
> + * DOC: System Controller (sysctrl)
> + *
> + * The System Controller (sysctrl) is an embedded microcontroller in Intel GPUs
> + * responsible for managing various low-level platform functions. Communication
> + * between the driver and the System Controller occurs via a mailbox interface,
> + * enabling the exchange of commands and responses.
> + *
> + * This module provides initialization routines and helper functions to interact
> + * with the System Controller through the mailbox.
> + */
> +
> +static void xe_sysctrl_fini(void *arg)
> +{
> +	struct xe_device *xe = arg;
> +
> +	xe->soc_remapper.set_sysctrl_region(xe, 0);
> +}
> +
> +/**
> + * xe_sysctrl_init - Initialize System Controller subsystem

btw, while still not common in Xe, the official syntax for function kernel-doc is:

    * xe_sysctrl_init() - Initialize System Controller subsystem

> + * @xe: xe device instance
> + *
> + * Entry point for System Controller initialization, called from xe_device_probe.
> + * This function checks platform support and initializes the system controller.
> + *
> + * Return: 0 on success, error code on failure
> + */
> +int xe_sysctrl_init(struct xe_device *xe)
> +{
> +	struct xe_tile *tile = xe_device_get_root_tile(xe);
> +	struct xe_sysctrl *sc = &xe->sc;
> +	int ret;
> +
> +	if (!xe->info.has_sysctrl)
> +		return 0;
> +
> +	if (!xe->soc_remapper.set_sysctrl_region)
> +		return -ENODEV;

can't we just assert that?

> +
> +	xe->soc_remapper.set_sysctrl_region(xe, SYSCTRL_MAILBOX_INDEX);
> +
> +	ret = devm_add_action_or_reset(xe->drm.dev, xe_sysctrl_fini, xe);
> +	if (ret)
> +		return ret;
> +
> +	sc->mmio = devm_kzalloc(xe->drm.dev, sizeof(*sc->mmio), GFP_KERNEL);
> +	if (!sc->mmio)
> +		return -ENOMEM;
> +
> +	xe_mmio_init(sc->mmio, tile, tile->mmio.regs, tile->mmio.regs_size);
> +	sc->mmio->adj_offset = SYSCTRL_BASE;
> +	sc->mmio->adj_limit = U32_MAX;
> +
> +	ret = drmm_mutex_init(&xe->drm, &sc->cmd_lock);
> +	if (ret)
> +		return ret;
> +
> +	xe_sysctrl_mailbox_init(sc);
> +
> +	return 0;
> +}
> diff --git a/drivers/gpu/drm/xe/xe_sysctrl.h b/drivers/gpu/drm/xe/xe_sysctrl.h
> new file mode 100644
> index 000000000000..ee7826fe4c98
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/xe_sysctrl.h
> @@ -0,0 +1,13 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2026 Intel Corporation
> + */
> +
> +#ifndef _XE_SYSCTRL_H_
> +#define _XE_SYSCTRL_H_
> +
> +struct xe_device;
> +
> +int xe_sysctrl_init(struct xe_device *xe);
> +
> +#endif /* _XE_SYSCTRL_H_ */

no need to comment simple endif


  reply	other threads:[~2026-01-29 23:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-29 12:10 [PATCH v7 0/6] drm/xe/sysctrl: Add system controller component for Xe3p dGPU platforms Anoop, Vijay
2026-01-29 12:10 ` [PATCH v7 1/6] drm/xe/sysctrl: Add System Controller register definitions Anoop, Vijay
2026-01-29 12:10 ` [PATCH v7 2/6] drm/xe/sysctrl: Add System Controller types and structures Anoop, Vijay
2026-01-29 22:08   ` Michal Wajdeczko
2026-01-29 12:10 ` [PATCH v7 3/6] drm/xe/sysctrl: Add System Controller mailbox implementation Anoop, Vijay
2026-01-29 22:52   ` Michal Wajdeczko
2026-01-29 12:10 ` [PATCH v7 4/6] drm/xe/sysctrl: Add System Controller initialization Anoop, Vijay
2026-01-29 23:11   ` Michal Wajdeczko [this message]
2026-01-30 19:59   ` Matt Roper
2026-03-02  8:22     ` Anoop Vijay
2026-01-29 12:10 ` [PATCH v7 5/6] drm/xe/sysctrl: Integrate System Controller into device Anoop, Vijay
2026-01-29 12:10 ` [PATCH v7 6/6] drm/xe/sysctrl: Enable System Controller for Xe3p Anoop, Vijay
2026-01-29 23:19   ` Michal Wajdeczko
2026-01-29 12:43 ` ✗ CI.checkpatch: warning for drm/xe/sysctrl: Add system controller component for Xe3p dGPU platforms (rev7) Patchwork
2026-01-29 12:45 ` ✓ CI.KUnit: success " Patchwork
2026-01-29 13:26 ` ✓ Xe.CI.BAT: " 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=bcb3d5ae-f4cd-46ff-ad20-cbbc0e44cb64@intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=anoop.c.vijay@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=aravind.iddamsetty@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=kam.nasim@intel.com \
    --cc=matthew.d.roper@intel.com \
    --cc=michael.j.ruhl@intel.com \
    --cc=mohamed.mansoor.v@intel.com \
    --cc=paul.e.luse@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=rodrigo.vivi@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