From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5AC1FC43463 for ; Fri, 18 Sep 2020 06:07:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0AF5621582 for ; Fri, 18 Sep 2020 06:07:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="xu+0pooH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726384AbgIRGHD (ORCPT ); Fri, 18 Sep 2020 02:07:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726119AbgIRGHD (ORCPT ); Fri, 18 Sep 2020 02:07:03 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D7E9C061756 for ; Thu, 17 Sep 2020 23:07:02 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id u21so4071788ljl.6 for ; Thu, 17 Sep 2020 23:07:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ILLtYDh87Hnf9dA6vVS4B7psVL7r7MTKfeGqDa+SuKE=; b=xu+0pooH8LiZDIx8k+PJPkqxKyO32tFfHElOtANSYujXsHlpbt9GYPehidVtEWjXNc /xXXU+SiXhhV3tr4L3m+CIptvYV9Y1sWjYBj8WA56yU7s/7WSQGfMxqHUrXiCP+Vkwzc rbTTOwP/FDgWbP0pNGUrmSktbFVvHDWG3Tb39PWpXuO4WsbpvOhX7D0h7hEM9jAkTZkj f08exOXNYS1HY9+Aqc9CZYVTuH+vJ+A0XrHZ1ELPpXxNrAW6ZJuG3d/8KAZK9gBIeH98 izVqAFItF/kqSVd5X+drWxPWZiRPQpKhEvFC80MCdY3cJMOzEPLjMLled+pEAcD3ztnl D6uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ILLtYDh87Hnf9dA6vVS4B7psVL7r7MTKfeGqDa+SuKE=; b=DxqMH8vo9NjjTEPUIjUZlV7qswLTFJNfbYHGgTuIHBfggJpACfXNR0++0xWA9jJO3v 3rujQANbcWFxOp1BcPQmhdFcvvnQG0FStMP4e18MVOUL5csaa5V5D1FxdXG8FvHgLP3e 5jHfMT5qeB++VP+BxEkLiGGJc+CQ2QVDo4CgLpFKsZ7wpb03GqsFE0kfCmmF570TrsAZ nL99Z+olGRgYorwnVcmJ4joX7Do8PFqhvlMViZ+Qb2pY2GwOjuNEc3/eAvwKwjgWqOxX tXeKnNZS1gfTXd9t3gUfl+3oAR5fiXAxdhoJrWic5p9KzRySsCEDe4jnNkoFMBycTHe2 UfUQ== X-Gm-Message-State: AOAM530ZSdfrJ2XjYdjqE+zDXLxQeMaWKDRSvoFnLTmHLACdAoX72IP2 eP85gLxT/xw9dXS7G40/XIjoruc+NHuAyM0M7XYd3g== X-Google-Smtp-Source: ABdhPJyEXZuLz/9VD9TgkWSbpgqwjYtEuhse8iQmZ+kvD+VMvEh/eMgZha0C2GrZshLMMBrho/gEjAYIvq4mDVItvuo= X-Received: by 2002:a2e:9496:: with SMTP id c22mr10298851ljh.249.1600409220979; Thu, 17 Sep 2020 23:07:00 -0700 (PDT) MIME-Version: 1.0 References: <20200914112521.1327-1-tzimmermann@suse.de> In-Reply-To: <20200914112521.1327-1-tzimmermann@suse.de> From: Sumit Semwal Date: Fri, 18 Sep 2020 11:36:49 +0530 Message-ID: Subject: Re: [PATCH 0/3] dma-buf: Flag vmap'ed memory as system or I/O memory To: Thomas Zimmermann Cc: Christian Koenig , Daniel Vetter , Dave Airlie , Sam Ravnborg , mark.cave-ayland@ilande.co.uk, Gerd Hoffmann , "David S . Miller" , Maarten Lankhorst , Maxime Ripard , Lucas Stach , Russell King , Christian Gmeiner , Jani Nikula , Joonas Lahtinen , rodrigo.vivi@intel.com, Thierry Reding , jonathanh@nvidia.com, Pawel Osciak , Marek Szyprowski , Kyungmin Park , Tomasz Figa , Mauro Carvalho Chehab , Chris Wilson , matthew.auld@intel.com, thomas.hellstrom@intel.com, "open list:DMA BUFFER SHARING FRAMEWORK" , DRI mailing list , Linaro MM SIG , etnaviv@lists.freedesktop.org, Intel Graphics Development , linux-tegra@vger.kernel.org, sparclinux@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org Hello Thomas, On Mon, 14 Sep 2020 at 16:55, Thomas Zimmermann wrote: > > Dma-buf provides vmap() and vunmap() for retrieving and releasing mappings > of dma-buf memory in kernel address space. The functions operate with plain > addresses and the assumption is that the memory can be accessed with load > and store operations. This is not the case on some architectures (e.g., > sparc64) where I/O memory can only be accessed with dedicated instructions. > > This patchset introduces struct dma_buf_map, which contains the address of > a buffer and a flag that tells whether system- or I/O-memory instructions > are required. Thank you for the patchset - it is a really nice, clean bit to add! > > Some background: updating the DRM framebuffer console on sparc64 makes the > kernel panic. This is because the framebuffer memory cannot be accessed with > system-memory instructions. We currently employ a workaround in DRM to > address this specific problem. [1] > > To resolve the problem, we'd like to address it at the most common point, > which is the dma-buf framework. The dma-buf mapping ideally knows if I/O > instructions are required and exports this information to it's users. The > new structure struct dma_buf_map stores the buffer address and a flag that > signals I/O memory. Affected users of the buffer (e.g., drivers, frameworks) > can then access the memory accordingly. > > This patchset only introduces struct dma_buf_map, and updates struct dma_buf > and it's interfaces. Further patches can update dma-buf users. For example, > there's a prototype patchset for DRM that fixes the framebuffer problem. [2] > > Further work: TTM, one of DRM's memory managers, already exports an > is_iomem flag of its own. It could later be switched over to exporting struct > dma_buf_map, thus simplifying some code. Several DRM drivers expect their > fbdev console to operate on I/O memory. These could possibly be switched over > to the generic fbdev emulation, as soon as the generic code uses struct > dma_buf_map. > > [1] https://lore.kernel.org/dri-devel/20200725191012.GA434957@ravnborg.org/ > [2] https://lore.kernel.org/dri-devel/20200806085239.4606-1-tzimmermann@suse.de/ > > Thomas Zimmermann (3): > dma-buf: Add struct dma-buf-map for storing struct dma_buf.vaddr_ptr > dma-buf: Use struct dma_buf_map in dma_buf_vmap() interfaces > dma-buf: Use struct dma_buf_map in dma_buf_vunmap() interfaces FWIW, for the series, please feel free to add my Acked-by: Sumit Semwal > > Documentation/driver-api/dma-buf.rst | 3 + > drivers/dma-buf/dma-buf.c | 40 +++--- > drivers/gpu/drm/drm_gem_cma_helper.c | 16 ++- > drivers/gpu/drm/drm_gem_shmem_helper.c | 17 ++- > drivers/gpu/drm/drm_prime.c | 14 +- > drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 13 +- > drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 13 +- > .../drm/i915/gem/selftests/i915_gem_dmabuf.c | 18 ++- > drivers/gpu/drm/tegra/gem.c | 23 ++-- > .../common/videobuf2/videobuf2-dma-contig.c | 17 ++- > .../media/common/videobuf2/videobuf2-dma-sg.c | 19 ++- > .../common/videobuf2/videobuf2-vmalloc.c | 21 ++- > include/drm/drm_prime.h | 5 +- > include/linux/dma-buf-map.h | 126 ++++++++++++++++++ > include/linux/dma-buf.h | 11 +- > 15 files changed, 274 insertions(+), 82 deletions(-) > create mode 100644 include/linux/dma-buf-map.h > > -- > 2.28.0 > Best, Sumit. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sumit Semwal Date: Fri, 18 Sep 2020 06:18:49 +0000 Subject: Re: [PATCH 0/3] dma-buf: Flag vmap'ed memory as system or I/O memory Message-Id: List-Id: References: <20200914112521.1327-1-tzimmermann@suse.de> In-Reply-To: <20200914112521.1327-1-tzimmermann@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Thomas Zimmermann Cc: Christian Koenig , Dave Airlie , mark.cave-ayland@ilande.co.uk, DRI mailing list , Chris Wilson , Thierry Reding , Gerd Hoffmann , sparclinux@vger.kernel.org, Sam Ravnborg , Marek Szyprowski , jonathanh@nvidia.com, matthew.auld@intel.com, Russell King , "open list:DMA BUFFER SHARING FRAMEWORK" , Pawel Osciak , Intel Graphics Development , etnaviv@lists.freedesktop.org, Linaro MM SIG , thomas.hellstrom@intel.com, rodrigo.vivi@intel.com, linux-tegra@vger.kernel.org, Mauro Carvalho Chehab , Tomasz Figa , Kyungmin Park , "David S . Miller" Hello Thomas, On Mon, 14 Sep 2020 at 16:55, Thomas Zimmermann wrote: > > Dma-buf provides vmap() and vunmap() for retrieving and releasing mappings > of dma-buf memory in kernel address space. The functions operate with plain > addresses and the assumption is that the memory can be accessed with load > and store operations. This is not the case on some architectures (e.g., > sparc64) where I/O memory can only be accessed with dedicated instructions. > > This patchset introduces struct dma_buf_map, which contains the address of > a buffer and a flag that tells whether system- or I/O-memory instructions > are required. Thank you for the patchset - it is a really nice, clean bit to add! > > Some background: updating the DRM framebuffer console on sparc64 makes the > kernel panic. This is because the framebuffer memory cannot be accessed with > system-memory instructions. We currently employ a workaround in DRM to > address this specific problem. [1] > > To resolve the problem, we'd like to address it at the most common point, > which is the dma-buf framework. The dma-buf mapping ideally knows if I/O > instructions are required and exports this information to it's users. The > new structure struct dma_buf_map stores the buffer address and a flag that > signals I/O memory. Affected users of the buffer (e.g., drivers, frameworks) > can then access the memory accordingly. > > This patchset only introduces struct dma_buf_map, and updates struct dma_buf > and it's interfaces. Further patches can update dma-buf users. For example, > there's a prototype patchset for DRM that fixes the framebuffer problem. [2] > > Further work: TTM, one of DRM's memory managers, already exports an > is_iomem flag of its own. It could later be switched over to exporting struct > dma_buf_map, thus simplifying some code. Several DRM drivers expect their > fbdev console to operate on I/O memory. These could possibly be switched over > to the generic fbdev emulation, as soon as the generic code uses struct > dma_buf_map. > > [1] https://lore.kernel.org/dri-devel/20200725191012.GA434957@ravnborg.org/ > [2] https://lore.kernel.org/dri-devel/20200806085239.4606-1-tzimmermann@suse.de/ > > Thomas Zimmermann (3): > dma-buf: Add struct dma-buf-map for storing struct dma_buf.vaddr_ptr > dma-buf: Use struct dma_buf_map in dma_buf_vmap() interfaces > dma-buf: Use struct dma_buf_map in dma_buf_vunmap() interfaces FWIW, for the series, please feel free to add my Acked-by: Sumit Semwal > > Documentation/driver-api/dma-buf.rst | 3 + > drivers/dma-buf/dma-buf.c | 40 +++--- > drivers/gpu/drm/drm_gem_cma_helper.c | 16 ++- > drivers/gpu/drm/drm_gem_shmem_helper.c | 17 ++- > drivers/gpu/drm/drm_prime.c | 14 +- > drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 13 +- > drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 13 +- > .../drm/i915/gem/selftests/i915_gem_dmabuf.c | 18 ++- > drivers/gpu/drm/tegra/gem.c | 23 ++-- > .../common/videobuf2/videobuf2-dma-contig.c | 17 ++- > .../media/common/videobuf2/videobuf2-dma-sg.c | 19 ++- > .../common/videobuf2/videobuf2-vmalloc.c | 21 ++- > include/drm/drm_prime.h | 5 +- > include/linux/dma-buf-map.h | 126 ++++++++++++++++++ > include/linux/dma-buf.h | 11 +- > 15 files changed, 274 insertions(+), 82 deletions(-) > create mode 100644 include/linux/dma-buf-map.h > > -- > 2.28.0 > Best, Sumit. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFE86C43465 for ; Fri, 18 Sep 2020 06:07:05 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 590642085B for ; Fri, 18 Sep 2020 06:07:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="xu+0pooH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 590642085B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9300B6E10B; Fri, 18 Sep 2020 06:07:03 +0000 (UTC) Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id DC7646E10B for ; Fri, 18 Sep 2020 06:07:02 +0000 (UTC) Received: by mail-lj1-x243.google.com with SMTP id r24so4087545ljm.3 for ; Thu, 17 Sep 2020 23:07:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ILLtYDh87Hnf9dA6vVS4B7psVL7r7MTKfeGqDa+SuKE=; b=xu+0pooH8LiZDIx8k+PJPkqxKyO32tFfHElOtANSYujXsHlpbt9GYPehidVtEWjXNc /xXXU+SiXhhV3tr4L3m+CIptvYV9Y1sWjYBj8WA56yU7s/7WSQGfMxqHUrXiCP+Vkwzc rbTTOwP/FDgWbP0pNGUrmSktbFVvHDWG3Tb39PWpXuO4WsbpvOhX7D0h7hEM9jAkTZkj f08exOXNYS1HY9+Aqc9CZYVTuH+vJ+A0XrHZ1ELPpXxNrAW6ZJuG3d/8KAZK9gBIeH98 izVqAFItF/kqSVd5X+drWxPWZiRPQpKhEvFC80MCdY3cJMOzEPLjMLled+pEAcD3ztnl D6uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ILLtYDh87Hnf9dA6vVS4B7psVL7r7MTKfeGqDa+SuKE=; b=YUrXSCKH4cifM/NmgERN116YR/0NYNjaPEMntS3GqhkbOBRWarO88m9AhL+a2aQZY8 KwhzmslBp5TyqyzFC8+bbi5V7D2eB5/prhOpsVk/q/IwyscV5n/f7MLJP34dqvMymFtj q5VPKM5X4YY71AhzH4hMF63berIJn3l6JixwSsT1r+7jD5r41xtgwWVd9jGRvznbKV+3 SqxhuK1gjKtUImEZsASoHXwKZ6b4Tvp7AVntyELowRhnuGmXa+p5lJSwblS8JLy/kHUz JupOd7uKg78gi+o12SXLuQfmpmoIyAI4n9Whgzx7Jk5oey93Jitg3O0FSYW4EHGzJjnN 4qcQ== X-Gm-Message-State: AOAM5331k4pSkE9z/NA0P+M0lIGLtp0sAGIwZ9Gw8gdDiTobwvaMfUXQ yb79ah/PNDlJoeXyZTqCoo5qTzYRBkpIlH7fvMqfUA== X-Google-Smtp-Source: ABdhPJyEXZuLz/9VD9TgkWSbpgqwjYtEuhse8iQmZ+kvD+VMvEh/eMgZha0C2GrZshLMMBrho/gEjAYIvq4mDVItvuo= X-Received: by 2002:a2e:9496:: with SMTP id c22mr10298851ljh.249.1600409220979; Thu, 17 Sep 2020 23:07:00 -0700 (PDT) MIME-Version: 1.0 References: <20200914112521.1327-1-tzimmermann@suse.de> In-Reply-To: <20200914112521.1327-1-tzimmermann@suse.de> From: Sumit Semwal Date: Fri, 18 Sep 2020 11:36:49 +0530 Message-ID: Subject: Re: [PATCH 0/3] dma-buf: Flag vmap'ed memory as system or I/O memory To: Thomas Zimmermann X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christian Koenig , Dave Airlie , mark.cave-ayland@ilande.co.uk, DRI mailing list , Chris Wilson , Thierry Reding , Gerd Hoffmann , sparclinux@vger.kernel.org, Sam Ravnborg , Marek Szyprowski , jonathanh@nvidia.com, matthew.auld@intel.com, Russell King , "open list:DMA BUFFER SHARING FRAMEWORK" , Pawel Osciak , Intel Graphics Development , etnaviv@lists.freedesktop.org, Linaro MM SIG , thomas.hellstrom@intel.com, rodrigo.vivi@intel.com, linux-tegra@vger.kernel.org, Mauro Carvalho Chehab , Tomasz Figa , Kyungmin Park , "David S . Miller" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hello Thomas, On Mon, 14 Sep 2020 at 16:55, Thomas Zimmermann wrote: > > Dma-buf provides vmap() and vunmap() for retrieving and releasing mappings > of dma-buf memory in kernel address space. The functions operate with plain > addresses and the assumption is that the memory can be accessed with load > and store operations. This is not the case on some architectures (e.g., > sparc64) where I/O memory can only be accessed with dedicated instructions. > > This patchset introduces struct dma_buf_map, which contains the address of > a buffer and a flag that tells whether system- or I/O-memory instructions > are required. Thank you for the patchset - it is a really nice, clean bit to add! > > Some background: updating the DRM framebuffer console on sparc64 makes the > kernel panic. This is because the framebuffer memory cannot be accessed with > system-memory instructions. We currently employ a workaround in DRM to > address this specific problem. [1] > > To resolve the problem, we'd like to address it at the most common point, > which is the dma-buf framework. The dma-buf mapping ideally knows if I/O > instructions are required and exports this information to it's users. The > new structure struct dma_buf_map stores the buffer address and a flag that > signals I/O memory. Affected users of the buffer (e.g., drivers, frameworks) > can then access the memory accordingly. > > This patchset only introduces struct dma_buf_map, and updates struct dma_buf > and it's interfaces. Further patches can update dma-buf users. For example, > there's a prototype patchset for DRM that fixes the framebuffer problem. [2] > > Further work: TTM, one of DRM's memory managers, already exports an > is_iomem flag of its own. It could later be switched over to exporting struct > dma_buf_map, thus simplifying some code. Several DRM drivers expect their > fbdev console to operate on I/O memory. These could possibly be switched over > to the generic fbdev emulation, as soon as the generic code uses struct > dma_buf_map. > > [1] https://lore.kernel.org/dri-devel/20200725191012.GA434957@ravnborg.org/ > [2] https://lore.kernel.org/dri-devel/20200806085239.4606-1-tzimmermann@suse.de/ > > Thomas Zimmermann (3): > dma-buf: Add struct dma-buf-map for storing struct dma_buf.vaddr_ptr > dma-buf: Use struct dma_buf_map in dma_buf_vmap() interfaces > dma-buf: Use struct dma_buf_map in dma_buf_vunmap() interfaces FWIW, for the series, please feel free to add my Acked-by: Sumit Semwal > > Documentation/driver-api/dma-buf.rst | 3 + > drivers/dma-buf/dma-buf.c | 40 +++--- > drivers/gpu/drm/drm_gem_cma_helper.c | 16 ++- > drivers/gpu/drm/drm_gem_shmem_helper.c | 17 ++- > drivers/gpu/drm/drm_prime.c | 14 +- > drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 13 +- > drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 13 +- > .../drm/i915/gem/selftests/i915_gem_dmabuf.c | 18 ++- > drivers/gpu/drm/tegra/gem.c | 23 ++-- > .../common/videobuf2/videobuf2-dma-contig.c | 17 ++- > .../media/common/videobuf2/videobuf2-dma-sg.c | 19 ++- > .../common/videobuf2/videobuf2-vmalloc.c | 21 ++- > include/drm/drm_prime.h | 5 +- > include/linux/dma-buf-map.h | 126 ++++++++++++++++++ > include/linux/dma-buf.h | 11 +- > 15 files changed, 274 insertions(+), 82 deletions(-) > create mode 100644 include/linux/dma-buf-map.h > > -- > 2.28.0 > Best, Sumit. _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55474C43464 for ; Fri, 18 Sep 2020 06:07:04 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0773D21534 for ; Fri, 18 Sep 2020 06:07:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="xu+0pooH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0773D21534 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6D2E56E0FF; Fri, 18 Sep 2020 06:07:03 +0000 (UTC) Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id E06B06E113 for ; Fri, 18 Sep 2020 06:07:02 +0000 (UTC) Received: by mail-lj1-x244.google.com with SMTP id r24so4087546ljm.3 for ; Thu, 17 Sep 2020 23:07:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ILLtYDh87Hnf9dA6vVS4B7psVL7r7MTKfeGqDa+SuKE=; b=xu+0pooH8LiZDIx8k+PJPkqxKyO32tFfHElOtANSYujXsHlpbt9GYPehidVtEWjXNc /xXXU+SiXhhV3tr4L3m+CIptvYV9Y1sWjYBj8WA56yU7s/7WSQGfMxqHUrXiCP+Vkwzc rbTTOwP/FDgWbP0pNGUrmSktbFVvHDWG3Tb39PWpXuO4WsbpvOhX7D0h7hEM9jAkTZkj f08exOXNYS1HY9+Aqc9CZYVTuH+vJ+A0XrHZ1ELPpXxNrAW6ZJuG3d/8KAZK9gBIeH98 izVqAFItF/kqSVd5X+drWxPWZiRPQpKhEvFC80MCdY3cJMOzEPLjMLled+pEAcD3ztnl D6uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ILLtYDh87Hnf9dA6vVS4B7psVL7r7MTKfeGqDa+SuKE=; b=IbcUjE8BwcoERN2SsE+1exqF6S938Ah4ZHP8clyl56EDbgXX34hQEWX7K/gZvDt0fc KjROf0Kzm8Iv5Y19hHRlPZcbHGGPrcLNqnI4RTx2vipNiUuCXexpAPqEBA1aE3OL8u4k 1YVdIbF0I13xdJjs8sc0qEYV2ZS1EoQxppZilIEY87rg4v2bJBYh8FJVIIp359YXZmEE MUPQBX5UR2k6tSi5DKM4zhzqMm/y/gVMrPPDnaSmlRjR8CLyP6YISw06oKt9vTVKl0SW cYfO5bI1IG/xaCv7gaTT20yNtNRk8BPACdlDT2EzuIfV3TNmdGHiJTzCM5NoABSCsgoZ NjlQ== X-Gm-Message-State: AOAM5327MD5u16cmL+929i5urDXO0UtGAluOoG90hOJy3kgoUMV+NMct PjDm01/OzyK3uH50ruLvjB6+sGLPIUfpce4aS5wktA== X-Google-Smtp-Source: ABdhPJyEXZuLz/9VD9TgkWSbpgqwjYtEuhse8iQmZ+kvD+VMvEh/eMgZha0C2GrZshLMMBrho/gEjAYIvq4mDVItvuo= X-Received: by 2002:a2e:9496:: with SMTP id c22mr10298851ljh.249.1600409220979; Thu, 17 Sep 2020 23:07:00 -0700 (PDT) MIME-Version: 1.0 References: <20200914112521.1327-1-tzimmermann@suse.de> In-Reply-To: <20200914112521.1327-1-tzimmermann@suse.de> From: Sumit Semwal Date: Fri, 18 Sep 2020 11:36:49 +0530 Message-ID: To: Thomas Zimmermann Subject: Re: [Intel-gfx] [PATCH 0/3] dma-buf: Flag vmap'ed memory as system or I/O memory X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christian Koenig , Dave Airlie , mark.cave-ayland@ilande.co.uk, DRI mailing list , Chris Wilson , Gerd Hoffmann , sparclinux@vger.kernel.org, Sam Ravnborg , Marek Szyprowski , jonathanh@nvidia.com, matthew.auld@intel.com, Russell King , "open list:DMA BUFFER SHARING FRAMEWORK" , Pawel Osciak , Intel Graphics Development , etnaviv@lists.freedesktop.org, Linaro MM SIG , Christian Gmeiner , thomas.hellstrom@intel.com, Maxime Ripard , linux-tegra@vger.kernel.org, Mauro Carvalho Chehab , Tomasz Figa , Kyungmin Park , "David S . Miller" , Lucas Stach Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Hello Thomas, On Mon, 14 Sep 2020 at 16:55, Thomas Zimmermann wrote: > > Dma-buf provides vmap() and vunmap() for retrieving and releasing mappings > of dma-buf memory in kernel address space. The functions operate with plain > addresses and the assumption is that the memory can be accessed with load > and store operations. This is not the case on some architectures (e.g., > sparc64) where I/O memory can only be accessed with dedicated instructions. > > This patchset introduces struct dma_buf_map, which contains the address of > a buffer and a flag that tells whether system- or I/O-memory instructions > are required. Thank you for the patchset - it is a really nice, clean bit to add! > > Some background: updating the DRM framebuffer console on sparc64 makes the > kernel panic. This is because the framebuffer memory cannot be accessed with > system-memory instructions. We currently employ a workaround in DRM to > address this specific problem. [1] > > To resolve the problem, we'd like to address it at the most common point, > which is the dma-buf framework. The dma-buf mapping ideally knows if I/O > instructions are required and exports this information to it's users. The > new structure struct dma_buf_map stores the buffer address and a flag that > signals I/O memory. Affected users of the buffer (e.g., drivers, frameworks) > can then access the memory accordingly. > > This patchset only introduces struct dma_buf_map, and updates struct dma_buf > and it's interfaces. Further patches can update dma-buf users. For example, > there's a prototype patchset for DRM that fixes the framebuffer problem. [2] > > Further work: TTM, one of DRM's memory managers, already exports an > is_iomem flag of its own. It could later be switched over to exporting struct > dma_buf_map, thus simplifying some code. Several DRM drivers expect their > fbdev console to operate on I/O memory. These could possibly be switched over > to the generic fbdev emulation, as soon as the generic code uses struct > dma_buf_map. > > [1] https://lore.kernel.org/dri-devel/20200725191012.GA434957@ravnborg.org/ > [2] https://lore.kernel.org/dri-devel/20200806085239.4606-1-tzimmermann@suse.de/ > > Thomas Zimmermann (3): > dma-buf: Add struct dma-buf-map for storing struct dma_buf.vaddr_ptr > dma-buf: Use struct dma_buf_map in dma_buf_vmap() interfaces > dma-buf: Use struct dma_buf_map in dma_buf_vunmap() interfaces FWIW, for the series, please feel free to add my Acked-by: Sumit Semwal > > Documentation/driver-api/dma-buf.rst | 3 + > drivers/dma-buf/dma-buf.c | 40 +++--- > drivers/gpu/drm/drm_gem_cma_helper.c | 16 ++- > drivers/gpu/drm/drm_gem_shmem_helper.c | 17 ++- > drivers/gpu/drm/drm_prime.c | 14 +- > drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 13 +- > drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 13 +- > .../drm/i915/gem/selftests/i915_gem_dmabuf.c | 18 ++- > drivers/gpu/drm/tegra/gem.c | 23 ++-- > .../common/videobuf2/videobuf2-dma-contig.c | 17 ++- > .../media/common/videobuf2/videobuf2-dma-sg.c | 19 ++- > .../common/videobuf2/videobuf2-vmalloc.c | 21 ++- > include/drm/drm_prime.h | 5 +- > include/linux/dma-buf-map.h | 126 ++++++++++++++++++ > include/linux/dma-buf.h | 11 +- > 15 files changed, 274 insertions(+), 82 deletions(-) > create mode 100644 include/linux/dma-buf-map.h > > -- > 2.28.0 > Best, Sumit. _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx