Skip to contentSkip to conversation

Remove global igt_global_mmio

PATCH Superseded Daniel Mrzyglod 3 participants 9 messages May 9, 2019 Library code

v5 of 12 Superseded Latest is v12 →

lore
Share & tools
lore
#0 lore raw

v5 cover Remove global igt_global_mmio

This patchset remove global igt_global_mmio pointer and structures. Motivation for this patch is to move global pointers. Current behaviour limit number of concurrent PCI device. There is a need to run multiple devices.

v2: fixed bugs pointed out in review
v3: divide series to more patches - fix bugs
v4: reword fix bugs
v5: removed patch 03/06 from the previous series due to sugestions
add fd to gem_mappable_aperture_size()

Daniel Mrzyglod (4):
lib/igt_device: add igt_device_map_pci_bar_region lib/intel_mmio: add pointer for read/write register funtions lib/intel_mmio: remove igt_global_mmio and move it to mmio_data lib/ioctl_wrappers: add fd to aperture_mmap

Michał Winiarski (1):
lib/igt_device: add igt_device_get_pci_addr by fd

 benchmarks/gem_latency.c        |   5 +-
 benchmarks/gem_wsim.c           |   6 +-
 lib/igt_device.c                | 168 ++++++++++++++++++
 lib/igt_device.h                |   2 +
 lib/intel_io.h                  |  90 ++++++----
 lib/intel_iosf.c                |  74 ++++----
 lib/intel_mmio.c                | 152 ++++++++--------
 lib/ioctl_wrappers.c            |  12 +-
 lib/ioctl_wrappers.h            |   2 +-
 tests/i915/gem_concurrent_all.c |  12 +-
 tests/i915/gem_cpu_reloc.c      |   4 +-
 tests/i915/gem_exec_latency.c   |   7 +-
 tests/i915/gem_exec_parse.c     |  14 +-
 tests/i915/gem_mmap.c           |   4 +-
 tests/i915/gem_mmap_gtt.c       |  10 +-
 tests/i915/gem_pwrite.c         |   4 +-
 tests/i915/gem_shrink.c         |   2 +-
 tests/i915/i915_pm_lpsp.c       |   9 +-
 tests/i915/i915_pm_rpm.c        |   4 +-
 tests/kms_flip.c                |   2 +-
 tests/prime_mmap.c              |   4 +-
 tools/intel_audio_dump.c        | 296 ++++++++++++++++++--------------
 tools/intel_backlight.c         |  15 +-
 tools/intel_display_poller.c    |  15 +-
 tools/intel_forcewaked.c        |  14 +-
 tools/intel_gpu_time.c          |  11 +-
 tools/intel_infoframes.c        |  75 ++++----
 tools/intel_l3_parity.c         |  14 +-
 tools/intel_lid.c               |   8 +-
 tools/intel_panel_fitter.c      |  31 ++--
 tools/intel_perf_counters.c     |  17 +-
 tools/intel_reg.c               |  41 +++--
 tools/intel_reg_checker.c       |   8 +-
 tools/intel_watermark.c         |  46 +++--
 34 files changed, 745 insertions(+), 433 deletions(-)
Signature · 6 lines
2.20.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#1 lore raw

PATCH v5 1/5 lib/igt_device: add igt_device_get_pci_addr by fd

From: Michał Winiarski <[email protected]>

This function get us pci address based by fd.
It allows us to make things a little bit more generic.
Also, we now require fd rather than doing guesswork when it comes to pci address.

v4: close sysfs fd

---
 lib/igt_device.c | 124 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_device.h |   1 +
 2 files changed, 125 insertions(+)
lib/igt_device.c +124 -0
index 08f39c8b..88f35cad 100644
@@ -21,11 +21,14 @@
  * IN THE SOFTWARE.
  *
  */
+#include <sys/types.h>
+#include <fcntl.h>
 
 #include <sys/stat.h>
 #include <sys/sysmacros.h>
 #include "igt.h"
 #include "igt_device.h"
+#include "igt_sysfs.h"
 
 int __igt_device_set_master(int fd)
 {
@@ -103,3 +106,124 @@ int igt_device_get_card_index(int fd)
 
 	return minor(st.st_rdev);
 }
+
+#define IGT_DEV_PATH_LEN 80
+
+static bool igt_device_is_pci(int fd)
+{
+	char path[IGT_DEV_PATH_LEN];
+	char *subsystem;
+	int sysfs;
+	int len;
+
+	sysfs = igt_sysfs_open(fd);
+	if (sysfs == -1)
+		return false;
+
+	len = readlinkat(sysfs, "device/subsystem", path, sizeof(path) - 1);
+	close(sysfs);
+	if (len == -1)
+		return false;
+	path[len] = '\0';
+
+	subsystem = strrchr(path, '/');
+	if (!subsystem)
+		return false;
+
+	return strcmp(subsystem, "/pci") == 0;
+}
+
+struct igt_pci_addr {
+	unsigned int domain;
+	unsigned int bus;
+	unsigned int device;
+	unsigned int function;
+};
+
+static int igt_device_get_pci_addr(int fd, struct igt_pci_addr *pci)
+{
+	char path[IGT_DEV_PATH_LEN];
+	char *buf;
+	int sysfs;
+	int len;
+
+	if (!igt_device_is_pci(fd))
+		return -ENODEV;
+
+	sysfs = igt_sysfs_open(fd);
+	if (sysfs == -1)
+		return -ENOENT;
+
+	len = readlinkat(sysfs, "device", path, sizeof(path) - 1);
+	close(sysfs);
+	if (len == -1)
+		return -ENOENT;
+	path[len] = '\0';
+
+	buf = strrchr(path, '/');
+	if (!buf)
+		return -ENOENT;
+
+	if (sscanf(buf, "/%4x:%2x:%2x.%2x",
+		   &pci->domain, &pci->bus,
+		   &pci->device, &pci->function) != 4) {
+		igt_warn("Unable to extract PCI device address from '%s'\n", buf);
+		return -ENOENT;
+	}
+
+	return 0;
+}
+
+static struct pci_device *__igt_device_get_pci_device(int fd)
+{
+	struct igt_pci_addr pci_addr;
+	struct pci_device *pci_dev;
+
+	if (igt_device_get_pci_addr(fd, &pci_addr)) {
+		igt_warn("Unable to find device PCI address\n");
+		return NULL;
+	}
+
+	if (pci_system_init()) {
+		igt_warn("Couldn't initialize PCI system\n");
+		return NULL;
+	}
+
+	pci_dev = pci_device_find_by_slot(pci_addr.domain,
+					  pci_addr.bus,
+					  pci_addr.device,
+					  pci_addr.function);
+	if (!pci_dev) {
+		igt_warn("Couldn't find PCI device %04x:%02x:%02x:%02x\n",
+			 pci_addr.domain, pci_addr.bus,
+			 pci_addr.device, pci_addr.function);
+		return NULL;
+	}
+
+	if (pci_device_probe(pci_dev)) {
+		igt_warn("Couldn't probe PCI device\n");
+		return NULL;
+	}
+
+	return pci_dev;
+}
+
+/**
+ * igt_device_get_pci_device:
+ *
+ * @fd: the device
+ *
+ * Looks up the main graphics pci device using libpciaccess.
+ *
+ * Returns:
+ * The pci_device, skips the test on any failures.
+ */
+struct pci_device *igt_device_get_pci_device(int fd)
+{
+	struct pci_device *pci_dev;
+
+	pci_dev = __igt_device_get_pci_device(fd);
+	igt_require(pci_dev);
+
+	return pci_dev;
+}
lib/igt_device.h +1 -0
index 9d7dc2c3..278ba7a9 100644
@@ -32,5 +32,6 @@ int __igt_device_drop_master(int fd);
 void igt_device_drop_master(int fd);
 
 int igt_device_get_card_index(int fd);
+struct pci_device *igt_device_get_pci_device(int fd);
 
 #endif /* __IGT_DEVICE_H__ */
Signature · 6 lines
2.20.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#2 lore raw

PATCH v5 2/5 lib/igt_device: add igt_device_map_pci_bar_region

In reply to Daniel Mrzyglod

This function use sysfs to map particular mmio region. fd of opened device point us for specific pci device.

---
 lib/igt_device.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_device.h |  1 +
 2 files changed, 45 insertions(+)
lib/igt_device.c +44 -0
index 88f35cad..b456b936 100644
@@ -227,3 +227,47 @@ struct pci_device *igt_device_get_pci_device(int fd)
 
 	return pci_dev;
 }
+
+/**
+ * igt_device_map_pci_bar_region:
+ *
+ * @fd: the device
+ * @mmio_bar: bar to be mapped
+ * @mmio_size: bar size
+ *
+ * Returns:
+ * The pointer for mmapped bar
+ */
+void *igt_device_map_pci_bar_region(int fd, int  mmio_bar, int mmio_size)
+{
+	struct igt_pci_addr pci_addr;
+	char *filepath = NULL;
+	char *pci_string = NULL;
+	int newfd;
+	void *igt_mmio;
+
+	if (igt_device_get_pci_addr(fd, &pci_addr)) {
+		igt_warn("Unable to find device PCI address\n");
+		return NULL;
+	}
+
+	asprintf(&pci_string, "%.4x:%.2x:%.2x.%.1x",
+		 pci_addr.domain, pci_addr.bus, pci_addr.device,
+		 pci_addr.function);
+
+
+	asprintf(&filepath, "/sys/devices/pci%.4x:%.2x/%s/resource%.1x",
+			pci_addr.domain, pci_addr.bus, pci_string, mmio_bar);
+
+	newfd = open(filepath, O_RDWR | O_SYNC);
+	igt_mmio = mmap(0, mmio_size, PROT_READ | PROT_WRITE, MAP_SHARED,
+			newfd, 0);
+	free(filepath);
+	close(newfd);
+	igt_warn_on_f(igt_mmio == MAP_FAILED,
+		      "Couldn't map MMIO region %s BAR %d\n",
+		      pci_string, mmio_bar);
+	free(pci_string);
+
+	return igt_mmio;
+}
lib/igt_device.h +1 -0
index 278ba7a9..c4188e96 100644
@@ -33,5 +33,6 @@ void igt_device_drop_master(int fd);
 
 int igt_device_get_card_index(int fd);
 struct pci_device *igt_device_get_pci_device(int fd);
+void *igt_device_map_pci_bar_region(int fd, int  mmio_bar, int mmio_size);
 
 #endif /* __IGT_DEVICE_H__ */
Signature · 6 lines
2.20.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#3 lore raw

PATCH v5 3/5 lib/intel_mmio: add pointer for read/write register funtions

In reply to Daniel Mrzyglod

This patch is first move to extend functionality of intel_mmio library. There was limitation for 1 device, adding pointer for IO functions to mmaped area gives us possibility to use those IO functions for other mmaped devices.

v4: reword commitmsg, spelling errors

---
 lib/intel_io.h               |  12 +-
 lib/intel_mmio.c             |  29 ++--
 tests/i915/i915_pm_lpsp.c    |   2 +-
 tools/intel_audio_dump.c     | 289 +++++++++++++++++++----------------
 tools/intel_backlight.c      |  10 +-
 tools/intel_display_poller.c |   8 +-
 tools/intel_gpu_time.c       |   6 +-
 tools/intel_infoframes.c     |  68 ++++-----
 tools/intel_lid.c            |   2 +-
 tools/intel_panel_fitter.c   |  24 +--
 tools/intel_reg.c            |  10 +-
 tools/intel_reg_checker.c    |   2 +-
 tools/intel_watermark.c      |   2 +-
 13 files changed, 250 insertions(+), 214 deletions(-)
lib/intel_io.h +6 -6
index 6014c485..0674b42c 100644
@@ -42,12 +42,12 @@ uint32_t intel_register_read(uint32_t reg);
 void intel_register_write(uint32_t reg, uint32_t val);
 int intel_register_access_needs_fakewake(void);
 
-uint32_t INREG(uint32_t reg);
-uint16_t INREG16(uint32_t reg);
-uint8_t INREG8(uint32_t reg);
-void OUTREG(uint32_t reg, uint32_t val);
-void OUTREG16(uint32_t reg, uint16_t val);
-void OUTREG8(uint32_t reg, uint8_t val);
+uint32_t INREG(void *igt_mmio, uint32_t reg);
+uint16_t INREG16(void *igt_mmio, uint32_t reg);
+uint8_t INREG8(void *igt_mmio, uint32_t reg);
+void OUTREG(void *igt_mmio, uint32_t reg, uint32_t val);
+void OUTREG16(void *igt_mmio, uint32_t reg, uint16_t val);
+void OUTREG8(void *igt_mmio, uint32_t reg, uint8_t val);
 
 /* sideband access functions from intel_iosf.c */
 uint32_t intel_dpio_reg_read(uint32_t reg, int phy);
lib/intel_mmio.c +17 -12
index a5458aeb..d473cd9b 100644
@@ -309,6 +309,7 @@ write_out:
 
 /**
  * INREG:
+ * @igt_mmio maped memory pointer
  * @reg: register offset
  *
  * 32-bit read of the register at offset @reg. This function only works when the
@@ -319,13 +320,14 @@ write_out:
  * Returns:
  * The value read from the register.
  */
-uint32_t INREG(uint32_t reg)
+uint32_t INREG(void *igt_mmio, uint32_t reg)
 {
-	return *(volatile uint32_t *)((volatile char *)igt_global_mmio + reg);
+	return *(volatile uint32_t *)((volatile char *)igt_mmio + reg);
 }
 
 /**
  * INREG16:
+ * @igt_mmio maped memory pointer
  * @reg: register offset
  *
  * 16-bit read of the register at offset @reg. This function only works when the
@@ -336,13 +338,14 @@ uint32_t INREG(uint32_t reg)
  * Returns:
  * The value read from the register.
  */
-uint16_t INREG16(uint32_t reg)
+uint16_t INREG16(void *igt_mmio, uint32_t reg)
 {
-	return *(volatile uint16_t *)((volatile char *)igt_global_mmio + reg);
+	return *(volatile uint16_t *)((volatile char *)igt_mmio + reg);
 }
 
 /**
  * INREG8:
+ * @igt_mmio maped memory pointer
  * @reg: register offset
  *
  * 8-bit read of the register at offset @reg. This function only works when the
@@ -353,13 +356,14 @@ uint16_t INREG16(uint32_t reg)
  * Returns:
  * The value read from the register.
  */
-uint8_t INREG8(uint32_t reg)
+uint8_t INREG8(void *igt_mmio, uint32_t reg)
 {
-	return *((volatile uint8_t *)igt_global_mmio + reg);
+	return *((volatile uint8_t *)igt_mmio + reg);
 }
 
 /**
  * OUTREG:
+ * @igt_mmio maped memory pointer
  * @reg: register offset
  * @val: value to write
  *
@@ -369,9 +373,9 @@ uint8_t INREG8(uint32_t reg)
  *
  * This function directly accesses the #igt_global_mmio without safety checks.
  */
-void OUTREG(uint32_t reg, uint32_t val)
+void OUTREG(void *igt_mmio, uint32_t reg, uint32_t val)
 {
-	*(volatile uint32_t *)((volatile char *)igt_global_mmio + reg) = val;
+	*(volatile uint32_t *)((volatile char *)igt_mmio + reg) = val;
 }
 
 /**
@@ -385,13 +389,14 @@ void OUTREG(uint32_t reg, uint32_t val)
  *
  * This function directly accesses the #igt_global_mmio without safety checks.
  */
-void OUTREG16(uint32_t reg, uint16_t val)
+void OUTREG16(void *igt_mmio, uint32_t reg, uint16_t val)
 {
-	*(volatile uint16_t *)((volatile char *)igt_global_mmio + reg) = val;
+	*(volatile uint16_t *)((volatile char *)igt_mmio + reg) = val;
 }
 
 /**
  * OUTREG8:
+ * @igt_mmio maped memory pointer
  * @reg: register offset
  * @val: value to write
  *
@@ -401,7 +406,7 @@ void OUTREG16(uint32_t reg, uint16_t val)
  *
  * This function directly accesses the #igt_global_mmio without safety checks.
  */
