MCHBAR registers are a bit special in that:
- we access them through the mirror
- the mirror is read only on HSW+
- the mirror requires the actual MCHBAR to be enabled in device 0:0.0
- the mirror is gone on MTL+
So I'd prefer to treat MCHBAR registers as a bit special in
the code as well, and do all accesses to them via dedicated
functions. Prodive such functions in the form of
intel_mchbar_read*().
v2: Put the function arguments on one line
No intel_uncore_read64() on xe, use intel_uncore_read64_2x32()
Name the new function intel_mchbar_read64_2x32() as well
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patch.msgid.link/20260331154259.24600-3-ville.syrjala@linux.intel.com
display/intel_link_bw.o \
display/intel_load_detect.o \
display/intel_lpe_audio.o \
+ display/intel_mchbar.o \
display/intel_modeset_lock.o \
display/intel_modeset_setup.o \
display/intel_modeset_verify.o \
--- /dev/null
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#include "intel_display_core.h"
+#include "intel_mchbar.h"
+#include "intel_uncore.h"
+
+u16 intel_mchbar_read16(struct intel_display *display, i915_reg_t reg)
+{
+ struct intel_uncore *uncore = to_intel_uncore(display->drm);
+
+ return intel_uncore_read16(uncore, reg);
+}
+
+u32 intel_mchbar_read(struct intel_display *display, i915_reg_t reg)
+{
+ struct intel_uncore *uncore = to_intel_uncore(display->drm);
+
+ return intel_uncore_read(uncore, reg);
+}
+
+u64 intel_mchbar_read64_2x32(struct intel_display *display, i915_reg_t reg)
+{
+ struct intel_uncore *uncore = to_intel_uncore(display->drm);
+ i915_reg_t upper_reg = _MMIO(i915_mmio_reg_offset(reg) + 4);
+
+ return intel_uncore_read64_2x32(uncore, reg, upper_reg);
+}
--- /dev/null
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef __INTEL_MCHBAR_H__
+#define __INTEL_MCHBAR_H__
+
+#include <linux/types.h>
+
+#include "i915_reg_defs.h"
+
+struct intel_display;
+
+u16 intel_mchbar_read16(struct intel_display *display, i915_reg_t reg);
+u32 intel_mchbar_read(struct intel_display *display, i915_reg_t reg);
+u64 intel_mchbar_read64_2x32(struct intel_display *display, i915_reg_t reg);
+
+#endif /* __INTEL_MCHBAR_H__ */
i915-display/intel_link_bw.o \
i915-display/intel_lspcon.o \
i915-display/intel_lt_phy.o \
+ i915-display/intel_mchbar.o \
i915-display/intel_modeset_lock.o \
i915-display/intel_modeset_setup.o \
i915-display/intel_modeset_verify.o \