From patchwork Mon Oct 26 12:48:44 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 55874 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9QCmqAN004578 for ; Mon, 26 Oct 2009 12:48:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753937AbZJZMsm (ORCPT ); Mon, 26 Oct 2009 08:48:42 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751815AbZJZMsm (ORCPT ); Mon, 26 Oct 2009 08:48:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39228 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751247AbZJZMsl (ORCPT ); Mon, 26 Oct 2009 08:48:41 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9QCmkJV027603 for ; Mon, 26 Oct 2009 08:48:47 -0400 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9QCmitk006580; Mon, 26 Oct 2009 08:48:45 -0400 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id 5939418D410; Mon, 26 Oct 2009 14:48:44 +0200 (IST) Date: Mon, 26 Oct 2009 14:48:44 +0200 From: Gleb Natapov To: avi@redhat.com Cc: kvm@vger.kernel.org Subject: [PATCH] remove vapic.S from pcbios Message-ID: <20091026124844.GH29477@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/Makefile b/Makefile index 434d64e..bcd3ee2 100644 --- a/Makefile +++ b/Makefile @@ -105,8 +105,8 @@ rombios32.bin: rombios32.out rombios.h objcopy -O binary $< $@ ./biossums -pad $@ -rombios32.out: rombios32start.o rombios32.o vapic.o rombios32.ld - ld -o $@ -T rombios32.ld rombios32start.o vapic.o rombios32.o +rombios32.out: rombios32start.o rombios32.o rombios32.ld + ld -o $@ -T rombios32.ld rombios32start.o rombios32.o rombios32.o: rombios32.c acpi-dsdt.hex acpi-ssdt.hex $(GCC) -m32 -O2 -Wall -c -o $@ $< @@ -126,9 +126,6 @@ acpi-ssdt.hex: acpi-ssdt.dsl rombios32start.o: rombios32start.S $(GCC) -m32 -c -o $@ $< -vapic.o: vapic.S - $(GCC) -m32 -c -o $@ $< - BIOS-bochs-latest: rombios16.bin rombios32.bin cat rombios32.bin rombios16.bin > $@ diff --git a/rombios32.ld b/rombios32.ld index 1fc99c3..ca31f54 100644 --- a/rombios32.ld +++ b/rombios32.ld @@ -6,10 +6,6 @@ SECTIONS . = 0x000e0000; .text : { *(.text) } .rodata : { *(.rodata*) } - . = ALIGN(64); - fixup_start = .; - .fixup : { *(.fixup) } - fixup_end = .; . = ALIGN(4096); _end = . ; .data 0x700 : AT (_end) { __data_start = .; *(.data); __data_end = .;} diff --git a/vapic.S b/vapic.S deleted file mode 100644 index cf2a474..0000000 --- a/vapic.S +++ /dev/null @@ -1,294 +0,0 @@ - .text - .code32 - .align 4096 - -vapic_size = 2*4096 - -.macro fixup delta=-4 -777: - .pushsection .fixup, "a" - .long 777b + \delta - vapic_base - .popsection -.endm - -.macro reenable_vtpr - out %al, $0x7e -.endm - -vapic_base: - .ascii "kvm aPiC" - - /* relocation data */ - .long vapic_base ; fixup - .long fixup_start ; fixup - .long fixup_end ; fixup - - .long vapic ; fixup - .long vapic_size -vcpu_shift: - .long 0 -real_tpr: - .long 0 - .long up_set_tpr ; fixup - .long up_set_tpr_eax ; fixup - .long up_get_tpr_eax ; fixup - .long up_get_tpr_ecx ; fixup - .long up_get_tpr_edx ; fixup - .long up_get_tpr_ebx ; fixup - .long 0 /* esp. won't work. */ - .long up_get_tpr_ebp ; fixup - .long up_get_tpr_esi ; fixup - .long up_get_tpr_edi ; fixup - .long up_get_tpr_stack ; fixup - .long mp_set_tpr ; fixup - .long mp_set_tpr_eax ; fixup - .long mp_get_tpr_eax ; fixup - .long mp_get_tpr_ecx ; fixup - .long mp_get_tpr_edx ; fixup - .long mp_get_tpr_ebx ; fixup - .long 0 /* esp. won't work. */ - .long mp_get_tpr_ebp ; fixup - .long mp_get_tpr_esi ; fixup - .long mp_get_tpr_edi ; fixup - .long mp_get_tpr_stack ; fixup - -.macro kvm_hypercall - .byte 0x0f, 0x01, 0xc1 -.endm - -kvm_hypercall_vapic_poll_irq = 1 - -pcr_cpu = 0x51 - -.align 64 - -mp_get_tpr_eax: - pushf - cli - reenable_vtpr - push %ecx - - fs/movzbl pcr_cpu, %eax - - mov vcpu_shift, %ecx ; fixup - shl %cl, %eax - testb $1, vapic+4(%eax) ; fixup delta=-5 - jz mp_get_tpr_bad - movzbl vapic(%eax), %eax ; fixup - -mp_get_tpr_out: - pop %ecx - popf - ret - -mp_get_tpr_bad: - mov real_tpr, %eax ; fixup - mov (%eax), %eax - jmp mp_get_tpr_out - -mp_get_tpr_ebx: - mov %eax, %ebx - call mp_get_tpr_eax - xchg %eax, %ebx - ret - -mp_get_tpr_ecx: - mov %eax, %ecx - call mp_get_tpr_eax - xchg %eax, %ecx - ret - -mp_get_tpr_edx: - mov %eax, %edx - call mp_get_tpr_eax - xchg %eax, %edx - ret - -mp_get_tpr_esi: - mov %eax, %esi - call mp_get_tpr_eax - xchg %eax, %esi - ret - -mp_get_tpr_edi: - mov %eax, %edi - call mp_get_tpr_edi - xchg %eax, %edi - ret - -mp_get_tpr_ebp: - mov %eax, %ebp - call mp_get_tpr_eax - xchg %eax, %ebp - ret - -mp_get_tpr_stack: - call mp_get_tpr_eax - xchg %eax, 4(%esp) - ret - -mp_set_tpr_eax: - push %eax - call mp_set_tpr - ret - -mp_set_tpr: - pushf - push %eax - push %ecx - push %edx - push %ebx - cli - reenable_vtpr - -mp_set_tpr_failed: - fs/movzbl pcr_cpu, %edx - - mov vcpu_shift, %ecx ; fixup - shl %cl, %edx - - testb $1, vapic+4(%edx) ; fixup delta=-5 - jz mp_set_tpr_bad - - mov vapic(%edx), %eax ; fixup - - mov %eax, %ebx - mov 24(%esp), %bl - - /* %ebx = new vapic (%bl = tpr, %bh = isr, %b3 = irr) */ - - lock cmpxchg %ebx, vapic(%edx) ; fixup - jnz mp_set_tpr_failed - - /* compute ppr */ - cmp %bh, %bl - jae mp_tpr_is_bigger -mp_isr_is_bigger: - mov %bh, %bl -mp_tpr_is_bigger: - /* %bl = ppr */ - mov %bl, %ch /* ch = ppr */ - rol $8, %ebx - /* now: %bl = irr, %bh = ppr */ - cmp %bh, %bl - ja mp_set_tpr_poll_irq - -mp_set_tpr_out: - pop %ebx - pop %edx - pop %ecx - pop %eax - popf - ret $4 - -mp_set_tpr_poll_irq: - mov $kvm_hypercall_vapic_poll_irq, %eax - kvm_hypercall - jmp mp_set_tpr_out - -mp_set_tpr_bad: - mov 24(%esp), %ecx - mov real_tpr, %eax ; fixup - mov %ecx, (%eax) - jmp mp_set_tpr_out - -up_get_tpr_eax: - reenable_vtpr - movzbl vapic, %eax ; fixup - ret - -up_get_tpr_ebx: - reenable_vtpr - movzbl vapic, %ebx ; fixup - ret - -up_get_tpr_ecx: - reenable_vtpr - movzbl vapic, %ecx ; fixup - ret - -up_get_tpr_edx: - reenable_vtpr - movzbl vapic, %edx ; fixup - ret - -up_get_tpr_esi: - reenable_vtpr - movzbl vapic, %esi ; fixup - ret - -up_get_tpr_edi: - reenable_vtpr - movzbl vapic, %edi ; fixup - ret - -up_get_tpr_ebp: - reenable_vtpr - movzbl vapic, %ebp ; fixup - ret - -up_get_tpr_stack: - reenable_vtpr - movzbl vapic, %eax ; fixup - xchg %eax, 4(%esp) - ret - -up_set_tpr_eax: - push %eax - call up_set_tpr - ret - -up_set_tpr: - pushf - push %eax - push %ecx - push %ebx - reenable_vtpr - -up_set_tpr_failed: - mov vapic, %eax ; fixup - - mov %eax, %ebx - mov 20(%esp), %bl - - /* %ebx = new vapic (%bl = tpr, %bh = isr, %b3 = irr) */ - - lock cmpxchg %ebx, vapic ; fixup - jnz up_set_tpr_failed - - /* compute ppr */ - cmp %bh, %bl - jae up_tpr_is_bigger -up_isr_is_bigger: - mov %bh, %bl -up_tpr_is_bigger: - /* %bl = ppr */ - mov %bl, %ch /* ch = ppr */ - rol $8, %ebx - /* now: %bl = irr, %bh = ppr */ - cmp %bh, %bl - ja up_set_tpr_poll_irq - -up_set_tpr_out: - pop %ebx - pop %ecx - pop %eax - popf - ret $4 - -up_set_tpr_poll_irq: - mov $kvm_hypercall_vapic_poll_irq, %eax - kvm_hypercall - jmp up_set_tpr_out - -.align 4096 -/* - * vapic format: - * per-vcpu records of size 2^vcpu shift. - * byte 0: tpr (r/w) - * byte 1: highest in-service interrupt (isr) (r/o); bits 3:0 are zero - * byte 2: zero (r/o) - * byte 3: highest pending interrupt (irr) (r/o) - */ -vapic: -. = . + vapic_size