[PATCH 14/25] ASoC: stm32: i2s: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 sound/soc/stm/stm32_i2s.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/stm/stm32_i2s.c b/sound/soc/stm/stm32_i2s.c
index 7c4d63c33f15..138acfb26882 100644
--- a/sound/soc/stm/stm32_i2s.c
+++ b/sound/soc/stm/stm32_i2s.c
@@ -984,7 +984,6 @@ static int stm32_i2s_probe(struct platform_device *pdev)
 
 MODULE_DEVICE_TABLE(of, stm32_i2s_ids);
 
-#ifdef CONFIG_PM_SLEEP
 static int stm32_i2s_suspend(struct device *dev)
 {
struct stm32_i2s_data *i2s = dev_get_drvdata(dev);
@@ -1002,7 +1001,6 @@ static int stm32_i2s_resume(struct device *dev)
regcache_cache_only(i2s->regmap, false);
return regcache_sync(i2s->regmap);
 }
-#endif /* CONFIG_PM_SLEEP */
 
 static const struct dev_pm_ops stm32_i2s_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(stm32_i2s_suspend, stm32_i2s_resume)
-- 
2.28.0



[PATCH 16/25] ASoC: sirf: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 sound/soc/sirf/sirf-usp.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/sirf/sirf-usp.c b/sound/soc/sirf/sirf-usp.c
index 2af0c6f14ee6..ae2890827414 100644
--- a/sound/soc/sirf/sirf-usp.c
+++ b/sound/soc/sirf/sirf-usp.c
@@ -313,7 +313,6 @@ static int sirf_usp_pcm_runtime_resume(struct device *dev)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int sirf_usp_pcm_suspend(struct device *dev)
 {
struct sirf_usp *usp = dev_get_drvdata(dev);
@@ -340,7 +339,6 @@ static int sirf_usp_pcm_resume(struct device *dev)
}
return 0;
 }
-#endif
 
 static const struct snd_soc_component_driver sirf_usp_component = {
.name   = "sirf-usp",
-- 
2.28.0



[PATCH 18/25] ASoC: codecs: max98373: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 sound/soc/codecs/max98373-i2c.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/codecs/max98373-i2c.c b/sound/soc/codecs/max98373-i2c.c
index 92921e34f948..f847e7e76635 100644
--- a/sound/soc/codecs/max98373-i2c.c
+++ b/sound/soc/codecs/max98373-i2c.c
@@ -468,7 +468,6 @@ static struct snd_soc_dai_driver max98373_dai[] = {
}
 };
 
-#ifdef CONFIG_PM_SLEEP
 static int max98373_suspend(struct device *dev)
 {
struct max98373_priv *max98373 = dev_get_drvdata(dev);
@@ -487,7 +486,6 @@ static int max98373_resume(struct device *dev)
regcache_sync(max98373->regmap);
return 0;
 }
