Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Sean Christopherson <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	 Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Kai Huang <kai.huang@intel.com>
Subject: [PATCH v2 07/18] KVM: x86: Rename irqchip_kernel() to irqchip_full()
Date: Wed, 11 Jun 2025 14:35:46 -0700	[thread overview]
Message-ID: <20250611213557.294358-8-seanjc@google.com> (raw)
In-Reply-To: <20250611213557.294358-1-seanjc@google.com>

Rename irqchip_kernel() to irqchip_full(), as "kernel" is very ambiguous
due to the existence of split IRQ chip support, where only some of the
"irqchip" is in emulated by the kernel/KVM.  E.g. irqchip_kernel() often
gets confused with irqchip_in_kernel().

Opportunistically hoist the definition up in irq.h so that it's
co-located with other "full" irqchip code in anticipation of wrapping it
all with a Kconfig/#ifdef.

No functional change intended.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 arch/x86/kvm/ioapic.h   |  2 +-
 arch/x86/kvm/irq.c      |  2 +-
 arch/x86/kvm/irq.h      | 22 +++++++++++-----------
 arch/x86/kvm/irq_comm.c |  2 +-
 arch/x86/kvm/x86.c      |  4 ++--
 5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/arch/x86/kvm/ioapic.h b/arch/x86/kvm/ioapic.h
index a86f59bbea44..289cca3aec69 100644
--- a/arch/x86/kvm/ioapic.h
+++ b/arch/x86/kvm/ioapic.h
@@ -103,7 +103,7 @@ do {									\
 
 static inline int ioapic_in_kernel(struct kvm *kvm)
 {
-	return irqchip_kernel(kvm);
+	return irqchip_full(kvm);
 }
 
 void kvm_rtc_eoi_tracking_restore_one(struct kvm_vcpu *vcpu);
diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
index da47e2165389..97e1617ce24d 100644
--- a/arch/x86/kvm/irq.c
+++ b/arch/x86/kvm/irq.c
@@ -172,7 +172,7 @@ bool kvm_arch_irqfd_allowed(struct kvm *kvm, struct kvm_irqfd *args)
 {
 	bool resample = args->flags & KVM_IRQFD_FLAG_RESAMPLE;
 
-	return resample ? irqchip_kernel(kvm) : irqchip_in_kernel(kvm);
+	return resample ? irqchip_full(kvm) : irqchip_in_kernel(kvm);
 }
 
 bool kvm_arch_irqchip_in_kernel(struct kvm *kvm)
diff --git a/arch/x86/kvm/irq.h b/arch/x86/kvm/irq.h
index aa77a6b2828c..4ac346102350 100644
--- a/arch/x86/kvm/irq.h
+++ b/arch/x86/kvm/irq.h
@@ -69,16 +69,7 @@ int kvm_pic_set_irq(struct kvm_kernel_irq_routing_entry *e, struct kvm *kvm,
 int kvm_vm_ioctl_get_irqchip(struct kvm *kvm, struct kvm_irqchip *chip);
 int kvm_vm_ioctl_set_irqchip(struct kvm *kvm, struct kvm_irqchip *chip);
 
-static inline int irqchip_split(struct kvm *kvm)
-{
-	int mode = kvm->arch.irqchip_mode;
-
-	/* Matches smp_wmb() when setting irqchip_mode */
-	smp_rmb();
-	return mode == KVM_IRQCHIP_SPLIT;
-}
-
-static inline int irqchip_kernel(struct kvm *kvm)
+static inline int irqchip_full(struct kvm *kvm)
 {
 	int mode = kvm->arch.irqchip_mode;
 
@@ -89,7 +80,16 @@ static inline int irqchip_kernel(struct kvm *kvm)
 
 static inline int pic_in_kernel(struct kvm *kvm)
 {
-	return irqchip_kernel(kvm);
+	return irqchip_full(kvm);
+}
+
+static inline int irqchip_split(struct kvm *kvm)
+{
+	int mode = kvm->arch.irqchip_mode;
+
+	/* Matches smp_wmb() when setting irqchip_mode */
+	smp_rmb();
+	return mode == KVM_IRQCHIP_SPLIT;
 }
 
 static inline int irqchip_in_kernel(struct kvm *kvm)
diff --git a/arch/x86/kvm/irq_comm.c b/arch/x86/kvm/irq_comm.c
index 28a8555ab58b..bcf2f1e4a005 100644
--- a/arch/x86/kvm/irq_comm.c
+++ b/arch/x86/kvm/irq_comm.c
@@ -200,7 +200,7 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id)
 		goto unlock;
 	}
 	clear_bit(irq_source_id, &kvm->arch.irq_sources_bitmap);
-	if (!irqchip_kernel(kvm))
+	if (!irqchip_full(kvm))
 		goto unlock;
 
 	kvm_ioapic_clear_all(kvm->arch.vioapic, irq_source_id);
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 311a670b6652..fb7b0d301c38 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -7039,7 +7039,7 @@ int kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg)
 		}
 
 		r = -ENXIO;