-void OUTREG8(uint32_t reg, uint8_t val)
+void OUTREG8(void *igt_mmio, uint32_t reg, uint8_t val)
 {
-	*((volatile uint8_t *)igt_global_mmio + reg) = val;
+	*((volatile uint8_t *)igt_mmio + reg) = val;
 }
tests/i915/i915_pm_lpsp.c +1 -1
index b319dbe9..f69c88f6 100644
@@ -40,7 +40,7 @@ static bool lpsp_is_enabled(int drm_fd)
 {
 	uint32_t val;
 
-	val = INREG(HSW_PWR_WELL_CTL2);
+	val = INREG(igt_global_mmio, HSW_PWR_WELL_CTL2);
 	return !(val & HSW_PWR_WELL_STATE_ENABLED);
 }
 
tools/intel_audio_dump.c +158 -131

859 lines not on this page · raw message

tools/intel_backlight.c +5 -5
index 067fd418..bdbf9af3 100644
@@ -42,8 +42,8 @@ int main(int argc, char** argv)
 
 	intel_mmio_use_pci_bar(intel_get_pci_device());
 
-	current = INREG(BLC_PWM_CPU_CTL) & BACKLIGHT_DUTY_CYCLE_MASK;
-	max = INREG(BLC_PWM_PCH_CTL2) >> 16;
+	current = INREG(igt_global_mmio, BLC_PWM_CPU_CTL) & BACKLIGHT_DUTY_CYCLE_MASK;
+	max = INREG(igt_global_mmio, BLC_PWM_PCH_CTL2) >> 16;
 
 	printf ("current backlight value: %d%%\n", current * 100 / max);
 
@@ -51,9 +51,9 @@ int main(int argc, char** argv)
 		uint32_t v = atoi (argv[1]) * max / 100;
 		if (v > max)
 			v = max;
-		OUTREG(BLC_PWM_CPU_CTL,
-		       (INREG(BLC_PWM_CPU_CTL) &~ BACKLIGHT_DUTY_CYCLE_MASK) | v);
-		(void) INREG(BLC_PWM_CPU_CTL);
+		OUTREG(igt_global_mmio, BLC_PWM_CPU_CTL,
+		       (INREG(igt_global_mmio, BLC_PWM_CPU_CTL) & ~BACKLIGHT_DUTY_CYCLE_MASK) | v);
+		(void)INREG(igt_global_mmio, BLC_PWM_CPU_CTL);
 		printf ("set backlight to %d%%\n", v * 100 / max);
 	}
 
tools/intel_display_poller.c +4 -4
index 51f5b9a5..e1094d39 100644
@@ -71,22 +71,22 @@ static void sighandler(int x)
 
 static uint16_t read_reg_16(uint32_t reg)
 {
-	return INREG16(vlv_offset + reg);
+	return INREG16(igt_global_mmio, vlv_offset + reg);
 }
 
 static uint32_t read_reg(uint32_t reg)
 {
-	return INREG(vlv_offset + reg);
+	return INREG(igt_global_mmio, vlv_offset + reg);
 }
 
 static void write_reg_16(uint32_t reg, uint16_t val)
 {
-	OUTREG16(vlv_offset + reg, val);
+	OUTREG16(igt_global_mmio, vlv_offset + reg, val);
 }
 
 static void write_reg(uint32_t reg, uint32_t val)
 {
-	OUTREG(vlv_offset + reg, val);
+	OUTREG(igt_global_mmio, vlv_offset + reg, val);
 }
 
 static char pipe_name(int pipe)
tools/intel_gpu_time.c +4 -2
index 56d65fe0..79240fd3 100644
@@ -86,8 +86,10 @@ int main(int argc, char **argv)
 	while (!goddo) {
 		uint32_t ring_head, ring_tail;
 
-		ring_head = INREG(LP_RING + RING_HEAD) & HEAD_ADDR;
-		ring_tail = INREG(LP_RING + RING_TAIL) & TAIL_ADDR;
+		ring_head = INREG(igt_global_mmio, LP_RING + RING_HEAD) &
+			    HEAD_ADDR;
+		ring_tail = INREG(igt_global_mmio, LP_RING + RING_TAIL) &
+			    TAIL_ADDR;
 
 		if (ring_tail == ring_head)
 			ring_idle++;
tools/intel_infoframes.c +34 -34

205 lines not on this page · raw message

tools/intel_lid.c +1 -1
index 37c6ba5e..2b597efb 100644
@@ -122,7 +122,7 @@ int main(int argc, char **argv)
 	intel_mmio_use_pci_bar(intel_get_pci_device());
 
 	while (1) {
-		swf14 = INREG(SWF14);
+		swf14 = INREG(igt_global_mmio, SWF14);
 
 		printf("Intel LVDS Lid status:\n");
 		printf("\tSWF14(0x%x) : %s\n", swf14,
tools/intel_panel_fitter.c +12 -12
index 137ef61a..26843d7c 100644
@@ -84,12 +84,12 @@ static void read_pipe_info(int intel_pipe, struct pipe_info *info)
 {
 	uint32_t conf, vtotal, htotal, src, ctrl1, win_sz;
 
-	conf   = INREG(PIPECONF[intel_pipe]);
-	htotal = INREG(HTOTAL[intel_pipe]);
-	vtotal = INREG(VTOTAL[intel_pipe]);
-	src    = INREG(PIPESRC[intel_pipe]);
-	ctrl1  = INREG(PF_CTRL1[intel_pipe]);
-	win_sz = INREG(PF_WIN_SZ[intel_pipe]);
+	conf   = INREG(igt_global_mmio, PIPECONF[intel_pipe]);
+	htotal = INREG(igt_global_mmio, HTOTAL[intel_pipe]);
+	vtotal = INREG(igt_global_mmio, VTOTAL[intel_pipe]);
+	src    = INREG(igt_global_mmio, PIPESRC[intel_pipe]);
+	ctrl1  = INREG(igt_global_mmio, PF_CTRL1[intel_pipe]);
+	win_sz = INREG(igt_global_mmio, PF_WIN_SZ[intel_pipe]);
 
 	info->enabled = (conf & PIPECONF_ENABLE) ? true : false;
 	info->tot_width = (htotal & HTOTAL_ACTIVE_MASK) + 1;
@@ -232,24 +232,24 @@ static int change_screen_size(int intel_pipe, int x, int y)
 			assert(0);
 		}
 	}
-	OUTREG(PF_CTRL1[intel_pipe], ctrl1_val);
+	OUTREG(igt_global_mmio, PF_CTRL1[intel_pipe], ctrl1_val);
 
 	win_pos_val = pos_x << 16;
 	win_pos_val |= pos_y;
-	OUTREG(PF_WIN_POS[intel_pipe], win_pos_val);
+	OUTREG(igt_global_mmio, PF_WIN_POS[intel_pipe], win_pos_val);
 
 	win_sz_val = dst_width << 16;
 	win_sz_val |= dst_height;
-	OUTREG(PF_WIN_SZ[intel_pipe], win_sz_val);
+	OUTREG(igt_global_mmio, PF_WIN_SZ[intel_pipe], win_sz_val);
 
 	return 0;
 }
 
 static int disable_panel_fitter(int intel_pipe)
 {
-	OUTREG(PF_CTRL1[intel_pipe], 0);
-	OUTREG(PF_WIN_POS[intel_pipe], 0);
-	OUTREG(PF_WIN_SZ[intel_pipe], 0);
+	OUTREG(igt_global_mmio, PF_CTRL1[intel_pipe], 0);
+	OUTREG(igt_global_mmio, PF_WIN_POS[intel_pipe], 0);
+	OUTREG(igt_global_mmio, PF_WIN_SZ[intel_pipe], 0);
 	return 0;
 }
 
tools/intel_reg.c +6 -4
index 1247b70b..2e74b601 100644
@@ -364,7 +364,8 @@ static int read_register(struct config *config, struct reg *reg, uint32_t *valp)
 		if (reg->engine)
 			val = register_srm(config, reg, NULL);
 		else
-			val = INREG(reg->mmio_offset + reg->addr);
+			val = INREG(igt_global_mmio,
+				    reg->mmio_offset + reg->addr);
 		break;
 	case PORT_PORTIO_VGA:
 		iopl(3);
@@ -372,7 +373,7 @@ static int read_register(struct config *config, struct reg *reg, uint32_t *valp)
 		iopl(0);
 		break;
 	case PORT_MMIO_VGA:
-		val = INREG8(reg->addr);
+		val = INREG8(igt_global_mmio, reg->addr);
 		break;
 	case PORT_BUNIT:
 	case PORT_PUNIT:
@@ -424,7 +425,8 @@ static int write_register(struct config *config, struct reg *reg, uint32_t val)
 		if (reg->engine) {
 			register_srm(config, reg, &val);
 		} else {
-			OUTREG(reg->mmio_offset + reg->addr, val);
+			OUTREG(igt_global_mmio,
+			       reg->mmio_offset + reg->addr, val);
 		}
 		break;
 	case PORT_PORTIO_VGA:
@@ -443,7 +445,7 @@ static int write_register(struct config *config, struct reg *reg, uint32_t val)
 				val, reg->port_desc.name);
 			return -1;
 		}
-		OUTREG8(reg->addr, val);
+		OUTREG8(igt_global_mmio, reg->addr, val);
 		break;
 	case PORT_BUNIT:
 	case PORT_PUNIT:
