Skip to content

Commit

Permalink
Merge tag 'drm-misc-next-2025-01-06' of https://gitlab.freedesktop.or…
Browse files Browse the repository at this point in the history
…g/drm/misc/kernel into drm-next

drm-misc-next for 6.14:

UAPI Changes:
- Clarify drm memory stats documentation

Cross-subsystem Changes:

Core Changes:
 - sched: Documentation fixes,

Driver Changes:
 - amdgpu: Track BO memory stats at runtime
 - amdxdna: Various fixes
 - hisilicon: New HIBMC driver
 - bridges:
   - Provide default implementation of atomic_check for HDMI bridges
   - it605: HDCP improvements, MCCS Support

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Maxime Ripard <mripard@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250106-augmented-kakapo-of-action-0cf000@houat
  • Loading branch information
airlied committed Jan 9, 2025
2 parents ae7f6d5 + 938fbb1 commit 0739b8b
Show file tree
Hide file tree
Showing 79 changed files with 2,518 additions and 608 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ properties:
- tianma,tm070jvhg33
# Tianma Micro-electronics TM070RVHG71 7.0" WXGA TFT LCD panel
- tianma,tm070rvhg71
# Topland TIAN-G07017-01 7.0" WSVGA TFT-LCD panel with capacitive touch
- topland,tian-g07017-01
# Toshiba 8.9" WXGA (1280x768) TFT LCD panel
- toshiba,lt089ac29000
# TPK U.S.A. LLC Fusion 7" 800 x 480 (WVGA) LCD panel with capacitive touch
Expand Down
2 changes: 2 additions & 0 deletions Documentation/devicetree/bindings/vendor-prefixes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1524,6 +1524,8 @@ patternProperties:
description: Topeet
"^topic,.*":
description: Topic Embedded Systems
"^topland,.*":
description: Topland Electronics (H.K) Co., Ltd.
"^toppoly,.*":
description: TPO (deprecated, use tpo)
deprecated: true
Expand Down
54 changes: 27 additions & 27 deletions Documentation/gpu/drm-usage-stats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -145,57 +145,57 @@ both.
Memory
^^^^^^

- drm-memory-<region>: <uint> [KiB|MiB]

Each possible memory type which can be used to store buffer objects by the
GPU in question shall be given a stable and unique name to be returned as the
string here.
Each possible memory type which can be used to store buffer objects by the GPU
in question shall be given a stable and unique name to be used as the "<region>"
string.

The region name "memory" is reserved to refer to normal system memory.

Value shall reflect the amount of storage currently consumed by the buffer
The value shall reflect the amount of storage currently consumed by the buffer
objects belong to this client, in the respective memory region.

Default unit shall be bytes with optional unit specifiers of 'KiB' or 'MiB'
indicating kibi- or mebi-bytes.

This key is deprecated and is an alias for drm-resident-<region>. Only one of
the two should be present in the output.

- drm-shared-<region>: <uint> [KiB|MiB]
- drm-total-<region>: <uint> [KiB|MiB]

The total size of buffers that are shared with another file (e.g., have more
than a single handle).
The total size of all requested buffers, including both shared and private
memory. The backing store for the buffers does not need to be currently
instantiated to count under this category. To avoid double-counting, if a buffer
has multiple regions where it can be allocated to, the implementation should
consistently select a single region for accounting purposes.

- drm-total-<region>: <uint> [KiB|MiB]
- drm-shared-<region>: <uint> [KiB|MiB]

The total size of all created buffers including shared and private memory. The
backing store for the buffers does not have to be currently instantiated to be
counted under this category.
The total size of buffers that are shared with another file (i.e., have more
than one handle). The same requirement to avoid double-counting that applies to
drm-total-<region> also applies here.

- drm-resident-<region>: <uint> [KiB|MiB]

The total size of buffers that are resident (have their backing store present or
instantiated) in the specified region.
The total size of buffers that are resident (i.e., have their backing store
present or instantiated) in the specified region.

- drm-memory-<region>: <uint> [KiB|MiB]

