* [igt-dev] [PATCH i-g-t] lib: add pci helper functions to intel_chipset
@ 2019-03-11 13:23 Daniel Mrzyglod
2019-03-11 13:44 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Daniel Mrzyglod @ 2019-03-11 13:23 UTC (permalink / raw)
To: igt-dev; +Cc: Mrzyglod
From: "Mrzyglod, Daniel T" <daniel.t.mrzyglod@intel.com>
This patch add two helper functions:
* reading register from PCI based on open fd
* getting PCI domain/bus/dev/func based on fd
The reason why we need this function is up to scenario when we have
multiple PCI devices.
Signed-off-by: Mrzyglod, Daniel T <daniel.t.mrzyglod@intel.com>
---
lib/intel_chipset.c | 176 ++++++++++++++++++++++++++++++++++++++++++++
lib/intel_chipset.h | 13 ++++
2 files changed, 189 insertions(+)
diff --git a/lib/intel_chipset.c b/lib/intel_chipset.c
index 4748a3fb..3dd722d6 100644
--- a/lib/intel_chipset.c
+++ b/lib/intel_chipset.c
@@ -36,6 +36,7 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mman.h>
+#include <linux/limits.h>
#include "i915_drm.h"
#include "drmtest.h"
@@ -178,3 +179,178 @@ intel_check_pch(void)
return;
}
}
+
+/**
+ * parse_pci_address_string:
+ * @pci_address: PCI string in form 0000:00:00.0
+ * @dev_addr: structure to be filled by this parsing function
+ *
+ * This function fill fd_pci_address structure with data about pci: domain, bus
+ * device, function
+ * Return:
+ * O or -EINVAL
+ */
+static int parse_pci_address_string(char *pci_address,
+ struct fd_pci_address *dev_addr)
+{
+ unsigned long val;
+ char *pch;
+ int i = 0;
+
+ if (strlen(pci_address) != 12)
+ return -EINVAL;
+
+ /* parse PCI address string for domain */
+ pch = strtok(pci_address, ":.");
+ errno = 0;
+ val = strtoul(pch, NULL, 16);
+ if (errno != 0 || val > UINT16_MAX)
+ return -EINVAL;
+ dev_addr->domain = val;
+
+ /* parse PCI address for: BUS DEVICE FUNCTION */
+ for (i = 0; i < 3; i++) {
+ pch = strtok(NULL, ":.");
+ errno = 0;
+ val = strtoul(pch, NULL, 16);
+ if (errno != 0 || val > UINT8_MAX)
+ return -EINVAL;
+
+ switch (i) {
+ case 0:
+ dev_addr->bus = val;
+ break;
+ case 1:
+ dev_addr->dev = val;
+ break;
+ case 2:
+ dev_addr->func = val;
+ break;
+ default:
+ return -EINVAL;
+ break;
+ }
+ }
+
+ pch = strtok(NULL, ":.");
+ if (pch)
+ return -EINVAL;
+
+ return 0;
+}
+
+/**
+ * parse_pci_filepath_string:
+ * @filepath: string in form ../../devices/pci0000:00/0000:00:00.0/drm/card0
+ * @dev_addr: structure to be filled by this parsing function
+ *
+ * This function parse filepath string to PCI address string 0000:00:00.0 form.
+ * and fill dev_addr.
+ * Return:
+ * O or -EINVAL
+ */
+static int
+parse_pci_filepath_string(char *filepath, struct fd_pci_address *dev_addr)
+{
+ char *pch = strstr(filepath, "pci");
+ char *begin = NULL;
+ char *end = NULL;
+
+ if (pch) {
+ pch = strstr(pch, "/");
+ pch++;
+ begin = pch;
+ end = strstr(pch, "/");
+ *end = '\0';
+ } else {
+ return -EINVAL;
+ }
+ if (strlen(begin) != 12)
+ return -EINVAL;
+ if (parse_pci_address_string(begin, dev_addr) < 0)
+ return -EINVAL;
+ return 0;
+}
+
+/**
+ * get_pci_address_space:
+ * @fd: file descriptor of opened device
+ * @dev_addr: structure with pci_address to be filled by this parsing function
+ *
+ * This function fill dev_addr from reading fstats from opened device.
+ * from it.
+ * Return:
+ * O or -EINVAL
+ */
+int intel_get_pci_address_space(int fd, struct fd_pci_address *dev_addr)
+{
+ struct stat sb;
+ char filepath[PATH_MAX];
+ char fdp[PATH_MAX];
+ int ret = -1;
+
+ if (fstat(fd, &sb) == -1) {
+ perror("stat");
+ return -EINVAL;
+ }
+
+ sprintf(fdp, "/sys/dev/char/%d:%d", major(sb.st_rdev),
+ minor(sb.st_rdev));
+ readlink(fdp, filepath, PATH_MAX);
+
+ ret = parse_pci_filepath_string(filepath, dev_addr);
+ if (ret < 0)
+ return -EINVAL;
+
+ return 0;
+}
+
+/**
+ * pci_read_register_u32:
+ * @fd: file descriptor of opened device
+ * @reg_name: offset in mmio space
+ *
+ * This function read UINT32 from pci.
+ * Return:
+ * Register value or igt_fail
+ */
+uint32_t intel_pci_read_register_u32(int fd, uint32_t reg_name)
+{
+ uint32_t reg_val = 0;
+ int error = -1;
+ int mmio_bar, mmio_size;
+ struct pci_device *dev;
+ struct fd_pci_address dev_addr;
+ void *igt_mmio;
+
+ intel_get_pci_address_space(fd, &dev_addr);
+ pci_system_init();
+ dev = pci_device_find_by_slot((uint32_t)dev_addr.domain,
+ (uint32_t)dev_addr.bus,
+ (uint32_t)dev_addr.dev,
+ (uint32_t)dev_addr.func);
+
+ error = pci_device_probe(dev);
+ igt_fail_on_f(error != 0,
+ "Couldn't probe graphics card\n");
+
+ mmio_bar = 0;
+ mmio_size = 2 * 1024 * 1024;
+
+ error = pci_device_map_range(dev,
+ dev->regions[mmio_bar].base_addr,
+ mmio_size,
+ PCI_DEV_MAP_FLAG_WRITABLE,
+ &igt_mmio);
+ igt_fail_on_f(error != 0,
+ "Couldn't map MMIO region\n");
+
+ reg_val = *(volatile uint32_t *)((volatile char *)igt_mmio + reg_name);
+
+ error = pci_device_unmap_range(dev, igt_mmio,
+ mmio_size);
+ igt_fail_on_f(error != 0,
+ "Couldn't unmap MMIO region\n");
+
+ return reg_val;
+}
diff --git a/lib/intel_chipset.h b/lib/intel_chipset.h
index 40170b7b..96a618eb 100644
--- a/lib/intel_chipset.h
+++ b/lib/intel_chipset.h
@@ -73,6 +73,19 @@ struct intel_device_info {
const struct intel_device_info *intel_get_device_info(uint16_t devid) __attribute__((pure));
+struct fd_pci_address {
+ /**
+ * PCI Address
+ */
+ uint16_t domain;
+ uint8_t bus;
+ uint8_t dev;
+ uint8_t func;
+};
+
+uint32_t intel_pci_read_register_u32(int fd, uint32_t reg_name);
+int intel_get_pci_address_space(int fd, struct fd_pci_address *dev_addr);
+
unsigned intel_gen(uint16_t devid) __attribute__((pure));
unsigned intel_gt(uint16_t devid) __attribute__((pure));
--
2.20.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 6+ messages in thread* [igt-dev] ✓ Fi.CI.BAT: success for lib: add pci helper functions to intel_chipset 2019-03-11 13:23 [igt-dev] [PATCH i-g-t] lib: add pci helper functions to intel_chipset Daniel Mrzyglod @ 2019-03-11 13:44 ` Patchwork 2019-03-11 13:52 ` [igt-dev] [PATCH i-g-t] " Chris Wilson ` (2 subsequent siblings) 3 siblings, 0 replies; 6+ messages in thread From: Patchwork @ 2019-03-11 13:44 UTC (permalink / raw) To: Daniel Mrzyglod; +Cc: igt-dev == Series Details == Series: lib: add pci helper functions to intel_chipset URL : https://patchwork.freedesktop.org/series/57831/ State : success == Summary == CI Bug Log - changes from CI_DRM_5733 -> IGTPW_2585 ==================================================== Summary ------- **SUCCESS** No regressions found. External URL: https://patchwork.freedesktop.org/api/1.0/series/57831/revisions/1/mbox/ Known issues ------------ Here are the changes found in IGTPW_2585 that come from known issues: ### IGT changes ### #### Issues hit #### * igt@amdgpu/amd_basic@cs-compute: - fi-kbl-8809g: NOTRUN -> FAIL [fdo#108094] * igt@amdgpu/amd_basic@cs-sdma: - fi-skl-6770hq: NOTRUN -> SKIP [fdo#109271] +37 * igt@gem_exec_basic@readonly-bsd2: - fi-pnv-d510: NOTRUN -> SKIP [fdo#109271] +76 * igt@kms_busy@basic-flip-a: - fi-bsw-n3050: NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +1 * igt@kms_busy@basic-flip-c: - fi-pnv-d510: NOTRUN -> SKIP [fdo#109271] / [fdo#109278] * igt@kms_chamelium@common-hpd-after-suspend: - fi-kbl-7567u: PASS -> WARN [fdo#109380] * igt@kms_chamelium@hdmi-crc-fast: - fi-bsw-n3050: NOTRUN -> SKIP [fdo#109271] +62 * igt@kms_chamelium@vga-edid-read: - fi-hsw-4770r: NOTRUN -> SKIP [fdo#109271] +45 * igt@kms_pipe_crc_basic@hang-read-crc-pipe-b: - fi-byt-clapper: PASS -> FAIL [fdo#103191] / [fdo#107362] +1 * igt@kms_pipe_crc_basic@nonblocking-crc-pipe-c: - fi-kbl-7567u: PASS -> SKIP [fdo#109271] +33 #### Possible fixes #### * igt@amdgpu/amd_basic@userptr: - fi-kbl-8809g: DMESG-WARN [fdo#108965] -> PASS * igt@i915_pm_rpm@basic-pci-d3-state: - fi-bsw-kefka: SKIP [fdo#109271] -> PASS * igt@i915_pm_rpm@basic-rte: - fi-bsw-kefka: FAIL [fdo#108800] -> PASS * igt@prime_vgem@basic-fence-flip: - fi-gdg-551: FAIL [fdo#103182] -> PASS [fdo#103182]: https://bugs.freedesktop.org/show_bug.cgi?id=103182 [fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191 [fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362 [fdo#108094]: https://bugs.freedesktop.org/show_bug.cgi?id=108094 [fdo#108800]: https://bugs.freedesktop.org/show_bug.cgi?id=108800 [fdo#108965]: https://bugs.freedesktop.org/show_bug.cgi?id=108965 [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271 [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278 [fdo#109380]: https://bugs.freedesktop.org/show_bug.cgi?id=109380 Participating hosts (44 -> 36) ------------------------------ Additional (4): fi-hsw-4770r fi-skl-6770hq fi-bsw-n3050 fi-pnv-d510 Missing (12): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-icl-u2 fi-bsw-cyan fi-cfl-guc fi-whl-u fi-cfl-8109u fi-icl-u3 fi-bdw-samus fi-skl-6700k2 Build changes ------------- * IGT: IGT_4879 -> IGTPW_2585 CI_DRM_5733: e853777d9c87e9b21d9ccb781e0dc186d816cfc0 @ git://anongit.freedesktop.org/gfx-ci/linux IGTPW_2585: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2585/ IGT_4879: 4e7296aa879350b10a216b88fa7f44d919765765 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools == Logs == For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2585/ _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [igt-dev] [PATCH i-g-t] lib: add pci helper functions to intel_chipset 2019-03-11 13:23 [igt-dev] [PATCH i-g-t] lib: add pci helper functions to intel_chipset Daniel Mrzyglod 2019-03-11 13:44 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork @ 2019-03-11 13:52 ` Chris Wilson 2019-03-11 14:24 ` Mrzyglod, Daniel T 2019-03-11 15:47 ` [igt-dev] ✗ Fi.CI.IGT: failure for " Patchwork 2019-03-12 13:43 ` [igt-dev] [PATCH i-g-t] " Jani Nikula 3 siblings, 1 reply; 6+ messages in thread From: Chris Wilson @ 2019-03-11 13:52 UTC (permalink / raw) To: Daniel Mrzyglod, igt-dev; +Cc: Mrzyglod Quoting Daniel Mrzyglod (2019-03-11 13:23:09) > + error = pci_device_map_range(dev, > + dev->regions[mmio_bar].base_addr, > + mmio_size, > + PCI_DEV_MAP_FLAG_WRITABLE, > + &igt_mmio); This wasn't enough clue to consider intel_mmio.c instead? -Chris _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [igt-dev] [PATCH i-g-t] lib: add pci helper functions to intel_chipset 2019-03-11 13:52 ` [igt-dev] [PATCH i-g-t] " Chris Wilson @ 2019-03-11 14:24 ` Mrzyglod, Daniel T 0 siblings, 0 replies; 6+ messages in thread From: Mrzyglod, Daniel T @ 2019-03-11 14:24 UTC (permalink / raw) To: igt-dev@lists.freedesktop.org, chris@chris-wilson.co.uk [-- Attachment #1.1: Type: text/plain, Size: 544 bytes --] On Mon, 2019-03-11 at 13:52 +0000, Chris Wilson wrote: > Quoting Daniel Mrzyglod (2019-03-11 13:23:09) > > + error = pci_device_map_range(dev, > > + dev- > > >regions[mmio_bar].base_addr, > > + mmio_size, > > + PCI_DEV_MAP_FLAG_WRITABLE, > > + &igt_mmio); > > This wasn't enough clue to consider intel_mmio.c instead? > -Chris You are correct I will move to v2 for second iteration. [-- Attachment #1.2: smime.p7s --] [-- Type: application/x-pkcs7-signature, Size: 3282 bytes --] [-- Attachment #2: Type: text/plain, Size: 153 bytes --] _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 6+ messages in thread
* [igt-dev] ✗ Fi.CI.IGT: failure for lib: add pci helper functions to intel_chipset 2019-03-11 13:23 [igt-dev] [PATCH i-g-t] lib: add pci helper functions to intel_chipset Daniel Mrzyglod 2019-03-11 13:44 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork 2019-03-11 13:52 ` [igt-dev] [PATCH i-g-t] " Chris Wilson @ 2019-03-11 15:47 ` Patchwork 2019-03-12 13:43 ` [igt-dev] [PATCH i-g-t] " Jani Nikula 3 siblings, 0 replies; 6+ messages in thread From: Patchwork @ 2019-03-11 15:47 UTC (permalink / raw) To: Mrzyglod, Daniel T; +Cc: igt-dev == Series Details == Series: lib: add pci helper functions to intel_chipset URL : https://patchwork.freedesktop.org/series/57831/ State : failure == Summary == CI Bug Log - changes from CI_DRM_5733_full -> IGTPW_2585_full ==================================================== Summary ------- **FAILURE** Serious unknown changes coming with IGTPW_2585_full absolutely need to be verified manually. If you think the reported changes have nothing to do with the changes introduced in IGTPW_2585_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/57831/revisions/1/mbox/ Known issues ------------ Here are the changes found in IGTPW_2585_full that come from known issues: ### IGT changes ### #### Issues hit #### * igt@gem_ctx_param@invalid-param-get: - shard-glk: NOTRUN -> FAIL [fdo#109559] - shard-snb: NOTRUN -> FAIL [fdo#109559] - shard-hsw: NOTRUN -> FAIL [fdo#109559] - shard-apl: NOTRUN -> FAIL [fdo#109559] - shard-kbl: NOTRUN -> FAIL [fdo#109559] * igt@gem_ctx_param@invalid-param-set: - shard-snb: NOTRUN -> FAIL [fdo#109674] - shard-glk: NOTRUN -> FAIL [fdo#109674] - shard-kbl: NOTRUN -> FAIL [fdo#109674] - shard-apl: NOTRUN -> FAIL [fdo#109674] - shard-hsw: NOTRUN -> FAIL [fdo#109674] * igt@gem_exec_schedule@preempt-other-chain-blt: - shard-snb: NOTRUN -> SKIP [fdo#109271] +1260 * igt@gem_exec_store@basic-bsd2: - shard-hsw: NOTRUN -> SKIP [fdo#109271] +898 * igt@i915_pm_rps@waitboost: - shard-glk: NOTRUN -> FAIL [fdo#102250] * igt@kms_atomic_transition@6x-modeset-transitions-fencing: - shard-snb: NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +140 * igt@kms_atomic_transition@6x-modeset-transitions-nonblocking: - shard-apl: NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +56 * igt@kms_available_modes_crc@available_mode_test_crc: - shard-apl: NOTRUN -> FAIL [fdo#106641] - shard-kbl: NOTRUN -> FAIL [fdo#106641] - shard-glk: NOTRUN -> FAIL [fdo#106641] * igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-a: - shard-glk: NOTRUN -> DMESG-WARN [fdo#107956] +10 * igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-b: - shard-snb: NOTRUN -> DMESG-WARN [fdo#107956] +3 * igt@kms_busy@extended-pageflip-hang-newfb-render-a: - shard-apl: NOTRUN -> DMESG-WARN [fdo#107956] +11 * igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-a: - shard-hsw: NOTRUN -> DMESG-WARN [fdo#107956] +4 * igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-c: - shard-kbl: NOTRUN -> DMESG-WARN [fdo#107956] +3 * igt@kms_color@pipe-a-degamma: - shard-glk: NOTRUN -> FAIL [fdo#104782] / [fdo#108145] * igt@kms_color@pipe-b-degamma: - shard-glk: NOTRUN -> FAIL [fdo#104782] +1 * igt@kms_color@pipe-c-ctm-max: - shard-glk: NOTRUN -> FAIL [fdo#108147] +2 * igt@kms_concurrent@pipe-d: - shard-hsw: NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +90 * igt@kms_content_protection@atomic: - shard-kbl: NOTRUN -> FAIL [fdo#108597] / [fdo#108739] +1 - shard-apl: NOTRUN -> FAIL [fdo#108597] / [fdo#108739] +1 * igt@kms_content_protection@atomic-dpms: - shard-apl: NOTRUN -> FAIL [fdo#108739] - shard-kbl: NOTRUN -> FAIL [fdo#108739] * igt@kms_cursor_crc@cursor-128x128-suspend: - shard-apl: NOTRUN -> FAIL [fdo#103191] / [fdo#103232] +1 - shard-kbl: NOTRUN -> FAIL [fdo#103191] / [fdo#103232] * igt@kms_cursor_crc@cursor-128x42-onscreen: - shard-kbl: NOTRUN -> FAIL [fdo#103232] +1 * igt@kms_cursor_crc@cursor-128x42-random: - shard-apl: NOTRUN -> FAIL [fdo#103232] +6 * igt@kms_cursor_crc@cursor-256x85-onscreen: - shard-glk: NOTRUN -> FAIL [fdo#103232] +23 * igt@kms_cursor_crc@cursor-alpha-opaque: - shard-glk: NOTRUN -> FAIL [fdo#109350] * igt@kms_cursor_legacy@2x-nonblocking-modeset-vs-cursor-atomic: - shard-glk: NOTRUN -> FAIL [fdo#105454] / [fdo#106509] +1 * igt@kms_flip@flip-vs-suspend-interruptible: - shard-snb: NOTRUN -> DMESG-WARN [fdo#102365] * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-move: - shard-kbl: NOTRUN -> FAIL [fdo#103167] * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt: - shard-apl: NOTRUN -> FAIL [fdo#103167] +2 * igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-blt: - shard-glk: NOTRUN -> FAIL [fdo#103167] +6 * igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-onoff: - shard-kbl: NOTRUN -> SKIP [fdo#109271] +727 * igt@kms_frontbuffer_tracking@fbc-2p-rte: - shard-apl: NOTRUN -> SKIP [fdo#109271] +851 * igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-blt: - shard-glk: NOTRUN -> SKIP [fdo#109271] +695 * igt@kms_invalid_dotclock: - shard-glk: NOTRUN -> DMESG-WARN [fdo#109373] * igt@kms_plane_alpha_blend@pipe-b-alpha-7efc: - shard-kbl: NOTRUN -> FAIL [fdo#108145] / [fdo#108590] +5 * igt@kms_plane_alpha_blend@pipe-b-alpha-basic: - shard-apl: NOTRUN -> FAIL [fdo#108145] +14 * igt@kms_plane_alpha_blend@pipe-b-alpha-transparant-fb: - shard-kbl: NOTRUN -> FAIL [fdo#108145] +8 * igt@kms_plane_alpha_blend@pipe-c-alpha-transparant-fb: - shard-glk: NOTRUN -> FAIL [fdo#108145] +11 * igt@kms_plane_multiple@atomic-pipe-a-tiling-x: - shard-glk: NOTRUN -> FAIL [fdo#103166] +7 * igt@kms_plane_multiple@atomic-pipe-b-tiling-yf: - shard-apl: NOTRUN -> FAIL [fdo#103166] * igt@kms_setmode@basic: - shard-glk: NOTRUN -> FAIL [fdo#99912] - shard-hsw: NOTRUN -> FAIL [fdo#99912] - shard-apl: NOTRUN -> FAIL [fdo#99912] - shard-snb: NOTRUN -> FAIL [fdo#99912] * igt@kms_sysfs_edid_timing: - shard-apl: NOTRUN -> FAIL [fdo#100047] - shard-kbl: NOTRUN -> FAIL [fdo#100047] * igt@kms_universal_plane@cursor-fb-leak-pipe-e: - shard-glk: NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +59 * igt@kms_universal_plane@disable-primary-vs-flip-pipe-d: - shard-kbl: NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +56 * igt@kms_vblank@pipe-b-ts-continuation-dpms-suspend: - shard-hsw: NOTRUN -> INCOMPLETE [fdo#103540] * igt@kms_vblank@pipe-c-ts-continuation-modeset-rpm: - shard-apl: NOTRUN -> FAIL [fdo#104894] * igt@runner@aborted: - shard-glk: NOTRUN -> FAIL [fdo#109373] / [k.org#202321] {name}: This element is suppressed. This means it is ignored when computing the status of the difference (SUCCESS, WARNING, or FAILURE). [fdo#100047]: https://bugs.freedesktop.org/show_bug.cgi?id=100047 [fdo#102250]: https://bugs.freedesktop.org/show_bug.cgi?id=102250 [fdo#102365]: https://bugs.freedesktop.org/show_bug.cgi?id=102365 [fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166 [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167 [fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191 [fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232 [fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540 [fdo#104782]: https://bugs.freedesktop.org/show_bug.cgi?id=104782 [fdo#104894]: https://bugs.freedesktop.org/show_bug.cgi?id=104894 [fdo#105454]: https://bugs.freedesktop.org/show_bug.cgi?id=105454 [fdo#106509]: https://bugs.freedesktop.org/show_bug.cgi?id=106509 [fdo#106641]: https://bugs.freedesktop.org/show_bug.cgi?id=106641 [fdo#107956]: https://bugs.freedesktop.org/show_bug.cgi?id=107956 [fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145 [fdo#108147]: https://bugs.freedesktop.org/show_bug.cgi?id=108147 [fdo#108590]: https://bugs.freedesktop.org/show_bug.cgi?id=108590 [fdo#108597]: https://bugs.freedesktop.org/show_bug.cgi?id=108597 [fdo#108739]: https://bugs.freedesktop.org/show_bug.cgi?id=108739 [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271 [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278 [fdo#109350]: https://bugs.freedesktop.org/show_bug.cgi?id=109350 [fdo#109373]: https://bugs.freedesktop.org/show_bug.cgi?id=109373 [fdo#109559]: https://bugs.freedesktop.org/show_bug.cgi?id=109559 [fdo#109674]: https://bugs.freedesktop.org/show_bug.cgi?id=109674 [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 (3 -> 5) ------------------------------ ERROR: It appears as if the changes made in IGTPW_2585_full prevented too many machines from booting. Additional (5): shard-apl shard-glk shard-hsw shard-kbl shard-snb Missing (3): pig-skl-6260u pig-glk-j5005 pig-hsw-4770r Build changes ------------- * IGT: None -> IGTPW_2585 * Piglit: piglit_4509 -> None CI_DRM_5733: e853777d9c87e9b21d9ccb781e0dc186d816cfc0 @ git://anongit.freedesktop.org/gfx-ci/linux IGTPW_2585: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2585/ piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit == Logs == For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2585/ _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [igt-dev] [PATCH i-g-t] lib: add pci helper functions to intel_chipset 2019-03-11 13:23 [igt-dev] [PATCH i-g-t] lib: add pci helper functions to intel_chipset Daniel Mrzyglod ` (2 preceding siblings ...) 2019-03-11 15:47 ` [igt-dev] ✗ Fi.CI.IGT: failure for " Patchwork @ 2019-03-12 13:43 ` Jani Nikula 3 siblings, 0 replies; 6+ messages in thread From: Jani Nikula @ 2019-03-12 13:43 UTC (permalink / raw) To: Daniel Mrzyglod, igt-dev; +Cc: Mrzyglod On Mon, 11 Mar 2019, Daniel Mrzyglod <daniel.t.mrzyglod@intel.com> wrote: > From: "Mrzyglod, Daniel T" <daniel.t.mrzyglod@intel.com> > > This patch add two helper functions: > * reading register from PCI based on open fd > * getting PCI domain/bus/dev/func based on fd > > The reason why we need this function is up to scenario when we have > multiple PCI devices. > > Signed-off-by: Mrzyglod, Daniel T <daniel.t.mrzyglod@intel.com> > --- > lib/intel_chipset.c | 176 ++++++++++++++++++++++++++++++++++++++++++++ > lib/intel_chipset.h | 13 ++++ > 2 files changed, 189 insertions(+) > > diff --git a/lib/intel_chipset.c b/lib/intel_chipset.c > index 4748a3fb..3dd722d6 100644 > --- a/lib/intel_chipset.c > +++ b/lib/intel_chipset.c > @@ -36,6 +36,7 @@ > #include <fcntl.h> > #include <sys/stat.h> > #include <sys/mman.h> > +#include <linux/limits.h> > #include "i915_drm.h" > > #include "drmtest.h" > @@ -178,3 +179,178 @@ intel_check_pch(void) > return; > } > } > + > +/** > + * parse_pci_address_string: > + * @pci_address: PCI string in form 0000:00:00.0 > + * @dev_addr: structure to be filled by this parsing function > + * > + * This function fill fd_pci_address structure with data about pci: domain, bus > + * device, function > + * Return: > + * O or -EINVAL > + */ > +static int parse_pci_address_string(char *pci_address, > + struct fd_pci_address *dev_addr) > +{ > + unsigned long val; > + char *pch; > + int i = 0; > + > + if (strlen(pci_address) != 12) > + return -EINVAL; > + > + /* parse PCI address string for domain */ > + pch = strtok(pci_address, ":."); > + errno = 0; > + val = strtoul(pch, NULL, 16); > + if (errno != 0 || val > UINT16_MAX) > + return -EINVAL; > + dev_addr->domain = val; > + > + /* parse PCI address for: BUS DEVICE FUNCTION */ > + for (i = 0; i < 3; i++) { > + pch = strtok(NULL, ":."); > + errno = 0; > + val = strtoul(pch, NULL, 16); > + if (errno != 0 || val > UINT8_MAX) > + return -EINVAL; > + > + switch (i) { > + case 0: > + dev_addr->bus = val; > + break; > + case 1: > + dev_addr->dev = val; > + break; > + case 2: > + dev_addr->func = val; > + break; > + default: > + return -EINVAL; > + break; > + } > + } > + > + pch = strtok(NULL, ":."); > + if (pch) > + return -EINVAL; > + > + return 0; > +} static int parse_pci_address_string(const char *pci_address, struct fd_pci_address *dev_addr) { int ret; unsigned int domain, bus, dev, func; ret = sscanf(pci_address, "%4x:%2x:%2x.%1x", &domain, &bus, &dev, &func); if (ret != 4) return -EINVAL; dev_addr->domain = domain; dev_addr->bus = bus; dev_addr->dev = dev; dev_addr->func = func; return 0; } BR, Jani. > + > +/** > + * parse_pci_filepath_string: > + * @filepath: string in form ../../devices/pci0000:00/0000:00:00.0/drm/card0 > + * @dev_addr: structure to be filled by this parsing function > + * > + * This function parse filepath string to PCI address string 0000:00:00.0 form. > + * and fill dev_addr. > + * Return: > + * O or -EINVAL > + */ > +static int > +parse_pci_filepath_string(char *filepath, struct fd_pci_address *dev_addr) > +{ > + char *pch = strstr(filepath, "pci"); > + char *begin = NULL; > + char *end = NULL; > + > + if (pch) { > + pch = strstr(pch, "/"); > + pch++; > + begin = pch; > + end = strstr(pch, "/"); > + *end = '\0'; > + } else { > + return -EINVAL; > + } > + if (strlen(begin) != 12) > + return -EINVAL; > + if (parse_pci_address_string(begin, dev_addr) < 0) > + return -EINVAL; > + return 0; > +} > + > +/** > + * get_pci_address_space: > + * @fd: file descriptor of opened device > + * @dev_addr: structure with pci_address to be filled by this parsing function > + * > + * This function fill dev_addr from reading fstats from opened device. > + * from it. > + * Return: > + * O or -EINVAL > + */ > +int intel_get_pci_address_space(int fd, struct fd_pci_address *dev_addr) > +{ > + struct stat sb; > + char filepath[PATH_MAX]; > + char fdp[PATH_MAX]; > + int ret = -1; > + > + if (fstat(fd, &sb) == -1) { > + perror("stat"); > + return -EINVAL; > + } > + > + sprintf(fdp, "/sys/dev/char/%d:%d", major(sb.st_rdev), > + minor(sb.st_rdev)); > + readlink(fdp, filepath, PATH_MAX); > + > + ret = parse_pci_filepath_string(filepath, dev_addr); > + if (ret < 0) > + return -EINVAL; > + > + return 0; > +} > + > +/** > + * pci_read_register_u32: > + * @fd: file descriptor of opened device > + * @reg_name: offset in mmio space > + * > + * This function read UINT32 from pci. > + * Return: > + * Register value or igt_fail > + */ > +uint32_t intel_pci_read_register_u32(int fd, uint32_t reg_name) > +{ > + uint32_t reg_val = 0; > + int error = -1; > + int mmio_bar, mmio_size; > + struct pci_device *dev; > + struct fd_pci_address dev_addr; > + void *igt_mmio; > + > + intel_get_pci_address_space(fd, &dev_addr); > + pci_system_init(); > + dev = pci_device_find_by_slot((uint32_t)dev_addr.domain, > + (uint32_t)dev_addr.bus, > + (uint32_t)dev_addr.dev, > + (uint32_t)dev_addr.func); > + > + error = pci_device_probe(dev); > + igt_fail_on_f(error != 0, > + "Couldn't probe graphics card\n"); > + > + mmio_bar = 0; > + mmio_size = 2 * 1024 * 1024; > + > + error = pci_device_map_range(dev, > + dev->regions[mmio_bar].base_addr, > + mmio_size, > + PCI_DEV_MAP_FLAG_WRITABLE, > + &igt_mmio); > + igt_fail_on_f(error != 0, > + "Couldn't map MMIO region\n"); > + > + reg_val = *(volatile uint32_t *)((volatile char *)igt_mmio + reg_name); > + > + error = pci_device_unmap_range(dev, igt_mmio, > + mmio_size); > + igt_fail_on_f(error != 0, > + "Couldn't unmap MMIO region\n"); > + > + return reg_val; > +} > diff --git a/lib/intel_chipset.h b/lib/intel_chipset.h > index 40170b7b..96a618eb 100644 > --- a/lib/intel_chipset.h > +++ b/lib/intel_chipset.h > @@ -73,6 +73,19 @@ struct intel_device_info { > > const struct intel_device_info *intel_get_device_info(uint16_t devid) __attribute__((pure)); > > +struct fd_pci_address { > + /** > + * PCI Address > + */ > + uint16_t domain; > + uint8_t bus; > + uint8_t dev; > + uint8_t func; > +}; > + > +uint32_t intel_pci_read_register_u32(int fd, uint32_t reg_name); > +int intel_get_pci_address_space(int fd, struct fd_pci_address *dev_addr); > + > unsigned intel_gen(uint16_t devid) __attribute__((pure)); > unsigned intel_gt(uint16_t devid) __attribute__((pure)); -- Jani Nikula, Intel Open Source Graphics Center _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-03-12 13:42 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-03-11 13:23 [igt-dev] [PATCH i-g-t] lib: add pci helper functions to intel_chipset Daniel Mrzyglod 2019-03-11 13:44 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork 2019-03-11 13:52 ` [igt-dev] [PATCH i-g-t] " Chris Wilson 2019-03-11 14:24 ` Mrzyglod, Daniel T 2019-03-11 15:47 ` [igt-dev] ✗ Fi.CI.IGT: failure for " Patchwork 2019-03-12 13:43 ` [igt-dev] [PATCH i-g-t] " Jani Nikula
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox