Repository navigation
Conversation
Port 0 on T8010 keeps CLKREQ# configured as a software GPIO input (clkreq-gpios) rather than hardware PCIe CLKREQ# pinmux, so the storage link cannot enter PCIe L1 PM Substates (L1.1/L1.2) safely. Add aspm-no-l1ss to the shared T8010 storage root port node so the PCIe ASPM core enforces this restriction from enumeration onward (including under pcie_aspm.policy=powersupersave), while still allowing ASPM L1. Assisted-by: LLM Signed-off-by: Grier Johnson <grier@scooterfarm.com>
Apple S3E (ANS) NVMe controllers (106b:2002) advertise an L1 acceptable latency of <32us (0x5) in DevCap while pairing exclusively with Apple H8/H9 root ports that report <64us (0x6) L1 exit latency. Because 64us exceeds 32us, pcie_aspm_check_latency() strips PCIE_LINK_STATE_L1 and leaves the storage link stuck in L0 on Apple H8/H9 boards whose storage port allows ASPM L1 (T8010 and T8011; S800x boards explicitly opt out via aspm-no-l1 in devicetree). Override DevCap L1 acceptable latency via the existing aspm_l1_acceptable_latency() quirk, allowing ASPM L1 to be enabled. Assisted-by: LLM Signed-off-by: Grier Johnson <grier@scooterfarm.com>
On Apple T8011 (A10X), the storage root port pinmuxes CLKREQ# to the PCIe controller and permits REFCLK gating, so the Apple S3E NVMe link supports PCIe L1 PM Substates (L1.1 and L1.2). Previously, nvme_pci_apple_ans_config() overwrote PCI_L1SS_CTL2 with 0 and PCI_L1SS_CTL1 with the enable bits cleared, clobbering the L1.2 timing parameters computed by the PCIe ASPM core during enumeration, and devicetree ASPM defaults only enable L0s/L1. Add an l1ss_enable flag to struct apple_ans_host (enabled on T8011 and J120, kept off on S8000/S8001/S8003 where REFCLK gating is disabled and on T8010 where port 0 CLKREQ# stays in software GPIO mode). When set, leave the ASPM core's L1SS timing registers intact in nvme_pci_apple_ans_config() and request L1 + L1.1/L1.2 via pci_enable_link_state() in nvme_pci_apple_ans_init() (and explicitly disable L1SS when l1ss_enable is false). Doing this once synchronously during probe ensures it runs before pci_enable_device_mem() applies ASPM policy (protecting older T8010 DTBs without aspm-no-l1ss) and outside reset_work (avoiding pci_bus_sem recursion under AER recovery), while nvme_pci_enable() subsequently saves the resulting PCI config state for suspend/resume. Assisted-by: LLM Signed-off-by: Grier Johnson <grier@scooterfarm.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enable PCIe ASPM L1 on Apple S3E (ANS) NVMe links (
106b:2002) and PCIe L1 PM Substates (L1.1/L1.2) on T8011 (A10X) storage links, cutting ~330 mW of continuous idle power draw on J207.Root Cause
DevCapacceptable latency: Apple S3E NVMe (106b:2002) advertisesDevCapL1 acceptable latency<32us(0x5) while its paired Apple H8/H9 root ports (106b:1009) reportLnkCapL1 exit latency<64us(0x6).pcie_aspm_check_latency()stripsPCIE_LINK_STATE_L1, leaving the link stuck in L0 on every Apple S3E board.nvme_pci_apple_ans_config()overwrotePCI_L1SS_CTL2 = 0(T_POWER_ON = 0us) andPCI_L1SS_CTL1with enable bits cleared (wipingaspm_calc_l12_info()'s programmed timings), and Devicetree ASPM defaults only enable L0s/L1.Changes
arch/arm64/boot/dts/apple/t8010.dtsi: Addaspm-no-l1ss;to the shared T8010pci@0,0storage root port node (ordered before the latency quirk for clean bisection), since T8010 keeps port 0CLKREQ#in software GPIO input mode (clkreq-gpios) rather than hardware PCIe pinmux. (s8000.dtsi,s8001.dtsi, ands8003.dtsialready carryaspm-no-l0s; aspm-no-l1;.)drivers/pci/quirks.c: OverrideDevCapL1 acceptable latency for Apple S3E NVMe (106b:2002) via the existingaspm_l1_acceptable_latency()quirk, enabling ASPM L1 on T8010 and T8011.drivers/nvme/host/pci-apple-ans.c: Addl1ss_enabletostruct apple_ans_host:apple_ans_host_t8011andapple_ans_host_j120(where port 0CLKREQ#is hardware-pinmuxed to the PCIe controller andREFCLKgating is permitted).s8000/s8001/s8003(S8003_RC_PORT_PWR_REFCLK_NOGATE) andt8010(clkreq-gpios).l1ss_enableis true, preserve the ASPM core'sPCI_L1SS_CTL1/CTL2timing registers innvme_pci_apple_ans_config()and callpci_enable_link_state()for L1 + L1.1/L1.2 (ASPM + PCI-PM) once synchronously innvme_pci_apple_ans_init()(outsidereset_workto avoidpci_bus_semrecursion under AER recovery, and beforenvme_pci_enable()saves PCI config state). When false, explicitly disable L1SS viapci_disable_link_state()beforepci_enable_device_mem().Hardware Verification (J207 / iPad Pro 10.5" Wi-Fi, T8011)
Built via
orchard build --device j207 --kernel ... hardware-checkand RAM-booted on J207:pci 0000:01:00.0: ASPM: overriding L1 acceptable latency from 0x5 to 0x7and brings upnvme0n1cleanly.0000:01:00.0/link/*:l1_aspm=1,l1_1_aspm=1,l1_2_aspm=1,l1_1_pcipm=1,l1_2_pcipm=1(LnkCtl=0x0042,L1SubCtl1=0x403c190f/0x403c000f,L1SubCtl2=0x78[T_PwrOn=30us],LTR=0x10081008).0000:02:00.0) remains untouched atl1_aspm=1,l1_1_aspm=0,l1_2_aspm=0.l1_aspmtoggle (1 -> 0 -> 1) + 32 MiB read all passed with zero AER errors (0x104=0,0x110=0on both00:00.0and01:00.0).bq27xxx_battery_hdq, 35 s idle on 500 mA USB SDP):l1_aspm=0):-107 mA(3.782 V,-405 mW)-20 mA(3.789 V,-76 mW)87 mA(~329 mW)