Skip to content

Commit bbca8b6

Browse files
committed
Merge: Initial bringup of riscv64 for centos
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/1155 JIRA: https://issues.redhat.com/browse/RHEL-101827 Added a section to priority.rhel in order to start generating riscv64 configs. kernel.spec.template is likewise updated to add riscv64 to the arch list for the rhel build flavor. Values are provided for all required configuration options and a few RISCV specific upstream patches are back-ported to make the code build. Note that the RHEL 10 RISC-V Developer Preview was announced at Red Hat Summit and is already available: * https://www.redhat.com/en/blog/red-hat-partners-with-sifive-for-risc-v-developer-preview-for-red-hat-enterprise-linux-10 * https://riscv.org/ecosystem-news/2025/05/sifive-collaborates-with-red-hat-to-support-red-hat-enterprise-linux-for-risc-v/ * https://developers.redhat.com/products/rhel-riscv Although that preview targets the SiFive HiFive Premier P550, the drivers for that system have not yet been accepted in the upstream kernel, so this MR only enables the virt target for a RISC-V kernel that is able to boot within QEMU but does not include drivers that would be needed to boot on any specific RISC-V hardware. The developer preview kernel source with P550 drivers is available at https://gitlab.com/CentOS/isa/src/kernel/centos-stream-10/-/tree/p550 There do not currently exist any announcements for future RHEL RISC-V releases, updates, or images. Contributions and builds will continue in CentOS. RISC-V koji builders for both CentOS and Fedora are currently being worked on in parallel over the next several weeks. Co-developed-by: Jennifer Berringer jberring@redhat.com Signed-off-by: Jennifer Berringer jberring@redhat.com Signed-off-by: Charles Mirabile <cmirabil@redhat.com> Approved-by: John W. Linville <linville@redhat.com> Approved-by: Jennifer Berringer <jberring@redhat.com> Approved-by: Vladis Dronov <vdronov@redhat.com> Approved-by: Murphy Zhou <xzhou@redhat.com> Approved-by: Rafael Aquini <raquini@redhat.com> Approved-by: David Arcari <darcari@redhat.com> Approved-by: Ivan Vecera <ivecera@redhat.com> Approved-by: Robert Foss <rfoss@kernel.org> Approved-by: Jan Stancek <jstancek@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Scott Weaver <scweaver@redhat.com>
2 parents 0b26c21 + eb86794 commit bbca8b6

File tree

111 files changed

+123
-20
lines changed

Some content is hidden

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

111 files changed

+123
-20
lines changed

arch/riscv/include/asm/compat.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
*/
1010
#include <linux/types.h>
1111
#include <linux/sched.h>
12-
#include <linux/sched/task_stack.h>
1312
#include <asm-generic/compat.h>
1413

1514
static inline int is_compat_task(void)

