Skip to content

Commit 9098e19

Browse files
authored
feat: GHA updates
* Merge pull request epics-modules#23 from jerzyjamroz/gha * added permissions to .yml files * codeql for the module and kmod * check-editorconfig.yml
2 parents d95da30 + ed3d983 commit 9098e19

File tree

7 files changed

+220
-7
lines changed

7 files changed

+220
-7
lines changed

.editorconfig

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Documentation for this file: https://EditorConfig.org
2+
3+
root = true
4+
5+
# Unix-style newlines ending every file,
6+
# as some compilers complain about files not ending in newline
7+
[*]
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
charset = utf-8
11+
end_of_line = lf
12+
13+
# Ignore for OPI-s
14+
[*.{opi,bob,def}]
15+
insert_final_newline = unset
16+
end_of_line = unset
17+
18+
[*Makefile*]
19+
trim_trailing_whitespace = false
20+
tab_width = 4
21+
indent_style = tab
22+
23+
[{*.{md,lyx},Doxyfile,LICENSE,copyright}]
24+
charset = unset
25+
trim_trailing_whitespace = false

.github/codeql/config.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: "CodeQL Config"
2+
3+
# Queries and the suites they belong to are documented at
4+
# https://codeql.github.com/codeql-query-help/cpp/
5+
6+
queries:
7+
- uses: security-and-quality
8+
# Choose the above from 3 query suites:
9+
# default
10+
# The default set of queries
11+
# security-extended
12+
# `default` suite plus lower severity and precision queries
13+
# security-and-quality
14+
# `security-extended`, plus maintainability and reliability queries
15+
16+
query-filters:
17+
-
18+
exclude:
19+
id: cpp/use-of-goto
20+
-
21+
exclude:
22+
problem.severity: recommendation
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Check EditorConfig
2+
3+
on:
4+
push: {}
5+
pull_request: {}
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
editorconfig:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: EditorConfig compliance check
16+
uses: editorconfig-checker/action-editorconfig-checker@v2

.github/workflows/kmod-codeql.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: CodeQL Linux kernel module
2+
3+
on:
4+
push:
5+
paths:
6+
- ".github/workflows/kmod-codeql.yml"
7+
- "linux/**"
8+
pull_request:
9+
paths:
10+
- ".github/workflows/kmod-codeql.yml"
11+
- "linux/**"
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: read
16+
actions: read
17+
security-events: write
18+
19+
jobs:
20+
analyze:
21+
name: CodeQL (C/C++)
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Info
29+
run: |
30+
uname -a
31+
gcc --version
32+
33+
- name: Deps
34+
run: |
35+
sudo apt-get update
36+
sudo apt-get -y install linux-headers-$(uname -r) kmod libelf-dev make
37+
38+
- name: Initialize CodeQL
39+
uses: github/codeql-action/init@v3
40+
with:
41+
languages: cpp
42+
# Optional stronger rules:
43+
# queries: security-and-quality
44+
# Optional smaller SARIF:
45+
# add-snippets: false
46+
47+
- name: Build (extraction only)
48+
run: |
49+
make -C linux
50+
51+
- name: Analyze
52+
uses: github/codeql-action/analyze@v3
53+
with:
54+
category: "/language:cpp"

.github/workflows/ci-scripts-build.yml renamed to .github/workflows/module-build.yml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,38 @@
55

66
# Set the 'name:' properties to values that work for you (pvxs)
77

8-
name: devlib2
8+
name: Module Build and Test
99

1010
# Trigger on pushes and PRs to any branch
1111
on:
1212
push:
13-
paths-ignore:
14-
- "documentation/**"
15-
- "**/*.md"
13+
paths:
14+
- ".github/workflows/module-build.yml"
15+
- "configure/**"
16+
- "common/**"
17+
- "exploreApp/**"
18+
- "pciApp/**"
19+
- "vmeApp/**"
20+
- "testApp/**"
21+
- "Makefile"
1622
pull_request:
17-
paths-ignore:
18-
- "documentation/**"
19-
- "**/*.md"
23+
paths:
24+
- ".github/workflows/module-build.yml"
25+
- "configure/**"
26+
- "common/**"
27+
- "exploreApp/**"
28+
- "pciApp/**"
29+
- "vmeApp/**"
30+
- "testApp/**"
31+
- "Makefile"
2032
workflow_dispatch:
2133

34+
permissions:
35+
contents: read
36+
pull-requests: write
37+
issues: write
38+
statuses: write
39+
2240
env:
2341
SETUP_PATH: .ci-local:.ci
2442
EPICS_TEST_IMPRECISE_TIMING: YES
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: CodeQL Module
2+
3+
on:
4+
push:
5+
branches: [master, gha]
6+
paths:
7+
- ".github/workflows/module-codeql.yml"
8+
- "common/**"
9+
- "exploreApp/**"
10+
- "pciApp/**"
11+
- "vmeApp/**"
12+
pull_request:
13+
branches: [master]
14+
paths:
15+
- ".github/workflows/module-codeql.yml"
16+
- "common/**"
17+
- "exploreApp/**"
18+
- "pciApp/**"
19+
- "vmeApp/**"
20+
21+
permissions:
22+
contents: read
23+
security-events: write
24+
25+
env:
26+
SETUP_PATH: .ci-local:.ci
27+
BASE: "7.0"
28+
CMP: gcc
29+
BCFG: default
30+
31+
jobs:
32+
analyze:
33+
name: Analyze
34+
runs-on: ubuntu-latest
35+
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
with:
40+
submodules: true
41+
fetch-depth: 0
42+
43+
- name: Deps
44+
run: |
45+
sudo apt-get update
46+
sudo apt-get -y install qemu-system-x86 gdb
47+
48+
- name: Prepare deps (ci-scripts)
49+
run: python3 .ci/cue.py prepare
50+
51+
- name: Initialize CodeQL (manual build)
52+
uses: github/codeql-action/init@v3
53+
with:
54+
languages: cpp
55+
build-mode: manual
56+
config-file: ./.github/codeql/config.yml
57+
58+
- name: Build (ci-scripts)
59+
run: |
60+
python3 .ci/cue.py build
61+
62+
- name: Analyze
63+
uses: github/codeql-action/analyze@v3
64+
with:
65+
category: "/language:cpp"

linux/pci_generic_msi.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,14 @@ int mmap_generic_msi(struct uio_info *info, struct vm_area_struct *vma)
6767
return -EINVAL;
6868
}
6969

70+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
71+
vm_flags_set(vma, VM_IO | VM_RESERVED);
72+
#elif defined(RHEL_RELEASE_CODE) && (RHEL_RELEASE_CODE >= 0x905)
73+
vm_flags_set(vma, VM_IO | VM_RESERVED);
74+
#else
7075
vma->vm_flags |= VM_IO | VM_RESERVED;
76+
#endif
77+
7178
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
7279

7380
return remap_pfn_range(vma,
@@ -163,9 +170,15 @@ static int probe_generic_msi(struct pci_dev *pdev,
163170
}
164171

165172
{
173+
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
166174
struct msi_desc *desc = irq_get_msi_desc(pdev->irq);
167175
priv->maskable = desc ? desc->msi_attrib.maskbit : 0;
168176
dev_info(&pdev->dev, "MSI is %smaskable\n", priv->maskable ? "" : "not ");
177+
#else
178+
// Newer kernels: msi_desc not active
179+
priv->maskable = 0;
180+
dev_info(&pdev->dev, "MSI enabled (mask-bit introspection not available).\n");
181+
#endif
169182
}
170183

171184
err = uio_register_device(&pdev->dev, &priv->uio);

0 commit comments

Comments
 (0)