Skip to content

Commit 1cd0c7a

Browse files
committed
Merge tag 'drm-misc-next-2025-08-21' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-next
drm-misc-next for v6.18: Core Changes: bridge: - Support Content Protection property gpuvm: - Support madvice in Xe driver mipi: - Add more multi-read/write helpers for improved error handling Driver Changes: amdxdna: - Refactoring wrt. hardware contexts bridge: - display-connector: Improve DP display detection panel: - Fix includes in various drivers panthor: - Add support for Mali G710, G510, G310, Gx15, Gx20, Gx25 - Improve cache flushing Signed-off-by: Dave Airlie <[email protected]> From: Thomas Zimmermann <[email protected]> Link: https://lore.kernel.org/r/20250821073822.GA45904@2a02-2454-fd5e-fd00-8f09-b5f-980b-a7ef.dyn6.pyur.net
2 parents dd489c0 + 043d9c6 commit 1cd0c7a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+858
-559
lines changed

drivers/accel/amdxdna/aie2_ctx.c

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -133,43 +133,49 @@ static void aie2_hwctx_wait_for_idle(struct amdxdna_hwctx *hwctx)
133133
dma_fence_put(fence);
134134
}
135135

136+
static int aie2_hwctx_suspend_cb(struct amdxdna_hwctx *hwctx, void *arg)
137+
{
138+
struct amdxdna_dev *xdna = hwctx->client->xdna;
139+
140+
aie2_hwctx_wait_for_idle(hwctx);
141+
aie2_hwctx_stop(xdna, hwctx, NULL);
142+
aie2_hwctx_status_shift_stop(hwctx);
143+
144+
return 0;
145+
}
146+
136147
void aie2_hwctx_suspend(struct amdxdna_client *client)
137148
{
138149
struct amdxdna_dev *xdna = client->xdna;
139-
struct amdxdna_hwctx *hwctx;
140-
unsigned long hwctx_id;
141150

142151
/*
143152
* Command timeout is unlikely. But if it happens, it doesn't
144153
* break the system. aie2_hwctx_stop() will destroy mailbox
145154
* and abort all commands.
146155
*/
147156
drm_WARN_ON(&xdna->ddev, !mutex_is_locked(&xdna->dev_lock));
148-
guard(mutex)(&client->hwctx_lock);
149-
amdxdna_for_each_hwctx(client, hwctx_id, hwctx) {
150-
aie2_hwctx_wait_for_idle(hwctx);
151-
aie2_hwctx_stop(xdna, hwctx, NULL);
152-
aie2_hwctx_status_shift_stop(hwctx);
153-
}
157+
amdxdna_hwctx_walk(client, NULL, aie2_hwctx_suspend_cb);
154158
}
155159

156-
void aie2_hwctx_resume(struct amdxdna_client *client)
160+
static int aie2_hwctx_resume_cb(struct amdxdna_hwctx *hwctx, void *arg)
161+
{
162+
struct amdxdna_dev *xdna = hwctx->client->xdna;
163+
164+
aie2_hwctx_status_restore(hwctx);
165+
return aie2_hwctx_restart(xdna, hwctx);
166+
}
167+
168+
int aie2_hwctx_resume(struct amdxdna_client *client)
157169
{
158170
struct amdxdna_dev *xdna = client->xdna;
159-
struct amdxdna_hwctx *hwctx;
160-
unsigned long hwctx_id;
161171

162172
/*
163173
* The resume path cannot guarantee that mailbox channel can be
164174
* regenerated. If this happen, when submit message to this
165175
* mailbox channel, error will return.
166176
*/
167177
drm_WARN_ON(&xdna->ddev, !mutex_is_locked(&xdna->dev_lock));
168-
guard(mutex)(&client->hwctx_lock);
169-
amdxdna_for_each_hwctx(client, hwctx_id, hwctx) {
170-
aie2_hwctx_status_restore(hwctx);
171-
aie2_hwctx_restart(xdna, hwctx);
172-
}
178+
return amdxdna_hwctx_walk(client, NULL, aie2_hwctx_resume_cb);
173179
}
174180

175181
static void

