Hi guys,
we are currently working an Freesync and direct scan out from system
memory on AMD APUs in A+A laptops.
On problem we stumbled over is that our display hardware needs to scan
out from uncached system memory and we currently don't have a way to
communicate that through DMA-buf.
For our specific use case at hand we are going to implement something
driver specific, but the question is should we have something more
generic for this?
After all the system memory access pattern is a PCIe extension and as
such something generic.
Regards,
Christian.
In the function amdgpu_uvd_cs_msg(), every branch in the switch
statement will have a return, so the code below the switch statement
will not be executed.
Eliminate the follow smatch warning:
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c:845 amdgpu_uvd_cs_msg() warn:
ignoring unreachable code.
Reported-by: Abaci Robot <abaci(a)linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong(a)linux.alibaba.com>
---
Changes in v2:
-For the follow advice: https://lore.kernel.org/patchwork/patch/1435968/
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
index c6dbc08..35f6874 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
@@ -829,9 +829,8 @@ static int amdgpu_uvd_cs_msg(struct amdgpu_uvd_cs_ctx *ctx,
default:
DRM_ERROR("Illegal UVD message type (%d)!\n", msg_type);
- return -EINVAL;
}
- BUG();
+
return -EINVAL;
}
--
1.8.3.1
We had a long outstanding problem in amdgpu that buffers exported to user drivers by DMA-buf serialize all command submissions using them.
In other words we can't compose the buffer with different engines and then send it to another driver for display further processing.
This was added to work around the fact that i915 didn't wanted to wait for shared fences in the dma_resv objects before displaying a buffer.
Since this problem is now causing issues with Vulkan we need to find a better solution for that.
The patch set here tries to do this by adding an usage flag to the shared fences noting when and how they should participate in implicit synchronization.
Please review and/or comment,
Christian.
tldr; DMA buffers aren't normal memory, expecting that you can use
them like that (like calling get_user_pages works, or that they're
accounting like any other normal memory) cannot be guaranteed.
Since some userspace only runs on integrated devices, where all
buffers are actually all resident system memory, there's a huge
temptation to assume that a struct page is always present and useable
like for any more pagecache backed mmap. This has the potential to
result in a uapi nightmare.
To stop this gap require that DMA buffer mmaps are VM_PFNMAP, which
blocks get_user_pages and all the other struct page based
infrastructure for everyone. In spirit this is the uapi counterpart to
the kernel-internal CONFIG_DMABUF_DEBUG.
Motivated by a recent patch which wanted to swich the system dma-buf
heap to vm_insert_page instead of vm_insert_pfn.
v2:
Jason brought up that we also want to guarantee that all ptes have the
pte_special flag set, to catch fast get_user_pages (on architectures
that support this). Allowing VM_MIXEDMAP (like VM_SPECIAL does) would
still allow vm_insert_page, but limiting to VM_PFNMAP will catch that.
>From auditing the various functions to insert pfn pte entires
(vm_insert_pfn_prot, remap_pfn_range and all it's callers like
dma_mmap_wc) it looks like VM_PFNMAP is already required anyway, so
this should be the correct flag to check for.
References: https://lore.kernel.org/lkml/CAKMK7uHi+mG0z0HUmNt13QCCvutuRVjpcR0NjRL12k-Wb…
Acked-by: Christian König <christian.koenig(a)amd.com>
Cc: Jason Gunthorpe <jgg(a)ziepe.ca>
Cc: Suren Baghdasaryan <surenb(a)google.com>
Cc: Matthew Wilcox <willy(a)infradead.org>
Cc: John Stultz <john.stultz(a)linaro.org>
Signed-off-by: Daniel Vetter <daniel.vetter(a)intel.com>
Cc: Sumit Semwal <sumit.semwal(a)linaro.org>
Cc: "Christian König" <christian.koenig(a)amd.com>
Cc: linux-media(a)vger.kernel.org
Cc: linaro-mm-sig(a)lists.linaro.org
--
Resending this so I can test the next two patches for vgem/shmem in
intel-gfx-ci. Last round failed somehow, but I can't repro that at all
locally here.
No immediate plans to merge this patch here since ttm isn't addressed
yet (and there we have the hugepte issue, for which I don't think we
have a clear consensus yet).
-Daniel
---
drivers/dma-buf/dma-buf.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index eadd1eaa2fb5..dda583fb1f03 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -127,6 +127,7 @@ static struct file_system_type dma_buf_fs_type = {
static int dma_buf_mmap_internal(struct file *file, struct vm_area_struct *vma)
{
struct dma_buf *dmabuf;
+ int ret;
if (!is_dma_buf_file(file))
return -EINVAL;
@@ -142,7 +143,11 @@ static int dma_buf_mmap_internal(struct file *file, struct vm_area_struct *vma)
dmabuf->size >> PAGE_SHIFT)
return -EINVAL;
- return dmabuf->ops->mmap(dmabuf, vma);
+ ret = dmabuf->ops->mmap(dmabuf, vma);
+
+ WARN_ON(!(vma->vm_flags & VM_PFNMAP));
+
+ return ret;
}
static loff_t dma_buf_llseek(struct file *file, loff_t offset, int whence)
@@ -1244,6 +1249,8 @@ EXPORT_SYMBOL_GPL(dma_buf_end_cpu_access);
int dma_buf_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma,
unsigned long pgoff)
{
+ int ret;
+
if (WARN_ON(!dmabuf || !vma))
return -EINVAL;
@@ -1264,7 +1271,11 @@ int dma_buf_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma,
vma_set_file(vma, dmabuf->file);
vma->vm_pgoff = pgoff;
- return dmabuf->ops->mmap(dmabuf, vma);
+ ret = dmabuf->ops->mmap(dmabuf, vma);
+
+ WARN_ON(!(vma->vm_flags & VM_PFNMAP));
+
+ return ret;
}
EXPORT_SYMBOL_GPL(dma_buf_mmap);
--
2.31.0
This set is part of a larger effort attempting to clean-up W=1
kernel builds, which are currently overwhelmingly riddled with
niggly little warnings.
Lee Jones (34):
drm/amd/pm/inc/smu_v13_0: Move table into the only source file that
uses it
drm/amd/pm/swsmu/smu13/aldebaran_ppt: Remove unused variable 'ret'
drm/amd/pm/powerplay/hwmgr/smu7_thermal: Provide function name for
'smu7_fan_ctrl_set_default_mode()'
drm/amd/pm/powerplay/hwmgr/vega12_thermal: Provide function name
drm/amd/pm/powerplay/hwmgr/vega12_hwmgr: Provide
'vega12_init_smc_table()' function name
drm/amd/pm/powerplay/hwmgr/vega10_hwmgr: Kernel-doc headers must
contain function names
drm/amd/pm/powerplay/hwmgr/vega20_hwmgr: Provide function name
'vega20_init_smc_table()'
drm/amd/display/dc/bios/command_table_helper: Fix function name for
'dal_cmd_table_helper_transmitter_bp_to_atom()'
drm/amd/display/dc/bios/command_table_helper2: Fix function name
'dal_cmd_table_helper_transmitter_bp_to_atom2()'
drm/amd/display/dc/bios/bios_parser: Fix formatting and misnaming
issues
drm/nouveau/nvkm/subdev/mc/tu102: Make functions called by reference
static
drm/amd/display/amdgpu_dm/amdgpu_dm: Functions must directly follow
their headers
drm/amd/display/dc/dce/dmub_outbox: Convert over to kernel-doc
drm/amd/display/dc/gpio/gpio_service: Pass around correct
dce_{version,environment} types
drm/amd/display/dc/dce110/dce110_hw_sequencer: Include our own header
drm/amd/display/dc/dce/dce_transform: Remove superfluous
re-initialisation of DCFE_MEM_LIGHT_SLEEP_CNTL,
drm/amd/display/dc/dce/dce_mem_input: Remove duplicate initialisation
of GRPH_CONTROL__GRPH_NUM_BANKS_{SHIFT,MASK}
drm/amd/display/dc/dce/dce_mem_input: Remove duplicate initialisation
of GRPH_CONTROL__GRPH_NUM_BANKS_{SHIFT,MASK
drm/amd/amdgpu/amdgpu_device: Make local function static
drm/amd/display/amdgpu_dm/amdgpu_dm: Fix kernel-doc formatting issue
drm/amd/display/dc/dce110/dce110_hw_sequencer: Include header
containing our prototypes
drm/amd/display/dc/core/dc: Convert function headers to kernel-doc
drm/amd/display/dmub/src/dmub_srv_stat: Convert function header to
kernel-doc
drm/amd/display/modules/hdcp/hdcp_psp: Remove unused function
'mod_hdcp_hdcp1_get_link_encryption_status()'
drm/xlnx/zynqmp_disp: Fix incorrectly named enum
'zynqmp_disp_layer_id'
drm/xlnx/zynqmp_dp: Fix incorrectly name function 'zynqmp_dp_train()'
drm/ttm/ttm_tt: Demote non-conformant kernel-doc header
drm/panel/panel-raspberrypi-touchscreen: Demote kernel-doc abuse
drm/panel/panel-sitronix-st7701: Demote kernel-doc abuse
drm/vgem/vgem_drv: Standard comment blocks should not use kernel-doc
format
drm/exynos/exynos7_drm_decon: Fix incorrect naming of
'decon_shadow_protect_win()'
drm/exynos/exynos_drm_ipp: Fix documentation for
'exynos_drm_ipp_get_{caps,res}_ioctl()'
drm/vboxvideo/hgsmi_base: Place function names into headers
drm/vboxvideo/modesetting: Provide function names for prototype
headers
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 +-
.../gpu/drm/amd/display/dc/bios/bios_parser.c | 6 +--
.../display/dc/bios/command_table_helper.c | 2 +-
.../display/dc/bios/command_table_helper2.c | 2 +-
drivers/gpu/drm/amd/display/dc/core/dc.c | 46 +++++--------------
.../drm/amd/display/dc/dce/dce_mem_input.h | 2 -
.../drm/amd/display/dc/dce/dce_transform.h | 3 +-
.../gpu/drm/amd/display/dc/dce/dmub_outbox.c | 17 ++-----
.../display/dc/dce110/dce110_hw_sequencer.c | 3 ++
.../drm/amd/display/dc/gpio/gpio_service.c | 12 ++---
.../drm/amd/display/dmub/src/dmub_srv_stat.c | 19 +++-----
.../display/include/gpio_service_interface.h | 4 +-
.../drm/amd/display/modules/hdcp/hdcp_psp.c | 13 ------
drivers/gpu/drm/amd/pm/inc/smu_v13_0.h | 6 ---
.../drm/amd/pm/powerplay/hwmgr/smu7_thermal.c | 8 ++--
.../drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 26 ++++++-----
.../drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c | 2 +-
.../amd/pm/powerplay/hwmgr/vega12_thermal.c | 3 +-
.../drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c | 2 +-
.../drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 9 +++-
drivers/gpu/drm/exynos/exynos7_drm_decon.c | 2 +-
drivers/gpu/drm/exynos/exynos_drm_ipp.c | 4 +-
.../gpu/drm/nouveau/nvkm/subdev/mc/tu102.c | 6 +--
.../drm/panel/panel-raspberrypi-touchscreen.c | 2 +-
drivers/gpu/drm/panel/panel-sitronix-st7701.c | 2 +-
drivers/gpu/drm/ttm/ttm_tt.c | 2 +-
drivers/gpu/drm/vboxvideo/hgsmi_base.c | 19 +++++---
drivers/gpu/drm/vboxvideo/modesetting.c | 20 ++++----
drivers/gpu/drm/vgem/vgem_drv.c | 2 +-
drivers/gpu/drm/xlnx/zynqmp_disp.c | 2 +-
drivers/gpu/drm/xlnx/zynqmp_dp.c | 2 +-
32 files changed, 107 insertions(+), 147 deletions(-)
Cc: Adam Jackson <ajax(a)redhat.com>
Cc: Ajay Kumar <ajaykumar.rs(a)samsung.com>
Cc: Akshu Agarwal <akshua(a)gmail.com>
Cc: Alex Deucher <alexander.deucher(a)amd.com>
Cc: Alistair Popple <apopple(a)nvidia.com>
Cc: amd-gfx(a)lists.freedesktop.org
Cc: Ben Skeggs <bskeggs(a)redhat.com>
Cc: Ben Widawsky <ben(a)bwidawsk.net>
Cc: Christian Koenig <christian.koenig(a)amd.com>
Cc: "Christian König" <christian.koenig(a)amd.com>
Cc: Daniel Vetter <daniel(a)ffwll.ch>
Cc: David Airlie <airlied(a)linux.ie>
Cc: dri-devel(a)lists.freedesktop.org
Cc: Eric Anholt <eric(a)anholt.net>
Cc: Evan Quan <evan.quan(a)amd.com>
Cc: Hans de Goede <hdegoede(a)redhat.com>
Cc: Harry Wentland <harry.wentland(a)amd.com>
Cc: Huang Rui <ray.huang(a)amd.com>
Cc: Hyun Kwon <hyun.kwon(a)xilinx.com>
Cc: Inki Dae <inki.dae(a)samsung.com>
Cc: Jagan Teki <jagan(a)amarulasolutions.com>
Cc: Joonyoung Shim <jy0922.shim(a)samsung.com>
Cc: Jun Lei <Jun.Lei(a)amd.com>
Cc: Kevin Wang <kevin1.wang(a)amd.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski(a)canonical.com>
Cc: Kyungmin Park <kyungmin.park(a)samsung.com>
Cc: Laurent Pinchart <laurent.pinchart(a)ideasonboard.com>
Cc: Lee Jones <lee.jones(a)linaro.org>
Cc: Leo Li <sunpeng.li(a)amd.com>
Cc: linaro-mm-sig(a)lists.linaro.org
Cc: linux-arm-kernel(a)lists.infradead.org
Cc: linux-media(a)vger.kernel.org
Cc: linux-samsung-soc(a)vger.kernel.org
Cc: Marek Szyprowski <m.szyprowski(a)samsung.com>
Cc: Mauro Rossi <issor.oruam(a)gmail.com>
Cc: Meenakshikumar Somasundaram <meenakshikumar.somasundaram(a)amd.com>
Cc: Michal Simek <michal.simek(a)xilinx.com>
Cc: nouveau(a)lists.freedesktop.org
Cc: Philipp Zabel <p.zabel(a)pengutronix.de>
Cc: Rodrigo Siqueira <Rodrigo.Siqueira(a)amd.com>
Cc: Sam Ravnborg <sam(a)ravnborg.org>
Cc: Seung-Woo Kim <sw0312.kim(a)samsung.com>
Cc: Sumit Semwal <sumit.semwal(a)linaro.org>
Cc: Thierry Reding <thierry.reding(a)gmail.com>
--
2.31.1