Re: [PATCH v3 7/7] iommu/amd: Do not support IOMMUv2 APIs when SNP is enabled

2022-06-29 Thread Suthikulpanit, Suravee via iommu
On 6/23/2022 3:23 PM, Joerg Roedel wrote: On Wed, Jun 22, 2022 at 12:11:31PM -0500, Suravee Suthikulpanit wrote: bool amd_iommu_v2_supported(void) { - return amd_iommu_v2_present; + /* +* Since DTE[Mode]=0 is prohibited on SNP-enabled system +* (i.e.

Re: [PATCH v3 1/7] iommu/amd: Warn when found inconsistency EFR mask

2022-06-29 Thread Suthikulpanit, Suravee via iommu
On 6/23/2022 3:22 PM, Joerg Roedel wrote: On Wed, Jun 22, 2022 at 12:11:25PM -0500, Suravee Suthikulpanit wrote: #ifdef CONFIG_IRQ_REMAP +/* + * Iterate through all the IOMMUs to verify if the specified + * EFR bitmask of IOMMU feature are set. + * Warn and return false if found

Re: [PATCH v2 4/7] iommu/amd: Introduce function to check and enable SNP

2022-06-22 Thread Suthikulpanit, Suravee via iommu
On 6/22/2022 3:35 PM, Robin Murphy wrote: Overall though, this is way nicer than v1, and it's definitely the right name in the right place now, thanks! FWIW, with those nits picked one way or another: Reviewed-by: Robin Murphy Cheers, Robin. Thanks for your review. I'll send out v3 w/

Re: [PATCH v2 4/7] iommu/amd: Introduce function to check and enable SNP

2022-06-22 Thread Suthikulpanit, Suravee via iommu
Recap discussion on the other thread. https://lore.kernel.org/linux-mm/camkat6qorwbaxapacasm0sc9o2uq9zqzb6s1kbkvav2d4tk...@mail.gmail.com/#t On 6/16/2022 8:55 AM, Suravee Suthikulpanit wrote: +int amd_iommu_snp_enable(void) +{ + /* +* The SNP support requires that IOMMU must be

Re: [PATCH 5/7] iommu: Add domain_type_supported() callback in iommu_ops

2022-06-14 Thread Suthikulpanit, Suravee via iommu
Robin, On 6/14/2022 4:51 PM, Robin Murphy wrote: On 2022-06-13 15:38, Suthikulpanit, Suravee wrote: Robin, On 6/13/2022 4:31 PM, Robin Murphy wrote: Introducing check_domain_type_supported() callback in iommu_ops, which allows IOMMU generic layer to check with vendor-specific IOMMU driver

Re: [PATCH 3/7] iommu/amd: Introduce function to check SEV-SNP support

2022-06-13 Thread Suthikulpanit, Suravee via iommu
On 6/13/2022 8:24 AM, Suravee Suthikulpanit wrote: @@ -3543,3 +3537,30 @@ int amd_iommu_pc_set_reg(struct amd_iommu *iommu, u8 bank, u8 cntr, u8 fxn, u64 return iommu_pc_get_set_reg(iommu, bank, cntr, fxn, value, true); } + +bool iommu_sev_snp_supported(void) +{ + /* +

Re: [PATCH 5/7] iommu: Add domain_type_supported() callback in iommu_ops

2022-06-13 Thread Suthikulpanit, Suravee via iommu
Robin, On 6/13/2022 4:31 PM, Robin Murphy wrote: On 2022-06-13 02:25, Suravee Suthikulpanit wrote: When user requests to change IOMMU domain to a new type, IOMMU generic layer checks the requested type against the default domain type returned by vendor-specific IOMMU driver. However, there is 

Re: iommu/amd: bug report: page table memory leak

2022-02-08 Thread Suthikulpanit, Suravee via iommu
Hi Daniel, On 1/19/2022 2:47 AM, Daniel Jordan wrote: Hi, I've hit a memory leak while testing qemu v6.2.0-rc4 on an AMD EPYC 7J13 (Milan) system. Starting an almost 1T guest, the leak is over 1.5G per qemu invocation. I haven't checked whether the leak is proportional to guest size. It

Re: [PATCH 0/3] iommu/amd: Fix unable to handle page fault due to AVIC

2021-09-02 Thread Suthikulpanit, Suravee via iommu
On 9/2/2021 12:38 AM, Joerg Roedel wrote: Hi Suravee, On Tue, Aug 31, 2021 at 12:10:27PM -0500, Suthikulpanit, Suravee wrote: Here is an dditional tags for this series: Fixes: 8bda0cfbdc1a ("iommu/amd: Detect and initialize guest vAPIC log") Are there any concerns with this series? No

Re: [PATCH 0/3] iommu/amd: Fix unable to handle page fault due to AVIC

2021-08-31 Thread Suthikulpanit, Suravee via iommu
Joerg, Here is an dditional tags for this series: Fixes: 8bda0cfbdc1a ("iommu/amd: Detect and initialize guest vAPIC log") Are there any concerns with this series? Thanks Suravee On 8/20/2021 3:29 PM, Suravee Suthikulpanit wrote: This bug is triggered when rebooting VM on a system which SVM

Re: [PATCH v3] iommu/amd: Use report_iommu_fault()

2021-08-05 Thread Suthikulpanit, Suravee via iommu
Lennert, FYI: I have made some comments in V2 thread specifically around the new changes that we discussed in that thread. Thanks, Suravee ___ iommu mailing list iommu@lists.linux-foundation.org

Re: [PATCH v2] iommu/amd: Use report_iommu_fault()

2021-08-05 Thread Suthikulpanit, Suravee via iommu
Lennert, On 7/29/2021 9:32 PM, Lennert Buytenhek wrote: We have three cases to handle: - EVENT_FLAG_I set: IRQ remapping fault, don't call report_iommu_fault() - EVENT_FLAG_I unset, but the request was a translation request (EVENT_FLAG_TR set) or the target page was not present

Re: [PATCH v2] iommu/amd: Use report_iommu_fault()

2021-07-28 Thread Suthikulpanit, Suravee via iommu
Lennert, On 7/26/2021 11:31 AM, Lennert Buytenhek wrote: This patch makes iommu/amd call report_iommu_fault() when an I/O page fault occurs, which has two effects: 1) It allows device drivers to register a callback to be notified of I/O page faults, via the iommu_set_fault_handler() API.

Re: [PATCH] iommu/amd: Convert from atomic_t to refcount_t on pasid_state->count

2021-07-22 Thread Suthikulpanit, Suravee via iommu
On 7/19/2021 3:32 AM, Xiyu Yang wrote: refcount_t type and corresponding API can protect refcounters from accidental underflow and overflow and further use-after-free situations. Signed-off-by: Xiyu Yang Signed-off-by: Xin Tan Thanks, Reviewed-by: Suravee Suthikulpanit

Re: [PATCH] iommu/amd: Convert from atomic_t to refcount_t on device_state->count

2021-07-22 Thread Suthikulpanit, Suravee via iommu
On 7/19/2021 1:00 AM, Xiyu Yang wrote: refcount_t type and corresponding API can protect refcounters from accidental underflow and overflow and further use-after-free situations. Signed-off-by: Xiyu Yang Signed-off-by: Xin Tan --- drivers/iommu/amd/iommu_v2.c | 11 ++- 1 file

Re: [PATCH,RFC] iommu/amd: Use report_iommu_fault()

2021-07-22 Thread Suthikulpanit, Suravee via iommu
Lennert, On 7/19/2021 4:54 AM, Lennert Buytenhek wrote: This patch makes iommu/amd call report_iommu_fault() when an I/O page fault occurs, which has two effects: 1) It allows device drivers to register a callback to be notified of I/O page faults, via the iommu_set_fault_handler() API.

Re: [PATCH] iommu/amd: Fix printing of IOMMU events when rate limiting kicks in

2021-07-22 Thread Suthikulpanit, Suravee via iommu
On 7/21/2021 8:44 AM, Lennert Buytenhek wrote: For the printing of RMP_HW_ERROR / RMP_PAGE_FAULT / IO_PAGE_FAULT events, the AMD IOMMU code uses such logic: if (pdev) dev_data = dev_iommu_priv_get(>dev); if (dev_data && __ratelimit(_data->rs)) {

Re: [PATCH] iommu/amd: Fix I/O page fault logging ratelimit test

2021-07-20 Thread Suthikulpanit, Suravee via iommu
Hi Lennert, On 7/18/2021 7:47 PM, Lennert Buytenhek wrote: On an AMD system, I/O page faults are usually logged like this: diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index 811a49a95d04..7ae426b092f2 100644 --- a/drivers/iommu/amd/iommu.c +++