drivers/accel/amdxdna/aie2_message.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -290,31 +290,34 @@ int aie2_map_host_buf(struct amdxdna_dev_hdl *ndev, u32 context_id, u64 addr, u6
290290
return 0;
291291
}
292292

293+
static int amdxdna_hwctx_col_map(struct amdxdna_hwctx *hwctx, void *arg)
294+
{
295+
u32 *bitmap = arg;
296+
297+
*bitmap |= GENMASK(hwctx->start_col + hwctx->num_col - 1, hwctx->start_col);
298+
299+
return 0;
300+
}
301+
293302
int aie2_query_status(struct amdxdna_dev_hdl *ndev, char __user *buf,
294303
u32 size, u32 *cols_filled)
295304
{
296305
DECLARE_AIE2_MSG(aie_column_info, MSG_OP_QUERY_COL_STATUS);
297306
struct amdxdna_dev *xdna = ndev->xdna;
298307
struct amdxdna_client *client;
299-
struct amdxdna_hwctx *hwctx;
300-
unsigned long hwctx_id;
301308
dma_addr_t dma_addr;
302309
u32 aie_bitmap = 0;
303310
u8 *buff_addr;
304-
int ret, idx;
311+
int ret;
305312

306313
buff_addr = dma_alloc_noncoherent(xdna->ddev.dev, size, &dma_addr,
307314
DMA_FROM_DEVICE, GFP_KERNEL);
308315
if (!buff_addr)
309316
return -ENOMEM;
310317

311318
/* Go through each hardware context and mark the AIE columns that are active */
312-
list_for_each_entry(client, &xdna->client_list, node) {
313-
idx = srcu_read_lock(&client->hwctx_srcu);
314-
amdxdna_for_each_hwctx(client, hwctx_id, hwctx)
315-
aie_bitmap |= amdxdna_hwctx_col_map(hwctx);
316-
srcu_read_unlock(&client->hwctx_srcu, idx);
317-
}
319+
list_for_each_entry(client, &xdna->client_list, node)
320+
amdxdna_hwctx_walk(client, &aie_bitmap, amdxdna_hwctx_col_map);
318321

319322
*cols_filled = 0;
320323
req.dump_buff_addr = dma_addr;

drivers/accel/amdxdna/aie2_pci.c

Lines changed: 44 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <drm/drm_managed.h>
1111
#include <drm/drm_print.h>
1212
#include <drm/gpu_scheduler.h>
13+
#include <linux/cleanup.h>
1314
#include <linux/errno.h>
1415
#include <linux/firmware.h>
1516
#include <linux/iommu.h>
@@ -465,8 +466,11 @@ static int aie2_hw_resume(struct amdxdna_dev *xdna)
465466
return ret;
466467
}
467468

468-
list_for_each_entry(client, &xdna->client_list, node)
469-
aie2_hwctx_resume(client);
469+
list_for_each_entry(client, &xdna->client_list, node) {
470+
ret = aie2_hwctx_resume(client);
471+
if (ret)
472+
break;
473+
}
470474

471475
return ret;
472476
}
@@ -779,65 +783,56 @@ static int aie2_get_clock_metadata(struct amdxdna_client *client,
779783
return ret;
780784
}
781785

