All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saurabh Sengar <ssengar@linux.microsoft.com>
To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
	dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com,
	johan+linaro@kernel.org, isaku.yamahata@intel.com,
	mikelley@microsoft.com, linux-kernel@vger.kernel.org
Subject: [PATCH] x86/ioapic: Don't return 0 as valid virq
Date: Thu,  2 Mar 2023 11:34:46 -0800	[thread overview]
Message-ID: <1677785686-2152-1-git-send-email-ssengar@linux.microsoft.com> (raw)

Zero is invalid virq and should't be returned as a valid value for
lower irq bound. If IO-APIC and gsi_top are not initialized return
the 'from' value as virq.

Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
---
 arch/x86/kernel/apic/io_apic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index a868b76cd3d4..000cc6159b8b 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -2483,9 +2483,11 @@ unsigned int arch_dynirq_lower_bound(unsigned int from)
 	/*
 	 * dmar_alloc_hwirq() may be called before setup_IO_APIC(), so use
 	 * gsi_top if ioapic_dynirq_base hasn't been initialized yet.
+	 *
+	 * Incase gsi_top is also not initialized return @from.
 	 */
 	if (!ioapic_initialized)
-		return gsi_top;
+		return gsi_top ? : from;
 	/*
 	 * For DT enabled machines ioapic_dynirq_base is irrelevant and not
 	 * updated. So simply return @from if ioapic_dynirq_base == 0.
-- 
2.34.1


             reply	other threads:[~2023-03-02 19:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-02 19:34 Saurabh Sengar [this message]
2023-03-09 17:14 ` [PATCH] x86/ioapic: Don't return 0 as valid virq Saurabh Singh Sengar
2023-03-12 20:40 ` Borislav Petkov
2023-03-13  3:29   ` [EXTERNAL] " Saurabh Singh Sengar
2023-03-13  3:37     ` Saurabh Singh Sengar
2023-03-13 11:07       ` Borislav Petkov
2023-03-13 11:14     ` [EXTERNAL] " Borislav Petkov
2023-03-14 10:23       ` Saurabh Singh Sengar
2023-03-24  7:09         ` Saurabh Singh Sengar
2023-03-24 15:39         ` [EXTERNAL] " Thomas Gleixner
2023-03-24 16:24           ` Saurabh Singh Sengar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1677785686-2152-1-git-send-email-ssengar@linux.microsoft.com \
    --to=ssengar@linux.microsoft.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=isaku.yamahata@intel.com \
    --cc=johan+linaro@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikelley@microsoft.com \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.