#2898 assigned project

x86_64 BSP

Reported by: Tanu Hari Dixit Owned by: Chris Johns
Priority: normal Milestone: Indefinite
Component: bsps Version: 4.11
Severity: normal Keywords: SoC, BSP
Cc: Blocked By:
Blocking:

Description (last modified by Gedare)

x86_64 BSP

Contents

  1. x86_64 BSP
    1. Mentors
    2. Students
    3. Status
  2. Introduction
  3. Project
    1. Goal
    2. Prerequisite
    3. Resources
  4. Tasks
    1. Tools
    2. CPU Kit
    3. BSP
      1. Console
      2. Timer
  5. Acknowledgements
  6. Miscellaneous Sections
  7. References

Mentors

Chris Johns, Pavel Pisa, Joel Sherrill, Gedare Bloom

Students

TBD.

Status

Looking for funding.

Introduction

This project involves the creation of an x86_64 BSP for RTEMS to replace the aging i386 PC BSP. The BSP is to boot on current Off The Self (OTS) PC hardware, x86 dev boards and emulators in popular emulation software.

This BSP is to support 64bit only, there is no need to support 32bit.

The i386 BSP contains legacy support and this is becoming harder and harder to maintain and some parts are not supported on newer hardware. There is no need to support any legacy hardware.

Project

Goal

To remove the i386 BSP and replace with a fully functional RTEMS with SMP, TLS, dynamic loading, and libbsd support.

Prerequisite

  • Knowledge of x86_64 ASM, C Programming language.
  • Knowledge of hardware and low level drivers.
  • Knowledge of low level debugging.
  • Knowledge of x86_64 Intel processors.
  • Knowledge of FreeBSD kernel source would help.
  • Requires x86_64-rtems tool configuration.
  • Requires QEMU,
  • Requires modern PC hardware, e.g. a recent motherboard or a Minnow Max board.

Resources

  • Current RTEMS developers.
  • Use existing code instead, e.g. FreeBSD, Intel.

Tasks

The following are the tasks:

Tools

  1. Build and verify x86_64 tools.
  2. Check suitable floating point multilib variants are being built and are functioning.
  3. Confirm newlib support is valid. Check setjmp/longjmp support is functioning.
  4. Check Thread Local Storage (TLS) is supported.

CPU Kit

Add support for the x86_64 architecture.

It is still no clear if this is a new architecture or something added to the i386 architecture that exists in the cputkit/score/i386. Consider the effect support for any hyper-visors needs may have.

The tools for this architecture are different to the i386-rtems tools so it could be a new architecture. This means the i386 support could be removed including the tools however this may effect any existing hyper-visor or partitioned system support.

BSP

Add support for:

  1. Add support for UEFI booting. Evaluate using an ASM generated table header or adding a tool to create the PC COFF+ format file. Use the FreeBSD support in the FreeBSD kernel source.
  2. Support UEFI and Multiboot formats.
  3. Support boot loader command line arguments.
  4. Add support for ACPI using Intel's ACPICA. Best to base this on the FreeBSD code in it's kernel source.
  5. Add support for APIC.
  6. Add support for SMP.
  7. Support low level remote debugging.
  8. Thread Local Storage (TLS) support.

Console

The i386 PC has legacy console support plus support for newer PCI UARTS. The i386 BSP code can be used as reference however I do not encourage reuse because the code's structure is not of a standard I would accept. Further to this, boot modes such as UEFI have the video hardware in graphics mode or the hardware can be headless and console IO can be redirected by the UEFI bios settings. This means a more flexibly and simplified console structure is required that can support redirection.

The redirection to a boot loader such as UEFI adds another complication. At some point RTEMS needs to take over the hardware and so printk need to be able to take over the related hardware, eg a serial port. This may mean some form of video switching from a graphics mode to text mode. Using a graphics mode with text is fine for testing however in production the slow down is not acceptable.

Timer

TDB

Acknowledgements

None.

Miscellaneous Sections

As the project progresses, you will need to add build instructions, etc and this page will evolve from a project description into a HOWTO.

References

  • TBD

Change History (14)

comment:1 Changed on Feb 4, 2017 at 5:13:58 PM by Joel Sherrill

Description: modified (diff)

comment:2 Changed on Feb 6, 2017 at 4:02:32 AM by Chris Johns

Type: enhancementproject

comment:3 Changed on Feb 6, 2017 at 11:55:45 PM by Chris Johns

Description: modified (diff)
Summary: Create an x86_64 BSPx86_64 BSP

comment:4 Changed on Mar 2, 2017 at 8:21:17 PM by Gedare

Keywords: BSP added

comment:5 Changed on Mar 2, 2017 at 9:28:39 PM by Gedare

