Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Anoop Vijay <anoop.c.vijay@intel.com>
To: Matt Roper <matthew.d.roper@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
	<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>,
	<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: Mon, 2 Mar 2026 13:52:18 +0530	[thread overview]
Message-ID: <a8794baa-a0a0-4aa6-bb50-86c2c1679bb2@intel.com> (raw)
In-Reply-To: <20260130195959.GF458797@mdroper-desk1.amr.corp.intel.com>

Hi Matt,

Thank you for your feedback on patch ordering. This has been addressed 
in v8. Patch series is reordered to follow logical initialization 
sequence as you suggested:

v8 Patch Order:
1. Types and device integration
2. Register definitions
3. Mailbox headers
4. Sysctrl Initialization
5. Mailbox Implementation
6. Platform enablement

Thanks,
Anoop

On 1/31/2026 1:29 AM, Matt Roper wrote:
> On Thu, Jan 29, 2026 at 04:10:45AM -0800, 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>
>> +
>> +#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
>> + * @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;
>> +
>> +	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;
> 
> I assume the whole series is effectively "dead code" until we finally
> flip the flag on for some platforms in the last patch, but it's still
> somewhat confusing to be using sc->mmio in the previous patch, but not
> initializing it until this one. People usually review patches in series
> order, so while reading the previous patch, they may be wondering what
> the target of the MMIO operations is, which they won't find out until
> this later patch.  It can also cause confusion if someone is doing a
> bisect and inspecting the state of the code at some intermediate point.
> Is it possible to shuffle the order around so that general
> initialization comes earlier in the series, followed by code that builds
> upon the items initialized?
> 
> 
> Matt
> 
>> +
>> +	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_ */
>> -- 
>> 2.43.0
>>
> 


  reply	other threads:[~2026-03-02  8:22 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
2026-01-30 19:59   ` Matt Roper
2026-03-02  8:22     ` Anoop Vijay [this message]
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=a8794baa-a0a0-4aa6-bb50-86c2c1679bb2@intel.com \
    --to=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