[kvm-unit-tests PATCH v2 01/16] x86/apic: Use common library outb() implementation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Remove the redundant local outb() implementation in favour of using the
common outb() implementation defined in lib/x86/asm/io.h, and convert
set_irq_line() to not open-code the out instruction.

Verfied no changes in assembly output for all three callsites, tested,
no functional changes were observed.

The rationale behind this change is that, support for SNP tests that are
introduced later will need apic sources to include common library io
code and if we don't remove apic's local outb() implementation, then we
get the following compilation conflicts:

In file included from lib/x86/apic.c:7:
lib/x86/asm/io.h:30:14: error: conflicting types for ‘outb’; have ‘void(unsigned char,  short unsigned int)’
   30 | #define outb outb
      |              ^~~~

Signed-off-by: Pavan Kumar Paluri <papaluri@xxxxxxx>
---
 lib/x86/apic.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/lib/x86/apic.c b/lib/x86/apic.c
index 0d15147677dd..bbc2d8ae85b1 100644
--- a/lib/x86/apic.c
+++ b/lib/x86/apic.c
@@ -4,6 +4,7 @@
 #include "processor.h"
 #include "smp.h"
 #include "asm/barrier.h"
+#include "asm/io.h"
 
 /* xAPIC and I/O APIC are identify mapped, and never relocated. */
 static void *g_apic = (void *)APIC_DEFAULT_PHYS_BASE;
@@ -23,11 +24,6 @@ static struct apic_ops *get_apic_ops(void)
 	return this_cpu_read_apic_ops();
 }
 
-static void outb(unsigned char data, unsigned short port)
-{
-	asm volatile ("out %0, %1" : : "a"(data), "d"(port));
-}
-
 void eoi(void)
 {
 	apic_write(APIC_EOI, 0);
@@ -232,7 +228,7 @@ void set_mask(unsigned line, int mask)
 
 void set_irq_line(unsigned line, int val)
 {
-	asm volatile("out %0, %1" : : "a"((u8)val), "d"((u16)(0x2000 + line)));
+	outb((u8)val, (u16)(0x2000 + line));
 }
 
 void enable_apic(void)
-- 
2.34.1





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux