Print this page
5255 uts shouldn't open-code ISP2

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/sun4v/os/intrq.c
          +++ new/usr/src/uts/sun4v/os/intrq.c
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  
       26 +#include <sys/sysmacros.h>
  26   27  #include <sys/machsystm.h>
  27   28  #include <sys/cpu.h>
  28   29  #include <sys/intreg.h>
  29   30  #include <sys/machcpuvar.h>
  30   31  #include <vm/hat_sfmmu.h>
  31   32  #include <sys/error.h>
  32   33  #include <sys/hypervisor_api.h>
  33   34  
  34   35  void
  35   36  cpu_intrq_register(struct cpu *cpu)
↓ open down ↓ 55 lines elided ↑ open up ↑
  91   92           *  Allocate a per-cpu list of ncpu_guest_max for xcalls
  92   93           */
  93   94          size = ncpu_guest_max * sizeof (uint16_t);
  94   95          if (size < INTR_REPORT_SIZE)
  95   96                  size = INTR_REPORT_SIZE;
  96   97  
  97   98          /*
  98   99           * contig_mem_alloc() requires size to be a power of 2.
  99  100           * Increase size to a power of 2 if necessary.
 100  101           */
 101      -        if ((size & (size - 1)) != 0) {
      102 +        if (!ISP2(size)) {
 102  103                  size = 1 << highbit(size);
 103  104          }
 104  105  
 105  106          mcpup->cpu_list = contig_mem_alloc(size);
 106  107  
 107  108          if (mcpup->cpu_list == NULL) {
 108  109                  cmn_err(CE_NOTE, "cpu%d: cpu cpu_list allocation failed",
 109  110                      cpu->cpu_id);
 110  111                  return (ENOMEM);
 111  112          }
↓ open down ↓ 89 lines elided ↑ open up ↑
 201  202           *  Free per-cpu list of ncpu_guest_max for xcalls
 202  203           */
 203  204          cpu_list_size = ncpu_guest_max * sizeof (uint16_t);
 204  205          if (cpu_list_size < INTR_REPORT_SIZE)
 205  206                  cpu_list_size = INTR_REPORT_SIZE;
 206  207  
 207  208          /*
 208  209           * contig_mem_alloc() requires size to be a power of 2.
 209  210           * Increase size to a power of 2 if necessary.
 210  211           */
 211      -        if ((cpu_list_size & (cpu_list_size - 1)) != 0) {
      212 +        if (!ISP2(cpu_list_size)) {
 212  213                  cpu_list_size = 1 << highbit(cpu_list_size);
 213  214          }
 214  215  
 215  216          if (mcpup->cpu_list) {
 216  217                  contig_mem_free(mcpup->cpu_list, cpu_list_size);
 217  218                  mcpup->cpu_list = NULL;
 218  219                  mcpup->cpu_list_ra = NULL;
 219  220          }
 220  221  
 221  222          /*
↓ open down ↓ 34 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX