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

Re: [Xen-devel] [RFC PATCH v2 2/3] arch, arm: add the XEN_DOMCTL_memory_mapping hypercall



>>> On 13.03.14 at 16:29, Ian Campbell <Ian.Campbell@xxxxxxxxxx> wrote:
>> @@ -30,7 +31,75 @@ long arch_do_domctl(struct xen_domctl *domctl, struct 
>> domain *d,
>>  
>>          return p2m_cache_flush(d, s, e);
>>      }
>> +    case XEN_DOMCTL_memory_mapping:
>> +    {
>> +        unsigned long gfn = domctl->u.memory_mapping.first_gfn;
>> +        unsigned long mfn = domctl->u.memory_mapping.first_mfn;
>> +        unsigned long nr_mfns = domctl->u.memory_mapping.nr_mfns;
>> +        int add = domctl->u.memory_mapping.add_mapping;
>> +        long int ret;
>> +
>> +        ret = -EINVAL;
>> +        if ( (mfn + nr_mfns - 1) < mfn || /* wrap? */
> 
> "foo + foo_mfns" appears quite a lot here. I think you could calculate
> those once into foo_start and foo_end and use throughout which would
> make the remainder much easier to follow.
> 
> Oh, I see this came from the x86 function of which this is an almost
> complete copy -- can it not be made common?
> 
> The difference seems to be map_mmio_regions vs. a loop over
> set_mmio_p2m_entry which seems easy enough to abstract out.

Indeed.

Jan


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


 


Rackspace

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