Bug 70931

Summary: Reboot quirks required for Baytrail-based tablets
Product: ACPI Reporter: Adam Williamson (adamw)
Component: BIOSAssignee: Aubrey Li (aubrey.li)
Status: CLOSED CODE_FIX    
Severity: high CC: alan, ashok.raj, ashok.raj, aubrey.li, bugzilla, jacek.m.danecki, lenb, nrndda, rjw, rui.zhang, tianyu.lan
Priority: P1    
Hardware: Intel   
OS: Linux   
Kernel Version: 3.14rc3 Subsystem:
Regression: No Bisected commit-id:
Attachments: poweroff patch from Jan Michael Brummer
reboot quirk patch: V8P from Jan Michael, T100TA from Jacek Danecki, Miix 2 by me
dmidecode from Miix 2 (provided by Vaidotas Kazla) for reference
dmidecode from Venue 8 Pro (mine) for reference
introduce BOOT_EFI and BOOT_CF9 into reboot sequence loop
pmc driver

Description Adam Williamson 2014-02-21 02:38:19 UTC
Created attachment 126901 [details]
poweroff patch from Jan Michael Brummer

I have a Dell Venue 8 Pro, and I've been working with several other folks with similar tablets - that is, tablets based on the first-generation Intel Baytrail platform.

They all appear to need quirk handling to shutdown / reboot correctly.

I'm attaching a couple of patches. Jan Michael Brummer at Intel wrote the 'poweroff' patch and the reboot quirk for the Venue 8 Pro. I've been applying those two to my 'fedlet' kernel builds - see https://www.happyassassin.net/fedlet-a-fedora-remix-for-bay-trail-tablets/ - and they make the V8P shut down and reboot reliably for me, and others with V8Ps who've tested the build.

The 'reboot quirk' patch contains that V8P quirk. It also contains a quirk for the Asus T100TA which has been written and tested by Jacek Danecki. It also contains a quirk for the Lenovo Miix 2: I don't have one of these, but someone following my Fedlet posts contacted me and sent the dmidecode, so I wrote a quirk based on that.

Phil Knirsch at Red Hat has an HP Omni 10, and I've contacted him to ask if it also has the same shutdown/reboot problems, and to ask for dmidecode output so we could add a quirk for that one too.
Comment 1 Adam Williamson 2014-02-21 02:39:28 UTC
Created attachment 126911 [details]
reboot quirk patch: V8P from Jan Michael, T100TA from Jacek Danecki, Miix 2 by me
Comment 2 Adam Williamson 2014-02-21 02:41:10 UTC
Created attachment 126921 [details]
dmidecode from Miix 2 (provided by Vaidotas Kazla) for reference
Comment 3 Adam Williamson 2014-02-21 02:45:09 UTC
Created attachment 126931 [details]
dmidecode from Venue 8 Pro (mine) for reference
Comment 4 Adam Williamson 2014-02-21 07:51:16 UTC
I've tested the kernel build with the attached patches - http://happyassassin.net/fedlet/repo/i386/kernel-3.14.0-0.rc3.git5.1.1awb.i686.rpm - on my V8P, and it both shuts down and reboots correctly.
Comment 5 Lan Tianyu 2014-02-24 12:26:24 UTC
Please send the quirk patch to ACPI and x86 maillist.
Comment 6 Alan 2014-02-24 22:19:07 UTC
For the longer term we should be using either EFI reboot (and the 64/32bit EFI thunking Matt is working on) or possibly PMU. PMU is being looked at internally at the moment.
Comment 7 Aubrey Li 2014-02-25 03:33:32 UTC
Bay Trail-T tablet doesn't support ACPI poweroff, and has only
32bit EFI runtime service to support shutdown, which can't be
called from current 64bit linux kernel.

I'm working on a Power management controller(PMC) driver for Bay Trail-T SoC
and found there is a native way to poweroff the tablet via PMC PCI IO port.
I have a patch to make 64bit kernel poweroff work.

So we have the following 3 methods:
(1) ACPI shutdown
(2) EFI runtime service shutdown
(3) PMC PCI IO port shutdown

I'm thinking if it's acceptable to add a cheap power off hook
void (*pci_power_off)(void);
to install PMC PCI IO poweroff method and called in native_machine_power_off.
Comment 8 Adam Williamson 2014-02-25 03:59:52 UTC
Just for the record, I'm still using a 32-bit kernel and userspace for my 'fedlet' build.

Do you still want the quirk patch mailed out to the lists?
Comment 9 Aubrey Li 2014-02-28 03:30:17 UTC
Created attachment 127611 [details]
introduce BOOT_EFI and BOOT_CF9 into reboot sequence loop
Comment 10 Aubrey Li 2014-02-28 03:47:06 UTC
Generally, we expect EFI handle all of the reported cases.

