patch-6.6-redhat.patch 74 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160
  1. From fc4c40ca1f332f2285c74eed80c8cfc94264dde0 Mon Sep 17 00:00:00 2001
  2. From: Nicolas Chauvet <[email protected]>
  3. Date: Wed, 27 Mar 2024 18:01:43 +0100
  4. Subject: [PATCH] Add redhat patches
  5. ---
  6. arch/s390/include/asm/ipl.h | 1 +
  7. arch/s390/kernel/ipl.c | 5 +
  8. arch/s390/kernel/setup.c | 4 +
  9. arch/x86/kernel/setup.c | 22 +-
  10. drivers/acpi/apei/hest.c | 8 +
  11. drivers/acpi/irq.c | 17 +-
  12. drivers/acpi/scan.c | 9 +
  13. drivers/ata/libahci.c | 18 +
  14. drivers/char/ipmi/ipmi_dmi.c | 15 +
  15. drivers/char/ipmi/ipmi_msghandler.c | 16 +-
  16. drivers/firmware/efi/Makefile | 1 +
  17. drivers/firmware/efi/efi.c | 124 ++++--
  18. drivers/firmware/efi/secureboot.c | 38 ++
  19. drivers/firmware/sysfb.c | 18 +-
  20. drivers/hid/hid-rmi.c | 66 ----
  21. .../coresight/coresight-etm4x-core.c | 19 +
  22. drivers/input/rmi4/rmi_driver.c | 124 +++---
  23. drivers/iommu/iommu.c | 22 ++
  24. drivers/pci/quirks.c | 24 ++
  25. drivers/scsi/sd.c | 10 +
  26. include/linux/efi.h | 22 +-
  27. include/linux/lsm_hook_defs.h | 2 +
  28. include/linux/module.h | 1 +
  29. include/linux/rh_kabi.h | 172 +++++++++
  30. include/linux/rmi.h | 1 +
  31. include/linux/security.h | 5 +
  32. kernel/module/main.c | 2 +
  33. kernel/module/signing.c | 9 +-
  34. scripts/tags.sh | 2 +
  35. security/integrity/platform_certs/load_uefi.c | 6 +-
  36. security/lockdown/Kconfig | 13 +
  37. security/lockdown/lockdown.c | 1 +
  38. security/security.c | 12 +
  39. sound/pci/hda/cs35l41_hda.c | 106 +++++-
  40. sound/pci/hda/cs35l41_hda.h | 8 +-
  41. sound/pci/hda/cs35l41_hda_property.c | 355 ++++++++++++++++--
  42. sound/pci/hda/hda_component.h | 4 +
  43. sound/pci/hda/patch_realtek.c | 34 +-
  44. 38 files changed, 1082 insertions(+), 234 deletions(-)
  45. create mode 100644 drivers/firmware/efi/secureboot.c
  46. create mode 100644 include/linux/rh_kabi.h
  47. diff --git a/arch/s390/include/asm/ipl.h b/arch/s390/include/asm/ipl.h
  48. index b0d00032479d..afb9544fb007 100644
  49. --- a/arch/s390/include/asm/ipl.h
  50. +++ b/arch/s390/include/asm/ipl.h
  51. @@ -139,6 +139,7 @@ int ipl_report_add_component(struct ipl_report *report, struct kexec_buf *kbuf,
  52. unsigned char flags, unsigned short cert);
  53. int ipl_report_add_certificate(struct ipl_report *report, void *key,
  54. unsigned long addr, unsigned long len);
  55. +bool ipl_get_secureboot(void);
  56. /*
  57. * DIAG 308 support
  58. diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
  59. index a3d3cb39b021..c02de966da1a 100644
  60. --- a/arch/s390/kernel/ipl.c
  61. +++ b/arch/s390/kernel/ipl.c
  62. @@ -2520,3 +2520,8 @@ int ipl_report_free(struct ipl_report *report)
  63. }
  64. #endif
  65. +
  66. +bool ipl_get_secureboot(void)
  67. +{
  68. + return !!ipl_secure_flag;
  69. +}
  70. diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
  71. index d48c7afe97e6..09fd497b28ba 100644
  72. --- a/arch/s390/kernel/setup.c
  73. +++ b/arch/s390/kernel/setup.c
  74. @@ -49,6 +49,7 @@
  75. #include <linux/memory.h>
  76. #include <linux/compat.h>
  77. #include <linux/start_kernel.h>
  78. +#include <linux/security.h>
  79. #include <linux/hugetlb.h>
  80. #include <linux/kmemleak.h>
  81. @@ -914,6 +915,9 @@ void __init setup_arch(char **cmdline_p)
  82. log_component_list();
  83. + if (ipl_get_secureboot())
  84. + security_lock_kernel_down("Secure IPL mode", LOCKDOWN_INTEGRITY_MAX);
  85. +
  86. /* Have one command line that is parsed and saved in /proc/cmdline */
  87. /* boot_command_line has been already set up in early.c */
  88. *cmdline_p = boot_command_line;
  89. diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
  90. index eb129277dcdd..da9c49b8a640 100644
  91. --- a/arch/x86/kernel/setup.c
  92. +++ b/arch/x86/kernel/setup.c
  93. @@ -20,6 +20,7 @@
  94. #include <linux/root_dev.h>
  95. #include <linux/hugetlb.h>
  96. #include <linux/tboot.h>
  97. +#include <linux/security.h>
  98. #include <linux/usb/xhci-dbgp.h>
  99. #include <linux/static_call.h>
  100. #include <linux/swiotlb.h>
  101. @@ -1028,6 +1029,13 @@ void __init setup_arch(char **cmdline_p)
  102. if (efi_enabled(EFI_BOOT))
  103. efi_init();
  104. + efi_set_secure_boot(boot_params.secure_boot);
  105. +
  106. +#ifdef CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT
  107. + if (efi_enabled(EFI_SECURE_BOOT))
  108. + security_lock_kernel_down("EFI Secure Boot mode", LOCKDOWN_INTEGRITY_MAX);
  109. +#endif
  110. +
  111. reserve_ibft_region();
  112. x86_init.resources.dmi_setup();
  113. @@ -1190,19 +1198,7 @@ void __init setup_arch(char **cmdline_p)
  114. /* Allocate bigger log buffer */
  115. setup_log_buf(1);
  116. - if (efi_enabled(EFI_BOOT)) {
  117. - switch (boot_params.secure_boot) {
  118. - case efi_secureboot_mode_disabled:
  119. - pr_info("Secure boot disabled\n");
  120. - break;
  121. - case efi_secureboot_mode_enabled:
  122. - pr_info("Secure boot enabled\n");
  123. - break;
  124. - default:
  125. - pr_info("Secure boot could not be determined\n");
  126. - break;
  127. - }
  128. - }
  129. + efi_set_secure_boot(boot_params.secure_boot);
  130. reserve_initrd();
  131. diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c
  132. index 6aef1ee5e1bd..8f146b1b4972 100644
  133. --- a/drivers/acpi/apei/hest.c
  134. +++ b/drivers/acpi/apei/hest.c
  135. @@ -96,6 +96,14 @@ static int apei_hest_parse(apei_hest_func_t func, void *data)
  136. if (hest_disable || !hest_tab)
  137. return -EINVAL;
  138. +#ifdef CONFIG_ARM64
  139. + /* Ignore broken firmware */
  140. + if (!strncmp(hest_tab->header.oem_id, "HPE ", 6) &&
  141. + !strncmp(hest_tab->header.oem_table_id, "ProLiant", 8) &&
  142. + MIDR_IMPLEMENTOR(read_cpuid_id()) == ARM_CPU_IMP_APM)
  143. + return -EINVAL;
  144. +#endif
  145. +
  146. hest_hdr = (struct acpi_hest_header *)(hest_tab + 1);
  147. for (i = 0; i < hest_tab->error_source_count; i++) {
  148. len = hest_esrc_len(hest_hdr);
  149. diff --git a/drivers/acpi/irq.c b/drivers/acpi/irq.c
  150. index 1687483ff319..390b67f19181 100644
  151. --- a/drivers/acpi/irq.c
  152. +++ b/drivers/acpi/irq.c
  153. @@ -143,6 +143,7 @@ struct acpi_irq_parse_one_ctx {
  154. unsigned int index;
  155. unsigned long *res_flags;
  156. struct irq_fwspec *fwspec;
  157. + bool skip_producer_check;
  158. };
  159. /**
  160. @@ -216,7 +217,8 @@ static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares,
  161. return AE_CTRL_TERMINATE;
  162. case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
  163. eirq = &ares->data.extended_irq;
  164. - if (eirq->producer_consumer == ACPI_PRODUCER)
  165. + if (!ctx->skip_producer_check &&
  166. + eirq->producer_consumer == ACPI_PRODUCER)
  167. return AE_OK;
  168. if (ctx->index >= eirq->interrupt_count) {
  169. ctx->index -= eirq->interrupt_count;
  170. @@ -252,8 +254,19 @@ static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares,
  171. static int acpi_irq_parse_one(acpi_handle handle, unsigned int index,
  172. struct irq_fwspec *fwspec, unsigned long *flags)
  173. {
  174. - struct acpi_irq_parse_one_ctx ctx = { -EINVAL, index, flags, fwspec };
  175. + struct acpi_irq_parse_one_ctx ctx = { -EINVAL, index, flags, fwspec, false };
  176. + /*
  177. + * Firmware on arm64-based HPE m400 platform incorrectly marks
  178. + * its UART interrupt as ACPI_PRODUCER rather than ACPI_CONSUMER.
  179. + * Don't do the producer/consumer check for that device.
  180. + */
  181. + if (IS_ENABLED(CONFIG_ARM64)) {
  182. + struct acpi_device *adev = acpi_get_acpi_dev(handle);
  183. +
  184. + if (adev && !strcmp(acpi_device_hid(adev), "APMC0D08"))
  185. + ctx.skip_producer_check = true;
  186. + }
  187. acpi_walk_resources(handle, METHOD_NAME__CRS, acpi_irq_parse_one_cb, &ctx);
  188. return ctx.rc;
  189. }
  190. diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
  191. index c0c5c5c58ae1..5fb3fde53f5a 100644
  192. --- a/drivers/acpi/scan.c
  193. +++ b/drivers/acpi/scan.c
  194. @@ -1753,6 +1753,15 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device)
  195. if (!acpi_match_device_ids(device, ignore_serial_bus_ids))
  196. return false;
  197. + /*
  198. + * Firmware on some arm64 X-Gene platforms will make the UART
  199. + * device appear as both a UART and a slave of that UART. Just
  200. + * bail out here for X-Gene UARTs.
  201. + */
  202. + if (IS_ENABLED(CONFIG_ARM64) &&
  203. + !strcmp(acpi_device_hid(device), "APMC0D08"))
  204. + return false;
  205. +
  206. INIT_LIST_HEAD(&resource_list);
  207. acpi_dev_get_resources(device, &resource_list,
  208. acpi_check_serial_bus_slave,
  209. diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
  210. index f1263364fa97..24ac410f4366 100644
  211. --- a/drivers/ata/libahci.c
  212. +++ b/drivers/ata/libahci.c
  213. @@ -729,6 +729,24 @@ int ahci_stop_engine(struct ata_port *ap)
  214. tmp &= ~PORT_CMD_START;
  215. writel(tmp, port_mmio + PORT_CMD);
  216. +#ifdef CONFIG_ARM64
  217. + /* Rev Ax of Cavium CN99XX needs a hack for port stop */
  218. + if (dev_is_pci(ap->host->dev) &&
  219. + to_pci_dev(ap->host->dev)->vendor == 0x14e4 &&
  220. + to_pci_dev(ap->host->dev)->device == 0x9027 &&
  221. + midr_is_cpu_model_range(read_cpuid_id(),
  222. + MIDR_CPU_MODEL(ARM_CPU_IMP_BRCM, BRCM_CPU_PART_VULCAN),
  223. + MIDR_CPU_VAR_REV(0, 0),
  224. + MIDR_CPU_VAR_REV(0, MIDR_REVISION_MASK))) {
  225. + tmp = readl(hpriv->mmio + 0x8000);
  226. + udelay(100);
  227. + writel(tmp | (1 << 26), hpriv->mmio + 0x8000);
  228. + udelay(100);
  229. + writel(tmp & ~(1 << 26), hpriv->mmio + 0x8000);
  230. + dev_warn(ap->host->dev, "CN99XX SATA reset workaround applied\n");
  231. + }
  232. +#endif
  233. +
  234. /* wait for engine to stop. This could be as long as 500 msec */
  235. tmp = ata_wait_register(ap, port_mmio + PORT_CMD,
  236. PORT_CMD_LIST_ON, PORT_CMD_LIST_ON, 1, 500);
  237. diff --git a/drivers/char/ipmi/ipmi_dmi.c b/drivers/char/ipmi/ipmi_dmi.c
  238. index bbf7029e224b..cf7faa970dd6 100644
  239. --- a/drivers/char/ipmi/ipmi_dmi.c
  240. +++ b/drivers/char/ipmi/ipmi_dmi.c
  241. @@ -215,6 +215,21 @@ static int __init scan_for_dmi_ipmi(void)
  242. {
  243. const struct dmi_device *dev = NULL;
  244. +#ifdef CONFIG_ARM64
  245. + /* RHEL-only
  246. + * If this is ARM-based HPE m400, return now, because that platform
  247. + * reports the host-side ipmi address as intel port-io space, which
  248. + * does not exist in the ARM architecture.
  249. + */
  250. + const char *dmistr = dmi_get_system_info(DMI_PRODUCT_NAME);
  251. +
  252. + if (dmistr && (strcmp("ProLiant m400 Server", dmistr) == 0)) {
  253. + pr_debug("%s does not support host ipmi\n", dmistr);
  254. + return 0;
  255. + }
  256. + /* END RHEL-only */
  257. +#endif
  258. +
  259. while ((dev = dmi_find_device(DMI_DEV_TYPE_IPMI, NULL, dev)))
  260. dmi_decode_ipmi((const struct dmi_header *) dev->device_data);
  261. diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
  262. index 186f1fee7534..93e3a76596ff 100644
  263. --- a/drivers/char/ipmi/ipmi_msghandler.c
  264. +++ b/drivers/char/ipmi/ipmi_msghandler.c
  265. @@ -35,6 +35,7 @@
  266. #include <linux/uuid.h>
  267. #include <linux/nospec.h>
  268. #include <linux/vmalloc.h>
  269. +#include <linux/dmi.h>
  270. #include <linux/delay.h>
  271. #define IPMI_DRIVER_VERSION "39.2"
  272. @@ -5516,8 +5517,21 @@ static int __init ipmi_init_msghandler_mod(void)
  273. {
  274. int rv;
  275. - pr_info("version " IPMI_DRIVER_VERSION "\n");
  276. +#ifdef CONFIG_ARM64
  277. + /* RHEL-only
  278. + * If this is ARM-based HPE m400, return now, because that platform
  279. + * reports the host-side ipmi address as intel port-io space, which
  280. + * does not exist in the ARM architecture.
  281. + */
  282. + const char *dmistr = dmi_get_system_info(DMI_PRODUCT_NAME);
  283. + if (dmistr && (strcmp("ProLiant m400 Server", dmistr) == 0)) {
  284. + pr_debug("%s does not support host ipmi\n", dmistr);
  285. + return -ENOSYS;
  286. + }
  287. + /* END RHEL-only */
  288. +#endif
  289. + pr_info("version " IPMI_DRIVER_VERSION "\n");
  290. mutex_lock(&ipmi_interfaces_mutex);
  291. rv = ipmi_register_driver();
  292. mutex_unlock(&ipmi_interfaces_mutex);
  293. diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile
  294. index e489fefd23da..f2dfae764fb5 100644
  295. --- a/drivers/firmware/efi/Makefile
  296. +++ b/drivers/firmware/efi/Makefile
  297. @@ -25,6 +25,7 @@ subdir-$(CONFIG_EFI_STUB) += libstub
  298. obj-$(CONFIG_EFI_BOOTLOADER_CONTROL) += efibc.o
  299. obj-$(CONFIG_EFI_TEST) += test/
  300. obj-$(CONFIG_EFI_DEV_PATH_PARSER) += dev-path-parser.o
  301. +obj-$(CONFIG_EFI) += secureboot.o
  302. obj-$(CONFIG_APPLE_PROPERTIES) += apple-properties.o
  303. obj-$(CONFIG_EFI_RCI2_TABLE) += rci2-table.o
  304. obj-$(CONFIG_EFI_EMBEDDED_FIRMWARE) += embedded-firmware.o
  305. diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
  306. index 2c1095dcc2f2..7ea6012e3ef4 100644
  307. --- a/drivers/firmware/efi/efi.c
  308. +++ b/drivers/firmware/efi/efi.c
  309. @@ -32,6 +32,7 @@
  310. #include <linux/ucs2_string.h>
  311. #include <linux/memblock.h>
  312. #include <linux/security.h>
  313. +#include <linux/bsearch.h>
  314. #include <asm/early_ioremap.h>
  315. @@ -985,40 +986,101 @@ int efi_mem_type(unsigned long phys_addr)
  316. }
  317. #endif
  318. +struct efi_error_code {
  319. + efi_status_t status;
  320. + int errno;
  321. + const char *description;
  322. +};
  323. +
  324. +static const struct efi_error_code efi_error_codes[] = {
  325. + { EFI_SUCCESS, 0, "Success"},
  326. +#if 0
  327. + { EFI_LOAD_ERROR, -EPICK_AN_ERRNO, "Load Error"},
  328. +#endif
  329. + { EFI_INVALID_PARAMETER, -EINVAL, "Invalid Parameter"},
  330. + { EFI_UNSUPPORTED, -ENOSYS, "Unsupported"},
  331. + { EFI_BAD_BUFFER_SIZE, -ENOSPC, "Bad Buffer Size"},
  332. + { EFI_BUFFER_TOO_SMALL, -ENOSPC, "Buffer Too Small"},
  333. + { EFI_NOT_READY, -EAGAIN, "Not Ready"},
  334. + { EFI_DEVICE_ERROR, -EIO, "Device Error"},
  335. + { EFI_WRITE_PROTECTED, -EROFS, "Write Protected"},
  336. + { EFI_OUT_OF_RESOURCES, -ENOMEM, "Out of Resources"},
  337. +#if 0
  338. + { EFI_VOLUME_CORRUPTED, -EPICK_AN_ERRNO, "Volume Corrupt"},
  339. + { EFI_VOLUME_FULL, -EPICK_AN_ERRNO, "Volume Full"},
  340. + { EFI_NO_MEDIA, -EPICK_AN_ERRNO, "No Media"},
  341. + { EFI_MEDIA_CHANGED, -EPICK_AN_ERRNO, "Media changed"},
  342. +#endif
  343. + { EFI_NOT_FOUND, -ENOENT, "Not Found"},
  344. +#if 0
  345. + { EFI_ACCESS_DENIED, -EPICK_AN_ERRNO, "Access Denied"},
  346. + { EFI_NO_RESPONSE, -EPICK_AN_ERRNO, "No Response"},
  347. + { EFI_NO_MAPPING, -EPICK_AN_ERRNO, "No mapping"},
  348. + { EFI_TIMEOUT, -EPICK_AN_ERRNO, "Time out"},
  349. + { EFI_NOT_STARTED, -EPICK_AN_ERRNO, "Not started"},
  350. + { EFI_ALREADY_STARTED, -EPICK_AN_ERRNO, "Already started"},
  351. +#endif
  352. + { EFI_ABORTED, -EINTR, "Aborted"},
  353. +#if 0
  354. + { EFI_ICMP_ERROR, -EPICK_AN_ERRNO, "ICMP Error"},
  355. + { EFI_TFTP_ERROR, -EPICK_AN_ERRNO, "TFTP Error"},
  356. + { EFI_PROTOCOL_ERROR, -EPICK_AN_ERRNO, "Protocol Error"},
  357. + { EFI_INCOMPATIBLE_VERSION, -EPICK_AN_ERRNO, "Incompatible Version"},
  358. +#endif
  359. + { EFI_SECURITY_VIOLATION, -EACCES, "Security Policy Violation"},
  360. +#if 0
  361. + { EFI_CRC_ERROR, -EPICK_AN_ERRNO, "CRC Error"},
  362. + { EFI_END_OF_MEDIA, -EPICK_AN_ERRNO, "End of Media"},
  363. + { EFI_END_OF_FILE, -EPICK_AN_ERRNO, "End of File"},
  364. + { EFI_INVALID_LANGUAGE, -EPICK_AN_ERRNO, "Invalid Languages"},
  365. + { EFI_COMPROMISED_DATA, -EPICK_AN_ERRNO, "Compromised Data"},
  366. +
  367. + // warnings
  368. + { EFI_WARN_UNKOWN_GLYPH, -EPICK_AN_ERRNO, "Warning Unknown Glyph"},
  369. + { EFI_WARN_DELETE_FAILURE, -EPICK_AN_ERRNO, "Warning Delete Failure"},
  370. + { EFI_WARN_WRITE_FAILURE, -EPICK_AN_ERRNO, "Warning Write Failure"},
  371. + { EFI_WARN_BUFFER_TOO_SMALL, -EPICK_AN_ERRNO, "Warning Buffer Too Small"},
  372. +#endif
  373. +};
  374. +
  375. +static int
  376. +efi_status_cmp_bsearch(const void *key, const void *item)
  377. +{
  378. + u64 status = (u64)(uintptr_t)key;
  379. + struct efi_error_code *code = (struct efi_error_code *)item;
  380. +
  381. + if (status < code->status)
  382. + return -1;
  383. + if (status > code->status)
  384. + return 1;
  385. + return 0;
  386. +}
  387. +
  388. int efi_status_to_err(efi_status_t status)
  389. {
  390. - int err;
  391. -
  392. - switch (status) {
  393. - case EFI_SUCCESS:
  394. - err = 0;
  395. - break;
  396. - case EFI_INVALID_PARAMETER:
  397. - err = -EINVAL;
  398. - break;
  399. - case EFI_OUT_OF_RESOURCES:
  400. - err = -ENOSPC;
  401. - break;
  402. - case EFI_DEVICE_ERROR:
  403. - err = -EIO;
  404. - break;
  405. - case EFI_WRITE_PROTECTED:
  406. - err = -EROFS;
  407. - break;
  408. - case EFI_SECURITY_VIOLATION:
  409. - err = -EACCES;
  410. - break;
  411. - case EFI_NOT_FOUND:
  412. - err = -ENOENT;
  413. - break;
  414. - case EFI_ABORTED:
  415. - err = -EINTR;
  416. - break;
  417. - default:
  418. - err = -EINVAL;
  419. - }
  420. + struct efi_error_code *found;
  421. + size_t num = sizeof(efi_error_codes) / sizeof(struct efi_error_code);
  422. - return err;
  423. + found = bsearch((void *)(uintptr_t)status, efi_error_codes,
  424. + sizeof(struct efi_error_code), num,
  425. + efi_status_cmp_bsearch);
  426. + if (!found)
  427. + return -EINVAL;
  428. + return found->errno;
  429. +}
  430. +
  431. +const char *
  432. +efi_status_to_str(efi_status_t status)
  433. +{
  434. + struct efi_error_code *found;
  435. + size_t num = sizeof(efi_error_codes) / sizeof(struct efi_error_code);
  436. +
  437. + found = bsearch((void *)(uintptr_t)status, efi_error_codes,
  438. + sizeof(struct efi_error_code), num,
  439. + efi_status_cmp_bsearch);
  440. + if (!found)
  441. + return "Unknown error code";
  442. + return found->description;
  443. }
  444. EXPORT_SYMBOL_GPL(efi_status_to_err);
  445. diff --git a/drivers/firmware/efi/secureboot.c b/drivers/firmware/efi/secureboot.c
  446. new file mode 100644
  447. index 000000000000..de0a3714a5d4
  448. --- /dev/null
  449. +++ b/drivers/firmware/efi/secureboot.c
  450. @@ -0,0 +1,38 @@
  451. +/* Core kernel secure boot support.
  452. + *
  453. + * Copyright (C) 2017 Red Hat, Inc. All Rights Reserved.
  454. + * Written by David Howells ([email protected])
  455. + *
  456. + * This program is free software; you can redistribute it and/or
  457. + * modify it under the terms of the GNU General Public Licence
  458. + * as published by the Free Software Foundation; either version
  459. + * 2 of the Licence, or (at your option) any later version.
  460. + */
  461. +
  462. +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  463. +
  464. +#include <linux/efi.h>
  465. +#include <linux/kernel.h>
  466. +#include <linux/printk.h>
  467. +
  468. +/*
  469. + * Decide what to do when UEFI secure boot mode is enabled.
  470. + */
  471. +void __init efi_set_secure_boot(enum efi_secureboot_mode mode)
  472. +{
  473. + if (efi_enabled(EFI_BOOT)) {
  474. + switch (mode) {
  475. + case efi_secureboot_mode_disabled:
  476. + pr_info("Secure boot disabled\n");
  477. + break;
  478. + case efi_secureboot_mode_enabled:
  479. + set_bit(EFI_SECURE_BOOT, &efi.flags);
  480. + pr_info("Secure boot enabled\n");
  481. + break;
  482. + default:
  483. + pr_warn("Secure boot could not be determined (mode %u)\n",
  484. + mode);
  485. + break;
  486. + }
  487. + }
  488. +}
  489. diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c
  490. index defd7a36cb08..09146688cb35 100644
  491. --- a/drivers/firmware/sysfb.c
  492. +++ b/drivers/firmware/sysfb.c
  493. @@ -34,6 +34,22 @@
  494. #include <linux/screen_info.h>
  495. #include <linux/sysfb.h>
  496. +static int skip_simpledrm;
  497. +
  498. +static int __init simpledrm_disable(char *opt)
  499. +{
  500. + if (!opt)
  501. + return -EINVAL;
  502. +
  503. + get_option(&opt, &skip_simpledrm);
  504. +
  505. + if (skip_simpledrm)
  506. + pr_info("The simpledrm driver will not be probed\n");
  507. +
  508. + return 0;
  509. +}
  510. +early_param("nvidia-drm.modeset", simpledrm_disable);
  511. +
  512. static struct platform_device *pd;
  513. static DEFINE_MUTEX(disable_lock);
  514. static bool disabled;
  515. @@ -87,7 +103,7 @@ static __init int sysfb_init(void)
  516. /* try to create a simple-framebuffer device */
  517. compatible = sysfb_parse_mode(si, &mode);
  518. - if (compatible) {
  519. + if (compatible && !skip_simpledrm) {
  520. pd = sysfb_create_simplefb(si, &mode);
  521. if (!IS_ERR(pd))
  522. goto unlock_mutex;
  523. diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
  524. index 84e7ba5314d3..efc96776f761 100644
  525. --- a/drivers/hid/hid-rmi.c
  526. +++ b/drivers/hid/hid-rmi.c
  527. @@ -321,21 +321,12 @@ static int rmi_input_event(struct hid_device *hdev, u8 *data, int size)
  528. {
  529. struct rmi_data *hdata = hid_get_drvdata(hdev);
  530. struct rmi_device *rmi_dev = hdata->xport.rmi_dev;
  531. - unsigned long flags;
  532. if (!(test_bit(RMI_STARTED, &hdata->flags)))
  533. return 0;
  534. - pm_wakeup_event(hdev->dev.parent, 0);
  535. -
  536. - local_irq_save(flags);
  537. -
  538. rmi_set_attn_data(rmi_dev, data[1], &data[2], size - 2);
  539. - generic_handle_irq(hdata->rmi_irq);
  540. -
  541. - local_irq_restore(flags);
  542. -
  543. return 1;
  544. }
  545. @@ -591,56 +582,6 @@ static const struct rmi_transport_ops hid_rmi_ops = {
  546. .reset = rmi_hid_reset,
  547. };
  548. -static void rmi_irq_teardown(void *data)
  549. -{
  550. - struct rmi_data *hdata = data;
  551. - struct irq_domain *domain = hdata->domain;
  552. -
  553. - if (!domain)
  554. - return;
  555. -
  556. - irq_dispose_mapping(irq_find_mapping(domain, 0));
  557. -
  558. - irq_domain_remove(domain);
  559. - hdata->domain = NULL;
  560. - hdata->rmi_irq = 0;
  561. -}
  562. -
  563. -static int rmi_irq_map(struct irq_domain *h, unsigned int virq,
  564. - irq_hw_number_t hw_irq_num)
  565. -{
  566. - irq_set_chip_and_handler(virq, &dummy_irq_chip, handle_simple_irq);
  567. -
  568. - return 0;
  569. -}
  570. -
  571. -static const struct irq_domain_ops rmi_irq_ops = {
  572. - .map = rmi_irq_map,
  573. -};
  574. -
  575. -static int rmi_setup_irq_domain(struct hid_device *hdev)
  576. -{
  577. - struct rmi_data *hdata = hid_get_drvdata(hdev);
  578. - int ret;
  579. -
  580. - hdata->domain = irq_domain_create_linear(hdev->dev.fwnode, 1,
  581. - &rmi_irq_ops, hdata);
  582. - if (!hdata->domain)
  583. - return -ENOMEM;
  584. -
  585. - ret = devm_add_action_or_reset(&hdev->dev, &rmi_irq_teardown, hdata);
  586. - if (ret)
  587. - return ret;
  588. -
  589. - hdata->rmi_irq = irq_create_mapping(hdata->domain, 0);
  590. - if (hdata->rmi_irq <= 0) {
  591. - hid_err(hdev, "Can't allocate an IRQ\n");
  592. - return hdata->rmi_irq < 0 ? hdata->rmi_irq : -ENXIO;
  593. - }
  594. -
  595. - return 0;
  596. -}
  597. -
  598. static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id)
  599. {
  600. struct rmi_data *data = NULL;
  601. @@ -713,18 +654,11 @@ static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id)
  602. mutex_init(&data->page_mutex);
  603. - ret = rmi_setup_irq_domain(hdev);
  604. - if (ret) {
  605. - hid_err(hdev, "failed to allocate IRQ domain\n");
  606. - return ret;
  607. - }
  608. -
  609. if (data->device_flags & RMI_DEVICE_HAS_PHYS_BUTTONS)
  610. rmi_hid_pdata.gpio_data.disable = true;
  611. data->xport.dev = hdev->dev.parent;
  612. data->xport.pdata = rmi_hid_pdata;
  613. - data->xport.pdata.irq = data->rmi_irq;
  614. data->xport.proto_name = "hid";
  615. data->xport.ops = &hid_rmi_ops;
  616. diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
  617. index 840e4cccf8c4..a214d6c51f69 100644
  618. --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
  619. +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
  620. @@ -10,6 +10,7 @@
  621. #include <linux/init.h>
  622. #include <linux/types.h>
  623. #include <linux/device.h>
  624. +#include <linux/dmi.h>
  625. #include <linux/io.h>
  626. #include <linux/err.h>
  627. #include <linux/fs.h>
  628. @@ -2308,6 +2309,16 @@ static const struct amba_id etm4_ids[] = {
  629. {},
  630. };
  631. +static const struct dmi_system_id broken_coresight[] = {
  632. + {
  633. + .matches = {
  634. + DMI_MATCH(DMI_SYS_VENDOR, "HPE"),
  635. + DMI_MATCH(DMI_PRODUCT_NAME, "Apollo 70"),
  636. + },
  637. + },
  638. + { } /* terminating entry */
  639. +};
  640. +
  641. MODULE_DEVICE_TABLE(amba, etm4_ids);
  642. static struct amba_driver etm4x_amba_driver = {
  643. @@ -2377,6 +2388,11 @@ static int __init etm4x_init(void)
  644. {
  645. int ret;
  646. + if (dmi_check_system(broken_coresight)) {
  647. + pr_info("ETM4 disabled due to firmware bug\n");
  648. + return 0;
  649. + }
  650. +
  651. ret = etm4_pm_setup();
  652. /* etm4_pm_setup() does its own cleanup - exit on error */
  653. @@ -2403,6 +2419,9 @@ static int __init etm4x_init(void)
  654. static void __exit etm4x_exit(void)
  655. {
  656. + if (dmi_check_system(broken_coresight))
  657. + return;
  658. +
  659. amba_driver_unregister(&etm4x_amba_driver);
  660. platform_driver_unregister(&etm4_platform_driver);
  661. etm4_pm_clear();
  662. diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
  663. index ef9ea295f9e0..0103334e8f32 100644
  664. --- a/drivers/input/rmi4/rmi_driver.c
  665. +++ b/drivers/input/rmi4/rmi_driver.c
  666. @@ -182,34 +182,47 @@ void rmi_set_attn_data(struct rmi_device *rmi_dev, unsigned long irq_status,
  667. attn_data.data = fifo_data;
  668. kfifo_put(&drvdata->attn_fifo, attn_data);
  669. +
  670. + schedule_work(&drvdata->attn_work);
  671. }
  672. EXPORT_SYMBOL_GPL(rmi_set_attn_data);
  673. -static irqreturn_t rmi_irq_fn(int irq, void *dev_id)
  674. +static void attn_callback(struct work_struct *work)
  675. {
  676. - struct rmi_device *rmi_dev = dev_id;
  677. - struct rmi_driver_data *drvdata = dev_get_drvdata(&rmi_dev->dev);
  678. + struct rmi_driver_data *drvdata = container_of(work,
  679. + struct rmi_driver_data,
  680. + attn_work);
  681. struct rmi4_attn_data attn_data = {0};
  682. int ret, count;
  683. count = kfifo_get(&drvdata->attn_fifo, &attn_data);
  684. - if (count) {
  685. - *(drvdata->irq_status) = attn_data.irq_status;
  686. - drvdata->attn_data = attn_data;
  687. - }
  688. + if (!count)
  689. + return;
  690. - ret = rmi_process_interrupt_requests(rmi_dev);
  691. + *(drvdata->irq_status) = attn_data.irq_status;
  692. + drvdata->attn_data = attn_data;
  693. +
  694. + ret = rmi_process_interrupt_requests(drvdata->rmi_dev);
  695. if (ret)
  696. - rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev,
  697. + rmi_dbg(RMI_DEBUG_CORE, &drvdata->rmi_dev->dev,
  698. "Failed to process interrupt request: %d\n", ret);
  699. - if (count) {
  700. - kfree(attn_data.data);
  701. - drvdata->attn_data.data = NULL;
  702. - }
  703. + kfree(attn_data.data);
  704. + drvdata->attn_data.data = NULL;
  705. if (!kfifo_is_empty(&drvdata->attn_fifo))
  706. - return rmi_irq_fn(irq, dev_id);
  707. + schedule_work(&drvdata->attn_work);
  708. +}
  709. +
  710. +static irqreturn_t rmi_irq_fn(int irq, void *dev_id)
  711. +{
  712. + struct rmi_device *rmi_dev = dev_id;
  713. + int ret;
  714. +
  715. + ret = rmi_process_interrupt_requests(rmi_dev);
  716. + if (ret)
  717. + rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev,
  718. + "Failed to process interrupt request: %d\n", ret);
  719. return IRQ_HANDLED;
  720. }
  721. @@ -217,7 +230,6 @@ static irqreturn_t rmi_irq_fn(int irq, void *dev_id)
  722. static int rmi_irq_init(struct rmi_device *rmi_dev)
  723. {
  724. struct rmi_device_platform_data *pdata = rmi_get_platform_data(rmi_dev);
  725. - struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev);
  726. int irq_flags = irq_get_trigger_type(pdata->irq);
  727. int ret;
  728. @@ -235,8 +247,6 @@ static int rmi_irq_init(struct rmi_device *rmi_dev)
  729. return ret;
  730. }
  731. - data->enabled = true;
  732. -
  733. return 0;
  734. }
  735. @@ -886,23 +896,27 @@ void rmi_enable_irq(struct rmi_device *rmi_dev, bool clear_wake)
  736. if (data->enabled)
  737. goto out;
  738. - enable_irq(irq);
  739. - data->enabled = true;
  740. - if (clear_wake && device_may_wakeup(rmi_dev->xport->dev)) {
  741. - retval = disable_irq_wake(irq);
  742. - if (retval)
  743. - dev_warn(&rmi_dev->dev,
  744. - "Failed to disable irq for wake: %d\n",
  745. - retval);
  746. - }
  747. + if (irq) {
  748. + enable_irq(irq);
  749. + data->enabled = true;
  750. + if (clear_wake && device_may_wakeup(rmi_dev->xport->dev)) {
  751. + retval = disable_irq_wake(irq);
  752. + if (retval)
  753. + dev_warn(&rmi_dev->dev,
  754. + "Failed to disable irq for wake: %d\n",
  755. + retval);
  756. + }
  757. - /*
  758. - * Call rmi_process_interrupt_requests() after enabling irq,
  759. - * otherwise we may lose interrupt on edge-triggered systems.
  760. - */
  761. - irq_flags = irq_get_trigger_type(pdata->irq);
  762. - if (irq_flags & IRQ_TYPE_EDGE_BOTH)
  763. - rmi_process_interrupt_requests(rmi_dev);
  764. + /*
  765. + * Call rmi_process_interrupt_requests() after enabling irq,
  766. + * otherwise we may lose interrupt on edge-triggered systems.
  767. + */
  768. + irq_flags = irq_get_trigger_type(pdata->irq);
  769. + if (irq_flags & IRQ_TYPE_EDGE_BOTH)
  770. + rmi_process_interrupt_requests(rmi_dev);
  771. + } else {
  772. + data->enabled = true;
  773. + }
  774. out:
  775. mutex_unlock(&data->enabled_mutex);
  776. @@ -922,20 +936,22 @@ void rmi_disable_irq(struct rmi_device *rmi_dev, bool enable_wake)
  777. goto out;
  778. data->enabled = false;
  779. - disable_irq(irq);
  780. - if (enable_wake && device_may_wakeup(rmi_dev->xport->dev)) {
  781. - retval = enable_irq_wake(irq);
  782. - if (retval)
  783. - dev_warn(&rmi_dev->dev,
  784. - "Failed to enable irq for wake: %d\n",
  785. - retval);
  786. - }
  787. -
  788. - /* make sure the fifo is clean */
  789. - while (!kfifo_is_empty(&data->attn_fifo)) {
  790. - count = kfifo_get(&data->attn_fifo, &attn_data);
  791. - if (count)
  792. - kfree(attn_data.data);
  793. + if (irq) {
  794. + disable_irq(irq);
  795. + if (enable_wake && device_may_wakeup(rmi_dev->xport->dev)) {
  796. + retval = enable_irq_wake(irq);
  797. + if (retval)
  798. + dev_warn(&rmi_dev->dev,
  799. + "Failed to enable irq for wake: %d\n",
  800. + retval);
  801. + }
  802. + } else {
  803. + /* make sure the fifo is clean */
  804. + while (!kfifo_is_empty(&data->attn_fifo)) {
  805. + count = kfifo_get(&data->attn_fifo, &attn_data);
  806. + if (count)
  807. + kfree(attn_data.data);
  808. + }
  809. }
  810. out:
  811. @@ -978,6 +994,8 @@ static int rmi_driver_remove(struct device *dev)
  812. rmi_disable_irq(rmi_dev, false);
  813. + cancel_work_sync(&data->attn_work);
  814. +
  815. rmi_f34_remove_sysfs(rmi_dev);
  816. rmi_free_function_list(rmi_dev);
  817. @@ -1223,9 +1241,15 @@ static int rmi_driver_probe(struct device *dev)
  818. }
  819. }
  820. - retval = rmi_irq_init(rmi_dev);
  821. - if (retval < 0)
  822. - goto err_destroy_functions;
  823. + if (pdata->irq) {
  824. + retval = rmi_irq_init(rmi_dev);
  825. + if (retval < 0)
  826. + goto err_destroy_functions;
  827. + }
  828. +
  829. + data->enabled = true;
  830. +
  831. + INIT_WORK(&data->attn_work, attn_callback);
  832. if (data->f01_container->dev.driver) {
  833. /* Driver already bound, so enable ATTN now. */
  834. diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
  835. index 3f1029c0825e..c64bb71e8deb 100644
  836. --- a/drivers/iommu/iommu.c
  837. +++ b/drivers/iommu/iommu.c
  838. @@ -8,6 +8,7 @@
  839. #include <linux/amba/bus.h>
  840. #include <linux/device.h>
  841. +#include <linux/dmi.h>
  842. #include <linux/kernel.h>
  843. #include <linux/bits.h>
  844. #include <linux/bug.h>
  845. @@ -2931,6 +2932,27 @@ int iommu_dev_disable_feature(struct device *dev, enum iommu_dev_features feat)
  846. }
  847. EXPORT_SYMBOL_GPL(iommu_dev_disable_feature);
  848. +#ifdef CONFIG_ARM64
  849. +static int __init iommu_quirks(void)
  850. +{
  851. + const char *vendor, *name;
  852. +
  853. + vendor = dmi_get_system_info(DMI_SYS_VENDOR);
  854. + name = dmi_get_system_info(DMI_PRODUCT_NAME);
  855. +
  856. + if (vendor &&
  857. + (strncmp(vendor, "GIGABYTE", 8) == 0 && name &&
  858. + (strncmp(name, "R120", 4) == 0 ||
  859. + strncmp(name, "R270", 4) == 0))) {
  860. + pr_warn("Gigabyte %s detected, force iommu passthrough mode", name);
  861. + iommu_def_domain_type = IOMMU_DOMAIN_IDENTITY;
  862. + }
  863. +
  864. + return 0;
  865. +}
  866. +arch_initcall(iommu_quirks);
  867. +#endif
  868. +
  869. /**
  870. * iommu_setup_default_domain - Set the default_domain for the group
  871. * @group: Group to change
  872. diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
  873. index 54061b65a2b7..a047c060fb78 100644
  874. --- a/drivers/pci/quirks.c
  875. +++ b/drivers/pci/quirks.c
  876. @@ -4445,6 +4445,30 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, 0x9000,
  877. DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, 0x9084,
  878. quirk_bridge_cavm_thrx2_pcie_root);
  879. +/*
  880. + * PCI BAR 5 is not setup correctly for the on-board AHCI controller
  881. + * on Broadcom's Vulcan processor. Added a quirk to fix BAR 5 by
  882. + * using BAR 4's resources which are populated correctly and NOT
  883. + * actually used by the AHCI controller.
  884. + */
  885. +static void quirk_fix_vulcan_ahci_bars(struct pci_dev *dev)
  886. +{
  887. + struct resource *r = &dev->resource[4];
  888. +
  889. + if (!(r->flags & IORESOURCE_MEM) || (r->start == 0))
  890. + return;
  891. +
  892. + /* Set BAR5 resource to BAR4 */
  893. + dev->resource[5] = *r;
  894. +
  895. + /* Update BAR5 in pci config space */
  896. + pci_write_config_dword(dev, PCI_BASE_ADDRESS_5, r->start);
  897. +
  898. + /* Clear BAR4's resource */
  899. + memset(r, 0, sizeof(*r));
  900. +}
  901. +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, 0x9027, quirk_fix_vulcan_ahci_bars);
  902. +
  903. /*
  904. * Intersil/Techwell TW686[4589]-based video capture cards have an empty (zero)
  905. * class code. Fix it.
  906. diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
  907. index 2c627deedc1f..7fbfe4fb790a 100644
  908. --- a/drivers/scsi/sd.c
  909. +++ b/drivers/scsi/sd.c
  910. @@ -118,6 +118,14 @@ static const char *sd_cache_types[] = {
  911. "write back, no read (daft)"
  912. };
  913. +static const char *sd_probe_types[] = { "async", "sync" };
  914. +
  915. +static char sd_probe_type[6] = "async";
  916. +module_param_string(probe, sd_probe_type, sizeof(sd_probe_type),
  917. + S_IRUGO|S_IWUSR);
  918. +MODULE_PARM_DESC(probe, "async or sync. Setting to 'sync' disables asynchronous "
  919. + "device number assignments (sda, sdb, ...).");
  920. +
  921. static void sd_set_flush_flag(struct scsi_disk *sdkp)
  922. {
  923. bool wc = false, fua = false;
  924. @@ -4090,6 +4098,8 @@ static int __init init_sd(void)
  925. goto err_out_class;
  926. }
  927. + if (!strcmp(sd_probe_type, "sync"))
  928. + sd_template.gendrv.probe_type = PROBE_FORCE_SYNCHRONOUS;
  929. err = scsi_register_driver(&sd_template.gendrv);
  930. if (err)
  931. goto err_out_driver;
  932. diff --git a/include/linux/efi.h b/include/linux/efi.h
  933. index 80b21d1c6eaf..b66c0683f2fc 100644
  934. --- a/include/linux/efi.h
  935. +++ b/include/linux/efi.h
  936. @@ -44,6 +44,8 @@ struct screen_info;
  937. #define EFI_ABORTED (21 | (1UL << (BITS_PER_LONG-1)))
  938. #define EFI_SECURITY_VIOLATION (26 | (1UL << (BITS_PER_LONG-1)))
  939. +#define EFI_IS_ERROR(x) ((x) & (1UL << (BITS_PER_LONG-1)))
  940. +
  941. typedef unsigned long efi_status_t;
  942. typedef u8 efi_bool_t;
  943. typedef u16 efi_char16_t; /* UNICODE character */
  944. @@ -871,6 +873,14 @@ extern int __init efi_setup_pcdp_console(char *);
  945. #define EFI_MEM_ATTR 10 /* Did firmware publish an EFI_MEMORY_ATTRIBUTES table? */
  946. #define EFI_MEM_NO_SOFT_RESERVE 11 /* Is the kernel configured to ignore soft reservations? */
  947. #define EFI_PRESERVE_BS_REGIONS 12 /* Are EFI boot-services memory segments available? */
  948. +#define EFI_SECURE_BOOT 13 /* Are we in Secure Boot mode? */
  949. +
  950. +enum efi_secureboot_mode {
  951. + efi_secureboot_mode_unset,
  952. + efi_secureboot_mode_unknown,
  953. + efi_secureboot_mode_disabled,
  954. + efi_secureboot_mode_enabled,
  955. +};
  956. #ifdef CONFIG_EFI
  957. /*
  958. @@ -882,6 +892,8 @@ static inline bool efi_enabled(int feature)
  959. }
  960. extern void efi_reboot(enum reboot_mode reboot_mode, const char *__unused);
  961. +extern void __init efi_set_secure_boot(enum efi_secureboot_mode mode);
  962. +
  963. bool __pure __efi_soft_reserve_enabled(void);
  964. static inline bool __pure efi_soft_reserve_enabled(void)
  965. @@ -903,6 +915,8 @@ static inline bool efi_enabled(int feature)
  966. static inline void
  967. efi_reboot(enum reboot_mode reboot_mode, const char *__unused) {}
  968. +static inline void efi_set_secure_boot(enum efi_secureboot_mode mode) {}
  969. +
  970. static inline bool efi_soft_reserve_enabled(void)
  971. {
  972. return false;
  973. @@ -917,6 +931,7 @@ static inline void efi_find_mirror(void) {}
  974. #endif
  975. extern int efi_status_to_err(efi_status_t status);
  976. +extern const char *efi_status_to_str(efi_status_t status);
  977. /*
  978. * Variable Attributes
  979. @@ -1133,13 +1148,6 @@ static inline bool efi_runtime_disabled(void) { return true; }
  980. extern void efi_call_virt_check_flags(unsigned long flags, const void *caller);
  981. extern unsigned long efi_call_virt_save_flags(void);
  982. -enum efi_secureboot_mode {
  983. - efi_secureboot_mode_unset,
  984. - efi_secureboot_mode_unknown,
  985. - efi_secureboot_mode_disabled,
  986. - efi_secureboot_mode_enabled,
  987. -};
  988. -
  989. static inline
  990. enum efi_secureboot_mode efi_get_secureboot_mode(efi_get_variable_t *get_var)
  991. {
  992. diff --git a/include/linux/lsm_hook_defs.h b/include/linux/lsm_hook_defs.h
  993. index 2923754c13bc..c374e00db283 100644
  994. --- a/include/linux/lsm_hook_defs.h
  995. +++ b/include/linux/lsm_hook_defs.h
  996. @@ -407,6 +407,8 @@ LSM_HOOK(void, LSM_RET_VOID, bpf_prog_free_security, struct bpf_prog_aux *aux)
  997. #endif /* CONFIG_BPF_SYSCALL */
  998. LSM_HOOK(int, 0, locked_down, enum lockdown_reason what)
  999. +LSM_HOOK(int, 0, lock_kernel_down, const char *where, enum lockdown_reason level)
  1000. +
  1001. #ifdef CONFIG_PERF_EVENTS
  1002. LSM_HOOK(int, 0, perf_event_open, struct perf_event_attr *attr, int type)
  1003. diff --git a/include/linux/module.h b/include/linux/module.h
  1004. index a98e188cf37b..2eef4246c2c9 100644
  1005. --- a/include/linux/module.h
  1006. +++ b/include/linux/module.h
  1007. @@ -418,6 +418,7 @@ struct module {
  1008. struct module_attribute *modinfo_attrs;
  1009. const char *version;
  1010. const char *srcversion;
  1011. + const char *rhelversion;
  1012. struct kobject *holders_dir;
  1013. /* Exported symbols */
  1014. diff --git a/include/linux/rh_kabi.h b/include/linux/rh_kabi.h
  1015. new file mode 100644
  1016. index 000000000000..e0d3353802bb
  1017. --- /dev/null
  1018. +++ b/include/linux/rh_kabi.h
  1019. @@ -0,0 +1,172 @@
  1020. +/*
  1021. + * rh_kabi.h - Red Hat kABI abstraction header
  1022. + *
  1023. + * Copyright (c) 2014 Don Zickus
  1024. + * Copyright (c) 2015-2017 Jiri Benc
  1025. + * Copyright (c) 2015 Sabrina Dubroca, Hannes Frederic Sowa
  1026. + * Copyright (c) 2016-2018 Prarit Bhargava
  1027. + * Copyright (c) 2017 Paolo Abeni, Larry Woodman
  1028. + *
  1029. + * This file is released under the GPLv2.
  1030. + * See the file COPYING for more details.
  1031. + *
  1032. + * These kabi macros hide the changes from the kabi checker and from the
  1033. + * process that computes the exported symbols' checksums.
  1034. + * They have 2 variants: one (defined under __GENKSYMS__) used when
  1035. + * generating the checksums, and the other used when building the kernel's
  1036. + * binaries.
  1037. + *
  1038. + * The use of these macros does not guarantee that the usage and modification
  1039. + * of code is correct. As with all Red Hat only changes, an engineer must
  1040. + * explain why the use of the macro is valid in the patch containing the
  1041. + * changes.
  1042. + *
  1043. + */
  1044. +
  1045. +#ifndef _LINUX_RH_KABI_H
  1046. +#define _LINUX_RH_KABI_H
  1047. +
  1048. +#include <linux/compiler.h>
  1049. +#include <linux/stringify.h>
  1050. +
  1051. +/*
  1052. + * RH_KABI_CONST
  1053. + * Adds a new const modifier to a function parameter preserving the old
  1054. + * checksum.
  1055. + *
  1056. + * RH_KABI_DEPRECATE
  1057. + * Mark the element as deprecated and make it unusable by modules while
  1058. + * preserving kABI checksums.
  1059. + *
  1060. + * RH_KABI_DEPRECATE_FN
  1061. + * Mark the function pointer as deprecated and make it unusable by modules
  1062. + * while preserving kABI checksums.
  1063. + *
  1064. + * RH_KABI_EXTEND
  1065. + * Simple macro for adding a new element to a struct.
  1066. + *
  1067. + * Warning: only use if a hole exists for _all_ arches. Use pahole to verify.
  1068. + *
  1069. + * RH_KABI_FILL_HOLE
  1070. + * Simple macro for filling a hole in a struct.
  1071. + *
  1072. + * RH_KABI_RENAME
  1073. + * Simple macro for renaming an element without changing its type. This
  1074. + * macro can be used in bitfields, for example.
  1075. + *
  1076. + * NOTE: does not include the final ';'
  1077. + *
  1078. + * RH_KABI_REPLACE
  1079. + * Simple replacement of _orig with a union of _orig and _new.
  1080. + *
  1081. + * The RH_KABI_REPLACE* macros attempt to add the ability to use the '_new'
  1082. + * element while preserving size alignment with the '_orig' element.
  1083. + *
  1084. + * The #ifdef __GENKSYMS__ preserves the kABI agreement, while the anonymous
  1085. + * union structure preserves the size alignment (assuming the '_new' element
  1086. + * is not bigger than the '_orig' element).
  1087. + *
  1088. + * RH_KABI_REPLACE_UNSAFE
  1089. + * Unsafe version of RH_KABI_REPLACE. Only use for typedefs.
  1090. + *
  1091. + * RH_KABI_FORCE_CHANGE
  1092. + * Force change of the symbol checksum. The argument of the macro is a
  1093. + * version for cases we need to do this more than once.
  1094. + *
  1095. + * This macro does the opposite: it changes the symbol checksum without
  1096. + * actually changing anything about the exported symbol. It is useful for
  1097. + * symbols that are not whitelisted, we're changing them in an
  1098. + * incompatible way and want to prevent 3rd party modules to silently
  1099. + * corrupt memory. Instead, by changing the symbol checksum, such modules
  1100. + * won't be loaded by the kernel. This macro should only be used as a
  1101. + * last resort when all other KABI workarounds have failed.
  1102. + *
  1103. + * NOTE
  1104. + * Don't use ';' after these macros as it messes up the kABI checker by
  1105. + * changing what the resulting token string looks like. Instead let this
  1106. + * macro add the ';' so it can be properly hidden from the kABI checker
  1107. + * (mainly for RH_KABI_EXTEND, but applied to all macros for uniformity).
  1108. + *
  1109. + */
  1110. +#ifdef __GENKSYMS__
  1111. +
  1112. +# define RH_KABI_CONST
  1113. +# define RH_KABI_EXTEND(_new)
  1114. +# define RH_KABI_FILL_HOLE(_new)
  1115. +# define RH_KABI_FORCE_CHANGE(ver) __attribute__((rh_kabi_change ## ver))
  1116. +# define RH_KABI_RENAME(_orig, _new) _orig
  1117. +
  1118. +# define _RH_KABI_DEPRECATE(_type, _orig) _type _orig
  1119. +# define _RH_KABI_DEPRECATE_FN(_type, _orig, _args...) _type (*_orig)(_args)
  1120. +# define _RH_KABI_REPLACE(_orig, _new) _orig
  1121. +# define _RH_KABI_REPLACE_UNSAFE(_orig, _new) _orig
  1122. +
  1123. +#else
  1124. +
  1125. +# define RH_KABI_ALIGN_WARNING ". Disable CONFIG_RH_KABI_SIZE_ALIGN_CHECKS if debugging."
  1126. +
  1127. +# define RH_KABI_CONST const
  1128. +# define RH_KABI_EXTEND(_new) _new;
  1129. +# define RH_KABI_FILL_HOLE(_new) _new;
  1130. +# define RH_KABI_FORCE_CHANGE(ver)
  1131. +# define RH_KABI_RENAME(_orig, _new) _new
  1132. +
  1133. +
  1134. +#if IS_BUILTIN(CONFIG_RH_KABI_SIZE_ALIGN_CHECKS)
  1135. +# define __RH_KABI_CHECK_SIZE_ALIGN(_orig, _new) \
  1136. + union { \
  1137. + _Static_assert(sizeof(struct{_new;}) <= sizeof(struct{_orig;}), \
  1138. + __FILE__ ":" __stringify(__LINE__) ": " __stringify(_new) " is larger than " __stringify(_orig) RH_KABI_ALIGN_WARNING); \
  1139. + _Static_assert(__alignof__(struct{_new;}) <= __alignof__(struct{_orig;}), \
  1140. + __FILE__ ":" __stringify(__LINE__) ": " __stringify(_orig) " is not aligned the same as " __stringify(_new) RH_KABI_ALIGN_WARNING); \
  1141. + }
  1142. +#else
  1143. +# define __RH_KABI_CHECK_SIZE_ALIGN(_orig, _new)
  1144. +#endif
  1145. +
  1146. +# define _RH_KABI_DEPRECATE(_type, _orig) _type rh_reserved_##_orig
  1147. +# define _RH_KABI_DEPRECATE_FN(_type, _orig, _args...) \
  1148. + _type (* rh_reserved_##_orig)(_args)
  1149. +# define _RH_KABI_REPLACE(_orig, _new) \
  1150. + union { \
  1151. + _new; \
  1152. + struct { \
  1153. + _orig; \
  1154. + } __UNIQUE_ID(rh_kabi_hide); \
  1155. + __RH_KABI_CHECK_SIZE_ALIGN(_orig, _new); \
  1156. + }
  1157. +# define _RH_KABI_REPLACE_UNSAFE(_orig, _new) _new
  1158. +
  1159. +#endif /* __GENKSYMS__ */
  1160. +
  1161. +/* semicolon added wrappers for the RH_KABI_REPLACE macros */
  1162. +# define RH_KABI_DEPRECATE(_type, _orig) _RH_KABI_DEPRECATE(_type, _orig);
  1163. +# define RH_KABI_DEPRECATE_FN(_type, _orig, _args...) \
  1164. + _RH_KABI_DEPRECATE_FN(_type, _orig, _args);
  1165. +# define RH_KABI_REPLACE(_orig, _new) _RH_KABI_REPLACE(_orig, _new);
  1166. +# define RH_KABI_REPLACE_UNSAFE(_orig, _new) _RH_KABI_REPLACE_UNSAFE(_orig, _new);
  1167. +/*
  1168. + * Macro for breaking up a random element into two smaller chunks using an
  1169. + * anonymous struct inside an anonymous union.
  1170. + */
  1171. +# define RH_KABI_REPLACE2(orig, _new1, _new2) RH_KABI_REPLACE(orig, struct{ _new1; _new2;})
  1172. +
  1173. +# define RH_KABI_RESERVE(n) _RH_KABI_RESERVE(n);
  1174. +/*
  1175. + * Simple wrappers to replace standard Red Hat reserved elements.
  1176. + */
  1177. +# define RH_KABI_USE(n, _new) RH_KABI_REPLACE(_RH_KABI_RESERVE(n), _new)
  1178. +/*
  1179. + * Macros for breaking up a reserved element into two smaller chunks using
  1180. + * an anonymous struct inside an anonymous union.
  1181. + */
  1182. +# define RH_KABI_USE2(n, _new1, _new2) RH_KABI_REPLACE(_RH_KABI_RESERVE(n), struct{ _new1; _new2; })
  1183. +
  1184. +/*
  1185. + * We tried to standardize on Red Hat reserved names. These wrappers
  1186. + * leverage those common names making it easier to read and find in the
  1187. + * code.
  1188. + */
  1189. +# define _RH_KABI_RESERVE(n) unsigned long rh_reserved##n
  1190. +
  1191. +#endif /* _LINUX_RH_KABI_H */
  1192. diff --git a/include/linux/rmi.h b/include/linux/rmi.h
  1193. index ab7eea01ab42..fff7c5f737fc 100644
  1194. --- a/include/linux/rmi.h
  1195. +++ b/include/linux/rmi.h
  1196. @@ -364,6 +364,7 @@ struct rmi_driver_data {
  1197. struct rmi4_attn_data attn_data;
  1198. DECLARE_KFIFO(attn_fifo, struct rmi4_attn_data, 16);
  1199. + struct work_struct attn_work;
  1200. };
  1201. int rmi_register_transport_device(struct rmi_transport_dev *xport);
  1202. diff --git a/include/linux/security.h b/include/linux/security.h
  1203. index 4bd0f6fc553e..3214365929b5 100644
  1204. --- a/include/linux/security.h
  1205. +++ b/include/linux/security.h
  1206. @@ -486,6 +486,7 @@ int security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen);
  1207. int security_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen);
  1208. int security_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen);
  1209. int security_locked_down(enum lockdown_reason what);
  1210. +int security_lock_kernel_down(const char *where, enum lockdown_reason level);
  1211. #else /* CONFIG_SECURITY */
  1212. static inline int call_blocking_lsm_notifier(enum lsm_event event, void *data)
  1213. @@ -1404,6 +1405,10 @@ static inline int security_locked_down(enum lockdown_reason what)
  1214. {
  1215. return 0;
  1216. }
  1217. +static inline int security_lock_kernel_down(const char *where, enum lockdown_reason level)
  1218. +{
  1219. + return 0;
  1220. +}
  1221. #endif /* CONFIG_SECURITY */
  1222. #if defined(CONFIG_SECURITY) && defined(CONFIG_WATCH_QUEUE)
  1223. diff --git a/kernel/module/main.c b/kernel/module/main.c
  1224. index b00e31721a73..0f691787fffd 100644
  1225. --- a/kernel/module/main.c
  1226. +++ b/kernel/module/main.c
  1227. @@ -528,6 +528,7 @@ static struct module_attribute modinfo_##field = { \
  1228. MODINFO_ATTR(version);
  1229. MODINFO_ATTR(srcversion);
  1230. +MODINFO_ATTR(rhelversion);
  1231. static struct {
  1232. char name[MODULE_NAME_LEN + 1];
  1233. @@ -980,6 +981,7 @@ struct module_attribute *modinfo_attrs[] = {
  1234. &module_uevent,
  1235. &modinfo_version,
  1236. &modinfo_srcversion,
  1237. + &modinfo_rhelversion,
  1238. &modinfo_initstate,
  1239. &modinfo_coresize,
  1240. #ifdef CONFIG_ARCH_WANTS_MODULES_DATA_IN_VMALLOC
  1241. diff --git a/kernel/module/signing.c b/kernel/module/signing.c
  1242. index a2ff4242e623..f0d2be1ee4f1 100644
  1243. --- a/kernel/module/signing.c
  1244. +++ b/kernel/module/signing.c
  1245. @@ -61,10 +61,17 @@ int mod_verify_sig(const void *mod, struct load_info *info)
  1246. modlen -= sig_len + sizeof(ms);
  1247. info->len = modlen;
  1248. - return verify_pkcs7_signature(mod, modlen, mod + modlen, sig_len,
  1249. + ret = verify_pkcs7_signature(mod, modlen, mod + modlen, sig_len,
  1250. VERIFY_USE_SECONDARY_KEYRING,
  1251. VERIFYING_MODULE_SIGNATURE,
  1252. NULL, NULL);
  1253. + if (ret == -ENOKEY && IS_ENABLED(CONFIG_INTEGRITY_PLATFORM_KEYRING)) {
  1254. + ret = verify_pkcs7_signature(mod, modlen, mod + modlen, sig_len,
  1255. + VERIFY_USE_PLATFORM_KEYRING,
  1256. + VERIFYING_MODULE_SIGNATURE,
  1257. + NULL, NULL);
  1258. + }
  1259. + return ret;
  1260. }
  1261. int module_sig_check(struct load_info *info, int flags)
  1262. diff --git a/scripts/tags.sh b/scripts/tags.sh
  1263. index a70d43723146..56d06b04f752 100755
  1264. --- a/scripts/tags.sh
  1265. +++ b/scripts/tags.sh
  1266. @@ -16,6 +16,8 @@ fi
  1267. ignore="$(echo "$RCS_FIND_IGNORE" | sed 's|\\||g' )"
  1268. # tags and cscope files should also ignore MODVERSION *.mod.c files
  1269. ignore="$ignore ( -name *.mod.c ) -prune -o"
  1270. +# RHEL tags and cscope should also ignore redhat/rpm
  1271. +ignore="$ignore ( -path redhat/rpm ) -prune -o"
  1272. # ignore arbitrary directories
  1273. if [ -n "${IGNORE_DIRS}" ]; then
  1274. diff --git a/security/integrity/platform_certs/load_uefi.c b/security/integrity/platform_certs/load_uefi.c
  1275. index d1fdd113450a..182e8090cfe8 100644
  1276. --- a/security/integrity/platform_certs/load_uefi.c
  1277. +++ b/security/integrity/platform_certs/load_uefi.c
  1278. @@ -74,7 +74,8 @@ static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid,
  1279. return NULL;
  1280. if (*status != EFI_BUFFER_TOO_SMALL) {
  1281. - pr_err("Couldn't get size: 0x%lx\n", *status);
  1282. + pr_err("Couldn't get size: %s (0x%lx)\n",
  1283. + efi_status_to_str(*status), *status);
  1284. return NULL;
  1285. }
  1286. @@ -85,7 +86,8 @@ static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid,
  1287. *status = efi.get_variable(name, guid, NULL, &lsize, db);
  1288. if (*status != EFI_SUCCESS) {
  1289. kfree(db);
  1290. - pr_err("Error reading db var: 0x%lx\n", *status);
  1291. + pr_err("Error reading db var: %s (0x%lx)\n",
  1292. + efi_status_to_str(*status), *status);
  1293. return NULL;
  1294. }
  1295. diff --git a/security/lockdown/Kconfig b/security/lockdown/Kconfig
  1296. index e84ddf484010..d0501353a4b9 100644
  1297. --- a/security/lockdown/Kconfig
  1298. +++ b/security/lockdown/Kconfig
  1299. @@ -16,6 +16,19 @@ config SECURITY_LOCKDOWN_LSM_EARLY
  1300. subsystem is fully initialised. If enabled, lockdown will
  1301. unconditionally be called before any other LSMs.
  1302. +config LOCK_DOWN_IN_EFI_SECURE_BOOT
  1303. + bool "Lock down the kernel in EFI Secure Boot mode"
  1304. + default n
  1305. + depends on EFI && SECURITY_LOCKDOWN_LSM_EARLY
  1306. + help
  1307. + UEFI Secure Boot provides a mechanism for ensuring that the firmware
  1308. + will only load signed bootloaders and kernels. Secure boot mode may
  1309. + be determined from EFI variables provided by the system firmware if
  1310. + not indicated by the boot parameters.
  1311. +
  1312. + Enabling this option results in kernel lockdown being triggered if
  1313. + EFI Secure Boot is set.
  1314. +
  1315. choice
  1316. prompt "Kernel default lockdown mode"
  1317. default LOCK_DOWN_KERNEL_FORCE_NONE
  1318. diff --git a/security/lockdown/lockdown.c b/security/lockdown/lockdown.c
  1319. index 68d19632aeb7..ef348935b6ff 100644
  1320. --- a/security/lockdown/lockdown.c
  1321. +++ b/security/lockdown/lockdown.c
  1322. @@ -73,6 +73,7 @@ static int lockdown_is_locked_down(enum lockdown_reason what)
  1323. static struct security_hook_list lockdown_hooks[] __ro_after_init = {
  1324. LSM_HOOK_INIT(locked_down, lockdown_is_locked_down),
  1325. + LSM_HOOK_INIT(lock_kernel_down, lock_kernel_down),
  1326. };
  1327. static int __init lockdown_lsm_init(void)
  1328. diff --git a/security/security.c b/security/security.c
  1329. index b6144833c7a8..48c70c78a1bd 100644
  1330. --- a/security/security.c
  1331. +++ b/security/security.c
  1332. @@ -5285,6 +5285,18 @@ int security_locked_down(enum lockdown_reason what)
  1333. }
  1334. EXPORT_SYMBOL(security_locked_down);
  1335. +/**
  1336. + * security_lock_kernel_down() - Put the kernel into lock-down mode.
  1337. + *
  1338. + * @where: Where the lock-down is originating from (e.g. command line option)
  1339. + * @level: The lock-down level (can only increase)
  1340. + */
  1341. +int security_lock_kernel_down(const char *where, enum lockdown_reason level)
  1342. +{
  1343. + return call_int_hook(lock_kernel_down, 0, where, level);
  1344. +}
  1345. +EXPORT_SYMBOL(security_lock_kernel_down);
  1346. +
  1347. #ifdef CONFIG_PERF_EVENTS
  1348. /**
  1349. * security_perf_event_open() - Check if a perf event open is allowed
  1350. diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
  1351. index b437beae9b51..b641e5e88a39 100644
  1352. --- a/sound/pci/hda/cs35l41_hda.c
  1353. +++ b/sound/pci/hda/cs35l41_hda.c
  1354. @@ -33,6 +33,9 @@
  1355. #define CAL_AMBIENT_DSP_CTL_NAME "CAL_AMBIENT"
  1356. #define CAL_DSP_CTL_TYPE 5
  1357. #define CAL_DSP_CTL_ALG 205
  1358. +#define CS35L41_UUID "50d90cdc-3de4-4f18-b528-c7fe3b71f40d"
  1359. +#define CS35L41_DSM_GET_MUTE 5
  1360. +#define CS35L41_NOTIFY_EVENT 0x91
  1361. static bool firmware_autostart = 1;
  1362. module_param(firmware_autostart, bool, 0444);
  1363. @@ -563,6 +566,31 @@ static void cs35l41_hda_play_start(struct device *dev)
  1364. }
  1365. +static void cs35l41_mute(struct device *dev, bool mute)
  1366. +{
  1367. + struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
  1368. + struct regmap *reg = cs35l41->regmap;
  1369. +
  1370. + dev_dbg(dev, "Mute(%d:%d) Playback Started: %d\n", mute, cs35l41->mute_override,
  1371. + cs35l41->playback_started);
  1372. +
  1373. + if (cs35l41->playback_started) {
  1374. + if (mute || cs35l41->mute_override) {
  1375. + dev_dbg(dev, "Muting\n");
  1376. + regmap_multi_reg_write(reg, cs35l41_hda_mute, ARRAY_SIZE(cs35l41_hda_mute));
  1377. + } else {
  1378. + dev_dbg(dev, "Unmuting\n");
  1379. + if (cs35l41->firmware_running) {
  1380. + regmap_multi_reg_write(reg, cs35l41_hda_unmute_dsp,
  1381. + ARRAY_SIZE(cs35l41_hda_unmute_dsp));
  1382. + } else {
  1383. + regmap_multi_reg_write(reg, cs35l41_hda_unmute,
  1384. + ARRAY_SIZE(cs35l41_hda_unmute));
  1385. + }
  1386. + }
  1387. + }
  1388. +}
  1389. +
  1390. static void cs35l41_hda_play_done(struct device *dev)
  1391. {
  1392. struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
  1393. @@ -572,13 +600,7 @@ static void cs35l41_hda_play_done(struct device *dev)
  1394. cs35l41_global_enable(dev, reg, cs35l41->hw_cfg.bst_type, 1,
  1395. cs35l41->firmware_running);
  1396. - if (cs35l41->firmware_running) {
  1397. - regmap_multi_reg_write(reg, cs35l41_hda_unmute_dsp,
  1398. - ARRAY_SIZE(cs35l41_hda_unmute_dsp));
  1399. - } else {
  1400. - regmap_multi_reg_write(reg, cs35l41_hda_unmute,
  1401. - ARRAY_SIZE(cs35l41_hda_unmute));
  1402. - }
  1403. + cs35l41_mute(dev, false);
  1404. }
  1405. static void cs35l41_hda_pause_start(struct device *dev)
  1406. @@ -588,7 +610,7 @@ static void cs35l41_hda_pause_start(struct device *dev)
  1407. dev_dbg(dev, "Pause (Start)\n");
  1408. - regmap_multi_reg_write(reg, cs35l41_hda_mute, ARRAY_SIZE(cs35l41_hda_mute));
  1409. + cs35l41_mute(dev, true);
  1410. cs35l41_global_enable(dev, reg, cs35l41->hw_cfg.bst_type, 0,
  1411. cs35l41->firmware_running);
  1412. }
  1413. @@ -1116,6 +1138,53 @@ static int cs35l41_create_controls(struct cs35l41_hda *cs35l41)
  1414. return 0;
  1415. }
  1416. +static bool cs35l41_dsm_supported(acpi_handle handle, unsigned int commands)
  1417. +{
  1418. + guid_t guid;
  1419. +
  1420. + guid_parse(CS35L41_UUID, &guid);
  1421. +
  1422. + return acpi_check_dsm(handle, &guid, 0, BIT(commands));
  1423. +}
  1424. +
  1425. +static int cs35l41_get_acpi_mute_state(struct cs35l41_hda *cs35l41, acpi_handle handle)
  1426. +{
  1427. + guid_t guid;
  1428. + union acpi_object *ret;
  1429. + int mute = -ENODEV;
  1430. +
  1431. + guid_parse(CS35L41_UUID, &guid);
  1432. +
  1433. + if (cs35l41_dsm_supported(handle, CS35L41_DSM_GET_MUTE)) {
  1434. + ret = acpi_evaluate_dsm(handle, &guid, 0, CS35L41_DSM_GET_MUTE, NULL);
  1435. + mute = *ret->buffer.pointer;
  1436. + dev_dbg(cs35l41->dev, "CS35L41_DSM_GET_MUTE: %d\n", mute);
  1437. + }
  1438. +
  1439. + dev_dbg(cs35l41->dev, "%s: %d\n", __func__, mute);
  1440. +
  1441. + return mute;
  1442. +}
  1443. +
  1444. +static void cs35l41_acpi_device_notify(acpi_handle handle, u32 event, struct device *dev)
  1445. +{
  1446. + struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
  1447. + int mute;
  1448. +
  1449. + if (event != CS35L41_NOTIFY_EVENT)
  1450. + return;
  1451. +
  1452. + mute = cs35l41_get_acpi_mute_state(cs35l41, handle);
  1453. + if (mute < 0) {
  1454. + dev_warn(cs35l41->dev, "Unable to retrieve mute state: %d\n", mute);
  1455. + return;
  1456. + }
  1457. +
  1458. + dev_dbg(cs35l41->dev, "Requesting mute value: %d\n", mute);
  1459. + cs35l41->mute_override = (mute > 0);
  1460. + cs35l41_mute(cs35l41->dev, cs35l41->mute_override);
  1461. +}
  1462. +
  1463. static int cs35l41_hda_bind(struct device *dev, struct device *master, void *master_data)
  1464. {
  1465. struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
  1466. @@ -1157,6 +1226,14 @@ static int cs35l41_hda_bind(struct device *dev, struct device *master, void *mas
  1467. comps->playback_hook = cs35l41_hda_playback_hook;
  1468. comps->pre_playback_hook = cs35l41_hda_pre_playback_hook;
  1469. comps->post_playback_hook = cs35l41_hda_post_playback_hook;
  1470. + comps->acpi_notify = cs35l41_acpi_device_notify;
  1471. + comps->adev = cs35l41->dacpi;
  1472. +
  1473. + comps->acpi_notifications_supported = cs35l41_dsm_supported(acpi_device_handle(comps->adev),
  1474. + CS35L41_DSM_GET_MUTE);
  1475. +
  1476. + cs35l41->mute_override = cs35l41_get_acpi_mute_state(cs35l41,
  1477. + acpi_device_handle(cs35l41->dacpi)) > 0;
  1478. mutex_unlock(&cs35l41->fw_mutex);
  1479. @@ -1430,8 +1507,8 @@ static int cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41, const char *hid, i
  1480. return -ENODEV;
  1481. }
  1482. + cs35l41->dacpi = adev;
  1483. physdev = get_device(acpi_get_first_physical_node(adev));
  1484. - acpi_dev_put(adev);
  1485. sub = acpi_get_subsystem_id(ACPI_HANDLE(physdev));
  1486. if (IS_ERR(sub))
  1487. @@ -1541,6 +1618,7 @@ static int cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41, const char *hid, i
  1488. hw_cfg->valid = false;
  1489. hw_cfg->gpio1.valid = false;
  1490. hw_cfg->gpio2.valid = false;
  1491. + acpi_dev_put(cs35l41->dacpi);
  1492. put_physdev:
  1493. put_device(physdev);
  1494. @@ -1644,10 +1722,7 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i
  1495. if (ret)
  1496. goto err;
  1497. - ret = regmap_multi_reg_write(cs35l41->regmap, cs35l41_hda_mute,
  1498. - ARRAY_SIZE(cs35l41_hda_mute));
  1499. - if (ret)
  1500. - goto err;
  1501. + cs35l41_mute(cs35l41->dev, true);
  1502. INIT_WORK(&cs35l41->fw_load_work, cs35l41_fw_load_work);
  1503. mutex_init(&cs35l41->fw_mutex);
  1504. @@ -1684,6 +1759,8 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i
  1505. if (cs35l41_safe_reset(cs35l41->regmap, cs35l41->hw_cfg.bst_type))
  1506. gpiod_set_value_cansleep(cs35l41->reset_gpio, 0);
  1507. gpiod_put(cs35l41->reset_gpio);
  1508. + gpiod_put(cs35l41->cs_gpio);
  1509. + acpi_dev_put(cs35l41->dacpi);
  1510. kfree(cs35l41->acpi_subsystem_id);
  1511. return ret;
  1512. @@ -1703,11 +1780,14 @@ void cs35l41_hda_remove(struct device *dev)
  1513. component_del(cs35l41->dev, &cs35l41_hda_comp_ops);
  1514. + acpi_dev_put(cs35l41->dacpi);
  1515. +
  1516. pm_runtime_put_noidle(cs35l41->dev);
  1517. if (cs35l41_safe_reset(cs35l41->regmap, cs35l41->hw_cfg.bst_type))
  1518. gpiod_set_value_cansleep(cs35l41->reset_gpio, 0);
  1519. gpiod_put(cs35l41->reset_gpio);
  1520. + gpiod_put(cs35l41->cs_gpio);
  1521. kfree(cs35l41->acpi_subsystem_id);
  1522. }
  1523. EXPORT_SYMBOL_NS_GPL(cs35l41_hda_remove, SND_HDA_SCODEC_CS35L41);
  1524. diff --git a/sound/pci/hda/cs35l41_hda.h b/sound/pci/hda/cs35l41_hda.h
  1525. index b93bf762976e..3d925d677213 100644
  1526. --- a/sound/pci/hda/cs35l41_hda.h
  1527. +++ b/sound/pci/hda/cs35l41_hda.h
  1528. @@ -10,6 +10,7 @@
  1529. #ifndef __CS35L41_HDA_H__
  1530. #define __CS35L41_HDA_H__
  1531. +#include <linux/acpi.h>
  1532. #include <linux/efi.h>
  1533. #include <linux/regulator/consumer.h>
  1534. #include <linux/gpio/consumer.h>
  1535. @@ -34,8 +35,8 @@ struct cs35l41_amp_efi_data {
  1536. } __packed;
  1537. enum cs35l41_hda_spk_pos {
  1538. - CS35l41_LEFT,
  1539. - CS35l41_RIGHT,
  1540. + CS35L41_LEFT,
  1541. + CS35L41_RIGHT,
  1542. };
  1543. enum cs35l41_hda_gpio_function {
  1544. @@ -49,6 +50,7 @@ struct cs35l41_hda {
  1545. struct device *dev;
  1546. struct regmap *regmap;
  1547. struct gpio_desc *reset_gpio;
  1548. + struct gpio_desc *cs_gpio;
  1549. struct cs35l41_hw_cfg hw_cfg;
  1550. struct hda_codec *codec;
  1551. @@ -70,6 +72,8 @@ struct cs35l41_hda {
  1552. bool halo_initialized;
  1553. bool playback_started;
  1554. struct cs_dsp cs_dsp;
  1555. + struct acpi_device *dacpi;
  1556. + bool mute_override;
  1557. };
  1558. enum halo_state {
  1559. diff --git a/sound/pci/hda/cs35l41_hda_property.c b/sound/pci/hda/cs35l41_hda_property.c
  1560. index b62a4e6968e2..c9eb70290973 100644
  1561. --- a/sound/pci/hda/cs35l41_hda_property.c
  1562. +++ b/sound/pci/hda/cs35l41_hda_property.c
  1563. @@ -6,9 +6,300 @@
  1564. //
  1565. // Author: Stefan Binding <[email protected]>
  1566. +#include <linux/acpi.h>
  1567. #include <linux/gpio/consumer.h>
  1568. #include <linux/string.h>
  1569. #include "cs35l41_hda_property.h"
  1570. +#include <linux/spi/spi.h>
  1571. +
  1572. +#define MAX_AMPS 4
  1573. +
  1574. +struct cs35l41_config {
  1575. + const char *ssid;
  1576. + enum {
  1577. + SPI,
  1578. + I2C
  1579. + } bus;
  1580. + int num_amps;
  1581. + enum {
  1582. + INTERNAL,
  1583. + EXTERNAL
  1584. + } boost_type;
  1585. + u8 channel[MAX_AMPS];
  1586. + int reset_gpio_index; /* -1 if no reset gpio */
  1587. + int spkid_gpio_index; /* -1 if no spkid gpio */
  1588. + int cs_gpio_index; /* -1 if no cs gpio, or cs-gpios already exists, max num amps == 2 */
  1589. + int boost_ind_nanohenry; /* Required if boost_type == Internal */
  1590. + int boost_peak_milliamp; /* Required if boost_type == Internal */
  1591. + int boost_cap_microfarad; /* Required if boost_type == Internal */
  1592. +};
  1593. +
  1594. +static const struct cs35l41_config cs35l41_config_table[] = {
  1595. +/*
  1596. + * Device 103C89C6 does have _DSD, however it is setup to use the wrong boost type.
  1597. + * We can override the _DSD to correct the boost type here.
  1598. + * Since this laptop has valid ACPI, we do not need to handle cs-gpios, since that already exists
  1599. + * in the ACPI. The Reset GPIO is also valid, so we can use the Reset defined in _DSD.
  1600. + */
  1601. + { "103C89C6", SPI, 2, INTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, 0, 0 }, -1, -1, -1, 1000, 4500, 24 },
  1602. + { "104312AF", SPI, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
  1603. + { "10431433", I2C, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
  1604. + { "10431463", I2C, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
  1605. + { "10431473", SPI, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 1000, 4500, 24 },
  1606. + { "10431483", SPI, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 1000, 4500, 24 },
  1607. + { "10431493", SPI, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
  1608. + { "104314D3", SPI, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
  1609. + { "104314E3", I2C, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
  1610. + { "10431503", I2C, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
  1611. + { "10431533", I2C, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
  1612. + { "10431573", SPI, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
  1613. + { "10431663", SPI, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 1000, 4500, 24 },
  1614. + { "104316D3", SPI, 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 0, 0, 0 },
  1615. + { "104316F3", SPI, 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 0, 0, 0 },
  1616. + { "104317F3", I2C, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
  1617. + { "10431863", SPI, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
  1618. + { "104318D3", I2C, 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
  1619. + { "10431C9F", SPI, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
  1620. + { "10431CAF", SPI, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
  1621. + { "10431CCF", SPI, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
  1622. + { "10431CDF", SPI, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
  1623. + { "10431CEF", SPI, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
  1624. + { "10431D1F", I2C, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
  1625. + { "10431DA2", SPI, 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 0, 0, 0 },
  1626. + { "10431E02", SPI, 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 0, 0, 0 },
  1627. + { "10431EE2", I2C, 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
  1628. + { "10431F12", I2C, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
  1629. + { "10431F1F", SPI, 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 0, 0, 0 },
  1630. + { "10431F62", SPI, 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 0, 0, 0 },
  1631. + {}
  1632. +};
  1633. +
  1634. +static int cs35l41_add_gpios(struct cs35l41_hda *cs35l41, struct device *physdev, int reset_gpio,
  1635. + int spkid_gpio, int cs_gpio_index, int num_amps)
  1636. +{
  1637. + struct acpi_gpio_mapping *gpio_mapping;
  1638. + struct acpi_gpio_params *reset_gpio_params;
  1639. + struct acpi_gpio_params *spkid_gpio_params;
  1640. + struct acpi_gpio_params *cs_gpio_params;
  1641. + unsigned int num_entries = 0;
  1642. + unsigned int reset_index, spkid_index, csgpio_index;
  1643. + int i;
  1644. +
  1645. + /*
  1646. + * GPIO Mapping only needs to be done once, since it would be available for subsequent amps
  1647. + */
  1648. + if (cs35l41->dacpi->driver_gpios)
  1649. + return 0;
  1650. +
  1651. + if (reset_gpio >= 0) {
  1652. + reset_index = num_entries;
  1653. + num_entries++;
  1654. + }
  1655. +
  1656. + if (spkid_gpio >= 0) {
  1657. + spkid_index = num_entries;
  1658. + num_entries++;
  1659. + }
  1660. +
  1661. + if ((cs_gpio_index >= 0) && (num_amps == 2)) {
  1662. + csgpio_index = num_entries;
  1663. + num_entries++;
  1664. + }
  1665. +
  1666. + if (!num_entries)
  1667. + return 0;
  1668. +
  1669. + /* must include termination entry */
  1670. + num_entries++;
  1671. +
  1672. + gpio_mapping = devm_kcalloc(physdev, num_entries, sizeof(struct acpi_gpio_mapping),
  1673. + GFP_KERNEL);
  1674. +
  1675. + if (!gpio_mapping)
  1676. + goto err;
  1677. +
  1678. + if (reset_gpio >= 0) {
  1679. + gpio_mapping[reset_index].name = "reset-gpios";
  1680. + reset_gpio_params = devm_kcalloc(physdev, num_amps, sizeof(struct acpi_gpio_params),
  1681. + GFP_KERNEL);
  1682. + if (!reset_gpio_params)
  1683. + goto err;
  1684. +
  1685. + for (i = 0; i < num_amps; i++)
  1686. + reset_gpio_params[i].crs_entry_index = reset_gpio;
  1687. +
  1688. + gpio_mapping[reset_index].data = reset_gpio_params;
  1689. + gpio_mapping[reset_index].size = num_amps;
  1690. + }
  1691. +
  1692. + if (spkid_gpio >= 0) {
  1693. + gpio_mapping[spkid_index].name = "spk-id-gpios";
  1694. + spkid_gpio_params = devm_kcalloc(physdev, num_amps, sizeof(struct acpi_gpio_params),
  1695. + GFP_KERNEL);
  1696. + if (!spkid_gpio_params)
  1697. + goto err;
  1698. +
  1699. + for (i = 0; i < num_amps; i++)
  1700. + spkid_gpio_params[i].crs_entry_index = spkid_gpio;
  1701. +
  1702. + gpio_mapping[spkid_index].data = spkid_gpio_params;
  1703. + gpio_mapping[spkid_index].size = num_amps;
  1704. + }
  1705. +
  1706. + if ((cs_gpio_index >= 0) && (num_amps == 2)) {
  1707. + gpio_mapping[csgpio_index].name = "cs-gpios";
  1708. + /* only one GPIO CS is supported without using _DSD, obtained using index 0 */
  1709. + cs_gpio_params = devm_kzalloc(physdev, sizeof(struct acpi_gpio_params), GFP_KERNEL);
  1710. + if (!cs_gpio_params)
  1711. + goto err;
  1712. +
  1713. + cs_gpio_params->crs_entry_index = cs_gpio_index;
  1714. +
  1715. + gpio_mapping[csgpio_index].data = cs_gpio_params;
  1716. + gpio_mapping[csgpio_index].size = 1;
  1717. + }
  1718. +
  1719. + return devm_acpi_dev_add_driver_gpios(physdev, gpio_mapping);
  1720. +err:
  1721. + devm_kfree(physdev, gpio_mapping);
  1722. + devm_kfree(physdev, reset_gpio_params);
  1723. + devm_kfree(physdev, spkid_gpio_params);
  1724. + devm_kfree(physdev, cs_gpio_params);
  1725. + return -ENOMEM;
  1726. +}
  1727. +
  1728. +static int generic_dsd_config(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
  1729. + const char *hid)
  1730. +{
  1731. + struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg;
  1732. + const struct cs35l41_config *cfg;
  1733. + struct gpio_desc *cs_gpiod;
  1734. + struct spi_device *spi;
  1735. + bool dsd_found;
  1736. + int ret;
  1737. +
  1738. + for (cfg = cs35l41_config_table; cfg->ssid; cfg++) {
  1739. + if (!strcasecmp(cfg->ssid, cs35l41->acpi_subsystem_id))
  1740. + break;
  1741. + }
  1742. +
  1743. + if (!cfg->ssid)
  1744. + return -ENOENT;
  1745. +
  1746. + if (!cs35l41->dacpi || cs35l41->dacpi != ACPI_COMPANION(physdev)) {
  1747. + dev_err(cs35l41->dev, "ACPI Device does not match, cannot override _DSD.\n");
  1748. + return -ENODEV;
  1749. + }
  1750. +
  1751. + dev_info(cs35l41->dev, "Adding DSD properties for %s\n", cs35l41->acpi_subsystem_id);
  1752. +
  1753. + dsd_found = acpi_dev_has_props(cs35l41->dacpi);
  1754. +
  1755. + if (!dsd_found) {
  1756. + ret = cs35l41_add_gpios(cs35l41, physdev, cfg->reset_gpio_index,
  1757. + cfg->spkid_gpio_index, cfg->cs_gpio_index,
  1758. + cfg->num_amps);
  1759. + if (ret) {
  1760. + dev_err(cs35l41->dev, "Error adding GPIO mapping: %d\n", ret);
  1761. + return ret;
  1762. + }
  1763. + } else if (cfg->reset_gpio_index >= 0 || cfg->spkid_gpio_index >= 0) {
  1764. + dev_warn(cs35l41->dev, "Cannot add Reset/Speaker ID/SPI CS GPIO Mapping, "
  1765. + "_DSD already exists.\n");
  1766. + }
  1767. +
  1768. + if (cfg->bus == SPI) {
  1769. + cs35l41->index = id;
  1770. + /*
  1771. + * Manually set the Chip Select for the second amp <cs_gpio_index> in the node.
  1772. + * This is only supported for systems with 2 amps, since we cannot expand the
  1773. + * default number of chip selects without using cs-gpios
  1774. + * The CS GPIO must be set high prior to communicating with the first amp (which
  1775. + * uses a native chip select), to ensure the second amp does not clash with the
  1776. + * first.
  1777. + */
  1778. + if (cfg->cs_gpio_index >= 0) {
  1779. + spi = to_spi_device(cs35l41->dev);
  1780. +
  1781. + if (cfg->num_amps != 2) {
  1782. + dev_warn(cs35l41->dev,
  1783. + "Cannot update SPI CS, Number of Amps (%d) != 2\n",
  1784. + cfg->num_amps);
  1785. + } else if (dsd_found) {
  1786. + dev_warn(cs35l41->dev,
  1787. + "Cannot update SPI CS, _DSD already exists.\n");
  1788. + } else {
  1789. + /*
  1790. + * This is obtained using driver_gpios, since only one GPIO for CS
  1791. + * exists, this can be obtained using index 0.
  1792. + */
  1793. + cs_gpiod = gpiod_get_index(physdev, "cs", 0, GPIOD_OUT_LOW);
  1794. + if (IS_ERR(cs_gpiod)) {
  1795. + dev_err(cs35l41->dev,
  1796. + "Unable to get Chip Select GPIO descriptor\n");
  1797. + return PTR_ERR(cs_gpiod);
  1798. + }
  1799. + if (id == 1) {
  1800. + spi_set_csgpiod(spi, 0, cs_gpiod);
  1801. + cs35l41->cs_gpio = cs_gpiod;
  1802. + } else {
  1803. + gpiod_set_value_cansleep(cs_gpiod, true);
  1804. + gpiod_put(cs_gpiod);
  1805. + }
  1806. + spi_setup(spi);
  1807. + }
  1808. + }
  1809. + } else {
  1810. + if (cfg->num_amps > 2)
  1811. + /*
  1812. + * i2c addresses for 3/4 amps are used in order: 0x40, 0x41, 0x42, 0x43,
  1813. + * subtracting 0x40 would give zero-based index
  1814. + */
  1815. + cs35l41->index = id - 0x40;
  1816. + else
  1817. + /* i2c addr 0x40 for first amp (always), 0x41/0x42 for 2nd amp */
  1818. + cs35l41->index = id == 0x40 ? 0 : 1;
  1819. + }
  1820. +
  1821. + if (cfg->num_amps == 3)
  1822. + /* 3 amps means a center channel, so no duplicate channels */
  1823. + cs35l41->channel_index = 0;
  1824. + else
  1825. + /*
  1826. + * if 4 amps, there are duplicate channels, so they need different indexes
  1827. + * if 2 amps, no duplicate channels, channel_index would be 0
  1828. + */
  1829. + cs35l41->channel_index = cs35l41->index / 2;
  1830. +
  1831. + cs35l41->reset_gpio = fwnode_gpiod_get_index(acpi_fwnode_handle(cs35l41->dacpi), "reset",
  1832. + cs35l41->index, GPIOD_OUT_LOW,
  1833. + "cs35l41-reset");
  1834. + cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, cs35l41->index, cfg->num_amps, -1);
  1835. +
  1836. + hw_cfg->spk_pos = cfg->channel[cs35l41->index];
  1837. +
  1838. + if (cfg->boost_type == INTERNAL) {
  1839. + hw_cfg->bst_type = CS35L41_INT_BOOST;
  1840. + hw_cfg->bst_ind = cfg->boost_ind_nanohenry;
  1841. + hw_cfg->bst_ipk = cfg->boost_peak_milliamp;
  1842. + hw_cfg->bst_cap = cfg->boost_cap_microfarad;
  1843. + hw_cfg->gpio1.func = CS35L41_NOT_USED;
  1844. + hw_cfg->gpio1.valid = true;
  1845. + } else {
  1846. + hw_cfg->bst_type = CS35L41_EXT_BOOST;
  1847. + hw_cfg->bst_ind = -1;
  1848. + hw_cfg->bst_ipk = -1;
  1849. + hw_cfg->bst_cap = -1;
  1850. + hw_cfg->gpio1.func = CS35l41_VSPK_SWITCH;
  1851. + hw_cfg->gpio1.valid = true;
  1852. + }
  1853. +
  1854. + hw_cfg->gpio2.func = CS35L41_INTERRUPT;
  1855. + hw_cfg->gpio2.valid = true;
  1856. + hw_cfg->valid = true;
  1857. +
  1858. + return 0;
  1859. +}
  1860. /*
  1861. * Device CLSA010(0/1) doesn't have _DSD so a gpiod_get by the label reset won't work.
  1862. @@ -43,37 +334,6 @@ static int lenovo_legion_no_acpi(struct cs35l41_hda *cs35l41, struct device *phy
  1863. return 0;
  1864. }
  1865. -/*
  1866. - * Device 103C89C6 does have _DSD, however it is setup to use the wrong boost type.
  1867. - * We can override the _DSD to correct the boost type here.
  1868. - * Since this laptop has valid ACPI, we do not need to handle cs-gpios, since that already exists
  1869. - * in the ACPI.
  1870. - */
  1871. -static int hp_vision_acpi_fix(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
  1872. - const char *hid)
  1873. -{
  1874. - struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg;
  1875. -
  1876. - dev_info(cs35l41->dev, "Adding DSD properties for %s\n", cs35l41->acpi_subsystem_id);
  1877. -
  1878. - cs35l41->index = id;
  1879. - cs35l41->channel_index = 0;
  1880. - cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 1, GPIOD_OUT_HIGH);
  1881. - cs35l41->speaker_id = -ENOENT;
  1882. - hw_cfg->spk_pos = cs35l41->index ? 1 : 0; // right:left
  1883. - hw_cfg->gpio1.func = CS35L41_NOT_USED;
  1884. - hw_cfg->gpio1.valid = true;
  1885. - hw_cfg->gpio2.func = CS35L41_INTERRUPT;
  1886. - hw_cfg->gpio2.valid = true;
  1887. - hw_cfg->bst_type = CS35L41_INT_BOOST;
  1888. - hw_cfg->bst_ind = 1000;
  1889. - hw_cfg->bst_ipk = 4500;
  1890. - hw_cfg->bst_cap = 24;
  1891. - hw_cfg->valid = true;
  1892. -
  1893. - return 0;
  1894. -}
  1895. -
  1896. struct cs35l41_prop_model {
  1897. const char *hid;
  1898. const char *ssid;
  1899. @@ -84,7 +344,36 @@ struct cs35l41_prop_model {
  1900. static const struct cs35l41_prop_model cs35l41_prop_model_table[] = {
  1901. { "CLSA0100", NULL, lenovo_legion_no_acpi },
  1902. { "CLSA0101", NULL, lenovo_legion_no_acpi },
  1903. - { "CSC3551", "103C89C6", hp_vision_acpi_fix },
  1904. + { "CSC3551", "103C89C6", generic_dsd_config },
  1905. + { "CSC3551", "104312AF", generic_dsd_config },
  1906. + { "CSC3551", "10431433", generic_dsd_config },
  1907. + { "CSC3551", "10431463", generic_dsd_config },
  1908. + { "CSC3551", "10431473", generic_dsd_config },
  1909. + { "CSC3551", "10431483", generic_dsd_config },
  1910. + { "CSC3551", "10431493", generic_dsd_config },
  1911. + { "CSC3551", "104314D3", generic_dsd_config },
  1912. + { "CSC3551", "104314E3", generic_dsd_config },
  1913. + { "CSC3551", "10431503", generic_dsd_config },
  1914. + { "CSC3551", "10431533", generic_dsd_config },
  1915. + { "CSC3551", "10431573", generic_dsd_config },
  1916. + { "CSC3551", "10431663", generic_dsd_config },
  1917. + { "CSC3551", "104316D3", generic_dsd_config },
  1918. + { "CSC3551", "104316F3", generic_dsd_config },
  1919. + { "CSC3551", "104317F3", generic_dsd_config },
  1920. + { "CSC3551", "10431863", generic_dsd_config },
  1921. + { "CSC3551", "104318D3", generic_dsd_config },
  1922. + { "CSC3551", "10431C9F", generic_dsd_config },
  1923. + { "CSC3551", "10431CAF", generic_dsd_config },
  1924. + { "CSC3551", "10431CCF", generic_dsd_config },
  1925. + { "CSC3551", "10431CDF", generic_dsd_config },
  1926. + { "CSC3551", "10431CEF", generic_dsd_config },
  1927. + { "CSC3551", "10431D1F", generic_dsd_config },
  1928. + { "CSC3551", "10431DA2", generic_dsd_config },
  1929. + { "CSC3551", "10431E02", generic_dsd_config },
  1930. + { "CSC3551", "10431EE2", generic_dsd_config },
  1931. + { "CSC3551", "10431F12", generic_dsd_config },
  1932. + { "CSC3551", "10431F1F", generic_dsd_config },
  1933. + { "CSC3551", "10431F62", generic_dsd_config },
  1934. {}
  1935. };
  1936. @@ -97,7 +386,7 @@ int cs35l41_add_dsd_properties(struct cs35l41_hda *cs35l41, struct device *physd
  1937. if (!strcmp(model->hid, hid) &&
  1938. (!model->ssid ||
  1939. (cs35l41->acpi_subsystem_id &&
  1940. - !strcmp(model->ssid, cs35l41->acpi_subsystem_id))))
  1941. + !strcasecmp(model->ssid, cs35l41->acpi_subsystem_id))))
  1942. return model->add_prop(cs35l41, physdev, id, hid);
  1943. }
  1944. diff --git a/sound/pci/hda/hda_component.h b/sound/pci/hda/hda_component.h
  1945. index f170aec967c1..bbd6f0ed16c1 100644
  1946. --- a/sound/pci/hda/hda_component.h
  1947. +++ b/sound/pci/hda/hda_component.h
  1948. @@ -6,6 +6,7 @@
  1949. * Cirrus Logic International Semiconductor Ltd.
  1950. */
  1951. +#include <linux/acpi.h>
  1952. #include <linux/component.h>
  1953. #define HDA_MAX_COMPONENTS 4
  1954. @@ -15,6 +16,9 @@ struct hda_component {
  1955. struct device *dev;
  1956. char name[HDA_MAX_NAME_SIZE];
  1957. struct hda_codec *codec;
  1958. + struct acpi_device *adev;
  1959. + bool acpi_notifications_supported;
  1960. + void (*acpi_notify)(acpi_handle handle, u32 event, struct device *dev);
  1961. void (*pre_playback_hook)(struct device *dev, int action);
  1962. void (*playback_hook)(struct device *dev, int action);
  1963. void (*post_playback_hook)(struct device *dev, int action);
  1964. diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
  1965. index 07e1547fff2e..beea19839508 100644
  1966. --- a/sound/pci/hda/patch_realtek.c
  1967. +++ b/sound/pci/hda/patch_realtek.c
  1968. @@ -10042,23 +10042,29 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
  1969. SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
  1970. SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
  1971. SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
  1972. - SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650P", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
  1973. - SND_PCI_QUIRK(0x1043, 0x1463, "Asus GA402X", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
  1974. - SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604V", ALC285_FIXUP_ASUS_HEADSET_MIC),
  1975. - SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603V", ALC285_FIXUP_ASUS_HEADSET_MIC),
  1976. - SND_PCI_QUIRK(0x1043, 0x1493, "ASUS GV601V", ALC285_FIXUP_ASUS_HEADSET_MIC),
  1977. + SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650PY/PZ/PV/PU/PYV/PZV/PIV/PVV", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
  1978. + SND_PCI_QUIRK(0x1043, 0x1463, "Asus GA402X/GA402N", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
  1979. + SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604VI/VC/VE/VG/VJ/VQ/VU/VV/VY/VZ", ALC285_FIXUP_ASUS_HEADSET_MIC),
  1980. + SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603VQ/VU/VV/VJ/VI", ALC285_FIXUP_ASUS_HEADSET_MIC),
  1981. + SND_PCI_QUIRK(0x1043, 0x1493, "ASUS GV601VV/VU/VJ/VQ/VI", ALC285_FIXUP_ASUS_HEADSET_MIC),
  1982. + SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G614JY/JZ/JG", ALC245_FIXUP_CS35L41_SPI_2),
  1983. + SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS G513PI/PU/PV", ALC287_FIXUP_CS35L41_I2C_2),
  1984. + SND_PCI_QUIRK(0x1043, 0x1503, "ASUS G733PY/PZ/PZV/PYV", ALC287_FIXUP_CS35L41_I2C_2),
  1985. SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
  1986. - SND_PCI_QUIRK(0x1043, 0x1533, "ASUS GV302XA", ALC287_FIXUP_CS35L41_I2C_2),
  1987. - SND_PCI_QUIRK(0x1043, 0x1573, "ASUS GZ301V", ALC285_FIXUP_ASUS_HEADSET_MIC),
  1988. + SND_PCI_QUIRK(0x1043, 0x1533, "ASUS GV302XA/XJ/XQ/XU/XV/XI", ALC287_FIXUP_CS35L41_I2C_2),
  1989. + SND_PCI_QUIRK(0x1043, 0x1573, "ASUS GZ301VV/VQ/VU/VJ/VA/VC/VE/VVC/VQC/VUC/VJC/VEC/VCC", ALC285_FIXUP_ASUS_HEADSET_MIC),
  1990. SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
  1991. - SND_PCI_QUIRK(0x1043, 0x1663, "ASUS GU603ZV", ALC285_FIXUP_ASUS_HEADSET_MIC),
  1992. + SND_PCI_QUIRK(0x1043, 0x1663, "ASUS GU603ZI/ZJ/ZQ/ZU/ZV", ALC285_FIXUP_ASUS_HEADSET_MIC),
  1993. SND_PCI_QUIRK(0x1043, 0x1683, "ASUS UM3402YAR", ALC287_FIXUP_CS35L41_I2C_2),
  1994. SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS UX3402VA", ALC245_FIXUP_CS35L41_SPI_2),
  1995. SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
  1996. + SND_PCI_QUIRK(0x1043, 0x16d3, "ASUS UX5304VA", ALC245_FIXUP_CS35L41_SPI_2),
  1997. SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
  1998. + SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS UX7602VI/BZ", ALC245_FIXUP_CS35L41_SPI_2),
  1999. SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
  2000. SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
  2001. - SND_PCI_QUIRK(0x1043, 0x17f3, "ROG Ally RC71L_RC71L", ALC294_FIXUP_ASUS_ALLY),
  2002. + SND_PCI_QUIRK(0x1043, 0x17f3, "ROG Ally NR2301L/X", ALC294_FIXUP_ASUS_ALLY),
  2003. + SND_PCI_QUIRK(0x1043, 0x1863, "ASUS UX6404VI/VV", ALC245_FIXUP_CS35L41_SPI_2),
  2004. SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
  2005. SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
  2006. SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC294_FIXUP_CS35L41_I2C_2),
  2007. @@ -10083,10 +10089,13 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
  2008. SND_PCI_QUIRK(0x1043, 0x1c43, "ASUS UX8406MA", ALC245_FIXUP_CS35L41_SPI_2),
  2009. SND_PCI_QUIRK(0x1043, 0x1c62, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
  2010. SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
  2011. - SND_PCI_QUIRK(0x1043, 0x1c9f, "ASUS G614JI", ALC285_FIXUP_ASUS_HEADSET_MIC),
  2012. - SND_PCI_QUIRK(0x1043, 0x1caf, "ASUS G634JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
  2013. + SND_PCI_QUIRK(0x1043, 0x1c9f, "ASUS G614JU/JV/JI", ALC285_FIXUP_ASUS_HEADSET_MIC),
  2014. + SND_PCI_QUIRK(0x1043, 0x1caf, "ASUS G634JY/JZ/JI/JG", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
  2015. SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
  2016. - SND_PCI_QUIRK(0x1043, 0x1d1f, "ASUS ROG Strix G17 2023 (G713PV)", ALC287_FIXUP_CS35L41_I2C_2),
  2017. + SND_PCI_QUIRK(0x1043, 0x1ccf, "ASUS G814JU/JV/JI", ALC245_FIXUP_CS35L41_SPI_2),
  2018. + SND_PCI_QUIRK(0x1043, 0x1cdf, "ASUS G814JY/JZ/JG", ALC245_FIXUP_CS35L41_SPI_2),
  2019. + SND_PCI_QUIRK(0x1043, 0x1cef, "ASUS G834JY/JZ/JI/JG", ALC285_FIXUP_ASUS_HEADSET_MIC),
  2020. + SND_PCI_QUIRK(0x1043, 0x1d1f, "ASUS G713PI/PU/PV/PVN", ALC287_FIXUP_CS35L41_I2C_2),
  2021. SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
  2022. SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
  2023. SND_PCI_QUIRK(0x1043, 0x1da2, "ASUS UP6502ZA/ZD", ALC245_FIXUP_CS35L41_SPI_2),
  2024. @@ -10100,6 +10109,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
  2025. SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
  2026. SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
  2027. SND_PCI_QUIRK(0x1043, 0x1f12, "ASUS UM5302", ALC287_FIXUP_CS35L41_I2C_2),
  2028. + SND_PCI_QUIRK(0x1043, 0x1f1f, "ASUS H7604JI/JV/J3D", ALC245_FIXUP_CS35L41_SPI_2),
  2029. SND_PCI_QUIRK(0x1043, 0x1f62, "ASUS UX7602ZM", ALC245_FIXUP_CS35L41_SPI_2),
  2030. SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401),
  2031. SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
  2032. --
  2033. 2.46.2