Remove global igt_global_mmio
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 no of concurrent PCI device. In a future there will be multiple PCI devices.
Daniel Mrzyglod (2):
lib/igt_device: add igt_map_bar_region
lib/intel_mmio: Remove global igt_global_mmio
Michał Winiarski (1):
lib/igt_device: add igt_device_get_pci_addr by fd
benchmarks/gem_latency.c | 11 +- benchmarks/gem_wsim.c | 8 +- lib/igt_device.c | 158 ++++++++++++++++++++ lib/igt_device.h | 3 + lib/intel_io.h | 93 +++++++----- lib/intel_iosf.c | 82 +++++++---- lib/intel_mmio.c | 206 +++++++++++++++----------- tests/i915/gem_exec_latency.c | 10 +- tests/i915/gem_exec_parse.c | 14 +- tests/i915/i915_pm_lpsp.c | 8 +- tools/intel_audio_dump.c | 267 +++++++++++++++++----------------- tools/intel_backlight.c | 13 +- tools/intel_display_poller.c | 13 +- tools/intel_forcewaked.c | 11 +- tools/intel_gpu_time.c | 7 +- tools/intel_infoframes.c | 74 +++++----- tools/intel_l3_parity.c | 12 +- tools/intel_lid.c | 5 +- tools/intel_panel_fitter.c | 29 ++-- tools/intel_perf_counters.c | 11 +- tools/intel_reg.c | 33 +++-- tools/intel_reg_checker.c | 6 +- tools/intel_watermark.c | 37 ++--- 23 files changed, 688 insertions(+), 423 deletions(-)
Signature · 6 lines
2.20.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 1/3 lib/igt_device: add igt_device_get_pci_addr by fd
From: Michał Winiarski <[email protected]>
This function get us in easy way pci adress.
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.
--- lib/igt_device.c | 117 +++++++++++++++++++++++++++++++++++++++++++++++ lib/igt_device.h | 2 + 2 files changed, 119 insertions(+)
lib/igt_device.c +117 -0
@@ -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,117 @@ 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; + +if ((sysfs =igt_sysfs_open (fd)) ==-1 ) +return false; + + len =readlinkat (sysfs,"device/subsystem" , path,sizeof (path) -1 ); +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 ; + +if ((sysfs =igt_sysfs_open (fd)) ==-1 ) +return -ENOENT ; + + len =readlinkat (sysfs,"device" , path,sizeof (path) -1 ); +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\n" ); +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; + +igt_require (pci_dev =__igt_device_get_pci_device (fd)); + +return pci_dev; +}
lib/igt_device.h +2 -0
@@ -25,6 +25,7 @@#ifndef __IGT_DEVICE_H__#define __IGT_DEVICE_H__ +#include <stdint.h> int __igt_device_set_master (int fd);void igt_device_set_master (int fd);
@@ -32,5 +33,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
PATCH 2/3 lib/igt_device: add igt_map_bar_region
In reply to Daniel MrzyglodThis function use sysfs to map particular mmio region.
--- lib/igt_device.c | 41 +++++++++++++++++++++++++++++++++++++++++ lib/igt_device.h | 1 + 2 files changed, 42 insertions(+)
lib/igt_device.c +41 -0
@@ -220,3 +220,44 @@ 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[4096 ]; +int newfd; +void *igt_mmio =NULL ; + +if (igt_device_get_pci_addr (fd, &pci_addr)) { +igt_warn ("Unable to find device PCI address\n" ); +return NULL ; + } + +sprintf (filepath,"/sys/devices/pci%.4x\:%.2x/%.4x\:%.2x\:%.2x.%.1x/resource%.1x" , + pci_addr.domain, + pci_addr.bus, + pci_addr.domain, + pci_addr.bus, + pci_addr.device, + pci_addr.function, + mmio_bar); + + + newfd =open (filepath,O_RDWR |O_SYNC ); + igt_mmio =mmap (0 , mmio_size,PROT_READ |PROT_WRITE ,MAP_SHARED , newfd,0 ); + +igt_fail_on_f (igt_mmio ==MAP_FAILED , +"Couldn't map MMIO region\n" ); + +return igt_mmio; +}
lib/igt_device.h +1 -0
@@ -34,5 +34,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
PATCH 3/3 lib/intel_mmio: Remove global igt_global_mmio
In reply to Daniel MrzyglodIn future tests there will be multiple PCI devices run at once. It's good for them to have different mmio space.
--- benchmarks/gem_latency.c | 11 +- benchmarks/gem_wsim.c | 8 +- lib/intel_io.h | 93 +++++++----- lib/intel_iosf.c | 82 +++++++---- lib/intel_mmio.c | 206 +++++++++++++++----------- tests/i915/gem_exec_latency.c | 10 +- tests/i915/gem_exec_parse.c | 14 +- tests/i915/i915_pm_lpsp.c | 8 +- tools/intel_audio_dump.c | 267 +++++++++++++++++----------------- tools/intel_backlight.c | 13 +- tools/intel_display_poller.c | 13 +- tools/intel_forcewaked.c | 11 +- tools/intel_gpu_time.c | 7 +- tools/intel_infoframes.c | 74 +++++----- tools/intel_l3_parity.c | 12 +- tools/intel_lid.c | 5 +- tools/intel_panel_fitter.c | 29 ++-- tools/intel_perf_counters.c | 11 +- tools/intel_reg.c | 33 +++-- tools/intel_reg_checker.c | 6 +- tools/intel_watermark.c | 37 ++--- 21 files changed, 527 insertions(+), 423 deletions(-)
benchmarks/gem_latency.c +8 -3
@@ -43,6 +43,7 @@#include <sys/poll.h> #include <sys/resource.h> #include "drm.h" +#include "igt_device.h" #define LOCAL_I915_EXEC_FENCE_IN (1<<16)#define LOCAL_I915_EXEC_FENCE_OUT (1<<17)
@@ -55,9 +56,12 @@static int done;static int fd;static volatile uint32_t *timestamp_reg; +struct mmio_data igt_global_mmio; -#define REG (x) (volatile uint32_t *)((volatile char *)igt_global_mmio + x) -#define REG_OFFSET (x) ((volatile char *)(x) - (volatile char *)igt_global_mmio) +#define REG (x) \ + (volatile uint32_t *)((volatile char *)igt_global_mmio.igt_mmio + x) +#define REG_OFFSET (x) \ + ((volatile char *)(x) - (volatile char *)igt_global_mmio.igt_mmio)#if defined(__USE_XOPEN2K) && defined(gen7_safe_mmio)static pthread_spinlock_t timestamp_lock;
@@ -456,7 +460,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 (igt_device_get_pci_device (fd), false, fd, + &igt_global_mmio);if (gen ==6 ) timestamp_reg =REG (RCS_TIMESTAMP );
benchmarks/gem_wsim.c +6 -2
@@ -50,6 +50,7 @@#include "intel_io.h" #include "igt_aux.h" +#include "igt_device.h" #include "igt_rand.h" #include "igt_perf.h" #include "sw_sync.h"
@@ -57,6 +58,7 @@#include "ewma.h" +struct mmio_data igt_global_mmio;#define LOCAL_I915_EXEC_FENCE_IN (1<<16)#define LOCAL_I915_EXEC_FENCE_OUT (1<<17)
@@ -229,7 +231,8 @@ static int fd;#define SEQNO_OFFSET (engine) (SEQNO_IDX(engine) * sizeof(uint32_t))#define RCS_TIMESTAMP (0x2000 + 0x358) -#define REG (x) (volatile uint32_t *)((volatile char *)igt_global_mmio + x) +#define REG (x) \ + (volatile uint32_t *)((volatile char *)igt_global_mmio.igt_mmio + x)static const char *ring_str_map[NUM_ENGINES ] = { [RCS ] ="RCS" ,
@@ -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 (igt_device_get_pci_device (fd), false, fd, + &igt_global_mmio);if (verbose <=1 )return ;
lib/intel_io.h +57 -36
113 lines not on this page · raw message
lib/intel_iosf.c +50 -32
203 lines not on this page · raw message
lib/intel_mmio.c +118 -88
430 lines not on this page · raw message
tests/i915/gem_exec_latency.c +7 -3
@@ -41,6 +41,7 @@#include "drm.h" #include "igt_sysfs.h" +#include "igt_device.h" #include "igt_vgem.h" #include "igt_dummyload.h" #include "igt_stats.h"
@@ -61,6 +62,7 @@static unsigned int ring_size;static double rcs_clock; +struct mmio_data igt_global_mmio;static void poll_ring (int fd,unsigned ring,const char *name)
@@ -129,8 +131,9 @@ static void latency_on_ring(int fd,uint64_t offset;double gpu_latency;int i, j; +void *igt_mmio = igt_global_mmio.igt_mmio; - reg = (volatile uint32_t *)((volatile char *)igt_global_mmio +RCS_TIMESTAMP ); + reg = (volatile uint32_t *)((volatile char *)igt_mmio +RCS_TIMESTAMP );memset (&execbuf,0 ,sizeof (execbuf)); execbuf.buffers_ptr =to_user_pointer (&obj[1 ]);
@@ -645,7 +648,7 @@ static double clockrate(int i915, int reg)if (igt_ioctl (i915,DRM_IOCTL_I915_GETPARAM , &gp) ==0 )return cs_timestamp_freq; - mmio = (volatile uint32_t *)((volatile char *)igt_global_mmio + reg); + mmio = (volatile uint32_t *)((volatile char *)igt_global_mmio.igt_mmio + reg); t_start =igt_nsec_elapsed (&tv); r_start = *mmio;
@@ -666,6 +669,7 @@ igt_mainconst struct intel_execution_engine *e;int device =-1 ; + igt_fixture { device =drm_open_driver (DRIVER_INTEL );igt_require_gem (device);
@@ -680,7 +684,7 @@ igt_mainif (ring_size >1024 ) ring_size =1024 ; -intel_register_access_init (intel_get_pci_device (), false, device); +intel_register_access_init (igt_device_get_pci_device (device), false, device, &igt_global_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 +8 -6
@@ -27,7 +27,7 @@#include <stdint.h> #include <stdio.h> #include <errno.h> - +#include "igt_device.h" #include <drm.h> #ifndef I915_PARAM_CMD_PARSER_VERSION
@@ -57,6 +57,7 @@#define PIPE_CONTROL_LRI_POST_OP (1<<23)static int parser_version; +struct mmio_data igt_global_mmio;static int command_parser_version (int fd) {
@@ -284,9 +285,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 (&igt_global_mmio, test->reg, test->init_val); -igt_assert_eq_u32 ((intel_register_read (test->reg) & +igt_assert_eq_u32 ((intel_register_read (&igt_global_mmio, test->reg) & test->read_mask), test->init_val);
@@ -296,7 +297,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 (&igt_global_mmio, test->reg) & test->read_mask), expect); }
@@ -430,6 +431,7 @@ igt_mainuint32_t handle;int fd; + igt_fixture { fd =drm_open_driver (DRIVER_INTEL );igt_require_gem (fd);
@@ -530,7 +532,7 @@ igt_main#undef REG igt_fixture { -intel_register_access_init (intel_get_pci_device (),0 , fd); +intel_register_access_init (igt_device_get_pci_device (fd),0 , fd, &igt_global_mmio); }for (int i =0 ; i <ARRAY_SIZE (lris); i++) {
@@ -543,7 +545,7 @@ igt_main } igt_fixture { -intel_register_access_fini (); +intel_register_access_fini (&igt_global_mmio); } }
tests/i915/i915_pm_lpsp.c +5 -3
@@ -30,6 +30,8 @@#include <fcntl.h> #include <unistd.h> +#include "igt_device.h" +struct mmio_data igt_global_mmio;static bool supports_lpsp (uint32_t devid) {
@@ -40,7 +42,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 ); }
@@ -210,7 +212,7 @@ igt_mainigt_require (supports_lpsp (devid)); -intel_register_access_init (intel_get_pci_device (),0 , drm_fd); +intel_register_access_init (igt_device_get_pci_device (drm_fd),0 , drm_fd, &igt_global_mmio);kmstest_set_vt_graphics_mode (); }
@@ -227,7 +229,7 @@ igt_main igt_fixture {int i; -intel_register_access_fini (); +intel_register_access_fini (&igt_global_mmio);for (i =0 ; i < drm_res->count_connectors; i++)drmModeFreeConnector (drm_connectors[i]);drmModeFreeResources (drm_res);
tools/intel_audio_dump.c +134 -133
850 lines not on this page · raw message
tools/intel_backlight.c +7 -6
@@ -35,15 +35,16 @@#include "intel_reg.h" /* XXX PCH only today */ +struct mmio_data 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 (intel_get_pci_device (),-1 , &igt_global_mmio); - 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 +52,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 +7 -6
@@ -63,6 +63,7 @@ static uint16_t pipe_offset[3] = { 0, 0x1000, 0x2000, };#define PIPE_REG (pipe, reg_a) (pipe_offset[(pipe)] + (reg_a))static volatile bool quit; +struct mmio_data igt_global_mmio;static void sighandler (int x) {
@@ -71,22 +72,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)
@@ -1187,7 +1188,7 @@ int main(int argc, char *argv[])break ; } -intel_register_access_init (intel_get_pci_device (),0 ,-1 ); +intel_register_access_init (intel_get_pci_device (),0 ,-1 , &igt_global_mmio);printf ("%s?\n" ,test_name (test, pipe, bit, test_pixelcount));
@@ -1262,7 +1263,7 @@ int main(int argc, char *argv[])assert (0 ); } -intel_register_access_fini (); +intel_register_access_fini (&igt_global_mmio);if (quit)return 0 ;
tools/intel_forcewaked.c +6 -5
@@ -39,6 +39,7 @@#include "drmtest.h" bool daemonized; +struct mmio_data igt_global_mmio;#define INFO_PRINT (...) \ do { \
@@ -59,7 +60,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 (&igt_global_mmio,0x2358 ) !=0 ); }int main (int argc,char *argv[])
@@ -80,7 +81,7 @@ 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 (intel_get_pci_device (),1 ,-1 , &igt_global_mmio);if (ret) {INFO_PRINT ("Couldn't init register access\n" );exit (1 );
@@ -90,14 +91,14 @@ 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 (&igt_global_mmio); + ret =intel_register_access_init (intel_get_pci_device (),1 ,-1 , &igt_global_mmio);if (ret)INFO_PRINT ("Reg access init fail\n" ); }sleep (1 ); } -intel_register_access_fini (); +intel_register_access_fini (&igt_global_mmio);INFO_PRINT ("Forcewake unlock\n" );if (daemonized) {
tools/intel_gpu_time.c +4 -3
@@ -41,6 +41,7 @@#define SAMPLES_PER_SEC 10000static volatile int goddo; +struct mmio_data igt_global_mmio;static pid_t spawn (char **argv) {
@@ -67,7 +68,7 @@ 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 (intel_get_pci_device (),-1 , &igt_global_mmio);if (argc ==1 ) {fprintf (stderr,"usage: %s cmd [args...]\n" , argv[0 ]);
@@ -86,8 +87,8 @@ 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 +38 -36
228 lines not on this page · raw message
tools/intel_l3_parity.c +7 -5
@@ -37,6 +37,7 @@#include "intel_chipset.h" #include "intel_io.h" #include "igt_sysfs.h" +#include "igt_device.h" #include "drmtest.h" #include "config.h" #include <libudev.h>
@@ -53,6 +54,7 @@ static inline int num_banks(void) {default :return 2 ; } } +struct mmio_data igt_global_mmio;#define NUM_SUBBANKS 8#define BYTES_PER_BANK (128 << 10)/* Each row addresses [up to] 4b. This multiplied by the number of subbanks
@@ -189,7 +191,7 @@ 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 (igt_device_get_pci_device (device),0 , device, &igt_global_mmio) ==0 ); dir =igt_sysfs_open (device);
@@ -211,7 +213,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 (&igt_global_mmio,0xb038 );while (1 ) {int c, option_index =0 ;
@@ -357,10 +359,10 @@ 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 (&igt_global_mmio,0xb038 , dft);break ;case 'u' : -intel_register_write (0xb038 , dft & ~(1 <<0 )); +intel_register_write (&igt_global_mmio,0xb038 , dft & ~(1 <<0 ));break ;case 'L' :break ;
@@ -369,7 +371,7 @@ int main(int argc, char *argv[]) } } -intel_register_access_fini (); +intel_register_access_fini (&igt_global_mmio);if (action =='l' )exit (EXIT_SUCCESS );
tools/intel_lid.c +3 -2
@@ -51,6 +51,7 @@ enum lid_status {#define ACPI_BUTTON "/proc/acpi/button/"#define ACPI_LID "/proc/acpi/button/lid/" +struct mmio_data igt_global_mmio;static int i830_lvds_acpi_lid_state (void ) {
@@ -119,10 +120,10 @@ int main(int argc, char **argv) {int swf14, acpi_lid; -intel_mmio_use_pci_bar (intel_get_pci_device ()); +intel_mmio_use_pci_bar (intel_get_pci_device (),-1 , &igt_global_mmio);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 +15 -14
@@ -36,6 +36,7 @@#include "drmtest.h" int gen; +struct mmio_data igt_global_mmio;uint32_t HTOTAL [] = {0x60000 ,0x61000 ,0x62000 };uint32_t VTOTAL [] = {0x6000C ,0x6100C ,0x6200C };
@@ -84,12 +85,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 +233,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 ; }
@@ -280,7 +281,7 @@ 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 (pci_dev,0 ,-1 , &igt_global_mmio); devid = pci_dev->device_id;if (!HAS_PCH_SPLIT (devid)) {
@@ -342,6 +343,6 @@ int main (int argc, char *argv[]) } out: -intel_register_access_fini (); +intel_register_access_fini (&igt_global_mmio);return ret; }
tools/intel_perf_counters.c +7 -4
@@ -45,6 +45,7 @@#include "drm.h" #include "i915_drm.h" #include "drmtest.h" +#include "igt_device.h" #include "intel_io.h" #include "intel_bufmgr.h" #include "intel_batchbuffer.h"
@@ -323,6 +324,8 @@ struct intel_batchbuffer *batch;# define OACONTROL_COUNTER_SELECT_SHIFT 2# define PERFORMANCE_COUNTER_ENABLE (1 << 0) +struct mmio_data igt_global_mmio; +static void gen5_get_counters (void ) {
@@ -483,10 +486,10 @@ main(int argc, char **argv)if (oacontrol) {/* Forcewake */ -intel_register_access_init (intel_get_pci_device (),0 , fd); +intel_register_access_init (igt_device_get_pci_device (fd),0 , fd, &igt_global_mmio);/* Enable performance counters */ -intel_register_write (OACONTROL , +intel_register_write (&igt_global_mmio,OACONTROL , counter_format <<OACONTROL_COUNTER_SELECT_SHIFT |PERFORMANCE_COUNTER_ENABLE ); }
@@ -520,10 +523,10 @@ main(int argc, char **argv)if (oacontrol) {/* Disable performance counters */ -intel_register_write (OACONTROL ,0 ); +intel_register_write (&igt_global_mmio,OACONTROL ,0 );/* Forcewake */ -intel_register_access_fini (); +intel_register_access_fini (&igt_global_mmio); }free (totals);
tools/intel_reg.c +17 -16
@@ -39,6 +39,7 @@#include "intel_reg_spec.h" +struct mmio_data igt_global_mmio;#ifdef HAVE_SYS_IO_H #include <sys/io.h>
@@ -364,7 +365,7 @@ 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 :
@@ -389,7 +390,7 @@ 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 (&igt_global_mmio, reg->port_desc.port, reg->addr);break ;default :fprintf (stderr,"port %d not supported\n" , reg->port_desc.port);
@@ -424,7 +425,7 @@ 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 +444,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 :
@@ -460,7 +461,7 @@ 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 (&igt_global_mmio, reg->port_desc.port, reg->addr, val);break ;default :fprintf (stderr,"port %d not supported\n" , reg->port_desc.port);
@@ -554,9 +555,9 @@ 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 (&igt_global_mmio, config->mmiofile);else -intel_register_access_init (config->pci_dev,0 ,-1 ); +intel_register_access_init (config->pci_dev,0 , config->fd, &igt_global_mmio);for (i =1 ; i < argc; i++) {struct reg reg;
@@ -572,7 +573,7 @@ static int intel_reg_read(struct config *config, int argc, char *argv[]) } } -intel_register_access_fini (); +intel_register_access_fini (&igt_global_mmio);return EXIT_SUCCESS ; }
@@ -586,7 +587,7 @@ 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 (config->pci_dev,0 , config->fd, &igt_global_mmio);for (i =1 ; i < argc; i +=2 ) {struct reg reg;
@@ -611,7 +612,7 @@ static int intel_reg_write(struct config *config, int argc, char *argv[])write_register (config, ®, val); } -intel_register_access_fini (); +intel_register_access_fini (&igt_global_mmio);return EXIT_SUCCESS ; }
@@ -622,9 +623,9 @@ 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 (&igt_global_mmio, config->mmiofile);else -intel_register_access_init (config->pci_dev,0 ,-1 ); +intel_register_access_init (config->pci_dev,0 , config->fd, &igt_global_mmio);for (i =0 ; i < config->regcount; i++) { reg = &config->regs[i];
@@ -636,7 +637,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 (&igt_global_mmio);return EXIT_SUCCESS ; }
@@ -650,10 +651,10 @@ 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 (config->pci_dev, config->fd, &igt_global_mmio);/* XXX: error handling */ -if (write (1 , igt_global_mmio, config->pci_dev->regions[mmio_bar].size) ==-1 ) +if (write (1 , igt_global_mmio.igt_mmio, config->pci_dev->regions[mmio_bar].size) ==-1 )fprintf (stderr,"Error writing snapshot: %s" ,strerror (errno));if (config->verbosity >0 )
tools/intel_reg_checker.c +4 -2
@@ -26,16 +26,18 @@#include <err.h> #include <string.h> #include <stdbool.h> +#include "igt_device.h" #include "intel_io.h" #include "intel_chipset.h" static uint32_t devid;static int gen; +struct mmio_data igt_global_mmio;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);
@@ -345,7 +347,7 @@ 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 (dev,-1 , &igt_global_mmio);if (IS_GEN7 (devid)) gen =7 ;
tools/intel_watermark.c +19 -18
@@ -35,10 +35,11 @@static uint32_t display_base;static uint32_t devid; +struct mmio_data igt_global_mmio;static uint32_t read_reg (uint32_t addr) { -return INREG (display_base + addr); +return INREG (&igt_global_mmio, display_base + addr); }struct gmch_wm {
@@ -249,7 +250,7 @@ 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 (intel_get_pci_device (),0 ,-1 , &igt_global_mmio);for (pipe =0 ; pipe < num_pipes; pipe++) {int num_planes =skl_num_planes (devid, pipe);
@@ -469,7 +470,7 @@ 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 (intel_get_pci_device (),0 ,-1 , &igt_global_mmio);for (i =0 ; i < num_pipes; i++) { dspcntr[i] =read_reg (0x70180 + i *0x1000 );
@@ -505,7 +506,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 (&igt_global_mmio);for (i =0 ; i < num_pipes; i++)printf (" WM_PIPE_%c = 0x%08x\n" ,pipe_name (i), wm_pipe[i]);
@@ -619,7 +620,7 @@ 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 (intel_get_pci_device (),0 ,-1 , &igt_global_mmio); dsparb =read_reg (0x70030 ); dsparb2 =read_reg (0x70060 );
@@ -650,13 +651,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 (&igt_global_mmio,0x36 , &dsp_ss_pm); +intel_punit_read (&igt_global_mmio,0x139 , &ddr_setup2); }else { fw7 =read_reg (0x7007c ); } -intel_register_access_fini (); +intel_register_access_fini (&igt_global_mmio);printf (" FW1 = 0x%08x\n" , fw1);printf (" FW2 = 0x%08x\n" , fw2);
@@ -835,7 +836,7 @@ 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 (intel_get_pci_device (),0 ,-1 , &igt_global_mmio); dspacntr =read_reg (0x70180 ); dspbcntr =read_reg (0x71180 );
@@ -846,7 +847,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 (&igt_global_mmio);printf (" DSPACNTR = 0x%08x\n" , dspacntr);printf (" DSPBCNTR = 0x%08x\n" , dspbcntr);
@@ -921,7 +922,7 @@ 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 (intel_get_pci_device (),0 ,-1 , &igt_global_mmio); dsparb =read_reg (0x70030 ); fw1 =read_reg (0x70034 );
@@ -930,7 +931,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 (&igt_global_mmio);printf (" FW1 = 0x%08x\n" , fw1);printf (" FW2 = 0x%08x\n" , fw2);
@@ -992,7 +993,7 @@ 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 (intel_get_pci_device (),0 ,-1 , &igt_global_mmio); dsparb =read_reg (0x70030 ); fw1 =read_reg (0x70034 );
@@ -1002,7 +1003,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 (&igt_global_mmio);printf (" DSPARB = 0x%08x\n" , dsparb);printf (" FW1 = 0x%08x\n" , fw1);
@@ -1082,7 +1083,7 @@ 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 (intel_get_pci_device (),0 ,-1 , &igt_global_mmio); dsparb =read_reg (0x70030 ); instpm =read_reg (0x20c0 );
@@ -1090,7 +1091,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 (&igt_global_mmio);printf (" DSPARB = 0x%08x\n" , dsparb);printf (" FW_BLC = 0x%016" PRIx64"\n" , fw_blc);
@@ -1151,7 +1152,7 @@ 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 (intel_get_pci_device (),0 ,-1 , &igt_global_mmio); dsparb =read_reg (0x70030 ); mem_mode =read_reg (0x20cc );
@@ -1159,7 +1160,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 (&igt_global_mmio);printf (" DSPARB = 0x%08x\n" , dsparb);printf (" MEM_MODE = 0x%08x\n" , mem_mode);
Signature · 6 lines
2.20.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 2/3] lib/igt_device: add igt_map_bar_region
In reply to Daniel MrzyglodQuoting Daniel Mrzyglod (2019-04-04 14:18:04)
Quoted 30 lines
This function use sysfs to map particular mmio region.
Signed-off-by Daniel Mrzyglod <[email protected]>--- lib/igt_device.c | 41 +++++++++++++++++++++++++++++++++++++++++ lib/igt_device.h | 1 + 2 files changed, 42 insertions(+)lib/igt_device.c +14
-0@@ -220,3 +220,44 @@ 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;
lib/igt_device.c struct pci_device *igt_device_get_pci_device(int fd) · line 246
Quoted 10 lines
lib/igt_device.c +10
-0+char filepath[4096 ]; +int newfd; +void *igt_mmio =NULL ; + +if (igt_device_get_pci_addr (fd, &pci_addr)) { +igt_warn ("Unable to find device PCI address\n" ); +return NULL ; + } + + sprintf(filepath, "/sys/devices/pci%.4x\:%.2x/%.4x\:%.2x\:%.2x.%.1x/resource%.1x",
Might as well use asprintf rather than a [4096]
Certainly snprintf is good habit (if irrelevant here).
lib/igt_device.c struct pci_device *igt_device_get_pci_device(int fd) · line 255
Quoted 10 lines
lib/igt_device.c +9
-0+ pci_addr.domain, + pci_addr.bus, + pci_addr.domain, + pci_addr.bus, + pci_addr.device, + pci_addr.function, + mmio_bar); + +
Bonus
.
lib/igt_device.c struct pci_device *igt_device_get_pci_device(int fd) · line 257
Quoted 2 lines
lib/igt_device.c +2
-0+ newfd =open (filepath,O_RDWR |O_SYNC ); + igt_mmio =mmap (0 , mmio_size,PROT_READ |PROT_WRITE ,MAP_SHARED , newfd,0 );
Leaking newfd for fun and profit?
lib/igt_device.c struct pci_device *igt_device_get_pci_device(int fd) · line 263
Quoted 6 lines
lib/igt_device.c +6
-0+ +igt_fail_on_f (igt_mmio ==MAP_FAILED , +"Couldn't map MMIO region\n" ); + +return igt_mmio; +}
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 1/3] lib/igt_device: add igt_device_get_pci_addr by fd
In reply to Daniel MrzyglodQuoted 3 lines · Daniel Mrzyglod
From: Michał Winiarski <[email protected]>
This function get us in easy way pci adress.
s/adress/address/
Quoted 36 lines
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.Signed-off-by Michał Winiarski <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Daniel Mrzyglod <[email protected]>--- lib/igt_device.c | 117 +++++++++++++++++++++++++++++++++++++++++++++++ lib/igt_device.h | 2 + 2 files changed, 119 insertions(+)lib/igt_device.c +5
-0@@ -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,117 @@ int igt_device_get_card_index(int fd)return minor (st.st_rdev); } + +#define IGT_DEV_PATH_LEN 80
lib/igt_device.c int igt_device_get_card_index(int fd) · line 120
Quoted 10 lines
lib/igt_device.c +10
-0+ +static bool igt_device_is_pci (int fd) +{ +char path[IGT_DEV_PATH_LEN ]; +char *subsystem; +int sysfs; +int len; + +if ((sysfs =igt_sysfs_open (fd)) ==-1 ) +return false;
Even checkpatch is returning error here - 'do not use assignment in if condition'
Quoted 22 lines
lib/igt_device.c +22
-0+ + len =readlinkat (sysfs,"device/subsystem" , path,sizeof (path) -1 ); +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) +{
lib/igt_device.c int igt_device_get_card_index(int fd) · line 152
Quoted 10 lines
lib/igt_device.c +10
-0+char path[IGT_DEV_PATH_LEN ]; +char *buf; +int sysfs; +int len; + +if (!igt_device_is_pci (fd)) +return -ENODEV ; + +if ((sysfs =igt_sysfs_open (fd)) ==-1 ) +return -ENOENT ;
Same error from checkpatch as above.
Kasia
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 2/3] lib/igt_device: add igt_map_bar_region
In reply to Daniel MrzyglodQuoted 1 line · Daniel Mrzyglod
This function use sysfs to map particular mmio region.
s/use/uses/
Quoted 20 lines
Signed-off-by Daniel Mrzyglod <[email protected]>--- lib/igt_device.c | 41 +++++++++++++++++++++++++++++++++++++++++ lib/igt_device.h | 1 + 2 files changed, 42 insertions(+)lib/igt_device.c +5
-0@@ -220,3 +220,44 @@ struct pci_device *igt_device_get_pci_device(int fd)return pci_dev; } + +/** +* igt_device_map_pci_bar_region: +* +* @fd: the device
lib/igt_device.c struct pci_device *igt_device_get_pci_device(int fd) · line 237
Quoted 10 lines
lib/igt_device.c +10
-0+* @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[4096 ];
It would be better to have some variable here instead of 'magic' number.
lib/igt_device.c struct pci_device *igt_device_get_pci_device(int fd) · line 246
Quoted 9 lines
lib/igt_device.c +9
-0+int newfd; +void *igt_mmio =NULL ; + +if (igt_device_get_pci_addr (fd, &pci_addr)) { +igt_warn ("Unable to find device PCI address\n" ); +return NULL ; + } + + sprintf(filepath, "/sys/devices/pci%.4x\:%.2x/%.4x\:%.2x\:%.2x.%.1x/resource%.1x",
Even without warning from compiler this sprintf looks buggy. Is there any way we can to it in a way to be sure it can be less error prone?
Quoted 5 lines
lib/igt_device.c +5
-0+ pci_addr.domain, + pci_addr.bus, + pci_addr.domain, + pci_addr.bus, + pci_addr.device,
lib/igt_device.c struct pci_device *igt_device_get_pci_device(int fd) · line 261
Quoted 10 lines
lib/igt_device.c +10
-0+ pci_addr.function, + mmio_bar); + + + newfd =open (filepath,O_RDWR |O_SYNC ); + igt_mmio =mmap (0 , mmio_size,PROT_READ |PROT_WRITE ,MAP_SHARED , newfd,0 ); + +igt_fail_on_f (igt_mmio ==MAP_FAILED , +"Couldn't map MMIO region\n" ); +
You're not closing fd on function end.
Kasia
Quoted 20 lines
lib/igt_device.c +2
-0+return igt_mmio; +}lib/igt_device.h +1
-0@@ -34,5 +34,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
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 3/3] lib/intel_mmio: Remove global igt_global_mmio
In reply to Daniel MrzyglodQuoted 229 lines · Daniel Mrzyglod
In future tests there will be multiple PCI devices run at once. It's good for them to have different mmio space.
Signed-off-by Daniel Mrzyglod <[email protected]>--- benchmarks/gem_latency.c | 11 +- benchmarks/gem_wsim.c | 8 +- lib/intel_io.h | 93 +++++++----- lib/intel_iosf.c | 82 +++++++---- lib/intel_mmio.c | 206 +++++++++++++++----------- tests/i915/gem_exec_latency.c | 10 +- tests/i915/gem_exec_parse.c | 14 +- tests/i915/i915_pm_lpsp.c | 8 +- tools/intel_audio_dump.c | 267 +++++++++++++++++----------------- tools/intel_backlight.c | 13 +- tools/intel_display_poller.c | 13 +- tools/intel_forcewaked.c | 11 +- tools/intel_gpu_time.c | 7 +- tools/intel_infoframes.c | 74 +++++----- tools/intel_l3_parity.c | 12 +- tools/intel_lid.c | 5 +- tools/intel_panel_fitter.c | 29 ++-- tools/intel_perf_counters.c | 11 +- tools/intel_reg.c | 33 +++-- tools/intel_reg_checker.c | 6 +- tools/intel_watermark.c | 37 ++--- 21 files changed, 527 insertions(+), 423 deletions(-)benchmarks/gem_latency.c +8
-3@@ -43,6 +43,7 @@#include <sys/poll.h> #include <sys/resource.h> #include "drm.h" +#include "igt_device.h" #define LOCAL_I915_EXEC_FENCE_IN (1<<16)#define LOCAL_I915_EXEC_FENCE_OUT (1<<17)@@ -55,9 +56,12 @@static int done;static int fd;static volatile uint32_t *timestamp_reg; +struct mmio_data igt_global_mmio; -#define REG (x) (volatile uint32_t *)((volatile char *)igt_global_mmio + x) -#define REG_OFFSET (x) ((volatile char *)(x) - (volatile char *)igt_global_mmio) +#define REG (x) \ + (volatile uint32_t *)((volatile char *)igt_global_mmio.igt_mmio + x) +#define REG_OFFSET (x) \ + ((volatile char *)(x) - (volatile char *)igt_global_mmio.igt_mmio)#if defined(__USE_XOPEN2K) && defined(gen7_safe_mmio)static pthread_spinlock_t timestamp_lock;@@ -456,7 +460,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 (igt_device_get_pci_device (fd), false, fd, + &igt_global_mmio);if (gen ==6 ) timestamp_reg =REG (RCS_TIMESTAMP );benchmarks/gem_wsim.c +6
-2@@ -50,6 +50,7 @@#include "intel_io.h" #include "igt_aux.h" +#include "igt_device.h" #include "igt_rand.h" #include "igt_perf.h" #include "sw_sync.h" @@ -57,6 +58,7 @@#include "ewma.h" +struct mmio_data igt_global_mmio;#define LOCAL_I915_EXEC_FENCE_IN (1<<16)#define LOCAL_I915_EXEC_FENCE_OUT (1<<17)@@ -229,7 +231,8 @@ static int fd;#define SEQNO_OFFSET (engine) (SEQNO_IDX(engine) * sizeof(uint32_t))#define RCS_TIMESTAMP (0x2000 + 0x358) -#define REG (x) (volatile uint32_t *)((volatile char *)igt_global_mmio + x) +#define REG (x) \ + (volatile uint32_t *)((volatile char *)igt_global_mmio.igt_mmio + x)static const char *ring_str_map[NUM_ENGINES ] = { [RCS ] ="RCS" ,@@ -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 (igt_device_get_pci_device (fd), false, fd, + &igt_global_mmio);if (verbose <=1 )return ;lib/intel_io.h +57
-36@@ -30,37 +30,67 @@#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); -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 ); +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; +}; -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); +void intel_mmio_use_pci_bar (struct pci_device *pci_dev,int fd, +struct mmio_data *mmio_data); +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, +struct mmio_data *mmio_data); +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 (struct mmio_data *mmio_data,uint32_t reg); +uint16_t INREG16 (struct mmio_data *mmio_data,uint32_t reg); +uint8_t INREG8 (struct mmio_data *mmio_data,uint32_t reg); +void OUTREG (struct mmio_data *mmio_data,uint32_t reg,uint32_t val); +void OUTREG16 (struct mmio_data *mmio_data,uint32_t reg,uint16_t val); +void OUTREG8 (struct mmio_data *mmio_data,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,19 +101,10 @@ 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; -};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); +struct intel_register_range *intel_get_register_range (struct intel_register_map + map,uint32_t offset, +uint32_t mode);#endif /* __GTK_DOC_IGNORE__ */ #endif /* INTEL_GPU_TOOLS_H */ lib/intel_iosf.c +0
-0
lib/intel_iosf.c line 23
Quoted 7 lines
lib/intel_iosf.c +2
-2@@ -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)
As I undestand VLV is quite an old gen, do we need to add mmio_data here? Or not adding it breaks some compatibility?
nit: patch is almost 3000 lines of different changes, please divide it in smaller chunks. It is hard to read so large changes and yet we need to understand what is going on :/
Kasia
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✓ Fi.CI.BAT: success for Remove global igt_global_mmio
In reply to Daniel Mrzyglod== Series Details ==
== Series Details ==
Series: Remove global igt_global_mmio
URL : https://patchwork.freedesktop.org/series/59008/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_5870 -> IGTPW_2789
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/59008/revisions/1/mbox/
Known issues
------------
Here are the changes found in IGTPW_2789 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@i915_selftest@live_uncore:
- fi-skl-gvtdvm: PASS -> DMESG-FAIL [fdo#110210]
#### Possible fixes ####
* igt@debugfs_test@read_all_entries:
- fi-ilk-650: DMESG-WARN [fdo#106387] -> PASS
- {fi-kbl-7567u}: DMESG-WARN [fdo#103558] / [fdo#105602] -> PASS
* igt@gem_exec_suspend@basic-s3:
- {fi-kbl-7567u}: DMESG-WARN [fdo#103558] / [fdo#105079] / [fdo#105602] -> PASS
* igt@i915_module_load@reload-with-fault-injection:
- {fi-kbl-7567u}: DMESG-WARN [fdo#105602] / [fdo#108529] -> PASS +1
* igt@i915_pm_rpm@module-reload:
- {fi-kbl-7567u}: DMESG-WARN [fdo#108529] -> PASS
* igt@kms_busy@basic-flip-a:
- {fi-kbl-7567u}: SKIP [fdo#109271] / [fdo#109278] -> PASS +2
* igt@kms_chamelium@hdmi-edid-read:
- {fi-kbl-7567u}: FAIL [fdo#109569] -> PASS +1
* igt@kms_chamelium@hdmi-hpd-fast:
- {fi-kbl-7567u}: FAIL [fdo#109800] -> PASS
* igt@kms_frontbuffer_tracking@basic:
- fi-byt-clapper: FAIL [fdo#103167] -> PASS
* igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a:
- fi-byt-clapper: FAIL [fdo#107362] -> PASS
* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- {fi-kbl-7567u}: DMESG-FAIL [fdo#105079] -> PASS
* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
- fi-byt-clapper: FAIL [fdo#103191] / [fdo#107362] -> PASS +1
* igt@prime_vgem@basic-fence-flip:
- {fi-kbl-7567u}: SKIP [fdo#109271] -> PASS +4
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#103558]: https://bugs.freedesktop.org/show_bug.cgi?id=103558
[fdo#105079]: https://bugs.freedesktop.org/show_bug.cgi?id=105079
[fdo#105602]: https://bugs.freedesktop.org/show_bug.cgi?id=105602
[fdo#106387]: https://bugs.freedesktop.org/show_bug.cgi?id=106387
[fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
[fdo#108529]: https://bugs.freedesktop.org/show_bug.cgi?id=108529
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109569]: https://bugs.freedesktop.org/show_bug.cgi?id=109569
[fdo#109800]: https://bugs.freedesktop.org/show_bug.cgi?id=109800
[fdo#110210]: https://bugs.freedesktop.org/show_bug.cgi?id=110210
Participating hosts (50 -> 44)
------------------------------
Missing (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-icl-y
Build changes
-------------
* IGT: IGT_4928 -> IGTPW_2789
CI_DRM_5870: 122dc43df57c9a03132314ddc78a6d60c714fa32 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2789: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2789/
IGT_4928: 014a6fa238322b497116b359cb92df1ce7fa8847 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2789/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 3/3] lib/intel_mmio: Remove global igt_global_mmio
In reply to Katarzyna DecQuoted 6 lines · Katarzyna Dec
Quoted 5 lines · Daniel Mrzyglod
In future tests there will be multiple PCI devices run at once. It's good for them to have different mmio space.
Signed-off-by Daniel Mrzyglod <[email protected]>---
<CUT>
Quoted 19 lines
Quoted 5 lines
lib/intel_iosf.c +0
-0lib/intel_iosf.c line 26
Quoted 10 lines
lib/intel_iosf.c +2
-2@@ -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)As I undestand VLV is quite an old gen, do we need to add
mmio_datahere? Or not
adding it breaks some compatibility?
Quoted 6 lines
nit: patch is almost 3000 lines of different changes, please divide it in
smaller chunks. It is hard to read so large changes and yet we need to
understand what is going on :/
Kasia
The problem is that igt_global_mmio is using by VLV also and almost all functions in intel_io.h
Design that was chosen was perfect for single device for now there are many challenges for us and that there will be in many future scenarios:
- For example we will run competition card and ours - run some scenari
os
- Run our integrated and our future PCI card
- Put few different models PCI cards to limit CI cost.
- other more real scenarios
When I moved igt_global_mmio there was a need to update everything that was using that global pointer.
There were few Tools that required more changes that were using INREG/OUTREG directly.... i think intel_audio.c was a leader in diff :>
It's used by tools/tests/benchmarks others... but if i divide this patch it will probably not compile... so it will not meet acceptance criteria.
There is a need for v2 so i will try to adress those problems.
Daniel
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✗ Fi.CI.IGT: failure for Remove global igt_global_mmio
In reply to Daniel Mrzyglod== Series Details ==
== Series Details ==
Series: Remove global igt_global_mmio
URL : https://patchwork.freedesktop.org/series/59008/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_5870_full -> IGTPW_2789_full
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with IGTPW_2789_full absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in IGTPW_2789_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://patchwork.freedesktop.org/api/1.0/series/59008/revisions/1/mbox/
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_2789_full:
### IGT changes ###
#### Possible regressions ####
* igt@i915_pm_rpm@gem-execbuf:
- shard-glk: PASS -> DMESG-WARN
Known issues
------------
Here are the changes found in IGTPW_2789_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@kms_atomic_transition@4x-modeset-transitions:
- shard-apl: NOTRUN -> SKIP [fdo#109271] / [fdo#109278]
* igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-a:
- shard-kbl: PASS -> DMESG-WARN [fdo#110222]
* igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-c:
- shard-hsw: PASS -> DMESG-WARN [fdo#110222] +1
* igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-b:
- shard-snb: PASS -> DMESG-WARN [fdo#110222]
* igt@kms_content_protection@atomic:
- shard-apl: NOTRUN -> FAIL [fdo#108739] / [fdo#110321]
* igt@kms_cursor_legacy@2x-long-cursor-vs-flip-atomic:
- shard-hsw: PASS -> FAIL [fdo#105767]
* igt@kms_frontbuffer_tracking@fbcpsr-1p-indfb-fliptrack:
- shard-apl: NOTRUN -> SKIP [fdo#109271] +6
* igt@kms_frontbuffer_tracking@psr-2p-primscrn-cur-indfb-draw-blt:
- shard-glk: NOTRUN -> SKIP [fdo#109271]
* igt@kms_plane_scaling@pipe-b-scaler-with-rotation:
- shard-glk: PASS -> SKIP [fdo#109271] / [fdo#109278]
* igt@kms_rotation_crc@multiplane-rotation:
- shard-kbl: PASS -> FAIL [fdo#109016]
* igt@kms_rotation_crc@multiplane-rotation-cropping-bottom:
- shard-kbl: PASS -> DMESG-FAIL [fdo#105763]
* igt@kms_setmode@basic:
- shard-kbl: PASS -> FAIL [fdo#99912]
* igt@kms_vblank@pipe-b-ts-continuation-modeset:
- shard-kbl: PASS -> FAIL [fdo#104894]
- shard-apl: PASS -> FAIL [fdo#104894]
#### Possible fixes ####
* igt@kms_cursor_edge_walk@pipe-a-64x64-left-edge:
- shard-snb: SKIP [fdo#109271] / [fdo#109278] -> PASS
* igt@kms_flip@modeset-vs-vblank-race:
- shard-kbl: FAIL [fdo#103060] -> PASS
* igt@kms_pipe_crc_basic@read-crc-pipe-b-frame-sequence:
- shard-snb: SKIP [fdo#109271] -> PASS +2
* igt@kms_setmode@basic:
- shard-apl: FAIL [fdo#99912] -> PASS
* igt@kms_vblank@pipe-c-ts-continuation-modeset:
- shard-kbl: FAIL [fdo#104894] -> PASS
- shard-apl: FAIL [fdo#104894] -> PASS
#### Warnings ####
* igt@kms_lease@atomic_implicit_crtc:
- shard-snb: SKIP [fdo#109271] -> FAIL [fdo#110279]
* igt@runner@aborted:
- shard-glk: FAIL [fdo#109373] / [k.org#202321] -> ( 2 FAIL ) [fdo#109373] / [k.org#202321]
[fdo#103060]: https://bugs.freedesktop.org/show_bug.cgi?id=103060
[fdo#104894]: https://bugs.freedesktop.org/show_bug.cgi?id=104894
[fdo#105763]: https://bugs.freedesktop.org/show_bug.cgi?id=105763
[fdo#105767]: https://bugs.freedesktop.org/show_bug.cgi?id=105767
[fdo#108739]: https://bugs.freedesktop.org/show_bug.cgi?id=108739
[fdo#109016]: https://bugs.freedesktop.org/show_bug.cgi?id=109016
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109373]: https://bugs.freedesktop.org/show_bug.cgi?id=109373
[fdo#110222]: https://bugs.freedesktop.org/show_bug.cgi?id=110222
[fdo#110279]: https://bugs.freedesktop.org/show_bug.cgi?id=110279
[fdo#110321]: https://bugs.freedesktop.org/show_bug.cgi?id=110321
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912
[k.org#202321]: https://bugzilla.kernel.org/show_bug.cgi?id=202321
Participating hosts (9 -> 5)
------------------------------
Missing (4): pig-skl-6260u shard-skl pig-glk-j5005 shard-iclb
Build changes
-------------
* IGT: IGT_4928 -> IGTPW_2789
* Piglit: piglit_4509 -> None
CI_DRM_5870: 122dc43df57c9a03132314ddc78a6d60c714fa32 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2789: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2789/
IGT_4928: 014a6fa238322b497116b359cb92df1ce7fa8847 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2789/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 3/3] lib/intel_mmio: Remove global igt_global_mmio
In reply to Mrzyglod, Daniel TQuoted 51 lines · Daniel T
Quoted 6 lines · Katarzyna Dec
Quoted 5 lines · Daniel Mrzyglod
In future tests there will be multiple PCI devices run at once. It's good for them to have different mmio space.
Signed-off-by Daniel Mrzyglod <[email protected]>---
<CUT>
Quoted 19 lines
Quoted 5 lines
lib/intel_iosf.c +0
-0lib/intel_iosf.c line 26
Quoted 10 lines
lib/intel_iosf.c +2
-2@@ -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)As I undestand VLV is quite an old gen, do we need to add
mmio_datahere? Or not
adding it breaks some compatibility?Quoted 6 lines
nit: patch is almost 3000 lines of different changes, please divide it in
smaller chunks. It is hard to read so large changes and yet we need to
understand what is going on :/
KasiaThe problem is that
igt_global_mmiois using by VLV also and almost all functions inintel_io.hDesign that was chosen was perfect for single device for now there are many challenges for us and that there will be in many future scenarios:
- For example we will run competition card and ours - run some scenari
os
- Run our integrated and our future PCI card
- Put few different models PCI cards to limit CI cost.
- other more real scenariosWhen I moved
igt_global_mmiothere was a need to update everything that was using that global pointer.There were few Tools that required more changes that were using INREG/OUTREG directly.... i think
intel_audio.cwas a leader in diff :>
Quoted 7 lines
It's used by
tools/tests/benchmarksothers... but if i divide this patch it will probably not compile... so it will not meet acceptance criteria.There is a need for v2 so i will try to adress those problems.
Daniel
Maybe you can have 1 patch that is adding new functionality, few another with appling the changes and last one that is removing old one? With this approach everything should compile. And will be more review friendly. Change is quite big and it would be nice to have a decent review to avoid implementing bugs.
Kasia
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 1/3] lib/igt_device: add igt_device_get_pci_addr by fd
In reply to Katarzyna DecQuoted 37 lines · Katarzyna Dec
Quoted 3 lines · Daniel Mrzyglod
From: Michał Winiarski <[email protected]>
This function get us in easy way pci adress.
s/adress/address/
Quoted 32 lines
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.Signed-off-by Michał Winiarski <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Daniel Mrzyglod <[email protected]>--- lib/igt_device.c | 117 +++++++++++++++++++++++++++++++++++++++++++++++ lib/igt_device.h | 2 + 2 files changed, 119 insertions(+)lib/igt_device.c +3
-0@@ -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,117 @@ int igt_device_get_card_index(int fd)
Quoted 16 lines
Quoted 4 lines
lib/igt_device.c +2
-0return minor (st.st_rdev); } + +#define IGT_DEV_PATH_LEN 80lib/igt_device.c int igt_device_get_card_index(int fd) · line 120
Quoted 10 lines
lib/igt_device.c +10
-0+ +static bool igt_device_is_pci (int fd) +{ +char path[IGT_DEV_PATH_LEN ]; +char *subsystem; +int sysfs; +int len; + +if ((sysfs =igt_sysfs_open (fd)) ==-1 ) +return false;Even checkpatch is returning error here - 'do not use assignment in if condition'
Checkpatch is the one in the wrong here. That if statement is elegant, valid and readable.
Signature · 5 lines
Petri Latvala _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 1/3] lib/igt_device: add igt_device_get_pci_addr by fd
Quoted 56 lines · Petri Latvala
Quoted 37 lines · Katarzyna Dec
Quoted 3 lines · Daniel Mrzyglod
From: Michał Winiarski <[email protected]>
This function get us in easy way pci adress.
s/adress/address/
Quoted 32 lines
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.Signed-off-by Michał Winiarski <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Daniel Mrzyglod <[email protected]>--- lib/igt_device.c | 117 +++++++++++++++++++++++++++++++++++++++++++++++ lib/igt_device.h | 2 + 2 files changed, 119 insertions(+)lib/igt_device.c +3
-0@@ -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,117 @@ int igt_device_get_card_index(int fd)Quoted 16 lines
Quoted 4 lines
lib/igt_device.c +2
-0return minor (st.st_rdev); } + +#define IGT_DEV_PATH_LEN 80lib/igt_device.c int igt_device_get_card_index(int fd) · line 120
Quoted 10 lines
lib/igt_device.c +10
-0+ +static bool igt_device_is_pci (int fd) +{ +char path[IGT_DEV_PATH_LEN ]; +char *subsystem; +int sysfs; +int len; + +if ((sysfs =igt_sysfs_open (fd)) ==-1 ) +return false;Even checkpatch is returning error here - 'do not use assignment in if condition'
Quoted 2 lines
Checkpatch is the one in the wrong here. That if statement is elegant, valid and readable.
Here, your call, but in the kernel I'd have that split to assignment and condition.
BR,
Jani.
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev