All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: xen-devel@lists.xenproject.org, stefano.stabellini@eu.citrix.com,
	tim@xen.org, patches@linaro.org
Subject: Re: [PATCH 1/3] xen/arm: p2m: extend create_p2m_entries to support read-only mapping
Date: Tue, 12 Nov 2013 13:13:02 +0000	[thread overview]
Message-ID: <5282295E.4030005@linaro.org> (raw)
In-Reply-To: <1384176236.19117.26.camel@kazak.uk.xensource.com>



On 11/11/2013 01:23 PM, Ian Campbell wrote:
> On Thu, 2013-10-24 at 10:02 +0100, Julien Grall wrote:
>> Signed-off-by: Julien Grall <julien.grall@linaro.org>
>> ---
>>   xen/arch/arm/p2m.c         | 19 +++++++++++--------
>>   xen/include/asm-arm/page.h |  5 +++--
>>   2 files changed, 14 insertions(+), 10 deletions(-)
>>
>> diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
>> index 2d09fef..fdbb07b 100644
>> --- a/xen/arch/arm/p2m.c
>> +++ b/xen/arch/arm/p2m.c
>> @@ -111,7 +111,7 @@ static int p2m_create_table(struct domain *d,
>>       clear_page(p);
>>       unmap_domain_page(p);
>>
>> -    pte = mfn_to_p2m_entry(page_to_mfn(page), MATTR_MEM);
>> +    pte = mfn_to_p2m_entry(page_to_mfn(page), MATTR_MEM, 1);
>
> If this is a bool_t then true/false might be more appropriate? (and all
> the other such too)
>
> I have a weak preference for avoiding such boolean parameters, since it
> is never obvious what a given 1/0/true/false is actually is without
> having to look at the prototype. At least there is only 1 such param
> here (now).
>
> We don't need full p2m typing yet but perhaps we can make a start by
> defining "typdef enum { p2m_ram_rw = N; p2m_ram_ro = M } p2m_type_t" for
> this?

Sounds good. I will update the patch series with that.

>> @@ -213,14 +213,15 @@ static inline lpae_t mfn_to_xen_entry(unsigned long mfn)
>>       return e;
>>   }
>>
>> -static inline lpae_t mfn_to_p2m_entry(unsigned long mfn, unsigned int mattr)
>> +static inline lpae_t mfn_to_p2m_entry(unsigned long mfn, unsigned int mattr,
>> +                                      bool_t rw)
>>   {
>>       paddr_t pa = ((paddr_t) mfn) << PAGE_SHIFT;
>>       lpae_t e = (lpae_t) {
>>           .p2m.xn = 0,
>>           .p2m.af = 1,
>>           .p2m.sh = LPAE_SH_OUTER,
>> -        .p2m.write = 1,
>> +        .p2m.write = !!rw,
>
> I don't think the !! is strictly necessary for either a bool_t nor a
> single bit bitfield.

I will use p2m_type_t here and check if the type is equal to p2m_ram_rw.

-- 
Julien Grall

  reply	other threads:[~2013-11-12 13:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-24  9:02 [PATCH 0/3] ARM: Support read-only mapping in the grant table Julien Grall
2013-10-24  9:02 ` [PATCH 1/3] xen/arm: p2m: extend create_p2m_entries to support read-only mapping Julien Grall
2013-11-11 13:23   ` Ian Campbell
2013-11-12 13:13     ` Julien Grall [this message]
2013-10-24  9:02 ` [PATCH 2/3] xen/arm: p2m: add guest_physmap_add_page_rw Julien Grall
2013-11-11 13:30   ` Ian Campbell
2013-10-24  9:02 ` [PATCH 3/3] xen/arm: grant-table: Support read-only mapping Julien Grall

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=5282295E.4030005@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=Ian.Campbell@citrix.com \
    --cc=patches@linaro.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.