From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.161.43 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796212838; b=Kqa5LgIUrmWrSyz10magPkoUWLL+27aXHoL/JuYc+9KgH3tqldTms9GDWQla7SJMS1Ds de84I+w1bswpmr9o1RVKVBu3xoqhXZuFG31ypa+KrrPPBq03O78SLP1W7eqz7YykCj0u2 nbBAoO5gmgaxKPEbuKTSzU+i6LO+rHssYDyYyO96onI2SS/SuTQEF0C9/EBl3FviJnGa3 2kV/TmNHzzXrDp2PNV7kvOPdlYqE79x+DyaDuMuRt9Z7b7V/Bntogph7xsvIEXl+7aX2x UQgKpkeoZYlOm/fzk1VxNaVDNh/VTG1sIBSZ54BAO1OC0EbtK5eRSSGej5rXbhYfU1g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796212838; h=DMARC-Filter:Received:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Received: X-Forwarded-Encrypted:X-Received:MIME-Version:References:In-Reply-To: From:Date:X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID: Subject:To:Cc:Content-Type:Content-Transfer-Encoding; bh=riS/7cxDfsny47uZFU/BYLEntask8S0W6ryBqWU1hTc=; b=sfVnyv7W0H5ZoiR16dnfyhr5fuLgt0JnswHzLNwIwsB29fuJDr0ikkQqSht5tjAK50je 3JLSb++EwREonchSwL7/5b++r4cNjU4BAkqrYEeFJanjT+TfC2lpNP/j2hBshYc0PdwTg uHgHuqQ2GIqu72TKZrLXlBAXbONsGh4FlkZfQ+0XosaFuHupz65gybO8eOB0Ubu47Xopg XTCNSF8JrlhH5zrOix4TXC/oDMwuKhExMe0J8EekMlIWd1f6QhCWlaFksQgEptQAdezQ1 guiF1PrLUI1TbGH+G4/wXJqhsJ3a0jVMrzidOVEJUY8Uf6Yd/qEJ15qyMbcvRCLRp9w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.remote-ip=209.85.161.43 Received: from mail-oo1-f43.google.com (mail-oo1-f43.google.com [209.85.161.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03D73606A31A for ; Wed, 2 Dec 2026 12:00:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 03D73606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oo1-f43.google.com with SMTP id 006d021491bc7-70b875f6f13so10012924eaf.0 for ; Wed, 02 Dec 2026 04:00:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796212837; x=1796817637; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=riS/7cxDfsny47uZFU/BYLEntask8S0W6ryBqWU1hTc=; b=0qLHqmh6dlaLEvsVo15wJd38hq7f7It7lSd1DmKIp+FZLGnPZsge0+9eYbivq7mL1G 2nYMVvsrlVVyzM7UL56ZvC/tVYb38s51s3Pqk1kd0FziGH3x8tkoyG74B2XXth6CoZHD kK/oMGvJYJOb+ZW6a6hOupJlRqSwa1lRpcXPntsfeEDauPnQBsEZtVVU03luPsqa0dW6 uhwdSAVu6WRVgDNlJJpbB04zmqswYKNdt+7tMQVG2Q2mmiIgYMviZw6ev4+QJ6B/e96i VeagkTFPVrxaDS7Y2C4Q/zlEruZxdRiJZvU1of4x9wyzj3HISRyuWO+u/5CzTqeggGUX Td1g== X-Forwarded-Encrypted: i=1; AL+hErG8mrFiUI11jE3MTXdPBlL7qGHFmyheLO0HTucGBsT89SL8+Y4EMMpgvpKhKRTNETqtDsroXjc1FereSs8=@vger.kernel.org X-Gm-Message-State: APuU4Z/CTnISJqyc7jQvrJIY/WkaxLv1G2ywOhpJfx2aRYPTgF2xj4NA jnj1Y2LPYOydTZYNkqa4H2UV5R6L/RwskBFIy8+dTTUrG6h5VKj6ntAbLx1voRjnGQ== X-Gm-Gg: AZFdTZeCx/BN4n590DjIUT2oAK9Zy+MqaGyt6p8BCTVG/KQoukfH/QlBkrgdo+5T2RC 6yr0dvNYVB75h4VoUJ04JW8Cd95N5xOX2bExfCixN8Npx04VDgNuMoxJ8xgLwdIhwNWwloAqbIJ 5r+px2O8FuOlCiGPBRDM9/z/wQ/cGiNzOZ+FLlVbdxPZdqOq1TWFTK0oVNgLy51JkBr6tvAJ4pc bXckEKAPazHeywGMNLoBS7tfG+JY6SESciDXg5AUbcv1kpfALTC1no2PQo4ytbttJyYM/NB6Gg7 iKbGw0PZvDUoS5jFlw7htvU/e1AW8NBbuWMbn9fpz4hdIpJ1HcFuplLm85MLptd7m//CT9R07Mb QMNl3gbPrlzEM2SH4UJdReoLp5Qoycc5wD/L66ZRrzW38j4GeahJnZmvjwAxGJhedSLz5jRftaS mC9SfOvyI3LW8bzRmvwraqGB+wsmSUI9+LbfTm+c7hnxtTKeAl5vNqt2OnBHKmlf+hfW2zz5RO+ 8J2LI0PvaI2C307rUAoVO1nBuUxntuepaJ6dyqCLkYDtt7UVsPe0+QHBv9323ailtj0EdkEbvgo PX3voHBApSjki6iii+WCLM3gzdzOGDkcGbqnL+l0RuEOQwJPH9CsP3BnP1xrdVJ3WQceUI1JVFr Wb3C9aQIEXVkjgakwZosEY7QQRpYHGcDVYq205Ka9GHtX X-Received: by 2002:a05:6820:807:b0:70a:4053:52e7 with SMTP id 006d021491bc7-71b3929330cmr37216972eaf.8.1796212836833; Wed, 02 Dec 2026 04:00:36 -0800 (PST) Received: from mail-oo1-f43.google.com (mail-oo1-f43.google.com. [209.85.161.43]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-71b380e5472sm29852232eaf.14.2026.12.02.04.00.36 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Dec 2026 04:00:36 -0800 (PST) Received: by mail-oo1-f43.google.com with SMTP id 006d021491bc7-6df5e315bd1so10426646eaf.2 for ; Wed, 02 Dec 2026 04:00:36 -0800 (PST) X-Forwarded-Encrypted: i=1; AL+hErGllLkIshdyiIdF7Hl6IhDfMj/4gFCt7+8WtUlvpgogHfjmwr7JVQNmPLxVD2pCAgwZGfEq+qQl4KnT4Ew=@vger.kernel.org X-Received: by 2002:a05:6820:604:b0:6f4:9618:bada with SMTP id 006d021491bc7-71b7a42a8a4mr23109809eaf.0.1796212836212; Wed, 02 Dec 2026 04:00:36 -0800 (PST) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 References: <20260930160629.1822-1-fourdollars@debian.org> <20260930160629.1822-6-fourdollars@debian.org> In-Reply-To: From: "Shih-Yuan Lee (FourDollars)" Date: Wed, 2 Dec 2026 20:00:23 +0800 X-Gmail-Original-Message-ID: X-Gm-Features: Aa3M54qiTprPEOfQk2Vy9bJ4_kVTLsV2wPeARP-2kCUy-6FG4Ki3WdWxhXZ3FN0 Message-ID: Subject: Re: [PATCH v17 5/6] spi: pxa2xx-pci: restore LPSS private register state across S3 resume To: Andy Shevchenko Cc: Mark Brown , Mika Westerberg , Lukas Wunner , Daniel Mack , Haojian Zhuang , Robert Jarzmik , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Andy, On Thu, Oct 1, 2026 at 3:20=E2=80=AFPM Andy Shevchenko wrote: > > On Thu, Oct 01, 2026 at 12:06:28AM +0800, Shih-Yuan Lee wrote: > > On platforms where Intel LPSS SPI is enumerated as a bare PCI device > > (such as the Apple MacBook8,1 on Lynxpoint-LP), the LPSS power island > > loses power during system sleep and powers up with the controller held > > in reset. Because the device lacks ACPI companion objects or MFD > > binding, neither drivers/acpi/x86/lpss.c nor drivers/mfd/intel-lpss.c > > restore the private register context across S3 resume. > > > > This causes memory-mapped I/O reads on resume to return ~0, resulting > > in PCIe Completion Timeouts, missing interrupts, and dead > > keyboard/touchpad. > > > > Restore LPSS private registers and deassert functional, APB, and iDMA > > resets in the PCI glue layer: > > 1. In suspend, quiesce the controller queue via spi_controller_suspend(= ) > > so no transfers remain in flight and chip select is deasserted. > > Then save the LPSS private registers (LPSS_PRIV_REG_COUNT 9 covering > > up to offset 0x20 including reg_cs_ctrl at 0x18). Ensure the clock i= s > > active for reading MMIO registers using pm_runtime_resume_and_get(), > > balanced by pm_runtime_put_noidle(), before calling > > pm_runtime_force_suspend(). > > 2. In resume, restore LPSS private registers and deassert functional, > > APB, and iDMA resets via pxa2xx_spi_pci_lpss_restore_ctx() before > > calling pm_runtime_force_resume(). Because the controller clock > > remains gated (clk_enabled is false) during this restoration, any > > interrupt arriving on a shared line bails out early in ssp_int() > > without accessing registers on a controller held in reset. Once > > resets are deasserted and private registers are restored, call > > pm_runtime_force_resume() to enable the clock and mark the device > > active, and restart the queue with spi_controller_resume(). > > 3. In probe, call pci_d3cold_disable() for Lynxpoint-LP (is_lpt) to > > ensure the PCI device cannot enter D3cold during runtime PM, > > guaranteeing that LPSS private registers are retained during S0 idle > > periods and only require restoration across S3 system sleep. Set > > DPM_FLAG_NO_DIRECT_COMPLETE to prevent PCI subsystem direct-complete > > bypassing system sleep callbacks. > > 4. Scope LPSS context restoration specifically to Lynxpoint-LP > > (PCI_DEVICE_ID_INTEL_LPT*) devices to avoid perturbing other LPSS > > PCI platforms (BYT, BSW) or non-LPSS platforms. > > > > Export lpss_ssp_setup() and core runtime PM ops so the PCI glue layer > > can invoke them around private register restoration. > > No, as I told earlier please find a way how to not add a code duplication= . Agreed =E2=80=94 I will avoid duplicating the LPSS private register save/re= store logic in v18. As noted in my reply to Mika, on MacBook8,1 (Wildcat Point-LP) the controller at 00:15.4 [8086:9ce6] is enumerated as an independent PCI function rather than via intel-lpss-pci, and drivers/acpi/x86/lpss.c also skips its ACPI companion (\_SB_.PCI0.SPI1 / INT33C1) because it uses PCI BAR0 on pci_bus_type. For v18, I am preparing a prerequisite patch that extracts the common LPSS private register definitions (LPSS_RESETS*, LPSS_PRV_REG_COUNT) and helpers (lpss_deassert_reset(), lpss_save_ctx(), lpss_restore_ctx()) from drivers/acpi/x86/lpss.c into include/linux/platform_data/x86/lpss.h, so both drivers/acpi/x86/lpss.c and drivers/spi/spi-pxa2xx-pci.c share the exact same implementation without duplication. Would extracting these helpers into be acceptable, or would you prefer unifying the PCI-mode LPT/WPT LPSS save/restore at the PCI PM layer (similar to drivers/pci/pci-mid.c)? (Also, for the other patches in the series: I have dropped Patch 2 entirely as you and Mark suggested, fixed the probe ordering in Patch 3, and applied your style cleanups to Patch 1.) Best regards, Shih-Yuan Lee