enable ARCH_SUNXI (and friends) in arm64 kernel .config

Bug #1701137 reported by Andre Przywara
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Fix Released
Wishlist
Seth Forshee
Artful
Fix Released
Wishlist
Seth Forshee

Bug Description

The mainline support for the ARM64 Allwinner SoCs (featured on the Pine64 boards and the Pinebook notebook, for instance, as well as other development boards like the BananaPi-M64) has come a long way by now, since 4.11 we have MMC and USB support working.
Now can we just enable the proper .config bits to make the official Ubuntu kernel support those boards? The latest mainline U-Boot can load an EFI grub from some UEFI ESP partition, so any standard EFI installer should work.
Apart from some minor hiccup (a missing MBR bootable flag/MBR at all) this works already with the Debian-testing netinst installer.
The config symbols needed for decent support are (all enabled by the latest Debian kernel and the official mainline defconfig):
ARCH_SUNXI=y
CONFIG_USB_MUSB_SUNXI=m
CONFIG_MMC_SUNXI=m
CONFIG_RTC_DRV_SUN6I=y
CONFIG_PHY_SUN4I_USB=y

Those enable MMC and USB (the mandatory clocks, pinctrl and UART are enabled by default) and make those boards quite usable already. The on-SoC Ethernet driver will probably be merged into 4.13-rc1.
Optionally:
CONFIG_I2C_MV64XXX=m
CONFIG_SPI_SUN6I=m
give us I2C and SPI support as well.

So can we add those symbols to the Ubuntu kernel .config to give users an out-of-the-box experience?

Cheers,
Andre.

CVE References

Revision history for this message
Joseph Salisbury (jsalisbury) wrote : Missing required logs.

This bug is missing log files that will aid in diagnosing the problem. While running an Ubuntu kernel (not a mainline or third-party kernel) please enter the following command in a terminal window:

apport-collect 1701137

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
Revision history for this message
Andre Przywara (apritzel) wrote :

This is really more of a feature request than a bug report, but I couldn't find a better place or tag to file this. So my apologies if this isn't the right way of requesting this.

For a way to reproduce this: Without ARCH_SUNXI a kernel does not contain the pinctrl and clock drivers crucial for any kind of I/O. The only thing that should work is "earlycon=uart,mmio32,0x1c28000".
Enabling ARCH_SUNXI should make the proper UART driver work, so "console=ttyS0,115200" would give any output. Enabling the other symbols mentioned above allow mass storage via uSD card and USB.

Changed in linux (Ubuntu):
status: Incomplete → Confirmed
Changed in linux (Ubuntu):
importance: Undecided → Wishlist
status: Confirmed → Triaged
tags: added: artful kernel-da-key
Revision history for this message
Seth Forshee (sforshee) wrote :

I took a stab at this, there are many more options to decide on than mentioned here. I enabled these as modules when possible, and generally took the default for the rest. Please look over the options below and let me know if they look reasonable.

Regarding CONFIG_PHY_SUN4I_USB, you've indicated that it should be =y but it is also available as a module. Is there any reason it cannot be =m instead?

Note that this is with a 4.12-based kernel.

