* Re: Constantly map and unmap of streaming DMA buffers with IOMMU backend might cause serious performance problem
From: Robin Murphy @ 2020-05-15 22:12 UTC (permalink / raw)
To: Song Bao Hua, hch@lst.de
Cc: davidm@hpl.hp.com, ralf@oss.sgi.com, Linuxarm,
linux@armlinux.org.uk, iommu@lists.linux-foundation.org,
sailer@ife.ee.ethz.ch, Jay.Estabrook@compaq.com,
dagum@barrel.engr.sgi.com, andrea@suse.de, grundler@cup.hp.com,
jens.axboe@oracle.com, linux-arm-kernel@lists.infradead.org,
m.szyprowski@samsung.com
In-Reply-To: <B926444035E5E2439431908E3842AFD249F9F4@DGGEMI525-MBS.china.huawei.com>
On 2020-05-15 22:33, Song Bao Hua wrote:
>> Subject: Re: Constantly map and unmap of streaming DMA buffers with
>> IOMMU backend might cause serious performance problem
>>
>> On Fri, May 15, 2020 at 01:10:21PM +0100, Robin Murphy wrote:
>>>> Meanwhile, for the safety of buffers, lower-layer drivers need to make
>> certain the buffers have already been unmapped in iommu before those
>> buffers go back to buddy for other users.
>>>
>>> That sounds like it would only have benefit in a very small set of specific
>>> circumstances, and would be very difficult to generalise to buffers that
>>> are mapped via dma_map_page() or dma_map_single(). Furthermore, a
>>> high-level API that affects a low-level driver's interpretation of
>>> mid-layer API calls without the mid-layer's knowledge sounds like a hideous
>>> abomination of anti-design. If a mid-layer API lends itself to inefficiency
>>> at the lower level, it would seem a lot cleaner and more robust to extend
>>> *that* API for stateful buffer reuse. Failing that, it might possibly be
>>> appropriate to approach this at the driver level - many of the cleverer
>>> network drivers already implement buffer pools to recycle mapped SKBs
>>> internally, couldn't the "zip driver" simply try doing something like that
>>> for itself?
>>
>> Exactly. If you upper consumer of the DMA API keeps reusing the same
>> pages just map them once and use dma_sync_* to transfer ownership as
>> needed.
>
> The problem is that the lower-layer drivers don't know if upper consumer keeps reusing the same pages. They are running in different software layers.
> For example, Consumer is here in mm/zswap.c
> static int zswap_frontswap_store(unsigned type, pgoff_t offset,
> struct page *page)
> {
> ...
> /* compress */
> dst = get_cpu_var(zswap_dstmem);
> ...
> ret = crypto_comp_compress(tfm, src, PAGE_SIZE, dst, &dlen);
> ...
> }
>
> But the lower-layer driver is in drivers/crypto/...
>
> Meanwhile, the lower-layer driver couldn't cache the pointers of buffer address coming from consumers to detect if the upper-layer is using the same page.
> Because the same page might come from different users or come from the different stages of the same user with different permissions.
Indeed the driver can't cache arbitrary pointers, but if typical buffers
are small enough it can copy the data into its own already-mapped page,
dma_sync it, and perform the DMA operation from there. That might even
be more or less what your first suggestion was, but I'm still not quite
sure.
> For example, consumer A uses the buffer as destination, then returns it to buddy, but consumer B gets the same buffer and uses it as source.
>
> Another possibility is
> Consumer A uses the buffer, returns it to buddy, after some time, it allocates a buffer again, but gets the same buffer from buddy like before.
>
> For the safety of the buffer, lower-layer driver must guarantee the buffer is unmapped when the buffer returns to buddy.
>
> I think only the upper-layer consumer knows if it is reusing the buffer.
Right, and if reusing buffers is common in crypto callers, then there's
an argument for "set up reusable buffer", "process updated buffer" and
"clean up buffer" operations to be added to the crypto API itself, such
that the underlying drivers can then optimise for DMA usage in a robust
and obvious way if they want to (or just implement the setup and
teardown as no-ops and still do a full map/unmap in each "process" call
if they don't).
Robin.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* [PATCH] arm64: Fix PTRACE_SYSEMU semantics
From: Keno Fischer @ 2020-05-15 22:22 UTC (permalink / raw)
To: linux-arm-kernel
Cc: catalin.marinas, will.deacon, oleg, linux-kernel, sudeep.holla
Quoth the man page:
```
If the tracee was restarted by PTRACE_SYSCALL or PTRACE_SYSEMU, the
tracee enters syscall-enter-stop just prior to entering any system
call (which will not be executed if the restart was using
PTRACE_SYSEMU, regardless of any change made to registers at this
point or how the tracee is restarted after this stop).
```
The parenthetical comment is currently true on x86 and powerpc,
but not currently true on arm64. arm64 re-checks the _TIF_SYSCALL_EMU
flag after the syscall entry ptrace stop. However, at this point,
it reflects which method was used to re-start the syscall
at the entry stop, rather than the method that was used to reach it.
Fix that by recording the original flag before performing the ptrace
stop, bringing the behavior in line with documentation and x86/powerpc.
Signed-off-by: Keno Fischer <keno@juliacomputing.com>
---
arch/arm64/kernel/ptrace.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index b3d3005d9515..b67b4d14aa17 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -1829,10 +1829,12 @@ static void tracehook_report_syscall(struct pt_regs *regs,
int syscall_trace_enter(struct pt_regs *regs)
{
- if (test_thread_flag(TIF_SYSCALL_TRACE) ||
- test_thread_flag(TIF_SYSCALL_EMU)) {
+ u32 flags = READ_ONCE(current_thread_info()->flags) &
+ (_TIF_SYSCALL_EMU | _TIF_SYSCALL_TRACE);
+
+ if (flags) {
tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER);
- if (!in_syscall(regs) || test_thread_flag(TIF_SYSCALL_EMU))
+ if (!in_syscall(regs) || (flags & _TIF_SYSCALL_EMU))
return -1;
}
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* RE: Constantly map and unmap of streaming DMA buffers with IOMMU backend might cause serious performance problem
From: Song Bao Hua @ 2020-05-15 22:45 UTC (permalink / raw)
To: Robin Murphy, linux@armlinux.org.uk, hch@lst.de,
m.szyprowski@samsung.com, dagum@barrel.engr.sgi.com,
ralf@oss.sgi.com, grundler@cup.hp.com, Jay.Estabrook@compaq.com,
sailer@ife.ee.ethz.ch, andrea@suse.de, jens.axboe@oracle.com,
davidm@hpl.hp.com
Cc: iommu@lists.linux-foundation.org, Linuxarm,
linux-arm-kernel@lists.infradead.org
In-Reply-To: <36d67d68-4381-c7a7-dcf1-6383bd9ae0ad@arm.com>
> Subject: Re: Constantly map and unmap of streaming DMA buffers with
> IOMMU backend might cause serious performance problem
>
> On 2020-05-15 09:19, Song Bao Hua wrote:
> [ snip... nice analysis, but ultimately it's still "doing stuff has more overhead
> than not doing stuff" ]
>
> > I am thinking several possible ways on decreasing or removing the latency of
> DMA map/unmap for every single DMA transfer. Meanwhile, "non-strict" as an
> existing option with possible safety issues, I won't discuss it in this mail.
>
> But passthrough and non-strict mode *specifically exist* for the cases where
> performance is the most important concern - streaming DMA with an IOMMU
> in the middle has an unavoidable tradeoff between performance and isolation,
> so dismissing that out of hand is not a good way to start making this
> argument.
I do understand there is a tradeoff between performance and isolation. However, users might ask for performance while supporting isolation.
In passthrough mode, the whole memory might be accessible by DMA. In non-strict mode, a buffer could be still mapped in IOMMU when users have returned it to buddy and the buffer has even been allocated by another user.
>
> > 1. provide bounce coherent buffers for streaming buffers.
> > As the coherent buffers keep the status of mapping, we can remove the
> overhead of map and unmap for each single DMA operations. However, this
> solution requires memory copy between stream buffers and bounce buffers.
> Thus it will work only if copy is faster than map/unmap. Meanwhile, it will
> consume much more memory bandwidth.
>
> I'm struggling to understand how that would work, can you explain it in more
> detail?
lower-layer drivers maintain some reusable coherent buffers.
For TX path, drivers copy streaming buffer to coherent buffer, then do DMA;
For RX path, drivers do DMA in coherent buffer, then copy to streaming buffer.
>
> > 2.make upper-layer kernel components aware of the pain of iommu
> > map/unmap upper-layer fs, mm, networks can somehow let the lower-layer
> drivers know the end of the life cycle of sg buffers. In zswap case, I have seen
> zswap always use the same 2 pages as the destination buffers to save
> compressed page, but the compressor driver still has to constantly map and
> unmap those same two pages for every single compression since zswap and zip
> drivers are working in two completely different software layers.
> >
> > I am thinking some way as below, upper-layer kernel code can call:
> > sg_init_table(&sg...);
> > sg_mark_reusable(&sg....);
> > .... /* use the buffer many times */
> > ....
> > sg_mark_stop_reuse(&sg);
> >
> > After that, if low level drivers see "reusable" flag, it will realize the buffer can
> be used multiple times and will not do map/unmap every time. it means
> upper-layer components will further use the buffers and the same buffers will
> probably be given to lower-layer drivers for new DMA transfer later. When
> upper-layer code sets " stop_reuse", lower-layer driver will unmap the sg
> buffers, possibly by providing a unmap-callback to upper-layer components.
> For zswap case, I have seen the same buffers are always re-used and zip driver
> maps and unmaps it again and again. Shortly after the buffer is unmapped, it
> will be mapped in the next transmission, almost without any time gap
> between unmap and map. In case zswap can set the "reusable" flag, zip driver
> will save a lot of time.
> > Meanwhile, for the safety of buffers, lower-layer drivers need to make certain
> the buffers have already been unmapped in iommu before those buffers go
> back to buddy for other users.
>
> That sounds like it would only have benefit in a very small set of specific
> circumstances, and would be very difficult to generalise to buffers that are
> mapped via dma_map_page() or dma_map_single().
Yes, indeed. Hopefully the small set of specific circumstances will encourage more upper-layer consumers to reuse buffers, then the "reusable" flag can extend to more common cases, such as page and single buffer.
> Furthermore, a high-level API that affects a low-level driver's interpretation of
> mid-layer API calls without the mid-layer's knowledge sounds like a hideous
> abomination of anti-design. If a mid-layer API lends itself to inefficiency at the
> lower level, it would seem a lot cleaner and more robust to extend *that* API
> for stateful buffer reuse.
Absolutely agree. I didn't say the method is elegant. For this moment, maybe "reuse" can get started from a small case like zswap. After some while, it is possible more users are encouraged to do some optimization for buffer reuse, understanding the suffering of lower-layer drivers. Then those performance problems might be solved case by case.
On the other hand, it is always the freedom of upper-layer code to indicate "reuse" or not. If they don't say anything about reuse, lower-layer drivers can simply do map and unmap.
> Failing that, it might possibly be appropriate to approach this at the driver
> level - many of the cleverer network drivers already implement buffer pools to
> recycle mapped SKBs internally, couldn't the "zip driver" simply try doing
> something like that for itself?
are the buffer pools for RX path? For TX path, buffers come from upper-layer so network drivers can't do anything for recycling SKBs?
>
> Robin.
Thanks
Barry
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: ARM: static kernel in vmalloc space
From: afzal mohammed @ 2020-05-16 6:06 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: Russell King, Linux ARM, linux-kernel@vger.kernel.org
In-Reply-To: <CAK8P3a1PVwkAi8ycUAB-7EMk4nQ_qOu0rC5vJAQk_q9j5xvOJw@mail.gmail.com>
Hi,
On Thu, May 14, 2020 at 05:32:41PM +0200, Arnd Bergmann wrote:
> Typical distros currently offer two kernels, with and without LPAE,
> and they probably don't want to add a third one for LPAE with
> either highmem or vmsplit-4g-4g. Having extra user address
> space and more lowmem is both going to help users that
> still have 8GB configurations.
Okay, so the conclusion i take is,
1. VMSPLIT 4G/4G have to live alongside highmem
2. For user space copy, do pinning followed by kmap
Regards
afzal
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: ARM: static kernel in vmalloc space
From: Arnd Bergmann @ 2020-05-16 7:35 UTC (permalink / raw)
To: afzal mohammed; +Cc: Russell King, Linux ARM, linux-kernel@vger.kernel.org
In-Reply-To: <20200516060624.GA6371@afzalpc>
On Sat, May 16, 2020 at 8:06 AM afzal mohammed <afzal.mohd.ma@gmail.com> wrote:
>
> On Thu, May 14, 2020 at 05:32:41PM +0200, Arnd Bergmann wrote:
>
> > Typical distros currently offer two kernels, with and without LPAE,
> > and they probably don't want to add a third one for LPAE with
> > either highmem or vmsplit-4g-4g. Having extra user address
> > space and more lowmem is both going to help users that
> > still have 8GB configurations.
>
> Okay, so the conclusion i take is,
>
> 1. VMSPLIT 4G/4G have to live alongside highmem
> 2. For user space copy, do pinning followed by kmap
Right, though kmap_atomic() should be sufficient here
because it is always a short-lived mapping.
Arnd
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* [PATCH 1/2] clk: bcm2835: Fix return type of bcm2835_register_gate
From: Nathan Chancellor @ 2020-05-16 8:08 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-arm-kernel, Florian Fainelli, Scott Branden, Ray Jui,
linux-kernel, clang-built-linux, bcm-kernel-feedback-list,
linux-rpi-kernel, Sami Tolvanen, Nathan Chancellor, linux-clk,
Nicolas Saenz Julienne
bcm2835_register_gate is used as a callback for the clk_register member
of bcm2835_clk_desc, which expects a struct clk_hw * return type but
bcm2835_register_gate returns a struct clk *.
This discrepancy is hidden by the fact that bcm2835_register_gate is
cast to the typedef bcm2835_clk_register by the _REGISTER macro. This
turns out to be a control flow integrity violation, which is how this
was noticed.
Change the return type of bcm2835_register_gate to be struct clk_hw *
and use clk_hw_register_gate to do so. This should be a non-functional
change as clk_register_gate calls clk_hw_register_gate anyways but this
is needed to avoid issues with further changes.
Fixes: b19f009d4510 ("clk: bcm2835: Migrate to clk_hw based registration and OF APIs")
Link: https://github.com/ClangBuiltLinux/linux/issues/1028
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
drivers/clk/bcm/clk-bcm2835.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
index ded13ccf768e..7c845c293af0 100644
--- a/drivers/clk/bcm/clk-bcm2835.c
+++ b/drivers/clk/bcm/clk-bcm2835.c
@@ -1448,13 +1448,13 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman,
return &clock->hw;
}
-static struct clk *bcm2835_register_gate(struct bcm2835_cprman *cprman,
+static struct clk_hw *bcm2835_register_gate(struct bcm2835_cprman *cprman,
const struct bcm2835_gate_data *data)
{
- return clk_register_gate(cprman->dev, data->name, data->parent,
- CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE,
- cprman->regs + data->ctl_reg,
- CM_GATE_BIT, 0, &cprman->regs_lock);
+ return clk_hw_register_gate(cprman->dev, data->name, data->parent,
+ CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE,
+ cprman->regs + data->ctl_reg,
+ CM_GATE_BIT, 0, &cprman->regs_lock);
}
typedef struct clk_hw *(*bcm2835_clk_register)(struct bcm2835_cprman *cprman,
base-commit: bdecf38f228bcca73b31ada98b5b7ba1215eb9c9
--
2.26.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH 2/2] clk: bcm2835: Remove casting to bcm2835_clk_register
From: Nathan Chancellor @ 2020-05-16 8:08 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-arm-kernel, Florian Fainelli, Scott Branden, Ray Jui,
linux-kernel, clang-built-linux, bcm-kernel-feedback-list,
linux-rpi-kernel, Sami Tolvanen, Nathan Chancellor, linux-clk,
Nicolas Saenz Julienne
In-Reply-To: <20200516080806.1459784-1-natechancellor@gmail.com>
There are four different callback functions that are used for the
clk_register callback that all have different second parameter types.
bcm2835_register_pll -> struct bcm2835_pll_data
bcm2835_register_pll_divider -> struct bcm2835_pll_divider_data
bcm2835_register_clock -> struct bcm2835_clock_data
bcm2835_register_date -> struct bcm2835_gate_data
These callbacks are cast to bcm2835_clk_register so that there is no
error about incompatible pointer types. Unfortunately, this is a control
flow integrity violation, which verifies that the callback function's
types match the prototypes exactly before jumping.
[ 0.857913] CFI failure (target: 0xffffff9334a81820):
[ 0.857977] WARNING: CPU: 3 PID: 35 at kernel/cfi.c:29 __cfi_check_fail+0x50/0x58
[ 0.857985] Modules linked in:
[ 0.858007] CPU: 3 PID: 35 Comm: kworker/3:1 Not tainted 4.19.123-v8-01301-gdbb48f16956e4-dirty #1
[ 0.858015] Hardware name: Raspberry Pi 3 Model B Rev 1.2 (DT)
[ 0.858031] Workqueue: events 0xffffff9334a925c8
[ 0.858046] pstate: 60000005 (nZCv daif -PAN -UAO)
[ 0.858058] pc : __cfi_check_fail+0x50/0x58
[ 0.858070] lr : __cfi_check_fail+0x50/0x58
[ 0.858078] sp : ffffff800814ba90
[ 0.858086] x29: ffffff800814ba90 x28: 000fffffffdfff3d
[ 0.858101] x27: 00000000002000c2 x26: ffffff93355fdb18
[ 0.858116] x25: 0000000000000000 x24: ffffff9334a81820
[ 0.858131] x23: ffffff93357f3580 x22: ffffff9334af1000
[ 0.858146] x21: a79b57e88f8ebc81 x20: ffffff93357f3580
[ 0.858161] x19: ffffff9334a81820 x18: fffffff679769070
[ 0.858175] x17: 0000000000000000 x16: 0000000000000000
[ 0.858190] x15: 0000000000000004 x14: 000000000000003c
[ 0.858205] x13: 0000000000003044 x12: 0000000000000000
[ 0.858220] x11: b57e91cd641bae00 x10: b57e91cd641bae00
[ 0.858235] x9 : b57e91cd641bae00 x8 : b57e91cd641bae00
[ 0.858250] x7 : 0000000000000000 x6 : ffffff933591d4e5
[ 0.858264] x5 : 0000000000000000 x4 : 0000000000000000
[ 0.858279] x3 : ffffff800814b718 x2 : ffffff9334a84818
[ 0.858293] x1 : ffffff9334bba66c x0 : 0000000000000029
[ 0.858308] Call trace:
[ 0.858321] __cfi_check_fail+0x50/0x58
[ 0.858337] __cfi_check+0x3ab3c/0x4467c
[ 0.858351] bcm2835_clk_probe+0x210/0x2dc
[ 0.858369] platform_drv_probe+0xb0/0xfc
[ 0.858380] really_probe+0x4a0/0x5a8
[ 0.858391] driver_probe_device+0x68/0x104
[ 0.858403] __device_attach_driver+0x100/0x148
[ 0.858418] bus_for_each_drv+0xb0/0x12c
[ 0.858431] __device_attach.llvm.17225159516306086099+0xc0/0x168
[ 0.858443] bus_probe_device+0x44/0xfc
[ 0.858455] deferred_probe_work_func+0xa0/0xe0
[ 0.858472] process_one_work+0x210/0x538
[ 0.858485] worker_thread+0x2e8/0x478
[ 0.858500] kthread+0x154/0x164
[ 0.858515] ret_from_fork+0x10/0x18
To fix this, change the second parameter of all functions void * and use
a local variable with the correct type so that everything works
properly. With this, the only use of bcm2835_clk_register is in struct
bcm2835_clk_desc so we can just remove it and use the type directly.
Fixes: 56eb3a2ed972 ("clk: bcm2835: remove use of BCM2835_CLOCK_COUNT in driver")
Link: https://github.com/ClangBuiltLinux/linux/issues/1028
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
drivers/clk/bcm/clk-bcm2835.c | 68 +++++++++++++++++++----------------
1 file changed, 37 insertions(+), 31 deletions(-)
diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
index 7c845c293af0..0d0eeb3b0dd5 100644
--- a/drivers/clk/bcm/clk-bcm2835.c
+++ b/drivers/clk/bcm/clk-bcm2835.c
@@ -1296,8 +1296,9 @@ static const struct clk_ops bcm2835_vpu_clock_clk_ops = {
};
static struct clk_hw *bcm2835_register_pll(struct bcm2835_cprman *cprman,
- const struct bcm2835_pll_data *data)
+ const void *data)
{
+ const struct bcm2835_pll_data *pll_data = data;
struct bcm2835_pll *pll;
struct clk_init_data init;
int ret;
@@ -1307,7 +1308,7 @@ static struct clk_hw *bcm2835_register_pll(struct bcm2835_cprman *cprman,
/* All of the PLLs derive from the external oscillator. */
init.parent_names = &cprman->real_parent_names[0];
init.num_parents = 1;
- init.name = data->name;
+ init.name = pll_data->name;
init.ops = &bcm2835_pll_clk_ops;
init.flags = CLK_IGNORE_UNUSED;
@@ -1316,7 +1317,7 @@ static struct clk_hw *bcm2835_register_pll(struct bcm2835_cprman *cprman,
return NULL;
pll->cprman = cprman;
- pll->data = data;
+ pll->data = pll_data;
pll->hw.init = &init;
ret = devm_clk_hw_register(cprman->dev, &pll->hw);
@@ -1327,35 +1328,36 @@ static struct clk_hw *bcm2835_register_pll(struct bcm2835_cprman *cprman,
static struct clk_hw *
bcm2835_register_pll_divider(struct bcm2835_cprman *cprman,
- const struct bcm2835_pll_divider_data *data)
+ const void *data)
{
+ const struct bcm2835_pll_divider_data *divider_data = data;
struct bcm2835_pll_divider *divider;
struct clk_init_data init;
const char *divider_name;
int ret;
- if (data->fixed_divider != 1) {
+ if (divider_data->fixed_divider != 1) {
divider_name = devm_kasprintf(cprman->dev, GFP_KERNEL,
- "%s_prediv", data->name);
+ "%s_prediv", divider_data->name);
if (!divider_name)
return NULL;
} else {
- divider_name = data->name;
+ divider_name = divider_data->name;
}
memset(&init, 0, sizeof(init));
- init.parent_names = &data->source_pll;
+ init.parent_names = ÷r_data->source_pll;
init.num_parents = 1;
init.name = divider_name;
init.ops = &bcm2835_pll_divider_clk_ops;
- init.flags = data->flags | CLK_IGNORE_UNUSED;
+ init.flags = divider_data->flags | CLK_IGNORE_UNUSED;
divider = devm_kzalloc(cprman->dev, sizeof(*divider), GFP_KERNEL);
if (!divider)
return NULL;
- divider->div.reg = cprman->regs + data->a2w_reg;
+ divider->div.reg = cprman->regs + divider_data->a2w_reg;
divider->div.shift = A2W_PLL_DIV_SHIFT;
divider->div.width = A2W_PLL_DIV_BITS;
divider->div.flags = CLK_DIVIDER_MAX_AT_ZERO;
@@ -1364,7 +1366,7 @@ bcm2835_register_pll_divider(struct bcm2835_cprman *cprman,
divider->div.table = NULL;
divider->cprman = cprman;
- divider->data = data;
+ divider->data = divider_data;
ret = devm_clk_hw_register(cprman->dev, ÷r->div.hw);
if (ret)
@@ -1374,20 +1376,22 @@ bcm2835_register_pll_divider(struct bcm2835_cprman *cprman,
* PLLH's channels have a fixed divide by 10 afterwards, which
* is what our consumers are actually using.
*/
- if (data->fixed_divider != 1) {
- return clk_hw_register_fixed_factor(cprman->dev, data->name,
+ if (divider_data->fixed_divider != 1) {
+ return clk_hw_register_fixed_factor(cprman->dev,
+ divider_data->name,
divider_name,
CLK_SET_RATE_PARENT,
1,
- data->fixed_divider);
+ divider_data->fixed_divider);
}
return ÷r->div.hw;
}
static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman,
- const struct bcm2835_clock_data *data)
+ const void *data)
{
+ const struct bcm2835_clock_data *clock_data = data;
struct bcm2835_clock *clock;
struct clk_init_data init;
const char *parents[1 << CM_SRC_BITS];
@@ -1398,8 +1402,8 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman,
* Replace our strings referencing parent clocks with the
* actual clock-output-name of the parent.
*/
- for (i = 0; i < data->num_mux_parents; i++) {
- parents[i] = data->parents[i];
+ for (i = 0; i < clock_data->num_mux_parents; i++) {
+ parents[i] = clock_data->parents[i];
ret = match_string(cprman_parent_names,
ARRAY_SIZE(cprman_parent_names),
@@ -1410,18 +1414,18 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman,
memset(&init, 0, sizeof(init));
init.parent_names = parents;
- init.num_parents = data->num_mux_parents;
- init.name = data->name;
- init.flags = data->flags | CLK_IGNORE_UNUSED;
+ init.num_parents = clock_data->num_mux_parents;
+ init.name = clock_data->name;
+ init.flags = clock_data->flags | CLK_IGNORE_UNUSED;
/*
* Pass the CLK_SET_RATE_PARENT flag if we are allowed to propagate
* rate changes on at least of the parents.
*/
- if (data->set_rate_parent)
+ if (clock_data->set_rate_parent)
init.flags |= CLK_SET_RATE_PARENT;
- if (data->is_vpu_clock) {
+ if (clock_data->is_vpu_clock) {
init.ops = &bcm2835_vpu_clock_clk_ops;
} else {
init.ops = &bcm2835_clock_clk_ops;
@@ -1430,7 +1434,7 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman,
/* If the clock wasn't actually enabled at boot, it's not
* critical.
*/
- if (!(cprman_read(cprman, data->ctl_reg) & CM_ENABLE))
+ if (!(cprman_read(cprman, clock_data->ctl_reg) & CM_ENABLE))
init.flags &= ~CLK_IS_CRITICAL;
}
@@ -1439,7 +1443,7 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman,
return NULL;
clock->cprman = cprman;
- clock->data = data;
+ clock->data = clock_data;
clock->hw.init = &init;
ret = devm_clk_hw_register(cprman->dev, &clock->hw);
@@ -1449,24 +1453,26 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman,
}
static struct clk_hw *bcm2835_register_gate(struct bcm2835_cprman *cprman,
- const struct bcm2835_gate_data *data)
+ const void *data)
{
- return clk_hw_register_gate(cprman->dev, data->name, data->parent,
+ const struct bcm2835_gate_data *gate_data = data;
+
+ return clk_hw_register_gate(cprman->dev, gate_data->name,
+ gate_data->parent,
CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE,
- cprman->regs + data->ctl_reg,
+ cprman->regs + gate_data->ctl_reg,
CM_GATE_BIT, 0, &cprman->regs_lock);
}
-typedef struct clk_hw *(*bcm2835_clk_register)(struct bcm2835_cprman *cprman,
- const void *data);
struct bcm2835_clk_desc {
- bcm2835_clk_register clk_register;
+ struct clk_hw *(*clk_register)(struct bcm2835_cprman *cprman,
+ const void *data);
unsigned int supported;
const void *data;
};
/* assignment helper macros for different clock types */
-#define _REGISTER(f, s, ...) { .clk_register = (bcm2835_clk_register)f, \
+#define _REGISTER(f, s, ...) { .clk_register = f, \
.supported = s, \
.data = __VA_ARGS__ }
#define REGISTER_PLL(s, ...) _REGISTER(&bcm2835_register_pll, \
--
2.26.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* Re: [PATCH 0/4] arm64: kgdb/kdb: Fix single-step debugging issues
From: liwei (GF) @ 2020-05-16 8:20 UTC (permalink / raw)
To: Doug Anderson
Cc: Mark Rutland, Daniel Thompson, Catalin Marinas, Marc Zyngier,
LKML, liwei1412, Masami Hiramatsu, Jason Wessel, Will Deacon,
David Miller, Linux ARM
In-Reply-To: <CAD=FV=Xv6xgj_M9tYjHzmW4UZD2RdH2c5=dagNybSkdfBabYZw@mail.gmail.com>
Hi Douglas,
On 2020/5/14 8:34, Doug Anderson wrote:
> Hi,
>
> On Sat, May 9, 2020 at 6:49 AM Wei Li <liwei391@huawei.com> wrote:
>>
>> This patch set is to fix several issues of single-step debugging
>> in kgdb/kdb on arm64.
>>
>> It seems that these issues have been shelved a very long time,
>> but i still hope to solve them, as the single-step debugging
>> is an useful feature.
>>
>> Note:
>> Based on patch "arm64: cacheflush: Fix KGDB trap detection",
>> https://www.spinics.net/lists/arm-kernel/msg803741.html
>>
>> Wei Li (4):
>> arm64: kgdb: Fix single-step exception handling oops
>> arm64: Extract kprobes_save_local_irqflag() and
>> kprobes_restore_local_irqflag()
>> arm64: kgdb: Fix single-stepping into the irq handler wrongly
>> arm64: kgdb: Set PSTATE.SS to 1 to reenable single-step
>>
>> arch/arm64/include/asm/debug-monitors.h | 6 ++++++
>> arch/arm64/kernel/debug-monitors.c | 28 ++++++++++++++++++++++++-
>> arch/arm64/kernel/kgdb.c | 16 +++++++++++---
>> arch/arm64/kernel/probes/kprobes.c | 28 ++-----------------------
>> 4 files changed, 48 insertions(+), 30 deletions(-)
>
> Just an overall note that I'm very happy that you posted this patch
> series! It's always been a thorn in my side that stepping and
> breakpoints were so broken on arm64 and I'm really excited that you're
> fixing them. Now I'll have to get in the habit of using kgdb for more
> than just debugging crashes and maybe I can use it more for exploring
> how functions work more. :-)
> > I'll also note that with your patch series I'm even seeing the "call"
> feature of gdb working now. That has always been terribly broken for
> me.
>
Thanks for reviewing and testing this series.
Enjoy exploring the kernel with kgdb/kdb! :-)
Thanks,
Wei
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 4/4] arm64: kgdb: Set PSTATE.SS to 1 to reenable single-step
From: liwei (GF) @ 2020-05-16 8:20 UTC (permalink / raw)
To: Doug Anderson
Cc: Mark Rutland, Daniel Thompson, Catalin Marinas, Marc Zyngier,
LKML, liwei1412, Masami Hiramatsu, Jason Wessel, Will Deacon,
David Miller, Linux ARM
In-Reply-To: <CAD=FV=Vb6=f=fr83-k0YH86k4v4G5LcfOGcks7RM9VxzxOnXsQ@mail.gmail.com>
Hi Douglas,
On 2020/5/14 8:23, Doug Anderson wrote:
(SNIP)
>> diff --git a/arch/arm64/kernel/kgdb.c b/arch/arm64/kernel/kgdb.c
>> index 3910ac06c261..093ad9d2e5e6 100644
>> --- a/arch/arm64/kernel/kgdb.c
>> +++ b/arch/arm64/kernel/kgdb.c
>> @@ -230,7 +230,8 @@ int kgdb_arch_handle_exception(int exception_vector, int signo,
>> kernel_prepare_single_step(&per_cpu(kgdb_ss_flags,
>> raw_smp_processor_id()), linux_regs);
>> kernel_enable_single_step(linux_regs);
>> - }
>> + } else
>> + set_regs_spsr_ss(linux_regs);
>
> One slight nit is that my personal preference is that if one half of
> an "if/else" needs braces then both halves should have braces. I
Thanks for spotting it. Refer to Documentation/process/coding-style.rst,
i will fix it in the v2.
> don't know what Catalin and Will's policies are, though.
>
> Other than that, this seems right to me. I will leave it to the
> Catalin and Will folks to say if they'd rather have this call made
> from a different place or if they're happy with where you've put it.
>
> Reviewed-by: Douglas Anderson <dianders@chromium.org>
> Tested-by: Douglas Anderson <dianders@chromium.org>
>
Thanks,
Wei
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 2/2] arm: dts: stm32f769-disco: Enable MIPI DSI display support
From: Adrian Pop @ 2020-05-16 8:39 UTC (permalink / raw)
To: Alexandre Torgue
Cc: devicetree, linux-kernel, Rob Herring, Maxime Coquelin, Lee Jones,
linux-stm32, linux-arm-kernel
In-Reply-To: <39c59632-e395-f7ec-12b9-ca1d667651a6@st.com>
Hello all,
a bit of a delayed response here, but:
On Tue, Apr 28, 2020 at 11:39 AM Alexandre Torgue
<alexandre.torgue@st.com> wrote:
>
> Hi Adrian
>
> On 4/27/20 10:05 PM, Adrian Pop wrote:
> > Added lee.jones@linaro.org.
> >
> > First, thank you all for taking a look at my changes!
>
> no pb.
>
> >
> > Hello Alex,
> >
> > On Mon, Apr 27, 2020 at 11:28 AM Alexandre Torgue
> > <alexandre.torgue@st.com> wrote:
> >>
> >> Hi Adrian
> >>
> >> On 4/24/20 8:21 PM, Adrian Pop wrote:
> >>> STM32f769-disco features a 4" MIPI DSI display: add support for it.
> >>>
> >>> Signed-off-by: Adrian Pop <pop.adrian61@gmail.com>
> >>> ---
> >>
> >> Commit title should be ARM: dts: stm32: ...
> >
> > Will fix in next version if that's ok.
> >
> >>
> >> Can you explain a bit more in your commit message why do you use a
> >> reserved memory pool for DMA and where this pool is located. (I assume
> >> it's linked to a story of DMA and cache memory attribute on cortexM7...)
> >
> > Need to look more into this, but if I remove it, /dev/fb0 is not
> > available anymore and I get a warning stating:
> > ...
> > [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
> > [drm] Initialized stm 1.0.0 20170330 for 40016800.display-controller on minor 0
> > ------------[ cut here ]------------
> > WARNING: CPU: 0 PID: 13 at arch/arm/mm/dma-mapping-nommu.c:50 0xc000b8ed
> > CPU: 0 PID: 13 Comm: kworker/0:1 Not tainted 5.6.0-next-20200412 #23
> > Hardware name: STM32 (Device Tree Support)
> > Workqueue: events 0xc014fa35
> > Function entered at [<c000b325>] from [<c000a487>]
> > ...
> >
> > When I looked in arch/arm/mm/dma-mapping-nommu.c:50, there is a comment stating:
> >
> > /*
> > * dma_alloc_from_global_coherent() may fail because:
> > *
> > * - no consistent DMA region has been defined, so we can't
> > * continue.
> > * - there is no space left in consistent DMA region, so we
> > * only can fallback to generic allocator if we are
> > * advertised that consistency is not required.
> > */
> >
> > This is the reason I added the reserved-memory.
>
> Note that on cortexM7 DMA can't use cached memory. For this reason you
> have to declare a dedicated memory area for DMA with no-cache attribute.
> It is done thanks to a "linux,dma" node plus a kernel config:
> CONFIG_ARM_MPU. I planed to declare this dedicated memeory region in
> sram. Can you check if add it for the same reason I explain and check if
> it works using sram ?
>
I did not have CONFIG_ARM_MPU enabled, enabled it now.
Just tried with SRAM:
reg = <0x20020000 0x60000>; /* SRAM1 368KB + SRAM2 16KB*/
but `arm_nommu_dma_alloc()` size parameter is 819200 (which is bigger
than the SRAM reserved memory), so the
`dma_alloc_from_global_coherent()` fails, so again I get the warning
stated above.
>
>
> >
> > About the location, does it need to be hardcoded? On my board
> > (STM32F769I-Disco, tftp boot) in boot log I get:
> > ...
> > Reserved memory: created DMA memory pool at 0xc0ef1000, size 1 MiB
> > OF: reserved mem: initialized node linux,dma, compatible id shared-dma-pool
> > ...
> >
> >>
> >> Did you try this configuration with XIP boot ?
> >
> > I did not try with XIP. Currently loading zImage from tftp to memory.
> > Will try with XIP as well, and get back with feedback.
Still trying to figure how to XIP :).
>
> Ok thanks.
>
> >
> >>
> >> regards
> >> alex
> >>
> >>> arch/arm/boot/dts/stm32f746.dtsi | 34 ++++++++++++++++++
> >>> arch/arm/boot/dts/stm32f769-disco.dts | 50 +++++++++++++++++++++++++++
> >>> 2 files changed, 84 insertions(+)
> >>>
> >>> diff --git a/arch/arm/boot/dts/stm32f746.dtsi b/arch/arm/boot/dts/stm32f746.dtsi
> >>> index 93c063796780..202bb6edc9f1 100644
> >>> --- a/arch/arm/boot/dts/stm32f746.dtsi
> >>> +++ b/arch/arm/boot/dts/stm32f746.dtsi
> >>> @@ -48,6 +48,19 @@ / {
> >>> #address-cells = <1>;
> >>> #size-cells = <1>;
> >>>
> >>> + reserved-memory {
> >>> + #address-cells = <1>;
> >>> + #size-cells = <1>;
> >>> + ranges;
> >>> +
> >>> + linux,dma {
> >>> + compatible = "shared-dma-pool";
> >>> + linux,dma-default;
> >>> + no-map;
> >>> + size = <0x10F000>;
> >>> + };
> >>> + };
> >>> +
> >>> clocks {
> >>> clk_hse: clk-hse {
> >>> #clock-cells = <0>;
> >>> @@ -75,6 +88,27 @@ clk_i2s_ckin: clk-i2s-ckin {
> >>> };
> >>>
> >>> soc {
> >>> + ltdc: display-controller@40016800 {
> >>> + compatible = "st,stm32-ltdc";
> >>> + reg = <0x40016800 0x200>;
> >>> + interrupts = <88>, <89>;
> >>> + resets = <&rcc STM32F7_APB2_RESET(LTDC)>;
> >>> + clocks = <&rcc 1 CLK_LCD>;
> >>> + clock-names = "lcd";
> >>> + status = "disabled";
> >>> + };
> >>> +
> >>> + dsi: dsi@40016c00 {
> >>> + compatible = "st,stm32-dsi";
> >>> + reg = <0x40016c00 0x800>;
> >>> + interrupts = <98>;
> >>> + clocks = <&rcc 1 CLK_F769_DSI>, <&clk_hse>;
> >>> + clock-names = "pclk", "ref";
> >>> + resets = <&rcc STM32F7_APB2_RESET(DSI)>;
> >>> + reset-names = "apb";
> >>> + status = "disabled";
> >>> + };
> >>> +
> >>> timer2: timer@40000000 {
> >>> compatible = "st,stm32-timer";
> >>> reg = <0x40000000 0x400>;
> >>> diff --git a/arch/arm/boot/dts/stm32f769-disco.dts b/arch/arm/boot/dts/stm32f769-disco.dts
> >>> index 1626e00bb2cb..30ebbc193e82 100644
> >>> --- a/arch/arm/boot/dts/stm32f769-disco.dts
> >>> +++ b/arch/arm/boot/dts/stm32f769-disco.dts
> >>> @@ -153,3 +153,53 @@ &usbotg_hs {
> >>> pinctrl-names = "default";
> >>> status = "okay";
> >>> };
> >>> +
> >>> +&dsi {
> >>> + #address-cells = <1>;
> >>> + #size-cells = <0>;
> >>> + status = "okay";
> >>> +
> >>> + ports {
> >>> + #address-cells = <1>;
> >>> + #size-cells = <0>;
> >>> +
> >>> + port@0 {
> >>> + reg = <0>;
> >>> + dsi_in: endpoint {
> >>> + remote-endpoint = <<dc_out_dsi>;
> >>> + };
> >>> + };
> >>> +
> >>> + port@1 {
> >>> + reg = <1>;
> >>> + dsi_out: endpoint {
> >>> + remote-endpoint = <&dsi_in_panel>;
> >>> + };
> >>> + };
> >>> +
> >>> + };
> >>> +
> >>> + panel: panel {
> >>> + compatible = "orisetech,otm8009a";
> >>> + reg = <0>; /* dsi virtual channel (0..3) */
> >>> + reset-gpios = <&gpioj 15 GPIO_ACTIVE_LOW>;
> >>> + status = "okay";
> >>> +
> >>> + port {
> >>> + dsi_in_panel: endpoint {
> >>> + remote-endpoint = <&dsi_out>;
> >>> + };
> >>> + };
> >>> + };
> >>> +};
> >>> +
> >>> +<dc {
> >>> + dma-ranges;
> >
> > Need to remove this, not needed and causes a warning.
> >
> >>> + status = "okay";
> >>> +
> >>> + port {
> >>> + ltdc_out_dsi: endpoint {
> >>> + remote-endpoint = <&dsi_in>;
> >>> + };
> >>> + };
> >>> +};
> >>>
> >
> > Regards,
> > Adrian
> >
Regards,
Adrian
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 2/4] arm64: Extract kprobes_save_local_irqflag() and kprobes_restore_local_irqflag()
From: liwei (GF) @ 2020-05-16 8:47 UTC (permalink / raw)
To: Doug Anderson
Cc: Mark Rutland, Daniel Thompson, Catalin Marinas, Marc Zyngier,
LKML, liwei1412, Masami Hiramatsu, Jason Wessel, Will Deacon,
David Miller, Linux ARM
In-Reply-To: <CAD=FV=VVz4QnQ6AWAsCMxw6Zne6es0omvJ--Gnag=PXkMPt42g@mail.gmail.com>
Hi Douglas,
On 2020/5/14 8:21, Doug Anderson wrote:
(SNIP)
>> +/*
>> + * Interrupts need to be disabled before single-step mode is set, and not
>> + * reenabled until after single-step mode ends.
>> + * Without disabling interrupt on local CPU, there is a chance of
>> + * interrupt occurrence in the period of exception return and start of
>> + * out-of-line single-step, that result in wrongly single stepping
>> + * into the interrupt handler.
>> + */
>> +void kernel_prepare_single_step(unsigned long *flags,
>> + struct pt_regs *regs)
>> +{
>> + *flags = regs->pstate & DAIF_MASK;
>> + regs->pstate |= PSR_I_BIT;
>> + /* Unmask PSTATE.D for enabling software step exceptions. */
>> + regs->pstate &= ~PSR_D_BIT;
>> +}
>> +NOKPROBE_SYMBOL(kernel_prepare_single_step);
>
> nit: why not just return unsigned long rather than passing by reference?
Because i just extract this function from kprobes_save_local_irqflag(), i think
return unsigned long is fine.
>
>> +
>> +void kernel_cleanup_single_step(unsigned long flags,
>> + struct pt_regs *regs)
>> +{
>> + regs->pstate &= ~DAIF_MASK;
>> + regs->pstate |= flags;
>> +}
>> +NOKPROBE_SYMBOL(kernel_cleanup_single_step);
>> +
>> /* ptrace API */
>> void user_enable_single_step(struct task_struct *task)
>> {
>> diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c
>> index d1c95dcf1d78..c655b6b543e3 100644
>> --- a/arch/arm64/kernel/probes/kprobes.c
>> +++ b/arch/arm64/kernel/probes/kprobes.c
>> @@ -168,30 +168,6 @@ static void __kprobes set_current_kprobe(struct kprobe *p)
>> __this_cpu_write(current_kprobe, p);
>> }
>>
>> -/*
>> - * Interrupts need to be disabled before single-step mode is set, and not
>> - * reenabled until after single-step mode ends.
>> - * Without disabling interrupt on local CPU, there is a chance of
>> - * interrupt occurrence in the period of exception return and start of
>> - * out-of-line single-step, that result in wrongly single stepping
>> - * into the interrupt handler.
>> - */
>> -static void __kprobes kprobes_save_local_irqflag(struct kprobe_ctlblk *kcb,
>> - struct pt_regs *regs)
>> -{
>> - kcb->saved_irqflag = regs->pstate & DAIF_MASK;
>> - regs->pstate |= PSR_I_BIT;
>> - /* Unmask PSTATE.D for enabling software step exceptions. */
>> - regs->pstate &= ~PSR_D_BIT;
>> -}
>> -
>> -static void __kprobes kprobes_restore_local_irqflag(struct kprobe_ctlblk *kcb,
>> - struct pt_regs *regs)
>> -{
>> - regs->pstate &= ~DAIF_MASK;
>> - regs->pstate |= kcb->saved_irqflag;
>> -}
>> -
>> static void __kprobes
>> set_ss_context(struct kprobe_ctlblk *kcb, unsigned long addr)
>> {
>> @@ -227,7 +203,7 @@ static void __kprobes setup_singlestep(struct kprobe *p,
>> set_ss_context(kcb, slot); /* mark pending ss */
>>
>> /* IRQs and single stepping do not mix well. */
>> - kprobes_save_local_irqflag(kcb, regs);
>> + kernel_prepare_single_step(&kcb->saved_irqflag, regs);
>
> Is there some reason to have two functions? It seems like every time
> you call kernel_enable_single_step() you'd want to call
> kernel_prepare_single_step(). ...and every time you call
> kernel_disable_single_step() you'd want to call
> kernel_cleanup_single_step().
>
> Maybe you can just add the flags parameter to
> kernel_enable_single_step() / kernel_disable_single_step() and put the
> code in there?
>
As kernel_enable_single_step() / kernel_disable_single_step() are also called in
breakpoint_handler() and watchpoint_handler(), i am not sure it's a right thing
to put the daif flag prepare/cleanup into them, especially we don't have a context
to save the flags.
Thanks,
Wei
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 0/3] Convert mtk-dpi to drm_bridge API
From: Chun-Kuang Hu @ 2020-05-16 9:12 UTC (permalink / raw)
To: Chun-Kuang Hu
Cc: Nicolas Boichat, Philipp Zabel, David Airlie, linux-kernel,
DRI Development, Matthias Brugger,
moderated list:ARM/Mediatek SoC support, Laurent Pinchart,
Daniel Vetter, Hsin-Yi Wang, Enric Balletbo i Serra,
Collabora Kernel ML, Linux ARM
In-Reply-To: <CAAOTY_8vMG1k86V+qBhs0YH5QHELmgtJ0PNOAzWTHoTy2j=R2Q@mail.gmail.com>
Hi, Enric:
Chun-Kuang Hu <chunkuang.hu@kernel.org> 於 2020年5月10日 週日 上午9:24寫道:
>
> Hi, Enric:
>
> Enric Balletbo i Serra <enric.balletbo@collabora.com> 於 2020年5月4日 週一 下午10:14寫道:
> >
> > The mtk-dpi driver still uses the drm_encoder API which is now somehow
> > deprecated. We started to move all the Mediatek drivers to the drm_bridge API,
> > like we did for the mtk-dsi driver [1], this is another small step to be able to
> > fully convert the DRM Mediatek drivers to the drm_bridge API. A dummy
> > drm_encoder is maintained in the mtk-dpi driver but the end goal is move all the
> > dummy drm_encoder (mtk-dsi, mtk-dpi, etc) to the main mtk_drm_drv driver.
>
> For this series, applied to mediatek-drm-next [1], thanks.
>
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next
>
I remove this series from mediatek-drm-next because drm bridge driver
need ack of drm bridge maintainer.
Regards,
Chun-Kuang.
> Regards,
> Chun-Kuang.
>
> >
> > Best regards,
> > Enric
> >
> > [1] https://lore.kernel.org/patchwork/project/lkml/list/?series=441559
> >
> > Enric Balletbo i Serra (3):
> > drm/mediatek: mtk_dpi: Rename bridge to next_bridge
> > drm/mediatek: mtk_dpi: Convert to bridge driver
> > drm/mediatek: mtk_dpi: Use simple encoder
> >
> > drivers/gpu/drm/mediatek/mtk_dpi.c | 84 ++++++++++++++----------------
> > 1 file changed, 39 insertions(+), 45 deletions(-)
> >
> > --
> > 2.26.2
> >
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH] coresight: dynamic-replicator: Fix handling of multiple connections
From: Sai Prakash Ranjan @ 2020-05-16 10:04 UTC (permalink / raw)
To: Mike Leach, Suzuki K Poulose, Mathieu Poirier
Cc: Russell King, linux-arm-msm, Linux Kernel Mailing List,
linux-arm-kernel, Stephen Boyd
In-Reply-To: <5a76926a6532d3f91cca169d474ba98e@codeaurora.org>
Hi Mike, Suzuki
[...]
>>
>> Please look at the CoreSight components specification 3.0 (ARM IHI
>> 0029E) Section B2.1.2 which describes the Unique Component Identifier
>> (UCI).
>> As mentioned above this consists of a combination of bits from
>> multiple registers, including PIDR4.
>>
>
> Ok got it now, thanks for clearing the doubt. I will go ahead with
> this method to identify QCOM impl and post a patch.
>
Looking some more into this, since we have this limitation only on
specific replicator on very few QCOM SoCs, rather than having a blanket
workaround for all QCOM, we were thinking it would be better to have
this workaround based on a firmware property something like
"qcom,replicator-loses-context" for those replicators with this
limitation and then set the drvdata->check_idfilter_val based on
this property.
Thanks,
Sai
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member
of Code Aurora Forum, hosted by The Linux Foundation
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v4 7/7] drm/mediatek: mtk_dsi: Create connector for bridges
From: Chun-Kuang Hu @ 2020-05-16 10:10 UTC (permalink / raw)
To: Enric Balletbo i Serra
Cc: Chun-Kuang Hu, Nicolas Boichat, Daniel Vetter,
Enric Balletbo Serra, linux-kernel, dri-devel, David Airlie,
moderated list:ARM/Mediatek SoC support, Laurent Pinchart,
Philipp Zabel, Hsin-Yi Wang, Matthias Brugger,
Collabora Kernel ML, Sam Ravnborg, Linux ARM
In-Reply-To: <e1ac7d75-c46a-445a-5fcf-5253548f2707@collabora.com>
Hi, Enric:
Enric Balletbo i Serra <enric.balletbo@collabora.com> 於 2020年5月15日 週五 上午1:35寫道:
>
> Hi again,
>
> On 14/5/20 19:12, Enric Balletbo i Serra wrote:
> > Hi Chun-Kuang,
> >
> > On 14/5/20 18:44, Chun-Kuang Hu wrote:
> >> Hi, Enric:
> >>
> >> Enric Balletbo i Serra <enric.balletbo@collabora.com> 於 2020年5月14日 週四 下午11:42寫道:
> >>>
> >>> Hi Chun-Kuang,
> >>>
> >>> On 14/5/20 16:28, Chun-Kuang Hu wrote:
> >>>> Hi, Enric:
> >>>>
> >>>> Enric Balletbo Serra <eballetbo@gmail.com> 於 2020年5月14日 週四 上午12:41寫道:
> >>>>>
> >>>>> Hi Chun-Kuang,
> >>>>>
> >>>>> Missatge de Enric Balletbo i Serra <enric.balletbo@collabora.com> del
> >>>>> dia dv., 1 de maig 2020 a les 17:25:
> >>>>>>
> >>>>>> Use the drm_bridge_connector helper to create a connector for pipelines
> >>>>>> that use drm_bridge. This allows splitting connector operations across
> >>>>>> multiple bridges when necessary, instead of having the last bridge in
> >>>>>> the chain creating the connector and handling all connector operations
> >>>>>> internally.
> >>>>>>
> >>>>>> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> >>>>>> Acked-by: Sam Ravnborg <sam@ravnborg.org>
> >>>>>
> >>>>> A gentle ping on this, I think that this one is the only one that
> >>>>> still needs a review in the series.
> >>>>
> >>>> This is what I reply in patch v3:
> >>>>
> >>>
> >>> Sorry for missing this.
> >>>
> >>>> I think the panel is wrapped into next_bridge here,
> >>>>
> >>>
> >>> Yes, you can have for example:
> >>>
> >>> 1. drm_bridge (mtk_dsi) -> drm_bridge (ps8640 - dsi-to-edp) -> drm_panel_bridge
> >>> (edp panel)
> >>>
> >>> or a
> >>>
> >>> 2. drm_bridge (mtk_dsi)-> drm_panel_bridge (dsi panel)
> >>>
> >>> The _first_ one is my use case
> >>>
> >>>> if (panel) {
> >>>
> >>> This handles the second case, where you attach a dsi panel.
> >>>
> >>>> dsi->next_bridge = devm_drm_panel_bridge_add(dev, panel);
> >>>>
> >>>> so the next_bridge is a panel_bridge, in its attach function
> >>>> panel_bridge_attach(),
> >>>> according to the flag DRM_BRIDGE_ATTACH_NO_CONNECTOR, if not exist,
> >>>> it would create connector and attach connector to panel.
> >>>>
> >>>> I'm not sure this flag would exist or not, but for both case, it's strange.
> >>>> If exist, you create connector in this patch but no where to attach
> >>>> connector to panel.
> >>>
> >>> Yes, in fact, this is transitional patch needed, as once I converted mtk_dpi,
> >>> mtk_dsi and mtk_hdmi to the new drm_bridge API the drm_bridge_connector_init()
> >>> will be done in mtk_drm_drv. We will need to call drm_bridge_connector_init for
> >>> dpi and dsi pipes and remove that call from mtk_dsi and mtk_dpi drivers. The
> >>> graphic controller driver should create connectors and CRTCs, as example you can
> >>> take a look at drivers/gpu/drm/omapdrm/omap_drv.c
> >>>
> >>
> >> I have such question because I've reviewed omap's driver. In omap's
> >> driver, after it call drm_bridge_connector_init(), it does this:
> >>
> >> if (pipe->output->panel) {
> >> ret = drm_panel_attach(pipe->output->panel,
> >> pipe->connector);
> >> if (ret < 0)
> >> return ret;
> >> }
> >>
> >> In this patch, you does not do this.
> >>
> >
> > I see, so yes, I am probably missing call drm_panel_attach in case there is a
> > direct panel attached. Thanks for pointing it.
> >
> > I'll send a new version adding the drm_panel_attach call.
> >
>
> Wait, shouldn't panel be attached on the call of mtk_dsi_bridge_attach as
> next_bridge points to a bridge or a panel?
>
> static int mtk_dsi_bridge_attach(struct drm_bridge *bridge,
> enum drm_bridge_attach_flags flags)
> {
> struct mtk_dsi *dsi = bridge_to_dsi(bridge);
>
> /* Attach the panel or bridge to the dsi bridge */
> return drm_bridge_attach(bridge->encoder, dsi->next_bridge,
> &dsi->bridge, flags);
> }
>
> Or I am continuing misunderstanding all this?
>
My point is: when do you attach panel to a connector?
In this patch,
ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL,
DRM_BRIDGE_ATTACH_NO_CONNECTOR);
it would call into mtk_dsi_bridge_attach() with
DRM_BRIDGE_ATTACH_NO_CONNECTOR, and call into panel_bridge_attach()
with DRM_BRIDGE_ATTACH_NO_CONNECTOR.
If you does not pass DRM_BRIDGE_ATTACH_NO_CONNECTOR into
panel_bridge_attach(), it would create a connector and attach panel to
that connector.
And you pass DRM_BRIDGE_ATTACH_NO_CONNECTOR into
panel_bridge_attach(), so I thiink you need to create connector and
attach panel to that connector by yourself (this is what omap does).
Regards,
Chun-Kuang.
> >>>> If not exist, the next_brige would create one connector and this brige
> >>>> would create another connector.
> >>>>
> >>>> I think in your case, mtk_dsi does not directly connect to a panel, so
> >>>
> >>> Exactly
> >>>
> >>>> I need a exact explain. Or someone could test this on a
> >>>> directly-connect-panel platform.
> >>>
> >>> I don't think I am breaking this use case but AFAICS there is no users in
> >>> mainline that directly connect a panel using the mediatek driver. As I said my
> >>> use case is the other so I can't really test. Do you know anyone that can test this?
> >>
> >> I'm not sure who can test this, but [1], which is sent by YT Shen in a
> >> series, is a patch to support dsi command mode so dsi could directly
> >> connect to panel.
> >>
> >> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/gpu/drm/mediatek?h=v5.7-rc5&id=21898816831fc60c92dd634ab4316a24da7eb4af
> >>
> >> It's better that someone could test this case, but if no one would
> >> test this, I could also accept a good-look patch.
> >>
> >> Regards,
> >> Chun-Kuang.
> >>
> >>>
> >>> Thanks,
> >>> Enric
> >>>
> >>>>
> >>>> Regards,
> >>>> Chun-Kuang.
> >>>>
> >>>>>
> >>>>> Thanks,
> >>>>> Enric
> >>>>>
> >>>>>> ---
> >>>>>>
> >>>>>> Changes in v4: None
> >>>>>> Changes in v3:
> >>>>>> - Move the bridge.type line to the patch that adds drm_bridge support. (Laurent Pinchart)
> >>>>>>
> >>>>>> Changes in v2: None
> >>>>>>
> >>>>>> drivers/gpu/drm/mediatek/mtk_dsi.c | 13 ++++++++++++-
> >>>>>> 1 file changed, 12 insertions(+), 1 deletion(-)
> >>>>>>
> >>>>>> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> >>>>>> index 4f3bd095c1ee..471fcafdf348 100644
> >>>>>> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> >>>>>> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> >>>>>> @@ -17,6 +17,7 @@
> >>>>>>
> >>>>>> #include <drm/drm_atomic_helper.h>
> >>>>>> #include <drm/drm_bridge.h>
> >>>>>> +#include <drm/drm_bridge_connector.h>
> >>>>>> #include <drm/drm_mipi_dsi.h>
> >>>>>> #include <drm/drm_of.h>
> >>>>>> #include <drm/drm_panel.h>
> >>>>>> @@ -183,6 +184,7 @@ struct mtk_dsi {
> >>>>>> struct drm_encoder encoder;
> >>>>>> struct drm_bridge bridge;
> >>>>>> struct drm_bridge *next_bridge;
> >>>>>> + struct drm_connector *connector;
> >>>>>> struct phy *phy;
> >>>>>>
> >>>>>> void __iomem *regs;
> >>>>>> @@ -977,10 +979,19 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
> >>>>>> */
> >>>>>> dsi->encoder.possible_crtcs = 1;
> >>>>>>
> >>>>>> - ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL, 0);
> >>>>>> + ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL,
> >>>>>> + DRM_BRIDGE_ATTACH_NO_CONNECTOR);
> >>>>>> if (ret)
> >>>>>> goto err_cleanup_encoder;
> >>>>>>
> >>>>>> + dsi->connector = drm_bridge_connector_init(drm, &dsi->encoder);
> >>>>>> + if (IS_ERR(dsi->connector)) {
> >>>>>> + DRM_ERROR("Unable to create bridge connector\n");
> >>>>>> + ret = PTR_ERR(dsi->connector);
> >>>>>> + goto err_cleanup_encoder;
> >>>>>> + }
> >>>>>> + drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
> >>>>>> +
> >>>>>> return 0;
> >>>>>>
> >>>>>> err_cleanup_encoder:
> >>>>>> --
> >>>>>> 2.26.2
> >>>>>>
> >>>>>>
> >>>>>> _______________________________________________
> >>>>>> Linux-mediatek mailing list
> >>>>>> Linux-mediatek@lists.infradead.org
> >>>>>> http://lists.infradead.org/mailman/listinfo/linux-mediatek
> >
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* [PATCH v2] drm/exynos: dsi: Remove bridge node reference in error handling path in probe function
From: Christophe JAILLET @ 2020-05-16 10:57 UTC (permalink / raw)
To: inki.dae, jy0922.shim, sw0312.kim, kyungmin.park, airlied, daniel,
kgene, krzk
Cc: linux-samsung-soc, kernel-janitors, linux-kernel, dri-devel,
Christophe JAILLET, linux-arm-kernel
'exynos_dsi_parse_dt()' takes a reference to 'dsi->in_bridge_node'.
This must be released in the error handling path.
In order to do that, add an error handling path and move the
'exynos_dsi_parse_dt()' call from the beginning to the end of the probe
function to ease the error handling path.
This function only sets some variables which are used only in the
'transfer' function.
The call chain is:
.transfer
--> exynos_dsi_host_transfer
--> exynos_dsi_init
--> exynos_dsi_enable_clock (use burst_clk_rate and esc_clk_rate)
--> exynos_dsi_set_pll (use pll_clk_rate)
While at it, also handle cases where 'component_add()' fails.
This patch is similar to commit 70505c2ef94b ("drm/exynos: dsi: Remove bridge node reference in removal")
which fixed the issue in the remove function.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
A Fixes tag could be required, but I've not been able to figure out which
one to use.
v2: move around 'exynos_dsi_parse_dt' instead of adding many gotos
handle component_add failures
---
drivers/gpu/drm/exynos/exynos_drm_dsi.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index 902938d2568f..a9d24402fabf 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -1759,10 +1759,6 @@ static int exynos_dsi_probe(struct platform_device *pdev)
dsi->dev = dev;
dsi->driver_data = of_device_get_match_data(dev);
- ret = exynos_dsi_parse_dt(dsi);
- if (ret)
- return ret;
-
dsi->supplies[0].supply = "vddcore";
dsi->supplies[1].supply = "vddio";
ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(dsi->supplies),
@@ -1823,11 +1819,25 @@ static int exynos_dsi_probe(struct platform_device *pdev)
return ret;
}
+ ret = exynos_dsi_parse_dt(dsi);
+ if (ret)
+ return ret;
+
platform_set_drvdata(pdev, &dsi->encoder);
pm_runtime_enable(dev);
- return component_add(dev, &exynos_dsi_component_ops);
+ ret = component_add(dev, &exynos_dsi_component_ops);
+ if (ret)
+ goto err_disable_runtime;
+
+ return 0;
+
+err_disable_runtime:
+ pm_runtime_disable(dev);
+ of_node_put(dsi->in_bridge_node);
+
+ return ret;
}
static int exynos_dsi_remove(struct platform_device *pdev)
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH 0/3] arm64: perf: Add support for Perf NMI interrupts
From: Lecopzer Chen @ 2020-05-16 12:48 UTC (permalink / raw)
To: linux-kernel
Cc: mark.rutland, lecopzer.chen, Lecopzer Chen, alexander.shishkin,
catalin.marinas, jolsa, acme, peterz, mingo, linux-mediatek,
matthias.bgg, namhyung, will, yj.chiang, linux-arm-kernel
These series implement Perf NMI funxtionality and depends on
Pseudo NMI [1] which has been upstreamed.
In arm64 with GICv3, Pseudo NMI was implemented for NMI-like interruts.
That can be extended to Perf NMI which is the prerequisite for hard-lockup
detector which had already a standard interface inside Linux.
Thus the first step we need to implement perf NMI interface and make sure
it works fine.
Perf NMI has been test by dd if=/dev/urandom of=/dev/null like the link [2]
did.
[1] https://lkml.org/lkml/2019/1/31/535
[2] https://www.linaro.org/blog/debugging-arm-kernels-using-nmifiq
Lecopzer Chen (3):
arm_pmu: Add support for perf NMI interrupts registration
arm64: perf: Support NMI context for perf event ISR
arm64: Kconfig: Add support for the Perf NMI
arch/arm64/Kconfig | 10 +++++++
arch/arm64/kernel/perf_event.c | 36 ++++++++++++++++++------
drivers/perf/arm_pmu.c | 51 ++++++++++++++++++++++++++++++----
include/linux/perf/arm_pmu.h | 6 ++++
4 files changed, 88 insertions(+), 15 deletions(-)
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* [PATCH 1/3] arm_pmu: Add support for perf NMI interrupts registration
From: Lecopzer Chen @ 2020-05-16 12:48 UTC (permalink / raw)
To: linux-kernel
Cc: mark.rutland, lecopzer.chen, Lecopzer Chen, alexander.shishkin,
catalin.marinas, jolsa, acme, peterz, mingo, linux-mediatek,
matthias.bgg, namhyung, will, yj.chiang, linux-arm-kernel
In-Reply-To: <20200516124857.75004-1-lecopzer@gmail.com>
Register perf interrupts by request_nmi()/percpu_nmi() when both
ARM64_PSEUDO_NMI and ARM64_PSEUDO_NMI_PERF are enabled and nmi
cpufreature is active.
Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com>
---
drivers/perf/arm_pmu.c | 51 +++++++++++++++++++++++++++++++-----
include/linux/perf/arm_pmu.h | 6 +++++
2 files changed, 51 insertions(+), 6 deletions(-)
diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
index df352b334ea7..fa37b72d19e2 100644
--- a/drivers/perf/arm_pmu.c
+++ b/drivers/perf/arm_pmu.c
@@ -559,6 +559,48 @@ void armpmu_free_irq(int irq, int cpu)
per_cpu(cpu_irq, cpu) = 0;
}
+static void armpmu_prepare_percpu_nmi_other(void *info)
+{
+ /*
+ * We don't need to disable preemption since smp_call_function()
+ * did this for us.
+ */
+ prepare_percpu_nmi((uintptr_t) info);
+}
+
+static int _armpmu_request_irq(unsigned int irq, irq_handler_t handler,
+ unsigned long flags, int cpu)
+{
+ if (armpmu_support_nmi())
+ return request_nmi(irq, handler, flags, "arm-pmu",
+ per_cpu_ptr(&cpu_armpmu, cpu));
+ return request_irq(irq, handler, flags, "arm-pmu",
+ per_cpu_ptr(&cpu_armpmu, cpu));
+}
+
+static int _armpmu_request_percpu_irq(unsigned int irq, irq_handler_t handler)
+{
+ if (armpmu_support_nmi()) {
+ int err;
+
+ err = request_percpu_nmi(irq, handler, "arm-pmu",
+ &cpu_armpmu);
+ if (err)
+ return err;
+
+ preempt_disable();
+ err = prepare_percpu_nmi(irq);
+ if (err) {
+ return err;
+ preempt_enable();
+ }
+ smp_call_function(armpmu_prepare_percpu_nmi_other,
+ (void *)(uintptr_t) irq, true);
+ preempt_enable();
+ }
+ return request_percpu_irq(irq, handler, "arm-pmu",
+ &cpu_armpmu);
+}
+
int armpmu_request_irq(int irq, int cpu)
{
int err = 0;
@@ -582,12 +624,9 @@ int armpmu_request_irq(int irq, int cpu)
IRQF_NO_THREAD;
irq_set_status_flags(irq, IRQ_NOAUTOEN);
- err = request_irq(irq, handler, irq_flags, "arm-pmu",
- per_cpu_ptr(&cpu_armpmu, cpu));
- } else if (armpmu_count_irq_users(irq) == 0) {
- err = request_percpu_irq(irq, handler, "arm-pmu",
- &cpu_armpmu);
- }
+ err = _armpmu_request_irq(irq, handler, irq_flags, cpu);
+ } else if (armpmu_count_irq_users(irq) == 0)
+ err = _armpmu_request_percpu_irq(irq, handler);
if (err)
goto err_out;
diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h
index 5b616dde9a4c..5b878b5a22aa 100644
--- a/include/linux/perf/arm_pmu.h
+++ b/include/linux/perf/arm_pmu.h
@@ -160,6 +160,12 @@ int arm_pmu_acpi_probe(armpmu_init_fn init_fn);
static inline int arm_pmu_acpi_probe(armpmu_init_fn init_fn) { return 0; }
#endif
+static inline bool armpmu_support_nmi(void)
+{
+ return IS_ENABLED(CONFIG_ARM64_PSEUDO_NMI_PERF) &&
+ system_uses_irq_prio_masking();
+}
+
/* Internal functions only for core arm_pmu code */
struct arm_pmu *armpmu_alloc(void);
struct arm_pmu *armpmu_alloc_atomic(void);
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH 2/3] arm64: perf: Support NMI context for perf event ISR
From: Lecopzer Chen @ 2020-05-16 12:48 UTC (permalink / raw)
To: linux-kernel
Cc: mark.rutland, lecopzer.chen, Lecopzer Chen, alexander.shishkin,
catalin.marinas, jolsa, acme, peterz, mingo, linux-mediatek,
matthias.bgg, namhyung, will, yj.chiang, linux-arm-kernel
In-Reply-To: <20200516124857.75004-1-lecopzer@gmail.com>
Perf ISR doesn't support for NMI context, thus add some necessary
condition-if to handle NMI context:
- We should not hold pmu_lock since it may have already been acquired
before NMI triggered.
- irq_work should not run at NMI context.
Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com>
---
arch/arm64/kernel/perf_event.c | 36 +++++++++++++++++++++++++---------
1 file changed, 27 insertions(+), 9 deletions(-)
diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
index 4d7879484cec..94b404509f02 100644
--- a/arch/arm64/kernel/perf_event.c
+++ b/arch/arm64/kernel/perf_event.c
@@ -313,6 +313,23 @@ static inline bool armv8pmu_event_is_chained(struct perf_event *event)
(idx != ARMV8_IDX_CYCLE_COUNTER);
}
+/*
+ * NMI Perf interrupts may be triggered during kernel holding
+ * same lock.
+ * Avoid acquiring lock again in NMI context.
+ */
+#define armv8pmu_lock(lock, flags) \
+ do { \
+ if (!in_nmi()) \
+ raw_spin_lock_irqsave(lock, flags); \
+ } while (0)
+
+#define armv8pmu_unlock(lock, flags) \
+ do { \
+ if (!in_nmi()) \
+ raw_spin_unlock_irqrestore(lock, flags);\
+ } while (0)
+
/*
* ARMv8 low level PMU access
*/
@@ -589,7 +606,7 @@ static void armv8pmu_enable_event(struct perf_event *event)
* Enable counter and interrupt, and set the counter to count
* the event that we're interested in.
*/
- raw_spin_lock_irqsave(&events->pmu_lock, flags);
+ armv8pmu_lock(&events->pmu_lock, flags);
/*
* Disable counter
@@ -611,7 +628,7 @@ static void armv8pmu_enable_event(struct perf_event *event)
*/
armv8pmu_enable_event_counter(event);
- raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
+ armv8pmu_unlock(&events->pmu_lock, flags);
}
static void armv8pmu_disable_event(struct perf_event *event)
@@ -623,7 +640,7 @@ static void armv8pmu_disable_event(struct perf_event *event)
/*
* Disable counter and interrupt
*/
- raw_spin_lock_irqsave(&events->pmu_lock, flags);
+ armv8pmu_lock(&events->pmu_lock, flags);
/*
* Disable counter
@@ -635,7 +652,7 @@ static void armv8pmu_disable_event(struct perf_event *event)
*/
armv8pmu_disable_event_irq(event);
- raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
+ armv8pmu_unlock(&events->pmu_lock, flags);
}
static void armv8pmu_start(struct arm_pmu *cpu_pmu)
@@ -643,10 +660,10 @@ static void armv8pmu_start(struct arm_pmu *cpu_pmu)
unsigned long flags;
struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
- raw_spin_lock_irqsave(&events->pmu_lock, flags);
+ armv8pmu_lock(&events->pmu_lock, flags);
/* Enable all counters */
armv8pmu_pmcr_write(armv8pmu_pmcr_read() | ARMV8_PMU_PMCR_E);
- raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
+ armv8pmu_unlock(&events->pmu_lock, flags);
}
static void armv8pmu_stop(struct arm_pmu *cpu_pmu)
@@ -654,10 +671,10 @@ static void armv8pmu_stop(struct arm_pmu *cpu_pmu)
unsigned long flags;
struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
- raw_spin_lock_irqsave(&events->pmu_lock, flags);
+ armv8pmu_lock(&events->pmu_lock, flags);
/* Disable all counters */
armv8pmu_pmcr_write(armv8pmu_pmcr_read() & ~ARMV8_PMU_PMCR_E);
- raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
+ armv8pmu_unlock(&events->pmu_lock, flags);
}
static irqreturn_t armv8pmu_handle_irq(struct arm_pmu *cpu_pmu)
@@ -722,7 +739,8 @@ static irqreturn_t armv8pmu_handle_irq(struct arm_pmu *cpu_pmu)
* platforms that can have the PMU interrupts raised as an NMI, this
* will not work.
*/
- irq_work_run();
+ if (!armpmu_support_nmi())
+ irq_work_run();
return IRQ_HANDLED;
}
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH 3/3] arm64: Kconfig: Add support for the Perf NMI
From: Lecopzer Chen @ 2020-05-16 12:48 UTC (permalink / raw)
To: linux-kernel
Cc: mark.rutland, lecopzer.chen, Lecopzer Chen, alexander.shishkin,
catalin.marinas, jolsa, acme, peterz, mingo, linux-mediatek,
matthias.bgg, namhyung, will, yj.chiang, linux-arm-kernel
In-Reply-To: <20200516124857.75004-1-lecopzer@gmail.com>
This is an extending function for Pseudo NMI that registering
Perf events interrupts as NMI.
It's helpful for sampling irq-off context when using perf.
Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com>
---
arch/arm64/Kconfig | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 40fb05d96c60..f89c169771a0 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1679,6 +1679,16 @@ config ARM64_PSEUDO_NMI
If unsure, say N
if ARM64_PSEUDO_NMI
+config ARM64_PSEUDO_NMI_PERF
+ bool "Register Perf interrupts as Pseudo NMI"
+ depends on HW_PERF_EVENTS
+ depends on ARM_PMU
+ select HAVE_PERF_EVENTS_NMI
+ help
+ This registers Perf interrupts to NMI when Pseudo NMI is active.
+ This option is helpful when you need to debug any context disabled
+ irq and get more inforamtion.
+
+ If unsure, say N
+
config ARM64_DEBUG_PRIORITY_MASKING
bool "Debug interrupt priority masking"
help
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* Re: [PATCH 1/4] dt-bindings: i2c: Document I2C controller binding for MT6797 SoC
From: Matthias Brugger @ 2020-05-16 15:05 UTC (permalink / raw)
To: Wolfram Sang
Cc: Rob Herring, devicetree, linux-kernel, robh+dt, linux-mediatek,
Manivannan Sadhasivam, adamboardman, linux-arm-kernel
In-Reply-To: <20200515165605.GA19423@ninjato>
On 15/05/2020 18:56, Wolfram Sang wrote:
> On Fri, May 15, 2020 at 04:48:28PM +0200, Matthias Brugger wrote:
>> Hi Wolfram,
>>
>> On 26/02/2020 23:23, Rob Herring wrote:
>>> On Sat, 22 Feb 2020 21:54:41 +0530, Manivannan Sadhasivam wrote:
>>>> I2C controller driver for MT6577 SoC is reused for MT6797 SoC.
>>>> Hence, document that in DT binding.
>>>>
>>>> Signed-off-by: Manivannan Sadhasivam
>>>> <manivannan.sadhasivam@linaro.org> ---
>>>> Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt | 1 + 1 file
>>>> changed, 1 insertion(+)
>>>>
>>>
>>> Acked-by: Rob Herring <robh@kernel.org>
>>>
>>
>> Do you want to take this thorough your tree or are you OK if I take it
>> thorough mine?
>
> The I2C list is neither in the CC field, nor is the patch in patchwork.
Right didn't check that.
> I suggest you take it.
>
> Acked-by: Wolfram Sang <wsa@kernel.org>
>
Thanks Wolfram.
Now queued in v5.7-next/dts64
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 0/4] Add I2C controller support for MT6797 SoC
From: Matthias Brugger @ 2020-05-16 15:05 UTC (permalink / raw)
To: Manivannan Sadhasivam, robh+dt
Cc: devicetree, adamboardman, linux-mediatek, linux-kernel,
linux-arm-kernel
In-Reply-To: <20200222162444.11590-1-manivannan.sadhasivam@linaro.org>
On 22/02/2020 17:24, Manivannan Sadhasivam wrote:
> Hello,
>
> This patchset adds I2C controller support for Mediatek MT6797 SoC. There
> are a total of 8 I2C controllers in this SoC (2 being shared) and they are
> same as the controllers present in MT6577 SoC. Hence, the driver support is
> added with DT fallback method.
>
> As per the datasheet, there are controllers with _imm prefix like i2c2_imm
> and i2c3_imm. These appears to be in different memory regions but sharing
> the same pins with i2c2 and i2c3 respectively. Since there is no clear
> evidence of what they really are, I've adapted the numbering/naming scheme
> from the downstream code by Mediatek.
>
> This patchset has been tested on 96Boards X20 development board.
>
> Thanks,
> Mani
>
> Manivannan Sadhasivam (4):
> dt-bindings: i2c: Document I2C controller binding for MT6797 SoC
> arm64: dts: mediatek: Add I2C support for MT6797 SoC
> arm64: dts: mediatek: Enable I2C support for 96Boards X20 Development
> board
> arm64: dts: mediatek: Switch to SPDX license identifier for MT6797 SoC
All four queued now in v5.7-next/dts64
Thanks!
>
> .../devicetree/bindings/i2c/i2c-mt65xx.txt | 1 +
> .../boot/dts/mediatek/mt6797-x20-dev.dts | 49 ++++
> arch/arm64/boot/dts/mediatek/mt6797.dtsi | 229 +++++++++++++++++-
> 3 files changed, 271 insertions(+), 8 deletions(-)
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 1/2] arm64: dts: mt8173: fix mdp aliases property name
From: Matthias Brugger @ 2020-05-16 15:09 UTC (permalink / raw)
To: Hans Verkuil, Hsin-Yi Wang, linux-arm-kernel, linux-mediatek
Cc: Andrew-CT Chen, Minghsiu Tsai, devicetree, linux-kernel,
Houlong Wei, Rob Herring, Mauro Carvalho Chehab, linux-media
In-Reply-To: <4e335bc7-a45d-4688-a578-1e9793a61229@xs4all.nl>
On 16/04/2020 10:41, Hans Verkuil wrote:
> On 14/04/2020 05:08, Hsin-Yi Wang wrote:
>> Fix warning:
>> Warning (alias_paths): /aliases: aliases property name must include only lowercase and '-'
>>
>> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
>> ---
>> arch/arm64/boot/dts/mediatek/mt8173.dtsi | 16 ++++++++--------
>> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> I'll merge patch 2/2 for 5.8. I assume that this dtsi patch is merged through
> a mediatek subsystem?
>
Correct. Now queued in v5.7-next/dts64
Thanks!
> Regards,
>
> Hans
>
>>
>> diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
>> index a212bf124e81..d1e9c41004b4 100644
>> --- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
>> +++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
>> @@ -42,14 +42,14 @@ aliases {
>> dpi0 = &dpi0;
>> dsi0 = &dsi0;
>> dsi1 = &dsi1;
>> - mdp_rdma0 = &mdp_rdma0;
>> - mdp_rdma1 = &mdp_rdma1;
>> - mdp_rsz0 = &mdp_rsz0;
>> - mdp_rsz1 = &mdp_rsz1;
>> - mdp_rsz2 = &mdp_rsz2;
>> - mdp_wdma0 = &mdp_wdma0;
>> - mdp_wrot0 = &mdp_wrot0;
>> - mdp_wrot1 = &mdp_wrot1;
>> + mdp-rdma0 = &mdp_rdma0;
>> + mdp-rdma1 = &mdp_rdma1;
>> + mdp-rsz0 = &mdp_rsz0;
>> + mdp-rsz1 = &mdp_rsz1;
>> + mdp-rsz2 = &mdp_rsz2;
>> + mdp-wdma0 = &mdp_wdma0;
>> + mdp-wrot0 = &mdp_wrot0;
>> + mdp-wrot1 = &mdp_wrot1;
>> serial0 = &uart0;
>> serial1 = &uart1;
>> serial2 = &uart2;
>>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v13 5/6] rtc: mt6397: Add support for the MediaTek MT6358 RTC
From: Matthias Brugger @ 2020-05-16 15:25 UTC (permalink / raw)
To: Hsin-Hsiung Wang, Lee Jones, Rob Herring, Alexandre Belloni
Cc: linux-rtc, Alessandro Zummo, Josef Friedl, drinkcat,
srv_heupstream, Frank Wunderlich, Ran Bi, Sean Wang,
Sebastian Reichel, linux-kernel, Richard Fontana, devicetree,
linux-mediatek, linux-pm, Thomas Gleixner, Eddie Huang,
linux-arm-kernel
In-Reply-To: <1587438012-24832-6-git-send-email-hsin-hsiung.wang@mediatek.com>
Hi Lee,
On 21/04/2020 05:00, Hsin-Hsiung Wang wrote:
> From: Ran Bi <ran.bi@mediatek.com>
>
> This add support for the MediaTek MT6358 RTC. Driver using
> compatible data to store different RTC_WRTGR address offset.
> This replace RTC_WRTGR to RTC_WRTGR_MT6323 in mt6323-poweroff
> driver which only needed by armv7 CPU without ATF.
>
> Signed-off-by: Ran Bi <ran.bi@mediatek.com>
> Signed-off-by: Hsin-Hsiung Wang <hsin-hsiung.wang@mediatek.com>
> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
> Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Acked-by: Sebastian Reichel <sre@kernel.org>
> Reviewed-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
We have Acked-by from rtc and reset drivers maintainers. Are you OK to take them
through your mfd branch?
Are you planning to queue them for v5.8?
Just asking because if so I'd queue patch 6 through my tree.
Regards,
Matthias
> ---
> drivers/power/reset/mt6323-poweroff.c | 2 +-
> drivers/rtc/rtc-mt6397.c | 18 +++++++++++++++---
> include/linux/mfd/mt6397/rtc.h | 9 ++++++++-
> 3 files changed, 24 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/power/reset/mt6323-poweroff.c b/drivers/power/reset/mt6323-poweroff.c
> index 1caf43d..0532803 100644
> --- a/drivers/power/reset/mt6323-poweroff.c
> +++ b/drivers/power/reset/mt6323-poweroff.c
> @@ -30,7 +30,7 @@ static void mt6323_do_pwroff(void)
> int ret;
>
> regmap_write(pwrc->regmap, pwrc->base + RTC_BBPU, RTC_BBPU_KEY);
> - regmap_write(pwrc->regmap, pwrc->base + RTC_WRTGR, 1);
> + regmap_write(pwrc->regmap, pwrc->base + RTC_WRTGR_MT6323, 1);
>
> ret = regmap_read_poll_timeout(pwrc->regmap,
> pwrc->base + RTC_BBPU, val,
> diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
> index cda238d..f8b1353 100644
> --- a/drivers/rtc/rtc-mt6397.c
> +++ b/drivers/rtc/rtc-mt6397.c
> @@ -9,6 +9,7 @@
> #include <linux/mfd/mt6397/core.h>
> #include <linux/module.h>
> #include <linux/mutex.h>
> +#include <linux/of_device.h>
> #include <linux/platform_device.h>
> #include <linux/regmap.h>
> #include <linux/rtc.h>
> @@ -20,7 +21,7 @@ static int mtk_rtc_write_trigger(struct mt6397_rtc *rtc)
> int ret;
> u32 data;
>
> - ret = regmap_write(rtc->regmap, rtc->addr_base + RTC_WRTGR, 1);
> + ret = regmap_write(rtc->regmap, rtc->addr_base + rtc->data->wrtgr, 1);
> if (ret < 0)
> return ret;
>
> @@ -269,6 +270,8 @@ static int mtk_rtc_probe(struct platform_device *pdev)
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> rtc->addr_base = res->start;
>
> + rtc->data = of_device_get_match_data(&pdev->dev);
> +
> rtc->irq = platform_get_irq(pdev, 0);
> if (rtc->irq < 0)
> return rtc->irq;
> @@ -325,9 +328,18 @@ static int mt6397_rtc_resume(struct device *dev)
> static SIMPLE_DEV_PM_OPS(mt6397_pm_ops, mt6397_rtc_suspend,
> mt6397_rtc_resume);
>
> +static const struct mtk_rtc_data mt6358_rtc_data = {
> + .wrtgr = RTC_WRTGR_MT6358,
> +};
> +
> +static const struct mtk_rtc_data mt6397_rtc_data = {
> + .wrtgr = RTC_WRTGR_MT6397,
> +};
> +
> static const struct of_device_id mt6397_rtc_of_match[] = {
> - { .compatible = "mediatek,mt6323-rtc", },
> - { .compatible = "mediatek,mt6397-rtc", },
> + { .compatible = "mediatek,mt6323-rtc", .data = &mt6397_rtc_data },
> + { .compatible = "mediatek,mt6358-rtc", .data = &mt6358_rtc_data },
> + { .compatible = "mediatek,mt6397-rtc", .data = &mt6397_rtc_data },
> { }
> };
> MODULE_DEVICE_TABLE(of, mt6397_rtc_of_match);
> diff --git a/include/linux/mfd/mt6397/rtc.h b/include/linux/mfd/mt6397/rtc.h
> index 7dfb63b..66989a1 100644
> --- a/include/linux/mfd/mt6397/rtc.h
> +++ b/include/linux/mfd/mt6397/rtc.h
> @@ -18,7 +18,9 @@
> #define RTC_BBPU_CBUSY BIT(6)
> #define RTC_BBPU_KEY (0x43 << 8)
>
> -#define RTC_WRTGR 0x003c
> +#define RTC_WRTGR_MT6358 0x003a
> +#define RTC_WRTGR_MT6397 0x003c
> +#define RTC_WRTGR_MT6323 RTC_WRTGR_MT6397
>
> #define RTC_IRQ_STA 0x0002
> #define RTC_IRQ_STA_AL BIT(0)
> @@ -65,6 +67,10 @@
> #define MTK_RTC_POLL_DELAY_US 10
> #define MTK_RTC_POLL_TIMEOUT (jiffies_to_usecs(HZ))
>
> +struct mtk_rtc_data {
> + u32 wrtgr;
> +};
> +
> struct mt6397_rtc {
> struct device *dev;
> struct rtc_device *rtc_dev;
> @@ -74,6 +80,7 @@ struct mt6397_rtc {
> struct regmap *regmap;
> int irq;
> u32 addr_base;
> + const struct mtk_rtc_data *data;
> };
>
> #endif /* _LINUX_MFD_MT6397_RTC_H_ */
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [RESEND PATCH v5 11/11] arm64: dts: mt2712: use non-empty ranges for usb-phy
From: Matthias Brugger @ 2020-05-16 15:35 UTC (permalink / raw)
To: Chunfeng Yun, Kishon Vijay Abraham I
Cc: Mark Rutland, devicetree, linux-kernel, Rob Herring,
linux-mediatek, linux-arm-kernel
In-Reply-To: <0b039294697126edb25a699b8c25b7fcc84eed36.1581389234.git.chunfeng.yun@mediatek.com>
On 11/02/2020 04:21, Chunfeng Yun wrote:
> Use non-empty ranges for usb-phy to make the layout of
> its registers clearer;
> Replace deprecated compatible by generic
>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
queued for v5.7-next/dts64
Thanks a lot
> ---
> v3~v5: no changes
>
> v2: use generic compatible
> ---
> arch/arm64/boot/dts/mediatek/mt2712e.dtsi | 42 ++++++++++++-----------
> 1 file changed, 22 insertions(+), 20 deletions(-)
>
> diff --git a/arch/arm64/boot/dts/mediatek/mt2712e.dtsi b/arch/arm64/boot/dts/mediatek/mt2712e.dtsi
> index 43307bad3f0d..e24f2f2f6004 100644
> --- a/arch/arm64/boot/dts/mediatek/mt2712e.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt2712e.dtsi
> @@ -697,30 +697,31 @@ usb_host0: xhci@11270000 {
> };
>
> u3phy0: usb-phy@11290000 {
> - compatible = "mediatek,mt2712-u3phy";
> - #address-cells = <2>;
> - #size-cells = <2>;
> - ranges;
> + compatible = "mediatek,mt2712-tphy",
> + "mediatek,generic-tphy-v2";
> + #address-cells = <1>;
> + #size-cells = <1>;
> + ranges = <0 0 0x11290000 0x9000>;
> status = "okay";
>
> - u2port0: usb-phy@11290000 {
> - reg = <0 0x11290000 0 0x700>;
> + u2port0: usb-phy@0 {
> + reg = <0x0 0x700>;
> clocks = <&clk26m>;
> clock-names = "ref";
> #phy-cells = <1>;
> status = "okay";
> };
>
> - u2port1: usb-phy@11298000 {
> - reg = <0 0x11298000 0 0x700>;
> + u2port1: usb-phy@8000 {
> + reg = <0x8000 0x700>;
> clocks = <&clk26m>;
> clock-names = "ref";
> #phy-cells = <1>;
> status = "okay";
> };
>
> - u3port0: usb-phy@11298700 {
> - reg = <0 0x11298700 0 0x900>;
> + u3port0: usb-phy@8700 {
> + reg = <0x8700 0x900>;
> clocks = <&clk26m>;
> clock-names = "ref";
> #phy-cells = <1>;
> @@ -760,30 +761,31 @@ usb_host1: xhci@112c0000 {
> };
>
> u3phy1: usb-phy@112e0000 {
> - compatible = "mediatek,mt2712-u3phy";
> - #address-cells = <2>;
> - #size-cells = <2>;
> - ranges;
> + compatible = "mediatek,mt2712-tphy",
> + "mediatek,generic-tphy-v2";
> + #address-cells = <1>;
> + #size-cells = <1>;
> + ranges = <0 0 0x112e0000 0x9000>;
> status = "okay";
>
> - u2port2: usb-phy@112e0000 {
> - reg = <0 0x112e0000 0 0x700>;
> + u2port2: usb-phy@0 {
> + reg = <0x0 0x700>;
> clocks = <&clk26m>;
> clock-names = "ref";
> #phy-cells = <1>;
> status = "okay";
> };
>
> - u2port3: usb-phy@112e8000 {
> - reg = <0 0x112e8000 0 0x700>;
> + u2port3: usb-phy@8000 {
> + reg = <0x8000 0x700>;
> clocks = <&clk26m>;
> clock-names = "ref";
> #phy-cells = <1>;
> status = "okay";
> };
>
> - u3port1: usb-phy@112e8700 {
> - reg = <0 0x112e8700 0 0x900>;
> + u3port1: usb-phy@8700 {
> + reg = <0x8700 0x900>;
> clocks = <&clk26m>;
> clock-names = "ref";
> #phy-cells = <1>;
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH] iio: stm32-dac: Replace indio_dev->mlock with own device lock
From: Jonathan Cameron @ 2020-05-16 15:35 UTC (permalink / raw)
To: Sergiu Cuciurean
Cc: Lars-Peter Clausen, Peter Meerwald-Stadler, linux-iio,
linux-kernel, Maxime Coquelin, Hartmut Knaack, Fabrice Gasnier,
linux-stm32, linux-arm-kernel, Alexandre Torgue
In-Reply-To: <20200514085018.79948-1-sergiu.cuciurean@analog.com>
On Thu, 14 May 2020 11:50:12 +0300
Sergiu Cuciurean <sergiu.cuciurean@analog.com> wrote:
> As part of the general cleanup of indio_dev->mlock, this change replaces
> it with a local lock on the device's state structure.
>
> Signed-off-by: Sergiu Cuciurean <sergiu.cuciurean@analog.com>
> ---
> drivers/iio/dac/stm32-dac.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/dac/stm32-dac.c b/drivers/iio/dac/stm32-dac.c
> index f22c1d9129b2..74b9474c8590 100644
> --- a/drivers/iio/dac/stm32-dac.c
> +++ b/drivers/iio/dac/stm32-dac.c
> @@ -26,9 +26,11 @@
> /**
> * struct stm32_dac - private data of DAC driver
> * @common: reference to DAC common data
> + * @lock: lock to protect the data buffer during regmap ops
In this particular case I'm not sure that's what mlock was being used for.
I think it's about avoiding races around checking if powered down and
actually doing it.
> */
> struct stm32_dac {
> struct stm32_dac_common *common;
> + struct mutex lock;
> };
>
> static int stm32_dac_is_enabled(struct iio_dev *indio_dev, int channel)
> @@ -58,10 +60,10 @@ static int stm32_dac_set_enable_state(struct iio_dev *indio_dev, int ch,
> int ret;
>
> /* already enabled / disabled ? */
> - mutex_lock(&indio_dev->mlock);
> + mutex_lock(&dac->lock);
> ret = stm32_dac_is_enabled(indio_dev, ch);
> if (ret < 0 || enable == !!ret) {
> - mutex_unlock(&indio_dev->mlock);
> + mutex_unlock(&dac->lock);
> return ret < 0 ? ret : 0;
> }
>
> @@ -69,13 +71,13 @@ static int stm32_dac_set_enable_state(struct iio_dev *indio_dev, int ch,
> ret = pm_runtime_get_sync(dev);
> if (ret < 0) {
> pm_runtime_put_noidle(dev);
> - mutex_unlock(&indio_dev->mlock);
> + mutex_unlock(&dac->lock);
> return ret;
> }
> }
>
> ret = regmap_update_bits(dac->common->regmap, STM32_DAC_CR, msk, en);
> - mutex_unlock(&indio_dev->mlock);
> + mutex_unlock(&dac->lock);
> if (ret < 0) {
> dev_err(&indio_dev->dev, "%s failed\n", en ?
> "Enable" : "Disable");
> @@ -328,6 +330,8 @@ static int stm32_dac_probe(struct platform_device *pdev)
> indio_dev->info = &stm32_dac_iio_info;
> indio_dev->modes = INDIO_DIRECT_MODE;
>
> + mutex_init(&dac->lock);
> +
> ret = stm32_dac_chan_of_init(indio_dev);
> if (ret < 0)
> return ret;
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox