~ubuntu-branches/ubuntu/trusty/qemu/trusty

« back to all changes in this revision

Viewing changes to cputlb.c

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2013-10-22 22:47:07 UTC
  • mfrom: (1.8.3) (10.1.42 sid)
  • Revision ID: package-import@ubuntu.com-20131022224707-1lya34fw3k3f24tv
Tags: 1.6.0+dfsg-2ubuntu1
* Merge 1.6.0~rc0+dfsg-2exp from debian experimental.  Remaining changes:
  - debian/control
    * update maintainer
    * remove libiscsi, usb-redir, vde, vnc-jpeg, and libssh2-1-dev
      from build-deps
    * enable rbd
    * add qemu-system and qemu-common B/R to qemu-keymaps
    * add D:udev, R:qemu, R:qemu-common and B:qemu-common to
      qemu-system-common
    * qemu-system-arm, qemu-system-ppc, qemu-system-sparc:
      - add qemu-kvm to Provides
      - add qemu-common, qemu-kvm, kvm to B/R
      - remove openbios-sparc from qemu-system-sparc D
      - drop openbios-ppc and openhackware Depends to Suggests (for now)
    * qemu-system-x86:
      - add qemu-common to Breaks/Replaces.
      - add cpu-checker to Recommends.
    * qemu-user: add B/R:qemu-kvm
    * qemu-kvm:
      - add armhf armel powerpc sparc to Architecture
      - C/R/P: qemu-kvm-spice
    * add qemu-common package
    * drop qemu-slof which is not packaged in ubuntu
  - add qemu-system-common.links for tap ifup/down scripts and OVMF link.
  - qemu-system-x86.links:
    * remove pxe rom links which are in kvm-ipxe
    * add symlink for kvm.1 manpage
  - debian/rules
    * add kvm-spice symlink to qemu-kvm
    * call dh_installmodules for qemu-system-x86
    * update dh_installinit to install upstart script
    * run dh_installman (Closes: #709241) (cherrypicked from 1.5.0+dfsg-2)
  - Add qemu-utils.links for kvm-* symlinks.
  - Add qemu-system-x86.qemu-kvm.upstart and .default
  - Add qemu-system-x86.modprobe to set nesting=1
  - Add qemu-system-common.preinst to add kvm group
  - qemu-system-common.postinst: remove bad group acl if there, then have
    udev relabel /dev/kvm.
  - New linaro patches from qemu-linaro rebasing branch
  - Dropped patches:
    * xen-simplify-xen_enabled.patch
    * sparc-linux-user-fix-missing-symbols-in-.rel-.rela.plt-sections.patch
    * main_loop-do-not-set-nonblocking-if-xen_enabled.patch
    * xen_machine_pv-do-not-create-a-dummy-CPU-in-machine-.patch
    * virtio-rng-fix-crash
  - Kept patches:
    * expose_vms_qemu64cpu.patch - updated
    * linaro arm patches from qemu-linaro rebasing branch
  - New patches:
    * fix-pci-add: change CONFIG variable in ifdef to make sure that
      pci_add is defined.
* Add linaro patches
* Add experimental mach-virt patches for arm virtualization.
* qemu-system-common.install: add debian/tmp/usr/lib to install the
  qemu-bridge-helper

Show diffs side-by-side

added added

removed removed

Lines of Context:
158
158
    }
159
159
}
160
160
 
 
161
static inline ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr)
 
162
{
 
163
    ram_addr_t ram_addr;
 
164
 
 
165
    if (qemu_ram_addr_from_host(ptr, &ram_addr) == NULL) {
 
166
        fprintf(stderr, "Bad ram pointer %p\n", ptr);
 
167
        abort();
 
168
    }
 
169
    return ram_addr;
 
170
}
 
171
 