arch/riscv/kvm/mmu.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,7 @@ int kvm_riscv_gstage_map(struct kvm_vcpu *vcpu,
601601
bool logging = (memslot->dirty_bitmap &&
602602
!(memslot->flags & KVM_MEM_READONLY)) ? true : false;
603603
unsigned long vma_pagesize, mmu_seq;
604+
struct page *page;
604605

605606
/* We need minimum second+third level pages */
606607
ret = kvm_mmu_topup_memory_cache(pcache, gstage_pgd_levels);
@@ -631,7 +632,7 @@ int kvm_riscv_gstage_map(struct kvm_vcpu *vcpu,
631632

632633
/*
633634
* Read mmu_invalidate_seq so that KVM can detect if the results of
634-
* vma_lookup() or gfn_to_pfn_prot() become stale priort to acquiring
635+
* vma_lookup() or __kvm_faultin_pfn() become stale prior to acquiring
635636
* kvm->mmu_lock.
636637
*
637638
* Rely on mmap_read_unlock() for an implicit smp_rmb(), which pairs
@@ -647,7 +648,7 @@ int kvm_riscv_gstage_map(struct kvm_vcpu *vcpu,
647648
return -EFAULT;
648649
}
649650

650-
hfn = gfn_to_pfn_prot(kvm, gfn, is_write, &writable);
651+
hfn = kvm_faultin_pfn(vcpu, gfn, is_write, &writable, &page);
651652
if (hfn == KVM_PFN_ERR_HWPOISON) {
652653
send_sig_mceerr(BUS_MCEERR_AR, (void __user *)hva,
653654
vma_pageshift, current);
@@ -669,7 +670,6 @@ int kvm_riscv_gstage_map(struct kvm_vcpu *vcpu,
669670
goto out_unlock;
670671

671672
if (writable) {
672-
kvm_set_pfn_dirty(hfn);
673673
mark_page_dirty(kvm, gfn);
674674
ret = gstage_map_page(kvm, pcache, gpa, hfn << PAGE_SHIFT,
675675
vma_pagesize, false, true);
@@ -682,9 +682,8 @@ int kvm_riscv_gstage_map(struct kvm_vcpu *vcpu,
682682
kvm_err("Failed to map in G-stage\n");
683683

684684
out_unlock:
685+
kvm_release_faultin_page(kvm, page, ret && ret != -EEXIST, writable);
685686
spin_unlock(&kvm->mmu_lock);
686-
kvm_set_pfn_accessed(hfn);
687-
kvm_release_pfn_clean(hfn);
688687
return ret;
689688
}
690689

redhat/Makefile.cross

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,16 @@ dist-cross-s390x-rpms: dist-cross-setup dist-sources
4444
$(REDHAT)/scripts/cross-compile/generate-cross-report.sh "s390x"
4545

4646
dist-cross-riscv64-rpms: dist-cross-setup dist-sources
47-
@if [ "$(DISTRO)" = "fedora" ]; then \
48-
$(REDHAT)/scripts/cross-compile/x86_rngd.sh; \
49-
$(CROSS_RPMFLAGS) --target riscv64 --with cross $(CROSS_DISABLED_SUBPACKAGES) -ba $(RPM)/SOURCES/$(SPECFILE); \
50-
$(REDHAT)/scripts/cross-compile/generate-cross-report.sh "riscv64" ; \
51-
else \
52-
echo "INFO: RISC-V builds are only supported on Fedora."; \
53-
fi;
47+
$(REDHAT)/scripts/cross-compile/x86_rngd.sh
48+
$(CROSS_RPMFLAGS) --target riscv64 --with cross $(CROSS_DISABLED_SUBPACKAGES) -ba $(RPM)/SOURCES/$(SPECFILE)
49+
$(REDHAT)/scripts/cross-compile/generate-cross-report.sh "riscv64"
5450

5551
dist-cross-all-rpms: dist-cross-setup dist-sources
5652
$(REDHAT)/scripts/cross-compile/x86_rngd.sh
5753
$(CROSS_RPMFLAGS) --target aarch64 --with cross $(CROSS_DISABLED_SUBPACKAGES) -ba $(RPM)/SOURCES/$(SPECFILE)
5854
$(CROSS_RPMFLAGS) --target ppc64le --with cross $(CROSS_DISABLED_SUBPACKAGES) -ba $(RPM)/SOURCES/$(SPECFILE)
5955
$(CROSS_RPMFLAGS) --target s390x --with cross $(CROSS_DISABLED_SUBPACKAGES) -ba $(RPM)/SOURCES/$(SPECFILE)
60-
@if [ "$(DISTRO)" = "fedora" ]; then \
61-
$(CROSS_RPMFLAGS) --target riscv64 --with cross $(CROSS_DISABLED_SUBPACKAGES) -ba $(RPM)/SOURCES/$(SPECFILE); \
62-
else \
63-
echo "INFO: RISC-V builds are only supported on Fedora."; \
64-
fi;
56+
$(CROSS_RPMFLAGS) --target riscv64 --with cross $(CROSS_DISABLED_SUBPACKAGES) -ba $(RPM)/SOURCES/$(SPECFILE)
6557
$(CROSS_RPMFLAGS) -ba $(RPM)/SOURCES/$(SPECFILE)
6658
$(REDHAT)/scripts/cross-compile/generate-cross-report.sh "aarch64 ppc64 s390x x86_64 riscv64"
6759

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# CONFIG_BINFMT_FLAT is not set
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_ACPI=y
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_ACPI_CPPC_CPUFREQ=m
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# CONFIG_ACPI_DOCK is not set
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# CONFIG_ARCH_RENESAS is not set
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_ARCH_RV64I=y
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_ARCH_VIRT=y

0 commit comments

Comments
 (0)