xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: julien.grall@citrix.com, xen-devel@lists.xensource.com,
	Ian.Campbell@citrix.com
Subject: Re: [PATCH v3 3/3] xen/arm: introduce XENFEAT_grant_map_identity
Date: Thu, 24 Jul 2014 15:51:01 +0100	[thread overview]
Message-ID: <53D11D55.705@linaro.org> (raw)
In-Reply-To: <alpine.DEB.2.02.1407241511040.2293@kaball.uk.xensource.com>

On 07/24/2014 03:14 PM, Stefano Stabellini wrote:
> On Thu, 24 Jul 2014, Julien Grall wrote:
>> Hi Stefano,
>>
>> On 07/24/2014 02:31 PM, Stefano Stabellini wrote:
>>> diff --git a/xen/common/kernel.c b/xen/common/kernel.c
>>> index 7e83353..dacbe38 100644
>>> --- a/xen/common/kernel.c
>>> +++ b/xen/common/kernel.c
>>> @@ -15,6 +15,7 @@
>>>  #include <xen/guest_access.h>
>>>  #include <xen/hypercall.h>
>>>  #include <asm/current.h>
>>> +#include <asm/grant_table.h>
>>>  #include <public/nmi.h>
>>>  #include <public/version.h>
>>>  
>>> @@ -325,6 +326,8 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>>>                  break;
>>>              }
>>>  #endif
>>> +            if ( gnttab_need_identity_mapping(d) )
>>
>> Actually even platform the IOMMU support needs to have this flags on.
>> With this solution you break platform where not every DMA-capable device
>> are behind an SMMU.
> 
> I see.
> 
> 
>>> +                fi.submap |= 1U << XENFEAT_grant_map_identity;
>>>              break;
>>>          default:
>>>              return -EINVAL;
>>> diff --git a/xen/include/asm-arm/grant_table.h b/xen/include/asm-arm/grant_table.h
>>> index eac8a70..6f7ccd9 100644
>>> --- a/xen/include/asm-arm/grant_table.h
>>> +++ b/xen/include/asm-arm/grant_table.h
>>> @@ -36,6 +36,9 @@ static inline int replace_grant_supported(void)
>>>  #define gnttab_need_iommu_mapping(d)                    \
>>>      (is_domain_direct_mapped(d) && need_iommu(d))
>>>  
>>> +#define gnttab_need_identity_mapping(d)                    \
>>> +    (is_domain_direct_mapped(d) && !need_iommu(d))
>>> +
>>
>> Why didn't you drop the need_iommu(d) in is_domain_direct_mapped?
> 
> I guess you mean why didn't you drop the need_iommu(d) in
> gnttab_need_iommu_mapping?
> 
> Because how can you need an iommu mapping if an iommu is not present?

I would invert the name of the 2 macros. And drop !need_iommu(d) in the
second.

The code would look like:

if (gnttab_need_identity_mapping(d))
{
   if (gnttab_need_iommu_mapping(d))
     iommu_map_page
   else
     arch_
}

On x86, the gnttab_need_iommu_mapping would be equal to 1.

Regards,

-- 
Julien Grall

  reply	other threads:[~2014-07-24 14:51 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-24 13:30 [PATCH v3 0/3] map grant refs at pfn = mfn Stefano Stabellini
2014-07-24 13:31 ` [PATCH v3 1/3] xen/x86: introduce is_domain_direct_mapped(d) as (0) on x86 Stefano Stabellini
2014-07-24 13:41   ` Julien Grall
2014-07-24 16:51     ` Stefano Stabellini
2014-07-24 13:31 ` [PATCH v3 2/3] xen: introduce arch_grant_(un)map_page_identity Stefano Stabellini
2014-07-24 13:42   ` Jan Beulich
2014-07-24 16:55     ` Stefano Stabellini
2014-07-24 13:44   ` Julien Grall
2014-07-24 16:57     ` Stefano Stabellini
2014-07-24 16:59       ` Julien Grall
2014-07-24 13:31 ` [PATCH v3 3/3] xen/arm: introduce XENFEAT_grant_map_identity Stefano Stabellini
2014-07-24 13:41   ` Jan Beulich
2014-07-24 14:10     ` Stefano Stabellini
2014-07-24 14:43       ` Jan Beulich
2014-07-24 14:47         ` Julien Grall
2014-07-24 15:02           ` Stefano Stabellini
2014-07-24 15:17             ` Julien Grall
2014-07-24 17:15               ` Stefano Stabellini
2014-07-24 13:50   ` Julien Grall
2014-07-24 14:14     ` Stefano Stabellini
2014-07-24 14:51       ` Julien Grall [this message]
2014-08-01 12:35 ` [PATCH v3 0/3] map grant refs at pfn = mfn Thomas Leonard
2014-08-01 12:37 ` Thomas Leonard
2014-08-01 15:13   ` Stefano Stabellini
2014-08-01 16:16     ` Thomas Leonard
2014-08-01 16:21       ` Julien Grall
2014-08-01 16:25         ` Stefano Stabellini
2014-08-01 16:56           ` Thomas Leonard
2014-08-01 17:01             ` Stefano Stabellini
2014-08-01 17:04               ` Thomas Leonard
2014-08-01 17:16                 ` Stefano Stabellini
2014-08-01 18:12                   ` Thomas Leonard
2014-08-06 11:22                     ` Thomas Leonard
2014-08-06 13:35                       ` Stefano Stabellini
2014-08-06 13:39                         ` Thomas Leonard
2014-08-06 13:46                           ` Stefano Stabellini
2014-08-06 14:04                             ` Thomas Leonard
2014-08-06 14:14                               ` Stefano Stabellini
2014-08-06 14:19                                 ` Thomas Leonard
2014-08-06 14:27                                   ` Stefano Stabellini
2014-08-06 14:53                                     ` Thomas Leonard
2014-08-06 15:59                                       ` Wei Liu
2014-08-06 17:50                                         ` Thomas Leonard
2014-08-06 20:46                                           ` Wei Liu
2014-08-07  7:59                                             ` Thomas Leonard
2014-08-07 10:40                                               ` Wei Liu
2014-08-07 11:19                                                 ` Thomas Leonard
2014-08-06 14:24                                 ` Thomas Leonard
2014-08-06 14:11                           ` Wei Liu

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=53D11D55.705@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=Ian.Campbell@citrix.com \
    --cc=julien.grall@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /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).