[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 6 Jun 2023 18:00:07 +0800
From: Tianrui Zhao <zhaotianrui@...ngson.cn>
To: Youling Tang <tangyouling@...ngson.cn>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
Paolo Bonzini <pbonzini@...hat.com>,
Huacai Chen <chenhuacai@...nel.org>,
WANG Xuerui <kernel@...0n.name>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
loongarch@...ts.linux.dev, Jens Axboe <axboe@...nel.dk>,
Mark Brown <broonie@...nel.org>,
Alex Deucher <alexander.deucher@....com>,
Oliver Upton <oliver.upton@...ux.dev>, maobibo@...ngson.cn,
Xi Ruoyao <xry111@...111.site>
Subject: Re: [PATCH v12 01/31] LoongArch: KVM: Add kvm related header files
在 2023年06月06日 14:30, Youling Tang 写道:
> Hi, Tianrui
>
> On 05/30/2023 09:51 AM, Tianrui Zhao wrote:
> /* snip */
>> +struct kvm_vcpu_arch {
>> + /*
>> + * Switch pointer-to-function type to unsigned long
>> + * for loading the value into register directly.
>> + */
>> + unsigned long guest_eentry;
>> + unsigned long host_eentry;
>> +
>> + /* Pointers stored here for easy accessing from assembly code */
>> + int (*handle_exit)(struct kvm_run *run, struct kvm_vcpu *vcpu);
>> +
>> + /* Host registers preserved across guest mode execution */
>> + unsigned long host_stack;
>> + unsigned long host_gp;
>
> In arch/loongarch/kvm/switch.S,
>
> ld.d tp, a2, KVM_ARCH_HGP
> ld.d sp, a2, KVM_ARCH_HSTACK
>
> Should we need to change host_gp to host_tp (and also change host_stack
> to host_sp for consistency).
>
> And modify KVM_ARCH_HSTACK and KVM_ARCH_HGP synchronously.
>
> Thanks,
> Youling
Why need we do this? and the kvm_arch_hstack/hgp is used to save and
restore host sp/tp when vcpu world switch.
Thanks
Tianrui Zhao
>> + unsigned long host_pgd;
>> +
>> + /* Host CSRs are used when handling exits from guest */
>> + unsigned long badi;
>> + unsigned long badv;
>> + unsigned long host_ecfg;
>> + unsigned long host_estat;
>> + unsigned long host_percpu;
>> +
>> + /* GPRs */
>> + unsigned long gprs[32];
>> + unsigned long pc;
>> +
>> + /* FPU state */
>> + struct loongarch_fpu fpu FPU_ALIGN;
>> + /* Which auxiliary state is loaded (KVM_LOONGARCH_AUX_*) */
>> + unsigned int aux_inuse;
>> +
>> + /* CSR state */
>> + struct loongarch_csrs *csr;
>> +
>> + /* GPR used as IO source/target */
>> + u32 io_gpr;
>> +
>> + struct hrtimer swtimer;
>> + /* KVM register to control count timer */
>> + u32 count_ctl;
>> +
>> + /* Bitmask of exceptions that are pending */
>> + unsigned long irq_pending;
>> + /* Bitmask of pending exceptions to be cleared */
>> + unsigned long irq_clear;
>> +
>> + /* Cache for pages needed inside spinlock regions */
>> + struct kvm_mmu_memory_cache mmu_page_cache;
>> +
>> + /* vcpu's vpid */
>> + u64 vpid;
>> +
>> + /* Period of stable timer tick in ns */
>> + u64 timer_period_ns;
>> + /* Frequency of stable timer in Hz */
>> + u64 timer_mhz;
>> + /* Stable bias from the raw time */
>> + u64 timer_bias;
>> + /* Dynamic nanosecond bias (multiple of timer_period_ns) to
>> avoid overflow */
>> + s64 timer_dyn_bias;
>> +
>> + ktime_t stable_ktime_saved;
>> +
>> + u64 core_ext_ioisr[4];
>> +
>> + /* Last CPU the vCPU state was loaded on */
>> + int last_sched_cpu;
>> + /* Last CPU the vCPU actually executed guest code on */
>> + int last_exec_cpu;
>> + /* mp state */
>> + struct kvm_mp_state mp_state;
>> +};
Powered by blists - more mailing lists