All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Ian Campbell <Ian.Campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: xen-devel@lists.xenproject.org, tim@xen.org,
	stefano.stabellini@citrix.com
Subject: Re: [PATCH v2 12/12] xen/iommu: smmu: Add Xen specific code to be able to use the driver
Date: Wed, 28 Jan 2015 11:49:02 +0000	[thread overview]
Message-ID: <54C8CCAE.5090506@linaro.org> (raw)
In-Reply-To: <1422441084.16180.61.camel@citrix.com>

On 28/01/15 10:31, Ian Campbell wrote:
> On Tue, 2015-01-27 at 17:34 +0000, Stefano Stabellini wrote:
>> On Tue, 27 Jan 2015, Julien Grall wrote:
>>> On 27/01/15 16:46, Stefano Stabellini wrote:
>>>> On Fri, 16 Jan 2015, Julien Grall wrote:
>>>>> The main goal is to modify as little the Linux code to be able to port
>>>>> easily new feature added in Linux repo for the driver.
>>>>
>>>> Agreed.
>>>>
>>>>
>>>>> To achieve that we:
>>>>>     - Add helpers to Linux function not implemented on Xen
>>>>
>>>> Good idea, I would take it further and move the helpers to a separate
>>>> file that smmu.c #includes. Or it could work the other way around: you
>>>> could move the original code to smmu-linux.c that get #included into
>>>> smmu.c
>>>
>>> We would have to modify smmu-linux.c for disabling some functions and/or
>>> modify them.
>>>
>>> Although for the later, there is only a couple functions modified.
>>>
>>>>
>>>>>     - Add callbacks used by Xen to do our own stuff and call Linux ones
>>>>>     - Only modify when required the code which comes from Linux. If so a
>>>>>     comment has been added with /* Xen: ... */ explaining why it's
>>>>>     necessary.
>>>>
>>>> I wonder if it makes sense to keep your changes in patch format and
>>>> apply the patch at run time as part of the make system.
>>>>
>>>> Of course you would need to be careful to keep the patched smmu.c
>>>> separate from the original, otherwise it would get very confusing when
>>>> people works on their changes.
>>>
>>> IHMO, it makes more difficult to review and work with it. Although it
>>> may be easier for porting change from Linux in the future.
>>
>> Yes, the reason to do that would be to make it as easy as possible to
>> update it in the future.  Ian, do you have an opinion on this?
> 
> Build time application of patches is a nightmare, we should definitely
> not do that.

I though about it during the night. It would be the best approach to
keep in sync with Linux more quickly.

It would also made clear what are our modifications and what was
upstreamed in Linux (assuming someone want to port/test our changes).

> IMHO the best way to approach this sort of thing is to separate it from
> the main body of imported code as much as possible, i.e. by patching in
> a minimal set of hooks the implementations of which can be segregated
> away from the imported code, even if that makes for a slightly less
> clean design overall.

It's already the case, if you look the code. The number of modifications
in the Linux code is very tiny compare to the number of changes (about
50 lines changes).

> Looking briefly at the patch:
>       * Can things like supporting larger address spaces not be
>         upstreamed?

I'm not sure which one you are talking about. But Linux is use separate
page table by device. Until now they were able to support only a certain
number of address bits.

I know they are reworking the SMMU drivers for 3.20. I haven't yet take
a look to it.


