From: Boris Brezillon <boris.brezillon@collabora.com>
To: Joerg Roedel <joro@8bytes.org>,
iommu@lists.linux-foundation.org,
Rob Herring <robh+dt@kernel.org>,
Tomeu Vizoso <tomeu.vizoso@collabora.com>,
Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>,
Steven Price <steven.price@arm.com>,
Robin Murphy <robin.murphy@arm.com>,
Will Deacon <will@kernel.org>,
linux-arm-kernel@lists.infradead.org
Cc: Boris Brezillon <boris.brezillon@collabora.com>,
dri-devel@lists.freedesktop.org
Subject: [PATCH v2 4/5] drm/panfrost: Add a PANFROST_BO_GPUONLY flag
Date: Fri, 1 Oct 2021 16:34:26 +0200 [thread overview]
Message-ID: <20211001143427.1564786-5-boris.brezillon@collabora.com> (raw)
In-Reply-To: <20211001143427.1564786-1-boris.brezillon@collabora.com>
This lets the driver reduce shareability domain of the MMU mapping,
which can in turn reduce access time and save power on cache-coherent
systems.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
drivers/gpu/drm/panfrost/panfrost_drv.c | 3 ++-
drivers/gpu/drm/panfrost/panfrost_gem.c | 1 +
drivers/gpu/drm/panfrost/panfrost_gem.h | 1 +
drivers/gpu/drm/panfrost/panfrost_mmu.c | 3 +++
include/uapi/drm/panfrost_drm.h | 1 +
5 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index b29ac942ae2d..b176921b9392 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -77,7 +77,8 @@ static int panfrost_ioctl_get_param(struct drm_device *ddev, void *data, struct
#define PANFROST_BO_FLAGS \
(PANFROST_BO_NOEXEC | PANFROST_BO_HEAP | \
- PANFROST_BO_NOREAD | PANFROST_BO_NOWRITE)
+ PANFROST_BO_NOREAD | PANFROST_BO_NOWRITE | \
+ PANFROST_BO_GPUONLY)
static int panfrost_ioctl_create_bo(struct drm_device *dev, void *data,
struct drm_file *file)
diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c b/drivers/gpu/drm/panfrost/panfrost_gem.c
index d6c1bb1445f2..4b1f85c0b98f 100644
--- a/drivers/gpu/drm/panfrost/panfrost_gem.c
+++ b/drivers/gpu/drm/panfrost/panfrost_gem.c
@@ -254,6 +254,7 @@ panfrost_gem_create_with_handle(struct drm_file *file_priv,
bo->noread = !!(flags & PANFROST_BO_NOREAD);
bo->nowrite = !!(flags & PANFROST_BO_NOWRITE);
bo->is_heap = !!(flags & PANFROST_BO_HEAP);
+ bo->gpuonly = !!(flags & PANFROST_BO_GPUONLY);
/*
* Allocate an id of idr table where the obj is registered
diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.h b/drivers/gpu/drm/panfrost/panfrost_gem.h
index 6246b5fef446..e332d5a4c24f 100644
--- a/drivers/gpu/drm/panfrost/panfrost_gem.h
+++ b/drivers/gpu/drm/panfrost/panfrost_gem.h
@@ -40,6 +40,7 @@ struct panfrost_gem_object {
bool noread :1;
bool nowrite :1;
bool is_heap :1;
+ bool gpuonly :1;
};
struct panfrost_gem_mapping {
diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
index 6a5c9d94d6f2..89eee8e80aa5 100644
--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
@@ -321,6 +321,9 @@ int panfrost_mmu_map(struct panfrost_gem_mapping *mapping)
if (!bo->noread)
prot |= IOMMU_READ;
+ if (bo->gpuonly)
+ prot |= IOMMU_DEVONLY;
+
sgt = drm_gem_shmem_get_pages_sgt(obj);
if (WARN_ON(IS_ERR(sgt)))
return PTR_ERR(sgt);
diff --git a/include/uapi/drm/panfrost_drm.h b/include/uapi/drm/panfrost_drm.h
index a2de81225125..538b58b2d095 100644
--- a/include/uapi/drm/panfrost_drm.h
+++ b/include/uapi/drm/panfrost_drm.h
@@ -88,6 +88,7 @@ struct drm_panfrost_wait_bo {
#define PANFROST_BO_HEAP 2
#define PANFROST_BO_NOREAD 4
#define PANFROST_BO_NOWRITE 8
+#define PANFROST_BO_GPUONLY 0x10
/**
* struct drm_panfrost_create_bo - ioctl argument for creating Panfrost BOs.
--
2.31.1
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
WARNING: multiple messages have this Message-ID (diff)
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Joerg Roedel <joro@8bytes.org>,
iommu@lists.linux-foundation.org,
Rob Herring <robh+dt@kernel.org>,
Tomeu Vizoso <tomeu.vizoso@collabora.com>,
Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>,
Steven Price <steven.price@arm.com>,
Robin Murphy <robin.murphy@arm.com>,
Will Deacon <will@kernel.org>,
linux-arm-kernel@lists.infradead.org
Cc: dri-devel@lists.freedesktop.org,
Boris Brezillon <boris.brezillon@collabora.com>
Subject: [PATCH v2 4/5] drm/panfrost: Add a PANFROST_BO_GPUONLY flag
Date: Fri, 1 Oct 2021 16:34:26 +0200 [thread overview]
Message-ID: <20211001143427.1564786-5-boris.brezillon@collabora.com> (raw)
In-Reply-To: <20211001143427.1564786-1-boris.brezillon@collabora.com>
This lets the driver reduce shareability domain of the MMU mapping,
which can in turn reduce access time and save power on cache-coherent
systems.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
drivers/gpu/drm/panfrost/panfrost_drv.c | 3 ++-
drivers/gpu/drm/panfrost/panfrost_gem.c | 1 +
drivers/gpu/drm/panfrost/panfrost_gem.h | 1 +
drivers/gpu/drm/panfrost/panfrost_mmu.c | 3 +++
include/uapi/drm/panfrost_drm.h | 1 +
5 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index b29ac942ae2d..b176921b9392 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -77,7 +77,8 @@ static int panfrost_ioctl_get_param(struct drm_device *ddev, void *data, struct
#define PANFROST_BO_FLAGS \
(PANFROST_BO_NOEXEC | PANFROST_BO_HEAP | \
- PANFROST_BO_NOREAD | PANFROST_BO_NOWRITE)
+ PANFROST_BO_NOREAD | PANFROST_BO_NOWRITE | \
+ PANFROST_BO_GPUONLY)
static int panfrost_ioctl_create_bo(struct drm_device *dev, void *data,
struct drm_file *file)
diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c b/drivers/gpu/drm/panfrost/panfrost_gem.c
index d6c1bb1445f2..4b1f85c0b98f 100644
--- a/drivers/gpu/drm/panfrost/panfrost_gem.c
+++ b/drivers/gpu/drm/panfrost/panfrost_gem.c
@@ -254,6 +254,7 @@ panfrost_gem_create_with_handle(struct drm_file *file_priv,
bo->noread = !!(flags & PANFROST_BO_NOREAD);
bo->nowrite = !!(flags & PANFROST_BO_NOWRITE);
bo->is_heap = !!(flags & PANFROST_BO_HEAP);
+ bo->gpuonly = !!(flags & PANFROST_BO_GPUONLY);
/*
* Allocate an id of idr table where the obj is registered
diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.h b/drivers/gpu/drm/panfrost/panfrost_gem.h
index 6246b5fef446..e332d5a4c24f 100644
--- a/drivers/gpu/drm/panfrost/panfrost_gem.h
+++ b/drivers/gpu/drm/panfrost/panfrost_gem.h
@@ -40,6 +40,7 @@ struct panfrost_gem_object {
bool noread :1;
bool nowrite :1;
bool is_heap :1;
+ bool gpuonly :1;
};
struct panfrost_gem_mapping {
diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
index 6a5c9d94d6f2..89eee8e80aa5 100644
--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
@@ -321,6 +321,9 @@ int panfrost_mmu_map(struct panfrost_gem_mapping *mapping)
if (!bo->noread)
prot |= IOMMU_READ;
+ if (bo->gpuonly)
+ prot |= IOMMU_DEVONLY;
+
sgt = drm_gem_shmem_get_pages_sgt(obj);
if (WARN_ON(IS_ERR(sgt)))
return PTR_ERR(sgt);
diff --git a/include/uapi/drm/panfrost_drm.h b/include/uapi/drm/panfrost_drm.h
index a2de81225125..538b58b2d095 100644
--- a/include/uapi/drm/panfrost_drm.h
+++ b/include/uapi/drm/panfrost_drm.h
@@ -88,6 +88,7 @@ struct drm_panfrost_wait_bo {
#define PANFROST_BO_HEAP 2
#define PANFROST_BO_NOREAD 4
#define PANFROST_BO_NOWRITE 8
+#define PANFROST_BO_GPUONLY 0x10
/**
* struct drm_panfrost_create_bo - ioctl argument for creating Panfrost BOs.
--
2.31.1
WARNING: multiple messages have this Message-ID (diff)
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Joerg Roedel <joro@8bytes.org>,
iommu@lists.linux-foundation.org,
Rob Herring <robh+dt@kernel.org>,
Tomeu Vizoso <tomeu.vizoso@collabora.com>,
Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>,
Steven Price <steven.price@arm.com>,
Robin Murphy <robin.murphy@arm.com>,
Will Deacon <will@kernel.org>,
linux-arm-kernel@lists.infradead.org
Cc: dri-devel@lists.freedesktop.org,
Boris Brezillon <boris.brezillon@collabora.com>
Subject: [PATCH v2 4/5] drm/panfrost: Add a PANFROST_BO_GPUONLY flag
Date: Fri, 1 Oct 2021 16:34:26 +0200 [thread overview]
Message-ID: <20211001143427.1564786-5-boris.brezillon@collabora.com> (raw)
In-Reply-To: <20211001143427.1564786-1-boris.brezillon@collabora.com>
This lets the driver reduce shareability domain of the MMU mapping,
which can in turn reduce access time and save power on cache-coherent
systems.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
drivers/gpu/drm/panfrost/panfrost_drv.c | 3 ++-
drivers/gpu/drm/panfrost/panfrost_gem.c | 1 +
drivers/gpu/drm/panfrost/panfrost_gem.h | 1 +
drivers/gpu/drm/panfrost/panfrost_mmu.c | 3 +++
include/uapi/drm/panfrost_drm.h | 1 +
5 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index b29ac942ae2d..b176921b9392 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -77,7 +77,8 @@ static int panfrost_ioctl_get_param(struct drm_device *ddev, void *data, struct
#define PANFROST_BO_FLAGS \
(PANFROST_BO_NOEXEC | PANFROST_BO_HEAP | \
- PANFROST_BO_NOREAD | PANFROST_BO_NOWRITE)
+ PANFROST_BO_NOREAD | PANFROST_BO_NOWRITE | \
+ PANFROST_BO_GPUONLY)
static int panfrost_ioctl_create_bo(struct drm_device *dev, void *data,
struct drm_file *file)
diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c b/drivers/gpu/drm/panfrost/panfrost_gem.c
index d6c1bb1445f2..4b1f85c0b98f 100644
--- a/drivers/gpu/drm/panfrost/panfrost_gem.c
+++ b/drivers/gpu/drm/panfrost/panfrost_gem.c
@@ -254,6 +254,7 @@ panfrost_gem_create_with_handle(struct drm_file *file_priv,
bo->noread = !!(flags & PANFROST_BO_NOREAD);
bo->nowrite = !!(flags & PANFROST_BO_NOWRITE);
bo->is_heap = !!(flags & PANFROST_BO_HEAP);
+ bo->gpuonly = !!(flags & PANFROST_BO_GPUONLY);
/*
* Allocate an id of idr table where the obj is registered
diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.h b/drivers/gpu/drm/panfrost/panfrost_gem.h
index 6246b5fef446..e332d5a4c24f 100644
--- a/drivers/gpu/drm/panfrost/panfrost_gem.h
+++ b/drivers/gpu/drm/panfrost/panfrost_gem.h
@@ -40,6 +40,7 @@ struct panfrost_gem_object {
bool noread :1;
bool nowrite :1;
bool is_heap :1;
+ bool gpuonly :1;
};
struct panfrost_gem_mapping {
diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
index 6a5c9d94d6f2..89eee8e80aa5 100644
--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
@@ -321,6 +321,9 @@ int panfrost_mmu_map(struct panfrost_gem_mapping *mapping)
if (!bo->noread)
prot |= IOMMU_READ;
+ if (bo->gpuonly)
+ prot |= IOMMU_DEVONLY;
+
sgt = drm_gem_shmem_get_pages_sgt(obj);
if (WARN_ON(IS_ERR(sgt)))
return PTR_ERR(sgt);
diff --git a/include/uapi/drm/panfrost_drm.h b/include/uapi/drm/panfrost_drm.h
index a2de81225125..538b58b2d095 100644
--- a/include/uapi/drm/panfrost_drm.h
+++ b/include/uapi/drm/panfrost_drm.h
@@ -88,6 +88,7 @@ struct drm_panfrost_wait_bo {
#define PANFROST_BO_HEAP 2
#define PANFROST_BO_NOREAD 4
#define PANFROST_BO_NOWRITE 8
+#define PANFROST_BO_GPUONLY 0x10
/**
* struct drm_panfrost_create_bo - ioctl argument for creating Panfrost BOs.
--
2.31.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-10-01 14:34 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-01 14:34 [PATCH v2 0/5] drm/panfrost: Add extra GPU-usage flags Boris Brezillon
2021-10-01 14:34 ` Boris Brezillon
2021-10-01 14:34 ` Boris Brezillon
2021-10-01 14:34 ` [PATCH v2 1/5] [RFC]iommu: Add a IOMMU_DEVONLY protection flag Boris Brezillon
2021-10-01 14:34 ` Boris Brezillon
2021-10-01 14:34 ` Boris Brezillon
2021-10-01 17:31 ` Alyssa Rosenzweig
2021-10-01 17:31 ` Alyssa Rosenzweig
2021-10-01 17:31 ` Alyssa Rosenzweig
2021-10-18 10:25 ` Joerg Roedel
2021-10-18 10:25 ` Joerg Roedel
2021-10-18 10:25 ` Joerg Roedel
2021-10-18 12:03 ` Boris Brezillon
2021-10-18 12:03 ` Boris Brezillon
2021-10-18 12:03 ` Boris Brezillon
2021-10-01 14:34 ` [PATCH v2 2/5] [RFC]iommu/io-pgtable-arm: Take the DEVONLY flag into account on ARM_MALI_LPAE Boris Brezillon
2021-10-01 14:34 ` Boris Brezillon
2021-10-01 14:34 ` Boris Brezillon
2021-10-01 14:34 ` [PATCH v2 3/5] drm/panfrost: Add PANFROST_BO_NO{READ,WRITE} flags Boris Brezillon
2021-10-01 14:34 ` Boris Brezillon
2021-10-01 14:34 ` Boris Brezillon
2021-10-01 14:36 ` Boris Brezillon
2021-10-01 14:36 ` Boris Brezillon
2021-10-01 14:36 ` Boris Brezillon
2021-10-01 14:34 ` Boris Brezillon [this message]
2021-10-01 14:34 ` [PATCH v2 4/5] drm/panfrost: Add a PANFROST_BO_GPUONLY flag Boris Brezillon
2021-10-01 14:34 ` Boris Brezillon
2021-10-01 15:13 ` Steven Price
2021-10-01 15:13 ` Steven Price
2021-10-01 15:13 ` Steven Price
2021-10-01 16:22 ` Boris Brezillon
2021-10-01 16:22 ` Boris Brezillon
2021-10-01 16:22 ` Boris Brezillon
2021-10-01 17:30 ` Alyssa Rosenzweig
2021-10-01 17:30 ` Alyssa Rosenzweig
2021-10-01 17:30 ` Alyssa Rosenzweig
2021-10-01 14:34 ` [PATCH v2 5/5] drm/panfrost: Bump the driver version to 1.3 Boris Brezillon
2021-10-01 14:34 ` Boris Brezillon
2021-10-01 14:34 ` Boris Brezillon
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=20211001143427.1564786-5-boris.brezillon@collabora.com \
--to=boris.brezillon@collabora.com \
--cc=alyssa.rosenzweig@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=robh+dt@kernel.org \
--cc=robin.murphy@arm.com \
--cc=steven.price@arm.com \
--cc=tomeu.vizoso@collabora.com \
--cc=will@kernel.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.