mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lizhi Hou <lizhi.hou@amd.com>
To: Mario Limonciello <superm1@kernel.org>, <ogabbay@kernel.org>,
	<quic_jhugo@quicinc.com>, <dri-devel@lists.freedesktop.org>,
	<karol.wachowski@linux.intel.com>
Cc: <linux-kernel@vger.kernel.org>, <max.zhen@amd.com>,
	<sonal.santan@amd.com>
Subject: Re: [PATCH V1] accel/amdxdna: Fix clflush buffer size
Date: Thu, 7 May 2026 14:23:02 -0700	[thread overview]
Message-ID: <73364760-c053-6be0-20a6-3ed549114797@amd.com> (raw)
In-Reply-To: <88330822-679b-497a-a2a1-93e0176cf022@kernel.org>

Applied to drm-misc-next

On 5/7/26 09:55, Mario Limonciello wrote:
>
>
> On 5/6/26 23:02, Lizhi Hou wrote:
>> The firmware is told the buffer is req.buf_size bytes. It may read/write
>> the entire region. If the CPU only flushes a subset, the remaining cache
>> lines could contain stale data, causing the device to see garbage.
>>
>> Fixes: 6e87001fe19f ("accel/amdxdna: Adjust size for copy_to_user()")
>> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
> Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
>> ---
>>   drivers/accel/amdxdna/aie2_message.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/accel/amdxdna/aie2_message.c 
>> b/drivers/accel/amdxdna/aie2_message.c
>> index 6e98af7b74db..a012e7e935ad 100644
>> --- a/drivers/accel/amdxdna/aie2_message.c
>> +++ b/drivers/accel/amdxdna/aie2_message.c
>> @@ -390,7 +390,7 @@ int aie2_query_status(struct amdxdna_dev_hdl 
>> *ndev, char __user *buf,
>>       req.num_cols = hweight32(aie_bitmap);
>>       req.aie_bitmap = aie_bitmap;
>>   -    drm_clflush_virt_range(buff_addr, size); /* device can access */
>> +    drm_clflush_virt_range(buff_addr, req.dump_buff_size); /* device 
>> can access */
>>       ret = aie_send_mgmt_msg_wait(&ndev->aie, &msg);
>>       if (ret) {
>>           XDNA_ERR(xdna, "Error during NPU query, status %d", ret);
>> @@ -442,7 +442,7 @@ int aie2_query_telemetry(struct amdxdna_dev_hdl 
>> *ndev,
>>       req.buf_size = buf_sz;
>>       req.type = header->type;
>>   -    drm_clflush_virt_range(addr, size); /* device can access */
>> +    drm_clflush_virt_range(addr, req.buf_size); /* device can access */
>>       ret = aie_send_mgmt_msg_wait(&ndev->aie, &msg);
>>       if (ret) {
>>           XDNA_ERR(xdna, "Query telemetry failed, status %d", ret);
>> @@ -1186,7 +1186,7 @@ int aie2_query_app_health(struct 
>> amdxdna_dev_hdl *ndev, u32 context_id,
>>       req.context_id = context_id;
>>       req.buf_size = buf_size;
>>   -    drm_clflush_virt_range(buf, sizeof(*report));
>> +    drm_clflush_virt_range(buf, req.buf_size);
>>       ret = aie_send_mgmt_msg_wait(&ndev->aie, &msg);
>>       if (ret) {
>>           XDNA_ERR(xdna, "Get app health failed, ret %d status 0x%x", 
>> ret, resp.status);
>

      reply	other threads:[~2026-05-07 21:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-07  4:02 Lizhi Hou
2026-05-07 16:55 ` Mario Limonciello
2026-05-07 21:23   ` Lizhi Hou [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=73364760-c053-6be0-20a6-3ed549114797@amd.com \
    --to=lizhi.hou@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=karol.wachowski@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=max.zhen@amd.com \
    --cc=ogabbay@kernel.org \
    --cc=quic_jhugo@quicinc.com \
    --cc=sonal.santan@amd.com \
    --cc=superm1@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®