CONFIG_ARCH_SUNXI=y
CONFIG_AHCI_SUNXI=m
CONFIG_DMA_SUN6I=m
CONFIG_DWMAC_SUNXI=m
CONFIG_IR_SUNXI=m
CONFIG_KEYBOARD_SUN4I_LRADC=m
CONFIG_MDIO_SUN4I=m
CONFIG_MFD_AC100=m
CONFIG_MFD_AXP20X_RSB=m
CONFIG_MFD_SUN4I_GPADC=m
CONFIG_MFD_SUN6I_PRCM=y
CONFIG_MMC_SUNXI=m
CONFIG_MTD_NAND_SUNXI=m
CONFIG_NET_VENDOR_ALLWINNER=y
CONFIG_NVMEM_SUNXI_SID=m
CONFIG_PHY_SUN4I_USB=m
CONFIG_PHY_SUN9I_USB=m
# CONFIG_PINCTRL_SUN4I_A10 is not set
CONFIG_PINCTRL_SUN50I_A64=y
CONFIG_PINCTRL_SUN50I_A64_R=y
CONFIG_PINCTRL_SUN50I_H5=y
# CONFIG_PINCTRL_SUN5I is not set
# CONFIG_PINCTRL_SUN6I_A31 is not set
# CONFIG_PINCTRL_SUN6I_A31_R is not set
# CONFIG_PINCTRL_SUN7I_A20 is not set
# CONFIG_PINCTRL_SUN8I_A23 is not set
# CONFIG_PINCTRL_SUN8I_A23_R is not set
# CONFIG_PINCTRL_SUN8I_A33 is not set
# CONFIG_PINCTRL_SUN8I_A83T is not set
# CONFIG_PINCTRL_SUN8I_H3 is not set
CONFIG_PINCTRL_SUN8I_H3_R=y
# CONFIG_PINCTRL_SUN8I_V3S is not set
# CONFIG_PINCTRL_SUN9I_A80 is not set
# CONFIG_PINCTRL_SUN9I_A80_R is not set
CONFIG_PINCTRL_SUNXI=y
CONFIG_PWM_SUN4I=m
CONFIG_RESET_SUNXI=y
CONFIG_RTC_DRV_AC100=m
CONFIG_RTC_DRV_SUN6I=y
CONFIG_SERIO_SUN4I_PS2=m
CONFIG_SND_SUN4I_CODEC=m
CONFIG_SND_SUN4I_I2S=m
CONFIG_SND_SUN4I_SPDIF=m
CONFIG_SND_SUN8I_CODEC_ANALOG=m
CONFIG_SPI_SUN4I=m
CONFIG_SPI_SUN6I=m
CONFIG_SUN4I_EMAC=m
CONFIG_SUN4I_GPADC=m
CONFIG_SUN50I_A64_CCU=y
# CONFIG_SUN8I_H3_CCU is not set
CONFIG_SUN8I_R_CCU=y
CONFIG_SUNXI_CCU=y
CONFIG_SUNXI_CCU_DIV=y
CONFIG_SUNXI_CCU_FRAC=y
CONFIG_SUNXI_CCU_GATE=y
CONFIG_SUNXI_CCU_MP=y
CONFIG_SUNXI_CCU_MUX=y
CONFIG_SUNXI_CCU_NK=y
CONFIG_SUNXI_CCU_NKM=y
CONFIG_SUNXI_CCU_NKMP=y
CONFIG_SUNXI_CCU_NM=y
CONFIG_SUNXI_CCU_PHASE=y
CONFIG_SUNXI_RSB=m
CONFIG_SUNXI_SRAM=y
CONFIG_SUNXI_WATCHDOG=m
CONFIG_TOUCHSCREEN_SUN4I=m
CONFIG_USB_MUSB_SUNXI=m

Changed in linux (Ubuntu Artful):
status: Triaged → Incomplete
Revision history for this message
Andre Przywara (apritzel) wrote :

Hi,
Thanks for having a look, and sorry for the delay.

Yes, CONFIG_PHY_SUN4I_USB=m is OK.
We can at least disable (=n) the following options:
CONFIG_AHCI_SUNXI=n
CONFIG_DWMAC_SUNXI=n
CONFIG_MFD_AC100=n
CONFIG_MTD_NAND_SUNXI=n
CONFIG_RTC_DRV_AC100=n
CONFIG_SERIO_SUN4I_PS2=n
CONFIG_SPI_SUN4I=n
CONFIG_SUN4I_EMAC=n
as these devices are in older SoCs which don't have arm64 cores.
There are probably more options which we don't need, but I need to check them later on a Linux box (just on a lousy tablet here, atm).

Revision history for this message
Andre Przywara (apritzel) wrote :

Back from holidays, so here is the list of options for the arm64 kernel .config.
I copied your list from above and changed the options accordingly, adding comments with explanations. Let me know if you need more information.

