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

Re: [PATCH] x86+Arm: drop (rename) __virt_to_maddr() / __maddr_to_virt()


  • To: Julien Grall <julien@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Wed, 6 Mar 2024 08:45:42 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=xen.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0NiyVVxkm7qwYRYm/eVn+i/fZI60GXvgZNgQfOtD4RI=; b=ffnu5nrGM+d4pj9yL/WlPCKfdGnowzF+qlbRp7pbZiLDsEwKgK6m+GzEY/Cr7MNG2zx/FyP8vf1wkS2Ur1zaj2bNWqZOiY35UOCUkfwUDMBTRSdOvgj8EVKfAf8dB1Jllg8Kt3KnFwpcEK30HNmvFnBQqwZc9Yw0PmeOneT2n/AK6KryRfibXhHGwHirxeTvOEZtQTG/qy1CsdTJBYyQJjt5+9dT2+FlACSCHe5iHDzYCohrqrZ2kSZOxvT/9XauOUe1yUUb54oo7B+bbTpV72HibmdtjVb4TkoFSADjHCfaSFRVUtECBPTO8IH+hRyrGjtUWfiO6rqZrj/7NMShzg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NVH8okqh0vq2WyZNx5oH4mDtkyAHdGLc5mNRJ8gqoRJ6grQ+koj/Ro9nnWCPvtV2zxuBEVgs6jWuiLS383Q3WAoKpGjntLYs7B5JIMY8sFlXZMC3mxBr4xfmTTYipRl1eQg7SkoRtO2004TKwfH7CSWXQMdseOtypUrTpDucH0hyXRdWNlUyzjr7xUq7UI1BUoE8T8+e1Bwi89T9sCJXIil3DtcV+amuKC0O4rJB5JMXYWNRf8s++9tHkHPShV+fG6gM4TCpxbJXGrJaJWt7cewGoXMKhGIBVYFeT4xg6OPCLvaBKuf+QOwiefuZHo3LqQhNULKSMvwx0kkQ32VSPQ==
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
  • Delivery-date: Wed, 06 Mar 2024 07:46:01 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 05/03/2024 20:24, Julien Grall wrote:
> 
> 
> Hi Jan,
> 
> The title is quite confusing. I would have expected the macro...
> 
> On 05/03/2024 08:33, Jan Beulich wrote:
>> There's no use of them anymore except in the definitions of the non-
>> underscore-prefixed aliases. Rename the inline functions, adjust the
>> virt_to_maddr() #define-e, and purge the (x86-only) maddr_to_virt() one,
>> thus eliminating a bogus cast which would have allowed the passing of a
>> pointer type variable into maddr_to_virt() to go silently.
>>
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>>
>> --- a/xen/arch/arm/include/asm/mm.h
>> +++ b/xen/arch/arm/include/asm/mm.h
>> @@ -256,12 +256,12 @@ static inline void __iomem *ioremap_wc(p
>>   /* Page-align address and convert to frame number format */
>>   #define paddr_to_pfn_aligned(paddr)    paddr_to_pfn(PAGE_ALIGN(paddr))
>>
>> -static inline paddr_t __virt_to_maddr(vaddr_t va)
>> +static inline paddr_t virt_to_maddr(vaddr_t va)
>>   {
>>       uint64_t par = va_to_par(va);
>>       return (par & PADDR_MASK & PAGE_MASK) | (va & ~PAGE_MASK);
>>   }
>> -#define virt_to_maddr(va)   __virt_to_maddr((vaddr_t)(va))
>> +#define virt_to_maddr(va) virt_to_maddr((vaddr_t)(va))
> 
> ... to be removed. But you keep it and just overload the name. I know it
> is not possible to remove the macro because some callers are using
> pointers (?). So I would rather prefer if we keep the name distinct on Arm.
> 
> Let see what the other Arm maintainers think.
I share the same opinion. If it's about double underscores that violates MISRA 
rule, I think
we deviated it the same way we deviated unique identifiers (IIRC).

~Michal



 


Rackspace

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