Re: [PATCH v13 1/8] x86: kdump: replace the hard-coded alignment with macro CRASH_ALIGN

2020-11-11 Thread Mike Rapoport
Hi,

On Sat, Oct 31, 2020 at 03:44:30PM +0800, Chen Zhou wrote:
> Move CRASH_ALIGN to header asm/kexec.h and replace the hard-coded
> alignment with macro CRASH_ALIGN in function reserve_crashkernel().
> 
> Suggested-by: Dave Young 
> Signed-off-by: Chen Zhou 
> Tested-by: John Donnelly 
> ---
>  arch/x86/include/asm/kexec.h | 3 +++
>  arch/x86/kernel/setup.c  | 5 +
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h
> index 6802c59e8252..8cf9d3fd31c7 100644
> --- a/arch/x86/include/asm/kexec.h
> +++ b/arch/x86/include/asm/kexec.h
> @@ -18,6 +18,9 @@
>  
>  # define KEXEC_CONTROL_CODE_MAX_SIZE 2048
>  
> +/* 2M alignment for crash kernel regions */
> +#define CRASH_ALIGN  SZ_16M

Please update the comment to match the code.

> +
>  #ifndef __ASSEMBLY__
>  
>  #include 
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index 84f581c91db4..bf373422dc8a 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -395,9 +395,6 @@ static void __init 
> memblock_x86_reserve_range_setup_data(void)
>  
>  #ifdef CONFIG_KEXEC_CORE
>  
> -/* 16M alignment for crash kernel regions */
> -#define CRASH_ALIGN  SZ_16M
> -
>  /*
>   * Keep the crash kernel below this limit.
>   *
> @@ -515,7 +512,7 @@ static void __init reserve_crashkernel(void)
>   } else {
>   unsigned long long start;
>  
> - start = memblock_phys_alloc_range(crash_size, SZ_1M, crash_base,
> + start = memblock_phys_alloc_range(crash_size, CRASH_ALIGN, 
> crash_base,
> crash_base + crash_size);
>   if (start != crash_base) {
>   pr_info("crashkernel reservation failed - memory is in 
> use.\n");
> -- 
> 2.20.1
> 

-- 
Sincerely yours,
Mike.


[PATCH] scsi: aacraid: Correct goto target in aac_resume()

2020-11-11 Thread Jing Xiangfeng
In current code, it jumps to call pci_disable_device() when
pci_enable_device() failes to initialize device. Add a label
'fail_enable' to fix it.

Fixes: de665f28f788 ("aacraid: Add Power Management support")
Signed-off-by: Jing Xiangfeng 
---
 drivers/scsi/aacraid/linit.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index a3aee146537b..13323707 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1943,7 +1943,7 @@ static int aac_resume(struct pci_dev *pdev)
r = pci_enable_device(pdev);
 
if (r)
-   goto fail_device;
+   goto fail_enable;
 
pci_set_master(pdev);
if (aac_acquire_resources(aac))
@@ -1958,9 +1958,10 @@ static int aac_resume(struct pci_dev *pdev)
return 0;
 
 fail_device:
+   pci_disable_device(pdev);
+fail_enable:
printk(KERN_INFO "%s%d: resume failed.\n", aac->name, aac->id);
scsi_host_put(shost);
-   pci_disable_device(pdev);
return -ENODEV;
 }
 #endif
-- 
2.17.1



Re: [PATCH v3 1/3] dt-bindings: Convert graph bindings to json-schema

2020-11-11 Thread Laurent Pinchart
Hi Rob,

On Wed, Nov 11, 2020 at 05:03:26PM -0600, Rob Herring wrote:
> On Wed, Nov 11, 2020 at 8:27 AM Laurent Pinchart wrote:
> > On Wed, Nov 11, 2020 at 08:25:40AM -0600, Rob Herring wrote:
> > > On Wed, Nov 11, 2020 at 8:00 AM Laurent Pinchart wrote:
> > > > On Mon, Nov 02, 2020 at 02:36:54PM -0600, Rob Herring wrote:
> > > > > From: Sameer Pujar 
> > > > >
> > > > > Convert device tree bindings of graph to YAML format. Currently 
> > > > > graph.txt
> > > > > doc is referenced in multiple files and all of these need to use 
> > > > > schema
> > > > > references. For now graph.txt is updated to refer to graph.yaml.
> > > > >
> > > > > For users of the graph binding, they should reference to the graph
> > > > > schema from either 'ports' or 'port' property:
> > > > >
> > > > > properties:
> > > > >   ports:
> > > > > type: object
> > > > > $ref: graph.yaml#/properties/ports
> > > > >
> > > > > properties:
> > > > >   port@0:
> > > > > description: What data this port has
> > > > >
> > > > >   ...
> > > > >
> > > > > Or:
> > > > >
> > > > > properties:
> > > > >   port:
> > > > > description: What data this port has
> > > > > type: object
> > > > > $ref: graph.yaml#/properties/port
> > > >
> > > > Sounds like a good approach.
> > > >
> > > > > Signed-off-by: Sameer Pujar 
> > > > > Acked-by: Philipp Zabel 
> > > > > Signed-off-by: Rob Herring 
> > > > > ---
> > > > > v3:
> > > > >  - Move port 'reg' to port@* and make required
> > > > >  - Make remote-endpoint required
> > > > >  - Add 'additionalProperties: true' now required
> > > > >  - Fix yamllint warnings
> > > > >
> > > > >  Documentation/devicetree/bindings/graph.txt  | 129 +---
> > > > >  Documentation/devicetree/bindings/graph.yaml | 199 
> > > > > +++
> > > > >  2 files changed, 200 insertions(+), 128 deletions(-)
> > > > >  create mode 100644 Documentation/devicetree/bindings/graph.yaml
> > >
> > > [...]
> > >
> > > > > diff --git a/Documentation/devicetree/bindings/graph.yaml 
> > > > > b/Documentation/devicetree/bindings/graph.yaml
> > > > > new file mode 100644
> > > > > index ..b56720c5a13e
> > > > > --- /dev/null
> > > > > +++ b/Documentation/devicetree/bindings/graph.yaml
> > > > > @@ -0,0 +1,199 @@
> > > > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > > > +%YAML 1.2
> > > > > +---
> > > > > +$id: http://devicetree.org/schemas/graph.yaml#
> > > > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > > > +
> > > > > +title: Common bindings for device graphs
> > > > > +
> > > > > +description: |
> > > > > +  The hierarchical organisation of the device tree is well suited to 
> > > > > describe
> > > > > +  control flow to devices, but there can be more complex connections 
> > > > > between
> > > > > +  devices that work together to form a logical compound device, 
> > > > > following an
> > > > > +  arbitrarily complex graph.
> > > > > +  There already is a simple directed graph between devices tree 
> > > > > nodes using
> > > > > +  phandle properties pointing to other nodes to describe connections 
> > > > > that
> > > > > +  can not be inferred from device tree parent-child relationships. 
> > > > > The device
> > > > > +  tree graph bindings described herein abstract more complex devices 
> > > > > that can
> > > > > +  have multiple specifiable ports, each of which can be linked to 
> > > > > one or more
> > > > > +  ports of other devices.
> > > > > +
> > > > > +  These common bindings do not contain any information about the 
> > > > > direction or
> > > > > +  type of the connections, they just map their existence. Specific 
> > > > > properties
> > > > > +  may be described by specialized bindings depending on the type of 
> > > > > connection.
> > > > > +
> > > > > +  To see how this binding applies to video pipelines, for example, 
> > > > > see
> > > > > +  Documentation/devicetree/bindings/media/video-interfaces.txt.
> > > > > +  Here the ports describe data interfaces, and the links between 
> > > > > them are
> > > > > +  the connecting data buses. A single port with multiple connections 
> > > > > can
> > > > > +  correspond to multiple devices being connected to the same 
> > > > > physical bus.
> > > > > +
> > > > > +maintainers:
> > > > > +  - Philipp Zabel 
> > > > > +
> > > > > +select: false
> > > > > +
> > > > > +properties:
> > > > > +  port:
> > > > > +type: object
> > > > > +description:
> > > > > +  If there is more than one endpoint node or 'reg' property 
> > > > > present in
> > > > > +  endpoint nodes then '#address-cells' and '#size-cells' 
> > > > > properties are
> > > > > +  required.
> > > > > +
> > > > > +properties:
> > > > > +  "#address-cells":
> > > > > +const: 1
> > > > > +
> > > > > +  "#size-cells":
> > > > > +const: 0
> > > > > +
> > > > > +patternProperties:
> > > > > +  "^endpoint(@[0-9a-f]+)?$":
> > > > > +type: object
> 

Re: [PATCH] ASoC: pcm512x: Add support for data formats RJ and LJ

2020-11-11 Thread Kirill Marinushkin
Hello Peter,

On 11/12/2020 08:41 AM, Peter Ujfalusi wrote:
> Hi Kirill,
> 
> On 11/11/2020 9.54, Kirill Marinushkin wrote:
>> Hello Peter,
>>
>> than you for your review!
>>
>>> The bus format and
>>>
switch (pcm512x->fmt & SND_SOC_DAIFMT_MASTER_MASK) {
>>>
case SND_SOC_DAIFMT_CBS_CFS:
ret = regmap_update_bits(pcm512x->regmap,
>>>
>>> the clock generation role should be set in pcm512x_set_fmt(), in that
>>> way you can deny specific setups earlier.
>>
>> I think we could move both checks for`SND_SOC_DAIFMT_FORMAT_MASK` and
>> `SND_SOC_DAIFMT_MASTER_MASK` into `pcm512x_set_fmt()`. But it would be a
>> different scope, and I didn't intend to do that level of refactoring.
> 
> Right, I was just saying what would make sense.
> 
>> Looking at other codecs in kernel, I would say, that doing those checks in
>> `pcm512x_hw_params()`, as they are done currently, is an equally valid 
>> approach.
> 
> The exception proves the rule
> 
>> As technically keeping checs where they are now doesn't break anything
> 
> They are just in a wrong place.
> 
>> and is
>> aligned with ASoC codecs design, I suggest to keep the checks where they are.
> 
> The set_fmt callback is there to set the bus format, it has nothing to
> do (in most cases) with the sample format (hw_params). Bus coding, clock
> source has nothing to do with hw_params.
> 
> When you bind a link you will use set_fmt for the two sides to see if
> they can agree, that both can support what has been asked.
> 
> The pcm512x driver just saves the fmt and say back to that card:
> whatever, I'm fine with it. But runtime during hw_params it can fail due
> to unsupported bus format, which it actually acked to be ok.
> 
> This is the difference.
> 
> Sure, some device have constraint based on the fmt towards the hw_params
> and it is perfectly OK to do such a checks and rejections or build
> rules/constraints based on fmt, but failing hw_params just because
> set_fmt did not checked that the bus format is not even supported is not
> a nice thing to do.

Those are good arguments

>> Would you agree?
> 
> I don't have a device to test, I'm just trying to point out what is the
> right thing to do.

I have a device to test. I will move format checks into `pcm512x_set_fmt()`,
ensure that it works properly, and submit as patch v3.

> I don't buy the argument that the sequencing is important here for the
> register writes. The fmt is set only once and those registers will be
> only written once.
> 
>>> I would also add DSP_A and DSP_B modes at the same time, DSP_A would
>>> need a write of 1 to register 41 (PCM512x_I2S_2, offset = 1), other
>>> formats should set the offset to 0.
>>
>> That's a good idea, than you for technical details! I just didn't know how to
>> use DSP_A and DSP_B. I will add them, and submit as patch v2
> 
> Great!
> Thanks
> - Péter
> 
>> Best regards,
>> Kirill
>>
>> On 11/10/2020 07:59 AM, Peter Ujfalusi wrote:
>>>
>>>
>>> On 09/11/2020 23.21, Kirill Marinushkin wrote:
 Currently, pcm512x driver supports only I2S data format.
 This commit adds RJ and LJ as well.

 I don't expect regression WRT existing sound cards, because:

 * default value in corresponding register of pcm512x codec is 0 ==  I2S
 * existing in-tree sound cards with pcm512x codec are configured for I2S
 * i don't see how existing off-tree sound cards with pcm512x codec could be
   configured differently - it would not work
 * tested explicitly, that there is no regression with Raspberry Pi +
   sound card `sound/soc/bcm/hifiberry_dacplus.c`

 Signed-off-by: Kirill Marinushkin 
 Cc: Mark Brown 
 Cc: Takashi Iwai 
 Cc: Liam Girdwood 
 Cc: Matthias Reichl 
 Cc: Kuninori Morimoto 
 Cc: Peter Ujfalusi 
 Cc: alsa-de...@alsa-project.org
 Cc: linux-kernel@vger.kernel.org
 ---
  sound/soc/codecs/pcm512x.c | 24 
  1 file changed, 24 insertions(+)

 diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c
 index 8153d3d01654..c6e975fb4a43 100644
 --- a/sound/soc/codecs/pcm512x.c
 +++ b/sound/soc/codecs/pcm512x.c
 @@ -1167,6 +1167,7 @@ static int pcm512x_hw_params(struct 
 snd_pcm_substream *substream,
struct snd_soc_component *component = dai->component;
struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
int alen;
 +  int afmt;
int gpio;
int clock_output;
int master_mode;
 @@ -1195,6 +1196,22 @@ static int pcm512x_hw_params(struct 
 snd_pcm_substream *substream,
return -EINVAL;
}
  
 +  switch (pcm512x->fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
 +  case SND_SOC_DAIFMT_I2S:
 +  afmt = PCM512x_AFMT_I2S;
 +  break;
 +  case SND_SOC_DAIFMT_RIGHT_J:
 +  afmt = PCM512x_AFMT_RTJ;
 +  break;
 +  case SND_SOC_DAIFMT_LEFT_J:
 +  afmt = 

[PATCH v1 1/3] dt-bindings: mmc: Add optional cqe off properties

2020-11-11 Thread Wenbin Mei
Add optional properties for cqe hosts which are used to set cqe off
during suspend flow.

Signed-off-by: Wenbin Mei 
---
 Documentation/devicetree/bindings/mmc/mmc-controller.yaml | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/mmc/mmc-controller.yaml 
b/Documentation/devicetree/bindings/mmc/mmc-controller.yaml
index b96da0c7f819..457c9a84b988 100644
--- a/Documentation/devicetree/bindings/mmc/mmc-controller.yaml
+++ b/Documentation/devicetree/bindings/mmc/mmc-controller.yaml
@@ -164,6 +164,13 @@ properties:
 description:
   enable SDIO IRQ signalling on this interface
 
+  cqe-off-in-suspend:
+$ref: /schemas/types.yaml#/definitions/flag
+description:
+  After suspend, the mmc host is powered off by HW, and bring CQE register
+  to default state, so we add the flag to re-init CQE register after resume
+  back.
+
   full-pwr-cycle:
 $ref: /schemas/types.yaml#/definitions/flag
 description:
-- 
2.18.0



[PATCH v1 0/3] Set cqe off during suspend flow

2020-11-11 Thread Wenbin Mei
Wenbin Mei (3):
  dt-bindings: mmc: Add optional cqe off properties
  arm64: dts: mt8192: Add cqe off flag
  mmc: core: Set cqe off during suspend flow
---
This patch depends on
[PATCH v7 3/4] arm64: dts: mt8192: add mmc device node

Please also accept this patch together with [1]
to avoid build and dt binding check error.
[1] https://patchwork.kernel.org/project/linux-mediatek/list/?series=364279
---
 Documentation/devicetree/bindings/mmc/mmc-controller.yaml | 7 +++
 arch/arm64/boot/dts/mediatek/mt8192-evb.dts   | 1 +
 drivers/mmc/core/host.c   | 2 ++
 drivers/mmc/core/mmc.c| 5 +
 include/linux/mmc/pm.h| 1 +
 5 files changed, 16 insertions(+)

--
2.18.0




[PATCH v1 3/3] mmc: core: Set cqe off during suspend flow

2020-11-11 Thread Wenbin Mei
Before we got these errors on MT8192 platform:
[   59.153891] Restarting tasks ...
[   59.154540] done.
[   59.159175] PM: suspend exit
[   59.218724] mtk-msdc 11f6.mmc: phase: [map:fffe] [maxlen:31]
[final:16]
[  119.776083] mmc0: cqhci: timeout for tag 9
[  119.780196] mmc0: cqhci:  CQHCI REGISTER DUMP ===
[  119.786709] mmc0: cqhci: Caps:  0x100020b6 | Version:  0x0510
[  119.793225] mmc0: cqhci: Config:0x0101 | Control:  0x
[  119.799706] mmc0: cqhci: Int stat:  0x | Int enab: 0x
[  119.806177] mmc0: cqhci: Int sig:   0x | Int Coal: 0x
[  119.812670] mmc0: cqhci: TDL base:  0x | TDL up32: 0x
[  119.819149] mmc0: cqhci: Doorbell:  0x003ffc00 | TCN:  0x0200
[  119.825656] mmc0: cqhci: Dev queue: 0x | Dev Pend: 0x
[  119.832155] mmc0: cqhci: Task clr:  0x | SSC1: 0x1000
[  119.838627] mmc0: cqhci: SSC2:  0x | DCMD rsp: 0x
[  119.845174] mmc0: cqhci: RED mask:  0xfdf9a080 | TERRI:0x891c
[  119.851654] mmc0: cqhci: Resp idx:  0x | Resp arg: 0x
[  119.865773] mmc0: cqhci: : ===
[  119.872358] mmc0: running CQE recovery
>From these logs, we found TDL base was back to the default value.

After suspend, the mmc host is powered off by HW, and bring CQE register
to the default value, so CQE need to be re-initialized after resuming back.

Signed-off-by: Wenbin Mei 
---
 drivers/mmc/core/host.c | 2 ++
 drivers/mmc/core/mmc.c  | 5 +
 include/linux/mmc/pm.h  | 1 +
 3 files changed, 8 insertions(+)

diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index ce43f7573d80..c98486c8fb3b 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -284,6 +284,8 @@ int mmc_of_parse(struct mmc_host *host)
if (device_property_read_bool(dev, "wakeup-source") ||
device_property_read_bool(dev, "enable-sdio-wakeup")) /* legacy */
host->pm_caps |= MMC_PM_WAKE_SDIO_IRQ;
+   if (device_property_read_bool(dev, "cqe-off-in-suspend"))
+   host->pm_caps |= MMC_PM_CQE_OFF_IN_SUSPEND;
if (device_property_read_bool(dev, "mmc-ddr-3_3v"))
host->caps |= MMC_CAP_3_3V_DDR;
if (device_property_read_bool(dev, "mmc-ddr-1_8v"))
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index b3fa193de846..f5ae1f13a867 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -2047,6 +2047,11 @@ static int _mmc_suspend(struct mmc_host *host, bool 
is_suspend)
err = mmc_deselect_cards(host);
 
if (!err) {
+   if (host->cqe_enabled &&
+   (host->pm_caps & MMC_PM_CQE_OFF_IN_SUSPEND)) {
+   host->cqe_ops->cqe_disable(host);
+   host->cqe_enabled = false;
+   }
mmc_power_off(host);
mmc_card_set_suspended(host->card);
}
diff --git a/include/linux/mmc/pm.h b/include/linux/mmc/pm.h
index 3549f8045784..3dd1046f2c8f 100644
--- a/include/linux/mmc/pm.h
+++ b/include/linux/mmc/pm.h
@@ -23,5 +23,6 @@ typedef unsigned int mmc_pm_flag_t;
 
 #define MMC_PM_KEEP_POWER  (1 << 0)/* preserve card power during 
suspend */
 #define MMC_PM_WAKE_SDIO_IRQ   (1 << 1)/* wake up host system on SDIO 
IRQ assertion */
+#define MMC_PM_CQE_OFF_IN_SUSPEND  (1 << 2)/* cqe off during suspend */
 
 #endif /* LINUX_MMC_PM_H */
-- 
2.18.0



[PATCH v1 2/3] arm64: dts: mt8192: Add cqe off flag

2020-11-11 Thread Wenbin Mei
Add cqe off flag for MT8192 mmc nodes.

Signed-off-by: Wenbin Mei 
---
 arch/arm64/boot/dts/mediatek/mt8192-evb.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8192-evb.dts 
b/arch/arm64/boot/dts/mediatek/mt8192-evb.dts
index a4279fa87c2b..0df78e4ea0d0 100644
--- a/arch/arm64/boot/dts/mediatek/mt8192-evb.dts
+++ b/arch/arm64/boot/dts/mediatek/mt8192-evb.dts
@@ -41,6 +41,7 @@
mmc-hs400-1_8v;
supports-cqe;
cap-mmc-hw-reset;
+   cqe-off-in-suspend;
no-sdio;
no-sd;
hs400-ds-delay = <0x12814>;
-- 
2.18.0



Re: [PATCH] ttyprintk: optimize tpk_close flush code

2020-11-11 Thread Greg KH
On Wed, Nov 04, 2020 at 02:02:24PM +0800, Junyong Sun wrote:
> tpk_printk(NULL,0) do nothing but call tpk_flush to
> flush buffer, so why don't use tpk_flush diretcly?
> this is a small optimization.
> 
> Signed-off-by: Junyong Sun 
> ---
>  drivers/char/ttyprintk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/char/ttyprintk.c b/drivers/char/ttyprintk.c
> index 6a0059e..2ce78b3 100644
> --- a/drivers/char/ttyprintk.c
> +++ b/drivers/char/ttyprintk.c
> @@ -104,7 +104,7 @@ static void tpk_close(struct tty_struct *tty, struct file 
> *filp)
>  
>   spin_lock_irqsave(>spinlock, flags);
>   /* flush tpk_printk buffer */
> - tpk_printk(NULL, 0);
> + tpk_flush();

If you do this, then please remove the logic in tpk_flush() that handles
NULL as now that logic will not be needed at all, right?

Also the comment here wouldn't be needed as the code obviously does that
based on the function call being made :)

thanks,

greg k-h


Re: [PATCH] w1: w1_therm: Rename conflicting sysfs attribute 'eeprom' to 'eeprom_cmd'

2020-11-11 Thread Greg Kroah-Hartman
On Thu, Nov 12, 2020 at 09:49:31AM +0300, Ivan Zaentsev wrote:
> Duplicate attribute 'eeprom' is defined in:
> 1) Documentation/ABI/testing/sysfs-driver-w1_therm
> 2) Documentation/ABI/stable/sysfs-driver-w1_ds28e04
> 
> Both drivers define an attribute: /sys/bus/w1/devices/.../eeprom
> with conflicting behavior.
> 
> Fix by renaming the newer one in w1_therm.c to 'eeprom_cmd'.
> 
> Reported-by: Mauro Carvalho Chehab 
> Suggested-by: Greg Kroah-Hartman 
> Link: https://lore.kernel.org/lkml/20201029152845.6bbb3...@coco.lan/
> Signed-off-by: Ivan Zaentsev 
> ---
>  Documentation/ABI/testing/sysfs-driver-w1_therm |  2 +-
>  Documentation/w1/slaves/w1_therm.rst|  2 +-
>  drivers/w1/slaves/w1_therm.c| 12 ++--
>  3 files changed, 8 insertions(+), 8 deletions(-)

Very nice, thanks for doing this, I'll go queue this up now.

greg k-h


Process-wide watchpoints

2020-11-11 Thread Dmitry Vyukov
Hello perf maintainers,

I have a wish for a particular kernel functionality related to
watchpoints, and I would appreciate it if you can say how
feasible/complex to add it is (mostly glueing existing infra pieces,
or redesigning and adding lots of new code), or maybe it exists
already and I am missing it.

You can think of the functionality as setting MPROT_NONE but for a few
bytes only using watchpoints. On the access the accessing thread
should receive a signal (similar to SIGSEGV). Kernel copy_to/from_user
should not be affected (no EFAULT), I think this is already satisfied
for watchpoints. This functionality is also intended for production
environments (if you are interested -- for sampling race detection),
number of threads in the process can be up to, say, ~~10K and the
watchpoint is intended to be set for a very brief period of time
(~~few ms).

This can be done today with both perf_event_open and ptrace.
However, the problem is that both APIs work on a single thread level
(? perf_event_open can be inherited by children, but not for existing
siblings). So doing this would require iterating over, say, 10K
threads, calling perf_event_open, F_SETOWN, F_SETSIG, later close and
consuming 40K file descriptors.

What I would like to have is a single syscall that does all of it for
the whole process (either sending IPIs to currently running siblings,
or maybe activating this only on the next sched in).

I see at least one potential problem: what do we do if some sibling
thread already has all 4 watchpoints consumed? We don't necessarily
want to iterate over all 10K threads synchronously, nor we even want
to fail in this case. The intended use case is that only this feature
will mostly use watchpoints, so all threads will have equal number of
available watchpoints. So perhaps the removal of the watchpoint could
just communicate that there were some threads that were not able to
install the watchpoint.

Does it make any sense? How feasible/complex to add it is?

Thanks in advance


Re: [PATCH] ASoC: pcm512x: Add support for data formats RJ and LJ

2020-11-11 Thread Peter Ujfalusi
Hi Kirill,

On 11/11/2020 9.54, Kirill Marinushkin wrote:
> Hello Peter,
> 
> than you for your review!
> 
>> The bus format and
>>
>>> switch (pcm512x->fmt & SND_SOC_DAIFMT_MASTER_MASK) {
>>
>>> case SND_SOC_DAIFMT_CBS_CFS:
>>> ret = regmap_update_bits(pcm512x->regmap,
>>
>> the clock generation role should be set in pcm512x_set_fmt(), in that
>> way you can deny specific setups earlier.
> 
> I think we could move both checks for`SND_SOC_DAIFMT_FORMAT_MASK` and
> `SND_SOC_DAIFMT_MASTER_MASK` into `pcm512x_set_fmt()`. But it would be a
> different scope, and I didn't intend to do that level of refactoring.

Right, I was just saying what would make sense.

> Looking at other codecs in kernel, I would say, that doing those checks in
> `pcm512x_hw_params()`, as they are done currently, is an equally valid 
> approach.

The exception proves the rule

> As technically keeping checs where they are now doesn't break anything

They are just in a wrong place.

> and is
> aligned with ASoC codecs design, I suggest to keep the checks where they are.

The set_fmt callback is there to set the bus format, it has nothing to
do (in most cases) with the sample format (hw_params). Bus coding, clock
source has nothing to do with hw_params.

When you bind a link you will use set_fmt for the two sides to see if
they can agree, that both can support what has been asked.

The pcm512x driver just saves the fmt and say back to that card:
whatever, I'm fine with it. But runtime during hw_params it can fail due
to unsupported bus format, which it actually acked to be ok.

This is the difference.

Sure, some device have constraint based on the fmt towards the hw_params
and it is perfectly OK to do such a checks and rejections or build
rules/constraints based on fmt, but failing hw_params just because
set_fmt did not checked that the bus format is not even supported is not
a nice thing to do.

> Would you agree?

I don't have a device to test, I'm just trying to point out what is the
right thing to do.

I don't buy the argument that the sequencing is important here for the
register writes. The fmt is set only once and those registers will be
only written once.

>> I would also add DSP_A and DSP_B modes at the same time, DSP_A would
>> need a write of 1 to register 41 (PCM512x_I2S_2, offset = 1), other
>> formats should set the offset to 0.
> 
> That's a good idea, than you for technical details! I just didn't know how to
> use DSP_A and DSP_B. I will add them, and submit as patch v2

Great!
Thanks
- Péter

> Best regards,
> Kirill
> 
> On 11/10/2020 07:59 AM, Peter Ujfalusi wrote:
>>
>>
>> On 09/11/2020 23.21, Kirill Marinushkin wrote:
>>> Currently, pcm512x driver supports only I2S data format.
>>> This commit adds RJ and LJ as well.
>>>
>>> I don't expect regression WRT existing sound cards, because:
>>>
>>> * default value in corresponding register of pcm512x codec is 0 ==  I2S
>>> * existing in-tree sound cards with pcm512x codec are configured for I2S
>>> * i don't see how existing off-tree sound cards with pcm512x codec could be
>>>   configured differently - it would not work
>>> * tested explicitly, that there is no regression with Raspberry Pi +
>>>   sound card `sound/soc/bcm/hifiberry_dacplus.c`
>>>
>>> Signed-off-by: Kirill Marinushkin 
>>> Cc: Mark Brown 
>>> Cc: Takashi Iwai 
>>> Cc: Liam Girdwood 
>>> Cc: Matthias Reichl 
>>> Cc: Kuninori Morimoto 
>>> Cc: Peter Ujfalusi 
>>> Cc: alsa-de...@alsa-project.org
>>> Cc: linux-kernel@vger.kernel.org
>>> ---
>>>  sound/soc/codecs/pcm512x.c | 24 
>>>  1 file changed, 24 insertions(+)
>>>
>>> diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c
>>> index 8153d3d01654..c6e975fb4a43 100644
>>> --- a/sound/soc/codecs/pcm512x.c
>>> +++ b/sound/soc/codecs/pcm512x.c
>>> @@ -1167,6 +1167,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream 
>>> *substream,
>>> struct snd_soc_component *component = dai->component;
>>> struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
>>> int alen;
>>> +   int afmt;
>>> int gpio;
>>> int clock_output;
>>> int master_mode;
>>> @@ -1195,6 +1196,22 @@ static int pcm512x_hw_params(struct 
>>> snd_pcm_substream *substream,
>>> return -EINVAL;
>>> }
>>>  
>>> +   switch (pcm512x->fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
>>> +   case SND_SOC_DAIFMT_I2S:
>>> +   afmt = PCM512x_AFMT_I2S;
>>> +   break;
>>> +   case SND_SOC_DAIFMT_RIGHT_J:
>>> +   afmt = PCM512x_AFMT_RTJ;
>>> +   break;
>>> +   case SND_SOC_DAIFMT_LEFT_J:
>>> +   afmt = PCM512x_AFMT_LTJ;
>>> +   break;
>>> +   default:
>>> +   dev_err(component->dev, "unsupported DAI format: 0x%x\n",
>>> +   pcm512x->fmt);
>>> +   return -EINVAL;
>>> +   }
>>> +
>>
>> The bus format and
>>
>>> switch (pcm512x->fmt & SND_SOC_DAIFMT_MASTER_MASK) {
>>
>>> case SND_SOC_DAIFMT_CBS_CFS:
>>> ret = 

Re: [PATCH v4 2/2] mm: prevent gup_fast from racing with COW during fork

2020-11-11 Thread Ahmed S. Darwish
On Tue, Nov 10, 2020 at 07:44:09PM -0400, Jason Gunthorpe wrote:
...
>
> Fixes: f3c64eda3e50 ("mm: avoid early COW write protect games during fork()")
> Suggested-by: Linus Torvalds 
> Link: 
> https://lore.kernel.org/r/CAHk-=wi=icnycarbpgjkvju9eyyez13n64tzyldob8cp5q_...@mail.gmail.com
> Reviewed-by: John Hubbard 
> Reviewed-by: Jan Kara 
> Signed-off-by: Jason Gunthorpe 
> ---

Thanks for the v3 and v4 updates.

For the seqcount_t parts:

  Acked-by: "Ahmed S. Darwish" 


[PATCH v2 4/5] Input: adp5589: use devm_gpiochip_add_data() for gpios

2020-11-11 Thread Alexandru Ardelean
This change makes use of the devm_gpiochip_add_data() function. With this
the gpiochip_remove() function can be removed, and the
adp5589_gpio_remove() function as well.

The kpad->export_gpio variable is also redundant now, and has been removed.

Signed-off-by: Alexandru Ardelean 
---
 drivers/input/keyboard/adp5589-keys.c | 22 ++
 1 file changed, 2 insertions(+), 20 deletions(-)

diff --git a/drivers/input/keyboard/adp5589-keys.c 
b/drivers/input/keyboard/adp5589-keys.c
index cc91a47931bd..ab390b01db08 100644
--- a/drivers/input/keyboard/adp5589-keys.c
+++ b/drivers/input/keyboard/adp5589-keys.c
@@ -238,7 +238,6 @@ struct adp5589_kpad {
bool support_row5;
 #ifdef CONFIG_GPIOLIB
unsigned char gpiomap[ADP5589_MAXGPIO];
-   bool export_gpio;
struct gpio_chip gc;
struct mutex gpio_lock; /* Protect cached dir, dat_out */
u8 dat_out[3];
@@ -512,8 +511,6 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad)
return 0;
}
 
-   kpad->export_gpio = true;
-
kpad->gc.direction_input = adp5589_gpio_direction_input;
kpad->gc.direction_output = adp5589_gpio_direction_output;
kpad->gc.get = adp5589_gpio_get_value;
@@ -526,11 +523,9 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad)
 
mutex_init(>gpio_lock);
 
-   error = gpiochip_add_data(>gc, kpad);
-   if (error) {
-   dev_err(dev, "gpiochip_add_data() failed, err: %d\n", error);
+   error = devm_gpiochip_add_data(dev, >gc, kpad);
+   if (error)
return error;
-   }
 
for (i = 0; i <= kpad->var->bank(kpad->var->maxgpio); i++) {
kpad->dat_out[i] = adp5589_read(kpad->client, kpad->var->reg(
@@ -541,23 +536,11 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad)
 
return 0;
 }
-
-static void adp5589_gpio_remove(struct adp5589_kpad *kpad)
-{
-   if (!kpad->export_gpio)
-   return;
-
-   gpiochip_remove(>gc);
-}
 #else
 static inline int adp5589_gpio_add(struct adp5589_kpad *kpad)
 {
return 0;
 }
-
-static inline void adp5589_gpio_remove(struct adp5589_kpad *kpad)
-{
-}
 #endif
 
 static void adp5589_report_switches(struct adp5589_kpad *kpad,
@@ -1021,7 +1004,6 @@ static int adp5589_remove(struct i2c_client *client)
struct adp5589_kpad *kpad = i2c_get_clientdata(client);
 
adp5589_write(client, kpad->var->reg(ADP5589_GENERAL_CFG), 0);
-   adp5589_gpio_remove(kpad);
 
return 0;
 }
-- 
2.17.1



[PATCH v2 2/5] Input: adp5589: use device-managed function in adp5589_keypad_add()

2020-11-11 Thread Alexandru Ardelean
This change makes use of the devm_input_allocate_device() function, which
gets rid of the input_free_device() and input_unregister_device() calls.

When a device is allocated via input_allocate_device(), the
input_register_device() call will also be device-managed, so there is no
longer need to manually call unregister.

Also, the irq is allocated with the devm_request_threaded_irq(), so with
these two changes, the adp5589_keypad_remove() function is no longer
needed.

This cleans up the error & exit paths.
It also looks like the input_free_device() should have been called on the
remove() hook, but doesn't look like it is.

This change may also also fix some potential leaks that were probably
omitted earlier.

Signed-off-by: Alexandru Ardelean 
---
 drivers/input/keyboard/adp5589-keys.c | 47 +++
 1 file changed, 11 insertions(+), 36 deletions(-)

diff --git a/drivers/input/keyboard/adp5589-keys.c 
b/drivers/input/keyboard/adp5589-keys.c
index 922497b65ab0..e96ffd5ed69e 100644
--- a/drivers/input/keyboard/adp5589-keys.c
+++ b/drivers/input/keyboard/adp5589-keys.c
@@ -909,7 +909,7 @@ static int adp5589_keypad_add(struct adp5589_kpad *kpad, 
unsigned int revid)
return -EINVAL;
}
 
-   input = input_allocate_device();
+   input = devm_input_allocate_device(>dev);
if (!input)
return -ENOMEM;
 
@@ -953,38 +953,19 @@ static int adp5589_keypad_add(struct adp5589_kpad *kpad, 
unsigned int revid)
__set_bit(kpad->gpimap[i].sw_evt, input->swbit);
 
error = input_register_device(input);
-   if (error) {
-   dev_err(>dev, "unable to register input device\n");
-   goto err_free_input;
-   }
+   if (error)
+   return error;
 
-   error = request_threaded_irq(client->irq, NULL, adp5589_irq,
-IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
-client->dev.driver->name, kpad);
-   if (error) {
-   dev_err(>dev, "irq %d busy?\n", client->irq);
-   goto err_unreg_dev;
-   }
+   error = devm_request_threaded_irq(>dev, client->irq, NULL,
+ adp5589_irq,
+ IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+ client->dev.driver->name, kpad);
+   if (error)
+   return error;
 
device_init_wakeup(>dev, 1);
 
return 0;
-
-err_unreg_dev:
-   input_unregister_device(input);
-   input = NULL;
-err_free_input:
-   input_free_device(input);
-
-   return error;
-}
-
-static void adp5589_keypad_remove(struct adp5589_kpad *kpad)
-{
-   if (kpad->input) {
-   free_irq(kpad->client->irq, kpad);
-   input_unregister_device(kpad->input);
-   }
 }
 
 static int adp5589_probe(struct i2c_client *client,
@@ -1041,24 +1022,19 @@ static int adp5589_probe(struct i2c_client *client,
 
error = adp5589_setup(kpad);
if (error)
-   goto err_keypad_remove;
+   return error;
 
if (kpad->gpimapsize)
adp5589_report_switch_state(kpad);
 
error = adp5589_gpio_add(kpad);
if (error)
-   goto err_keypad_remove;
+   return error;
 
i2c_set_clientdata(client, kpad);
 
dev_info(>dev, "Rev.%d keypad, irq %d\n", revid, client->irq);
return 0;
-
-err_keypad_remove:
-   adp5589_keypad_remove(kpad);
-
-   return error;
 }
 
 static int adp5589_remove(struct i2c_client *client)
@@ -1066,7 +1042,6 @@ static int adp5589_remove(struct i2c_client *client)
struct adp5589_kpad *kpad = i2c_get_clientdata(client);
 
adp5589_write(client, kpad->var->reg(ADP5589_GENERAL_CFG), 0);
-   adp5589_keypad_remove(kpad);
adp5589_gpio_remove(kpad);
 
return 0;
-- 
2.17.1



[PATCH v2 3/5] Input: adp5589: remove setup/teardown hooks for gpios

2020-11-11 Thread Alexandru Ardelean
This is currently just dead code. It's from around a time when
platform-data was used, and a board could hook it's own special callback
for setup/teardown, and a private object (via 'context').

This change removes it, as there are no more users in mainline for this.

Signed-off-by: Alexandru Ardelean 
---
 drivers/input/keyboard/adp5589-keys.c | 21 -
 include/linux/input/adp5589.h |  7 ---
 2 files changed, 28 deletions(-)

diff --git a/drivers/input/keyboard/adp5589-keys.c 
b/drivers/input/keyboard/adp5589-keys.c
index e96ffd5ed69e..cc91a47931bd 100644
--- a/drivers/input/keyboard/adp5589-keys.c
+++ b/drivers/input/keyboard/adp5589-keys.c
@@ -539,35 +539,14 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad)
ADP5589_GPIO_DIRECTION_A) + i);
}
 
