summaryrefslogtreecommitdiffstats
path: root/0001-device-detect-if-changing-endianness-failed.patch
diff options
context:
space:
mode:
authorJustin M. Forbes <jforbes@fedoraproject.org>2020-05-28 10:35:15 -0500
committerJustin M. Forbes <jforbes@fedoraproject.org>2020-05-28 10:35:15 -0500
commitc1d5388741c67796c728a41e28949b05ed72e52c (patch)
tree9271475cb907db2eb4a9fa111df997c1a461620e /0001-device-detect-if-changing-endianness-failed.patch
parenta79d8affb70a95069c35a0ccf7085e230c22a98d (diff)
downloadkernel-c1d5388741c67796c728a41e28949b05ed72e52c.tar.gz
kernel-c1d5388741c67796c728a41e28949b05ed72e52c.tar.xz
kernel-c1d5388741c67796c728a41e28949b05ed72e52c.zip
kernel-5.7.0-0.rc7.20200528gitb0c3ba31be3e.1
* Thu May 28 2020 CKI@GitLab <cki-project@redhat.com> [5.7.0-0.rc7.20200528gitb0c3ba31be3e.1] - b0c3ba31be3e rebase - Updated changelog for the release based on 444fc5cde643 ("CKI@GitLab") Resolves: rhbz# Signed-off-by: Justin M. Forbes <jforbes@fedoraproject.org>
Diffstat (limited to '0001-device-detect-if-changing-endianness-failed.patch')
-rw-r--r--0001-device-detect-if-changing-endianness-failed.patch62
1 files changed, 62 insertions, 0 deletions
diff --git a/0001-device-detect-if-changing-endianness-failed.patch b/0001-device-detect-if-changing-endianness-failed.patch
new file mode 100644
index 000000000..1089b7e87
--- /dev/null
+++ b/0001-device-detect-if-changing-endianness-failed.patch
@@ -0,0 +1,62 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Karol Herbst <kherbst@redhat.com>
+Date: Tue, 28 Apr 2020 18:54:03 +0200
+Subject: [PATCH] device: detect if changing endianness failed
+
+v2: relax the checks a little
+
+Signed-off-by: Karol Herbst <kherbst@redhat.com>
+Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
+---
+ .../gpu/drm/nouveau/nvkm/engine/device/base.c | 26 +++++++++++++++----
+ 1 file changed, 21 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
+index 37589f36546d..c732074bf790 100644
+--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
++++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
+@@ -2924,6 +2924,20 @@ nvkm_device_del(struct nvkm_device **pdevice)
+ }
+ }
+
++static inline bool
++nvkm_device_endianness(void __iomem *pri)
++{
++ u32 boot1 = ioread32_native(pri + 0x000004) & 0x01000001;
++#ifdef __BIG_ENDIAN
++ if (!boot1)
++ return false;
++#else
++ if (boot1)
++ return false;
++#endif
++ return true;
++}
++
+ int
+ nvkm_device_ctor(const struct nvkm_device_func *func,
+ const struct nvkm_device_quirk *quirk,
+@@ -2973,13 +2987,15 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
+ /* identify the chipset, and determine classes of subdev/engines */
+ if (detect) {
+ /* switch mmio to cpu's native endianness */
+-#ifndef __BIG_ENDIAN
+- if (ioread32_native(map + 0x000004) != 0x00000000) {
+-#else
+- if (ioread32_native(map + 0x000004) == 0x00000000) {
+-#endif
++ if (!nvkm_device_endianness(map)) {
+ iowrite32_native(0x01000001, map + 0x000004);
+ ioread32_native(map);
++ if (!nvkm_device_endianness(map)) {
++ nvdev_error(device,
++ "GPU not supported on big-endian\n");
++ ret = -ENOSYS;
++ goto done;
++ }
+ }
+
+ /* read boot0 and strapping information */
+--
+2.26.2
+