mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
iommu/amd: Do not reallocate GA log buffers on resume
Commitc5e1a1eb92("iommu/amd: Simplify and Consolidate Virtual APIC (AVIC) Enablement") moved the GA log allocation from iommu_init_pci() to enable_iommus_vapic(), which is called on every resume. iommu_init_ga_log() assigns iommu->ga_log and iommu->ga_log_tail unconditionally. Each resume therefore replaces the boot-time pointers and leaks both old allocations. The function also uses GFP_KERNEL from a syscore resume callback, where interrupts are disabled and the non-boot CPUs are offline. Return early if both buffers are already allocated. Clear the pointers in free_ga_log() so a partial allocation failure cannot leave ga_log dangling. Fixes:c5e1a1eb92("iommu/amd: Simplify and Consolidate Virtual APIC (AVIC) Enablement") Assisted-by: Claude:claude-opus-5 Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com> Reviewed-by: Vasant Hegde <vasant.hegde@amd.com> Reviewed-by: Ankit Soni <Ankit.Soni@amd.com> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
This commit is contained in:
parent
20db657330
commit
00a7dd6488
|
|
@ -909,7 +909,9 @@ static void free_ga_log(struct amd_iommu *iommu)
|
|||
{
|
||||
#ifdef CONFIG_IRQ_REMAP
|
||||
iommu_free_pages(iommu->ga_log);
|
||||
iommu->ga_log = NULL;
|
||||
iommu_free_pages(iommu->ga_log_tail);
|
||||
iommu->ga_log_tail = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -956,6 +958,9 @@ static int iommu_init_ga_log(struct amd_iommu *iommu)
|
|||
if (WARN_ON_ONCE(!AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir)))
|
||||
return -EINVAL;
|
||||
|
||||
if (iommu->ga_log && iommu->ga_log_tail)
|
||||
return 0;
|
||||
|
||||
iommu->ga_log = iommu_alloc_pages_node_sz(nid, GFP_KERNEL, GA_LOG_SIZE);
|
||||
if (!iommu->ga_log)
|
||||
goto err_out;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user