intel_iommu: Allow both Status Write and Interrupt Flag in QI wait
PATCH v2 1/1 intel_iommu: Allow both Status Write and Interrupt Flag in QI wait
From: David Woodhouse <[email protected]>
FreeBSD does both, and this appears to be perfectly valid. The VT-d spec even talks about the ordering (the status write should be done first, unsurprisingly).
We certainly shouldn't assert() and abort QEMU if the guest asks for both.
---
v2:
• Only generate the interrupt once.
• Spaces around bitwise OR.
This stops QEMU crashing, but I still can't get FreeBSD to boot and use CPUs with APIC ID > 255 using *either* Intel or AMD IOMMU with interrupt remapping, or the native 15-bit APIC ID enlightenment. cf. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=288122
hw/i386/intel_iommu.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
hw/i386/intel_iommu.c +9 -6
@@ -2822,6 +2822,7 @@ static bool vtd_process_wait_desc(IntelIOMMUState *s, VTDInvDesc *inv_desc) {uint64_t mask[4 ] = {VTD_INV_DESC_WAIT_RSVD_LO ,VTD_INV_DESC_WAIT_RSVD_HI ,VTD_INV_DESC_ALL_ONE ,VTD_INV_DESC_ALL_ONE }; +bool ret = true;if (!vtd_inv_desc_reserved_check (s, inv_desc, mask, false, __func__,"wait" )) {
@@ -2833,8 +2834,6 @@ static bool vtd_process_wait_desc(IntelIOMMUState *s, VTDInvDesc *inv_desc)uint32_t status_data = (uint32_t )(inv_desc->lo >>VTD_INV_DESC_WAIT_DATA_SHIFT ); -assert (!(inv_desc->lo &VTD_INV_DESC_WAIT_IF )); -/* FIXME: need to be masked with HAW? */ dma_addr_t status_addr = inv_desc->hi;trace_vtd_inv_desc_wait_sw (status_addr, status_data);
@@ -2843,18 +2842,22 @@ static bool vtd_process_wait_desc(IntelIOMMUState *s, VTDInvDesc *inv_desc) &status_data, sizeof(status_data), MEMTXATTRS_UNSPECIFIED)) {trace_vtd_inv_desc_wait_write_fail (inv_desc->hi, inv_desc->lo); -return false; + ret = false; } - }else if (inv_desc->lo &VTD_INV_DESC_WAIT_IF ) { + } + +if (inv_desc->lo &VTD_INV_DESC_WAIT_IF ) {/* Interrupt flag */ vtd_generate_completion_event (s); - }else { + } + +if (!(inv_desc->lo & (VTD_INV_DESC_WAIT_IF |VTD_INV_DESC_WAIT_SW ))) {error_report_once ("%s: invalid wait desc: hi=%" PRIx64", lo=%" PRIx64" (unknown type)" , __func__, inv_desc->hi, inv_desc->lo);return false; } -return true; +return ret; } static bool vtd_process_context_cache_desc(IntelIOMMUState *s,
Signature · 1 line
2.43.0
Hi David,
Quoted 5 lines · David Woodhouse
From: David Woodhouse <[email protected]>
FreeBSD does both, and this appears to be perfectly valid. The VT-d spec even talks about the ordering (the status write should be done first, unsurprisingly).
interesting. Have you tried setting both flags on baremetal and the hw gives you both the status code and an interrupt?
Quoted 53 lines
We certainly shouldn't
assert()and abort QEMU if the guest asks for both.Fixes ed7b8fbcfb88 ("intel-iommu: add supports for queued invalidation interface")Signed-off-by David Woodhouse <[email protected]>---
v2:
• Only generate the interrupt once.
• Spaces around bitwise OR.This stops QEMU crashing, but I still can't get FreeBSD to boot and use CPUs with APIC ID > 255 using *either* Intel or AMD IOMMU with interrupt remapping, or the native 15-bit APIC ID enlightenment. cf. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=288122
hw/i386/intel_iommu.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)hw/i386/intel_iommu.c +5
-4@@ -2822,6 +2822,7 @@ static bool vtd_process_wait_desc(IntelIOMMUState *s, VTDInvDesc *inv_desc) {uint64_t mask[4 ] = {VTD_INV_DESC_WAIT_RSVD_LO ,VTD_INV_DESC_WAIT_RSVD_HI ,VTD_INV_DESC_ALL_ONE ,VTD_INV_DESC_ALL_ONE }; +bool ret = true;if (!vtd_inv_desc_reserved_check (s, inv_desc, mask, false, __func__,"wait" )) {@@ -2833,8 +2834,6 @@ static bool vtd_process_wait_desc(IntelIOMMUState *s, VTDInvDesc *inv_desc)uint32_t status_data = (uint32_t )(inv_desc->lo >>VTD_INV_DESC_WAIT_DATA_SHIFT ); -assert (!(inv_desc->lo &VTD_INV_DESC_WAIT_IF )); -/* FIXME: need to be masked with HAW? */ dma_addr_t status_addr = inv_desc->hi;trace_vtd_inv_desc_wait_sw (status_addr, status_data);@@ -2843,18 +2842,22 @@ static bool vtd_process_wait_desc(IntelIOMMUState *s, VTDInvDesc *inv_desc) &status_data, sizeof(status_data), MEMTXATTRS_UNSPECIFIED)) {trace_vtd_inv_desc_wait_write_fail (inv_desc->hi, inv_desc->lo); -return false; + ret = false; } - }else if (inv_desc->lo &VTD_INV_DESC_WAIT_IF ) { + } + +if (inv_desc->lo &VTD_INV_DESC_WAIT_IF ) {/* Interrupt flag */
hw/i386/intel_iommu.c static bool vtd_process_wait_desc(IntelIOMMUState *s, VTDInvDesc *inv_desc) · line 2859
Quoted 10 lines
hw/i386/intel_iommu.c +3
-1vtd_generate_completion_event (s); - }else { + } + +if (!(inv_desc->lo & (VTD_INV_DESC_WAIT_IF |VTD_INV_DESC_WAIT_SW ))) {error_report_once ("%s: invalid wait desc: hi=%" PRIx64", lo=%" PRIx64" (unknown type)" , __func__, inv_desc->hi, inv_desc->lo);return false; }
I think this "if branch" can be moved just after the inv_desc non-zero reserved bit checking. Hence you don't need a ret at all. :) btw. I'm also asking if VT-d spec allows it or not. So let's wait for a while..
Quoted 5 lines
hw/i386/intel_iommu.c +1
-1-return true; +return ret; } static bool vtd_process_context_cache_desc(IntelIOMMUState *s,
Signature · 2 lines
Regards, Yi Liu
Quoted 11 lines · Yi Liu
Hi David,
Quoted 5 lines · David Woodhouse
From: David Woodhouse <[email protected]>
FreeBSD does both, and this appears to be perfectly valid. The VT-d spec even talks about the ordering (the status write should be done first, unsurprisingly).
interesting. Have you tried setting both flags on baremetal and the hw gives you both the status code and an interrupt?
I see no reason why it shouldn't. The spec (§6.5.2.8) gives no that the IF and SW bits should be mutually exclusive and even talks about ordering:
Section 6.5.2.11 describes queued invalidation ordering considerations. Hardware completes an invalidation wait command as follows:
• If a status write is specified in the wait descriptor (SW=1), hardware performs a coherent write of the status data to the status address.
• If an interrupt is requested in the wait descriptor (IF=1), hardware sets the IWC field in the Invalidation Completion Status Register. An invalidation completion interrupt may be generated as described in the following section
Quoted 2 lines
I think this "if branch" can be moved just after the
inv_descnon-zero reserved bit checking. Hence you don't need a ret at all. :)
We want to return false if the memory write fails, and the interrupt has to happen afterwards.
Quoted 2 lines
btw. I'm
also asking if VT-d spec allows it or not. So let's wait for a while..
Ok.
Quoted 15 lines · David Woodhouse
Quoted 11 lines · Yi Liu
Hi David,
Quoted 5 lines · David Woodhouse
From: David Woodhouse <[email protected]>
FreeBSD does both, and this appears to be perfectly valid. The VT-d spec even talks about the ordering (the status write should be done first, unsurprisingly).
interesting. Have you tried setting both flags on baremetal and the hw gives you both the status code and an interrupt?
I see no reason why it shouldn't. The spec (§6.5.2.8) gives no that the IF and SW bits should be mutually exclusive and even talks about ordering:
Quoted 8 lines
Section 6.5.2.11 describes queued invalidation ordering considerations. Hardware completes an invalidation wait command as follows:
• If a status write is specified in the wait descriptor (SW=1), hardware performs a coherent write of the status data to the status address.
• If an interrupt is requested in the wait descriptor (IF=1), hardware sets the IWC field in the Invalidation Completion Status Register. An invalidation completion interrupt may be generated as described in the following section
Yes, and the FreeBSD DMAR code uses that, and relies on that, as was mentioned earlier in the mail thread.
Quoted 13 lines
Quoted 4 lines
I think this "if branch" can be moved just after the
inv_descnon-zero reserved bit checking. Hence you don't need a ret at all. :)We want to return false if the memory write fails, and the interrupt has to happen afterwards.
Quoted 2 lines
btw. I'm
also asking if VT-d spec allows it or not. So let's wait for a while..Ok.
Quoted 13 lines · Konstantin Belousov
Caution: External email. Do not open attachments or click links, unless this email comes from a known sender and you know the content is safe.
Quoted 9 lines · David Woodhouse
Quoted 8 lines · Yi Liu
Hi David,
Quoted 5 lines · David Woodhouse
From: David Woodhouse <[email protected]>
FreeBSD does both, and this appears to be perfectly valid. The VT-d spec even talks about the ordering (the status write should be done first, unsurprisingly).
Are you talking about the ordering constraint mentioned in bullet "Page-request Drain (PD)"?
Quoted 15 lines
Quoted 6 lines
Quoted 3 lines
interesting. Have you tried setting both flags on baremetal and the hw gives you both the status code and an interrupt?
I see no reason why it shouldn't. The spec (§6.5.2.8) gives no that the IF and SW bits should be mutually exclusive and even talks about ordering:
Quoted 8 lines
Section 6.5.2.11 describes queued invalidation ordering considerations. Hardware completes an invalidation wait command as follows:
• If a status write is specified in the wait descriptor (SW=1), hardware performs a coherent write of the status data to the status address.
• If an interrupt is requested in the wait descriptor (IF=1), hardware sets the IWC field in the Invalidation Completion Status Register. An invalidation completion interrupt may be generated as described in the following section
Quoted 9 lines
Yes, and the FreeBSD DMAR code uses that, and relies on that, as was mentioned earlier in the mail thread.
Quoted 6 lines
Quoted 4 lines
I think this "if branch" can be moved just after the
inv_descnon-zero reserved bit checking. Hence you don't need a ret at all. :)We want to return false if the memory write fails, and the interrupt has to happen afterwards.
Per spec: "Hardware behavior is undefined if the Status Address specified is not an address route-able to memory"
Do we want to trigger the interrupt even when the DMA fails?
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
btw. I'm
also asking if VT-d spec allows it or not. So let's wait for a while..
Thanks Yi
Quoted 4 lines
Quoted 4 lines
Ok.
Quoted 14 lines · CLEMENT MATHIEU--DRIF
Quoted 11 lines · Konstantin Belousov
Caution: External email. Do not open attachments or click links, unless this email comes from a known sender and you know the content is safe.
Quoted 5 lines · David Woodhouse
Quoted 3 lines · Yi Liu
Hi David,
On 2025/7/14 16:00, David Woodhouse wrote:
Quoted 9 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
From: David Woodhouse <[email protected]>
FreeBSD does both, and this appears to be perfectly valid. The VT-d spec even talks about the ordering (the status write should be done first, unsurprisingly).
Are you talking about the ordering constraint mentioned in bullet "Page-request Drain (PD)"?
No, in the v4.0 spec it's just below that bullet list, at the bottom of §6.5.2.8.
The wording in §6.5.2.9 is even clearer:
"The invalidation completion event interrupt must push any in-flight invalidation completion status writes, including status writes that may have originated from the same inv_wait_dsc for which the interrupt was generated."
Quoted 10 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
I think this "if branch" can be moved just after the
inv_descnon-zero reserved bit checking. Hence you don't need a ret at all. :)We want to return false if the memory write fails, and the interrupt has to happen afterwards.
Per spec: "Hardware behavior is undefined if the Status Address specified is not an address route-able to memory"
Do we want to trigger the interrupt even when the DMA fails?
Yes, we do. That's a quality of implementation issue. Just because the behaviour is 'undefined' and theoretically gives us permission to do whatever we like to the guest, we should still be as sensible as possible.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
btw. I'm
also asking if VT-d spec allows it or not. So let's wait for a while..
Rapidly losing interest in this conversation. QEMU currently has a guest-triggerable crash, for crying out loud. I'd like to fix it and move on to finding out why FreeBSD doesn't work *even* when QEMU doesn't abort...
Quoted 28 lines · David Woodhouse
Quoted 14 lines · CLEMENT MATHIEU--DRIF
Quoted 11 lines · Konstantin Belousov
Caution: External email. Do not open attachments or click links, unless this email comes from a known sender and you know the content is safe.
Quoted 5 lines · David Woodhouse
Quoted 3 lines · Yi Liu
Hi David,
On 2025/7/14 16:00, David Woodhouse wrote:
Quoted 9 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
From: David Woodhouse <[email protected]>
FreeBSD does both, and this appears to be perfectly valid. The VT-d spec even talks about the ordering (the status write should be done first, unsurprisingly).
Are you talking about the ordering constraint mentioned in bullet "Page-request Drain (PD)"?
No, in the v4.0 spec it's just below that bullet list, at the bottom of §6.5.2.8.
Quoted 6 lines
The wording in §6.5.2.9 is even clearer:
"The invalidation completion event interrupt must push any in-flight invalidation completion status writes, including status writes that may have originated from the same
inv_wait_dscfor which the interrupt was generated."
Fine
Quoted 10 lines
Quoted 10 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
I think this "if branch" can be moved just after the
inv_descnon-zero reserved bit checking. Hence you don't need a ret at all. :)We want to return false if the memory write fails, and the interrupt has to happen afterwards.
Per spec: "Hardware behavior is undefined if the Status Address specified is not an address route-able to memory"
Quoted 6 lines
Quoted 1 line
Do we want to trigger the interrupt even when the DMA fails?
Yes, we do. That's a quality of implementation issue. Just because the behaviour is 'undefined' and theoretically gives us permission to do whatever we like to the guest, we should still be as sensible as possible.
lgtm
Quoted 11 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
btw. I'm
also asking if VT-d spec allows it or not. So let's wait for a while..Rapidly losing interest in this conversation. QEMU currently has a guest-triggerable crash, for crying out loud. I'd like to fix it and move on to finding out why FreeBSD doesn't work *even* when QEMU doesn't abort...
Quoted 26 lines · CLEMENT MATHIEU--DRIF
Quoted 23 lines · David Woodhouse
Quoted 22 lines · CLEMENT MATHIEU--DRIF
Quoted 7 lines · Konstantin Belousov
Quoted 5 lines · David Woodhouse
Quoted 3 lines · Yi Liu
Hi David,
On 2025/7/14 16:00, David Woodhouse wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
From: David Woodhouse <[email protected]>
I think this "if branch" can be moved just after the
inv_descnon-zero reserved bit checking. Hence you don't need a ret at all. :)We want to return false if the memory write fails, and the interrupt has to happen afterwards.
Per spec: "Hardware behavior is undefined if the Status Address specified is not an address route-able to memory"
Quoted 7 lines
Quoted 6 lines
Quoted 1 line
Do we want to trigger the interrupt even when the DMA fails?
Yes, we do. That's a quality of implementation issue. Just because the behaviour is 'undefined' and theoretically gives us permission to do whatever we like to the guest, we should still be as sensible as possible.
Personally, I'm fine with generating the interrupt even the status write failed. But to avoid potential conflict, I've also raised this question to the VT-d spec owner. Haven't got a clear answer yet. To further understand this, may I ask some dumb questions here. Why FreeBSD set both SW and IF flag. What is the usage model here. Would software consider that all the QI descriptors prior to this specific wait descriptor has succeeded when either the interrupt got invoked or the expected status is written back?
Regards,
Yi Liu
Quoted 35 lines · Yi Liu
Quoted 26 lines · CLEMENT MATHIEU--DRIF
Quoted 23 lines · David Woodhouse
Quoted 22 lines · CLEMENT MATHIEU--DRIF
Quoted 7 lines · Konstantin Belousov
Quoted 5 lines · David Woodhouse
Quoted 3 lines · Yi Liu
Hi David,
On 2025/7/14 16:00, David Woodhouse wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
From: David Woodhouse <[email protected]>
I think this "if branch" can be moved just after the
inv_descnon-zero reserved bit checking. Hence you don't need a ret at all. :)We want to return false if the memory write fails, and the interrupt has to happen afterwards.
Per spec: "Hardware behavior is undefined if the Status Address specified is not an address route-able to memory"
Quoted 7 lines
Quoted 6 lines
Quoted 1 line
Do we want to trigger the interrupt even when the DMA fails?
Yes, we do. That's a quality of implementation issue. Just because the behaviour is 'undefined' and theoretically gives us permission to do whatever we like to the guest, we should still be as sensible as possible.
Quoted 7 lines
Personally, I'm fine with generating the interrupt even the status write failed. But to avoid potential conflict, I've also raised this question to the VT-d spec owner. Haven't got a clear answer yet. To further understand this, may I ask some dumb questions here. Why FreeBSD set both SW and IF flag. What is the usage model here. Would software consider that all the QI descriptors prior to this specific wait descriptor has succeeded when either the interrupt got invoked or the expected status is written back?
FreeBSD queues invalidations, each invalidation has the gen number. To know that some invalidation finished, FreeBSD waits for the interrupt, we do not scan the invalidation sequence word otherwise. There might be further generations of the invalidation descriptors in flight when we get the interrupt, which means that we need to know which generation is finished.
Quoted 44 lines · Konstantin Belousov
Quoted 35 lines · Yi Liu
Quoted 26 lines · CLEMENT MATHIEU--DRIF
Quoted 23 lines · David Woodhouse
Quoted 22 lines · CLEMENT MATHIEU--DRIF
Quoted 7 lines · Konstantin Belousov
Quoted 5 lines · David Woodhouse
Quoted 3 lines · Yi Liu
Hi David,
On 2025/7/14 16:00, David Woodhouse wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
From: David Woodhouse <[email protected]>
I think this "if branch" can be moved just after the
inv_descnon-zero reserved bit checking. Hence you don't need a ret at all. :)We want to return false if the memory write fails, and the interrupt has to happen afterwards.
Per spec: "Hardware behavior is undefined if the Status Address specified is not an address route-able to memory"
Quoted 7 lines
Quoted 6 lines
Quoted 1 line
Do we want to trigger the interrupt even when the DMA fails?
Yes, we do. That's a quality of implementation issue. Just because the behaviour is 'undefined' and theoretically gives us permission to do whatever we like to the guest, we should still be as sensible as possible.
Quoted 7 lines
Personally, I'm fine with generating the interrupt even the status write failed. But to avoid potential conflict, I've also raised this question to the VT-d spec owner. Haven't got a clear answer yet. To further understand this, may I ask some dumb questions here. Why FreeBSD set both SW and IF flag. What is the usage model here. Would software consider that all the QI descriptors prior to this specific wait descriptor has succeeded when either the interrupt got invoked or the expected status is written back?
Quoted 6 lines
FreeBSD queues invalidations, each invalidation has the gen number. To know that some invalidation finished, FreeBSD waits for the interrupt, we do not scan the invalidation sequence word otherwise. There might be further generations of the invalidation descriptors in flight when we get the interrupt, which means that we need to know which generation is finished.
thanks for the explanation. So software still relies on checking the written back status of the wait descriptor to identify finished invalidation. If so might be better to generate interrupt when status write is succeeded? Otherwise, the interrupt is meaningless to software. Does the current software implementation rely on this interrupt even status write failed?
Regards,
Yi Liu
Quoted 52 lines · Yi Liu
Quoted 44 lines · Konstantin Belousov
Quoted 35 lines · Yi Liu
Quoted 26 lines · CLEMENT MATHIEU--DRIF
Quoted 23 lines · David Woodhouse
Quoted 22 lines · CLEMENT MATHIEU--DRIF
Quoted 7 lines · Konstantin Belousov
Quoted 5 lines · David Woodhouse
Quoted 3 lines · Yi Liu
Hi David,
On 2025/7/14 16:00, David Woodhouse wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
From: David Woodhouse <[email protected]>
I think this "if branch" can be moved just after the
inv_descnon-zero reserved bit checking. Hence you don't need a ret at all. :)We want to return false if the memory write fails, and the interrupt has to happen afterwards.
Per spec: "Hardware behavior is undefined if the Status Address specified is not an address route-able to memory"
Quoted 7 lines
Quoted 6 lines
Quoted 1 line
Do we want to trigger the interrupt even when the DMA fails?
Yes, we do. That's a quality of implementation issue. Just because the behaviour is 'undefined' and theoretically gives us permission to do whatever we like to the guest, we should still be as sensible as possible.
Quoted 7 lines
Personally, I'm fine with generating the interrupt even the status write failed. But to avoid potential conflict, I've also raised this question to the VT-d spec owner. Haven't got a clear answer yet. To further understand this, may I ask some dumb questions here. Why FreeBSD set both SW and IF flag. What is the usage model here. Would software consider that all the QI descriptors prior to this specific wait descriptor has succeeded when either the interrupt got invoked or the expected status is written back?
Quoted 6 lines
FreeBSD queues invalidations, each invalidation has the gen number. To know that some invalidation finished, FreeBSD waits for the interrupt, we do not scan the invalidation sequence word otherwise. There might be further generations of the invalidation descriptors in flight when we get the interrupt, which means that we need to know which generation is finished.
Quoted 6 lines
thanks for the explanation. So software still relies on checking the written back status of the wait descriptor to identify finished invalidation. If so might be better to generate interrupt when status write is succeeded? Otherwise, the interrupt is meaningless to software. Does the current software implementation rely on this interrupt even status write failed?
Yes, if the inv sequence word is not updated past the requested value, the interrupt is basically ignored.
OTOH, the FreeBSD DMAR driver (should) never program non-main memory physical address into the address field of the inv descriptor. And we use the same location for all invalidations issued from the single DMAR unit.
Quoted 11 lines · CLEMENT MATHIEU--DRIF
Quoted 8 lines · Konstantin Belousov
Caution: External email. Do not open attachments or click links, unless this email comes from a known sender and you know the content is safe.
Quoted 4 lines · David Woodhouse
Quoted 3 lines · Yi Liu
Hi David,
On 2025/7/14 16:00, David Woodhouse wrote:
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
From: David Woodhouse <[email protected]>
FreeBSD does both, and this appears to be perfectly valid. The VT-d spec even talks about the ordering (the status write should be done first, unsurprisingly).
Are you talking about the ordering constraint mentioned in bullet "Page-request Drain (PD)"?
David is talking about the IF and SW flags. And he is correct. Spec has below sentence. It means a wait descriptor can have both IF and SW set and indeed completion interrupt happens later than status write. Let's
go on refine the patch. :)
"The invalidation completion event interrupt must push any in-flight invalidation completion status writes, including status writes that may have originated from the same inv_wait_dsc for which the interrupt was generated."
Regards,
Yi Liu
Quoted 32 lines · Yi Liu
Caution: External email. Do not open attachments or click links, unless this email comes from a known sender and you know the content is safe.
Quoted 13 lines · CLEMENT MATHIEU--DRIF
Quoted 10 lines · Konstantin Belousov
Caution: External email. Do not open attachments or click links, unless this email comes from a known sender and you know the content is safe.
Quoted 4 lines · David Woodhouse
Quoted 3 lines · Yi Liu
Hi David,
On 2025/7/14 16:00, David Woodhouse wrote:
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
From: David Woodhouse <[email protected]>
FreeBSD does both, and this appears to be perfectly valid. The VT-d spec even talks about the ordering (the status write should be done first, unsurprisingly).
Are you talking about the ordering constraint mentioned in bullet "Page-request Drain (PD)"?
David is talking about the IF and SW flags. And he is correct. Spec has below sentence. It means a wait descriptor can have both IF and SW set and indeed completion interrupt happens later than status write. Let's go on refine the patch. :)
Quoted 4 lines
"The invalidation completion event interrupt must push any in-flight invalidation completion status
writes, including status writes that may have originated from the sameinv_wait_dscfor which the interrupt was generated."
Yep, I agree
Quoted 4 lines
Regards,
Yi Liu
Quoted 5 lines · Yi Liu
David is talking about the IF and SW flags. And he is correct. Spec has below sentence. It means a wait descriptor can have both IF and SW set and indeed completion interrupt happens later than status write. Let's go on refine the patch. :)
Are there any refinements you believe are necessary?
https://gitlab.com/dwmw2/qemu/-/pipelines/1941324674 looks like it's going to be clean, and I think we resolved everything we talked about.
Liu, Yi L
Reviewed-byQuoted 11 lines
From: David Woodhouse <[email protected]>
Sent: Tuesday, July 22, 2025 8:04 PMQuoted 5 lines · Yi Liu
David is talking about the IF and SW flags. And he is correct. Spec has below sentence. It means a wait descriptor can have both IF and SW set and indeed completion interrupt happens later than status write. Let's go on refine the patch. :)
Are there any refinements you believe are necessary?
No extra change I suppose. I was just waiting for a respond from VT-d arch. I've now got a clear answer. It's ok to generate the interrupt no matter the status write failed or not if IF is set. Sorry for the delayed respond.
Quoted 2 lines
https://gitlab.com/dwmw2/qemu/-/pipelines/1941324674 looks like it's going to be clean, and I think we resolved everything we talked about.
Thanks,
Yi Liu
Quoted 17 lines · David Woodhouse
From: David Woodhouse <[email protected]>
FreeBSD does both, and this appears to be perfectly valid. The VT-d spec even talks about the ordering (the status write should be done first, unsurprisingly).
We certainly shouldn't
assert()and abort QEMU if the guest asks for both.Fixes ed7b8fbcfb88 ("intel-iommu: add supports for queued invalidation interface")Signed-off-by David Woodhouse <[email protected]>---
v2:
• Only generate the interrupt once.
• Spaces around bitwise OR.
Quoted 8 lines
This stops QEMU crashing, but I still can't get FreeBSD to boot and use CPUs with APIC ID > 255 using *either* Intel or AMD IOMMU with interrupt remapping, or the native 15-bit APIC ID enlightenment. cf. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=288122
hw/i386/intel_iommu.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
This looks like a qemu-stable material (for 10.0). Please let me know if it is not.
Thanks,
/mjt