From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 44F0FCCFA05 for ; Thu, 6 Nov 2025 15:28:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C06E310E935; Thu, 6 Nov 2025 15:28:34 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="FCPxhjLW"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id 90BB310E935 for ; Thu, 6 Nov 2025 15:28:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1762442913; x=1793978913; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qitlHTbsoPMzezzP1ywsfT02B7fcaeEfsvmY1X4GGrU=; b=FCPxhjLWiv87GFzhc43VTN4TWfVSbLNJYFbevDC8c3KtCMLYnpxR/Gof S5cRwKpHMjdqnCqzdja6h/tm0efSS+97A25ukGgOdtH92kVEti6xxsRbV gcptWFO0eTivMdf2T682q77qoEEstK5vVtyLwlP9+AOR37FszqyL6yIAB dZfEZhT60gx0gPmtu4CaSPDTKgFQCmWT5aUMv88a7ob8EHcbhJy3vhcm9 0R0MONRc2g/LmtO0iNhssB82ajbMlrJuXl28n2QxjSCJWLay9+TSIfPBa aUh6Cmz1hEXaGxqGt2MSb8YK7KeTRzTWDjKAgEWOJVMbT5VnFSimY/1i+ g==; X-CSE-ConnectionGUID: nxv51ULFRY+4f1XAUZzOyg== X-CSE-MsgGUID: UEkYz/CpRPaxmbwlKxrIRg== X-IronPort-AV: E=McAfee;i="6800,10657,11604"; a="75270136" X-IronPort-AV: E=Sophos;i="6.19,284,1754982000"; d="scan'208";a="75270136" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2025 07:28:33 -0800 X-CSE-ConnectionGUID: j7jlk7XiS7+lJ5X0HJrJFA== X-CSE-MsgGUID: Q9AHJo7bR1+85J9TsB71rg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,284,1754982000"; d="scan'208";a="192832498" Received: from soc-5cg43972f8.clients.intel.com (HELO localhost) ([172.28.180.65]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2025 07:28:31 -0800 From: Marcin Bernatowicz To: igt-dev@lists.freedesktop.org Cc: piotr.piorkowski@intel.com, lukasz.laguna@intel.com, jakub1.kolakowski@intel.com, Marcin Bernatowicz , Jan Sokolowski Subject: [PATCH i-g-t 2/6] lib/xe_mmio: Add init flag and helper to check initialization Date: Thu, 6 Nov 2025 16:28:06 +0100 Message-ID: <20251106152811.1997614-3-marcin.bernatowicz@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251106152811.1997614-1-marcin.bernatowicz@linux.intel.com> References: <20251106152811.1997614-1-marcin.bernatowicz@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: igt-dev@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development mailing list for IGT GPU Tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" From: Piotr Piórkowski Track MMIO initialization state via a new `init` flag and expose it through xe_mmio_is_initialized(). Signed-off-by: Piotr Piórkowski Cc: Lukasz Laguna Cc: Marcin Bernatowicz Reviewed-by: Jan Sokolowski Signed-off-by: Marcin Bernatowicz --- 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 b52e90dba..94e516417 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 35cafa448..030c50a2e 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.43.0