Re: [PATCH v2] intel_iommu: Allow both Status Write and Interrupt Flag in QI wait

2025-07-16 Thread Yi Liu
On 2025/7/16 12:05, Konstantin Belousov wrote: On Wed, Jul 16, 2025 at 12:01:44PM +0800, Yi Liu wrote: On 2025/7/15 20:27, CLEMENT MATHIEU--DRIF wrote: On 15/07/2025 10:27 am, David Woodhouse wrote: On Tue, 2025-07-15 at 06:11 +, CLEMENT MATHIEU--DRIF wrote: On 14/07/2025 11:22 pm

Re: [PATCH v2] intel_iommu: Allow both Status Write and Interrupt Flag in QI wait

2025-07-15 Thread Yi Liu
2025 15:28:09 GMT+01:00, Yi Liu wrote: Hi David, On 2025/7/14 16:00, David Woodhouse wrote: From: David Woodhouse 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. :) We want to return false if t

Re: [PATCH v2] intel_iommu: Allow both Status Write and Interrupt Flag in QI wait

2025-07-15 Thread Yi Liu
Woodhouse wrote: On 14 July 2025 15:28:09 GMT+01:00, Yi Liu wrote: Hi David, On 2025/7/14 16:00, David Woodhouse wrote: From: David Woodhouse 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

Re: [PATCH v2] intel_iommu: Allow both Status Write and Interrupt Flag in QI wait

2025-07-14 Thread Yi Liu
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.. -return true; +return ret; } static bool vtd_process_context_cache_desc(IntelIOMMUState *s, -- Regards, Yi Liu

Re: [PATCH rfcv3 15/21] intel_iommu: Bind/unbind guest page table to host

2025-06-17 Thread Yi Liu
On 2025/6/17 21:11, Jason Gunthorpe wrote: On Tue, Jun 17, 2025 at 09:03:32PM +0800, Yi Liu wrote: I suggest fixing the Linux driver to refuse to run in sm_on mode if the HW supports scalable mode and ecap_slts = false. That may not be 100% spec compliant but it seems like a reasonable approach

Re: [PATCH rfcv3 15/21] intel_iommu: Bind/unbind guest page table to host

2025-06-17 Thread Yi Liu
AMD has the same issues, BTW, arguably even worse as I didn't notice any way to specify if the v1 page table is supported :\ Jason -- Regards, Yi Liu

Re: [PATCH v1 06/15] intel_iommu: Handle PASID entry removing and updating

2025-06-17 Thread Yi Liu
with the PASID cache. To aovid confusion, maybe better to say cached pasid entry. :) Signed-off-by: Yi Liu Signed-off-by: Yi Sun Signed-off-by: Zhenzhong Duan --- hw/i386/intel_iommu_internal.h | 26 include/hw/i386/intel_iommu.h | 6 + hw/i386/intel_iommu.c | 252

Re: [PATCH v1 02/15] intel_iommu: Optimize context entry cache utilization

2025-06-17 Thread Yi Liu
ache_gen) { *ce = cc_entry->context_entry; +vtd_iommu_unlock(s); return 0; } else { +vtd_iommu_unlock(s); return vtd_dev_to_context_entry(s, bus_num, devfn, ce); } } Which one do you prefer? If it's just optimization, perhaps just drop it. :) -- Regards, Yi Liu

Re: [PATCH v1 05/15] intel_iommu: Introduce two helpers vtd_as_from/to_iommu_pasid_locked

2025-06-17 Thread Yi Liu
en reading the first line, it makes me thinking why need the helpers since there is already a helper to find. The key is the later part. We need to translate the PCI_NO_PASID to ridpasid. OK, presume you want me to delete first line. Let me know if you mean not. yes. :) Regards, Yi Liu

Re: [PATCH rfcv3 15/21] intel_iommu: Bind/unbind guest page table to host

2025-06-17 Thread Yi Liu
ith normal requirement. :) I can think of ERRATA_772415 and NESTED capability. NESTED used for creating VFIO default HWPT in stage2 mode. yeah. NESTED should be a hard requirement. VFIO should allocate hwpt with nested_parent flag. -- Regards, Yi Liu

Re: [PATCH rfcv3 15/21] intel_iommu: Bind/unbind guest page table to host

2025-06-16 Thread Yi Liu
On 2025/6/17 11:22, Nicolin Chen wrote: On Mon, Jun 16, 2025 at 03:38:26PM +0800, Yi Liu wrote: On 2025/6/16 13:59, Nicolin Chen wrote: On Thu, Jun 12, 2025 at 08:53:40PM +0800, Yi Liu wrote: That being said, IOMMU_NOTIFIER_IOTLB_EVENTS should not be needed for passthrough devices, right

Re: [PATCH rfcv3 15/21] intel_iommu: Bind/unbind guest page table to host

2025-06-16 Thread Yi Liu
cause I don't want to bring complexity to VFIO just for an Errata. I remember ERRATA_772415 exists only on old SPR, @Liu, Yi L can correct me if I'm wrong. hmmm. I'm fine to pass some info to vfio hence let vfio skip RO mappings. Is there other info that VFIO needs to get from vIOMMU? Hope start adding such mechanism with normal requirement. :) -- Regards, Yi Liu

