All of lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: mark.rutland@arm.com, devicetree@vger.kernel.org,
	pawel.moll@arm.com, mst@redhat.com,
	virtualization@lists.linux-foundation.org, robh+dt@kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 2/2] virtio: Document DMA coherency
Date: Fri, 3 Feb 2017 09:52:39 +0000	[thread overview]
Message-ID: <20170203095238.GA11585@arm.com> (raw)
In-Reply-To: <6cc1be2a3ace621293157a9828c9f1d3f47147c8.1486053223.git.robin.murphy@arm.com>

On Thu, Feb 02, 2017 at 04:36:21PM +0000, Robin Murphy wrote:
> Since making use of the DMA API will require the architecture code to
> have the correct notion of device cache-coherency on architectures like
> ARM, explicitly call this out in the virtio-mmio DT binding. The ship
> has sailed for legacy virtio, but let's hope that we can head off any
> future firmware mishaps.
> 
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>  Documentation/devicetree/bindings/virtio/mmio.txt | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/virtio/mmio.txt b/Documentation/devicetree/bindings/virtio/mmio.txt
> index 5069c1b8e193..999a93faa67c 100644
> --- a/Documentation/devicetree/bindings/virtio/mmio.txt
> +++ b/Documentation/devicetree/bindings/virtio/mmio.txt
> @@ -7,6 +7,16 @@ Required properties:
>  - compatible:	"virtio,mmio" compatibility string
>  - reg:		control registers base address and size including configuration space
>  - interrupts:	interrupt generated by the device
> +- dma-coherent:	required if the device (or host emulation) accesses memory
> +		cache-coherently, absent otherwise
> +
> +Linux implementation note:
> +
> +virtio devices not advertising the VIRTIO_F_IOMMU_PLATFORM flag have been
> +implicitly assumed to be cache-coherent by Linux, and for legacy reasons this
> +behaviour is likely to remain.  If VIRTIO_F_IOMMU_PLATFORM is advertised, then
> +such assumptions cannot be relied upon and the "dma-coherent" property must
> +accurately reflect the coherency of the device.
>  
>  Example:
>  
> @@ -14,4 +24,5 @@ Example:
>  		compatible = "virtio,mmio";
>  		reg = <0x3000 0x100>;
>  		interrupts = <41>;
> +		dma-coherent;

I think this is a sensible update to the binding and is independent of
whatever we decide to do for IOMMUs and DMA on legacy devices.

Acked-by: Will Deacon <will.deacon@arm.com>

Will

WARNING: multiple messages have this Message-ID (diff)
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/2] virtio: Document DMA coherency
Date: Fri, 3 Feb 2017 09:52:39 +0000	[thread overview]
Message-ID: <20170203095238.GA11585@arm.com> (raw)
In-Reply-To: <6cc1be2a3ace621293157a9828c9f1d3f47147c8.1486053223.git.robin.murphy@arm.com>

On Thu, Feb 02, 2017 at 04:36:21PM +0000, Robin Murphy wrote:
> Since making use of the DMA API will require the architecture code to
> have the correct notion of device cache-coherency on architectures like
> ARM, explicitly call this out in the virtio-mmio DT binding. The ship
> has sailed for legacy virtio, but let's hope that we can head off any
> future firmware mishaps.
> 
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>  Documentation/devicetree/bindings/virtio/mmio.txt | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/virtio/mmio.txt b/Documentation/devicetree/bindings/virtio/mmio.txt
> index 5069c1b8e193..999a93faa67c 100644
> --- a/Documentation/devicetree/bindings/virtio/mmio.txt
> +++ b/Documentation/devicetree/bindings/virtio/mmio.txt
> @@ -7,6 +7,16 @@ Required properties:
>  - compatible:	"virtio,mmio" compatibility string
>  - reg:		control registers base address and size including configuration space
>  - interrupts:	interrupt generated by the device
> +- dma-coherent:	required if the device (or host emulation) accesses memory
> +		cache-coherently, absent otherwise
> +
> +Linux implementation note:
> +
> +virtio devices not advertising the VIRTIO_F_IOMMU_PLATFORM flag have been
> +implicitly assumed to be cache-coherent by Linux, and for legacy reasons this
> +behaviour is likely to remain.  If VIRTIO_F_IOMMU_PLATFORM is advertised, then
> +such assumptions cannot be relied upon and the "dma-coherent" property must
> +accurately reflect the coherency of the device.
>  
>  Example:
>  
> @@ -14,4 +24,5 @@ Example:
>  		compatible = "virtio,mmio";
>  		reg = <0x3000 0x100>;
>  		interrupts = <41>;
> +		dma-coherent;

I think this is a sensible update to the binding and is independent of
whatever we decide to do for IOMMUs and DMA on legacy devices.

Acked-by: Will Deacon <will.deacon@arm.com>

Will

  reply	other threads:[~2017-02-03  9:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-02 16:36 [PATCH v2 1/2] virtio: Make ARM SMMU workaround more specific Robin Murphy
2017-02-02 16:36 ` Robin Murphy
2017-02-02 16:36 ` [PATCH v2 2/2] virtio: Document DMA coherency Robin Murphy
2017-02-02 16:36   ` Robin Murphy
2017-02-03  9:52   ` Will Deacon [this message]
2017-02-03  9:52     ` Will Deacon
2017-02-07 18:45   ` Rob Herring
2017-02-07 18:45     ` Rob Herring
2017-02-02 16:36 ` Robin Murphy

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=20170203095238.GA11585@arm.com \
    --to=will.deacon@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=mst@redhat.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=virtualization@lists.linux-foundation.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.