786+
static int aie2_hwctx_status_cb(struct amdxdna_hwctx *hwctx, void *arg)
787+
{
788+
struct amdxdna_drm_query_hwctx __user *buf, *tmp __free(kfree) = NULL;
789+
struct amdxdna_drm_get_info *get_info_args = arg;
790+
791+
if (get_info_args->buffer_size < sizeof(*tmp))
792+
return -EINVAL;
793+
794+
tmp = kzalloc(sizeof(*tmp), GFP_KERNEL);
795+
if (!tmp)
796+
return -ENOMEM;
797+
798+
tmp->pid = hwctx->client->pid;
799+
tmp->context_id = hwctx->id;
800+
tmp->start_col = hwctx->start_col;
801+
tmp->num_col = hwctx->num_col;
802+
tmp->command_submissions = hwctx->priv->seq;
803+
tmp->command_completions = hwctx->priv->completed;
804+
805+
buf = u64_to_user_ptr(get_info_args->buffer);
806+
807+
if (copy_to_user(buf, tmp, sizeof(*tmp)))
808+
return -EFAULT;
809+
810+
get_info_args->buffer += sizeof(*tmp);
811+
get_info_args->buffer_size -= sizeof(*tmp);
812+
813+
return 0;
814+
}
815+
782816
static int aie2_get_hwctx_status(struct amdxdna_client *client,
783817
struct amdxdna_drm_get_info *args)
784818
{
785-
struct amdxdna_drm_query_hwctx __user *buf;
786819
struct amdxdna_dev *xdna = client->xdna;
787-
struct amdxdna_drm_query_hwctx *tmp;
820+
struct amdxdna_drm_get_info info_args;
788821
struct amdxdna_client *tmp_client;
789-
struct amdxdna_hwctx *hwctx;
790-
unsigned long hwctx_id;
791-
bool overflow = false;
792-
u32 req_bytes = 0;
793-
u32 hw_i = 0;
794-
int ret = 0;
795-
int idx;
822+
int ret;
796823

797824
drm_WARN_ON(&xdna->ddev, !mutex_is_locked(&xdna->dev_lock));
798825

799-
tmp = kzalloc(sizeof(*tmp), GFP_KERNEL);
800-
if (!tmp)
801-
return -ENOMEM;
826+
info_args.buffer = args->buffer;
827+
info_args.buffer_size = args->buffer_size;
802828

803-
buf = u64_to_user_ptr(args->buffer);
804829
list_for_each_entry(tmp_client, &xdna->client_list, node) {
805-
idx = srcu_read_lock(&tmp_client->hwctx_srcu);
806-
amdxdna_for_each_hwctx(tmp_client, hwctx_id, hwctx) {
807-
req_bytes += sizeof(*tmp);
808-
if (args->buffer_size < req_bytes) {
809-
/* Continue iterating to get the required size */
810-
overflow = true;
811-
continue;
812-
}
813-
814-
memset(tmp, 0, sizeof(*tmp));
815-
tmp->pid = tmp_client->pid;
816-
tmp->context_id = hwctx->id;
817-
tmp->start_col = hwctx->start_col;
818-
tmp->num_col = hwctx->num_col;
819-
tmp->command_submissions = hwctx->priv->seq;
820-
tmp->command_completions = hwctx->priv->completed;
821-
822-
if (copy_to_user(&buf[hw_i], tmp, sizeof(*tmp))) {
823-
ret = -EFAULT;
824-
srcu_read_unlock(&tmp_client->hwctx_srcu, idx);
825-
goto out;
826-
}
827-
hw_i++;
828-
}
829-
srcu_read_unlock(&tmp_client->hwctx_srcu, idx);
830-
}
831-
832-
if (overflow) {
833-
XDNA_ERR(xdna, "Invalid buffer size. Given: %u Need: %u.",
834-
args->buffer_size, req_bytes);
835-
ret = -EINVAL;
830+
ret = amdxdna_hwctx_walk(tmp_client, &info_args, aie2_hwctx_status_cb);
831+
if (ret)
832+
break;
836833
}
837834

838-
out:
839-
kfree(tmp);
840-
args->buffer_size = req_bytes;
835+
args->buffer_size = (u32)(info_args.buffer - args->buffer);
841836
return ret;
842837
}
843838

drivers/accel/amdxdna/aie2_pci.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ int aie2_hwctx_init(struct amdxdna_hwctx *hwctx);
289289
void aie2_hwctx_fini(struct amdxdna_hwctx *hwctx);
290290
int aie2_hwctx_config(struct amdxdna_hwctx *hwctx, u32 type, u64 value, void *buf, u32 size);
291291
void aie2_hwctx_suspend(struct amdxdna_client *client);
292-
void aie2_hwctx_resume(struct amdxdna_client *client);
292+
int aie2_hwctx_resume(struct amdxdna_client *client);
293293
int aie2_cmd_submit(struct amdxdna_hwctx *hwctx, struct amdxdna_sched_job *job, u64 *seq);
294294
void aie2_hmm_invalidate(struct amdxdna_gem_obj *abo, unsigned long cur_seq);
295295

