From patchwork Thu Aug 8 22:21:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring \(Arm\)" X-Patchwork-Id: 170866 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp9165182ile; Thu, 8 Aug 2019 15:22:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzqiZ/aNypDfOlekjR8Ng1FA7NaKHDrDUl7Za155BkeVp6+4XkxIzW73Ziwd9lvGHZ2WpiE X-Received: by 2002:a17:902:aa41:: with SMTP id c1mr15780156plr.201.1565302929086; Thu, 08 Aug 2019 15:22:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565302929; cv=none; d=google.com; s=arc-20160816; b=WHGI1l+3DzouRJtA0A8FOPRQ7Vqgml6wMh6tbho0eTuE9RxMwLdq2erhEdSlFGOfde dN7XE06x7iCxh35a7yD1Un8BwU8xEs72RcxkexthmNxCE5Lb6qKR49hwlyI7CAyFUTmM u4RUfKBi3JaUUfT5AwDLqTfdsVffbTHcO3EApoiBj+eU8tnuk+/dKsYXFKmtZkuiZcyK Si7NRt65yuym8AFBjbpN1PUfO7zb7LK64NnFZq16vDc2eZHwF/tiHqWNImcTwqDIa9L4 0HD0WTjQnfgsFmmn9mfLr3EfSekWpkkVe3S8dC/x+1c+Ltn1xVJuIqG1nePuk8cV6C1S MgSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to; bh=S9pFbrG9QU871bkAhbR+T6iE3jCBamQbHsmjO3LfTZw=; b=x3pzl0CRkVDxpR7l+9MSPCRmdHcqUvOR7MpBILkPd4l4TtNIf5yvGLL0jFwOuJ9KTR KutAstvMJynlyWoi+wov9WnGjjsN3WhUuNMEmW+TI1UsDjkWdq02kAJQJFGpP0/ky7PM ECUvybF70ipMSXP7wbC20GBebd1eMj15yLdRayYrcX990tV0r7Q7rI326wm7CBL1lw9b q8todV566tniigrBgpWlb00uOUuxZ6rT+5C6oIZ3STTxGgP/+flEIhewV+srCsN0qEIc jxykdaQOvD74ebG0TFclZVubq8yQ+9mSbGdG/LP4GDsiit4FySJmBU5oyNaLert5idHg Vd+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id a6si48450926pla.259.2019.08.08.15.22.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Aug 2019 15:22:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9E12D6ECCD; Thu, 8 Aug 2019 22:22:06 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ot1-f65.google.com (mail-ot1-f65.google.com [209.85.210.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 78CAA6ECCD for ; Thu, 8 Aug 2019 22:22:04 +0000 (UTC) Received: by mail-ot1-f65.google.com with SMTP id l15so67857730oth.7 for ; Thu, 08 Aug 2019 15:22:04 -0700 (PDT) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=T+bEnEpkz+ZRgimT11B8n1cZQnPJ56dXCRl4mSO81UA=; b=k0vUGxpn8egUs7jS0u4o3GPbRo29eUVz3PfW4wM0q0Nwtfqyix/e+7t01OhB+NUBWk EDcCWW8/WRO1mHIH7/22TDD1nC72G+VhFGcopKJQxX9ltcfon6iiaJ3447UdOPYnho0z SyHQWIrY/WpJPZWAZ02nDLcKFGfOPvAiQgifEnEaqbJdN+6W8ihk+UVxK4JL8GkGX3AR xQBoHfzdR/+83xffbByc8+oppGoPXUIoGu9bDT3ZRb2Hj4kMtGL/GeDhRnB+JosnOc+Q /G1iHcDNL5w9W7SQEKm+NN3GafxmJEfRX+qtJe4SSIJhv8Bn8zZG76hhCSS8B4I/7r7f 4gbg== X-Gm-Message-State: APjAAAUCI8zRa4YtKeiZbGgXv/v7CYZnE/BPnJb3Le+mVHybudChLk16 Im+mUIV9xb+wQpqo9s2qbGBVTF8= X-Received: by 2002:a5d:924e:: with SMTP id e14mr16640982iol.215.1565302923477; Thu, 08 Aug 2019 15:22:03 -0700 (PDT) Received: from xps15.herring.priv ([64.188.179.254]) by smtp.googlemail.com with ESMTPSA id i4sm118528553iog.31.2019.08.08.15.22.02 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 08 Aug 2019 15:22:03 -0700 (PDT) From: Rob Herring To: dri-devel@lists.freedesktop.org Subject: [PATCH v4 1/9] drm/gem: Allow sparsely populated page arrays in drm_gem_put_pages Date: Thu, 8 Aug 2019 16:21:52 -0600 Message-Id: <20190808222200.13176-2-robh@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190808222200.13176-1-robh@kernel.org> References: <20190808222200.13176-1-robh@kernel.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomeu Vizoso , Maxime Ripard , Robin Murphy , Steven Price , David Airlie , Boris Brezillon , Alyssa Rosenzweig , Sean Paul Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Panfrost has a need for pages allocated on demand via GPU page faults. When releasing the pages, the only thing preventing using drm_gem_put_pages() is needing to skip over unpopulated pages, so allow for skipping over NULL struct page pointers. Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Sean Paul Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel@lists.freedesktop.org Reviewed-by: Steven Price Acked-by: Alyssa Rosenzweig Signed-off-by: Rob Herring --- drivers/gpu/drm/drm_gem.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index afc38cece3f5..a2dd198177f2 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c @@ -633,6 +633,9 @@ void drm_gem_put_pages(struct drm_gem_object *obj, struct page **pages, pagevec_init(&pvec); for (i = 0; i < npages; i++) { + if (!pages[i]) + continue; + if (dirty) set_page_dirty(pages[i]);