Dong, Eddie wrote:
@@ -2183,6 +2197,25 @@ static int paging64_init_context_common(struct kvm_vcpu 
*vcpu, int level)
static int paging64_init_context(struct kvm_vcpu *vcpu)
 {
+       struct kvm_mmu *context = &vcpu->arch.mmu;
+       int maxphyaddr = cpuid_maxphyaddr(vcpu);
+       u64 exb_bit_rsvd = 0;
+
+       if (!is_nx(vcpu))
+               exb_bit_rsvd = rsvd_bits(63, 63);
+
+       context->rsvd_bits_mask[0][3] = exb_bit_rsvd |
+               rsvd_bits(maxphyaddr, 51) | rsvd_bits(7, 8);
+       context->rsvd_bits_mask[0][2] = exb_bit_rsvd |
+               rsvd_bits(maxphyaddr, 51) | rsvd_bits(7, 8);
+       context->rsvd_bits_mask[0][1] = exb_bit_rsvd |
+               rsvd_bits(maxphyaddr, 51) | rsvd_bits(7, 8);
+       context->rsvd_bits_mask[0][0] = rsvd_bits(maxphyaddr, 51);
+       context->rsvd_bits_mask[1][3] = context->rsvd_bits_mask[0][3];
+       context->rsvd_bits_mask[1][2] = context->rsvd_bits_mask[0][2];
+       context->rsvd_bits_mask[1][1] = exb_bit_rsvd |
+               rsvd_bits(maxphyaddr, 51) | rsvd_bits(13, 20);
+       context->rsvd_bits_mask[1][0] = context->rsvd_bits_mask[0][0];
        return paging64_init_context_common(vcpu, PT64_ROOT_LEVEL);
 }

Just noticed that walk_addr() too can be called from tdp context, so need to make sure rsvd_bits_mask is initialized in init_kvm_tdp_mmu() as well.

--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to