Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Piórkowski, Piotr" <piotr.piorkowski@intel.com>
To: <igt-dev@lists.freedesktop.org>
Cc: "Piotr Piórkowski" <piotr.piorkowski@intel.com>,
	"Lukasz Laguna" <lukasz.laguna@intel.com>,
	"Marcin Bernatowicz" <marcin.bernatowicz@linux.intel.com>
Subject: [PATCH v1 2/3] lib/xe_mmio: Add init flag and helper to check initialization
Date: Mon, 20 Oct 2025 18:26:32 +0200	[thread overview]
Message-ID: <20251020162633.2622396-3-piotr.piorkowski@intel.com> (raw)
In-Reply-To: <20251020162633.2622396-1-piotr.piorkowski@intel.com>

From: Piotr Piórkowski <piotr.piorkowski@intel.com>

Track MMIO initialization state via a new `init` flag and expose it
through xe_mmio_is_initialized().

Signed-off-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
Cc: Lukasz Laguna <lukasz.laguna@intel.com>
Cc: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
---
 lib/xe/xe_mmio.c | 14 ++++++++++++++
 lib/xe/xe_mmio.h |  2 ++
 2 files changed, 16 insertions(+)

diff --git a/lib/xe/xe_mmio.c b/lib/xe/xe_mmio.c
index 8bc446fb9..43aa354ff 100644
--- a/lib/xe/xe_mmio.c
+++ b/lib/xe/xe_mmio.c
@@ -25,6 +25,7 @@ void xe_mmio_vf_access_init(int pf_fd, int vf_id, struct xe_mmio *mmio)
 
 	intel_register_access_init(&mmio->intel_mmio, pci_dev, false);
 	mmio->fd = pf_fd;
+	mmio->init = true;
 }
 
 /**
@@ -39,6 +40,18 @@ void xe_mmio_access_init(int pf_fd, struct xe_mmio *mmio)
 	xe_mmio_vf_access_init(pf_fd, 0, mmio);
 }
 
+/**
+ * xe_mmio_is_initialized:
+ * @mmio: xe mmio structure for IO operations
+ *
+ * Returns:
+ * Non-zero if the xe mmio structure is initialized.
+ */
+bool xe_mmio_is_initialized(const struct xe_mmio *mmio)
+{
+	return mmio->init;
+}
+
 /**
  * xe_mmio_access_fini:
  * @mmio: xe mmio structure for IO operations
@@ -49,6 +62,7 @@ void xe_mmio_access_init(int pf_fd, struct xe_mmio *mmio)
 void xe_mmio_access_fini(struct xe_mmio *mmio)
 {
 	intel_register_access_fini(&mmio->intel_mmio);
+	mmio->init = false;
 }
 
 /**
diff --git a/lib/xe/xe_mmio.h b/lib/xe/xe_mmio.h
index f15017c96..1710a384f 100644
--- a/lib/xe/xe_mmio.h
+++ b/lib/xe/xe_mmio.h
@@ -16,11 +16,13 @@ typedef uint64_t xe_ggtt_pte_t;
 
 struct xe_mmio {
 	int fd;
+	bool init;
 	struct intel_mmio_data intel_mmio;
 };
 
 void xe_mmio_vf_access_init(int pf_fd, int vf_id, struct xe_mmio *mmio);
 void xe_mmio_access_init(int pf_fd, struct xe_mmio *mmio);
+bool xe_mmio_is_initialized(const struct xe_mmio *mmio);
 void xe_mmio_access_fini(struct xe_mmio *mmio);
 
 uint32_t xe_mmio_read32(struct xe_mmio *mmio, uint32_t offset);
-- 
2.34.1


  parent reply	other threads:[~2025-10-20 16:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-20 16:26 [PATCH v1 0/3] Multi-tile support for xe_sriov_flr and other MMIO improvements Piórkowski, Piotr
2025-10-20 16:26 ` [PATCH v1 1/3] lib/xe_mmio: Introduce tile-level XE MMIO access helpers Piórkowski, Piotr
2025-10-22 11:54   ` Sokolowski, Jan
2025-10-20 16:26 ` Piórkowski, Piotr [this message]
2025-10-22 11:55   ` [PATCH v1 2/3] lib/xe_mmio: Add init flag and helper to check initialization Sokolowski, Jan
2025-10-20 16:26 ` [PATCH v1 3/3] tests/xe_sriov_flr: extend VF FLR test for multi-tile Xe devices Piórkowski, Piotr
2025-10-23 10:43   ` Bernatowicz, Marcin
2025-10-23 11:56   ` Bernatowicz, Marcin
2025-10-23 14:43   ` Bernatowicz, Marcin
2025-10-21  2:23 ` ✓ i915.CI.BAT: success for Multi-tile support for xe_sriov_flr and other MMIO improvements Patchwork
2025-10-21  4:20 ` ✓ Xe.CI.BAT: " Patchwork
2025-10-21  5:50 ` ✗ Xe.CI.Full: failure " Patchwork
2025-10-21 12:15 ` Patchwork
2025-10-21 17:29 ` ✗ i915.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=20251020162633.2622396-3-piotr.piorkowski@intel.com \
    --to=piotr.piorkowski@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=lukasz.laguna@intel.com \
    --cc=marcin.bernatowicz@linux.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