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>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/i86pc/io/apix/apix_utils.c
          +++ new/usr/src/uts/i86pc/io/apix/apix_utils.c
↓ open down ↓ 21 lines elided ↑ open up ↑
  22   22  /*
  23   23   * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   */
  25   25  /*
  26   26   * Copyright (c) 2010, Intel Corporation.
  27   27   * All rights reserved.
  28   28   */
  29   29  /*
  30   30   * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  31   31   * Copyright 2013 Pluribus Networks, Inc.
       32 + * Copyright 2018 Joyent, Inc.
  32   33   */
  33   34  
  34   35  #include <sys/processor.h>
  35   36  #include <sys/time.h>
  36   37  #include <sys/psm.h>
  37   38  #include <sys/smp_impldefs.h>
  38   39  #include <sys/cram.h>
  39   40  #include <sys/acpi/acpi.h>
  40   41  #include <sys/acpica.h>
  41   42  #include <sys/psm_common.h>
↓ open down ↓ 17 lines elided ↑ open up ↑
  59   60  #include <sys/privregs.h>
  60   61  #include <sys/note.h>
  61   62  #include <sys/pci_intr_lib.h>
  62   63  #include <sys/spl.h>
  63   64  #include <sys/clock.h>
  64   65  #include <sys/dditypes.h>
  65   66  #include <sys/sunddi.h>
  66   67  #include <sys/x_call.h>
  67   68  #include <sys/reboot.h>
  68   69  #include <sys/apix.h>
       70 +#include <sys/ht.h>
  69   71  
  70   72  static int apix_get_avail_vector_oncpu(uint32_t, int, int);
  71   73  static apix_vector_t *apix_init_vector(processorid_t, uchar_t);
  72   74  static void apix_cleanup_vector(apix_vector_t *);
  73   75  static void apix_insert_av(apix_vector_t *, void *, avfunc, caddr_t, caddr_t,
  74   76      uint64_t *, int, dev_info_t *);
  75   77  static void apix_remove_av(apix_vector_t *, struct autovec *);
  76   78  static void apix_clear_dev_map(dev_info_t *, int, int);
  77   79  static boolean_t apix_is_cpu_enabled(processorid_t);
  78   80  static void apix_wait_till_seen(processorid_t, int);
↓ open down ↓ 717 lines elided ↑ open up ↑
 796  798          APIC_VERBOSE(INTR, (CE_CONT, "apix_insert_av: dip %p, vector 0x%x, "
 797  799              "cpu %d\n", (void *)dip, vecp->v_vector, vecp->v_cpuid));
 798  800  
 799  801          mem = kmem_zalloc(sizeof (struct autovec), KM_SLEEP);
 800  802          INIT_AUTOVEC(mem, intr_id, f, arg1, arg2, ticksp, ipl, dip);
 801  803          if (vecp->v_type == APIX_TYPE_FIXED && apic_level_intr[vecp->v_inum])
 802  804                  mem->av_flags |= AV_PENTRY_LEVEL;
 803  805  
 804  806          vecp->v_share++;
 805  807          vecp->v_pri = (ipl > vecp->v_pri) ? ipl : vecp->v_pri;
      808 +
      809 +        ht_intr_alloc_pil(vecp->v_pri);
      810 +
 806  811          if (vecp->v_autovect == NULL) { /* Nothing on list - put it at head */
 807  812                  vecp->v_autovect = mem;
 808  813                  return;
 809  814          }
 810  815  
 811  816          if (DDI_INTR_IS_MSI_OR_MSIX(vecp->v_type)) {    /* MSI/X */
 812  817                  ASSERT(vecp->v_share == 1);     /* No sharing for MSI/X */
 813  818  
 814  819                  INIT_AUTOVEC(vecp->v_autovect, intr_id, f, arg1, arg2, ticksp,
 815  820                      ipl, dip);
↓ open down ↓ 645 lines elided ↑ open up ↑
1461 1466          apix_vector_t *newp, *oldp;
1462 1467          processorid_t oldcpu = vecp->v_cpuid;
1463 1468          uchar_t newvec, oldvec = vecp->v_vector;
1464 1469          int i;
1465 1470  
1466 1471          ASSERT(LOCK_HELD(&apix_lock) && count > 0);
1467 1472  
1468 1473          if (!apix_is_cpu_enabled(newcpu))
1469 1474                  return (NULL);
1470 1475  
1471      -        if (vecp->v_cpuid == newcpu)    /* rebind to the same cpu */
     1476 +        if (vecp->v_cpuid == newcpu)    /* rebind to the same cpu */
1472 1477                  return (vecp);
1473 1478  
1474 1479          APIX_ENTER_CPU_LOCK(oldcpu);
1475 1480          APIX_ENTER_CPU_LOCK(newcpu);
1476 1481  
1477 1482          /* allocate vector */
1478 1483          if (count == 1)
1479 1484                  newp = apix_alloc_vector_oncpu(newcpu, NULL, 0, vecp->v_type);
1480 1485          else {
1481 1486                  ASSERT(vecp->v_type == APIX_TYPE_MSI);
↓ open down ↓ 443 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX