drm/nouveau: Fix fallout from reservation object rework
authorThierry Reding <treding@nvidia.com>
Mon, 16 Sep 2019 14:19:23 +0000 (16:19 +0200)
committerBen Skeggs <bskeggs@redhat.com>
Tue, 17 Sep 2019 04:50:15 +0000 (14:50 +1000)
commit9ca7f7968be74ebf02f3a89d605d36bcb636560e
treee00316844cb29b935146964e4e14e8c9ca3412b8
parent698c1aa9f83b618de79e9e5e19a58f70a4a6ae0f
drm/nouveau: Fix fallout from reservation object rework

Commit 019cbd4a4feb ("drm/nouveau: Initialize GEM object before TTM
object") introduced a subtle change in how the buffer allocation size is
handled. Prior to that change, the size would get aligned to at least a
page, whereas after that change a non-page-aligned size would get passed
through unmodified. This ultimately causes a BUG_ON() to trigger in
drm_gem_private_object_init() and crashes the system.

Fix this by restoring the code that align the allocation size.

Fixes: 019cbd4a4feb ("drm/nouveau: Initialize GEM object before TTM object")
Reported-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_bo.c
drivers/gpu/drm/nouveau/nouveau_bo.h
drivers/gpu/drm/nouveau/nouveau_gem.c
drivers/gpu/drm/nouveau/nouveau_prime.c