From patchwork Fri Aug 2 19:51:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 170445 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp1223054ile; Fri, 2 Aug 2019 12:51:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqyok5rnJqHcjL+rN/HzS//hUT4WIkhAGZsZVnAGSHffGOGg33KTjoAs60pPu2knNRYdY/8a X-Received: by 2002:a17:90a:8c0c:: with SMTP id a12mr5849246pjo.67.1564775518870; Fri, 02 Aug 2019 12:51:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564775518; cv=none; d=google.com; s=arc-20160816; b=B3HzjvAnI/tkW4si9OA4Dw9VAfbLbu9MXOE8sHKxsgXs3E01aaXdVQvpxnpl1taOl0 blcaS15QqEywFBGeqPsKKhLkATjyx8cS25/VhYVP6QQsUCcnd6GOwOL1plcpX3wUxEzY VoJh6T9rkjrpYSGy11PetIpTs57dYibyVsCGUBhHSfKq68dJlYilRDkc01Ktyy/inLqd y4fAmkzRcZfwYenR3J/asxtBDtpnGhLPhGjR01XqabxHDFEm6KW2DFWRFWnMYMjA1a4H u+lkx9LGEnmjEQT0fESUcF5JTeub97aH6DnDgxFSmvGU15Tdf01X5k04/nf0aRNv6Rl4 HtAw== 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=p69VusyH6Lz5s8Hvk421lhlfBM2CXGP3pyayg0dgues=; b=Ej4AVddOULhBeRdU3lPYQHMTPti6iqtM6KsUVgNWTRl4g1kXzE1zldi5Xc6zVhpC9u fkR4ou6w+ZAZV/Zz+D1Rlc0HQ4myi+hpYtaQJsIYJTReZObXMcbmBWlyjkmx/XdrGdQA rXRjbVDt1VpKWO2kUOkeSXM8KpLe91k+SbSnRxShwVJ9bZzjVdBvPEJFpt4B13cG0GFR IjbJ2i8egoLVpmF7IuR2zaV/5nDRpc6no0qZdseCNpwuaQQvihaV6jiYQbTtCrfJ+fbL qwEDKzqCNbvREpc5h3nTxmfsQr8k1ChVZDnA+W7HpTWLWZaPkLu0pYJ3V8I3aJ7eZqqE L/lA== 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 c12si5210676pgq.148.2019.08.02.12.51.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Aug 2019 12:51:58 -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 3EADF6E5BB; Fri, 2 Aug 2019 19:51:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id BC5356E5BB for ; Fri, 2 Aug 2019 19:51:54 +0000 (UTC) Received: by mail-io1-f65.google.com with SMTP id g20so154705157ioc.12 for ; Fri, 02 Aug 2019 12:51:54 -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=3p4cBswFFRoKy6tEpknmdkGW5IPNEAcVsUIZqRHEvng=; b=ImfLIJuNGazzxPJ0pHHSu8rCY98jzTP1xZA9DPSMxAkG6SUp5HviR5xY8vORaGk68k G5xMBtCjnnAi++pKzlM5rGAjZX3TuICnfOy/CHNDjZsohCKXUtwfMpwi+t/tNPhoFGj8 ytxzIUliwzOnyk9Dh+akBdA63zULgJmHuRbYbHN+VuyStNgvDCHG2mmHGOG9UGp3Vi0l GaHfbQEP7hQDT0Ojo5pBDvMpfxte4DmDf7sGcLx5kCVIzdmKmAGkkhwEkpQD77vHyDOv emGHJjtnfrxN06XAw7c85EZ2QIlEcbAYolQFgS439Pu/1Lxqne/DXcLY3P8PfyJVNizS 7rLQ== X-Gm-Message-State: APjAAAVxRV9hCQfIGFBQ9FTCedkkv38tcXxnN+CSCgLl81+vb5KzKEQH BRV6pekKWAu2q5Epe2cepqCqE7Q= X-Received: by 2002:a02:b016:: with SMTP id p22mr56289915jah.121.1564775513702; Fri, 02 Aug 2019 12:51:53 -0700 (PDT) Received: from xps15.herring.priv ([64.188.179.254]) by smtp.googlemail.com with ESMTPSA id s4sm98419934iop.25.2019.08.02.12.51.52 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 02 Aug 2019 12:51:53 -0700 (PDT) From: Rob Herring To: dri-devel@lists.freedesktop.org Subject: [PATCH v3 1/8] drm/gem: Allow sparsely populated page arrays in drm_gem_put_pages Date: Fri, 2 Aug 2019 13:51:43 -0600 Message-Id: <20190802195150.23207-2-robh@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190802195150.23207-1-robh@kernel.org> References: <20190802195150.23207-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 , Sean Paul , Steven Price , David Airlie , Boris Brezillon , Alyssa Rosenzweig , Robin Murphy 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 243f43d70f42..db373c945f16 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]);