This is an alias for drm-memory-<region> and only one of the two should be
present in the output.
This key is deprecated and is only printed by amdgpu; it is an alias for
drm-resident-<region>.

- drm-purgeable-<region>: <uint> [KiB|MiB]

The total size of buffers that are purgeable.
The total size of buffers that are resident and purgeable.

For example drivers which implement a form of 'madvise' like functionality can
here count buffers which have instantiated backing store, but have been marked
with an equivalent of MADV_DONTNEED.
For example, drivers that implement functionality similar to 'madvise' can count
buffers that have instantiated backing stores but have been marked with an
equivalent of MADV_DONTNEED.

- drm-active-<region>: <uint> [KiB|MiB]

The total size of buffers that are active on one or more engines.

One practical example of this can be presence of unsignaled fences in an GEM
buffer reservation object. Therefore the active category is a subset of
resident.
One practical example of this could be the presence of unsignaled fences in a
GEM buffer reservation object. Therefore, the active category is a subset of the
resident category.

Implementation Details
======================
Expand Down
3 changes: 2 additions & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -7081,7 +7081,8 @@ T: git https://gitlab.freedesktop.org/drm/misc/kernel.git
F: drivers/gpu/drm/sun4i/sun8i*

DRM DRIVER FOR ARM PL111 CLCD
S: Orphan
M: Linus Walleij <linus.walleij@linaro.org>
S: Maintained
T: git https://gitlab.freedesktop.org/drm/misc/kernel.git
F: drivers/gpu/drm/pl111/

Expand Down
2 changes: 1 addition & 1 deletion drivers/accel/amdxdna/aie2_ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "amdxdna_mailbox.h"
#include "amdxdna_pci_drv.h"

bool force_cmdlist;
static bool force_cmdlist;
module_param(force_cmdlist, bool, 0600);
MODULE_PARM_DESC(force_cmdlist, "Force use command list (Default false)");

Expand Down
6 changes: 3 additions & 3 deletions drivers/accel/amdxdna/aie2_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "amdxdna_mailbox.h"
#include "amdxdna_pci_drv.h"

int aie2_max_col = XRS_MAX_COL;
static int aie2_max_col = XRS_MAX_COL;
module_param(aie2_max_col, uint, 0600);
MODULE_PARM_DESC(aie2_max_col, "Maximum column could be used");

Expand Down Expand Up @@ -380,9 +380,9 @@ static int aie2_hw_start(struct amdxdna_dev *xdna)
goto stop_psp;
}

