~ubuntu-branches/ubuntu/utopic/xen/utopic

« back to all changes in this revision

Viewing changes to xen/arch/x86/hvm/svm/asid.c

  • Committer: Bazaar Package Importer
  • Author(s): Bastian Blank
  • Date: 2010-05-06 15:47:38 UTC
  • mto: (1.3.1) (15.1.1 sid) (4.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20100506154738-agoz0rlafrh1fnq7
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * asid.c: handling ASIDs in SVM.
 
3
 * Copyright (c) 2007, Advanced Micro Devices, Inc.
 
4
 *
 
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.
 
8
 *
 
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
 
12
 * more details.
 
13
 *
 
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.
 
17
 */
 
18
 
 
19
#include <xen/config.h>
 
20
#include <xen/init.h>
 
21
#include <xen/lib.h>
 
22
#include <xen/perfc.h>
 
23
#include <asm/hvm/svm/asid.h>
 
24
 
 
25
void svm_asid_init(struct cpuinfo_x86 *c)
 
26
{
 
27
    int nasids = 0;
 
28
 
 
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);
 
33
 
 
34
    hvm_asid_init(nasids);
 
35
}
 
36
 
 
37
/*
 
38
 * Called directly before VMRUN.  Checks if the VCPU needs a new ASID,
 
39
 * assigns it, and if required, issues required TLB flushes.
 
40
 */
 
41
asmlinkage void svm_asid_handle_vmrun(void)
 
42
{
 
43
    struct vcpu *curr = current;
 
44
    bool_t need_flush = hvm_asid_handle_vmenter();
 
45
 
 
46
    /* ASID 0 indicates that ASIDs are disabled. */
 
47
    if ( curr->arch.hvm_vcpu.asid == 0 )
 
48
    {
 
49
        curr->arch.hvm_svm.vmcb->guest_asid  = 1;
 
50
        curr->arch.hvm_svm.vmcb->tlb_control = 1;
 
51
        return;
 
52
    }
 
53
 
 
54
    curr->arch.hvm_svm.vmcb->guest_asid  = curr->arch.hvm_vcpu.asid;
 
55
    curr->arch.hvm_svm.vmcb->tlb_control = need_flush;
 
56
}
 
57
 
 
58
/*
 
59
 * Local variables:
 
60
 * mode: C
 
61
 * c-set-style: "BSD"
 
62
 * c-basic-offset: 4
 
63
 * tab-width: 4
 
64
 * indent-tabs-mode: nil
 
65
 * End:
 
66
 */