xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Stefano Stabellini <sstabellini@kernel.org>
Cc: andre.przywara@arm.com, xen-devel@lists.xen.org
Subject: Re: [PATCH v2 04/24] xen/arm: mm: Redefine mfn_to_virt to use typesafe
Date: Sat, 16 Sep 2017 10:27:35 +0100	[thread overview]
Message-ID: <b0961e1f-4af7-4653-ec76-8f122fd275c0@arm.com> (raw)
In-Reply-To: <alpine.DEB.2.10.1709151653410.9439@sstabellini-ThinkPad-X260>

Hi Stefano,

On 09/16/2017 12:56 AM, Stefano Stabellini wrote:
> On Tue, 12 Sep 2017, Julien Grall wrote:
>> This add a bit more safety in the memory subsystem code.
>>
>> Signed-off-by: Julien Grall <julien.grall@arm.com>
>> ---
>>   xen/arch/arm/mm.c | 16 +++++++++-------
>>   1 file changed, 9 insertions(+), 7 deletions(-)
>>
>> diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
>> index 965d0573a4..5716ef1123 100644
>> --- a/xen/arch/arm/mm.c
>> +++ b/xen/arch/arm/mm.c
>> @@ -47,6 +47,8 @@ struct domain *dom_xen, *dom_io, *dom_cow;
>>   /* Override macros from asm/page.h to make them work with mfn_t */
>>   #undef virt_to_mfn
>>   #define virt_to_mfn(va) _mfn(__virt_to_mfn(va))
>> +#undef mfn_to_virt
>> +#define mfn_to_virt(mfn) __mfn_to_virt(mfn_x(mfn))
>>   
>>   /* Static start-of-day pagetables that we use before the allocators
>>    * are up. These are used by all CPUs during bringup before switching
>> @@ -837,7 +839,7 @@ void __init setup_xenheap_mappings(unsigned long base_mfn,
>>        * Virtual address aligned to previous 1GB to match physical
>>        * address alignment done above.
>>        */
>> -    vaddr = (vaddr_t)mfn_to_virt(base_mfn) & FIRST_MASK;
>> +    vaddr = (vaddr_t)__mfn_to_virt(base_mfn) & FIRST_MASK;
> 
> Don't you think it would be better to do mfn_to_virt(_mfn(base_mfn)) in
> this patch? This is just bike-shedding, but I think it would be more
> obviously consistent. Other than that, it looks good.

Well, last time I used mfn_x/_mfn in similar condition, you requested to 
use the __* version (see [1]).

I really don't mind which one to use. But we should stay consistent with 
the macros to use for non-typesafe version.

Cheers,

[1] http://patches.linaro.org/patch/105386/

