linux-mips
[Top] [All Lists]

Re: [PATCH 06/18] KVM/MIPS32-VZ: VZ-ASE related callbacks to handle gues

To: Sanjay Lal <sanjayl@kymasys.com>
Subject: Re: [PATCH 06/18] KVM/MIPS32-VZ: VZ-ASE related callbacks to handle guest exceptions that trap to the Root context.
From: Paolo Bonzini <pbonzini@redhat.com>
Date: Tue, 28 May 2013 17:04:22 +0200
Cc: kvm@vger.kernel.org, linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>, Gleb Natapov <gleb@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=eOhIyYxjaD4bLKDWNpHgQThqILBp+rSZmYEfdUK7hB8=; b=b8S+Cy/Sm3xUCA9xRiAZqELL9yztkRx2dCAQ1c7qlde5eazg7IUR6B3t+a1/a2PK+9 9v9jmMJUgvzxPx1MOq4R7bj9V2Ehg8BveSxjC6IQQfA/KmDNkHrIPw2FLXdk0jhdhMkn wgqoFSRaZPOHtjX5memGdbVrovwq0uYHZEPLiwdTUSCLDvdI7bFCd4NIsqzuUHFmodb0 MSGb3f1BN62Kc7kFDCvvDqbQfhdBCpLhPrBknJGojqmM+ft26cCyzL4avXpxvkoNMelp EafCnGExnUVf2sAc3vu81cvWyyJhf78Aw0TN/1SGFnwfAijnVHqTZjeWn7znooYYi8c7 Fg3A==
In-reply-to: <1368942460-15577-7-git-send-email-sanjayl@kymasys.com>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <n> <1368942460-15577-1-git-send-email-sanjayl@kymasys.com> <1368942460-15577-7-git-send-email-sanjayl@kymasys.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6
Il 19/05/2013 07:47, Sanjay Lal ha scritto:
> +static int kvm_vz_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs 
> *regs)
> +{
> +     struct mips_coproc *cop0 = vcpu->arch.cop0;
> +
> +     /* some registers are not restored
> +      * random, count        : read-only
> +      * userlocal            : not implemented in qemu
> +      * config6              : not implemented in processor variant
> +      * compare, cause       : defer to kvm_vz_restore_guest_timer_int
> +      */
> +
> +     kvm_write_c0_guest_index(cop0, regs->cp0reg[MIPS_CP0_TLB_INDEX][0]);
> +     kvm_write_c0_guest_entrylo0(cop0, regs->cp0reg[MIPS_CP0_TLB_LO0][0]);
> +     kvm_write_c0_guest_entrylo1(cop0, regs->cp0reg[MIPS_CP0_TLB_LO1][0]);
> +     kvm_write_c0_guest_context(cop0, regs->cp0reg[MIPS_CP0_TLB_CONTEXT][0]);
> +     kvm_write_c0_guest_pagemask(cop0,
> +                                 regs->cp0reg[MIPS_CP0_TLB_PG_MASK][0]);
> +     kvm_write_c0_guest_pagegrain(cop0,
> +                                  regs->cp0reg[MIPS_CP0_TLB_PG_MASK][1]);
> +     kvm_write_c0_guest_wired(cop0, regs->cp0reg[MIPS_CP0_TLB_WIRED][0]);
> +     kvm_write_c0_guest_hwrena(cop0, regs->cp0reg[MIPS_CP0_HWRENA][0]);
> +     kvm_write_c0_guest_badvaddr(cop0, regs->cp0reg[MIPS_CP0_BAD_VADDR][0]);
> +     /* skip kvm_write_c0_guest_count */
> +     kvm_write_c0_guest_entryhi(cop0, regs->cp0reg[MIPS_CP0_TLB_HI][0]);
> +     /* defer kvm_write_c0_guest_compare */
> +     kvm_write_c0_guest_status(cop0, regs->cp0reg[MIPS_CP0_STATUS][0]);
> +     kvm_write_c0_guest_intctl(cop0, regs->cp0reg[MIPS_CP0_STATUS][1]);
> +     /* defer kvm_write_c0_guest_cause */
> +     kvm_write_c0_guest_epc(cop0, regs->cp0reg[MIPS_CP0_EXC_PC][0]);
> +     kvm_write_c0_guest_prid(cop0, regs->cp0reg[MIPS_CP0_PRID][0]);
> +     kvm_write_c0_guest_ebase(cop0, regs->cp0reg[MIPS_CP0_PRID][1]);
> +
> +     /* only restore implemented config registers */
> +     kvm_write_c0_guest_config(cop0, regs->cp0reg[MIPS_CP0_CONFIG][0]);
> +
> +     if ((regs->cp0reg[MIPS_CP0_CONFIG][0] & MIPS_CONF_M) &
> +                     cpu_vz_has_config1)
> +             kvm_write_c0_guest_config1(cop0,
> +                             regs->cp0reg[MIPS_CP0_CONFIG][1]);
> +
> +     if ((regs->cp0reg[MIPS_CP0_CONFIG][1] & MIPS_CONF_M) &
> +                     cpu_vz_has_config2)
> +             kvm_write_c0_guest_config2(cop0,
> +                             regs->cp0reg[MIPS_CP0_CONFIG][2]);
> +
> +     if ((regs->cp0reg[MIPS_CP0_CONFIG][2] & MIPS_CONF_M) &
> +                     cpu_vz_has_config3)
> +             kvm_write_c0_guest_config3(cop0,
> +                             regs->cp0reg[MIPS_CP0_CONFIG][3]);
> +
> +     if ((regs->cp0reg[MIPS_CP0_CONFIG][3] & MIPS_CONF_M) &
> +                     cpu_vz_has_config4)
> +             kvm_write_c0_guest_config4(cop0,
> +                             regs->cp0reg[MIPS_CP0_CONFIG][4]);
> +
> +     if ((regs->cp0reg[MIPS_CP0_CONFIG][4] & MIPS_CONF_M) &
> +                     cpu_vz_has_config5)
> +             kvm_write_c0_guest_config5(cop0,
> +                             regs->cp0reg[MIPS_CP0_CONFIG][5]);
> +
> +     if (cpu_vz_has_config6)
> +             kvm_write_c0_guest_config6(cop0,
> +                             regs->cp0reg[MIPS_CP0_CONFIG][6]);
> +     if (cpu_vz_has_config7)
> +             kvm_write_c0_guest_config7(cop0,
> +                             regs->cp0reg[MIPS_CP0_CONFIG][7]);
> +
> +     kvm_write_c0_guest_errorepc(cop0, regs->cp0reg[MIPS_CP0_ERROR_PC][0]);
> +
> +     /* call after setting MIPS_CP0_CAUSE to avoid having it overwritten
> +      * this will set guest compare and cause.TI if necessary
> +      */
> +     kvm_vz_restore_guest_timer_int(vcpu, regs);
> +
> +     return 0;
> +}

All this is now obsolete after David's patches (reusing kvm_regs looked
a bit strange in fact).

Paolo

<Prev in Thread] Current Thread [Next in Thread>