-#endif
 
 static const struct dev_pm_ops max98373_pm = {
SET_SYSTEM_SLEEP_PM_OPS(max98373_suspend, max98373_resume)
-- 
2.28.0



[PATCH 19/25] ASoC: sirf-audio: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 sound/soc/codecs/sirf-audio-codec.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/codecs/sirf-audio-codec.c 
b/sound/soc/codecs/sirf-audio-codec.c
index a061d78473ac..b6a101ec6e7c 100644
--- a/sound/soc/codecs/sirf-audio-codec.c
+++ b/sound/soc/codecs/sirf-audio-codec.c
@@ -522,7 +522,6 @@ static int sirf_audio_codec_driver_remove(struct 
platform_device *pdev)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int sirf_audio_codec_suspend(struct device *dev)
 {
struct sirf_audio_codec *sirf_audio_codec = dev_get_drvdata(dev);
@@ -552,7 +551,6 @@ static int sirf_audio_codec_resume(struct device *dev)
 
return 0;
 }
-#endif
 
 static const struct dev_pm_ops sirf_audio_codec_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(sirf_audio_codec_suspend, 
sirf_audio_codec_resume)
-- 
2.28.0



[PATCH 23/25] ASoC: ts3a227e: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 sound/soc/codecs/ts3a227e.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/codecs/ts3a227e.c b/sound/soc/codecs/ts3a227e.c
index 3ed3b45fa7ba..95d17cf7695a 100644
--- a/sound/soc/codecs/ts3a227e.c
+++ b/sound/soc/codecs/ts3a227e.c
@@ -334,7 +334,6 @@ static int ts3a227e_i2c_probe(struct i2c_client *i2c,
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int ts3a227e_suspend(struct device *dev)
 {
struct ts3a227e *ts3a227e = dev_get_drvdata(dev);
@@ -354,7 +353,6 @@ static int ts3a227e_resume(struct device *dev)
 
return 0;
 }
-#endif
 
 static const struct dev_pm_ops ts3a227e_pm = {
SET_SYSTEM_SLEEP_PM_OPS(ts3a227e_suspend, ts3a227e_resume)
-- 
2.28.0



Re: [PATCH 2/2] usb: dwc3: gadget: Preserve UDC max speed setting

2020-10-29 Thread Thinh Nguyen
Thinh Nguyen wrote:
> Wesley Cheng wrote:
>> On 10/28/2020 5:43 PM, Thinh Nguyen wrote:
>>> Hi,
>>>
>>> Wesley Cheng wrote:
 The USB gadget/UDC driver can restrict the DWC3 controller speed using
 dwc3_gadget_set_speed().  Store this setting into a variable, in order for
 this setting to persist across controller resets due to runtime PM.
>>> Why do we need to do this? DCFG should persist unless we overwrite it.
>>> The current PM shouldn't update the current speed setting.
>>>
>>> BR,
>>> Thinh
>>>
>> Hi Thinh,
>>
>> During runtime PM suspend, the dwc3_suspend_common() will call
>> dwc3_core_exit().  On some platforms they register the DWC3 reset
>> control to the DWC3 core driver (otherwise could be handled in the DWC3
>> glue drivers), which will be asserted here:
>>
>> static void dwc3_core_exit(struct dwc3 *dwc)
>> {
>> ...
>>  reset_control_assert(dwc->reset);
>>
>> From the SNPS databook (Table 2-2 Resets for Registers) it mentions that
>> assertion of the reset signal will reset the DCFG register.
> I see. There's a hard reset on some platforms.
>
>> In addition to the above, with the change to allow runtime PM suspend
>> during UDC unbind, we need a way to avoid writing to the DCFG during the
>> UDC bind path. (if we entered suspend before re-binding the UDC)  If we
>> add an early exit based on the PM state (in
>> dwc3_gadget_set_udc_speed()), then we basically ignore the max speed
>> request from the UDC/gadget layer.
> Then shouldn't we restore the speed setting when dwc3_gadget_resume()
> instead of in dwc3_gadget_run_stop()?

Actually, ignore this comment. This is fine, and it may save some
register read/write operations. I was thinking of save/restore from
suspend and resume similar to hibernation.

Thanks,
Thinh

>
>> Since it looks like the DWC3 gadget driver doesn't like using
>> synchronous PM runtime resumes, by going this route, we can allow the
>> async runtime resume handler to do everything, such as writing the speed
>> config and re-enabling the controller.
>>
>> Thanks
>>
>> Regards,
>> Wesley Cheng
> Thanks,
> Thinh



[PATCH 22/25] ASoC: max98927: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 sound/soc/codecs/max98927.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/codecs/max98927.c b/sound/soc/codecs/max98927.c
index 8b206ee77709..48c6aa78a410 100644
--- a/sound/soc/codecs/max98927.c
+++ b/sound/soc/codecs/max98927.c
@@ -794,7 +794,6 @@ static int max98927_probe(struct snd_soc_component 
*component)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int max98927_suspend(struct device *dev)
 {
struct max98927_priv *max98927 = dev_get_drvdata(dev);
@@ -813,7 +812,6 @@ static int max98927_resume(struct device *dev)
regcache_sync(max98927->regmap);
return 0;
 }
-#endif
 
 static const struct dev_pm_ops max98927_pm = {
SET_SYSTEM_SLEEP_PM_OPS(max98927_suspend, max98927_resume)
-- 
2.28.0



[PATCH 24/25] ASoC: wm8994: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 sound/soc/codecs/wm8994.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index fc9ea198ac79..9294ad06f76d 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -4656,7 +4656,6 @@ static int wm8994_remove(struct platform_device *pdev)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int wm8994_suspend(struct device *dev)
 {
struct wm8994_priv *wm8994 = dev_get_drvdata(dev);
@@ -4681,7 +4680,6 @@ static int wm8994_resume(struct device *dev)
 
return 0;
 }
-#endif
 
 static const struct dev_pm_ops wm8994_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(wm8994_suspend, wm8994_resume)
-- 
2.28.0



[PATCH 25/25] ALSA: aoa: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 sound/aoa/fabrics/layout.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/sound/aoa/fabrics/layout.c b/sound/aoa/fabrics/layout.c
index d2e85b83f7ed..197d13f23141 100644
--- a/sound/aoa/fabrics/layout.c
+++ b/sound/aoa/fabrics/layout.c
@@ -1126,7 +1126,6 @@ static int aoa_fabric_layout_remove(struct soundbus_dev 
*sdev)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int aoa_fabric_layout_suspend(struct device *dev)
 {
struct layout_dev *ldev = dev_get_drvdata(dev);
@@ -1150,7 +1149,6 @@ static int aoa_fabric_layout_resume(struct device *dev)
 static SIMPLE_DEV_PM_OPS(aoa_fabric_layout_pm_ops,
aoa_fabric_layout_suspend, aoa_fabric_layout_resume);
 
-#endif
 
 static struct soundbus_driver aoa_soundbus_driver = {
.name = "snd_aoa_soundbus_drv",
@@ -1159,9 +1157,7 @@ static struct soundbus_driver aoa_soundbus_driver = {
.remove = aoa_fabric_layout_remove,
.driver = {
.owner = THIS_MODULE,
-#ifdef CONFIG_PM_SLEEP
.pm = _fabric_layout_pm_ops,
-#endif
}
 };
 
-- 
2.28.0



[PATCH 20/25] ASoC: max98390: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 sound/soc/codecs/max98390.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/codecs/max98390.c b/sound/soc/codecs/max98390.c
index ff5cc9bbec29..50b37e39bb6d 100644
--- a/sound/soc/codecs/max98390.c
+++ b/sound/soc/codecs/max98390.c
@@ -889,7 +889,6 @@ static int max98390_probe(struct snd_soc_component 
*component)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int max98390_suspend(struct device *dev)
 {
struct max98390_priv *max98390 = dev_get_drvdata(dev);
@@ -913,7 +912,6 @@ static int max98390_resume(struct device *dev)
 
return 0;
 }
-#endif
 
 static const struct dev_pm_ops max98390_pm = {
SET_SYSTEM_SLEEP_PM_OPS(max98390_suspend, max98390_resume)
-- 
2.28.0



[PATCH 3/5] i2c: brcmstb: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/i2c/busses/i2c-brcmstb.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-brcmstb.c b/drivers/i2c/busses/i2c-brcmstb.c
index d4e0a0f6732a..16f688e115be 100644
--- a/drivers/i2c/busses/i2c-brcmstb.c
+++ b/drivers/i2c/busses/i2c-brcmstb.c
@@ -713,7 +713,6 @@ static int brcmstb_i2c_remove(struct platform_device *pdev)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int brcmstb_i2c_suspend(struct device *dev)
 {
struct brcmstb_i2c_dev *i2c_dev = dev_get_drvdata(dev);
@@ -731,7 +730,6 @@ static int brcmstb_i2c_resume(struct device *dev)
 
return 0;
 }
-#endif
 
 static SIMPLE_DEV_PM_OPS(brcmstb_i2c_pm, brcmstb_i2c_suspend,
 brcmstb_i2c_resume);
-- 
2.28.0



Re: [PATCH] Staging: rtl8723bs: core: rtw_cmd: Fixed two if-statement coding style issues

2020-10-29 Thread Greg KH
On Wed, Oct 28, 2020 at 09:28:37PM +, Manuel Palenzuela wrote:
> Fixed two cases where the if-statement coding style wasn't following the 
> guidelines. (rtw_cmd.c)
>

Please properly wrap your changelog comments at 72 columns like your
editor asked you to :)

And what is with the file name in ()?

thanks,

greg k-h


[PATCH 5/5] i2c: stm32: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/i2c/busses/i2c-stm32f7.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
index f41f51a176a1..95ac9dfdf458 100644
--- a/drivers/i2c/busses/i2c-stm32f7.c
+++ b/drivers/i2c/busses/i2c-stm32f7.c
@@ -2262,7 +2262,6 @@ static int __maybe_unused 
stm32f7_i2c_runtime_resume(struct device *dev)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int stm32f7_i2c_regs_backup(struct stm32f7_i2c_dev *i2c_dev)
 {
int ret;
@@ -2356,7 +2355,6 @@ static int stm32f7_i2c_resume(struct device *dev)
 
return 0;
 }
-#endif
 
 static const struct dev_pm_ops stm32f7_i2c_pm_ops = {
SET_RUNTIME_PM_OPS(stm32f7_i2c_runtime_suspend,
-- 
2.28.0



[PATCH 1/5] i2c: qup: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/i2c/busses/i2c-qup.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
index fbc04b60cfd1..bf63e4567705 100644
--- a/drivers/i2c/busses/i2c-qup.c
+++ b/drivers/i2c/busses/i2c-qup.c
@@ -1940,7 +1940,6 @@ static int qup_i2c_pm_resume_runtime(struct device 
*device)
 }
 #endif
 
-#ifdef CONFIG_PM_SLEEP
 static int qup_i2c_suspend(struct device *device)
 {
if (!pm_runtime_suspended(device))
@@ -1955,7 +1954,6 @@ static int qup_i2c_resume(struct device *device)
pm_request_autosuspend(device);
return 0;
 }
-#endif
 
 static const struct dev_pm_ops qup_i2c_qup_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(
-- 
2.28.0



[PATCH 21/25] ASoC: codecs: max98090: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 sound/soc/codecs/max98090.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index 945a79e4f3eb..97175d7c99cc 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -2636,7 +2636,6 @@ static int max98090_runtime_suspend(struct device *dev)
 }
 #endif
 
-#ifdef CONFIG_PM_SLEEP
 static int max98090_resume(struct device *dev)
 {
struct max98090_priv *max98090 = dev_get_drvdata(dev);
@@ -2653,7 +2652,6 @@ static int max98090_resume(struct device *dev)
 
return 0;
 }
-#endif
 
 static const struct dev_pm_ops max98090_pm = {
SET_RUNTIME_PM_OPS(max98090_runtime_suspend,
-- 
2.28.0



[PATCH 2/5] i2c: mediatek: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/i2c/busses/i2c-mt65xx.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
index 0cbdfbe605b5..c2939f2e5dea 100644
--- a/drivers/i2c/busses/i2c-mt65xx.c
+++ b/drivers/i2c/busses/i2c-mt65xx.c
@@ -1284,7 +1284,6 @@ static int mtk_i2c_remove(struct platform_device *pdev)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int mtk_i2c_resume(struct device *dev)
 {
int ret;
@@ -1302,7 +1301,6 @@ static int mtk_i2c_resume(struct device *dev)
 
return 0;
 }
-#endif
 
 static const struct dev_pm_ops mtk_i2c_pm = {
SET_SYSTEM_SLEEP_PM_OPS(NULL, mtk_i2c_resume)
-- 
2.28.0



Re: [PATCH 2/2] usb: dwc3: gadget: Preserve UDC max speed setting

2020-10-29 Thread Thinh Nguyen
Wesley Cheng wrote:
>
> On 10/28/2020 5:43 PM, Thinh Nguyen wrote:
>> Hi,
>>
>> Wesley Cheng wrote:
>>> The USB gadget/UDC driver can restrict the DWC3 controller speed using
>>> dwc3_gadget_set_speed().  Store this setting into a variable, in order for
>>> this setting to persist across controller resets due to runtime PM.
>> Why do we need to do this? DCFG should persist unless we overwrite it.
>> The current PM shouldn't update the current speed setting.
>>
>> BR,
>> Thinh
>>
> Hi Thinh,
>
> During runtime PM suspend, the dwc3_suspend_common() will call
> dwc3_core_exit().  On some platforms they register the DWC3 reset
> control to the DWC3 core driver (otherwise could be handled in the DWC3
> glue drivers), which will be asserted here:
>
> static void dwc3_core_exit(struct dwc3 *dwc)
> {
> ...
>   reset_control_assert(dwc->reset);
>
> From the SNPS databook (Table 2-2 Resets for Registers) it mentions that
> assertion of the reset signal will reset the DCFG register.

I see. There's a hard reset on some platforms.

>
> In addition to the above, with the change to allow runtime PM suspend
> during UDC unbind, we need a way to avoid writing to the DCFG during the
> UDC bind path. (if we entered suspend before re-binding the UDC)  If we
> add an early exit based on the PM state (in
> dwc3_gadget_set_udc_speed()), then we basically ignore the max speed
> request from the UDC/gadget layer.

Then shouldn't we restore the speed setting when dwc3_gadget_resume()
instead of in dwc3_gadget_run_stop()?

>
> Since it looks like the DWC3 gadget driver doesn't like using
> synchronous PM runtime resumes, by going this route, we can allow the
> async runtime resume handler to do everything, such as writing the speed
> config and re-enabling the controller.
>
> Thanks
>
> Regards,
> Wesley Cheng

Thanks,
Thinh


回复: 回复: [PATCH v2] kthread_worker: re-set CPU affinities if CPU come online

2020-10-29 Thread Zhang, Qiang



发件人: Thomas Gleixner 
发送时间: 2020年10月28日 17:23
收件人: Zhang, Qiang; pmla...@suse.com; t...@kernel.org
抄送: a...@linux-foundation.org; linux...@kvack.org; linux-kernel@vger.kernel.org
主题: Re: 回复: [PATCH v2] kthread_worker: re-set CPU affinities if CPU come online

> [Please note this e-mail is from an EXTERNAL e-mail address]
>
> On Wed, Oct 28 2020 at 15:30, qiang zhang wrote:
>
>>How is that addressing any of the comments I made on V1 of this?
>
> Do you mean the following problem:
>
> "The dynamic hotplug states run late. What's preventing work to be queued
> on such a worker before it is bound to the CPU again?"
>
>This is one problem, but there are more and I explained them in great
>length. If there is anything unclear, then please ask.

Really, this patch is not considered that work may be put into the queue after 
the bound CPU is offline.   in addition, when the bound CPU goes online again, 
before restoring the worker's CPU affinity, work may be put into the queue.

Although  int this (powerclamp) way,that's not a problem, that it is solved by 
destroying and creating  tasks when the CPU hotplug,  in addition,  when CPU 
going down , this need call 'cancel_work_sync' func in offline callback,  this 
may be blocked long time. these operation is expensive.

this patch only just to recover  the worker task's affinity when CPU go to 
online again that create by "kthread_create_worker_on_cpu" func ,  likely 
per-CPU worker method when CPU hotplug in "workqueue" and "io-wq".

Thanks

Qiang

>
>Thanks,
>
>tglx


[PATCH 4/5] i2c: nomadik: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_LATE_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/i2c/busses/i2c-nomadik.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
index d4b1b0865f67..cd0f9f92c913 100644
--- a/drivers/i2c/busses/i2c-nomadik.c
+++ b/drivers/i2c/busses/i2c-nomadik.c
@@ -873,7 +873,6 @@ static irqreturn_t i2c_irq_handler(int irq, void *arg)
return IRQ_HANDLED;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int nmk_i2c_suspend_late(struct device *dev)
 {
int ret;
@@ -890,7 +889,6 @@ static int nmk_i2c_resume_early(struct device *dev)
 {
return pm_runtime_force_resume(dev);
 }
-#endif
 
 #ifdef CONFIG_PM
 static int nmk_i2c_runtime_suspend(struct device *dev)
-- 
2.28.0



[PATCH 09/25] ASoC: tegra: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 sound/soc/tegra/tegra30_ahub.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c
index 156e3b9d613c..9fc22d5e9f6e 100644
--- a/sound/soc/tegra/tegra30_ahub.c
+++ b/sound/soc/tegra/tegra30_ahub.c
@@ -629,7 +629,6 @@ static int tegra30_ahub_remove(struct platform_device *pdev)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int tegra30_ahub_suspend(struct device *dev)
 {
regcache_mark_dirty(ahub->regmap_ahub);
@@ -653,7 +652,6 @@ static int tegra30_ahub_resume(struct device *dev)
 
return ret;
 }
-#endif
 
 static const struct dev_pm_ops tegra30_ahub_pm_ops = {
SET_RUNTIME_PM_OPS(tegra30_ahub_runtime_suspend,
-- 
2.28.0



[PATCH 07/25] ASoC: img-spdif-out: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 sound/soc/img/img-spdif-out.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/img/img-spdif-out.c b/sound/soc/img/img-spdif-out.c
index b1d8e4535726..1549a8db6657 100644
--- a/sound/soc/img/img-spdif-out.c
+++ b/sound/soc/img/img-spdif-out.c
@@ -419,7 +419,6 @@ static int img_spdif_out_dev_remove(struct platform_device 
*pdev)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int img_spdif_out_suspend(struct device *dev)
 {
struct img_spdif_out *spdif = dev_get_drvdata(dev);
@@ -458,7 +457,6 @@ static int img_spdif_out_resume(struct device *dev)
 
return 0;
 }
-#endif
 static const struct of_device_id img_spdif_out_of_match[] = {
{ .compatible = "img,spdif-out" },
{}
-- 
2.28.0



[PATCH 08/25] ASoC: img-i2s-out: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 sound/soc/img/img-i2s-out.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/img/img-i2s-out.c b/sound/soc/img/img-i2s-out.c
index b56a18e7f3ac..7693b7fdf299 100644
--- a/sound/soc/img/img-i2s-out.c
+++ b/sound/soc/img/img-i2s-out.c
@@ -551,7 +551,6 @@ static int img_i2s_out_dev_remove(struct platform_device 
*pdev)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int img_i2s_out_suspend(struct device *dev)
 {
struct img_i2s_out *i2s = dev_get_drvdata(dev);
@@ -598,7 +597,6 @@ static int img_i2s_out_resume(struct device *dev)
 
return 0;
 }
-#endif
 
 static const struct of_device_id img_i2s_out_of_match[] = {
{ .compatible = "img,i2s-out" },
-- 
2.28.0



Re: [PATCH 01/25] ALSA: core: pcm: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Takashi Iwai
On Thu, 29 Oct 2020 08:42:37 +0100,
Coiby Xu wrote:
> 
> SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.
> 
> Signed-off-by: Coiby Xu 

It caused compile warnings.  Was it already addressed in general?

Or we may use __maybe_unused attribute instead, but it's just a matter
of taste.


thanks,

Takashi

> ---
>  sound/core/pcm.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/sound/core/pcm.c b/sound/core/pcm.c
> index be5714f1bb58..5a281ac92958 100644
> --- a/sound/core/pcm.c
> +++ b/sound/core/pcm.c
> @@ -599,7 +599,6 @@ static const struct attribute_group 
> *pcm_dev_attr_groups[];
>   * PM callbacks: we need to deal only with suspend here, as the resume is
>   * triggered either from user-space or the driver's resume callback
>   */
> -#ifdef CONFIG_PM_SLEEP
>  static int do_pcm_suspend(struct device *dev)
>  {
>   struct snd_pcm_str *pstr = container_of(dev, struct snd_pcm_str, dev);
> @@ -608,7 +607,6 @@ static int do_pcm_suspend(struct device *dev)
>   snd_pcm_suspend_all(pstr->pcm);
>   return 0;
>  }
> -#endif
>  
>  static const struct dev_pm_ops pcm_dev_pm_ops = {
>   SET_SYSTEM_SLEEP_PM_OPS(do_pcm_suspend, NULL)
> -- 
> 2.28.0
> 


[PATCH 01/15] iio: accel: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/iio/accel/da311.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/iio/accel/da311.c b/drivers/iio/accel/da311.c
index 3b3df620ba27..55d4891556ca 100644
--- a/drivers/iio/accel/da311.c
+++ b/drivers/iio/accel/da311.c
@@ -263,7 +263,6 @@ static int da311_remove(struct i2c_client *client)
return da311_enable(client, false);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int da311_suspend(struct device *dev)
 {
return da311_enable(to_i2c_client(dev), false);
@@ -273,7 +272,6 @@ static int da311_resume(struct device *dev)
 {
return da311_enable(to_i2c_client(dev), true);
 }
-#endif
 
 static SIMPLE_DEV_PM_OPS(da311_pm_ops, da311_suspend, da311_resume);
 
-- 
2.28.0



Re: [RFC PATCH 0/3] Allocate memmap from hotadded memory (per device)

2020-10-29 Thread David Hildenbrand

On 28.10.20 19:47, Mike Kravetz wrote:

On 10/27/20 8:58 AM, Oscar Salvador wrote:

On Tue, Oct 27, 2020 at 04:44:33PM +0100, David Hildenbrand wrote:

I'm planning on looking into patch #2/3 later this or next week (this week
is open source summit / KVM Forum).


Sure, aprecciated the time ;-)



One thing to look into right now is how to make this fly this with vmemmap
optimizations for hugetlb pages.

https://lkml.kernel.org/r/20201026145114.59424-1-songmuc...@bytedance.com


I was about to have a look at that series eitherway, but good you mentioned.



More eyes on that series would be appreciated.

That series will dynamically free and allocate memmap pages as hugetlb
pages are allocated or freed.  I haven't looked through this series, but
my first thought is that we would need to ensure those allocs/frees are
directed to the device.  Not sure if there are interfaces for that.


Directing to the device might be part of the solution, but does not have 
to be. You really want to free the pages to the OS in the end, otherwise 
you lose the whole benefit of the vmemmap optimization.


You would want to actually free the pages (making sure whatever 
generic_online_page() does was done to these special vmemmap pages). But 
then, you cannot simply skip all X first pages of a memory block when 
offlining, you can only skip the once that are still vmemmap pages 
(e.g., marked via page type), and have to isolate/migrate off the 
no-longer vmemmap pages.


--
Thanks,

David / dhildenb



[PATCH 05/25] ASoC: img: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 sound/soc/img/img-i2s-in.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/img/img-i2s-in.c b/sound/soc/img/img-i2s-in.c
index 0843235d73c9..8364eb9c44bc 100644
--- a/sound/soc/img/img-i2s-in.c
+++ b/sound/soc/img/img-i2s-in.c
@@ -545,7 +545,6 @@ static int img_i2s_in_dev_remove(struct platform_device 
*pdev)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int img_i2s_in_suspend(struct device *dev)
 {
struct img_i2s_in *i2s = dev_get_drvdata(dev);
@@ -592,7 +591,6 @@ static int img_i2s_in_resume(struct device *dev)
 
return 0;
 }
-#endif
 
 static const struct of_device_id img_i2s_in_of_match[] = {
{ .compatible = "img,i2s-in" },
-- 
2.28.0



[PATCH 06/25] ASoC: img-spdif-in: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 sound/soc/img/img-spdif-in.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/img/img-spdif-in.c b/sound/soc/img/img-spdif-in.c
index 46ff8a3621d5..bb73b7fc35da 100644
--- a/sound/soc/img/img-spdif-in.c
+++ b/sound/soc/img/img-spdif-in.c
@@ -823,7 +823,6 @@ static int img_spdif_in_dev_remove(struct platform_device 
*pdev)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int img_spdif_in_suspend(struct device *dev)
 {
struct img_spdif_in *spdif = dev_get_drvdata(dev);
@@ -863,7 +862,6 @@ static int img_spdif_in_resume(struct device *dev)
 
return 0;
 }
-#endif
 
 static const struct of_device_id img_spdif_in_of_match[] = {
{ .compatible = "img,spdif-in" },
-- 
2.28.0



[PATCH 04/25] ASoC: rockchip: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 sound/soc/rockchip/rockchip_pdm.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/rockchip/rockchip_pdm.c 
b/sound/soc/rockchip/rockchip_pdm.c
index 5adb293d0435..f3c19310aeeb 100644
--- a/sound/soc/rockchip/rockchip_pdm.c
+++ b/sound/soc/rockchip/rockchip_pdm.c
@@ -574,7 +574,6 @@ static int rockchip_pdm_remove(struct platform_device *pdev)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int rockchip_pdm_suspend(struct device *dev)
 {
struct rk_pdm_dev *pdm = dev_get_drvdata(dev);
@@ -601,7 +600,6 @@ static int rockchip_pdm_resume(struct device *dev)
 
return ret;
 }
-#endif
 
 static const struct dev_pm_ops rockchip_pdm_pm_ops = {
SET_RUNTIME_PM_OPS(rockchip_pdm_runtime_suspend,
-- 
2.28.0



[PATCH 03/25] ASoC: fsl: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 sound/soc/fsl/imx-audmux.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c
index 25c18b9e348f..6d77188a4eab 100644
--- a/sound/soc/fsl/imx-audmux.c
+++ b/sound/soc/fsl/imx-audmux.c
@@ -349,7 +349,6 @@ static int imx_audmux_remove(struct platform_device *pdev)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int imx_audmux_suspend(struct device *dev)
 {
int i;
@@ -377,7 +376,6 @@ static int imx_audmux_resume(struct device *dev)
 
return 0;
 }
-#endif /* CONFIG_PM_SLEEP */
 
 static const struct dev_pm_ops imx_audmux_pm = {
SET_SYSTEM_SLEEP_PM_OPS(imx_audmux_suspend, imx_audmux_resume)
-- 
2.28.0



[PATCH 05/15] iio: accel: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/iio/accel/mma9551.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/iio/accel/mma9551.c b/drivers/iio/accel/mma9551.c
index 08a2303cc9df..c3b7a1633907 100644
--- a/drivers/iio/accel/mma9551.c
+++ b/drivers/iio/accel/mma9551.c
@@ -558,7 +558,6 @@ static int mma9551_runtime_resume(struct device *dev)
 }
 #endif
 
-#ifdef CONFIG_PM_SLEEP
 static int mma9551_suspend(struct device *dev)
 {
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
@@ -584,7 +583,6 @@ static int mma9551_resume(struct device *dev)
 
return ret;
 }
-#endif
 
 static const struct dev_pm_ops mma9551_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(mma9551_suspend, mma9551_resume)
-- 
2.28.0



[PATCH 04/15] iio: accel: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/iio/accel/mc3230.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/iio/accel/mc3230.c b/drivers/iio/accel/mc3230.c
index 46e4283fc037..b966922b9899 100644
--- a/drivers/iio/accel/mc3230.c
+++ b/drivers/iio/accel/mc3230.c
@@ -160,7 +160,6 @@ static int mc3230_remove(struct i2c_client *client)
return mc3230_set_opcon(iio_priv(indio_dev), MC3230_MODE_OPCON_STANDBY);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int mc3230_suspend(struct device *dev)
 {
struct mc3230_data *data;
@@ -178,7 +177,6 @@ static int mc3230_resume(struct device *dev)
 
return mc3230_set_opcon(data, MC3230_MODE_OPCON_WAKE);
 }
-#endif
 
 static SIMPLE_DEV_PM_OPS(mc3230_pm_ops, mc3230_suspend, mc3230_resume);
 
-- 
2.28.0



[PATCH 02/25] ASoC: fsl: fsl_ssi: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 sound/soc/fsl/fsl_ssi.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 404be27c15fe..065500a4cbc1 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -1669,7 +1669,6 @@ static int fsl_ssi_remove(struct platform_device *pdev)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int fsl_ssi_suspend(struct device *dev)
 {
struct fsl_ssi *ssi = dev_get_drvdata(dev);
@@ -1699,7 +1698,6 @@ static int fsl_ssi_resume(struct device *dev)
 
return regcache_sync(regs);
 }
-#endif /* CONFIG_PM_SLEEP */
 
 static const struct dev_pm_ops fsl_ssi_pm = {
SET_SYSTEM_SLEEP_PM_OPS(fsl_ssi_suspend, fsl_ssi_resume)
-- 
2.28.0



[PATCH 03/15] iio: accel: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/iio/accel/mma9553.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/iio/accel/mma9553.c b/drivers/iio/accel/mma9553.c
index c15908faa381..1d2e57158b31 100644
--- a/drivers/iio/accel/mma9553.c
+++ b/drivers/iio/accel/mma9553.c
@@ -1197,7 +1197,6 @@ static int mma9553_runtime_resume(struct device *dev)
 }
 #endif
 
-#ifdef CONFIG_PM_SLEEP
 static int mma9553_suspend(struct device *dev)
 {
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
@@ -1223,7 +1222,6 @@ static int mma9553_resume(struct device *dev)
 
return ret;
 }
-#endif
 
 static const struct dev_pm_ops mma9553_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(mma9553_suspend, mma9553_resume)
-- 
2.28.0



[PATCH 01/25] ALSA: core: pcm: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 sound/core/pcm.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index be5714f1bb58..5a281ac92958 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -599,7 +599,6 @@ static const struct attribute_group *pcm_dev_attr_groups[];
  * PM callbacks: we need to deal only with suspend here, as the resume is
  * triggered either from user-space or the driver's resume callback
  */
-#ifdef CONFIG_PM_SLEEP
 static int do_pcm_suspend(struct device *dev)
 {
struct snd_pcm_str *pstr = container_of(dev, struct snd_pcm_str, dev);
@@ -608,7 +607,6 @@ static int do_pcm_suspend(struct device *dev)
snd_pcm_suspend_all(pstr->pcm);
return 0;
 }
-#endif
 
 static const struct dev_pm_ops pcm_dev_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(do_pcm_suspend, NULL)
-- 
2.28.0



[PATCH 06/15] iio: accel: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/iio/accel/dmard10.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/iio/accel/dmard10.c b/drivers/iio/accel/dmard10.c
index 90206f015857..64a15dea2a82 100644
--- a/drivers/iio/accel/dmard10.c
+++ b/drivers/iio/accel/dmard10.c
@@ -224,7 +224,6 @@ static int dmard10_remove(struct i2c_client *client)
return dmard10_shutdown(client);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int dmard10_suspend(struct device *dev)
 {
return dmard10_shutdown(to_i2c_client(dev));
@@ -234,7 +233,6 @@ static int dmard10_resume(struct device *dev)
 {
return dmard10_reset(to_i2c_client(dev));
 }
-#endif
 
 static SIMPLE_DEV_PM_OPS(dmard10_pm_ops, dmard10_suspend, dmard10_resume);
 
-- 
2.28.0



[PATCH 02/15] iio: accel: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/iio/accel/da280.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/iio/accel/da280.c b/drivers/iio/accel/da280.c
index 4472dde6899e..c82d241491dd 100644
--- a/drivers/iio/accel/da280.c
+++ b/drivers/iio/accel/da280.c
@@ -160,7 +160,6 @@ static int da280_remove(struct i2c_client *client)
return da280_enable(client, false);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int da280_suspend(struct device *dev)
 {
return da280_enable(to_i2c_client(dev), false);
@@ -170,7 +169,6 @@ static int da280_resume(struct device *dev)
 {
return da280_enable(to_i2c_client(dev), true);
 }
-#endif
 
 static SIMPLE_DEV_PM_OPS(da280_pm_ops, da280_suspend, da280_resume);
 
-- 
2.28.0



[PATCH V3 1/2] PCI/AER: Add pcie_is_ecrc_enabled() API

2020-10-29 Thread Vidya Sagar
Adds pcie_is_ecrc_enabled() API to let other sub-systems (like DesignWare)
to query if ECRC policy is enabled and perform any configuration
required in those respective sub-systems.

Signed-off-by: Vidya Sagar 
Reviewed-by: Jingoo Han 
---
V3:
* Address Ethan Zhao's comments
* Added 'Reviewed-by: Jingoo Han '

V2:
* None from V1

 drivers/pci/pci.h  |  2 ++
 drivers/pci/pcie/aer.c | 11 +++
 2 files changed, 13 insertions(+)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index fa12f7cbc1a0..325fdbf91dde 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -575,9 +575,11 @@ static inline void pcie_aspm_powersave_config_link(struct 
pci_dev *pdev) { }
 #ifdef CONFIG_PCIE_ECRC
 void pcie_set_ecrc_checking(struct pci_dev *dev);
 void pcie_ecrc_get_policy(char *str);
+bool pcie_is_ecrc_enabled(void);
 #else
 static inline void pcie_set_ecrc_checking(struct pci_dev *dev) { }
 static inline void pcie_ecrc_get_policy(char *str) { }
+static inline bool pcie_is_ecrc_enabled(void) { return false; }
 #endif
 
 #ifdef CONFIG_PCIE_PTM
diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
index 65dff5f3457a..d0f5a7043aff 100644
--- a/drivers/pci/pcie/aer.c
+++ b/drivers/pci/pcie/aer.c
@@ -207,6 +207,17 @@ void pcie_ecrc_get_policy(char *str)
 
ecrc_policy = i;
 }
+
+/**
+ * pcie_is_ecrc_enabled - returns if ECRC is enabled in the system or not
+ *
+ * Returns true if ECRC policy is enabled and false otherwise
+ */
+bool pcie_is_ecrc_enabled(void)
+{
+   return ecrc_policy == ECRC_POLICY_ON;
+}
+EXPORT_SYMBOL(pcie_is_ecrc_enabled);
 #endif /* CONFIG_PCIE_ECRC */
 
 #definePCI_EXP_AER_FLAGS   (PCI_EXP_DEVCTL_CERE | 
PCI_EXP_DEVCTL_NFERE | \
-- 
2.17.1



[PATCH 07/15] iio: ssp: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/iio/common/ssp_sensors/ssp_dev.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/iio/common/ssp_sensors/ssp_dev.c 
b/drivers/iio/common/ssp_sensors/ssp_dev.c
index 1aee87100038..e284ff702280 100644
--- a/drivers/iio/common/ssp_sensors/ssp_dev.c
+++ b/drivers/iio/common/ssp_sensors/ssp_dev.c
@@ -612,7 +612,6 @@ static int ssp_remove(struct spi_device *spi)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int ssp_suspend(struct device *dev)
 {
int ret;
@@ -661,7 +660,6 @@ static int ssp_resume(struct device *dev)
 
return 0;
 }
-#endif /* CONFIG_PM_SLEEP */
 
 static const struct dev_pm_ops ssp_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(ssp_suspend, ssp_resume)
-- 
2.28.0



[PATCH 08/15] iio: magnetometer: mmc35240: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/iio/magnetometer/mmc35240.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/iio/magnetometer/mmc35240.c 
b/drivers/iio/magnetometer/mmc35240.c
index 65f3d1ed0d59..37d330220433 100644
--- a/drivers/iio/magnetometer/mmc35240.c
+++ b/drivers/iio/magnetometer/mmc35240.c
@@ -521,7 +521,6 @@ static int mmc35240_probe(struct i2c_client *client,
return devm_iio_device_register(>dev, indio_dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int mmc35240_suspend(struct device *dev)
 {
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
@@ -548,7 +547,6 @@ static int mmc35240_resume(struct device *dev)
 
return 0;
 }
-#endif
 
 static const struct dev_pm_ops mmc35240_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(mmc35240_suspend, mmc35240_resume)
-- 
2.28.0



[PATCH 14/15] iio: light: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/iio/light/pa12203001.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/iio/light/pa12203001.c b/drivers/iio/light/pa12203001.c
index bfade6577a38..7737d2c8f0d5 100644
--- a/drivers/iio/light/pa12203001.c
+++ b/drivers/iio/light/pa12203001.c
@@ -417,14 +417,12 @@ static int pa12203001_suspend(struct device *dev)
 }
 #endif
 
-#ifdef CONFIG_PM_SLEEP
 static int pa12203001_resume(struct device *dev)
 {
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
 
return pa12203001_power_chip(indio_dev, PA12203001_CHIP_ENABLE);
 }
-#endif
 
 #ifdef CONFIG_PM
 static int pa12203001_runtime_resume(struct device *dev)
-- 
2.28.0



[PATCH 2/3] Input: adp5589: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/input/keyboard/adp5589-keys.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/input/keyboard/adp5589-keys.c 
b/drivers/input/keyboard/adp5589-keys.c
index eb0e9cd66bcb..50f94984e055 100644
--- a/drivers/input/keyboard/adp5589-keys.c
+++ b/drivers/input/keyboard/adp5589-keys.c
@@ -1077,7 +1077,6 @@ static int adp5589_remove(struct i2c_client *client)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int adp5589_suspend(struct device *dev)
 {
struct adp5589_kpad *kpad = dev_get_drvdata(dev);
@@ -1109,7 +1108,6 @@ static int adp5589_resume(struct device *dev)
 
return 0;
 }
-#endif
 
 static SIMPLE_DEV_PM_OPS(adp5589_dev_pm_ops, adp5589_suspend, adp5589_resume);
 
-- 
2.28.0



[PATCH 3/3] Input: nomadik-ske-keypad: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/input/keyboard/nomadik-ske-keypad.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/input/keyboard/nomadik-ske-keypad.c 
b/drivers/input/keyboard/nomadik-ske-keypad.c
index 608446e14614..b3052c8fa5d2 100644
--- a/drivers/input/keyboard/nomadik-ske-keypad.c
+++ b/drivers/input/keyboard/nomadik-ske-keypad.c
@@ -386,7 +386,6 @@ static int ske_keypad_remove(struct platform_device *pdev)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int ske_keypad_suspend(struct device *dev)
 {
struct platform_device *pdev = to_platform_device(dev);
@@ -414,7 +413,6 @@ static int ske_keypad_resume(struct device *dev)
 
return 0;
 }
-#endif
 
 static SIMPLE_DEV_PM_OPS(ske_keypad_dev_pm_ops,
 ske_keypad_suspend, ske_keypad_resume);
-- 
2.28.0



[PATCH 1/3] Input: pmic8xxx-keypad: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/input/keyboard/pmic8xxx-keypad.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/input/keyboard/pmic8xxx-keypad.c 
b/drivers/input/keyboard/pmic8xxx-keypad.c
index 91d5811d6f0e..c04ab04331b2 100644
--- a/drivers/input/keyboard/pmic8xxx-keypad.c
+++ b/drivers/input/keyboard/pmic8xxx-keypad.c
@@ -621,7 +621,6 @@ static int pmic8xxx_kp_probe(struct platform_device *pdev)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int pmic8xxx_kp_suspend(struct device *dev)
 {
struct platform_device *pdev = to_platform_device(dev);
@@ -661,7 +660,6 @@ static int pmic8xxx_kp_resume(struct device *dev)
 
return 0;
 }
-#endif
 
 static SIMPLE_DEV_PM_OPS(pm8xxx_kp_pm_ops,
 pmic8xxx_kp_suspend, pmic8xxx_kp_resume);
-- 
2.28.0



RE: [PATCH V3 1/1] nvme: Add quirk for LiteON CL1 devices running FW 220TQ,22001

2020-10-29 Thread Gloria Tsai
Correct, it's device SRAM.


Regards,
Gloria Tsai
_

Sales PM Division
Solid State Storage Technology Corporation
TEL: +886-3-612-3888 ext. 2201
E-Mail: gloria.t...@ssstc.com
_

-Original Message-
From: Keith Busch  
Sent: Thursday, October 29, 2020 11:15 AM
To: Gloria Tsai 
Cc: Jongpil Jung ; Sagi Grimberg ; 
linux-kernel@vger.kernel.org; linux-n...@lists.infradead.org; Jens Axboe 
; dj54.s...@samsung.com; jongpil19.j...@samsung.com; 
jongheony@samsung.com; Christoph Hellwig 
Subject: Re: [PATCH V3 1/1] nvme: Add quirk for LiteON CL1 devices running FW 
220TQ,22001



This message was sent from outside of the company. Please do not click links or 
open attachments unless you recognize the source of this email and know the 
content is safe.


On Thu, Oct 29, 2020 at 11:33:06AM +0900, Keith Busch wrote:
> On Thu, Oct 29, 2020 at 02:20:27AM +, Gloria Tsai wrote:
> > Corrected the description of this bug that SSD will not do GC after 
> > receiving shutdown cmd.
> > Do GC before shutdown -> delete IO Q -> shutdown from host -> 
> > breakup GC -> D3hot -> enter PS4 -> have a chance swap block -> use 
> > wrong pointer on device SRAM -> over program
>
> What do you mean by "wrong pointer"? At the place in the sequence 
> you're referring to, the PCI BME is disabled: you can't access *any* 
> host RAM, so there's no "correct" pointer either.

Re-reading your message, I do see you said "device" rather than "host", so my 
response may not be relevant.


[PATCH] Drivers: ssb: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/ssb/pcihost_wrapper.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/ssb/pcihost_wrapper.c b/drivers/ssb/pcihost_wrapper.c
index 410215c16920..6510f57469a0 100644
--- a/drivers/ssb/pcihost_wrapper.c
+++ b/drivers/ssb/pcihost_wrapper.c
@@ -18,7 +18,6 @@
 #include 
 
 
-#ifdef CONFIG_PM_SLEEP
 static int ssb_pcihost_suspend(struct device *d)
 {
struct pci_dev *dev = to_pci_dev(d);
@@ -62,8 +61,6 @@ static const struct dev_pm_ops ssb_pcihost_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(ssb_pcihost_suspend, ssb_pcihost_resume)
 };
 
-#endif /* CONFIG_PM_SLEEP */
-
 static int ssb_pcihost_probe(struct pci_dev *dev,
 const struct pci_device_id *id)
 {
@@ -125,9 +122,7 @@ int ssb_pcihost_register(struct pci_driver *driver)
 {
driver->probe = ssb_pcihost_probe;
driver->remove = ssb_pcihost_remove;
-#ifdef CONFIG_PM_SLEEP
driver->driver.pm = _pcihost_pm_ops;
-#endif
 
return pci_register_driver(driver);
 }
-- 
2.28.0



Re: [PATCH v2] gpio: mockup: Allow probing from device tree

2020-10-29 Thread Vincent Whitchurch
On Wed, Oct 28, 2020 at 09:25:32PM +0100, Andy Shevchenko wrote:
> On Wed, Oct 28, 2020 at 8:41 PM Bartosz Golaszewski  wrote:
> > On Tue, Oct 27, 2020 at 2:54 PM Vincent Whitchurch
> > > +#ifdef CONFIG_OF
> > > +static const struct of_device_id gpio_mockup_of_match[] = {
> > > +   { .compatible = "gpio-mockup", },
> > > +   {},
> > > +};
> > > +MODULE_DEVICE_TABLE(of, gpio_mockup_of_match);
> > > +#endif
> >
> > You don't need this ifdef - of_match_ptr() will evaluate to NULL if
> > CONFIG_OF is disabled and the compiler will optimize this struct out.
> 
> It's not so. If you drop ugly ifdeffery (and I vote for that, see also
> above) the of_match_ptr() must be dropped as well.  Otherwise the
> compiler will issue the warning. So it is either all or none.

Yes, you're right.  I actually tested a !OF build before but it turns
out that the warning is disabled by default and only enabled with W=1.
I'll fix this and change the header in the next version.  Thank you.


Re: [PATCH 0/4] Powerpc: Better preemption for shared processor

2020-10-29 Thread Srikar Dronamraju
* Waiman Long  [2020-10-28 20:01:30]:

> > Srikar Dronamraju (4):
> >powerpc: Refactor is_kvm_guest declaration to new header
> >powerpc: Rename is_kvm_guest to check_kvm_guest
> >powerpc: Reintroduce is_kvm_guest
> >powerpc/paravirt: Use is_kvm_guest in vcpu_is_preempted
> > 
> >   arch/powerpc/include/asm/firmware.h  |  6 --
> >   arch/powerpc/include/asm/kvm_guest.h | 25 +
> >   arch/powerpc/include/asm/kvm_para.h  |  2 +-
> >   arch/powerpc/include/asm/paravirt.h  | 18 ++
> >   arch/powerpc/kernel/firmware.c   |  5 -
> >   arch/powerpc/platforms/pseries/smp.c |  3 ++-
> >   6 files changed, 50 insertions(+), 9 deletions(-)
> >   create mode 100644 arch/powerpc/include/asm/kvm_guest.h
> > 
> This patch series looks good to me and the performance is nice too.
> 
> Acked-by: Waiman Long 

Thank you.

> 
> Just curious, is the performance mainly from the use of static_branch
> (patches 1 - 3) or from reducing call to yield_count_of().

Because of the reduced call to yield_count

> 
> Cheers,
> Longman
> 

-- 
Thanks and Regards
Srikar Dronamraju


[PATCH 15/15] iio: proximity: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/iio/proximity/sx9500.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c
index acb821cbad46..f4d55d217582 100644
--- a/drivers/iio/proximity/sx9500.c
+++ b/drivers/iio/proximity/sx9500.c
@@ -994,7 +994,6 @@ static int sx9500_remove(struct i2c_client *client)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int sx9500_suspend(struct device *dev)
 {
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
@@ -1031,7 +1030,6 @@ static int sx9500_resume(struct device *dev)
 
return ret;
 }
-#endif /* CONFIG_PM_SLEEP */
 
 static const struct dev_pm_ops sx9500_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(sx9500_suspend, sx9500_resume)
-- 
2.28.0



[PATCH 13/15] iio: light: us5182d: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/iio/light/us5182d.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/light/us5182d.c b/drivers/iio/light/us5182d.c
index 393f27b75c75..15c6f8db3fdc 100644
--- a/drivers/iio/light/us5182d.c
+++ b/drivers/iio/light/us5182d.c
@@ -918,7 +918,7 @@ static int us5182d_remove(struct i2c_client *client)
return us5182d_shutdown_en(data, US5182D_CFG0_SHUTDOWN_EN);
 }
 
-#if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM)
+#if defined(CONFIG_PM)
 static int us5182d_suspend(struct device *dev)
 {
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
-- 
2.28.0



Re: [PATCH 2/4] PM: hibernate: improve robustness of mapping pages in the direct map

2020-10-29 Thread Mike Rapoport
On Wed, Oct 28, 2020 at 09:15:38PM +, Edgecombe, Rick P wrote:
> On Sun, 2020-10-25 at 12:15 +0200, Mike Rapoport wrote:
> > +   if (IS_ENABLED(CONFIG_ARCH_HAS_SET_DIRECT_MAP)) {
> > +   unsigned long addr = (unsigned
> > long)page_address(page);
> > +   int ret;
> > +
> > +   if (enable)
> > +   ret = set_direct_map_default_noflush(page);
> > +   else
> > +   ret = set_direct_map_invalid_noflush(page);
> > +
> > +   if (WARN_ON(ret))
> > +   return;
> > +
> > +   flush_tlb_kernel_range(addr, addr + PAGE_SIZE);
> > +   } else {
> > +   debug_pagealloc_map_pages(page, 1, enable);
> > +   }
> 
> Looking at the arm side again, I think this might actually introduce a
> regression for the arm/hibernate/DEBUG_PAGEALLOC combo.
> 
> Unlike __kernel_map_pages(), it looks like arm's cpa will always bail
> in the set_direct_map_() functions if rodata_full is false.
>
> So if rodata_full was disabled but debug page alloc is on, then this
> would now skip remapping the pages. I guess the significance depends
> on whether hibernate could actually try to save any DEBUG_PAGEALLOC
> unmapped pages. Looks like it to me though.
 
__kernel_map_pages() on arm64 will also bail out if rodata_full is
false:

void __kernel_map_pages(struct page *page, int numpages, int enable)
{
if (!debug_pagealloc_enabled() && !rodata_full)
return;

set_memory_valid((unsigned long)page_address(page), numpages, enable);
}

So using set_direct_map() to map back pages removed from the direct map
with __kernel_map_pages() seems safe to me.

-- 
Sincerely yours,
Mike.


[PATCH v5 0/6] spi: cadence-quadspi: Add QSPI controller support for Intel LGM SoC

2020-10-29 Thread Ramuthevar,Vadivel MuruganX
Add QSPI controller support for Intel LGM SoC.

Note from Vignesh(mtd subsystem maintainer):
This series is a subset of "[PATCH v12 0/4] spi: cadence-quadspi: Add
support for the Cadence QSPI controller" by Ramuthevar,Vadivel MuruganX
 that intended to move
cadence-quadspi driver to spi-mem framework

Those patches were trying to accomplish too many things in a single set
of patches and need to split into smaller patches. This is reduced
version of above series.

Changes that are intended to make migration easy are split into separate
patches. Patches 1 to 3 drop features that cannot be supported under
spi-mem at the moment (backward compatibility is maintained).
Patch 4-5 are trivial cleanups. Patch 6 does the actual conversion to
spi-mem and patch 7 moves the driver to drivers/spi folder.

I have tested both INDAC mode (used by non TI platforms like Altera
SoCFPGA) and DAC mode (used by TI platforms) on TI EVMs.

Patches to move move bindings over to
"Documentation/devicetree/bindings/spi/" directory and also conversion
of bindig doc to YAML will be posted separately.  Support for Intel
platform would follow that.

Reference:
https://lkml.org/lkml/2020/6/1/50

---
v5:
  - Rob's review comments update
  - const with single compatible string kept
v4:
  - Rob's review comments update
  - remove '|' no formatting to preserve
  - child node attributes follows under 'properties' under '@[0-9a-f]+$'.
v3:
  - Pratyush review comments update
  - CQSPI_SUPPORTS_MULTI_CHIPSELECT macro used instead of cqspi->use_direct_mode
  - disable DAC support placed in end of controller_init
v2:
  - Rob's review comments update for dt-bindings
  - add 'oneOf' for compatible selection
  - drop un-neccessary descriptions
  - add the cdns,is-decoded-cs and cdns,rclk-en properties as schema
  - remove 'allOf' in not required place
  - add AdditionalProperties false
  - add minItems/maxItems for qspi reset attributes

resend-v1:
  - As per Mark's suggestion , reorder the patch series 1-3 driver
support patches, series 4-6 dt-bindings patches.
v1:
  - initial version



Ramuthevar Vadivel Murugan (6):
  spi: cadence-quadspi: Add QSPI support for Intel LGM SoC
  spi: cadence-quadspi: Disable the DAC for Intel LGM SoC
  spi: cadence-quadspi: Add multi-chipselect support for Intel LGM SoC
  spi: Move cadence-quadspi.txt to Documentation/devicetree/bindings/spi
  dt-bindings: spi: Convert cadence-quadspi.txt to cadence-quadspi.yaml
  dt-bindings: spi: Add compatible for Intel LGM SoC

 .../devicetree/bindings/mtd/cadence-quadspi.txt|  67 -
 .../devicetree/bindings/spi/cadence-quadspi.yaml   | 151 +
 drivers/spi/Kconfig|   2 +-
 drivers/spi/spi-cadence-quadspi.c  |  31 +
 4 files changed, 183 insertions(+), 68 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/mtd/cadence-quadspi.txt
 create mode 100644 Documentation/devicetree/bindings/spi/cadence-quadspi.yaml

-- 
2.11.0



Re: [PATCH 1/2] fs:regfs: add register easy filesystem

2020-10-29 Thread Al Viro
On Wed, Oct 28, 2020 at 02:27:20PM +0800, zc wrote:
> Hi viro:
> 
>    have time for reviewing this?

Start with removing unused boilerplate.  When quite a chunk
of the codebase is simply never used, filtering _that_ out
is on the author, not reviewers.


[PATCH v5 1/2] f2fs: add F2FS_IOC_GET_COMPRESS_OPTION ioctl

2020-10-29 Thread Daeho Jeong
From: Daeho Jeong 

Added a new F2FS_IOC_GET_COMPRESS_OPTION ioctl to get file compression
option of a file.

struct f2fs_comp_option {
u8 algorithm; => compression algorithm
  => 0:lzo, 1:lz4, 2:zstd, 3:lzorle
u8 log_cluster_size;  => log scale cluster size
  => 2 ~ 8
};

struct f2fs_comp_option option;

ioctl(fd, F2FS_IOC_GET_COMPRESS_OPTION, );

Signed-off-by: Daeho Jeong 
---

v4: changed commit message.
v3: changed the error number more specific.
v2: added ioctl description.
---
 fs/f2fs/f2fs.h |  7 +++
 fs/f2fs/file.c | 30 ++
 2 files changed, 37 insertions(+)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 53fe2853579c..a33c90cf979b 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -433,6 +433,8 @@ static inline bool __has_cursum_space(struct f2fs_journal 
*journal,
_IOR(F2FS_IOCTL_MAGIC, 19, __u64)
 #define F2FS_IOC_SEC_TRIM_FILE _IOW(F2FS_IOCTL_MAGIC, 20,  \
struct f2fs_sectrim_range)
+#define F2FS_IOC_GET_COMPRESS_OPTION   _IOR(F2FS_IOCTL_MAGIC, 21,  \
+   struct f2fs_comp_option)
 
 /*
  * should be same as XFS_IOC_GOINGDOWN.
@@ -481,6 +483,11 @@ struct f2fs_sectrim_range {
u64 flags;
 };
 
+struct f2fs_comp_option {
+   u8 algorithm;
+   u8 log_cluster_size;
+};
+
 /* for inline stuff */
 #define DEF_INLINE_RESERVED_SIZE   1
 static inline int get_extra_isize(struct inode *inode);
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index ef5a844de53f..8922ab191a9d 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -3936,6 +3936,33 @@ static int f2fs_sec_trim_file(struct file *filp, 
unsigned long arg)
return ret;
 }
 
+static int f2fs_ioc_get_compress_option(struct file *filp, unsigned long arg)
+{
+   struct inode *inode = file_inode(filp);
+   struct f2fs_comp_option option;
+
+   if (!f2fs_sb_has_compression(F2FS_I_SB(inode)))
+   return -EOPNOTSUPP;
+
+   inode_lock(inode);
+
+   if (!f2fs_compressed_file(inode)) {
+   inode_unlock(inode);
+   return -ENODATA;
+   }
+
+   option.algorithm = F2FS_I(inode)->i_compress_algorithm;
+   option.log_cluster_size = F2FS_I(inode)->i_log_cluster_size;
+
+   inode_unlock(inode);
+
+   if (copy_to_user((struct f2fs_comp_option __user *)arg, ,
+   sizeof(option)))
+   return -EFAULT;
+
+   return 0;
+}
+
 long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
if (unlikely(f2fs_cp_error(F2FS_I_SB(file_inode(filp)
@@ -4024,6 +4051,8 @@ long f2fs_ioctl(struct file *filp, unsigned int cmd, 
unsigned long arg)
return f2fs_reserve_compress_blocks(filp, arg);
case F2FS_IOC_SEC_TRIM_FILE:
return f2fs_sec_trim_file(filp, arg);
+   case F2FS_IOC_GET_COMPRESS_OPTION:
+   return f2fs_ioc_get_compress_option(filp, arg);
default:
return -ENOTTY;
}
@@ -4194,6 +4223,7 @@ long f2fs_compat_ioctl(struct file *file, unsigned int 
cmd, unsigned long arg)
case F2FS_IOC_RELEASE_COMPRESS_BLOCKS:
case F2FS_IOC_RESERVE_COMPRESS_BLOCKS:
case F2FS_IOC_SEC_TRIM_FILE:
+   case F2FS_IOC_GET_COMPRESS_OPTION:
break;
default:
return -ENOIOCTLCMD;
-- 
2.29.1.341.ge80a0c044ae-goog



Re: linux-next: manual merge of the phy-next tree with the regulator-fixes tree

2020-10-29 Thread Vinod Koul
On 29-10-20, 13:20, Stephen Rothwell wrote:
> Hi all,
> 
> Today's linux-next merge of the phy-next tree got a conflict in:
> 
>   MAINTAINERS
> 
> between commit:
> 
>   43c3e148830a ("MAINTAINERS: Add entry for Qualcomm IPQ4019 VQMMC regulator")
> 
> from the regulator-fixes tree and commit:
> 
>   c36f74566cef ("MAINTAINERS: Add entry for Qualcomm IPQ4019 USB PHY")
> 
> from the phy-next tree.
> 
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.

lgtm, thanks Stephen

> 
> -- 
> Cheers,
> Stephen Rothwell
> 
> diff --cc MAINTAINERS
> index 0e8f57817184,f01ce8f451c8..
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@@ -14552,14 -14547,14 +14552,22 @@@ F:  
> Documentation/devicetree/bindings/ma
>   F:  drivers/mailbox/qcom-ipcc.c
>   F:  include/dt-bindings/mailbox/qcom-ipcc.h
>   
> + QUALCOMM IPQ4019 USB PHY DRIVER
> + M:  Robert Marko 
> + M:  Luka Perkov 
> + L:  linux-arm-...@vger.kernel.org
> + S:  Maintained
> + F:  Documentation/devicetree/bindings/phy/qcom-usb-ipq4019-phy.yaml
> + F:  drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c
> + 
>  +QUALCOMM IPQ4019 VQMMC REGULATOR DRIVER
>  +M:  Robert Marko 
>  +M:  Luka Perkov 
>  +L:  linux-arm-...@vger.kernel.org
>  +S:  Maintained
>  +F:  Documentation/devicetree/bindings/regulator/vqmmc-ipq4019-regulator.yaml
>  +F:  drivers/regulator/vqmmc-ipq4019-regulator.c
>  +
>   QUALCOMM RMNET DRIVER
>   M:  Subash Abhinov Kasiviswanathan 
>   M:  Sean Tranchetti 



-- 
~Vinod


[PATCH 3/3] watchdog: sirfsoc_wdt: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/watchdog/sirfsoc_wdt.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/watchdog/sirfsoc_wdt.c b/drivers/watchdog/sirfsoc_wdt.c
index 734cf2966ecb..dc8341cd7d44 100644
--- a/drivers/watchdog/sirfsoc_wdt.c
+++ b/drivers/watchdog/sirfsoc_wdt.c
@@ -170,7 +170,6 @@ static int sirfsoc_wdt_probe(struct platform_device *pdev)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int sirfsoc_wdt_suspend(struct device *dev)
 {
return 0;
@@ -189,7 +188,6 @@ static int sirfsoc_wdt_resume(struct device *dev)
 
return 0;
 }
-#endif
 
 static SIMPLE_DEV_PM_OPS(sirfsoc_wdt_pm_ops,
sirfsoc_wdt_suspend, sirfsoc_wdt_resume);
-- 
2.28.0



Re: [PATCH 1/2] fs:regfs: add register easy filesystem

2020-10-29 Thread zc



在 2020/10/29 上午10:44, Al Viro 写道:

On Wed, Oct 28, 2020 at 02:27:20PM +0800, zc wrote:

Hi viro:

    have time for reviewing this?

Start with removing unused boilerplate.  When quite a chunk
of the codebase is simply never used, filtering _that_ out
is on the author, not reviewers.


sorry, i will remove these unused boilerplat.

Regsards,

zoucao



Re: [f2fs-dev] [PATCH v5 2/2] f2fs: add F2FS_IOC_SET_COMPRESS_OPTION ioctl

2020-10-29 Thread Chao Yu

On 2020/10/29 15:39, Daeho Jeong wrote:

f2fs_cops is a static variable. Do you wanna change this to global
variable (extern)?


Oh, no, how about updating f2fs_is_compress_algorithm_ready() as below?
and use this function in f2fs_ioc_set_compress_option().

bool f2fs_is_compress_algorithm_valid(unsigned char algorithm)
{
return f2fs_cops[algorithm];
}



2020년 10월 29일 (목) 오후 4:29, Chao Yu 님이 작성:


On 2020/10/29 12:15, Daeho Jeong wrote:

From: Daeho Jeong 

Added a new F2FS_IOC_SET_COMPRESS_OPTION ioctl to change file
compression option of a file.

struct f2fs_comp_option {
  u8 algorithm; => compression algorithm
=> 0:lzo, 1:lz4, 2:zstd, 3:lzorle
  u8 log_cluster_size;  => log scale cluster size
=> 2 ~ 8
};

struct f2fs_comp_option option;

option.algorithm = 1;
option.log_cluster_size = 7;

ioctl(fd, F2FS_IOC_SET_COMPRESS_OPTION, );

Signed-off-by: Daeho Jeong 
---

v5: allowed to set algorithm which is not currently enabled by kernel
v4: changed commit message.
v3: changed the error number more specific.
  folded in fix for build breakage reported by kernel test robot
   and Dan Carpenter .
v2: added ioctl description.
---
   fs/f2fs/compress.c |  5 +
   fs/f2fs/f2fs.h |  7 ++
   fs/f2fs/file.c | 54 ++
   3 files changed, 66 insertions(+)

diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
index 7895186cc765..816d7adc914c 100644
--- a/fs/f2fs/compress.c
+++ b/fs/f2fs/compress.c
@@ -514,6 +514,11 @@ bool f2fs_is_compress_backend_ready(struct inode *inode)
   return f2fs_cops[F2FS_I(inode)->i_compress_algorithm];
   }

+bool f2fs_is_compress_algorithm_ready(unsigned char algorithm)
+{
+ return algorithm < COMPRESS_MAX && f2fs_cops[algorithm] != NULL;
+}
+
   static mempool_t *compress_page_pool;
   static int num_compress_pages = 512;
   module_param(num_compress_pages, uint, 0444);
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index a33c90cf979b..cc38afde6c04 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -435,6 +435,8 @@ static inline bool __has_cursum_space(struct f2fs_journal 
*journal,
   struct f2fs_sectrim_range)
   #define F2FS_IOC_GET_COMPRESS_OPTION_IOR(F2FS_IOCTL_MAGIC, 21,  \
   struct f2fs_comp_option)
+#define F2FS_IOC_SET_COMPRESS_OPTION _IOW(F2FS_IOCTL_MAGIC, 22,  \
+ struct f2fs_comp_option)

   /*
* should be same as XFS_IOC_GOINGDOWN.
@@ -3915,6 +3917,7 @@ bool f2fs_compress_write_end(struct inode *inode, void 
*fsdata,
   int f2fs_truncate_partial_cluster(struct inode *inode, u64 from, bool lock);
   void f2fs_compress_write_end_io(struct bio *bio, struct page *page);
   bool f2fs_is_compress_backend_ready(struct inode *inode);
+bool f2fs_is_compress_algorithm_ready(unsigned char algorithm);
   int f2fs_init_compress_mempool(void);
   void f2fs_destroy_compress_mempool(void);
   void f2fs_decompress_pages(struct bio *bio, struct page *page, bool verity);
@@ -3945,6 +3948,10 @@ static inline bool f2fs_is_compress_backend_ready(struct 
inode *inode)
   /* not support compression */
   return false;
   }
+static inline bool f2fs_is_compress_algorithm_ready(unsigned char algorithm)
+{
+ return false;
+}
   static inline struct page *f2fs_compress_control_page(struct page *page)
   {
   WARN_ON_ONCE(1);
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 8922ab191a9d..a0f31d8ebcfd 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -3963,6 +3963,57 @@ static int f2fs_ioc_get_compress_option(struct file 
*filp, unsigned long arg)
   return 0;
   }

+static int f2fs_ioc_set_compress_option(struct file *filp, unsigned long arg)
+{
+ struct inode *inode = file_inode(filp);
+ struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
+ struct f2fs_comp_option option;
+ int ret = 0;
+
+ if (!f2fs_sb_has_compression(sbi))
+ return -EOPNOTSUPP;
+
+ if (!(filp->f_mode & FMODE_WRITE))
+ return -EBADF;
+
+ if (copy_from_user(, (struct f2fs_comp_option __user *)arg,
+ sizeof(option)))
+ return -EFAULT;
+
+ if (!f2fs_compressed_file(inode) ||
+ option.log_cluster_size < MIN_COMPRESS_LOG_SIZE ||
+ option.log_cluster_size > MAX_COMPRESS_LOG_SIZE ||
+ option.algorithm >= COMPRESS_MAX)
+ return -EINVAL;
+
+ file_start_write(filp);
+ inode_lock(inode);
+
+ if (f2fs_is_mmap_file(inode) || get_dirty_pages(inode)) {
+ ret = -EBUSY;
+ goto out;
+ }
+
+ if (inode->i_size != 0) {
+ ret = -EFBIG;
+ goto out;
+ }


Hmm...

Shouldn't it be:

if (algorithm >= COMPRESS_MAX) {
 ret = -ENOPKG;
 goto out;
}

if (!f2fs_cops[algorithm])
 

[PATCH 1/3] ACPI: watchdog: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/watchdog/wdat_wdt.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/watchdog/wdat_wdt.c b/drivers/watchdog/wdat_wdt.c
index 3065dd670a18..0d912ceb2ecd 100644
--- a/drivers/watchdog/wdat_wdt.c
+++ b/drivers/watchdog/wdat_wdt.c
@@ -465,7 +465,6 @@ static int wdat_wdt_probe(struct platform_device *pdev)
return devm_watchdog_register_device(dev, >wdd);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int wdat_wdt_suspend_noirq(struct device *dev)
 {
struct wdat_wdt *wdat = dev_get_drvdata(dev);
@@ -526,7 +525,6 @@ static int wdat_wdt_resume_noirq(struct device *dev)
 
return wdat_wdt_start(>wdd);
 }
-#endif
 
 static const struct dev_pm_ops wdat_wdt_pm_ops = {
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(wdat_wdt_suspend_noirq,
-- 
2.28.0



Re: [PATCH v3 00/26] coresight: Support for ETM system instructions

2020-10-29 Thread Mike Leach
Hi Suzuki,

On Wed, 28 Oct 2020 at 22:10, Suzuki K Poulose  wrote:
>
> CoreSight ETMv4.4 obsoletes memory mapped access to ETM and
> mandates the system instructions for registers.
> This also implies that they may not be on the amba bus.
> Right now all the CoreSight components are accessed via memory
> map. Also, we have some common routines in coresight generic
> code driver (e.g, CS_LOCK, claim/disclaim), which assume the
> mmio. In order to preserve the generic algorithms at a single
> place and to allow dynamic switch for ETMs, this series introduces
> an abstraction layer for accessing a coresight device. It is
> designed such that the mmio access are fast tracked (i.e, without
> an indirect function call).
>
> This will also help us to get rid of the driver+attribute specific
> sysfs show/store routines and replace them with a single routine
> to access a given register offset (which can be embedded in the
> dev_ext_attribute). This is not currently implemented in the series,
> but can be achieved.
>
> Further we switch the generic routines to work with the abstraction.
> With this in place, we refactor the etm4x code a bit to allow for
> supporting the system instructions with very little new code. The
> changes also switch to using the system instructions by default
> even when we may have an MMIO.
>
> We use TRCDEVARCH for the detection of the ETM component, which
> is a standard register as per CoreSight architecture, rather than
> the etm specific id register TRCIDR1. This is for making sure
> that we are able to detect the ETM via system instructions accurately,
> when the the trace unit could be anything (etm or a custom trace unit).
> To keep the backward compatibility for any existing broken impelementation
> which may not implement TRCDEVARCH, we fall back to TRCIDR1. Also
> this covers us for the changes in the future architecture [0].
>
> The series has been mildly tested on a model for system instructions.
> I would really appreciate any testing on real hardware.
>
> Applies on coresight/next.
>
> [0] https://developer.arm.com/docs/ddi0601/g/aarch64-system-registers/trcidr1
>
> Known issues:
>   Checkpatch failure for "coresight: etm4x: Add sysreg access helpers" :
>
>   ERROR: Macros with complex values should be enclosed in parentheses
>   #121: FILE: drivers/hwtracing/coresight/coresight-etm4x.h:153:
>   +#define CASE_READ(res, x)  \
>   +   case (x): { (res) = read_etm4x_sysreg_const_offset((x)); break; }
>
>
> I don't know how to fix that without breaking the build ! Suggestions
> welcome.
>

I hit exactly the same issue with my recent v2 set. The checker really
hates case statements in macros. In my case I shut it up for v3 by
changing:-

#define MAPREG(cval, elem) \
case cval: \
reg->drv_store = >elem; \
break;


if (((offset >= TRCEVENTCTL0R) && (offset <= TRCVIPCSSCTLR)) ||
((offset >= TRCSEQRSTEVR) && (offset <= TRCEXTINSELR)) ||
((offset >= TRCCIDCCTLR0) && (offset <= TRCVMIDCCTLR1))) {
switch (offset) {
/* 32 bit single control and filter registers */
MAPREG(TRCEVENTCTL0R, eventctrl0);
MAPREG(TRCEVENTCTL1R, eventctrl1);
MAPREG(TRCSTALLCTLR, stall_ctrl);
MAPREG(TRCTSCTLR, ts_ctrl);
MAPREG(TRCSYNCPR, syncfreq);
MAPREG(TRTLR, ccctlr);
MAPREG(TRCBBCTLR, bb_ctrl);
MAPREG(TRCVICTLR, vinst_ctrl);
MAPREG(TRCVIIECTLR, viiectlr);
MAPREG(TRCVISSCTLR, vissctlr);
MAPREG(TRCVIPCSSCTLR, vipcssctlr);
MAPREG(TRCSEQRSTEVR, seq_rst);
MAPREG(TRCSEQSTR, seq_state);
MAPREG(TRCEXTINSELR, ext_inp);
MAPREG(TRCCIDCCTLR0, ctxid_mask0);
MAPREG(TRCCIDCCTLR1, ctxid_mask1);
MAPREG(TRCVMIDCCTLR0, vmid_mask0);
MAPREG(TRCVMIDCCTLR1, vmid_mask1);
default:
err = -EINVAL;
break;
}


to

err = -EINVAL;

#define CHECKREG(cval, elem) \
{ \
if (offset == cval) { \
reg->drv_store = >elem; \
err = 0; \
break; \
} \
}

if (((offset >= TRCEVENTCTL0R) && (offset <= TRCVIPCSSCTLR)) ||
((offset >= TRCSEQRSTEVR) && (offset <= TRCEXTINSELR)) ||
((offset >= TRCCIDCCTLR0) && (offset <= TRCVMIDCCTLR1))) {
do {
CHECKREG(TRCEVENTCTL0R, eventctrl0);
CHECKREG(TRCEVENTCTL1R, eventctrl1);
CHECKREG(TRCSTALLCTLR, stall_ctrl);
CHECKREG(TRCTSCTLR, ts_ctrl);
CHECKREG(TRCSYNCPR, syncfreq);
CHECKREG(TRTLR, ccctlr);
CHECKREG(TRCBBCTLR, bb_ctrl);
CHECKREG(TRCVICTLR, vinst_ctrl);
CHECKREG(TRCVIIECTLR, viiectlr);
CHECKREG(TRCVISSCTLR, vissctlr);
CHECKREG(TRCVIPCSSCTLR, vipcssctlr);
CHECKREG(TRCSEQRSTEVR, seq_rst);

[PATCH 2/3] watchdog: st_lpc_wdt: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/watchdog/st_lpc_wdt.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/watchdog/st_lpc_wdt.c b/drivers/watchdog/st_lpc_wdt.c
index 14ab6559c748..c1428d63dc9e 100644
--- a/drivers/watchdog/st_lpc_wdt.c
+++ b/drivers/watchdog/st_lpc_wdt.c
@@ -248,7 +248,6 @@ static int st_wdog_remove(struct platform_device *pdev)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int st_wdog_suspend(struct device *dev)
 {
struct st_wdog *st_wdog = watchdog_get_drvdata(_wdog_dev);
@@ -285,7 +284,6 @@ static int st_wdog_resume(struct device *dev)
 
return 0;
 }
-#endif
 
 static SIMPLE_DEV_PM_OPS(st_wdog_pm_ops,
 st_wdog_suspend,
-- 
2.28.0



Re: [PATCH 0/5] mtd: rawnand: qcom: Add support for QSPI nand

2020-10-29 Thread Miquel Raynal
Hello,

mda...@codeaurora.org wrote on Wed, 28 Oct 2020 23:54:23 +0530:

> On 2020-10-28 15:18, Miquel Raynal wrote:
> > Hello,
> > 
> > Md Sadre Alam  wrote on Sat, 10 Oct 2020
> > 11:01:37 +0530:
> >   
> >> QPIC 2.0 supports Serial NAND support in addition to all features and
> >> commands in QPIC 1.0 for parallel NAND. Parallel and Serial NAND >> cannot
> >> operate simultaneously. QSPI nand devices will connect to QPIC >> IO_MACRO
> >> block of QPIC controller. There is a separate IO_MACRO clock for >> 
> >> IO_MACRO
> >> block. Default IO_MACRO block divide the input clock by 4. so if >> 
> >> IO_MACRO
> >> input clock is 320MHz then on bus it will be 80MHz, so QSPI nand >> device
> >> should also support this frequency.  
> >> >> QPIC provides 4 data pins to QSPI nand. In standard SPI mode (x1 mode) 
> >> >> >> data  
> >> transfer will occur on only 2 pins one pin for Serial data in and one >> 
> >> for
> >> serial data out. In QUAD SPI mode (x4 mode) data transfer will occur >> at 
> >> all
> >> the four data lines. QPIC controller supports command for x1 mode and >> 
> >> x4 mode.  
> >> >> Md Sadre Alam (5):  
> >>   dt-bindings: qcom_nandc: IPQ5018 QPIC NAND documentation
> >>   mtd: rawnand: qcom: Add initial support for qspi nand
> >>   mtd: rawnand: qcom: Read QPIC version
> >>   mtd: rawnand: qcom: Enable support for erase,read & write for serial
> >> nand.
> >>   mtd: rawnand: qcom: Add support for serial training.  
> >> >>  .../devicetree/bindings/mtd/qcom_nandc.txt |   3 +  
> >>  drivers/mtd/nand/raw/nand_ids.c|  13 +
> >>  drivers/mtd/nand/raw/qcom_nandc.c  | 502 >> 
> >> -
> >>  3 files changed, 494 insertions(+), 24 deletions(-)  
> >> > > I'm sorry but this series clearly breaks the current layering. I 
> >> > > cannot  
> > authorize SPI-NAND code to fall into the raw NAND subsystem.
> >   
> 
> I am agree with you, we should not add SPI-NAND changes inside
> raw NAND subsystem.
> 
> > As both typologies cannot be used at the same time, I guess you should
> > have another driver handling this feature under the spi/ subsystem +
> > a few declarations in the SPI-NAND devices list.
> >   
> 
> Initially I was started writing separate driver under SPI-NAND subsystem then 
> I
> realized that more than 85% of raw/qcom_nand.c code getting duplicated.
> 
> That's why I have added this SPI-NAND change in raw/qcom_nand.c since
> more than 85% of code will be reused.
> 
> If I will add this change inside SPI-NAND subsystem then much of
> raw/qcom_nand.c code will get duplicated. Would it be ok ?

What about moving the generic code to drivers/mtd/nand/common/ and
referring to it from drivers/mtd/nand/raw/qcom_nand.c and
drivers/spi/spi-qcom.c (or such)?

Thanks,
Miquèl


[PATCH v12 09/10] usb: typec: tcpci_maxim: Enable auto discharge disconnect

2020-10-29 Thread Badhri Jagan Sridharan
Enable auto discharge disconnect for Maxim TCPC.

Signed-off-by: Badhri Jagan Sridharan 
Reviewed-by: Heikki Krogerus 
---
Changes since v1:
- Changing patch version to v6 to fix version number confusion.

Changes since v6:
- Rebase on usb-next.

Changes since v7:
- Heikki's suggestion:
Moved the actual write of TCPC_VBUS_SINK_DISCONNECT_THRES
register to tcpci code.

Changes since v8:
- Moved the logic to program the default values of
  TCPC_VBUS_SINK_DISCONNECT_THRESH into the tcpci code.

Changes since v9:
- none.

Changes since v10:
-Added Reviewed-by: Heikki Krogerus

Changes since v11:
none
---
 drivers/usb/typec/tcpm/tcpci_maxim.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/typec/tcpm/tcpci_maxim.c 
b/drivers/usb/typec/tcpm/tcpci_maxim.c
index dd6171604362..536df4a7901a 100644
--- a/drivers/usb/typec/tcpm/tcpci_maxim.c
+++ b/drivers/usb/typec/tcpm/tcpci_maxim.c
@@ -441,6 +441,7 @@ static int max_tcpci_probe(struct i2c_client *client, const 
struct i2c_device_id
chip->data.TX_BUF_BYTE_x_hidden = true;
chip->data.init = tcpci_init;
chip->data.frs_sourcing_vbus = max_tcpci_frs_sourcing_vbus;
+   chip->data.auto_discharge_disconnect = true;
 
max_tcpci_init_regs(chip);
chip->tcpci = tcpci_register_port(chip->dev, >data);
-- 
2.29.1.341.ge80a0c044ae-goog



[PATCH v12 07/10] usb: typec: tcpm: Implement enabling Auto Discharge disconnect support

2020-10-29 Thread Badhri Jagan Sridharan
TCPCI spec allows TCPC hardware to autonomously discharge the vbus
capacitance upon disconnect. The expectation is that the TCPM enables
AutoDischargeDisconnect while entering SNK/SRC_ATTACHED states. Hardware
then automously discharges vbus when the vbus falls below a certain
threshold i.e. VBUS_SINK_DISCONNECT_THRESHOLD.

Apart from enabling the vbus discharge circuit, AutoDischargeDisconnect
is also used a flag to move TCPCI based TCPC implementations into
Attached.Snk/Attached.Src state as mentioned in
Figure 4-15. TCPC State Diagram before a Connection of the
USB Type-C Port Controller Interface Specification.
In such TCPC implementations, setting AutoDischargeDisconnect would
prevent TCPC into entering "Connection_Invalid" state as well.

Signed-off-by: Badhri Jagan Sridharan 
Reviewed-by: Heikki Krogerus 
---
Changes since v1:
- Changing patch version to v6 to fix version number confusion.

Changes since v6:
- Fixed incorrect data_role error that I introduced by mistake in
  the previous version.

Changes since v7:
- Rebase on usb-next

Changes since v8:
- Removing the call to tcpm_set_auto_vbus_discharge_threshold
  in the source path.

Changes since v9:
- None

Changes since v10:
Added Reviewed-by: Heikki Krogerus

Changes since v11:
none
---
 drivers/usb/typec/tcpm/tcpm.c | 60 ---
 include/linux/usb/tcpm.h  | 15 +
 2 files changed, 71 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 0123d2f14c96..1539faf06d38 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -1706,6 +1706,24 @@ static void tcpm_handle_alert(struct tcpm_port *port, 
const __le32 *payload,
}
 }
 
+static int tcpm_set_auto_vbus_discharge_threshold(struct tcpm_port *port,
+ enum typec_pwr_opmode mode, 
bool pps_active,
+ u32 requested_vbus_voltage)
+{
+   int ret;
+
+   if (!port->tcpc->set_auto_vbus_discharge_threshold)
+   return 0;
+
+   ret = port->tcpc->set_auto_vbus_discharge_threshold(port->tcpc, mode, 
pps_active,
+   
requested_vbus_voltage);
+   tcpm_log_force(port,
+  "set_auto_vbus_discharge_threshold mode:%d pps_active:%c 
vbus:%u ret:%d",
+  mode, pps_active ? 'y' : 'n', requested_vbus_voltage, 
ret);
+
+   return ret;
+}
+
 static void tcpm_pd_data_request(struct tcpm_port *port,
 const struct pd_message *msg)
 {
@@ -1876,6 +1894,10 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port,
   port->current_limit,
   port->supply_voltage);
port->explicit_contract = true;
+   tcpm_set_auto_vbus_discharge_threshold(port,
+  
TYPEC_PWR_MODE_PD,
+  
port->pps_data.active,
+  
port->supply_voltage);
tcpm_set_state(port, SNK_READY, 0);
} else {
/*
@@ -2790,8 +2812,12 @@ static int tcpm_src_attach(struct tcpm_port *port)
if (ret < 0)
return ret;
 
-   ret = tcpm_set_roles(port, true, TYPEC_SOURCE,
-tcpm_data_role_for_source(port));
+   if (port->tcpc->enable_auto_vbus_discharge) {
+   ret = port->tcpc->enable_auto_vbus_discharge(port->tcpc, true);
+   tcpm_log_force(port, "enable vbus discharge ret:%d", ret);
+   }
+
+   ret = tcpm_set_roles(port, true, TYPEC_SOURCE, 
tcpm_data_role_for_source(port));
if (ret < 0)
return ret;
 
@@ -2858,6 +2884,12 @@ static void tcpm_unregister_altmodes(struct tcpm_port 
*port)
 
 static void tcpm_reset_port(struct tcpm_port *port)
 {
+   int ret;
+
+   if (port->tcpc->enable_auto_vbus_discharge) {
+   ret = port->tcpc->enable_auto_vbus_discharge(port->tcpc, false);
+   tcpm_log_force(port, "Disable vbus discharge ret:%d", ret);
+   }
tcpm_unregister_altmodes(port);
tcpm_typec_disconnect(port);
port->attached = false;
@@ -2922,8 +2954,13 @@ static int tcpm_snk_attach(struct tcpm_port *port)
if (ret < 0)
return ret;
 
-   ret = tcpm_set_roles(port, true, TYPEC_SINK,
-tcpm_data_role_for_sink(port));
+   if (port->tcpc->enable_auto_vbus_discharge) {
+   tcpm_set_auto_vbus_discharge_threshold(port, 
TYPEC_PWR_MODE_USB, false, VSAFE5V);
+   ret = port->tcpc->enable_auto_vbus_discharge(port->tcpc, 

Re: [PATCH 0/4] Add sustainable OPP concept

2020-10-29 Thread Viresh Kumar
On 29-10-20, 13:10, Viresh Kumar wrote:
> On 28-10-20, 14:08, Lukasz Luba wrote:
> > Hi all,
> > 
> > This patch set introduces a concept of sustainable OPP, which then can be 
> > used
> > by kernel frameworks or governors for estimating system sustainable system
> > state. This kind of estimation is done e.g. in thermal governor Intelligent
> > Power Allocation (IPA), which calculates sustainable power of the whole 
> > system
> > and then derives some coefficients for internal algorithm.
> > 
> > The patch set introduces a new DT bindings 'opp-sustainable', with parsing
> > code. It also adds a function (in patch 3/4) which allows device drivers to 
> > set
> > directly the sustainable OPP. This is helpful when the device drivers 
> > populate
> > the OPP table by themself (example in patch 4/4).
> > 
> 
> Can we please have some more information about this ? What does the
> sustainable OPP mean ? How will platform guys know or learn about this
> ? How we are going to use it finally ? What does it have to do with
> temperature of the SoC or the thermal affects, etc.

And that we need a real user of this first if it is ever going to be
merged.

-- 
viresh


[PATCH v12 08/10] usb: typec: tcpci: Implement Auto discharge disconnect callbacks

2020-10-29 Thread Badhri Jagan Sridharan
vImplement callbacks for enabling/disabling
POWER_CONTROL.AutoDischargeDisconnect.

Programs VBUS_SINK_DISCONNECT_THRESHOLD based on the
voltage requested as sink, mode of operation.

The programmed threshold is based on vSinkDisconnect and
vSinkDisconnectPD values.

Add auto_discharge_disconnect to tdata to allow TCPC chip
level drivers enable AutoDischargeDisconnect.

Signed-off-by: Badhri Jagan Sridharan 
Reviewed-by: Heikki Krogerus 
---
Changes since v1:
- Changing patch version to v6 to fix version number confusion.

Changes since v6:
- Rebase on usb-next.

Changes since v7:
Heikki's suggestion:
- Moved the actual write to TCPC_VBUS_SINK_DISCONNECT_THRESH
as it's common to all chip drivers.
- Renaming the tcpci_data callback as
get_auto_vbus_discharge_threshold

Changes since v8:
- Removed get_auto_vbus_discharge_threshold callback and moved the logic
  to program the default threshold for TCPC_VBUS_SINK_DISCONNECT_THRESH
  into the TCPCI code.

Changes since v9:
- none

Changes since v10:
-Added Reviewed-by: Heikki Krogerus

Changes since v11:
none
---
 drivers/usb/typec/tcpm/tcpci.c | 63 +-
 drivers/usb/typec/tcpm/tcpci.h | 14 ++--
 2 files changed, 74 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
index f91688e43991..12d983a75510 100644
--- a/drivers/usb/typec/tcpm/tcpci.c
+++ b/drivers/usb/typec/tcpm/tcpci.c
@@ -18,7 +18,10 @@
 
 #include "tcpci.h"
 
-#define PD_RETRY_COUNT 3
+#definePD_RETRY_COUNT  3
+#defineAUTO_DISCHARGE_DEFAULT_THRESHOLD_MV 3500
+#defineAUTO_DISCHARGE_PD_HEADROOM_MV   850
+#defineAUTO_DISCHARGE_PPS_HEADROOM_MV  1250
 
 struct tcpci {
struct device *dev;
@@ -268,6 +271,58 @@ static int tcpci_set_vconn(struct tcpc_dev *tcpc, bool 
enable)
enable ? TCPC_POWER_CTRL_VCONN_ENABLE : 0);
 }
 
+static int tcpci_enable_auto_vbus_discharge(struct tcpc_dev *dev, bool enable)
+{
+   struct tcpci *tcpci = tcpc_to_tcpci(dev);
+   int ret;
+
+   ret = regmap_update_bits(tcpci->regmap, TCPC_POWER_CTRL, 
TCPC_POWER_CTRL_AUTO_DISCHARGE,
+enable ? TCPC_POWER_CTRL_AUTO_DISCHARGE : 0);
+   return ret;
+}
+
+static int tcpci_set_auto_vbus_discharge_threshold(struct tcpc_dev *dev, enum 
typec_pwr_opmode mode,
+  bool pps_active, u32 
requested_vbus_voltage_mv)
+{
+   struct tcpci *tcpci = tcpc_to_tcpci(dev);
+   unsigned int pwr_ctrl, threshold = 0;
+   int ret;
+
+   /*
+* Indicates that vbus is going to go away due PR_SWAP, hard reset etc.
+* Do not discharge vbus here.
+*/
+   if (requested_vbus_voltage_mv == 0)
+   goto write_thresh;
+
+   ret = regmap_read(tcpci->regmap, TCPC_POWER_CTRL, _ctrl);
+   if (ret < 0)
+   return ret;
+
+   if (pwr_ctrl & TCPC_FAST_ROLE_SWAP_EN) {
+   /* To prevent disconnect when the source is fast role swap is 
capable. */
+   threshold = AUTO_DISCHARGE_DEFAULT_THRESHOLD_MV;
+   } else if (mode == TYPEC_PWR_MODE_PD) {
+   if (pps_active)
+   threshold = (95 * requested_vbus_voltage_mv / 100) -
+   AUTO_DISCHARGE_PD_HEADROOM_MV;
+   else
+   threshold = (95 * requested_vbus_voltage_mv / 100) -
+   AUTO_DISCHARGE_PPS_HEADROOM_MV;
+   } else {
+   /* 3.5V for non-pd sink */
+   threshold = AUTO_DISCHARGE_DEFAULT_THRESHOLD_MV;
+   }
+
+   threshold = threshold / TCPC_VBUS_SINK_DISCONNECT_THRESH_LSB_MV;
+
+   if (threshold > TCPC_VBUS_SINK_DISCONNECT_THRESH_MAX)
+   return -EINVAL;
+
+write_thresh:
+   return tcpci_write16(tcpci, TCPC_VBUS_SINK_DISCONNECT_THRESH, 
threshold);
+}
+
 static int tcpci_enable_frs(struct tcpc_dev *dev, bool enable)
 {
struct tcpci *tcpci = tcpc_to_tcpci(dev);
@@ -638,6 +693,12 @@ struct tcpci *tcpci_register_port(struct device *dev, 
struct tcpci_data *data)
tcpci->tcpc.enable_frs = tcpci_enable_frs;
tcpci->tcpc.frs_sourcing_vbus = tcpci_frs_sourcing_vbus;
 
+   if (tcpci->data->auto_discharge_disconnect) {
+   tcpci->tcpc.enable_auto_vbus_discharge = 
tcpci_enable_auto_vbus_discharge;
+   tcpci->tcpc.set_auto_vbus_discharge_threshold =
+   tcpci_set_auto_vbus_discharge_threshold;
+   }
+
err = tcpci_parse_config(tcpci);
if (err < 0)
return ERR_PTR(err);
diff --git a/drivers/usb/typec/tcpm/tcpci.h b/drivers/usb/typec/tcpm/tcpci.h
index b418fe11b527..3fe313655f0c 100644
--- a/drivers/usb/typec/tcpm/tcpci.h
+++ b/drivers/usb/typec/tcpm/tcpci.h
@@ -8,6 +8,8 @@
 #ifndef __LINUX_USB_TCPCI_H
 #define __LINUX_USB_TCPCI_H
 
+#include 
+
 #define TCPC_VENDOR_ID   

Re: [PATCH 5/9] kprobes/ftrace: Add recursion protection to the ftrace callback

2020-10-29 Thread Masami Hiramatsu
Hi Steve,

On Wed, 28 Oct 2020 07:52:49 -0400
Steven Rostedt  wrote:

> From: "Steven Rostedt (VMware)" 
> 
> If a ftrace callback does not supply its own recursion protection and
> does not set the RECURSION_SAFE flag in its ftrace_ops, then ftrace will
> make a helper trampoline to do so before calling the callback instead of
> just calling the callback directly.

So in that case the handlers will be called without preempt disabled?


> The default for ftrace_ops is going to assume recursion protection unless
> otherwise specified.

This seems to skip entier handler if ftrace finds recursion.
I would like to increment the missed counter even in that case.

[...]
e.g.

> diff --git a/arch/csky/kernel/probes/ftrace.c 
> b/arch/csky/kernel/probes/ftrace.c
> index 5264763d05be..5eb2604fdf71 100644
> --- a/arch/csky/kernel/probes/ftrace.c
> +++ b/arch/csky/kernel/probes/ftrace.c
> @@ -13,16 +13,21 @@ int arch_check_ftrace_location(struct kprobe *p)
>  void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
>  struct ftrace_ops *ops, struct pt_regs *regs)
>  {
> + int bit;
>   bool lr_saver = false;
>   struct kprobe *p;
>   struct kprobe_ctlblk *kcb;
>  
> - /* Preempt is disabled by ftrace */
> + bit = ftrace_test_recursion_trylock();

> +
> + preempt_disable_notrace();
>   p = get_kprobe((kprobe_opcode_t *)ip);
>   if (!p) {
>   p = get_kprobe((kprobe_opcode_t *)(ip - MCOUNT_INSN_SIZE));
>   if (unlikely(!p) || kprobe_disabled(p))
> - return;
> + goto out;
>   lr_saver = true;
>   }

if (bit < 0) {
kprobes_inc_nmissed_count(p);
goto out;
}

>  
> @@ -56,6 +61,9 @@ void kprobe_ftrace_handler(unsigned long ip, unsigned long 
> parent_ip,
>*/
>   __this_cpu_write(current_kprobe, NULL);
>   }
> +out:
> + preempt_enable_notrace();

if (bit >= 0)
ftrace_test_recursion_unlock(bit);

>  }
>  NOKPROBE_SYMBOL(kprobe_ftrace_handler);
>  

Or, we can also introduce a support function,

static inline void kprobes_inc_nmissed_ip(unsigned long ip)
{
struct kprobe *p;

preempt_disable_notrace();
p = get_kprobe((kprobe_opcode_t *)ip);
if (p)
kprobes_inc_nmissed_count(p);
preempt_enable_notrace();
}

> diff --git a/arch/parisc/kernel/ftrace.c b/arch/parisc/kernel/ftrace.c
> index 4bab21c71055..5f7742b225a5 100644
> --- a/arch/parisc/kernel/ftrace.c
> +++ b/arch/parisc/kernel/ftrace.c
> @@ -208,13 +208,19 @@ void kprobe_ftrace_handler(unsigned long ip, unsigned 
> long parent_ip,
>  {
>   struct kprobe_ctlblk *kcb;
>   struct kprobe *p = get_kprobe((kprobe_opcode_t *)ip);

(BTW, here is a bug... get_kprobe() must be called with preempt disabled.)

> + int bit;
>  
> - if (unlikely(!p) || kprobe_disabled(p))
> + bit = ftrace_test_recursion_trylock();

if (bit < 0) {
kprobes_inc_nmissed_ip(ip);
>   return;
}

This may easier for you ?

Thank you,

>  
> + preempt_disable_notrace();
> + if (unlikely(!p) || kprobe_disabled(p))
> + goto out;
> +
>   if (kprobe_running()) {
>   kprobes_inc_nmissed_count(p);
> - return;
> + goto out;
>   }
>  
>   __this_cpu_write(current_kprobe, p);
> @@ -235,6 +241,9 @@ void kprobe_ftrace_handler(unsigned long ip, unsigned 
> long parent_ip,
>   }
>   }
>   __this_cpu_write(current_kprobe, NULL);
> +out:
> + preempt_enable_notrace();
> + ftrace_test_recursion_unlock(bit);
>  }
>  NOKPROBE_SYMBOL(kprobe_ftrace_handler);
>  
> diff --git a/arch/powerpc/kernel/kprobes-ftrace.c 
> b/arch/powerpc/kernel/kprobes-ftrace.c
> index 972cb28174b2..5df8d50c65ae 100644
> --- a/arch/powerpc/kernel/kprobes-ftrace.c
> +++ b/arch/powerpc/kernel/kprobes-ftrace.c
> @@ -18,10 +18,16 @@ void kprobe_ftrace_handler(unsigned long nip, unsigned 
> long parent_nip,
>  {
>   struct kprobe *p;
>   struct kprobe_ctlblk *kcb;
> + int bit;
>  
> + bit = ftrace_test_recursion_trylock();
> + if (bit < 0)
> + return;
> +
> + preempt_disable_notrace();
>   p = get_kprobe((kprobe_opcode_t *)nip);
>   if (unlikely(!p) || kprobe_disabled(p))
> - return;
> + goto out;
>  
>   kcb = get_kprobe_ctlblk();
>   if (kprobe_running()) {
> @@ -52,6 +58,9 @@ void kprobe_ftrace_handler(unsigned long nip, unsigned long 
> parent_nip,
>*/
>   __this_cpu_write(current_kprobe, NULL);
>   }
> +out:
> + preempt_enable_notrace();
> + ftrace_test_recursion_unlock(bit);
>  }
>  NOKPROBE_SYMBOL(kprobe_ftrace_handler);
>  
> diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c
> index b388e87a08bf..88466d7fb6b2 100644
> --- a/arch/s390/kernel/ftrace.c
> +++ 

[tip:locking/urgent] BUILD SUCCESS 921c7ebd1337d1a46783d7e15a850e12aed2eaa0

2020-10-29 Thread kernel test robot
   x86_64_defconfig
arm  tct_hammer_defconfig
mips   bmips_be_defconfig
arm   viper_defconfig
powerpcsam440ep_defconfig
sh  urquell_defconfig
sh  sdk7780_defconfig
powerpc pseries_defconfig
sh  ul2_defconfig
armzeus_defconfig
sh  rsk7264_defconfig
powerpcklondike_defconfig
riscvnommu_virt_defconfig
ia64  gensparse_defconfig
arm  pxa168_defconfig
ia64 allmodconfig
ia64 allyesconfig
m68k allmodconfig
m68kdefconfig
m68k allyesconfig
nios2   defconfig
arc  allyesconfig
nds32 allnoconfig
nds32   defconfig
nios2allyesconfig
cskydefconfig
alpha   defconfig
alphaallyesconfig
xtensa   allyesconfig
h8300allyesconfig
sh   allmodconfig
parisc  defconfig
parisc   allyesconfig
s390defconfig
i386 allyesconfig
sparcallyesconfig
sparc   defconfig
i386defconfig
mips allyesconfig
mips allmodconfig
powerpc  allyesconfig
powerpc  allmodconfig
powerpc   allnoconfig
x86_64   randconfig-a001-20201029
x86_64   randconfig-a002-20201029
x86_64   randconfig-a003-20201029
x86_64   randconfig-a006-20201029
x86_64   randconfig-a005-20201029
x86_64   randconfig-a004-20201029
i386 randconfig-a002-20201026
i386 randconfig-a003-20201026
i386 randconfig-a005-20201026
i386 randconfig-a001-20201026
i386 randconfig-a006-20201026
i386 randconfig-a004-20201026
i386 randconfig-a002-20201028
i386 randconfig-a005-20201028
i386 randconfig-a003-20201028
i386 randconfig-a001-20201028
i386 randconfig-a004-20201028
i386 randconfig-a006-20201028
x86_64   randconfig-a011-20201028
x86_64   randconfig-a013-20201028
x86_64   randconfig-a016-20201028
x86_64   randconfig-a015-20201028
x86_64   randconfig-a012-20201028
x86_64   randconfig-a014-20201028
x86_64   randconfig-a011-20201026
x86_64   randconfig-a013-20201026
x86_64   randconfig-a016-20201026
x86_64   randconfig-a015-20201026
x86_64   randconfig-a012-20201026
x86_64   randconfig-a014-20201026
i386 randconfig-a016-20201028
i386 randconfig-a014-20201028
i386 randconfig-a015-20201028
i386 randconfig-a013-20201028
i386 randconfig-a012-20201028
i386 randconfig-a011-20201028
riscvnommu_k210_defconfig
riscvallyesconfig
riscv allnoconfig
riscv   defconfig
riscv  rv32_defconfig
riscvallmodconfig
x86_64   rhel
x86_64   allyesconfig
x86_64rhel-7.6-kselftests
x86_64  defconfig
x86_64   rhel-8.3
x86_64  kexec

clang tested configs:
x86_64   randconfig-a001-20201028
x86_64   randconfig-a002-20201028
x86_64   randconfig-a003-20201028
x86_64   randconfig-a006-20201028
x86_64   randconfig-a005-20201028
x86_64   randconfig-a004-20201028
x86_64   randconfig-a001-20201026
x86_64   randconfig-a003-20201026
x86_64   randconfig-a002-20201026
x86_64   randconfig-a006-20201026
x86_64   randconfig-a004-20201026
x86_64   randconfig-a005-20201026

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


Re: [PATCH 2/3] watchdog: st_lpc_wdt: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Patrice CHOTARD
Hi Coiby

On 10/29/20 8:53 AM, Coiby Xu wrote:
> SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.
>
> Signed-off-by: Coiby Xu 
> ---
>  drivers/watchdog/st_lpc_wdt.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/watchdog/st_lpc_wdt.c b/drivers/watchdog/st_lpc_wdt.c
> index 14ab6559c748..c1428d63dc9e 100644
> --- a/drivers/watchdog/st_lpc_wdt.c
> +++ b/drivers/watchdog/st_lpc_wdt.c
> @@ -248,7 +248,6 @@ static int st_wdog_remove(struct platform_device *pdev)
>   return 0;
>  }
>  
> -#ifdef CONFIG_PM_SLEEP
>  static int st_wdog_suspend(struct device *dev)
>  {
>   struct st_wdog *st_wdog = watchdog_get_drvdata(_wdog_dev);
> @@ -285,7 +284,6 @@ static int st_wdog_resume(struct device *dev)
>  
>   return 0;
>  }
> -#endif
>  
>  static SIMPLE_DEV_PM_OPS(st_wdog_pm_ops,
>st_wdog_suspend,

Reviewed-by: Patrice Chotard 

Thanks

Patrice


Re: [v3,2/3] arm64: dts: qcom: sc7180: Add gpu cooling support

2020-10-29 Thread Akhil P Oommen

On 10/29/2020 6:09 AM, m...@chromium.org wrote:

Hi Akhil,

On Wed, Oct 28, 2020 at 07:09:53PM +0530, Akhil P Oommen wrote:

Add cooling-cells property and the cooling maps for the gpu tzones
to support GPU cooling.

Signed-off-by: Akhil P Oommen 
---
  arch/arm64/boot/dts/qcom/sc7180.dtsi | 30 +++---
  1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180.dtsi
index d46b383..a7ea029 100644
--- a/arch/arm64/boot/dts/qcom/sc7180.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi
@@ -2,7 +2,7 @@
  /*
   * SC7180 SoC device tree source
   *
- * Copyright (c) 2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019-20, The Linux Foundation. All rights reserved.
   */
  
  #include 

@@ -1886,6 +1886,8 @@
operating-points-v2 = <_opp_table>;
qcom,gmu = <>;
  
+			#cooling-cells = <2>;

+
interconnects = <_noc MASTER_GFX3D _virt 
SLAVE_EBI1>;
interconnect-names = "gfx-mem";
  
@@ -3825,16 +3827,16 @@

};
  
  		gpuss0-thermal {

-   polling-delay-passive = <0>;
+   polling-delay-passive = <100>;
polling-delay = <0>;
  
  			thermal-sensors = < 13>;
  
  			trips {

gpuss0_alert0: trip-point0 {
-   temperature = <9>;
+   temperature = <95000>;
hysteresis = <2000>;
-   type = "hot";
+   type = "passive";
};
  
  gpuss0_crit: gpuss0_crit {

@@ -3843,19 +3845,26 @@
type = "critical";
};
};
+
+   cooling-maps {
+   map0 {
+   trip = <_alert0>;
+   cooling-device = < THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
+   };
+   };
};
  
  		gpuss1-thermal {

-   polling-delay-passive = <0>;
+   polling-delay-passive = <100>;
polling-delay = <0>;
  
  			thermal-sensors = < 14>;
  
  			trips {

gpuss1_alert0: trip-point0 {
-   temperature = <9>;
+   temperature = <95000>;
hysteresis = <2000>;
-   type = "hot";
+   type = "passive";
};
  
  gpuss1_crit: gpuss1_crit {

@@ -3864,6 +3873,13 @@
type = "critical";
};
};
+
+   cooling-maps {
+   map0 {
+   trip = <_alert0>;


Copy & paste error, this should be 'gpuss1_alert0'.

aah! you are correct.

--Akhil



+   cooling-device = < THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
+   };
+   };
};
  
  		aoss1-thermal {



Other than the C error:

Reviewed-by: Matthias Kaehlcke 
___
dri-devel mailing list
dri-de...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel





Re: [seccomp] Request for a "enable on execve" mode for Seccomp filters

2020-10-29 Thread Sargun Dhillon
On Wed, Oct 28, 2020 at 03:47:27PM -0700, Kees Cook wrote:
> On Wed, Oct 28, 2020 at 12:18:47PM +0100, Camille Mougey wrote:
> > (This is my first message to the kernel list, I hope I'm doing it right)
> 
> Looks good to me! The key was CCing real people. ;)
> 
> > From my understanding, there is no way to delay the activation of
> > seccomp filters, for instance "until an _execve_ call".
> > But this might be useful, especially for tools who sandbox other,
> > non-cooperative, executables, such as "systemd" or "FireJail".
> > [...]
> > I only see hackish ways to restrict the use of _execve_ in a
> > non-cooperative executable. These methods seem globally bypassables
> > and not satisfactory from a security point of view.
> > 
> > IMHO, a way to prepare filter and enable them only on the next
> > _execve_ would have some benefit:
> > * have a way to restrict _execve_ in a non-cooperative executable;
> > * install filters atomically, ie. before the _execve_ system call
> > return. That would limit racy situations, and have the very firsts
> > instructions of potentially untrusted binaries already subject to
> > seccomp filters. It would also ensure there is only one thread running
> > at the filter enabling time.
> > 
> > From what I understand, there is a relative use case[2] where the
> > "enable on exec" mode would also be a solution.
> > 
> > Thanks for your attention,
> > C. Mougey
> > 
> > [1]: https://github.com/netblue30/firejail/issues/3685
> > [2]: https://lore.kernel.org/linux-man/202010250759.F9745E0B6@keescook/
> 
> Just to restate things already said in the thread and to try to illustrate
> with more clarity, I tend to organize my thinking about seccomp usage
> into three categories:
> 
> 1- self-confinement
> 2- launching external processes
>   a) cooperating
>   b) oblivious
> 
> I classify things like Chrome's complex tree of related processes and
> filters as 1, since it's all one thing together.
> 
> I think of systemd, docker, minijail, FireJail, etc all as falling into
> category 2, with some variation about how to deal with 2a or 2b. I see
> systemd as weakly covering both 2a and 2b: e.g. services are documenting
> what restrictions they want, etc. minijail has stronger 2b coverage as
> it attempts to do PRELOAD tricks (which it sounds like FireJail does
> too?) (Aside: why doesn't systemd do any self-confinement?)
> 
> We don't have much possibility for the targets in the 2a realm as far
> as cooperating over how to _manage_ confinement, but rather about simply
> expecting confinement to exist, or adding more confinement on their own.
> 
> So, what would adding delayed filters gain in the above classifications?
> 
> Both 1 and 2 would benefit from some simplification over how to apply
> filters (e.g. the referenced relative complexity of needing to pass the
> USER_NOTIF fd up to the supervisor).
> 
> Dealing with 2b is improved by allowing execve itself to be blocked.
> 
> If we turn this:
> 
>   fork
>   prepare & apply
>   exec
> 
> into this:
> 
>   fork
>   prepare
>   exec & apply
> 
> for 2a, this isn't too interesting since a 2a target could just give up
> execve after it launched. For 2b, though, it's pretty meaningful to gain
> further isolation of an oblivious (and assumingly untrusted) process
> (given all the hacks needed to try to cover the situation).
> 
> And to clarify, 2a would much prefer this to be able to separate
> initialization from runtime:
> 
> fork
> prepare
> exec
> other things
> apply
> 
> And just for completeness, none of this is useful at all for 1, which
> doesn't even "see" the fork from its perspective:
> 
> exec
> other things
> prepare & apply
> 
> How should 2a targets indicate they're ready? Can it be done passively
> (in the sense that libc would make some seccomp call to apply the
> delayed filters), or does it need to stay explicit? (e.g. can we turn
> a pre-untrusted-input 2b into a 2a just by having the libc make calls?)
> My instinct is that hiding it won't gain much over a "on-execve" case,
> but having an explicit call that means "I'm done initializing now" would
> be a meaningful synchronization point -- except I note that it just means
> the target could just as easily start doing its own confinement anyway,
> which means they effectively move from 2a to 1, and now we don't care
> about delayed filters any more.
> 
> So, lacking a clearer sync point, execve() does seem to stand out to me.
> 
> The other idea which was touched on in the thread was very direct
> management (e.g. ptrace) and the supervisor waits until some point and
> then forces the filters to apply on the target. What would be more
> light-weight than this? (Or rather, what kinds of things would such a
> ptracer be looking for to mark "I've started"?)
> 
> Since I've got bitmaps on my mind, what about a syscall bitmap that
> triggers the application of delayed filters? The supervisor is launching
> a daemon: mark NR_listen as the 

Re: [PATCH v7] Introduce support for Systems Management Driver over WMI for Dell Systems

2020-10-29 Thread Mauro Carvalho Chehab
Em Tue, 27 Oct 2020 19:19:44 +0530
Divya Bharathi  escreveu:

> The Dell WMI Systems Management Driver provides a sysfs
> interface for systems management to enable BIOS configuration
> capability on certain Dell Systems.
> 
> This driver allows user to configure Dell systems with a
> uniform common interface. To facilitate this, the patch
> introduces a generic way for driver to be able to create
> configurable BIOS Attributes available in Setup (F2) screen.
> 
> Cc: Hans de Goede 
> Cc: Andy Shevchenko 
> Cc: mark gross 
> 
> Co-developed-by: Mario Limonciello 
> Signed-off-by: Mario Limonciello 
> Co-developed-by: Prasanth KSR 
> Signed-off-by: Prasanth KSR 
> Signed-off-by: Divya Bharathi 
> ---


> +What:/sys/class/firmware-attributes/*/authentication/
> +Date:February 2021
> +KernelVersion:   5.11
> +Contact: Divya Bharathi ,
> + Mario Limonciello ,
> + Prasanth KSR 
> +
> + Devices support various authentication mechanisms which can be 
> exposed
> + as a separate configuration object.
> +
> + For example a "BIOS Admin" password and "System" Password can 
> be set,
> + reset or cleared using these attributes.
> + - An "Admin" password is used for preventing modification to 
> the BIOS
> +   settings.
> + - A "System" password is required to boot a machine.
> +

This is adding a new warning:

$ ./scripts/get_abi.pl validate
Warning: file 
Documentation/ABI/testing/sysfs-class-firmware-attributes#172:
What '/sys/class/firmware-attributes/*/authentication/' doesn't 
have a description

Because you forgot to add a Description: tag.

Feel free to either add the enclosed tag to the tree which added this into
linux-next, or to fold id with the original patch.

Thanks,
Mauro

ABI: docs: sysfs-class-firmware-attributes: add a missing tag

The Description:  tag is missing, causing this warning with
scripts/get_abi.pl:

Warning: file 
Documentation/ABI/testing/sysfs-class-firmware-attributes#172:
 What '/sys/class/firmware-attributes/*/authentication/' 
doesn't have a description

Fixes: e8a60aa7404b ("platform/x86: Introduce support for Systems Management 
Driver over WMI for Dell Systems")
Signed-off-by: Mauro Carvalho Chehab 

diff --git a/Documentation/ABI/testing/sysfs-class-firmware-attributes 
b/Documentation/ABI/testing/sysfs-class-firmware-attributes
index 04a15c72e883..ea1837f1f3c2 100644
--- a/Documentation/ABI/testing/sysfs-class-firmware-attributes
+++ b/Documentation/ABI/testing/sysfs-class-firmware-attributes
@@ -113,7 +113,7 @@ KernelVersion:  5.11
 Contact:   Divya Bharathi ,
Mario Limonciello ,
Prasanth KSR 
-
+Description:
Devices support various authentication mechanisms which can be 
exposed
as a separate configuration object.
 



Re: Kernel 5.9 IOMMU groups regression/change

2020-10-29 Thread Boris V.

On 29/10/2020 00:37, Rajat Jain wrote:

On Wed, Oct 28, 2020 at 3:07 PM Rajat Jain  wrote:

On Wed, Oct 28, 2020 at 2:52 PM Bjorn Helgaas  wrote:

[+cc Rajat, LKML]


Thanks for copying me. (I don't look at mailing lists actively - so
missed this). Taking a look at this now.

Thanks,

Rajat



On Tue, Oct 27, 2020 at 08:31:09PM +0100, Boris V. wrote:

On 25/10/2020 20:45, Boris V. wrote:

With upgrade to kernel 5.9 my VMs stopped working, because some devices
can't be passed through.
This is caused by different IOMMU groups and devices being in the same
group.

For ex. with kernel 5.8 this are IOMMU groups:
IOMMU Group 40:
 08:01.0 PCI bridge [0604]: ASMedia Technology Inc. Device
[1b21:118f]
 09:00.0 Ethernet controller [0200]: Intel Corporation I211
Gigabit Network Connection [8086:1539] (rev 03)
IOMMU Group 43:
 0c:00.0 SATA controller [0106]: ASMedia Technology Inc. ASM1062
Serial ATA Controller [1b21:0612] (rev 02)
IOMMU Group 44:
 0d:00.0 USB controller [0c03]: ASMedia Technology Inc. ASM1042A
USB 3.0 Host Controller [1b21:1142]

Ethernet, SATA and USB controller in its own group.

And with 5.9, everything is in one group:
IOMMU Group 29:
 00:1c.0 PCI bridge [0604]: Intel Corporation C610/X99 series
chipset PCI Express Root Port #1 [8086:8d10] (rev d5)
 00:1c.3 PCI bridge [0604]: Intel Corporation C610/X99 series
chipset PCI Express Root Port #4 [8086:8d16] (rev d5)
 00:1c.4 PCI bridge [0604]: Intel Corporation C610/X99 series
chipset PCI Express Root Port #5 [8086:8d18] (rev d5)
 00:1c.6 PCI bridge [0604]: Intel Corporation C610/X99 series
chipset PCI Express Root Port #7 [8086:8d1c] (rev d5)
 07:00.0 PCI bridge [0604]: ASMedia Technology Inc. Device
[1b21:118f]
 08:01.0 PCI bridge [0604]: ASMedia Technology Inc. Device
[1b21:118f]
 08:03.0 PCI bridge [0604]: ASMedia Technology Inc. Device
[1b21:118f]
 08:04.0 PCI bridge [0604]: ASMedia Technology Inc. Device
[1b21:118f]
 09:00.0 Ethernet controller [0200]: Intel Corporation I211
Gigabit Network Connection [8086:1539] (rev 03)
 0c:00.0 SATA controller [0106]: ASMedia Technology Inc. ASM1062
Serial ATA Controller [1b21:0612] (rev 02)
 0d:00.0 USB controller [0c03]: ASMedia Technology Inc. ASM1042A
USB 3.0 Host Controller [1b21:1142]


This seems to be caused by commit
52fbf5bdeeef415b28b8e6cdade1e48927927f60.
commit 52fbf5bdeeef415b28b8e6cdade1e48927927f60
Author: Rajat Jain 
Date:   Tue Jul 7 15:46:02 2020 -0700

 PCI: Cache ACS capability offset in device

 Currently the ACS capability is being looked up at a number of
places. Read
 and store it once at enumeration so that it can be used by all
later.  No
 functional change intended.

 Link:
https://lore.kernel.org/r/20200707224604.3737893-2-raja...@google.com
 Signed-off-by: Rajat Jain 
 Signed-off-by: Bjorn Helgaas 

  drivers/pci/p2pdma.c |  2 +-
  drivers/pci/pci.c| 20 
  drivers/pci/pci.h|  2 +-
  drivers/pci/probe.c  |  2 +-
  drivers/pci/quirks.c |  8 
  include/linux/pci.h  |  1 +
  6 files changed, 24 insertions(+), 11 deletions(-)


If I revert this commit, I get back old groups.

In commit log there is message 'No functional change intended'. But
there is functional change.

This is Intel Core i7-5930K CPU and X99 chipset. But I see the same
thing on other Intel systems (didn't test on AMD).

Some more info.
Problem seems to be that pci_dev_specific_enable_acs() is not called
anymore.
Before, pci_enable_acs() was called from pci_init_capabilities() and in
pci_enable_acs(), pci_dev_specific_enable_acs() was called.
I don't know anything about PCI and this stuff, but I'm guessing that this
function enable ACS for some Intel devices.
But after this commit, pci_acs_init() is called from pci_init_capabilities()
and if pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ACS) returns 0,
pci_enable_acs() and pci_dev_specific_enable_acs() is not called anymore.
If I apply for ex. this patch bellow, groups are right again and everything
works as before.

Thanks very much for the report and the debugging.  Maybe we can get
this sorted and fixed for v5.10-rc2 or -rc3.

Thank Boris for reporting and debugging! The problem was because I
overlooked the fact that some rootports (the ones quirked with
*_intel_pch_acs_* functions in this case) may not expose a standard
ACS capability structure, but rather depend on quirks to enable ACS
for them using non standard registers. Your platform is in this
category. Can you please send lspci - and lspci - for one of
your rootports to confirm?


Below is lspci output for some root ports:

lspci - -s 00:01.0
00:01.0 PCI bridge: Intel Corporation Xeon E7 v3/Xeon E5 v3/Core i7 PCI 
Express Root Port 1 (rev 02) (prog-if 00 [Normal decode])
    Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- 
ParErr- Stepping- SERR- FastB2B- DisINTx+
    Status: Cap+ 66MHz- UDF- 

RE: [PATCH V4 0/6] can: flexcan: add stop mode support for i.MX8QM

2020-10-29 Thread Joakim Zhang

Gentle Ping...

@shawn...@kernel.org, Could you please help review patch 1/6 and 5/6 in this 
patch set?

Best Regards,
Joakim Zhang

> -Original Message-
> From: Joakim Zhang 
> Sent: 2020年10月21日 13:33
> To: m...@pengutronix.de; robh...@kernel.org; shawn...@kernel.org;
> s.ha...@pengutronix.de
> Cc: ker...@pengutronix.de; dl-linux-imx ; Ying Liu
> ; linux-...@vger.kernel.org; net...@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Subject: RE: [PATCH V4 0/6] can: flexcan: add stop mode support for i.MX8QM
> 
> 
> > -Original Message-
> > From: Joakim Zhang 
> > Sent: 2020年10月21日 13:25
> > To: m...@pengutronix.de; robh...@kernel.org; shawn...@kernel.org;
> > s.ha...@pengutronix.de
> > Cc: ker...@pengutronix.de; dl-linux-imx ; Ying Liu
> > ; linux-...@vger.kernel.org;
> > net...@vger.kernel.org; linux-kernel@vger.kernel.org
> > Subject: [PATCH V4 0/6] can: flexcan: add stop mode support for
> > i.MX8QM
> >
> > The first patch from Liu Ying aims to export SCU symbols for SoCs w/wo
> > SCU, so that no need to check CONFIG_IMX_SCU in the specific driver.
> >
> > The following patches are flexcan fixes and add stop mode support for
> > i.MX8QM.
> 
> Hi Shawnguo,
> 
> Could you please help review patch 1/6 and 5/6? Since flexcan driver depends
> on these. Thanks.
> 
> For patch 1/6, it will benefit other drivers which cover SoCs w/wo SCU, such 
> as
> i.MX Ethernet Controller driver (drivers/net/ethernet/freescale/fec_main.c).
> 
> Best Regards,
> Joakim Zhang



Re: [PATCH V3 1/1] nvme: Add quirk for LiteON CL1 devices running FW 220TQ,22001

2020-10-29 Thread Keith Busch
On Thu, Oct 29, 2020 at 11:33:06AM +0900, Keith Busch wrote:
> On Thu, Oct 29, 2020 at 02:20:27AM +, Gloria Tsai wrote:
> > Corrected the description of this bug that SSD will not do GC after 
> > receiving shutdown cmd.
> > Do GC before shutdown -> delete IO Q -> shutdown from host -> breakup GC -> 
> > D3hot -> enter PS4 -> have a chance swap block -> use wrong pointer on 
> > device SRAM -> over program
> 
> What do you mean by "wrong pointer"? At the place in the sequence you're
> referring to, the PCI BME is disabled: you can't access *any* host RAM,
> so there's no "correct" pointer either.

Re-reading your message, I do see you said "device" rather than "host",
so my response may not be relevant.


[PATCH 1/6] MIPS: Loongson64: Do not write the read only field LPA of CP0_CONFIG3

2020-10-29 Thread Tiezhu Yang
The field LPA of CP0_CONFIG3 register is read only for Loongson64, so the
write operations are meaningless, remove them.

Signed-off-by: Tiezhu Yang 
---
 arch/mips/include/asm/mach-loongson64/kernel-entry-init.h | 8 
 arch/mips/loongson64/numa.c   | 3 ---
 2 files changed, 11 deletions(-)

diff --git a/arch/mips/include/asm/mach-loongson64/kernel-entry-init.h 
b/arch/mips/include/asm/mach-loongson64/kernel-entry-init.h
index 87a5bfb..e4d77f4 100644
--- a/arch/mips/include/asm/mach-loongson64/kernel-entry-init.h
+++ b/arch/mips/include/asm/mach-loongson64/kernel-entry-init.h
@@ -19,10 +19,6 @@
.macro  kernel_entry_setup
.setpush
.setmips64
-   /* Set LPA on LOONGSON3 config3 */
-   mfc0t0, CP0_CONFIG3
-   or  t0, (0x1 << 7)
-   mtc0t0, CP0_CONFIG3
/* Set ELPA on LOONGSON3 pagegrain */
mfc0t0, CP0_PAGEGRAIN
or  t0, (0x1 << 29)
@@ -54,10 +50,6 @@
.macro  smp_slave_setup
.setpush
.setmips64
-   /* Set LPA on LOONGSON3 config3 */
-   mfc0t0, CP0_CONFIG3
-   or  t0, (0x1 << 7)
-   mtc0t0, CP0_CONFIG3
/* Set ELPA on LOONGSON3 pagegrain */
mfc0t0, CP0_PAGEGRAIN
or  t0, (0x1 << 29)
diff --git a/arch/mips/loongson64/numa.c b/arch/mips/loongson64/numa.c
index cf9459f..c7e3cced 100644
--- a/arch/mips/loongson64/numa.c
+++ b/arch/mips/loongson64/numa.c
@@ -40,9 +40,6 @@ static void enable_lpa(void)
unsigned long value;
 
value = __read_32bit_c0_register($16, 3);
-   value |= 0x0080;
-   __write_32bit_c0_register($16, 3, value);
-   value = __read_32bit_c0_register($16, 3);
pr_info("CP0_Config3: CP0 16.3 (0x%lx)\n", value);
 
value = __read_32bit_c0_register($5, 1);
-- 
2.1.0



[PATCH 6/6] MIPS: Loongson64: Move decode_cpucfg() to loongson_regs.h

2020-10-29 Thread Tiezhu Yang
Since decode_cpucfg() is only used for Loongson64, just move
it to loongson_regs.h to avoid the pollution of common code
with #ifdef CONFIG_CPU_LOONGSON64.

Signed-off-by: Tiezhu Yang 
---
 .../include/asm/mach-loongson64/loongson_regs.h| 24 +
 arch/mips/kernel/cpu-probe.c   | 31 +-
 2 files changed, 25 insertions(+), 30 deletions(-)

diff --git a/arch/mips/include/asm/mach-loongson64/loongson_regs.h 
b/arch/mips/include/asm/mach-loongson64/loongson_regs.h
index 1659935..2d469d6 100644
--- a/arch/mips/include/asm/mach-loongson64/loongson_regs.h
+++ b/arch/mips/include/asm/mach-loongson64/loongson_regs.h
@@ -129,6 +129,30 @@ static inline u32 read_cpucfg(u32 reg)
 #define LOONGSON_CFG7_GCCAEQRP BIT(0)
 #define LOONGSON_CFG7_UCAWINP  BIT(1)
 
+static inline void decode_cpucfg(struct cpuinfo_mips *c)
+{
+   u32 cfg1 = read_cpucfg(LOONGSON_CFG1);
+   u32 cfg2 = read_cpucfg(LOONGSON_CFG2);
+   u32 cfg3 = read_cpucfg(LOONGSON_CFG3);
+
+   if (cfg1 & LOONGSON_CFG1_MMI)
+   c->ases |= MIPS_ASE_LOONGSON_MMI;
+
+   if (cfg2 & LOONGSON_CFG2_LEXT1)
+   c->ases |= MIPS_ASE_LOONGSON_EXT;
+
+   if (cfg2 & LOONGSON_CFG2_LEXT2)
+   c->ases |= MIPS_ASE_LOONGSON_EXT2;
+
+   if (cfg2 & LOONGSON_CFG2_LSPW) {
+   c->options |= MIPS_CPU_LDPTE;
+   c->guest.options |= MIPS_CPU_LDPTE;
+   }
+
+   if (cfg3 & LOONGSON_CFG3_LCAMP)
+   c->ases |= MIPS_ASE_LOONGSON_CAM;
+}
+
 static inline bool cpu_has_csr(void)
 {
if (cpu_has_cfg())
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index e685369..1fa2c8b 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -31,6 +31,7 @@
 #include "fpu-probe.h"
 
 #include 
+#include 
 
 /* Hardware capabilities */
 unsigned int elf_hwcap __read_mostly;
@@ -1692,33 +1693,6 @@ static inline void cpu_probe_cavium(struct cpuinfo_mips 
*c, unsigned int cpu)
}
 }
 
-#ifdef CONFIG_CPU_LOONGSON64
-#include 
-
-static inline void decode_cpucfg(struct cpuinfo_mips *c)
-{
-   u32 cfg1 = read_cpucfg(LOONGSON_CFG1);
-   u32 cfg2 = read_cpucfg(LOONGSON_CFG2);
-   u32 cfg3 = read_cpucfg(LOONGSON_CFG3);
-
-   if (cfg1 & LOONGSON_CFG1_MMI)
-   c->ases |= MIPS_ASE_LOONGSON_MMI;
-
-   if (cfg2 & LOONGSON_CFG2_LEXT1)
-   c->ases |= MIPS_ASE_LOONGSON_EXT;
-
-   if (cfg2 & LOONGSON_CFG2_LEXT2)
-   c->ases |= MIPS_ASE_LOONGSON_EXT2;
-
-   if (cfg2 & LOONGSON_CFG2_LSPW) {
-   c->options |= MIPS_CPU_LDPTE;
-   c->guest.options |= MIPS_CPU_LDPTE;
-   }
-
-   if (cfg3 & LOONGSON_CFG3_LCAMP)
-   c->ases |= MIPS_ASE_LOONGSON_CAM;
-}
-
 static inline void cpu_probe_loongson(struct cpuinfo_mips *c, unsigned int cpu)
 {
decode_configs(c);
@@ -1787,9 +1761,6 @@ static inline void cpu_probe_loongson(struct cpuinfo_mips 
*c, unsigned int cpu)
break;
}
 }
-#else
-static inline void cpu_probe_loongson(struct cpuinfo_mips *c, unsigned int 
cpu) { }
-#endif
 
 static inline void cpu_probe_ingenic(struct cpuinfo_mips *c, unsigned int cpu)
 {
-- 
2.1.0



Re: [PATCH v3] mm/oom_kill: remove comment and rename is_dump_unreclaim_slabs()

2020-10-29 Thread Michal Hocko
On Wed 28-10-20 14:53:30, Andrew Morton wrote:
> On Wed, 28 Oct 2020 23:31:41 +0800 Hui Su  wrote:
> 
> > Comment for is_dump_unreclaim_slabs is not really clear whether it is
> > meant to instruct how to use the function or whether it is an outdated
> > information of the past implementation of the function. it doesn't realy
> > help that is_dump_unreclaim_slabs is hard to grasp on its own.
> > 
> > Rename the helper to should_dump_unreclaim_slabs which should make it
> > clear what it is meant to do and drop the comment as the purpose
> > should be pretty evident now.
> > 
> 
> I think your recent attempt to improve the comment:
> 
> /*
>  * Check whether unreclaimable slabs amount is greater than all user
>  * memory(LRU pages).
>  */
> 
> was actually somewhat useful, and worth retaining.
> 
> It would be better if it explained *why* we're doing this, rather than
> simply "what we are doing"?
> 
> 
> 
> It's actually quite unobvious why we're doing this!

It's quite arbitrary criterion to print slab information in the oom
report. The current logic is to dump if there is more slabs than LRU
pages which should be pretty obvious from the code. Why this rather than
e.g. slab * k > lru? Well, no strong reason, AFAIK. We just want to
catch too much slab memory cases.

-- 
Michal Hocko
SUSE Labs


[PATCH 10/15] iio: adc: stm32: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/iio/adc/stm32-adc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
index b3f31f147347..42f9013730f8 100644
--- a/drivers/iio/adc/stm32-adc.c
+++ b/drivers/iio/adc/stm32-adc.c
@@ -1988,7 +1988,6 @@ static int stm32_adc_remove(struct platform_device *pdev)
return 0;
 }
 
-#if defined(CONFIG_PM_SLEEP)
 static int stm32_adc_suspend(struct device *dev)
 {
struct iio_dev *indio_dev = dev_get_drvdata(dev);
@@ -2018,7 +2017,6 @@ static int stm32_adc_resume(struct device *dev)
 
return stm32_adc_buffer_postenable(indio_dev);
 }
-#endif
 
 #if defined(CONFIG_PM)
 static int stm32_adc_runtime_suspend(struct device *dev)
-- 
2.28.0



[PATCH 3/6] MIPS: Loongson64: Set IPI_Enable register per core by itself

2020-10-29 Thread Tiezhu Yang
In the current code, for example, core 1 sets Core[0, 1, 2, 3]_IPI_Enalbe
register and core 2, 3 do the same thing on the 1-way Loongson64 platform,
this is not necessary. Set IPI_Enable register per core by itself to avoid
duplicate operations and make the logic more clear.

Signed-off-by: Tiezhu Yang 
---
 arch/mips/loongson64/smp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/loongson64/smp.c b/arch/mips/loongson64/smp.c
index e744e1b..7d58853 100644
--- a/arch/mips/loongson64/smp.c
+++ b/arch/mips/loongson64/smp.c
@@ -348,8 +348,7 @@ static void loongson3_init_secondary(void)
/* Set interrupt mask, but don't enable */
change_c0_status(ST0_IM, imask);
 
-   for (i = 0; i < num_possible_cpus(); i++)
-   loongson3_ipi_write32(0x, 
ipi_en0_regs[cpu_logical_map(i)]);
+   loongson3_ipi_write32(0x, ipi_en0_regs[cpu_logical_map(cpu)]);
 
per_cpu(cpu_state, cpu) = CPU_ONLINE;
cpu_set_core(_data[cpu],
@@ -420,6 +419,7 @@ static void __init loongson3_smp_setup(void)
ipi_status0_regs_init();
ipi_en0_regs_init();
ipi_mailbox_buf_init();
+   loongson3_ipi_write32(0x, ipi_en0_regs[cpu_logical_map(0)]);
cpu_set_core(_data[0],
 cpu_logical_map(0) % loongson_sysconf.cores_per_package);
cpu_data[0].package = cpu_logical_map(0) / 
loongson_sysconf.cores_per_package;
-- 
2.1.0



[PATCH 11/15] iio: adc: at91_adc: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/iio/adc/at91_adc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 9b2c548fae95..445072b239a6 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -1350,7 +1350,6 @@ static int at91_adc_remove(struct platform_device *pdev)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int at91_adc_suspend(struct device *dev)
 {
struct iio_dev *idev = dev_get_drvdata(dev);
@@ -1372,7 +1371,6 @@ static int at91_adc_resume(struct device *dev)
 
return 0;
 }
-#endif
 
 static SIMPLE_DEV_PM_OPS(at91_adc_pm_ops, at91_adc_suspend, at91_adc_resume);
 
-- 
2.28.0



[PATCH 0/6] Modify some registers operations and move decode_cpucfg() to loongson_regs.h

2020-10-29 Thread Tiezhu Yang
Tiezhu Yang (6):
  MIPS: Loongson64: Do not write the read only field LPA of CP0_CONFIG3
  MIPS: Loongson64: Set the field ELPA of CP0_PAGEGRAIN only once
  MIPS: Loongson64: Set IPI_Enable register per core by itself
  MIPS: Loongson64: Add Mail_Send support for 3A4000+ CPU
  MIPS: Loongson64: Make sure the PC address is correct when 3A4000+ CPU
hotplug
  MIPS: Loongson64: Move decode_cpucfg() to loongson_regs.h

 .../asm/mach-loongson64/kernel-entry-init.h|  8 ---
 .../include/asm/mach-loongson64/loongson_regs.h| 34 ++
 arch/mips/kernel/cpu-probe.c   | 31 +
 arch/mips/loongson64/numa.c| 20 +-
 arch/mips/loongson64/smp.c | 78 +-
 5 files changed, 97 insertions(+), 74 deletions(-)

-- 
2.1.0



[PATCH 4/6] MIPS: Loongson64: Add Mail_Send support for 3A4000+ CPU

2020-10-29 Thread Tiezhu Yang
Loongson 3A4000+ CPU has per-core Mail_Send register to send mail,
there is no need to maintain register address of each core and node,
just simply specify cpu number.

Signed-off-by: Lu Zeng 
Signed-off-by: Jianmin Lv 
Signed-off-by: Tiezhu Yang 
---
 .../include/asm/mach-loongson64/loongson_regs.h| 10 +++
 arch/mips/loongson64/smp.c | 75 +-
 2 files changed, 68 insertions(+), 17 deletions(-)

diff --git a/arch/mips/include/asm/mach-loongson64/loongson_regs.h 
b/arch/mips/include/asm/mach-loongson64/loongson_regs.h
index 83dbb9f..1659935 100644
--- a/arch/mips/include/asm/mach-loongson64/loongson_regs.h
+++ b/arch/mips/include/asm/mach-loongson64/loongson_regs.h
@@ -227,6 +227,16 @@ static inline void csr_writeq(u64 val, u32 reg)
 #define CSR_IPI_SEND_CPU_SHIFT 16
 #define CSR_IPI_SEND_BLOCK BIT(31)
 
+#define LOONGSON_CSR_MAIL_BUF0 0x1020
+#define LOONGSON_CSR_MAIL_SEND 0x1048
+#define CSR_MAIL_SEND_BLOCKBIT_ULL(31)
+#define CSR_MAIL_SEND_BOX_LOW(box) (box << 1)
+#define CSR_MAIL_SEND_BOX_HIGH(box)((box << 1) + 1)
+#define CSR_MAIL_SEND_BOX_SHIFT2
+#define CSR_MAIL_SEND_CPU_SHIFT16
+#define CSR_MAIL_SEND_BUF_SHIFT32
+#define CSR_MAIL_SEND_H32_MASK 0xULL
+
 static inline u64 drdtime(void)
 {
int rID = 0;
diff --git a/arch/mips/loongson64/smp.c b/arch/mips/loongson64/smp.c
index 7d58853..33597d2 100644
--- a/arch/mips/loongson64/smp.c
+++ b/arch/mips/loongson64/smp.c
@@ -54,6 +54,26 @@ static uint32_t core0_c0count[NR_CPUS];
 u32 (*ipi_read_clear)(int cpu);
 void (*ipi_write_action)(int cpu, u32 action);
 
+/* send mail via Mail_Send register for 3A4000+ CPU */
+static void csr_mail_send(uint64_t data, int cpu, int mailbox)
+{
+   uint64_t val;
+
+   /* send high 32 bits */
+   val = CSR_MAIL_SEND_BLOCK;
+   val |= (CSR_MAIL_SEND_BOX_HIGH(mailbox) << CSR_MAIL_SEND_BOX_SHIFT);
+   val |= (cpu << CSR_MAIL_SEND_CPU_SHIFT);
+   val |= (data & CSR_MAIL_SEND_H32_MASK);
+   csr_writeq(val, LOONGSON_CSR_MAIL_SEND);
+
+   /* send low 32 bits */
+   val = CSR_MAIL_SEND_BLOCK;
+   val |= (CSR_MAIL_SEND_BOX_LOW(mailbox) << CSR_MAIL_SEND_BOX_SHIFT);
+   val |= (cpu << CSR_MAIL_SEND_CPU_SHIFT);
+   val |= (data << CSR_MAIL_SEND_BUF_SHIFT);
+   csr_writeq(val, LOONGSON_CSR_MAIL_SEND);
+};
+
 static u32 csr_ipi_read_clear(int cpu)
 {
u32 action;
@@ -348,7 +368,10 @@ static void loongson3_init_secondary(void)
/* Set interrupt mask, but don't enable */
change_c0_status(ST0_IM, imask);
 
-   loongson3_ipi_write32(0x, ipi_en0_regs[cpu_logical_map(cpu)]);
+   if (cpu_has_csr() && csr_readl(LOONGSON_CSR_FEATURES) & 
LOONGSON_CSRF_IPI)
+   csr_writel(0x, LOONGSON_CSR_IPI_EN);
+   else
+   loongson3_ipi_write32(0x, 
ipi_en0_regs[cpu_logical_map(cpu)]);
 
per_cpu(cpu_state, cpu) = CPU_ONLINE;
cpu_set_core(_data[cpu],
@@ -380,8 +403,12 @@ static void loongson3_smp_finish(void)
 
write_c0_compare(read_c0_count() + mips_hpt_frequency/HZ);
local_irq_enable();
-   loongson3_ipi_write64(0,
-   ipi_mailbox_buf[cpu_logical_map(cpu)] + 0x0);
+
+   if (cpu_has_csr() && csr_readl(LOONGSON_CSR_FEATURES) & 
LOONGSON_CSRF_IPI)
+   csr_writel(0, LOONGSON_CSR_MAIL_BUF0);
+   else
+   loongson3_ipi_write64(0, ipi_mailbox_buf[cpu_logical_map(cpu)] 
+ 0x0);
+
pr_info("CPU#%d finished, CP0_ST=%x\n",
smp_processor_id(), read_c0_status());
 }
@@ -414,12 +441,18 @@ static void __init loongson3_smp_setup(void)
}
 
csr_ipi_probe();
-   ipi_set0_regs_init();
-   ipi_clear0_regs_init();
-   ipi_status0_regs_init();
-   ipi_en0_regs_init();
-   ipi_mailbox_buf_init();
-   loongson3_ipi_write32(0x, ipi_en0_regs[cpu_logical_map(0)]);
+
+   if (cpu_has_csr() && csr_readl(LOONGSON_CSR_FEATURES) & 
LOONGSON_CSRF_IPI) {
+   csr_writel(0x, LOONGSON_CSR_IPI_EN);
+   } else {
+   ipi_set0_regs_init();
+   ipi_clear0_regs_init();
+   ipi_status0_regs_init();
+   ipi_en0_regs_init();
+   ipi_mailbox_buf_init();
+   loongson3_ipi_write32(0x, 
ipi_en0_regs[cpu_logical_map(0)]);
+   }
+
cpu_set_core(_data[0],
 cpu_logical_map(0) % loongson_sysconf.cores_per_package);
cpu_data[0].package = cpu_logical_map(0) / 
loongson_sysconf.cores_per_package;
@@ -452,14 +485,22 @@ static int loongson3_boot_secondary(int cpu, struct 
task_struct *idle)
pr_debug("CPU#%d, func_pc=%lx, sp=%lx, gp=%lx\n",
cpu, startargs[0], startargs[1], startargs[2]);
 
-   loongson3_ipi_write64(startargs[3],
-   

[PATCH 12/15] iio: imu: kmx61: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/iio/imu/kmx61.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/iio/imu/kmx61.c b/drivers/iio/imu/kmx61.c
index 61885e99d3fc..3b3d44ea8d24 100644
--- a/drivers/iio/imu/kmx61.c
+++ b/drivers/iio/imu/kmx61.c
@@ -1448,7 +1448,6 @@ static int kmx61_remove(struct i2c_client *client)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int kmx61_suspend(struct device *dev)
 {
int ret;
@@ -1474,7 +1473,6 @@ static int kmx61_resume(struct device *dev)
 
return kmx61_set_mode(data, stby, KMX61_ACC | KMX61_MAG, true);
 }
-#endif
 
 #ifdef CONFIG_PM
 static int kmx61_runtime_suspend(struct device *dev)
-- 
2.28.0



[PATCH 5/6] MIPS: Loongson64: Make sure the PC address is correct when 3A4000+ CPU hotplug

2020-10-29 Thread Tiezhu Yang
In loongson3_type3_play_dead(), in order to make sure the PC address is
correct, use lw to read the low 32 bits first, if the result is not zero,
then use ld to read the whole 64 bits, otherwise there maybe exists atomic
problem due to write high 32 bits first and then low 32 bits, like this:

high 32 bits (write done)
  -- only read high 32-bits which is wrong
low 32 bits (not yet write done)

This problem is especially for Loongson 3A4000+ CPU due to using Mail_Send
register which can only send 32 bits data one time. Although it is hard to
reproduce, we can do something at the software level to avoid the risks for
3A4000+ CPU, this change has no influence on the other Loongson CPUs.

Signed-off-by: Lu Zeng 
Signed-off-by: Jun Yi 
Signed-off-by: Tiezhu Yang 
---
 arch/mips/loongson64/smp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/mips/loongson64/smp.c b/arch/mips/loongson64/smp.c
index 33597d2..e486bbf 100644
--- a/arch/mips/loongson64/smp.c
+++ b/arch/mips/loongson64/smp.c
@@ -731,9 +731,10 @@ static void loongson3_type3_play_dead(int *state_addr)
"1: li%[count], 0x100 \n" /* wait for init loop 
*/
"2: bnez  %[count], 2b\n" /* limit mailbox 
access */
"   addiu %[count], -1\n"
-   "   ld%[initfunc], 0x20(%[base])  \n" /* get PC via mailbox 
*/
+   "   lw%[initfunc], 0x20(%[base])  \n" /* get PC (low 32 
bits) via mailbox */
"   beqz  %[initfunc], 1b \n"
"   nop   \n"
+   "   ld%[initfunc], 0x20(%[base])  \n" /* get PC (whole 64 
bits) via mailbox */
"   ld$sp, 0x28(%[base])  \n" /* get SP via mailbox 
*/
"   ld$gp, 0x30(%[base])  \n" /* get GP via mailbox 
*/
"   ld$a1, 0x38(%[base])  \n"
-- 
2.1.0



ld.lld: error: undefined symbol: amba_driver_register

2020-10-29 Thread kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   23859ae44402f4d935b9ee548135dd1e65e2cbf4
commit: ea0c0ad6b6eb36726088991d97a55b99cae456d0 memory: Enable compile testing 
for most of the drivers
date:   2 months ago
config: arm-randconfig-r024-20201028 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 
50dfa19cc799ae7cddd39a95dbfce675a12672ad)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ea0c0ad6b6eb36726088991d97a55b99cae456d0
git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout ea0c0ad6b6eb36726088991d97a55b99cae456d0
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 

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

All errors (new ones prefixed by >>):

>> ld.lld: error: undefined symbol: amba_driver_register
   >>> referenced by pl353-smc.c
   >>> memory/pl353-smc.o:(pl353_smc_driver_init) in archive drivers/built-in.a
--
>> ld.lld: error: undefined symbol: amba_driver_unregister
   >>> referenced by pl353-smc.c
   >>> memory/pl353-smc.o:(pl353_smc_driver_exit) in archive drivers/built-in.a

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


.config.gz
Description: application/gzip


[PATCH 2/6] MIPS: Loongson64: Set the field ELPA of CP0_PAGEGRAIN only once

2020-10-29 Thread Tiezhu Yang
The field ELPA of CP0_PAGEGRAIN register is set at the beginning
of the kernel entry point in kernel-entry-init.h, no need to set
it again in numa.c, we can remove enable_lpa() and only print the
related information.

Signed-off-by: Tiezhu Yang 
---
 arch/mips/loongson64/numa.c | 17 ++---
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/arch/mips/loongson64/numa.c b/arch/mips/loongson64/numa.c
index c7e3cced..509b360 100644
--- a/arch/mips/loongson64/numa.c
+++ b/arch/mips/loongson64/numa.c
@@ -35,20 +35,6 @@ EXPORT_SYMBOL(__node_data);
 cpumask_t __node_cpumask[MAX_NUMNODES];
 EXPORT_SYMBOL(__node_cpumask);
 
-static void enable_lpa(void)
-{
-   unsigned long value;
-
-   value = __read_32bit_c0_register($16, 3);
-   pr_info("CP0_Config3: CP0 16.3 (0x%lx)\n", value);
-
-   value = __read_32bit_c0_register($5, 1);
-   value |= 0x2000;
-   __write_32bit_c0_register($5, 1, value);
-   value = __read_32bit_c0_register($5, 1);
-   pr_info("CP0_PageGrain: CP0 5.1 (0x%lx)\n", value);
-}
-
 static void cpu_node_probe(void)
 {
int i;
@@ -240,7 +226,8 @@ EXPORT_SYMBOL(pcibus_to_node);
 
 void __init prom_init_numa_memory(void)
 {
-   enable_lpa();
+   pr_info("CP0_Config3: CP0 16.3 (0x%x)\n", read_c0_config3());
+   pr_info("CP0_PageGrain: CP0 5.1 (0x%x)\n", read_c0_pagegrain());
prom_meminit();
 }
 EXPORT_SYMBOL(prom_init_numa_memory);
-- 
2.1.0



[PATCH 09/15] iio: adc: palmas_gpadc: remove unnecessary CONFIG_PM_SLEEP

2020-10-29 Thread Coiby Xu
SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu 
---
 drivers/iio/adc/palmas_gpadc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c
index 889b88768b63..76bafa5a4bf3 100644
--- a/drivers/iio/adc/palmas_gpadc.c
+++ b/drivers/iio/adc/palmas_gpadc.c
@@ -643,7 +643,6 @@ static int palmas_gpadc_remove(struct platform_device *pdev)
return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int palmas_adc_wakeup_configure(struct palmas_gpadc *adc)
 {
int adc_period, conv;
@@ -812,7 +811,6 @@ static int palmas_gpadc_resume(struct device *dev)
 
return 0;
 };
-#endif
 
 static const struct dev_pm_ops palmas_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(palmas_gpadc_suspend,
-- 
2.28.0



Re: [PATCH] Documentation: Chinese translation of Documentation/arm64/perf.rst

2020-10-29 Thread Alex Shi



在 2020/10/28 下午9:48, Bailu Lin 写道:
> This is a Chinese translated version of
>  Documentation/arm64/perf.rst
> 
> Signed-off-by: Bailu Lin 
> ---
>  Documentation/arm64/perf.rst  |  2 +
>  .../translations/zh_CN/arm64/index.rst|  1 +
>  .../translations/zh_CN/arm64/perf.rst | 85 +++
>  3 files changed, 88 insertions(+)
>  create mode 100644 Documentation/translations/zh_CN/arm64/perf.rst
> 
> diff --git a/Documentation/arm64/perf.rst b/Documentation/arm64/perf.rst
> index 9c76a97baf28..b567f177d385 100644
> --- a/Documentation/arm64/perf.rst
> +++ b/Documentation/arm64/perf.rst
> @@ -1,5 +1,7 @@
>  .. SPDX-License-Identifier: GPL-2.0
>  
> +.. _perf_index:
> +
>  =
>  Perf Event Attributes
>  =
> diff --git a/Documentation/translations/zh_CN/arm64/index.rst 
> b/Documentation/translations/zh_CN/arm64/index.rst
> index e31a6090384d..f51fed166326 100644
> --- a/Documentation/translations/zh_CN/arm64/index.rst
> +++ b/Documentation/translations/zh_CN/arm64/index.rst
> @@ -15,3 +15,4 @@ ARM64 架构
>  
>  amu
>  hugetlbpage
> +perf
> diff --git a/Documentation/translations/zh_CN/arm64/perf.rst 
> b/Documentation/translations/zh_CN/arm64/perf.rst
> new file mode 100644
> index ..be8269dd5d9a
> --- /dev/null
> +++ b/Documentation/translations/zh_CN/arm64/perf.rst
> @@ -0,0 +1,85 @@
> +.. SPDX-License-Identifier: GPL-2.0
> +
> +.. include:: ../disclaimer-zh_CN.rst
> +
> +:Original: :ref:`Documentation/arm64/perf.rst `
> +
> +Translator: Bailu Lin 
> +
> +=
> +Perf 事件属性
> +=
> +
> +:作者: Andrew Murray 
> +:日期: 2019-03-06
> +
> +exclude_user
> +
> +
> +该属性排除用户空间。
> +
> +用户空间始终运行在 EL0,因此该属性将排除 EL0。
> +
> +
> +exclude_kernel
> +--
> +
> +该属性排除内核空间。
> +
> +打开 VHE 时内核运行在 EL2,不打开 VHE 时内核运行在 EL1。客户端

guest kernel could be better translated as '客户内核' ? 
'客户端' is easy to confuse with aonther word 'client'
So shall we better to use 客户, or 客户机 for 'guest/guest machine'

And 'host' here means 宿主/宿主机 better than 主机。 

Also couple wiki tranlates hypervisor as 虚拟机监视器

> +内核总是运行在 EL1。
> +
> +对于主机端,该属性排除 EL1 和 VHE 上的 EL2。
> +
> +对于客户端,该属性排除 EL1。请注意客户端从来不会运行在 EL2。
> +
> +
> +exclude_hv
> +--
> +
> +该属性排除虚拟机监控器。
> +
> +对于 VHE 主机端该属性将被忽略,因为此时主机端内核是虚拟机监控器。

s/此时/我们认为/

> +
> +对于 non-VHE 主机端该属性将排除 EL2,因为虚拟机监控器运行在 EL2
> +的任何代码主要用于客户端和主机端的切换。
> +
> +对于客户端该属性无效。请注意客户端从来不会运行在 EL2。
> +
> +
> +exclude_host / exclude_guest
> +
> +
> +这些属性分别排除了 KVM 主机端和客户端。
> +
> +KVM 主机端可能运行在 EL0(用户空间),EL1(non-VHE 内核)和
> +EL2(VHE 内核 或 non-VHE 虚拟机监控器)。
> +
> +KVM 客户端可能运行在 EL0(用户空间)和 EL1(内核)。
> +
> +由于主机端和客户端之间重叠的异常级别,我们不能仅仅依靠 PMU 的硬件异
> +常过滤机制-因此我们必须启用/禁用对于客户端进入和退出的计数。而这在
> +VHE 和 non-VHE 系统上表现不同。
> +
> +对于 non-VHE 系统的 exclude_host 属性排除 EL2 -  在进入和退出客户
> +端时,我们会根据 exclude_host 和 exclude_guest 属性在适当的情况下
> +禁用/启用该事件。
> +
> +对于 VHE 系统的 exclude_guest 属性排除 EL1,而对其中的 exclude_host
> +属性同时排除 EL0,EL2。在进入和退出客户端时,我们会适当地根据
> +exclude_host 和 exclude_guest 属性包括/排除 EL0。
> +
> +以上声明也适用于在 not-VHE 客户端使用这些属性时,但是请注意客户端从
> +来不会运行在 EL2。
> +
> +
> +准确性
> +--
> +
> +在 non-VHE 主机端上,我们在 EL2 进入/退出主机端/客户端的切换时启用/
> +关闭计数器 -但是在启用/禁用计数器和进入/退出客户端之间存在一段延时。
> +对于 exclude_host, 我们可以通过过滤 EL2 消除在客户端进入/退出边界
> +上用于计数客户端事件的主机端事件计数器。但是当使用 !exclude_hv 时,
> +在客户端进入/退出有一个小的暗窗口无法捕获到主机端的事件。
> +
> +在VHE系统尚没有暗窗口。
> 

暗窗口 maynot the best, but I have no better on blackout window..

Thanks
Alex


[PATCH v4 1/3] drm/msm: Add support for GPU cooling

2020-10-29 Thread Akhil P Oommen
Register GPU as a devfreq cooling device so that it can be passively
cooled by the thermal framework.

Signed-off-by: Akhil P Oommen 
Reviewed-by: Matthias Kaehlcke 
---
Changes in v4:
1. Fix gpu cooling map.
2. Add mka's Reviewed-by tag.
Changes in v3:
1. Minor fix in binding documentation (RobH)
Changes in v2:
1. Update the dt bindings documentation

 drivers/gpu/drm/msm/msm_gpu.c | 12 
 drivers/gpu/drm/msm/msm_gpu.h |  2 ++
 2 files changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index 55d1648..9f9db46 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -107,9 +108,18 @@ static void msm_devfreq_init(struct msm_gpu *gpu)
if (IS_ERR(gpu->devfreq.devfreq)) {
DRM_DEV_ERROR(>pdev->dev, "Couldn't initialize GPU 
devfreq\n");
gpu->devfreq.devfreq = NULL;
+   return;
}
 
devfreq_suspend_device(gpu->devfreq.devfreq);
+
+   gpu->cooling = of_devfreq_cooling_register(gpu->pdev->dev.of_node,
+   gpu->devfreq.devfreq);
+   if (IS_ERR(gpu->cooling)) {
+   DRM_DEV_ERROR(>pdev->dev,
+   "Couldn't register GPU cooling device\n");
+   gpu->cooling = NULL;
+   }
 }
 
 static int enable_pwrrail(struct msm_gpu *gpu)
@@ -1005,4 +1015,6 @@ void msm_gpu_cleanup(struct msm_gpu *gpu)
gpu->aspace->mmu->funcs->detach(gpu->aspace->mmu);
msm_gem_address_space_put(gpu->aspace);
}
+
+   devfreq_cooling_unregister(gpu->cooling);
 }
diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h
index 6c9e1fd..9a8f20d 100644
--- a/drivers/gpu/drm/msm/msm_gpu.h
+++ b/drivers/gpu/drm/msm/msm_gpu.h
@@ -147,6 +147,8 @@ struct msm_gpu {
struct msm_gpu_state *crashstate;
/* True if the hardware supports expanded apriv (a650 and newer) */
bool hw_apriv;
+
+   struct thermal_cooling_device *cooling;
 };
 
 static inline struct msm_gpu *dev_to_gpu(struct device *dev)
-- 
2.7.4



Re: [PATCH] mtd: spi-nor: intel-spi: Split intel-spi reading from writing

2020-10-29 Thread Greg Kroah-Hartman
On Wed, Oct 28, 2020 at 06:43:59PM -0300, Daniel Gutson wrote:
> This patch separates the writing part of the intel-spi drivers
> so the 'dangerous' part can be set/unset independently.
> This way, the kernel can be configured to include the reading
> parts of the driver which can be used without
> the dangerous write operations that can turn the system
> unbootable.
> 
> Signed-off-by: Daniel Gutson 
> ---
>  drivers/mtd/spi-nor/controllers/Kconfig | 39 -
>  drivers/mtd/spi-nor/controllers/intel-spi.c | 12 +--
>  2 files changed, 33 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/mtd/spi-nor/controllers/Kconfig 
> b/drivers/mtd/spi-nor/controllers/Kconfig
> index 5c0e0ec2e6d1..491c755fea49 100644
> --- a/drivers/mtd/spi-nor/controllers/Kconfig
> +++ b/drivers/mtd/spi-nor/controllers/Kconfig
> @@ -31,34 +31,41 @@ config SPI_INTEL_SPI
>   tristate
>  
>  config SPI_INTEL_SPI_PCI
> - tristate "Intel PCH/PCU SPI flash PCI driver (DANGEROUS)"
> + tristate "Intel PCH/PCU SPI flash PCI driver"
>   depends on X86 && PCI
>   select SPI_INTEL_SPI
>   help
> -   This enables PCI support for the Intel PCH/PCU SPI controller in
> -   master mode. This controller is present in modern Intel hardware
> -   and is used to hold BIOS and other persistent settings. Using
> -   this driver it is possible to upgrade BIOS directly from Linux.
> -
> -   Say N here unless you know what you are doing. Overwriting the
> -   SPI flash may render the system unbootable.
> +   This enables read only PCI support for the Intel PCH/PCU SPI
> +   controller in master mode. This controller is present in modern
> +   Intel hardware and is used to hold BIOS and other persistent settings.
> +   Using this driver it is possible to read the SPI chip directly
> +   from Linux.
>  
> To compile this driver as a module, choose M here: the module
> will be called intel-spi-pci.
>  
>  config SPI_INTEL_SPI_PLATFORM
> - tristate "Intel PCH/PCU SPI flash platform driver (DANGEROUS)"
> + tristate "Intel PCH/PCU SPI flash platform driver"
>   depends on X86
>   select SPI_INTEL_SPI
>   help
> -   This enables platform support for the Intel PCH/PCU SPI
> +   This enables read only platform support for the Intel PCH/PCU SPI
> controller in master mode. This controller is present in modern
> -   Intel hardware and is used to hold BIOS and other persistent
> -   settings. Using this driver it is possible to upgrade BIOS
> -   directly from Linux.
> +   Intel hardware and is used to hold BIOS and other persistent settings.
> +   Using this driver it is possible to read the SPI chip directly
> +   from Linux.
> +
> +   To compile this driver as a module, choose M here: the module
> +   will be called intel-spi-pci.
> +
> +config SPI_INTEL_SPI_WRITE
> + bool "Intel PCH/PCU SPI flash drivers write operations (DANGEROUS)"
> + depends on SPI_INTEL_SPI_PCI || SPI_INTEL_SPI_PLATFORM
> + help
> +   This enables full read/write support for the Intel PCH/PCU SPI
> +   controller.
> +   Using this option it may be possible to upgrade BIOS directly
> +   from Linux.
>  
> Say N here unless you know what you are doing. Overwriting the
> SPI flash may render the system unbootable.
> -
> -   To compile this driver as a module, choose M here: the module
> -   will be called intel-spi-platform.
> diff --git a/drivers/mtd/spi-nor/controllers/intel-spi.c 
> b/drivers/mtd/spi-nor/controllers/intel-spi.c
> index b54a56a68100..8d8053395c3d 100644
> --- a/drivers/mtd/spi-nor/controllers/intel-spi.c
> +++ b/drivers/mtd/spi-nor/controllers/intel-spi.c
> @@ -266,6 +266,7 @@ static int intel_spi_read_block(struct intel_spi *ispi, 
> void *buf, size_t size)
>   return 0;
>  }
>  
> +#ifdef CONFIG_SPI_INTEL_SPI_WRITE



Please do not add #ifdef to .c files, that's not the proper kernel
coding style at all, and just makes maintaining this file much much
harder over time.

Split things out into two different files if you really need to do this.

thanks,

greg k-h


Re: [RFC][PATCH 1/2 v2] ftrace/x86: Allow for arguments to be passed in to REGS by default

2020-10-29 Thread Masami Hiramatsu
On Wed, 28 Oct 2020 11:29:16 -0400
Steven Rostedt  wrote:

> Hi Masami,
> 
> Talking with Peter and Thomas on IRC, where they really don't like
> passing a partial pt_regs around, got me thinking of redoing the REGS
> parameter of ftrace. Kprobes is the only user that requires the full
> registers being saved, and that's only because some kprobe user might
> want them.

Yes, kprobes can be used for debugging use case. I think we can skip
coller-saved registers (because ftrace is embedded by compiler and it
may save such registers correctly), but we still need a pt_regs on memory
to access it.

> 
> On Wed, 28 Oct 2020 10:25:02 -0400
> Steven Rostedt  wrote:
> >
> >  typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip,
> >   struct ftrace_ops *op, struct pt_regs *regs);
> >  
> 
> 
> Most registers of pt_regs at a start of a function is rather useless.
> What if we got rid of FL_SAVE_REGS all together and had a "ftrace_regs"
> structure passed in that would have only access to all the argument
> registers, the stack pointer and the instruction pointer?

Yeah, that's OK to me. If someone wants to investigate suspicious compiler
bug, they should not put a kprobe on the fentry call site. (in most cases
symbol+5 will put a breakpoint right after fentry nop)

> Then kprobes could just create its own pt_regs, fill in all the data
> from ftrace_regs and then fill the rest with zeros or possibly whatever
> the values currently are (does it really matter what those registers
> are?), including flags.

That sounds good to me.

> 
> Not only would this simplify the code, it would probably allow moving
> more of the kprobe code from the arch specific to the generic code, and
> remove a lot of duplication.

Ah, right.

> 
> This would also help speed up the processing of live kernel patching.
> 
> And best of all, it would give everything access to the arguments of a
> function and a stack pointer with out (ab)using pt_regs.
> 
> Do you think this would be feasible?

Yes, I agreed.

Thank you,

> 
> -- Steve


-- 
Masami Hiramatsu 


Re: [PATCH v1] pinctrl: intel: Add Intel Alder Lake pin controller support

2020-10-29 Thread Mika Westerberg
Hi,

I think the $subject should say "Alder Lake-S" as this is for -S
variant.

On Mon, Oct 26, 2020 at 09:25:52PM +0200, Andy Shevchenko wrote:
> This driver adds pinctrl/GPIO support for Intel Alder Lake SoC. The
> GPIO controller is based on the next generation GPIO hardware but still
> compatible with the one supported by the Intel core pinctrl/GPIO driver.
> 
> Signed-off-by: Andy Shevchenko 
> ---
>  drivers/pinctrl/intel/Kconfig |   9 +
>  drivers/pinctrl/intel/Makefile|   1 +
>  drivers/pinctrl/intel/pinctrl-alderlake.c | 437 ++
>  3 files changed, 447 insertions(+)
>  create mode 100644 drivers/pinctrl/intel/pinctrl-alderlake.c
> 
> diff --git a/drivers/pinctrl/intel/Kconfig b/drivers/pinctrl/intel/Kconfig
> index b9d78a4187e0..98494c8fdaf8 100644
> --- a/drivers/pinctrl/intel/Kconfig
> +++ b/drivers/pinctrl/intel/Kconfig
> @@ -70,6 +70,14 @@ config PINCTRL_INTEL
>   select GPIOLIB
>   select GPIOLIB_IRQCHIP
>  
> +config PINCTRL_ALDERLAKE
> + tristate "Intel Alder Lake pinctrl and GPIO driver"
> + depends on ACPI
> + select PINCTRL_INTEL
> + help
> +   This pinctrl driver provides an interface that allows configuring
> +   of Intel Alder Lake PCH pins and using them as GPIOs.
> +
>  config PINCTRL_BROXTON
>   tristate "Intel Broxton pinctrl and GPIO driver"
>   depends on ACPI
> @@ -158,4 +166,5 @@ config PINCTRL_TIGERLAKE
>   help
> This pinctrl driver provides an interface that allows configuring
> of Intel Tiger Lake PCH pins and using them as GPIOs.
> +

Is this intentional ws change?

>  endif

Otherwise looks good to me.


[PATCH v4 3/3] dt-bindings: drm/msm/gpu: Add cooling device support

2020-10-29 Thread Akhil P Oommen
Add cooling device support to gpu. A cooling device is bound to a
thermal zone to allow thermal mitigation.

Signed-off-by: Akhil P Oommen 
---
 Documentation/devicetree/bindings/display/msm/gpu.txt | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/msm/gpu.txt 
b/Documentation/devicetree/bindings/display/msm/gpu.txt
index 1af0ff1..090dcb3 100644
--- a/Documentation/devicetree/bindings/display/msm/gpu.txt
+++ b/Documentation/devicetree/bindings/display/msm/gpu.txt
@@ -39,6 +39,10 @@ Required properties:
 a4xx Snapdragon SoCs. See
 Documentation/devicetree/bindings/sram/qcom,ocmem.yaml.
 
+Optional properties:
+- #cooling-cells: The value must be 2. For details, please refer
+   Documentation/devicetree/bindings/thermal/thermal-cooling-devices.yaml.
+
 Example 3xx/4xx:
 
 / {
@@ -61,6 +65,7 @@ Example 3xx/4xx:
power-domains = < OXILICX_GDSC>;
operating-points-v2 = <_opp_table>;
iommus = <_iommu 0>;
+   #cooling-cells = <2>;
};
 
gpu_sram: ocmem@fdd0 {
@@ -98,6 +103,8 @@ Example a6xx (with GMU):
reg = <0x500 0x4>, <0x509e000 0x10>;
reg-names = "kgsl_3d0_reg_memory", "cx_mem";
 
+   #cooling-cells = <2>;
+
/*
 * Look ma, no clocks! The GPU clocks and power are
 * controlled entirely by the GMU
-- 
2.7.4



Re: linux-next: Signed-off-by missing for commit in the drm-intel-fixes tree

2020-10-29 Thread Jani Nikula
On Wed, 28 Oct 2020, Chris Wilson  wrote:
> Quoting Stephen Rothwell (2020-10-28 21:28:23)
>> Hi all,
>> 
>> Commit
>> 
>>   d13208a88f41 ("lockdep: Fix nr_unused_locks")
>> 
>> is missing a Signed-off-by from its author.
>> 
>> Also, the author's email name is missing the leading 'P'.
>
> And it shouldn't be in the drm-intel-fixes tree.

It's temporarily on top of the fixes branch to allow our CI to test the
branch. We weren't getting results on anything -rc1 based because of
this.

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Graphics Center


[PATCH v4 2/3] arm64: dts: qcom: sc7180: Add gpu cooling support

2020-10-29 Thread Akhil P Oommen
Add cooling-cells property and the cooling maps for the gpu tzones
to support GPU cooling.

Signed-off-by: Akhil P Oommen 
Reviewed-by: Matthias Kaehlcke 
---
 arch/arm64/boot/dts/qcom/sc7180.dtsi | 30 +++---
 1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180.dtsi
index d46b383..8e2000c 100644
--- a/arch/arm64/boot/dts/qcom/sc7180.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi
@@ -2,7 +2,7 @@
 /*
  * SC7180 SoC device tree source
  *
- * Copyright (c) 2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019-20, The Linux Foundation. All rights reserved.
  */
 
 #include 
@@ -1886,6 +1886,8 @@
operating-points-v2 = <_opp_table>;
qcom,gmu = <>;
 
+   #cooling-cells = <2>;
+
interconnects = <_noc MASTER_GFX3D _virt 
SLAVE_EBI1>;
interconnect-names = "gfx-mem";
 
@@ -3825,16 +3827,16 @@
};
 
gpuss0-thermal {
-   polling-delay-passive = <0>;
+   polling-delay-passive = <100>;
polling-delay = <0>;
 
thermal-sensors = < 13>;
 
trips {
gpuss0_alert0: trip-point0 {
-   temperature = <9>;
+   temperature = <95000>;
hysteresis = <2000>;
-   type = "hot";
+   type = "passive";
};
 
gpuss0_crit: gpuss0_crit {
@@ -3843,19 +3845,26 @@
type = "critical";
};
};
+
+   cooling-maps {
+   map0 {
+   trip = <_alert0>;
+   cooling-device = < THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
+   };
+   };
};
 
gpuss1-thermal {
-   polling-delay-passive = <0>;
+   polling-delay-passive = <100>;
polling-delay = <0>;
 
thermal-sensors = < 14>;
 
trips {
gpuss1_alert0: trip-point0 {
-   temperature = <9>;
+   temperature = <95000>;
hysteresis = <2000>;
-   type = "hot";
+   type = "passive";
};
 
gpuss1_crit: gpuss1_crit {
@@ -3864,6 +3873,13 @@
type = "critical";
};
};
+
+   cooling-maps {
+   map0 {
+   trip = <_alert0>;
+   cooling-device = < THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
+   };
+   };
};
 
aoss1-thermal {
-- 
2.7.4



Re: [PATCH] arm64: defconfig: enable APSS clock driver for IPQ6018

2020-10-29 Thread Kathiravan T

Bjorn,

Wondering if this patch was overlooked due to some reason or should I 
send V2 based on v5.10-rc1?


Thanks,

Kathiravan T.

On 10/8/2020 9:59 PM, Kathiravan T wrote:

Bjorn,

Any comments on this? I would like to know if there is any chances of 
taking this patch for v5.10 merge window?


Thanks,

Kathiravan T.


On 9/17/2020 7:26 PM, Kathiravan T wrote:

Lets enable the APSS clock driver for the DVFS support.

Signed-off-by: Kathiravan T 
---
  arch/arm64/configs/defconfig | 1 +
  1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 6d04b9577b0b..67244560f869 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -850,6 +850,7 @@ CONFIG_QCOM_A53PLL=y
  CONFIG_QCOM_CLK_APCS_MSM8916=y
  CONFIG_QCOM_CLK_SMD_RPM=y
  CONFIG_QCOM_CLK_RPMH=y
+CONFIG_IPQ_APSS_6018=y
  CONFIG_IPQ_GCC_8074=y
  CONFIG_IPQ_GCC_6018=y
  CONFIG_MSM_GCC_8916=y

base-commit: 856deb866d16e29bd65952e0289066f6078af773



--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of 
Code Aurora Forum, hosted by The Linux Foundation



Re: [PATCH 0/4] arch, mm: improve robustness of direct map manipulation

2020-10-29 Thread Mike Rapoport
On Wed, Oct 28, 2020 at 09:03:31PM +, Edgecombe, Rick P wrote:

> > On Wed, Oct 28, 2020 at 11:20:12AM +, Will Deacon wrote:
> > > On Tue, Oct 27, 2020 at 10:38:16AM +0200, Mike Rapoport wrote:
> > > > 
> > > > This is a theoretical bug, but it is still not nice :)  
> > > > 
> > > 
> > > Just to clarify: this patch series fixes this problem, right?
> > 
> > Yes.
> > 
> 
> Well, now I'm confused again.
> 
> As David pointed, __vunmap() should not be executing simultaneously
> with the hibernate operation because hibernate can't snapshot while
> data it needs to save is still updating. If a thread was paused when a
> page was in an "invalid" state, it should be remapped by hibernate
> before the copy.
> 
> To level set, before reading this mail, my takeaways from the
> discussions on potential hibernate/debug page alloc problems were:
> 
> Potential RISC-V issue:
> Doesn't have hibernate support
> 
> Potential ARM issue:
> The logic around when it's cpa determines pages might be unmapped looks
> correct for current callers.
> 
> Potential x86 page break issue:
> Seems to be ok for now, but a new set_memory_np() caller could violate
> assumptions in hibernate.
> 
> Non-obvious thorny logic: 
> General agreement it would be good to separate dependencies.
> 
> Behavior of V1 of this patchset:
> No functional change other than addition of a warn in hibernate.

There is a change that adds explicit use of set_direct_map() to
hibernate. Currently, in case of arm64 with DEBUG_PAGEALLOC=n if a
thread was paused when a page was in an "invalid" state hibernate will
access an unmapped data because __kernel_map_pages() will bail out.
After the change set_direct_map_default_noflush() would be used and the
page will get mapped before copy.

> So "does this fix the problem", "yes" leaves me a bit confused... Not
> saying there couldn't be any problems, especially due to the thorniness
> and cross arch stride, but what is it exactly and how does this series
> fix it?

This series goal was primarily to separate dependincies and make it
clearer what DEBUG_PAGEALLOC and what SET_DIRECT_MAP are. As it turned
out, there is also some lack of consistency between architectures that
implement either of this so I tried to improve this as well.

Honestly, I don't know if a thread can be paused at the time __vunmap()
left invalid pages, but it could, there is an issue on arm64 with
DEBUG_PAGEALLOC=n and this set fixes it.

__vunmap()
vm_remove_mappings()
set_direct_map_invalid()
/* thread is frozen */
safe_copy_page()
__kernel_map_pages()
if (!debug_pagealloc())
return
do_copy_page() -> fault

-- 
Sincerely yours,
Mike.


Re: [RFC][PATCH 7/9] mm/vmscan: Consider anonymous pages without swap

2020-10-29 Thread Oscar Salvador
On Wed, Oct 07, 2020 at 09:17:49AM -0700, Dave Hansen wrote:
> 
> From: Keith Busch 
> 
> Age and reclaim anonymous pages if a migration path is available. The
> node has other recourses for inactive anonymous pages beyond swap,
> 
> #Signed-off-by: Keith Busch 
> Cc: Keith Busch 
> [vishal: fixup the migration->demotion rename]
> Signed-off-by: Vishal Verma 
> Signed-off-by: Dave Hansen 
> Cc: Yang Shi 
> Cc: David Rientjes 
> Cc: Huang Ying 
> Cc: Dan Williams 
> Cc: David Hildenbrand 

I have a question regarding this one.

It seems that we do have places where we read total_swap_pages directly and 
other
places where we use get_nr_swap_pages.
One seems to give the total number of swap pages, while the other gives 
the number of free swap pages.

With this patch, we will use always the atomic version get_nr_swap_pages from
now on.
Is that ok? I guess so, but it might warrant a mention in the changelog?

E.g: age_active_anon seems to base one of its decisions on whether we have
swap (it seems it does not care if swap space is available).

-- 
Oscar Salvador
SUSE L3


[PATCH v6 1/4] dt-bindings: net: Add 5GBASER phy interface mode

2020-10-29 Thread Pavana Sharma
Add 5GBASE-R phy interface mode supported by mv88e6393
family.

Signed-off-by: Pavana Sharma 
---
 Documentation/devicetree/bindings/net/ethernet-controller.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/ethernet-controller.yaml 
b/Documentation/devicetree/bindings/net/ethernet-controller.yaml
index fa2baca8c726..068c16fd27dc 100644
--- a/Documentation/devicetree/bindings/net/ethernet-controller.yaml
+++ b/Documentation/devicetree/bindings/net/ethernet-controller.yaml
@@ -92,6 +92,8 @@ properties:
   - rxaui
   - xaui
 
+  # 5GBASE-R
+  - 5gbase-r
   # 10GBASE-KR, XFI, SFI
   - 10gbase-kr
   - usxgmii
-- 
2.17.1



Re: [PATCH 1/2] fs:regfs: add register easy filesystem

2020-10-29 Thread zc



在 2020/10/29 上午10:42, Al Viro 写道:

On Tue, Oct 20, 2020 at 02:30:07PM +0800, Zou Cao wrote:

+ssize_t regfs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
+{
+   struct file *file = iocb->ki_filp;
+   struct inode *inode = file->f_mapping->host;
+   ssize_t ret;
+
+   inode_lock(inode);
+   ret = generic_write_checks(iocb, from);
+   if (ret > 0)
+   ret = __generic_file_write_iter(iocb, from);
+   inode_unlock(inode);
+
+   if (ret > 0)
+   ret = generic_write_sync(iocb, ret);
+   return ret;
+}

Huh?  How is that different from generic_file_write_iter()?  And who's
using it, anyway?

my bug,  remove it.

+   struct regfs_inode_info  *info = REGFS_I(mapping->host);
+   char str[67];
+   unsigned long val = 0;
+   loff_t pos = *ppos;
+   size_t res;
+
+   if (pos < 0)
+   return -EINVAL;
+   if (pos >= len || len > 66)
+   return 0;

This is completely bogus.  "If current position is greater than the
length of string we are asking to write, quietly return 0"?

Yes, fixed it.

+   res = copy_from_user(str, buf, len);
+   if (res)
+   return -EFAULT;
+   str[len] = 0;
+
+   if (kstrtoul(str, 16, ) < 0)
+   return -EINVAL;

Where does 67 come from?  If you are expecting a hexadecimal representation
of a unsigned long on arm64, you should have at most 16 digits.  67 looks
rather odd...


Yes, it is only 16.  thank you so much.

+   writel_relaxed(val, info->base + info->offset);

... and you are promptly discarding the upper 32 bits, since writel_relaxed()
takes u32:
((void)__raw_writel((__force u32)cpu_to_le32(v),(c)))
is going to truncate to 32bit, no matter what.  Quietly truncate, at that...


+const struct address_space_operations regfs_aops = {
+   .readpage   = simple_readpage,
+   .write_begin= simple_write_begin,
+   .write_end  = simple_write_end,
+   .set_page_dirty = __set_page_dirty_buffers,
+};

Again, huh?  What would use the page cache there, anyway?


actually it not need,  it will be remove


+static LIST_HEAD(regfs_head);

Protected by...?
It is  better to add a protect for multpite mount, i will do more test 
for it.

+static const struct inode_operations regfs_dir_inode_operations;
+int regfs_debug;
+module_param(regfs_debug, int, S_IRUGO);
+MODULE_PARM_DESC(regfs_debug, "enable regfs debug mode");
+
+struct inode *regfs_get_inode(struct super_block *sb, const struct inode *dir, 
umode_t mode, dev_t dev)
+{
+   struct inode *inode = new_inode(sb);
+
+   if (inode) {
+   inode->i_ino = get_next_ino();
+   inode_init_owner(inode, dir, mode);
+   inode->i_mapping->a_ops = _aops;
+   //inode->i_mapping->backing_dev_info = _backing_dev_info;
+   mapping_set_gfp_mask(inode->i_mapping, GFP_HIGHUSER);
+   mapping_set_unevictable(inode->i_mapping);
+   inode->i_atime = inode->i_mtime = inode->i_ctime = 
current_time(inode);
+   switch (mode & S_IFMT) {
+   default:
+   init_special_inode(inode, mode, dev);
+   break;
+   case S_IFREG:
+   inode->i_op = _file_inode_operations;
+   inode->i_fop = _file_operations;
+   break;
+   case S_IFDIR:
+   inode->i_op = _dir_inode_operations;
+   inode->i_fop = _dir_operations;
+
+   /* directory inodes start off with i_nlink == 2 (for 
"." entry) */
+   inc_nlink(inode);
+   break;
+   case S_IFLNK:
+   inode->i_op = _symlink_inode_operations;
+   break;
+   }
+   }
+
+   return inode;
+}

Seriously?  Where would symlinks, device nodes, FIFOs and sockets come from?
And you are open-coding the regular file case in the new_dentry_create() anyway,
so the only thing this is actually used for is the root directory.
yes,  i have limited the rm/create/link in regfs in inode_operations, so 
i need to remove all these and only leave the


inode->i_op = _file_inode_operations; ?


+static const struct inode_operations regfs_dir_inode_operations = {
+   .lookup = simple_lookup,
+};

... and simple_dir_inode_operations is wrong, because...?

Here i limit the inode create/rm/link and so on, only support the read 
and write, it isn't useful for new inode,  because these inode have not 
register addr to bind its dentry,


i think these create/rm/simlink are invalidm,  only use simple_lookup.


+static struct dentry *new_dentry_create(struct super_block *sb, struct dentry 
*parent,
+const char *name, bool is_dir, struct res_data *res)
+{
+   struct dentry *dentry;
+   struct inode *inode;
+   struct regfs_inode_info *ei;
+   struct 

<    1   2   3   4   5   6   7   8   9   10   >