CONFIG_ARCH_SUNXI=y
# CONFIG_AHCI_SUNXI is not set ## no SATA in 64-bit Allwinner SoCs
CONFIG_DMA_SUN6I=m
# CONFIG_DWMAC_SUNXI is not set ## no GMAC in 64-bit Allwinner SoCs
CONFIG_IR_SUNXI=m
# CONFIG_KEYBOARD_SUN4I_LRADC is not set ## not in 64-bit Allwinner SoCs
# CONFIG_MDIO_SUN4I is not set ## not in 64-bit Allwinner SoCs
# CONFIG_MFD_AC100 is not set ## not used on boards with 64-bit Allwinner SoCs
CONFIG_MFD_AXP20X_RSB=m
CONFIG_MFD_SUN4I_GPADC=m
CONFIG_MFD_SUN6I_PRCM=y
CONFIG_MMC_SUNXI=m
# CONFIG_MTD_NAND_SUNXI is not set ## not used on boards with 64-bit Allwinner SoCs
CONFIG_NET_VENDOR_ALLWINNER=y
CONFIG_NVMEM_SUNXI_SID=m
CONFIG_PHY_SUN4I_USB=m
# CONFIG_PHY_SUN9I_USB is not set ## not in 64-bit Allwinner SoCs
# CONFIG_PINCTRL_SUN4I_A10 is not set
CONFIG_PINCTRL_SUN50I_A64=y
CONFIG_PINCTRL_SUN50I_A64_R=y
CONFIG_PINCTRL_SUN50I_H5=y
# CONFIG_PINCTRL_SUN5I is not set
# CONFIG_PINCTRL_SUN6I_A31 is not set
# CONFIG_PINCTRL_SUN6I_A31_R is not set
# CONFIG_PINCTRL_SUN7I_A20 is not set
# CONFIG_PINCTRL_SUN8I_A23 is not set
# CONFIG_PINCTRL_SUN8I_A23_R is not set
# CONFIG_PINCTRL_SUN8I_A33 is not set
# CONFIG_PINCTRL_SUN8I_A83T is not set
# CONFIG_PINCTRL_SUN8I_H3 is not set
CONFIG_PINCTRL_SUN8I_H3_R=y
# CONFIG_PINCTRL_SUN8I_V3S is not set
# CONFIG_PINCTRL_SUN9I_A80 is not set
# CONFIG_PINCTRL_SUN9I_A80_R is not set
CONFIG_PINCTRL_SUNXI=y
CONFIG_PWM_SUN4I=m
CONFIG_RESET_SUNXI=y
# CONFIG_RTC_DRV_AC100 is not set ## not used on boards with 64-bit Allwinner SoCs
CONFIG_RTC_DRV_SUN6I=y
# CONFIG_SERIO_SUN4I_PS2 is not set ## not in 64-bit Allwinner SoCs
# CONFIG_SND_SUN4I_CODEC is not set ## not in 64-bit Allwinner SoCs
# CONFIG_SND_SUN4I_I2S is not set ## not in 64-bit Allwinner SoCs
# CONFIG_SND_SUN4I_SPDIF is not set ## not in 64-bit Allwinner SoCs
CONFIG_SND_SUN8I_CODEC_ANALOG=m
# CONFIG_SPI_SUN4I is not set ## not in 64-bit Allwinner SoCs
CONFIG_SPI_SUN6I=m
# CONFIG_SUN4I_EMAC is not set ## not in 64-bit Allwinner SoCs
# CONFIG_SUN4I_GPADC is not set ## not (yet?) supported
CONFIG_SUN50I_A64_CCU=y
CONFIG_SUN8I_H3_CCU=y ## drives the H5 as well
CONFIG_SUN8I_R_CCU=y
CONFIG_SUNXI_CCU=y
CONFIG_SUNXI_CCU_DIV=y
CONFIG_SUNXI_CCU_FRAC=y
CONFIG_SUNXI_CCU_GATE=y
CONFIG_SUNXI_CCU_MP=y
CONFIG_SUNXI_CCU_MUX=y
CONFIG_SUNXI_CCU_NK=y
CONFIG_SUNXI_CCU_NKM=y
CONFIG_SUNXI_CCU_NKMP=y
CONFIG_SUNXI_CCU_NM=y
CONFIG_SUNXI_CCU_PHASE=y
CONFIG_SUNXI_RSB=m ## supported in upcoming kernels
CONFIG_SUNXI_SRAM=y
CONFIG_SUNXI_WATCHDOG=m
# CONFIG_TOUCHSCREEN_SUN4I is not set ## not (yet?) supported
CONFIG_USB_MUSB_SUNXI=m

