Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp409115ybb; Wed, 25 Mar 2020 02:09:47 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv/9SoPHJF1SIR/umO5jrkKxM+smemQtReF6BiV+Nf8jpB87QvwBSugszXb51DyOMkjjMZQ X-Received: by 2002:a9d:480b:: with SMTP id c11mr1647053otf.109.1585127386782; Wed, 25 Mar 2020 02:09:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585127386; cv=none; d=google.com; s=arc-20160816; b=NQtd0jMOmXfA/R6XlEVSK7Zz45lXlulkKqNZ99phBbS9KXKLww2oL/QePlSnOr/5W9 ysOe2Nrso7il7pn0UTx/X1kGJUCTXtRt5qhirkLAjwFlN1BRoLAgS5pW4BYy8HuWjIMi XjB7A7Y7w1vP7OkEEsRBldRKBXS+q+j9iEHsoV4XjK8WZF4vyILd/BIWdCg7vVqVWhGz Om3KMVHWqEhxgptr8arqR6FbCcfif0qKeHfcrAvvRdyXPvQIFJwFgkoKBS+lsMOAuvk2 m98IV+LUP71ZzkZeI0hFTDKT63n0c3aWlGPF0PEZVuAHKTlzcuyCHQFAdxDNcEgekuED Vzng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eVp8N3Y86PwDON5iNLeFPoqqE59j/nJ6HOnpicwvFYw=; b=QQVBTgVn48jM9H1U7mTR/o/9YEQM4Khm5rLvIjdD40AsEflqB4/CAMpudA99heEJNE seNK3bSRWvOhsEmafvD82CCnzZLVP6DJ/PMxSdzOa1UIjfJgt6ylGr6oy0auv6vInvrG poXXbeH0o4r3vct1/EsF9v4tAVkMFEd3ISw2+ncKDA3RIhJz6rc7pft2ulXY0tCTCqH9 CVspKDJDzGxZUaZVqkPbvq5O8z7rxQDOw8OVGp7KrusSo136HS7P14IP048bAHAPGd/1 z5qYJrrfYR5zWNZMpj8k4C99h79rdAj8Q3CTlZWIYuTbWVrolEFWRBGxJGYlGNbK3C7o aqPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=b7M9444M; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y5si10306273oiy.150.2020.03.25.02.09.34; Wed, 25 Mar 2020 02:09:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=b7M9444M; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727542AbgCYJIq (ORCPT + 99 others); Wed, 25 Mar 2020 05:08:46 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:37759 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727518AbgCYJIo (ORCPT ); Wed, 25 Mar 2020 05:08:44 -0400 Received: by mail-wr1-f68.google.com with SMTP id w10so1909580wrm.4 for ; Wed, 25 Mar 2020 02:08:43 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=eVp8N3Y86PwDON5iNLeFPoqqE59j/nJ6HOnpicwvFYw=; b=b7M9444MjNBuwc+NdupdV9NJBwXQmDDARdLnAWQRPZCwEKEdoKmEkTMN6rTzkSq/Ev lA0tnWa51Jfc+72oCbnIyrp2Miipc74i4YZijLG7bRgYce7Wgf9kcUy0T96vgZvj8Y5x Pt+MKZX/HcMv27OjVADXuMnSaFlbxTxNv6fXGNarX2vX+DWos9GPnOn8U3QiTgXb43k8 xZrRgAAunCi137t8E7cQOYrtgEI1EIxjkXRdQ18JbkhqQHhZtik6nWSHP/JYh6GVoHRX 0TlR+cdjgoWhrD7oZ2sdk0fIZzoP72LORQ0OO2jBSBixFazDVHI59oLu3HQP1yk1z9OA nc9A== 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=eVp8N3Y86PwDON5iNLeFPoqqE59j/nJ6HOnpicwvFYw=; b=dqmFwnxMWK7CRG0OpxrjVs9x0odppV3hZPce54aklhKUqXdnq5O90Tc6tF8P4U0btd 6OKxUtbKYHI16gfNxC3LHSnzPxxq7QAjwDMd8Rzpu/ov8wiBZoIhqxho+bdmBdnstIWC UAVV+IkKdZd2/op761jIEjuRE9OfReHAxwBCPqjEoPPTDX/xqU6DRsAfIc4pu1nDoSVy QckVNfbU0K3HMrDR6wTInB8D6VvpPokB5nYzvn2tz2KptdiP/lPBcj8NPCesH5yISKy1 4F8hni8HEDKPlylxf1wKYgte1DUpSabYEeJ9iH1v5Vjgrt1R79kY1qbu7yCF9rLntGDu eKPQ== X-Gm-Message-State: ANhLgQ3X5MxSPzAkY3nUiV9pWfLkLlOIHBHuzAQOTKHrhZQo/D4EDDy0 gn+8qHNtLO2013Ab2u+Xt7Y= X-Received: by 2002:adf:e6c8:: with SMTP id y8mr2183980wrm.279.1585127323079; Wed, 25 Mar 2020 02:08:43 -0700 (PDT) Received: from wasp.lan (250.128.208.46.dyn.plus.net. [46.208.128.250]) by smtp.googlemail.com with ESMTPSA id 127sm8565048wmd.38.2020.03.25.02.08.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Mar 2020 02:08:42 -0700 (PDT) From: Shane Francis To: dri-devel@lists.freedesktop.org Cc: amd-gfx-request@lists.freedesktop.org, linux-kernel@vger.kernel.org, bigbeeshane@gmail.com, alexander.deucher@amd.com, christian.koenig@amd.com, mripard@kernel.org, airlied@linux.ie, David1.Zhou@amd.com Subject: [PATCH v4 3/3] drm/radeon: fix scatter-gather mapping with user pages Date: Wed, 25 Mar 2020 09:07:41 +0000 Message-Id: <20200325090741.21957-4-bigbeeshane@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200325090741.21957-1-bigbeeshane@gmail.com> References: <20200325090741.21957-1-bigbeeshane@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Calls to dma_map_sg may return segments / entries than requested if they fall on page bounderies. The old implementation did not support this use case. Signed-off-by: Shane Francis --- drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index 3b92311d30b9..b3380ffab4c2 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c @@ -528,7 +528,7 @@ static int radeon_ttm_tt_pin_userptr(struct ttm_tt *ttm) r = -ENOMEM; nents = dma_map_sg(rdev->dev, ttm->sg->sgl, ttm->sg->nents, direction); - if (nents != ttm->sg->nents) + if (nents == 0) goto release_sg; drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages, -- 2.26.0