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

Re: [Xen-devel] [PATCH for 4.9 1/6] x86/hvm: Correct some address space terminology



On 03/04/17 09:24, Jan Beulich wrote:
>>>> On 31.03.17 at 21:50, <andrew.cooper3@xxxxxxxxxx> wrote:
>> The function hvm_translate_linear_addr() translates a virtual address to a
>> linear address, not a linear address to a physical address.  Correct its 
>> name.
>>
>> Both hvm_translate_virtual_addr() and hvmemul_virtual_to_linear() return a
>> linear address, not a physical address.  Correct the parameters name.
> I think the "p" in the names didn't stand for "physical", but for
> "pointer",

In which case it should have been p_addr,

As it stands, we have a paddr_t which very definitely is a physical address.

>  and I further think ...
>
>> --- a/xen/arch/x86/hvm/emulate.c
>> +++ b/xen/arch/x86/hvm/emulate.c
>> @@ -506,7 +506,7 @@ static int hvmemul_virtual_to_linear(
>>      unsigned long *reps,
>>      enum hvm_access_type access_type,
>>      struct hvm_emulate_ctxt *hvmemul_ctxt,
>> -    unsigned long *paddr)
>> +    unsigned long *linear)
> ... retaining the "p" here and ...
>
>> --- a/xen/arch/x86/mm/shadow/common.c
>> +++ b/xen/arch/x86/mm/shadow/common.c
>> @@ -136,13 +136,13 @@ static struct segment_register *hvm_get_seg_reg(
>>      return seg_reg;
>>  }
>>  
>> -static int hvm_translate_linear_addr(
>> +static int hvm_translate_virtual_addr(
>>      enum x86_segment seg,
>>      unsigned long offset,
>>      unsigned int bytes,
>>      enum hvm_access_type access_type,
>>      struct sh_emulate_ctxt *sh_ctxt,
>> -    unsigned long *paddr)
>> +    unsigned long *linear)
> ... here would be useful (to distinguish the virtual address
> represented by the pointer itself - in hypervisor space - from the
> one the pointer points to, i.e. in guest space).

The virtual address representation is {seg, offset}, and Xen can't use
linear addresses.

I can't see any way to get them accidentally confused.

~Andrew

>
> With that
> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
>
> Jan
>


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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