161
172
static inline void tlb_update_dirty(CPUTLBEntry *tlb_entry)
162
173
{
163
174
    ram_addr_t ram_addr;
175
186
 
176
187
void cpu_tlb_reset_dirty_all(ram_addr_t start1, ram_addr_t length)
177
188
{
 
189
    CPUState *cpu;
178
190
    CPUArchState *env;
179
191
 
180
 
    for (env = first_cpu; env != NULL; env = env->next_cpu) {
 
192
    for (cpu = first_cpu; cpu != NULL; cpu = cpu->next_cpu) {
181
193
        int mmu_idx;
182
194
 
 
195
        env = cpu->env_ptr;
183
196
        for (mmu_idx = 0; mmu_idx < NB_MMU_MODES; mmu_idx++) {
184
197
            unsigned int i;
185
198
 
248
261
    target_ulong code_address;
249
262
    uintptr_t addend;
250
263
    CPUTLBEntry *te;
251
 
    hwaddr iotlb;
 
264
    hwaddr iotlb, xlat, sz;
252
265
 
253
266
    assert(size >= TARGET_PAGE_SIZE);
254
267
    if (size != TARGET_PAGE_SIZE) {
255
268
        tlb_add_large_page(env, vaddr, size);
256
269
    }
257
 
    section = phys_page_find(address_space_memory.dispatch, paddr >> TARGET_PAGE_BITS);
 
270
 
 
271
    sz = size;
 
272
    section = address_space_translate_for_iotlb(&address_space_memory, paddr,
 
273
                                                &xlat, &sz);
 
274
    assert(sz >= TARGET_PAGE_SIZE);
 
275
 
258
276
#if defined(DEBUG_TLB)
259
277
    printf("tlb_set_page: vaddr=" TARGET_FMT_lx " paddr=0x" TARGET_FMT_plx
260
 
           " prot=%x idx=%d pd=0x%08lx\n",
261
 
           vaddr, paddr, prot, mmu_idx, pd);
 
278
           " prot=%x idx=%d\n",
 
279
           vaddr, paddr, prot, mmu_idx);
262
280
#endif
263
281
 
264
282
    address = vaddr;
265
 
    if (!(memory_region_is_ram(section->mr) ||
266
 
          memory_region_is_romd(section->mr))) {
267
 
        /* IO memory case (romd handled later) */
 
283
    if (!memory_region_is_ram(section->mr) && !memory_region_is_romd(section->mr)) {
 
284
        /* IO memory case */
268
285
        address |= TLB_MMIO;
269
 
    }
270
 
    if (memory_region_is_ram(section->mr) ||
271
 
        memory_region_is_romd(section->mr)) {
272
 
        addend = (uintptr_t)memory_region_get_ram_ptr(section->mr)
273
 
        + memory_region_section_addr(section, paddr);
274
 
    } else {
275
286
        addend = 0;
 
287
    } else {
 
288
        /* TLB_MMIO for rom/romd handled below */
 
289
        addend = (uintptr_t)memory_region_get_ram_ptr(section->mr) + xlat;
276
290
    }
277
291
 
278
292
    code_address = address;
279
 
    iotlb = memory_region_section_get_iotlb(env, section, vaddr, paddr, prot,
280
 
                                            &address);
 
293
    iotlb = memory_region_section_get_iotlb(env, section, vaddr, paddr, xlat,
 
294
                                            prot, &address);
281
295
 
282
296
    index = (vaddr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
283
297
    env->iotlb[mmu_idx][index] = iotlb - vaddr;
300
314
            /* Write access calls the I/O callback.  */
301
315
            te->addr_write = address | TLB_MMIO;
302
316
        } else if (memory_region_is_ram(section->mr)
303
 
                   && !cpu_physical_memory_is_dirty(
304
 
                           section->mr->ram_addr
305
 
                           + memory_region_section_addr(section, paddr))) {
 
317
                   && !cpu_physical_memory_is_dirty(section->mr->ram_addr + xlat)) {
306
318
            te->addr_write = address | TLB_NOTDIRTY;
307
319
        } else {
308
320
            te->addr_write = address;
332
344
    pd = env1->iotlb[mmu_idx][page_index] & ~TARGET_PAGE_MASK;
333
345
    mr = iotlb_to_region(pd);
334
346
    if (memory_region_is_unassigned(mr)) {
335
 
#if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SPARC)
336
 
        cpu_unassigned_access(env1, addr, 0, 1, 0, 4);
337
 
#else
338
 
        cpu_abort(env1, "Trying to execute code outside RAM or ROM at 0x"
339
 
                  TARGET_FMT_lx "\n", addr);
340
 
#endif
 
347
        CPUState *cpu = ENV_GET_CPU(env1);
 
348
        CPUClass *cc = CPU_GET_CLASS(cpu);
 
349
 
 
350
        if (cc->do_unassigned_access) {
 
351
            cc->do_unassigned_access(cpu, addr, false, true, 0, 4);
 
352
        } else {
 
353
            cpu_abort(env1, "Trying to execute code outside RAM or ROM at 0x"
 
354
                      TARGET_FMT_lx "\n", addr);
 
355
        }
341
356
    }
342
357
    p = (void *)((uintptr_t)addr + env1->tlb_table[mmu_idx][page_index].addend);
343
358
    return qemu_ram_addr_from_host_nofail(p);