Re: [PATCH rfcv3 15/21] intel_iommu: Bind/unbind guest page table to host

2025-06-16 Thread Yi Liu
On 2025/6/16 13:59, Nicolin Chen wrote: On Thu, Jun 12, 2025 at 08:53:40PM +0800, Yi Liu wrote: That being said, IOMMU_NOTIFIER_IOTLB_EVENTS should not be needed for passthrough devices, right? No, even if x-flts=on is configured in QEMU cmdline, that only mean virtual vtd supports stage-1

Re: [PATCH rfcv3 15/21] intel_iommu: Bind/unbind guest page table to host

2025-06-12 Thread Yi Liu
can further simplify the routine by allocating a nesting parent HWPT in iommufd_cdev_attach(), as long as the attaching device is identified as "passthrough" and there is "iommufd" in its "-device" string? After all, IOMMU_HWPT_ALLOC_NEST_PARENT is a common f

Re: [PATCH v1 05/15] intel_iommu: Introduce two helpers vtd_as_from/to_iommu_pasid_locked

2025-06-11 Thread Yi Liu
w_page_hook(const IOMMUTLBEvent *event, void *private) { -- Regards, Yi Liu

Re: [PATCH v1 02/15] intel_iommu: Optimize context entry cache utilization

2025-06-11 Thread Yi Liu
-if (vtd_dev_to_context_entry(s, bus_n, vtd_as->devfn, &ce) == 0) { + if (vtd_as_to_context_entry(vtd_as, &ce) == 0) { trace_vtd_replay_ce_valid(s->root_scalable ? "scalable mode" : "legacy mode", bus_n, PCI_SLOT(vtd_as->devfn), -- Regards, Yi Liu

Re: [PATCH v1 01/15] intel_iommu: Rename vtd_ce_get_rid2pasid_entry to vtd_ce_get_pasid_entry

2025-06-11 Thread Yi Liu
: Zhenzhong Duan Reviewed-by: Clément Mathieu--Drif --- hw/i386/intel_iommu.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) Reviewed-by: Yi Liu diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 69d72ad35c..f0b1f90eff 100644 --- a/hw/i386/intel_iommu.c

Re: [PATCH] vfio/pci: Fix instance_size of VFIO_PCI_BASE

2025-06-10 Thread Yi Liu
E_VFIO_PCI_BASE, -.instance_size = sizeof(VFIOPCIDevice), .class_init = vfio_pci_dev_class_init, .instance_init = vfio_instance_init, .instance_finalize = vfio_instance_finalize, LGTM. Reviewed-by: Yi Liu -- Regards, Yi Liu

Re: [PATCH rfcv3 15/21] intel_iommu: Bind/unbind guest page table to host

2025-05-26 Thread Yi Liu
:15PM +0800, Yi Liu wrote: Hey Nic, On 2025/5/22 06:49, Nicolin Chen wrote: On Wed, May 21, 2025 at 07:14:45PM +0800, Zhenzhong Duan wrote: +static const MemoryListener iommufd_s2domain_memory_listener = { +.name = "iommufd_s2domain", +.priority = 1000, +.

Re: [PATCH rfcv3 15/21] intel_iommu: Bind/unbind guest page table to host

2025-05-22 Thread Yi Liu
d allocate an S1 HWPT for device to attach. Starting from here, get_address_space() can return the iommu address space -- on ARM, we only need it for KVM to translate MSI. refer to the last reply. This seems to be different between ARM and VT-d emulation. -- Regards, Yi Liu

Re: [PATCH rfcv3 15/21] intel_iommu: Bind/unbind guest page table to host

2025-05-22 Thread Yi Liu
ways there for use. does vtd_host_dma_iommu() have to return the iommu address space all the time? yes, all the time. -- Regards, Yi Liu

Re: [PATCH] intel_iommu: Take the bql before registering a new address space

2025-04-15 Thread Yi Liu
n unrelated cleanup. Yeah unrelated cleanup. Although I don't understand why these code paths don't use memory_region_transaction_begin/commit and have to access BQL. The below two functions would call memory_region_transaction_begin/commit(). So these paths need BQL. memory_region

Re: [PATCH] intel_iommu: Take the bql before registering a new address space

2025-04-15 Thread Yi Liu
--- hw/i386/intel_iommu.c | 10 ++ 1 file changed, 10 insertions(+) Reviewed-by: Yi Liu diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index dffd7ee885..fea2220013 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -4216,6 +4216,7 @@ VTDAddressSpace

Re: Giving your own patches your Reviewed-by

2025-03-12 Thread Yi Liu
aro.org     Signed-off-by: Peter Maydell Is this workflow making sense and accepted? Otherwise what should we change? Maybe clarify along with the tags; or including all Message-Id could make this easier to track? Commit eda4c9b5b3c is the similar case. Zhenzhong and Clément took the patch fro

Re: [PATCH v4 13/17] intel_iommu: piotlb invalidation should notify unmap

2024-11-05 Thread Yi Liu
well. But it checks PCI_NO_PASID against the pasid instead of vtd_pas->pasid. So it looks confusing to me. -- Regards, Yi Liu

Re: [PATCH 3/3] intel_iommu: Add missed reserved bit check for IEC descriptor

2024-11-04 Thread Yi Liu
Reviewed-by: Yi Liu diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index 75ccd501b0..4323fc5d6d 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -410,6 +410,9 @@ typedef union VTDInvDesc VTDInvDesc;

Re: [PATCH 1/3] intel_iommu: Send IQE event when setting reserved bit in IQT_TAIL

2024-11-04 Thread Yi Liu
will result in invalidation queue error." Current code missed to send IQE event to guest, fix it. a nit: mention the spec revision as well since the Figure number may be modified. Reviewed-by: Yi Liu Fixes: c0c1d351849b ("intel_iommu: add 256 bits qi_desc support") Suggested-by

Re: [PATCH 2/3] intel_iommu: Add missed sanity check for 256-bit invalidation queue

2024-11-04 Thread Yi Liu
ainly used to help debug guest error, but it only dumps once in qemu life cycle and doesn't help much, we need error_report() instead. Fixes: c0c1d351849b ("intel_iommu: add 256 bits qi_desc support") Suggested-by: Yi Liu Signed-off-by: Zhenzhong Duan --- hw/i386/intel_iommu_int

Re: [PATCH v4 15/17] intel_iommu: Introduce a property x-fls for scalable modern mode

2024-11-04 Thread Yi Liu
er). :) Got it, just double confirm you prefer x-flts, not x-fsts? x-flts as most of the code use flt instead of fst. -- Regards, Yi Liu

Re: [PATCH v4 15/17] intel_iommu: Introduce a property x-fls for scalable modern mode

2024-11-04 Thread Yi Liu
better as it suits more how spec tells it (FSTS in the eap register). :) -- Regards, Yi Liu

Re: [PATCH 2/3] intel_iommu: Add missed sanity check for 256-bit invalidation queue

2024-11-04 Thread Yi Liu
different call sites. This isn't an issue as error_report_once() here is mainly used to help debug guest error, but it only dumps once in qemu life cycle and doesn't help much, we need error_report() instead. Fixes: c0c1d351849b ("intel_iommu: add 256 bits qi_desc support") Suggeste

Re: [PATCH v4 04/17] intel_iommu: Flush stage-2 cache in PASID-selective PASID-based iotlb invalidation

2024-11-04 Thread Yi Liu
On 2024/11/4 15:37, CLEMENT MATHIEU--DRIF wrote: On 04/11/2024 03:49, Yi Liu wrote: 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. On 2024/9/30 17:26, Zhenzhong Duan wrote: Per spec 6.5.2.4

Re: [PATCH v4 09/17] intel_iommu: Flush stage-1 cache in iotlb invalidation

2024-11-03 Thread Yi Liu
- include/hw/i386/intel_iommu.h | 1 + hw/i386/intel_iommu.c | 27 +-- 2 files changed, 22 insertions(+), 6 deletions(-) anyhow, this patch looks good to me. Reviewed-by: Yi Liu diff --git a/include/hw/i386/intel_iommu.h b/include/hw/i386/intel_iommu.h i

Re: [PATCH v4 14/17] intel_iommu: Set default aw_bits to 48 in scalable modern mode

2024-11-03 Thread Yi Liu
-Drif --- include/hw/i386/intel_iommu.h | 2 +- hw/i386/intel_iommu.c | 10 +- 2 files changed, 10 insertions(+), 2 deletions(-) Reviewed-by: Yi Liu -- Regards, Yi Liu

Re: [PATCH v4 15/17] intel_iommu: Introduce a property x-fls for scalable modern mode

2024-11-03 Thread Yi Liu
rn mode is supported. When enabled in legacy mode, throw out error. With scalable modern mode exposed to user, also accurate the pasid entry check in vtd_pe_type_check(). Signed-off-by: Yi Liu Signed-off-by: Yi Sun Signed-off-by: Zhenzhong Duan Maybe a Suggested-by tag can help to understand where

Re: [PATCH v4 10/17] intel_iommu: Process PASID-based iotlb invalidation

2024-11-03 Thread Yi Liu
during walking Intel VT-d stage-1 page table. This emulates the stage-1 page table iotlb invalidation requested by a PASID-based IOTLB Invalidate Descriptor (P_IOTLB). Signed-off-by: Yi Liu Signed-off-by: Zhenzhong Duan Reviewed-by: Clément Mathieu--Drif Acked-by: Jason Wang --- hw/i386

Re: [PATCH v4 06/17] intel_iommu: Implement stage-1 translation

2024-11-03 Thread Yi Liu
On 2024/11/4 11:05, Duan, Zhenzhong wrote: -Original Message- From: Liu, Yi L Sent: Sunday, November 3, 2024 10:22 PM Subject: Re: [PATCH v4 06/17] intel_iommu: Implement stage-1 translation On 2024/9/30 17:26, Zhenzhong Duan wrote: From: Yi Liu This adds stage-1 page table

Re: [PATCH v4 16/17] intel_iommu: Introduce a property to control FS1GP cap bit setting

2024-11-03 Thread Yi Liu
rning Reviewed-by: Yi Liu This property has no effect when vIOMMU isn't in scalable modern mode. Signed-off-by: Zhenzhong Duan Reviewed-by: Clément Mathieu--Drif --- include/hw/i386/intel_iommu.h | 1 + hw/i386/intel_iommu.c | 5 - 2 files changed, 5 insertions(+), 1 deletio

Re: [PATCH v4 15/17] intel_iommu: Introduce a property x-fls for scalable modern mode

2024-11-03 Thread Yi Liu
n scalable mode, first stage translation also known as scalable modern mode is supported. When enabled in legacy mode, throw out error. With scalable modern mode exposed to user, also accurate the pasid entry check in vtd_pe_type_check(). Signed-off-by: Yi Liu Signed-off-by: Yi Sun Sig

Re: [PATCH v3 15/17] intel_iommu: Modify x-scalable-mode to be string option to expose scalable modern mode

2024-11-03 Thread Yi Liu
PRI is also a missing part. :) -- Regards, Yi Liu

