-
Notifications
You must be signed in to change notification settings - Fork 56
resources: Add files to make 6.8.12 riscv kernel and gem5 bridge driver #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Harshil2107
wants to merge
7
commits into
gem5:stable
Choose a base branch
from
Harshil2107:make-riscv-kernel
base: stable
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
977630e
resources: Add files to make 6.8.12 riscv kernel and gem5 bridge driver
Harshil2107 dd7cf0a
resources: Update riscv disk image to use hypercall
Harshil2107 72ea968
resources: Add riscv npb disk image
Harshil2107 0a1b8e9
Merge branch 'stable' into make-riscv-kernel
Harshil2107 c21bcea
resources: updated documentation and base disk image
Harshil2107 91eb056
resources: Update m5ops installation to point to stable gem5
Harshil2107 cfb8735
resources: Update m5ops installation to point to stable in dockerfile
Harshil2107 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Copyright (c) 2024 The Regents of the University of California. | ||
| # SPDX-License-Identifier: BSD 3-Clause | ||
|
|
||
| PACKER_VERSION="1.10.0" | ||
|
|
||
| if [ ! -f ./packer ]; then | ||
| wget https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip; | ||
| unzip packer_${PACKER_VERSION}_linux_amd64.zip; | ||
| rm packer_${PACKER_VERSION}_linux_amd64.zip; | ||
| fi | ||
|
|
||
| if [ ! -f riscv-ubuntu-24-04 ]; then | ||
| wget https://storage.googleapis.com/dist.gem5.org/dist/develop/images/riscv/ubuntu-24-04/riscv-ubuntu-24-04.gz; | ||
| gunzip riscv-ubuntu-24-04.gz; | ||
| fi | ||
|
|
||
| ./packer init riscv-npb.pkr.hcl | ||
| ./packer build riscv-npb.pkr.hcl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,168 @@ | ||
| #--------------------------------------------------------------------------- | ||
| # | ||
| # SITE- AND/OR PLATFORM-SPECIFIC DEFINITIONS. | ||
| # | ||
| #--------------------------------------------------------------------------- | ||
|
|
||
| #--------------------------------------------------------------------------- | ||
| # This config is specific for gem5. | ||
| #--------------------------------------------------------------------------- | ||
|
|
||
|
|
||
| #--------------------------------------------------------------------------- | ||
| # Items in this file will need to be changed for each platform. | ||
| #--------------------------------------------------------------------------- | ||
|
|
||
| #--------------------------------------------------------------------------- | ||
| # Parallel Fortran: | ||
| # | ||
| # For CG, EP, FT, MG, LU, SP, BT and UA, which are in Fortran, the following | ||
| # must be defined: | ||
| # | ||
| # FC - Fortran compiler | ||
| # FFLAGS - Fortran compilation arguments | ||
| # F_INC - any -I arguments required for compiling Fortran | ||
| # FLINK - Fortran linker | ||
| # FLINKFLAGS - Fortran linker arguments | ||
| # F_LIB - any -L and -l arguments required for linking Fortran | ||
| # | ||
| # compilations are done with $(FC) $(F_INC) $(FFLAGS) or | ||
| # $(FC) $(FFLAGS) | ||
| # linking is done with $(FLINK) $(F_LIB) $(FLINKFLAGS) | ||
| #--------------------------------------------------------------------------- | ||
|
|
||
| #--------------------------------------------------------------------------- | ||
| # This is the fortran compiler used for Fortran programs | ||
| #--------------------------------------------------------------------------- | ||
| FC = gfortran | ||
| # This links fortran programs; usually the same as ${FC} | ||
| FLINK = $(FC) | ||
|
|
||
| #--------------------------------------------------------------------------- | ||
| # These macros are passed to the linker | ||
| #--------------------------------------------------------------------------- | ||
| F_LIB = -lm5 -lm | ||
|
|
||
| #--------------------------------------------------------------------------- | ||
| # These macros are passed to the compiler | ||
| #--------------------------------------------------------------------------- | ||
| F_INC = | ||
|
|
||
| #--------------------------------------------------------------------------- | ||
| # Global *compile time* flags for Fortran programs | ||
| #--------------------------------------------------------------------------- | ||
| FFLAGS = -O3 -fopenmp -cpp -mcmodel=medany -fcommon -no-pie -DM5_ANNOTATION | ||
|
|
||
| #--------------------------------------------------------------------------- | ||
| # Global *link time* flags. Flags for increasing maximum executable | ||
| # size usually go here. | ||
| #--------------------------------------------------------------------------- | ||
| # Using no-pie here as m5 is compiled with the no-pie flash and cant no be build | ||
| # as a position independent executable. | ||
| FLINKFLAGS = -O3 -fopenmp -no-pie | ||
|
|
||
|
|
||
| #--------------------------------------------------------------------------- | ||
| # Parallel C: | ||
| # | ||
| # For IS and DC, which are in C, the following must be defined: | ||
| # | ||
| # CC - C compiler | ||
| # CFLAGS - C compilation arguments | ||
| # C_INC - any -I arguments required for compiling C | ||
| # CLINK - C linker | ||
| # CLINKFLAGS - C linker flags | ||
| # C_LIB - any -L and -l arguments required for linking C | ||
| # | ||
| # compilations are done with $(CC) $(C_INC) $(CFLAGS) or | ||
| # $(CC) $(CFLAGS) | ||
| # linking is done with $(CLINK) $(C_LIB) $(CLINKFLAGS) | ||
| #--------------------------------------------------------------------------- | ||
|
|
||
| #--------------------------------------------------------------------------- | ||
| # This is the C compiler used for C programs | ||
| #--------------------------------------------------------------------------- | ||
| CC = gcc | ||
| # This links C programs; usually the same as ${CC} | ||
| CLINK = $(CC) | ||
|
|
||
| #--------------------------------------------------------------------------- | ||
| # These macros are passed to the linker | ||
| #--------------------------------------------------------------------------- | ||
| C_LIB = -lm5 -lm | ||
|
|
||
| #--------------------------------------------------------------------------- | ||
| # These macros are passed to the compiler | ||
| #--------------------------------------------------------------------------- | ||
| C_INC = | ||
|
|
||
| #--------------------------------------------------------------------------- | ||
| # Global *compile time* flags for C programs | ||
| # DC inspects the following flags (preceded by "-D"): | ||
| # | ||
| # IN_CORE - computes all views and checksums in main memory (if there is | ||
| # enough memory) | ||
| # | ||
| # VIEW_FILE_OUTPUT - forces DC to write the generated views to disk | ||
| # | ||
| # OPTIMIZATION - turns on some nonstandard DC optimizations | ||
| # | ||
| # _FILE_OFFSET_BITS=64 | ||
| # _LARGEFILE64_SOURCE - are standard compiler flags which allow to work with | ||
| # files larger than 2GB. | ||
| #--------------------------------------------------------------------------- | ||
| CFLAGS = -O3 -fopenmp -mcmodel=medany -fcommon -no-pie -DM5_ANNOTATION | ||
|
|
||
| #--------------------------------------------------------------------------- | ||
| # Global *link time* flags. Flags for increasing maximum executable | ||
| # size usually go here. | ||
| #--------------------------------------------------------------------------- | ||
| # Using no-pie here as m5 is compiled with the no-pie flash and cant no be build | ||
| # as a position independent executable. | ||
| CLINKFLAGS = -O3 -fopenmp -no-pie | ||
|
|
||
|
|
||
| #--------------------------------------------------------------------------- | ||
| # Utilities C: | ||
| # | ||
| # This is the C compiler used to compile C utilities. Flags required by | ||
| # this compiler go here also; typically there are few flags required; hence | ||
| # there are no separate macros provided for such flags. | ||
| #--------------------------------------------------------------------------- | ||
| UCC = gcc | ||
|
|
||
|
|
||
| #--------------------------------------------------------------------------- | ||
| # Destination of executables, relative to subdirs of the main directory. . | ||
| #--------------------------------------------------------------------------- | ||
| BINDIR = ../bin | ||
|
|
||
|
|
||
| #--------------------------------------------------------------------------- | ||
| # The variable RAND controls which random number generator | ||
| # is used. It is described in detail in README.install. | ||
| # Use "randi8" unless there is a reason to use another one. | ||
| # Other allowed values are "randi8_safe", "randdp" and "randdpvec" | ||
| #--------------------------------------------------------------------------- | ||
| RAND = randi8 | ||
| # The following is highly reliable but may be slow: | ||
| # RAND = randdp | ||
|
|
||
|
|
||
| #--------------------------------------------------------------------------- | ||
| # The variable WTIME is the name of the wtime source code module in the | ||
| # common directory. | ||
| # For most machines, use wtime.c | ||
| # For SGI power challenge: use wtime_sgi64.c | ||
| #--------------------------------------------------------------------------- | ||
| WTIME = wtime.c | ||
|
|
||
|
|
||
| #--------------------------------------------------------------------------- | ||
| # Enable if either Cray (not Cray-X1) or IBM: | ||
| # (no such flag for most machines: see common/wtime.h) | ||
| # This is used by the C compiler to pass the machine name to common/wtime.h, | ||
| # where the C/Fortran binding interface format is determined | ||
| #--------------------------------------------------------------------------- | ||
| # MACHINE = -DCRAY | ||
| # MACHINE = -DIBM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| /* | ||
| Copyright (c) 2024 The Regents of the University of California | ||
| All rights reserved. | ||
|
|
||
| Redistribution and use in source and binary forms, with or without | ||
| modification, are permitted provided that the following conditions are | ||
| met: redistributions of source code must retain the above copyright | ||
| notice, this list of conditions and the following disclaimer; | ||
| redistributions in binary form must reproduce the above copyright | ||
| notice, this list of conditions and the following disclaimer in the | ||
| documentation and/or other materials provided with the distribution; | ||
| neither the name of the copyright holders nor the names of its | ||
| contributors may be used to endorse or promote products derived from | ||
| this software without specific prior written permission. | ||
|
|
||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| */ | ||
| #include <stdio.h> | ||
| #include <gem5/m5ops.h> | ||
|
|
||
|
|
||
| void init_() __attribute__((constructor)); | ||
| void map_m5_mem(); | ||
|
|
||
| void init_() { | ||
|
|
||
| //__attribute__ makes this function get called before main() | ||
| // need to mmap /dev/mem | ||
| printf(" --------------------- M5 INIT --------------------- \n"); | ||
| map_m5_mem(); | ||
| } | ||
|
|
||
| void m5_exit_interface_() | ||
| { | ||
| printf(" --------------------- M5 EXIT --------------------- \n"); | ||
| // this function calls m5_exit | ||
| m5_exit_addr(0); | ||
| } | ||
|
|
||
| void m5_work_begin_interface_() | ||
| { | ||
|
|
||
| printf(" -------------------- ROI BEGIN -------------------- \n"); | ||
| m5_hypercall_addr(4); | ||
| } | ||
|
|
||
| void m5_work_end_interface_() | ||
| { | ||
| m5_hypercall_addr(5); | ||
| printf(" -------------------- ROI END -------------------- \n"); | ||
| } |
61 changes: 61 additions & 0 deletions
61
src/npb-24.04-imgs/npb-hook-files/non-addr-version/hooks.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| /* | ||
| Copyright (c) 2024 The Regents of the University of California | ||
| All rights reserved. | ||
|
|
||
| Redistribution and use in source and binary forms, with or without | ||
| modification, are permitted provided that the following conditions are | ||
| met: redistributions of source code must retain the above copyright | ||
| notice, this list of conditions and the following disclaimer; | ||
| redistributions in binary form must reproduce the above copyright | ||
| notice, this list of conditions and the following disclaimer in the | ||
| documentation and/or other materials provided with the distribution; | ||
| neither the name of the copyright holders nor the names of its | ||
| contributors may be used to endorse or promote products derived from | ||
| this software without specific prior written permission. | ||
|
|
||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| */ | ||
| #include <stdio.h> | ||
| #include <gem5/m5ops.h> | ||
|
|
||
|
|
||
| void init_() __attribute__((constructor)); | ||
| void map_m5_mem(); | ||
|
|
||
| void init_() { | ||
|
|
||
| //__attribute__ makes this function get called before main() | ||
| // need to mmap /dev/mem | ||
| printf(" --------------------- M5 INIT --------------------- \n"); | ||
| map_m5_mem(); | ||
| } | ||
|
|
||
| void m5_exit_interface_() | ||
| { | ||
| printf(" --------------------- M5 EXIT --------------------- \n"); | ||
| // this function calls m5_exit | ||
| m5_exit(0); | ||
| } | ||
|
|
||
| void m5_work_begin_interface_() | ||
| { | ||
|
|
||
| printf(" -------------------- ROI BEGIN -------------------- \n"); | ||
| m5_hypercall(4); | ||
| } | ||
|
|
||
| void m5_work_end_interface_() | ||
| { | ||
| m5_hypercall(5); | ||
| printf(" -------------------- ROI END -------------------- \n"); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this change supposed to be in this PR? It's a change for Arm NPB, but the PR is for RISCV.