mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
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
This commit is contained in:
@@ -39,6 +39,7 @@ int kvm_riscv_mmu_ioremap(struct kvm *kvm, gpa_t gpa, phys_addr_t hpa,
|
||||
unsigned long size, bool writable, bool in_atomic)
|
||||
{
|
||||
int ret = 0;
|
||||
pgprot_t prot;
|
||||
unsigned long pfn;
|
||||
phys_addr_t addr, end;
|
||||
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,
|
||||
|
||||
end = (gpa + size + PAGE_SIZE - 1) & PAGE_MASK;
|
||||
pfn = __phys_to_pfn(hpa);
|
||||
prot = pgprot_noncached(PAGE_WRITE);
|
||||
|
||||
for (addr = gpa; addr < end; addr += PAGE_SIZE) {
|
||||
map.addr = addr;
|
||||
map.pte = pfn_pte(pfn, PAGE_KERNEL_IO);
|
||||
map.pte = pfn_pte(pfn, prot);
|
||||
map.pte = pte_mkdirty(map.pte);
|
||||
map.level = 0;
|
||||
|
||||
if (!writable)
|
||||
|
||||
@@ -683,7 +683,7 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
|
||||
}
|
||||
|
||||
/**
|
||||
* check_vcpu_requests - check and handle pending vCPU requests
|
||||
* kvm_riscv_check_vcpu_requests - check and handle pending vCPU requests
|
||||
* @vcpu: the VCPU pointer
|
||||
*
|
||||
* Return: 1 if we should enter the guest
|
||||
|
||||
@@ -182,6 +182,8 @@ int kvm_riscv_vcpu_set_reg_vector(struct kvm_vcpu *vcpu,
|
||||
struct kvm_cpu_context *cntx = &vcpu->arch.guest_context;
|
||||
unsigned long reg_val;
|
||||
|
||||
if (reg_size != sizeof(reg_val))
|
||||
return -EINVAL;
|
||||
if (copy_from_user(®_val, uaddr, reg_size))
|
||||
return -EFAULT;
|
||||
if (reg_val != cntx->vector.vlenb)
|
||||
|
||||
Reference in New Issue
Block a user