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 12/12] drivers/passthrough: arm: Add support for SMMU drivers
Date: Wed, 19 Feb 2014 17:21:30 +0000 [thread overview]
Message-ID: <5304E81A.3050703@linaro.org> (raw)
In-Reply-To: <1392819327.29739.85.camel@kazak.uk.xensource.com>
On 02/19/2014 02:15 PM, Ian Campbell wrote:
> On Fri, 2014-02-07 at 17:43 +0000, Julien Grall wrote:
>> This patch add support for ARM architected SMMU driver. It's based on the
>> linux drivers (drivers/iommu/arm-smmu) commit 89ac23cd.
>
> Aha, here comes all the hard stuff ;-)
>
> Could you try and briefly enumerate the areas which you had to change
> please.
The main changes are:
- Fault by default if the SMMU is enabled to translate an
address (Linux is bypassing the SMMU)
- Using P2M page table instead of creating new one
- Dropped stage-1 support
- Dropped chained SMMUs support for now
- Reworking device assignment and the structure
> Some comments on e.g. which translation context type we are using and
> how we are configuring things etc might also be helpful here in
> understanding what is going on.
Honestly, the configuration part was mostly copied from Linux. Some bits
are still fuzzy for me. I will try to improve the commit message.
> Also could you give details of the test setup you used, was it just
> booting dom0 on Midway with these patches? Was the DTB complete etc?
I had to modify the device tree by applying this following patch:
http://www.spinics.net/lists/arm-kernel/msg301163.html
I've tried to boot dom0 and a guest with LVM (a patch is coming to
remove swiotlb when the device is protected by an IOMMU).
>
>> + * This driver currently supports:
>> + * - SMMUv1 and v2 implementations (didn't try v2 SMMU)
>
> I guess this is Will's original comment, I thought SMMU-400, which
> you've tried, was v2?
No it's SMMU v2. As I understand:
- SMMU-400 => SMMU v1
- SMMU-500 => SMMU v2
The words in parenthesis was added by me because I don't have a test box
with SMMU v2.
>
>> + * - Stream-matching and stream-indexing
>> + * - v7/v8 long-descriptor format
>> + * - Non-secure access to the SMMU
>> + * - 4k pages, p2m shared with the processor
>> + * - Up to 40-bit addressing
>> + * - Context fault reporting
>> + */
>> +
>> +#include <xen/config.h>
>> +#include <xen/delay.h>
>> +#include <xen/errno.h>
>> +#include <xen/irq.h>
>> +#include <xen/lib.h>
>> +#include <xen/list.h>
>> +#include <xen/mm.h>
>> +#include <xen/rbtree.h>
>> +#include <xen/sched.h>
>> +#include <asm/atomic.h>
>> +#include <asm/device.h>
>> +#include <asm/io.h>
>> +#include <asm/platform.h>
>> +
>> +#define SZ_4K (1 << 12)
>> +#define SZ_64K (1 << 16)
>> +
>> +/* Driver options */
>> +#define SMMU_OPT_SECURE_CONFIG_ACCESS (1 << 0)
>
> Is this just retained to reduce the deviation from the Linux driver?
> It's no use to us I think. (I suppose that goes for a bunch of other
> stuff, eg.. the PGSZ_4K stuff, which I will avoid commenting on
> further).
SZ_4K and SZ_64K is used later in the code. The
SMMU_OPT_SECURE_CONFIG_ACCESS is used for midway as the SMMU is broken.
>
>> +
>> +void arm_smmu_iommu_dom0_init(struct domain *d)
>> +{
>> + struct arm_smmu_device *smmu;
>> + struct rb_node *node;
>> +
>> + printk(XENLOG_DEBUG "arm-smmu: Initialize dom0\n");
>> +
>> + list_for_each_entry( smmu, &arm_smmu_devices, list )
>> + {
>> + for ( node = rb_first(&smmu->masters); node; node = rb_next(node) )
>> + {
>> + struct arm_smmu_master *master;
>> +
>> + master = container_of(node, struct arm_smmu_master, node);
>> +
>> + if ( dt_device_used_by(master->dt_node) == DOMID_XEN ||
>> + platform_device_is_blacklisted(master->dt_node) )
>> + continue;
>> +
>> + arm_smmu_attach_dev(d, master->dt_node);
>
> Should this not be driven from the same loop as the MMIO mapping setup
> in dom0 build? Otherwise isn't there a danger that they won't
> correspond?
On my second version of the patch series I moved out this code in
map_device.
>
> A "master" here is a "bus master" i.e. a device, right?
>> + /* Even if the device can't be initialized, we don't want to give to
>> + * dom0 the smmu device
>
> "give the smmu device to dom0"
>
>
> I obviously haven't reviewed all this code in detail, but I have skimmed
> it and nothing leapt out.
Thanks for the review!
Cheers,
--
Julien Grall
next prev parent reply other threads:[~2014-02-19 17:21 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
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 [this message]
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=5304E81A.3050703@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.