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: patches@linaro.org, tim@xen.org, stefano.stabellini@citrix.com,
	Jan Beulich <jbeulich@suse.com>,
	xen-devel@lists.xenproject.org,
	Xiantao Zhang <xiantao.zhang@intel.com>
Subject: Re: [RFC for-4.5 10/12] xen/passthrough: Introduce IOMMU ARM architure
Date: Wed, 19 Feb 2014 16:50:07 +0000	[thread overview]
Message-ID: <5304E0BF.7010300@linaro.org> (raw)
In-Reply-To: <1392814144.29739.55.camel@kazak.uk.xensource.com>

Hi Ian,

On 02/19/2014 12:49 PM, Ian Campbell wrote:
> On Fri, 2014-02-07 at 17:43 +0000, Julien Grall wrote:
>> This patch contains the architecture to use IOMMU on ARM. There is no
> 
> s/IOMMU/IOMMUs/
> 
>> IOMMU drivers on this patch.
>>
>> The code will run through the device tree and will initialize every IOMMUs.
> 
> s/IOMMUs/IOMMU/
> 
>> It's possible to have multiple IOMMUs on the same platform, but they should
> 
> s/should/must/ I think for now?

Right.

>> be handled with the same drivers.
> 
> s/drivers/driver/
> 
>> For now, there is no support for using multiple iommu drivers at runtime.
> 
> But this is in principal possible in the future, right? (I shudder to
> think what the designers of an SoC with multiple different SMMUs on it
> would have to be smoking...)

In theory yes. I will wait that someone want to support a such platfomr
on Xen before implement it :).

> 
> You should mention somewhere that on ARM these are called SMMUs not
> IOMMUs.

I think SMMU is the name used for ARM IOMMU. Samsung and TI doesn't use
the term SMMU.

> 
>> Each new IOMMU drivers should contain:
>>
>> static const char * const myiommu_dt_compat[] __initcontst =
> 
> "__initconst".

Oops. Will fix it.

>> {
>>     /* list of device compatible with the drivers. Will be matched with
>>      * the "compatible" property on the device tree
>>      */
>>     NULL,
>> };
>>
>> DT_DEVICE_START(myiommu, "MY IOMMU", DEVICE_IOMMU)
>>         .compatible = myiommu_compatible,
>>         .init = myiommu_init,
>> DT_DEVICE_END
> 
> This is the same as for any other driver, right?

Yes, the only change is we need to specify DEVICE_IOMMU in DT_DEVICE_START.

> 
>> @@ -568,6 +571,10 @@ fail:
>>  
>>  void arch_domain_destroy(struct domain *d)
>>  {
>> +    /* IOMMU page table is shared with P2M, always call
>> +     * iommu_domain_destroy() before p2m_teardown().
> 
> It would be worth adding some commentary on the design we are using
> (decisions such as whether to share PTs with the stage 2 MMU) in the
> commit message as well.

I will do.

> I suppose this requirement puts constraints on the SMMU hardware we can
> support. I think it is fine to live with that until someone shows up
> with an SMMU with pagetables that are incompatible with the stage 2
> paging ones.

Adding support for a such hardware should not need too much code.

>> diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
>> index 1f6d713..5a687d1 100644
>> --- a/xen/arch/arm/setup.c
>> +++ b/xen/arch/arm/setup.c
>> @@ -725,6 +725,8 @@ void __init start_xen(unsigned long boot_phys_offset,
>>      local_irq_enable();
>>      local_abort_enable();
>>  
>> +    iommu_setup(); /* setup iommu if available */
> 
> Comment is a bit redundant ;-)

Copied for x86/setup.c. I will remove it.

> 
>> diff --git a/xen/drivers/passthrough/arm/iommu.c b/xen/drivers/passthrough/arm/iommu.c
>> new file mode 100644
>> index 0000000..7cf36cd
>> --- /dev/null
>> +++ b/xen/drivers/passthrough/arm/iommu.c
>> @@ -0,0 +1,65 @@
>> +/*
>> + * xen/drivers/passthrough/arm/iommu.c
>> + *
>> + * Generic IOMMU framework via the device tree
>> + *
>> + * Julien Grall <julien.grall@linaro.org>
>> + * Copyright (c) 2013 Linaro Limited.
> 
> It's not 2013 any more...

I have started the implementation in 2013 and forgot to update it.

> 
>> diff --git a/xen/include/asm-arm/hvm/iommu.h b/xen/include/asm-arm/hvm/iommu.h
>> new file mode 100644
>> index 0000000..461c8cf
>> --- /dev/null
>> +++ b/xen/include/asm-arm/hvm/iommu.h
>> @@ -0,0 +1,10 @@
>> +#ifndef __ASM_ARM_HVM_IOMMU_H_
>> +#define __ASM_ARM_HVM_IOMMU_H_
>> +
>> +struct arch_hvm_iommu
>> +{
>> +    /* Private information for the IOMMU drivers */
>> +    void *priv;
>> +};
>> +
>> +#endif /* __ASM_ARM_HVM_IOMMU_H_ */
> 
> Emacs magic block please.

