From patchwork Wed Sep 16 09:25:59 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 47886 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 n8G9Quxb009707 for ; Wed, 16 Sep 2009 09:26:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758402AbZIPJ0l (ORCPT ); Wed, 16 Sep 2009 05:26:41 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758519AbZIPJ0k (ORCPT ); Wed, 16 Sep 2009 05:26:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64966 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758317AbZIPJ0L (ORCPT ); Wed, 16 Sep 2009 05:26:11 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8G9QFA0023618 for ; Wed, 16 Sep 2009 05:26:15 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n8G9QDZt005531; Wed, 16 Sep 2009 05:26:14 -0400 Received: from localhost.localdomain (cleopatra.tlv.redhat.com [10.35.255.11]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id CCC39250ADC; Wed, 16 Sep 2009 12:26:11 +0300 (IDT) From: Avi Kivity To: Marcelo Tosatti Cc: kvm@vger.kernel.org Subject: [PATCH QEMU-KVM 24/34] test: switch 64-bit smp startup to real APIC Date: Wed, 16 Sep 2009 12:25:59 +0300 Message-Id: <1253093169-1423-25-git-send-email-avi@redhat.com> In-Reply-To: <1253093169-1423-1-git-send-email-avi@redhat.com> References: <1253093169-1423-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Signed-off-by: Avi Kivity --- kvm/user/test/x86/cstart64.S | 74 ++++++++++++++++++++++++----------------- 1 files changed, 43 insertions(+), 31 deletions(-) diff --git a/kvm/user/test/x86/cstart64.S b/kvm/user/test/x86/cstart64.S index 14bb98c..278465b 100644 --- a/kvm/user/test/x86/cstart64.S +++ b/kvm/user/test/x86/cstart64.S @@ -107,10 +107,42 @@ efer = 0xc0000080 mov %eax, %cr0 ret +smp_stacktop: .long 0xa0000 -smp_init_ipi: +.align 16 + +gdt32: + .quad 0 + .quad 0x00cf9b000000ffff // flat 32-bit code segment + .quad 0x00cf93000000ffff // flat 32-bit data segment +gdt32_end: + +.code16 +sipi_entry: + mov %cr0, %eax + or $1, %eax + mov %eax, %cr0 + lgdtl gdt32_descr - sipi_entry + ljmpl $8, $ap_start32 + +gdt32_descr: + .word gdt32_end - gdt32 - 1 + .long gdt32 + +sipi_end: + +.code32 +ap_start32: + mov $0x10, %ax + mov %ax, %ds + mov %ax, %es + mov %ax, %fs + mov %ax, %gs + mov %ax, %ss + mov $-4096, %esp + lock/xaddl %esp, smp_stacktop call prepare_64 - jmpl $8, $ap_start64 + ljmpl $8, $ap_start64 .code64 ap_start64: @@ -151,34 +183,14 @@ load_tss: ret smp_init: -#if 0 - lea boot_idt + ipi_vector * 8, %rdi - mov $smp_init_ipi, %eax - mov %ax, (%rdi) - mov %cs, %ax - mov %ax, 2(%rdi) - movw $0x8e00, 4(%rdi) - shr $16, %eax - mov %ax, 6(%rdi) - - mov $(APIC_BASE + APIC_REG_IPI_VECTOR), %dx - mov $ipi_vector, %eax - out %eax, %dx - - mov $(APIC_BASE + APIC_REG_NCPU), %dx - in %dx, %eax - mov %eax, %ecx - mov $1, %esi -smp_loop: - cmp %esi, %ecx - je smp_init_done - - mov $(APIC_BASE + APIC_REG_SEND_IPI), %dx - mov %esi, %eax - out %eax, %dx - - inc %esi - jmp smp_loop + cld + lea sipi_entry, %rsi + xor %rdi, %rdi + mov $(sipi_end - sipi_entry), %rcx + rep/movsb + mov $APIC_DEFAULT_PHYS_BASE, %eax + movl $(APIC_DEST_ALLBUT | APIC_DEST_PHYSICAL | APIC_DM_INIT | APIC_INT_ASSERT), APIC_ICR(%rax) + movl $(APIC_DEST_ALLBUT | APIC_DEST_PHYSICAL | APIC_DM_INIT), APIC_ICR(%rax) + movl $(APIC_DEST_ALLBUT | APIC_DEST_PHYSICAL | APIC_DM_STARTUP), APIC_ICR(%rax) smp_init_done: -#endif ret