Description: modified (diff)

comment:6 Changed on Mar 2, 2017 at 9:36:14 PM by Gedare

Description: modified (diff)
Owner: set to Chris Johns
Status: newassigned

comment:7 Changed on Mar 23, 2017 at 11:52:09 PM by Jason Vas Dias

I have an x86_86 laptop, with PCI devices:

$ lspci -nnk
00:00.0 Host bridge [0600]: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor DRAM Controller [8086:0c04] (rev 06)

Subsystem: CLEVO/KAPOK Computer Device [1558:5106]
Kernel modules: ie31200_edac

00:01.0 PCI bridge [0604]: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller [8086:0c01] (rev 06)

Kernel driver in use: pcieport

00:02.0 VGA compatible controller [0300]: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller [8086:0416] (rev 06)

Subsystem: CLEVO/KAPOK Computer Device [1558:5106]
Kernel driver in use: i915

00:03.0 Audio device [0403]: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller [8086:0c0c] (rev 06)

Subsystem: CLEVO/KAPOK Computer Device [1558:5106]
Kernel driver in use: snd_hda_intel

00:14.0 USB controller [0c03]: Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI [8086:8c31] (rev 05)

Subsystem: CLEVO/KAPOK Computer Device [1558:5106]
Kernel driver in use: xhci_hcd

00:16.0 Communication controller [0780]: Intel Corporation 8 Series/C220 Series Chipset Family MEI Controller #1 [8086:8c3a] (rev 04)

Subsystem: CLEVO/KAPOK Computer Device [1558:5106]
Kernel driver in use: mei_me

00:1a.0 USB controller [0c03]: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #2 [8086:8c2d] (rev 05)

Subsystem: CLEVO/KAPOK Computer Device [1558:5106]
Kernel driver in use: ehci-pci

00:1b.0 Audio device [0403]: Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller [8086:8c20] (rev 05)

Subsystem: CLEVO/KAPOK Computer Device [1558:5106]
Kernel driver in use: snd_hda_intel

00:1c.0 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #1 [8086:8c10] (rev d5)

Kernel driver in use: pcieport

00:1c.1 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #2 [8086:8c12] (rev d5)

Kernel driver in use: pcieport

00:1c.2 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #3 [8086:8c14] (rev d5)

Kernel driver in use: pcieport

00:1c.3 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #4 [8086:8c16] (rev d5)

Kernel driver in use: pcieport

00:1d.0 USB controller [0c03]: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #1 [8086:8c26] (rev 05)

Subsystem: CLEVO/KAPOK Computer Device [1558:5106]
Kernel driver in use: ehci-pci

00:1f.0 ISA bridge [0601]: Intel Corporation HM87 Express LPC Controller [8086:8c4b] (rev 05)

Subsystem: CLEVO/KAPOK Computer Device [1558:5106]
Kernel driver in use: lpc_ich

00:1f.2 SATA controller [0106]: Intel Corporation 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode] [8086:8c03] (rev 05)

Subsystem: CLEVO/KAPOK Computer Device [1558:5106]
Kernel driver in use: ahci

00:1f.3 SMBus [0c05]: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller [8086:8c22] (rev 05)

Subsystem: CLEVO/KAPOK Computer Device [1558:5106]
Kernel driver in use: i801_smbus

01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Neptune XT [Radeon HD 8970M] [1002:6801]

Subsystem: CLEVO/KAPOK Computer Device [1558:5106]
Kernel driver in use: radeon

03:00.0 PCI bridge [0604]: Texas Instruments XIO2213A/B/XIO2221 PCI Express to PCI Bridge [Cheetah Express] [104c:823e] (rev 01)
04:00.0 FireWire? (IEEE 1394) [0c00]: Texas Instruments XIO2213A/B/XIO2221 IEEE-1394b OHCI Controller [Cheetah Express] [104c:823f] (rev 01)

Subsystem: CLEVO/KAPOK Computer Device [1558:5106]
Kernel driver in use: firewire_ohci
Kernel modules: firewire_ohci

05:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTL8411 PCI Express Card Reader [10ec:5289] (rev 01)

Subsystem: CLEVO/KAPOK Computer Device [1558:5106]
Kernel driver in use: rtsx_pci

05:00.2 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 0a)

Subsystem: CLEVO/KAPOK Computer Device [1558:5106]
Kernel driver in use: r8169

06:00.0 Network controller [0280]: Intel Corporation Wireless 7260 [8086:08b1] (rev bb)

Subsystem: Intel Corporation Dual Band Wireless-AC 7260 [8086:4070]
Kernel driver in use: iwlwifi