I will do.

> That was a surprisingly small and uncontroversial patch. Well done.

The IOMMU framework in Xen was well designed.

cheers,

-- 
Julien Grall

  reply	other threads:[~2014-02-19 16:50 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-07 17:42 [RFC for-4.5 00/12] IOMMU support for ARM Julien Grall
2014-02-07 17:43 ` [RFC for-4.5 01/12] xen/common: grant-table: only call IOMMU if paging mode translate is disabled Julien Grall
2014-02-10  8:02   ` Jan Beulich
2014-02-19 12:25   ` Ian Campbell
2014-02-07 17:43 ` [RFC for-4.5 02/12] xen/passthrough: vtd: Don't export iommu_domain_teardown Julien Grall
2014-02-19 12:26   ` Ian Campbell
2014-02-07 17:43 ` [RFC for-4.5 03/12] xen/passthrough: vtd: Don't export iommu_set_pgd Julien Grall
2014-02-10  8:04   ` Jan Beulich
2014-02-10  8:07     ` Zhang, Xiantao
2014-02-19 12:27   ` Ian Campbell
2014-02-07 17:43 ` [RFC for-4.5 04/12] xen/dts: Add dt_property_read_bool Julien Grall
2014-02-19 12:28   ` Ian Campbell
2014-02-19 14:57     ` Julien Grall
2014-02-07 17:43 ` [RFC for-4.5 05/12] xen/dts: Add dt_parse_phandle_with_args and dt_parse_phandle Julien Grall
2014-02-19 12:34   ` Ian Campbell
2014-02-19 16:17     ` Julien Grall
2014-02-19 16:26       ` Ian Campbell
2014-02-19 16:52         ` Julien Grall
2014-02-19 16:57           ` Ian Campbell
2014-02-07 17:43 ` [RFC for-4.5 06/12] xen/passthrough: rework dom0_pvh_reqs to use it also on ARM Julien Grall
2014-02-10  8:07   ` Jan Beulich
2014-02-10 11:42     ` Julien Grall
2014-02-10 16:10   ` Julien Grall
2014-02-10 16:35     ` Jan Beulich
2014-02-10 17:42       ` Julien Grall
2014-02-11  7:47         ` Jan Beulich
2014-02-07 17:43 ` [RFC for-4.5 07/12] xen/passthrough: iommu: Don't need to map dom0 page when the PT is shared Julien Grall
2014-02-10  8:11   ` Jan Beulich
2014-02-19 12:37   ` Ian Campbell
2014-02-07 17:43 ` [RFC for-4.5 08/12] xen/passthrough: iommu: Split generic IOMMU code Julien Grall
2014-02-10  8:22   ` Jan Beulich
2014-02-10 11:52     ` Julien Grall
2014-02-19 12:39   ` Ian Campbell
2014-02-19 16:23     ` Julien Grall
2014-02-07 17:43 ` [RFC for-4.5 09/12] xen/passthrough: iommu: Introduce arch specific code Julien Grall
2014-02-19 12:40   ` Ian Campbell
2014-02-19 16:25     ` Julien Grall
2014-02-07 17:43 ` [RFC for-4.5 10/12] xen/passthrough: Introduce IOMMU ARM architure Julien Grall
2014-02-19 12:49   ` Ian Campbell
2014-02-19 16:50     ` Julien Grall [this message]
2014-02-07 17:43 ` [RFC for-4.5 11/12] MAINTAINERS: Add drivers/passthrough/arm Julien Grall
2014-02-19 12:49   ` Ian Campbell
2014-02-07 17:43 ` [RFC for-4.5 12/12] drivers/passthrough: arm: Add support for SMMU drivers Julien Grall
2014-02-19 14:15   ` Ian Campbell
2014-02-19 17:21     ` Julien Grall
2014-02-19 17:27       ` Ian Campbell
2014-02-19 17:31         ` Julien Grall
2014-02-20  8:11           ` Jan Beulich
2014-02-20 11:05             ` Julien Grall
2014-02-19 17:23     ` Julien Grall
2014-02-07 17:51 ` [RFC for-4.5 00/12] IOMMU support for ARM 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=5304E0BF.7010300@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=Ian.Campbell@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=patches@linaro.org \
    --cc=stefano.stabellini@citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    --cc=xiantao.zhang@intel.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 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.