]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/x86_64/pmap.c
xnu-1504.15.3.tar.gz
[apple/xnu.git] / osfmk / x86_64 / pmap.c
index a7ad2bb9df340223094f3cc9241ef6c2842499a9..a8c8cbde4eef89a487b85d2597519cb9e79dac06 100644 (file)
@@ -212,8 +212,6 @@ int                 pv_hashed_kern_free_count = 0;
 
 zone_t         pv_hashed_list_zone;    /* zone of pv_hashed_entry structures */
 
-static zone_t pdpt_zone;
-
 /*
  *     Each entry in the pv_head_table is locked by a bit in the
  *     pv_lock_table.  The lock bits are accessed by the physical
@@ -644,7 +642,7 @@ pmap_init(void)
 {
        long                    npages;
        vm_offset_t             addr;
-       vm_size_t               s;
+       vm_size_t               s, vsize;
        vm_map_offset_t         vaddr;
        ppnum_t ppn;
 
@@ -683,6 +681,9 @@ pmap_init(void)
 
        memset((char *)addr, 0, s);
 
+       vaddr = addr;
+       vsize = s;
+
 #if PV_DEBUG
        if (0 == npvhash) panic("npvhash not initialized");
 #endif
@@ -714,23 +715,37 @@ pmap_init(void)
                for (pn = pmptr->base; pn <= pmptr->end; pn++) {
                        if (pn < last_pn) {
                                pmap_phys_attributes[pn] |= PHYS_MANAGED;
+
                                if (pn > last_managed_page)
                                        last_managed_page = pn;
+
+                               if (pn < lowest_lo)
+                                       pmap_phys_attributes[pn] |= PHYS_NOENCRYPT;
+                               else if (pn >= lowest_hi && pn <= highest_hi)
+                                       pmap_phys_attributes[pn] |= PHYS_NOENCRYPT;
+
                        }
                }
        }
+       while (vsize) {
+               ppn = pmap_find_phys(kernel_pmap, vaddr);
 
+               pmap_phys_attributes[ppn] |= PHYS_NOENCRYPT;
+
+               vaddr += PAGE_SIZE;
+               vsize -= PAGE_SIZE;
+       }
        /*
         *      Create the zone of physical maps,
         *      and of the physical-to-virtual entries.
         */
        s = (vm_size_t) sizeof(struct pmap);
        pmap_zone = zinit(s, 400*s, 4096, "pmap"); /* XXX */
+        zone_change(pmap_zone, Z_NOENCRYPT, TRUE);
+
        s = (vm_size_t) sizeof(struct pv_hashed_entry);
        pv_hashed_list_zone = zinit(s, 10000*s, 4096, "pv_list"); /* XXX */
-       s = 63;
-       pdpt_zone = zinit(s, 400*s, 4096, "pdpt"); /* XXX */
-
+       zone_change(pv_hashed_list_zone, Z_NOENCRYPT, TRUE);
 
        /* create pv entries for kernel pages mapped by low level
           startup code.  these have to exist so we can pmap_remove()
@@ -2119,6 +2134,8 @@ pt_fake_zone_info(
        *exhaustable = 0;
 }
 
+extern         long    NMIPI_acks;
+
 static inline void
 pmap_cpuset_NMIPI(cpu_set cpu_mask) {
        unsigned int cpu, cpu_bit;
@@ -2221,17 +2238,7 @@ pmap_flush_tlbs(pmap_t   pmap)
                 * Wait for those other cpus to acknowledge
                 */
                while (cpus_to_respond != 0) {
-                       if (mach_absolute_time() > deadline) {
-                               if (mp_recent_debugger_activity())
-                                       continue;
-                               if (!panic_active()) {
-                                       pmap_tlb_flush_timeout = TRUE;
-                                       pmap_cpuset_NMIPI(cpus_to_respond);
-                               }
-                               panic("pmap_flush_tlbs() timeout: "
-                                   "cpu(s) failing to respond to interrupts, pmap=%p cpus_to_respond=0x%lx",
-                                   pmap, cpus_to_respond);
-                       }
+                       long orig_acks = 0;
 
                        for (cpu = 0, cpu_bit = 1; cpu < real_ncpus; cpu++, cpu_bit <<= 1) {
                                if ((cpus_to_respond & cpu_bit) != 0) {
@@ -2245,6 +2252,17 @@ pmap_flush_tlbs(pmap_t   pmap)
                                if (cpus_to_respond == 0)
                                        break;
                        }
+                       if (mach_absolute_time() > deadline) {
+                               if (machine_timeout_suspended())
+                                       continue;
+                               pmap_tlb_flush_timeout = TRUE;
+                               orig_acks = NMIPI_acks;
+                               pmap_cpuset_NMIPI(cpus_to_respond);
+
+                               panic("TLB invalidation IPI timeout: "
+                                   "CPU(s) failed to respond to interrupts, unresponsive CPU bitmap: 0x%lx, NMIPI acks: orig: 0x%lx, now: 0x%lx",
+                                   cpus_to_respond, orig_acks, NMIPI_acks);
+                       }
                }
        }