All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Keir Fraser <keir@xen.org>,
	ian.campbell@citrix.com, patches@linaro.org, tim@xen.org,
	Jan Beulich <jbeulich@suse.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH] xen/arm: Allow balooning working with 1:1 memory mapping
Date: Mon, 25 Nov 2013 17:30:44 +0000	[thread overview]
Message-ID: <52938944.4050400@linaro.org> (raw)
In-Reply-To: <5284F7C7.2020805@linaro.org>

On 11/14/2013 04:18 PM, Julien Grall wrote:
> 
> 
> On 11/14/2013 03:34 PM, Stefano Stabellini wrote:
>> On Thu, 14 Nov 2013, Julien Grall wrote:
>>> With the lake of iommu, dom0 must have a 1:1 memory mapping for all
>>> these guest physical address. When the ballon decides to give back a
>>> page to the kernel, this page must have the same address as previously.
>>> Otherwise, we will loose the 1:1 mapping and will break DMA-capable
>>> device.
>>>
>>> Signed-off-by: Julien Grall <julien.grall@linaro.org>
>>> CC: Keir Fraser <keir@xen.org>
>>> CC: Jan Beulich <jbeulich@suse.com>
>>> ---
>>>   xen/common/memory.c | 42 ++++++++++++++++++++++++++++++++++++++++--
>>>   1 file changed, 40 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/xen/common/memory.c b/xen/common/memory.c
>>> index 50b740f..df36d43 100644
>>> --- a/xen/common/memory.c
>>> +++ b/xen/common/memory.c
>>> @@ -28,6 +28,9 @@
>>>   #include <public/memory.h>
>>>   #include <xsm/xsm.h>
>>>   #include <xen/trace.h>
>>> +#ifdef CONFIG_ARM
>>> +#include <asm/platform.h>
>>> +#endif
>>>
>>>   struct memop_args {
>>>       /* INPUT */
>>> @@ -90,7 +93,7 @@ static void increase_reservation(struct memop_args *a)
>>>
>>>   static void populate_physmap(struct memop_args *a)
>>>   {
>>> -    struct page_info *page;
>>> +    struct page_info *page = NULL;
>>>       unsigned long i, j;
>>>       xen_pfn_t gpfn, mfn;
>>>       struct domain *d = a->domain;
>>> @@ -122,7 +125,33 @@ static void populate_physmap(struct memop_args *a)
>>>           }
>>>           else
>>>           {
>>> -            page = alloc_domheap_pages(d, a->extent_order,
>>> a->memflags);
>>> +#ifdef CONFIG_ARM
>>> +            if ( d == dom0 &&
>>> platform_has_quirk(PLATFORM_QUIRK_DOM0_MAPPING_11) )
>>> +            {
>>> +                mfn = gpfn;
>>> +                if (!mfn_valid(mfn))
>>> +                {
>>> +                    gdprintk(XENLOG_INFO, "Invalid mfn
>>> 0x%"PRI_xen_pfn"\n",
>>> +                             mfn);
>>> +                    goto out;
>>> +                }
>>> +
>>> +                page = mfn_to_page(mfn);
>>> +                if ( !get_page(page, d) )
>>> +                {
>>> +                    gdprintk(XENLOG_INFO,
>>> +                             "mfn 0x%"PRI_xen_pfn" doesn't belong to
>>> dom0\n",
>>> +                             mfn);
>>> +                    goto out;
>>> +                }
>>> +                put_page(page);
>>> +            }
>>> +            else
>>> +#endif
>>
>> I don't know if the x86 maintainers would like that, but I would prefer
>> to remove the ifdef CONFIG_ARM.
>> You just need to define a new function called is_dom0_mapped_11, that
>> always returns false on x86 and on ARM is implemented by d == dom0 &&
>> platform_has_quirk(PLATFORM_QUIRK_DOM0_MAPPING_11).
>> Then you can use it on common code.
> 
> With this solution, it's less clear that it's ARM specific code. We are
> introducing a workaround that will never be used on x86.
> 
> I would wait an opinion from other maintainers before sending a new
> version of this patch.
> 

Ping, any input for X86 maintainers (Keir, Jan)?

-- 
Julien Grall

  reply	other threads:[~2013-11-25 17:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-14 15:15 [PATCH] xen/arm: Allow balooning working with 1:1 memory mapping Julien Grall
2013-11-14 15:34 ` Stefano Stabellini
2013-11-14 16:18   ` Julien Grall
2013-11-25 17:30     ` Julien Grall [this message]
2013-11-28  0:10     ` 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=52938944.4050400@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=ian.campbell@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --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.