Not covered by the default config when enabling ARCH_SUNXI, but please add:
CONFIG_I2C_MV64XXX=m ## the I2C controller used in both A64 and H5

Revision history for this message
Andre Przywara (apritzel) wrote :

So I checked out the latest Ubuntu kernel (based on 4.12.8) and enabled the options as mentioned above, which leads to the (attached) diff against the config grabbed from here:
http://kernel.ubuntu.com/~kernel-ppa/config/artful/linux/4.12.0-12.13/arm64-config.flavour.generic

These options should comply with the Ubuntu .config rules as I understand them (=m whenever possible), but require an initramfs to boot (from SD card). Compiling in CONFIG_MMC_SUNXI and CONFIG_REGULATOR_FIXED_VOLTAGE allow to access the rootfs without modules (handy for bootstrapping).

Changed in linux (Ubuntu Artful):
status: Incomplete → In Progress
tags: added: patch
Revision history for this message
Seth Forshee (sforshee) wrote :

There are numerous drivers disabled in the supplied diff which can be configured as modules. What's the reason for not including these?

The way we normally handle boot-critical modules is to include them in the installer, and then they will automatically be included in the initrd built for each new kernel as it is installed. Is there any special reason that we need to make the drivers you mentioned built-in instead of doing this?

Revision history for this message
Andre Przywara (apritzel) wrote :

> There are numerous drivers disabled...

The 64-bit Allwinner SoCs share a lot of devices with their 32-bit predecessors (or siblings), so we also share some config symbols, most prominently ARCH_SUNXI. However some of those supported devices are only in older SoCs (Sun4i generation, for instance), and will never be needed for an *arm64* kernel (take Sun4i sound drivers, for example). In the wake of avoiding to bloat the kernel (or the number of modules) needlessly, we can safely disable drivers for which there is no AArch64 capable SoC using those devices. I marked those as "not in 64-bit Allwinner SoCs" in the list above.

> The way we normally handle boot-critical modules ...

I understand that, and can see the reasons why. It's just for my work (hacking and testing kernels, and not being on Ubuntu) it's very inconvenient to always build a matching initrd, and it's just those two symbols needed to boot into an SD card based rootfs without one.
If this is of no concern for you, then it's fine to leave them as =m.

Thanks!

Revision history for this message
Seth Forshee (sforshee) wrote :

I've applied the config options as in your config to our 4.13 "unstable" kernel. There were a few differences. First a couple of new options which I set as follows:

 CONFIG_DWMAC_SUN8I=m
 CONFIG_SUN8I_A83T_CCU=y

And the CONFIG_SUNXI_CCU_* options have been removed. Let me know if anything looks wrong.

https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/unstable

Changed in linux (Ubuntu Artful):
status: In Progress → Fix Committed
assignee: nobody → Seth Forshee (sforshee)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package linux - 4.13.0-11.12

---------------
linux (4.13.0-11.12) artful; urgency=low

  * linux: 4.13.0-11.12 -proposed tracker (LP: #1716699)

  * kernel panic -not syncing: Fatal exception: panic_on_oops (LP: #1708399)
    - s390/mm: fix local TLB flushing vs. detach of an mm address space
    - s390/mm: fix race on mm->context.flush_mm

  * CVE-2017-1000251
    - Bluetooth: Properly check L2CAP config option output buffer length

 -- Seth Forshee <email address hidden> Tue, 12 Sep 2017 10:18:38 -0500

Changed in linux (Ubuntu Artful):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.