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

Re: [PATCH v2 02/12] x86/p2m: {,un}map_mmio_regions() are HVM-only



On 29.04.2021 16:48, Roger Pau Monné wrote:
> On Mon, Apr 12, 2021 at 04:06:34PM +0200, Jan Beulich wrote:
>> Mirror the "translated" check the functions do to do_domctl(), allowing
>> the calls to be DCEd by the compiler. Add ASSERT_UNREACHABLE() to the
>> original checks.
>>
>> Also arrange for {set,clear}_mmio_p2m_entry() and
>> {set,clear}_identity_p2m_entry() to respectively live next to each
>> other, such that clear_mmio_p2m_entry() can also be covered by the
>> #ifdef already covering set_mmio_p2m_entry().
> 
> Seeing the increase in HVM specific regions, would it make sense to
> consider splitting the HVM bits into p2m-hvm.c or some such?

As said on the 01/12 sub-thread, I see the goal as p2m.c as a whole
becoming HVM specific.

>> @@ -1932,7 +1934,10 @@ int map_mmio_regions(struct domain *d,
>>      unsigned int iter, order;
>>  
>>      if ( !paging_mode_translate(d) )
>> +    {
>> +        ASSERT_UNREACHABLE();
>>          return 0;
>> +    }
>>  
>>      for ( iter = i = 0; i < nr && iter < MAP_MMIO_MAX_ITER;
>>            i += 1UL << order, ++iter )
>> @@ -1964,7 +1969,10 @@ int unmap_mmio_regions(struct domain *d,
>>      unsigned int iter, order;
>>  
>>      if ( !paging_mode_translate(d) )
>> +    {
>> +        ASSERT_UNREACHABLE();
>>          return 0;
> 
> Maybe consider returning an error here now instead of silently
> failing? It's not supposed to be reached, so getting here likely means
> something else has gone wrong and it's best to just report an error?

Can do, sure. Would be -EOPNOTSUPP.

> The rest LGTM:
> 
> Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

Thanks.

Jan



 


Rackspace

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