tools/intel_reg_checker.c +1 -1
index 6bde63ec..b14a06ea 100644
@@ -35,7 +35,7 @@ static int gen;
 static uint32_t
 read_and_print_reg(const char *name, uint32_t reg)
 {
-	uint32_t val = INREG(reg);
+	uint32_t val = INREG(igt_global_mmio, reg);
 
 	printf("%s (0x%x): 0x%08x\n", name, reg, val);
 
tools/intel_watermark.c +1 -1
index e71c3d9c..00bdd120 100644
@@ -38,7 +38,7 @@ static uint32_t devid;
 
 static uint32_t read_reg(uint32_t addr)
 {
-	return INREG(display_base + addr);
+	return INREG(igt_global_mmio, display_base + addr);
 }
 
 struct gmch_wm {
Signature · 6 lines
2.20.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#4 lore raw

PATCH v5 4/5 lib/intel_mmio: remove igt_global_mmio and move it to mmio_data

In reply to Daniel Mrzyglod

this patch remove need for igt_global_mmio from library space. The reason that it was moved is the idea to support multiple devices at once.

---
 benchmarks/gem_latency.c      |   5 +-
 benchmarks/gem_wsim.c         |   6 +-
 lib/intel_io.h                |  78 +++++++++++++--------
 lib/intel_iosf.c              |  74 +++++++++++---------
 lib/intel_mmio.c              | 123 ++++++++++++++++------------------
 tests/i915/gem_exec_latency.c |   7 +-
 tests/i915/gem_exec_parse.c   |  14 ++--
 tests/i915/i915_pm_lpsp.c     |   7 +-
 tools/intel_audio_dump.c      |   7 +-
 tools/intel_backlight.c       |   5 +-
 tools/intel_display_poller.c  |   7 +-
 tools/intel_forcewaked.c      |  14 ++--
 tools/intel_gpu_time.c        |   5 +-
 tools/intel_infoframes.c      |   7 +-
 tools/intel_l3_parity.c       |  14 ++--
 tools/intel_lid.c             |   6 +-
 tools/intel_panel_fitter.c    |   7 +-
 tools/intel_perf_counters.c   |  17 +++--
 tools/intel_reg.c             |  31 ++++++---
 tools/intel_reg_checker.c     |   6 +-
 tools/intel_watermark.c       |  44 +++++++-----
 21 files changed, 292 insertions(+), 192 deletions(-)
benchmarks/gem_latency.c +4 -1
index c3fc4bf0..bcaaecef 100644
@@ -55,6 +55,8 @@
 static int done;
 static int fd;
 static volatile uint32_t *timestamp_reg;
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
 
 #define REG(x) (volatile uint32_t *)((volatile char *)igt_global_mmio + x)
 #define REG_OFFSET(x) ((volatile char *)(x) - (volatile char *)igt_global_mmio)
@@ -456,7 +458,8 @@ static int run(int seconds,
 	if (gen < 6)
 		return IGT_EXIT_SKIP; /* Needs BCS timestamp */
 
-	intel_register_access_init(intel_get_pci_device(), false, fd);
+	intel_register_access_init(&mmio_data, intel_get_pci_device(), false, fd);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	if (gen == 6)
 		timestamp_reg = REG(RCS_TIMESTAMP);
benchmarks/gem_wsim.c +5 -1
index afb9644d..86af58cb 100644
@@ -206,6 +206,9 @@ struct workload
 	} busy_balancer;
 };
 
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
+
 static const unsigned int nop_calibration_us = 1000;
 static unsigned long nop_calibration;
 
@@ -2223,7 +2226,8 @@ static void init_clocks(void)
 	uint32_t rcs_start, rcs_end;
 	double overhead, t;
 
-	intel_register_access_init(intel_get_pci_device(), false, fd);
+	intel_register_access_init(&mmio_data, intel_get_pci_device(), false, fd);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	if (verbose <= 1)
 		return;
lib/intel_io.h +50 -28

101 lines not on this page · raw message

lib/intel_iosf.c +42 -32

168 lines not on this page · raw message

lib/intel_mmio.c +57 -66

301 lines not on this page · raw message

tests/i915/gem_exec_latency.c +6 -1
index e56d6278..6379edae 100644
@@ -62,6 +62,9 @@
 static unsigned int ring_size;
 static double rcs_clock;
 
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
+
 static void
 poll_ring(int fd, unsigned ring, const char *name)
 {
@@ -667,7 +670,9 @@ igt_main
 		if (ring_size > 1024)
 			ring_size = 1024;
 
-		intel_register_access_init(intel_get_pci_device(), false, device);
+		intel_register_access_init(&mmio_data, intel_get_pci_device(), false, device);
+		igt_global_mmio = mmio_data.igt_mmio;
+
 		rcs_clock = clockrate(device, RCS_TIMESTAMP);
 		igt_info("RCS timestamp clock: %.0fKHz, %.1fns\n",
 			 rcs_clock / 1e3, 1e9 / rcs_clock);
tests/i915/gem_exec_parse.c +9 -5
index 62e8d0a5..98b05267 100644
@@ -58,6 +58,9 @@
 
 static int parser_version;
 
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
+
 static int command_parser_version(int fd)
 {
 	int version = -1;
@@ -284,9 +287,9 @@ test_lri(int fd, uint32_t handle, struct test_lri *test)
 		  test->name, test->reg, test->test_val,
 		  expected_errno, expect);
 
-	intel_register_write(test->reg, test->init_val);
+	intel_register_write(&mmio_data, test->reg, test->init_val);
 
-	igt_assert_eq_u32((intel_register_read(test->reg) &
+	igt_assert_eq_u32((intel_register_read(&mmio_data, test->reg) &
 			   test->read_mask),
 			  test->init_val);
 
@@ -296,7 +299,7 @@ test_lri(int fd, uint32_t handle, struct test_lri *test)
 		   expected_errno);
 	gem_sync(fd, handle);
 
-	igt_assert_eq_u32((intel_register_read(test->reg) &
+	igt_assert_eq_u32((intel_register_read(&mmio_data, test->reg) &
 			   test->read_mask),
 			  expect);
 }
@@ -530,7 +533,8 @@ igt_main
 #undef REG
 
 		igt_fixture {
-			intel_register_access_init(intel_get_pci_device(), 0, fd);
+			intel_register_access_init(&mmio_data, intel_get_pci_device(), 0, fd);
+			igt_global_mmio = mmio_data.igt_mmio;
 		}
 
 		for (int i = 0; i < ARRAY_SIZE(lris); i++) {
@@ -543,7 +547,7 @@ igt_main
 		}
 
 		igt_fixture {
-			intel_register_access_fini();
+			intel_register_access_fini(&mmio_data);
 		}
 	}
 
tests/i915/i915_pm_lpsp.c +5 -2
index f69c88f6..cbbe6a4b 100644
@@ -30,6 +30,8 @@
 #include <fcntl.h>
 #include <unistd.h>
 
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
 
 static bool supports_lpsp(uint32_t devid)
 {
@@ -210,7 +212,8 @@ igt_main
 
 		igt_require(supports_lpsp(devid));
 
-		intel_register_access_init(intel_get_pci_device(), 0, drm_fd);
+		intel_register_access_init(&mmio_data, intel_get_pci_device(), 0, drm_fd);
+		igt_global_mmio = mmio_data.igt_mmio;
 
 		kmstest_set_vt_graphics_mode();
 	}
@@ -227,7 +230,7 @@ igt_main
 	igt_fixture {
 		int i;
 
-		intel_register_access_fini();
+		intel_register_access_fini(&mmio_data);
 		for (i = 0; i < drm_res->count_connectors; i++)
 			drmModeFreeConnector(drm_connectors[i]);
 		drmModeFreeResources(drm_res);
tools/intel_audio_dump.c +5 -2
index 678e1d08..119fece1 100644
@@ -41,6 +41,8 @@ static uint32_t devid;
 
 static int aud_reg_base = 0;	/* base address of audio registers */
 static int disp_reg_base = 0;	/* base address of display registers */
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
 
 #define IS_HASWELL_PLUS(devid)  (IS_HASWELL(devid) || IS_BROADWELL(devid))
 
@@ -2498,9 +2500,10 @@ int main(int argc, char **argv)
 	do_self_tests();
 
 	if (argc == 2)
-		intel_mmio_use_dump_file(argv[1]);
+		intel_mmio_use_dump_file(&mmio_data, argv[1]);
 	else
-		intel_mmio_use_pci_bar(pci_dev);
+		intel_mmio_use_pci_bar(&mmio_data, pci_dev);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	printf("%s audio registers:\n\n", intel_get_device_info(devid)->codename);
 	if (IS_VALLEYVIEW(devid)) {
tools/intel_backlight.c +4 -1
index bdbf9af3..1bd35f43 100644
@@ -35,12 +35,15 @@
 #include "intel_reg.h"
 
 /* XXX PCH only today */
+static struct _mmio_data mmio_data;
+void *igt_global_mmio;
 
 int main(int argc, char** argv)
 {
 	uint32_t current, max;
 
-	intel_mmio_use_pci_bar(intel_get_pci_device());
+	intel_mmio_use_pci_bar(&mmio_data, intel_get_pci_device());
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	current = INREG(igt_global_mmio, BLC_PWM_CPU_CTL) & BACKLIGHT_DUTY_CYCLE_MASK;
 	max = INREG(igt_global_mmio, BLC_PWM_PCH_CTL2) >> 16;
tools/intel_display_poller.c +5 -2
index e1094d39..af7e40cc 100644
@@ -59,6 +59,8 @@ enum test {
 
 static uint32_t vlv_offset;
 static uint16_t pipe_offset[3] = { 0, 0x1000, 0x2000, };
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
 
 #define PIPE_REG(pipe, reg_a) (pipe_offset[(pipe)] + (reg_a))
 
@@ -1187,7 +1189,8 @@ int main(int argc, char *argv[])
 		break;
 	}
 
-	intel_register_access_init(intel_get_pci_device(), 0, -1);
+	intel_register_access_init(&mmio_data, intel_get_pci_device(), 0, -1);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	printf("%s?\n", test_name(test, pipe, bit, test_pixelcount));
 
@@ -1262,7 +1265,7 @@ int main(int argc, char *argv[])
 		assert(0);
 	}
 
-	intel_register_access_fini();
+	intel_register_access_fini(&mmio_data);
 
 	if (quit)
 		return 0;
tools/intel_forcewaked.c +9 -5
index 02fbf888..e52db5ed 100644
@@ -39,6 +39,8 @@
 #include "drmtest.h"
 
 bool daemonized;
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
 
 #define INFO_PRINT(...) \
 	do { \
@@ -59,7 +61,7 @@ help(char *prog) {
 static int
 is_alive(void) {
 	/* Read the timestamp, which should *almost* always be !0 */
-	return (intel_register_read(0x2358) != 0);
+	return (intel_register_read(&mmio_data, 0x2358) != 0);
 }
 
 int main(int argc, char *argv[])
@@ -80,7 +82,8 @@ int main(int argc, char *argv[])
 		INFO_PRINT("started daemon");
 	}
 
-	ret = intel_register_access_init(intel_get_pci_device(), 1, -1);
+	ret = intel_register_access_init(&mmio_data, intel_get_pci_device(), 1, -1);
+	igt_global_mmio = mmio_data.igt_mmio;
 	if (ret) {
 		INFO_PRINT("Couldn't init register access\n");
 		exit(1);
@@ -90,14 +93,15 @@ int main(int argc, char *argv[])
 	while(1) {
 		if (!is_alive()) {
 			INFO_PRINT("gpu reset? restarting daemon\n");
-			intel_register_access_fini();
-			ret = intel_register_access_init(intel_get_pci_device(), 1, -1);
+			intel_register_access_fini(&mmio_data);
+			ret = intel_register_access_init(&mmio_data, intel_get_pci_device(), 1, -1);
+			igt_global_mmio = mmio_data.igt_mmio;
 			if (ret)
 				INFO_PRINT("Reg access init fail\n");
 		}
 		sleep(1);
 	}
-	intel_register_access_fini();
+	intel_register_access_fini(&mmio_data);
 	INFO_PRINT("Forcewake unlock\n");
 
 	if (daemonized) {
tools/intel_gpu_time.c +4 -1
index 79240fd3..0cfc108b 100644
@@ -41,6 +41,8 @@
 #define SAMPLES_PER_SEC             10000
 
 static volatile int goddo;
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
 
 static pid_t spawn(char **argv)
 {
@@ -67,7 +69,8 @@ int main(int argc, char **argv)
 	static struct rusage rusage;
 	int status;
 
-	intel_mmio_use_pci_bar(intel_get_pci_device());
+	intel_mmio_use_pci_bar(&mmio_data, intel_get_pci_device());
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	if (argc == 1) {
 		fprintf(stderr, "usage: %s cmd [args...]\n", argv[0]);
tools/intel_infoframes.c +5 -2
index 689f5faa..633a5e10 100644
@@ -262,6 +262,8 @@ const char *dip_frequency_names[] = {
 	"reserved (invalid)"
 };
 
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
 struct pci_device *pci_dev;
 int gen = 0;
 
@@ -1108,7 +1110,8 @@ int main(int argc, char *argv[])
 	       " perfectly: the Kernel might undo our changes.\n");
 
 	pci_dev = intel_get_pci_device();
-	intel_register_access_init(pci_dev, 0, -1);
+	intel_register_access_init(&mmio_data, pci_dev, 0, -1);
+	igt_global_mmio = mmio_data.igt_mmio;
 	intel_check_pch();
 
 	if (IS_GEN4(pci_dev->device_id))
@@ -1256,6 +1259,6 @@ int main(int argc, char *argv[])
 	}
 
 out:
-	intel_register_access_fini();
+	intel_register_access_fini(&mmio_data);
 	return ret;
 }
tools/intel_l3_parity.c +9 -5
index d8c997af..7a461a54 100644
@@ -44,6 +44,8 @@
 #include "intel_l3_parity.h"
 
 static unsigned int devid;
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
 /* L3 size is always a function of banks. The number of banks cannot be
  * determined by number of slices however */
 static inline int num_banks(void) {
@@ -189,7 +191,8 @@ int main(int argc, char *argv[])
 	if (intel_gen(devid) < 7 || IS_VALLEYVIEW(devid))
 		exit(77);
 
-	assert(intel_register_access_init(intel_get_pci_device(), 0, device) == 0);
+	assert(intel_register_access_init(&mmio_data, intel_get_pci_device(), 0, device) == 0);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	dir = igt_sysfs_open(device);
 
@@ -211,7 +214,7 @@ int main(int argc, char *argv[])
 	 * now. Just be aware of this if for some reason a hang is reported
 	 * when using this tool.
 	 */
-	dft = intel_register_read(0xb038);
+	dft = intel_register_read(&mmio_data, 0xb038);
 
 	while (1) {
 		int c, option_index = 0;
@@ -357,10 +360,11 @@ int main(int argc, char *argv[])
 				assert(i < 2);
 				dft |= i << 1; /* slice */
 				dft |= 1 << 0; /* enable */
-				intel_register_write(0xb038, dft);
+				intel_register_write(&mmio_data, 0xb038, dft);
 				break;
 			case 'u':
-				intel_register_write(0xb038, dft & ~(1<<0));
+				intel_register_write(&mmio_data, 0xb038, dft &
+						     ~(1 << 0));
 				break;
 			case 'L':
 				break;
@@ -369,7 +373,7 @@ int main(int argc, char *argv[])
 		}
 	}
 
-	intel_register_access_fini();
+	intel_register_access_fini(&mmio_data);
 	if (action == 'l')
 		exit(EXIT_SUCCESS);
 
tools/intel_lid.c +5 -1
index 2b597efb..b4f26b60 100644
@@ -52,6 +52,9 @@ enum lid_status {
 #define ACPI_BUTTON "/proc/acpi/button/"
 #define ACPI_LID "/proc/acpi/button/lid/"
 
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
+
 static int i830_lvds_acpi_lid_state(void)
 {
 	int fd;
@@ -119,7 +122,8 @@ int main(int argc, char **argv)
 {
 	int swf14, acpi_lid;
 
-	intel_mmio_use_pci_bar(intel_get_pci_device());
+	intel_mmio_use_pci_bar(&mmio_data, intel_get_pci_device());
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	while (1) {
 		swf14 = INREG(igt_global_mmio, SWF14);
tools/intel_panel_fitter.c +5 -2
index 26843d7c..9663d0cc 100644
@@ -35,6 +35,8 @@
 #include "intel_reg.h"
 #include "drmtest.h"
 
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
 int gen;
 
 uint32_t HTOTAL[]     = { 0x60000, 0x61000, 0x62000 };
@@ -280,7 +282,8 @@ int main (int argc, char *argv[])
 	       "solution that may or may not work. Use it at your own risk.\n");
 
 	pci_dev = intel_get_pci_device();
-	intel_register_access_init(pci_dev, 0, -1);
+	intel_register_access_init(&mmio_data, pci_dev, 0, -1);
+	igt_global_mmio = mmio_data.igt_mmio;
 	devid = pci_dev->device_id;
 
 	if (!HAS_PCH_SPLIT(devid)) {
@@ -342,6 +345,6 @@ int main (int argc, char *argv[])
 	}
 
 out:
-	intel_register_access_fini();
+	intel_register_access_fini(&mmio_data);
 	return ret;
 }
tools/intel_perf_counters.c +11 -6
index 50c4bce6..38f71419 100644
@@ -300,6 +300,8 @@ uint32_t *totals;
 uint32_t *last_counter;
 static drm_intel_bufmgr *bufmgr;
 struct intel_batchbuffer *batch;
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
 
 /* DW0 */
 #define GEN5_MI_REPORT_PERF_COUNT ((0x26 << 23) | (3 - 2))
@@ -483,12 +485,15 @@ main(int argc, char **argv)
 
 	if (oacontrol) {
 		/* Forcewake */
-		intel_register_access_init(intel_get_pci_device(), 0, fd);
+		intel_register_access_init(&mmio_data, intel_get_pci_device(),
+					   0, fd);
+		igt_global_mmio = mmio_data.igt_mmio;
 
 		/* Enable performance counters */
-		intel_register_write(OACONTROL,
-			counter_format << OACONTROL_COUNTER_SELECT_SHIFT |
-			PERFORMANCE_COUNTER_ENABLE);
+		intel_register_write(&mmio_data, OACONTROL,
+				     counter_format <<
+				     OACONTROL_COUNTER_SELECT_SHIFT |
+				     PERFORMANCE_COUNTER_ENABLE);
 	}
 
 	totals = calloc(counter_count, sizeof(uint32_t));
@@ -520,10 +525,10 @@ main(int argc, char **argv)
 
 	if (oacontrol) {
 		/* Disable performance counters */
-		intel_register_write(OACONTROL, 0);
+		intel_register_write(&mmio_data, OACONTROL, 0);
 
 		/* Forcewake */
-		intel_register_access_fini();
+		intel_register_access_fini(&mmio_data);
 	}
 
 	free(totals);
tools/intel_reg.c +20 -11
index 2e74b601..1c78af0b 100644
@@ -84,6 +84,9 @@ struct config {
 	int verbosity;
 };
 
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
+
 /* port desc must have been set */
 static int set_reg_by_addr(struct config *config, struct reg *reg,
 			   uint32_t addr)
@@ -390,7 +393,8 @@ static int read_register(struct config *config, struct reg *reg, uint32_t *valp)
 				reg->port_desc.name);
 			return -1;
 		}
-		val = intel_iosf_sb_read(reg->port_desc.port, reg->addr);
+		val = intel_iosf_sb_read(&mmio_data, reg->port_desc.port,
+					 reg->addr);
 		break;
 	default:
 		fprintf(stderr, "port %d not supported\n", reg->port_desc.port);
@@ -462,7 +466,8 @@ static int write_register(struct config *config, struct reg *reg, uint32_t val)
 				reg->port_desc.name);
 			return -1;
 		}
-		intel_iosf_sb_write(reg->port_desc.port, reg->addr, val);
+		intel_iosf_sb_write(&mmio_data, reg->port_desc.port, reg->addr,
+				    val);
 		break;
 	default:
 		fprintf(stderr, "port %d not supported\n", reg->port_desc.port);
@@ -556,9 +561,10 @@ static int intel_reg_read(struct config *config, int argc, char *argv[])
 	}
 
 	if (config->mmiofile)
-		intel_mmio_use_dump_file(config->mmiofile);
+		intel_mmio_use_dump_file(&mmio_data, config->mmiofile);
 	else
-		intel_register_access_init(config->pci_dev, 0, -1);
+		intel_register_access_init(&mmio_data, config->pci_dev, 0, -1);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	for (i = 1; i < argc; i++) {
 		struct reg reg;
@@ -574,7 +580,7 @@ static int intel_reg_read(struct config *config, int argc, char *argv[])
 		}
 	}
 
-	intel_register_access_fini();
+	intel_register_access_fini(&mmio_data);
 
 	return EXIT_SUCCESS;
 }
@@ -588,7 +594,8 @@ static int intel_reg_write(struct config *config, int argc, char *argv[])
 		return EXIT_FAILURE;
 	}
 
-	intel_register_access_init(config->pci_dev, 0, -1);
+	intel_register_access_init(&mmio_data, config->pci_dev, 0, -1);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	for (i = 1; i < argc; i += 2) {
 		struct reg reg;
@@ -613,7 +620,7 @@ static int intel_reg_write(struct config *config, int argc, char *argv[])
 		write_register(config, &reg, val);
 	}
 
-	intel_register_access_fini();
+	intel_register_access_fini(&mmio_data);
 
 	return EXIT_SUCCESS;
 }
@@ -624,9 +631,10 @@ static int intel_reg_dump(struct config *config, int argc, char *argv[])
 	int i;
 
 	if (config->mmiofile)
-		intel_mmio_use_dump_file(config->mmiofile);
+		intel_mmio_use_dump_file(&mmio_data, config->mmiofile);
 	else
-		intel_register_access_init(config->pci_dev, 0, -1);
+		intel_register_access_init(&mmio_data, config->pci_dev, 0, -1);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	for (i = 0; i < config->regcount; i++) {
 		reg = &config->regs[i];
@@ -638,7 +646,7 @@ static int intel_reg_dump(struct config *config, int argc, char *argv[])
 		dump_register(config, &config->regs[i]);
 	}
 
