Skip to content

Commit 085e899

Browse files
committed
Merge tag 'kvm-riscv-fixes-6.17-1' of https://github.com/kvm-riscv/linux into HEAD
KVM/riscv fixes for 6.17, take #1 - Fix pte settings within kvm_riscv_gstage_ioremap() - Fix comments in kvm_riscv_check_vcpu_requests() - Fix stack overrun when setting vlenb via ONE_REG
2 parents 22b2ca0 + 7997662 commit 085e899

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

arch/riscv/kvm/mmu.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ int kvm_riscv_mmu_ioremap(struct kvm *kvm, gpa_t gpa, phys_addr_t hpa,
3939
unsigned long size, bool writable, bool in_atomic)
4040
{
4141
int ret = 0;
42+
pgprot_t prot;
4243
unsigned long pfn;
4344
phys_addr_t addr, end;
4445
struct kvm_mmu_memory_cache pcache = {
@@ -55,10 +56,12 @@ int kvm_riscv_mmu_ioremap(struct kvm *kvm, gpa_t gpa, phys_addr_t hpa,
5556

5657
end = (gpa + size + PAGE_SIZE - 1) & PAGE_MASK;
5758
pfn = __phys_to_pfn(hpa);
59+
prot = pgprot_noncached(PAGE_WRITE);
5860

5961
for (addr = gpa; addr < end; addr += PAGE_SIZE) {
6062
map.addr = addr;
61-
map.pte = pfn_pte(pfn, PAGE_KERNEL_IO);
63+
map.pte = pfn_pte(pfn, prot);
64+
map.pte = pte_mkdirty(map.pte);
6265
map.level = 0;
6366

6467
if (!writable)

arch/riscv/kvm/vcpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
683683
}
684684

685685
/**
686-
* check_vcpu_requests - check and handle pending vCPU requests
686+
* kvm_riscv_check_vcpu_requests - check and handle pending vCPU requests
687687
* @vcpu: the VCPU pointer
688688
*
689689
* Return: 1 if we should enter the guest

arch/riscv/kvm/vcpu_vector.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ int kvm_riscv_vcpu_set_reg_vector(struct kvm_vcpu *vcpu,
182182
struct kvm_cpu_context *cntx = &vcpu->arch.guest_context;
183183
unsigned long reg_val;
184184

185+
if (reg_size != sizeof(reg_val))
186+
return -EINVAL;
185187
if (copy_from_user(&reg_val, uaddr, reg_size))
186188
return -EFAULT;
187189
if (reg_val != cntx->vector.vlenb)

0 commit comments

Comments
 (0)