drivers/accel/amdxdna/amdxdna_ctx.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,30 @@ static void amdxdna_hwctx_destroy_rcu(struct amdxdna_hwctx *hwctx,
6868
synchronize_srcu(ss);
6969

7070
/* At this point, user is not able to submit new commands */
71-
mutex_lock(&xdna->dev_lock);
7271
xdna->dev_info->ops->hwctx_fini(hwctx);
73-
mutex_unlock(&xdna->dev_lock);
7472

7573
kfree(hwctx->name);
7674
kfree(hwctx);
7775
}
7876

77+
int amdxdna_hwctx_walk(struct amdxdna_client *client, void *arg,
78+
int (*walk)(struct amdxdna_hwctx *hwctx, void *arg))
79+
{
80+
struct amdxdna_hwctx *hwctx;
81+
unsigned long hwctx_id;
82+
int ret = 0, idx;
83+
84+
idx = srcu_read_lock(&client->hwctx_srcu);
85+
amdxdna_for_each_hwctx(client, hwctx_id, hwctx) {
86+
ret = walk(hwctx, arg);
87+
if (ret)
88+
break;
89+
}
90+
srcu_read_unlock(&client->hwctx_srcu, idx);
91+
92+
return ret;
93+
}
94+
7995
void *amdxdna_cmd_get_payload(struct amdxdna_gem_obj *abo, u32 *size)
8096
{
8197
struct amdxdna_cmd *cmd = abo->mem.kva;
@@ -126,16 +142,12 @@ void amdxdna_hwctx_remove_all(struct amdxdna_client *client)
126142
struct amdxdna_hwctx *hwctx;
127143
unsigned long hwctx_id;
128144

129-
mutex_lock(&client->hwctx_lock);
130145
amdxdna_for_each_hwctx(client, hwctx_id, hwctx) {
131146
XDNA_DBG(client->xdna, "PID %d close HW context %d",
132147
client->pid, hwctx->id);
133148
xa_erase(&client->hwctx_xa, hwctx->id);
134-
mutex_unlock(&client->hwctx_lock);
135149
amdxdna_hwctx_destroy_rcu(hwctx, &client->hwctx_srcu);
136-
mutex_lock(&client->hwctx_lock);
137150
}
138-
mutex_unlock(&client->hwctx_lock);
139151
}
140152

