2
* asid.c: handling ASIDs in SVM.
3
* Copyright (c) 2007, Advanced Micro Devices, Inc.
5
* This program is free software; you can redistribute it and/or modify it
6
* under the terms and conditions of the GNU General Public License,
7
* version 2, as published by the Free Software Foundation.
9
* This program is distributed in the hope it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14
* You should have received a copy of the GNU General Public License along with
15
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16
* Place - Suite 330, Boston, MA 02111-1307 USA.
19
#include <xen/config.h>
22
#include <xen/perfc.h>
23
#include <asm/hvm/svm/asid.h>
25
void svm_asid_init(struct cpuinfo_x86 *c)
29
/* Check for erratum #170, and leave ASIDs disabled if it's present. */
30
if ( (c->x86 == 0x10) ||
31
((c->x86 == 0xf) && (c->x86_model >= 0x68) && (c->x86_mask >= 1)) )
32
nasids = cpuid_ebx(0x8000000A);
34
hvm_asid_init(nasids);
38
* Called directly before VMRUN. Checks if the VCPU needs a new ASID,
39
* assigns it, and if required, issues required TLB flushes.
41
asmlinkage void svm_asid_handle_vmrun(void)
43
struct vcpu *curr = current;
44
bool_t need_flush = hvm_asid_handle_vmenter();
46
/* ASID 0 indicates that ASIDs are disabled. */
47
if ( curr->arch.hvm_vcpu.asid == 0 )
49
curr->arch.hvm_svm.vmcb->guest_asid = 1;
50
curr->arch.hvm_svm.vmcb->tlb_control = 1;
54
curr->arch.hvm_svm.vmcb->guest_asid = curr->arch.hvm_vcpu.asid;
55
curr->arch.hvm_svm.vmcb->tlb_control = need_flush;
64
* indent-tabs-mode: nil