[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 23/25] x86/HVM: make use of new read-modify-write emulator hook



>>> On 02.02.18 at 17:37, <andrew.cooper3@xxxxxxxxxx> wrote:
> On 07/12/17 14:17, Jan Beulich wrote:
>> ..., at least as far as currently possible, i.e. when a mapping can be
>> obtained.
>>
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>> ---
>> v3: New.
>>
>> --- a/xen/arch/x86/hvm/emulate.c
>> +++ b/xen/arch/x86/hvm/emulate.c
>> @@ -1187,6 +1187,61 @@ static int hvmemul_write(
>>      return X86EMUL_OKAY;
>>  }
>>  
>> +static int hvmemul_rmw(
>> +    enum x86_segment seg,
>> +    unsigned long offset,
>> +    unsigned int bytes,
>> +    uint32_t *eflags,
>> +    struct x86_emulate_state *state,
>> +    struct x86_emulate_ctxt *ctxt)
>> +{
>> +    struct hvm_emulate_ctxt *hvmemul_ctxt =
>> +        container_of(ctxt, struct hvm_emulate_ctxt, ctxt);
>> +    unsigned long addr, reps = 1;
>> +    uint32_t pfec = PFEC_page_present | PFEC_write_access;
> 
> Drop present, and...

See reply to previous patch.

>> +    struct hvm_vcpu_io *vio = &current->arch.hvm_vcpu.hvm_io;
>> +    int rc;
>> +    void *mapping;
>> +
>> +    rc = hvmemul_virtual_to_linear(
>> +        seg, offset, bytes, &reps, hvm_access_write, hvmemul_ctxt, &addr);
>> +    if ( rc != X86EMUL_OKAY || !bytes )
>> +        return rc;
>> +
>> +    if ( is_x86_system_segment(seg) )
>> +        pfec |= PFEC_implicit;
>> +    else if ( hvmemul_ctxt->seg_reg[x86_seg_ss].dpl == 3 )
>> +        pfec |= PFEC_user_mode;
>> +
>> +    mapping = hvmemul_map_linear_addr(addr, bytes, pfec, hvmemul_ctxt);
>> +    if ( IS_ERR(mapping) )
>> +        return ~PTR_ERR(mapping);
>> +
>> +    if ( mapping )
>> +    {
>> +        rc = x86_emul_rmw(mapping, bytes, eflags, state, ctxt);
>> +        hvmemul_unmap_linear_addr(mapping, addr, bytes, hvmemul_ctxt);
>> +    }
>> +    else
>> +    {
>> +        unsigned long data = 0;
>> +        bool_t known_gpfn = vio->mmio_access.write_access &&
>> +                            vio->mmio_gla == (addr & PAGE_MASK);
> 
> ... bool here.

Oops.

> Otherwise, Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Thanks, but due to the first of the two requests you'll need to let
me know whether this applies with just the second change done.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.