[root@jvdlux[LUX-4.4]:~/rtems-docs [6089] 23:46:13 #:232!:9378]
$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel?
cpu family : 6
model : 60
model name : Intel(R) Core(TM) i7-4910MQ CPU @ 2.90GHz
stepping : 3
microcode : 0x17
cpu MHz : 1399.908
cache size : 8192 KB
physical id : 0
siblings : 8
core id : 0
cpu cores : 4
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc a
perfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb tpr_shadow vnmi flexpriority ept vpid fsgsbase
tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm xsaveopt dtherm ida arat pln pts
bugs :
bogomips : 5786.23
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management:

I've just checked out rtems & rtems-docs .

How can I help ?

I'd really like to try and port the above listed Linux drivers
and a libc and libstdc++ and OpenGL (mesa) and XWayland and Java to RTEMS - once this project is complete, I'd have my ideal operating
system .
My laptop uses AMI BIOS . Any luck with getting OpenFirmware? / EFI booting working with RTEMS ?
My first plan would be to extend GRUB to load & boot RTEMS alongside
a Linux partition.
Any bootable image for x86_64 I could try out ?

comment:8 in reply to:  7 Changed on Mar 24, 2017 at 1:36:26 AM by Chris Johns

Replying to Jason Vas Dias:

I've just checked out rtems & rtems-docs .

I suggest you also check out the rtems-libbsd repo. It is the port of the FreeBSD kernel and drivers to run on RTEMS.

How can I help ?

You need to build an RTEMS X86_64 tool chain and then look at score structure to see if the i386 can be used or a new x86_64 arch is added.

I'd really like to try and port the above listed Linux drivers

We do not accept GPL licensed code into RTEMS. This is why RTEMS focuses on the FreeBSD. You should be able to find the equivalent support.

and a libc and libstdc++

RTEMS uses newlib for libc the libstdc++ is from g++. I would say this is already covered.

and OpenGL (mesa) and XWayland and Java to RTEMS - once this project is complete, I'd have my ideal operating system .
My laptop uses AMI BIOS . Any luck with getting OpenFirmware? / EFI booting working with RTEMS ?

No, you would need to add the low level support to do this.

My first plan would be to extend GRUB to load & boot RTEMS alongside
a Linux partition.
Any bootable image for x86_64 I could try out ?

No, this is the task.

comment:9 Changed on Mar 17, 2018 at 3:58:56 PM by Amaan Cheval

Regarding the x86_64 tools, Gedare said this on the mailing list:

The x86_64 tools have a recipe in RSB, you can give it a try. The
tasks identified there are in two categories:

  1. GCC multilib support for FPU -- You should ask Joel to look into

this for you. :)

  1. Newlib support for setjmp/longjmp, and anything else that should be

in the libc. You should do this. Join newlib mailing list, check out
the source, and find the current i386 and x86_64 implementations.
(Hint: newlib.git/newlib/libc/machine/[i386 x86_64]).

  1. TLS. There are multiple ways to implement it. I don't know what is

preferred for this. See https://www.akkadia.org/drepper/tls.pdf for a
thorough background.

comment:10 Changed on Jun 5, 2018 at 5:19:42 PM by Amaan Cheval

comment:11 Changed on Jun 13, 2018 at 3:05:17 PM by Amaan Cheval <amaan.cheval@…>

In 20f62cd/rtems-source-builder:

x86_64/binutils: Add PEI target to build UEFI application images

Updates #2898.

comment:12 in reply to:  11 Changed on Jun 13, 2018 at 3:11:14 PM by Gedare

Replying to Amaan Cheval <amaan.cheval@…>:

In 20f62cd/rtems-source-builder:

x86_64/binutils: Add PEI target to build UEFI application images

Updates #2898.

Original commit in binutils:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=421acf18739edb54111b64d2b328ea2e7bf19889

comment:13 Changed on Jul 11, 2018 at 8:39:00 PM by Amaan Cheval <amaan.cheval@…>

In cf811a4/rtems:

x86_64/console: Add NS16550 polled console driver

This addition allows us to successfully run the sample hello.exe test.

Updates #2898.

comment:14 Changed on Aug 13, 2018 at 10:49:37 PM by Amaan Cheval <amaan.cheval@…>

In bc731313/rtems:

bsps/x86_64: Add APIC timer based clock driver

The APIC timer is calibrated by running the i8254 PIT for a fraction of a
second (determined by PIT_CALIBRATE_DIVIDER) and counting how many times the
APIC counter has ticked. The calibration can be run multiple times (determined
by APIC_TIMER_NUM_CALIBRATIONS) and averaged out.

Updates #2898.

Note: See TracTickets for help on using tickets.