850-v5.17-0002-PCI-pci-bridge-emul-Add-definitions-for-missing-capa.patch 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. From 8ea673a8b30b4a32516b8adabb15e2a68ff02ec8 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]>
  3. Date: Tue, 30 Nov 2021 18:29:04 +0100
  4. Subject: [PATCH] PCI: pci-bridge-emul: Add definitions for missing
  5. capabilities registers
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. pci-bridge-emul driver already allocates buffer for capabilities up to the
  10. PCI_EXP_SLTSTA2 register, but does not define bit access behavior for these
  11. registers. Add these missing definitions.
  12. Link: https://lore.kernel.org/r/[email protected]
  13. Signed-off-by: Pali Rohár <[email protected]>
  14. Signed-off-by: Marek Behún <[email protected]>
  15. Signed-off-by: Lorenzo Pieralisi <[email protected]>
  16. ---
  17. drivers/pci/pci-bridge-emul.c | 43 +++++++++++++++++++++++++++++++++++
  18. 1 file changed, 43 insertions(+)
  19. --- a/drivers/pci/pci-bridge-emul.c
  20. +++ b/drivers/pci/pci-bridge-emul.c
  21. @@ -251,6 +251,49 @@ struct pci_bridge_reg_behavior pcie_cap_
  22. .ro = GENMASK(15, 0) | PCI_EXP_RTSTA_PENDING,
  23. .w1c = PCI_EXP_RTSTA_PME,
  24. },
  25. +
  26. + [PCI_EXP_DEVCAP2 / 4] = {
  27. + /*
  28. + * Device capabilities 2 register has reserved bits [30:27].
  29. + * Also bits [26:24] are reserved for non-upstream ports.
  30. + */
  31. + .ro = BIT(31) | GENMASK(23, 0),
  32. + },
  33. +
  34. + [PCI_EXP_DEVCTL2 / 4] = {
  35. + /*
  36. + * Device control 2 register is RW. Bit 11 is reserved for
  37. + * non-upstream ports.
  38. + *
  39. + * Device status 2 register is reserved.
  40. + */
  41. + .rw = GENMASK(15, 12) | GENMASK(10, 0),
  42. + },
  43. +
  44. + [PCI_EXP_LNKCAP2 / 4] = {
  45. + /* Link capabilities 2 register has reserved bits [30:25] and 0. */
  46. + .ro = BIT(31) | GENMASK(24, 1),
  47. + },
  48. +
  49. + [PCI_EXP_LNKCTL2 / 4] = {
  50. + /*
  51. + * Link control 2 register is RW.
  52. + *
  53. + * Link status 2 register has bits 5, 15 W1C;
  54. + * bits 10, 11 reserved and others are RO.
  55. + */
  56. + .rw = GENMASK(15, 0),
  57. + .w1c = (BIT(15) | BIT(5)) << 16,
  58. + .ro = (GENMASK(14, 12) | GENMASK(9, 6) | GENMASK(4, 0)) << 16,
  59. + },
  60. +
  61. + [PCI_EXP_SLTCAP2 / 4] = {
  62. + /* Slot capabilities 2 register is reserved. */
  63. + },
  64. +
  65. + [PCI_EXP_SLTCTL2 / 4] = {
  66. + /* Both Slot control 2 and Slot status 2 registers are reserved. */
  67. + },
  68. };
  69. /*