-	intel_register_access_fini();
+	intel_register_access_fini(&mmio_data);
 
 	return EXIT_SUCCESS;
 }
@@ -652,7 +660,8 @@ static int intel_reg_snapshot(struct config *config, int argc, char *argv[])
 		return EXIT_FAILURE;
 	}
 
-	intel_mmio_use_pci_bar(config->pci_dev);
+	intel_mmio_use_pci_bar(&mmio_data, config->pci_dev);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	/* XXX: error handling */
 	if (write(1, igt_global_mmio, config->pci_dev->regions[mmio_bar].size) == -1)
tools/intel_reg_checker.c +5 -1
index b14a06ea..c8831901 100644
@@ -32,6 +32,9 @@
 static uint32_t devid;
 static int gen;
 
+static struct _mmio_data mmio_data;
+void *igt_global_mmio;
+
 static uint32_t
 read_and_print_reg(const char *name, uint32_t reg)
 {
@@ -345,7 +348,8 @@ int main(int argc, char** argv)
 
 	dev = intel_get_pci_device();
 	devid = dev->device_id;
-	intel_mmio_use_pci_bar(dev);
+	intel_mmio_use_pci_bar(&mmio_data, dev);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	if (IS_GEN7(devid))
 		gen = 7;
tools/intel_watermark.c +27 -17

144 lines not on this page · raw message

Signature · 6 lines
2.20.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#6 lore raw

PATCH v5 5/5 lib/ioctl_wrappers: add fd to aperture_mmap

In reply to Daniel Mrzyglod

Add fd parameter to determine device correctly -1 for legacy parts of library

---
 lib/ioctl_wrappers.c            | 12 +++++++++---
 lib/ioctl_wrappers.h            |  2 +-
 tests/i915/gem_concurrent_all.c | 12 ++++++------
 tests/i915/gem_cpu_reloc.c      |  4 ++--
 tests/i915/gem_mmap.c           |  4 ++--
 tests/i915/gem_mmap_gtt.c       | 10 +++++-----
 tests/i915/gem_pwrite.c         |  4 ++--
 tests/i915/gem_shrink.c         |  2 +-
 tests/i915/i915_pm_rpm.c        |  4 ++--
 tests/kms_flip.c                |  2 +-
 tests/prime_mmap.c              |  4 ++--
 11 files changed, 33 insertions(+), 27 deletions(-)
lib/ioctl_wrappers.c +9 -3
index 280fdd62..5e33b1ea 100644
@@ -54,6 +54,7 @@
 #include "intel_io.h"
 #include "igt_debugfs.h"
 #include "igt_sysfs.h"
+#include "igt_device.h"
 #include "config.h"
 
 #ifdef HAVE_VALGRIND
@@ -1090,17 +1091,22 @@ uint64_t gem_aperture_size(int fd)
 
 /**
  * gem_mappable_aperture_size:
- *
+ * @fd open i915 drm file descriptor or -1 for legacy
  * Feature test macro to query the kernel for the mappable gpu aperture size.
  * This is the area available for GTT memory mappings.
  *
  * Returns: The mappable gtt address space size.
  */
-uint64_t gem_mappable_aperture_size(void)
+uint64_t gem_mappable_aperture_size(int fd)
 {
-	struct pci_device *pci_dev = intel_get_pci_device();
+	struct pci_device *pci_dev;
 	int bar;
 
+	if (fd == -1)
+		pci_dev = intel_get_pci_device();
+	else
+		pci_dev = igt_device_get_pci_device(fd);
+
 	if (intel_gen(pci_dev->device_id) < 3)
 		bar = 0;
 	else
lib/ioctl_wrappers.h +1 -1
index 03211c97..e712f197 100644
@@ -136,7 +136,7 @@ uint64_t gem_total_stolen_size(int fd);
 uint64_t gem_available_aperture_size(int fd);
 uint64_t gem_aperture_size(int fd);
 uint64_t gem_global_aperture_size(int fd);
-uint64_t gem_mappable_aperture_size(void);
+uint64_t gem_mappable_aperture_size(int fd);
 bool gem_has_softpin(int fd);
 bool gem_has_exec_fence(int fd);
 
tests/i915/gem_concurrent_all.c +6 -6
index 3ddaab82..3d863f97 100644
@@ -1830,7 +1830,7 @@ igt_main
 				 c->name, s->name, "small");
 			igt_subtest_group {
 				igt_fixture {
-					count = num_buffers(gem_mappable_aperture_size()/4,
+					count = num_buffers(gem_mappable_aperture_size(fd)/4,
 							    s, c, CHECK_RAM);
 				}
 				run_modes(name, c, modes, s, count);
@@ -1841,7 +1841,7 @@ igt_main
 				 c->name, s->name, "thrash");
 			igt_subtest_group {
 				igt_fixture {
-					count = num_buffers(gem_mappable_aperture_size(),
+					count = num_buffers(gem_mappable_aperture_size(fd),
 							    s, c, CHECK_RAM);
 				}
 				run_modes(name, c, modes, s, count);
@@ -1873,7 +1873,7 @@ igt_main
 				 c->name, s->name, "shrink");
 			igt_subtest_group {
 				igt_fixture {
-					count = num_buffers(gem_mappable_aperture_size(),
+					count = num_buffers(gem_mappable_aperture_size(fd),
 							    s, c, CHECK_RAM);
 
 					igt_fork_shrink_helper(fd);
@@ -1889,8 +1889,8 @@ igt_main
 				 c->name, s->name, "swap");
 			igt_subtest_group {
 				igt_fixture {
-					if (intel_get_avail_ram_mb() > gem_mappable_aperture_size()/(1024*1024)) {
-						pin_sz = intel_get_avail_ram_mb() - gem_mappable_aperture_size()/(1024*1024);
+					if (intel_get_avail_ram_mb() > gem_mappable_aperture_size(fd)/(1024*1024)) {
+						pin_sz = intel_get_avail_ram_mb() - gem_mappable_aperture_size(fd)/(1024*1024);
 
 						igt_debug("Pinning %lld MiB\n", (long long)pin_sz);
 						pin_sz *= 1024 * 1024;
@@ -1904,7 +1904,7 @@ igt_main
 						igt_require(pinned);
 					}
 
-					count = num_buffers(gem_mappable_aperture_size(),
+					count = num_buffers(gem_mappable_aperture_size(fd),
 							    s, c, CHECK_RAM | CHECK_SWAP);
 				}
 				run_modes(name, c, modes, s, count);
tests/i915/gem_cpu_reloc.c +2 -2
index 47099862..17c2fe11 100644
@@ -283,7 +283,7 @@ igt_main
 		run_test(i915, 1);
 
 	igt_subtest("full") {
-		uint64_t aper_size = gem_mappable_aperture_size();
+		uint64_t aper_size = gem_mappable_aperture_size(i915);
 		unsigned long count = aper_size / 4096 + 1;
 
 		intel_require_memory(count, 4096, CHECK_RAM);
@@ -292,7 +292,7 @@ igt_main
 	}
 
 	igt_subtest("forked") {
-		uint64_t aper_size = gem_mappable_aperture_size();
+		uint64_t aper_size = gem_mappable_aperture_size(i915);
 		unsigned long count = aper_size / 4096 + 1;
 		int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
 
tests/i915/gem_mmap.c +2 -2
index d1b10013..0344d416 100644
@@ -53,10 +53,10 @@ test_huge_bo(int huge)
 
 	switch (huge) {
 	case -1:
-		huge_object_size = gem_mappable_aperture_size() / 2;
+		huge_object_size = gem_mappable_aperture_size(fd) / 2;
 		break;
 	case 0:
-		huge_object_size = gem_mappable_aperture_size() + PAGE_SIZE;
+		huge_object_size = gem_mappable_aperture_size(fd) + PAGE_SIZE;
 		break;
 	case 1:
 		huge_object_size = gem_aperture_size(fd) + PAGE_SIZE;
tests/i915/gem_mmap_gtt.c +5 -5
index 9a670f03..4e4f2925 100644
@@ -562,7 +562,7 @@ test_huge_bo(int fd, int huge, int tiling)
 
 	switch (huge) {
 	case -1:
-		size = gem_mappable_aperture_size() / 2;
+		size = gem_mappable_aperture_size(fd) / 2;
 
 		/* Power of two fence size, natural fence
 		 * alignment, and the guard page at the end
@@ -577,7 +577,7 @@ test_huge_bo(int fd, int huge, int tiling)
 			size /= 2;
 		break;
 	case 0:
-		size = gem_mappable_aperture_size() + PAGE_SIZE;
+		size = gem_mappable_aperture_size(fd) + PAGE_SIZE;
 		break;
 	default:
 		size = gem_global_aperture_size(fd) + PAGE_SIZE;
@@ -658,13 +658,13 @@ test_huge_copy(int fd, int huge, int tiling_a, int tiling_b, int ncpus)
 
 	switch (huge) {
 	case -2:
-		huge_object_size = gem_mappable_aperture_size() / 4;
+		huge_object_size = gem_mappable_aperture_size(fd) / 4;
 		break;
 	case -1:
-		huge_object_size = gem_mappable_aperture_size() / 2;
+		huge_object_size = gem_mappable_aperture_size(fd) / 2;
 		break;
 	case 0:
-		huge_object_size = gem_mappable_aperture_size() + PAGE_SIZE;
+		huge_object_size = gem_mappable_aperture_size(fd) + PAGE_SIZE;
 		break;
 	case 1:
 		huge_object_size = gem_global_aperture_size(fd) + PAGE_SIZE;
tests/i915/gem_pwrite.c +2 -2
index 3fd0ef66..6c400c43 100644
@@ -121,7 +121,7 @@ static void test_big_cpu(int fd, int scale, unsigned flags)
 
 	switch (scale) {
 	case 0:
-		size = gem_mappable_aperture_size() + 4096;
+		size = gem_mappable_aperture_size(fd) + 4096;
 		break;
 	case 1:
 		size = gem_global_aperture_size(fd) + 4096;
@@ -183,7 +183,7 @@ static void test_big_gtt(int fd, int scale, unsigned flags)
 	igt_require(gem_mmap__has_wc(fd));
 	switch (scale) {
 	case 0:
-		size = gem_mappable_aperture_size() + 4096;
+		size = gem_mappable_aperture_size(fd) + 4096;
 		break;
 	case 1:
 		size = gem_global_aperture_size(fd) + 4096;
tests/i915/gem_shrink.c +1 -1
index 037ff005..eb0a22b8 100644
@@ -413,7 +413,7 @@ igt_main
 		 * we expect the shrinker to start purging objects,
 		 * and possibly fail.
 		 */
-		alloc_size = gem_mappable_aperture_size() / 2;
+		alloc_size = gem_mappable_aperture_size(fd) / 2;
 		num_processes = 1 + (mem_size / (alloc_size >> 20));
 
 		igt_info("Using %d processes and %'lluMiB per process\n",
tests/i915/i915_pm_rpm.c +2 -2
index a2c9d0ed..78e547bd 100644
@@ -1371,7 +1371,7 @@ static void gem_evict_pwrite_subtest(void)
 	unsigned int num_trash_bos, n;
 	uint32_t buf;
 
-	num_trash_bos = gem_mappable_aperture_size() / (1024*1024) + 1;
+	num_trash_bos = gem_mappable_aperture_size(drm_fd) / (1024*1024) + 1;
 	trash_bos = malloc(num_trash_bos * sizeof(*trash_bos));
 	igt_assert(trash_bos);
 
@@ -1415,7 +1415,7 @@ static bool device_in_pci_d3(void)
 	uint16_t val;
 	int rc;
 
-	rc = pci_device_cfg_read_u16(intel_get_pci_device(), &val, 0xd4);
+	rc = pci_device_cfg_read_u16(igt_device_get_pci_device(drm_fd), &val, 0xd4);
 	igt_assert_eq(rc, 0);
 
 	igt_debug("%s: PCI D3 state=%d\n", __func__, val & 0x3);
tests/kms_flip.c +1 -1
index 8c17c8da..ce931f72 100755
@@ -1223,7 +1223,7 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
 	/* 256 MB is usually the maximum mappable aperture,
 	 * (make it 4x times that to ensure failure) */
 	if (o->flags & TEST_BO_TOOBIG) {
-		bo_size = 4*gem_mappable_aperture_size();
+		bo_size = 4*gem_mappable_aperture_size(drm_fd);
 		igt_require(bo_size < gem_global_aperture_size(drm_fd));
 	}
 
tests/prime_mmap.c +2 -2
index fc985784..06a66cab 100644
@@ -447,8 +447,8 @@ test_aperture_limit(void)
 	char *ptr1, *ptr2;
 	uint32_t handle1, handle2;
 	/* Two buffers the sum of which > mappable aperture */
-	uint64_t size1 = (gem_mappable_aperture_size() * 7) / 8;
-	uint64_t size2 = (gem_mappable_aperture_size() * 3) / 8;
+	uint64_t size1 = (gem_mappable_aperture_size(fd) * 7) / 8;
+	uint64_t size2 = (gem_mappable_aperture_size(fd) * 3) / 8;
 
 	handle1 = gem_create(fd, size1);
 	fill_bo(handle1, BO_SIZE);
Signature · 6 lines
2.20.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#5 lore raw

Re: [igt-dev] [PATCH i-g-t v5 4/5] lib/intel_mmio: remove igt_global_mmio and move it to mmio_data

In reply to Daniel Mrzyglod
Quoted 1,141 lines · Daniel Mrzyglod

this patch remove need for igt_global_mmio from library space. The reason that it was moved is the idea to support multiple devices at once.

---
 benchmarks/gem_latency.c      |   5 +-
 benchmarks/gem_wsim.c         |   6 +-
 lib/intel_io.h                |  78 +++++++++++++--------
 lib/intel_iosf.c              |  74 +++++++++++---------
 lib/intel_mmio.c              | 123 ++++++++++++++++------------------
 tests/i915/gem_exec_latency.c |   7 +-
 tests/i915/gem_exec_parse.c   |  14 ++--
 tests/i915/i915_pm_lpsp.c     |   7 +-
 tools/intel_audio_dump.c      |   7 +-
 tools/intel_backlight.c       |   5 +-
 tools/intel_display_poller.c  |   7 +-
 tools/intel_forcewaked.c      |  14 ++--
 tools/intel_gpu_time.c        |   5 +-
 tools/intel_infoframes.c      |   7 +-
 tools/intel_l3_parity.c       |  14 ++--
 tools/intel_lid.c             |   6 +-
 tools/intel_panel_fitter.c    |   7 +-
 tools/intel_perf_counters.c   |  17 +++--
 tools/intel_reg.c             |  31 ++++++---
 tools/intel_reg_checker.c     |   6 +-
 tools/intel_watermark.c       |  44 +++++++-----
 21 files changed, 292 insertions(+), 192 deletions(-)
benchmarks/gem_latency.c +4 -1
index c3fc4bf0..bcaaecef 100644
@@ -55,6 +55,8 @@
 static int done;
 static int fd;
 static volatile uint32_t *timestamp_reg;
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
 
 #define REG(x) (volatile uint32_t *)((volatile char *)igt_global_mmio + x)
 #define REG_OFFSET(x) ((volatile char *)(x) - (volatile char *)igt_global_mmio)
@@ -456,7 +458,8 @@ static int run(int seconds,
 	if (gen < 6)
 		return IGT_EXIT_SKIP; /* Needs BCS timestamp */
 
-	intel_register_access_init(intel_get_pci_device(), false, fd);
+	intel_register_access_init(&mmio_data, intel_get_pci_device(), false, fd);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	if (gen == 6)
 		timestamp_reg = REG(RCS_TIMESTAMP);
benchmarks/gem_wsim.c +5 -1
index afb9644d..86af58cb 100644
@@ -206,6 +206,9 @@ struct workload
 	} busy_balancer;
 };
 
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
+
 static const unsigned int nop_calibration_us = 1000;
 static unsigned long nop_calibration;
 
@@ -2223,7 +2226,8 @@ static void init_clocks(void)
 	uint32_t rcs_start, rcs_end;
 	double overhead, t;
 
-	intel_register_access_init(intel_get_pci_device(), false, fd);
+	intel_register_access_init(&mmio_data, intel_get_pci_device(), false, fd);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	if (verbose <= 1)
 		return;
lib/intel_io.h +50 -28
index 0674b42c..5f9ea724 100644
@@ -30,17 +30,41 @@
 
 #include <stdint.h>
 #include <pciaccess.h>
+#include <stdbool.h>
 
 /* register access helpers from intel_mmio.c */
-extern void *igt_global_mmio;
-void intel_mmio_use_pci_bar(struct pci_device *pci_dev);
-void intel_mmio_use_dump_file(char *file);
+struct intel_register_range {
+	uint32_t base;
+	uint32_t size;
+	uint32_t flags;
+};
+
+struct intel_register_map {
+	struct intel_register_range *map;
+	uint32_t top;
+	uint32_t alignment_mask;
+};
+
+struct _mmio_data {
+	int inited;
+	bool safe;
+	uint32_t i915_devid;
+	struct intel_register_map map;
+	int key;
+	void *igt_mmio;
+};
+
+void intel_mmio_use_pci_bar(struct _mmio_data *mmio_data,
+			    struct pci_device *pci_dev);
+void intel_mmio_use_dump_file(struct _mmio_data *mmio_data, char *file);
 
-int intel_register_access_init(struct pci_device *pci_dev, int safe, int fd);
-void intel_register_access_fini(void);
-uint32_t intel_register_read(uint32_t reg);
-void intel_register_write(uint32_t reg, uint32_t val);
-int intel_register_access_needs_fakewake(void);
+int intel_register_access_init(struct _mmio_data *mmio_data,
+			       struct pci_device *pci_dev, int safe, int fd);
+void intel_register_access_fini(struct _mmio_data *mmio_data);
+uint32_t intel_register_read(struct _mmio_data *mmio_data, uint32_t reg);
+void intel_register_write(struct _mmio_data *mmio_data, uint32_t reg,
+			  uint32_t val);
+int intel_register_access_needs_fakewake(struct _mmio_data *mmio_data);
 
 uint32_t INREG(void *igt_mmio, uint32_t reg);
 uint16_t INREG16(void *igt_mmio, uint32_t reg);
@@ -50,17 +74,24 @@ void OUTREG16(void *igt_mmio, uint32_t reg, uint16_t val);
 void OUTREG8(void *igt_mmio, uint32_t reg, uint8_t val);
 
 /* sideband access functions from intel_iosf.c */
-uint32_t intel_dpio_reg_read(uint32_t reg, int phy);
-void intel_dpio_reg_write(uint32_t reg, uint32_t val, int phy);
-uint32_t intel_flisdsi_reg_read(uint32_t reg);
-void intel_flisdsi_reg_write(uint32_t reg, uint32_t val);
-uint32_t intel_iosf_sb_read(uint32_t port, uint32_t reg);
-void intel_iosf_sb_write(uint32_t port, uint32_t reg, uint32_t val);
+uint32_t intel_dpio_reg_read(struct _mmio_data *mmio_data, uint32_t reg,
+			     int phy);
+void intel_dpio_reg_write(struct _mmio_data *mmio_data, uint32_t reg,
+			  uint32_t val, int phy);
+uint32_t intel_flisdsi_reg_read(struct _mmio_data *mmio_data, uint32_t reg);
+void intel_flisdsi_reg_write(struct _mmio_data *mmio_data, uint32_t reg,
+			     uint32_t val);
+uint32_t intel_iosf_sb_read(struct _mmio_data *mmio_data, uint32_t port,
+			    uint32_t reg);
+void intel_iosf_sb_write(struct _mmio_data *mmio_data, uint32_t port,
+			 uint32_t reg, uint32_t val);
 
-int intel_punit_read(uint32_t addr, uint32_t *val);
-int intel_punit_write(uint32_t addr, uint32_t val);
-int intel_nc_read(uint32_t addr, uint32_t *val);
-int intel_nc_write(uint32_t addr, uint32_t val);
+int intel_punit_read(struct _mmio_data *mmio_data, uint32_t addr,
+		     uint32_t *val);
+int intel_punit_write(struct _mmio_data *mmio_data, uint32_t addr,
+		      uint32_t val);
+int intel_nc_read(struct _mmio_data *mmio_data, uint32_t addr, uint32_t *val);
+int intel_nc_write(struct _mmio_data *mmio_data, uint32_t addr, uint32_t val);
 
 /* register maps from intel_reg_map.c */
 #ifndef __GTK_DOC_IGNORE__
@@ -71,17 +102,8 @@ int intel_nc_write(uint32_t addr, uint32_t val);
 #define INTEL_RANGE_RW		(INTEL_RANGE_READ | INTEL_RANGE_WRITE)
 #define INTEL_RANGE_END		(1<<31)
 
-struct intel_register_range {
-	uint32_t base;
-	uint32_t size;
-	uint32_t flags;
-};
 
-struct intel_register_map {
-	struct intel_register_range *map;
-	uint32_t top;
-	uint32_t alignment_mask;
-};
+//static struct _mmio_data mmio_data;
 struct intel_register_map intel_get_register_map(uint32_t devid);
 struct intel_register_range *intel_get_register_range(struct intel_register_map map, uint32_t offset, uint32_t mode);
 #endif /* __GTK_DOC_IGNORE__ */
lib/intel_iosf.c +42 -32
index 3b5a1370..2e23dd29 100644
@@ -19,8 +19,8 @@
 /* Private register write, double-word addressing, non-posted */
 #define SB_CRWRDA_NP   0x07
 
-static int vlv_sideband_rw(uint32_t port, uint8_t opcode, uint32_t addr,
-			   uint32_t *val)
+static int vlv_sideband_rw(struct _mmio_data *mmio_data, uint32_t port,
+			   uint8_t opcode, uint32_t addr, uint32_t *val)
 {
 	int timeout = 0;
 	uint32_t cmd, devfn, be, bar;
@@ -34,22 +34,24 @@ static int vlv_sideband_rw(uint32_t port, uint8_t opcode, uint32_t addr,
 		(port << IOSF_PORT_SHIFT) | (be << IOSF_BYTE_ENABLES_SHIFT) |
 		(bar << IOSF_BAR_SHIFT);
 
-	if (intel_register_read(VLV_IOSF_DOORBELL_REQ) & IOSF_SB_BUSY) {
+	if (intel_register_read(mmio_data, VLV_IOSF_DOORBELL_REQ) &
+	    IOSF_SB_BUSY) {
 		igt_warn("warning: pcode (%s) mailbox access failed\n", is_read ? "read" : "write");
 		return -EAGAIN;
 	}
 
-	intel_register_write(VLV_IOSF_ADDR, addr);
+	intel_register_write(mmio_data, VLV_IOSF_ADDR, addr);
 	if (!is_read)
-		intel_register_write(VLV_IOSF_DATA, *val);
+		intel_register_write(mmio_data, VLV_IOSF_DATA, *val);
 
-	intel_register_write(VLV_IOSF_DOORBELL_REQ, cmd);
+	intel_register_write(mmio_data, VLV_IOSF_DOORBELL_REQ, cmd);
 
 	do {
 		usleep(1);
 		timeout++;
-	} while (intel_register_read(VLV_IOSF_DOORBELL_REQ) & IOSF_SB_BUSY &&
-		 timeout < TIMEOUT_US);
+	} while (intel_register_read(mmio_data->igt_mmio,
+				     VLV_IOSF_DOORBELL_REQ) &
+		IOSF_SB_BUSY && timeout < TIMEOUT_US);
 
 	if (timeout >= TIMEOUT_US) {
 		igt_warn("timeout waiting for pcode %s (%d) to finish\n", is_read ? "read" : "write", addr);
@@ -57,8 +59,8 @@ static int vlv_sideband_rw(uint32_t port, uint8_t opcode, uint32_t addr,
 	}
 
 	if (is_read)
-		*val = intel_register_read(VLV_IOSF_DATA);
-	intel_register_write(VLV_IOSF_DATA, 0);
+		*val = intel_register_read(mmio_data->igt_mmio, VLV_IOSF_DATA);
+	intel_register_write(mmio_data->igt_mmio, VLV_IOSF_DATA, 0);
 
 	return 0;
 }
@@ -73,9 +75,10 @@ static int vlv_sideband_rw(uint32_t port, uint8_t opcode, uint32_t addr,
  * Returns:
  * 0 when the register access succeeded, negative errno code on failure.
  */
-int intel_punit_read(uint32_t addr, uint32_t *val)
+int intel_punit_read(struct _mmio_data *mmio_data, uint32_t addr, uint32_t *val)
 {
-	return vlv_sideband_rw(IOSF_PORT_PUNIT, SB_CRRDDA_NP, addr, val);
+	return vlv_sideband_rw(mmio_data, IOSF_PORT_PUNIT, SB_CRRDDA_NP, addr,
+			       val);
 }
 
 /**
@@ -88,9 +91,10 @@ int intel_punit_read(uint32_t addr, uint32_t *val)
  * Returns:
  * 0 when the register access succeeded, negative errno code on failure.
  */
-int intel_punit_write(uint32_t addr, uint32_t val)
+int intel_punit_write(struct _mmio_data *mmio_data, uint32_t addr, uint32_t val)
 {
-	return vlv_sideband_rw(IOSF_PORT_PUNIT, SB_CRWRDA_NP, addr, &val);
+	return vlv_sideband_rw(mmio_data, IOSF_PORT_PUNIT, SB_CRWRDA_NP, addr,
+			       &val);
 }
 
 /**
@@ -103,9 +107,10 @@ int intel_punit_write(uint32_t addr, uint32_t val)
  * Returns:
  * 0 when the register access succeeded, negative errno code on failure.
  */
-int intel_nc_read(uint32_t addr, uint32_t *val)
+int intel_nc_read(struct _mmio_data *mmio_data, uint32_t addr, uint32_t *val)
 {
-	return vlv_sideband_rw(IOSF_PORT_NC, SB_CRRDDA_NP, addr, val);
+	return vlv_sideband_rw(mmio_data, IOSF_PORT_NC, SB_CRRDDA_NP, addr,
+			       val);
 }
 
 /**
@@ -118,9 +123,10 @@ int intel_nc_read(uint32_t addr, uint32_t *val)
  * Returns:
  * 0 when the register access succeeded, negative errno code on failure.
  */
-int intel_nc_write(uint32_t addr, uint32_t val)
+int intel_nc_write(struct _mmio_data *mmio_data, uint32_t addr, uint32_t val)
 {
-	return vlv_sideband_rw(IOSF_PORT_NC, SB_CRWRDA_NP, addr, &val);
+	return vlv_sideband_rw(mmio_data, IOSF_PORT_NC, SB_CRWRDA_NP, addr,
+			       &val);
 }
 
 /**
@@ -133,14 +139,16 @@ int intel_nc_write(uint32_t addr, uint32_t val)
  * Returns:
  * The value read from the register.
  */
-uint32_t intel_dpio_reg_read(uint32_t reg, int phy)
+uint32_t intel_dpio_reg_read(struct _mmio_data *mmio_data, uint32_t reg, int phy)
 {
 	uint32_t val;
 
 	if (phy == 0)
-		vlv_sideband_rw(IOSF_PORT_DPIO, SB_MRD_NP, reg, &val);
+		vlv_sideband_rw(mmio_data, IOSF_PORT_DPIO, SB_MRD_NP, reg,
+				&val);
 	else
-		vlv_sideband_rw(IOSF_PORT_DPIO_2, SB_MRD_NP, reg, &val);
+		vlv_sideband_rw(mmio_data, IOSF_PORT_DPIO_2, SB_MRD_NP, reg,
+				&val);
 	return val;
 }
 
@@ -152,38 +160,40 @@ uint32_t intel_dpio_reg_read(uint32_t reg, int phy)
  *
  * 32-bit write of the register at @offset through the DPIO sideband port.
  */
-void intel_dpio_reg_write(uint32_t reg, uint32_t val, int phy)
+void intel_dpio_reg_write(struct _mmio_data *mmio_data, uint32_t reg, uint32_t val, int phy)
 {
 	if (phy == 0)
-		vlv_sideband_rw(IOSF_PORT_DPIO, SB_MWR_NP, reg, &val);
+		vlv_sideband_rw(mmio_data, IOSF_PORT_DPIO, SB_MWR_NP, reg, &val);
 	else
-		vlv_sideband_rw(IOSF_PORT_DPIO_2, SB_MWR_NP, reg, &val);
+		vlv_sideband_rw(mmio_data, IOSF_PORT_DPIO_2, SB_MWR_NP, reg,
+				&val);
 }
 
-uint32_t intel_flisdsi_reg_read(uint32_t reg)
+uint32_t intel_flisdsi_reg_read(struct _mmio_data *mmio_data, uint32_t reg)
 {
 	uint32_t val = 0;
 
-	vlv_sideband_rw(IOSF_PORT_FLISDSI, SB_CRRDDA_NP, reg, &val);
+	vlv_sideband_rw(mmio_data, IOSF_PORT_FLISDSI, SB_CRRDDA_NP, reg, &val);
 
 	return val;
 }
 
-void intel_flisdsi_reg_write(uint32_t reg, uint32_t val)
+void intel_flisdsi_reg_write(struct _mmio_data *mmio_data, uint32_t reg, uint32_t val)
 {
-	vlv_sideband_rw(IOSF_PORT_FLISDSI, SB_CRWRDA_NP, reg, &val);
+	vlv_sideband_rw(mmio_data, IOSF_PORT_FLISDSI, SB_CRWRDA_NP, reg, &val);
 }
 
-uint32_t intel_iosf_sb_read(uint32_t port, uint32_t reg)
+uint32_t intel_iosf_sb_read(struct _mmio_data *mmio_data, uint32_t port, uint32_t reg)
 {
 	uint32_t val;
 
-	vlv_sideband_rw(port, SB_CRRDDA_NP, reg, &val);
+	vlv_sideband_rw(mmio_data, port, SB_CRRDDA_NP, reg, &val);
 
 	return val;
 }
 
-void intel_iosf_sb_write(uint32_t port, uint32_t reg, uint32_t val)
+void intel_iosf_sb_write(struct _mmio_data *mmio_data, uint32_t port,
+			 uint32_t reg, uint32_t val)
 {
-	vlv_sideband_rw(port, SB_CRWRDA_NP, reg, &val);
+	vlv_sideband_rw(mmio_data, port, SB_CRWRDA_NP, reg, &val);
 }
lib/intel_mmio.c +57 -66
index d473cd9b..42aff2b7 100644
@@ -65,32 +65,17 @@
 
 #define FAKEKEY 0x2468ace0
 
-/**
- * igt_global_mmio:
- *
- * Pointer to the register range, initialized using intel_register_access_init()
- * or intel_mmio_use_dump_file(). It is not recommended to use this directly.
- */
-void *igt_global_mmio;
-
-static struct _mmio_data {
-	int inited;
-	bool safe;
-	uint32_t i915_devid;
-	struct intel_register_map map;
-	int key;
-} mmio_data;
-
 /**
  * intel_mmio_use_dump_file:
+ * @mmio_data:  mmio structure for IO operations
  * @file: name of the register dump file to open
  *
- * Sets up #igt_global_mmio to point at the data contained in @file. This allows
- * the same code to get reused for dumping and decoding from running hardware as
- * from register dumps.
+ * Sets also up mmio_data->igt_mmio to point at the data contained
+ * in @file. This allows the same code to get reused for dumping and decoding
+ * from running hardware as from register dumps.
  */
 void
-intel_mmio_use_dump_file(char *file)
+intel_mmio_use_dump_file(struct _mmio_data *mmio_data, char *file)
 {
 	int fd;
 	struct stat st;
@@ -100,22 +85,23 @@ intel_mmio_use_dump_file(char *file)
 		      "Couldn't open %s\n", file);
 
 	fstat(fd, &st);
-	igt_global_mmio = mmap(NULL, st.st_size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
-	igt_fail_on_f(igt_global_mmio == MAP_FAILED,
+	mmio_data->igt_mmio = mmap(NULL, st.st_size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
+	igt_fail_on_f(mmio_data->igt_mmio == MAP_FAILED,
 		      "Couldn't mmap %s\n", file);
 	close(fd);
 }
 
 /**
  * intel_mmio_use_pci_bar:
+ * @mmio_data:  mmio structure for IO operations
  * @pci_dev: intel gracphis pci device
  *
- * Sets up #igt_global_mmio to point at the mmio bar.
+ * Fill a mmio_data stucture with igt_mmio to point at the mmio bar.
  *
  * @pci_dev can be obtained from intel_get_pci_device().
  */
 void
-intel_mmio_use_pci_bar(struct pci_device *pci_dev)
+intel_mmio_use_pci_bar(struct _mmio_data *mmio_data, struct pci_device *pci_dev)
 {
 	uint32_t devid, gen;
 	int mmio_bar, mmio_size;
@@ -139,7 +125,7 @@ intel_mmio_use_pci_bar(struct pci_device *pci_dev)
 				      pci_dev->regions[mmio_bar].base_addr,
 				      mmio_size,
 				      PCI_DEV_MAP_FLAG_WRITABLE,
-				      &igt_global_mmio);
+				      &mmio_data->igt_mmio);
 
 	igt_fail_on_f(error != 0,
 		      "Couldn't map MMIO region\n");
@@ -153,6 +139,7 @@ release_forcewake_lock(int fd)
 
 /**
  * intel_register_access_init:
+ * @mmio_data:  mmio structure for IO operations
  * @pci_dev: intel graphics pci device
  * @safe: use safe register access tables
  *
@@ -160,76 +147,79 @@ release_forcewake_lock(int fd)
  * handling and also allows register access to be checked with an explicit
  * whitelist.
  *
- * It also initializes #igt_global_mmio like intel_mmio_use_pci_bar().
+ * It also initializes mmio_data->igt_mmio like intel_mmio_use_pci_bar().
  *
  * @pci_dev can be obtained from intel_get_pci_device().
  */
 int
-intel_register_access_init(struct pci_device *pci_dev, int safe, int fd)
+intel_register_access_init(struct _mmio_data *mmio_data, struct pci_device *pci_dev, int safe, int fd)
 {
 	int ret;
 
 	/* after old API is deprecated, remove this */
-	if (igt_global_mmio == NULL)
-		intel_mmio_use_pci_bar(pci_dev);
+	if (mmio_data->igt_mmio == NULL)
+		intel_mmio_use_pci_bar(mmio_data, pci_dev);
 
-	igt_assert(igt_global_mmio != NULL);
+	igt_assert(mmio_data->igt_mmio != NULL);
 
-	if (mmio_data.inited)
+	if (mmio_data->inited)
 		return -1;
 
-	mmio_data.safe = (safe != 0 &&
+	mmio_data->safe = (safe != 0 &&
 			intel_gen(pci_dev->device_id) >= 4) ? true : false;
-	mmio_data.i915_devid = pci_dev->device_id;
-	if (mmio_data.safe)
-		mmio_data.map = intel_get_register_map(mmio_data.i915_devid);
+	mmio_data->i915_devid = pci_dev->device_id;
+	if (mmio_data->safe)
+		mmio_data->map = intel_get_register_map(mmio_data->i915_devid);
 
 	/* Find where the forcewake lock is. Forcewake doesn't exist
 	 * gen < 6, but the debugfs should do the right things for us.
 	 */
 	ret = igt_open_forcewake_handle(fd);
 	if (ret == -1)
-		mmio_data.key = FAKEKEY;
+		mmio_data->key = FAKEKEY;
 	else
-		mmio_data.key = ret;
+		mmio_data->key = ret;
 
-	mmio_data.inited++;
+	mmio_data->inited++;
 	return 0;
 }
 
 static int
-intel_register_access_needs_wake(void)
+intel_register_access_needs_wake(struct _mmio_data *mmio_data)
 {
-	return mmio_data.key != FAKEKEY;
+	return mmio_data->key != FAKEKEY;
 }
 
 /**
  * intel_register_access_needs_fakewake:
+ * @mmio_data:  mmio structure for IO operations
  *
  * Returns:
  * Non-zero when forcewake initialization failed.
  */
-int intel_register_access_needs_fakewake(void)
+int intel_register_access_needs_fakewake(struct _mmio_data *mmio_data)
 {
-	return mmio_data.key == FAKEKEY;
+	return mmio_data->key == FAKEKEY;
 }
 
 /**
  * intel_register_access_fini:
+ * @mmio_data:  mmio structure for IO operations
  *
  * Clean up the register access helper initialized with
  * intel_register_access_init().
  */
 void
-intel_register_access_fini(void)
+intel_register_access_fini(struct _mmio_data *mmio_data)
 {
-	if (mmio_data.key && intel_register_access_needs_wake())
-		release_forcewake_lock(mmio_data.key);
-	mmio_data.inited--;
+	if (mmio_data->key && intel_register_access_needs_wake(mmio_data))
+		release_forcewake_lock(mmio_data->key);
+	mmio_data->inited--;
 }
 
 /**
  * intel_register_read:
+ * @mmio_data:  mmio structure for IO operations
  * @reg: register offset
  *
  * 32-bit read of the register at @offset. This function only works when the new
@@ -242,20 +232,20 @@ intel_register_access_fini(void)
  * The value read from the register.
  */
 uint32_t
-intel_register_read(uint32_t reg)
+intel_register_read(struct _mmio_data *mmio_data, uint32_t reg)
 {
 	struct intel_register_range *range;
 	uint32_t ret;
 
-	igt_assert(mmio_data.inited);
+	igt_assert(mmio_data->inited);
 
-	if (intel_gen(mmio_data.i915_devid) >= 6)
-		igt_assert(mmio_data.key != -1);
+	if (intel_gen(mmio_data->i915_devid) >= 6)
+		igt_assert(mmio_data->key != -1);
 
-	if (!mmio_data.safe)
+	if (!mmio_data->safe)
 		goto read_out;
 
-	range = intel_get_register_range(mmio_data.map,
+	range = intel_get_register_range(mmio_data->map,
 					 reg,
 					 INTEL_RANGE_READ);
 
@@ -266,13 +256,14 @@ intel_register_read(uint32_t reg)
 	}
 
 read_out:
-	ret = *(volatile uint32_t *)((volatile char *)igt_global_mmio + reg);
+	ret = *(volatile uint32_t *)((volatile char *)mmio_data->igt_mmio + reg);
 out:
 	return ret;
 }
 
 /**
  * intel_register_write:
+ * @mmio_data:  mmio structure for IO operations
  * @reg: register offset
  * @val: value to write
  *
@@ -283,19 +274,19 @@ out:
  * white lists.
  */
 void
-intel_register_write(uint32_t reg, uint32_t val)
+intel_register_write(struct _mmio_data *mmio_data, uint32_t reg, uint32_t val)
 {
 	struct intel_register_range *range;
 
-	igt_assert(mmio_data.inited);
+	igt_assert(mmio_data->inited);
 
-	if (intel_gen(mmio_data.i915_devid) >= 6)
-		igt_assert(mmio_data.key != -1);
+	if (intel_gen(mmio_data->i915_devid) >= 6)
+		igt_assert(mmio_data->key != -1);
 
-	if (!mmio_data.safe)
+	if (!mmio_data->safe)
 		goto write_out;
 
-	range = intel_get_register_range(mmio_data.map,
+	range = intel_get_register_range(mmio_data->map,
 					 reg,
 					 INTEL_RANGE_WRITE);
 
@@ -303,7 +294,7 @@ intel_register_write(uint32_t reg, uint32_t val)
 		      "Register write blocked for safety ""(*0x%08x = 0x%x)\n", reg, val);
 
 write_out:
-	*(volatile uint32_t *)((volatile char *)igt_global_mmio + reg) = val;
+	*(volatile uint32_t *)((volatile char *)mmio_data->igt_mmio + reg) = val;
 }
 
 
@@ -315,7 +306,7 @@ write_out:
  * 32-bit read of the register at offset @reg. This function only works when the
  * new register access helper is initialized with intel_register_access_init().
  *
- * This function directly accesses the #igt_global_mmio without safety checks.
+ * This function directly accesses the igt_mmio without safety checks.
  *
  * Returns:
  * The value read from the register.
@@ -333,7 +324,7 @@ uint32_t INREG(void *igt_mmio, uint32_t reg)
  * 16-bit read of the register at offset @reg. This function only works when the
  * new register access helper is initialized with intel_register_access_init().
  *
- * This function directly accesses the #igt_global_mmio without safety checks.
+ * This function directly accesses the igt_mmio without safety checks.
  *
  * Returns:
  * The value read from the register.
@@ -351,7 +342,7 @@ uint16_t INREG16(void *igt_mmio, uint32_t reg)
  * 8-bit read of the register at offset @reg. This function only works when the
  * new register access helper is initialized with intel_register_access_init().
  *
- * This function directly accesses the #igt_global_mmio without safety checks.
+ * This function directly accesses the igt_mmio without safety checks.
  *
  * Returns:
  * The value read from the register.
@@ -371,7 +362,7 @@ uint8_t INREG8(void *igt_mmio, uint32_t reg)
  * when the new register access helper is initialized with
  * intel_register_access_init().
  *
- * This function directly accesses the #igt_global_mmio without safety checks.
+ * This function directly accesses the igt_mmio without safety checks.
  */
 void OUTREG(void *igt_mmio, uint32_t reg, uint32_t val)
 {
@@ -387,7 +378,7 @@ void OUTREG(void *igt_mmio, uint32_t reg, uint32_t val)
  * when the new register access helper is initialized with
  * intel_register_access_init().
  *
- * This function directly accesses the #igt_global_mmio without safety checks.
+ * This function directly accesses the igt_mmio without safety checks.
  */
 void OUTREG16(void *igt_mmio, uint32_t reg, uint16_t val)
 {
@@ -404,7 +395,7 @@ void OUTREG16(void *igt_mmio, uint32_t reg, uint16_t val)
  * when the new register access helper is initialized with
  * intel_register_access_init().
  *
- * This function directly accesses the #igt_global_mmio without safety checks.
+ * This function directly accesses the igt_mmio without safety checks.
  */
 void OUTREG8(void *igt_mmio, uint32_t reg, uint8_t val)
 {
tests/i915/gem_exec_latency.c +6 -1
index e56d6278..6379edae 100644
@@ -62,6 +62,9 @@
 static unsigned int ring_size;
 static double rcs_clock;
 
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
+
 static void
 poll_ring(int fd, unsigned ring, const char *name)
 {
@@ -667,7 +670,9 @@ igt_main
 		if (ring_size > 1024)
 			ring_size = 1024;
 
-		intel_register_access_init(intel_get_pci_device(), false, device);
+		intel_register_access_init(&mmio_data, intel_get_pci_device(), false, device);
+		igt_global_mmio = mmio_data.igt_mmio;
+
 		rcs_clock = clockrate(device, RCS_TIMESTAMP);
 		igt_info("RCS timestamp clock: %.0fKHz, %.1fns\n",
 			 rcs_clock / 1e3, 1e9 / rcs_clock);
tests/i915/gem_exec_parse.c +9 -5
index 62e8d0a5..98b05267 100644
@@ -58,6 +58,9 @@
 
 static int parser_version;
 
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
+
 static int command_parser_version(int fd)
 {
 	int version = -1;
@@ -284,9 +287,9 @@ test_lri(int fd, uint32_t handle, struct test_lri *test)
 		  test->name, test->reg, test->test_val,
 		  expected_errno, expect);
 
-	intel_register_write(test->reg, test->init_val);
+	intel_register_write(&mmio_data, test->reg, test->init_val);
 
-	igt_assert_eq_u32((intel_register_read(test->reg) &
+	igt_assert_eq_u32((intel_register_read(&mmio_data, test->reg) &
 			   test->read_mask),
 			  test->init_val);
 
@@ -296,7 +299,7 @@ test_lri(int fd, uint32_t handle, struct test_lri *test)
 		   expected_errno);
 	gem_sync(fd, handle);
 
-	igt_assert_eq_u32((intel_register_read(test->reg) &
+	igt_assert_eq_u32((intel_register_read(&mmio_data, test->reg) &
 			   test->read_mask),
 			  expect);
 }
@@ -530,7 +533,8 @@ igt_main
 #undef REG
 
 		igt_fixture {
-			intel_register_access_init(intel_get_pci_device(), 0, fd);
+			intel_register_access_init(&mmio_data, intel_get_pci_device(), 0, fd);
+			igt_global_mmio = mmio_data.igt_mmio;
 		}
 
 		for (int i = 0; i < ARRAY_SIZE(lris); i++) {
@@ -543,7 +547,7 @@ igt_main
 		}
 
 		igt_fixture {
-			intel_register_access_fini();
+			intel_register_access_fini(&mmio_data);
 		}
 	}
 
tests/i915/i915_pm_lpsp.c +5 -2
index f69c88f6..cbbe6a4b 100644
@@ -30,6 +30,8 @@
 #include <fcntl.h>
 #include <unistd.h>
 
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
 
 static bool supports_lpsp(uint32_t devid)
 {
@@ -210,7 +212,8 @@ igt_main
 
 		igt_require(supports_lpsp(devid));
 
-		intel_register_access_init(intel_get_pci_device(), 0, drm_fd);
+		intel_register_access_init(&mmio_data, intel_get_pci_device(), 0, drm_fd);
+		igt_global_mmio = mmio_data.igt_mmio;
 
 		kmstest_set_vt_graphics_mode();
 	}
@@ -227,7 +230,7 @@ igt_main
 	igt_fixture {
 		int i;
 
-		intel_register_access_fini();
+		intel_register_access_fini(&mmio_data);
 		for (i = 0; i < drm_res->count_connectors; i++)
 			drmModeFreeConnector(drm_connectors[i]);
 		drmModeFreeResources(drm_res);
tools/intel_audio_dump.c +5 -2
index 678e1d08..119fece1 100644
@@ -41,6 +41,8 @@ static uint32_t devid;
 
 static int aud_reg_base = 0;	/* base address of audio registers */
 static int disp_reg_base = 0;	/* base address of display registers */
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
 
 #define IS_HASWELL_PLUS(devid)  (IS_HASWELL(devid) || IS_BROADWELL(devid))
 
@@ -2498,9 +2500,10 @@ int main(int argc, char **argv)
 	do_self_tests();
 
 	if (argc == 2)
-		intel_mmio_use_dump_file(argv[1]);
+		intel_mmio_use_dump_file(&mmio_data, argv[1]);
 	else
-		intel_mmio_use_pci_bar(pci_dev);
+		intel_mmio_use_pci_bar(&mmio_data, pci_dev);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	printf("%s audio registers:\n\n", intel_get_device_info(devid)->codename);
 	if (IS_VALLEYVIEW(devid)) {
tools/intel_backlight.c +4 -1
index bdbf9af3..1bd35f43 100644
@@ -35,12 +35,15 @@
 #include "intel_reg.h"
 
 /* XXX PCH only today */
+static struct _mmio_data mmio_data;
+void *igt_global_mmio;
 
 int main(int argc, char** argv)
 {
 	uint32_t current, max;
 
-	intel_mmio_use_pci_bar(intel_get_pci_device());
+	intel_mmio_use_pci_bar(&mmio_data, intel_get_pci_device());
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	current = INREG(igt_global_mmio, BLC_PWM_CPU_CTL) & BACKLIGHT_DUTY_CYCLE_MASK;
 	max = INREG(igt_global_mmio, BLC_PWM_PCH_CTL2) >> 16;
tools/intel_display_poller.c +5 -2
index e1094d39..af7e40cc 100644
@@ -59,6 +59,8 @@ enum test {
 
 static uint32_t vlv_offset;
 static uint16_t pipe_offset[3] = { 0, 0x1000, 0x2000, };
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
 
 #define PIPE_REG(pipe, reg_a) (pipe_offset[(pipe)] + (reg_a))
 
@@ -1187,7 +1189,8 @@ int main(int argc, char *argv[])
 		break;
 	}
 
-	intel_register_access_init(intel_get_pci_device(), 0, -1);
+	intel_register_access_init(&mmio_data, intel_get_pci_device(), 0, -1);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	printf("%s?\n", test_name(test, pipe, bit, test_pixelcount));
 
@@ -1262,7 +1265,7 @@ int main(int argc, char *argv[])
 		assert(0);
 	}
 
-	intel_register_access_fini();
+	intel_register_access_fini(&mmio_data);
 
 	if (quit)
 		return 0;
tools/intel_forcewaked.c +9 -5
index 02fbf888..e52db5ed 100644
@@ -39,6 +39,8 @@
 #include "drmtest.h"
 
 bool daemonized;
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
 
 #define INFO_PRINT(...) \
 	do { \
@@ -59,7 +61,7 @@ help(char *prog) {
 static int
 is_alive(void) {
 	/* Read the timestamp, which should *almost* always be !0 */
-	return (intel_register_read(0x2358) != 0);
+	return (intel_register_read(&mmio_data, 0x2358) != 0);
 }
 
 int main(int argc, char *argv[])
@@ -80,7 +82,8 @@ int main(int argc, char *argv[])
 		INFO_PRINT("started daemon");
 	}
 
-	ret = intel_register_access_init(intel_get_pci_device(), 1, -1);
+	ret = intel_register_access_init(&mmio_data, intel_get_pci_device(), 1, -1);
+	igt_global_mmio = mmio_data.igt_mmio;
 	if (ret) {
 		INFO_PRINT("Couldn't init register access\n");
 		exit(1);
@@ -90,14 +93,15 @@ int main(int argc, char *argv[])
 	while(1) {
 		if (!is_alive()) {
 			INFO_PRINT("gpu reset? restarting daemon\n");
-			intel_register_access_fini();
-			ret = intel_register_access_init(intel_get_pci_device(), 1, -1);
+			intel_register_access_fini(&mmio_data);
+			ret = intel_register_access_init(&mmio_data, intel_get_pci_device(), 1, -1);
+			igt_global_mmio = mmio_data.igt_mmio;
 			if (ret)
 				INFO_PRINT("Reg access init fail\n");
 		}
 		sleep(1);
 	}
-	intel_register_access_fini();
+	intel_register_access_fini(&mmio_data);
 	INFO_PRINT("Forcewake unlock\n");
 
 	if (daemonized) {
tools/intel_gpu_time.c +4 -1
index 79240fd3..0cfc108b 100644
@@ -41,6 +41,8 @@
 #define SAMPLES_PER_SEC             10000
 
 static volatile int goddo;
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
 
 static pid_t spawn(char **argv)
 {
@@ -67,7 +69,8 @@ int main(int argc, char **argv)
 	static struct rusage rusage;
 	int status;
 
-	intel_mmio_use_pci_bar(intel_get_pci_device());
+	intel_mmio_use_pci_bar(&mmio_data, intel_get_pci_device());
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	if (argc == 1) {
 		fprintf(stderr, "usage: %s cmd [args...]\n", argv[0]);
tools/intel_infoframes.c +5 -2
index 689f5faa..633a5e10 100644
@@ -262,6 +262,8 @@ const char *dip_frequency_names[] = {
 	"reserved (invalid)"
 };
 
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
 struct pci_device *pci_dev;
 int gen = 0;
 
@@ -1108,7 +1110,8 @@ int main(int argc, char *argv[])
 	       " perfectly: the Kernel might undo our changes.\n");
 
 	pci_dev = intel_get_pci_device();
-	intel_register_access_init(pci_dev, 0, -1);
+	intel_register_access_init(&mmio_data, pci_dev, 0, -1);
+	igt_global_mmio = mmio_data.igt_mmio;
 	intel_check_pch();
 
 	if (IS_GEN4(pci_dev->device_id))
@@ -1256,6 +1259,6 @@ int main(int argc, char *argv[])
 	}
 
 out:
-	intel_register_access_fini();
+	intel_register_access_fini(&mmio_data);
 	return ret;
 }
tools/intel_l3_parity.c +9 -5
index d8c997af..7a461a54 100644
@@ -44,6 +44,8 @@
 #include "intel_l3_parity.h"
 
 static unsigned int devid;
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
 /* L3 size is always a function of banks. The number of banks cannot be
  * determined by number of slices however */
 static inline int num_banks(void) {
@@ -189,7 +191,8 @@ int main(int argc, char *argv[])
 	if (intel_gen(devid) < 7 || IS_VALLEYVIEW(devid))
 		exit(77);
 
-	assert(intel_register_access_init(intel_get_pci_device(), 0, device) == 0);
+	assert(intel_register_access_init(&mmio_data, intel_get_pci_device(), 0, device) == 0);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	dir = igt_sysfs_open(device);
 
@@ -211,7 +214,7 @@ int main(int argc, char *argv[])
 	 * now. Just be aware of this if for some reason a hang is reported
 	 * when using this tool.
 	 */
-	dft = intel_register_read(0xb038);
+	dft = intel_register_read(&mmio_data, 0xb038);
 
 	while (1) {
 		int c, option_index = 0;
@@ -357,10 +360,11 @@ int main(int argc, char *argv[])
 				assert(i < 2);
 				dft |= i << 1; /* slice */
 				dft |= 1 << 0; /* enable */
-				intel_register_write(0xb038, dft);
+				intel_register_write(&mmio_data, 0xb038, dft);
 				break;
 			case 'u':
-				intel_register_write(0xb038, dft & ~(1<<0));
+				intel_register_write(&mmio_data, 0xb038, dft &
+						     ~(1 << 0));
 				break;
 			case 'L':
 				break;
@@ -369,7 +373,7 @@ int main(int argc, char *argv[])
 		}
 	}
 
-	intel_register_access_fini();
+	intel_register_access_fini(&mmio_data);
 	if (action == 'l')
 		exit(EXIT_SUCCESS);
 
tools/intel_lid.c +5 -1
index 2b597efb..b4f26b60 100644
@@ -52,6 +52,9 @@ enum lid_status {
 #define ACPI_BUTTON "/proc/acpi/button/"
 #define ACPI_LID "/proc/acpi/button/lid/"
 
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
+
 static int i830_lvds_acpi_lid_state(void)
 {
 	int fd;
@@ -119,7 +122,8 @@ int main(int argc, char **argv)
 {
 	int swf14, acpi_lid;
 
-	intel_mmio_use_pci_bar(intel_get_pci_device());
+	intel_mmio_use_pci_bar(&mmio_data, intel_get_pci_device());
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	while (1) {
 		swf14 = INREG(igt_global_mmio, SWF14);
tools/intel_panel_fitter.c +5 -2
index 26843d7c..9663d0cc 100644
@@ -35,6 +35,8 @@
 #include "intel_reg.h"
 #include "drmtest.h"
 
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
 int gen;
 
 uint32_t HTOTAL[]     = { 0x60000, 0x61000, 0x62000 };
@@ -280,7 +282,8 @@ int main (int argc, char *argv[])
 	       "solution that may or may not work. Use it at your own risk.\n");
 
 	pci_dev = intel_get_pci_device();
-	intel_register_access_init(pci_dev, 0, -1);
+	intel_register_access_init(&mmio_data, pci_dev, 0, -1);
+	igt_global_mmio = mmio_data.igt_mmio;
 	devid = pci_dev->device_id;
 
 	if (!HAS_PCH_SPLIT(devid)) {
@@ -342,6 +345,6 @@ int main (int argc, char *argv[])
 	}
 
 out:
-	intel_register_access_fini();
+	intel_register_access_fini(&mmio_data);
 	return ret;
 }
tools/intel_perf_counters.c +11 -6
index 50c4bce6..38f71419 100644
@@ -300,6 +300,8 @@ uint32_t *totals;
 uint32_t *last_counter;
 static drm_intel_bufmgr *bufmgr;
 struct intel_batchbuffer *batch;
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
 
 /* DW0 */
 #define GEN5_MI_REPORT_PERF_COUNT ((0x26 << 23) | (3 - 2))
@@ -483,12 +485,15 @@ main(int argc, char **argv)
 
 	if (oacontrol) {
 		/* Forcewake */
-		intel_register_access_init(intel_get_pci_device(), 0, fd);
+		intel_register_access_init(&mmio_data, intel_get_pci_device(),
+					   0, fd);
+		igt_global_mmio = mmio_data.igt_mmio;
 
 		/* Enable performance counters */
-		intel_register_write(OACONTROL,
-			counter_format << OACONTROL_COUNTER_SELECT_SHIFT |
-			PERFORMANCE_COUNTER_ENABLE);
+		intel_register_write(&mmio_data, OACONTROL,
+				     counter_format <<
+				     OACONTROL_COUNTER_SELECT_SHIFT |
+				     PERFORMANCE_COUNTER_ENABLE);
 	}
 
 	totals = calloc(counter_count, sizeof(uint32_t));
@@ -520,10 +525,10 @@ main(int argc, char **argv)
 
 	if (oacontrol) {
 		/* Disable performance counters */
-		intel_register_write(OACONTROL, 0);
+		intel_register_write(&mmio_data, OACONTROL, 0);
 
 		/* Forcewake */
-		intel_register_access_fini();
+		intel_register_access_fini(&mmio_data);
 	}
 
 	free(totals);
tools/intel_reg.c +0 -0
index 2e74b601..1c78af0b 100644

tools/intel_reg.c struct config { · line 88

Quoted 5 lines
tools/intel_reg.c +2 -0
@@ -84,6 +84,9 @@ struct config {
 	int verbosity;
 };
 
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;

Sad trombone for these ugly ducklings. Same everywhere, really, but here it hurts me because I put effort into avoiding *all* non-local data when I wrote the tool.

There's struct config that gets passed around all over the place. That's where this belongs. Don't take the shortcuts.

Or does igt_global_mmio have to be non-static? Then what's the point?

BR,
Jani.

Quoted 285 lines
tools/intel_reg.c +18 -11
+
 /* port desc must have been set */
 static int set_reg_by_addr(struct config *config, struct reg *reg,
 			   uint32_t addr)
@@ -390,7 +393,8 @@ static int read_register(struct config *config, struct reg *reg, uint32_t *valp)
 				reg->port_desc.name);
 			return -1;
 		}
-		val = intel_iosf_sb_read(reg->port_desc.port, reg->addr);
+		val = intel_iosf_sb_read(&mmio_data, reg->port_desc.port,
+					 reg->addr);
 		break;
 	default:
 		fprintf(stderr, "port %d not supported\n", reg->port_desc.port);
@@ -462,7 +466,8 @@ static int write_register(struct config *config, struct reg *reg, uint32_t val)
 				reg->port_desc.name);
 			return -1;
 		}
-		intel_iosf_sb_write(reg->port_desc.port, reg->addr, val);
+		intel_iosf_sb_write(&mmio_data, reg->port_desc.port, reg->addr,
+				    val);
 		break;
 	default:
 		fprintf(stderr, "port %d not supported\n", reg->port_desc.port);
@@ -556,9 +561,10 @@ static int intel_reg_read(struct config *config, int argc, char *argv[])
 	}
 
 	if (config->mmiofile)
-		intel_mmio_use_dump_file(config->mmiofile);
+		intel_mmio_use_dump_file(&mmio_data, config->mmiofile);
 	else
-		intel_register_access_init(config->pci_dev, 0, -1);
+		intel_register_access_init(&mmio_data, config->pci_dev, 0, -1);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	for (i = 1; i < argc; i++) {
 		struct reg reg;
@@ -574,7 +580,7 @@ static int intel_reg_read(struct config *config, int argc, char *argv[])
 		}
 	}
 
-	intel_register_access_fini();
+	intel_register_access_fini(&mmio_data);
 
 	return EXIT_SUCCESS;
 }
@@ -588,7 +594,8 @@ static int intel_reg_write(struct config *config, int argc, char *argv[])
 		return EXIT_FAILURE;
 	}
 
-	intel_register_access_init(config->pci_dev, 0, -1);
+	intel_register_access_init(&mmio_data, config->pci_dev, 0, -1);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	for (i = 1; i < argc; i += 2) {
 		struct reg reg;
@@ -613,7 +620,7 @@ static int intel_reg_write(struct config *config, int argc, char *argv[])
 		write_register(config, &reg, val);
 	}
 
-	intel_register_access_fini();
+	intel_register_access_fini(&mmio_data);
 
 	return EXIT_SUCCESS;
 }
@@ -624,9 +631,10 @@ static int intel_reg_dump(struct config *config, int argc, char *argv[])
 	int i;
 
 	if (config->mmiofile)
-		intel_mmio_use_dump_file(config->mmiofile);
+		intel_mmio_use_dump_file(&mmio_data, config->mmiofile);
 	else
-		intel_register_access_init(config->pci_dev, 0, -1);
+		intel_register_access_init(&mmio_data, config->pci_dev, 0, -1);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	for (i = 0; i < config->regcount; i++) {
 		reg = &config->regs[i];
@@ -638,7 +646,7 @@ static int intel_reg_dump(struct config *config, int argc, char *argv[])
 		dump_register(config, &config->regs[i]);
 	}
 
-	intel_register_access_fini();
+	intel_register_access_fini(&mmio_data);
 
 	return EXIT_SUCCESS;
 }
@@ -652,7 +660,8 @@ static int intel_reg_snapshot(struct config *config, int argc, char *argv[])
 		return EXIT_FAILURE;
 	}
 
-	intel_mmio_use_pci_bar(config->pci_dev);
+	intel_mmio_use_pci_bar(&mmio_data, config->pci_dev);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	/* XXX: error handling */
 	if (write(1, igt_global_mmio, config->pci_dev->regions[mmio_bar].size) == -1)
tools/intel_reg_checker.c +5 -1
index b14a06ea..c8831901 100644
@@ -32,6 +32,9 @@
 static uint32_t devid;
 static int gen;
 
+static struct _mmio_data mmio_data;
+void *igt_global_mmio;
+
 static uint32_t
 read_and_print_reg(const char *name, uint32_t reg)
 {
@@ -345,7 +348,8 @@ int main(int argc, char** argv)
 
 	dev = intel_get_pci_device();
 	devid = dev->device_id;
-	intel_mmio_use_pci_bar(dev);
+	intel_mmio_use_pci_bar(&mmio_data, dev);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	if (IS_GEN7(devid))
 		gen = 7;
tools/intel_watermark.c +27 -17
index 00bdd120..3f267fa6 100644
@@ -35,6 +35,8 @@
 
 static uint32_t display_base;
 static uint32_t devid;
+void *igt_global_mmio;
+static struct _mmio_data mmio_data;
 
 static uint32_t read_reg(uint32_t addr)
 {
@@ -249,7 +251,8 @@ static void skl_wm_dump(void)
 	uint32_t plane_ctl[num_pipes][max_planes];
 	uint32_t wm_linetime[num_pipes];
 
-	intel_register_access_init(intel_get_pci_device(), 0, -1);
+	intel_register_access_init(&mmio_data, intel_get_pci_device(), 0, -1);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	for (pipe = 0; pipe < num_pipes; pipe++) {
 		int num_planes = skl_num_planes(devid, pipe);
@@ -469,7 +472,8 @@ static void ilk_wm_dump(void)
 	int num_pipes = intel_gen(devid) >= 7 ? 3 : 2;
 	struct ilk_wm wm = {};
 
-	intel_register_access_init(intel_get_pci_device(), 0, -1);
+	intel_register_access_init(&mmio_data, intel_get_pci_device(), 0, -1);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	for (i = 0; i < num_pipes; i++) {
 		dspcntr[i] = read_reg(0x70180 + i * 0x1000);
@@ -505,7 +509,7 @@ static void ilk_wm_dump(void)
 	if (IS_BROADWELL(devid) || IS_HASWELL(devid))
 		wm_misc = read_reg(0x45260);
 
-	intel_register_access_fini();
+	intel_register_access_fini(&mmio_data);
 
 	for (i = 0; i < num_pipes; i++)
 		printf("    WM_PIPE_%c = 0x%08x\n", pipe_name(i), wm_pipe[i]);
@@ -619,7 +623,8 @@ static void vlv_wm_dump(void)
 	uint32_t dsp_ss_pm, ddr_setup2;
 	struct gmch_wm wms[MAX_PLANE] = {};
 
-	intel_register_access_init(intel_get_pci_device(), 0, -1);
+	intel_register_access_init(&mmio_data, intel_get_pci_device(), 0, -1);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	dsparb = read_reg(0x70030);
 	dsparb2 = read_reg(0x70060);
@@ -650,13 +655,13 @@ static void vlv_wm_dump(void)
 
 		ddl3 = read_reg(0x70058);
 
-		intel_punit_read(0x36, &dsp_ss_pm);
-		intel_punit_read(0x139, &ddr_setup2);
+		intel_punit_read(&mmio_data, 0x36, &dsp_ss_pm);
+		intel_punit_read(&mmio_data, 0x139, &ddr_setup2);
 	} else {
 		fw7 = read_reg(0x7007c);
 	}
 
-	intel_register_access_fini();
+	intel_register_access_fini(&mmio_data);
 
 	printf("        FW1 = 0x%08x\n", fw1);
 	printf("        FW2 = 0x%08x\n", fw2);
@@ -835,7 +840,8 @@ static void g4x_wm_dump(void)
 	uint32_t mi_arb_state;
 	struct gmch_wm wms[MAX_PLANE] = {};
 
-	intel_register_access_init(intel_get_pci_device(), 0, -1);
+	intel_register_access_init(&mmio_data, intel_get_pci_device(), 0, -1);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	dspacntr = read_reg(0x70180);
 	dspbcntr = read_reg(0x71180);
@@ -846,7 +852,7 @@ static void g4x_wm_dump(void)
 	mi_display_power_down = read_reg(0x20e0);
 	mi_arb_state = read_reg(0x20e4);
 
-	intel_register_access_fini();
+	intel_register_access_fini(&mmio_data);
 
 	printf("             DSPACNTR = 0x%08x\n", dspacntr);
 	printf("             DSPBCNTR = 0x%08x\n", dspbcntr);
@@ -921,7 +927,8 @@ static void gen4_wm_dump(void)
 	uint32_t mi_arb_state;
 	struct gmch_wm wms[MAX_PLANE] = {};
 
-	intel_register_access_init(intel_get_pci_device(), 0, -1);
+	intel_register_access_init(&mmio_data, intel_get_pci_device(), 0, -1);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	dsparb = read_reg(0x70030);
 	fw1 = read_reg(0x70034);
@@ -930,7 +937,7 @@ static void gen4_wm_dump(void)
 	mi_display_power_down = read_reg(0x20e0);
 	mi_arb_state = read_reg(0x20e4);
 
-	intel_register_access_fini();
+	intel_register_access_fini(&mmio_data);
 
 	printf("                  FW1 = 0x%08x\n", fw1);
 	printf("                  FW2 = 0x%08x\n", fw2);
@@ -992,7 +999,8 @@ static void pnv_wm_dump(void)
 	uint32_t cbr;
 	struct gmch_wm wms[MAX_PLANE] = {};
 
-	intel_register_access_init(intel_get_pci_device(), 0, -1);
+	intel_register_access_init(&mmio_data, intel_get_pci_device(), 0, -1);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	dsparb = read_reg(0x70030);
 	fw1 = read_reg(0x70034);
@@ -1002,7 +1010,7 @@ static void pnv_wm_dump(void)
 	mi_display_power_down = read_reg(0x20e0);
 	mi_arb_state = read_reg(0x20e4);
 
-	intel_register_access_fini();
+	intel_register_access_fini(&mmio_data);
 
 	printf("               DSPARB = 0x%08x\n", dsparb);
 	printf("                  FW1 = 0x%08x\n", fw1);
@@ -1082,7 +1090,8 @@ static void gen3_wm_dump(void)
 	uint32_t mi_arb_state;
 	struct gmch_wm wms[MAX_PLANE] = {};
 
-	intel_register_access_init(intel_get_pci_device(), 0, -1);
+	intel_register_access_init(&mmio_data, intel_get_pci_device(), 0, -1);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	dsparb = read_reg(0x70030);
 	instpm = read_reg(0x20c0);
@@ -1090,7 +1099,7 @@ static void gen3_wm_dump(void)
 	fw_blc_self = read_reg(0x20e0);
 	mi_arb_state = read_reg(0x20e4);
 
-	intel_register_access_fini();
+	intel_register_access_fini(&mmio_data);
 
 	printf("      DSPARB = 0x%08x\n", dsparb);
 	printf("      FW_BLC = 0x%016" PRIx64 "\n", fw_blc);
@@ -1151,7 +1160,8 @@ static void gen2_wm_dump(void)
 	uint32_t mi_state;
 	struct gmch_wm wms[MAX_PLANE] = {};
 
-	intel_register_access_init(intel_get_pci_device(), 0, -1);
+	intel_register_access_init(&mmio_data, intel_get_pci_device(), 0, -1);
+	igt_global_mmio = mmio_data.igt_mmio;
 
 	dsparb = read_reg(0x70030);
 	mem_mode = read_reg(0x20cc);
@@ -1159,7 +1169,7 @@ static void gen2_wm_dump(void)
 	fw_blc_self = read_reg(0x20e0);
 	mi_state = read_reg(0x20e4);
 
-	intel_register_access_fini();
+	intel_register_access_fini(&mmio_data);
 
 	printf("     DSPARB = 0x%08x\n", dsparb);
 	printf("   MEM_MODE = 0x%08x\n", mem_mode);
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#7 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for Remove global igt_global_mmio (rev5)

In reply to Daniel Mrzyglod
== Series Details ==

== Series Details ==

Series: Remove global igt_global_mmio (rev5)
URL : https://patchwork.freedesktop.org/series/59008/
State : success

== Summary ==

CI Bug Log - changes from IGT_4977 -> IGTPW_2959
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/59008/revisions/5/mbox/

Known issues
------------

Here are the changes found in IGTPW_2959 that come from known issues:

### IGT changes ###

#### Possible fixes ####

* igt@amdgpu/amd_basic@userptr:
- fi-kbl-8809g: [DMESG-WARN][1] ([fdo#108965]) -> [PASS][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/fi-kbl-8809g/igt@amdgpu/[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/fi-kbl-8809g/igt@amdgpu/[email protected]

* igt@i915_selftest@live_evict:
- fi-bsw-kefka: [DMESG-WARN][3] ([fdo#107709]) -> [PASS][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/fi-bsw-kefka/igt@i915_selftest@live_evict.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/fi-bsw-kefka/igt@i915_selftest@live_evict.html

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [FAIL][5] ([fdo#109485]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/fi-kbl-7500u/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/fi-kbl-7500u/igt@[email protected]

#### Warnings ####

* igt@i915_selftest@live_hangcheck:
- fi-apl-guc: [DMESG-FAIL][7] ([fdo#110620]) -> [INCOMPLETE][8] ([fdo#103927])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/fi-apl-guc/igt@i915_selftest@live_hangcheck.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/fi-apl-guc/igt@i915_selftest@live_hangcheck.html

* igt@runner@aborted:
- fi-apl-guc: [FAIL][9] ([fdo#110622]) -> [FAIL][10] ([fdo#110624])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/fi-apl-guc/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/fi-apl-guc/igt@[email protected]

[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#107709]: https://bugs.freedesktop.org/show_bug.cgi?id=107709
[fdo#108965]: https://bugs.freedesktop.org/show_bug.cgi?id=108965
[fdo#109485]: https://bugs.freedesktop.org/show_bug.cgi?id=109485
[fdo#110620]: https://bugs.freedesktop.org/show_bug.cgi?id=110620
[fdo#110622]: https://bugs.freedesktop.org/show_bug.cgi?id=110622
[fdo#110624]: https://bugs.freedesktop.org/show_bug.cgi?id=110624

Participating hosts (49 -> 44)
------------------------------

Additional (1): fi-icl-dsi
Missing (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-byt-clapper

Build changes
-------------

* IGT: IGT_4977 -> IGTPW_2959

CI_DRM_6072: 645586708589c3d2ac81114595e875cdfbbff385 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2959: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/
IGT_4977: 54538a37ded2bbdc775141cb0858defb22809bde @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#8 lore raw

[igt-dev] ✓ Fi.CI.IGT: success for Remove global igt_global_mmio (rev5)

In reply to Daniel Mrzyglod
== Series Details ==

== Series Details ==

Series: Remove global igt_global_mmio (rev5)
URL : https://patchwork.freedesktop.org/series/59008/
State : success

== Summary ==

CI Bug Log - changes from IGT_4977_full -> IGTPW_2959_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/59008/revisions/5/mbox/

Known issues
------------

Here are the changes found in IGTPW_2959_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@kms_cursor_crc@cursor-64x21-offscreen:
- shard-hsw: [PASS][1] -> [INCOMPLETE][2] ([fdo#103540])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-hsw1/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-hsw1/igt@[email protected]

* igt@kms_cursor_legacy@2x-long-nonblocking-modeset-vs-cursor-atomic:
- shard-glk: [PASS][3] -> [FAIL][4] ([fdo#106509] / [fdo#107409])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-glk5/igt@kms_cursor_legacy@2x-long-nonblocking-modeset-vs-cursor-atomic.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-glk4/igt@kms_cursor_legacy@2x-long-nonblocking-modeset-vs-cursor-atomic.html

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-blt:
- shard-iclb: [PASS][5] -> [FAIL][6] ([fdo#103167]) +7 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-iclb1/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-iclb2/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-shrfb-scaledprimary:
- shard-apl: [PASS][7] -> [FAIL][8] ([fdo#103167])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-apl7/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-apl7/igt@[email protected]
- shard-kbl: [PASS][9] -> [FAIL][10] ([fdo#103167])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-kbl7/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-kbl6/igt@[email protected]

* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-a-planes:
- shard-apl: [PASS][11] -> [DMESG-WARN][12] ([fdo#108566]) +2 similar issues
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-apl7/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-apl2/igt@[email protected]

* igt@kms_plane_lowres@pipe-a-tiling-y:
- shard-iclb: [PASS][13] -> [FAIL][14] ([fdo#103166])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-iclb4/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-iclb5/igt@[email protected]

* igt@kms_psr@psr2_sprite_mmap_gtt:
- shard-iclb: [PASS][15] -> [SKIP][16] ([fdo#109441])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-iclb2/igt@kms_psr@psr2_sprite_mmap_gtt.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-iclb3/igt@kms_psr@psr2_sprite_mmap_gtt.html

* igt@kms_rotation_crc@multiplane-rotation-cropping-top:
- shard-kbl: [PASS][17] -> [FAIL][18] ([fdo#109016])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-kbl7/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-kbl6/igt@[email protected]

* igt@kms_setmode@basic:
- shard-apl: [PASS][19] -> [FAIL][20] ([fdo#99912])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-apl5/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-apl2/igt@[email protected]
- shard-kbl: [PASS][21] -> [FAIL][22] ([fdo#99912])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-kbl3/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-kbl5/igt@[email protected]

#### Possible fixes ####

* igt@gem_tiled_swapping@non-threaded:
- shard-iclb: [FAIL][23] ([fdo#108686]) -> [PASS][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-iclb1/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-iclb1/igt@[email protected]

* igt@i915_suspend@fence-restore-untiled:
- shard-apl: [DMESG-WARN][25] ([fdo#108566]) -> [PASS][26] +9 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-apl2/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-apl5/igt@[email protected]

* igt@kms_cursor_crc@cursor-64x64-random:
- shard-snb: [SKIP][27] ([fdo#109271]) -> [PASS][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-snb4/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-snb1/igt@[email protected]

* igt@kms_cursor_crc@cursor-64x64-suspend:
- shard-kbl: [DMESG-WARN][29] ([fdo#108566]) -> [PASS][30]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-kbl1/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-kbl1/igt@[email protected]

* igt@kms_cursor_crc@cursor-alpha-opaque:
- shard-kbl: [FAIL][31] ([fdo#109350]) -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-kbl5/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-kbl1/igt@[email protected]
- shard-apl: [FAIL][33] ([fdo#109350]) -> [PASS][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-apl1/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-apl6/igt@[email protected]
- shard-glk: [FAIL][35] ([fdo#109350]) -> [PASS][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-glk5/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-glk2/igt@[email protected]

* igt@kms_cursor_legacy@2x-long-cursor-vs-flip-legacy:
- shard-hsw: [FAIL][37] ([fdo#105767]) -> [PASS][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-hsw1/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-hsw5/igt@[email protected]

* igt@kms_cursor_legacy@2x-long-flip-vs-cursor-atomic:
- shard-glk: [FAIL][39] ([fdo#104873]) -> [PASS][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-glk3/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-glk4/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-pri-indfb-multidraw:
- shard-iclb: [FAIL][41] ([fdo#103167]) -> [PASS][42] +1 similar issue
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-iclb7/igt@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-iclb3/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-render:
- shard-hsw: [SKIP][43] ([fdo#109271]) -> [PASS][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-hsw8/igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-render.html
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-hsw5/igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-render.html

* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-move:
- shard-glk: [FAIL][45] ([fdo#103167]) -> [PASS][46]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-glk5/igt@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-glk6/igt@[email protected]

* igt@kms_psr@psr2_sprite_blt:
- shard-iclb: [SKIP][47] ([fdo#109441]) -> [PASS][48] +3 similar issues
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-iclb4/igt@kms_psr@psr2_sprite_blt.html
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-iclb2/igt@kms_psr@psr2_sprite_blt.html

* igt@kms_sysfs_edid_timing:
- shard-iclb: [FAIL][49] ([fdo#100047]) -> [PASS][50]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-iclb2/igt@kms_sysfs_edid_timing.html
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-iclb5/igt@kms_sysfs_edid_timing.html

* igt@tools_test@tools_test:
- shard-iclb: [SKIP][51] ([fdo#109352]) -> [PASS][52]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4977/shard-iclb6/igt@tools_test@tools_test.html
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/shard-iclb3/igt@tools_test@tools_test.html

[fdo#100047]: https://bugs.freedesktop.org/show_bug.cgi?id=100047
[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
[fdo#104873]: https://bugs.freedesktop.org/show_bug.cgi?id=104873
[fdo#105767]: https://bugs.freedesktop.org/show_bug.cgi?id=105767
[fdo#106509]: https://bugs.freedesktop.org/show_bug.cgi?id=106509
[fdo#107409]: https://bugs.freedesktop.org/show_bug.cgi?id=107409
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#108686]: https://bugs.freedesktop.org/show_bug.cgi?id=108686
[fdo#109016]: https://bugs.freedesktop.org/show_bug.cgi?id=109016
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109350]: https://bugs.freedesktop.org/show_bug.cgi?id=109350
[fdo#109352]: https://bugs.freedesktop.org/show_bug.cgi?id=109352
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912

Participating hosts (7 -> 6)
------------------------------

Missing (1): shard-skl

Build changes
-------------

* IGT: IGT_4977 -> IGTPW_2959

CI_DRM_6072: 645586708589c3d2ac81114595e875cdfbbff385 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2959: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/
IGT_4977: 54538a37ded2bbdc775141cb0858defb22809bde @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2959/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev