Print this page
10924 Need mitigation of L1TF (CVE-2018-3646)
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Peter Tribble <peter.tribble@gmail.com>


  65 #include <sys/debug.h>
  66 #include <sys/archsystm.h>
  67 #include <sys/trap.h>
  68 #include <sys/machsystm.h>
  69 #include <sys/sysmacros.h>
  70 #include <sys/cpuvar.h>
  71 #include <sys/rm_platter.h>
  72 #include <sys/privregs.h>
  73 #include <sys/note.h>
  74 #include <sys/pci_intr_lib.h>
  75 #include <sys/spl.h>
  76 #include <sys/clock.h>
  77 #include <sys/cyclic.h>
  78 #include <sys/dditypes.h>
  79 #include <sys/sunddi.h>
  80 #include <sys/x_call.h>
  81 #include <sys/reboot.h>
  82 #include <sys/hpet.h>
  83 #include <sys/apic_common.h>
  84 #include <sys/apic_timer.h>

  85 
  86 /*
  87  *      Local Function Prototypes
  88  */
  89 static void apic_init_intr(void);
  90 
  91 /*
  92  *      standard MP entries
  93  */
  94 static int      apic_probe(void);
  95 static int      apic_getclkirq(int ipl);
  96 static void     apic_init(void);
  97 static void     apic_picinit(void);
  98 static int      apic_post_cpu_start(void);
  99 static int      apic_intr_enter(int ipl, int *vect);
 100 static void     apic_setspl(int ipl);
 101 static int      apic_addspl(int ipl, int vector, int min_ipl, int max_ipl);
 102 static int      apic_delspl(int ipl, int vector, int min_ipl, int max_ipl);
 103 static int      apic_disable_intr(processorid_t cpun);
 104 static void     apic_enable_intr(processorid_t cpun);


 283         psm_get_ioapicid = apic_get_ioapicid;
 284         psm_get_localapicid = apic_get_localapicid;
 285         psm_xlate_vector_by_irq = apic_xlate_vector_by_irq;
 286 
 287         apic_ipltopri[0] = APIC_VECTOR_PER_IPL; /* leave 0 for idle */
 288         for (i = 0; i < (APIC_AVAIL_VECTOR / APIC_VECTOR_PER_IPL); i++) {
 289                 if ((i < ((APIC_AVAIL_VECTOR / APIC_VECTOR_PER_IPL) - 1)) &&
 290                     (apic_vectortoipl[i + 1] == apic_vectortoipl[i]))
 291                         /* get to highest vector at the same ipl */
 292                         continue;
 293                 for (; j <= apic_vectortoipl[i]; j++) {
 294                         apic_ipltopri[j] = (i << APIC_IPL_SHIFT) +
 295                             APIC_BASE_VECT;
 296                 }
 297         }
 298         for (; j < MAXIPL + 1; j++)
 299                 /* fill up any empty ipltopri slots */
 300                 apic_ipltopri[j] = (i << APIC_IPL_SHIFT) + APIC_BASE_VECT;
 301         apic_init_common();
 302 





 303         apic_pir_vect = apic_get_ipivect(XC_CPUPOKE_PIL, -1);
 304 
 305 #if !defined(__amd64)
 306         if (cpuid_have_cr8access(CPU))
 307                 apic_have_32bit_cr8 = 1;
 308 #endif
 309 }
 310 
 311 static void
 312 apic_init_intr(void)
 313 {
 314         processorid_t   cpun = psm_get_cpu_id();
 315         uint_t nlvt;
 316         uint32_t svr = AV_UNIT_ENABLE | APIC_SPUR_INTR;
 317 
 318         apic_reg_ops->apic_write_task_reg(APIC_MASK_ALL);
 319 
 320         ASSERT(apic_mode == LOCAL_APIC);
 321 
 322         /*




  65 #include <sys/debug.h>
  66 #include <sys/archsystm.h>
  67 #include <sys/trap.h>
  68 #include <sys/machsystm.h>
  69 #include <sys/sysmacros.h>
  70 #include <sys/cpuvar.h>
  71 #include <sys/rm_platter.h>
  72 #include <sys/privregs.h>
  73 #include <sys/note.h>
  74 #include <sys/pci_intr_lib.h>
  75 #include <sys/spl.h>
  76 #include <sys/clock.h>
  77 #include <sys/cyclic.h>
  78 #include <sys/dditypes.h>
  79 #include <sys/sunddi.h>
  80 #include <sys/x_call.h>
  81 #include <sys/reboot.h>
  82 #include <sys/hpet.h>
  83 #include <sys/apic_common.h>
  84 #include <sys/apic_timer.h>
  85 #include <sys/ht.h>
  86 
  87 /*
  88  *      Local Function Prototypes
  89  */
  90 static void apic_init_intr(void);
  91 
  92 /*
  93  *      standard MP entries
  94  */
  95 static int      apic_probe(void);
  96 static int      apic_getclkirq(int ipl);
  97 static void     apic_init(void);
  98 static void     apic_picinit(void);
  99 static int      apic_post_cpu_start(void);
 100 static int      apic_intr_enter(int ipl, int *vect);
 101 static void     apic_setspl(int ipl);
 102 static int      apic_addspl(int ipl, int vector, int min_ipl, int max_ipl);
 103 static int      apic_delspl(int ipl, int vector, int min_ipl, int max_ipl);
 104 static int      apic_disable_intr(processorid_t cpun);
 105 static void     apic_enable_intr(processorid_t cpun);


 284         psm_get_ioapicid = apic_get_ioapicid;
 285         psm_get_localapicid = apic_get_localapicid;
 286         psm_xlate_vector_by_irq = apic_xlate_vector_by_irq;
 287 
 288         apic_ipltopri[0] = APIC_VECTOR_PER_IPL; /* leave 0 for idle */
 289         for (i = 0; i < (APIC_AVAIL_VECTOR / APIC_VECTOR_PER_IPL); i++) {
 290                 if ((i < ((APIC_AVAIL_VECTOR / APIC_VECTOR_PER_IPL) - 1)) &&
 291                     (apic_vectortoipl[i + 1] == apic_vectortoipl[i]))
 292                         /* get to highest vector at the same ipl */
 293                         continue;
 294                 for (; j <= apic_vectortoipl[i]; j++) {
 295                         apic_ipltopri[j] = (i << APIC_IPL_SHIFT) +
 296                             APIC_BASE_VECT;
 297                 }
 298         }
 299         for (; j < MAXIPL + 1; j++)
 300                 /* fill up any empty ipltopri slots */
 301                 apic_ipltopri[j] = (i << APIC_IPL_SHIFT) + APIC_BASE_VECT;
 302         apic_init_common();
 303 
 304         /*
 305          * For pcplusmp, we'll keep things simple and always disable this.
 306          */
 307         ht_intr_alloc_pil(XC_CPUPOKE_PIL);
 308 
 309         apic_pir_vect = apic_get_ipivect(XC_CPUPOKE_PIL, -1);
 310 
 311 #if !defined(__amd64)
 312         if (cpuid_have_cr8access(CPU))
 313                 apic_have_32bit_cr8 = 1;
 314 #endif
 315 }
 316 
 317 static void
 318 apic_init_intr(void)
 319 {
 320         processorid_t   cpun = psm_get_cpu_id();
 321         uint_t nlvt;
 322         uint32_t svr = AV_UNIT_ENABLE | APIC_SPUR_INTR;
 323 
 324         apic_reg_ops->apic_write_task_reg(APIC_MASK_ALL);
 325 
 326         ASSERT(apic_mode == LOCAL_APIC);
 327 
 328         /*