-   if (gpio_data->setup) {
-   error = gpio_data->setup(kpad->client,
-kpad->gc.base, kpad->gc.ngpio,
-gpio_data->context);
-   if (error)
-   dev_warn(dev, "setup failed, %d\n", error);
-   }
-
return 0;
 }
 
 static void adp5589_gpio_remove(struct adp5589_kpad *kpad)
 {
-   struct device *dev = >client->dev;
-   const struct adp5589_kpad_platform_data *pdata = dev_get_platdata(dev);
-   const struct adp5589_gpio_platform_data *gpio_data = pdata->gpio_data;
-   int error;
-
if (!kpad->export_gpio)
return;
 
-   if (gpio_data->teardown) {
-   error = gpio_data->teardown(kpad->client,
-   kpad->gc.base, kpad->gc.ngpio,
-   gpio_data->context);
-   if (error)
-   dev_warn(dev, "teardown failed %d\n", error);
-   }
-
gpiochip_remove(>gc);
 }
 #else
diff --git a/include/linux/input/adp5589.h b/include/linux/input/adp5589.h
index c0523af96893..0e4742c8c81e 100644
--- a/include/linux/input/adp5589.h
+++ b/include/linux/input/adp5589.h
@@ -175,13 +175,6 @@ struct i2c_client; /* forward declaration */
 
 struct adp5589_gpio_platform_data {
int gpio_start; /* GPIO Chip base # */
-   int (*setup)(struct i2c_client *client,
-   int gpio, unsigned ngpio,
-   void *context);
-   int (*teardown)(struct i2c_client *client,
-   int gpio, unsigned ngpio,
-   void *context);
-   void*context;
 };
 
 #endif
-- 
2.17.1



[PATCH v2 1/5] Input: adp5589: use devm_kzalloc() to allocate the kpad object

2020-11-11 Thread Alexandru Ardelean
This removes the need to manually free the kpad object and cleans up some
exit/error paths.
The error path cleanup should reduce the risk of any memory leaks with this
object.

Signed-off-by: Alexandru Ardelean 
---
 drivers/input/keyboard/adp5589-keys.c | 13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/input/keyboard/adp5589-keys.c 
b/drivers/input/keyboard/adp5589-keys.c
index eb0e9cd66bcb..922497b65ab0 100644
--- a/drivers/input/keyboard/adp5589-keys.c
+++ b/drivers/input/keyboard/adp5589-keys.c
@@ -1007,7 +1007,7 @@ static int adp5589_probe(struct i2c_client *client,
return -EINVAL;
}
 
-   kpad = kzalloc(sizeof(*kpad), GFP_KERNEL);
+   kpad = devm_kzalloc(>dev, sizeof(*kpad), GFP_KERNEL);
if (!kpad)
return -ENOMEM;
 
@@ -1028,17 +1028,15 @@ static int adp5589_probe(struct i2c_client *client,
}
 
ret = adp5589_read(client, ADP5589_5_ID);
-   if (ret < 0) {
-   error = ret;
-   goto err_free_mem;
-   }
+   if (ret < 0)
+   return ret;
 
revid = (u8) ret & ADP5589_5_DEVICE_ID_MASK;
 
if (pdata->keymapsize) {
error = adp5589_keypad_add(kpad, revid);
if (error)
-   goto err_free_mem;
+   return error;
}
 
error = adp5589_setup(kpad);
@@ -1059,8 +1057,6 @@ static int adp5589_probe(struct i2c_client *client,
 
 err_keypad_remove:
adp5589_keypad_remove(kpad);
-err_free_mem:
-   kfree(kpad);
 
return error;
 }
@@ -1072,7 +1068,6 @@ static int adp5589_remove(struct i2c_client *client)
adp5589_write(client, kpad->var->reg(ADP5589_GENERAL_CFG), 0);
adp5589_keypad_remove(kpad);
adp5589_gpio_remove(kpad);
-   kfree(kpad);
 
return 0;
 }
-- 
2.17.1



[PATCH v2 0/5] Input: adp5589: cleanup and use device-managed functions

2020-11-11 Thread Alexandru Ardelean
This change-set does a cleanup of the driver to use device-managed
functions. The error & exit paths are simplified, and some potential
leaks should be removed.

Changelog v1 -> v2:
* 
https://lore.kernel.org/linux-input/2020084833.40995-1-alexandru.ardel...@analog.com/T/#t
* dropped patch: 'Input: adp5589: use a single variable for error in probe'
* for patch 'Input: adp5589: use devm_add_action_or_reset() for register clear'
  moved devm_add_action_or_reset() right after switch statement;
  using 'error' variable to check for error condition

Alexandru Ardelean (5):
  Input: adp5589: use devm_kzalloc() to allocate the kpad object
  Input: adp5589: use device-managed function in adp5589_keypad_add()
  Input: adp5589: remove setup/teardown hooks for gpios
  Input: adp5589: use devm_gpiochip_add_data() for gpios
  Input: adp5589: use devm_add_action_or_reset() for register clear

 drivers/input/keyboard/adp5589-keys.c | 120 ++
 include/linux/input/adp5589.h |   7 --
 2 files changed, 27 insertions(+), 100 deletions(-)

-- 
2.17.1



[PATCH v2 5/5] Input: adp5589: use devm_add_action_or_reset() for register clear

2020-11-11 Thread Alexandru Ardelean
The driver clears the general configuration register during the remove()
hook. This should also be done in case the driver exits on error.

This change move the clear of that register to the
devm_add_action_or_reset() hook.

Signed-off-by: Alexandru Ardelean 
---
 drivers/input/keyboard/adp5589-keys.c | 23 +--
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/input/keyboard/adp5589-keys.c 
b/drivers/input/keyboard/adp5589-keys.c
index ab390b01db08..9d5a39187b77 100644
--- a/drivers/input/keyboard/adp5589-keys.c
+++ b/drivers/input/keyboard/adp5589-keys.c
@@ -930,6 +930,14 @@ static int adp5589_keypad_add(struct adp5589_kpad *kpad, 
unsigned int revid)
return 0;
 }
 
+static void adp5589_clear_config(void *data)
+{
+   struct i2c_client *client = data;
+   struct adp5589_kpad *kpad = i2c_get_clientdata(client);
+
+   adp5589_write(client, kpad->var->reg(ADP5589_GENERAL_CFG), 0);
+}
+
 static int adp5589_probe(struct i2c_client *client,
 const struct i2c_device_id *id)
 {
@@ -970,6 +978,11 @@ static int adp5589_probe(struct i2c_client *client,
break;
}
 
+   error = devm_add_action_or_reset(>dev, adp5589_clear_config,
+client);
+   if (error)
+   return error;
+
ret = adp5589_read(client, ADP5589_5_ID);
if (ret < 0)
return ret;
@@ -999,15 +1012,6 @@ static int adp5589_probe(struct i2c_client *client,
return 0;
 }
 
-static int adp5589_remove(struct i2c_client *client)
-{
-   struct adp5589_kpad *kpad = i2c_get_clientdata(client);
-
-   adp5589_write(client, kpad->var->reg(ADP5589_GENERAL_CFG), 0);
-
-   return 0;
-}
-
 #ifdef CONFIG_PM_SLEEP
 static int adp5589_suspend(struct device *dev)
 {
@@ -1059,7 +1063,6 @@ static struct i2c_driver adp5589_driver = {
.pm = _dev_pm_ops,
},
.probe = adp5589_probe,
-   .remove = adp5589_remove,
.id_table = adp5589_id,
 };
 
-- 
2.17.1



drivers/net/wireless/mediatek/mt76/mt7915/init.c:339:26: sparse: sparse: cast from restricted __le16

2020-11-11 Thread kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   3d5e28bff7ad55aea081c1af516cc1c94a5eca7d
commit: 00b2e16e006390069480e90478aa8b6e924996d7 mt76: mt7915: add TxBF 
capabilities
date:   6 months ago
config: x86_64-randconfig-s022-20201112 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-106-gd020cf33-dirty
# 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=00b2e16e006390069480e90478aa8b6e924996d7
git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 00b2e16e006390069480e90478aa8b6e924996d7
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 


"sparse warnings: (new ones prefixed by >>)"
>> drivers/net/wireless/mediatek/mt76/mt7915/init.c:339:26: sparse: sparse: 
>> cast from restricted __le16
>> drivers/net/wireless/mediatek/mt76/mt7915/init.c:339:26: sparse: sparse: 
>> cast from restricted __le16
>> drivers/net/wireless/mediatek/mt76/mt7915/init.c:339:26: sparse: sparse: 
>> cast from restricted __le16
>> drivers/net/wireless/mediatek/mt76/mt7915/init.c:339:26: sparse: sparse: 
>> cast from restricted __le16
>> drivers/net/wireless/mediatek/mt76/mt7915/init.c:339:26: sparse: sparse: 
>> cast from restricted __le16
>> drivers/net/wireless/mediatek/mt76/mt7915/init.c:339:26: sparse: sparse: 
>> cast from restricted __le16

vim +339 drivers/net/wireless/mediatek/mt76/mt7915/init.c

   296  
   297  elem->phy_cap_info[3] &= ~IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER;
   298  elem->phy_cap_info[4] &= ~IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER;
   299  
   300  c = 
IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK |
   301  
IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_MASK;
   302  elem->phy_cap_info[5] &= ~c;
   303  
   304  c = IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMER_FB |
   305  IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMER_FB;
   306  elem->phy_cap_info[6] &= ~c;
   307  
   308  elem->phy_cap_info[7] &= ~IEEE80211_HE_PHY_CAP7_MAX_NC_MASK;
   309  
   310  c = IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US |
   311  IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO |
   312  IEEE80211_HE_PHY_CAP2_UL_MU_PARTIAL_MU_MIMO;
   313  elem->phy_cap_info[2] |= c;
   314  
   315  c = IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE |
   316  IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_4 |
   317  IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_4;
   318  elem->phy_cap_info[4] |= c;
   319  
   320  /* do not support NG16 due to spec D4.0 changes subcarrier idx 
*/
   321  c = IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU |
   322  IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU;
   323  
   324  if (vif == NL80211_IFTYPE_STATION)
   325  c |= IEEE80211_HE_PHY_CAP6_PARTIAL_BANDWIDTH_DL_MUMIMO;
   326  
   327  elem->phy_cap_info[6] |= c;
   328  
   329  if (nss < 2)
   330  return;
   331  
   332  if (vif != NL80211_IFTYPE_AP)
   333  return;
   334  
   335  elem->phy_cap_info[3] |= IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER;
   336  elem->phy_cap_info[4] |= IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER;
   337  
   338  /* num_snd_dim */
 > 339  c = (nss - 1) | (max_t(int, mcs->tx_mcs_160, 1) << 3);
   340  elem->phy_cap_info[5] |= c;
   341  
   342  c = IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMER_FB |
   343  IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMER_FB;
   344  elem->phy_cap_info[6] |= c;
   345  
   346  /* the maximum cap is 4 x 3, (Nr, Nc) = (3, 2) */
   347  elem->phy_cap_info[7] |= min_t(int, nss - 1, 2) << 3;
   348  }
   349  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip


[PATCH v6 4/4] MAINTAINERS: Add ROHM BD9576MUF and BD9573MUF drivers

2020-11-11 Thread Matti Vaittinen
Add maintainer entries for ROHM BD9576MUF and ROHM BD9573MUF drivers.
MFD, regulator and watchdog drivers were introduced for these PMICs.

Signed-off-by: Matti Vaittinen 
---
 MAINTAINERS | 4 
 1 file changed, 4 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index b516bb34a8d5..0bd788a94376 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -15088,16 +15088,20 @@ F:drivers/gpio/gpio-bd71828.c
 F: drivers/mfd/rohm-bd70528.c
 F: drivers/mfd/rohm-bd71828.c
 F: drivers/mfd/rohm-bd718x7.c
+F: drivers/mfd/rohm-bd9576.c
 F: drivers/power/supply/bd70528-charger.c
 F: drivers/regulator/bd70528-regulator.c
 F: drivers/regulator/bd71828-regulator.c
 F: drivers/regulator/bd718x7-regulator.c
+F: drivers/regulator/bd9576-regulator.c
 F: drivers/regulator/rohm-regulator.c
 F: drivers/rtc/rtc-bd70528.c
 F: drivers/watchdog/bd70528_wdt.c
+F: drivers/watchdog/bd9576_wdt.c
 F: include/linux/mfd/rohm-bd70528.h
 F: include/linux/mfd/rohm-bd71828.h
 F: include/linux/mfd/rohm-bd718x7.h
+F: include/linux/mfd/rohm-bd957x.h
 F: include/linux/mfd/rohm-generic.h
 F: include/linux/mfd/rohm-shared.h
 
-- 
2.25.4


-- 
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =] 


[PATCH v6 3/4] wdt: Support wdt on ROHM BD9576MUF and BD9573MUF

2020-11-11 Thread Matti Vaittinen
Add Watchdog support for ROHM BD9576MUF and BD9573MUF PMICs which are
mainly used to power the R-Car series processors. The watchdog is
pinged using a GPIO and enabled using another GPIO. Additionally
watchdog time-out can be configured to HW prior starting the watchdog.
Watchdog timeout can be configured to detect only delayed ping or in
a window mode where also too fast pings are detected.

Signed-off-by: Matti Vaittinen 
Reviewed-by: Guenter Roeck 
---

Changes from v5: Fixed the timeout.

Guenter, I kept your reviewed-by tag as I think you accepted this
change when we discussed it yesterday. Please let me know if this is not
Ok to you.

 drivers/watchdog/Kconfig  |  13 ++
 drivers/watchdog/Makefile |   1 +
 drivers/watchdog/bd9576_wdt.c | 291 ++
 3 files changed, 305 insertions(+)
 create mode 100644 drivers/watchdog/bd9576_wdt.c

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index fd7968635e6d..d5fec1bdf23e 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -172,6 +172,19 @@ config BD70528_WATCHDOG
  Alternatively say M to compile the driver as a module,
  which will be called bd70528_wdt.
 
+config BD957XMUF_WATCHDOG
+   tristate "ROHM BD9576MUF and BD9573MUF PMIC Watchdog"
+   depends on MFD_ROHM_BD957XMUF
+   select WATCHDOG_CORE
+   help
+ Support for the watchdog in the ROHM BD9576 and BD9573 PMICs.
+ These PMIC ICs contain watchdog block which can be configured
+ to toggle reset line if SoC fails to ping watchdog via GPIO.
+
+ Say Y here to include support for the ROHM BD9576 or BD9573
+ watchdog. Alternatively say M to compile the driver as a module,
+ which will be called bd9576_wdt.
+
 config DA9052_WATCHDOG
tristate "Dialog DA9052 Watchdog"
depends on PMIC_DA9052 || COMPILE_TEST
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index 071a2e50be98..54f39883f3ac 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -209,6 +209,7 @@ obj-$(CONFIG_XEN_WDT) += xen_wdt.o
 
 # Architecture Independent
 obj-$(CONFIG_BD70528_WATCHDOG) += bd70528_wdt.o
+obj-$(CONFIG_BD957XMUF_WATCHDOG) += bd9576_wdt.o
 obj-$(CONFIG_DA9052_WATCHDOG) += da9052_wdt.o
 obj-$(CONFIG_DA9055_WATCHDOG) += da9055_wdt.o
 obj-$(CONFIG_DA9062_WATCHDOG) += da9062_wdt.o