Re: [PATCH v4 14/17] intel_iommu: Set default aw_bits to 48 in scalable modern mode

2024-11-03 Thread Yi Liu
ST_AW_39BIT && s->aw_bits != VTD_HOST_AW_48BIT) { error_setg(errp, "%s mode: supported values for aw-bits are: %d, %d", -- Regards, Yi Liu

Re: [PATCH v4 13/17] intel_iommu: piotlb invalidation should notify unmap

2024-11-03 Thread Yi Liu
event.entry.addr_mask = size - 1; +event.entry.translated_addr = 0; +memory_region_notify_iommu(&vtd_as->iommu, 0, event); +} + } } static bool vtd_process_piotlb_desc(IntelIOMMUState *s, -- Regards, Yi Liu

Re: [PATCH v4 11/17] intel_iommu: Add an internal API to find an address space with PASID

2024-11-03 Thread Yi Liu
rn sid == target_sid; + +return (as_key->pasid == target.pasid) && + (sid == target.sid); hence using target->pasid and target->sid here. Otherwise, looks good to me. Reviewed-by: Yi Liu } -static VTDAddressSpace *vtd_get_as_by_sid(IntelIOMMUState *s, u

Re: [PATCH v4 12/17] intel_iommu: Add support for PASID-based device IOTLB invalidation

2024-11-03 Thread Yi Liu
break; +case VTD_INV_DESC_DEV_PIOTLB: +trace_vtd_inv_desc("device-piotlb", inv_desc.hi, inv_desc.lo); +if (!vtd_process_device_piotlb_desc(s, &inv_desc)) { +return false; +} +break; + case VTD_INV_DESC_DEVICE: trace_vtd_inv_desc("device", inv_desc.hi, inv_desc.lo); if (!vtd_process_device_iotlb_desc(s, &inv_desc)) { -- Regards, Yi Liu

Re: [PATCH v4 10/17] intel_iommu: Process PASID-based iotlb invalidation

2024-11-03 Thread Yi Liu
On 2024/9/30 17:26, Zhenzhong Duan wrote: PASID-based iotlb (piotlb) is used during walking Intel VT-d stage-1 page table. This emulates the stage-1 page table iotlb invalidation requested by a PASID-based IOTLB Invalidate Descriptor (P_IOTLB). Signed-off-by: Yi Liu Signed-off-by: Zhenzhong

Re: [PATCH v4 09/17] intel_iommu: Flush stage-1 cache in iotlb invalidation

2024-11-03 Thread Yi Liu
Duan Reviewed-by: Clément Mathieu--Drif Acked-by: Jason Wang --- include/hw/i386/intel_iommu.h | 1 + hw/i386/intel_iommu.c | 27 +-- 2 files changed, 22 insertions(+), 6 deletions(-) anyhow, this patch looks good to me. Reviewed-by: Yi Liu diff --

Re: [PATCH v4 04/17] intel_iommu: Flush stage-2 cache in PASID-selective PASID-based iotlb invalidation

2024-11-03 Thread Yi Liu
+} +break; + case VTD_INV_DESC_WAIT: trace_vtd_inv_desc("wait", inv_desc.hi, inv_desc.lo); if (!vtd_process_wait_desc(s, &inv_desc)) { @@ -2793,7 +2880,6 @@ static bool vtd_process_inv_desc(IntelIOMMUState *s) * iommu driver) work, just return true is enough so far. */ case VTD_INV_DESC_PC: -case VTD_INV_DESC_PIOTLB: if (s->scalable_mode) { break; } -- Regards, Yi Liu

Re: [PATCH v4 08/17] intel_iommu: Set accessed and dirty bits during first stage translation

2024-11-03 Thread Yi Liu
deletion(-) Reviewed-by: Yi Liu diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index 57c50648ce..4c3e75e593 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -324,6 +324,7 @@ typedef enum VTDFaultReason { /* Output address in

Re: [PATCH v4 06/17] intel_iommu: Implement stage-1 translation

2024-11-03 Thread Yi Liu
On 2024/9/30 17:26, Zhenzhong Duan wrote: From: Yi Liu This adds stage-1 page table walking to support stage-1 only translation in scalable modern mode. Signed-off-by: Yi Liu Co-developed-by: Clément Mathieu--Drif Signed-off-by: Clément Mathieu--Drif Signed-off-by: Yi Sun Signed-off-by

Re: [PATCH v4 07/17] intel_iommu: Check if the input address is canonical

2024-11-03 Thread Yi Liu
/i386/intel_iommu.c | 23 +++ 2 files changed, 25 insertions(+) Reviewed-by: Yi Liu diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index 38bf0c7a06..57c50648ce 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386

Re: [PATCH v4 03/17] intel_iommu: Add a placeholder variable for scalable modern mode

2024-11-03 Thread Yi Liu
evice passthrough until nesting is supported. Signed-off-by: Yi Liu Signed-off-by: Zhenzhong Duan Acked-by: Jason Wang --- include/hw/i386/intel_iommu.h | 1 + hw/i386/intel_iommu.c | 23 ++- 2 files changed, 19 insertions(+), 5 deletions(-) Reviewed-by: Yi Liu

Re: [PATCH v4] intel_iommu: Introduce property "stale-tm" to control Transient Mapping (TM) field

2024-10-25 Thread Yi Liu
ow user to control the setting. Use hw_compat_9_1 to handle the compatibility for machines before 9.2 which is hw_compat_9_1 a typo? Looks to be pc_compat_9_1. :) Otherwise I think it is good. Reviewed-by: Yi Liu allow guest to set the field. Starting from 9.2, this field is reserved(0) by

Re: [PATCH v3 06/17] intel_iommu: Implement stage-1 translation

2024-09-29 Thread Yi Liu
On 2024/9/11 13:22, Zhenzhong Duan wrote: From: Yi Liu This adds stage-1 page table walking to support stage-1 only transltion in scalable modern mode. a typo. s/tansltion/translation/ Signed-off-by: Yi Liu Co-developed-by: Clément Mathieu--Drif Signed-off-by: Clément Mathieu--Drif

Re: [PATCH v3 05/17] intel_iommu: Rename slpte to pte

2024-09-29 Thread Yi Liu
On 2024/9/11 13:22, Zhenzhong Duan wrote: From: Yi Liu Because we will support both FST(a.k.a, FLT) and SST(a.k.a, SLT) translation, rename variable and functions from slpte to pte whenever possible. But some are SST only, they are renamed with sl_ prefix. Signed-off-by: Yi Liu Co-developed

Re: [PATCH v2 13/17] intel_iommu: piotlb invalidation should notify unmap

2024-08-19 Thread Yi Liu
e the translation request." sorry for a typo. s/request/result/ -- Regards, Yi Liu

Re: [PATCH v2 16/17] intel_iommu: Introduce a property to control FS1GP cap bit setting

2024-08-19 Thread Yi Liu
's suggestion, only vIOMMU properties can control them. I see. yeah, it makes sense. -- Regards, Yi Liu

Re: [PATCH v2 13/17] intel_iommu: piotlb invalidation should notify unmap

2024-08-19 Thread Yi Liu
gt;iommu, 0, event); +} + } } static bool vtd_process_piotlb_desc(IntelIOMMUState *s, -- Regards, Yi Liu

Re: [PATCH v2 16/17] intel_iommu: Introduce a property to control FS1GP cap bit setting

2024-08-19 Thread Yi Liu
vIOMMU when comes to support passthrough devices. Yes, we already have this check, see https://github.com/yiliu1765/qemu/commit/b7ac7ce3a2e21eb1b3172743ee6f73e80fe67b3a good to know it. :) Will you fail the VM if the device's iommu does not support FS1GP or just mask out the FS1GP? -- Regards, Yi Liu

Re: [PATCH v2 04/17] intel_iommu: Flush stage-2 cache in PASID-selective PASID-based iotlb invalidation

2024-08-19 Thread Yi Liu
n false; +} +return true; +} + static bool vtd_process_inv_iec_desc(IntelIOMMUState *s, VTDInvDesc *inv_desc) { @@ -2775,6 +2852,10 @@ static bool vtd_process_inv_desc(IntelIOMMUState *s) break; case VTD_INV_DESC_PIOTLB: +trace_vtd_inv_desc("p-iotlb", inv_desc.val[1], inv_desc.val[0]); +if (!vtd_process_piotlb_desc(s, &inv_desc)) { +return false; +} break; case VTD_INV_DESC_WAIT: -- Regards, Yi Liu -- Regards, Yi Liu

Re: [PATCH v2 04/17] intel_iommu: Flush stage-2 cache in PASID-selective PASID-based iotlb invalidation

2024-08-14 Thread Yi Liu
break; case VTD_INV_DESC_PIOTLB: +trace_vtd_inv_desc("p-iotlb", inv_desc.val[1], inv_desc.val[0]); +if (!vtd_process_piotlb_desc(s, &inv_desc)) { +return false; +} break; case VTD_INV_DESC_WAIT: -- Regards, Yi Liu

Re: [PATCH v2 14/17] intel_iommu: Set default aw_bits to 48 in scalable modren mode

2024-08-14 Thread Yi Liu
48BIT) && s->scalable_modern) { +error_setg(errp, "Supported values for aw-bits are: %d", + VTD_HOST_AW_48BIT); call out it is for scalable modern.:) +return false; +} + if (s->scalable_mode && !s->dma_drain) { error_setg(errp, "Need to set dma_drain for scalable mode"); return false; -- Regards, Yi Liu

Re: [PATCH v2 16/17] intel_iommu: Introduce a property to control FS1GP cap bit setting

2024-08-14 Thread Yi Liu
t;ecap |= VTD_ECAP_SMTS | VTD_ECAP_SRS | VTD_ECAP_SLTS; } -- Regards, Yi Liu

Re: [PATCH v2 07/17] intel_iommu: Check if the input address is canonical

2024-08-14 Thread Yi Liu
uot;," + "pasid=0x%" PRIx32 ")", __func__, iova, pasid); +return -VTD_FR_FS_NON_CANONICAL; +} + while (true) { offset = vtd_iova_level_offset(iova, level); flpte = vtd_get_pte(addr, offset); -- Regards, Yi Liu

Re: [PATCH v2 08/17] intel_iommu: Set accessed and dirty bits during first stage translation

2024-08-14 Thread Yi Liu
return -VTD_FR_FS_BIT_UPDATE_FAILED; +} *flptep = flpte; *flpte_level = level; return 0; -- Regards, Yi Liu

Re: [PATCH v3 2/2] intel_iommu: Make PASID-cache and PIOTLB type invalid in legacy mode

2024-08-13 Thread Yi Liu
make scalable mode work") 4a4f219e8a10 would be better. :) Suggested-by: Yi Liu Signed-off-by: Zhenzhong Duan Reviewed-by: Clément Mathieu--Drif Reviewed-by: Yi Liu --- hw/i386/intel_iommu.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git

Re: [PATCH v2 02/17] intel_iommu: Make pasid entry type check accurate

2024-08-13 Thread Yi Liu
emulation") Suggested-by: Yi Liu Signed-off-by: Zhenzhong Duan Reviewed-by: Clément Mathieu--Drif --- hw/i386/intel_iommu.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) Reviewed-by: Yi Liu diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index c52912f

Re: [PATCH v2 01/17] intel_iommu: Use the latest fault reasons defined by spec

2024-08-13 Thread Yi Liu
, /*Invalid PASID table entry */ how about making the comment line aligned? Either one line or two lines. Besides this, lgtm. Reviewed-by: Yi Liu /* Output address in the interrupt address range for scalable mode */ VTD_FR_SM_INTERRUPT_ADDR = 0x87, diff --git a/hw/i386

Re: [PATCH v2 2/2] intel_iommu: Make PASID-cache and PIOTLB type invalid in legacy mode

2024-08-13 Thread Yi Liu
safe. In vtd_process_inv_desc(), VTD_INV_DESC_PC and VTD_INV_DESC_PIOTLB are bypassed without scalable mode check. These two types are not valid in legacy mode and we should report error. Suggested-by: Yi Liu Signed-off-by: Zhenzhong Duan --- hw/i386/intel_iommu.c | 22 +++---

Re: [PATCH v2 2/2] intel_iommu: Make PASID-cache and PIOTLB type invalid in legacy mode

2024-08-13 Thread Yi Liu
On 2024/8/13 15:44, Zhenzhong Duan wrote: In vtd_process_inv_desc(), VTD_INV_DESC_PC and VTD_INV_DESC_PIOTLB are bypassed without scalable mode check. These two types are not valid in legacy mode and we should report error. Suggested-by: Yi Liu Signed-off-by: Zhenzhong Duan --- hw/i386

Re: [PATCH] intel_iommu: Fix invalidation descriptor type field

2024-08-13 Thread Yi Liu
problem for now as bits[11:9] is zero for all current invalidation types. But it will break if newer type occupies bits[11:9]. Fix it by take bits[11:9] into type and make reserved bits check accurate. s/take/taking/ Reviewed-by: Yi Liu There is another fix you may add. In vtd_process_inv_desc(), it

Re: [RFC V1 02/12] iommufd: no DMA to BARs

2024-08-12 Thread Yi Liu
794,7 @@ struct MemoryRegion { bool unmergeable; uint8_t dirty_log_mask; bool is_iommu; +bool no_dma; RAMBlock *ram_block; Object *owner; /* owner as TYPE_DEVICE. Used for re-entrancy checks in MR access hotpath */ -- Regards, Yi Liu

Re: [PATCH v1 01/17] intel_iommu: Use the latest fault reasons defined by spec

2024-07-29 Thread Yi Liu
On 2024/7/29 16:42, Michael S. Tsirkin wrote: On Mon, Jul 29, 2024 at 03:39:03PM +0800, Yi Liu wrote: On 2024/7/18 16:16, Zhenzhong Duan wrote: From: Yu Zhang Spec revision 3.0 or above defines more detailed fault reasons for scalable mode. So introduce them into emulation code, see spec

Re: [PATCH v1 01/17] intel_iommu: Use the latest fault reasons defined by spec

2024-07-29 Thread Yi Liu
ee VT-d spec has any definition on it. So it should just be a software trick. :) [1] https://lore.kernel.org/qemu-devel/1408168544-28605-3-git-send-email-tamlokv...@gmail.com/ [2] https://lore.kernel.org/qemu-devel/20190301065219.GA9@xz-x1/ -- Regards, Yi Liu

Re: [PATCH v6 0/9] hw/iommufd: IOMMUFD Dirty Tracking

2024-07-23 Thread Yi Liu
| 11 ++ hw/vfio/iommufd.c | 170 - hw/vfio/migration.c| 12 +- hw/vfio/pci.c | 3 + backends/trace-events | 3 + 11 files changed, 318 insertions(+), 23 deletions(-) -- Regards, Yi Liu

Re: [PATCH] intel-iommu: fix Read DMAR IQA REG DW

2024-07-23 Thread Yi Liu
y checking the debugfs output, and it looks to miss the DW bit. is it? Put a clearer commit message would be helpful. Please address Michael's comment, add a "Fixes: xxx" tag and resend. -- Regards, Yi Liu

Re: [PATCH v1 03/17] intel_iommu: Add a placeholder variable for scalable modern mode

2024-07-18 Thread Yi Liu
/ecap initialization, compatibility check and block host device passthrough until nesting is supported. Signed-off-by: Yi Liu Signed-off-by: Zhenzhong Duan --- hw/i386/intel_iommu_internal.h | 2 ++ include/hw/i386/intel_iommu.h | 1 + hw/i386/intel_iommu.c

Re: [PATCH 6/7] backends/iommufd: Get rid of qemu_open_old()

2024-07-16 Thread Yi Liu
On 2024/7/15 16:21, Zhao Liu wrote: For qemu_open_old(), osdep.h said: Don't introduce new usage of this function, prefer the following qemu_open/qemu_create that take an "Error **errp". So replace qemu_open_old() with qemu_open(). Cc: Yi Liu Cc: Eric Auger Cc: Zhenzhong D

Re: [PATCH v6 3/4] intel_iommu: fix type of the mask field in VTDIOTLBPageInvInfo

2024-07-09 Thread Yi Liu
er to refine the commit message a bit. Reviewed-by: Yi Liu Signed-off-by: Clément Mathieu--Drif Reviewed-by: Minwoo Im --- hw/i386/intel_iommu_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h

Re: [PATCH v6 2/4] intel_iommu: move VTD_FRCD_PV and VTD_FRCD_PP declarations

2024-07-09 Thread Yi Liu
changed, 2 insertions(+), 2 deletions(-) Reviewed-by: Yi Liu diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index cbc4030031..faea23e8d6 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -264,10 +264,10 @@ #define VTD_FRCD_FR

Re: [PATCH v4 1/4] intel_iommu: fix FRCD construction macro

2024-07-08 Thread Yi Liu
On 2024/7/9 10:51, Jason Wang wrote: On Mon, Jul 8, 2024 at 3:04 PM Yi Liu wrote: On 2024/7/5 19:01, CLEMENT MATHIEU--DRIF wrote: From: Clément Mathieu--Drif The constant must be unsigned, otherwise the two's complement overrides the other fields when a PASID is present.

Re: [PATCH v5 4/4] intel_iommu: make type match

2024-07-08 Thread Yi Liu
c VTDIOTLBEntry *vtd_lookup_iotlb(IntelIOMMUState *s, uint16_t source_id, { struct vtd_iotlb_key key; VTDIOTLBEntry *entry; -int level; +unsigned level; for (level = VTD_SL_PT_LEVEL; level < VTD_SL_PML4_LEVEL; level++) { key.gfn = vtd_get_iotlb_gfn(addr, level); R

Re: [PATCH v5 3/4] intel_iommu: fix type of the mask field in VTDIOTLBPageInvInfo

2024-07-08 Thread Yi Liu
nt32_t pasid; uint64_t addr; -uint8_t mask; +uint64_t mask; }; typedef struct VTDIOTLBPageInvInfo VTDIOTLBPageInvInfo; -- Regards, Yi Liu

Re: [PATCH v4 4/4] intel_iommu: make types match

2024-07-08 Thread Yi Liu
L; level < VTD_SL_PML4_LEVEL; level++) { key.gfn = vtd_get_iotlb_gfn(addr, level); -- Regards, Yi Liu

Re: [PATCH v4 3/4] intel_iommu: fix type of the mask field in VTDIOTLBPageInvInfo

2024-07-08 Thread Yi Liu
nt64_t mask; }; typedef struct VTDIOTLBPageInvInfo VTDIOTLBPageInvInfo; -- Regards, Yi Liu

Re: [PATCH v4 1/4] intel_iommu: fix FRCD construction macro

2024-07-08 Thread Yi Liu
ot;Fixes tag" is not needed. Signed-off-by: Clément Mathieu--Drif Reviewed-by: Yi Liu Reviewed-by: Zhenzhong Duan --- hw/i386/intel_iommu_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index f8cf

[PATCH] MAINTAINERS: Add myself as a VT-d reviewer

2024-07-07 Thread Yi Liu
Signed-off-by: Yi Liu --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 6725913c8b..61724b91d8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3656,6 +3656,7 @@ F: tests/uefi-test-tools/ VT-d Emulation M: Michael S. Tsirkin R: Jason Wang +R

Re: [PATCH v1 0/8] PRI support for VT-d

2024-07-04 Thread Yi Liu
On 2024/7/5 13:13, CLEMENT MATHIEU--DRIF wrote: On 05/07/2024 05:03, Yi Liu wrote: 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. On 2024/5/30 20:24, CLEMENT MATHIEU--DRIF wrote: This series

Re: [PATCH v2 1/3] intel_iommu: fix FRCD construction macro.

2024-07-04 Thread Yi Liu
the sentence. :) Fixes: 1b2b12376c ("intel-iommu: PASID support") you need more digits per the result of "grep Fixes docs/devel/submitting-a-patch.rst". docs/devel/submitting-a-patch.rst:add an additional line with "Fixes: Signed-off-by: Clément Mathieu--Drif Reviewed-by

Re: [PATCH v1 0/8] PRI support for VT-d

2024-07-04 Thread Yi Liu
cie_regs.h | 4 + system/memory.c| 49 ++ 10 files changed, 604 insertions(+), 2 deletions(-) -- Regards, Yi Liu

Re: [PATCH v2 3/3] intel_iommu: Bypass barrier wait descriptor

2024-07-04 Thread Yi Liu
" (unknown type)", __func__, inv_desc->hi, -- Regards, Yi Liu

Re: [PATCH v2 2/3] intel_iommu: make types match

2024-07-04 Thread Yi Liu
truct VTDIOTLBPageInvInfo VTDIOTLBPageInvInfo; -- 2.45.2 -- Regards, Yi Liu

Re: [PATCH ats_vtd v5 19/22] memory: add an API for ATS support

2024-07-04 Thread Yi Liu
On 2024/7/4 12:30, CLEMENT MATHIEU--DRIF wrote: On 03/07/2024 14:14, Yi Liu wrote: 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. On 2024/7/2 13:52, CLEMENT MATHIEU--DRIF wrote: From: Clément

Re: [PATCH ats_vtd v5 00/22] ATS support for VT-d

2024-07-04 Thread Yi Liu
On 2024/7/4 12:36, CLEMENT MATHIEU--DRIF wrote: On 03/07/2024 14:32, Yi Liu wrote: 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. Hi, thanks for your review! very efficient! Hi CMD, I've

Re: [PATCH ats_vtd v5 00/22] ATS support for VT-d

2024-07-03 Thread Yi Liu
ATHIEU--DRIF wrote: From: Clement Mathieu--Drif This series belongs to a list of series that add SVM support for VT-d. As a starting point, we use the series called 'intel_iommu: Enable stage-1 translation' (rfc2) by Zhenzhong Duan and Yi Liu. Here we focus on the implementation of ATS

Re: [PATCH ats_vtd v5 19/22] memory: add an API for ATS support

2024-07-03 Thread Yi Liu
, no_write, result, + result_length, err_count); +} + void memory_region_notify_iommu_one(IOMMUNotifier *notifier, IOMMUTLBEvent *event) { -- Regards, Yi Liu

Re: [PATCH ats_vtd v5 06/22] pcie: add helper to declare PASID capability for a pcie device

2024-07-03 Thread Yi Liu
AP_WIDTH_SHIFT 8 #define PCI_PASID_CTRL0x06/* PASID control register */ #define PCI_PASID_CTRL_ENABLE0x0001 /* Enable bit */ #define PCI_PASID_CTRL_EXEC 0x0002 /* Exec permissions Enable */ -- Regards, Yi Liu

Re: [PATCH ats_vtd v5 03/22] intel_iommu: return page walk level even when the translation fails

2024-07-03 Thread Yi Liu
*flptep = flpte; -*flpte_level = level; return 0; } addr = vtd_get_pte_addr(flpte, aw_bits); -level--; +(*flpte_level)--; } } -- Regards, Yi Liu

