From patchwork Fri Sep 13 08:32:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ghadi Elie Rahme X-Patchwork-Id: 1985058 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X4ncZ4myhz1y2L for ; Fri, 13 Sep 2024 18:32:46 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1sp1jK-0008Ex-4W; Fri, 13 Sep 2024 08:32:38 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1sp1jH-0008Dg-SJ for kernel-team@lists.ubuntu.com; Fri, 13 Sep 2024 08:32:35 +0000 Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 990AB3F2FC for ; Fri, 13 Sep 2024 08:32:35 +0000 (UTC) Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-53654fd283bso391619e87.3 for ; Fri, 13 Sep 2024 01:32:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726216355; x=1726821155; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ECVQt2CalF91jyOIK3LMjaOqZkV0HPjFljvePTwlK5Q=; b=mx5vARD8kzI3CRl+WTqERvVQnET/OONB4+n/veHzDvVl9lCgd3P7bkAk7BuS2KhZ8V CcHXA8F7CcB0YlYLP0QCeFqRwXErODQw/6ZlLfESVio3ketmoOhZjkT9ZicfP0rkYWce JHDv+3Pj8ZBK7HOUecPhfzxW9Jk+gKZxsrFpyO0az/C1TErrlpQxxE8xFzpchpm8oLOA zxyZ01LDL9fSIbFpkv3oxgbNn2gBcpsPikjR+0wqUiFSrJQq76XGk798dnmtdhU/1oXZ EgeE3FJdj/jtCBmImG2NhLEllmsozGamHjX5/CU7ak7APXT/5FhHonfZNsCM7FmVpQi2 alyQ== X-Gm-Message-State: AOJu0YwpD+bdTdnUSivufWtmXzeI532D3wlxZ75Qcz+h9AO0IDk4SPZG w+dRAe2+4ubLeYKKjCocXEGrzr5nMWURDJCBritVmXRzvmqOr+SOtUP6ZKGElYYRRuSiJ4Vbp8d /b3x56Ni1fNzL3U7/TTLrRmlizCcHyM00qjJ0fWCnvHo2njcOHK3qkeX4Daibo9QAfHWoaAIM2i ZVHcIgZ4pbCw== X-Received: by 2002:a05:6512:31cd:b0:52c:e159:a998 with SMTP id 2adb3069b0e04-5367fee53femr1179944e87.29.1726216354552; Fri, 13 Sep 2024 01:32:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEDNoRBecVaAI8xL7O01V+f9LYULMOsELlxXKSiWtDWlCjgQRg9YOgPoiU2pOk8TlfMv0bmKA== X-Received: by 2002:a05:6512:31cd:b0:52c:e159:a998 with SMTP id 2adb3069b0e04-5367fee53femr1179913e87.29.1726216353797; Fri, 13 Sep 2024 01:32:33 -0700 (PDT) Received: from XPS-17-9720.han-hoki.ts.net ([213.204.117.111]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37895649449sm16151133f8f.12.2024.09.13.01.32.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 01:32:33 -0700 (PDT) From: Ghadi Elie Rahme To: kernel-team@lists.ubuntu.com Subject: [PATCH v2 1/2] iommu/amd: Simplify and Consolidate Virtual APIC (AVIC) Enablement Date: Fri, 13 Sep 2024 11:32:24 +0300 Message-ID: <20240913083225.715406-2-ghadi.rahme@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913083225.715406-1-ghadi.rahme@canonical.com> References: <20240913083225.715406-1-ghadi.rahme@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Suravee Suthikulpanit Currently, enabling AVIC requires individually detect and enable GAM and GALOG features on each IOMMU, which is difficult to keep track on multi-IOMMU system, where the features needs to be enabled system-wide. In addition, these features do not need to be enabled in early stage. It can be delayed until after amd_iommu_init_pci(). Therefore, consolidate logic for detecting and enabling IOMMU GAM and GALOG features into a helper function, enable_iommus_vapic(), which uses the check_feature_on_all_iommus() helper function to ensure system-wide support of the features before enabling them, and postpone until after amd_iommu_init_pci(). The new function also check and clean up feature enablement residue from previous boot (e.g. in case of booting into kdump kernel), which triggers a WARN_ON (shown below) introduced by the commit a8d4a37d1bb9 ("iommu/amd: Restore GA log/tail pointer on host resume") in iommu_ga_log_enable(). [ 7.731955] ------------[ cut here ]------------ [ 7.736575] WARNING: CPU: 0 PID: 1 at drivers/iommu/amd/init.c:829 iommu_ga_log_enable.isra.0+0x16f/0x190 [ 7.746135] Modules linked in: [ 7.749193] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G W -------- --- 5.19.0-0.rc7.53.eln120.x86_64 #1 [ 7.759706] Hardware name: Dell Inc. PowerEdge R7525/04D5GJ, BIOS 2.1.6 03/09/2021 [ 7.767274] RIP: 0010:iommu_ga_log_enable.isra.0+0x16f/0x190 [ 7.772931] Code: 20 20 00 00 8b 00 f6 c4 01 74 da 48 8b 44 24 08 65 48 2b 04 25 28 00 00 00 75 13 48 83 c4 10 5b 5d e9 f5 00 72 00 0f 0b eb e1 <0f> 0b eb dd e8 f8 66 42 00 48 8b 15 f1 85 53 01 e9 29 ff ff ff 48 [ 7.791679] RSP: 0018:ffffc90000107d20 EFLAGS: 00010206 [ 7.796905] RAX: ffffc90000780000 RBX: 0000000000000100 RCX: ffffc90000780000 [ 7.804038] RDX: 0000000000000001 RSI: ffffc90000780000 RDI: ffff8880451f9800 [ 7.811170] RBP: ffff8880451f9800 R08: ffffffffffffffff R09: 0000000000000000 [ 7.818303] R10: 0000000000000000 R11: 0000000000000000 R12: 0008000000000000 [ 7.825435] R13: ffff8880462ea900 R14: 0000000000000021 R15: 0000000000000000 [ 7.832572] FS: 0000000000000000(0000) GS:ffff888054a00000(0000) knlGS:0000000000000000 [ 7.840657] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 7.846400] CR2: ffff888054dff000 CR3: 0000000053210000 CR4: 0000000000350eb0 [ 7.853533] Call Trace: [ 7.855979] [ 7.858085] amd_iommu_enable_interrupts+0x180/0x270 [ 7.863051] ? iommu_setup+0x271/0x271 [ 7.866803] state_next+0x197/0x2c0 [ 7.870295] ? iommu_setup+0x271/0x271 [ 7.874049] iommu_go_to_state+0x24/0x2c [ 7.877976] amd_iommu_init+0xf/0x29 [ 7.881554] pci_iommu_init+0xe/0x36 [ 7.885133] do_one_initcall+0x44/0x200 [ 7.888975] do_initcalls+0xc8/0xe1 [ 7.892466] kernel_init_freeable+0x14c/0x199 [ 7.896826] ? rest_init+0xd0/0xd0 [ 7.900231] kernel_init+0x16/0x130 [ 7.903723] ret_from_fork+0x22/0x30 [ 7.907306] [ 7.909497] ---[ end trace 0000000000000000 ]--- Fixes: commit a8d4a37d1bb9 ("iommu/amd: Restore GA log/tail pointer on host resume") Reported-by: Jerry Snitselaar Cc: Joerg Roedel Cc: Maxim Levitsky Cc: Will Deacon (maintainer:IOMMU DRIVERS) Signed-off-by: Suravee Suthikulpanit Reviewed-by: Jerry Snitselaar Link: https://lore.kernel.org/r/20220726134348.6438-2-suravee.suthikulpanit@amd.com Signed-off-by: Joerg Roedel (backported from commit c5e1a1eb9279fdb28d47ca2a4493a4c53b7d6a0b) [ghadi-rahme: Had to adjust the context due to missing commits] signed-off-by: Ghadi Elie Rahme --- drivers/iommu/amd/init.c | 86 ++++++++++++++++++++++++++-------------- 1 file changed, 56 insertions(+), 30 deletions(-) diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c index 70f3720d96c7..f30d607f0e08 100644 --- a/drivers/iommu/amd/init.c +++ b/drivers/iommu/amd/init.c @@ -825,11 +825,6 @@ static int iommu_ga_log_enable(struct amd_iommu *iommu) if (!iommu->ga_log) return -EINVAL; - /* Check if already running */ - status = readl(iommu->mmio_base + MMIO_STATUS_OFFSET); - if (WARN_ON(status & (MMIO_STATUS_GALOG_RUN_MASK))) - return 0; - entry = iommu_virt_to_phys(iommu->ga_log) | GA_LOG_SIZE_512; memcpy_toio(iommu->mmio_base + MMIO_GA_LOG_BASE_OFFSET, &entry, sizeof(entry)); @@ -1915,10 +1910,6 @@ static int __init iommu_init_pci(struct amd_iommu *iommu) if (iommu_feature(iommu, FEATURE_PPR) && alloc_ppr_log(iommu)) return -ENOMEM; - ret = iommu_init_ga_log(iommu); - if (ret) - return ret; - if (iommu->cap & (1UL << IOMMU_CAP_NPCACHE)) { pr_info("Using strict mode due to virtualization\n"); iommu_set_dma_strict(); @@ -1995,8 +1986,6 @@ static void print_iommu_info(void) } if (irq_remapping_enabled) { pr_info("Interrupt remapping enabled\n"); - if (AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir)) - pr_info("Virtual APIC enabled\n"); if (amd_iommu_xt_mode == IRQ_REMAP_X2APIC_MODE) pr_info("X2APIC enabled\n"); } @@ -2277,9 +2266,6 @@ static int iommu_init_irq(struct amd_iommu *iommu) if (iommu->ppr_log != NULL) iommu_feature_enable(iommu, CONTROL_PPRINT_EN); - - iommu_ga_log_enable(iommu); - return 0; } @@ -2485,8 +2471,6 @@ static void iommu_enable_ga(struct amd_iommu *iommu) #ifdef CONFIG_IRQ_REMAP switch (amd_iommu_guest_ir) { case AMD_IOMMU_GUEST_IR_VAPIC: - iommu_feature_enable(iommu, CONTROL_GAM_EN); - fallthrough; case AMD_IOMMU_GUEST_IR_LEGACY_GA: iommu_feature_enable(iommu, CONTROL_GA_EN); iommu->irte_ops = &irte_128_ops; @@ -2557,19 +2541,6 @@ static void early_enable_iommus(void) iommu_flush_all_caches(iommu); } } - -#ifdef CONFIG_IRQ_REMAP - /* - * Note: We have already checked GASup from IVRS table. - * Now, we need to make sure that GAMSup is set. - */ - if (AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir) && - !check_feature_on_all_iommus(FEATURE_GAM_VAPIC)) - amd_iommu_guest_ir = AMD_IOMMU_GUEST_IR_LEGACY_GA; - - if (AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir)) - amd_iommu_irq_ops.capability |= (1 << IRQ_POSTING_CAP); -#endif } static void enable_iommus_v2(void) @@ -2582,10 +2553,64 @@ static void enable_iommus_v2(void) } } +static void enable_iommus_vapic(void) +{ +#ifdef CONFIG_IRQ_REMAP + u32 status, i; + struct amd_iommu *iommu; + + for_each_iommu(iommu) { + /* + * Disable GALog if already running. It could have been enabled + * in the previous boot before kdump. + */ + status = readl(iommu->mmio_base + MMIO_STATUS_OFFSET); + if (!(status & MMIO_STATUS_GALOG_RUN_MASK)) + continue; + + iommu_feature_disable(iommu, CONTROL_GALOG_EN); + iommu_feature_disable(iommu, CONTROL_GAINT_EN); + + /* + * Need to set and poll check the GALOGRun bit to zero before + * we can set/ modify GA Log registers safely. + */ + for (i = 0; i < LOOP_TIMEOUT; ++i) { + status = readl(iommu->mmio_base + MMIO_STATUS_OFFSET); + if (!(status & MMIO_STATUS_GALOG_RUN_MASK)) + break; + udelay(10); + } + + if (WARN_ON(i >= LOOP_TIMEOUT)) + return; + } + + if (AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir) && + !check_feature_on_all_iommus(FEATURE_GAM_VAPIC)) { + amd_iommu_guest_ir = AMD_IOMMU_GUEST_IR_LEGACY_GA; + return; + } + + /* Enabling GAM support */ + for_each_iommu(iommu) { + if (iommu_init_ga_log(iommu) || + iommu_ga_log_enable(iommu)) + return; + + iommu_feature_enable(iommu, CONTROL_GAM_EN); + } + + amd_iommu_irq_ops.capability |= (1 << IRQ_POSTING_CAP); + pr_info("Virtual APIC enabled\n"); +#endif +} + + static void enable_iommus(void) { early_enable_iommus(); - + enable_iommus_vapic(); enable_iommus_v2(); } @@ -2983,6 +3008,7 @@ static int __init state_next(void) register_syscore_ops(&amd_iommu_syscore_ops); ret = amd_iommu_init_pci(); init_state = ret ? IOMMU_INIT_ERROR : IOMMU_PCI_INIT; + enable_iommus_vapic(); enable_iommus_v2(); break; case IOMMU_PCI_INIT: From patchwork Fri Sep 13 08:32:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ghadi Elie Rahme X-Patchwork-Id: 1985057 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X4ncZ2MjDz1y2K for ; Fri, 13 Sep 2024 18:32:46 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1sp1jL-0008Ft-Bv; Fri, 13 Sep 2024 08:32:39 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1sp1jI-0008ET-3V for kernel-team@lists.ubuntu.com; Fri, 13 Sep 2024 08:32:36 +0000 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id F1F543F328 for ; Fri, 13 Sep 2024 08:32:35 +0000 (UTC) Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-378ab5b74e1so333776f8f.3 for ; Fri, 13 Sep 2024 01:32:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726216355; x=1726821155; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Nja1Zb5hiiioxkbzg4VCDGFAY/SuggG9aul+fqMrMrw=; b=dEtm2lcsL291+9qLP/4pj1qqOLFM9Wd4RqfngCD2iMVzsAeeP+nGkUkaCT6K3hpIYy 4PsBWtBUsizwp4cjGyojD9qT441pqoU0rIvaxgna0NrFBvp1+ikl1HJL7N63/hqk/XBb jkCORR6Ic2O0MDd7qyXC+9i1Zv3mjQF3lpBWYRpqhuYRa5aRFch290xhodjmwcfnA7wq ccD7pOyy09+QIkyPLBCaxwbm6U9/xvHb73qBMK9l3UFd1d/wqDF/VN3s2ighQTZPjNL+ eioRNQdf9RXel6jOxNE8ELq9TEcAtNaib5fMLAtA+bqi9gjrmTCtsHfrQdBbkrwTCI+g dlfA== X-Gm-Message-State: AOJu0Yw18zeiFI9OnIi9d+oiaz4gEP7Yf6YrSNzc6s1FZkw9OVJFDOf+ ggAXT9B6P2zVG06i6MxrqVOAUFzh8qPU63CxGHQPtNfByCmMsbjLF09WEvb/FGQI146OzxntusJ 1vDYjpUcJ/IvoWi/5jF4CZT6GJZ8H+1TSX6QLdeXLldRvAx3aKWvbqCVhkBgHCogaplYeTwVgVJ o6eO3C1mZHEA== X-Received: by 2002:a05:6000:1864:b0:371:8c9c:d97f with SMTP id ffacd0b85a97d-378d61d507emr1322237f8f.10.1726216355172; Fri, 13 Sep 2024 01:32:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHVM7KxghllKYnACK2xefpEnQE/LBK5N3H4XRnr9JR96GoYSgcf03RMesNg9Ct0OwuYCNFyGA== X-Received: by 2002:a05:6000:1864:b0:371:8c9c:d97f with SMTP id ffacd0b85a97d-378d61d507emr1322209f8f.10.1726216354643; Fri, 13 Sep 2024 01:32:34 -0700 (PDT) Received: from XPS-17-9720.han-hoki.ts.net ([213.204.117.111]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37895649449sm16151133f8f.12.2024.09.13.01.32.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 01:32:34 -0700 (PDT) From: Ghadi Elie Rahme To: kernel-team@lists.ubuntu.com Subject: [PATCH v2 2/2] iommu/amd: Fix compile warning in init code Date: Fri, 13 Sep 2024 11:32:25 +0300 Message-ID: <20240913083225.715406-3-ghadi.rahme@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913083225.715406-1-ghadi.rahme@canonical.com> References: <20240913083225.715406-1-ghadi.rahme@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Joerg Roedel A recent commit introduced these compile warnings: CC drivers/iommu/amd/init.o drivers/iommu/amd/init.c:938:12: error: ‘iommu_init_ga_log’ defined but not used [-Werror=unused-function] 938 | static int iommu_init_ga_log(struct amd_iommu *iommu) | ^~~~~~~~~~~~~~~~~ drivers/iommu/amd/init.c:902:12: error: ‘iommu_ga_log_enable’ defined but not used [-Werror=unused-function] 902 | static int iommu_ga_log_enable(struct amd_iommu *iommu) | ^~~~~~~~~~~~~~~~~~~ The warnings appear because both functions are defined when IRQ remapping is not enabled, but only used when IRQ remapping is enabled. Fix it by only defining the functions when IRQ remapping is enabled. Fixes: c5e1a1eb9279 ("iommu/amd: Simplify and Consolidate Virtual APIC (AVIC) Enablement") Signed-off-by: Joerg Roedel Link: https://lore.kernel.org/r/20220729100432.22474-1-joro@8bytes.org (backported from commit be280ea763f7db492e0e30ba22873433aea0f468) [ghadi-rahme: Had to adjust the context due to missing commits] signed-off-by: Ghadi Elie Rahme --- drivers/iommu/amd/init.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c index f30d607f0e08..8c250240e63e 100644 --- a/drivers/iommu/amd/init.c +++ b/drivers/iommu/amd/init.c @@ -808,9 +808,9 @@ static void __init free_ppr_log(struct amd_iommu *iommu) free_pages((unsigned long)iommu->ppr_log, get_order(PPR_LOG_SIZE)); } +#ifdef CONFIG_IRQ_REMAP static void free_ga_log(struct amd_iommu *iommu) { -#ifdef CONFIG_IRQ_REMAP free_pages((unsigned long)iommu->ga_log, get_order(GA_LOG_SIZE)); free_pages((unsigned long)iommu->ga_log_tail, get_order(8)); #endif @@ -848,13 +848,12 @@ static int iommu_ga_log_enable(struct amd_iommu *iommu) if (WARN_ON(i >= LOOP_TIMEOUT)) return -EINVAL; -#endif /* CONFIG_IRQ_REMAP */ + return 0; } static int iommu_init_ga_log(struct amd_iommu *iommu) { -#ifdef CONFIG_IRQ_REMAP if (!AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir)) return 0; @@ -872,10 +871,8 @@ static int iommu_init_ga_log(struct amd_iommu *iommu) err_out: free_ga_log(iommu); return -EINVAL; -#else - return 0; -#endif /* CONFIG_IRQ_REMAP */ } +#endif /* CONFIG_IRQ_REMAP */ static int __init alloc_cwwb_sem(struct amd_iommu *iommu) {