[reboot]
for 32bit/64bit linux on 32bit/64bit EFI:
- we need the attached patch to include BOOT_EFI into the reboot sequence loop so that we don't need "reboot=efi" in the command line.

for linux and EFI in 32bit and 64bit mixed mode:
- we need Matt Fleming's work to make linux calling EFI runtime service in mixed mode, his work will be coming soon in the upstream linux kernel.
http://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=mixed-mode

for currently 64bit linux on 32bit EFI:
- we fall into BOOT_CF9 and write to 0xCF9 to reboot with the attached patch.

[poweroff]
poweroff is similar to reboot, we still expect EFI runtime service handles all of the cases. The exception is that we don't have 0xCF9 to poweroff the machine. But, my another patch will install a pmc_power_off function to pm_power_off hook, to provide a PCI IO port to power off the machine.

So, we don't need any dmidecode based quirks any more.
Comment 11 Rafael J. Wysocki 2014-03-11 12:18:09 UTC
Patch: https://patchwork.kernel.org/patch/3808341/

Adam, can you please check if this patch makes any difference?
Comment 12 Aubrey Li 2014-03-11 12:41:31 UTC
(In reply to Rafael J. Wysocki from comment #11)
> Patch: https://patchwork.kernel.org/patch/3808341/
> 
> Adam, can you please check if this patch makes any difference?

This patch will not make any difference. This patch just releases the not-working ACPI power off method, so that a native power method provided by pmc driver can be installed and power off the machine.

We'll consider EFI runtime service here once Fleming's mixed mode is landed.
Comment 13 Aubrey Li 2014-03-11 12:45:32 UTC
Created attachment 128941 [details]
pmc driver

work to provide poweroff functionality after the following patch is applied.
https://patchwork.kernel.org/patch/3808341/
Comment 14 Rafael J. Wysocki 2014-03-11 12:54:17 UTC
So *in* *addition* to applying the patch from comment #11, users will need the new PMC driver from comment #13, right?

Please take care of this bug going forward.
Comment 15 Aubrey Li 2014-03-11 13:36:30 UTC
Reboot patch is here:
https://lkml.org/lkml/2014/3/5/379
Comment 16 Adam Williamson 2014-03-11 15:02:46 UTC
Sorry, I kind of got lost in the giant email exchange that accompanied the patch and forgot to test it. I'll throw it in the next Fedlet kernel build and verify that it works. I'm still carrying the old quirk patches at present.
Comment 17 Rafael J. Wysocki 2014-03-11 19:11:47 UTC
You'll need both patches from comment #11 and comment #13.
Comment 18 Aubrey Li 2014-03-11 23:00:28 UTC
For power off:
- patches from comment #11 and comment #13.
For reboot:
- patch from comment 15

Please make sure the old quirk patches are removed.

Both 32bit and 64bit should work.
Comment 19 Adam Williamson 2014-03-12 18:58:31 UTC
OK, I have a kernel build going now with the latest versions I could find of the three patches, plus https://patchwork.kernel.org/patch/3780211/ . Will report back when it's built and tested.
Comment 20 Adam Williamson 2014-03-12 23:30:55 UTC
Looks good here on the Venue 8 Pro. Shutdown and restart both work. Will ask for feedback from Fedlet users.
Comment 21 Ashok Raj 2014-03-12 23:33:02 UTC
Thanks Adam, did you remove the old reboot quirk via DMI strings before checking? Hopefully yes.. but just checking
Comment 22 Adam Williamson 2014-03-12 23:35:35 UTC
Yep, of course.
Comment 23 Adam Williamson 2014-04-02 16:28:52 UTC
So it looks like as of current 3.15, the smaller patches have been merged but the new PMC driver still hasn't. Do we need to poke upstream to get that merged?
Comment 24 Adam Williamson 2014-06-12 19:17:20 UTC
Still doesn't seem to have been merged for 3.16(!) I've mailed Aubrey to ask why.
Comment 25 Aubrey Li 2014-09-10 02:50:32 UTC
already merged by:

(1) efi/reboot: Add generic wrapper around EfiResetSystem()
(2) efi/reboot: Allow powering off machines using EFI
(3) x86/reboot: Add EFI reboot quirk for ACPI Hardware Reduced flag
Comment 26 Len Brown 2015-07-21 19:20:26 UTC
shipped in 3.15-rc1:

commit a4f1987e4c5489a3877eaa7451a68d28c5a3f664
Author: Li, Aubrey <aubrey.li@linux.intel.com>
Date:   Sun Mar 2 18:39:02 2014 +0800

    x86, reboot: Add EFI and CF9 reboot methods into the default list

If a kernel newer than that isn't rebooting on the machines
mentioned here, then please re-open this report.