bigsmp_32.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * APIC driver for "bigsmp" xAPIC machines with more than 8 virtual CPUs.
  4. *
  5. * Drives the local APIC in "clustered mode".
  6. */
  7. #include <linux/cpumask.h>
  8. #include <linux/dmi.h>
  9. #include <linux/smp.h>
  10. #include <asm/apic.h>
  11. #include <asm/io_apic.h>
  12. #include "local.h"
  13. static u32 bigsmp_get_apic_id(u32 x)
  14. {
  15. return (x >> 24) & 0xFF;
  16. }
  17. static void bigsmp_send_IPI_allbutself(int vector)
  18. {
  19. default_send_IPI_mask_allbutself_phys(cpu_online_mask, vector);
  20. }
  21. static void bigsmp_send_IPI_all(int vector)
  22. {
  23. default_send_IPI_mask_sequence_phys(cpu_online_mask, vector);
  24. }
  25. static int dmi_bigsmp; /* can be set by dmi scanners */
  26. static int hp_ht_bigsmp(const struct dmi_system_id *d)
  27. {
  28. printk(KERN_NOTICE "%s detected: force use of apic=bigsmp\n", d->ident);
  29. dmi_bigsmp = 1;
  30. return 0;
  31. }
  32. static const struct dmi_system_id bigsmp_dmi_table[] = {
  33. { hp_ht_bigsmp, "HP ProLiant DL760 G2",
  34. { DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
  35. DMI_MATCH(DMI_BIOS_VERSION, "P44-"),
  36. }
  37. },
  38. { hp_ht_bigsmp, "HP ProLiant DL740",
  39. { DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
  40. DMI_MATCH(DMI_BIOS_VERSION, "P47-"),
  41. }
  42. },
  43. { } /* NULL entry stops DMI scanning */
  44. };
  45. static int probe_bigsmp(void)
  46. {
  47. return dmi_check_system(bigsmp_dmi_table);
  48. }
  49. static struct apic apic_bigsmp __ro_after_init = {
  50. .name = "bigsmp",
  51. .probe = probe_bigsmp,
  52. .dest_mode_logical = false,
  53. .disable_esr = 1,
  54. .cpu_present_to_apicid = default_cpu_present_to_apicid,
  55. .max_apic_id = 0xFE,
  56. .get_apic_id = bigsmp_get_apic_id,
  57. .calc_dest_apicid = apic_default_calc_apicid,
  58. .send_IPI = default_send_IPI_single_phys,
  59. .send_IPI_mask = default_send_IPI_mask_sequence_phys,
  60. .send_IPI_mask_allbutself = NULL,
  61. .send_IPI_allbutself = bigsmp_send_IPI_allbutself,
  62. .send_IPI_all = bigsmp_send_IPI_all,
  63. .send_IPI_self = default_send_IPI_self,
  64. .read = native_apic_mem_read,
  65. .write = native_apic_mem_write,
  66. .eoi = native_apic_mem_eoi,
  67. .icr_read = native_apic_icr_read,
  68. .icr_write = native_apic_icr_write,
  69. .wait_icr_idle = apic_mem_wait_icr_idle,
  70. .safe_wait_icr_idle = apic_mem_wait_icr_idle_timeout,
  71. };
  72. bool __init apic_bigsmp_possible(bool cmdline_override)
  73. {
  74. return apic == &apic_bigsmp || !cmdline_override;
  75. }
  76. void __init apic_bigsmp_force(void)
  77. {
  78. if (apic != &apic_bigsmp)
  79. apic_install_driver(&apic_bigsmp);
  80. }
  81. apic_driver(apic_bigsmp);