cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
218e99
From 96d75583baef53a94ed53eec99f14951669f4155 Mon Sep 17 00:00:00 2001
218e99
From: Kevin Wolf <kwolf@redhat.com>
218e99
Date: Wed, 6 Nov 2013 14:41:06 +0100
218e99
Subject: [PATCH 30/81] apic: rename apic specific bitopts
218e99
218e99
RH-Author: Kevin Wolf <kwolf@redhat.com>
218e99
Message-id: <1383748882-22831-2-git-send-email-kwolf@redhat.com>
218e99
Patchwork-id: 55527
218e99
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 01/17] apic: rename apic specific bitopts
218e99
Bugzilla: 1001216
218e99
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
218e99
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
218e99
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
218e99
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
218e99
From: "Michael S. Tsirkin" <mst@redhat.com>
218e99
218e99
apic has its own version of bitops, with the
218e99
difference that it works on u32 and not long.
218e99
Add apic_ prefix to avoid namespace clashes.
218e99
218e99
We should look into reusing standard bitops long-term,
218e99
but that's not entirely trivial.
218e99
218e99
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
218e99
(cherry picked from commit edf9735e40841298874ee308fdecca2ac2aa5bdf)
218e99
Signed-off-by: Markus Armbruster <armbru@redhat.com>
218e99
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
218e99
---
218e99
 hw/intc/apic.c | 42 +++++++++++++++++++++---------------------
218e99
 1 file changed, 21 insertions(+), 21 deletions(-)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 hw/intc/apic.c |   42 +++++++++++++++++++++---------------------
218e99
 1 files changed, 21 insertions(+), 21 deletions(-)
218e99
218e99
diff --git a/hw/intc/apic.c b/hw/intc/apic.c
218e99
index 756dff0..46cb097 100644
218e99
--- a/hw/intc/apic.c
218e99
+++ b/hw/intc/apic.c
218e99
@@ -40,18 +40,18 @@ static void apic_get_delivery_bitmask(uint32_t *deliver_bitmask,
218e99
                                       uint8_t dest, uint8_t dest_mode);
218e99
 
218e99
 /* Find first bit starting from msb */
218e99
-static int fls_bit(uint32_t value)
218e99
+static int apic_fls_bit(uint32_t value)
218e99
 {
218e99
     return 31 - clz32(value);
218e99
 }
218e99
 
218e99
 /* Find first bit starting from lsb */
218e99
-static int ffs_bit(uint32_t value)
218e99
+static int apic_ffs_bit(uint32_t value)
218e99
 {
218e99
     return ctz32(value);
218e99
 }
218e99
 
218e99
-static inline void set_bit(uint32_t *tab, int index)
218e99
+static inline void apic_set_bit(uint32_t *tab, int index)
218e99
 {
218e99
     int i, mask;
218e99
     i = index >> 5;
218e99
@@ -59,7 +59,7 @@ static inline void set_bit(uint32_t *tab, int index)
218e99
     tab[i] |= mask;
218e99
 }
218e99
 
218e99
-static inline void reset_bit(uint32_t *tab, int index)
218e99
+static inline void apic_reset_bit(uint32_t *tab, int index)
218e99
 {
218e99
     int i, mask;
218e99
     i = index >> 5;
218e99
@@ -67,7 +67,7 @@ static inline void reset_bit(uint32_t *tab, int index)
218e99
     tab[i] &= ~mask;
218e99
 }
218e99
 
