From patchwork Fri Dec 23 14:57:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9487491 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 03345601D7 for ; Fri, 23 Dec 2016 14:58:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E87A325D9E for ; Fri, 23 Dec 2016 14:58:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC04026212; Fri, 23 Dec 2016 14:58:41 +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_SIGNED, 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 A965625D9E for ; Fri, 23 Dec 2016 14:58:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CB6976E06A; Fri, 23 Dec 2016 14:58:35 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wj0-x242.google.com (mail-wj0-x242.google.com [IPv6:2a00:1450:400c:c01::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 83D276E069 for ; Fri, 23 Dec 2016 14:58:16 +0000 (UTC) Received: by mail-wj0-x242.google.com with SMTP id hb5so7397215wjc.2 for ; Fri, 23 Dec 2016 06:58:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=p+RdTcvNUCqqTkQxO96b598kkc4NkEOBIy0f9ScoXOo=; b=rxU8wxF/lnglPtDVAtT46K+SF3HjYNNFKKDrvuCMxnLXA/+h+ZtKZfqYZ5Wq7xVJog LCQUsft/gxu/3Z2s1mMXGU2j0KBOto66bidkqwXpgmVQhulMUcvY1cXZqfLmR5aObtY+ 24CekjnZ7w9Tk076sUoRD3/+jk7LbB3x/k3+TPBQ0fMNGYZ9XxQgO8kzV/i9yUqCQDJZ A7dr6LN7BD+XWiVx9gKrvGsCwKEYj4ONDpnO3lD2doeuAJa2Y5jKynie5rxhlp2x/QMQ E8KUxpOhnug4YXpK7J2gTo1yV5bAkB/femd+KSfBXA9cfmFdUJqKK0ZiKSBqxz8OmptU jZag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=p+RdTcvNUCqqTkQxO96b598kkc4NkEOBIy0f9ScoXOo=; b=MWK7ioh5+7P2VG4lf0JNsBw1hZ52Wdxu63yCIOrfL+wpgR7eOno1wscaa65KUjIV6G 5FmA9KSDVmtvelBt7R/opAU91rRy1t8XtipVnkDC+7nFqAD3fbuoE0FOPVWhJQdg6DMG cpL0zwS7CTCtfeaPf9G/sIDswhqsznhUlB/dBm0E63YMNMPyu/4awQMAox5OAgKxVEfV FHWIap6pdzaunRv4TsnDkXna0zoN0XQw9ztOXZU0eSb/pQp3rqLJc8mI+MhQidEewHKW FOJrzVYn3koPiE30SObWfkEPUpKj8bBgsMPA13MavPPtTxWJmrrbtVQB5vtAAO10qa2A pVqQ== X-Gm-Message-State: AIkVDXIQosLw8gf+Ky5H1ldzyjgP71HRQ8Fs/m307NE0JxPGjadt7AL8L6vYMg0JmEU+dA== X-Received: by 10.194.109.42 with SMTP id hp10mr13711175wjb.167.1482505093513; Fri, 23 Dec 2016 06:58:13 -0800 (PST) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id i15sm40786462wjs.16.2016.12.23.06.58.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Dec 2016 06:58:13 -0800 (PST) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 23 Dec 2016 14:57:59 +0000 Message-Id: <20161223145804.6605-5-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20161223145804.6605-1-chris@chris-wilson.co.uk> References: <20161223145804.6605-1-chris@chris-wilson.co.uk> Subject: [Intel-gfx] [PATCH 05/10] drm/i915: Assert that the partial VMA fits within the object X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP When creating a partial VMA assert that it first fits with the parent object, and that if it covers the whole of the parent a normal view was created instead. Signed-off-by: Chris Wilson Reviewed-by: Joonas Lahtinen --- drivers/gpu/drm/i915/i915_vma.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c index fd75d5704287..868d061e1a11 100644 --- a/drivers/gpu/drm/i915/i915_vma.c +++ b/drivers/gpu/drm/i915/i915_vma.c @@ -95,8 +95,13 @@ __i915_vma_create(struct drm_i915_gem_object *obj, if (view) { vma->ggtt_view = *view; if (view->type == I915_GGTT_VIEW_PARTIAL) { + GEM_BUG_ON(range_overflows_t(u64, + view->params.partial.offset, + view->params.partial.size, + obj->base.size >> PAGE_SHIFT)); vma->size = view->params.partial.size; vma->size <<= PAGE_SHIFT; + GEM_BUG_ON(vma->size >= obj->base.size); } else if (view->type == I915_GGTT_VIEW_ROTATED) { vma->size = intel_rotation_info_size(&view->params.rotated);