Tree/Branch: next-20161208
Git describe: next-20161208
Commit: 6c6ea1d836 Add linux-next specific files for 20161208
Build Time: 98 min 37 sec
Passed: 10 / 10 (100.00 %)
Failed: 0 / 10 ( 0.00 %)
Errors: 0
Warnings: 3
Section Mismatches: 0
-------------------------------------------------------------------------------
defconfigs with issues (other than build errors):
1 warnings 0 mismatches : arm64-allmodconfig
2 warnings 0 mismatches : arm-allmodconfig
-------------------------------------------------------------------------------
Warnings Summary: 3
1 ../drivers/net/ethernet/apm/xgene/xgene_enet_cle.c:836:1: warning: the frame size of 1056 bytes is larger than 1024 bytes [-Wframe-larger-than=]
1 ../crypto/algif_aead.c:539:9: warning: 'outlen' may be used uninitialized in this function [-Wmaybe-uninitialized]
1 ../crypto/algif_aead.c:539:19: warning: 'outlen' may be used uninitialized in this function [-Wmaybe-uninitialized]
===============================================================================
Detailed per-defconfig build reports below:
-------------------------------------------------------------------------------
arm64-allmodconfig : PASS, 0 errors, 1 warnings, 0 section mismatches
Warnings:
../crypto/algif_aead.c:539:19: warning: 'outlen' may be used uninitialized in this function [-Wmaybe-uninitialized]
-------------------------------------------------------------------------------
arm-allmodconfig : PASS, 0 errors, 2 warnings, 0 section mismatches
Warnings:
../crypto/algif_aead.c:539:9: warning: 'outlen' may be used uninitialized in this function [-Wmaybe-uninitialized]
../drivers/net/ethernet/apm/xgene/xgene_enet_cle.c:836:1: warning: the frame size of 1056 bytes is larger than 1024 bytes [-Wframe-larger-than=]
-------------------------------------------------------------------------------
Passed with no errors, warnings or mismatches:
arm64-allnoconfig
arm-multi_v5_defconfig
arm-multi_v7_defconfig
x86_64-defconfig
arm-allnoconfig
x86_64-allnoconfig
arm-multi_v4t_defconfig
arm64-defconfig
The OPP structures are abused to the best here, without understanding
how the OPP core and RCU locks work.
In short, the OPP pointer saved in 'rk3399_dmcfreq' can become invalid
under your nose, as the OPP core may free it.
Fix various abuses around OPP structures and calls.
Compile tested only.
Reviewed-by: Chanwoo Choi <cw00.choi(a)samsung.com>
Signed-off-by: Viresh Kumar <viresh.kumar(a)linaro.org>
---
V1->V2:
- Added Reviewed-by from Chanwoo.
- Fixed an issue reported by buildbot.
drivers/devfreq/rk3399_dmc.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c
index 5063ac1a5939..75333050cdea 100644
--- a/drivers/devfreq/rk3399_dmc.c
+++ b/drivers/devfreq/rk3399_dmc.c
@@ -80,7 +80,6 @@ struct rk3399_dmcfreq {
struct regulator *vdd_center;
unsigned long rate, target_rate;
unsigned long volt, target_volt;
- struct dev_pm_opp *curr_opp;
};
static int rk3399_dmcfreq_target(struct device *dev, unsigned long *freq,
@@ -102,9 +101,6 @@ static int rk3399_dmcfreq_target(struct device *dev, unsigned long *freq,
target_rate = dev_pm_opp_get_freq(opp);
target_volt = dev_pm_opp_get_voltage(opp);
- dmcfreq->rate = dev_pm_opp_get_freq(dmcfreq->curr_opp);
- dmcfreq->volt = dev_pm_opp_get_voltage(dmcfreq->curr_opp);
-
rcu_read_unlock();
if (dmcfreq->rate == target_rate)
@@ -165,7 +161,9 @@ static int rk3399_dmcfreq_target(struct device *dev, unsigned long *freq,
if (err)
dev_err(dev, "Cannot to set vol %lu uV\n", target_volt);
- dmcfreq->curr_opp = opp;
+ dmcfreq->rate = target_rate;
+ dmcfreq->volt = target_volt;
+
out:
mutex_unlock(&dmcfreq->lock);
return err;
@@ -431,8 +429,9 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)
rcu_read_unlock();
return PTR_ERR(opp);
}
+ data->rate = dev_pm_opp_get_freq(opp);
+ data->volt = dev_pm_opp_get_voltage(opp);
rcu_read_unlock();
- data->curr_opp = opp;
rk3399_devfreq_dmc_profile.initial_freq = data->rate;
--
2.7.1.410.g6faf27b
This reverts commit ef3caabee9691386e6801ea92150e37277db9c7a.
The commit was based on the assumption that a platform with voltages
specified with individual OPPs, would have registered a regulator as
well in order to do full DVFS.
That assumption is broken by the Tegra124 platform.
For Tegra124, the voltage is not scaled via a direct call to the
regulator subsystem because the DFLL directly controls the I2C interface
that controls the voltage. The DFLL essentially figures out the max
frequency for a given voltage. So to run at a particular frequency, the
DFLL continuously adjusts the voltage in a control loop fashion to get
the desired frequency.
Following are the logs from: NVIDIA Tegra124 Jetson TK1
cpufreq: cpufreq_online: CPU0: Running at unlisted freq: 696000 KHz
cpu cpu0: dev_pm_opp_set_rate: Regulator not registered with OPP core
cpufreq: __target_index: Failed to change cpu frequency: -22
------------[ cut here ]------------
kernel BUG at drivers/cpufreq/cpufreq.c:1235!
Fix these by reverting the offending commit.
Signed-off-by: Viresh Kumar <viresh.kumar(a)linaro.org>
---
Rafael, you can simply drop the patch if that is easier for you.
---
drivers/base/power/opp/core.c | 13 -------------
1 file changed, 13 deletions(-)
diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c
index 7db672f632d9..6af371a55062 100644
--- a/drivers/base/power/opp/core.c
+++ b/drivers/base/power/opp/core.c
@@ -747,20 +747,7 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
/* Only frequency scaling */
if (!regulators) {
- unsigned long u_volt = opp->supplies[0].u_volt;
-
rcu_read_unlock();
-
- /*
- * DT contained supply ratings? Consider platform failed to set
- * regulators.
- */
- if (unlikely(u_volt)) {
- dev_err(dev, "%s: Regulator not registered with OPP core\n",
- __func__);
- return -EINVAL;
- }
-
return _generic_set_opp_clk_only(dev, clk, old_freq, freq);
}
--
2.7.1.410.g6faf27b
Some SoC without MMU have display driver where a drm/kms driver
could be implemented.
Before doing such kind of thing drm/kms must allow to use mmuless devices.
This patch propose to remove MMU configuration flag and add a cma helper
function to help implementing mmuless display driver
version 4:
- add documentation about drm_gem_cma_get_unmapped_area()
- stub it MMU case
Signed-off-by: Benjamin Gaignard <benjamin.gaignard(a)linaro.org>
---
Documentation/gpu/drm-mm.rst | 11 ++++++
drivers/gpu/drm/Kconfig | 4 +-
drivers/gpu/drm/drm_gem_cma_helper.c | 71 ++++++++++++++++++++++++++++++++++++
include/drm/drm_gem_cma_helper.h | 17 +++++++++
4 files changed, 101 insertions(+), 2 deletions(-)
diff --git a/Documentation/gpu/drm-mm.rst b/Documentation/gpu/drm-mm.rst
index bca8085..9d4aa11 100644
--- a/Documentation/gpu/drm-mm.rst
+++ b/Documentation/gpu/drm-mm.rst
@@ -303,6 +303,17 @@ created.
Drivers that want to map the GEM object upfront instead of handling page
faults can implement their own mmap file operation handler.
+For platforms without MMU the GEM core provides a helper method
+:c:func:`drm_gem_cma_get_unmapped_area`. The mmap() routines will call
+this to get a proposed address for the mapping.
+
+To use :c:func:`drm_gem_cma_get_unmapped_area`, drivers must fill the
+struct :c:type:`struct file_operations <file_operations>` get_unmapped_area
+field with a pointer on :c:func:`drm_gem_cma_get_unmapped_area`.
+
+More detailed information about get_unmapped_area can be found in
+Documentation/nommu-mmap.txt
+
Memory Coherency
----------------
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 83ac815..0eae4ad 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -6,7 +6,7 @@
#
menuconfig DRM
tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
- depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && MMU && HAS_DMA
+ depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA
select HDMI
select FB_CMDLINE
select I2C
@@ -98,7 +98,7 @@ config DRM_LOAD_EDID_FIRMWARE
config DRM_TTM
tristate
- depends on DRM
+ depends on DRM && MMU
help
GPU memory management subsystem for devices with multiple
GPU memory types. Will be enabled automatically if a device driver
diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c
index 1d6c335..19908bb 100644
--- a/drivers/gpu/drm/drm_gem_cma_helper.c
+++ b/drivers/gpu/drm/drm_gem_cma_helper.c
@@ -358,6 +358,77 @@ int drm_gem_cma_mmap(struct file *filp, struct vm_area_struct *vma)
}
EXPORT_SYMBOL_GPL(drm_gem_cma_mmap);
+#ifndef CONFIG_MMU
+/**
+ * drm_gem_cma_get_unmapped_area - propose address for mapping in noMMU cases
+ * @filp: file object
+ * @addr: memory address
+ * @len: buffer size
+ * @pgoff: page offset
+ * @flags: memory flags
+ *
+ * This function is used in noMMU platforms to propose address mapping
+ * for a given buffer.
+ * It's intended to be used as a direct handler for the struct &file_operations
+ * .get_unmapped_area() operation.
+ *
+ * Returns:
+ * mapping address on success or a negative error code on failure.
+ */
+unsigned long drm_gem_cma_get_unmapped_area(struct file *filp,
+ unsigned long addr,
+ unsigned long len,
+ unsigned long pgoff,
+ unsigned long flags)
+{
+ struct drm_gem_cma_object *cma_obj;
+ struct drm_gem_object *obj = NULL;
+ struct drm_file *priv = filp->private_data;
+ struct drm_device *dev = priv->minor->dev;
+ struct drm_vma_offset_node *node;
+
+ if (drm_device_is_unplugged(dev))
+ return -ENODEV;
+
+ drm_vma_offset_lock_lookup(dev->vma_offset_manager);
+ node = drm_vma_offset_exact_lookup_locked(dev->vma_offset_manager,
+ pgoff,
+ len >> PAGE_SHIFT);
+ if (likely(node)) {
+ obj = container_of(node, struct drm_gem_object, vma_node);
+ /*
+ * When the object is being freed, after it hits 0-refcnt it
+ * proceeds to tear down the object. In the process it will
+ * attempt to remove the VMA offset and so acquire this
+ * mgr->vm_lock. Therefore if we find an object with a 0-refcnt
+ * that matches our range, we know it is in the process of being
+ * destroyed and will be freed as soon as we release the lock -
+ * so we have to check for the 0-refcnted object and treat it as
+ * invalid.
+ */
+ if (!kref_get_unless_zero(&obj->refcount))
+ obj = NULL;
+ }
+
+ drm_vma_offset_unlock_lookup(dev->vma_offset_manager);
+
+ if (!obj)
+ return -EINVAL;
+
+ if (!drm_vma_node_is_allowed(node, priv)) {
+ drm_gem_object_unreference_unlocked(obj);
+ return -EACCES;
+ }
+
+ cma_obj = to_drm_gem_cma_obj(obj);
+
+ drm_gem_object_unreference_unlocked(obj);
+
+ return cma_obj->vaddr ? (unsigned long)cma_obj->vaddr : -EINVAL;
+}
+EXPORT_SYMBOL_GPL(drm_gem_cma_get_unmapped_area);
+#endif
+
#ifdef CONFIG_DEBUG_FS
/**
* drm_gem_cma_describe - describe a CMA GEM object for debugfs
diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h
index acd6af8..180b586 100644
--- a/include/drm/drm_gem_cma_helper.h
+++ b/include/drm/drm_gem_cma_helper.h
@@ -53,6 +53,23 @@ struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,
extern const struct vm_operations_struct drm_gem_cma_vm_ops;
+#ifndef CONFIG_MMU
+unsigned long drm_gem_cma_get_unmapped_area(struct file *filp,
+ unsigned long addr,
+ unsigned long len,
+ unsigned long pgoff,
+ unsigned long flags);
+#else
+unsigned long drm_gem_cma_get_unmapped_area(struct file *filp,
+ unsigned long addr,
+ unsigned long len,
+ unsigned long pgoff,
+ unsigned long flags)
+{
+ return -EINVAL;
+}
+#endif
+
#ifdef CONFIG_DEBUG_FS
void drm_gem_cma_describe(struct drm_gem_cma_object *obj, struct seq_file *m);
#endif
--
1.9.1
version 4:
- add documentation about drm_gem_cma_get_unmapped_area()
- introduce FB_PROVIDE_GET_FB_UNMAPPED_AREA configuration flag for get_fb_unmapped_area()
- I have also send the first patch (https://lkml.org/lkml/2016/12/1/308) to make dma_mmap_wc
works on ARM noMMU platform, assuming that is patch will be accepted there is no more
needs to call vm_ioremap in cma helpers.
version 3:
- split the original patch in 3 parts, it should be more easy to review like
this.
- duplicate drm_fb_cma_helper.c and drm_gem_cma_helper.c into nommu version
- add a configuration flag for drm_vm.c
The purpose of this RFC is to understand what is needed to allow to
write drm/kms drivers for devices without MMU.
There are some MCU platforms, like stm32f4, which don't have MMU
but have hardware display IP where is it possible to implement a
drm/kms driver.
Obviously that start by removing MMU configuration flag from Kconfig.
But while coding the driver for stm32f4 (on discovery board to have enough memory)
we have already identify few other pieces of code that need to be change.
We have been inspired by what already exist in v4l2 where using mmuless devices
is possible.
Since we have only use cma helpers we only have partial view of what could be
needed for other part of drm/kms framework.
Benjamin Gaignard (4):
nommu: allow mmap when !CONFIG_MMU
fbmem: add a default get_fb_unmapped_area function
drm: compile drm_vm.c only when needed
drm: allow to use mmuless SoC
Documentation/gpu/drm-mm.rst | 11 ++++++
arch/arm/mm/dma-mapping.c | 3 ++
drivers/gpu/drm/Kconfig | 9 +++--
drivers/gpu/drm/Makefile | 3 +-
drivers/gpu/drm/drm_gem_cma_helper.c | 69 ++++++++++++++++++++++++++++++++++++
drivers/gpu/drm/drm_legacy.h | 7 ++++
drivers/gpu/drm/nouveau/Kconfig | 1 +
drivers/video/fbdev/Kconfig | 8 +++++
drivers/video/fbdev/core/fbmem.c | 15 ++++++++
include/drm/drm_gem_cma_helper.h | 17 +++++++++
10 files changed, 140 insertions(+), 3 deletions(-)
--
1.9.1
Tree/Branch: next-20161207
Git describe: next-20161207
Commit: 7677a1fb12 Add linux-next specific files for 20161207
Build Time: 98 min 50 sec
Passed: 9 / 10 ( 90.00 %)
Failed: 1 / 10 ( 10.00 %)
Errors: 1
Warnings: 4
Section Mismatches: 0
Failed defconfigs:
arm-allmodconfig
Errors:
arm-allmodconfig
ERROR: "__bad_xchg" [net/netfilter/nft_counter.ko] undefined!
-------------------------------------------------------------------------------
defconfigs with issues (other than build errors):
1 warnings 0 mismatches : arm64-allmodconfig
4 warnings 0 mismatches : arm-allmodconfig
-------------------------------------------------------------------------------
Errors summary: 1
1 ERROR: "__bad_xchg" [net/netfilter/nft_counter.ko] undefined!
Warnings Summary: 4
2 ../net/netfilter/nf_tables_api.c:3011:15: warning: 'objtype' may be used uninitialized in this function [-Wmaybe-uninitialized]
1 ../net/netfilter/nft_counter.c:129:16: warning: 'bytes' may be used uninitialized in this function [-Wmaybe-uninitialized]
1 ../net/netfilter/nft_counter.c:128:18: warning: 'packets' may be used uninitialized in this function [-Wmaybe-uninitialized]
1 ../drivers/net/ethernet/apm/xgene/xgene_enet_cle.c:836:1: warning: the frame size of 1056 bytes is larger than 1024 bytes [-Wframe-larger-than=]
===============================================================================
Detailed per-defconfig build reports below:
-------------------------------------------------------------------------------
arm64-allmodconfig : PASS, 0 errors, 1 warnings, 0 section mismatches
Warnings:
../net/netfilter/nf_tables_api.c:3011:15: warning: 'objtype' may be used uninitialized in this function [-Wmaybe-uninitialized]
-------------------------------------------------------------------------------
arm-allmodconfig : FAIL, 1 errors, 4 warnings, 0 section mismatches
Errors:
ERROR: "__bad_xchg" [net/netfilter/nft_counter.ko] undefined!
Warnings:
../net/netfilter/nf_tables_api.c:3011:15: warning: 'objtype' may be used uninitialized in this function [-Wmaybe-uninitialized]
../net/netfilter/nft_counter.c:128:18: warning: 'packets' may be used uninitialized in this function [-Wmaybe-uninitialized]
../net/netfilter/nft_counter.c:129:16: warning: 'bytes' may be used uninitialized in this function [-Wmaybe-uninitialized]
../drivers/net/ethernet/apm/xgene/xgene_enet_cle.c:836:1: warning: the frame size of 1056 bytes is larger than 1024 bytes [-Wframe-larger-than=]
-------------------------------------------------------------------------------
Passed with no errors, warnings or mismatches:
arm64-allnoconfig
arm-multi_v5_defconfig
arm-multi_v7_defconfig
x86_64-defconfig
arm-allnoconfig
x86_64-allnoconfig
arm-multi_v4t_defconfig
arm64-defconfig
Hi,
Some platforms (like TI) have complex DVFS configuration for CPU
devices, where multiple regulators are required to be configured to
change DVFS state of the device. This was explained well by Nishanth
earlier [1].
One of the major complaints around multiple regulators case was that the
DT isn't responsible in any way to represent the order in which multiple
supplies need to be programmed, before or after a frequency change. It
was considered in this patch and such information is left for the
platform specific OPP driver now, which can register its own
opp_set_rate() callback with the OPP core and the OPP core will then
call it during DVFS.
The patches are tested on Exynos5250 (Dual A15). I have hacked around DT
and code to pass values for multiple regulators and verified that they
are all properly read by the kernel (using debugfs interface).
Dave Gerlach has already tested [2] it on the real TI platforms and it
works well for him.
This is rebased over: linux-next branch in the PM tree.
V6->V7:
- Added RBY from Stephen for the 8th patch as well.
- Rebased over pm/bleeding-edge as the dependency patch is already
applied there.
- s/dev_pm_opp_set_regulator()/dev_pm_opp_set_regulators() in a comment.
- Removed the local 'names' array in cpufreq-dt and used "&name"
instead.
- Only the 6th patch doesn't have a Reviewed-by Tag now..
V5->V6:
- Rebased over a recent fix (and resolved rebase conflicts) that will
get applied before this series:
https://marc.info/?l=linux-kernel&m=148047843010418&w=2
V4->V5:
- Stephen boyd had some minor review comments and gave his Reviewed-by
tag for the rest. Only 2 patches don't have his RBY tag.
- Individual patches contain the version history from V4 to V5.
V3->V4:
- Separate out cpu-supply fix in the binding in a separate patch (Mark).
- Add more documentation to the binding to explain that the relation to
the supplies and the order of programming them is left for the
platform specific bindings and that every platform using multiple
regulators for their devices needs to provide a separate binding
document explaining their implementation (Mark).
- @Rob and Stephen: I have kept your Acks for the bindings as the
bindings only got a bit reworded (improved) since the time you guys
Acked them. Please let me know if you want more improvement in the
bindings now.
- V4 for 10/10 was sent earlier, which added a missing
rcu_read_unlock(). Nothing else changed in it.
- Added some missing Kernel documentation comments
V2->V3:
- The last patch is new
- Removed a debug leftover pr_info() message
- Renamed few names as s/set_rate/set_opp
- Removed a TODO comment (as it is done now with this series)
- created struct for min_uV and max_uV
- kerneldoc comments for structures in pm_opp.h
- s/const char */const char * const
- use kasprintf()
- Some more minor reformatting
- More Ack/RBY tags added
V1->V2:
- Ack from Rob for 1st patch
- Moved the supplies structure to pm_opp.h (Dave)
- Fixed an compilation warning.
--
viresh
[1] https://marc.info/?l=linux-pm&m=145684495832764&w=2
[2] https://marc.info/?l=linux-kernel&m=147924789305276&w=2
Viresh Kumar (10):
PM / OPP: Fix incorrect cpu-supply property in binding
PM / OPP: Reword binding supporting multiple regulators per device
PM / OPP: Don't use OPP structure outside of rcu protected section
PM / OPP: Manage supply's voltage/current in a separate structure
PM / OPP: Pass struct dev_pm_opp_supply to _set_opp_voltage()
PM / OPP: Add infrastructure to manage multiple regulators
PM / OPP: Separate out _generic_set_opp()
PM / OPP: Allow platform specific custom set_opp() callbacks
PM / OPP: Don't WARN on multiple calls to dev_pm_opp_set_regulators()
PM / OPP: Don't assume platform doesn't have regulators
Documentation/devicetree/bindings/opp/opp.txt | 27 +-
drivers/base/power/opp/core.c | 538 ++++++++++++++++++++------
drivers/base/power/opp/debugfs.c | 52 ++-
drivers/base/power/opp/of.c | 105 +++--
drivers/base/power/opp/opp.h | 22 +-
drivers/cpufreq/cpufreq-dt.c | 6 +-
include/linux/pm_opp.h | 69 +++-
7 files changed, 633 insertions(+), 186 deletions(-)
--
2.7.1.410.g6faf27b