Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.

Commit 75d323a

Browse files
committed
The open source GIM-2.0 release
Signed-off-by: Ken Xue <[email protected]>
1 parent 534694c commit 75d323a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+55833
-48993
lines changed

Makefile

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#
2+
# Copyright (c) 2014-2017 Advanced Micro Devices, Inc. All rights reserved.
3+
#
4+
# Permission is hereby granted, free of charge, to any person obtaining a copy
5+
# of this software and associated documentation files (the "Software"), to deal
6+
# in the Software without restriction, including without limitation the rights
7+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
# copies of the Software, and to permit persons to whom the Software is
9+
# furnished to do so, subject to the following conditions:
10+
#
11+
# The above copyright notice and this permission notice shall be included in
12+
# all copies or substantial portions of the Software.
13+
#
14+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
# THE SOFTWARE
21+
22+
GIM_VERSION=1.1.3
23+
24+
LINUXINCLUDE := $(LINUXINCLUDE) -I$(src)/drv/asic_reg
25+
KBUILD_CFLAGS := $(KBUILD_CFLAGS) -D DRV_VERSION=$(GIM_VERSION)
26+
27+
#KBUILD_CFLAGS += -DCONFIG_GIM_HEARTBEAT_TIMER=y
28+
#KBUILD_CFLAGS += -DCONFIG_MMIO_QEMU_SECURITY=y
29+
30+
obj-m += gim.o
31+
gim-objs := drv/gim_drv.o drv/gim_interface.o drv/gim_adapter.o drv/gim_pci.o drv/gim_unwrapper.o drv/gim_gpuiov.o drv/gim_config.o drv/gim_timer.o drv/gim_fb.o drv/gim_debug.o drv/gim_flr.o drv/gim_atom.o drv/gim_atombios.o drv/gim_os_service.o drv/gim_irqmgr.o drv/gim_kcl_os.o drv/gim_pci_config.o drv/gim_kcl_pci.o drv/gim_reset.o drv/gim_dma.o drv/gim_monitor.o drv/gim_monitor_ioctl.o drv/gim_monitor_tonga.o
32+
33+
PWD := $(shell pwd)
34+
35+
ifeq ($(KERNELRELEASE),)
36+
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
37+
38+
$(info $(KBUILD_CFLAGS))
39+
all:
40+
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
41+
42+
clean:
43+
$(MAKE) -C $(KERNELDIR) M=$(PWD) clean
44+
endif
45+

README.md

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# GIM
22

