[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>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 6 Mar 2024 10:59:23 +0100
  • Autocrypt: addr=jbeulich@xxxxxxxx; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL
  • 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>, Michal Orzel <michal.orzel@xxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 06 Mar 2024 09:59:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 06.03.2024 10:44, Julien Grall wrote:
> On 06/03/2024 07:22, Jan Beulich wrote:
>> On 05.03.2024 20:24, Julien Grall wrote:
>>> 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 (?).
>>
>> Indeed. I actually tried without, but the build fails miserably.
>>
>>> So I would rather prefer if we keep the name distinct on Arm.
>>>
>>> Let see what the other Arm maintainers think.
>>
>> Well, okay. I'm a little surprised though; I was under the impression
>> that a goal would be to, eventually, get rid of all the __-prefixed
>> secondary variants of this kind of helpers.
> 
> Because of MISRA? If so, you would be replacing one violation by another 
> one (duplicated name). IIRC we decided to deviate it, yet I don't 
> particular want to use the pattern in Arm headers when there is no need.
> 
> If you are trying to solve MISRA, then I think we want to either remove 
> the macro (not possible here) or suffix with the double-underscore the 
> static inline helper.

No, Misra is only secondary here. Many of these helpers come in two flavors
such than one can be overridden in individual source files. That's mainly
connected to type-safety being generally wanted, but not always easy to
achieve without a lot of code churn. We've made quite a bit of progress
there, and imo ultimately the need for two flavors of doing the same thing
ought to disappear.

Jan



 


Rackspace

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