Re: [PATCH ats_vtd v5 04/22] intel_iommu: do not consider wait_desc as an invalid descriptor

2024-07-03 Thread Yi Liu
On 2024/7/2 23:29, CLEMENT MATHIEU--DRIF wrote: On 02/07/2024 15:33, Yi Liu wrote: 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. On 2024/7/2 13:52, CLEMENT MATHIEU--DRIF wrote: From: Clément

Re: [PATCH ats_vtd v5 00/22] ATS support for VT-d

2024-07-02 Thread Yi Liu
On 2024/7/2 13:52, CLEMENT MATHIEU--DRIF wrote: From: Clement Mathieu--Drif This series belongs to a list of series that add SVM support for VT-d. As a starting point, we use the series called 'intel_iommu: Enable stage-1 translation' (rfc2) by Zhenzhong Duan and Yi Liu. Here w

Re: [PATCH ats_vtd v5 00/22] ATS support for VT-d

2024-07-02 Thread Yi Liu
nable stage-1 translation' (rfc2) by Zhenzhong Duan and Yi Liu. Here we focus on the implementation of ATS support in the IOMMU and on a PCI-level API for ATS to be used by virtual devices. This work is based on the VT-d specification version 4.1 (March 2023). Here is a link to a GitHub

  1   2   >