aboutsummaryrefslogtreecommitdiffstats
path: root/include/prereq.mk
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2012-07-22 21:00:07 +0000
committerFelix Fietkau <nbd@openwrt.org>2012-07-22 21:00:07 +0000
commit2335304a08827f4f083eba2bfb73163516c5fd57 (patch)
treed54824af9e02be484acdf6caecd364b786250516 /include/prereq.mk
parentb59bc92c6edf517d0a2d958530ac58fc58f74c32 (diff)
downloadupstream-2335304a08827f4f083eba2bfb73163516c5fd57.tar.gz
upstream-2335304a08827f4f083eba2bfb73163516c5fd57.tar.bz2
upstream-2335304a08827f4f083eba2bfb73163516c5fd57.zip
build: ensure that reordering of KCONFIG lines are handled properly and that the final result does not depend on the package scan order
SVN-Revision: 32788
Diffstat (limited to 'include/prereq.mk')
0 files changed, 0 insertions, 0 deletions
href='#n110'>110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
/******************************************************************************
 * domain_page.h
 * 
 * Allow temporary mapping of domain pages.
 * 
 * Copyright (c) 2003-2006, Keir Fraser <keir@xensource.com>
 */

#include <xen/config.h>
#include <xen/sched.h>
#include <xen/mm.h>
#include <xen/perfc.h>
#include <xen/domain_page.h>
#include <xen/shadow.h>
#include <asm/current.h>
#include <asm/flushtlb.h>
#include <asm/hardirq.h>

static inline struct vcpu *mapcache_current_vcpu(void)
{
    struct vcpu *v;

    /* In the common case we use the mapcache of the running VCPU. */
    v = current;

    /*
     * If guest_table is NULL, and we are running a paravirtualised guest,
     * then it means we are running on the idle domain's page table and must
     * therefore use its mapcache.
     */
    if ( unlikely(!pagetable_get_pfn(v->arch.guest_table)) && !hvm_guest(v) )
    {
        /* If we really are idling, perform lazy context switch now. */
        if ( (v = idle_vcpu[smp_processor_id()]) == current )
            __sync_lazy_execstate();
        /* We must now be running on the idle page table. */
        ASSERT(read_cr3() == __pa(idle_pg_table));
    }

    return v;
}

void *map_domain_page(unsigned long pfn)
{
    unsigned long va;
    unsigned int idx, i, vcpu;
    struct vcpu *v;
    struct mapcache *cache;
    struct vcpu_maphash_entry *hashent;

    ASSERT(!in_irq());

    perfc_incrc(map_domain_page_count);

    v = mapcache_current_vcpu();

    vcpu  = v->vcpu_id;
    cache = &v->domain->arch.mapcache;

    hashent = &cache->vcpu_maphash[vcpu].hash[MAPHASH_HASHFN(pfn)];
    if ( hashent->pfn == pfn )
    {
        idx = hashent->idx;
        hashent->refcnt++;
        ASSERT(hashent->refcnt != 0);
        ASSERT(l1e_get_pfn(cache->l1tab[idx]) == pfn);
        goto out;
    }

    spin_lock(&cache->lock);

    /* Has some other CPU caused a wrap? We must flush if so. */
    if ( unlikely(cache->epoch != cache->shadow_epoch[vcpu]) )
    {
        cache->shadow_epoch[vcpu] = cache->epoch;
        if ( NEED_FLUSH(tlbflush_time[smp_processor_id()],
                        cache->tlbflush_timestamp) )
        {
            perfc_incrc(domain_page_tlb_flush);
            local_flush_tlb();
        }
    }

    idx = find_next_zero_bit(cache->inuse, MAPCACHE_ENTRIES, cache->cursor);
    if ( unlikely(idx >= MAPCACHE_ENTRIES) )
    {
        /* /First/, clean the garbage map and update the inuse list. */
        for ( i = 0; i < ARRAY_SIZE(cache->garbage); i++ )
        {
            unsigned long x = xchg(&cache->garbage[i], 0);
            cache->inuse[i] &= ~x;