Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp3938182ybf; Tue, 3 Mar 2020 16:14:33 -0800 (PST) X-Google-Smtp-Source: ADFU+vvOZl0tKUWYEJOXAU7B1xgxLn3q94O3ykz23TKSC7fQEcZYbC/fAT0COtz7Wo2v4ZY8Pt/H X-Received: by 2002:aca:afc8:: with SMTP id y191mr65830oie.26.1583280872984; Tue, 03 Mar 2020 16:14:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583280872; cv=none; d=google.com; s=arc-20160816; b=0FYDcaGKsJnXJdqa7p330zTC5MJgDIyRA9SodoStk4pXITmn/LyiQi+bXsDFlQgVG5 g3KO4I6qslOtpMgtsGlpQsFfmHMZKL0wiGoklOEk546rlCekbNPz5MlMKfmQ7wYAET+V GkdblwcMoCKpcPpe0Y1hlJEHeSfK1OG6Fo11wpGfpL23YmRgBgosJtCOyLHEjljCWaTS Tt/Pq5ygMgoVWVs3ZQCgz2mNfFpt/HyQEjK9ERfZ4xQWEzN1g+q9Egwi+PPT5izm3dDM ipnW6oYi8/VnGiERwk1Z+EwckZm2ybkvd1BmNDcv4+Zb00yfbZzlEtpLAiRSNj0hLotR bWBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=0xBoXNdw36zdi+oexlXq9iRpMr1fMPzGbKsYihdGgx4=; b=j9XxtI8yaxJypNxlWROrCYotD5cCAkvJ470YyjwmzM4nxRuSbmZ4eH87qx6mun4Bok yQoIGgbZmfOzHmSpOjN/Nxel/zmYaMSpQrTKBIQj2fYJUca+BTueRIG3WIFVDue2E2iI LUIaLiqvO5v4A9NTON911qJbNMFSTfS/ySD6olYs4gqEdreuf78ZIU/CySEYMTqIowB+ ZJX4posk5lPCqgvRrkjGqR/Q5x/lOsXRfVOmqIadQXn2Nt+j3exwnzB0hjfdG+n1ooa7 eJSVMVvPizbMOCFV5YUbJ75CYcAfrjzDfajiYUa7i8IRXEyM8E3V30GJvXsJBOkwVNNy OX6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=XfgFUH9T; 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=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h9si121750otk.170.2020.03.03.16.14.21; Tue, 03 Mar 2020 16:14:32 -0800 (PST) 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=@nvidia.com header.s=n1 header.b=XfgFUH9T; 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=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728327AbgCDAOJ (ORCPT + 99 others); Tue, 3 Mar 2020 19:14:09 -0500 Received: from hqnvemgate26.nvidia.com ([216.228.121.65]:15449 "EHLO hqnvemgate26.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728140AbgCDAOH (ORCPT ); Tue, 3 Mar 2020 19:14:07 -0500 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 03 Mar 2020 16:13:53 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Tue, 03 Mar 2020 16:14:07 -0800 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Tue, 03 Mar 2020 16:14:07 -0800 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 4 Mar 2020 00:14:03 +0000 Received: from rnnvemgw01.nvidia.com (10.128.109.123) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Wed, 4 Mar 2020 00:14:03 +0000 Received: from rcampbell-dev.nvidia.com (Not Verified[10.110.48.66]) by rnnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Tue, 03 Mar 2020 16:14:03 -0800 From: Ralph Campbell To: , , , , CC: Jerome Glisse , John Hubbard , Christoph Hellwig , Jason Gunthorpe , "Andrew Morton" , Ben Skeggs , "Ralph Campbell" Subject: [PATCH v3 2/4] nouveau/hmm: check for SVM initialized before migrating Date: Tue, 3 Mar 2020 16:13:37 -0800 Message-ID: <20200304001339.8248-3-rcampbell@nvidia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200304001339.8248-1-rcampbell@nvidia.com> References: <20200304001339.8248-1-rcampbell@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public Content-Transfer-Encoding: quoted-printable Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1583280833; bh=0xBoXNdw36zdi+oexlXq9iRpMr1fMPzGbKsYihdGgx4=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:X-NVConfidentiality: Content-Transfer-Encoding:Content-Type; b=XfgFUH9Tk+atQQftWclcctJpBwUAfYF2j5ty2Mea930/qWVISDDiPyGXHOvllUFWm 3zdlYDJdKrexCxDldPaXaHUi9gRo1hEo7IbYXL9tEBQDyjDS3Sl/Q8TO0jay+txNRb abqKn+TRhne7BH8nIteK4k5Lk1+2XnU6ImnwQpcL7pnwBC81ehYlsFA5ySq+QNHQ57 RtDeEPZ5BsbXbedgwtxKaYcso7iVPkc6b8xR5REsaz8PWDsVl/b9fWb5aexJWEodP2 S15s0I6xbAI7Ze1SGlGmbnc1CmAt0RlumY7vtL0MTmjFKYsMGuFwvhzP90O9Az8DJe RaDjBgcYvnL1g== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When migrating system memory to GPU memory, check that SVM has been enabled. Even though most errors can be ignored since migration is a performance optimization, return an error because this is a violation of the API. Signed-off-by: Ralph Campbell --- drivers/gpu/drm/nouveau/nouveau_svm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouvea= u/nouveau_svm.c index 169320409286..c567526b75b8 100644 --- a/drivers/gpu/drm/nouveau/nouveau_svm.c +++ b/drivers/gpu/drm/nouveau/nouveau_svm.c @@ -171,6 +171,11 @@ nouveau_svmm_bind(struct drm_device *dev, void *data, mm =3D get_task_mm(current); down_read(&mm->mmap_sem); =20 + if (!cli->svm.svmm) { + up_read(&mm->mmap_sem); + return -EINVAL; + } + for (addr =3D args->va_start, end =3D args->va_start + size; addr < end;)= { struct vm_area_struct *vma; unsigned long next; --=20 2.20.1