>       * Can we not avoid the #if 0 in many cases by just leaving them
>         and making it so the compiler can statically eliminate the call
>         (i.e. with expressions which expand to if(0)?

No, most of this code is self-contained in callbacks that we don't use.

>       * The fixups for differing configurations could be done all at
>         once in a xen hook called at the end of arm_smmu_device_reset
>         which applies our delta (overriding what the upstream code had
>         done)

No, because we may for a slight moment allow the device to bypass the
SMMU and therefore mess up the real memory.

>       * etc

I believe the most of my changes in the Linux code are justified.

There is a certain limit about using Linux drivers. They are moving fast
(at least on the ARM IOMMU sides). It will never be possible to have an
nearly exact (99%) match with Linux.

Regards,

-- 
Julien Grall

  reply	other threads:[~2015-01-28 11:49 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-16 14:23 [PATCH v2 00/12] xen/arm: Resync the SMMU driver with the Linux one Julien Grall
2015-01-16 14:23 ` [PATCH v2 01/12] xen/arm: gic-v2: Change the device name in DT_DEVICE_START Julien Grall
2015-01-27 15:52   ` Stefano Stabellini
2015-01-16 14:23 ` [PATCH v2 02/12] xen/arm: vgic: Drop unecessary include asm/device.h Julien Grall
2015-01-27 15:53   ` Stefano Stabellini
2015-01-16 14:23 ` [PATCH v2 03/12] xen/dt: Extend dt_device_match to possibly store data Julien Grall
2015-01-27 15:57   ` Stefano Stabellini
2015-01-27 16:07     ` Julien Grall
2015-01-27 16:10       ` Stefano Stabellini
2015-01-27 16:35         ` Julien Grall
2015-01-27 16:46           ` Stefano Stabellini
2015-01-27 16:49             ` Julien Grall
2015-01-16 14:23 ` [PATCH v2 04/12] xen/arm: device: Rename device_type into device_match Julien Grall
2015-01-27 16:05   ` Stefano Stabellini
2015-01-27 16:09     ` Julien Grall
2015-01-27 16:13       ` Stefano Stabellini
2015-01-27 22:26         ` Julien Grall
2015-01-16 14:24 ` [PATCH v2 05/12] xen/iommu: arm: Remove temporary the SMMU driver Julien Grall
2015-01-27 16:05   ` Stefano Stabellini
2015-01-16 14:24 ` [PATCH v2 06/12] xen/arm: Introduce a generic way to describe device Julien Grall
2015-01-16 14:59   ` Jan Beulich
2015-01-16 15:01     ` Julien Grall
2015-01-27 16:13   ` Stefano Stabellini
2015-01-16 14:24 ` [PATCH v2 07/12] xen/iommu: Consolidate device assignment ops into a single set Julien Grall
2015-01-16 15:03   ` Jan Beulich
2015-01-27 16:16   ` Stefano Stabellini
2015-01-16 14:24 ` [PATCH v2 08/12] xen/arm: Describe device supported by a driver with dt_match_node Julien Grall
2015-01-27 16:28   ` Stefano Stabellini
2015-01-16 14:24 ` [PATCH v2 09/12] xen/iommu: arm: Import the SMMU driver from Linux Julien Grall
2015-01-27 16:28   ` Stefano Stabellini
2015-01-27 16:51     ` Julien Grall
2015-01-16 14:24 ` [PATCH v2 10/12] xen/iommu: smmu: Check for duplicate stream IDs when registering master devices Julien Grall
2015-01-27 16:30   ` Stefano Stabellini
2015-01-27 16:52     ` Julien Grall
2015-01-27 17:02       ` Stefano Stabellini
2015-01-27 17:33         ` Julien Grall
2015-01-27 17:36           ` Stefano Stabellini
2015-01-27 17:44           ` Ian Campbell
2015-01-27 17:51             ` Julien Grall
2015-01-27 20:54               ` Andreas Herrmann
2015-01-28 10:38               ` Ian Campbell
2015-01-28 11:39                 ` Julien Grall
2015-01-16 14:24 ` [PATCH v2 11/12] xen/iommu: smmu: Introduce automatic stream-id-masking Julien Grall
2015-01-16 14:24 ` [PATCH v2 12/12] xen/iommu: smmu: Add Xen specific code to be able to use the driver Julien Grall
2015-01-27 16:46   ` Stefano Stabellini
2015-01-27 17:05     ` Julien Grall
2015-01-27 17:34       ` Stefano Stabellini
2015-01-28 10:31         ` Ian Campbell
2015-01-28 11:49           ` Julien Grall [this message]
2015-01-28 12:13             ` Ian Campbell
2015-01-28 12:15             ` Stefano Stabellini

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=54C8CCAE.5090506@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=Ian.Campbell@citrix.com \
    --cc=stefano.stabellini@citrix.com \
    --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.