All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH 1/3] drm/i915: Extract intel_mmio_bar()
@ 2022-10-05 15:41 Ville Syrjala
  2022-10-05 15:41 ` [Intel-gfx] [PATCH 2/3] drm/i915: Name our BARs based on the spec Ville Syrjala
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Ville Syrjala @ 2022-10-05 15:41 UTC (permalink / raw)
  To: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We have the same code to determine the MMIO BAR in
two places. Collect it to a single place.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/gt/intel_gt.c      | 2 +-
 drivers/gpu/drm/i915/i915_pci.c         | 4 +---
 drivers/gpu/drm/i915/intel_pci_config.h | 8 ++++++++
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c
index b367cfff48d5..8995a21c2209 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt.c
@@ -838,7 +838,7 @@ int intel_gt_probe_all(struct drm_i915_private *i915)
 	unsigned int i;
 	int ret;
 
-	mmio_bar = GRAPHICS_VER(i915) == 2 ? GEN2_GTTMMADR_BAR : GTTMMADR_BAR;
+	mmio_bar = intel_mmio_bar(GRAPHICS_VER(i915));
 	phys_addr = pci_resource_start(pdev, mmio_bar);
 
 	/*
diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
index 38460a0bd7cb..19ae173937bc 100644
--- a/drivers/gpu/drm/i915/i915_pci.c
+++ b/drivers/gpu/drm/i915/i915_pci.c
@@ -1297,9 +1297,7 @@ bool i915_pci_resource_valid(struct pci_dev *pdev, int bar)
 
 static bool intel_mmio_bar_valid(struct pci_dev *pdev, struct intel_device_info *intel_info)
 {
-	int gttmmaddr_bar = intel_info->__runtime.graphics.ip.ver == 2 ? GEN2_GTTMMADR_BAR : GTTMMADR_BAR;
-
-	return i915_pci_resource_valid(pdev, gttmmaddr_bar);
+	return i915_pci_resource_valid(pdev, intel_mmio_bar(intel_info->__runtime.graphics.ip.ver));
 }
 
 static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
diff --git a/drivers/gpu/drm/i915/intel_pci_config.h b/drivers/gpu/drm/i915/intel_pci_config.h
index 4977a524ce6f..305f137d2ebd 100644
--- a/drivers/gpu/drm/i915/intel_pci_config.h
+++ b/drivers/gpu/drm/i915/intel_pci_config.h
@@ -13,6 +13,14 @@
 #define GTT_APERTURE_BAR			GFXMEM_BAR
 #define GEN12_LMEM_BAR				GFXMEM_BAR
 
+static inline int intel_mmio_bar(int graphics_ver)
+{
+	switch (graphics_ver) {
+	case 2: return GEN2_GTTMMADR_BAR;
+	default: return GTTMMADR_BAR;
+	}
+}
+
 /* BSM in include/drm/i915_drm.h */
 
 #define MCHBAR_I915				0x44
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-10-06 13:37 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-05 15:41 [Intel-gfx] [PATCH 1/3] drm/i915: Extract intel_mmio_bar() Ville Syrjala
2022-10-05 15:41 ` [Intel-gfx] [PATCH 2/3] drm/i915: Name our BARs based on the spec Ville Syrjala
2022-10-05 16:02   ` Matthew Auld
2022-10-05 16:43     ` Ville Syrjälä
2022-10-05 18:23   ` kernel test robot
2022-10-05 19:56   ` [Intel-gfx] [PATCH v2 " Ville Syrjala
2022-10-06  8:42     ` Matthew Auld
2022-10-05 15:41 ` [Intel-gfx] [PATCH 3/3] drm/i915: s/HAS_BAR2_SMEM_STOLEN/HAS_LMEMBAR_SMEM_STOLEN/ Ville Syrjala
2022-10-05 16:05   ` Matthew Auld
2022-10-05 15:47 ` [Intel-gfx] [PATCH 1/3] drm/i915: Extract intel_mmio_bar() Matthew Auld
2022-10-05 17:50 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for series starting with [1/3] " Patchwork
2022-10-05 20:13 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/3] drm/i915: Extract intel_mmio_bar() (rev2) Patchwork
2022-10-05 20:32 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-10-06 13:37 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.