From patchwork Sat Apr 29 04:11:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Kleiner X-Patchwork-Id: 9705633 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C3F88602CA for ; Sat, 29 Apr 2017 04:12:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B1A826CFC for ; Sat, 29 Apr 2017 04:12:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D4A026223; Sat, 29 Apr 2017 04:12:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 156EA26223 for ; Sat, 29 Apr 2017 04:12:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B0CA46E855; Sat, 29 Apr 2017 04:12:16 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id BEFDB6E851; Sat, 29 Apr 2017 04:12:14 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id y10so14233469wmh.0; Fri, 28 Apr 2017 21:12:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=3vDcswIt91EIuA9P8SnPTM5vM/j/EkT6OhDSuwRxGrQ=; b=Kjb6vp/jOFEfEIkH3ndaKivYntOcYRraD+7BC59inH9lBzalqwD5naf3irhcFdDdaQ OTDGknyBJ5fWZhgRAe9Yh214CLlI47DtZM2hQK/ysck3ss++T63o/ae7f5J6vS8lFDGm 8rD0JSWthten2g/MRripD8PBapUo2KgYtU1XEU8Fb77SLpQwPiPsTLPq/s/Q6cnrCJiY 30QQBC1Zk+d3sR2qOzzwo/fyBbCvmY+qf2Snh0+Yb4ZttrSZmHlfJ4auVn0Vo6PXR9R6 U3uizH0yi+Eba1DANoQ52ssHzOsOFDcW92JJaG6j5sUZ110Td45H5Ur8dDsgKTKq1Bt3 ReOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=3vDcswIt91EIuA9P8SnPTM5vM/j/EkT6OhDSuwRxGrQ=; b=KkgmHYokDiZE07c4+mxuyVUgTTBfzuVrn/IChq6yj5TB+fmTCw89agB3X/j/mkuZR5 HRDNMu+pUZSO544RrctanY24m2cp2UsJfD/nwiCY4vCVjXan/IZ3/JezFPrA6cXZT2EK 8W+W+jGeTcT0qntt0uVUFajrWqqzLFLxv+HarLAJ3pNvRtge2JP+Ve3ZxMi6BQeWLQJf g0XnP2igynNJVKf7D7Lz5KH99sqeUzsi9YP10JRQg8pK/UBDpeM25zY3auJvjZydsb0P OWa/buZ7ZIOgJpVtKcOVyOC3NvZiPPbES0z/SEqfdn5zGKOow9udJ6ujexLDoOux1Nyg CHfw== X-Gm-Message-State: AN3rC/6FUg4X1pIh1Nbd/jhAq+e+97xQ+H4+bo4oxJe+L+ci8VTwJnat tg4a5gxwgZsUwQ== X-Received: by 10.28.223.84 with SMTP id w81mr673283wmg.32.1493439133382; Fri, 28 Apr 2017 21:12:13 -0700 (PDT) Received: from twisty.cin.medizin.uni-tuebingen.de (cin-11.medizin.uni-tuebingen.de. [134.2.118.242]) by smtp.gmail.com with ESMTPSA id c37sm10163688wra.16.2017.04.28.21.12.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Apr 2017 21:12:12 -0700 (PDT) From: Mario Kleiner To: nouveau@lists.freedesktop.org Subject: [PATCH] drm/nouveau/fb/gf100-: Fix 32 bit wraparound in new ram detection Date: Sat, 29 Apr 2017 06:11:30 +0200 Message-Id: <1493439090-26510-1-git-send-email-mario.kleiner.de@gmail.com> X-Mailer: git-send-email 2.7.0 Cc: bskeggs@redhat.com, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP A missing u64 cast causes a 32-Bit wraparound from 4096 MiB to 0 MiB and therefore total 0 MiB VRAM detected if card has 4096 Mib per FBP. Signed-off-by: Mario Kleiner Reviewed-by: Karol Herbst --- drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgf100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgf100.c index 53c32fc..c639759 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgf100.c @@ -589,7 +589,7 @@ gf100_ram_ctor(const struct nvkm_ram_func *func, struct nvkm_fb *fb, nvkm_debug(subdev, "FBP %d: %4d MiB, %d LTC(s)\n", fbp, size, ltcs); lcomm = min(lcomm, (u64)(size / ltcs) << 20); - total += size << 20; + total += (u64) size << 20; ltcn += ltcs; } else { nvkm_debug(subdev, "FBP %d: disabled\n", fbp);