From: Alexandre Courbot <acourbot@nvidia.com>
To: Ben Skeggs <bskeggs@redhat.com>, David Airlie <airlied@linux.ie>,
David Herrmann <dh.herrmann@gmail.com>,
Lucas Stach <dev@lynxeye.de>,
Thierry Reding <thierry.reding@gmail.com>,
Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: <nouveau@lists.freedesktop.org>,
<dri-devel@lists.freedesktop.org>, <linux-tegra@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <gnurou@gmail.com>,
Alexandre Courbot <acourbot@nvidia.com>
Subject: [PATCH v5 1/4] drm: introduce nv_device_is_cpu_coherent()
Date: Mon, 27 Oct 2014 18:49:16 +0900 [thread overview]
Message-ID: <1414403359-22332-2-git-send-email-acourbot@nvidia.com> (raw)
In-Reply-To: <1414403359-22332-1-git-send-email-acourbot@nvidia.com>
Add a function allowing us to know whether a device is CPU-coherent,
i.e. accesses performed by the CPU on GPU-mapped buffers will
be immediately visible on the GPU side and vice-versa.
For now, a device is considered to be coherent if it uses the PCI bus on
a non-ARM architecture.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
lib/core/os.h | 2 ++
nvkm/include/core/device.h | 6 ++++++
2 files changed, 8 insertions(+)
diff --git a/lib/core/os.h b/lib/core/os.h
index fba9542292ac..79462eb2cfd4 100644
--- a/lib/core/os.h
+++ b/lib/core/os.h
@@ -101,6 +101,8 @@ typedef dma_addr_t resource_size_t;
#define __printf(a,b)
#define __user
+#define IS_ENABLED(x) (0)
+
static inline int
order_base_2(u64 base)
{
diff --git a/nvkm/include/core/device.h b/nvkm/include/core/device.h
index 1d9d893929bb..0d839e1ddaf4 100644
--- a/nvkm/include/core/device.h
+++ b/nvkm/include/core/device.h
@@ -158,6 +158,12 @@ nv_device_is_pci(struct nouveau_device *device)
return device->pdev != NULL;
}
+static inline bool
+nv_device_is_cpu_coherent(struct nouveau_device *device)
+{
+ return (!IS_ENABLED(CONFIG_ARM) && nv_device_is_pci(device));
+}
+
static inline struct device *
nv_device_base(struct nouveau_device *device)
{
--
2.1.2
next prev parent reply other threads:[~2014-10-27 9:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-27 9:49 [PATCH v5 0/4] drm: nouveau: memory coherency on ARM Alexandre Courbot
2014-10-27 9:49 ` Alexandre Courbot [this message]
2014-10-27 9:49 ` [PATCH v5 2/4] drm: implement explicitly coherent BOs Alexandre Courbot
2014-10-27 9:49 ` [PATCH v5 3/4] drm: allocate GPFIFOs and fences coherently Alexandre Courbot
2014-10-27 9:49 ` [PATCH v5 4/4] drm: synchronize BOs when required Alexandre Courbot
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=1414403359-22332-2-git-send-email-acourbot@nvidia.com \
--to=acourbot@nvidia.com \
--cc=airlied@linux.ie \
--cc=bskeggs@redhat.com \
--cc=dev@lynxeye.de \
--cc=dh.herrmann@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gnurou@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=maarten.lankhorst@canonical.com \
--cc=nouveau@lists.freedesktop.org \
--cc=thierry.reding@gmail.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
Powered by JetHome