mbox_res.ringbuf_base = (u64)ndev->sram_base;
mbox_res.ringbuf_base = ndev->sram_base;
mbox_res.ringbuf_size = pci_resource_len(pdev, xdna->dev_info->sram_bar);
mbox_res.mbox_base = (u64)ndev->mbox_base;
mbox_res.mbox_base = ndev->mbox_base;
mbox_res.mbox_size = MBOX_SIZE(ndev);
mbox_res.name = "xdna_mailbox";
ndev->mbox = xdnam_mailbox_create(&xdna->ddev, &mbox_res);
Expand Down
2 changes: 1 addition & 1 deletion drivers/accel/amdxdna/aie2_pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ int aie2_query_firmware_version(struct amdxdna_dev_hdl *ndev,
int aie2_create_context(struct amdxdna_dev_hdl *ndev, struct amdxdna_hwctx *hwctx);
int aie2_destroy_context(struct amdxdna_dev_hdl *ndev, struct amdxdna_hwctx *hwctx);
int aie2_map_host_buf(struct amdxdna_dev_hdl *ndev, u32 context_id, u64 addr, u64 size);
int aie2_query_status(struct amdxdna_dev_hdl *ndev, char *buf, u32 size, u32 *cols_filled);
int aie2_query_status(struct amdxdna_dev_hdl *ndev, char __user *buf, u32 size, u32 *cols_filled);
int aie2_register_asyn_event_msg(struct amdxdna_dev_hdl *ndev, dma_addr_t addr, u32 size,
void *handle, int (*cb)(void*, const u32 *, size_t));
int aie2_config_cu(struct amdxdna_hwctx *hwctx);
Expand Down
24 changes: 12 additions & 12 deletions drivers/accel/amdxdna/amdxdna_mailbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,27 +98,27 @@ struct mailbox_msg {
static void mailbox_reg_write(struct mailbox_channel *mb_chann, u32 mbox_reg, u32 data)
{
struct xdna_mailbox_res *mb_res = &mb_chann->mb->res;
u64 ringbuf_addr = mb_res->mbox_base + mbox_reg;
void __iomem *ringbuf_addr = mb_res->mbox_base + mbox_reg;

writel(data, (void *)ringbuf_addr);
writel(data, ringbuf_addr);
}

static u32 mailbox_reg_read(struct mailbox_channel *mb_chann, u32 mbox_reg)
{
struct xdna_mailbox_res *mb_res = &mb_chann->mb->res;
u64 ringbuf_addr = mb_res->mbox_base + mbox_reg;
void __iomem *ringbuf_addr = mb_res->mbox_base + mbox_reg;

return readl((void *)ringbuf_addr);
return readl(ringbuf_addr);
}

static int mailbox_reg_read_non_zero(struct mailbox_channel *mb_chann, u32 mbox_reg, u32 *val)
{
struct xdna_mailbox_res *mb_res = &mb_chann->mb->res;
u64 ringbuf_addr = mb_res->mbox_base + mbox_reg;
void __iomem *ringbuf_addr = mb_res->mbox_base + mbox_reg;
int ret, value;

/* Poll till value is not zero */
ret = readx_poll_timeout(readl, (void *)ringbuf_addr, value,
ret = readx_poll_timeout(readl, ringbuf_addr, value,
value, 1 /* us */, 100);
if (ret < 0)
return ret;
Expand Down Expand Up @@ -200,10 +200,10 @@ static void mailbox_release_msg(struct mailbox_channel *mb_chann,
static int
mailbox_send_msg(struct mailbox_channel *mb_chann, struct mailbox_msg *mb_msg)
{
void __iomem *write_addr;
u32 ringbuf_size;
u32 head, tail;
u32 start_addr;
u64 write_addr;
u32 tmp_tail;

head = mailbox_get_headptr(mb_chann, CHAN_RES_X2I);
Expand All @@ -221,14 +221,14 @@ mailbox_send_msg(struct mailbox_channel *mb_chann, struct mailbox_msg *mb_msg)

if (tail >= head && tmp_tail > ringbuf_size - sizeof(u32)) {
write_addr = mb_chann->mb->res.ringbuf_base + start_addr + tail;
writel(TOMBSTONE, (void *)write_addr);
writel(TOMBSTONE, write_addr);

/* tombstone is set. Write from the start of the ringbuf */
tail = 0;
}

write_addr = mb_chann->mb->res.ringbuf_base + start_addr + tail;
memcpy_toio((void *)write_addr, &mb_msg->pkg, mb_msg->pkg_size);
memcpy_toio(write_addr, &mb_msg->pkg, mb_msg->pkg_size);
mailbox_set_tailptr(mb_chann, tail + mb_msg->pkg_size);

trace_mbox_set_tail(MAILBOX_NAME, mb_chann->msix_irq,
Expand Down Expand Up @@ -275,11 +275,11 @@ mailbox_get_resp(struct mailbox_channel *mb_chann, struct xdna_msg_header *heade
static int mailbox_get_msg(struct mailbox_channel *mb_chann)
{
struct xdna_msg_header header;
void __iomem *read_addr;
u32 msg_size, rest;
u32 ringbuf_size;
u32 head, tail;
u32 start_addr;
u64 read_addr;
int ret;

if (mailbox_reg_read_non_zero(mb_chann, mb_chann->res[CHAN_RES_I2X].mb_tail_ptr_reg, &tail))
Expand All @@ -302,7 +302,7 @@ static int mailbox_get_msg(struct mailbox_channel *mb_chann)

/* Peek size of the message or TOMBSTONE */
read_addr = mb_chann->mb->res.ringbuf_base + start_addr + head;
header.total_size = readl((void *)read_addr);
header.total_size = readl(read_addr);
/* size is TOMBSTONE, set next read from 0 */
if (header.total_size == TOMBSTONE) {
if (head < tail) {
Expand All @@ -328,7 +328,7 @@ static int mailbox_get_msg(struct mailbox_channel *mb_chann)

rest = sizeof(header) - sizeof(u32);
read_addr += sizeof(u32);
memcpy_fromio((u32 *)&header + 1, (void *)read_addr, rest);
memcpy_fromio((u32 *)&header + 1, read_addr, rest);
read_addr += rest;

ret = mailbox_get_resp(mb_chann, &header, (u32 *)read_addr);
Expand Down
4 changes: 2 additions & 2 deletions drivers/accel/amdxdna/amdxdna_mailbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ struct xdna_mailbox_msg {
* @mbox_size: mailbox size
*/
struct xdna_mailbox_res {
u64 ringbuf_base;
void __iomem *ringbuf_base;
size_t ringbuf_size;
u64 mbox_base;
void __iomem *mbox_base;
size_t mbox_size;
const char *name;
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/accel/amdxdna/amdxdna_pci_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static int amdxdna_drm_open(struct drm_device *ddev, struct drm_file *filp)
goto put_rpm;
}

client->pid = pid_nr(filp->pid);
client->pid = pid_nr(rcu_access_pointer(filp->pid));
client->xdna = xdna;

client->sva = iommu_sva_bind_device(xdna->ddev.dev, current->mm);
Expand Down
2 changes: 1 addition & 1 deletion drivers/accel/amdxdna/npu1_regs.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const struct dpm_clk_freq npu1_dpm_clk_table[] = {
{ 0 }
};

const struct amdxdna_dev_priv npu1_dev_priv = {
static const struct amdxdna_dev_priv npu1_dev_priv = {
.fw_path = "amdnpu/1502_00/npu.sbin",
.protocol_major = 0x5,
.protocol_minor = 0x7,
Expand Down
2 changes: 1 addition & 1 deletion drivers/accel/amdxdna/npu2_regs.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
#define NPU2_SMU_BAR_BASE MMNPU_APERTURE4_BASE
#define NPU2_SRAM_BAR_BASE MMNPU_APERTURE1_BASE

const struct amdxdna_dev_priv npu2_dev_priv = {
static const struct amdxdna_dev_priv npu2_dev_priv = {
.fw_path = "amdnpu/17f0_00/npu.sbin",
.protocol_major = 0x6,
.protocol_minor = 0x6,
Expand Down
2 changes: 1 addition & 1 deletion drivers/accel/amdxdna/npu4_regs.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const struct dpm_clk_freq npu4_dpm_clk_table[] = {
{ 0 }
};

const struct amdxdna_dev_priv npu4_dev_priv = {
static const struct amdxdna_dev_priv npu4_dev_priv = {
.fw_path = "amdnpu/17f0_10/npu.sbin",
.protocol_major = 0x6,
.protocol_minor = 12,
Expand Down
2 changes: 1 addition & 1 deletion drivers/accel/amdxdna/npu5_regs.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
#define NPU5_SMU_BAR_BASE MMNPU_APERTURE4_BASE
#define NPU5_SRAM_BAR_BASE MMNPU_APERTURE1_BASE

const struct amdxdna_dev_priv npu5_dev_priv = {
static const struct amdxdna_dev_priv npu5_dev_priv = {
.fw_path = "amdnpu/17f0_11/npu.sbin",
.protocol_major = 0x6,
.protocol_minor = 12,
Expand Down
2 changes: 1 addition & 1 deletion drivers/accel/amdxdna/npu6_regs.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
#define NPU6_SMU_BAR_BASE MMNPU_APERTURE4_BASE
#define NPU6_SRAM_BAR_BASE MMNPU_APERTURE1_BASE

const struct amdxdna_dev_priv npu6_dev_priv = {
static const struct amdxdna_dev_priv npu6_dev_priv = {
.fw_path = "amdnpu/17f0_10/npu.sbin",
.protocol_major = 0x6,
.protocol_minor = 12,
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p)
* We can't use gang submit on with reserved VMIDs when the VM changes
* can't be invalidated by more than one engine at the same time.
*/
if (p->gang_size > 1 && !p->adev->vm_manager.concurrent_flush) {
if (p->gang_size > 1 && !adev->vm_manager.concurrent_flush) {
for (i = 0; i < p->gang_size; ++i) {
struct drm_sched_entity *entity = p->entities[i];
struct drm_gpu_scheduler *sched = entity->rq->sched;
Expand Down Expand Up @@ -1189,7 +1189,7 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p)
if (!bo)
continue;

amdgpu_vm_bo_invalidate(adev, bo, false);
amdgpu_vm_bo_invalidate(bo, false);
}
}

Expand Down
5 changes: 4 additions & 1 deletion drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "amdgpu_gem.h"
#include "amdgpu_dma_buf.h"
#include "amdgpu_xgmi.h"
#include "amdgpu_vm.h"
#include <drm/amdgpu_drm.h>
#include <drm/ttm/ttm_tt.h>
#include <linux/dma-buf.h>
Expand All @@ -60,6 +61,8 @@ static int amdgpu_dma_buf_attach(struct dma_buf *dmabuf,
if (pci_p2pdma_distance(adev->pdev, attach->dev, false) < 0)
attach->peer2peer = false;

amdgpu_vm_bo_update_shared(bo);

return 0;
}

Expand Down Expand Up @@ -345,7 +348,7 @@ amdgpu_dma_buf_move_notify(struct dma_buf_attachment *attach)
/* FIXME: This should be after the "if", but needs a fix to make sure
* DMABuf imports are initialized in the right VM list.
*/
amdgpu_vm_bo_invalidate(adev, bo, false);
amdgpu_vm_bo_invalidate(bo, false);
if (!bo->tbo.resource || bo->tbo.resource->mem_type == TTM_PL_SYSTEM)
return;

Expand Down
17 changes: 6 additions & 11 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file)
struct amdgpu_fpriv *fpriv = file->driver_priv;
struct amdgpu_vm *vm = &fpriv->vm;

struct amdgpu_mem_stats stats[__AMDGPU_PL_LAST + 1] = { };
struct amdgpu_mem_stats stats[__AMDGPU_PL_NUM];
ktime_t usage[AMDGPU_HW_IP_NUM];
const char *pl_name[] = {
[TTM_PL_VRAM] = "vram",
Expand All @@ -72,15 +72,8 @@ void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file)
[AMDGPU_PL_DOORBELL] = "doorbell",
};
unsigned int hw_ip, i;
int ret;

ret = amdgpu_bo_reserve(vm->root.bo, false);
if (ret)
return;

amdgpu_vm_get_memory(vm, stats, ARRAY_SIZE(stats));
amdgpu_bo_unreserve(vm->root.bo);

amdgpu_vm_get_memory(vm, stats);
amdgpu_ctx_mgr_usage(&fpriv->ctx_mgr, usage);

/*
Expand Down Expand Up @@ -114,9 +107,11 @@ void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file)
drm_printf(p, "amd-evicted-vram:\t%llu KiB\n",
stats[TTM_PL_VRAM].evicted/1024UL);
drm_printf(p, "amd-requested-vram:\t%llu KiB\n",
stats[TTM_PL_VRAM].requested/1024UL);
(stats[TTM_PL_VRAM].drm.shared +
stats[TTM_PL_VRAM].drm.private) / 1024UL);
drm_printf(p, "amd-requested-gtt:\t%llu KiB\n",
stats[TTM_PL_TT].requested/1024UL);
(stats[TTM_PL_TT].drm.shared +
stats[TTM_PL_TT].drm.private) / 1024UL);

for (hw_ip = 0; hw_ip < AMDGPU_HW_IP_NUM; ++hw_ip) {
if (!usage[hw_ip])
Expand Down
Loading

0 comments on commit 0739b8b

Please sign in to comment.