diff --git a/drivers/watchdog/bd9576_wdt.c b/drivers/watchdog/bd9576_wdt.c
new file mode 100644
index ..0b6999f3b6e8
--- /dev/null
+++ b/drivers/watchdog/bd9576_wdt.c
@@ -0,0 +1,291 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2020 ROHM Semiconductors
+ *
+ * ROHM BD9576MUF and BD9573MUF Watchdog driver
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static bool nowayout;
+module_param(nowayout, bool, 0);
+MODULE_PARM_DESC(nowayout,
+   "Watchdog cannot be stopped once started (default=\"false\")");
+
+#define HW_MARGIN_MIN 2
+#define HW_MARGIN_MAX 4416
+#define BD957X_WDT_DEFAULT_MARGIN 4416
+#define WATCHDOG_TIMEOUT 30
+
+struct bd9576_wdt_priv {
+   struct gpio_desc*gpiod_ping;
+   struct gpio_desc*gpiod_en;
+   struct device   *dev;
+   struct regmap   *regmap;
+   boolalways_running;
+   struct watchdog_device  wdd;
+};
+
+static void bd9576_wdt_disable(struct bd9576_wdt_priv *priv)
+{
+   gpiod_set_value_cansleep(priv->gpiod_en, 0);
+}
+
+static int bd9576_wdt_ping(struct watchdog_device *wdd)
+{
+   struct bd9576_wdt_priv *priv = watchdog_get_drvdata(wdd);
+
+   /* Pulse */
+   gpiod_set_value_cansleep(priv->gpiod_ping, 1);
+   gpiod_set_value_cansleep(priv->gpiod_ping, 0);
+
+   return 0;
+}
+
+static int bd9576_wdt_start(struct watchdog_device *wdd)
+{
+   struct bd9576_wdt_priv *priv = watchdog_get_drvdata(wdd);
+
+   gpiod_set_value_cansleep(priv->gpiod_en, 1);
+
+   return bd9576_wdt_ping(wdd);
+}
+
+static int bd9576_wdt_stop(struct watchdog_device *wdd)
+{
+   struct bd9576_wdt_priv *priv = watchdog_get_drvdata(wdd);
+
+   if (!priv->always_running)
+   bd9576_wdt_disable(priv);
+   else
+   set_bit(WDOG_HW_RUNNING, >status);
+
+   return 0;
+}
+
+static const struct watchdog_info bd957x_wdt_ident = {
+   .options= WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING |
+ WDIOF_SETTIMEOUT,
+   .identity   = "BD957x Watchdog",
+};
+
+static const struct watchdog_ops bd957x_wdt_ops = {
+   .owner  = THIS_MODULE,
+   .start  = bd9576_wdt_start,
+   .stop   = bd9576_wdt_stop,
+   .ping   = bd9576_wdt_ping,
+};
+
+/* Unit is hundreds of uS */
+#define FASTNG_MIN 23
+
+static int find_closest_fast(int target, int *sel, int *val)
+{
+   int i;
+   int window = FASTNG_MIN;
+
+   for (i = 0; i < 8 && window < target; 

Fair Pay: I-T Step : Dance Culture for Fair Pay Unity in East and West

2020-11-11 Thread Ywe Cærlyn

I have also made this:

https://www.youtube.com/channel/UCi7TCodsP4Y4UTuIigrG9GQ

Dance Culture for Fair Pay Unity in East and West

Make it your culture!
Serenity
Ywe.


[PATCH v6 2/4] mfd: Support ROHM BD9576MUF and BD9573MUF

2020-11-11 Thread Matti Vaittinen
Add core support for ROHM BD9576MUF and BD9573MUF PMICs which are
mainly used to power the R-Car series processors.

Signed-off-by: Matti Vaittinen 
---
 drivers/mfd/Kconfig  |  11 
 drivers/mfd/Makefile |   1 +
 drivers/mfd/rohm-bd9576.c| 108 +++
 include/linux/mfd/rohm-bd957x.h  |  59 +
 include/linux/mfd/rohm-generic.h |   2 +
 5 files changed, 181 insertions(+)
 create mode 100644 drivers/mfd/rohm-bd9576.c
 create mode 100644 include/linux/mfd/rohm-bd957x.h

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 8b99a13669bf..dcb2b14a570e 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -2010,6 +2010,17 @@ config MFD_ROHM_BD71828
  Also included is a Coulomb counter, a real-time clock (RTC), and
  a 32.768 kHz clock gate.
 
+config MFD_ROHM_BD957XMUF
+   tristate "ROHM BD9576MUF and BD9573MUF Power Management ICs"
+   depends on I2C=y
+   depends on OF
+   select REGMAP_I2C
+   select MFD_CORE
+   help
+ Select this option to get support for the ROHM BD9576MUF and
+ BD9573MUF Power Management ICs. BD9576 and BD9573 are primarily
+ designed to be used to power R-Car series processors.
+
 config MFD_STM32_LPTIMER
tristate "Support for STM32 Low-Power Timer"
depends on (ARCH_STM32 && OF) || COMPILE_TEST
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 1780019d2474..837f68c9f336 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -261,6 +261,7 @@ obj-$(CONFIG_RAVE_SP_CORE)  += rave-sp.o
 obj-$(CONFIG_MFD_ROHM_BD70528) += rohm-bd70528.o
 obj-$(CONFIG_MFD_ROHM_BD71828) += rohm-bd71828.o
 obj-$(CONFIG_MFD_ROHM_BD718XX) += rohm-bd718x7.o
+obj-$(CONFIG_MFD_ROHM_BD957XMUF)   += rohm-bd9576.o
 obj-$(CONFIG_MFD_STMFX)+= stmfx.o
 obj-$(CONFIG_MFD_KHADAS_MCU)   += khadas-mcu.o
 
diff --git a/drivers/mfd/rohm-bd9576.c b/drivers/mfd/rohm-bd9576.c
new file mode 100644
index ..f4dd9e438427
--- /dev/null
+++ b/drivers/mfd/rohm-bd9576.c
@@ -0,0 +1,108 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+//
+// Copyright (C) 2020 ROHM Semiconductors
+//
+// ROHM BD9576MUF and BD9573MUF PMIC driver
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static struct mfd_cell bd9573_mfd_cells[] = {
+   { .name = "bd9573-pmic", },
+   { .name = "bd9576-wdt", },
+};
+
+static struct mfd_cell bd9576_mfd_cells[] = {
+   { .name = "bd9576-pmic", },
+   { .name = "bd9576-wdt", },
+};
+
+static const struct regmap_range volatile_ranges[] = {
+   regmap_reg_range(BD957X_REG_SMRB_ASSERT, BD957X_REG_SMRB_ASSERT),
+   regmap_reg_range(BD957X_REG_PMIC_INTERNAL_STAT,
+BD957X_REG_PMIC_INTERNAL_STAT),
+   regmap_reg_range(BD957X_REG_INT_THERM_STAT, BD957X_REG_INT_THERM_STAT),
+   regmap_reg_range(BD957X_REG_INT_OVP_STAT, BD957X_REG_INT_SYS_STAT),
+   regmap_reg_range(BD957X_REG_INT_MAIN_STAT, BD957X_REG_INT_MAIN_STAT),
+};
+
+static const struct regmap_access_table volatile_regs = {
+   .yes_ranges = _ranges[0],
+   .n_yes_ranges = ARRAY_SIZE(volatile_ranges),
+};
+
+static struct regmap_config bd957x_regmap = {
+   .reg_bits = 8,
+   .val_bits = 8,
+   .volatile_table = _regs,
+   .max_register = BD957X_MAX_REGISTER,
+   .cache_type = REGCACHE_RBTREE,
+};
+
+static int bd957x_i2c_probe(struct i2c_client *i2c,
+const struct i2c_device_id *id)
+{
+   int ret;
+   struct regmap *regmap;
+   struct mfd_cell *mfd;
+   int cells;
+   unsigned long chip_type;
+
+   chip_type = (unsigned long)of_device_get_match_data(>dev);
+
+   switch (chip_type) {
+   case ROHM_CHIP_TYPE_BD9576:
+   mfd = bd9576_mfd_cells;
+   cells = ARRAY_SIZE(bd9576_mfd_cells);
+   break;
+   case ROHM_CHIP_TYPE_BD9573:
+   mfd = bd9573_mfd_cells;
+   cells = ARRAY_SIZE(bd9573_mfd_cells);
+   break;
+   default:
+   dev_err(>dev, "Unknown device type");
+   return -EINVAL;
+   }
+
+   regmap = devm_regmap_init_i2c(i2c, _regmap);
+   if (IS_ERR(regmap)) {
+   dev_err(>dev, "Failed to initialize Regmap\n");
+   return PTR_ERR(regmap);
+   }
+
+   ret = devm_mfd_add_devices(>dev, PLATFORM_DEVID_AUTO, mfd, cells,
+  NULL, 0, NULL);
+   if (ret)
+   dev_err(>dev, "Failed to create subdevices\n");
+
+   return ret;
+}
+
+static const struct of_device_id bd957x_of_match[] = {
+   { .compatible = "rohm,bd9576", .data = (void *)ROHM_CHIP_TYPE_BD9576, },
+   { .compatible = "rohm,bd9573", .data = (void *)ROHM_CHIP_TYPE_BD9573, },
+   { },
+};
+MODULE_DEVICE_TABLE(of, bd957x_of_match);
+
+static struct i2c_driver bd957x_drv = {
+   

[PATCH v6 1/4] dt_bindings: mfd: Add ROHM BD9576MUF and BD9573MUF PMICs

2020-11-11 Thread Matti Vaittinen
Add bindings for ROHM BD9576MUF and BD9573MUF PMICs. These
PMICs are primarily intended to be used to power the R-Car series
processors. They provide 6 power outputs, safety features and a
watchdog with two functional modes.

Signed-off-by: Matti Vaittinen 
Reviewed-by: Rob Herring 
---
 .../bindings/mfd/rohm,bd9576-pmic.yaml| 123 ++
 1 file changed, 123 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/rohm,bd9576-pmic.yaml

diff --git a/Documentation/devicetree/bindings/mfd/rohm,bd9576-pmic.yaml 
b/Documentation/devicetree/bindings/mfd/rohm,bd9576-pmic.yaml
new file mode 100644
index ..6483860da955
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/rohm,bd9576-pmic.yaml
@@ -0,0 +1,123 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/rohm,bd9576-pmic.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ROHM BD9576MUF and BD9573MUF Power Management Integrated Circuit 
bindings
+
+maintainers:
+  - Matti Vaittinen 
+
+description: |
+  BD9576MUF and BD9573MUF are power management ICs primarily intended for
+  powering the R-Car series processors.
+  The IC provides 6 power outputs with configurable sequencing and safety
+  monitoring. A watchdog logic with slow ping/windowed modes is also included.
+
+properties:
+  compatible:
+enum:
+  - rohm,bd9576
+  - rohm,bd9573
+
+  reg:
+description:
+  I2C slave address.
+maxItems: 1
+
+  interrupts:
+maxItems: 1
+
+  rohm,vout1-en-low:
+description:
+  BD9576 and BD9573 VOUT1 regulator enable state can be individually
+  controlled by a GPIO. This is dictated by state of vout1-en pin during
+  the PMIC startup. If vout1-en is LOW during PMIC startup then the VOUT1
+  enable sate is controlled via this pin. Set this property if vout1-en
+  is wired to be down at PMIC start-up.
+type: boolean
+
+  rohm,vout1-en-gpios:
+description:
+  GPIO specifier to specify the GPIO connected to vout1-en for vout1 ON/OFF
+  state control.
+maxItems: 1
+
+  rohm,ddr-sel-low:
+description:
+  The BD9576 and BD9573 output voltage for DDR can be selected by setting
+  the ddr-sel pin low or high. Set this property if ddr-sel is grounded.
+type: boolean
+
+  rohm,watchdog-enable-gpios:
+description: The GPIO line used to enable the watchdog.
+maxItems: 1
+
+  rohm,watchdog-ping-gpios:
+description: The GPIO line used to ping the watchdog.
+maxItems: 1
+
+  rohm,hw-timeout-ms:
+maxItems: 2
+description:
+  Watchog timeout in milliseconds. If single value is given it is
+  the maximum timeout. Eg. if pinging watchdog is not done within this time
+  limit the watchdog will be triggered. If two values are given watchdog
+  is configured in "window mode". Then first value is limit for short-ping
+  Eg. if watchdog is pinged sooner than that the watchdog will trigger.
+  When two values is given the second value is the maximum timeout.
+  # (HW) minimum for short timeout is 2ms, maximum 220 ms.
+  # (HW) minimum for max timeout is 4ms, maximum 4416 ms.
+
+  regulators:
+$ref: ../regulator/rohm,bd9576-regulator.yaml
+description:
+  List of child nodes that specify the regulators.
+
+required:
+  - compatible
+  - reg
+  - regulators
+
+additionalProperties: false
+
+examples:
+  - |
+#include 
+#include 
+i2c {
+#address-cells = <1>;
+#size-cells = <0>;
+pmic: pmic@30 {
+compatible = "rohm,bd9576";
+reg = <0x30>;
+rohm,vout1-en-low;
+rohm,vout1-en-gpios = < 6 GPIO_ACTIVE_HIGH>;
+rohm,ddr-sel-low;
+rohm,watchdog-enable-gpios = < 6 GPIO_ACTIVE_HIGH>;
+rohm,watchdog-ping-gpios = < 7 GPIO_ACTIVE_HIGH>;
+rohm,hw-timeout-ms = <150>, <2300>;
+
+regulators {
+boost1: regulator-vd50 {
+regulator-name = "VD50";
+};
+buck1: regulator-vd18 {
+regulator-name = "VD18";
+};
+buck2: regulator-vdddr {
+regulator-name = "VDDDR";
+};
+buck3: regulator-vd10 {
+regulator-name = "VD10";
+};
+ldo: regulator-voutl1 {
+regulator-name = "VOUTL1";
+};
+sw: regulator-vouts1 {
+regulator-name = "VOUTS1";
+};
+};
+};
+};
-- 
2.25.4


-- 
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the 

[PATCH v6 0/4] Support ROHM BD9576MUF and BD9573MUF PMICs

2020-11-11 Thread Matti Vaittinen
Initial support for ROHM BD9576MUF and BD9573MUF PMICs.

These PMICs are primarily intended to be used to power the R-Car family
processors. BD9576MUF includes some additional safety features the
BD9573MUF does not have. This initial version of drivers does not
utilize these features and for now the SW behaviour is identical.

This patch series includes MFD and watchdog drivers. Regulator part was
already applied.

- Enabling and pinging the watchdog
- configuring watchog timeout / window from device-tree

This patch series does not bring interrupt support. BD9576MUF and BD9573MUF
are designed to keep the IRQ line low for whole duration of error
condition. IRQ can't be 'acked'. So proper IRQ support would require
some IRQ limiter implementation (delayed unmask?) in order to not hog
the CPU.

Changelog v6:
  - Fixed watchdog timeout

Changelog v5:
  - rebased on top of v5.10-rc2
  - few styling fixes in MFD as suggested by Lee

Changelog v4:
  - rebased on top of 5.10-rc1
  - Fix typo (repeated word maximum) from the DT binding doc

Changelog v3:
  - use only one binding to specify watchdog time-out window.

Changelog v2:
  - dropped already applied regulator part
  - dt_bindings: Fix case for regulator-names in the example
  - watchdod: unify probe error check and revise includes

---


Matti Vaittinen (4):
  dt_bindings: mfd: Add ROHM BD9576MUF and BD9573MUF PMICs
  mfd: Support ROHM BD9576MUF and BD9573MUF
  wdt: Support wdt on ROHM BD9576MUF and BD9573MUF
  MAINTAINERS: Add ROHM BD9576MUF and BD9573MUF drivers

 .../bindings/mfd/rohm,bd9576-pmic.yaml| 123 
 MAINTAINERS   |   4 +
 drivers/mfd/Kconfig   |  11 +
 drivers/mfd/Makefile  |   1 +
 drivers/mfd/rohm-bd9576.c | 108 +++
 drivers/watchdog/Kconfig  |  13 +
 drivers/watchdog/Makefile |   1 +
 drivers/watchdog/bd9576_wdt.c | 291 ++
 include/linux/mfd/rohm-bd957x.h   |  59 
 include/linux/mfd/rohm-generic.h  |   2 +
 10 files changed, 613 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/rohm,bd9576-pmic.yaml
 create mode 100644 drivers/mfd/rohm-bd9576.c
 create mode 100644 drivers/watchdog/bd9576_wdt.c
 create mode 100644 include/linux/mfd/rohm-bd957x.h


base-commit: 3cea11cd5e3b00d91caf0b4730194039b45c5891
-- 
2.25.4


-- 
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =] 


[PATCH v4 4/5] usb: dwc3: debugfs: Introduce DEFINE_SHOW_STORE_ATTRIBUTE

2020-11-11 Thread Luo Jiaxing
Seq introduce a new helper macro DEFINE_SHOW_STORE_ATTRIBUTE for
Read-Write file, so we apply it at dwc3 debugfs to reduce some duplicated
code.

While at that, also use DEFINE_SHOW_ATTRIBUTE() where possible.

Signed-off-by: Luo Jiaxing 
Acked-by: Felipe Balbi 
---
 drivers/usb/dwc3/debugfs.c | 52 --
 1 file changed, 4 insertions(+), 48 deletions(-)

diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c
index 5da4f60..2b5de8d 100644
--- a/drivers/usb/dwc3/debugfs.c
+++ b/drivers/usb/dwc3/debugfs.c
@@ -348,11 +348,6 @@ static int dwc3_lsp_show(struct seq_file *s, void *unused)
return 0;
 }
 
-static int dwc3_lsp_open(struct inode *inode, struct file *file)
-{
-   return single_open(file, dwc3_lsp_show, inode->i_private);
-}
-
 static ssize_t dwc3_lsp_write(struct file *file, const char __user *ubuf,
  size_t count, loff_t *ppos)
 {
@@ -377,13 +372,7 @@ static ssize_t dwc3_lsp_write(struct file *file, const 
char __user *ubuf,
return count;
 }
 
-static const struct file_operations dwc3_lsp_fops = {
-   .open   = dwc3_lsp_open,
-   .write  = dwc3_lsp_write,
-   .read   = seq_read,
-   .llseek = seq_lseek,
-   .release= single_release,
-};
+DEFINE_SHOW_STORE_ATTRIBUTE(dwc3_lsp);
 
 static int dwc3_mode_show(struct seq_file *s, void *unused)
 {
@@ -412,11 +401,6 @@ static int dwc3_mode_show(struct seq_file *s, void *unused)
return 0;
 }
 
-static int dwc3_mode_open(struct inode *inode, struct file *file)
-{
-   return single_open(file, dwc3_mode_show, inode->i_private);
-}
-
 static ssize_t dwc3_mode_write(struct file *file,
const char __user *ubuf, size_t count, loff_t *ppos)
 {
@@ -445,13 +429,7 @@ static ssize_t dwc3_mode_write(struct file *file,
return count;
 }
 
-static const struct file_operations dwc3_mode_fops = {
-   .open   = dwc3_mode_open,
-   .write  = dwc3_mode_write,
-   .read   = seq_read,
-   .llseek = seq_lseek,
-   .release= single_release,
-};
+DEFINE_SHOW_STORE_ATTRIBUTE(dwc3_mode);
 
 static int dwc3_testmode_show(struct seq_file *s, void *unused)
 {
@@ -491,11 +469,6 @@ static int dwc3_testmode_show(struct seq_file *s, void 
*unused)
return 0;
 }
 
-static int dwc3_testmode_open(struct inode *inode, struct file *file)
-{
-   return single_open(file, dwc3_testmode_show, inode->i_private);
-}
-
 static ssize_t dwc3_testmode_write(struct file *file,
const char __user *ubuf, size_t count, loff_t *ppos)
 {
@@ -528,13 +501,7 @@ static ssize_t dwc3_testmode_write(struct file *file,
return count;
 }
 
-static const struct file_operations dwc3_testmode_fops = {
-   .open   = dwc3_testmode_open,
-   .write  = dwc3_testmode_write,
-   .read   = seq_read,
-   .llseek = seq_lseek,
-   .release= single_release,
-};
+DEFINE_SHOW_STORE_ATTRIBUTE(dwc3_testmode);
 
 static int dwc3_link_state_show(struct seq_file *s, void *unused)
 {
@@ -564,11 +531,6 @@ static int dwc3_link_state_show(struct seq_file *s, void 
*unused)
return 0;
 }
 
-static int dwc3_link_state_open(struct inode *inode, struct file *file)
-{
-   return single_open(file, dwc3_link_state_show, inode->i_private);
-}
-
 static ssize_t dwc3_link_state_write(struct file *file,
const char __user *ubuf, size_t count, loff_t *ppos)
 {
@@ -620,13 +582,7 @@ static ssize_t dwc3_link_state_write(struct file *file,
return count;
 }
 
-static const struct file_operations dwc3_link_state_fops = {
-   .open   = dwc3_link_state_open,
-   .write  = dwc3_link_state_write,
-   .read   = seq_read,
-   .llseek = seq_lseek,
-   .release= single_release,
-};
+DEFINE_SHOW_STORE_ATTRIBUTE(dwc3_link_state);
 
 struct dwc3_ep_file_map {
const char name[25];
-- 
2.7.4



[PATCH v4 1/5] seq_file: Introduce DEFINE_SHOW_STORE_ATTRIBUTE() helper macro

2020-11-11 Thread Luo Jiaxing
We already own DEFINE_SHOW_ATTRIBUTE() helper macro for defining attribute
for read-only file, but many of drivers want a helper macro for read-write
file too.

So we make one to decrease code duplication.

Signed-off-by: Luo Jiaxing 
---
 include/linux/seq_file.h | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 813614d..8a474c8 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -191,6 +191,21 @@ static const struct proc_ops __name ## _proc_ops = {   
\
.proc_release   = single_release,   \
 }
 
+#define DEFINE_SHOW_STORE_ATTRIBUTE(__name)
\
+static int __name ## _open(struct inode *inode, struct file *file) \
+{  \
+   return single_open(file, __name ## _show, inode->i_private);\
+}  \
+   \
+static const struct file_operations __name ## _fops = {
\
+   .owner  = THIS_MODULE,  \
+   .open   = __name ## _open,  \
+   .read   = seq_read, \
+   .write  = __name ## _write, \
+   .llseek = seq_lseek,\
+   .release= single_release,   \
+}
+
 static inline struct user_namespace *seq_user_ns(struct seq_file *seq)
 {
 #ifdef CONFIG_USER_NS
-- 
2.7.4



[PATCH v4 0/5] Introduce a new helper macro DEFINE_SHOW_STORE_ATTRIBUTE at seq_file.c

2020-11-11 Thread Luo Jiaxing
We already own DEFINE_SHOW_ATTRIBUTE() helper macro for defining attribute
for read-only file, but we found many of drivers also want a helper macro
for read-write file too.

So we add this macro to help decrease code duplication.

---
 v1->v2:
1.Rename DEFINE_STORE_ATTRIBUTE() to DEFINE_SHOW_STORE_ATTRIBUTE().
2.AI Viro points out that he doesn't like the definition of macros
  like DEFINE_SHOW_ATTRIBUTE.
 v2->v3:
1.Fixed some spelling mistakes in commit.
2.Revision description are added for easy tracing.

 v3->v4:
1.Add AI Viro's comment to v1->v2's revision description.
2.Fixed a spelling mistakes of "marco" to "macro".
---

Luo Jiaxing (5):
  seq_file: Introduce DEFINE_SHOW_STORE_ATTRIBUTE() helper macro
  scsi: hisi_sas: Introduce DEFINE_SHOW_STORE_ATTRIBUTE for debugfs
  scsi: qla2xxx: Introduce DEFINE_SHOW_STORE_ATTRIBUTE for debugfs
  usb: dwc3: debugfs: Introduce DEFINE_SHOW_STORE_ATTRIBUTE
  drm/i915/display: Introduce DEFINE_SHOW_STORE_ATTRIBUTE for debugfs

 .../gpu/drm/i915/display/intel_display_debugfs.c   |  55 +
 drivers/scsi/hisi_sas/hisi_sas_main.c  | 135 +++--
 drivers/scsi/qla2xxx/qla_dfs.c |  19 +--
 drivers/usb/dwc3/debugfs.c |  52 +---
 include/linux/seq_file.h   |  15 +++
 5 files changed, 41 insertions(+), 235 deletions(-)

-- 
2.7.4



[PATCH v4 3/5] scsi: qla2xxx: Introduce DEFINE_SHOW_STORE_ATTRIBUTE for debugfs

2020-11-11 Thread Luo Jiaxing
Seq introduce a new helper macro DEFINE_SHOW_STORE_ATTRIBUTE for
Read-Write file, so we apply it at qla2xxx to reduce some duplicated code.

Signed-off-by: Luo Jiaxing 
---
 drivers/scsi/qla2xxx/qla_dfs.c | 19 ++-
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c
index f89ad32..a5de808 100644
--- a/drivers/scsi/qla2xxx/qla_dfs.c
+++ b/drivers/scsi/qla2xxx/qla_dfs.c
@@ -513,14 +513,6 @@ qla_dfs_naqp_show(struct seq_file *s, void *unused)
return 0;
 }
 
-static int
-qla_dfs_naqp_open(struct inode *inode, struct file *file)
-{
-   struct scsi_qla_host *vha = inode->i_private;
-
-   return single_open(file, qla_dfs_naqp_show, vha);
-}
-
 static ssize_t
 qla_dfs_naqp_write(struct file *file, const char __user *buffer,
 size_t count, loff_t *pos)
@@ -569,14 +561,7 @@ qla_dfs_naqp_write(struct file *file, const char __user 
*buffer,
return rc;
 }
 
-static const struct file_operations dfs_naqp_ops = {
-   .open   = qla_dfs_naqp_open,
-   .read   = seq_read,
-   .llseek = seq_lseek,
-   .release= single_release,
-   .write  = qla_dfs_naqp_write,
-};
-
+DEFINE_SHOW_STORE_ATTRIBUTE(qla_dfs_naqp);
 
 int
 qla2x00_dfs_setup(scsi_qla_host_t *vha)
@@ -622,7 +607,7 @@ qla2x00_dfs_setup(scsi_qla_host_t *vha)
 
if (IS_QLA27XX(ha) || IS_QLA83XX(ha) || IS_QLA28XX(ha)) {
ha->tgt.dfs_naqp = debugfs_create_file("naqp",
-   0400, ha->dfs_dir, vha, _naqp_ops);
+   0400, ha->dfs_dir, vha, _dfs_naqp_ops);
if (!ha->tgt.dfs_naqp) {
ql_log(ql_log_warn, vha, 0xd011,
   "Unable to create debugFS naqp node.\n");
-- 
2.7.4



[PATCH v4 2/5] scsi: hisi_sas: Introduce DEFINE_SHOW_STORE_ATTRIBUTE for debugfs

2020-11-11 Thread Luo Jiaxing
Seq introduce a new helper macro DEFINE_SHOW_STORE_ATTRIBUTE for
Read-Write file, so we use it at our code to reduce some duplicated code.

Signed-off-by: Luo Jiaxing 
---
 drivers/scsi/hisi_sas/hisi_sas_main.c | 135 --
 1 file changed, 16 insertions(+), 119 deletions(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c 
b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 128583d..b8a6fc9 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -3403,22 +3403,7 @@ static ssize_t 
hisi_sas_debugfs_bist_linkrate_write(struct file *filp,
 
return count;
 }
-
-static int hisi_sas_debugfs_bist_linkrate_open(struct inode *inode,
-  struct file *filp)
-{
-   return single_open(filp, hisi_sas_debugfs_bist_linkrate_show,
-  inode->i_private);
-}
-
-static const struct file_operations hisi_sas_debugfs_bist_linkrate_ops = {
-   .open = hisi_sas_debugfs_bist_linkrate_open,
-   .read = seq_read,
-   .write = hisi_sas_debugfs_bist_linkrate_write,
-   .llseek = seq_lseek,
-   .release = single_release,
-   .owner = THIS_MODULE,
-};
+DEFINE_SHOW_STORE_ATTRIBUTE(hisi_sas_debugfs_bist_linkrate);
 
 static const struct {
int value;
@@ -3493,22 +3478,7 @@ static ssize_t 
hisi_sas_debugfs_bist_code_mode_write(struct file *filp,
 
return count;
 }
-
-static int hisi_sas_debugfs_bist_code_mode_open(struct inode *inode,
-   struct file *filp)
-{
-   return single_open(filp, hisi_sas_debugfs_bist_code_mode_show,
-  inode->i_private);
-}
-
-static const struct file_operations hisi_sas_debugfs_bist_code_mode_ops = {
-   .open = hisi_sas_debugfs_bist_code_mode_open,
-   .read = seq_read,
-   .write = hisi_sas_debugfs_bist_code_mode_write,
-   .llseek = seq_lseek,
-   .release = single_release,
-   .owner = THIS_MODULE,
-};
+DEFINE_SHOW_STORE_ATTRIBUTE(hisi_sas_debugfs_bist_code_mode);
 
 static ssize_t hisi_sas_debugfs_bist_phy_write(struct file *filp,
   const char __user *buf,
@@ -3542,22 +3512,7 @@ static int hisi_sas_debugfs_bist_phy_show(struct 
seq_file *s, void *p)
 
return 0;
 }
-
-static int hisi_sas_debugfs_bist_phy_open(struct inode *inode,
- struct file *filp)
-{
-   return single_open(filp, hisi_sas_debugfs_bist_phy_show,
-  inode->i_private);
-}
-
-static const struct file_operations hisi_sas_debugfs_bist_phy_ops = {
-   .open = hisi_sas_debugfs_bist_phy_open,
-   .read = seq_read,
-   .write = hisi_sas_debugfs_bist_phy_write,
-   .llseek = seq_lseek,
-   .release = single_release,
-   .owner = THIS_MODULE,
-};
+DEFINE_SHOW_STORE_ATTRIBUTE(hisi_sas_debugfs_bist_phy);
 
 static const struct {
int value;
@@ -3621,22 +3576,7 @@ static ssize_t hisi_sas_debugfs_bist_mode_write(struct 
file *filp,
 
return count;
 }
-
-static int hisi_sas_debugfs_bist_mode_open(struct inode *inode,
-  struct file *filp)
-{
-   return single_open(filp, hisi_sas_debugfs_bist_mode_show,
-  inode->i_private);
-}
-
-static const struct file_operations hisi_sas_debugfs_bist_mode_ops = {
-   .open = hisi_sas_debugfs_bist_mode_open,
-   .read = seq_read,
-   .write = hisi_sas_debugfs_bist_mode_write,
-   .llseek = seq_lseek,
-   .release = single_release,
-   .owner = THIS_MODULE,
-};
+DEFINE_SHOW_STORE_ATTRIBUTE(hisi_sas_debugfs_bist_mode);
 
 static ssize_t hisi_sas_debugfs_bist_enable_write(struct file *filp,
  const char __user *buf,
@@ -3677,22 +3617,7 @@ static int hisi_sas_debugfs_bist_enable_show(struct 
seq_file *s, void *p)
 
return 0;
 }
-
-static int hisi_sas_debugfs_bist_enable_open(struct inode *inode,
-struct file *filp)
-{
-   return single_open(filp, hisi_sas_debugfs_bist_enable_show,
-  inode->i_private);
-}
-
-static const struct file_operations hisi_sas_debugfs_bist_enable_ops = {
-   .open = hisi_sas_debugfs_bist_enable_open,
-   .read = seq_read,
-   .write = hisi_sas_debugfs_bist_enable_write,
-   .llseek = seq_lseek,
-   .release = single_release,
-   .owner = THIS_MODULE,
-};
+DEFINE_SHOW_STORE_ATTRIBUTE(hisi_sas_debugfs_bist_enable);
 
 static const struct {
char *name;
@@ -3730,21 +3655,7 @@ static int hisi_sas_debugfs_show(struct seq_file *s, 
void *p)
 
return 0;
 }
-
-static int hisi_sas_debugfs_open(struct inode *inode, struct file *filp)
-{
-   return single_open(filp, hisi_sas_debugfs_show,
-  inode->i_private);
-}
-
-static const struct file_operations hisi_sas_debugfs_ops 

[PATCH v4 5/5] drm/i915/display: Introduce DEFINE_SHOW_STORE_ATTRIBUTE for debugfs

2020-11-11 Thread Luo Jiaxing
Seq introduce a new helper macro DEFINE_SHOW_STORE_ATTRIBUTE for
Read-Write file, so we apply it at drm/i915/display to reduce some
duplicated code.

Signed-off-by: Luo Jiaxing 
---
 .../gpu/drm/i915/display/intel_display_debugfs.c   | 55 ++
 1 file changed, 4 insertions(+), 51 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c 
b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
index 0bf31f9..8bf839f 100644
--- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
+++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
@@ -1329,21 +1329,7 @@ static int i915_displayport_test_active_show(struct 
seq_file *m, void *data)
return 0;
 }
 
-static int i915_displayport_test_active_open(struct inode *inode,
-struct file *file)
-{
-   return single_open(file, i915_displayport_test_active_show,
-  inode->i_private);
-}
-
-static const struct file_operations i915_displayport_test_active_fops = {
-   .owner = THIS_MODULE,
-   .open = i915_displayport_test_active_open,
-   .read = seq_read,
-   .llseek = seq_lseek,
-   .release = single_release,
-   .write = i915_displayport_test_active_write
-};
+DEFINE_SHOW_STORE_ATTRIBUTE(i915_displayport_test_active);
 
 static int i915_displayport_test_data_show(struct seq_file *m, void *data)
 {
@@ -1733,19 +1719,7 @@ static ssize_t i915_hpd_storm_ctl_write(struct file 
*file,
return len;
 }
 
-static int i915_hpd_storm_ctl_open(struct inode *inode, struct file *file)
-{
-   return single_open(file, i915_hpd_storm_ctl_show, inode->i_private);
-}
-
-static const struct file_operations i915_hpd_storm_ctl_fops = {
-   .owner = THIS_MODULE,
-   .open = i915_hpd_storm_ctl_open,
-   .read = seq_read,
-   .llseek = seq_lseek,
-   .release = single_release,
-   .write = i915_hpd_storm_ctl_write
-};
+DEFINE_SHOW_STORE_ATTRIBUTE(i915_hpd_storm_ctl);
 
 static int i915_hpd_short_storm_ctl_show(struct seq_file *m, void *data)
 {
@@ -1811,14 +1785,7 @@ static ssize_t i915_hpd_short_storm_ctl_write(struct 
file *file,
return len;
 }
 
-static const struct file_operations i915_hpd_short_storm_ctl_fops = {
-   .owner = THIS_MODULE,
-   .open = i915_hpd_short_storm_ctl_open,
-   .read = seq_read,
-   .llseek = seq_lseek,
-   .release = single_release,
-   .write = i915_hpd_short_storm_ctl_write,
-};
+DEFINE_SHOW_STORE_ATTRIBUTE(i915_hpd_short_storm_ctl);
 
 static int i915_drrs_ctl_set(void *data, u64 val)
 {
@@ -2181,21 +2148,7 @@ static ssize_t i915_dsc_fec_support_write(struct file 
*file,
return len;
 }
 
-static int i915_dsc_fec_support_open(struct inode *inode,
-struct file *file)
-{
-   return single_open(file, i915_dsc_fec_support_show,
-  inode->i_private);
-}
-
-static const struct file_operations i915_dsc_fec_support_fops = {
-   .owner = THIS_MODULE,
-   .open = i915_dsc_fec_support_open,
-   .read = seq_read,
-   .llseek = seq_lseek,
-   .release = single_release,
-   .write = i915_dsc_fec_support_write
-};
+DEFINE_SHOW_STORE_ATTRIBUTE(i915_dsc_fec_support);
 
 /**
  * intel_connector_debugfs_add - add i915 specific connector debugfs files
-- 
2.7.4



Re: [PATCH net-next RFC] MAINTAINERS: Add Martin Schiller as a maintainer for the X.25 stack

2020-11-11 Thread Martin Schiller

On 2020-11-11 22:36, Xie He wrote:
Hi Martin Schiller, would you like to be a maintainer for the X.25 
stack?


As we know the linux-x25 mail list has stopped working for a long time.
Adding you as a maintainer may make you be Cc'd for new patches so that
you can review them.


About 1 year ago I was asked by Arnd Bergmann if I would like to become
the maintainer for the X.25 stack:

https://patchwork.ozlabs.org/project/netdev/patch/20191209151256.2497534-4-a...@arndb.de/#2320767

Yes, I would agree to be listed as a maintainer.

But I still think it is important that we either repair or delete the
linux-x25 mailing list. The current state that the messages are going
into nirvana is very unpleasant.



The original maintainer of X.25 network layer (Andrew Hendry) has 
stopped
sending emails to the netdev mail list since 2013. So there is 
practically

no maintainer for X.25 code currently.

Cc: Martin Schiller 
Cc: Andrew Hendry 
Signed-off-by: Xie He 
---
 MAINTAINERS | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 2a0fde12b650..9ebcb0708d5d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9832,13 +9832,6 @@ S:   Maintained
 F: arch/mips/lantiq
 F: drivers/soc/lantiq

-LAPB module
-L: linux-...@vger.kernel.org
-S: Orphan
-F: Documentation/networking/lapb-module.rst
-F: include/*/lapb.h
-F: net/lapb/
-
 LASI 53c700 driver for PARISC
 M: "James E.J. Bottomley" 
 L: linux-s...@vger.kernel.org
@@ -18979,12 +18972,19 @@ L:linux-kernel@vger.kernel.org
 S: Maintained
 N: axp[128]

-X.25 NETWORK LAYER
-M: Andrew Hendry 
+X.25 STACK
+M: Martin Schiller 
 L: linux-...@vger.kernel.org
-S: Odd Fixes
+L: net...@vger.kernel.org
+S: Maintained
+F: Documentation/networking/lapb-module.txt
 F: Documentation/networking/x25*
+F: drivers/net/wan/hdlc_x25.c
+F: drivers/net/wan/lapbether.c
+F: include/*/lapb.h
 F: include/net/x25*
+F: include/uapi/linux/x25.h
+F: net/lapb/
 F: net/x25/

 X86 ARCHITECTURE (32-BIT AND 64-BIT)


[RESEND PATCH 1/2] hwspinlock: sprd: fixed warning of unused variable 'sprd_hwspinlock_of_match'

2020-11-11 Thread Chunyan Zhang
From: Chunyan Zhang 

The macro function of_match_ptr() is NULL if CONFIG_OF is not set, in this
case Clang compiler would complain the of_device_id variable is unused.

Reported-by: kernel test robot 
Fixes: d8c81aba ("hwspinlock: sprd: Add hardware spinlock driver")
Signed-off-by: Chunyan Zhang 
---
* Resent this patch only since the 2nd patch in this patchset has been
  applied [1].

[1] https://www.spinics.net/lists/kernel/msg3720202.html
---
 drivers/hwspinlock/sprd_hwspinlock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwspinlock/sprd_hwspinlock.c 
b/drivers/hwspinlock/sprd_hwspinlock.c
index 36dc8038bbb4..e7b55217293c 100644
--- a/drivers/hwspinlock/sprd_hwspinlock.c
+++ b/drivers/hwspinlock/sprd_hwspinlock.c
@@ -148,7 +148,7 @@ static struct platform_driver sprd_hwspinlock_driver = {
.probe = sprd_hwspinlock_probe,
.driver = {
.name = "sprd_hwspinlock",
-   .of_match_table = of_match_ptr(sprd_hwspinlock_of_match),
+   .of_match_table = sprd_hwspinlock_of_match,
},
 };
 
-- 
2.20.1



Re: [f2fs-dev] [PATCH v3] f2fs: avoid race condition for shinker count

2020-11-11 Thread Chao Yu

On 2020/11/12 13:40, Jaegeuk Kim wrote:

Light reported sometimes shinker gets nat_cnt < dirty_nat_cnt resulting in
wrong do_shinker work. Let's avoid to get stale data by using nat_tree_lock.

Reported-by: Light Hsieh 
Signed-off-by: Jaegeuk Kim 
---
v3:
  - fix to use NM_I(sbi)

  fs/f2fs/shrinker.c | 6 +-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/shrinker.c b/fs/f2fs/shrinker.c
index d66de5999a26..555712ba06d8 100644
--- a/fs/f2fs/shrinker.c
+++ b/fs/f2fs/shrinker.c
@@ -18,7 +18,11 @@ static unsigned int shrinker_run_no;
  
  static unsigned long __count_nat_entries(struct f2fs_sb_info *sbi)

  {
-   long count = NM_I(sbi)->nat_cnt - NM_I(sbi)->dirty_nat_cnt;
+   long count;
+
+   down_read(_I(sbi)->nat_tree_lock);
+   count = NM_I(sbi)->nat_cnt - NM_I(sbi)->dirty_nat_cnt;
+   up_read(_I(sbi)->nat_tree_lock);
  
  	return count > 0 ? count : 0;


Minor thing,

Just return count is enough? since count should never be smaller than 0.

Anyway,

Reviewed-by: Chao Yu 

Thanks,

Thanks,


  }



Fair Pay: Fork Off Open Mandriva "Star X" Shortcut There.

2020-11-11 Thread Ywe Cærlyn

Which points to a fork of Open Mandriva being a shortcut there.
"Star X".

Serenity!
Ywe Cærlyn
https://ihsan-code.eu/


[PATCH v2] f2fs: compress: support chksum

2020-11-11 Thread Chao Yu
This patch supports to store chksum value with compressed
data, and verify the integrality of compressed data while
reading the data.

The feature can be enabled through specifying mount option
'compress_chksum'.

Signed-off-by: Chao Yu 
---
v2:
- don't always return error and print error message, just warn once
and set need_fsck flag.
 Documentation/filesystems/f2fs.rst |  1 +
 fs/f2fs/compress.c | 24 
 fs/f2fs/f2fs.h | 16 ++--
 fs/f2fs/inode.c|  3 +++
 fs/f2fs/super.c|  9 +
 include/linux/f2fs_fs.h|  2 +-
 6 files changed, 52 insertions(+), 3 deletions(-)

diff --git a/Documentation/filesystems/f2fs.rst 
b/Documentation/filesystems/f2fs.rst
index b8ee761c9922..985ae7d35066 100644
--- a/Documentation/filesystems/f2fs.rst
+++ b/Documentation/filesystems/f2fs.rst
@@ -260,6 +260,7 @@ compress_extension=%sSupport adding specified 
extension, so that f2fs can enab
 For other files, we can still enable compression via 
ioctl.
 Note that, there is one reserved special extension 
'*', it
 can be set to enable compression for all files.
+compress_chksum Support verifying chksum of raw data in 
compressed cluster.
 inlinecrypt When possible, encrypt/decrypt the contents of 
encrypted
 files using the blk-crypto framework rather than
 filesystem-layer encryption. This allows the use of
diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
index 3957a84a185e..2509348ced2b 100644
--- a/fs/f2fs/compress.c
+++ b/fs/f2fs/compress.c
@@ -607,6 +607,7 @@ static int f2fs_compress_pages(struct compress_ctx *cc)
f2fs_cops[fi->i_compress_algorithm];
unsigned int max_len, new_nr_cpages;
struct page **new_cpages;
+   u32 chksum = 0;
int i, ret;
 
trace_f2fs_compress_pages_start(cc->inode, cc->cluster_idx,
@@ -660,6 +661,11 @@ static int f2fs_compress_pages(struct compress_ctx *cc)
 
cc->cbuf->clen = cpu_to_le32(cc->clen);
 
+   if (fi->i_compress_flag & 1 << COMPRESS_CHKSUM)
+   chksum = f2fs_crc32(F2FS_I_SB(cc->inode),
+   cc->cbuf->cdata, cc->clen);
+   cc->cbuf->chksum = cpu_to_le32(chksum);
+
for (i = 0; i < COMPRESS_DATA_RESERVED_SIZE; i++)
cc->cbuf->reserved[i] = cpu_to_le32(0);
 
@@ -726,6 +732,7 @@ void f2fs_decompress_pages(struct bio *bio, struct page 
*page, bool verity)
(struct decompress_io_ctx *)page_private(page);
struct f2fs_sb_info *sbi = F2FS_I_SB(dic->inode);
struct f2fs_inode_info *fi= F2FS_I(dic->inode);
+   struct f2fs_sb_info *sbi = F2FS_I_SB(dic->inode);
const struct f2fs_compress_ops *cops =
f2fs_cops[fi->i_compress_algorithm];
int ret;
@@ -795,6 +802,23 @@ void f2fs_decompress_pages(struct bio *bio, struct page 
*page, bool verity)
 
ret = cops->decompress_pages(dic);
 
+   if (!ret && fi->i_compress_flag & 1 << COMPRESS_CHKSUM) {
+   u32 provided = le32_to_cpu(dic->cbuf->chksum);
+   u32 calculated = f2fs_crc32(sbi, dic->cbuf->cdata, dic->clen);
+
+   if (provided != calculated) {
+   if (!is_inode_flag_set(dic->inode, 
FI_COMPRESS_CORRUPT)) {
+   set_inode_flag(dic->inode, FI_COMPRESS_CORRUPT);
+   printk_ratelimited(
+   "%sF2FS-fs (%s): checksum invalid, nid 
= %lu, %x vs %x",
+   KERN_INFO, sbi->sb->s_id, 
dic->inode->i_ino,
+   provided, calculated);
+   }
+   set_sbi_flag(sbi, SBI_NEED_FSCK);
+   WARN_ON_ONCE(1);
+   }
+   }
+
 out_vunmap_cbuf:
vm_unmap_ram(dic->cbuf, dic->nr_cpages);
 out_vunmap_rbuf:
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 0d38f2135016..7c2e7e4738e5 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -147,7 +147,8 @@ struct f2fs_mount_info {
 
/* For compression */
unsigned char compress_algorithm;   /* algorithm type */
-   unsigned compress_log_size; /* cluster log size */
+   unsigned char compress_log_size;/* cluster log size */
+   bool compress_chksum;   /* compressed data chksum */
unsigned char compress_ext_cnt; /* extension count */
unsigned char extensions[COMPRESS_EXT_NUM][F2FS_EXTENSION_LEN]; /* 
extensions */
 };
@@ -674,6 +675,7 @@ enum {
FI_ATOMIC_REVOKE_REQUEST, /* request to drop atomic data */
FI_VERITY_IN_PROGRESS,  /* building fs-verity Merkle tree */
FI_COMPRESSED_FILE, /* indicate file's data can be 

Re: [PATCH] net: xfrm: fix memory leak in xfrm_user_policy()

2020-11-11 Thread Steffen Klassert
On Tue, Nov 10, 2020 at 09:14:43AM +0800, Yu Kuai wrote:
> if xfrm_get_translator() failed, xfrm_user_policy() return without
> freeing 'data', which is allocated in memdup_sockptr().
> 
> Fixes: 96392ee5a13b ("xfrm/compat: Translate 32-bit user_policy from sockptr")
> Reported-by: Hulk Robot 
> Signed-off-by: Yu Kuai 

Patch applied, thanks!


[rcu:rcu/next] BUILD SUCCESS e78cd85dc606c36677721c6d74bfcd8bd154e9a3

2020-11-11 Thread kernel test robot
tree/branch: 
https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git  rcu/next
branch HEAD: e78cd85dc606c36677721c6d74bfcd8bd154e9a3  doc: Remove obsolete 
RCU-bh and RCU-sched update-side API members

elapsed time: 722m

configs tested: 139
configs skipped: 2

The following configs have been built successfully.
More configs may be tested in the coming days.

gcc tested configs:
arm defconfig
arm64allyesconfig
arm64   defconfig
arm  allyesconfig
arm  allmodconfig
sh   se7206_defconfig
armqcom_defconfig
shtitan_defconfig
armmini2440_defconfig
powerpc mpc512x_defconfig
sh  lboxre2_defconfig
powerpc   mpc834x_itxgp_defconfig
powerpc mpc8560_ads_defconfig
m68k   bvme6000_defconfig
armoxnas_v6_defconfig
powerpc mpc5200_defconfig
arm   aspeed_g4_defconfig
mipsworkpad_defconfig
sh   se7712_defconfig
umkunit_defconfig
m68k apollo_defconfig
powerpcmvme5100_defconfig
powerpc   lite5200b_defconfig
arm   cns3420vb_defconfig
armmvebu_v5_defconfig
csky alldefconfig
powerpc  tqm8xx_defconfig
i386 alldefconfig
nds32   defconfig
ia64generic_defconfig
mips   ip32_defconfig
m68km5307c3_defconfig
c6x defconfig
mips  pistachio_defconfig
ia64  gensparse_defconfig
powerpc tqm8560_defconfig
sh   secureedge5410_defconfig
arm   mainstone_defconfig
xtensaxip_kc705_defconfig
arm at91_dt_defconfig
arc nsimosci_hs_smp_defconfig
c6xevmc6474_defconfig
powerpc  makalu_defconfig
riscvnommu_k210_defconfig
powerpc   ebony_defconfig
sh   allmodconfig
ia64zx1_defconfig
xtensa  nommu_kc705_defconfig
armzeus_defconfig
sh   alldefconfig
arm s3c6400_defconfig
armkeystone_defconfig
microblaze  mmu_defconfig
sh sh03_defconfig
sh microdev_defconfig
arm   milbeaut_m10v_defconfig
riscvallmodconfig
arm nhk8815_defconfig
m68k  hp300_defconfig
arm socfpga_defconfig
m68k  sun3x_defconfig
sh magicpanelr2_defconfig
powerpc   allnoconfig
ia64 allmodconfig
ia64defconfig
ia64 allyesconfig
m68k allmodconfig
m68kdefconfig
m68k allyesconfig
nios2   defconfig
arc  allyesconfig
nds32 allnoconfig
c6x  allyesconfig
nios2allyesconfig
cskydefconfig
alpha   defconfig
alphaallyesconfig
xtensa   allyesconfig
h8300allyesconfig
arc defconfig
parisc  defconfig
s390 allyesconfig
parisc   allyesconfig
s390defconfig
i386 allyesconfig
sparcallyesconfig
sparc   defconfig
i386defconfig
mips allyesconfig
mips allmodconfig
powerpc  allyesconfig
powerpc  allmodconfig
i386 randconfig-a006-2020
i386 randconfig-a005-2020
i386 randconfig-a002-2020
i386 randconfig-a001-2020
i386 randconfig-a003-2020
i386 randconfig-a004-2020
x86_64   randconfig-a015-2020
x86_64   randconfig-a011-2020

RE: [PATCH 1/6] Input: adp5589: use a single variable for error in probe

2020-11-11 Thread Ardelean, Alexandru



> -Original Message-
> From: Ardelean, Alexandru
> Sent: Thursday, November 12, 2020 8:40 AM
> To: Dmitry Torokhov 
> Cc: linux-in...@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: RE: [PATCH 1/6] Input: adp5589: use a single variable for error in 
> probe
> 
> 
> > -Original Message-
> > From: Dmitry Torokhov 
> > Sent: Thursday, November 12, 2020 2:38 AM
> > To: Ardelean, Alexandru 
> > Cc: linux-in...@vger.kernel.org; linux-kernel@vger.kernel.org
> > Subject: Re: [PATCH 1/6] Input: adp5589: use a single variable for
> > error in probe
> >
> > [External]
> >
> > Hi Alexandru,
> >
> > On Wed, Nov 11, 2020 at 10:48:28AM +0200, Alexandru Ardelean wrote:
> > > The 'error' & 'ret' variables are used. This is a bit of duplication.
> > > This change replaces the use of error with the 'ret' variable since
> > > the name is a bit more generic.
> >
> > I really prefer variables that carry error codes/success and are used
> > in error paths to be called "error", and "ret" or "retval" to be used
> > in cases where we may return actual data.
> >
> 
> Ack.
> Will do it the other way around for v2.
> 

Wait.
I just had some coffee.
I think you're saying to drop this patch.
Also fine from my side.

> > Thanks.
> >
> > --
> > Dmitry


Re: bootconfig length parse error in kernel

2020-11-11 Thread Chen Yu
On Thu, Nov 12, 2020 at 1:50 PM Masami Hiramatsu  wrote:
>
> Hi Chen,
>
> On Thu, 12 Nov 2020 12:34:36 +0800
> Chen Yu  wrote:
>
> > Hi Masami,
> >
> > On Wed, Nov 11, 2020 at 5:37 PM Masami Hiramatsu  
> > wrote:
> > >
> > > Hi Chen,
> > >
> > > On Tue, 10 Nov 2020 23:39:53 +0800
> > > Chen Yu  wrote:
> > >
> > > > Hi Masami,
> > > > Thanks for writing bootconfig and it is useful for boot up trace event
> > > > debugging.
> > >
> > > Thanks for testing!
> > >
> > > > However it was found that on 5.10-rc2 the bootconfig does not work and 
> > > > it shows
> > > > "'bootconfig' found on command line, but no bootconfig found"
> > > > And the reason for this is the kernel found the magic number to be 
> > > > incorrect.
> > > > I've added some hack in kernel to dump the first 12 bytes, it shows:
> > > > "OTCONFIG". So printed more content ahead we can find
> > > > "#BOOTCONFIG" ahead. So it looks that there is some alignment during
> > > > initrd load, and get_boot_config_from_initrd() might also deal with it. 
> > > > That is
> > > > to say:
> > > > data = (char *)initrd_end - BOOTCONFIG_MAGIC_LEN;
> > > > might do some alignment?
> > >
> > > Hrm, interesting. So initrd_end might be aligned. Could you print out the
> > > actuall address of initrd_end?
> > I've done some investigation, it looks like this issue is not related
> > to alignment, but related to
> > the bootloader that has provided an inaccurate ramdisk size via
> > boot_params.hdr.ramdisk_size.
>
> Yeah, it seems to happen. bootloader can pass wrong (bigger) size
> to kernel. BTW, what bootloader would you use?
>
It is
$ grub-install --version
grub-install (GRUB) 2.04-1ubuntu26.2
> > The actual size of initrd is:
> > ls /boot/initrd.img-5.10.0-rc3-e1000e-hw+ -l
> > -rw-r--r-- 1 root root 48689230 11月 12 00:08
> > /boot/initrd.img-5.10.0-rc3-e1000e-hw+
> > while the ramdisk size provided by bootloader via
> > boot_params.hdr.ramdisk_size is
> > 48689232, which is 2 bytes bigger than the actual size, and this is
> > why the initrd_end
> > is bigger than expected and causing the missmatch of magic number.
>
> OK. It seems that the bootloader might cut it up to 16 bytes
> aligned. (But I think that's wrong behavior, there is no reason
> to do it)
Agree.
>
> > Since there is no guarantee that bootloader provides the accurate
> > ramdisk size, an compromised
> > proposal might be that to search for the magic number a little ahead.
>
> If the bootloader does such wrong behavior, there is no guarantee
> that the size is "a little" bigger. IOW, it can be aligned to the
> page size (4KB-)
>
Right. How about inserting the bootconfig at initrd_start if
initrd_end could not be trusted?
> > For example, the
> > following patch works for me:
> > diff --git a/init/main.c b/init/main.c
> > index 130376ec10ba..60fb125d44f4 100644
> > --- a/init/main.c
> > +++ b/init/main.c
> > @@ -273,7 +273,10 @@ static void * __init
> > get_boot_config_from_initrd(u32 *_size, u32 *_csum)
> > if (!initrd_end)
> > return NULL;
> >
> > -   data = (char *)initrd_end - BOOTCONFIG_MAGIC_LEN;
> > +   data = memchr((char *)initrd_end - 2 * BOOTCONFIG_MAGIC_LEN,
> > +  '#', BOOTCONFIG_MAGIC_LEN);
> > +   if (!data)
> > +   return NULL;
>
> So this also does not guarantee that we can find "#" in BOOTCONFIG_MAGIC_LEN.
> We need to find actual code in the bootloader, what it does.
>
Indeed.
> > if (memcmp(data, BOOTCONFIG_MAGIC, BOOTCONFIG_MAGIC_LEN))
> > return NULL;
> >
> >
> > > And could you tell me which platform are you tested?
> > >
> > It is HP ZHAN 99 Mobile Workstation G1 with i5-8300H, Ubuntu 20.04.
>
> Hmm, this means x86 Grub2 does this change. Let me check it.
>
Okay.

Thanks,
Chenyu

> Thank you,
>
>
> --
> Masami Hiramatsu 


[PATCH] w1: w1_therm: Rename conflicting sysfs attribute 'eeprom' to 'eeprom_cmd'

2020-11-11 Thread Ivan Zaentsev
Duplicate attribute 'eeprom' is defined in:
1) Documentation/ABI/testing/sysfs-driver-w1_therm
2) Documentation/ABI/stable/sysfs-driver-w1_ds28e04

Both drivers define an attribute: /sys/bus/w1/devices/.../eeprom
with conflicting behavior.

Fix by renaming the newer one in w1_therm.c to 'eeprom_cmd'.

Reported-by: Mauro Carvalho Chehab 
Suggested-by: Greg Kroah-Hartman 
Link: https://lore.kernel.org/lkml/20201029152845.6bbb3...@coco.lan/
Signed-off-by: Ivan Zaentsev 
---
 Documentation/ABI/testing/sysfs-driver-w1_therm |  2 +-
 Documentation/w1/slaves/w1_therm.rst|  2 +-
 drivers/w1/slaves/w1_therm.c| 12 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-driver-w1_therm 
b/Documentation/ABI/testing/sysfs-driver-w1_therm
index 6a37dc33ffdb..74642c73d29c 100644
--- a/Documentation/ABI/testing/sysfs-driver-w1_therm
+++ b/Documentation/ABI/testing/sysfs-driver-w1_therm
@@ -14,7 +14,7 @@ Users:any user space application which wants 
to communicate with
w1_term device
 
 
-What:  /sys/bus/w1/devices/.../eeprom
+What:  /sys/bus/w1/devices/.../eeprom_cmd
 Date:  May 2020
 Contact:   Akira Shimahara 
 Description:
diff --git a/Documentation/w1/slaves/w1_therm.rst 
b/Documentation/w1/slaves/w1_therm.rst
index e39202e2b000..c3c9ed7a356c 100644
--- a/Documentation/w1/slaves/w1_therm.rst
+++ b/Documentation/w1/slaves/w1_therm.rst
@@ -82,7 +82,7 @@ resolution is read back from the chip and verified.
 
 Note: Changing the resolution reverts the conversion time to default.
 
-The write-only sysfs entry ``eeprom`` is an alternative for EEPROM operations.
+The write-only sysfs entry ``eeprom_cmd`` is an alternative for EEPROM 
operations.
 Write ``save`` to save device RAM to EEPROM. Write ``restore`` to restore 
EEPROM
 data in device RAM.
 
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c
index cddf60b7309c..3712b1e6dc71 100644
--- a/drivers/w1/slaves/w1_therm.c
+++ b/drivers/w1/slaves/w1_therm.c
@@ -315,7 +315,7 @@ static ssize_t resolution_show(struct device *device,
 static ssize_t resolution_store(struct device *device,
struct device_attribute *attr, const char *buf, size_t size);
 
-static ssize_t eeprom_store(struct device *device,
+static ssize_t eeprom_cmd_store(struct device *device,
struct device_attribute *attr, const char *buf, size_t size);
 
 static ssize_t alarms_store(struct device *device,
@@ -350,7 +350,7 @@ static DEVICE_ATTR_RO(w1_seq);
 static DEVICE_ATTR_RO(temperature);
 static DEVICE_ATTR_RO(ext_power);
 static DEVICE_ATTR_RW(resolution);
-static DEVICE_ATTR_WO(eeprom);
+static DEVICE_ATTR_WO(eeprom_cmd);
 static DEVICE_ATTR_RW(alarms);
 static DEVICE_ATTR_RW(conv_time);
 static DEVICE_ATTR_RW(features);
@@ -386,7 +386,7 @@ static struct attribute *w1_therm_attrs[] = {
_attr_temperature.attr,
_attr_ext_power.attr,
_attr_resolution.attr,
-   _attr_eeprom.attr,
+   _attr_eeprom_cmd.attr,
_attr_alarms.attr,
_attr_conv_time.attr,
_attr_features.attr,
@@ -397,7 +397,7 @@ static struct attribute *w1_ds18s20_attrs[] = {
_attr_w1_slave.attr,
_attr_temperature.attr,
_attr_ext_power.attr,
-   _attr_eeprom.attr,
+   _attr_eeprom_cmd.attr,
_attr_alarms.attr,
_attr_conv_time.attr,
_attr_features.attr,
@@ -410,7 +410,7 @@ static struct attribute *w1_ds28ea00_attrs[] = {
_attr_temperature.attr,
_attr_ext_power.attr,
_attr_resolution.attr,
-   _attr_eeprom.attr,
+   _attr_eeprom_cmd.attr,
_attr_alarms.attr,
_attr_conv_time.attr,
_attr_features.attr,
@@ -1740,7 +1740,7 @@ static ssize_t resolution_store(struct device *device,
return size;
 }
 
-static ssize_t eeprom_store(struct device *device,
+static ssize_t eeprom_cmd_store(struct device *device,
struct device_attribute *attr, const char *buf, size_t size)
 {
struct w1_slave *sl = dev_to_w1_slave(device);
-- 
2.25.1



[PATCH] staging: gasket: interrupt: fix the missed eventfd_ctx_put() in gasket_interrupt.c

2020-11-11 Thread Jing Xiangfeng
gasket_interrupt_set_eventfd() misses to call eventfd_ctx_put() in an
error path. We check interrupt is valid before calling
eventfd_ctx_fdget() to fix it.

There is the same issue in gasket_interrupt_clear_eventfd(), Add the
missed function call to fix it.

Fixes: 9a69f5087ccc ("drivers/staging: Gasket driver framework + Apex driver")
Signed-off-by: Jing Xiangfeng 
---
 drivers/staging/gasket/gasket_interrupt.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/gasket/gasket_interrupt.c 
b/drivers/staging/gasket/gasket_interrupt.c
index 2d6195f7300e..864342acfd86 100644
--- a/drivers/staging/gasket/gasket_interrupt.c
+++ b/drivers/staging/gasket/gasket_interrupt.c
@@ -487,14 +487,16 @@ int gasket_interrupt_system_status(struct gasket_dev 
*gasket_dev)
 int gasket_interrupt_set_eventfd(struct gasket_interrupt_data *interrupt_data,
 int interrupt, int event_fd)
 {
-   struct eventfd_ctx *ctx = eventfd_ctx_fdget(event_fd);
-
-   if (IS_ERR(ctx))
-   return PTR_ERR(ctx);
+   struct eventfd_ctx *ctx;
 
if (interrupt < 0 || interrupt >= interrupt_data->num_interrupts)
return -EINVAL;
 
+   ctx = eventfd_ctx_fdget(event_fd);
+
+   if (IS_ERR(ctx))
+   return PTR_ERR(ctx);
+
interrupt_data->eventfd_ctxs[interrupt] = ctx;
return 0;
 }
@@ -505,6 +507,9 @@ int gasket_interrupt_clear_eventfd(struct 
gasket_interrupt_data *interrupt_data,
if (interrupt < 0 || interrupt >= interrupt_data->num_interrupts)
return -EINVAL;
 
-   interrupt_data->eventfd_ctxs[interrupt] = NULL;
+   if (interrupt_data->eventfd_ctxs[interrupt]) {
+   eventfd_ctx_put(interrupt_data->eventfd_ctxs[interrupt]);
+   interrupt_data->eventfd_ctxs[interrupt] = NULL;
+   }
return 0;
 }
-- 
2.17.1



Fair Pay Main Point: Theophrastus vs La Quran

2020-11-11 Thread Ywe Cærlyn
It seems drinking customs of Oden, came back here, via Theophrastus, 
reflecting a Fire Salamander, and Kyphosus Fish. (That now is LSD).


This is not sufficient for Fair Pay background, and a clear argument for 
a switch to a Quranic background.


Serenity,
Ywe Cærlyn
https://ihsan-code.eu/


[PATCH] drm/bridge: anx7625: Add anx7625 port switching.

2020-11-11 Thread Pi-Hsun Shih
When output 2 lanes DP data, anx7625 can output to either TX1/RX1 or
TX2/RX2. In typical usage, these two TX/RX pairs corresponds to two
orientations of typec.

On some board one anx7625 is used as DPI to DP converter for two typec
ports. In this case, the TX1/RX1 and TX2/RX2 are connected to two usb
muxes, which mux the DP data with the rest of the USB3 data, and
connects to the two typec ports.

This patch adds option for anx7625 to acts as a usb typec switch and
switch output lanes based on the typec orientation, or acts as two usb
typec mux and switch output lanes depending on whether the two ports
currently has DP enabled.

Signed-off-by: Pi-Hsun Shih 



This is an attempt to use typec framework with how we're using anx7625
on Chrome OS asurada board.

An example of the dts for the two ports case can be found at
https://crrev.com/c/2507199/6

Sending this as a RFC patch since I'm not sure about the best approach
here. Should the logic of switching output lanes depends on ports be
coupled inside anx7625 driver, or in another driver, or is there
any existing way to accomplish this?

---
 drivers/gpu/drm/bridge/analogix/anx7625.c | 135 ++
 drivers/gpu/drm/bridge/analogix/anx7625.h |  24 
 2 files changed, 159 insertions(+)

diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c 
b/drivers/gpu/drm/bridge/analogix/anx7625.c
index 65cc05982f82..75f35a197196 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.c
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
@@ -13,6 +13,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
 
 #include 
@@ -1224,6 +1227,122 @@ static irqreturn_t anx7625_intr_hpd_isr(int irq, void 
*data)
return IRQ_HANDLED;
 }
 
+static void anx7625_set_crosspoint_switch(struct anx7625_data *ctx,
+ enum typec_orientation orientation)
+{
+   if (orientation == TYPEC_ORIENTATION_NORMAL) {
+   anx7625_reg_write(ctx, ctx->i2c.tcpc_client, TCPC_SWITCH_0,
+ SW_SEL1_SSRX_B10_B11 | SW_SEL1_ML0_A10_A11);
+   anx7625_reg_write(ctx, ctx->i2c.tcpc_client, TCPC_SWITCH_1,
+ SW_SEL2_SSTX_A2_A3 | SW_SEL2_ML1_B2_B3);
+   } else if (orientation == TYPEC_ORIENTATION_REVERSE) {
+   anx7625_reg_write(ctx, ctx->i2c.tcpc_client, TCPC_SWITCH_0,
+ SW_SEL1_SSRX_A10_A11 | SW_SEL1_ML0_B10_B11);
+   anx7625_reg_write(ctx, ctx->i2c.tcpc_client, TCPC_SWITCH_1,
+ SW_SEL2_SSTX_B2_B3 | SW_SEL2_ML1_A2_A3);
+   }
+}
+
+static int anx7625_usb_set_orientation(struct typec_switch *sw,
+  enum typec_orientation orientation)
+{
+   struct anx7625_data *ctx = typec_switch_get_drvdata(sw);
+
+   anx7625_set_crosspoint_switch(ctx, orientation);
+   return 0;
+}
+
+static int anx7625_register_usb(struct device *device,
+   struct anx7625_data *ctx)
+{
+   struct typec_switch_desc sw_desc = { };
+   struct fwnode_handle *fwnode = of_fwnode_handle(device->of_node);
+
+   sw_desc.fwnode = fwnode;
+   sw_desc.drvdata = ctx;
+   sw_desc.name = fwnode_get_name(fwnode);
+   sw_desc.set = anx7625_usb_set_orientation;
+
+   ctx->typec_sw = typec_switch_register(device, _desc);
+   if (IS_ERR(ctx->typec_sw))
+   return PTR_ERR(ctx->typec_sw);
+
+   return 0;
+}
+
+static void anx7625_usb_two_ports_update(struct anx7625_data *ctx)
+{
+   if (ctx->typec_ports[0].has_dp && ctx->typec_ports[1].has_dp)
+   // Both ports available, do nothing to retain the current one.
+   return;
+   else if (ctx->typec_ports[0].has_dp)
+   anx7625_set_crosspoint_switch(ctx, TYPEC_ORIENTATION_NORMAL);
+   else if (ctx->typec_ports[1].has_dp)
+   anx7625_set_crosspoint_switch(ctx, TYPEC_ORIENTATION_REVERSE);
+}
+
+static int anx7625_usb_mux_set(struct typec_mux *mux,
+  struct typec_mux_state *state)
+{
+   struct anx7625_port_data *data = typec_mux_get_drvdata(mux);
+
+   if (state->alt && state->alt->svid == USB_TYPEC_DP_SID &&
+   state->alt->mode == USB_TYPEC_DP_MODE)
+   data->has_dp = true;
+   else
+   data->has_dp = false;
+
+   anx7625_usb_two_ports_update(data->ctx);
+   return 0;
+}
+
+static int anx7625_register_usb_two_ports(struct device *device,
+ struct anx7625_data *ctx)
+{
+   struct typec_mux_desc mux_desc = { };
+   struct fwnode_handle *fwnode;
+   struct anx7625_port_data *port_data;
+   u32 port_num;
+   int ret;
+
+   device_for_each_child_node(device, fwnode) {
+   if (fwnode_property_read_u32(fwnode, "reg", _num))
+   continue;
+
+   

Re: [PATCH 1/4] drivers core: Introduce CPU type sysfs interface

2020-11-11 Thread Greg Kroah-Hartman
On Thu, Nov 12, 2020 at 07:19:48AM +0100, Brice Goglin wrote:
> Le 07/10/2020 à 07:15, Greg Kroah-Hartman a écrit :
> > On Tue, Oct 06, 2020 at 08:14:47PM -0700, Ricardo Neri wrote:
> >> On Tue, Oct 06, 2020 at 09:37:44AM +0200, Greg Kroah-Hartman wrote:
> >>> On Mon, Oct 05, 2020 at 05:57:36PM -0700, Ricardo Neri wrote:
>  On Sat, Oct 03, 2020 at 10:53:45AM +0200, Greg Kroah-Hartman wrote:
> > On Fri, Oct 02, 2020 at 06:17:42PM -0700, Ricardo Neri wrote:
> >> Hybrid CPU topologies combine CPUs of different microarchitectures in 
> >> the
> >> same die. Thus, even though the instruction set is compatible among all
> >> CPUs, there may still be differences in features (e.g., some CPUs may
> >> have counters that others CPU do not). There may be applications
> >> interested in knowing the type of micro-architecture topology of the
> >> system to make decisions about process affinity.
> >>
> >> While the existing sysfs for capacity (/sys/devices/system/cpu/cpuX/
> >> cpu_capacity) may be used to infer the types of micro-architecture of 
> >> the
> >> CPUs in the platform, it may not be entirely accurate. For instance, 
> >> two
> >> subsets of CPUs with different types of micro-architecture may have the
> >> same capacity due to power or thermal constraints.
> >>
> >> Create the new directory /sys/devices/system/cpu/types. Under such
> >> directory, create individual subdirectories for each type of CPU micro-
> >> architecture. Each subdirectory will have cpulist and cpumap files. 
> >> This
> >> makes it convenient for user space to read all the CPUs of the same 
> >> type
> >> at once without having to inspect each CPU individually.
> >>
> >> Implement a generic interface using weak functions that architectures 
> >> can
> >> override to indicate a) support for CPU types, b) the CPU type number, 
> >> and
> >> c) a string to identify the CPU vendor and type.
> >>
> >> For example, an x86 system with one Intel Core and four Intel Atom CPUs
> >> would look like this (other architectures have the hooks to use 
> >> whatever
> >> directory naming convention below "types" that meets their needs):
> >>
> >> user@host:~$: ls /sys/devices/system/cpu/types
> >> intel_atom_0  intel_core_0
> >>
> >> user@host:~$ ls /sys/devices/system/cpu/types/intel_atom_0
> >> cpulist cpumap
> >>
> >> user@host:~$ ls /sys/devices/system/cpu/types/intel_core_0
> >> cpulist cpumap
> >>
> >> user@host:~$ cat /sys/devices/system/cpu/types/intel_atom_0/cpumap
> >> 0f
> >>
> >> user@host:~$ cat /sys/devices/system/cpu/types/intel_atom_0/cpulist
> >> 0-3
> >>
> >> user@ihost:~$ cat /sys/devices/system/cpu/types/intel_core_0/cpumap
> >> 10
> >>
> >> user@host:~$ cat /sys/devices/system/cpu/types/intel_core_0/cpulist
> >> 4
>  Thank you for the quick and detailed Greg!
> 
> > The output of 'tree' sometimes makes it easier to see here, or:
> > grep -R . *
> > also works well.
>  Indeed, this would definitely make it more readable.
> 
> >> On non-hybrid systems, the /sys/devices/system/cpu/types directory is 
> >> not
> >> created. Add a hook for this purpose.
> > Why should these not show up if the system is not "hybrid"?
>  My thinking was that on a non-hybrid system, it does not make sense to
>  create this interface, as all the CPUs will be of the same type.
> >>> Why not just have this an attribute type in the existing cpuX directory?
> >>> Why do this have to be a totally separate directory and userspace has to
> >>> figure out to look in two different spots for the same cpu to determine
> >>> what it is?
> >> But if the type is located under cpuX, usespace would need to traverse
> >> all the CPUs and create its own cpu masks. Under the types directory it
> >> would only need to look once for each type of CPU, IMHO.
> > What does a "mask" do?  What does userspace care about this?  You would
> > have to create it by traversing the directories you are creating anyway,
> > so it's not much different, right?
> 
> 
> Hello
> 
> Sorry for the late reply. As the first userspace consumer of this
> interface [1], I can confirm that reading a single file to get the mask
> would be better, at least for performance reason. On large platforms, we
> already have to read thousands of sysfs files to get CPU topology and
> cache information, I'd be happy not to read one more file per cpu.
> 
> Reading these sysfs files is slow, and it does not scale well when
> multiple processes read them in parallel.

Really?  Where is the slowdown?  Would something like readfile() work
better for you for that?

https://lore.kernel.org/linux-api/20200704140250.423345-1-gre...@linuxfoundation.org/

How does multiple processes slow anything down, there shouldn't be any
shared 

Re: [PATCH] clk: hisilicon: Add clock driver for hi3559A SoC

2020-11-11 Thread Dongjiu Geng
On 2020/11/12 6:23, Rob Herring wrote:
> On Mon, Nov 09, 2020 at 08:28:38PM +, Dongjiu Geng wrote:
>> Add clock drivers for hi3559A SoC, this driver controls the SoC
>> registers to supply different clocks to different IPs in the SoC.
>>
>> Signed-off-by: Dongjiu Geng 
>> ---
>>  drivers/clk/hisilicon/Kconfig |   7 +
>>  drivers/clk/hisilicon/Makefile|   1 +
>>  drivers/clk/hisilicon/clk-hi3559a.c   | 873 ++
>>  include/dt-bindings/clock/hi3559av100-clock.h | 173 
> 
> Is there a binding for this? The header should be part of it.
yes, I will add it.
Thanks for the pointing out.

> 
>>  4 files changed, 1054 insertions(+)
>>  create mode 100644 drivers/clk/hisilicon/clk-hi3559a.c
>>  create mode 100644 include/dt-bindings/clock/hi3559av100-clock.h
>>
>> diff --git a/drivers/clk/hisilicon/Kconfig b/drivers/clk/hisilicon/Kconfig
>> index 6a9e93a0bb95..5ecc37aaa118 100644
>> --- a/drivers/clk/hisilicon/Kconfig
>> +++ b/drivers/clk/hisilicon/Kconfig
>> @@ -15,6 +15,13 @@ config COMMON_CLK_HI3519
>>  help
>>Build the clock driver for hi3519.
>>  
>> +config COMMON_CLK_HI3559A
>> +bool "Hi3559A Clock Driver"
>> +depends on ARCH_HISI || COMPILE_TEST
>> +default ARCH_HISI
>> +help
>> +  Build the clock driver for hi3559a.
>> +
>>  config COMMON_CLK_HI3660
>>  bool "Hi3660 Clock Driver"
>>  depends on ARCH_HISI || COMPILE_TEST
>> diff --git a/drivers/clk/hisilicon/Makefile b/drivers/clk/hisilicon/Makefile
>> index b2441b99f3d5..bc101833b35e 100644
>> --- a/drivers/clk/hisilicon/Makefile
>> +++ b/drivers/clk/hisilicon/Makefile
>> @@ -17,3 +17,4 @@ obj-$(CONFIG_COMMON_CLK_HI6220)+= clk-hi6220.o
>>  obj-$(CONFIG_RESET_HISI)+= reset.o
>>  obj-$(CONFIG_STUB_CLK_HI6220)   += clk-hi6220-stub.o
>>  obj-$(CONFIG_STUB_CLK_HI3660)   += clk-hi3660-stub.o
>> +obj-$(CONFIG_COMMON_CLK_HI3559A)+= clk-hi3559a.o
>> diff --git a/drivers/clk/hisilicon/clk-hi3559a.c 
>> b/drivers/clk/hisilicon/clk-hi3559a.c
>> new file mode 100644
>> index ..bd3921fc8c8e
>> --- /dev/null
>> +++ b/drivers/clk/hisilicon/clk-hi3559a.c
>> @@ -0,0 +1,873 @@
>> +// SPDX-License-Identifier: GPL-2.0-or-later
>> +/*
>> + * Hisilicon Hi3559A clock driver
>> + *
>> + * Copyright (c) 2019-2020 HiSilicon Technologies Co., Ltd.
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License as published by
>> + * the Free Software Foundation; either version 2 of the License, or
>> + * (at your option) any later version.
> 
> Don't need both this and SPDX tag. Kernel code should be GPL-2.0 (-only) 
> generally.

Ok, I will remove one. thanks.

> 
>> + *
>> + * Author: Dongjiu Geng 
> 
> git will tell us this.
> 
> Same comments apply to the header. Though DT headers should be dual 
> licensed.
> 
> Rob
> .
> 


RE: [PATCH 1/6] Input: adp5589: use a single variable for error in probe

2020-11-11 Thread Ardelean, Alexandru


> -Original Message-
> From: Dmitry Torokhov 
> Sent: Thursday, November 12, 2020 2:38 AM
> To: Ardelean, Alexandru 
> Cc: linux-in...@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH 1/6] Input: adp5589: use a single variable for error in 
> probe
> 
> [External]
> 
> Hi Alexandru,
> 
> On Wed, Nov 11, 2020 at 10:48:28AM +0200, Alexandru Ardelean wrote:
> > The 'error' & 'ret' variables are used. This is a bit of duplication.
> > This change replaces the use of error with the 'ret' variable since
> > the name is a bit more generic.
> 
> I really prefer variables that carry error codes/success and are used in error
> paths to be called "error", and "ret" or "retval" to be used in cases where we
> may return actual data.
> 

Ack.
Will do it the other way around for v2.

> Thanks.
> 
> --
> Dmitry


Re: [RFC PATCH 00/12] Topdown parser

2020-11-11 Thread Andi Kleen
On Wed, Nov 11, 2020 at 08:09:49PM -0800, Ian Rogers wrote:
>  >    to the optimization manual the group Topdown_Group_TopDownL1
>  provides the
>  >   
>  metrics Topdown_Metric_Frontend_Bound, Topdown_Metric_Backend_Bound, 
> Topdown_Metric_Bad_Speculation
>  >    and Topdown_Metric_Retiring. The hope is the events here will all
>  be
>  >    scheduled without multiplexing.
> 
>  That's not necessarily true. Some of the newer expressions are quite
>  complex (e.g .due to workarounds or because the events are complex, like
>  the FLOPS events) There's also some problems with the
>  scheduling of the fixed metrics on Icelake+, that need special handling.
> 
>For FLOPS I see:
>( #FP_Arith_Scalar + #FP_Arith_Vector ) / ( 2 * CORE_CLKS ) 
>is the concern about multiplexing? Could we create metrics/groups aware of
>the limitations?

If you expand it you'll end up with a lot of events, so it has to be split
into groups. But you still need to understand the rules, otherwise the tool
ends up with non schedulable groups.

For example here's a group schedule generated by toplev for level 3 Icelake.
On pre Icelake with only 4 counters it's more complicated.

Microcode_Sequencer[3] Heavy_Operations[1] Memory_Bound[1]
Branch_Mispredicts[1] Fetch_Bandwidth[1] Other[4] Heavy_Operations[3]
Frontend_Bound[1] FP_Arith[1] Backend_Bound[1] Light_Operations[3]
Microcode_Sequencer[1] FP_Arith[4] Fetch_Bandwidth[2] Light_Operations[1]
Retiring[1] Bad_Speculation[1] Machine_Clears[1] Other[1] Core_Bound[1]
Ports_Utilization[1]:
  perf_metrics.frontend_bound[f] perf_metrics.bad_speculation[f]
  topdown.slots[f] perf_metrics.backend_bound[f] perf_metrics.retiring[f] [0
  counters]
Machine_Clears[2] Branch_Mispredicts[2] ITLB_Misses[3] Branch_Mispredicts[1]
Fetch_Bandwidth[1] Machine_Clears[1] Frontend_Bound[1] Backend_Bound[1]
ICache_Misses[3] Fetch_Latency[2] Fetch_Bandwidth[2] Bad_Speculation[1]
Memory_Bound[1] DSB_Switches[3]:
  inst_retired.any[f] machine_clears.count cpu_clk_unhalted.thread[f]
  int_misc.recovery_cycles:c1:e1 br_misp_retired.all_branches
  idq_uops_not_delivered.cycles_0_uops_deliv.core topdown.slots[f]
  dsb2mite_switches.penalty_cycles icache_64b.iftag_stall
  int_misc.uop_dropping icache_16b.ifdata_stall [8 counters]
Core_Bound[1] Core_Bound[2] Heavy_Operations[3] Memory_Bound[2]
Light_Operations[3]:
  cycle_activity.stalls_mem_any idq.ms_uops exe_activity.1_ports_util
  exe_activity.exe_bound_0_ports exe_activity.2_ports_util
  exe_activity.bound_on_stores int_misc.recovery_cycles:c1:e1 uops_issued.any
  [8 counters]
Microcode_Sequencer[3] Store_Bound[3] Branch_Resteers[3] MS_Switches[3]
Divider[3] LCP[3]:
  int_misc.clear_resteer_cycles arith.divider_active
  cpu_clk_unhalted.thread[f] idq.ms_switches ild_stall.lcp baclears.any
  exe_activity.bound_on_stores idq.ms_uops uops_issued.any [8 counters]
L1_Bound[3] L3_Bound[3]:
  cycle_activity.stalls_l1d_miss cycle_activity.stalls_mem_any
  cycle_activity.stalls_l2_miss cpu_clk_unhalted.thread[f]
  cycle_activity.stalls_l3_miss [4 counters]
DSB[3] MITE[3]:
  idq.mite_cycles_ok idq.mite_cycles_any cpu_clk_unhalted.distributed
  idq.dsb_cycles_any idq.dsb_cycles_ok [5 counters]
LSD[3] L2_Bound[3]:
  cycle_activity.stalls_l1d_miss cpu_clk_unhalted.thread[f]
  cpu_clk_unhalted.distributed lsd.cycles_ok lsd.cycles_active
  cycle_activity.stalls_l2_miss [5 counters]
Other[4] FP_Arith[4] L2_Bound[3] DRAM_Bound[3]:
  mem_load_retired.fb_hit mem_load_retired.l2_hit
  fp_arith_inst_retired.512b_packed_single mem_load_retired.l1_miss
  fp_arith_inst_retired.512b_packed_double l1d_pend_miss.fb_full_periods [6
  counters]
Ports_Utilization[3] DRAM_Bound[3]:
  cycle_activity.stalls_l1d_miss arith.divider_active mem_load_retired.l2_hit
  exe_activity.1_ports_util cpu_clk_unhalted.thread[f]
  cycle_activity.stalls_l3_miss exe_activity.2_ports_util
  cycle_activity.stalls_l2_miss exe_activity.exe_bound_0_ports [8 counters]
Other[4] FP_Arith[4]:
  fp_arith_inst_retired.128b_packed_single uops_executed.thread
  uops_executed.x87 fp_arith_inst_retired.scalar_double
  fp_arith_inst_retired.256b_packed_single
  fp_arith_inst_retired.scalar_single
  fp_arith_inst_retired.128b_packed_double
  fp_arith_inst_retired.256b_packed_double [8 counters]


>Ok, so we can read the threshold from the spreadsheet and create an extra
>metric for if the metric above the threshold?

Yes it can be all derived from the spreadsheet.

You need a much more complicated evaluation algorithm though, single
pass is not enough.

> 
>  Also in other cases it's probably better to not drilldown, but collect
>  everything upfront, e.g. when someone else is doing the collection
>  for you. In this case the thresholding has to be figured out from
>  existing data.
> 
>This sounds like perf record support for metrics, which I think is a good
>idea but not currently a use-case I'm trying to solve.

I meant just a single 

[PATCH] usb: dwc3: qcom: Add shutdown callback for dwc3

2020-11-11 Thread Sandeep Maheswaram
This patch adds a shutdown callback to USB DWC QCOM driver to ensure that
it is properly shutdown in reboot/shutdown path. This is required
where SMMU address translation is enabled like on SC7180
SoC and few others. If the hardware is still accessing memory after
SMMU translation is disabled as part of SMMU shutdown callback in
system reboot or shutdown path, then IOVAs(I/O virtual address)
which it was using will go on the bus as the physical addresses which
might result in unknown crashes (NoC/interconnect errors).

Signed-off-by: Sandeep Maheswaram 
---
 drivers/usb/dwc3/dwc3-qcom.c | 26 --
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index c703d55..a930e06 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -790,13 +790,11 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
return ret;
 }
 
-static int dwc3_qcom_remove(struct platform_device *pdev)
+static void __dwc3_qcom_teardown(struct dwc3_qcom *qcom)
 {
-   struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
-   struct device *dev = >dev;
int i;
 
-   of_platform_depopulate(dev);
+   of_platform_depopulate(qcom->dev);
 
for (i = qcom->num_clocks - 1; i >= 0; i--) {
clk_disable_unprepare(qcom->clks[i]);
@@ -807,12 +805,27 @@ static int dwc3_qcom_remove(struct platform_device *pdev)
dwc3_qcom_interconnect_exit(qcom);
reset_control_assert(qcom->resets);
 
-   pm_runtime_allow(dev);
-   pm_runtime_disable(dev);
+   pm_runtime_allow(qcom->dev);
+   pm_runtime_disable(qcom->dev);
+}
+
+static int dwc3_qcom_remove(struct platform_device *pdev)
+{
+   struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
+
+   __dwc3_qcom_teardown(qcom);
 
return 0;
 }
 
+static void dwc3_qcom_shutdown(struct platform_device *pdev)
+{
+   struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
+
+   __dwc3_qcom_teardown(qcom);
+
+}
+
 static int __maybe_unused dwc3_qcom_pm_suspend(struct device *dev)
 {
struct dwc3_qcom *qcom = dev_get_drvdata(dev);
@@ -887,6 +900,7 @@ MODULE_DEVICE_TABLE(acpi, dwc3_qcom_acpi_match);
 static struct platform_driver dwc3_qcom_driver = {
.probe  = dwc3_qcom_probe,
.remove = dwc3_qcom_remove,
+   .shutdown   = dwc3_qcom_shutdown,
.driver = {
.name   = "dwc3-qcom",
.pm = _qcom_dev_pm_ops,
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation



Re: [PATCH 1/4] drivers core: Introduce CPU type sysfs interface

2020-11-11 Thread Brice Goglin
Le 07/10/2020 à 07:15, Greg Kroah-Hartman a écrit :
> On Tue, Oct 06, 2020 at 08:14:47PM -0700, Ricardo Neri wrote:
>> On Tue, Oct 06, 2020 at 09:37:44AM +0200, Greg Kroah-Hartman wrote:
>>> On Mon, Oct 05, 2020 at 05:57:36PM -0700, Ricardo Neri wrote:
 On Sat, Oct 03, 2020 at 10:53:45AM +0200, Greg Kroah-Hartman wrote:
> On Fri, Oct 02, 2020 at 06:17:42PM -0700, Ricardo Neri wrote:
>> Hybrid CPU topologies combine CPUs of different microarchitectures in the
>> same die. Thus, even though the instruction set is compatible among all
>> CPUs, there may still be differences in features (e.g., some CPUs may
>> have counters that others CPU do not). There may be applications
>> interested in knowing the type of micro-architecture topology of the
>> system to make decisions about process affinity.
>>
>> While the existing sysfs for capacity (/sys/devices/system/cpu/cpuX/
>> cpu_capacity) may be used to infer the types of micro-architecture of the
>> CPUs in the platform, it may not be entirely accurate. For instance, two
>> subsets of CPUs with different types of micro-architecture may have the
>> same capacity due to power or thermal constraints.
>>
>> Create the new directory /sys/devices/system/cpu/types. Under such
>> directory, create individual subdirectories for each type of CPU micro-
>> architecture. Each subdirectory will have cpulist and cpumap files. This
>> makes it convenient for user space to read all the CPUs of the same type
>> at once without having to inspect each CPU individually.
>>
>> Implement a generic interface using weak functions that architectures can
>> override to indicate a) support for CPU types, b) the CPU type number, 
>> and
>> c) a string to identify the CPU vendor and type.
>>
>> For example, an x86 system with one Intel Core and four Intel Atom CPUs
>> would look like this (other architectures have the hooks to use whatever
>> directory naming convention below "types" that meets their needs):
>>
>> user@host:~$: ls /sys/devices/system/cpu/types
>> intel_atom_0  intel_core_0
>>
>> user@host:~$ ls /sys/devices/system/cpu/types/intel_atom_0
>> cpulist cpumap
>>
>> user@host:~$ ls /sys/devices/system/cpu/types/intel_core_0
>> cpulist cpumap
>>
>> user@host:~$ cat /sys/devices/system/cpu/types/intel_atom_0/cpumap
>> 0f
>>
>> user@host:~$ cat /sys/devices/system/cpu/types/intel_atom_0/cpulist
>> 0-3
>>
>> user@ihost:~$ cat /sys/devices/system/cpu/types/intel_core_0/cpumap
>> 10
>>
>> user@host:~$ cat /sys/devices/system/cpu/types/intel_core_0/cpulist
>> 4
 Thank you for the quick and detailed Greg!

> The output of 'tree' sometimes makes it easier to see here, or:
>   grep -R . *
> also works well.
 Indeed, this would definitely make it more readable.

>> On non-hybrid systems, the /sys/devices/system/cpu/types directory is not
>> created. Add a hook for this purpose.
> Why should these not show up if the system is not "hybrid"?
 My thinking was that on a non-hybrid system, it does not make sense to
 create this interface, as all the CPUs will be of the same type.
>>> Why not just have this an attribute type in the existing cpuX directory?
>>> Why do this have to be a totally separate directory and userspace has to
>>> figure out to look in two different spots for the same cpu to determine
>>> what it is?
>> But if the type is located under cpuX, usespace would need to traverse
>> all the CPUs and create its own cpu masks. Under the types directory it
>> would only need to look once for each type of CPU, IMHO.
> What does a "mask" do?  What does userspace care about this?  You would
> have to create it by traversing the directories you are creating anyway,
> so it's not much different, right?


Hello

Sorry for the late reply. As the first userspace consumer of this
interface [1], I can confirm that reading a single file to get the mask
would be better, at least for performance reason. On large platforms, we
already have to read thousands of sysfs files to get CPU topology and
cache information, I'd be happy not to read one more file per cpu.

Reading these sysfs files is slow, and it does not scale well when
multiple processes read them in parallel. There are ways to avoid this
multiple discoveries by sharing hwloc info through XML or shmem, but it
will take years before all developers of different runtimes all
implement this :)

Thanks

Brice

[1] hwloc and lstopo are going to expose this hybrid info to HPC
runtimes (https://www.open-mpi.org/projects/hwloc/)




[PATCH v1 1/2] mmc: Support kmsg dumper based on pstore/blk

2020-11-11 Thread Bhaskara Budiredla
This patch introduces to mmcpstore. The functioning of mmcpstore is
is similar to mtdpstore. mmcpstore works on FTL based flash devices
whereas mtdpstore works on raw flash devices. When the system crashes,
mmcpstore stores the kmsg panic and oops logs to a user specified
MMC device.

It collects the details about the host MMC device through pstore/blk
"blkdev" parameter. The user can specify the MMC device in many ways
by checking in Documentation/admin-guide/pstore-blk.rst.

The individual mmc host drivers have to define suitable polling
subroutines to write kmsg panic/oops logs through mmcpstore.

Signed-off-by: Bhaskara Budiredla 
---
 drivers/mmc/core/Kconfig |   7 +
 drivers/mmc/core/Makefile|   1 +
 drivers/mmc/core/block.c |  20 +++
 drivers/mmc/core/block.h |   3 +
 drivers/mmc/core/core.c  |  24 +++
 drivers/mmc/core/mmcpstore.c | 318 +++
 include/linux/mmc/card.h |   4 +
 include/linux/mmc/core.h |   4 +
 include/linux/mmc/host.h |   6 +
 9 files changed, 387 insertions(+)
 create mode 100644 drivers/mmc/core/mmcpstore.c

diff --git a/drivers/mmc/core/Kconfig b/drivers/mmc/core/Kconfig
index c12fe13e4b14..cafb367c482d 100644
--- a/drivers/mmc/core/Kconfig
+++ b/drivers/mmc/core/Kconfig
@@ -81,3 +81,10 @@ config MMC_TEST
  This driver is only of interest to those developing or
  testing a host driver. Most people should say N here.
 
+config MMC_PSTORE
+   bool "Log panic/oops to a MMC buffer"
+   depends on PSTORE
+   depends on PSTORE_BLK
+   help
+ Backend driver to store the kmsg crash dumps to a user specified MMC
+ device. The driver is based on pstore/blk.
diff --git a/drivers/mmc/core/Makefile b/drivers/mmc/core/Makefile
index 95ffe008ebdf..5f4230b79ac6 100644
--- a/drivers/mmc/core/Makefile
+++ b/drivers/mmc/core/Makefile
@@ -17,4 +17,5 @@ mmc_core-$(CONFIG_DEBUG_FS)   += debugfs.o
 obj-$(CONFIG_MMC_BLOCK)+= mmc_block.o
 mmc_block-objs := block.o queue.o
 obj-$(CONFIG_MMC_TEST) += mmc_test.o
+obj-$(CONFIG_MMC_PSTORE)   += mmcpstore.o
 obj-$(CONFIG_SDIO_UART)+= sdio_uart.o
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 8d3df0be0355..f11c21d60b67 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -2870,6 +2870,21 @@ static void mmc_blk_remove_debugfs(struct mmc_card *card,
 
 #endif /* CONFIG_DEBUG_FS */
 
+#ifdef CONFIG_MMC_PSTORE
+sector_t mmc_blk_get_part(struct mmc_card *card, int part_num, sector_t *size)
+{
+   struct mmc_blk_data *md = dev_get_drvdata(>dev);
+   struct gendisk *disk = md->disk;
+   struct disk_part_tbl *part_tbl = disk->part_tbl;
+
+   if (part_num < 0 || part_num >= part_tbl->len)
+   return 0;
+
+   *size = part_tbl->part[part_num]->nr_sects << SECTOR_SHIFT;
+   return part_tbl->part[part_num]->start_sect;
+}
+#endif
+
 static int mmc_blk_probe(struct mmc_card *card)
 {
struct mmc_blk_data *md, *part_md;
@@ -2913,6 +2928,11 @@ static int mmc_blk_probe(struct mmc_card *card)
goto out;
}
 
+#ifdef CONFIG_MMC_PSTORE
+   if (mmc_card_mmc(card) || mmc_card_sd(card))
+   mmcpstore_card_set(card, md->disk->disk_name);
+#endif
+
/* Add two debugfs entries */
mmc_blk_add_debugfs(card, md);
 
diff --git a/drivers/mmc/core/block.h b/drivers/mmc/core/block.h
index 31153f656f41..2a2b81635508 100644
--- a/drivers/mmc/core/block.h
+++ b/drivers/mmc/core/block.h
@@ -16,5 +16,8 @@ void mmc_blk_mq_recovery(struct mmc_queue *mq);
 struct work_struct;
 
 void mmc_blk_mq_complete_work(struct work_struct *work);
+#ifdef CONFIG_MMC_PSTORE
+sector_t mmc_blk_get_part(struct mmc_card *card, int part_num, sector_t *size);
+#endif
 
 #endif
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index d42037f0f10d..7cc3d81f6a9a 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -569,6 +569,30 @@ int mmc_cqe_recovery(struct mmc_host *host)
 }
 EXPORT_SYMBOL(mmc_cqe_recovery);
 
+
+#ifdef CONFIG_MMC_PSTORE
+/**
+ * mmc_wait_for_pstore_req - initiate a blocking mmc request
+ * @host: MMC host to start command
+ * @mrq: MMC request to start
+ *
+ * Start a new MMC custom command request for a host, and
+ * wait for the command to complete based on request data timeout.
+ */
+void mmc_wait_for_pstore_req(struct mmc_host *host, struct mmc_request *mrq)
+{
+   unsigned int timeout;
+
+   host->ops->req_cleanup_pending(host);
+   mmc_start_request(host, mrq);
+
+   if (mrq->data) {
+   timeout = mrq->data->timeout_ns / NSEC_PER_MSEC;
+   host->ops->req_completion_poll(host, timeout);
+   }
+}
+#endif
+
 /**
  * mmc_is_req_done - Determine if a 'cap_cmd_during_tfr' request is done
  * @host: MMC host
diff --git a/drivers/mmc/core/mmcpstore.c b/drivers/mmc/core/mmcpstore.c
new file 

[PATCH 0/1] Fix objects remain in the offline per-cpu quarantine

2020-11-11 Thread Kuan-Ying Lee
This patch fixes object remain in the offline per-cpu quarantine as
describe below.

Free objects will get into per-cpu quarantine if enable generic KASAN.
If a cpu is offline and users use kmem_cache_destroy, kernel will detect
objects still remain in the offline per-cpu quarantine and report error.

Register a cpu hotplug function to remove all objects in the offline
per-cpu quarantine when cpu is going offline. Set a per-cpu variable
to indicate this cpu is offline.

Kuan-Ying Lee (1):
  kasan: fix object remain in offline per-cpu quarantine

 mm/kasan/quarantine.c | 59 +--
 1 file changed, 57 insertions(+), 2 deletions(-)

-- 
2.18.0



[PATCH v1 2/2] mmc:cavium: Add MMC polling method to support kmsg panic/oops write

2020-11-11 Thread Bhaskara Budiredla
To enable the writing of panic and oops logs, a Cavium specific MMC
polling method is defined and thereby ensure the functioning of mmcpstore.

Signed-off-by: Bhaskara Budiredla 
---
 drivers/mmc/host/cavium-thunderx.c | 10 +
 drivers/mmc/host/cavium.c  | 67 ++
 drivers/mmc/host/cavium.h  |  3 ++
 3 files changed, 80 insertions(+)

diff --git a/drivers/mmc/host/cavium-thunderx.c 
b/drivers/mmc/host/cavium-thunderx.c
index 76013bbbcff3..efd3422939af 100644
--- a/drivers/mmc/host/cavium-thunderx.c
+++ b/drivers/mmc/host/cavium-thunderx.c
@@ -19,12 +19,22 @@
 
 static void thunder_mmc_acquire_bus(struct cvm_mmc_host *host)
 {
+#ifdef CONFIG_MMC_PSTORE
+   if (!host->pstore)
+   down(>mmc_serializer);
+#else
down(>mmc_serializer);
+#endif
 }
 
 static void thunder_mmc_release_bus(struct cvm_mmc_host *host)
 {
+#ifdef CONFIG_MMC_PSTORE
+   if (!host->pstore)
+   up(>mmc_serializer);
+#else
up(>mmc_serializer);
+#endif
 }
 
 static void thunder_mmc_int_enable(struct cvm_mmc_host *host, u64 val)
diff --git a/drivers/mmc/host/cavium.c b/drivers/mmc/host/cavium.c
index c5da3aaee334..8f62f6612ac0 100644
--- a/drivers/mmc/host/cavium.c
+++ b/drivers/mmc/host/cavium.c
@@ -510,6 +510,66 @@ irqreturn_t cvm_mmc_interrupt(int irq, void *dev_id)
return IRQ_RETVAL(emm_int != 0);
 }
 
+#ifdef CONFIG_MMC_PSTORE
+static int cvm_req_completion_poll(struct mmc_host *host, unsigned long msecs)
+{
+   struct cvm_mmc_slot *slot = mmc_priv(host);
+   struct cvm_mmc_host *cvm_host = slot->host;
+   u64 emm_int;
+
+   while (msecs) {
+   emm_int = readq(cvm_host->base + MIO_EMM_INT(cvm_host));
+
+   if (emm_int & MIO_EMM_INT_DMA_DONE)
+   return 0;
+   else if (emm_int & MIO_EMM_INT_DMA_ERR)
+   return -EIO;
+   mdelay(1);
+   msecs--;
+   }
+
+   return -ETIMEDOUT;
+}
+
+static void cvm_req_cleanup_pending(struct mmc_host *host)
+{
+   struct cvm_mmc_slot *slot = mmc_priv(host);
+   struct cvm_mmc_host *cvm_host = slot->host;
+   u64 fifo_cfg;
+   u64 dma_cfg;
+   u64 emm_int;
+
+   cvm_host->pstore = 1;
+
+   /* Clear pending DMA FIFO queue */
+   fifo_cfg = readq(cvm_host->dma_base + MIO_EMM_DMA_FIFO_CFG(cvm_host));
+   if (FIELD_GET(MIO_EMM_DMA_FIFO_CFG_COUNT, fifo_cfg))
+   writeq(MIO_EMM_DMA_FIFO_CFG_CLR,
+   cvm_host->dma_base + MIO_EMM_DMA_FIFO_CFG(cvm_host));
+
+   /* Clear ongoing DMA, if there is any */
+   dma_cfg = readq(cvm_host->dma_base + MIO_EMM_DMA_CFG(cvm_host));
+   if (dma_cfg & MIO_EMM_DMA_CFG_EN) {
+   dma_cfg |= MIO_EMM_DMA_CFG_CLR;
+   writeq(dma_cfg, cvm_host->dma_base +
+   MIO_EMM_DMA_CFG(cvm_host));
+   do {
+   dma_cfg = readq(cvm_host->dma_base +
+   MIO_EMM_DMA_CFG(cvm_host));
+   } while (dma_cfg & MIO_EMM_DMA_CFG_EN);
+   }
+
+   /* Clear pending DMA interrupts */
+   emm_int = readq(cvm_host->base + MIO_EMM_INT(cvm_host));
+   if (emm_int)
+   writeq(emm_int, cvm_host->base + MIO_EMM_INT(cvm_host));
+
+   /* Clear prepared and yet to be fired DMA requests */
+   cvm_host->current_req = NULL;
+   cvm_host->dma_active = false;
+}
+#endif
+
 /*
  * Program DMA_CFG and if needed DMA_ADR.
  * Returns 0 on error, DMA address otherwise.
@@ -901,6 +961,10 @@ static const struct mmc_host_ops cvm_mmc_ops = {
.set_ios= cvm_mmc_set_ios,
.get_ro = mmc_gpio_get_ro,
.get_cd = mmc_gpio_get_cd,
+#ifdef CONFIG_MMC_PSTORE
+   .req_cleanup_pending = cvm_req_cleanup_pending,
+   .req_completion_poll = cvm_req_completion_poll,
+#endif
 };
 
 static void cvm_mmc_set_clock(struct cvm_mmc_slot *slot, unsigned int clock)
@@ -1058,6 +1122,9 @@ int cvm_mmc_of_slot_probe(struct device *dev, struct 
cvm_mmc_host *host)
slot->bus_id = id;
slot->cached_rca = 1;
 
+#ifdef CONFIG_MMC_PSTORE
+   host->pstore = 0;
+#endif
host->acquire_bus(host);
host->slot[id] = slot;
cvm_mmc_switch_to(slot);
diff --git a/drivers/mmc/host/cavium.h b/drivers/mmc/host/cavium.h
index f3eea5eaa678..b72dea9a81eb 100644
--- a/drivers/mmc/host/cavium.h
+++ b/drivers/mmc/host/cavium.h
@@ -75,6 +75,9 @@ struct cvm_mmc_host {
spinlock_t irq_handler_lock;
struct semaphore mmc_serializer;
 
+#ifdef CONFIG_MMC_PSTORE
+   bool pstore;
+#endif
struct gpio_desc *global_pwr_gpiod;
atomic_t shared_power_users;
 
-- 
2.17.1



[PATCH v1 0/2] mmc: support crash logging to MMC block devices

2020-11-11 Thread Bhaskara Budiredla
This patch introduces to mmcpstore.

Bhaskara Budiredla (2):
  mmc: Support kmsg dumper based on pstore/blk
  mmc:cavium: Add MMC polling method to support kmsg panic/oops write

 drivers/mmc/core/Kconfig   |   7 +
 drivers/mmc/core/Makefile  |   1 +
 drivers/mmc/core/block.c   |  20 ++
 drivers/mmc/core/block.h   |   3 +
 drivers/mmc/core/core.c|  24 +++
 drivers/mmc/core/mmcpstore.c   | 318 +
 drivers/mmc/host/cavium-thunderx.c |  10 +
 drivers/mmc/host/cavium.c  |  67 ++
 drivers/mmc/host/cavium.h  |   3 +
 include/linux/mmc/card.h   |   4 +
 include/linux/mmc/core.h   |   4 +
 include/linux/mmc/host.h   |   6 +
 12 files changed, 467 insertions(+)
 create mode 100644 drivers/mmc/core/mmcpstore.c

-- 
2.17.1



[PATCH 1/1] kasan: fix object remain in offline per-cpu quarantine

2020-11-11 Thread Kuan-Ying Lee
We hit this issue in our internal test.
When enabling generic kasan, a kfree()'d object is put into per-cpu
quarantine first. If the cpu goes offline, object still remains in
the per-cpu quarantine. If we call kmem_cache_destroy() now, slub
will report "Objects remaining" error.

[   74.982625] 
=
[   74.983380] BUG test_module_slab (Not tainted): Objects remaining in 
test_module_slab on __kmem_cache_shutdown()
[   74.984145] 
-
[   74.984145]
[   74.984883] Disabling lock debugging due to kernel taint
[   74.985561] INFO: Slab 0x(ptrval) objects=34 used=1 
fp=0x(ptrval) flags=0x20010200
[   74.986638] CPU: 3 PID: 176 Comm: cat Tainted: GB 
5.10.0-rc1-7-g4525c8781ec0-dirty #10
[   74.987262] Hardware name: linux,dummy-virt (DT)
[   74.987606] Call trace:
[   74.987924]  dump_backtrace+0x0/0x2b0
[   74.988296]  show_stack+0x18/0x68
[   74.988698]  dump_stack+0xfc/0x168
[   74.989030]  slab_err+0xac/0xd4
[   74.989346]  __kmem_cache_shutdown+0x1e4/0x3c8
[   74.989779]  kmem_cache_destroy+0x68/0x130
[   74.990176]  test_version_show+0x84/0xf0
[   74.990679]  module_attr_show+0x40/0x60
[   74.991218]  sysfs_kf_seq_show+0x128/0x1c0
[   74.991656]  kernfs_seq_show+0xa0/0xb8
[   74.992059]  seq_read+0x1f0/0x7e8
[   74.992415]  kernfs_fop_read+0x70/0x338
[   74.993051]  vfs_read+0xe4/0x250
[   74.993498]  ksys_read+0xc8/0x180
[   74.993825]  __arm64_sys_read+0x44/0x58
[   74.994203]  el0_svc_common.constprop.0+0xac/0x228
[   74.994708]  do_el0_svc+0x38/0xa0
[   74.995088]  el0_sync_handler+0x170/0x178
[   74.995497]  el0_sync+0x174/0x180
[   74.996050] INFO: Object 0x(ptrval) @offset=15848
[   74.996752] INFO: Allocated in test_version_show+0x98/0xf0 age=8188 cpu=6 
pid=172
[   75.000802]  stack_trace_save+0x9c/0xd0
[   75.002420]  set_track+0x64/0xf0
[   75.002770]  alloc_debug_processing+0x104/0x1a0
[   75.003171]  ___slab_alloc+0x628/0x648
[   75.004213]  __slab_alloc.isra.0+0x2c/0x58
[   75.004757]  kmem_cache_alloc+0x560/0x588
[   75.005376]  test_version_show+0x98/0xf0
[   75.005756]  module_attr_show+0x40/0x60
[   75.007035]  sysfs_kf_seq_show+0x128/0x1c0
[   75.007433]  kernfs_seq_show+0xa0/0xb8
[   75.007800]  seq_read+0x1f0/0x7e8
[   75.008128]  kernfs_fop_read+0x70/0x338
[   75.008507]  vfs_read+0xe4/0x250
[   75.008990]  ksys_read+0xc8/0x180
[   75.009462]  __arm64_sys_read+0x44/0x58
[   75.010085]  el0_svc_common.constprop.0+0xac/0x228
[   75.011006] kmem_cache_destroy test_module_slab: Slab cache still has objects

Register a cpu hotplug function to remove all objects in the offline
per-cpu quarantine when cpu is going offline. Set a per-cpu variable
to indicate this cpu is offline.

Signed-off-by: Kuan-Ying Lee 
---
 mm/kasan/quarantine.c | 59 +--
 1 file changed, 57 insertions(+), 2 deletions(-)

diff --git a/mm/kasan/quarantine.c b/mm/kasan/quarantine.c
index 4c5375810449..67fb91ae2bd0 100644
--- a/mm/kasan/quarantine.c
+++ b/mm/kasan/quarantine.c
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "../slab.h"
 #include "kasan.h"
@@ -97,6 +98,7 @@ static void qlist_move_all(struct qlist_head *from, struct 
qlist_head *to)
  * guarded by quarantine_lock.
  */
 static DEFINE_PER_CPU(struct qlist_head, cpu_quarantine);
+static DEFINE_PER_CPU(int, cpu_quarantine_offline);
 
 /* Round-robin FIFO array of batches. */
 static struct qlist_head global_quarantine[QUARANTINE_BATCHES];
@@ -176,6 +178,8 @@ void quarantine_put(struct kasan_free_meta *info, struct 
kmem_cache *cache)
unsigned long flags;
struct qlist_head *q;
struct qlist_head temp = QLIST_INIT;
+   int *offline;
+   struct qlist_head q_offline = QLIST_INIT;
 
/*
 * Note: irq must be disabled until after we move the batch to the
@@ -187,8 +191,16 @@ void quarantine_put(struct kasan_free_meta *info, struct 
kmem_cache *cache)
 */
local_irq_save(flags);
 
-   q = this_cpu_ptr(_quarantine);
-   qlist_put(q, >quarantine_link, cache->size);
+   offline = this_cpu_ptr(_quarantine_offline);
+   if (*offline == 0) {
+   q = this_cpu_ptr(_quarantine);
+   qlist_put(q, >quarantine_link, cache->size);
+   } else {
+   qlist_put(_offline, >quarantine_link, cache->size);
+   qlist_free_all(_offline, cache);
+   local_irq_restore(flags);
+   return;
+   }
if (unlikely(q->bytes > QUARANTINE_PERCPU_SIZE)) {
qlist_move_all(q, );
 
@@ -328,3 +340,46 @@ void quarantine_remove_cache(struct kmem_cache *cache)
 
synchronize_srcu(_cache_srcu);
 }
+
+static int kasan_cpu_online(unsigned int cpu)
+{
+   int *offline;
+   unsigned long flags;
+
+   local_irq_save(flags);
+   offline = 

Re: [RFC] Are you good with Lockdep?

2020-11-11 Thread Byungchul Park
On Wed, Nov 11, 2020 at 11:54:41AM +0100, Ingo Molnar wrote:
> > We cannot get reported other than the first one.
> 
> Correct. Experience has shown that the overwhelming majority of 
> lockdep reports are single-cause and single-report.
> 
> This is an optimal approach, because after a decade of exorcising 
> locking bugs from the kernel, lockdep is currently, most of the time, 

I also think Lockdep has been doing great job exorcising almost all
locking bugs so far. Respect it.

> in 'steady-state', with there being no reports for the overwhelming 
> majority of testcases, so the statistical probability of there being 
> just one new report is by far the highest.

This is true if Lockdep is only for checking if maintainers' tree are
ok and if we totally ignore how a tool could help folks in the middle of
development esp. when developing something complicated wrt.
synchronization.

But I don't agree if a tool could help while developing something that
could introduce many dependency issues.

> If on the other hand there's some bug in lockdep itself that causes 
> excessive false positives, it's better to limit the number of reports 
> to one per bootup, so that it's not seen as a nuisance debugging 
> facility.
> 
> Or if lockdep gets extended that causes multiple previously unreported 
> (but very much real) bugs to be reported, it's *still* better to 
> handle them one by one: because lockdep doesn't know whether it's real 

Why do you think we cannot handle them one by one with multi-reporting?
We can handle them with the first one as we do with single-reporting.
And also that's how we work, for example, when building the kernel or
somethinig.

> >So the one who has introduced the first one should fix it as soon 
> >as possible so that the other problems can be reported and fixed. 
> >It will get even worse if it's a false positive because it's 
> >worth nothing but only preventing reporting real ones.
> 
> Since kernel development is highly distributed, and 90%+ of new 
> commits get created in dozens of bigger and hundreds of smaller 
> maintainer topic trees, the chance of getting two independent locking 
> bugs in the same tree without the first bug being found & fixed is 
> actually pretty low.

Again, this is true if Lockdep is for checking maintainers' tree only.

> linux-next offers several weeks/months advance integration testing to 
> see whether the combination of maintainer trees causes 
> problems/warnings.

Good for us.

> >That's why kernel developers are so sensitive to Lockdep's false
> >positive reporting - I would, too. But precisely speaking, it's a
> >problem of how Lockdep was designed and implemented, not false
> >positive itself. Annoying false positives - as WARN()'s messages are
> >annoying - should be fixed but we don't have to be as sensitive as we
> >are now if the tool keeps normally working even after reporting.
> 
> I disagree, and even for WARN()s we are seeing a steady movement 
> towards WARN_ON_ONCE(): exactly because developers are usually 
> interested in the first warning primarily.
> 
> Followup warnings are even marked 'tainted' by the kernel - if a bug 
> happened we cannot trust the state of the kernel anymore, even if it 
> seems otherwise functional. This is doubly true for lockdep, where 

I definitely think so. Already tainted kernel is not the kernel we can
trust anymore. Again, IMO, a tool should help us not only for checking
almost final trees but also in developing something. No?

> But for lockdep there's another concern: we do occasionally report 
> bugs in locking facilities themselves. In that case it's imperative 
> for all lockdep activity to cease & desist, so that we are able to get 
> a log entry out before the kernel goes down potentially.

Sure. Makes sense.

> I.e. there's a "race to log the bug as quickly as possible", which is 
> the other reason we shut down lockdep immediately. But once shut down, 

Not sure I understand this part.

> all the lockdep data structures are hopelessly out of sync and it 
> cannot be restarted reasonably.

Is it about tracking IRQ and IRQ-enabled state? That's exactly what I'd
like to point out. Or is there something else?

> Not sure I understand the "problem 2)" outlined here, but I'm looking 
> forward to your patchset!

Thank you for the response.

Thanks,
Byungchul


Re: Scheduler wakeup path tuning surface: Interface discussion

2020-11-11 Thread Parth Shah
I was analyzing LPC 2020 discussion regarding Latency-nice interface and
have below points to initiate further discussion:

1. There was consensus that having interface like "Latency-nice" to
provide scheduler hints about task latency requirement can be very useful.

2. There are two use-case regarding the change in the number of CPUs to
be searched in select_idle_cpu path:
- milli-seconds optimization: Perform more scans to find idle CPUs to
reduce latency in milliseconds
- micro-seconds optimization: Perform less searches and queue it to any
CPU when system is overloaded

Both these optimization are contradictory since one requires to reduce
search space for latency sensitive task while other wants to increase
it. Though we can think about tuning select_idle_cpu path by keeping
mask of idle CPUs or applying other tricks, it will always be a
trade-off to search more or less and that's where latency-nice like
attribute can be useful for task aware decisions.

3. Using range is non-deterministic, meaning it is difficult to classify
a task should be marked with value of -18 or -19 and there will be
non-deterministic impact on system performance between these values.

And that's where should we even think of using "Flags" or other type
instead of range where we just say if a task is latency-sensitive or not
and won't classify if a task is "relatively" latency-nice than others?


Best,
Parth


Re: bootconfig length parse error in kernel

2020-11-11 Thread Masami Hiramatsu
Hi Chen,

On Thu, 12 Nov 2020 12:34:36 +0800
Chen Yu  wrote:

> Hi Masami,
> 
> On Wed, Nov 11, 2020 at 5:37 PM Masami Hiramatsu  wrote:
> >
> > Hi Chen,
> >
> > On Tue, 10 Nov 2020 23:39:53 +0800
> > Chen Yu  wrote:
> >
> > > Hi Masami,
> > > Thanks for writing bootconfig and it is useful for boot up trace event
> > > debugging.
> >
> > Thanks for testing!
> >
> > > However it was found that on 5.10-rc2 the bootconfig does not work and it 
> > > shows
> > > "'bootconfig' found on command line, but no bootconfig found"
> > > And the reason for this is the kernel found the magic number to be 
> > > incorrect.
> > > I've added some hack in kernel to dump the first 12 bytes, it shows:
> > > "OTCONFIG". So printed more content ahead we can find
> > > "#BOOTCONFIG" ahead. So it looks that there is some alignment during
> > > initrd load, and get_boot_config_from_initrd() might also deal with it. 
> > > That is
> > > to say:
> > > data = (char *)initrd_end - BOOTCONFIG_MAGIC_LEN;
> > > might do some alignment?
> >
> > Hrm, interesting. So initrd_end might be aligned. Could you print out the
> > actuall address of initrd_end?
> I've done some investigation, it looks like this issue is not related
> to alignment, but related to
> the bootloader that has provided an inaccurate ramdisk size via
> boot_params.hdr.ramdisk_size.

Yeah, it seems to happen. bootloader can pass wrong (bigger) size
to kernel. BTW, what bootloader would you use?

> The actual size of initrd is:
> ls /boot/initrd.img-5.10.0-rc3-e1000e-hw+ -l
> -rw-r--r-- 1 root root 48689230 11月 12 00:08
> /boot/initrd.img-5.10.0-rc3-e1000e-hw+
> while the ramdisk size provided by bootloader via
> boot_params.hdr.ramdisk_size is
> 48689232, which is 2 bytes bigger than the actual size, and this is
> why the initrd_end
> is bigger than expected and causing the missmatch of magic number.

OK. It seems that the bootloader might cut it up to 16 bytes
aligned. (But I think that's wrong behavior, there is no reason
to do it)

> Since there is no guarantee that bootloader provides the accurate
> ramdisk size, an compromised
> proposal might be that to search for the magic number a little ahead.

If the bootloader does such wrong behavior, there is no guarantee
that the size is "a little" bigger. IOW, it can be aligned to the
page size (4KB-)

> For example, the
> following patch works for me:
> diff --git a/init/main.c b/init/main.c
> index 130376ec10ba..60fb125d44f4 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -273,7 +273,10 @@ static void * __init
> get_boot_config_from_initrd(u32 *_size, u32 *_csum)
> if (!initrd_end)
> return NULL;
> 
> -   data = (char *)initrd_end - BOOTCONFIG_MAGIC_LEN;
> +   data = memchr((char *)initrd_end - 2 * BOOTCONFIG_MAGIC_LEN,
> +  '#', BOOTCONFIG_MAGIC_LEN);
> +   if (!data)
> +   return NULL;

So this also does not guarantee that we can find "#" in BOOTCONFIG_MAGIC_LEN.
We need to find actual code in the bootloader, what it does.

> if (memcmp(data, BOOTCONFIG_MAGIC, BOOTCONFIG_MAGIC_LEN))
> return NULL;
> 
> 
> > And could you tell me which platform are you tested?
> >
> It is HP ZHAN 99 Mobile Workstation G1 with i5-8300H, Ubuntu 20.04.

Hmm, this means x86 Grub2 does this change. Let me check it.

Thank you,


-- 
Masami Hiramatsu 


Re: [PATCH 0/4] ARM: dts: aspeed: Add Facebook Galaxy100 BMC

2020-11-11 Thread Joel Stanley
On Thu, 12 Nov 2020 at 03:18, Patrick Williams  wrote:
>
> On Wed, Nov 11, 2020 at 11:34:10PM +, Joel Stanley wrote:
> > On Wed, 11 Nov 2020 at 23:23,  wrote:
> > >
> > > From: Tao Ren 
> > >
> > > The patch series adds the initial version of device tree for Facebook
> > > Galaxy100 (AST2400) BMC.
> > >
> > > Patch #1 adds common dtsi to minimize duplicated device entries across
> > > Facebook Network AST2400 BMC device trees.
> > >
> > > Patch #2 simplfies Wedge40 device tree by using the common dtsi.
> > >
> > > Patch #3 simplfies Wedge100 device tree by using the common dtsi.
> > >
> > > Patch #4 adds the initial version of device tree for Facebook Galaxy100
> > > BMC.
> >
> > Nice. They look good to me.
> >
> > Reviewed-by: Joel Stanley 
> >
> > Is there another person familiar with the design you would like to
> > review before I merge?
>
> Also,
>
> Reviewed-by: Patrick Williams 

Thanks. I have merged them into the aspeed tree for 5.11.

Cheers,

Joel


[PATCH v13 4/6] fpga: dfl: move dfl bus related APIs to include/linux/dfl.h

2020-11-11 Thread Xu Yilun
Now the dfl drivers could be made as independent modules and put in
different folders according to their functionalities. In order for
scattered dfl device drivers to include dfl bus APIs, move the
dfl bus APIs to a new header file in the public folder.

[m...@kernel.org: Fixed up header guards to match filename]
Signed-off-by: Xu Yilun 
Reviewed-by: Tom Rix 
Acked-by: Wu Hao 
Signed-off-by: Moritz Fischer 
---
v2: updated the MAINTAINERS under FPGA DFL DRIVERS
improve the comments
rename the dfl-bus.h to dfl.h
v3: rebase the patch for previous changes
v9: rebase the patch for bus name changes back to "dfl"
v10: move the head file from inlude/linux/fpga to include/linux
v11: no change
v12: Fixed up header guards to match filename by Moritz
v13: no change
---
 MAINTAINERS |  1 +
 drivers/fpga/dfl.c  |  1 +
 drivers/fpga/dfl.h  | 72 
 include/linux/dfl.h | 86 +
 4 files changed, 88 insertions(+), 72 deletions(-)
 create mode 100644 include/linux/dfl.h

diff --git a/MAINTAINERS b/MAINTAINERS
index e73636b..9bbb378 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6886,6 +6886,7 @@ S:Maintained
 F: Documentation/ABI/testing/sysfs-bus-dfl
 F: Documentation/fpga/dfl.rst
 F: drivers/fpga/dfl*
+F: include/linux/dfl.h
 F: include/uapi/linux/fpga-dfl.h
 
 FPGA MANAGER FRAMEWORK
diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c
index 5a6ba3b..511b20f 100644
--- a/drivers/fpga/dfl.c
+++ b/drivers/fpga/dfl.c
@@ -10,6 +10,7 @@
  *   Wu Hao 
  *   Xiao Guangrong 
  */
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/fpga/dfl.h b/drivers/fpga/dfl.h
index 549c790..2b82c96 100644
--- a/drivers/fpga/dfl.h
+++ b/drivers/fpga/dfl.h
@@ -517,76 +517,4 @@ long dfl_feature_ioctl_set_irq(struct platform_device 
*pdev,
   struct dfl_feature *feature,
   unsigned long arg);
 
-/**
- * enum dfl_id_type - define the DFL FIU types
- */
-enum dfl_id_type {
-   FME_ID = 0,
-   PORT_ID = 1,
-   DFL_ID_MAX,
-};
-
-/**
- * struct dfl_device - represent an dfl device on dfl bus
- *
- * @dev: generic device interface.
- * @id: id of the dfl device.
- * @type: type of DFL FIU of the device. See enum dfl_id_type.
- * @feature_id: feature identifier local to its DFL FIU type.
- * @mmio_res: mmio resource of this dfl device.
- * @irqs: list of Linux IRQ numbers of this dfl device.
- * @num_irqs: number of IRQs supported by this dfl device.
- * @cdev: pointer to DFL FPGA container device this dfl device belongs to.
- * @id_entry: matched id entry in dfl driver's id table.
- */
-struct dfl_device {
-   struct device dev;
-   int id;
-   u16 type;
-   u16 feature_id;
-   struct resource mmio_res;
-   int *irqs;
-   unsigned int num_irqs;
-   struct dfl_fpga_cdev *cdev;
-   const struct dfl_device_id *id_entry;
-};
-
-/**
- * struct dfl_driver - represent an dfl device driver
- *
- * @drv: driver model structure.
- * @id_table: pointer to table of device IDs the driver is interested in.
- *   { } member terminated.
- * @probe: mandatory callback for device binding.
- * @remove: callback for device unbinding.
- */
-struct dfl_driver {
-   struct device_driver drv;
-   const struct dfl_device_id *id_table;
-
-   int (*probe)(struct dfl_device *dfl_dev);
-   void (*remove)(struct dfl_device *dfl_dev);
-};
-
-#define to_dfl_dev(d) container_of(d, struct dfl_device, dev)
-#define to_dfl_drv(d) container_of(d, struct dfl_driver, drv)
-
-/*
- * use a macro to avoid include chaining to get THIS_MODULE.
- */
-#define dfl_driver_register(drv) \
-   __dfl_driver_register(drv, THIS_MODULE)
-int __dfl_driver_register(struct dfl_driver *dfl_drv, struct module *owner);
-void dfl_driver_unregister(struct dfl_driver *dfl_drv);
-
-/*
- * module_dfl_driver() - Helper macro for drivers that don't do
- * anything special in module init/exit.  This eliminates a lot of
- * boilerplate.  Each module may only use this macro once, and
- * calling it replaces module_init() and module_exit().
- */
-#define module_dfl_driver(__dfl_driver) \
-   module_driver(__dfl_driver, dfl_driver_register, \
- dfl_driver_unregister)
-
 #endif /* __FPGA_DFL_H */
diff --git a/include/linux/dfl.h b/include/linux/dfl.h
new file mode 100644
index 000..6cc1098
--- /dev/null
+++ b/include/linux/dfl.h
@@ -0,0 +1,86 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Header file for DFL driver and device API
+ *
+ * Copyright (C) 2020 Intel Corporation, Inc.
+ */
+
+#ifndef __LINUX_DFL_H
+#define __LINUX_DFL_H
+
+#include 
+#include 
+
+/**
+ * enum dfl_id_type - define the DFL FIU types
+ */
+enum dfl_id_type {
+   FME_ID = 0,
+   PORT_ID = 1,
+   DFL_ID_MAX,
+};
+
+/**
+ * struct dfl_device - represent an dfl device on dfl bus
+ *
+ * @dev: generic device interface.
+ * @id: id 

[PATCH v13 1/6] fpga: dfl: fix the definitions of type & feature_id for dfl devices

2020-11-11 Thread Xu Yilun
The value of the field dfl_device.type comes from the 12 bits register
field DFH_ID according to DFL spec. So this patch changes the definition
of the type field to u16.

Also it is not necessary to illustrate the valid bits of the type field
in comments. Instead we should explicitly define the possible values in
the enumeration type for it, because they are shared by hardware spec.
We should not let the compiler decide these values.

Similar changes are also applied to dfl_device.feature_id.

This patch also fixed the MODALIAS format according to the changes
above.

Signed-off-by: Xu Yilun 
Reviewed-by: Tom Rix 
Signed-off-by: Moritz Fischer 
---
v9: no change
v10: no change
v11: no change
v12: no change
v13: no change
---
 drivers/fpga/dfl.c |  3 +--
 drivers/fpga/dfl.h | 14 +++---
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c
index b450870..5a6ba3b 100644
--- a/drivers/fpga/dfl.c
+++ b/drivers/fpga/dfl.c
@@ -298,8 +298,7 @@ static int dfl_bus_uevent(struct device *dev, struct 
kobj_uevent_env *env)
 {
struct dfl_device *ddev = to_dfl_dev(dev);
 
-   /* The type has 4 valid bits and feature_id has 12 valid bits */
-   return add_uevent_var(env, "MODALIAS=dfl:t%01Xf%03X",
+   return add_uevent_var(env, "MODALIAS=dfl:t%04Xf%04X",
  ddev->type, ddev->feature_id);
 }
 
diff --git a/drivers/fpga/dfl.h b/drivers/fpga/dfl.h
index 5dc758f..ac373b1 100644
--- a/drivers/fpga/dfl.h
+++ b/drivers/fpga/dfl.h
@@ -520,19 +520,19 @@ long dfl_feature_ioctl_set_irq(struct platform_device 
*pdev,
  * enum dfl_id_type - define the DFL FIU types
  */
 enum dfl_id_type {
-   FME_ID,
-   PORT_ID,
+   FME_ID = 0,
+   PORT_ID = 1,
DFL_ID_MAX,
 };
 
 /**
  * struct dfl_device_id -  dfl device identifier
- * @type: contains 4 bits DFL FIU type of the device. See enum dfl_id_type.
- * @feature_id: contains 12 bits feature identifier local to its DFL FIU type.
+ * @type: DFL FIU type of the device. See enum dfl_id_type.
+ * @feature_id: feature identifier local to its DFL FIU type.
  * @driver_data: driver specific data.
  */
 struct dfl_device_id {
-   u8 type;
+   u16 type;
u16 feature_id;
unsigned long driver_data;
 };
@@ -543,7 +543,7 @@ struct dfl_device_id {
  * @dev: generic device interface.
  * @id: id of the dfl device.
  * @type: type of DFL FIU of the device. See enum dfl_id_type.
- * @feature_id: 16 bits feature identifier local to its DFL FIU type.
+ * @feature_id: feature identifier local to its DFL FIU type.
  * @mmio_res: mmio resource of this dfl device.
  * @irqs: list of Linux IRQ numbers of this dfl device.
  * @num_irqs: number of IRQs supported by this dfl device.
@@ -553,7 +553,7 @@ struct dfl_device_id {
 struct dfl_device {
struct device dev;
int id;
-   u8 type;
+   u16 type;
u16 feature_id;
struct resource mmio_res;
int *irqs;
-- 
2.7.4



[PATCH v13 6/6] memory: dfl-emif: add the DFL EMIF private feature driver

2020-11-11 Thread Xu Yilun
This driver is for the EMIF private feature implemented under FPGA
Device Feature List (DFL) framework. It is used to expose memory
interface status information as well as memory clearing control.

The purpose of memory clearing block is to zero out all private memory
when FPGA is to be reprogrammed. This gives users a reliable method to
prevent potential data leakage.

Signed-off-by: Xu Yilun 
Signed-off-by: Russ Weight 
Reviewed-by: Tom Rix 
Acked-by: Krzysztof Kozlowski 
---
v2: Adjust the position of this driver in Kconfig.
Improves the name of the Kconfig option.
Change the include dfl-bus.h to dfl.h, cause the previous patchset
 renames the file.
Some minor fixes and comment improvement.
v3: Adjust the position of the driver in Makefile.
v9: Add static prefix for emif attributes macro.
Update the kernel version of the sysfs interfaces in Doc.
v10: Rebase due to the dfl head file moves to include/linux.
v11: Use sysfs_emit instead of sprintf.
 Rebase to rebase to 5.10-rc1.
v12: no change.
v13: no change.
---
 .../ABI/testing/sysfs-bus-dfl-devices-emif |  25 +++
 drivers/memory/Kconfig |   9 +
 drivers/memory/Makefile|   2 +
 drivers/memory/dfl-emif.c  | 207 +
 4 files changed, 243 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-dfl-devices-emif
 create mode 100644 drivers/memory/dfl-emif.c

diff --git a/Documentation/ABI/testing/sysfs-bus-dfl-devices-emif 
b/Documentation/ABI/testing/sysfs-bus-dfl-devices-emif
new file mode 100644
index 000..1ae8ebd
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-bus-dfl-devices-emif
@@ -0,0 +1,25 @@
+What:  /sys/bus/dfl/devices/dfl_dev.X/infX_cal_fail
+Date:  Oct 2020
+KernelVersion: 5.11
+Contact:   Xu Yilun 
+Description:   Read-only. It indicates if the calibration failed on this
+   memory interface. "1" for calibration failure, "0" for OK.
+   Format: %u
+
+What:  /sys/bus/dfl/devices/dfl_dev.X/infX_init_done
+Date:  Oct 2020
+KernelVersion: 5.11
+Contact:   Xu Yilun 
+Description:   Read-only. It indicates if the initialization completed on
+   this memory interface. "1" for initialization complete, "0"
+   for not yet.
+   Format: %u
+
+What:  /sys/bus/dfl/devices/dfl_dev.X/infX_clear
+Date:  Oct 2020
+KernelVersion: 5.11
+Contact:   Xu Yilun 
+Description:   Write-only. Writing "1" to this file will zero out all memory
+   data in this memory interface. Writing of other values is
+   invalid.
+   Format: %u
diff --git a/drivers/memory/Kconfig b/drivers/memory/Kconfig
index 00e013b..2495bc4 100644
--- a/drivers/memory/Kconfig
+++ b/drivers/memory/Kconfig
@@ -137,6 +137,15 @@ config TI_EMIF_SRAM
  sequence so this driver provides several relocatable PM functions
  for the SoC PM code to use.
 
+config FPGA_DFL_EMIF
+   tristate "FPGA DFL EMIF Driver"
+   depends on FPGA_DFL && HAS_IOMEM
+   help
+ This driver is for the EMIF private feature implemented under
+ FPGA Device Feature List (DFL) framework. It is used to expose
+ memory interface status information as well as memory clearing
+ control.
+
 config MVEBU_DEVBUS
bool "Marvell EBU Device Bus Controller"
default y if PLAT_ORION
diff --git a/drivers/memory/Makefile b/drivers/memory/Makefile
index e71cf7b..bc7663e 100644
--- a/drivers/memory/Makefile
+++ b/drivers/memory/Makefile
@@ -28,6 +28,8 @@ obj-$(CONFIG_STM32_FMC2_EBI)  += stm32-fmc2-ebi.o
 obj-$(CONFIG_SAMSUNG_MC)   += samsung/
 obj-$(CONFIG_TEGRA_MC) += tegra/
 obj-$(CONFIG_TI_EMIF_SRAM) += ti-emif-sram.o
+obj-$(CONFIG_FPGA_DFL_EMIF)+= dfl-emif.o
+
 ti-emif-sram-objs  := ti-emif-pm.o ti-emif-sram-pm.o
 
 AFLAGS_ti-emif-sram-pm.o   :=-Wa,-march=armv7-a
diff --git a/drivers/memory/dfl-emif.c b/drivers/memory/dfl-emif.c
new file mode 100644
index 000..3f71981
--- /dev/null
+++ b/drivers/memory/dfl-emif.c
@@ -0,0 +1,207 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * DFL device driver for EMIF private feature
+ *
+ * Copyright (C) 2020 Intel Corporation, Inc.
+ *
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define FME_FEATURE_ID_EMIF0x9
+
+#define EMIF_STAT  0x8
+#define EMIF_STAT_INIT_DONE_SFT0
+#define EMIF_STAT_CALC_FAIL_SFT8
+#define EMIF_STAT_CLEAR_BUSY_SFT   16
+#define EMIF_CTRL  0x10
+#define EMIF_CTRL_CLEAR_EN_SFT 0
+#define EMIF_CTRL_CLEAR_EN_MSK GENMASK_ULL(3, 0)
+
+#define EMIF_POLL_INVL 1 /* us */
+#define EMIF_POLL_TIMEOUT  500 /* us */
+
+struct dfl_emif {
+   struct device *dev;
+   void 

[PATCH v13 2/6] fpga: dfl: move dfl_device_id to mod_devicetable.h

2020-11-11 Thread Xu Yilun
In order to support MODULE_DEVICE_TABLE() for dfl device driver, this
patch moves struct dfl_device_id to mod_devicetable.h

Some brief description for DFL (Device Feature List) is added to make
the DFL known to the whole kernel.

Signed-off-by: Xu Yilun 
Signed-off-by: Wu Hao 
Signed-off-by: Matthew Gerlach 
Signed-off-by: Russ Weight 
Reviewed-by: Tom Rix 
Acked-by: Wu Hao 
Signed-off-by: Moritz Fischer 
---
v2: fix the order for the header file
v3: rebase the patch for dfl bus name change
v9: rebase the patch for dfl bus name changes back to "dfl"
v10: add some comments to describe what is DFL
v11: no change
v12: fix the type of driver_data from unsigned long to kernel_ulong_t
v13: no change
---
 drivers/fpga/dfl.h  | 13 +
 include/linux/mod_devicetable.h | 24 
 2 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/drivers/fpga/dfl.h b/drivers/fpga/dfl.h
index ac373b1..549c790 100644
--- a/drivers/fpga/dfl.h
+++ b/drivers/fpga/dfl.h
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -526,18 +527,6 @@ enum dfl_id_type {
 };
 
 /**
- * struct dfl_device_id -  dfl device identifier
- * @type: DFL FIU type of the device. See enum dfl_id_type.
- * @feature_id: feature identifier local to its DFL FIU type.
- * @driver_data: driver specific data.
- */
-struct dfl_device_id {
-   u16 type;
-   u16 feature_id;
-   unsigned long driver_data;
-};
-
-/**
  * struct dfl_device - represent an dfl device on dfl bus
  *
  * @dev: generic device interface.
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 5b08a47..7d36c8c 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -838,4 +838,28 @@ struct mhi_device_id {
kernel_ulong_t driver_data;
 };
 
+/*
+ * DFL (Device Feature List)
+ *
+ * DFL defines a linked list of feature headers within the device MMIO space to
+ * provide an extensible way of adding features. Software can walk through 
these
+ * predefined data structures to enumerate features. It is now used in the 
FPGA.
+ * See Documentation/fpga/dfl.rst for more information.
+ *
+ * The dfl bus type is introduced to match the individual feature devices (dfl
+ * devices) for specific dfl drivers.
+ */
+
+/**
+ * struct dfl_device_id -  dfl device identifier
+ * @type: DFL FIU type of the device. See enum dfl_id_type.
+ * @feature_id: feature identifier local to its DFL FIU type.
+ * @driver_data: driver specific data.
+ */
+struct dfl_device_id {
+   __u16 type;
+   __u16 feature_id;
+   kernel_ulong_t driver_data;
+};
+
 #endif /* LINUX_MOD_DEVICETABLE_H */
-- 
2.7.4



[PATCH v13 0/6] add DFL bus support to MODULE_DEVICE_TABLE()

2020-11-11 Thread Xu Yilun
Main changes from v1: 
- A new patch (Patch #3) to fix the description.
- Rename the dfl-bus.h to dfl.h
- Updated the MAINTAINERS under FPGA DFL DRIVERS.
- Improve comments and minor fixes.

Main changes from v2: 
- Change the bus name from "dfl" to "fpga-dfl", also rename related
  variables, functions ... 
- Changes the data type of fpga_dfl_device_id.type from u8 to u16 
- Explicitly defines the values of enum fpga_dfl_id_type
- Delete the comments for the valid bits of type & feature_id
- changes MODALIAS format for fpga dfl devices

Main changes from v3: 
- Change the bus name back to "dfl".
- Add 2 patches (#5, 6) for dfl drivers.
- Delete the retimer FEC mode configuration via module_parameter for 
  Patch #5
- Merge the patch "Make m10_n3000_info static" 
(https://lore.kernel.org/linux-fpga/52d8411e-13d8-1e91-756d-131802f5f...@huawei.com/T/#t)
  into Patch #5
- Add static prefix for emif attributes macro for Patch #6

Main changes from v9:
- Add the description for struct dfl_device_id in mod_devicetable.h
- Move the dfl.h from include/linux/fpga to include/linux
- some code refactor and minor fixes for dfl-n3000-nios

Main changes from v10:
- use sysfs_emit instead of sprintf for both patches
- rebase to 5.10-rc1

Main changes from v11:
- Fix the type of driver_data from unsigned long to kernel_ulong_t
- Fixed up header guards to match filename by Moritz
- move the MODULE_DEVICE_TABLE() right after its definition

Main changes from v12:
- For patch #5, fix the wrong use of logical'||', should use '|'

Xu Yilun (6):
  fpga: dfl: fix the definitions of type & feature_id for dfl devices
  fpga: dfl: move dfl_device_id to mod_devicetable.h
  fpga: dfl: add dfl bus support to MODULE_DEVICE_TABLE()
  fpga: dfl: move dfl bus related APIs to include/linux/dfl.h
  fpga: dfl: add support for N3000 Nios private feature
  memory: dfl-emif: add the DFL EMIF private feature driver

 .../ABI/testing/sysfs-bus-dfl-devices-emif |  25 +
 .../ABI/testing/sysfs-bus-dfl-devices-n3000-nios   |  47 ++
 MAINTAINERS|   3 +-
 drivers/fpga/Kconfig   |  11 +
 drivers/fpga/Makefile  |   2 +
 drivers/fpga/dfl-n3000-nios.c  | 588 +
 drivers/fpga/dfl.c |   4 +-
 drivers/fpga/dfl.h |  85 +--
 drivers/memory/Kconfig |   9 +
 drivers/memory/Makefile|   2 +
 drivers/memory/dfl-emif.c  | 207 
 include/linux/dfl.h|  86 +++
 include/linux/mod_devicetable.h|  24 +
 scripts/mod/devicetable-offsets.c  |   4 +
 scripts/mod/file2alias.c   |  13 +
 15 files changed, 1023 insertions(+), 87 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-dfl-devices-emif
 create mode 100644 Documentation/ABI/testing/sysfs-bus-dfl-devices-n3000-nios
 create mode 100644 drivers/fpga/dfl-n3000-nios.c
 create mode 100644 drivers/memory/dfl-emif.c
 create mode 100644 include/linux/dfl.h

-- 
2.7.4



[PATCH v13 3/6] fpga: dfl: add dfl bus support to MODULE_DEVICE_TABLE()

2020-11-11 Thread Xu Yilun
Device Feature List (DFL) is a linked list of feature headers within the
device MMIO space. It is used by FPGA to enumerate multiple sub features
within it. Each feature can be uniquely identified by DFL type and
feature id, which can be read out from feature headers.

A dfl bus helps DFL framework modularize DFL device drivers for
different sub features. The dfl bus matches its devices and drivers by
DFL type and feature id.

This patch adds dfl bus support to MODULE_DEVICE_TABLE() by adding info
about struct dfl_device_id in devicetable-offsets.c and add a dfl entry
point in file2alias.c.

Signed-off-by: Xu Yilun 
Signed-off-by: Wu Hao 
Signed-off-by: Matthew Gerlach 
Signed-off-by: Russ Weight 
Acked-by: Wu Hao 
Signed-off-by: Moritz Fischer 
---
v2: add comments for the format of modalias
v3: changes the names from dfl_XXX to fpga_dfl_XXX
delete the comments of valid bits for modalias format
v9: rebase the patch for bus name changes back to "dfl"
v10: no change
v11: no change
v12: no change
v13: no change
---
 scripts/mod/devicetable-offsets.c |  4 
 scripts/mod/file2alias.c  | 13 +
 2 files changed, 17 insertions(+)

diff --git a/scripts/mod/devicetable-offsets.c 
b/scripts/mod/devicetable-offsets.c
index 27007c1..d8350ee 100644
--- a/scripts/mod/devicetable-offsets.c
+++ b/scripts/mod/devicetable-offsets.c
@@ -243,5 +243,9 @@ int main(void)
DEVID(mhi_device_id);
DEVID_FIELD(mhi_device_id, chan);
 
+   DEVID(dfl_device_id);
+   DEVID_FIELD(dfl_device_id, type);
+   DEVID_FIELD(dfl_device_id, feature_id);
+
return 0;
 }
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 2417dd1..8a438c9 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -1368,6 +1368,18 @@ static int do_mhi_entry(const char *filename, void 
*symval, char *alias)
return 1;
 }
 
+/* Looks like: dfl:tNfN */
+static int do_dfl_entry(const char *filename, void *symval, char *alias)
+{
+   DEF_FIELD(symval, dfl_device_id, type);
+   DEF_FIELD(symval, dfl_device_id, feature_id);
+
+   sprintf(alias, "dfl:t%04Xf%04X", type, feature_id);
+
+   add_wildcard(alias);
+   return 1;
+}
+
 /* Does namelen bytes of name exactly match the symbol? */
 static bool sym_is(const char *name, unsigned namelen, const char *symbol)
 {
@@ -1442,6 +1454,7 @@ static const struct devtable devtable[] = {
{"tee", SIZE_tee_client_device_id, do_tee_entry},
{"wmi", SIZE_wmi_device_id, do_wmi_entry},
{"mhi", SIZE_mhi_device_id, do_mhi_entry},
+   {"dfl", SIZE_dfl_device_id, do_dfl_entry},
 };
 
 /* Create MODULE_ALIAS() statements.
-- 
2.7.4



[PATCH v13 5/6] fpga: dfl: add support for N3000 Nios private feature

2020-11-11 Thread Xu Yilun
This patch adds support for the Nios handshake private feature on Intel
PAC (Programmable Acceleration Card) N3000.

The Nios is the embedded processor on the FPGA card. This private feature
provides a handshake interface to FPGA Nios firmware, which receives
retimer configuration command from host and executes via an internal SPI
master (spi-altera). When Nios finishes the configuration, host takes over
the ownership of the SPI master to control an Intel MAX10 BMC (Board
Management Controller) Chip on the SPI bus.

For Nios firmware handshake part, this driver requests the retimer
configuration for Nios firmware on probe, and adds some sysfs nodes for
user to query the onboard retimer's working mode and Nios firmware
version.

For SPI part, this driver adds a spi-altera platform device as well as
the MAX10 BMC spi slave info. A spi-altera driver will be matched to
handle the following SPI work.

[m...@kernel.org: Fixed up MAINTAINERS file to include added ABI doc]
Signed-off-by: Xu Yilun 
Signed-off-by: Wu Hao 
Signed-off-by: Matthew Gerlach 
Signed-off-by: Russ Weight 
Signed-off-by: YueHaibing 
Reviewed-by: Tom Rix 
---
v3: add the doc for this driver
minor fixes for comments from Tom
v4: move the err log in regmap implementation, and delete
 n3000_nios_writel/readl(), they have nothing to wrapper now.
some minor fixes and comments improvement.
v5: fix the output of fec_mode sysfs inf to "no" on 10G configuration,
 cause no FEC mode could be configured for 10G.
rename the dfl_n3000_nios_* to n3000_nios_*
improves comments.
v6: fix the output of fec_mode sysfs inf to "not supported" if in 10G,
 or the firmware version major < 3.
minor fixes and improves comments.
v7: improves comments.
v8: add sysfs interfaces for retimer mode, also doc update.
delete duplicated sysfs interfaces description in doc.
minor fixes.
v9: delete the retimer FEC mode configuration via module_parameter.
update the kernel version of the sysfs interfaces in Doc.
merge the patch "Make m10_n3000_info static" 
(https://lore.kernel.org/linux-fpga/52d8411e-13d8-1e91-756d-131802f5f...@huawei.com/T/#t)
remove the tags of Maintainers, this implementation is changed.
v10: improve the name of some macros, functions and variables.
 refactor the FEC mode setting and reading.
 refactor the retimer init error checking and dumping.
 refactor the loop timeout for regbus reading & write.
 some minor fixes.
v11: use sysfs_emit instead of sprintf.
 rebase to 5.10-rc1.
v12: move the MODULE_DEVICE_TABLE() right after its definition.
v13: fix the wrong use of logical'||', should use '|' on Nios
 INIT_DONE and INIT_START check, reported by lkp check.
---
 .../ABI/testing/sysfs-bus-dfl-devices-n3000-nios   |  47 ++
 MAINTAINERS|   2 +-
 drivers/fpga/Kconfig   |  11 +
 drivers/fpga/Makefile  |   2 +
 drivers/fpga/dfl-n3000-nios.c  | 588 +
 5 files changed, 649 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-dfl-devices-n3000-nios
 create mode 100644 drivers/fpga/dfl-n3000-nios.c

diff --git a/Documentation/ABI/testing/sysfs-bus-dfl-devices-n3000-nios 
b/Documentation/ABI/testing/sysfs-bus-dfl-devices-n3000-nios
new file mode 100644
index 000..a505537
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-bus-dfl-devices-n3000-nios
@@ -0,0 +1,47 @@
+What:  /sys/bus/dfl/devices/dfl_dev.X/fec_mode
+Date:  Oct 2020
+KernelVersion: 5.11
+Contact:   Xu Yilun 
+Description:   Read-only. Returns the FEC mode of the 25G links of the
+   ethernet retimers configured by Nios firmware. "rs" for Reed
+   Solomon FEC, "kr" for Fire Code FEC, "no" for NO FEC.
+   "not supported" if the FEC mode setting is not supported, this
+   happens when the Nios firmware version major < 3, or no link is
+   configured to 25G.
+   Format: string
+
+What:  /sys/bus/dfl/devices/dfl_dev.X/retimer_A_mode
+Date:  Oct 2020
+KernelVersion: 5.11
+Contact:   Xu Yilun 
+Description:   Read-only. Returns the enumeration value of the working mode of
+   the retimer A configured by the Nios firmware. The value is
+   read out from shared registers filled by the Nios firmware. Now
+   the values could be:
+
+   - "0": Reset
+   - "1": 4x10G
+   - "2": 4x25G
+   - "3": 2x25G
+   - "4": 2x25G+2x10G
+   - "5": 1x25G
+
+   If the Nios firmware is updated in future to support more
+   retimer modes, more enumeration value is expected.
+   Format: 0x%x
+
+What:  /sys/bus/dfl/devices/dfl_dev.X/retimer_B_mode
+Date:  Oct 2020
+KernelVersion: 5.11
+Contact:   Xu Yilun 
+Description:   

[PATCH v2 2/2] ASoC: qcom: sc7180: Modify machine driver for sound card

2020-11-11 Thread xuyuqing
Bypass set jack because there is no jack on coachz.
Create route for dmic.

Signed-off-by: xuyuqing 
---
 sound/soc/qcom/Kconfig  |  1 +
 sound/soc/qcom/sc7180.c | 86 ++---
 2 files changed, 74 insertions(+), 13 deletions(-)

diff --git a/sound/soc/qcom/Kconfig b/sound/soc/qcom/Kconfig
index 41cb08bd5588..27f93006be96 100644
--- a/sound/soc/qcom/Kconfig
+++ b/sound/soc/qcom/Kconfig
@@ -145,6 +145,7 @@ config SND_SOC_SC7180
select SND_SOC_LPASS_SC7180
select SND_SOC_MAX98357A
select SND_SOC_RT5682_I2C
+   select SND_SOC_ADAU7002
help
  To add support for audio on Qualcomm Technologies Inc.
  SC7180 SoC-based systems.
diff --git a/sound/soc/qcom/sc7180.c b/sound/soc/qcom/sc7180.c
index 878fd0169aab..e2e6567566af 100644
--- a/sound/soc/qcom/sc7180.c
+++ b/sound/soc/qcom/sc7180.c
@@ -221,16 +221,69 @@ static void sc7180_snd_shutdown(struct snd_pcm_substream 
*substream)
}
 }
 
+static int sc7180_adau7002_init(struct snd_soc_pcm_runtime *rtd)
+{
+   struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
+
+   switch (cpu_dai->id) {
+   case MI2S_PRIMARY:
+   return 0;
+   case MI2S_SECONDARY:
+   return 0;
+   case LPASS_DP_RX:
+   return sc7180_hdmi_init(rtd);
+   default:
+   dev_err(rtd->dev, "%s: invalid dai id 0x%x\n", __func__,
+   cpu_dai->id);
+   return -EINVAL;
+   }
+   return 0;
+}
+
+static int sc7180_adau7002_snd_startup(struct snd_pcm_substream *substream)
+{
+   struct snd_soc_pcm_runtime *rtd = substream->private_data;
+   struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
+   struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
+
+   switch (cpu_dai->id) {
+   case MI2S_PRIMARY:
+   snd_soc_dai_set_fmt(codec_dai,
+   SND_SOC_DAIFMT_CBS_CFS |
+   SND_SOC_DAIFMT_NB_NF |
+   SND_SOC_DAIFMT_I2S);
+
+   break;
+   case MI2S_SECONDARY:
+   break;
+   case LPASS_DP_RX:
+   break;
+   default:
+   dev_err(rtd->dev, "%s: invalid dai id 0x%x\n", __func__,
+   cpu_dai->id);
+   return -EINVAL;
+   }
+   return 0;
+}
+
 static const struct snd_soc_ops sc7180_ops = {
.startup = sc7180_snd_startup,
.shutdown = sc7180_snd_shutdown,
 };
 
+static const struct snd_soc_ops sc7180_adau7002_ops = {
+   .startup = sc7180_adau7002_snd_startup,
+};
+
 static const struct snd_soc_dapm_widget sc7180_snd_widgets[] = {
SND_SOC_DAPM_HP("Headphone Jack", NULL),
SND_SOC_DAPM_MIC("Headset Mic", NULL),
 };
 
+static const struct snd_soc_dapm_widget sc7180_adau7002_snd_widgets[] = {
+   SND_SOC_DAPM_MIC("DMIC", NULL),
+};
+
 static const char * const dmic_mux_text[] = {
"Front Mic",
"Rear Mic",
@@ -255,23 +308,15 @@ static const struct snd_soc_dapm_route 
sc7180_snd_dual_mic_audio_route[] = {
{"Dmic Mux", "Rear Mic", "DMIC"},
 };
 
-static void sc7180_add_ops(struct snd_soc_card *card)
-{
-   struct snd_soc_dai_link *link;
-   int i;
-
-   for_each_card_prelinks(card, i, link) {
-   link->ops = _ops;
-   link->init = sc7180_init;
-   }
-}
-
 static int sc7180_snd_platform_probe(struct platform_device *pdev)
 {
struct snd_soc_card *card;
struct sc7180_snd_data *data;
struct device *dev = >dev;
+   struct snd_soc_dai_link *link;
int ret;
+   int i;
+   bool no_headphone;
 
/* Allocate the private data */
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
@@ -299,17 +344,32 @@ static int sc7180_snd_platform_probe(struct 
platform_device *pdev)
}
}
 
+   if (of_device_is_compatible(dev->of_node, "google,sc7180-coachz")) {
+   no_headphone = true;
+   card->dapm_widgets = sc7180_adau7002_snd_widgets;
+   card->num_dapm_widgets = 
ARRAY_SIZE(sc7180_adau7002_snd_widgets);
+   }
+
ret = qcom_snd_parse_of(card);
if (ret)
return ret;
 
-   sc7180_add_ops(card);
+   for_each_card_prelinks(card, i, link) {
+   if (no_headphone) {
+   link->ops = _adau7002_ops;
+   link->init = sc7180_adau7002_init;
+   } else {
+   link->ops = _ops;
+   link->init = sc7180_init;
+   }
+   }
 
return devm_snd_soc_register_card(dev, card);
 }
 
 static const struct of_device_id sc7180_snd_device_id[]  = {
-   { .compatible = "google,sc7180-trogdor"},
+   {.compatible = "google,sc7180-trogdor"},
+   {.compatible = "google,sc7180-coachz"},
{},
 };
 MODULE_DEVICE_TABLE(of, sc7180_snd_device_id);
-- 
2.25.1


Re: [PATCH 0/7] MIPS: ralink: add CPU clock detection and clock gate driver for MT7621

2020-11-11 Thread Chuanhong Guo
On Thu, Nov 12, 2020 at 9:26 AM Chuanhong Guo  wrote:
>
> I've already said in previous threads that clock assignment in
> current linux kernel is not trustworthy.
> I've got the clock plan for mt7621 now. (Can't share it, sorry.)
> Most of your clock assumptions above are incorrect.
> I've made a clock driver with gate support a few months ago.[0]
> but I don't have much time to really finish it.
> Maybe you could rework your clock gate driver based on it.
>
> [0] 
> https://github.com/981213/linux/commit/2eca1f045e4c3db18c941135464c0d7422ad8133

hsdma/eth/pio clocks are still missing in mediatek doc and
I just made them up in the driver. Correct clock frequency for
them aren't really important for them to work though.
And another part I didn't finish is checking clock support for
every drivers mt7621 used. Many drivers don't explicitly
enable the clock and may be problematic when kernel
gates unused clocks.

-- 
Regards,
Chuanhong Guo


Re: [PATCH v5 1/1] sched/uclamp: add SCHED_FLAG_UTIL_CLAMP_RESET flag to reset uclamp

2020-11-11 Thread Yun Hsiang
On Wed, Nov 11, 2020 at 07:04:41PM +0100, Peter Zijlstra wrote:
> On Wed, Nov 11, 2020 at 06:41:07PM +0100, Dietmar Eggemann wrote:
> > diff --git a/include/uapi/linux/sched/types.h 
> > b/include/uapi/linux/sched/types.h
> > index c852153ddb0d..b9165f17dddc 100644
> > --- a/include/uapi/linux/sched/types.h
> > +++ b/include/uapi/linux/sched/types.h
> > @@ -115,8 +115,8 @@ struct sched_attr {
> > __u64 sched_period;
> >  
> > /* Utilization hints */
> > -   __u32 sched_util_min;
> > -   __u32 sched_util_max;
> > +   __s32 sched_util_min;
> > +   __s32 sched_util_max;
> 
> So that's UAPI, not sure we can change the type here.

+1
I am also concerned about changing UAPI.
But if we can chage sched_util_{min/max} to __s32, use -1 to reset is better 
than
adding flags.

> 
> >  };
> >  
> > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > index 3dc415f58bd7..caaa2a8434b9 100644
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -1413,17 +1413,24 @@ int sysctl_sched_uclamp_handler(struct ctl_table 
> > *table, int write,
> >  static int uclamp_validate(struct task_struct *p,
> >const struct sched_attr *attr)
> >  {
> > -   unsigned int lower_bound = p->uclamp_req[UCLAMP_MIN].value;
> > -   unsigned int upper_bound = p->uclamp_req[UCLAMP_MAX].value;
> > +   int util_min = p->uclamp_req[UCLAMP_MIN].value;
> > +   int util_max = p->uclamp_req[UCLAMP_MAX].value;
> >  
> > -   if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MIN)
> > -   lower_bound = attr->sched_util_min;
> > -   if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MAX)
> > -   upper_bound = attr->sched_util_max;
> > +   if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MIN) {
> > +   util_min = attr->sched_util_min;
> >  
> > -   if (lower_bound > upper_bound)
> > -   return -EINVAL;
> > -   if (upper_bound > SCHED_CAPACITY_SCALE)
> > +   if (util_min < -1 || util_min > SCHED_CAPACITY_SCALE)
> > +   return -EINVAL;
> > +   }
> > +
> > +   if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MAX) {
> > +   util_max = attr->sched_util_max;
> > +
> > +   if (util_max < -1 || util_max > SCHED_CAPACITY_SCALE)
> > +   return -EINVAL;
> > +   }
> 
> Luckily we can write that range as a single branch like:
> 
>   if (util_{min,max} + 1 > SCHED_CAPACITY_SCALE+1)
> 
> which assumes u32 :-)
> 
> > +
> > +   if (util_min != -1 && util_max != -1 && util_min > util_max)
> > return -EINVAL;
> 
> I think that will compile as is, otherwise write it like ~0u, which is
> the same bit pattern.
> 


[PATCH] scsi: ufs: Add retry flow for failed hba enabling

2020-11-11 Thread Stanley Chu
Once hba enabling is failed, add retry mechanism and in the
meanwhile allow vendors to apply specific handlings before
the next retry. For example, vendors can do vendor-specific
host reset flow in variant function "ufshcd_vops_hce_enable_notify()".

Signed-off-by: Stanley Chu 
---
 drivers/scsi/ufs/ufshcd.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 8001bbfec5c0..9186ee01379a 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -4328,8 +4328,10 @@ static inline void ufshcd_hba_stop(struct ufs_hba *hba)
  */
 static int ufshcd_hba_execute_hce(struct ufs_hba *hba)
 {
-   int retry;
+   int retry_outer = 3;
+   int retry_inner;
 
+start:
if (!ufshcd_is_hba_active(hba))
/* change controller state to "reset state" */
ufshcd_hba_stop(hba);
@@ -4355,13 +4357,17 @@ static int ufshcd_hba_execute_hce(struct ufs_hba *hba)
ufshcd_delay_us(hba->vps->hba_enable_delay_us, 100);
 
/* wait for the host controller to complete initialization */
-   retry = 50;
+   retry_inner = 50;
while (ufshcd_is_hba_active(hba)) {
-   if (retry) {
-   retry--;
+   if (retry_inner) {
+   retry_inner--;
} else {
dev_err(hba->dev,
"Controller enable failed\n");
+   if (retry_outer) {
+   retry_outer--;
+   goto start;
+   }
return -EIO;
}
usleep_range(1000, 1100);
-- 
2.18.0



[PATCH v2 0/2] Support SC7180 sound card variation without headset

2020-11-11 Thread xuyuqing
Use compatible string to let machine driver handle the case
where ALC5682 headset codec is replaced with ADAU7002 dmic codec

xuyuqing (2):
  ASoC: google: dt-bindings: add new compatible for sc7180-coachz
  ASoC: qcom: sc7180: Add machine driver for sound card

 .../bindings/sound/google,sc7180-trogdor.yaml |  4 +-
 sound/soc/qcom/Kconfig|  1 +
 sound/soc/qcom/sc7180.c   | 86 ---
 3 files changed, 77 insertions(+), 14 deletions(-)

-- 
2.25.1



[PATCH v2 1/2] ASoC: google: dt-bindings: add new compatible for sc7180-coachz

2020-11-11 Thread xuyuqing
Add devicetree bindings for coachz in documentation file

Signed-off-by: xuyuqing 
---
 .../devicetree/bindings/sound/google,sc7180-trogdor.yaml  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/sound/google,sc7180-trogdor.yaml 
b/Documentation/devicetree/bindings/sound/google,sc7180-trogdor.yaml
index ce050a9dec94..5095b780e2c7 100644
--- a/Documentation/devicetree/bindings/sound/google,sc7180-trogdor.yaml
+++ b/Documentation/devicetree/bindings/sound/google,sc7180-trogdor.yaml
@@ -15,7 +15,9 @@ description:
 
 properties:
   compatible:
-const: google,sc7180-trogdor
+enum:
+  - google,sc7180-trogdor
+  - google,sc7180-coachz
 
   audio-routing:
 $ref: /schemas/types.yaml#/definitions/non-unique-string-array
-- 
2.25.1



Re: [PATCH 1/2] init/console: Use ttynull as a fallback when there is no console

2020-11-11 Thread Sergey Senozhatsky
On (20/11/12 09:17), Sergey Senozhatsky wrote:
> On (20/11/11 14:54), Petr Mladek wrote:
> [..]
> > diff --git a/init/main.c b/init/main.c
> > index 130376ec10ba..24413c055a85 100644
> > --- a/init/main.c
> > +++ b/init/main.c
> > @@ -1470,8 +1470,14 @@ void __init console_on_rootfs(void)
> > struct file *file = filp_open("/dev/console", O_RDWR, 0);
> >  
> > if (IS_ERR(file)) {
> > -   pr_err("Warning: unable to open an initial console.\n");
> > -   return;
> > +   pr_err("Warning: unable to open an initial console. Fallback to 
> > ttynull.\n");
> > +   register_ttynull_console();
> > +
> 
> A nit, this probably can be done in console_device() function.
> 
> For several reasons:
> 
> - we will get covered all the future cases when something other than
>   console_on_rootfs() will filp_open("/dev/console")

And the existing ones (including user-space). For instance,
kernel/bpf/preload/iterators/iterators.c probably fails (?)
on systems with console=

debug_fd = open("/dev/console", O_WRONLY | O_NOCTTY | O_CLOEXEC);
if (debug_fd < 0)
return 1;

-ss


Re: [PATCH v3 07/11] input: raspberrypi-ts: Release firmware handle when not needed

2020-11-11 Thread Dmitry Torokhov
Hi Nicolas,

On Wed, Nov 04, 2020 at 11:39:33AM +0100, Nicolas Saenz Julienne wrote:
> Use devm_rpi_firmware_get() so as to make sure we release RPi's firmware
> interface when unbinding the device.

Unless I am mistaken this driver does not really need the firmware
structure past rpi_ts_probe(), and will be fine if it disappears earlier
than unbind time.

Thanks.

> 
> Signed-off-by: Nicolas Saenz Julienne 
> 
> ---
> 
> Changes since v2:
>  - Use devm_rpi_firmware_get(), instead of remove function
> 
>  drivers/input/touchscreen/raspberrypi-ts.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/touchscreen/raspberrypi-ts.c 
> b/drivers/input/touchscreen/raspberrypi-ts.c
> index ef6aaed217cf..efed0efa91d9 100644
> --- a/drivers/input/touchscreen/raspberrypi-ts.c
> +++ b/drivers/input/touchscreen/raspberrypi-ts.c
> @@ -134,7 +134,7 @@ static int rpi_ts_probe(struct platform_device *pdev)
>   return -ENOENT;
>   }
>  
> - fw = rpi_firmware_get(fw_node);
> + fw = devm_rpi_firmware_get(>dev, fw_node);
>   of_node_put(fw_node);
>   if (!fw)
>   return -EPROBE_DEFER;
> -- 
> 2.29.1
> 

-- 
Dmitry


Re: [PATCH] Input: elan_i2c - Modify the correct input of the iap page type command.

2020-11-11 Thread Dmitry Torokhov
Hi Jingle,

On Wed, Nov 04, 2020 at 03:08:04PM +0800, jingle.wu wrote:
> The iap page type command of the parameter is page_size.

You need to supply your "Signed-off-by: " for me to apply this patch.

Thanks!

> ---
>  drivers/input/mouse/elan_i2c.h   |  2 +-
>  drivers/input/mouse/elan_i2c_core.c  |  3 ++-
>  drivers/input/mouse/elan_i2c_i2c.c   | 10 +-
>  drivers/input/mouse/elan_i2c_smbus.c |  2 +-
>  4 files changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/input/mouse/elan_i2c.h b/drivers/input/mouse/elan_i2c.h
> index c75b00c45d75..36e3cd908671 100644
> --- a/drivers/input/mouse/elan_i2c.h
> +++ b/drivers/input/mouse/elan_i2c.h
> @@ -78,7 +78,7 @@ struct elan_transport_ops {
>   int (*iap_reset)(struct i2c_client *client);
>  
>   int (*prepare_fw_update)(struct i2c_client *client, u16 ic_type,
> -  u8 iap_version);
> +  u8 iap_version, u16 fw_page_size);
>   int (*write_fw_block)(struct i2c_client *client, u16 fw_page_size,
> const u8 *page, u16 checksum, int idx);
>   int (*finish_fw_update)(struct i2c_client *client,
> diff --git a/drivers/input/mouse/elan_i2c_core.c 
> b/drivers/input/mouse/elan_i2c_core.c
> index c599e21a8478..61ed3f5ca219 100644
> --- a/drivers/input/mouse/elan_i2c_core.c
> +++ b/drivers/input/mouse/elan_i2c_core.c
> @@ -497,7 +497,8 @@ static int __elan_update_firmware(struct elan_tp_data 
> *data,
>   u16 sw_checksum = 0, fw_checksum = 0;
>  
>   error = data->ops->prepare_fw_update(client, data->ic_type,
> -  data->iap_version);
> +  data->iap_version,
> +  data->fw_page_size);
>   if (error)
>   return error;
>  
> diff --git a/drivers/input/mouse/elan_i2c_i2c.c 
> b/drivers/input/mouse/elan_i2c_i2c.c
> index 5a496d4ffa49..13dc097eb6c6 100644
> --- a/drivers/input/mouse/elan_i2c_i2c.c
> +++ b/drivers/input/mouse/elan_i2c_i2c.c
> @@ -517,7 +517,7 @@ static int elan_i2c_set_flash_key(struct i2c_client 
> *client)
>   return 0;
>  }
>  
> -static int elan_read_write_iap_type(struct i2c_client *client)
> +static int elan_read_write_iap_type(struct i2c_client *client, u16 
> fw_page_size)
>  {
>   int error;
>   u16 constant;
> @@ -526,7 +526,7 @@ static int elan_read_write_iap_type(struct i2c_client 
> *client)
>  
>   do {
>   error = elan_i2c_write_cmd(client, ETP_I2C_IAP_TYPE_CMD,
> -ETP_I2C_IAP_TYPE_REG);
> +fw_page_size / 2);
>   if (error) {
>   dev_err(>dev,
>   "cannot write iap type: %d\n", error);
> @@ -543,7 +543,7 @@ static int elan_read_write_iap_type(struct i2c_client 
> *client)
>   constant = le16_to_cpup((__le16 *)val);
>   dev_dbg(>dev, "iap type reg: 0x%04x\n", constant);
>  
> - if (constant == ETP_I2C_IAP_TYPE_REG)
> + if (constant == fw_page_size / 2)
>   return 0;
>  
>   } while (--retry > 0);
> @@ -553,7 +553,7 @@ static int elan_read_write_iap_type(struct i2c_client 
> *client)
>  }
>  
>  static int elan_i2c_prepare_fw_update(struct i2c_client *client, u16 ic_type,
> -   u8 iap_version)
> +   u8 iap_version, u16 fw_page_size)
>  {
>   struct device *dev = >dev;
>   int error;
> @@ -594,7 +594,7 @@ static int elan_i2c_prepare_fw_update(struct i2c_client 
> *client, u16 ic_type,
>   }
>  
>   if (ic_type >= 0x0D && iap_version >= 1) {
> - error = elan_read_write_iap_type(client);
> + error = elan_read_write_iap_type(client, fw_page_size);
>   if (error)
>   return error;
>   }
> diff --git a/drivers/input/mouse/elan_i2c_smbus.c 
> b/drivers/input/mouse/elan_i2c_smbus.c
> index 8ff823751f3b..1820f1cfc1dc 100644
> --- a/drivers/input/mouse/elan_i2c_smbus.c
> +++ b/drivers/input/mouse/elan_i2c_smbus.c
> @@ -340,7 +340,7 @@ static int elan_smbus_set_flash_key(struct i2c_client 
> *client)
>  }
>  
>  static int elan_smbus_prepare_fw_update(struct i2c_client *client, u16 
> ic_type,
> - u8 iap_version)
> + u8 iap_version, u16 fw_page_size)
>  {
>   struct device *dev = >dev;
>   int len;
> -- 
> 2.17.1
> 

-- 
Dmitry


Re: [PATCH v7 0/3] Add support for AMD PTDMA controller driver

2020-11-11 Thread Sanjay R Mehta


On 10/16/2020 1:09 PM, Sanjay R Mehta wrote:
> From: Sanjay R Mehta 
> 
> This patch series adds support for AMD PTDMA controller which
> performs high bandwidth memory-to-memory and IO copy operation,
> performs DMA transfer through queue based descriptor management.
> 
> AMD Processor has multiple ptdma device instances with each controller
> having single queue. The driver also adds support for for multiple PTDMA
> instances, each device will get an unique identifier and uniquely
> named resources.
> 
> v7:
>   - Fixed module warnings reported ( by kernel test robot 
>  ).
> 
> v6:
>   - Removed debug artifacts and made the suggested cosmetic changes.
>   - implemented and used to_pt_chan and to_pt_desc inline functions.
>   - Removed src and dst address check as framework does this.
>   - Removed devm_kcalloc() usage and used devm_kzalloc() api.
>   - Using framework debugfs directory to store dma info.
> 
> v5:
>   - modified code to submit next tranction in ISR itself and removed the 
> tasklet.
>   - implemented .device_synchronize API.
>   - converted debugfs code by using DEFINE_SHOW_ATTRIBUTE()
>   - using dbg_dev_root for debugfs root directory.
>   - removed dma_status from pt_dma_chan
>   - removed module parameter cmd_queue_lenght.
>   - removed global device list for multiple devics.
>   - removed code related to dynamic adding/deleting to device list
>   - removed pt_add_device and pt_del_device functions
> 
> v4:
>   - modified DMA channel and descriptor management using virt-dma layer
> instead of list based management.
>   - return only status of the cookie from pt_tx_status
>   - copyright year changed from 2019 to 2020
>   - removed dummy code for suspend & resume
>   - used bitmask and genmask
> 
> v3:
> - Fixed the sparse warnings.
> 
> v2:
> - Added controller description in cover letter
> - Removed "default m" from Kconfig
> - Replaced low_address() and high_address() functions with kernel
>   API's lower_32_bits & upper_32_bits().
> - Removed the BH handler function pt_core_irq_bh() and instead
>   handling transaction in irq handler itself.
> - Moved presetting of command queue registers into new function
>   "init_cmdq_regs()"
> - Removed the kernel thread dependency to submit transaction.
> - Increased the hardware command queue size to 32 and adding it
>   as a module parameter.
> - Removed backlog command queue handling mechanism.
> - Removed software command queue handling and instead submitting
>   transaction command directly to
>   hardware command queue.
> - Added tasklet structure variable in "struct pt_device".
>   This is used to invoke pt_do_cmd_complete() upon receiving interrupt
>   for command completion.
> - pt_core_perform_passthru() function parameters are modified and it 
> is
>   now used to submit command directly to hardware from dmaengine 
> framew
> - Removed below structures, enums, macros and functions, as these 
> value
>   constants. Making command submission simple,
>- Removed "union pt_function"  and several macros like PT_VERSION,
>  PT_BYTESWAP, PT_CMD_* etc..
>- enum pt_passthru_bitwise, enum pt_passthru_byteswap, enum 
> pt_memty
>  struct pt_dma_info, struct pt_data, struct pt_mem, struct 
> pt_passt
>  struct pt_op,
> 
> Links of the review comments for v5:
> 1. https://lkml.org/lkml/2020/7/3/154
> 2. https://lkml.org/lkml/2020/8/25/431
> 3. https://lkml.org/lkml/2020/7/3/177
> 4. https://lkml.org/lkml/2020/7/3/186
> 
> Links of the review comments for v5:
> 1. https://lkml.org/lkml/2020/5/4/42
> 2. https://lkml.org/lkml/2020/5/4/45
> 3. https://lkml.org/lkml/2020/5/4/38
> 4. https://lkml.org/lkml/2020/5/26/70
> 
> Links of the review comments for v4:
> 1. https://lkml.org/lkml/2020/1/24/12
> 2. https://lkml.org/lkml/2020/1/24/17
> 
> Links of the review comments for v2:
> 1https://lkml.org/lkml/2019/12/27/630
> 2. https://lkml.org/lkml/2020/1/3/23
> 3. https://lkml.org/lkml/2020/1/3/314
> 4. https://lkml.org/lkml/2020/1/10/100
> 
> Links of the review comments for v1:
> 1. https://lkml.org/lkml/2019/9/24/490
> 2. https://lkml.org/lkml/2019/9/24/399
> 3. https://lkml.org/lkml/2019/9/24/862
> 4. https://lkml.org/lkml/2019/9/24/122
> 
> Sanjay R Mehta (3):
>   dmaengine: ptdma: Initial driver for the AMD PTDMA
>   dmaengine: ptdma: register PTDMA controller as a DMA resource
>   dmaengine: ptdma: Add debugfs entries for PTDMA information
> 
>  MAINTAINERS |   6 +
>  drivers/dma/Kconfig |   2 +
>  drivers/dma/Makefile|   1 +
>  drivers/dma/ptdma/Kconfig   |  13 +
>  drivers/dma/ptdma/Makefile  |  10 +
>  drivers/dma/ptdma/ptdma-debugfs.c   | 115 

[PATCH V2 2/5] arm64: dts: ti: k3-j721e*: Cleanup disabled nodes at SoC dtsi level

2020-11-11 Thread Nishanth Menon
The device tree standard states that when the status property is
not present under a node, the okay value is assumed. There are many
reasons for doing the same, the number of strings in the device
tree, default power management functionality, etc. are a few of the
reasons.

In general, after a few rounds of discussions [1] there are few
options one could take when dealing with SoC dtsi and board dts

a. SoC dtsi provide nodes as a super-set default (aka enabled) state and
   to prevent messy board files, when more boards are added per SoC, we
   optimize and disable commonly un-used nodes in board-common.dtsi
b. SoC dtsi disables all hardware dependent nodes by default and board
   dts files enable nodes based on a need basis.
c. Subjectively pick and choose which nodes we will disable by default
   in SoC dtsi and over the years we can optimize things and change
   default state depending on the need.

While there are pros and cons on each of these approaches, the right
thing to do will be to stick with device tree default standards and
work within those established rules. So, we choose to go with option
(a).

Lets cleanup defaults of j721e SoC dtsi before this gets more harder
to cleanup later on and new SoCs are added.

The only functional difference between the dtb generated is
status='okay' is no longer necessary for mcasp10 and depends on the
default state.

NOTE: There is a known risk of omission that new board dts developers
might miss reviewing both the board schematics in addition to all the
DT nodes of the SoC when setting appropriate nodes status to disable
or reserved in the board dts. This can expose issues in drivers that
may not anticipate an incomplete node (example: missing appropriate
board properties) being in an "okay" state. These cases are considered
bugs and need to be fixed in the drivers as and when identified.

[1] https://lore.kernel.org/linux-arm-kernel/20201027130701.ge5...@atomide.com/

Fixes: 1c4d35265fb2 ("arm64: dts: ti: k3-j721e-main: Add McASP nodes")
Fixes: 76921f15acc0 ("arm64: dts: ti: k3-j721e-main: Add DSS node")
Signed-off-by: Nishanth Menon 
Reviewed-by: Tomi Valkeinen 
Cc: Jyri Sarha 
Cc: Tomi Valkeinen 
Cc: Peter Ujfalusi 
Cc: Tony Lindgren 
---
Changes since v1:
- commit message update

V1: https://lore.kernel.org/linux-arm-kernel/20201104224356.18040-3...@ti.com/
 .../dts/ti/k3-j721e-common-proc-board.dts | 48 ++-
 arch/arm64/boot/dts/ti/k3-j721e-main.dtsi | 26 --
 2 files changed, 47 insertions(+), 27 deletions(-)

diff --git a/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts 
b/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts
index 52e121155563..9416528caa8a 100644
--- a/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts
+++ b/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts
@@ -540,6 +540,46 @@  {
 <_clks 152 18>; /* PLL23_HSDIV0 */
 };
 
+ {
+   status = "disabled";
+};
+
+ {
+   status = "disabled";
+};
+
+ {
+   status = "disabled";
+};
+
+ {
+   status = "disabled";
+};
+
+ {
+   status = "disabled";
+};
+
+ {
+   status = "disabled";
+};
+
+ {
+   status = "disabled";
+};
+
+ {
+   status = "disabled";
+};
+
+ {
+   status = "disabled";
+};
+
+ {
+   status = "disabled";
+};
+
  {
#sound-dai-cells = <0>;
 
@@ -556,8 +596,10 @@  {
>;
tx-num-evt = <0>;
rx-num-evt = <0>;
+};
 
-   status = "okay";
+ {
+   status = "disabled";
 };
 
  {
@@ -639,3 +681,7 @@ _rc {
 _ep {
status = "disabled";
 };
+
+ {
+   status = "disabled";
+};
diff --git a/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi 
b/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi
index e2a96b2c423c..b54332d6fdc5 100644
--- a/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi
@@ -1327,8 +1327,6 @@ dss: dss@04a0 {
  "common_s1",
  "common_s2";
 
-   status = "disabled";
-
dss_ports: ports {
#address-cells = <1>;
#size-cells = <0>;
@@ -1350,8 +1348,6 @@ mcasp0: mcasp@2b0 {
clocks = <_clks 174 1>;
clock-names = "fck";
power-domains = <_pds 174 TI_SCI_PD_EXCLUSIVE>;
-
-   status = "disabled";
};
 
mcasp1: mcasp@2b1 {
@@ -1369,8 +1365,6 @@ mcasp1: mcasp@2b1 {
clocks = <_clks 175 1>;
clock-names = "fck";
power-domains = <_pds 175 TI_SCI_PD_EXCLUSIVE>;
-
-   status = "disabled";
};
 
mcasp2: mcasp@2b2 {
@@ -1388,8 +1382,6 @@ mcasp2: mcasp@2b2 {
clocks = <_clks 176 1>;
clock-names = "fck";
power-domains = <_pds 176 TI_SCI_PD_EXCLUSIVE>;
-
-   status = "disabled";
};
 
mcasp3: mcasp@2b3 {
@@ -1407,8 +1399,6 @@ mcasp3: 

[PATCH V2 4/5] arm64: dts: ti: k3-am654-base-board: Fix up un-necessary status set to "okay" for USB

2020-11-11 Thread Nishanth Menon
The default state of a device tree node is "okay". There is no specific
use of explicitly adding status = "okay" in the board dts.

Fixes: 7e7e7dd51d06 ("arm64: dts: ti: k3-am654-base-board: enable USB1")
Signed-off-by: Nishanth Menon 
Cc: Roger Quadros 
---
Changes since v1:
- no change.

v1: https://lore.kernel.org/linux-arm-kernel/20201104224356.18040-5...@ti.com/

 arch/arm64/boot/dts/ti/k3-am654-base-board.dts | 8 
 1 file changed, 8 deletions(-)

diff --git a/arch/arm64/boot/dts/ti/k3-am654-base-board.dts 
b/arch/arm64/boot/dts/ti/k3-am654-base-board.dts
index 199c4d4e7539..744efcbb4f7f 100644
--- a/arch/arm64/boot/dts/ti/k3-am654-base-board.dts
+++ b/arch/arm64/boot/dts/ti/k3-am654-base-board.dts
@@ -325,14 +325,6 @@  {
disable-wp;
 };
 
-_1 {
-   status = "okay";
-};
-
-_phy {
-   status = "okay";
-};
-
  {
pinctrl-names = "default";
pinctrl-0 = <_pins_default>;
-- 
2.29.2



[PATCH V2 1/5] arm64: dts: ti: k3-am65*: Cleanup disabled nodes at SoC dtsi level

2020-11-11 Thread Nishanth Menon
The device tree standard states that when the status property is
not present under a node, the okay value is assumed. There are many
reasons for doing the same, the number of strings in the device
tree, default power management functionality, etc. are a few of the
reasons.

In general, after a few rounds of discussions [1] there are few
options one could take when dealing with SoC dtsi and board dts

a. SoC dtsi provide nodes as a super-set default (aka enabled) state and
   to prevent messy board files, when more boards are added per SoC, we
   optimize and disable commonly un-used nodes in board-common.dtsi
b. SoC dtsi disables all hardware dependent nodes by default and board
   dts files enable nodes based on a need basis.
c. Subjectively pick and choose which nodes we will disable by default
   in SoC dtsi and over the years we can optimize things and change
   default state depending on the need.

While there are pros and cons on each of these approaches, the right
thing to do will be to stick with device tree default standards and
work within those established rules. So, we choose to go with option
(a).

Lets cleanup defaults of am654 SoC dtsi before this gets more harder
to cleanup later on and new SoCs are added.

The dtb generated is identical with the patch and it is just cleanup to
ensure we have a clean usage model

NOTE: There is a known risk of omission that new board dts developers
might miss reviewing both the board schematics in addition to all the
DT nodes of the SoC when setting appropriate nodes status to disable
or reserved in the board dts. This can expose issues in drivers that
may not anticipate an incomplete node (example: missing appropriate
board properties) being in an "okay" state. These cases are considered
bugs and need to be fixed in the drivers as and when identified.

[1] https://lore.kernel.org/linux-arm-kernel/20201027130701.ge5...@atomide.com/

Fixes: 9bcb631e9953 ("arm64: dts: ti: k3-am654-main: Add McASP nodes")
Fixes: fc539b90eda2 ("arm64: dts: ti: am654: Add DSS node")
Signed-off-by: Nishanth Menon 
Reviewed-by: Tomi Valkeinen 
Cc: Jyri Sarha 
Cc: Tomi Valkeinen 
Cc: Peter Ujfalusi 
Cc: Tony Lindgren 
---

Changes since v1:
- commit message update

V1: https://lore.kernel.org/linux-arm-kernel/20201104224356.18040-2...@ti.com/

 arch/arm64/boot/dts/ti/k3-am65-main.dtsi   |  8 
 arch/arm64/boot/dts/ti/k3-am654-base-board.dts | 16 
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/arch/arm64/boot/dts/ti/k3-am65-main.dtsi 
b/arch/arm64/boot/dts/ti/k3-am65-main.dtsi
index 533525229a8d..21e50021dd83 100644
--- a/arch/arm64/boot/dts/ti/k3-am65-main.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am65-main.dtsi
@@ -770,8 +770,6 @@ mcasp0: mcasp@2b0 {
clocks = <_clks 104 0>;
clock-names = "fck";
power-domains = <_pds 104 TI_SCI_PD_EXCLUSIVE>;
-
-   status = "disabled";
};
 
mcasp1: mcasp@2b1 {
@@ -789,8 +787,6 @@ mcasp1: mcasp@2b1 {
clocks = <_clks 105 0>;
clock-names = "fck";
power-domains = <_pds 105 TI_SCI_PD_EXCLUSIVE>;
-
-   status = "disabled";
};
 
mcasp2: mcasp@2b2 {
@@ -808,8 +804,6 @@ mcasp2: mcasp@2b2 {
clocks = <_clks 106 0>;
clock-names = "fck";
power-domains = <_pds 106 TI_SCI_PD_EXCLUSIVE>;
-
-   status = "disabled";
};
 
cal: cal@6f03000 {
@@ -865,8 +859,6 @@ dss: dss@04a0 {
 
interrupts = ;
 
-   status = "disabled";
-
dss_ports: ports {
#address-cells = <1>;
#size-cells = <0>;
diff --git a/arch/arm64/boot/dts/ti/k3-am654-base-board.dts 
b/arch/arm64/boot/dts/ti/k3-am654-base-board.dts
index d12dd89f3405..199c4d4e7539 100644
--- a/arch/arm64/boot/dts/ti/k3-am654-base-board.dts
+++ b/arch/arm64/boot/dts/ti/k3-am654-base-board.dts
@@ -486,3 +486,19 @@ _port1 {
phy-mode = "rgmii-rxid";
phy-handle = <>;
 };
+
+ {
+   status = "disabled";
+};
+
+ {
+   status = "disabled";
+};
+
+ {
+   status = "disabled";
+};
+
+ {
+   status = "disabled";
+};
-- 
2.29.2



Re: [PATCH v21 15/19] mm/compaction: do page isolation first in compaction

2020-11-11 Thread Hugh Dickins
On Wed, 11 Nov 2020, Vlastimil Babka wrote:
> On 11/5/20 9:55 AM, Alex Shi wrote:
> 
> > @@ -979,10 +995,6 @@ static bool too_many_isolated(pg_data_t *pgdat)
> > goto isolate_abort;
> > }
> >   - /* Recheck PageLRU and PageCompound under lock */
> > -   if (!PageLRU(page))
> > -   goto isolate_fail;
> > -
> > /*
> >  * Page become compound since the non-locked check,
> >  * and it's on LRU. It can only be a THP so the order
> > @@ -990,16 +1002,13 @@ static bool too_many_isolated(pg_data_t *pgdat)

Completely off-topic, and won't matter at all when Andrew rediffs into
mmotm: but isn't it weird that this is showing "too_many_isolated(",
when actually the function is isolate_migratepages_block()?

> >  */
> > if (unlikely(PageCompound(page) &&
> > !cc->alloc_contig)) {
> > low_pfn += compound_nr(page) - 1;
> > -   goto isolate_fail;
> > +   SetPageLRU(page);
> > +   goto isolate_fail_put;
> > }
> 
> IIUC the danger here is khugepaged will collapse a THP. For that,
> __collapse_huge_page_isolate() has to succeed isolate_lru_page(). Under the
> new scheme, it shouldn't be possible, right? If that's correct, we can remove
> this part?

I don't think so.  A preliminary check for PageCompound was made much
higher up, before taking a reference on the page, but it can easily have
become PageCompound since then (when racing prep_new_page() calls
prep_compound_page()).

And __collapse_huge_page_isolate() does not turn a non-compound page
into a compound page: it isolates small pages before copying them into
the compound page (in the usual case: I can see there's also allowance
for PageCompound there too, which will do something different).

Hugh


Re:Re: [PATCH V4 net-bugfixs] net/ethernet: Update ret when ptp_clock is ERROR

2020-11-11 Thread 王擎
>On Thu, 12 Nov 2020 09:15:05 +0800 (GMT+08:00) 王擎 wrote:
>> >Grygorii, would you mind sending a correct patch in so Wang Qing can
>> >see how it's done? I've been asking for a fixes tag multiple times
>> >already :(  
>> 
>> I still don't quite understand what a fixes tag means,
>> can you tell me how to do this, thanks.
>
>Please read: Documentation/process/submitting-patches.rst
>
>You can search for "Fixes:"

I see, but this bug is not caused by a specific patch, it exists at the 
beginning, so 
there is no need to add a fixes tag. Please point out if I understand it 
incorrectly,thanks!

Wang Qing




Re: [MPTCP][PATCH net 1/2] mptcp: fix static checker warnings in mptcp_pm_add_timer

2020-11-11 Thread Geliang Tang
Hi Jakub, Matt,

Jakub Kicinski  于2020年11月10日周二 上午6:20写道:
>
> On Mon, 9 Nov 2020 21:23:33 + (UTC) Matthieu Baerts wrote:
> > 09 Nov 2020 21:57:05 Jakub Kicinski :
> > > On Mon, 9 Nov 2020 17:28:54 +0100 Matthieu Baerts wrote:
> > >> A small detail (I think): the Signed-off-by of the sender (Geliang)
> > >> should be the last one in the list if I am not mistaken.
> > >> But I guess this is not blocking.
> > >>
> > >> Reviewed-by: Matthieu Baerts 
> > >
> > > I take it you'd like me to apply patch 1 directly to net?
> >
> > Sorry, I didn't know it was OK to apply only one patch of the series.
> > Then yes, if you don't mind, please apply this patch :)
>
> Not really, I was just establishing ownership ;)
>
> Geliang Tang, please rebase on net and repost just the first patch.
> It does not apply to net as is.

v2 of this patch had been sent out.

http://patchwork.ozlabs.org/project/netdev/patch/078a2ef5bdc4e3b2c25ef852461692001f426495.1604976945.git.geliangt...@gmail.com/

This patch should be applied to net-next, not -net. Since commit "mptcp:
add a new sysctl add_addr_timeout" is not applied to -net yet.

-Geliang


Re: [PATCH v2] f2fs: avoid race condition for shinker count

2020-11-11 Thread Jaegeuk Kim
Light reported sometimes shinker gets nat_cnt < dirty_nat_cnt resulting in
wrong do_shinker work. Let's avoid to get stale data by using nat_tree_lock.

Reported-by: Light Hsieh 
Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/shrinker.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/shrinker.c b/fs/f2fs/shrinker.c
index d66de5999a26..d42245ab07f4 100644
--- a/fs/f2fs/shrinker.c
+++ b/fs/f2fs/shrinker.c
@@ -18,7 +18,11 @@ static unsigned int shrinker_run_no;
 
 static unsigned long __count_nat_entries(struct f2fs_sb_info *sbi)
 {
-   long count = NM_I(sbi)->nat_cnt - NM_I(sbi)->dirty_nat_cnt;
+   long count;
+
+   down_read(_i->nat_tree_lock);
+   count = NM_I(sbi)->nat_cnt - NM_I(sbi)->dirty_nat_cnt;
+   up_read(_i->nat_tree_lock);
 
return count > 0 ? count : 0;
 }
-- 
2.29.2.299.gdc1121823c-goog



[PATCH v5 02/10] firmware: imx: scu-pd: Add power domains for imx-jpeg

2020-11-11 Thread Mirela Rabulea (OSS)
From: Mirela Rabulea 

The power domains are for imx8qxp/imx8qm JPEG encoder & decoder.
Each has 4 slots and a wrapper.

Signed-off-by: Mirela Rabulea 
Acked-by: Daniel Baluta 
---
Changes in v5:
Added Acked-by

 drivers/firmware/imx/scu-pd.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/firmware/imx/scu-pd.c b/drivers/firmware/imx/scu-pd.c
index 946eea292b52..a614d8dd868e 100644
--- a/drivers/firmware/imx/scu-pd.c
+++ b/drivers/firmware/imx/scu-pd.c
@@ -180,6 +180,12 @@ static const struct imx_sc_pd_range 
imx8qxp_scu_pd_ranges[] = {
{ "cm41-pid", IMX_SC_R_M4_1_PID0, 5, true, 0},
{ "cm41-mu-a1", IMX_SC_R_M4_1_MU_1A, 1, false, 0},
{ "cm41-lpuart", IMX_SC_R_M4_1_UART, 1, false, 0},
+
+   /* IMAGE SS */
+   { "img-jpegdec-mp", IMX_SC_R_MJPEG_DEC_MP, 1, false, 0 },
+   { "img-jpegdec-s0", IMX_SC_R_MJPEG_DEC_S0, 4, true, 0 },
+   { "img-jpegenc-mp", IMX_SC_R_MJPEG_ENC_MP, 1, false, 0 },
+   { "img-jpegenc-s0", IMX_SC_R_MJPEG_ENC_S0, 4, true, 0 },
 };
 
 static const struct imx_sc_pd_soc imx8qxp_scu_pd = {
-- 
2.17.1



Re: [f2fs-dev] [PATCH v3] f2fs: avoid race condition for shinker count

2020-11-11 Thread Jaegeuk Kim
Light reported sometimes shinker gets nat_cnt < dirty_nat_cnt resulting in
wrong do_shinker work. Let's avoid to get stale data by using nat_tree_lock.

Reported-by: Light Hsieh 
Signed-off-by: Jaegeuk Kim 
---
v3:
 - fix to use NM_I(sbi)

 fs/f2fs/shrinker.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/shrinker.c b/fs/f2fs/shrinker.c
index d66de5999a26..555712ba06d8 100644
--- a/fs/f2fs/shrinker.c
+++ b/fs/f2fs/shrinker.c
@@ -18,7 +18,11 @@ static unsigned int shrinker_run_no;
 
 static unsigned long __count_nat_entries(struct f2fs_sb_info *sbi)
 {
-   long count = NM_I(sbi)->nat_cnt - NM_I(sbi)->dirty_nat_cnt;
+   long count;
+
+   down_read(_I(sbi)->nat_tree_lock);
+   count = NM_I(sbi)->nat_cnt - NM_I(sbi)->dirty_nat_cnt;
+   up_read(_I(sbi)->nat_tree_lock);
 
return count > 0 ? count : 0;
 }
-- 
2.29.2.299.gdc1121823c-goog



Re: [RFC] fs: Avoid to use lockdep information if it's turned off

2020-11-11 Thread Boqun Feng
Hi David,

On Wed, Nov 11, 2020 at 03:01:21PM +0100, David Sterba wrote:
> On Tue, Nov 10, 2020 at 04:33:27PM +0100, David Sterba wrote:
> > On Tue, Nov 10, 2020 at 09:37:37AM +0800, Boqun Feng wrote:
> > 
> > I'll run another test on top of the development branch in case there are
> > unrelated lockdep warning bugs that have been fixed meanwhile.
> 
> Similar reports but earlier test and probably completely valid due to
> "BUG: MAX_LOCKDEP_CHAIN_HLOCKS too low!"
> 

Thanks for trying this out. These results are as expected: first a
lockdep splat warning is hit, which could be either caused by the
detection of a deadlock case or caused by an internal lockdep issue
("BUG: MAX_LOCKDEP_CHAIN_HLOCKS too low!" in this case), the lockdep
get turned off afterwards, and then when __sb_start_write() wants to use
lock holding information, we find out, stop using that information and
do a WARN_ON_ONCE().

Without this patch, __sb_start_write() will get incorrect lock holding
information, and result in task hanging as reported by Filipe. Darrick's
patch:


https://lore.kernel.org/linux-fsdevel/160494580419.772573.9286165021627298770.stgit@magnolia/T/#t

can also fix that by not relying the lock holding information at all in
__sb_start_write(). And I think that's a better fix.


For the "BUG: MAX_LOCKDEP_CHAIN_HLOCKS too low!" warning, do you see
that every time when you run xfstests and don't see other lockdep
splats? If so, that means we reach the limitation of number of lockdep
hlock chains, and we should fix that.

Regards,
Boqun

> btrfs/057 [16:01:29][ 1580.146087] run fstests btrfs/057 at 
> 2020-11-10 16:01:29
> [ 1580.787867] BTRFS info (device vda): disk space caching is enabled
> [ 1580.789366] BTRFS info (device vda): has skinny extents
> [ 1581.052542] BTRFS: device fsid 84018822-2e45-4341-80be-da6d2b4e033a devid 
> 1 transid 5 /dev/vdb scanned by mkfs.btrfs (18739)
> [ 1581.105177] BTRFS info (device vdb): turning on sync discard
> [ 1581.106834] BTRFS info (device vdb): disk space caching is enabled
> [ 1581.108423] BTRFS info (device vdb): has skinny extents
> [ 1581.109799] BTRFS info (device vdb): flagging fs with big metadata feature
> [ 1581.120343] BTRFS info (device vdb): checking UUID tree
> [ 1586.942699] BUG: MAX_LOCKDEP_CHAIN_HLOCKS too low!
> [ 1586.945725] turning off the locking correctness validator.
> [ 1586.948823] Please attach the output of /proc/lock_stat to the bug report
> [ 1586.952153] CPU: 0 PID: 18771 Comm: fsstress Not tainted 
> 5.10.0-rc3-default+ #1355
> [ 1586.954919] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 
> rel-1.12.0-59-gc9ba527-rebuilt.opensuse.org 04/01/2014
> [ 1586.958630] Call Trace:
> [ 1586.959214]  dump_stack+0x77/0x97
> [ 1586.960030]  add_chain_cache.cold+0x29/0x30
> [ 1586.961028]  validate_chain+0x278/0x780
> [ 1586.961979]  __lock_acquire+0x3fb/0x730
> [ 1586.962880]  lock_acquire.part.0+0xac/0x1a0
> [ 1586.963895]  ? try_to_wake_up+0x59/0x450
> [ 1586.965153]  ? rcu_read_lock_sched_held+0x3f/0x70
> [ 1586.966569]  ? lock_acquire+0xc4/0x150
> [ 1586.967699]  ? try_to_wake_up+0x59/0x450
> [ 1586.968882]  _raw_spin_lock_irqsave+0x43/0x90
> [ 1586.970207]  ? try_to_wake_up+0x59/0x450
> [ 1586.971404]  try_to_wake_up+0x59/0x450
> [ 1586.973149]  wake_up_q+0x60/0xb0
> [ 1586.974620]  __up_write+0x117/0x1d0
> [ 1586.975080] [ cut here ]
> [ 1586.976039]  btrfs_release_path+0xc8/0x180 [btrfs]
> [ 1586.977718] WARNING: CPU: 2 PID: 18772 at fs/super.c:1676 
> __sb_start_write+0x113/0x2a0
> [ 1586.979478]  __btrfs_update_delayed_inode+0x1c1/0x2c0 [btrfs]
> [ 1586.979506]  btrfs_commit_inode_delayed_inode+0x115/0x120 [btrfs]
> [ 1586.982484] Modules linked in:
> [ 1586.984080]  btrfs_evict_inode+0x1e2/0x370 [btrfs]
> [ 1586.985557]  dm_flakey
> [ 1586.986419]  ? evict+0xc3/0x220
> [ 1586.986421]  evict+0xd5/0x220
> [ 1586.986423]  vfs_rmdir.part.0+0x10c/0x180
> [ 1586.986426]  do_rmdir+0x14b/0x1b0
> [ 1586.987504]  dm_mod
> [ 1586.988244]  do_syscall_64+0x2d/0x70
> [ 1586.988947]  xxhash_generic btrfs
> [ 1586.989779]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
> [ 1586.990906]  blake2b_generic
> [ 1586.991808] RIP: 0033:0x7f0ad919b5d7
> [ 1586.992451]  libcrc32c
> [ 1586.993427] Code: 73 01 c3 48 8b 0d 99 f8 0c 00 f7 d8 64 89 01 48 83 c8 ff 
> c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 54 00 00 00 0f 05 <48> 3d 
> 01 f0 ff ff 73 01 c3 48 8b 0d 69 f8 0c 00 f7 d8 64 89 01 48
> [ 1586.994380]  crc32c_intel
> [ 1586.995546] RSP: 002b:7ffc152bf368 EFLAGS: 0202 ORIG_RAX: 
> 0054
> [ 1586.996034]  xor
> [ 1586.996613] RAX: ffda RBX: 01f4 RCX: 
> 7f0ad919b5d7
> [ 1586.996615] RDX: 00316264 RSI:  RDI: 
> 0045eff0
> [ 1586.997033]  zstd_decompress
> [ 1587.001060] RBP: 7ffc152bf4b0 R08: 0045eff0 R09: 
> 7ffc152bf4a4
> [ 1587.001061] R10: 00b1 R11: 0202 R12: 
> 030e
> [ 

[PATCH] bus: mvebu-mbus: make iounmap() symmetric with ioremap()

2020-11-11 Thread Chris Packham
make coccicheck complains:

  ./drivers/bus/mvebu-mbus.c:1113:2-8: ERROR: missing iounmap; ioremap on line 
1106 and execution via conditional on line 

It took some staring but I don't think there is a problem because the
file global `mbus_state` is passed mvebu_mbus_common_init() as the
`mbus` parameter so `mbus_state.mbuswins_base` and `mbus->mbuswins_base`
are the same thing. But this is confusing for anyone reading the code
and one less complaint from coccicheck would be nice so lets fix it.

Signed-off-by: Chris Packham 
---
I haven't included

Fixes: fb52a6c4 ("bus: introduce an Marvell EBU MBus driver")

because that commit is quite old and it's probably not worth bothering
the stable trees with what is essentially a no-op.

 drivers/bus/mvebu-mbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
index 2519ceede64b..dd9e7343a5e3 100644
--- a/drivers/bus/mvebu-mbus.c
+++ b/drivers/bus/mvebu-mbus.c
@@ -,7 +,7 @@ static int __init mvebu_mbus_common_init(struct 
mvebu_mbus_state *mbus,
 
mbus->sdramwins_base = ioremap(sdramwins_phys_base, sdramwins_size);
if (!mbus->sdramwins_base) {
-   iounmap(mbus_state.mbuswins_base);
+   iounmap(mbus->mbuswins_base);
return -ENOMEM;
}
 
-- 
2.29.2



Re: [PATCH v21 14/19] mm/lru: introduce TestClearPageLRU

2020-11-11 Thread Hugh Dickins
On Wed, 11 Nov 2020, Vlastimil Babka wrote:
> On 11/5/20 9:55 AM, Alex Shi wrote:
> 
> > --- a/mm/vmscan.c
> > +++ b/mm/vmscan.c
> > @@ -1542,7 +1542,7 @@ unsigned int reclaim_clean_pages_from_list(struct
> > zone *zone,
> >*/
> >   int __isolate_lru_page(struct page *page, isolate_mode_t mode)
> >   {
> > -   int ret = -EINVAL;
> > +   int ret = -EBUSY;
> > /* Only take pages on the LRU. */
> > if (!PageLRU(page))
> > @@ -1552,8 +1552,6 @@ int __isolate_lru_page(struct page *page,
> > isolate_mode_t mode)
> > if (PageUnevictable(page) && !(mode & ISOLATE_UNEVICTABLE))
> > return ret;
> >   - ret = -EBUSY;
> 
> I'm not sure why this change is here, looks unrelated to the patch?
> 
> Oh I see, you want to prevent the BUG() in isolate_lru_pages().

Yes, I suggested this part of the patch to Alex, when I hit that BUG().

> 
> But due to that, the PageUnevictable check was also affected unintentionally.
> But I don't think it's that important to BUG() when we run into
> PageUnevictable unexpectedly, so that's probably ok.

Not unintentional.  __isolate_lru_page(), or __isolate_lru_page_prepare(),
is a silly function, used by two callers whose requirements are almost
entirely disjoint.  The ISOLATE_UNEVICTABLE case is only for compaction.c,
which takes no interest in -EINVAL versus -EBUSY, and has no such BUG().

I think it dates back to lumpy reclaim days, and it probably made more
sense back then.

> 
> But with that, we can just make __isolate_lru_page() a bool function and
> remove the ugly switch in  isolate_lru_pages()?

I agree that the switch statement in isolate_lru_pages() seems pointless
now, and can be turned into an if{}else{}.  But that cleanup is a
diversion from this particular TestClearPageLRU patch, and I think from
the whole series (checking final state of the patchset, yes, the switch
is still there - though I think there have been variant series which
removed it).

Can we please leave that cleanup until after the series has gone in?

I think several of us have cleanups or optimization that we want to
follow (I had one that inlines what isolate_migratepages_block() wanted
of __isolate_lru_page() into that function, so simplifying what vmscan.c
needs; perhaps that can now eliminate it completely, I've not tried
recently).  But there was a point at which the series was growing
ten patches per release as we all added our bits and pieces on top,
it got harder and harder to review the whole, and further from
getting the basics in: I do push back against that tendency.

Hugh


[PATCH V3 net-next 10/10] net: hns3: add ethtool priv-flag for EQ/CQ

2020-11-11 Thread Huazhong Tan
Add a control private flag in ethtool for switching EQ/CQ mode.

Signed-off-by: Huazhong Tan 
---
 drivers/net/ethernet/hisilicon/hns3/hnae3.h|  2 ++
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.c| 19 +++--
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.h|  2 ++
 drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 24 ++
 4 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h 
b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
index 345e8a4..a452874 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
@@ -719,6 +719,8 @@ struct hnae3_roce_private_info {
 
 enum hnae3_pflag {
HNAE3_PFLAG_DIM_ENABLE,
+   HNAE3_PFLAG_TX_CQE_MODE,
+   HNAE3_PFLAG_RX_CQE_MODE,
HNAE3_PFLAG_MAX
 };
 
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c 
b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index d1243ea..93f7731 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -4144,6 +4144,7 @@ static void hns3_info_show(struct hns3_nic_priv *priv)
 
 static void hns3_state_init(struct hnae3_handle *handle)
 {
+   struct hnae3_ae_dev *ae_dev = pci_get_drvdata(handle->pdev);
struct net_device *netdev = handle->kinfo.netdev;
struct hns3_nic_priv *priv = netdev_priv(netdev);
 
@@ -4151,10 +4152,24 @@ static void hns3_state_init(struct hnae3_handle *handle)
set_bit(HNS3_NIC_STATE_DIM_ENABLE, >state);
handle->priv_flags |= BIT(HNAE3_PFLAG_DIM_ENABLE);
set_bit(HNAE3_PFLAG_DIM_ENABLE, >supported_pflags);
+
+   /* device version above V3(include V3), GL can switch CQ/EQ period
+* mode.
+*/
+   if (ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V3) {
+   set_bit(HNAE3_PFLAG_TX_CQE_MODE, >supported_pflags);
+   set_bit(HNAE3_PFLAG_RX_CQE_MODE, >supported_pflags);
+   }
+
+   if (priv->tx_cqe_mode == DIM_CQ_PERIOD_MODE_START_FROM_CQE)
+   handle->priv_flags |= BIT(HNAE3_PFLAG_TX_CQE_MODE);
+
+   if (priv->rx_cqe_mode == DIM_CQ_PERIOD_MODE_START_FROM_CQE)
+   handle->priv_flags |= BIT(HNAE3_PFLAG_RX_CQE_MODE);
 }
 
-static void hns3_set_cq_period_mode(struct hns3_nic_priv *priv,
-   enum dim_cq_period_mode mode, bool is_tx)
+void hns3_set_cq_period_mode(struct hns3_nic_priv *priv,
+enum dim_cq_period_mode mode, bool is_tx)
 {
struct hnae3_ae_dev *ae_dev = pci_get_drvdata(priv->ae_handle->pdev);
struct hnae3_handle *handle = priv->ae_handle;
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h 
b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h
index c6c082a..ecdb544 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h
@@ -635,4 +635,6 @@ void hns3_dbg_uninit(struct hnae3_handle *handle);
 void hns3_dbg_register_debugfs(const char *debugfs_dir_name);
 void hns3_dbg_unregister_debugfs(void);
 void hns3_shinfo_pack(struct skb_shared_info *shinfo, __u32 *size);
+void hns3_set_cq_period_mode(struct hns3_nic_priv *priv,
+enum dim_cq_period_mode mode, bool is_tx);
 #endif
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c 
b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index 7462d43..ba9c0fe 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -417,8 +417,32 @@ static void hns3_update_dim_state(struct net_device 
*netdev, bool enable)
hns3_update_state(netdev, HNS3_NIC_STATE_DIM_ENABLE, enable);
 }
 
+static void hns3_update_cqe_mode(struct net_device *netdev, bool enable,
+bool is_tx)
+{
+   struct hns3_nic_priv *priv = netdev_priv(netdev);
+   enum dim_cq_period_mode mode;
+
+   mode = enable ? DIM_CQ_PERIOD_MODE_START_FROM_CQE :
+   DIM_CQ_PERIOD_MODE_START_FROM_EQE;
+
+   hns3_set_cq_period_mode(priv, mode, is_tx);
+}
+
+static void hns3_update_tx_cqe_mode(struct net_device *netdev, bool enable)
+{
+   hns3_update_cqe_mode(netdev, enable, true);
+}
+
+static void hns3_update_rx_cqe_mode(struct net_device *netdev, bool enable)
+{
+   hns3_update_cqe_mode(netdev, enable, false);
+}
+
 static const struct hns3_pflag_desc hns3_priv_flags[HNAE3_PFLAG_MAX] = {
{ "dim_enable", hns3_update_dim_state },
+   { "tx_cqe_mode",hns3_update_tx_cqe_mode },
+   { "rx_cqe_mode",hns3_update_rx_cqe_mode },
 };
 
 static int hns3_get_sset_count(struct net_device *netdev, int stringset)
-- 
2.7.4



[PATCH v9 1/2] dt-bindings: dma: Add bindings for Intel LGM SoC

2020-11-11 Thread Amireddy Mallikarjuna reddy
Add DT bindings YAML schema for DMA controller driver
of Lightning Mountain (LGM) SoC.

Signed-off-by: Amireddy Mallikarjuna reddy 
---
v1:
- Initial version.

v2:
- Fix bot errors.

v3:
- No change.

v4:
- Address Thomas langer comments
  - use node name pattern as dma-controller as in common binding.
  - Remove "_" (underscore) in instance name.
  - Remove "port-" and "chan-" in attribute name for both 'dma-ports' & 
'dma-channels' child nodes.

v5:
- Moved some of the attributes in 'dma-ports' & 'dma-channels' child nodes to 
dma client/consumer side as cells in 'dmas' properties.

v6:
- Add additionalProperties: false
- completely removed 'dma-ports' and 'dma-channels' child nodes.
- Moved channel dt properties to client side dmas.
- Use standard dma-channels and dma-channel-mask properties.
- Documented reset-names
- Add description for dma-cells

v7:
- modified compatible to oneof
- Reduced number of dma-cells to 3
- Fine tune the description of some properties.

v7-resend:
- rebase to 5.10-rc1

v8:
- rebased to 5.10-rc3
- Fixing the bot issues (wrong indentation)

v9:
- rebased to 5.10-rc3
- Use 'enum' instead of oneOf+const
- Drop '#dma-cells' in required:, already covered in dma-common.yaml
- Drop nodename Already covered by dma-controller.yaml
---
 .../devicetree/bindings/dma/intel,ldma.yaml| 130 +
 1 file changed, 130 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/intel,ldma.yaml

diff --git a/Documentation/devicetree/bindings/dma/intel,ldma.yaml 
b/Documentation/devicetree/bindings/dma/intel,ldma.yaml
new file mode 100644
index ..c06281a10178
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/intel,ldma.yaml
@@ -0,0 +1,130 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/dma/intel,ldma.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Lightning Mountain centralized low speed DMA and high speed DMA 
controllers.
+
+maintainers:
+  - chuanhua@intel.com
+  - mallikarjunax.re...@intel.com
+
+allOf:
+  - $ref: "dma-controller.yaml#"
+
+properties:
+  compatible:
+enum:
+  - intel,lgm-cdma
+  - intel,lgm-dma2tx
+  - intel,lgm-dma1rx
+  - intel,lgm-dma1tx
+  - intel,lgm-dma0tx
+  - intel,lgm-dma3
+  - intel,lgm-toe-dma30
+  - intel,lgm-toe-dma31
+
+  reg:
+maxItems: 1
+
+  "#dma-cells":
+const: 3
+description:
+  The first cell is the peripheral's DMA request line.
+  The second cell is the peripheral's (port) number corresponding to the 
channel.
+  The third cell is the burst length of the channel.
+
+  dma-channels:
+minimum: 1
+maximum: 16
+
+  dma-channel-mask:
+maxItems: 1
+
+  clocks:
+maxItems: 1
+
+  resets:
+maxItems: 1
+
+  reset-names:
+items:
+  - const: ctrl
+
+  interrupts:
+maxItems: 1
+
+  intel,dma-poll-cnt:
+$ref: /schemas/types.yaml#definitions/uint32
+description:
+  DMA descriptor polling counter is used to control the poling mechanism
+  for the descriptor fetching for all channels.
+
+  intel,dma-byte-en:
+type: boolean
+description:
+  DMA byte enable is only valid for DMA write(RX).
+  Byte enable(1) means DMA write will be based on the number of dwords
+  instead of the whole burst.
+
+  intel,dma-drb:
+type: boolean
+description:
+  DMA descriptor read back to make sure data and desc synchronization.
+
+  intel,dma-desc-in-sram:
+type: boolean
+description:
+  DMA descritpors in SRAM or not. Some old controllers descriptors
+  can be in DRAM or SRAM. The new ones are all in SRAM.
+
+  intel,dma-orrc:
+$ref: /schemas/types.yaml#definitions/uint32
+description:
+  DMA outstanding read counter value determine the number of
+  ORR-Outstanding Read Request. The maximum value is 16.
+
+  intel,dma-dburst-wr:
+type: boolean
+description:
+  Enable RX dynamic burst write. When it is enabled, the DMA does RX 
dynamic burst;
+  if it is disabled, the DMA RX will still support programmable fixed 
burst size of 2,4,8,16.
+  It only applies to RX DMA and memcopy DMA.
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+dma0: dma-controller@e0e0 {
+  compatible = "intel,lgm-cdma";
+  reg = <0xe0e0 0x1000>;
+  #dma-cells = <3>;
+  dma-channels = <16>;
+  dma-channel-mask = <0x>;
+  interrupt-parent = <>;
+  interrupts = <82 1>;
+  resets = < 0x30 0>;
+  reset-names = "ctrl";
+  clocks = < 80>;
+  intel,dma-poll-cnt = <4>;
+  intel,dma-byte-en;
+  intel,dma-drb;
+};
+  - |
+dma3: dma-controller@ec80 {
+  compatible = "intel,lgm-dma3";
+  reg = <0xec80 0x1000>;
+  clocks = < 71>;
+  resets = < 0x10 9>;
+  #dma-cells = <3>;
+  intel,dma-poll-cnt = <16>;
+  intel,dma-desc-in-sram;
+  

Re: [PATCH v5 0/7] dma-buf: Performance improvements for system heap & a system-uncached implementation

2020-11-11 Thread Sumit Semwal
Hi John,

On Tue, 10 Nov 2020 at 09:19, John Stultz  wrote:
>
> Hey All,
>   So just wanted to send my last revision of my patch series
> of performance optimizations to the dma-buf system heap.

Thanks very much for your patches - I think the first 5 patches look good to me.

I know there was a bit of discussion over adding a new system-uncached
heap v/s using a flag to identify that; I think I prefer the separate
heap idea, but lets ask one last time if any one else has any real
objections to it.

Daniel, Christian: any comments from your side on this?

I am planning to merge this series to drm-misc this week if I hear no
objections.
>
> This series reworks the system heap to use sgtables, and then
> consolidates the pagelist method from the heap-helpers into the
> CMA heap. After which the heap-helpers logic is removed (as it
> is unused). I'd still like to find a better way to avoid some of
> the logic duplication in implementing the entire dma_buf_ops
> handlers per heap. But unfortunately that code is tied somewhat
> to how the buffer's memory is tracked. As more heaps show up I
> think we'll have a better idea how to best share code, so for
> now I think this is ok.
>
> After this, the series introduces an optimization that
> Ørjan Eide implemented for ION that avoids calling sync on
> attachments that don't have a mapping.
>
> Next, an optimization to use larger order pages for the system
> heap. This change brings us closer to the current performance
> of the ION allocation code (though there still is a gap due
> to ION using a mix of deferred-freeing and page pools, I'll be
> looking at integrating those eventually).
>
> Finally, a reworked version of my uncached system heap
> implementation I was submitting a few weeks back. Since it
> duplicated a lot of the now reworked system heap code, I
> realized it would be much simpler to add the functionality to
> the system_heap implementation itself.
>
> While not improving the core allocation performance, the
> uncached heap allocations do result in *much* improved
> performance on HiKey960 as it avoids a lot of flushing and
> invalidating buffers that the cpu doesn't touch often.
>
> Feedback on these would be great!
>
> thanks
> -john
>
> New in v5:
> * Added a comment explaining why the order sizes are
>   chosen as they are
>
> Cc: Sumit Semwal 
> Cc: Liam Mark 
> Cc: Laura Abbott 
> Cc: Brian Starkey 
> Cc: Hridya Valsaraju 
> Cc: Suren Baghdasaryan 
> Cc: Sandeep Patil 
> Cc: Daniel Mentz 
> Cc: Chris Goldsworthy 
> Cc: Ørjan Eide 
> Cc: Robin Murphy 
> Cc: Ezequiel Garcia 
> Cc: Simon Ser 
> Cc: James Jones 
> Cc: linux-me...@vger.kernel.org
> Cc: dri-de...@lists.freedesktop.org
>
> John Stultz (7):
>   dma-buf: system_heap: Rework system heap to use sgtables instead of
> pagelists
>   dma-buf: heaps: Move heap-helper logic into the cma_heap
> implementation
>   dma-buf: heaps: Remove heap-helpers code
>   dma-buf: heaps: Skip sync if not mapped
>   dma-buf: system_heap: Allocate higher order pages if available
>   dma-buf: dma-heap: Keep track of the heap device struct
>   dma-buf: system_heap: Add a system-uncached heap re-using the system
> heap
>
>  drivers/dma-buf/dma-heap.c   |  33 +-
>  drivers/dma-buf/heaps/Makefile   |   1 -
>  drivers/dma-buf/heaps/cma_heap.c | 324 +++---
>  drivers/dma-buf/heaps/heap-helpers.c | 270 ---
>  drivers/dma-buf/heaps/heap-helpers.h |  53 ---
>  drivers/dma-buf/heaps/system_heap.c  | 494 ---
>  include/linux/dma-heap.h |   9 +
>  7 files changed, 753 insertions(+), 431 deletions(-)
>  delete mode 100644 drivers/dma-buf/heaps/heap-helpers.c
>  delete mode 100644 drivers/dma-buf/heaps/heap-helpers.h
>
> --
> 2.17.1
>
Thanks much,

Best,
Sumit.


[PATCH v10 4/5] Bluetooth: Refactor read default sys config for various types

2020-11-11 Thread Howard Chung
Refactor read default system configuration function so that it's capable
of returning different types than u16

Signed-off-by: Howard Chung 
---

(no changes since v8)

Changes in v8:
- Update the commit title and message

 net/bluetooth/mgmt_config.c | 140 +---
 1 file changed, 84 insertions(+), 56 deletions(-)

diff --git a/net/bluetooth/mgmt_config.c b/net/bluetooth/mgmt_config.c
index 2d3ad288c78ac..282fbf82f3192 100644
--- a/net/bluetooth/mgmt_config.c
+++ b/net/bluetooth/mgmt_config.c
@@ -11,72 +11,100 @@
 #include "mgmt_util.h"
 #include "mgmt_config.h"
 
-#define HDEV_PARAM_U16(_param_code_, _param_name_) \
-{ \
-   { cpu_to_le16(_param_code_), sizeof(__u16) }, \
-   { cpu_to_le16(hdev->_param_name_) } \
-}
+#define HDEV_PARAM_U16(_param_name_) \
+   struct {\
+   struct mgmt_tlv entry; \
+   __le16 value; \
+   } __packed _param_name_
 
-#define HDEV_PARAM_U16_JIFFIES_TO_MSECS(_param_code_, _param_name_) \
-{ \
-   { cpu_to_le16(_param_code_), sizeof(__u16) }, \
-   { cpu_to_le16(jiffies_to_msecs(hdev->_param_name_)) } \
-}
+#define TLV_SET_U16(_param_code_, _param_name_) \
+   { \
+   { cpu_to_le16(_param_code_), sizeof(__u16) }, \
+   cpu_to_le16(hdev->_param_name_) \
+   }
+
+#define TLV_SET_U16_JIFFIES_TO_MSECS(_param_code_, _param_name_) \
+   { \
+   { cpu_to_le16(_param_code_), sizeof(__u16) }, \
+   cpu_to_le16(jiffies_to_msecs(hdev->_param_name_)) \
+   }
 
 int read_def_system_config(struct sock *sk, struct hci_dev *hdev, void *data,
   u16 data_len)
 {
-   struct {
-   struct mgmt_tlv entry;
-   union {
-   /* This is a simplification for now since all values
-* are 16 bits.  In the future, this code may need
-* refactoring to account for variable length values
-* and properly calculate the required buffer size.
-*/
-   __le16 value;
-   };
-   } __packed params[] = {
+   int ret;
+   struct mgmt_rp_read_def_system_config {
/* Please see mgmt-api.txt for documentation of these values */
-   HDEV_PARAM_U16(0x, def_page_scan_type),
-   HDEV_PARAM_U16(0x0001, def_page_scan_int),
-   HDEV_PARAM_U16(0x0002, def_page_scan_window),
-   HDEV_PARAM_U16(0x0003, def_inq_scan_type),
-   HDEV_PARAM_U16(0x0004, def_inq_scan_int),
-   HDEV_PARAM_U16(0x0005, def_inq_scan_window),
-   HDEV_PARAM_U16(0x0006, def_br_lsto),
-   HDEV_PARAM_U16(0x0007, def_page_timeout),
-   HDEV_PARAM_U16(0x0008, sniff_min_interval),
-   HDEV_PARAM_U16(0x0009, sniff_max_interval),
-   HDEV_PARAM_U16(0x000a, le_adv_min_interval),
-   HDEV_PARAM_U16(0x000b, le_adv_max_interval),
-   HDEV_PARAM_U16(0x000c, def_multi_adv_rotation_duration),
-   HDEV_PARAM_U16(0x000d, le_scan_interval),
-   HDEV_PARAM_U16(0x000e, le_scan_window),
-   HDEV_PARAM_U16(0x000f, le_scan_int_suspend),
-   HDEV_PARAM_U16(0x0010, le_scan_window_suspend),
-   HDEV_PARAM_U16(0x0011, le_scan_int_discovery),
-   HDEV_PARAM_U16(0x0012, le_scan_window_discovery),
-   HDEV_PARAM_U16(0x0013, le_scan_int_adv_monitor),
-   HDEV_PARAM_U16(0x0014, le_scan_window_adv_monitor),
-   HDEV_PARAM_U16(0x0015, le_scan_int_connect),
-   HDEV_PARAM_U16(0x0016, le_scan_window_connect),
-   HDEV_PARAM_U16(0x0017, le_conn_min_interval),
-   HDEV_PARAM_U16(0x0018, le_conn_max_interval),
-   HDEV_PARAM_U16(0x0019, le_conn_latency),
-   HDEV_PARAM_U16(0x001a, le_supv_timeout),
-   HDEV_PARAM_U16_JIFFIES_TO_MSECS(0x001b,
-   def_le_autoconnect_timeout),
-   HDEV_PARAM_U16(0x001d, advmon_allowlist_duration),
-   HDEV_PARAM_U16(0x001e, advmon_no_filter_duration),
+   HDEV_PARAM_U16(def_page_scan_type);
+   HDEV_PARAM_U16(def_page_scan_int);
+   HDEV_PARAM_U16(def_page_scan_window);
+   HDEV_PARAM_U16(def_inq_scan_type);
+   HDEV_PARAM_U16(def_inq_scan_int);
+   HDEV_PARAM_U16(def_inq_scan_window);
+   HDEV_PARAM_U16(def_br_lsto);
+   HDEV_PARAM_U16(def_page_timeout);
+   HDEV_PARAM_U16(sniff_min_interval);
+   HDEV_PARAM_U16(sniff_max_interval);
+   HDEV_PARAM_U16(le_adv_min_interval);
+   HDEV_PARAM_U16(le_adv_max_interval);
+   HDEV_PARAM_U16(def_multi_adv_rotation_duration);
+   HDEV_PARAM_U16(le_scan_interval);
+   

linux-next: Tree for Nov 12

2020-11-11 Thread Stephen Rothwell
Hi all,

Changes since 2020:

The drivers-memory tree still had its build failure.

The mac80211-next tree lost its build failure.

Non-merge commits (relative to Linus' tree): 4823
 5042 files changed, 519831 insertions(+), 79842 deletions(-)



I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
(patches at http://www.kernel.org/pub/linux/kernel/next/ ).  If you
are tracking the linux-next tree using git, you should not use "git pull"
to do so as that will try to merge the new linux-next release with the
old one.  You should use "git fetch" and checkout or reset to the new
master.

You can see which trees have been included by looking in the Next/Trees
file in the source.  There are also quilt-import.log and merge.log
files in the Next directory.  Between each merge, the tree was built
with a ppc64_defconfig for powerpc, an allmodconfig for x86_64, a
multi_v7_defconfig for arm and a native build of tools/perf. After
the final fixups (if any), I do an x86_64 modules_install followed by
builds for x86_64 allnoconfig, powerpc allnoconfig (32 and 64 bit),
ppc44x_defconfig, allyesconfig and pseries_le_defconfig and i386, sparc
and sparc64 defconfig and htmldocs. And finally, a simple boot test
of the powerpc pseries_le_defconfig kernel in qemu (with and without
kvm enabled).

Below is a summary of the state of the merge.

I am currently merging 327 trees (counting Linus' and 85 trees of bug
fix patches pending for the current merge release).

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

Status of my local build tests will be at
http://kisskb.ellerman.id.au/linux-next .  If maintainers want to give
advice about cross compilers/configs that work, we are always open to add
more builds.

Thanks to Randy Dunlap for doing many randconfig builds.  And to Paul
Gortmaker for triage and bug fixes.

-- 
Cheers,
Stephen Rothwell

$ git checkout master
$ git reset --hard stable
Merging origin/master (eccc87672492 Merge branch 'fixes' of 
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs)
Merging fixes/fixes (9123e3a74ec7 Linux 5.9-rc1)
Merging kbuild-current/fixes (d1889589a4f5 builddeb: Fix rootless build in 
setuid/setgid directory)
Merging arc-current/for-curr (3b57533b460c ARC: [plat-hsdk] Remap CCMs super 
early in asm boot trampoline)
Merging arm-current/fixes (9fa2e7af3d53 ARM: 9019/1: kprobes: Avoid 
fortify_panic() when copying optprobe template)
Merging arm64-fixes/for-next/fixes (04e613ded8c2 arm64: smp: Tell RCU about 
CPUs that fail to come online)
Merging arm-soc-fixes/arm/fixes (3d696f42c7f4 soc: ti: ti_sci_pm_domains: check 
for proper args count in xlate)
Merging drivers-memory-fixes/fixes (3650b228f83a Linux 5.10-rc1)
Merging m68k-current/for-linus (50c5feeea0af ide/macide: Convert Mac IDE driver 
to platform driver)
Merging powerpc-fixes/fixes (01776f070ffc powerpc/32s: Use relocation offset 
when setting early hash table)
Merging s390-fixes/fixes (ce9dfafe29be s390: fix system call exit path)
Merging sparc/master (0a95a6d1a4cd sparc: use for_each_child_of_node() macro)
Merging fscrypt-current/for-stable (92cfcd030e4b fscrypt: remove reachable WARN 
in fscrypt_setup_iv_ino_lblk_32_key())
Merging net/master (e87d24fce924 Merge branch 'net-iucv-fixes-2020-11-09')
Merging bpf/master (f16e631333a8 bpf: Fix unsigned 'datasec_id' compared with 
zero in check_pseudo_btf_id)
Merging ipsec/master (bc0230b6461c Merge branch 'xfrm/compat: syzbot-found 
fixes')
Merging netfilter/master (fea07a487c6d net: openvswitch: silence suspicious RCU 
usage warning)
Merging ipvs/master (fea07a487c6d net: openvswitch: silence suspicious RCU 
usage warning)
Merging wireless-drivers/master (fe56d05ee6c8 iwlwifi: mvm: fix kernel panic in 
case of assert during CSA)
Merging mac80211/master (989ef49bdf10 mptcp: provide rmem[0] limit)
Merging rdma-fixes/for-rc (f8394f232b1e Linux 5.10-rc3)
Merging sound-current/for-linus (b5acfe152aba ALSA: hda/realtek: Add some Clove 
SSID in the ALC293(ALC1220))
Merging sound-asoc-fixes/for-linus (3317433d5091 Merge remote-tracking branch 
'asoc/for-5.10' into asoc-linus)
Merging regmap-fixes/for-linus (780f88b04704 Merge remote-tracking branch 
'regmap/for-5.10' into regmap-linus)
Merging regulator-fixes/for-linus (365ec8b61689 regulator: pfuze100: limit 
pfuze-support-disable-sw to pfuze{100,200})
Merging spi-fixes/for-linus (8e2ba731d153 Merge remote-tracking branch 
'spi/for-5.10' into spi-linus)
Merging pci-current/for-linus (832ea234277a PCI: mvebu: Fix duplicate resource 
requests)
Merging driver-core.current/driver-core-linus (f8394f232b1e Linux 5.10-rc3)
Merging tty.current/tty-linus (f8394f232b1e Linux 5.10-rc3)
Merging usb.current/usb-linus (368183029cc4 Merge tag 
'thunderbolt-for-v5.10-rc4' of 
git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into 
us

[PATCH v9 2/2] Add Intel LGM SoC DMA support.

2020-11-11 Thread Amireddy Mallikarjuna reddy
Add DMA controller driver for Lightning Mountain (LGM) family of SoCs.

The main function of the DMA controller is the transfer of data from/to any
peripheral to/from the memory. A memory to memory copy capability can also
be configured.

This ldma driver is used for configure the device and channnels for data
and control paths.

Signed-off-by: Amireddy Mallikarjuna reddy 
---
v1:
- Initial version.

v2:
- Fix device tree bot issues, correspondign driver changes done.
- Fix kerntel test robot warnings.
  
  >> drivers/dma/lgm/lgm-dma.c:729:5: warning: no previous prototype for 
function 'intel_dma_chan_desc_cfg' [-Wmissing-prototypes]
  int intel_dma_chan_desc_cfg(struct dma_chan *chan, dma_addr_t desc_base,
  ^
  drivers/dma/lgm/lgm-dma.c:729:1: note: declare 'static' if the function is 
not intended to be used outside of this translation unit
  int intel_dma_chan_desc_cfg(struct dma_chan *chan, dma_addr_t desc_base,
  ^
  static
  1 warning generated.

  vim +/intel_dma_chan_desc_cfg +729 drivers/dma/lgm/lgm-dma.c

728
  > 729 int intel_dma_chan_desc_cfg(struct dma_chan *chan, dma_addr_t desc_base,
730 int desc_num)
731 {
732 return ldma_chan_desc_cfg(to_ldma_chan(chan), desc_base, 
desc_num);
733 }
734 EXPORT_SYMBOL_GPL(intel_dma_chan_desc_cfg);
735

   Reported-by: kernel test robot 
   ---

v3:
- Fix smatch warning.
  
  smatch warnings:
  drivers/dma/lgm/lgm-dma.c:1306 ldma_cfg_init() error: uninitialized symbol 
'ret'.

  Reported-by: kernel test robot 
  Reported-by: Dan Carpenter 
  

v4:
- Address Thomas Langer comments in dtbinding and corresponding driver side 
changes.
- Driver side changes to corresponding device tree changes.

v5:
- Add changes to read 'dmas' properties and update the config properties driver 
side.
- Add virt_dma_desc utilizes virt-dma API.

v6:
- Driver changes corresponding to the device tree changes.
- Restructure things to have less activity with the spinlock.
- Save the slave config in dma_slave_config() and used in prepare time.
- Addressed & fixed issues related to desc_free callback _free_ up the memory.
- Addressed peter review comments.

v7:
- Change bool to tristate in Kconfig
- Explained the _initcall()
- change of_property*() to device_property_*()
- split the code to functions at version checks
- Remove the dma caller capability restrictions
- used for_each_set_bit()
- Addressed minor comments and fine tune the code.

v7-resend:
- rebase to 5.10-rc1

v8:
- rebase to 5.10-rc3
- Addressed structural things and fine tune the code.

v9:
- rebase to 5.10-rc3
- No change.
---
 drivers/dma/Kconfig |2 +
 drivers/dma/Makefile|1 +
 drivers/dma/lgm/Kconfig |9 +
 drivers/dma/lgm/Makefile|2 +
 drivers/dma/lgm/lgm-dma.c   | 1742 +++
 include/linux/dma/lgm_dma.h |   27 +
 6 files changed, 1783 insertions(+)
 create mode 100644 drivers/dma/lgm/Kconfig
 create mode 100644 drivers/dma/lgm/Makefile
 create mode 100644 drivers/dma/lgm/lgm-dma.c
 create mode 100644 include/linux/dma/lgm_dma.h

diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 90284ffda58a..34c78e4255d8 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -730,6 +730,8 @@ source "drivers/dma/ti/Kconfig"
 
 source "drivers/dma/fsl-dpaa2-qdma/Kconfig"
 
+source "drivers/dma/lgm/Kconfig"
+
 # clients
 comment "DMA Clients"
depends on DMA_ENGINE
diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile
index 948a8da05f8b..649a4f95ea4b 100644
--- a/drivers/dma/Makefile
+++ b/drivers/dma/Makefile
@@ -82,6 +82,7 @@ obj-$(CONFIG_XGENE_DMA) += xgene-dma.o
 obj-$(CONFIG_ZX_DMA) += zx_dma.o
 obj-$(CONFIG_ST_FDMA) += st_fdma.o
 obj-$(CONFIG_FSL_DPAA2_QDMA) += fsl-dpaa2-qdma/
+obj-$(CONFIG_INTEL_LDMA) += lgm/
 
 obj-y += mediatek/
 obj-y += qcom/
diff --git a/drivers/dma/lgm/Kconfig b/drivers/dma/lgm/Kconfig
new file mode 100644
index ..bdb5b0d91afb
--- /dev/null
+++ b/drivers/dma/lgm/Kconfig
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0-only
+config INTEL_LDMA
+   bool "Lightning Mountain centralized low speed DMA and high speed DMA 
controllers"
+   select DMA_ENGINE
+   select DMA_VIRTUAL_CHANNELS
+   help
+ Enable support for intel Lightning Mountain SOC DMA controllers.
+ These controllers provide DMA capabilities for a variety of on-chip
+ devices such as SSC, HSNAND and GSWIP.
diff --git a/drivers/dma/lgm/Makefile b/drivers/dma/lgm/Makefile
new file mode 100644
index ..f318a8eff464
--- /dev/null
+++ b/drivers/dma/lgm/Makefile
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_INTEL_LDMA)   += lgm-dma.o
diff --git 

[PATCH V3 net-next 06/10] net: hns3: add ethtool priv-flag for DIM

2020-11-11 Thread Huazhong Tan
Add a control private flag in ethtool for enable/disable
DIM feature.

Signed-off-by: Huazhong Tan 
---
 drivers/net/ethernet/hisilicon/hns3/hnae3.h|  7 +++
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.c|  1 +
 drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 71 ++
 3 files changed, 79 insertions(+)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h 
b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
index f9d4d23..18b3e43 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
@@ -716,6 +716,11 @@ struct hnae3_roce_private_info {
 #define HNAE3_UPE  (HNAE3_USER_UPE | HNAE3_OVERFLOW_UPE)
 #define HNAE3_MPE  (HNAE3_USER_MPE | HNAE3_OVERFLOW_MPE)
 
+enum hnae3_pflag {
+   HNAE3_PFLAG_DIM_ENABLE,
+   HNAE3_PFLAG_MAX
+};
+
 struct hnae3_handle {
struct hnae3_client *client;
struct pci_dev *pdev;
@@ -738,6 +743,8 @@ struct hnae3_handle {
 
/* Network interface message level enabled bits */
u32 msg_enable;
+
+   unsigned long priv_flags;
 };
 
 #define hnae3_set_field(origin, mask, shift, val) \
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c 
b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index 9e895b9..a567557 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -4246,6 +4246,7 @@ static int hns3_client_init(struct hnae3_handle *handle)
 
set_bit(HNS3_NIC_STATE_INITED, >state);
set_bit(HNS3_NIC_STATE_DIM_ENABLE, >state);
+   handle->priv_flags |= BIT(HNAE3_PFLAG_DIM_ENABLE);
 
if (netif_msg_drv(handle))
hns3_info_show(priv);
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c 
b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index c30d5d3..e8adc70 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -18,6 +18,11 @@ struct hns3_sfp_type {
u8 ext_type;
 };
 
+struct hns3_pflag_desc {
+   char name[ETH_GSTRING_LEN];
+   void (*handler)(struct net_device *netdev, bool enable);
+};
+
 /* tqp related stats */
 #define HNS3_TQP_STAT(_string, _member){   \
.stats_string = _string,\
@@ -59,6 +64,8 @@ static const struct hns3_stats hns3_rxq_stats[] = {
HNS3_TQP_STAT("non_reuse_pg", non_reuse_pg),
 };
 
+#define HNS3_PRIV_FLAGS_LEN ARRAY_SIZE(hns3_priv_flags)
+
 #define HNS3_RXQ_STATS_COUNT ARRAY_SIZE(hns3_rxq_stats)
 
 #define HNS3_TQP_STATS_COUNT (HNS3_TXQ_STATS_COUNT + HNS3_RXQ_STATS_COUNT)
@@ -394,6 +401,26 @@ static void hns3_self_test(struct net_device *ndev,
netif_dbg(h, drv, ndev, "self test end\n");
 }
 
+static void hns3_update_state(struct net_device *netdev,
+ enum hns3_nic_state state, bool enable)
+{
+   struct hns3_nic_priv *priv = netdev_priv(netdev);
+
+   if (enable)
+   set_bit(state, >state);
+   else
+   clear_bit(state, >state);
+}
+
+static void hns3_update_dim_state(struct net_device *netdev, bool enable)
+{
+   hns3_update_state(netdev, HNS3_NIC_STATE_DIM_ENABLE, enable);
+}
+
+static const struct hns3_pflag_desc hns3_priv_flags[HNAE3_PFLAG_MAX] = {
+   { "dim_enable", hns3_update_dim_state },
+};
+
 static int hns3_get_sset_count(struct net_device *netdev, int stringset)
 {
struct hnae3_handle *h = hns3_get_handle(netdev);
@@ -410,6 +437,9 @@ static int hns3_get_sset_count(struct net_device *netdev, 
int stringset)
case ETH_SS_TEST:
return ops->get_sset_count(h, stringset);
 
+   case ETH_SS_PRIV_FLAGS:
+   return HNAE3_PFLAG_MAX;
+
default:
return -EOPNOTSUPP;
}
@@ -463,6 +493,7 @@ static void hns3_get_strings(struct net_device *netdev, u32 
stringset, u8 *data)
struct hnae3_handle *h = hns3_get_handle(netdev);
const struct hnae3_ae_ops *ops = h->ae_algo->ops;
char *buff = (char *)data;
+   int i;
 
if (!ops->get_strings)
return;
@@ -475,6 +506,13 @@ static void hns3_get_strings(struct net_device *netdev, 
u32 stringset, u8 *data)
case ETH_SS_TEST:
ops->get_strings(h, stringset, data);
break;
+   case ETH_SS_PRIV_FLAGS:
+   for (i = 0; i < HNS3_PRIV_FLAGS_LEN; i++) {
+   snprintf(buff, ETH_GSTRING_LEN, "%s",
+hns3_priv_flags[i].name);
+   buff += ETH_GSTRING_LEN;
+   }
+   break;
default:
break;
}
@@ -1516,6 +1554,35 @@ static int hns3_get_module_eeprom(struct net_device 
*netdev,
return ops->get_module_eeprom(handle, ee->offset, ee->len, data);
 }
 
+static u32 hns3_get_priv_flags(struct net_device *netdev)
+{
+   struct 

[PATCH V3 net-next 09/10] net: hns3: add support for EQ/CQ mode configuration

2020-11-11 Thread Huazhong Tan
For device whose version is above V3(include V3), the GL can
select EQ or CQ mode, so adds support for it.

In CQ mode, the coalesced timer will restart when the first new
completion occurs, while in EQ mode, the timer will not restart.

Signed-off-by: Huazhong Tan 
---
 drivers/net/ethernet/hisilicon/hns3/hnae3.h|  1 +
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.c| 49 +-
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.h|  8 
 .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c|  1 +
 .../ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c  |  1 +
 5 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h 
b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
index 3642740..345e8a4 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
@@ -684,6 +684,7 @@ struct hnae3_knic_private_info {
 
u16 int_rl_setting;
enum pkt_hash_types rss_type;
+   void __iomem *io_base;
 };
 
 struct hnae3_roce_private_info {
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c 
b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index c30cf9e..d1243ea 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -3653,9 +3653,7 @@ static void hns3_tx_dim_work(struct work_struct *work)
 static void hns3_nic_init_dim(struct hns3_enet_tqp_vector *tqp_vector)
 {
INIT_WORK(_vector->rx_group.dim.work, hns3_rx_dim_work);
-   tqp_vector->rx_group.dim.mode = DIM_CQ_PERIOD_MODE_START_FROM_EQE;
INIT_WORK(_vector->tx_group.dim.work, hns3_tx_dim_work);
-   tqp_vector->tx_group.dim.mode = DIM_CQ_PERIOD_MODE_START_FROM_EQE;
 }
 
 static int hns3_nic_init_vector_data(struct hns3_nic_priv *priv)
@@ -4155,6 +4153,48 @@ static void hns3_state_init(struct hnae3_handle *handle)
set_bit(HNAE3_PFLAG_DIM_ENABLE, >supported_pflags);
 }
 
+static void hns3_set_cq_period_mode(struct hns3_nic_priv *priv,
+   enum dim_cq_period_mode mode, bool is_tx)
+{
+   struct hnae3_ae_dev *ae_dev = pci_get_drvdata(priv->ae_handle->pdev);
+   struct hnae3_handle *handle = priv->ae_handle;
+   int i;
+
+   if (is_tx) {
+   priv->tx_cqe_mode = mode;
+
+   for (i = 0; i < priv->vector_num; i++)
+   priv->tqp_vector[i].tx_group.dim.mode = mode;
+   } else {
+   priv->rx_cqe_mode = mode;
+
+   for (i = 0; i < priv->vector_num; i++)
+   priv->tqp_vector[i].rx_group.dim.mode = mode;
+   }
+
+   /* only device version above V3(include V3), GL can switch CQ/EQ
+* period mode.
+*/
+   if (ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V3) {
+   u32 new_mode;
+   u64 reg;
+
+   new_mode = (mode == DIM_CQ_PERIOD_MODE_START_FROM_CQE) ?
+   HNS3_CQ_MODE_CQE : HNS3_CQ_MODE_EQE;
+   reg = is_tx ? HNS3_GL1_CQ_MODE_REG : HNS3_GL0_CQ_MODE_REG;
+
+   writel(new_mode, handle->kinfo.io_base + reg);
+   }
+}
+
+static void hns3_cq_period_mode_init(struct hns3_nic_priv *priv,
+enum dim_cq_period_mode tx_mode,
+enum dim_cq_period_mode rx_mode)
+{
+   hns3_set_cq_period_mode(priv, tx_mode, true);
+   hns3_set_cq_period_mode(priv, rx_mode, false);
+}
+
 static int hns3_client_init(struct hnae3_handle *handle)
 {
struct pci_dev *pdev = handle->pdev;
@@ -4220,6 +4260,9 @@ static int hns3_client_init(struct hnae3_handle *handle)
goto out_init_ring;
}
 
+   hns3_cq_period_mode_init(priv, DIM_CQ_PERIOD_MODE_START_FROM_EQE,
+DIM_CQ_PERIOD_MODE_START_FROM_EQE);
+
ret = hns3_init_phy(netdev);
if (ret)
goto out_init_phy;
@@ -4580,6 +4623,8 @@ static int hns3_reset_notify_init_enet(struct 
hnae3_handle *handle)
if (ret)
goto err_uninit_vector;
 
+   hns3_cq_period_mode_init(priv, priv->tx_cqe_mode, priv->rx_cqe_mode);
+
/* the device can work without cpu rmap, only aRFS needs it */
ret = hns3_set_rx_cpu_rmap(netdev);
if (ret)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h 
b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h
index eb4e7ef..c6c082a 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h
@@ -188,6 +188,12 @@ enum hns3_nic_state {
 
 #define HNS3_RING_EN_B 0
 
+#define HNS3_GL0_CQ_MODE_REG   0x20d00
+#define HNS3_GL1_CQ_MODE_REG   0x20d04
+#define HNS3_GL2_CQ_MODE_REG   0x20d08
+#define HNS3_CQ_MODE_EQE   1U
+#define HNS3_CQ_MODE_CQE   0U
+
 enum hns3_pkt_l2t_type {
HNS3_L2_TYPE_UNICAST,
 

[PATCH v9 0/2] Add Intel LGM SoC DMA support

2020-11-11 Thread Amireddy Mallikarjuna reddy
Add DMA controller driver for Lightning Mountain (LGM) family of SoCs.

The main function of the DMA controller is the transfer of data from/to any
peripheral to/from the memory. A memory to memory copy capability can also
be configured. This ldma driver is used for configure the device and channnels
for data and control paths.

These controllers provide DMA capabilities for a variety of on-chip
devices such as SSC, HSNAND and GSWIP.

-
Future Plans:
-
LGM SOC also supports Hardware Memory Copy engine.
The role of the HW Memory copy engine is to offload memory copy operations
from the CPU.

Amireddy Mallikarjuna reddy (2):
  dt-bindings: dma: Add bindings for Intel LGM SoC
  Add Intel LGM SoC DMA support.

 .../devicetree/bindings/dma/intel,ldma.yaml|  130 ++
 drivers/dma/Kconfig|2 +
 drivers/dma/Makefile   |1 +
 drivers/dma/lgm/Kconfig|9 +
 drivers/dma/lgm/Makefile   |2 +
 drivers/dma/lgm/lgm-dma.c  | 1742 
 include/linux/dma/lgm_dma.h|   27 +
 7 files changed, 1913 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/intel,ldma.yaml
 create mode 100644 drivers/dma/lgm/Kconfig
 create mode 100644 drivers/dma/lgm/Makefile
 create mode 100644 drivers/dma/lgm/lgm-dma.c
 create mode 100644 include/linux/dma/lgm_dma.h

-- 
2.11.0



[PATCH V3 net-next 01/10] net: hns3: add support for configuring interrupt quantity limiting

2020-11-11 Thread Huazhong Tan
QL(quantity limiting) means that hardware supports the interrupt
coalesce based on the frame quantity.  QL can be configured when
int_ql_max in device's specification is non-zero, so add support
to configure it. Also, rename two coalesce init function to fit
their purpose.

Signed-off-by: Huazhong Tan 
---
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.c| 65 --
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.h| 13 -
 drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 43 +-
 .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c|  1 +
 .../ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c  |  1 +
 5 files changed, 105 insertions(+), 18 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c 
b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index a362516..6e08719 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -237,35 +237,68 @@ void hns3_set_vector_coalesce_tx_gl(struct 
hns3_enet_tqp_vector *tqp_vector,
writel(tx_gl_reg, tqp_vector->mask_addr + HNS3_VECTOR_GL1_OFFSET);
 }
 
-static void hns3_vector_gl_rl_init(struct hns3_enet_tqp_vector *tqp_vector,
-  struct hns3_nic_priv *priv)
+void hns3_set_vector_coalesce_tx_ql(struct hns3_enet_tqp_vector *tqp_vector,
+   u32 ql_value)
 {
+   writel(ql_value, tqp_vector->mask_addr + HNS3_VECTOR_TX_QL_OFFSET);
+}
+
+void hns3_set_vector_coalesce_rx_ql(struct hns3_enet_tqp_vector *tqp_vector,
+   u32 ql_value)
+{
+   writel(ql_value, tqp_vector->mask_addr + HNS3_VECTOR_RX_QL_OFFSET);
+}
+
+static void hns3_vector_coalesce_init(struct hns3_enet_tqp_vector *tqp_vector,
+ struct hns3_nic_priv *priv)
+{
+   struct hnae3_ae_dev *ae_dev = pci_get_drvdata(priv->ae_handle->pdev);
+   struct hns3_enet_coalesce *tx_coal = _vector->tx_group.coal;
+   struct hns3_enet_coalesce *rx_coal = _vector->rx_group.coal;
+
/* initialize the configuration for interrupt coalescing.
 * 1. GL (Interrupt Gap Limiter)
 * 2. RL (Interrupt Rate Limiter)
+* 3. QL (Interrupt Quantity Limiter)
 *
 * Default: enable interrupt coalescing self-adaptive and GL
 */
-   tqp_vector->tx_group.coal.gl_adapt_enable = 1;
-   tqp_vector->rx_group.coal.gl_adapt_enable = 1;
+   tx_coal->gl_adapt_enable = 1;
+   rx_coal->gl_adapt_enable = 1;
+
+   tx_coal->int_gl = HNS3_INT_GL_50K;
+   rx_coal->int_gl = HNS3_INT_GL_50K;
 
-   tqp_vector->tx_group.coal.int_gl = HNS3_INT_GL_50K;
-   tqp_vector->rx_group.coal.int_gl = HNS3_INT_GL_50K;
+   rx_coal->flow_level = HNS3_FLOW_LOW;
+   tx_coal->flow_level = HNS3_FLOW_LOW;
 
-   tqp_vector->rx_group.coal.flow_level = HNS3_FLOW_LOW;
-   tqp_vector->tx_group.coal.flow_level = HNS3_FLOW_LOW;
+   if (ae_dev->dev_specs.int_ql_max) {
+   tx_coal->ql_enable = 1;
+   rx_coal->ql_enable = 1;
+   tx_coal->int_ql_max = ae_dev->dev_specs.int_ql_max;
+   rx_coal->int_ql_max = ae_dev->dev_specs.int_ql_max;
+   tx_coal->int_ql = HNS3_INT_QL_DEFAULT_CFG;
+   rx_coal->int_ql = HNS3_INT_QL_DEFAULT_CFG;
+   }
 }
 
-static void hns3_vector_gl_rl_init_hw(struct hns3_enet_tqp_vector *tqp_vector,
- struct hns3_nic_priv *priv)
+static void
+hns3_vector_coalesce_init_hw(struct hns3_enet_tqp_vector *tqp_vector,
+struct hns3_nic_priv *priv)
 {
+   struct hns3_enet_coalesce *tx_coal = _vector->tx_group.coal;
+   struct hns3_enet_coalesce *rx_coal = _vector->rx_group.coal;
struct hnae3_handle *h = priv->ae_handle;
 
-   hns3_set_vector_coalesce_tx_gl(tqp_vector,
-  tqp_vector->tx_group.coal.int_gl);
-   hns3_set_vector_coalesce_rx_gl(tqp_vector,
-  tqp_vector->rx_group.coal.int_gl);
+   hns3_set_vector_coalesce_tx_gl(tqp_vector, tx_coal->int_gl);
+   hns3_set_vector_coalesce_rx_gl(tqp_vector, rx_coal->int_gl);
hns3_set_vector_coalesce_rl(tqp_vector, h->kinfo.int_rl_setting);
+
+   if (tx_coal->ql_enable)
+   hns3_set_vector_coalesce_tx_ql(tqp_vector, tx_coal->int_ql);
+
+   if (rx_coal->ql_enable)
+   hns3_set_vector_coalesce_rx_ql(tqp_vector, rx_coal->int_ql);
 }
 
 static int hns3_nic_set_real_num_queue(struct net_device *netdev)
@@ -3536,7 +3569,7 @@ static int hns3_nic_init_vector_data(struct hns3_nic_priv 
*priv)
 
for (i = 0; i < priv->vector_num; i++) {
tqp_vector = >tqp_vector[i];
-   hns3_vector_gl_rl_init_hw(tqp_vector, priv);
+   hns3_vector_coalesce_init_hw(tqp_vector, priv);
tqp_vector->num_tqps = 0;
}
 
@@ -3632,7 +3665,7 @@ static int 

[PATCH v2 05/10] ARM: dts: BCM5301X: Provide defaults ports container node

2020-11-11 Thread Florian Fainelli
Provide an empty 'ports' container node with the correct #address-cells
and #size-cells properties. This silences the following warning:

arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dt.yaml:
ethernet-switch@18007000: 'oneOf' conditional failed, one must be fixed:
'ports' is a required property
'ethernet-ports' is a required property
From schema:
Documentation/devicetree/bindings/net/dsa/b53.yaml

Signed-off-by: Florian Fainelli 
---
 arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts | 3 ---
 arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts | 3 ---
 arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts| 3 ---
 arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts| 3 ---
 arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts| 3 ---
 arch/arm/boot/dts/bcm47094-linksys-panamera.dts  | 3 ---
 arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts| 3 ---
 arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts| 3 ---
 arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts| 3 ---
 arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts | 3 ---
 arch/arm/boot/dts/bcm5301x.dtsi  | 4 
 arch/arm/boot/dts/bcm953012er.dts| 3 ---
 12 files changed, 4 insertions(+), 33 deletions(-)

diff --git a/arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts 
b/arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts
index 810fc32f1895..766107a28d4d 100644
--- a/arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts
+++ b/arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts
@@ -65,9 +65,6 @@  {
status = "okay";
 
ports {
-   #address-cells = <1>;
-   #size-cells = <0>;
-
port@0 {
reg = <0>;
label = "poe";
diff --git a/arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts 
b/arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts
index 7604b4480bb1..530380272a93 100644
--- a/arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts
+++ b/arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts
@@ -72,9 +72,6 @@  {
status = "okay";
 
ports {
-   #address-cells = <1>;
-   #size-cells = <0>;
-
port@4 {
reg = <4>;
label = "lan";
diff --git a/arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts 
b/arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts
index abd35a518046..51c64f0b2560 100644
--- a/arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts
+++ b/arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts
@@ -122,9 +122,6 @@  {
status = "okay";
 
ports {
-   #address-cells = <1>;
-   #size-cells = <0>;
-
port@0 {
reg = <0>;
label = "lan4";
diff --git a/arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts 
b/arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts
index 1ec655809e57..afc98234170f 100644
--- a/arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts
+++ b/arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts
@@ -65,9 +65,6 @@  {
status = "okay";
 
ports {
-   #address-cells = <1>;
-   #size-cells = <0>;
-
port@4 {
reg = <4>;
label = "poe";
diff --git a/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts 
b/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts
index 04bfd58127fc..811bc371562e 100644
--- a/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts
+++ b/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts
@@ -113,9 +113,6 @@  {
status = "okay";
 
ports {
-   #address-cells = <1>;
-   #size-cells = <0>;
-
port@0 {
reg = <0>;
label = "lan4";
diff --git a/arch/arm/boot/dts/bcm47094-linksys-panamera.dts 
b/arch/arm/boot/dts/bcm47094-linksys-panamera.dts
index 3bb3fe5bfbf8..3725f2b0d60b 100644
--- a/arch/arm/boot/dts/bcm47094-linksys-panamera.dts
+++ b/arch/arm/boot/dts/bcm47094-linksys-panamera.dts
@@ -201,9 +201,6 @@  {
dsa,member = <0 0>;
 
ports {
-   #address-cells = <1>;
-   #size-cells = <0>;
-
port@1 {
reg = <1>;
label = "lan7";
diff --git a/arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts 
b/arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts
index 068e384b8ab7..6fa101f0a90d 100644
--- a/arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts
+++ b/arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts
@@ -59,9 +59,6 @@  {
status = "okay";
 
ports {
-   #address-cells = <1>;
-   #size-cells = <0>;
-
port@0 {
reg = <0>;
label = "poe";
diff --git a/arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts 
b/arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts
index 9ae815ddbb4b..4f8d777ae18d 100644
--- a/arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts
+++ b/arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts
@@ -57,9 +57,6 @@  {
status = "okay";
 
ports {
-   #address-cells = 

  1   2   3   4   5   6   7   8   9   10   >