Re: [PATCH v2 16/26] drm/xe/pf: Add helpers for VF GGTT migration data handling

From: Michal Wajdeczko

Date: Tue Oct 28 2025 - 03:38:33 EST




On 10/28/2025 4:22 AM, Tian, Kevin wrote:
>> From: Winiarski, Michal <michal.winiarski@xxxxxxxxx>
>> Sent: Wednesday, October 22, 2025 6:41 AM
>>
>> +int xe_ggtt_node_load(struct xe_ggtt_node *node, const void *src, size_t
>> size, u16 vfid)
>> +{
>> + u64 vfid_pte = xe_encode_vfid_pte(vfid);
>> + const u64 *buf = src;
>> + struct xe_ggtt *ggtt;
>> + u64 start, end;
>> +
>> + if (!node)
>> + return -ENOENT;
>> +
>> + guard(mutex)(&node->ggtt->lock);
>> +
>> + ggtt = node->ggtt;
>> + start = node->base.start;
>> + end = start + size - 1;
>> +
>> + if (xe_ggtt_pte_size(ggtt, node->base.size) != size)
>> + return -EINVAL;
>> +
>> + while (start < end) {
>> + ggtt->pt_ops->ggtt_set_pte(ggtt, start, (*buf &
>> ~GGTT_PTE_VFID) | vfid_pte);
>> + start += XE_PAGE_SIZE;
>> + buf++;
>> + }
>
> static u64 xe_encode_vfid_pte(u16 vfid)
> {
> return FIELD_PREP(GGTT_PTE_VFID, vfid) | XE_PAGE_PRESENT;
> }
>
> so above loop blindly set every GGTT entry to valid. Isn't the right
> thing to carry the present bit from the src buffer?

VFs can't modify VALID/PRESENT(0) bit so it must be always set by PF

Bspec: 52395