141153
int amdxdna_drm_create_hwctx_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
@@ -225,6 +237,7 @@ int amdxdna_drm_destroy_hwctx_ioctl(struct drm_device *dev, void *data, struct d
225237
if (!drm_dev_enter(dev, &idx))
226238
return -ENODEV;
227239

240+
mutex_lock(&xdna->dev_lock);
228241
hwctx = xa_erase(&client->hwctx_xa, args->handle);
229242
if (!hwctx) {
230243
ret = -EINVAL;
@@ -241,6 +254,7 @@ int amdxdna_drm_destroy_hwctx_ioctl(struct drm_device *dev, void *data, struct d
241254

242255
XDNA_DBG(xdna, "PID %d destroyed HW context %d", client->pid, args->handle);
243256
out:
257+
mutex_unlock(&xdna->dev_lock);
244258
drm_dev_exit(idx);
245259
return ret;
246260
}

drivers/accel/amdxdna/amdxdna_ctx.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,10 @@ amdxdna_cmd_get_state(struct amdxdna_gem_obj *abo)
139139
void *amdxdna_cmd_get_payload(struct amdxdna_gem_obj *abo, u32 *size);
140140
int amdxdna_cmd_get_cu_idx(struct amdxdna_gem_obj *abo);
141141

142-
static inline u32 amdxdna_hwctx_col_map(struct amdxdna_hwctx *hwctx)
143-
{
144-
return GENMASK(hwctx->start_col + hwctx->num_col - 1,
145-
hwctx->start_col);
146-
}
147-
148142
void amdxdna_sched_job_cleanup(struct amdxdna_sched_job *job);
149143
void amdxdna_hwctx_remove_all(struct amdxdna_client *client);
144+
int amdxdna_hwctx_walk(struct amdxdna_client *client, void *arg,
145+
int (*walk)(struct amdxdna_hwctx *hwctx, void *arg));
150146

151147
int amdxdna_cmd_submit(struct amdxdna_client *client,
152148
u32 cmd_bo_hdls, u32 *arg_bo_hdls, u32 arg_bo_cnt,

drivers/accel/amdxdna/amdxdna_pci_drv.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ static int amdxdna_drm_open(struct drm_device *ddev, struct drm_file *filp)
8181
ret = -ENODEV;
8282
goto unbind_sva;
8383
}
84-
mutex_init(&client->hwctx_lock);
8584
init_srcu_struct(&client->hwctx_srcu);
8685
xa_init_flags(&client->hwctx_xa, XA_FLAGS_ALLOC);
8786
mutex_init(&client->mm_lock);
@@ -116,7 +115,6 @@ static void amdxdna_drm_close(struct drm_device *ddev, struct drm_file *filp)
116115

117116
xa_destroy(&client->hwctx_xa);
118117
cleanup_srcu_struct(&client->hwctx_srcu);
119-
mutex_destroy(&client->hwctx_lock);
120118
mutex_destroy(&client->mm_lock);
121119
if (client->dev_heap)
122120
drm_gem_object_put(to_gobj(client->dev_heap));
@@ -142,8 +140,8 @@ static int amdxdna_flush(struct file *f, fl_owner_t id)
142140

143141
mutex_lock(&xdna->dev_lock);
144142
list_del_init(&client->node);
145-
mutex_unlock(&xdna->dev_lock);
146143
amdxdna_hwctx_remove_all(client);
144+
mutex_unlock(&xdna->dev_lock);
147145

148146
drm_dev_exit(idx);
149147
return 0;
@@ -330,11 +328,8 @@ static void amdxdna_remove(struct pci_dev *pdev)
330328
struct amdxdna_client, node);
331329
while (client) {
332330
list_del_init(&client->node);
333-
mutex_unlock(&xdna->dev_lock);
334-
335331
amdxdna_hwctx_remove_all(client);
336332

337-
mutex_lock(&xdna->dev_lock);
338333
client = list_first_entry_or_null(&xdna->client_list,
339334
struct amdxdna_client, node);
340335
}

drivers/accel/amdxdna/amdxdna_pci_drv.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,6 @@ struct amdxdna_device_id {
116116
struct amdxdna_client {
117117
struct list_head node;
118118
pid_t pid;
119-
struct mutex hwctx_lock; /* protect hwctx */
120-
/* do NOT wait this srcu when hwctx_lock is held */
121119
struct srcu_struct hwctx_srcu;
122120
struct xarray hwctx_xa;
123121
u32 next_hwctxid;

drivers/gpu/drm/bridge/analogix/anx7625.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2604,6 +2604,7 @@ static int anx7625_link_bridge(struct drm_dp_aux *aux)
26042604
platform->bridge.type = platform->pdata.panel_bridge ?
26052605
DRM_MODE_CONNECTOR_eDP :
26062606
DRM_MODE_CONNECTOR_DisplayPort;
2607+
platform->bridge.support_hdcp = true;
26072608

26082609
drm_bridge_add(&platform->bridge);
26092610

drivers/gpu/drm/bridge/display-connector.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,8 @@ static int display_connector_probe(struct platform_device *pdev)
373373
if (conn->bridge.ddc)
374374
conn->bridge.ops |= DRM_BRIDGE_OP_EDID
375375
| DRM_BRIDGE_OP_DETECT;
376-
if (conn->hpd_gpio)
376+
/* Detecting the monitor requires reading DPCD */
377+
if (conn->hpd_gpio && type != DRM_MODE_CONNECTOR_DisplayPort)
377378
conn->bridge.ops |= DRM_BRIDGE_OP_DETECT;
378379
if (conn->hpd_irq >= 0)
379380
conn->bridge.ops |= DRM_BRIDGE_OP_HPD;

0 commit comments

Comments
 (0)