218e99
-static inline int get_bit(uint32_t *tab, int index)
218e99
+static inline int apic_get_bit(uint32_t *tab, int index)
218e99
 {
218e99
     int i, mask;
218e99
     i = index >> 5;
218e99
@@ -81,7 +81,7 @@ static int get_highest_priority_int(uint32_t *tab)
218e99
     int i;
218e99
     for (i = 7; i >= 0; i--) {
218e99
         if (tab[i] != 0) {
218e99
-            return i * 32 + fls_bit(tab[i]);
218e99
+            return i * 32 + apic_fls_bit(tab[i]);
218e99
         }
218e99
     }
218e99
     return -1;
218e99
@@ -184,7 +184,7 @@ void apic_deliver_pic_intr(DeviceState *d, int level)
218e99
         case APIC_DM_FIXED:
218e99
             if (!(lvt & APIC_LVT_LEVEL_TRIGGER))
218e99
                 break;
218e99
-            reset_bit(s->irr, lvt & 0xff);
218e99
+            apic_reset_bit(s->irr, lvt & 0xff);
218e99
             /* fall through */
218e99
         case APIC_DM_EXTINT:
218e99
             cpu_reset_interrupt(CPU(s->cpu), CPU_INTERRUPT_HARD);
218e99
@@ -230,7 +230,7 @@ static void apic_bus_deliver(const uint32_t *deliver_bitmask,
218e99
                 d = -1;
218e99
                 for(i = 0; i < MAX_APIC_WORDS; i++) {
218e99
                     if (deliver_bitmask[i]) {
218e99
-                        d = i * 32 + ffs_bit(deliver_bitmask[i]);
218e99
+                        d = i * 32 + apic_ffs_bit(deliver_bitmask[i]);
218e99
                         break;
218e99
                     }
218e99
                 }
218e99
@@ -386,13 +386,13 @@ void apic_poll_irq(DeviceState *d)
218e99
 
218e99
 static void apic_set_irq(APICCommonState *s, int vector_num, int trigger_mode)
218e99
 {
218e99
-    apic_report_irq_delivered(!get_bit(s->irr, vector_num));
218e99
+    apic_report_irq_delivered(!apic_get_bit(s->irr, vector_num));
218e99
 
218e99
-    set_bit(s->irr, vector_num);
218e99
+    apic_set_bit(s->irr, vector_num);
218e99
     if (trigger_mode)
218e99
-        set_bit(s->tmr, vector_num);
218e99
+        apic_set_bit(s->tmr, vector_num);
218e99
     else
218e99
-        reset_bit(s->tmr, vector_num);
218e99
+        apic_reset_bit(s->tmr, vector_num);
218e99
     if (s->vapic_paddr) {
218e99
         apic_sync_vapic(s, SYNC_ISR_IRR_TO_VAPIC);
218e99
         /*
218e99
@@ -412,8 +412,8 @@ static void apic_eoi(APICCommonState *s)
218e99
     isrv = get_highest_priority_int(s->isr);
218e99
     if (isrv < 0)
218e99
         return;
218e99
-    reset_bit(s->isr, isrv);
218e99
-    if (!(s->spurious_vec & APIC_SV_DIRECTED_IO) && get_bit(s->tmr, isrv)) {
218e99
+    apic_reset_bit(s->isr, isrv);
218e99
+    if (!(s->spurious_vec & APIC_SV_DIRECTED_IO) && apic_get_bit(s->tmr, isrv)) {
218e99
         ioapic_eoi_broadcast(isrv);
218e99
     }
218e99
     apic_sync_vapic(s, SYNC_FROM_VAPIC | SYNC_TO_VAPIC);
218e99
@@ -452,7 +452,7 @@ static void apic_get_delivery_bitmask(uint32_t *deliver_bitmask,
218e99
             int idx = apic_find_dest(dest);
218e99
             memset(deliver_bitmask, 0x00, MAX_APIC_WORDS * sizeof(uint32_t));
218e99
             if (idx >= 0)
218e99
-                set_bit(deliver_bitmask, idx);
218e99
+                apic_set_bit(deliver_bitmask, idx);
218e99
         }
218e99
     } else {
218e99
         /* XXX: cluster mode */
218e99
@@ -462,11 +462,11 @@ static void apic_get_delivery_bitmask(uint32_t *deliver_bitmask,
218e99
             if (apic_iter) {
218e99
                 if (apic_iter->dest_mode == 0xf) {
218e99
                     if (dest & apic_iter->log_dest)
218e99
-                        set_bit(deliver_bitmask, i);
218e99
+                        apic_set_bit(deliver_bitmask, i);
218e99
                 } else if (apic_iter->dest_mode == 0x0) {
218e99
                     if ((dest & 0xf0) == (apic_iter->log_dest & 0xf0) &&
218e99
                         (dest & apic_iter->log_dest & 0x0f)) {
218e99
-                        set_bit(deliver_bitmask, i);
218e99
+                        apic_set_bit(deliver_bitmask, i);
218e99
                     }
218e99
                 }
218e99
             } else {
218e99
@@ -509,14 +509,14 @@ static void apic_deliver(DeviceState *d, uint8_t dest, uint8_t dest_mode,
218e99
         break;
218e99
     case 1:
218e99
         memset(deliver_bitmask, 0x00, sizeof(deliver_bitmask));
218e99
-        set_bit(deliver_bitmask, s->idx);
218e99
+        apic_set_bit(deliver_bitmask, s->idx);
218e99
         break;
218e99
     case 2:
218e99
         memset(deliver_bitmask, 0xff, sizeof(deliver_bitmask));
218e99
         break;
218e99
     case 3:
218e99
         memset(deliver_bitmask, 0xff, sizeof(deliver_bitmask));
218e99
-        reset_bit(deliver_bitmask, s->idx);
218e99
+        apic_reset_bit(deliver_bitmask, s->idx);
218e99
         break;
218e99
     }
218e99
 
218e99
@@ -573,8 +573,8 @@ int apic_get_interrupt(DeviceState *d)
218e99
         apic_sync_vapic(s, SYNC_TO_VAPIC);
218e99
         return s->spurious_vec & 0xff;
218e99
     }
218e99
-    reset_bit(s->irr, intno);
218e99
-    set_bit(s->isr, intno);
218e99
+    apic_reset_bit(s->irr, intno);
218e99
+    apic_set_bit(s->isr, intno);
218e99
     apic_sync_vapic(s, SYNC_TO_VAPIC);
218e99
 
218e99
     /* re-inject if there is still a pending PIC interrupt */
218e99
-- 
218e99
1.7.1
218e99