33
```javascript
4-
Copyright (c) 2014-2017 Advanced Micro Devices, Inc. All rights reserved.
4+
Copyright (c) 2014-2018 Advanced Micro Devices, Inc. All rights reserved.
55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
77
in the Software without restriction, including without limitation the rights
@@ -25,12 +25,14 @@ THE SOFTWARE
2525
(GPU-IOV Module) is a Linux kernel module for AMD SR-IOV based HW
2626
Virtualization (MxGPU) product. It can support KVM, open source Xen and
2727
any other Linux kernel based hypervisors with necessary kernel compatibility
28-
modification. GIM is reponsible for but not limits to: GPU IOV initialization,
29-
virtual function configuration and enablement, GPU scheduling for world
30-
switch, hung detection and virtual function level reset (FLR), PF/VF hand
31-
shake and other GPU utilities.
28+
modification. GIM is reponsible for:
29+
* GPU IOV initialization
30+
* Virtual function configuration and enablement
31+
* GPU scheduling for world switch
32+
* Hang detection and virtual function level reset (FLR)
33+
* PF/VF hand shake and other GPU utilities.
3234

33-
Currently only AMD S7150 series are supported.
35+
Currently, only AMD S7150 series GPUs are supported.
3436

3537
## DOCUMENTATION:
3638
All documents are listed in SRC_ROOT/docs
@@ -40,7 +42,7 @@ THE SOFTWARE
4042
hypervisor SW(KVM, XEN, QEMU, LIBVIRT) versions are aligned with default
4143
version of OS.
4244

43-
GIM supports KVM in Ubuntu16.04, and supports XEN in CentOS7.3.
45+
GIM supports KVM in Ubuntu 16.04, and supports XEN in CentOS 7.3.
4446

4547
Host OS | Kernel | KVM/Xen | QEMU | libvirt
4648
------------|-------------------|---------|-------|--------------
@@ -51,14 +53,13 @@ THE SOFTWARE
5153

5254
Guest OS | Distributions
5355
----------|-------------------------------------------------
54-
Linux | Ubuntu16.04 LTS 64bit; CentOS7.3 64 bit
56+
Linux | Ubuntu 16.04 LTS 64bit; CentOS 7.3 64 bit
5557
Windows | Win7 64bit; Win10 TH2 64bit
5658

5759

58-
* The patches for Linux host OS
59-
For some legacy Linux kernels, there are some issues to enable pci sriov.
60-
Take Ubuntu 4.4.0-75-generic kernel, there is a patch for iov module under
61-
SRC_ROOT/patch.
60+
* Some legacy Linux kernels have issues with enabling PCI SR-IOV.
61+
It is suggested to use Ubuntu 4.4.0-75-generic kernel and apply the patch for
62+
IOV module. The patch file can be found under SRC_ROOT/patch.
6263

6364
## HOW TO BUILD & INSTALL:
6465
All driver source codes are under SRC_ROOT/drv.
@@ -67,15 +68,21 @@ THE SOFTWARE
6768
gim.ko to /lib/modules/$(KERNELRELEASE)/GIM/.
6869
3. Generally, Just run helper SRC_ROOT/gim.sh in a command terminal also can
6970
completed build and installation. And gim.sh -help can display usages.
70-
71+
4. Blacklist amdgpu and amdkfd and reboot the server. Such as, under Ubuntu,
72+
by adding the following line to the end of file /etc/modprobe.d/blacklist.conf
73+
74+
```
75+
blacklist amdgpu
76+
blacklist amdkfd
77+
```
7178
## HOW TO LOAD:
72-
1. Typing command "modprobe gim " in terminal can load gim driver
79+
1. Typing command "modprobe gim" in terminal can load gim driver
7380
2. Usually, Typing command "lsmod | grep gim " and "lspci | grep AMD" in
7481
terminal can help to check if gim driver is loaded
7582

7683
## HOW TO CONFIGURE BUILD:
77-
Read this section carefully. New configuration options would be added in
78-
each release, and odd problems will turn up if the configuration files are
84+
Read this section carefully. New configuration options could be added in
85+
each release, and unexpected problems can occur if the configuration files are
7986
not set up as expected.
8087

8188
* Alternative configuration commands are
@@ -88,10 +95,13 @@ THE SOFTWARE
8895

8996
* Edit configuraiton in Makefile
9097

91-
GIM is a external kernel driver module. The driver configuration is
92-
different from upstream kernel driver. Now, Edit "KBUILD_CFLAGS" in
93-
Makefile is preferred to pass the configuraiton to GIM codes.
98+
GIM is an external kernel driver module. The driver configuration is
99+
different from upstream kernel driver. Editing "KBUILD_CFLAGS" in
100+
the Makefile is preferred to pass the configuration to GIM.
94101

95102
## HISTORY:
96103
- 1.0 (2017/07/20)
97104
The original release support AMD S7150 series.
105+
106+
- 2.0 (2018/9/30)
107+
Fix some issues for AMD S7150 series.

docs/environment_setup

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ Platform
3030

3131
Host Software
3232
-------------
33-
1.Ubuntu16.04 server
33+
1.Ubuntu 16.04 server
3434
1.1 OS installation and configuration
35-
1.1.1 just install OS step by step by the installation tips,
36-
there is no special configure, but remeber to select virtualization choice when install.
35+
1.1.1 Select virtualization when installing.
3736

3837
1.2 Hypervisor installation and configuration
3938
1.2.1 update the software and kernel
@@ -49,18 +48,18 @@ Host Software
4948
f. apt-get install qt3-dev-tools libqt3-mt-dev
5049
g. menuconfig (by default)
5150
1.2.3 patch the kernel for SRIOV support and build kernel
52-
a. patch the following patches
53-
0001-Added-legacy-endpoint-type-to-sriov-for-ubuntu-4.4.0-75-generic.diff
54-
0002-add-pci-io-access-cap-for-ubuntu-4.4.0-75-generic.diff
51+
a. Apply the following patches
52+
patch < ./patch/0001-Added-legacy-endpoint-type-to-sriov-for-ubuntu-4.4.0-75-generic.diff
53+
patch < ./patch/0002-add-pci-io-access-cap-for-ubuntu-4.4.0-75-generic.diff
5554
b. make-kpkg -j N --initrd --append-to-version=my-very-own-kernel kernel-image kernel-headers to buile kernel
5655
where N is how many jobs to run in parallel (usually the number of CPUs you have), and my-very-own-kernel is
5756
a custom string to identify the build
58-
1.2.4 install kernel
57+
1.2.4 Install kernel
5958
a. dpkg -i *.deb to install kernel-image and header which are ready after build compelete.
60-
1.2.5 configure to blacklist amdgpu driver in host
59+
1.2.5 Blacklist amdgpu driver on the host system
6160
a. add "blacklist amdgpu" in /etc/modprobe.d/blacklist.conf
6261
b. update-initramfs -u
63-
1.2.6 configure to enable iommu
62+
1.2.6 Enable IOMMU
6463
a. edit /etc/default/grub
6564
change GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" to GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_iommu=on" if Intel CPU
6665
change GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" to GRUB_CMDLINE_LINUX_DEFAULT="quiet splash amd_iommu=on" if AMD CPU

docs/gim_runtime_configuration

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323
GIM Runtime Configuration
2424

25-
The GIM configuration file /etc/gim_config can be created after first time load
26-
gim.ko. It can configure runtime GIM behaviors.
25+
The GIM configuration file /etc/gim_config can be created after loading gim.ko
26+
for the first time. It can be used to modify options for GIM.
2727

2828
There are 7 options: vf_num, pf_fb, vf_fb, fb_option, sched_interval,
2929
sched_option, fb_clear.
@@ -136,7 +136,7 @@ sched_option, fb_clear.
136136

137137
sched_option = 1
138138
All VFs will share HW resoruce equally by almost same time slice in turns. Even
139-
the VF is stop, the VF still can occupy the HW resource.
139+
the VF is stop, the VF still can occupy its HW resource.
140140

141141
7. fb_clear
142142
Clear the VRAM for VF

drv/Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
# THE SOFTWARE
2020

2121
obj-m := gim.o
22-
gim-objs := gim_drv.o gim_interface.o gim_adapter.o gim_pci.o gim_unwrapper.o gim_gpuiov.o gim_file.o gim_config.o gim_timer.o gim_fb.o gim_debug.o gim_flr.o gim_atom.o gim_atombios.o gim_os_service.o gim_irqmgr.o gim_kcl_os.o gim_pci_config.o gim_kcl_pci.o gim_reset.o gim_dma.o
22+
gim-objs := gim_drv.o gim_interface.o gim_adapter.o gim_pci.o gim_unwrapper.o gim_gpuiov.o gim_config.o gim_timer.o gim_fb.o gim_debug.o gim_flr.o gim_atom.o gim_atombios.o gim_os_service.o gim_irqmgr.o gim_kcl_os.o gim_pci_config.o gim_kcl_pci.o gim_reset.o gim_dma.o gim_monitor.o gim_monitor_ioctl.o gim_monitor_tonga.o
2323

24-
ccflags-y := -O1 -ftree-ter -I$(src)/asic_reg
24+
LINUXINCLUDE := $(LINUXINCLUDE) -I$(src)/asic_reg
2525

2626
#GIM configuration
2727
#ccflags-y += -DCONFIG_GIM_HEARTBEAT_TIMER
28+
#ccflags-y += -D DRV_VERSION=1.0
29+
#ccflags-y += -DCONFIG_MMIO_QEMU_SECURITY
2830

2931
PWD := $(shell pwd)
3032

@@ -39,5 +41,5 @@ clean:
3941
$(MAKE) -C $(KERNELDIR) M=$(PWD) clean
4042

4143
install:
42-
$(MAKE) -C $(KERNELDIR) M=$(PWD) INSTALL_MOD_DIR=GIM modules_install
44+
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
4345
endif

0 commit comments

Comments
 (0)