From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Intel-gfx@lists.freedesktop.org,
Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Subject: [igt-dev] [RFT i-g-t] lib/i915: Assert mmap size alignment
Date: Fri, 1 Mar 2019 09:37:58 +0000 [thread overview]
Message-ID: <20190301093758.10836-1-tvrtko.ursulin@linux.intel.com> (raw)
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Fishing for fails...
/*
mmap(2) mandates size is page aligned so check this in our wrappers.
*/
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
lib/i915/gem_mman.c | 4 ++++
tests/kms_psr.c | 8 ++++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/lib/i915/gem_mman.c b/lib/i915/gem_mman.c
index 3cf9a6bbdb31..084dbb3b3678 100644
--- a/lib/i915/gem_mman.c
+++ b/lib/i915/gem_mman.c
@@ -57,6 +57,8 @@ void *__gem_mmap__gtt(int fd, uint32_t handle, uint64_t size, unsigned prot)
struct drm_i915_gem_mmap_gtt mmap_arg;
void *ptr;
+ igt_assert(!(size & 4095));
+
memset(&mmap_arg, 0, sizeof(mmap_arg));
mmap_arg.handle = handle;
if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg))
@@ -162,6 +164,8 @@ static void
{
struct drm_i915_gem_mmap arg;
+ igt_assert(!(size & 4095));
+
memset(&arg, 0, sizeof(arg));
arg.handle = handle;
arg.offset = offset;
diff --git a/tests/kms_psr.c b/tests/kms_psr.c
index 3e16a6bf4f37..5d3f0ed87eec 100644
--- a/tests/kms_psr.c
+++ b/tests/kms_psr.c
@@ -270,8 +270,8 @@ static void run_test(data_t *data)
expected = "GREEN";
break;
case MMAP_GTT:
- ptr = gem_mmap__gtt(data->drm_fd, handle, data->mod_size,
- PROT_WRITE);
+ ptr = gem_mmap__gtt(data->drm_fd, handle,
+ ALIGN(data->mod_size, 4096), PROT_WRITE);
gem_set_domain(data->drm_fd, handle,
I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
memset(ptr, 0xcc, data->mod_size);
@@ -279,8 +279,8 @@ static void run_test(data_t *data)
expected = "BLACK or TRANSPARENT mark on top of plane in test";
break;
case MMAP_CPU:
- ptr = gem_mmap__cpu(data->drm_fd, handle, 0, data->mod_size,
- PROT_WRITE);
+ ptr = gem_mmap__cpu(data->drm_fd, handle, 0,
+ ALIGN(data->mod_size, 4096), PROT_WRITE);
gem_set_domain(data->drm_fd, handle,
I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
memset(ptr, 0, data->mod_size);
--
2.19.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next reply other threads:[~2019-03-01 9:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-01 9:37 Tvrtko Ursulin [this message]
2019-03-01 12:30 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/i915: Assert mmap size alignment Patchwork
2019-03-01 15:39 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2019-03-04 7:11 [igt-dev] [RFT i-g-t] " Tvrtko Ursulin
2019-03-04 7:14 Tvrtko Ursulin
2019-03-04 14:11 Tvrtko Ursulin
2019-03-04 14:45 ` Chris Wilson
2019-03-05 7:55 ` Tvrtko Ursulin
2019-03-05 8:38 ` Chris Wilson
2019-03-05 9:23 ` Tvrtko Ursulin
2019-03-05 9:30 ` Chris Wilson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190301093758.10836-1-tvrtko.ursulin@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=Intel-gfx@lists.freedesktop.org \
--cc=igt-dev@lists.freedesktop.org \
--cc=tvrtko.ursulin@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox