Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3772412pxk; Tue, 8 Sep 2020 01:59:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAt50nCipjQkcRxzbGcX5b4ZMEQpwBg2RIzqkAqn9tB7B4sxx0+XTrS1AvBO3oOsvgJ6ez X-Received: by 2002:a50:ab1d:: with SMTP id s29mr27060518edc.246.1599555541008; Tue, 08 Sep 2020 01:59:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599555541; cv=none; d=google.com; s=arc-20160816; b=U35dyL8t6ak5HOrzsVemzKM3yAA3oWsLyv424oFiDqgFX3XJQOnKhGdSjfEm2be7qQ nzoc+QjETCw/sGnZI3QO8m/eNpkvU+nFm+NqfOWtv4noxVkzU34Rj4e7bwPGYsYIi9nD PWk5keOHx2EHaLs9Lvmo9P7Axkc256Plg/QeB32kKA9EoDKtxkbCAlFB3SIf+eBqXrxu hfOhZOWzFnUSt0hVejL9rjHBplsSV11XSnusuA+8oRZX94UDqYyg4rERLwaEeY6JYL0l 6BmHWWXvX6tNWkI+rBBTzxD8ApMknfJ3bpo5xG1Nur1Su3ppGZ9t40djO0+w/uUOBm8V grZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:dkim-signature; bh=lPf7+5yaWPR4Bsu29CBYqFns/59BDsvYdpze1XOObUQ=; b=HgqFOhAacBVyeAnFOQBAeDHVPngtoijXJ8L9XB+fYPbosYCGDNExa6qGRqGwA3833b fK4Uyzt/Xw9C1IYfUvbPmkLA62ITquxw7y+ZuV7aniB/h+ScGm3pWfBkIK/yXWzGQFJQ kLGbnSeojW8dKAIlzyT0KrLeIKwNLNnYwCstJY4YoofnSJ+SpAy4ERMvTwFIRKEXRdQ5 xSpQ6SB0sZF2Yc9ysVm5LJ1DEwEw6n9jrhoswwAy9w1N6fD+oVTgZQJSdr0WN/5kAhla 3B9AJrjvAPf4EW1wHhW1eghi+5KJSoZbbbjezy4RE8ReDdNPMyl76al9RiT8uAXsVoGX VhHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=PGlAHISs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w24si11040984ejq.224.2020.09.08.01.58.38; Tue, 08 Sep 2020 01:59:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=PGlAHISs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729252AbgIHIzz (ORCPT + 99 others); Tue, 8 Sep 2020 04:55:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728948AbgIHIzu (ORCPT ); Tue, 8 Sep 2020 04:55:50 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A141C061756 for ; Tue, 8 Sep 2020 01:55:49 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id a65so16439929wme.5 for ; Tue, 08 Sep 2020 01:55:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=lPf7+5yaWPR4Bsu29CBYqFns/59BDsvYdpze1XOObUQ=; b=PGlAHISsJbb/iYgixfJKVAK0d3OOuP3SlP2TjTpoK/oyd/DkyWjQ7j9CtU74WPEw0A NkxDuWQKM4W+M6eiE0fRmROTwl4OHi/jQ6z3R8Ikhb+ljBKxuSnOMNBFuSVwV7AkQa34 kBB3vAMyk0pYZpn9c7JUOZ/xI0bfjYSUvtffY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=lPf7+5yaWPR4Bsu29CBYqFns/59BDsvYdpze1XOObUQ=; b=O7DVOI/7QkG0mCdhBcie3FOMZ0SmphX8Ah4KAfYidc7SjVMIjcdrklM3ZvpUQCo2ke IHf2LsRqv7UAC8qU5jPeD1Za4HpEwe5cFaZqkv+Vqo84iRo9uOA7YHcAFp1Y0P/+cx1a YruUKKJIvATCf0FH6nV2vEpCHA+NVHlNKAlkrkdBCcrw/F/aqFbTtUgpYmJbdI2d5vm8 M0Ag5kU02Nn/s2hdUHlQk5jCkCvQ+0uL1/FJXdPCMT7zI+72nECMiNRiKkU5N28/7Vpt Jw53rzi6yYZl+SEzfD7/ZZ/nPqBYgTP+y1j6KrkjdXz5F6o1UQECVrxvpLQSuCyQPWaV tj5g== X-Gm-Message-State: AOAM5326rheC13QuPS478VP5Dv7y9stSGEVcITdmzF99KN2qA8LCeTR4 ZDDTMVaPmf7MQnAa3X8GFEJvow== X-Received: by 2002:a1c:e256:: with SMTP id z83mr3369682wmg.33.1599555347784; Tue, 08 Sep 2020 01:55:47 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id l10sm30834268wru.59.2020.09.08.01.55.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 01:55:47 -0700 (PDT) Date: Tue, 8 Sep 2020 10:55:44 +0200 From: Daniel Vetter To: Gerd Hoffmann Cc: Daniel Vetter , dri-devel , Christian =?iso-8859-1?Q?K=F6nig?= , Alex Deucher , David Airlie , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Lucas Stach , Russell King , Christian Gmeiner , Rob Clark , Sean Paul , Ben Skeggs , Sandy Huang , Heiko =?iso-8859-1?Q?St=FCbner?= , Thierry Reding , Jonathan Hunter , Oleksandr Andrushchenko , "open list:RADEON and AMDGPU DRM DRIVERS" , open list , "moderated list:DRM DRIVERS FOR VIVANTE GPU IP" , "open list:DRM DRIVER FOR MSM ADRENO GPU" , "open list:DRM DRIVER FOR MSM ADRENO GPU" , "open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS" , "moderated list:ARM/Rockchip SoC support" , "open list:ARM/Rockchip SoC support" , "open list:DRM DRIVERS FOR NVIDIA TEGRA" , "moderated list:DRM DRIVERS FOR XEN" Subject: Re: [PATCH v4 1/1] drm: allow limiting the scatter list size. Message-ID: <20200908085544.GI2352366@phenom.ffwll.local> Mail-Followup-To: Gerd Hoffmann , dri-devel , Christian =?iso-8859-1?Q?K=F6nig?= , Alex Deucher , David Airlie , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Lucas Stach , Russell King , Christian Gmeiner , Rob Clark , Sean Paul , Ben Skeggs , Sandy Huang , Heiko =?iso-8859-1?Q?St=FCbner?= , Thierry Reding , Jonathan Hunter , Oleksandr Andrushchenko , "open list:RADEON and AMDGPU DRM DRIVERS" , open list , "moderated list:DRM DRIVERS FOR VIVANTE GPU IP" , "open list:DRM DRIVER FOR MSM ADRENO GPU" , "open list:DRM DRIVER FOR MSM ADRENO GPU" , "open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS" , "moderated list:ARM/Rockchip SoC support" , "open list:ARM/Rockchip SoC support" , "open list:DRM DRIVERS FOR NVIDIA TEGRA" , "moderated list:DRM DRIVERS FOR XEN" References: <20200907112425.15610-1-kraxel@redhat.com> <20200907112425.15610-2-kraxel@redhat.com> <20200908054858.um34wojjv6uhi7d3@sirius.home.kraxel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200908054858.um34wojjv6uhi7d3@sirius.home.kraxel.org> X-Operating-System: Linux phenom 5.7.0-1-amd64 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 08, 2020 at 07:48:58AM +0200, Gerd Hoffmann wrote: > On Mon, Sep 07, 2020 at 03:53:02PM +0200, Daniel Vetter wrote: > > On Mon, Sep 7, 2020 at 1:24 PM Gerd Hoffmann wrote: > > > > > > Add drm_device argument to drm_prime_pages_to_sg(), so we can > > > call dma_max_mapping_size() to figure the segment size limit > > > and call into __sg_alloc_table_from_pages() with the correct > > > limit. > > > > > > This fixes virtio-gpu with sev. Possibly it'll fix other bugs > > > too given that drm seems to totaly ignore segment size limits > > > so far ... > > > > > > v2: place max_segment in drm driver not gem object. > > > v3: move max_segment next to the other gem fields. > > > v4: just use dma_max_mapping_size(). > > > > > > Signed-off-by: Gerd Hoffmann > > > > Uh, are you sure this works in all cases for virtio? > > Sure, I've tested it ;) > > > The comments I've found suggest very much not ... Or is that all very > > old stuff only that no one cares about anymore? > > I think these days it is possible to override dma_ops per device, which > in turn allows virtio to deal with the quirks without the rest of the > kernel knowing about these details. > > I also think virtio-gpu can drop the virtio_has_dma_quirk() checks, just > use the dma api path unconditionally and depend on virtio core having > setup dma_ops in a way that it JustWorks[tm]. I'll look into that next. The comment above vring_use_dma_api() suggests that this has not yet happened, that's why I'm asking. If this has happened then I think it'd be best if you remove that todo entry and update it, as part of the overall series to add dma_max_mapping_size and remove the quirks. Otherwise this all is a bit wtf material :-) -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch