All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvm/x86: use symbolic constant for nr interrupts
@ 2012-09-05 17:00 Michael S. Tsirkin
  2012-09-06 15:37 ` Avi Kivity
  0 siblings, 1 reply; 2+ messages in thread
From: Michael S. Tsirkin @ 2012-09-05 17:00 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti, gleb, kvm

interrupt_bitmap is KVM_NR_INTERRUPTS bits in size,
so just use that instead of hard-coded constants
and math.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 arch/x86/kvm/x86.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index dce75b76..62bba66 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2365,7 +2365,7 @@ static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu,
 static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu,
 				    struct kvm_interrupt *irq)
 {
-	if (irq->irq < 0 || irq->irq >= 256)
+	if (irq->irq < 0 || irq->irq >= KVM_NR_INTERRUPTS)
 		return -EINVAL;
 	if (irqchip_in_kernel(vcpu->kvm))
 		return -ENXIO;
@@ -5789,7 +5789,7 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
 	if (mmu_reset_needed)
 		kvm_mmu_reset_context(vcpu);
 
-	max_bits = (sizeof sregs->interrupt_bitmap) << 3;
+	max_bits = KVM_NR_INTERRUPTS;
 	pending_vec = find_first_bit(
 		(const unsigned long *)sregs->interrupt_bitmap, max_bits);
 	if (pending_vec < max_bits) {
-- 
MST

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] kvm/x86: use symbolic constant for nr interrupts
  2012-09-05 17:00 [PATCH] kvm/x86: use symbolic constant for nr interrupts Michael S. Tsirkin
@ 2012-09-06 15:37 ` Avi Kivity
  0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2012-09-06 15:37 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: Marcelo Tosatti, gleb, kvm

On 09/05/2012 08:00 PM, Michael S. Tsirkin wrote:
> interrupt_bitmap is KVM_NR_INTERRUPTS bits in size,
> so just use that instead of hard-coded constants
> and math.

Applied, thanks.


-- 
error compiling committee.c: too many arguments to function

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-09-06 15:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-05 17:00 [PATCH] kvm/x86: use symbolic constant for nr interrupts Michael S. Tsirkin
2012-09-06 15:37 ` Avi Kivity

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.