On 2023/10/20 15:53, Tian, Kevin wrote:
From: Joao Martins<joao.m.martins@xxxxxxxxxx>
Sent: Thursday, October 19, 2023 4:27 AM
+
+ if (!IS_ERR(domain) && enforce_dirty) {
+ if (to_dmar_domain(domain)->use_first_level) {
+ iommu_domain_free(domain);
+ return ERR_PTR(-EOPNOTSUPP);
+ }
+ domain->dirty_ops = &intel_dirty_ops;
+ }
I don't understand why we should check use_first_level here. It's
a dead condition as alloc_user() only uses 2nd level. Later when
nested is introduced then we explicitly disallow enforce_dirty
on a nested user domain.
This is to restrict dirty tracking to the second level page table
*explicitly*. If we have a need to enable dirty tracking on the first
level in the future, we can remove this check.
Best regards,
baolu