Re: [PATCH 3/5] iommu/amd: Fix missing CMD_COMPLETE_PPR response for invalid PPR requests

Vasant Hegde <[email protected]> Thu, 30 Jul 2026 17:02:35 +0530
Newsgroups dev.linux.lists.iommu
Message-ID <[email protected]>

On 7/28/2026 12:02 PM, Ankit Soni wrote:
> On Mon, Jul 27, 2026 at 05:39:05AM +0000, Vasant Hegde wrote:
>> The AMD IOMMU spec, requires the host to respond with a CMD_COMPLETE_PPR
>> command when an EVENT_TYPE_INV_PPR_REQ event is received with the RX bit
>> cleared. This response was missing in the current implementation, leaving
>> invalid PPR requests unacknowledged.
>>
>> Introduce amd_iommu_report_ppr_err() to handle EVENT_TYPE_INV_PPR_REQ
>> events. The new function logs the invalid PPR request and when the RX
>> bit is cleared, sends CMD_COMPLETE_PPR response.

.../...

>>  
>> +static void amd_iommu_report_ppr_err(struct amd_iommu *iommu, volatile u32 *event,
>> +				     u16 devid, u64 address, int flags)
>> +{
>> +	struct pci_dev *pdev;
>> +	struct device *dev = iommu->iommu.dev;
>> +	u32 pasid = PPR_PASID(*((u64 *)event));
>> +	int tag = event[1] & 0x03FF;
>> +
>> +	dev_err(dev, "Event logged [INVALID_PPR_REQUEST device=%04x:%02x:%02x.%x pasid=0x%05x address=0x%llx flags=0x%04x tag=0x%03x]\n",
>> +		iommu->pci_seg->id, PCI_BUS_NUM(devid), PCI_SLOT(devid), PCI_FUNC(devid),
>> +		pasid, address, flags, tag);
>> +
>> +	/* Skip COMPLETE_PPR_REQUEST response if RX=1 */
>> +	if (flags & EVENT_FLAG_PPR_RX)
>> +		return;
>> +
>> +	pdev = pci_get_domain_bus_and_slot(iommu->pci_seg->id, PCI_BUS_NUM(devid),
>> +					   devid & 0xff);
>> +	if (!pdev)
>> +		return;
>> +
>> +	if (!dev_iommu_priv_get(&pdev->dev)) {
> 
> Hi Vasant,
> May be corener case, we return without sending COMPLETE_PPR. Since the 
> goal of this patch is to always respond when RX=0, and the completion only
> needs the devid (already available from the event) and iommu, should these
> paths still issue the completion directly via 
> build_complete_ppr()/iommu_queue_command() rather than just return?

That's even before the probe is complete. At that point we don't get these event
as interrupts are not configured. So its fine to return here.

-Vasant