-- 
Julien Grall

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

  reply	other threads:[~2017-09-16  9:27 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-12 10:03 [PATCH v2 00/24] xen/arm: Memory subsystem clean-up Julien Grall
2017-09-12 10:03 ` [PATCH v2 01/24] xen/x86: mm: Introduce {G, M}FN <-> {G, M}ADDR helpers Julien Grall
2017-09-12 10:14   ` Andrew Cooper
2017-09-12 10:29   ` Wei Liu
2017-09-12 10:03 ` [PATCH v2 02/24] xen/mm: Use typesafe MFN for alloc_boot_pages return Julien Grall
2017-09-12 10:27   ` Jan Beulich
2017-09-12 10:29   ` Wei Liu
2017-09-12 14:19   ` George Dunlap
2017-09-15 23:33   ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 03/24] xen/mm: Use __virt_to_mfn in map_domain_page instead of virt_to_mfn Julien Grall
2017-09-12 10:29   ` Wei Liu
2017-09-15 23:39   ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 04/24] xen/arm: mm: Redefine mfn_to_virt to use typesafe Julien Grall
2017-09-15 23:56   ` Stefano Stabellini
2017-09-16  9:27     ` Julien Grall [this message]
2017-09-19 22:58       ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 05/24] xen/arm: hsr_iabt: Document RES0 field Julien Grall
2017-09-15 23:43   ` Stefano Stabellini
2017-09-15 23:45   ` [PATCH v2 06/24] xen/arm: traps: Don't define FAR_EL2 for ARM32 Stefano Stabellini
2017-09-12 10:03 ` Julien Grall
2017-09-12 10:03 ` [PATCH v2 07/24] xen/arm: arm32: Don't define FAR_EL1 Julien Grall
2017-09-15 23:51   ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 08/24] xen/arm: Add FnV field in hsr_*abt Julien Grall
2017-09-15 23:58   ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 09/24] xen/arm: Introduce hsr_xabt to gather common bits between hsr_dabt and Julien Grall
2017-09-12 15:01   ` Julien Grall
2017-09-16  0:04   ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 10/24] xen/arm: traps: Introduce a helper to read the hypersivor fault register Julien Grall
2017-09-16  0:08   ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 11/24] xen/arm: traps: Improve logging for data/prefetch abort fault Julien Grall
2017-09-16  0:15   ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 12/24] xen/arm: Replace ioremap_attr(PAGE_HYPERVISOR_NOCACHE) call by ioremap_nocache Julien Grall
2017-09-16  0:17   ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 13/24] xen/arm: page: Remove unused attributes DEV_NONSHARED and DEV_CACHED Julien Grall
2017-09-19 23:32   ` Stefano Stabellini
2017-09-20 17:55     ` Julien Grall
2017-09-12 10:03 ` [PATCH v2 14/24] xen/arm: page: Use directly BUFFERABLE and drop DEV_WC Julien Grall
2017-09-19 23:33   ` Stefano Stabellini
2017-09-20 17:56     ` Julien Grall
2017-09-12 10:03 ` [PATCH v2 15/24] xen/arm: page: Prefix memory types with MT_ Julien Grall
2017-09-16  0:29   ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 16/24] xen/arm: page: Use ARMv8 naming to improve readability Julien Grall
2017-09-19 23:45   ` Stefano Stabellini
2017-09-21 15:17     ` Julien Grall
2017-09-21 15:46       ` Stefano Stabellini
2017-09-21 15:52         ` Andre Przywara
2017-09-21 16:37         ` Julien Grall
2017-09-12 10:03 ` [PATCH v2 17/24] xen/arm: page: Clean-up the definition of MAIRVAL Julien Grall
2017-09-19 23:51   ` Stefano Stabellini
2017-09-20 17:57     ` Julien Grall
2017-09-20 21:03       ` Stefano Stabellini
2017-09-20 22:11         ` Julien Grall
2017-09-12 10:03 ` [PATCH v2 18/24] xen/arm: mm: Rename and clarify AP[1] in the stage-1 page table Julien Grall
2017-09-19 23:01   ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 19/24] xen/arm: Switch to SYS_STATE_boot just after end_boot_allocator() Julien Grall
2017-09-19 23:02   ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 20/24] xen/arm: mm: Rename 'ai' into 'flags' in create_xen_entries Julien Grall
2017-09-19 23:10   ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 21/24] xen/arm: page: Describe the layout of flags used to update page tables Julien Grall
2017-09-19 23:11   ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 22/24] xen/arm: mm: Embed permission in the flags Julien Grall
2017-09-19 23:59   ` Stefano Stabellini
2017-09-20 18:03     ` Julien Grall
2017-09-20 21:07       ` Stefano Stabellini
2017-09-20 22:13         ` Julien Grall
2017-09-12 10:03 ` [PATCH v2 23/24] xen/arm: mm: Handle permission flags when adding a new mapping Julien Grall
2017-09-19 23:17   ` Stefano Stabellini
2017-10-02 13:30     ` Julien Grall
2017-09-12 10:03 ` [PATCH v2 24/24] xen/arm: mm: Use memory flags for modify_xen_mappings rather than custom one Julien Grall
2017-09-20  0:02   ` Stefano Stabellini
2017-09-20  0:29 ` [PATCH v2 00/24] xen/arm: Memory subsystem clean-up Stefano Stabellini
2017-09-20 21:12   ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b0961e1f-4af7-4653-ec76-8f122fd275c0@arm.com \
    --to=julien.grall@arm.com \
    --cc=andre.przywara@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).