On 27.02.2025 17:49, Jason Andryuk wrote: > On 2025-02-27 03:54, Jan Beulich wrote: >> On 26.02.2025 22:11, Jason Andryuk wrote: >>> Signed-off-by: Xenia Ragiadakou <xenia.ragiada...@amd.com> >>> Signed-off-by: Jason Andryuk <jason.andr...@amd.com> >> >> Just to clarify: Who's the original patch author? The common expectation >> is that the first S-o-b: matches From:. > > I took Xenia's changes to xen/drivers/passthrough/pci.c and > xen/include/xen/pci.h from an earlier patch and re-used them. I wrote > the rest, so I put myself in the Form: line.
Unusual arrangements of tags typically call for some clarification in ... >>> --- ... the post-commit-message area. In the case here the question arises whether a different tag (Co-Developed-by:?) might not be better. >>> --- a/xen/drivers/passthrough/amd/iommu_intr.c >>> +++ b/xen/drivers/passthrough/amd/iommu_intr.c >>> @@ -543,6 +543,31 @@ int cf_check amd_iommu_msi_msg_update_ire( >>> if ( !msg ) >>> return 0; >>> >>> + if ( pdev->gvec_as_irte_idx && amd_iommu_perdev_intremap ) >>> + { >>> + int new_remap_index = 0; >>> + if ( msi_desc->gvec ) >>> + { >>> + printk("%pp: gvec remap_index %#x -> %#x\n", &pdev->sbdf, >>> + msi_desc->remap_index, msi_desc->gvec); >>> + new_remap_index = msi_desc->gvec; >>> + } >>> + >>> + if ( new_remap_index && new_remap_index != msi_desc->remap_index && >>> + msi_desc->remap_index != -1 ) >>> + { >>> + /* Clear any existing entries */ >>> + update_intremap_entry_from_msi_msg(iommu, bdf, nr, >>> + &msi_desc->remap_index, >>> + NULL, NULL); >>> + >>> + for ( i = 0; i < nr; ++i ) >>> + msi_desc[i].remap_index = -1; >>> + >>> + msi_desc->remap_index = new_remap_index; >> >> You zap nr entries, and then set only 1? Doesn't the zapping loop need to >> instead be a setting one? Perhaps with a check up front that the last value >> used will still fit in 8 bits? Or else make applying the quirk conditional >> upon nr == 1? > > The code below here sets all `nr` entries on success: > > rc = update_intremap_entry_from_msi_msg(iommu, bdf, nr, > &msi_desc->remap_index, > msg, &data); > if ( !rc ) > { > for ( i = 1; i < nr; ++i ) > msi_desc[i].remap_index = msi_desc->remap_index + i; > msg->data = data; > } > > return rc; Ah, yes, I see now how this matches other behavior in the function. > Maybe all the remap_index settting should be moved into > update_intremap_entry_from_msi_msg()? That would require passing in msi_desc (or making assumptions on the passed in "int *remap_index"), neither of which looks very attractive to me. Jan