On 2018/11/28 14:18, Masanobu SAITOH wrote: > Hi, David. > > On 2018/11/28 6:09, David Brownlee wrote: >> On Tue, 27 Nov 2018 at 18:10, David Brownlee <a...@absd.org> wrote: >>> >>> On Tue, 27 Nov 2018 at 08:27, Masanobu SAITOH <msai...@execsw.org> wrote: >>>> >>>> Hi, David. >>>> >>>> On 2018/11/26 6:11, David Brownlee wrote: >>>>> I've bisected the changes against the github src copy, and it looks like >>>>> the suspend/resume issue is related to the following commit: >>>>> >>>>> commit 0fe469276f49bf0dc003300e0b8a35a80b7b246d (HEAD) >>>>> Author: jdolecek <jdole...@netbsd.org> >>>>> Date: Mon Oct 22 20:57:07 2018 +0000 >>>>> >>>>> enable MSI support where available, blatantly copied from >>>>> jmcneill's msk(4) >>>>> >>>>> I tried building from HEAD with just that one commit reverted, and my >>>>> T420s suspends and resumes again! >>>>> >>>>> iwn0 is still non responsive after resume and wm0 will not pick up an IP >>>>> via dhcpcd, but the disk responds :-p >>>> >>>> (Note that I'm not familiar with suspend/resume though...) >>>> >>>> Our pci_suspend()/pci_resume() copy only first 16 bytes of each PCI >>>> config space. Other OSes copy some other control registers and >>>> MSI/MSI-X capability area. >>>> >>>> Could you dump all PCI config space both before and after suspend with: >>>> >>>> http://www.netbsd.org/~msaitoh/pcidump >>>> >>>> and put the two output somewhere? Diffing the two output will teach >>>> us what we have to do. >>>> >>>> Thanks in advance. >>> >>> Let me just install to a USB stick to give me a working filesystem >>> from which to run pcidump after resume :-p >> >> Collecting a pre-suspend dump was easy, but getting post-resume turned >> out to be a little more involved :) >> - root on wd0 on ahcisata - times out on resume >> - root on sd0 on usb on xhci - times out on resume >> - root on sd0 on usb on uhci - loses the root filesystem mount point on >> resume >> - install image - doesn't have the libs to run pcictl >> - install image, then chroot to mfs with extracted base - suspends but >> video does not come back (no drm) >> - root on wd0, then chroot to mfs with extracted base, suspend & >> resume, then mount sd0 on usb on uhci to save data - \o/ >> >> After all that it occurred to me I could have probably run the >> suspend/resume with an older NetBSD version where MSI was not being >> used. Still, interesting puzzle to try, and useful technique to stash. >> >> Files for the ThinkPad T420s: >> >> http://ftp.netbsd.org/pub/NetBSD/misc/abs/acpi-suspend-resume/pcidump.pre >> http://ftp.netbsd.org/pub/NetBSD/misc/abs/acpi-suspend-resume/pcidump.post > > The diff says we should save/restore MSI table. > We also should save/restore some other registers. > > Give me one or two days to resolve the problem.
Please try the following diff: http://www.netbsd.org/~msaitoh/pci-resume-20181118-0.dif Even if I use this change with Thinkpad X220, it doesn't recover from suspend... > > Thanks. > > >> Thanks for looking at this! >> >> David > > > -- ----------------------------------------------- SAITOH Masanobu (msai...@execsw.org msai...@netbsd.org)