-		if (!irqchip_kernel(kvm))
+		if (!irqchip_full(kvm))
 			goto get_irqchip_out;
 		r = kvm_vm_ioctl_get_irqchip(kvm, chip);
 		if (r)
@@ -7063,7 +7063,7 @@ int kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg)
 		}
 
 		r = -ENXIO;
-		if (!irqchip_kernel(kvm))
+		if (!irqchip_full(kvm))
 			goto set_irqchip_out;
 		r = kvm_vm_ioctl_set_irqchip(kvm, chip);
 	set_irqchip_out:
-- 
2.50.0.rc1.591.g9c95f17f64-goog


  parent reply	other threads:[~2025-06-11 21:36 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-11 21:35 [PATCH v2 00/18] KVM: x86: Add I/O APIC kconfig, delete irq_comm.c Sean Christopherson
2025-06-11 21:35 ` [PATCH v2 01/18] KVM: x86: Trigger I/O APIC route rescan in kvm_arch_irq_routing_update() Sean Christopherson
2025-06-11 21:35 ` [PATCH v2 02/18] KVM: x86: Drop superfluous kvm_set_pic_irq() => kvm_pic_set_irq() wrapper Sean Christopherson
2025-06-11 21:35 ` [PATCH v2 03/18] KVM: x86: Drop superfluous kvm_set_ioapic_irq() => kvm_ioapic_set_irq() wrapper Sean Christopherson
2025-06-11 21:35 ` [PATCH v2 04/18] KVM: x86: Drop superfluous kvm_hv_set_sint() => kvm_hv_synic_set_irq() wrapper Sean Christopherson
2025-06-12  2:38   ` Huang, Kai
2025-06-13  0:48     ` Sean Christopherson
2025-06-13  1:41       ` Huang, Kai
2025-06-13 14:22         ` Sean Christopherson
2025-06-18  9:02   ` Vitaly Kuznetsov
2025-06-11 21:35 ` [PATCH v2 05/18] KVM: x86: Move PIT ioctl helpers to i8254.c Sean Christopherson
2025-06-12  2:09   ` Huang, Kai
2025-06-13  0:49     ` Sean Christopherson
2025-06-11 21:35 ` [PATCH v2 06/18] KVM: x86: Move KVM_{GET,SET}_IRQCHIP ioctl helpers to irq.c Sean Christopherson
2025-06-12  2:20   ` Huang, Kai
2025-06-13  0:52     ` Sean Christopherson
2025-06-11 21:35 ` Sean Christopherson [this message]
2025-06-12  2:24   ` [PATCH v2 07/18] KVM: x86: Rename irqchip_kernel() to irqchip_full() Huang, Kai
2025-06-13  0:53     ` Sean Christopherson
2025-06-11 21:35 ` [PATCH v2 08/18] KVM: x86: Move kvm_setup_default_irq_routing() into irq.c Sean Christopherson
2025-06-12  2:27   ` Huang, Kai
2025-06-11 21:35 ` [PATCH v2 09/18] KVM: x86: Move kvm_{request,free}_irq_source_id() to i8254.c (PIT) Sean Christopherson
2025-06-11 21:35 ` [PATCH v2 10/18] KVM: x86: Hardcode the PIT IRQ source ID to '2' Sean Christopherson
2025-06-11 21:35 ` [PATCH v2 11/18] KVM: x86: Don't clear PIT's IRQ line status when destroying PIT Sean Christopherson
2025-06-11 21:35 ` [PATCH v2 12/18] KVM: x86: Explicitly check for in-kernel PIC when getting ExtINT Sean Christopherson
2025-06-11 21:35 ` [PATCH v2 13/18] KVM: Move x86-only tracepoints to x86's trace.h Sean Christopherson
2025-06-11 21:35 ` [PATCH v2 14/18] KVM: x86: Add CONFIG_KVM_IOAPIC to allow disabling in-kernel I/O APIC Sean Christopherson
2025-06-11 21:35 ` [PATCH v2 15/18] KVM: Squash two CONFIG_HAVE_KVM_IRQCHIP #ifdefs into one Sean Christopherson
2025-06-11 21:35 ` [PATCH v2 16/18] KVM: selftests: Fall back to split IRQ chip if full in-kernel chip is unsupported Sean Christopherson
2025-06-11 21:35 ` [PATCH v2 17/18] KVM: x86: Move IRQ mask notifier infrastructure to I/O APIC emulation Sean Christopherson
2025-06-11 21:35 ` [PATCH v2 18/18] KVM: x86: Fold irq_comm.c into irq.c Sean Christopherson
2025-06-24 19:38 ` [PATCH v2 00/18] KVM: x86: Add I/O APIC kconfig, delete irq_comm.c Sean Christopherson

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=20250611213557.294358-8-seanjc@google.com \
    --to=seanjc@google.com \
    --cc=kai.huang@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=vkuznets@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox