>> @@ -4488,7 +4471,6 @@ static MemTxResult vtd_mem_ir_write(void *opaque,
>hwaddr addr,
>>      int ret = 0;
>>      MSIMessage from = {}, to = {};
>>      uint16_t sid = X86_IOMMU_SID_INVALID;
>> -    uint32_t pasid;
>>
>>      from.address = (uint64_t) addr + VTD_INTERRUPT_ADDR_FIRST;
>>      from.data = (uint32_t) value;
>> @@ -4496,11 +4478,11 @@ static MemTxResult vtd_mem_ir_write(void
>*opaque, hwaddr addr,
>>      if (!attrs.unspecified) {
>>          /* We have explicit Source ID */
>>          sid = attrs.requester_id;
>> -        pasid = attrs.pid != 0 ? attrs.pid : PCI_NO_PASID;
>
>Are we relying on the fact that IOMMU_NO_PASID is 0?
>Maybe we could add a comment/assert about that?

Yes, will add below to prevent anyone changing its value.

--- a/include/hw/core/iommu.h
+++ b/include/hw/core/iommu.h
@@ -41,6 +41,10 @@ enum host_iommu_quirks {
     HOST_IOMMU_QUIRK_NESTING_PARENT_BYPASS_RO = BIT_ULL(0),
 };

+/*
+ * Value 0 is shared between kernel and QEMU for IOMMU_NO_PASID, so never
+ * change it
+ */
 #define IOMMU_NO_PASID 0

Thanks
Zhenzhong

Reply via email to