Re: [GIT PULL 3/5] ARM: SoC changes for v5.9

2020-08-04 Thread Joel Stanley
On Mon, 3 Aug 2020 at 21:49, Arnd Bergmann  wrote:
> ARM: SoC changes for v5.9

> Andy Shevchenko (1):
>   ARM: orion/gpio: Make use of for_each_requested_gpio()

This change broke the arm build (I noticed it when building multi_v5_defconfig):

../arch/arm/plat-orion/gpio.c:457:2: error: implicit declaration of
function ‘for_each_requested_gpio’
[-Werror=implicit-function-declaration]
  457 |  for_each_requested_gpio(chip, i, label) {
  |  ^~~

for_each_requested_gpio isn't in Linus (Torvalds) tree yet. It will be
fixed when he pulls Linus Walleij's GPIO tree which has the commit:

 b3337eb24831 gpiolib: Introduce for_each_requested_gpio_in_range() macro

Cheers,

Joel


Re: [v2,5/6] reset-controller: ti: Introduce force-update method

2020-08-04 Thread Philipp Zabel
Hi Crystal,

On Mon, 2020-08-03 at 14:15 +0800, Crystal Guo wrote:
> Introduce force-update method for assert and deassert interface,
> which force the write operation in case the read already happens
> to return the correct value.
> 
> Signed-off-by: Crystal Guo 

Added Suman and Andrew for confirmation: I think writing unconditionally
can't break any existing user. Just changing to regmap_write_bits()
instead of adding the update-force property as in v1 should be fine.

regards
Philipp

> ---
>  drivers/reset/reset-ti-syscon.c | 15 +--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/reset/reset-ti-syscon.c b/drivers/reset/reset-ti-syscon.c
> index 1c74bcb9a6c3..f4baf78afd14 100644
> --- a/drivers/reset/reset-ti-syscon.c
> +++ b/drivers/reset/reset-ti-syscon.c
> @@ -57,6 +57,7 @@ struct ti_syscon_reset_data {
>   struct ti_syscon_reset_control *controls;
>   unsigned int nr_controls;
>   bool assert_deassert_together;
> + bool update_force;
>  };
>  
>  #define to_ti_syscon_reset_data(rcdev)   \
> @@ -90,7 +91,10 @@ static int ti_syscon_reset_assert(struct 
> reset_controller_dev *rcdev,
>   mask = BIT(control->assert_bit);
>   value = (control->flags & ASSERT_SET) ? mask : 0x0;
>  
> - return regmap_update_bits(data->regmap, control->assert_offset, mask, 
> value);
> + if (data->update_force)
> + return regmap_write_bits(data->regmap, control->assert_offset, 
> mask, value);
> + else
> + return regmap_update_bits(data->regmap, control->assert_offset, 
> mask, value);
>  }
>  
>  /**
> @@ -121,7 +125,10 @@ static int ti_syscon_reset_deassert(struct 
> reset_controller_dev *rcdev,
>   mask = BIT(control->deassert_bit);
>   value = (control->flags & DEASSERT_SET) ? mask : 0x0;
>  
> - return regmap_update_bits(data->regmap, control->deassert_offset, mask, 
> value);
> + if (data->update_force)
> + return regmap_write_bits(data->regmap, 
> control->deassert_offset, mask, value);
> + else
> + return regmap_update_bits(data->regmap, 
> control->deassert_offset, mask, value);
>  }
>  
>  /**
> @@ -223,6 +230,10 @@ static int ti_syscon_reset_probe(struct platform_device 
> *pdev)
>   data->assert_deassert_together = true;
>   else
>   data->assert_deassert_together = false;
> + if (of_property_read_bool(np, "update-force"))
> + data->update_force = true;
> + else
> + data->update_force = false;
>  
>   data->rcdev.ops = &ti_syscon_reset_ops;
>   data->rcdev.owner = THIS_MODULE;
> -- 
> 2.18.0


Re: [PATCH] ASoC: fsl_sai: Clean code for synchronize mode

2020-08-04 Thread Nicolin Chen
On Tue, Aug 04, 2020 at 12:22:53PM +0800, Shengjiu Wang wrote:

> > > Btw, do we need similar change for TRIGGER_STOP?
> >
> > This is a good question. It is better to do change for STOP,
> > but I am afraid that there is no much test to guarantee the result.

> Maybe we can do this change for STOP.

The idea looks good to me...(check inline comments)
 
> diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
> index 1c0e06bb3783..6e4be398eaee 100644
> --- a/sound/soc/fsl/fsl_sai.c
> +++ b/sound/soc/fsl/fsl_sai.c
> @@ -517,6 +517,37 @@ static int fsl_sai_hw_free(struct
> snd_pcm_substream *substream,
> return 0;
>  }
> 
> +static void fsl_sai_config_disable(struct fsl_sai *sai, bool tx)
> +{
> +   unsigned int ofs = sai->soc_data->reg_offset;
> +   u32 xcsr, count = 100;
> +
> +   regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx, ofs),
> +  FSL_SAI_CSR_TERE, 0);
> +
> +   /* TERE will remain set till the end of current frame */
> +   do {
> +   udelay(10);
> +   regmap_read(sai->regmap, FSL_SAI_xCSR(tx, ofs), &xcsr);
> +   } while (--count && xcsr & FSL_SAI_CSR_TERE);
> +
> +   regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx, ofs),
> +  FSL_SAI_CSR_FR, FSL_SAI_CSR_FR);
> +
> +   /*
> +* For sai master mode, after several open/close sai,
> +* there will be no frame clock, and can't recover
> +* anymore. Add software reset to fix this issue.
> +* This is a hardware bug, and will be fix in the
> +* next sai version.
> +*/
> +   if (!sai->is_slave_mode) {
> +   /* Software Reset for both Tx and Rx */

Remove "for both Tx and Rx"

> /* Check if the opposite FRDE is also disabled */
> regmap_read(sai->regmap, FSL_SAI_xCSR(!tx, ofs), &xcsr);
> +   if (sai->synchronous[tx] && !sai->synchronous[!tx] && !(xcsr 
> & FSL_SAI_CSR_FRDE))
> +   fsl_sai_config_disable(sai, !tx);

> +   if (sai->synchronous[tx] || !sai->synchronous[!tx] || !(xcsr 
> & FSL_SAI_CSR_FRDE))
> +   fsl_sai_config_disable(sai, tx);

The first "||" should probably be "&&".

The trigger() logic is way more complicated than a simple cleanup
in my opinion. Would suggest to split RMR part out of this change.

And for conditions like "sync[tx] && !sync[!tx]", it'd be better
to have a helper function to improve readability:

/**
 * fsl_sai_dir_is_synced - Check if stream is synced by the opposite stream
 *
 * SAI supports synchronous mode using bit/frame clocks of either Transmitter's
 * or Receiver's for both streams. This function is used to check if clocks of
 * current stream's are synced by the opposite stream.
 *
 * @sai: SAI context
 * @dir: direction of current stream
 */
static inline bool fsl_sai_dir_is_synced(struct fsl_sai *sai, int dir)
{
int adir = (dir == TX) ? RX : TX;

/* current dir in async mode while opposite dir in sync mode */
return !sai->synchronous[dir] && sai->synchronous[adir];
}

Then add more comments in trigger:

static ...trigger()
{
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
int adir = tx ? RX : TX;
int dir = tx ? TX : RX;

// 
{
// ...

/* Check if the opposite FRDE is also disabled */
regmap_read(sai->regmap, FSL_SAI_xCSR(!tx, ofs), &xcsr);

/*
 * If opposite stream provides clocks for synchronous mode and
 * it is inactive, disable it before disabling the current one
 */
if (fsl_sai_dir_is_synced(adir) && !(xcsr & FSL_SAI_CSR_FRDE))
fsl_sai_config_disable(sai, adir);

/*
 * Disable current stream if either of:
 * 1. current stream doesn't provide clocks for synchronous mode
 * 2. current stream provides clocks for synchronous mode but no
 *more stream is active.
 */
if (!fsl_sai_dir_is_synced(dir) || !(xcsr & FSL_SAI_CSR_FRDE))
fsl_sai_config_disable(sai, dir);

// ...
}
// 
}

Note, in fsl_sai_config_disable(sai, dir):
bool tx = dir == TX;

Above all, I am just drafting, so please test it thoroughly :)


Re: linux-next: build failure after merge of the vhost tree

2020-08-04 Thread Guennadi Liakhovetski
Michael, looks like something went wrong with your merge? My patch 
https://lore.kernel.org/r/20200722150927.15587-3-guennadi.liakhovet...@linux.intel.com
 
has the header, your merged commit 
https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git/commit/?h=vhost&id=bba6f4f52c31af1ce4ebcc063afa08eb063b3d2c
doesn't have it?

Thanks
Guennadi

On Tue, Aug 04, 2020 at 07:47:58AM +0200, Guennadi Liakhovetski wrote:
> Hi Stephen,
> 
> On Tue, Aug 04, 2020 at 03:11:17PM +1000, Stephen Rothwell wrote:
> > Hi all,
> > 
> > After merging the vhost tree, today's linux-next build (arm
> > multi_v7_defconfig) failed like this:
> > 
> > drivers/rpmsg/virtio_rpmsg_bus.c:28:10: fatal error: linux/virtio_rpmsg.h: 
> > No such file or directory
> >28 | #include 
> >   |  ^~
> > 
> > Caused by commit
> > 
> >   bba6f4f52c31 ("rpmsg: move common structures and defines to headers")
> > 
> > I have used the vhost tree from next-20200803 for today.
> 
> Yes, I've seen that, that's a clang build for MIPS... I'll have a look.
> 
> Thanks
> Guennadi
> 
> > -- 
> > Cheers,
> > Stephen Rothwell


Re: [PATCH v2] drivers/net/wan/lapbether: Use needed_headroom instead of hard_header_len

2020-08-04 Thread Willem de Bruijn
> I don't like the idea to get rid of the 1-byte header.
> This header is also used in userspace, for example when using a tun/tap
> interface for an XoT (X.25 over TCP) application. A change would
> therefore have very far-reaching consequences.

That's no longer the plan of record.

> BTW: The linux x25 mailing list does not seem to work anymore. I've been
> on it for some time now, but haven't received a single email from it.
> I've tried to contact owner-linux-...@vger.kernel.org, but only got an
> "undeliverable" email back.

That is odd. It is a vger hosted list.

I'm not subscribed, but indeed the spinics archive ends in 2009 and
the other archive link resolves to something that is definitely not
X.25 related.

http://vger.kernel.org/vger-lists.html#linux-x25

> It would be great if you could add me to CC list of all versions of your
> patches, so I don't need to "google" for any further related mails.
>
> So, what's the latest version of the patch now, which you want me to
> review?

http://patchwork.ozlabs.org/project/netdev/patch/20200802195046.402539-1-xie.he.0...@gmail.com/


[PATCH v3 3/4] fpga: dfl: create a dfl bus type to support DFL devices

2020-08-04 Thread Xu Yilun
A new bus type "dfl" is introduced for private features which are not
initialized by DFL feature drivers (dfl-fme & dfl-afu drivers). So these
private features could be handled by separate driver modules.

DFL feature drivers (dfl-fme, dfl-port) will create DFL devices on
enumeration. DFL drivers could be registered on this bus to match these
DFL devices. They are matched by dfl type & feature_id.

Signed-off-by: Xu Yilun 
Signed-off-by: Wu Hao 
Signed-off-by: Matthew Gerlach 
Signed-off-by: Russ Weight 
Reviewed-by: Tom Rix 
---
v2: change the bus uevent format.
change the dfl device's sysfs name format.
refactor dfl_dev_add().
minor fixes for comments from Hao and Tom.
v3: no change.
---
 Documentation/ABI/testing/sysfs-bus-dfl |  15 ++
 drivers/fpga/dfl.c  | 254 +++-
 drivers/fpga/dfl.h  |  84 +++
 3 files changed, 345 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-dfl

diff --git a/Documentation/ABI/testing/sysfs-bus-dfl 
b/Documentation/ABI/testing/sysfs-bus-dfl
new file mode 100644
index 000..b1eea30
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-bus-dfl
@@ -0,0 +1,15 @@
+What:  /sys/bus/dfl/devices/.../type
+Date:  July 2020
+KernelVersion: 5.9
+Contact:   Xu Yilun 
+Description:   Read-only. It returns type of DFL FIU of the device. Now DFL
+   supports 2 FIU types, 0 for FME, 1 for PORT.
+   Format: 0x%x
+
+What:  /sys/bus/dfl/devices/.../feature_id
+Date:  July 2020
+KernelVersion: 5.9
+Contact:   Xu Yilun 
+Description:   Read-only. It returns feature identifier local to its DFL FIU
+   type.
+   Format: 0x%x
diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c
index c649239..978d182 100644
--- a/drivers/fpga/dfl.c
+++ b/drivers/fpga/dfl.c
@@ -30,12 +30,6 @@ static DEFINE_MUTEX(dfl_id_mutex);
  * index to dfl_chardevs table. If no chardev support just set devt_type
  * as one invalid index (DFL_FPGA_DEVT_MAX).
  */
-enum dfl_id_type {
-   FME_ID, /* fme id allocation and mapping */
-   PORT_ID,/* port id allocation and mapping */
-   DFL_ID_MAX,
-};
-
 enum dfl_fpga_devt_type {
DFL_FPGA_DEVT_FME,
DFL_FPGA_DEVT_PORT,
@@ -250,6 +244,236 @@ int dfl_fpga_check_port_id(struct platform_device *pdev, 
void *pport_id)
 }
 EXPORT_SYMBOL_GPL(dfl_fpga_check_port_id);
 
+static DEFINE_IDA(dfl_device_ida);
+
+static const struct dfl_device_id *
+dfl_match_one_device(const struct dfl_device_id *id, struct dfl_device *ddev)
+{
+   if (id->type == ddev->type && id->feature_id == ddev->feature_id)
+   return id;
+
+   return NULL;
+}
+
+static int dfl_bus_match(struct device *dev, struct device_driver *drv)
+{
+   struct dfl_device *ddev = to_dfl_dev(dev);
+   struct dfl_driver *ddrv = to_dfl_drv(drv);
+   const struct dfl_device_id *id_entry = ddrv->id_table;
+
+   if (id_entry) {
+   while (id_entry->feature_id) {
+   if (dfl_match_one_device(id_entry, ddev)) {
+   ddev->id_entry = id_entry;
+   return 1;
+   }
+   id_entry++;
+   }
+   }
+
+   return 0;
+}
+
+static int dfl_bus_probe(struct device *dev)
+{
+   struct dfl_device *ddev = to_dfl_dev(dev);
+   struct dfl_driver *ddrv = to_dfl_drv(dev->driver);
+
+   return ddrv->probe(ddev);
+}
+
+static int dfl_bus_remove(struct device *dev)
+{
+   struct dfl_device *ddev = to_dfl_dev(dev);
+   struct dfl_driver *ddrv = to_dfl_drv(dev->driver);
+
+   if (ddrv->remove)
+   ddrv->remove(ddev);
+
+   return 0;
+}
+
+static int dfl_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
+{
+   struct dfl_device *ddev = to_dfl_dev(dev);
+
+   return add_uevent_var(env, "MODALIAS=dfl:t%08Xf%04X",
+ ddev->type, ddev->feature_id);
+}
+
+/* show dfl info fields */
+#define dfl_info_attr(field, format_string)\
+static ssize_t \
+field##_show(struct device *dev, struct device_attribute *attr,
\
+char *buf) \
+{  \
+   struct dfl_device *ddev = to_dfl_dev(dev);  \
+   \
+   return sprintf(buf, format_string, ddev->field);\
+}  \
+static DEVICE_ATTR_RO(field)
+
+dfl_info_attr(type, "0x%x\n");
+dfl_info_attr(feature_id, "0x%x\n");
+
+static struct attribute *dfl_dev_attrs[] = {
+   &dev_attr_type.attr,
+   &dev_attr_feature_id.attr,
+   NULL,

[PATCH v3 2/4] fpga: dfl: map feature mmio resources in their own feature drivers

2020-08-04 Thread Xu Yilun
This patch makes preparation for modularization of DFL sub feature
drivers.

Currently, if we need to support a new DFL sub feature, an entry should
be added to fme/port_feature_drvs[] in dfl-fme/port-main.c. And we need
to re-compile the whole DFL modules. That make the DFL drivers hard to be
extended.

Another consideration is that DFL may contain some IP blocks which are
already supported by kernel, most of them are supported by platform
device drivers. We could create platform devices for these IP blocks and
get them supported by these drivers.

An important issue is that platform device drivers usually requests mmio
resources on probe. But now dfl mmio is mapped in dfl bus driver (e.g.
dfl-pci) as a whole region. Then platform device drivers for sub features
can't request their own mmio resources again. This is what the patch
trying to resolve.

This patch changes the DFL enumeration. DFL bus driver will unmap mmio
resources after first step enumeration and pass enumeration info to DFL
framework. Then DFL framework will map the mmio resources again, do 2nd
step enumeration, and also unmap the mmio resources. In this way, sub
feature drivers could then request their own mmio resources as needed.

An exception is that mmio resource of FIU headers are still mapped in dfl
bus driver. The FIU headers have some fundamental functions (sriov set,
port enable/disable) needed for dfl bus devices and other sub features.
They should not be unmapped as long as dfl bus device is alive.

Signed-off-by: Xu Yilun 
Signed-off-by: Wu Hao 
Signed-off-by: Matthew Gerlach 
Signed-off-by: Russ Weight 
Reviewed-by: Tom Rix 
---
v2: delete dfl_binfo_shift() cause no shift is possible for FIU parsing.
Only map bar0 for first phase enumeration in dfl-pci, we can find
  all dfl mmio resource info in bar0.
Some minor fixes for comments from Hao & Tom.
v3: no change.
---
 drivers/fpga/dfl-pci.c |  24 +++
 drivers/fpga/dfl.c | 185 ++---
 drivers/fpga/dfl.h |   7 +-
 3 files changed, 140 insertions(+), 76 deletions(-)

diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c
index e220bec..a2203d0 100644
--- a/drivers/fpga/dfl-pci.c
+++ b/drivers/fpga/dfl-pci.c
@@ -31,12 +31,12 @@ struct cci_drvdata {
struct dfl_fpga_cdev *cdev; /* container device */
 };
 
-static void __iomem *cci_pci_ioremap_bar(struct pci_dev *pcidev, int bar)
+static void __iomem *cci_pci_ioremap_bar0(struct pci_dev *pcidev)
 {
-   if (pcim_iomap_regions(pcidev, BIT(bar), DRV_NAME))
+   if (pcim_iomap_regions(pcidev, BIT(0), DRV_NAME))
return NULL;
 
-   return pcim_iomap_table(pcidev)[bar];
+   return pcim_iomap_table(pcidev)[0];
 }
 
 static int cci_pci_alloc_irq(struct pci_dev *pcidev)
@@ -156,8 +156,8 @@ static int cci_enumerate_feature_devs(struct pci_dev 
*pcidev)
goto irq_free_exit;
}
 
-   /* start to find Device Feature List from Bar 0 */
-   base = cci_pci_ioremap_bar(pcidev, 0);
+   /* start to find Device Feature List in Bar 0 */
+   base = cci_pci_ioremap_bar0(pcidev);
if (!base) {
ret = -ENOMEM;
goto irq_free_exit;
@@ -172,7 +172,7 @@ static int cci_enumerate_feature_devs(struct pci_dev 
*pcidev)
start = pci_resource_start(pcidev, 0);
len = pci_resource_len(pcidev, 0);
 
-   dfl_fpga_enum_info_add_dfl(info, start, len, base);
+   dfl_fpga_enum_info_add_dfl(info, start, len);
 
/*
 * find more Device Feature Lists (e.g. Ports) per information
@@ -196,26 +196,24 @@ static int cci_enumerate_feature_devs(struct pci_dev 
*pcidev)
 */
bar = FIELD_GET(FME_PORT_OFST_BAR_ID, v);
offset = FIELD_GET(FME_PORT_OFST_DFH_OFST, v);
-   base = cci_pci_ioremap_bar(pcidev, bar);
-   if (!base)
-   continue;
-
start = pci_resource_start(pcidev, bar) + offset;
len = pci_resource_len(pcidev, bar) - offset;
 
-   dfl_fpga_enum_info_add_dfl(info, start, len,
-  base + offset);
+   dfl_fpga_enum_info_add_dfl(info, start, len);
}
} else if (dfl_feature_is_port(base)) {
start = pci_resource_start(pcidev, 0);
len = pci_resource_len(pcidev, 0);
 
-   dfl_fpga_enum_info_add_dfl(info, start, len, base);
+   dfl_fpga_enum_info_add_dfl(info, start, len);
} else {
ret = -ENODEV;
goto irq_free_exit;
}
 
+   /* release I/O mappings for next step enumeration */
+   pcim_iounmap_regions(pcidev, BIT(0));
+
/* start enumeration with prepared enumeration information */
cdev = dfl_f

[PATCH v3 4/4] fpga: dfl: add support for N3000 nios private feature

2020-08-04 Thread Xu Yilun
This patch adds support for the nios handshake private feature on Intel
N3000 FPGA Card. This private feature provides a handshake interface to
FPGA NIOS firmware, which receives retimer configuration command from host
and executes via an internal SPI master. When nios finished the
configuration, host takes over the ownership of the SPI master to control
an Intel MAX10 BMC Chip on the SPI bus.

For NIOS firmware handshake part, this driver requests the retimer
configuration for NIOS with parameters from module param, and adds some
sysfs nodes for user to query NIOS state.

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

Signed-off-by: Xu Yilun 
Signed-off-by: Wu Hao 
Signed-off-by: Matthew Gerlach 
Signed-off-by: Russ Weight 
Reviewed-by: Tom Rix 
---
v3: Add the doc for this driver.
Minor fixes for comments from Tom.
---
 .../ABI/testing/sysfs-bus-dfl-devices-n3000-nios   |  18 +
 Documentation/fpga/dfl-n3000-nios.rst  |  39 ++
 Documentation/fpga/index.rst   |   1 +
 drivers/fpga/Kconfig   |  12 +
 drivers/fpga/Makefile  |   2 +
 drivers/fpga/dfl-n3000-nios.c  | 518 +
 6 files changed, 590 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-dfl-devices-n3000-nios
 create mode 100644 Documentation/fpga/dfl-n3000-nios.rst
 create mode 100644 drivers/fpga/dfl-n3000-nios.c

diff --git a/Documentation/ABI/testing/sysfs-bus-dfl-devices-n3000-nios 
b/Documentation/ABI/testing/sysfs-bus-dfl-devices-n3000-nios
new file mode 100644
index 000..fcfcdbd
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-bus-dfl-devices-n3000-nios
@@ -0,0 +1,18 @@
+What:  /sys/bus/dfl/devices/dfl-fme.X.X/fec_mode
+Date:  July 2020
+KernelVersion: 5.9
+Contact:   Xu Yilun 
+Description:   Read-only. It returns the FEC mode of the ethernet retimer
+   configured by NIOS firmware. "rs" for RS FEC mode, "kr" for
+   KR FEC mode, "no" FOR NO FEC mode. The FEC mode could be set
+   by module parameters, but it could only be set once after the
+   board powers up.
+   Format: string
+
+What:  /sys/bus/dfl/devices/dfl-fme.X.X/nios_fw_version
+Date:  July 2020
+KernelVersion: 5.9
+Contact:   Xu Yilun 
+Description:   Read-only. It returns the NIOS firmware version in FPGA. Its
+   format is "major.minor.patch".
+   Format: %x.%x.%x
diff --git a/Documentation/fpga/dfl-n3000-nios.rst 
b/Documentation/fpga/dfl-n3000-nios.rst
new file mode 100644
index 000..391528e
--- /dev/null
+++ b/Documentation/fpga/dfl-n3000-nios.rst
@@ -0,0 +1,39 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+=
+DFL N3000 Nios Private Feature Driver
+=
+
+The dfl n3000 nios driver supports for the nios handshake private feature on
+Intel N3000 FPGA Card.
+
+This private feature provides a handshake interface to FPGA NIOS firmware,
+which receives the ethernet retimer configuration command from host and
+do the configuration via an internal SPI master. When nios finished the
+configuration, host takes over the ownership of the SPI master to control an
+Intel MAX10 BMC Chip on the SPI bus.
+
+So the driver does 2 major tasks on probe, requires NIOS firmware to configure
+the ethernet retimer by operating the handshake interfaces, and then creates a
+spi master platform device with the MAX10 device info in spi_board_info.
+
+Module Parameters
+=
+
+The dfl n3000 nios driver supports the following module parameters:
+
+* fec_mode: string
+  Require the NIOS firmware to set the FEC mode of the ethernet retimer on
+  the PAC N3000 FPGA card. The possible values could be:
+
+  - "rs": RS FEC mode (default)
+  - "kr": KR FEC mode
+  - "no": NO FEC mode
+
+  The configuration could only be set once after the board powers up, the
+  firmware will not accept a second configuration afterward. So the fec mode
+  will not be changed if the module is reloaded with a different param value.
+
+  The configured value of the fec mode could be queried from sysfs node:
+
+  /sys/bus/dfl/devices/dfl-fme.X.X/fec_mode
diff --git a/Documentation/fpga/index.rst b/Documentation/fpga/index.rst
index f80f956..5fd3c37 100644
--- a/Documentation/fpga/index.rst
+++ b/Documentation/fpga/index.rst
@@ -8,6 +8,7 @@ fpga
 :maxdepth: 1
 
 dfl
+dfl-n3000-nios
 
 .. only::  subproject and html
 
diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
index 7cd5a29..f820142 100644
--- a/drivers/fpga/Kconfig
+++ b/drivers/fpga/Kconfig
@@ -191,6 +191,18 @@ config FPGA_DFL_AFU
  to the FPGA infrastructure via a Port. There may be more than one
  Port/AFU per DFL based FPGA device.
 
+config FPGA_DFL_N3000_NI

[PATCH v3 1/4] fpga: dfl: change data type of feature id to u16

2020-08-04 Thread Xu Yilun
The feature id is stored in a 12 bit field in DFH. So a u16 variable is
enough for feature id.

This patch changes all feature id related places to fit u16.

Signed-off-by: Xu Yilun 
Reviewed-by: Tom Rix 
---
v3: no change.
---
 drivers/fpga/dfl-fme-perf.c |  2 +-
 drivers/fpga/dfl.c  | 29 +++--
 drivers/fpga/dfl.h  | 10 +-
 3 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/drivers/fpga/dfl-fme-perf.c b/drivers/fpga/dfl-fme-perf.c
index 6ce1ed2..5312662 100644
--- a/drivers/fpga/dfl-fme-perf.c
+++ b/drivers/fpga/dfl-fme-perf.c
@@ -148,7 +148,7 @@ struct fme_perf_priv {
struct device *dev;
void __iomem *ioaddr;
struct pmu pmu;
-   u64 id;
+   u16 id;
 
u32 fab_users;
u32 fab_port_id;
diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c
index 649958a..18575d9 100644
--- a/drivers/fpga/dfl.c
+++ b/drivers/fpga/dfl.c
@@ -58,7 +58,7 @@ static const char *dfl_pdata_key_strings[DFL_ID_MAX] = {
  */
 struct dfl_dev_info {
const char *name;
-   u32 dfh_id;
+   u16 dfh_id;
struct idr id;
enum dfl_fpga_devt_type devt_type;
 };
@@ -134,7 +134,7 @@ static enum dfl_id_type feature_dev_id_type(struct 
platform_device *pdev)
return DFL_ID_MAX;
 }
 
-static enum dfl_id_type dfh_id_to_type(u32 id)
+static enum dfl_id_type dfh_id_to_type(u16 id)
 {
int i;
 
@@ -454,7 +454,7 @@ struct build_feature_devs_info {
  * @nr_irqs: number of irqs of this sub feature.
  */
 struct dfl_feature_info {
-   u64 fid;
+   u16 fid;
struct resource mmio_res;
void __iomem *ioaddr;
struct list_head node;
@@ -649,7 +649,7 @@ static inline u32 feature_size(void __iomem *start)
return ofst ? ofst : 4096;
 }
 
-static u64 feature_id(void __iomem *start)
+static u16 feature_id(void __iomem *start)
 {
u64 v = readq(start + DFH);
u16 id = FIELD_GET(DFH_ID, v);
@@ -667,7 +667,7 @@ static u64 feature_id(void __iomem *start)
 }
 
 static int parse_feature_irqs(struct build_feature_devs_info *binfo,
- resource_size_t ofst, u64 fid,
+ resource_size_t ofst, u16 fid,
  unsigned int *irq_base, unsigned int *nr_irqs)
 {
void __iomem *base = binfo->ioaddr + ofst;
@@ -713,12 +713,12 @@ static int parse_feature_irqs(struct 
build_feature_devs_info *binfo,
return 0;
}
 
-   dev_dbg(binfo->dev, "feature: 0x%llx, irq_base: %u, nr_irqs: %u\n",
+   dev_dbg(binfo->dev, "feature: 0x%x, irq_base: %u, nr_irqs: %u\n",
fid, ibase, inr);
 
if (ibase + inr > binfo->nr_irqs) {
dev_err(binfo->dev,
-   "Invalid interrupt number in feature 0x%llx\n", fid);
+   "Invalid interrupt number in feature 0x%x\n", fid);
return -EINVAL;
}
 
@@ -726,7 +726,7 @@ static int parse_feature_irqs(struct 
build_feature_devs_info *binfo,
virq = binfo->irq_table[ibase + i];
if (virq < 0 || virq > NR_IRQS) {
dev_err(binfo->dev,
-   "Invalid irq table entry for feature 0x%llx\n",
+   "Invalid irq table entry for feature 0x%x\n",
fid);
return -EINVAL;
}
@@ -748,7 +748,7 @@ static int parse_feature_irqs(struct 
build_feature_devs_info *binfo,
 static int
 create_feature_instance(struct build_feature_devs_info *binfo,
struct dfl_fpga_enum_dfl *dfl, resource_size_t ofst,
-   resource_size_t size, u64 fid)
+   resource_size_t size, u16 fid)
 {
unsigned int irq_base, nr_irqs;
struct dfl_feature_info *finfo;
@@ -819,9 +819,10 @@ static int parse_feature_fiu(struct 
build_feature_devs_info *binfo,
 struct dfl_fpga_enum_dfl *dfl,
 resource_size_t ofst)
 {
-   u32 id, offset;
-   u64 v;
int ret = 0;
+   u32 offset;
+   u16 id;
+   u64 v;
 
v = readq(dfl->ioaddr + ofst + DFH);
id = FIELD_GET(DFH_ID, v);
@@ -855,8 +856,8 @@ static int parse_feature_private(struct 
build_feature_devs_info *binfo,
 resource_size_t ofst)
 {
if (!binfo->feature_dev) {
-   dev_err(binfo->dev, "the private feature %llx does not belong 
to any AFU.\n",
-   (unsigned long long)feature_id(dfl->ioaddr + ofst));
+   dev_err(binfo->dev, "the private feature 0x%x does not belong 
to any AFU.\n",
+   feature_id(dfl->ioaddr + ofst));
return -EINVAL;
}
 
@@ -1424,7 +1425,7 @@ static int do_set_irq_trigger(struct dfl_feature 
*feature, unsigned int idx,
return 0;
 
feature->irq_ctx[idx].name =
-   

[PATCH v3 0/4] Modularization of DFL private feature drivers

2020-08-04 Thread Xu Yilun
This patchset makes it possible to develop independent driver modules
for DFL private features. It also helps to leverage existing kernel
drivers to enable some IP blocks in DFL.

Patch #1: An improvement of feature id definition. The feature id will be used
  as the key field for dfl device/driver matching.
Patch #2: Release the dfl mmio regions after enumeration, so that private
  feature drivers could request mmio region in their own drivers.
Patch #3: Introduce the dfl bus, then dfl devices could be supported by
  independent dfl drivers.
Patch #4: An example of the dfl driver for N3000 nios private feature.


Main changes from v1:
- Add the new Patch #1, to improve the feature id definition.
- Change the dfl bus uevent format.
- Change the dfl device's sysfs name format.
- refactor dfl_dev_add()
- Add the Patch #4 as an example of the dfl driver.
- A lot of minor fixes for comments from Hao and Tom.

Main changes from v2:
- Add the doc for dfl-n3000-nios driver.
- Minor fixes for comments from Tom.

Xu Yilun (4):
  fpga: dfl: change data type of feature id to u16
  fpga: dfl: map feature mmio resources in their own feature drivers
  fpga: dfl: create a dfl bus type to support DFL devices
  fpga: dfl: add support for N3000 nios private feature

 Documentation/ABI/testing/sysfs-bus-dfl|  15 +
 .../ABI/testing/sysfs-bus-dfl-devices-n3000-nios   |  18 +
 Documentation/fpga/dfl-n3000-nios.rst  |  39 ++
 Documentation/fpga/index.rst   |   1 +
 drivers/fpga/Kconfig   |  12 +
 drivers/fpga/Makefile  |   2 +
 drivers/fpga/dfl-fme-perf.c|   2 +-
 drivers/fpga/dfl-n3000-nios.c  | 518 +
 drivers/fpga/dfl-pci.c |  24 +-
 drivers/fpga/dfl.c | 464 +++---
 drivers/fpga/dfl.h | 101 +++-
 11 files changed, 1094 insertions(+), 102 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-dfl
 create mode 100644 Documentation/ABI/testing/sysfs-bus-dfl-devices-n3000-nios
 create mode 100644 Documentation/fpga/dfl-n3000-nios.rst
 create mode 100644 drivers/fpga/dfl-n3000-nios.c

-- 
2.7.4



[PATCH] regulator: Avoid grabbing regulator lock during suspend/resume

2020-08-04 Thread Stephen Boyd
I see it takes about 5us per regulator to grab the lock, check that this
regulator isn't going to do anything for suspend, and then release the
lock. When that is combined with PMICs that have dozens of regulators we
get into a state where we spend a few miliseconds doing a bunch of
locking operations synchronously to figure out that there's nothing to
do. Let's reorganize the code here a bit so that we don't grab the lock
until we're actually going to do something so that suspend is a little
faster.

Cc: Matthias Kaehlcke 
Cc: Douglas Anderson 
Signed-off-by: Stephen Boyd 
---
 drivers/regulator/core.c | 75 +++-
 1 file changed, 51 insertions(+), 24 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 03154f5b939f..c94b656178ec 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -564,6 +564,30 @@ regulator_get_suspend_state(struct regulator_dev *rdev, 
suspend_state_t state)
}
 }
 
+static const struct regulator_state *
+regulator_get_suspend_state_check(struct regulator_dev *rdev, suspend_state_t 
state)
+{
+   const struct regulator_state *rstate;
+
+   rstate = regulator_get_suspend_state(rdev, state);
+   if (rstate == NULL)
+   return NULL;
+
+   /* If we have no suspend mode configuration don't set anything;
+* only warn if the driver implements set_suspend_voltage or
+* set_suspend_mode callback.
+*/
+   if (rstate->enabled != ENABLE_IN_SUSPEND &&
+   rstate->enabled != DISABLE_IN_SUSPEND) {
+   if (rdev->desc->ops->set_suspend_voltage ||
+   rdev->desc->ops->set_suspend_mode)
+   rdev_warn(rdev, "No configuration\n");
+   return NULL;
+   }
+
+   return rstate;
+}
+
 static ssize_t regulator_uV_show(struct device *dev,
struct device_attribute *attr, char *buf)
 {
@@ -981,27 +1005,10 @@ static int drms_uA_update(struct regulator_dev *rdev)
return err;
 }
 
-static int suspend_set_state(struct regulator_dev *rdev,
-   suspend_state_t state)
+static int __suspend_set_state(struct regulator_dev *rdev,
+  const struct regulator_state *rstate)
 {
int ret = 0;
-   struct regulator_state *rstate;
-
-   rstate = regulator_get_suspend_state(rdev, state);
-   if (rstate == NULL)
-   return 0;
-
-   /* If we have no suspend mode configuration don't set anything;
-* only warn if the driver implements set_suspend_voltage or
-* set_suspend_mode callback.
-*/
-   if (rstate->enabled != ENABLE_IN_SUSPEND &&
-   rstate->enabled != DISABLE_IN_SUSPEND) {
-   if (rdev->desc->ops->set_suspend_voltage ||
-   rdev->desc->ops->set_suspend_mode)
-   rdev_warn(rdev, "No configuration\n");
-   return 0;
-   }
 
if (rstate->enabled == ENABLE_IN_SUSPEND &&
rdev->desc->ops->set_suspend_enable)
@@ -1036,6 +1043,18 @@ static int suspend_set_state(struct regulator_dev *rdev,
return ret;
 }
 
+static int suspend_set_initial_state(struct regulator_dev *rdev)
+{
+   const struct regulator_state *rstate;
+
+   rstate = regulator_get_suspend_state_check(rdev,
+   rdev->constraints->initial_state);
+   if (!rstate)
+   return 0;
+
+   return __suspend_set_state(rdev, rstate);
+}
+
 static void print_constraints(struct regulator_dev *rdev)
 {
struct regulation_constraints *constraints = rdev->constraints;
@@ -1318,7 +1337,7 @@ static int set_machine_constraints(struct regulator_dev 
*rdev,
 
/* do we need to setup our suspend state */
if (rdev->constraints->initial_state) {
-   ret = suspend_set_state(rdev, rdev->constraints->initial_state);
+   ret = suspend_set_initial_state(rdev);
if (ret < 0) {
rdev_err(rdev, "failed to set suspend state\n");
return ret;
@@ -5297,9 +5316,14 @@ static int regulator_suspend(struct device *dev)
struct regulator_dev *rdev = dev_to_rdev(dev);
suspend_state_t state = pm_suspend_target_state;
int ret;
+   const struct regulator_state *rstate;
+
+   rstate = regulator_get_suspend_state_check(rdev, state);
+   if (!rstate)
+   return 0;
 
regulator_lock(rdev);
-   ret = suspend_set_state(rdev, state);
+   ret = __suspend_set_state(rdev, rstate);
regulator_unlock(rdev);
 
return ret;
@@ -5316,11 +5340,14 @@ static int regulator_resume(struct device *dev)
if (rstate == NULL)
return 0;
 
+   /* Avoid grabbing the lock if we don't need to */
+   if (!rdev->desc->ops->resume)
+   return 0;
+
regulator_lock(rdev);
 
-   if (rdev->desc->op

Re: [PATCH] ASoC: fsl_sai: Clean code for synchronize mode

2020-08-04 Thread Nicolin Chen
On Tue, Aug 04, 2020 at 12:03:46AM -0700, Nicolin Chen wrote:
> On Tue, Aug 04, 2020 at 12:22:53PM +0800, Shengjiu Wang wrote:
> 
> > > > Btw, do we need similar change for TRIGGER_STOP?
> > >
> > > This is a good question. It is better to do change for STOP,
> > > but I am afraid that there is no much test to guarantee the result.
> 
> > Maybe we can do this change for STOP.
> 
> The idea looks good to me...(check inline comments)
>  
> > diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
> > index 1c0e06bb3783..6e4be398eaee 100644
> > --- a/sound/soc/fsl/fsl_sai.c
> > +++ b/sound/soc/fsl/fsl_sai.c
> > @@ -517,6 +517,37 @@ static int fsl_sai_hw_free(struct
> > snd_pcm_substream *substream,
> > return 0;
> >  }
> > 
> > +static void fsl_sai_config_disable(struct fsl_sai *sai, bool tx)
> > +{
> > +   unsigned int ofs = sai->soc_data->reg_offset;
> > +   u32 xcsr, count = 100;
> > +
> > +   regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx, ofs),
> > +  FSL_SAI_CSR_TERE, 0);
> > +
> > +   /* TERE will remain set till the end of current frame */
> > +   do {
> > +   udelay(10);
> > +   regmap_read(sai->regmap, FSL_SAI_xCSR(tx, ofs), &xcsr);
> > +   } while (--count && xcsr & FSL_SAI_CSR_TERE);
> > +
> > +   regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx, ofs),
> > +  FSL_SAI_CSR_FR, FSL_SAI_CSR_FR);
> > +
> > +   /*
> > +* For sai master mode, after several open/close sai,
> > +* there will be no frame clock, and can't recover
> > +* anymore. Add software reset to fix this issue.
> > +* This is a hardware bug, and will be fix in the
> > +* next sai version.
> > +*/
> > +   if (!sai->is_slave_mode) {
> > +   /* Software Reset for both Tx and Rx */
> 
> Remove "for both Tx and Rx"
> 
> > /* Check if the opposite FRDE is also disabled */
> > regmap_read(sai->regmap, FSL_SAI_xCSR(!tx, ofs), &xcsr);
> > +   if (sai->synchronous[tx] && !sai->synchronous[!tx] && 
> > !(xcsr & FSL_SAI_CSR_FRDE))
> > +   fsl_sai_config_disable(sai, !tx);
> 
> > +   if (sai->synchronous[tx] || !sai->synchronous[!tx] || 
> > !(xcsr & FSL_SAI_CSR_FRDE))
> > +   fsl_sai_config_disable(sai, tx);
> 
> The first "||" should probably be "&&".
> 
> The trigger() logic is way more complicated than a simple cleanup
> in my opinion. Would suggest to split RMR part out of this change.
> 
> And for conditions like "sync[tx] && !sync[!tx]", it'd be better
> to have a helper function to improve readability:
> 
> /**
>  * fsl_sai_dir_is_synced - Check if stream is synced by the opposite stream
>  *
>  * SAI supports synchronous mode using bit/frame clocks of either 
> Transmitter's
>  * or Receiver's for both streams. This function is used to check if clocks of
>  * current stream's are synced by the opposite stream.

Aww..this should be a generic function, so drop "current":

  * or Receiver's for both streams. This function is used to check if clocks of
  * the stream's are synced by the opposite stream.

>  *
>  * @sai: SAI context
>  * @dir: direction of current stream

Ditto:
   * @dir: stream direction

Thanks.
-
   
>  */
> static inline bool fsl_sai_dir_is_synced(struct fsl_sai *sai, int dir)
> {
>   int adir = (dir == TX) ? RX : TX;
> 
>   /* current dir in async mode while opposite dir in sync mode */
>   return !sai->synchronous[dir] && sai->synchronous[adir];
> }
> 
> Then add more comments in trigger:
> 
> static ...trigger()
> {
>   bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
>   int adir = tx ? RX : TX;
>   int dir = tx ? TX : RX;
> 
>   // 
>   {
>   // ...
> 
>   /* Check if the opposite FRDE is also disabled */
>   regmap_read(sai->regmap, FSL_SAI_xCSR(!tx, ofs), &xcsr);
> 
>   /*
>* If opposite stream provides clocks for synchronous mode and
>* it is inactive, disable it before disabling the current one
>*/
>   if (fsl_sai_dir_is_synced(adir) && !(xcsr & FSL_SAI_CSR_FRDE))
>   fsl_sai_config_disable(sai, adir);
> 
>   /*
>* Disable current stream if either of:
>* 1. current stream doesn't provide clocks for synchronous mode
>* 2. current stream provides clocks for synchronous mode but no
>*more stream is active.
>*/
>   if (!fsl_sai_dir_is_synced(dir) || !(xcsr & FSL_SAI_CSR_FRDE))
>   fsl_sai_config_disable(sai, dir);
> 
>   // ...
>   }
>   // 
> }
> 
> Note, in fsl_sai_config_disable(sai, dir):
>   bool tx = dir == TX;
> 
> Above all, I am just drafting, so please test it thoroughly :)


Re: [PATCH v2] perf evsel: Don't set sample_regs_intr/sample_regs_user for dummy event

2020-08-04 Thread Adrian Hunter
On 29/07/20 10:23 am, Jin, Yao wrote:
> Hi Adrian,
> 
> Could you help to check if following condition will break PT?
> 
> "(opts->sample_intr_regs && !evsel->no_aux_samples &&
> !evsel__is_dummy_event(evsel))"

Sorry for slow response - I've been away.

This is fine.  It will not break PT.

no_aux_samples is useful for evsels that have been added by the code rather
than requested by the user.  For old kernels PT adds sched_switch tracepoint
to track context switches (before the current context switch event was
added) and having auxiliary sample information unnecessarily uses up space
in the perf buffer.

Acked-by: Adrian Hunter 

> 
> Thanks
> Jin Yao
> 
> On 7/23/2020 9:01 AM, Jin, Yao wrote:
>> Hi Jiri, Adrian,
>>
>> On 7/22/2020 7:08 PM, Jiri Olsa wrote:
>>> On Wed, Jul 22, 2020 at 01:00:03PM +0800, Jin, Yao wrote:
>>>
>>> SNIP
>>>
>>
>> If we use -IXMM0, the attr>sample_regs_intr will be set with
>> PERF_REG_EXTENDED_MASK bit.
>>
>> It doesn't make sense to set attr->sample_regs_intr for a
>> software dummy event.
>>
>> This patch adds dummy event checking before setting
>> attr->sample_regs_intr and attr->sample_regs_user.
>>
>> After:
>>     # ./perf record -e cycles:p -IXMM0 -a -- sleep 1
>>     [ perf record: Woken up 1 times to write data ]
>>     [ perf record: Captured and wrote 0.413 MB perf.data (45 samples) ]
>>
>>    v2:
>>    ---
>>    Rebase to perf/core
>>
>> Fixes: 0a892c1c9472 ("perf record: Add dummy event during system wide
>> synthesis")
>> Signed-off-by: Jin Yao 
>> ---
>>    tools/perf/util/evsel.c | 6 --
>>    1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
>> index 9aa51a65593d..11794d3b7879 100644
>> --- a/tools/perf/util/evsel.c
>> +++ b/tools/perf/util/evsel.c
>> @@ -1014,12 +1014,14 @@ void evsel__config(struct evsel *evsel, struct
>> record_opts *opts,
>>    if (callchain && callchain->enabled && !evsel->no_aux_samples)
>>    evsel__config_callchain(evsel, opts, callchain);
>> -    if (opts->sample_intr_regs && !evsel->no_aux_samples) {
>> +    if (opts->sample_intr_regs && !evsel->no_aux_samples &&
>> +    !evsel__is_dummy_event(evsel)) {
>
> hum, I thought it'd look something like this:
>
>     if (opts->sample_intr_regs && (!evsel->no_aux_samples ||
> !evsel__is_dummy_event(evsel))
>
> but I'm not sure how no_aux_samples flag works exactly.. so it might be
> correct.. just making sure ;-)
>
> cc-ing Adrian
>
> jirka
>
>

 no_aux_samples is set to false by default and it's only set to true by
 pt, right?

 So most of the time, !evsel->no_aux_samples is always true.

 if (opts->sample_intr_regs && (!evsel->no_aux_samples ||
 !evsel__is_dummy_event(evsel)) {
 attr->sample_regs_intr = opts->sample_intr_regs;
 evsel__set_sample_bit(evsel, REGS_INTR);
 }

 So even if the evsel is dummy event, the condition check is true. :(

 Or maybe I misunderstand anything?
>>>
>>> I was just curious, because I did not follow the no_aux_samples
>>> usage in detail.. so how about a case where:
>>>
>>>     evsel->no_aux_samples == true and evsel__is_dummy_event(evsel) = false
>>>
>>> then the original condition will be false for non dummy event
>>>
>>>    (opts->sample_intr_regs && !evsel->no_aux_samples &&
>>> !evsel__is_dummy_event(evsel))
>>>
>>> is that ok?
>>>
>>
>> I searched the perf source and found the no_aux_samples was only set to
>> true in intel-pt.c. So I assume for the non-pt usage, the no_aux_samples
>> is always false.
>>
>> For non-pt usage,
>> (opts->sample_intr_regs && !evsel->no_aux_samples &&
>> !evsel__is_dummy_event(evsel)) is equal to
>> (opts->sample_intr_regs && !evsel__is_dummy_event(evsel))
>>
>> For pt usage, we need to consider the case that
>> evsel__is_dummy_event(evsel) is true or false.
>>
>> If evsel__is_dummy_event(evsel) is true:
>> (opts->sample_intr_regs && !evsel->no_aux_samples &&
>> !evsel__is_dummy_event(evsel)) is false.
>> It's expected.
>>
>> If evsel__is_dummy_event(evsel) is false:
>> (opts->sample_intr_regs && !evsel->no_aux_samples &&
>> !evsel__is_dummy_event(evsel)) is equal to
>> (opts->sample_intr_regs && !evsel->no_aux_samples)
>> That's the current code logic.
>>
>> So I think the condition "(opts->sample_intr_regs &&
>> !evsel->no_aux_samples && !evsel__is_dummy_event(evsel))" looks reasonable.
>>
>> Adrian, please correct me if I'm wrong here.
>>
>> Thanks
>> Jin Yao
>>
>>> jirka
>>>



Re: [PATCH 4.19 09/56] btrfs: inode: Verify inode mode to avoid NULL pointer dereference

2020-08-04 Thread Pavel Machek
Hi!


> @@ -6993,6 +7010,14 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode 
> *inode,
>   extent_start = found_key.offset;
>   if (found_type == BTRFS_FILE_EXTENT_REG ||
>   found_type == BTRFS_FILE_EXTENT_PREALLOC) {
> + /* Only regular file could have regular/prealloc extent */
> + if (!S_ISREG(inode->vfs_inode.i_mode)) {
> + ret = -EUCLEAN;
> + btrfs_crit(fs_info,
> + "regular/prealloc extent found for non-regular inode %llu",
> +btrfs_ino(inode));
> + goto out;
> + }

This sets ret, but function returns err. Fix was already submitted.

Best regards,
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


signature.asc
Description: PGP signature


[PATCH RFC] sched/fair: simplfy the work when reweighting entity

2020-08-04 Thread Jiang Biao
If a se is on_rq when reweighting entity, all we need should be
updating the load of cfs_rq, other dequeue/enqueue works could be
redundant, such as,
* account_numa_dequeue/account_numa_enqueue
* list_del/list_add from/into cfs_tasks
* nr_running--/nr_running++

Just simplfy the work. Could be helpful for the hot path.

Signed-off-by: Jiang Biao 
---
 kernel/sched/fair.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 04fa8dbcfa4d..18a8fc7bd0de 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3086,7 +3086,7 @@ static void reweight_entity(struct cfs_rq *cfs_rq, struct 
sched_entity *se,
/* commit outstanding execution time */
if (cfs_rq->curr == se)
update_curr(cfs_rq);
-   account_entity_dequeue(cfs_rq, se);
+   update_load_sub(&cfs_rq->load, se->load.weight);
}
dequeue_load_avg(cfs_rq, se);
 
@@ -3102,7 +3102,7 @@ static void reweight_entity(struct cfs_rq *cfs_rq, struct 
sched_entity *se,
 
enqueue_load_avg(cfs_rq, se);
if (se->on_rq)
-   account_entity_enqueue(cfs_rq, se);
+   update_load_add(&cfs_rq->load, se->load.weight);
 
 }
 
-- 
2.21.0



Re: [v2,4/6] reset-controller: ti: introduce a new reset handler

2020-08-04 Thread Philipp Zabel
On Mon, 2020-08-03 at 14:15 +0800, Crystal Guo wrote:
> Add ti_syscon_reset() to integrate assert and deassert together.
> If some modules need do serialized assert and deassert operations
> to reset itself, reset_control_reset can be called for convenience.
> 
> Change-Id: I9046992b115a46f3594de57fa89c6a2de9957d49
> ---
>  drivers/reset/reset-ti-syscon.c | 20 
>  1 file changed, 20 insertions(+)
> 
> diff --git a/drivers/reset/reset-ti-syscon.c b/drivers/reset/reset-ti-syscon.c
> index a2635c21db7f..1c74bcb9a6c3 100644
> --- a/drivers/reset/reset-ti-syscon.c
> +++ b/drivers/reset/reset-ti-syscon.c
> @@ -56,6 +56,7 @@ struct ti_syscon_reset_data {
>   struct regmap *regmap;
>   struct ti_syscon_reset_control *controls;
>   unsigned int nr_controls;
> + bool assert_deassert_together;
>  };
>  
>  #define to_ti_syscon_reset_data(rcdev)   \
> @@ -158,10 +159,24 @@ static int ti_syscon_reset_status(struct 
> reset_controller_dev *rcdev,
>   !(control->flags & STATUS_SET);
>  }
>  
> +static int ti_syscon_reset(struct reset_controller_dev *rcdev,
> +   unsigned long id)
> +{
> + struct ti_syscon_reset_data *data = to_ti_syscon_reset_data(rcdev);
> +
> + if (data->assert_deassert_together) {
> + ti_syscon_reset_assert(rcdev, id);
> + return ti_syscon_reset_deassert(rcdev, id);

Even if your hardware engineers guarantee that no delays are necessary
between assert and deassert for any peripheral used with your reset
controller that may use this function, this is not generic.

I wonder if it would be better to define a minimum delay similarly to
reset-simple [1].

[1] 
https://lore.kernel.org/lkml/be2cecb2654e68385561a15df7967c7723d5531d.1590594512.git-series.max...@cerno.tech/

> + } else {
> + return -ENOTSUPP;
> + }
> +}
> +
>  static const struct reset_control_ops ti_syscon_reset_ops = {
>   .assert = ti_syscon_reset_assert,
>   .deassert   = ti_syscon_reset_deassert,
>   .status = ti_syscon_reset_status,
> + .reset  = ti_syscon_reset,
>  };
>  
>  static int ti_syscon_reset_probe(struct platform_device *pdev)
> @@ -204,6 +219,11 @@ static int ti_syscon_reset_probe(struct platform_device 
> *pdev)
>   controls[i].flags = be32_to_cpup(list++);
>   }
>  
> + if (of_property_read_bool(np, "assert-deassert-together"))
> + data->assert_deassert_together = true;
> + else
> + data->assert_deassert_together = false;
> +

This could just be assigned directly, but as said above, I think it
might be better to have a reset-duration-us property or similar.

regards
Philipp


Re: [PATCH] gve: Fix the size used in a 'dma_free_coherent()' call

2020-08-04 Thread Willem de Bruijn
On Mon, Aug 3, 2020 at 9:50 PM Christophe JAILLET
 wrote:
>
> Le 03/08/2020 à 21:35, Joe Perches a écrit :
> > On Mon, 2020-08-03 at 21:19 +0200, Christophe JAILLET wrote:
> >> Le 03/08/2020 à 17:41, Jakub Kicinski a écrit :
> >>> On Sun,  2 Aug 2020 16:15:23 +0200 Christophe JAILLET wrote:
>  Update the size used in 'dma_free_coherent()' in order to match the one
>  used in the corresponding 'dma_alloc_coherent()'.
> 
>  Fixes: 893ce44df5 ("gve: Add basic driver framework for Compute Engine 
>  Virtual NIC")
>  Signed-off-by: Christophe JAILLET 
> >>>
> >>> Fixes tag: Fixes: 893ce44df5 ("gve: Add basic driver framework for 
> >>> Compute Engine Virtual NIC")
> >>> Has these problem(s):
> >>> - SHA1 should be at least 12 digits long
> >>>   Can be fixed by setting core.abbrev to 12 (or more) or (for git 
> >>> v2.11
> >>>   or later) just making sure it is not set (or set to "auto").
> >>>
> >>
> >> Hi,
> >>
> >> I have git 2.25.1 and core.abbrev is already 12, both in my global
> >> .gitconfig and in the specific .git/gitconfig of my repo.
> >>
> >> I would have expected checkpatch to catch this kind of small issue.
> >> Unless I do something wrong, it doesn't.
> >>
> >> Joe, does it make sense to you and would one of the following patch help?
> >
> > 18 months ago I sent:
> >
> > https://lore.kernel.org/lkml/40bfc40958fca6e2cc9b86101153aa0715fac4f7.ca...@perches.com/
> >
> >
> >
>
> Looks like the same spirit.
> I've not tested, but doesn't the:
> ($line =~ /(?:\s|^)[0-9a-f]{12,40}(?:[\s"'\(\[]|$)/i &&
> at the top short cut the rest of the regex?
>
> I read it as "the line should have something that looks like a commit id
> of 12+ char to process further".
>
> So smaller commit id would not be checked.
> Did I miss something?
>
>
> Basically, my proposal is to replace this 12 by a 5 in order to accept
> smaller strings before checking if it looks well formatted or not.

My attempt from a few years ago: https://lore.kernel.org/patchwork/patch/911726/


Re: [PATCH 4.19 09/56] btrfs: inode: Verify inode mode to avoid NULL pointer dereference

2020-08-04 Thread Greg Kroah-Hartman
On Tue, Aug 04, 2020 at 09:11:32AM +0200, Pavel Machek wrote:
> Hi!
> 
> 
> > @@ -6993,6 +7010,14 @@ struct extent_map *btrfs_get_extent(struct 
> > btrfs_inode *inode,
> > extent_start = found_key.offset;
> > if (found_type == BTRFS_FILE_EXTENT_REG ||
> > found_type == BTRFS_FILE_EXTENT_PREALLOC) {
> > +   /* Only regular file could have regular/prealloc extent */
> > +   if (!S_ISREG(inode->vfs_inode.i_mode)) {
> > +   ret = -EUCLEAN;
> > +   btrfs_crit(fs_info,
> > +   "regular/prealloc extent found for non-regular inode %llu",
> > +  btrfs_ino(inode));
> > +   goto out;
> > +   }
> 
> This sets ret, but function returns err. Fix was already submitted.

What is the git commit id of that fix?

thanks,

greg k-h


Re: [PATCH] eeprom: at25: allow page sizes greater than 16 bit

2020-08-04 Thread Greg Kroah-Hartman
On Tue, Aug 04, 2020 at 08:40:52AM +0200, Christian Eggers wrote:
> Ping?

It's the middle of the merge window now, I can't take any patches for
the next 2 weeks, sorry.  It is in my queue, and will be looked at after
5.9-rc1 is out.

thanks,

greg k-h


RE: [EXT] Re: [PATCH v4 1/2] net: dsa: Add protocol support for 802.1AD when adding or deleting vlan for dsa switch port

2020-08-04 Thread Hongbo Wang
> You are adding a new member to the switchdev VLAN object, so you should
> make sure that all call paths creating and parsing that object get updated as
> well, for now, you are doing this solely within DSA which is probably
> reasonable if we assume proto is uninitialized and unused elsewhere, there is
> no change of functionality.

I will review the related code, and confirm it.

> [snip]
> > + ret = br_vlan_get_proto(dp->bridge_dev, &br_proto);
> > + if (ret == 0 && br_proto != vlan_proto)
> > + change_proto = true;
> 
> 
> This deserves a comment, because the change_proto variable is not really
> explaining what this is about, maybe more like "incompatible_proto" would?
> 
> First you query the VLAN protocol currently configured on the bridge master
> device, and if this VLAN protocol is different than the one being requested,
> then you treat this as an error. It might make sense to also print a message
> towards the user that the bridge device protocol should be changed, or that
> the bridge device should be removed and re-created accordingly.
> 
> Does it not work if we have a bridge currently configured with 802.1ad and a
> 802.1q VLAN programming request comes in? In premise it should, right?
> Likewise, if we had a 802.1ad bridge configured already and we want to
> configure a 802.1Q VLAN on a bridged port, there should be a way for this
> configuration to work.
> 
> And both cases, it ought to be possible to configure the switch in double
> tagged mode and just make sure that there is no S-tag being added unless
> requested.

Thanks for long reply.

When create a bridge br0, it's default protocol is 802.1Q, then add a port swp1 
to bridge, the bridge will call add_vlan add a default VLAN to swp1, its vid is 
pvid 1, the vlan's protocol is 802.1Q. the related command is:
# ip link add dev br0 type bridge
# ip link set dev swp1 master br0

After testing port's 802.1Q mode, If want to test 802.1AD mode, we can use the 
following command to set switch and its  ports into QinQ mode, 
# ip link set br0 type bridge vlan_protocol 802.1ad
it will call vlan_vid_add(dev, proto, vid) for every port, the parameter proto 
is 802.1AD and the vid is also 1, after that, it will set br->vlan_proto to 
802.1AD, the related code is __br_vlan_set_proto in br_vlan.c

vlan_vid_add will call dsa_slave_vlan_rx_add_vid.
But in dsa_slave_vlan_rx_add_vid, because we had added vlan 1 before, so 
br_vlan_get_info will return 0, then the function return -EBUSY, it can't call 
dsa_port_vid_add, so I add the code to check protocol changing.

I will add code to print the message for protocol changing.

> > + ret = br_vlan_get_proto(dp->bridge_dev, &br_proto);
> > + if (ret == 0 && br_proto != vlan_proto)
> > + change_proto = true;
> > +
> >   /* br_vlan_get_info() returns -EINVAL or -ENOENT if the
> >* device, respectively the VID is not found, returning
> >* 0 means success, which is a failure for us here.
> >*/
> >   ret = br_vlan_get_info(dp->bridge_dev, vid, &info);
> > - if (ret == 0)
> > + if (ret == 0 && !change_proto)
> >   return -EBUSY;
> 
> Since we are copying the same code than in the add_vid path, it might make
> sense to extract this to a helper function eventually.

I will extract the code to helper function.

> >   slave_dev->features = master->vlan_features | NETIF_F_HW_TC;
> >   if (ds->ops->port_vlan_add && ds->ops->port_vlan_del)
> > - slave_dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
> > + slave_dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER |
> > +
> NETIF_F_HW_VLAN_STAG_FILTER;
> 
> You cannot advertise this netdev feature for *all* DSA switch driver unless 
> you
> have verified that each DSA driver implementing
> port_vlan_add() will work correctly. Please assign this flag from within the
> ocelot driver for now.

I will change it in next version.

> 
> >
> >   if (enabled)
> > - return dsa_port_vid_add(dp, vid, flags);
> > + return dsa_port_vid_add(dp, vid, 0, flags);
> 
> Why not pass ETH_P_8021Q here to indicate we want a 802.1Q, not .AD
> configuration request?
> --
I will change it in next version.




[PATCH v3 4/6] mm/page_isolation: cleanup set_migratetype_isolate()

2020-08-04 Thread David Hildenbrand
Let's clean it up a bit, simplifying error handling and getting rid of
the label.

Reviewed-by: Baoquan He 
Reviewed-by: Pankaj Gupta 
Cc: Andrew Morton 
Cc: Michal Hocko 
Cc: Michael S. Tsirkin 
Cc: Mike Kravetz 
Signed-off-by: David Hildenbrand 
---
 mm/page_isolation.c | 17 +++--
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/mm/page_isolation.c b/mm/page_isolation.c
index d099aac479601..e65fe5d770849 100644
--- a/mm/page_isolation.c
+++ b/mm/page_isolation.c
@@ -17,12 +17,9 @@
 
 static int set_migratetype_isolate(struct page *page, int migratetype, int 
isol_flags)
 {
-   struct page *unmovable = NULL;
-   struct zone *zone;
+   struct zone *zone = page_zone(page);
+   struct page *unmovable;
unsigned long flags;
-   int ret = -EBUSY;
-
-   zone = page_zone(page);
 
spin_lock_irqsave(&zone->lock, flags);
 
@@ -51,13 +48,13 @@ static int set_migratetype_isolate(struct page *page, int 
migratetype, int isol_
NULL);
 
__mod_zone_freepage_state(zone, -nr_pages, mt);
-   ret = 0;
+   spin_unlock_irqrestore(&zone->lock, flags);
+   drain_all_pages(zone);
+   return 0;
}
 
spin_unlock_irqrestore(&zone->lock, flags);
-   if (!ret) {
-   drain_all_pages(zone);
-   } else if ((isol_flags & REPORT_FAILURE) && unmovable) {
+   if (isol_flags & REPORT_FAILURE) {
/*
 * printk() with zone->lock held will likely trigger a
 * lockdep splat, so defer it here.
@@ -65,7 +62,7 @@ static int set_migratetype_isolate(struct page *page, int 
migratetype, int isol_
dump_page(unmovable, "unmovable page");
}
 
-   return ret;
+   return -EBUSY;
 }
 
 static void unset_migratetype_isolate(struct page *page, unsigned migratetype)
-- 
2.26.2



Re: [PATCH v10 4/8] usr: add support for zstd compressed initramfs

2020-08-04 Thread Sedat Dilek
On Tue, Aug 4, 2020 at 8:52 AM Geert Uytterhoeven  wrote:
>
> Hi Nick,
>
> On Thu, Jul 30, 2020 at 9:13 PM Nick Terrell  wrote:
> > From: Nick Terrell 
> >
> > * Add support for a zstd compressed initramfs.
> > * Add compression for compressing built-in initramfs with zstd.
> >
> > I have tested this patch by boot testing with buildroot and QEMU.
> > Specifically, I booted the kernel with both a zstd and gzip compressed
> > initramfs, both built into the kernel and separate. I ensured that the
> > correct compression algorithm was used. I tested on arm, aarch64, i386,
> > and x86_64.
> >
> > This patch has been tested in production on aarch64 and x86_64 devices.
> >
> > Additionally, I have performance measurements from internal use in
> > production. On an aarch64 device we saw 19 second boot time improvement
> > from switching from lzma to zstd (27 seconds to 8 seconds). On an x86_64
> > device we saw a 9 second boot time reduction from switching from xz to
> > zstd.
> >
> > Reviewed-by: Kees Cook 
> > Tested-by: Sedat Dilek 
> > Signed-off-by: Nick Terrell 
>
> Thanks for your patch, which is now commit a30d8a39f0571425 ("usr: Add
> support for zstd compressed initramfs").
>
> > --- a/usr/Kconfig
> > +++ b/usr/Kconfig
> > @@ -100,6 +100,15 @@ config RD_LZ4
> >   Support loading of a LZ4 encoded initial ramdisk or cpio buffer
> >   If unsure, say N.
> >
> > +config RD_ZSTD
> > +   bool "Support initial ramdisk/ramfs compressed using ZSTD"
> > +   default y
> > +   depends on BLK_DEV_INITRD
> > +   select DECOMPRESS_ZSTD
> > +   help
> > + Support loading of a ZSTD encoded initial ramdisk or cpio buffer.
> > + If unsure, say N.
>
> I'm aware you copied this from the other entries, but IMHO "default y",
> and "If unsure, say N" are not a good combination.
>

Hi Geert,

you are right - for new stuff it should be "default n".

What I am missing - still - is a note - that your user-space should
have the correct bits to support zstd-initramfs.
Unsure where to place such an information.

If you send a patch for above feel free to add my:

Reviewed-by: Sedat Dilek 

Thanks.

Regards,
- Sedat -

[1] https://bugs.debian.org/955469

> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- 
> ge...@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like 
> that.
> -- Linus Torvalds


[PATCH v3 1/6] mm/page_isolation: don't dump_page(NULL) in set_migratetype_isolate()

2020-08-04 Thread David Hildenbrand
Right now, if we have two isolations racing, we might trigger the
WARN_ON_ONCE() and to dump_page(NULL), dereferencing NULL. Let's just
return directly.

In the future, we might want to report -EAGAIN to the caller instead, as
this could indicate a temporary isolation failure only.

Reviewed-by: Baoquan He 
Reviewed-by: Pankaj Gupta 
Acked-by: Mike Kravetz 
Fixes: 4a55c0474a92 ("mm/hotplug: silence a lockdep splat with printk()")
Cc: Andrew Morton 
Cc: Michal Hocko 
Cc: Michael S. Tsirkin 
Cc: Qian Cai 
Signed-off-by: David Hildenbrand 
---
 mm/page_isolation.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/mm/page_isolation.c b/mm/page_isolation.c
index f6d07c5f0d34d..7d7d263ce7f4b 100644
--- a/mm/page_isolation.c
+++ b/mm/page_isolation.c
@@ -29,10 +29,12 @@ static int set_migratetype_isolate(struct page *page, int 
migratetype, int isol_
/*
 * We assume the caller intended to SET migrate type to isolate.
 * If it is already set, then someone else must have raced and
-* set it before us.  Return -EBUSY
+* set it before us.
 */
-   if (is_migrate_isolate_page(page))
-   goto out;
+   if (is_migrate_isolate_page(page)) {
+   spin_unlock_irqrestore(&zone->lock, flags);
+   return -EBUSY;
+   }
 
/*
 * FIXME: Now, memory hotplug doesn't call shrink_slab() by itself.
@@ -52,7 +54,6 @@ static int set_migratetype_isolate(struct page *page, int 
migratetype, int isol_
ret = 0;
}
 
-out:
spin_unlock_irqrestore(&zone->lock, flags);
if (!ret) {
drain_all_pages(zone);
-- 
2.26.2



[PATCH v3 2/6] mm/page_alloc: tweak comments in has_unmovable_pages()

2020-08-04 Thread David Hildenbrand
Let's move the split comment regarding bootmem allocations and memory
holes, especially in the context of ZONE_MOVABLE, to the PageReserved()
check.

Reviewed-by: Baoquan He 
Cc: Andrew Morton 
Cc: Michal Hocko 
Cc: Michael S. Tsirkin 
Cc: Mike Kravetz 
Cc: Pankaj Gupta 
Signed-off-by: David Hildenbrand 
---
 mm/page_alloc.c | 22 ++
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index e028b87ce2942..042ba09d70c5d 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -8207,14 +8207,6 @@ struct page *has_unmovable_pages(struct zone *zone, 
struct page *page,
unsigned long iter = 0;
unsigned long pfn = page_to_pfn(page);
 
-   /*
-* TODO we could make this much more efficient by not checking every
-* page in the range if we know all of them are in MOVABLE_ZONE and
-* that the movable zone guarantees that pages are migratable but
-* the later is not the case right now unfortunatelly. E.g. movablecore
-* can still lead to having bootmem allocations in zone_movable.
-*/
-
if (is_migrate_cma_page(page)) {
/*
 * CMA allocations (alloc_contig_range) really need to mark
@@ -8233,6 +8225,12 @@ struct page *has_unmovable_pages(struct zone *zone, 
struct page *page,
 
page = pfn_to_page(pfn + iter);
 
+   /*
+* Both, bootmem allocations and memory holes are marked
+* PG_reserved and are unmovable. We can even have unmovable
+* allocations inside ZONE_MOVABLE, for example when
+* specifying "movablecore".
+*/
if (PageReserved(page))
return page;
 
@@ -8306,14 +8304,6 @@ struct page *has_unmovable_pages(struct zone *zone, 
struct page *page,
 * it.  But now, memory offline itself doesn't call
 * shrink_node_slabs() and it still to be fixed.
 */
-   /*
-* If the page is not RAM, page_count()should be 0.
-* we don't need more check. This is an _used_ not-movable page.
-*
-* The problematic thing here is PG_reserved pages. PG_reserved
-* is set to both of a memory hole page and a _used_ kernel
-* page at boot.
-*/
return page;
}
return NULL;
-- 
2.26.2



[PATCH v3 5/6] virtio-mem: don't special-case ZONE_MOVABLE

2020-08-04 Thread David Hildenbrand
Let's allow to online partially plugged memory blocks to ZONE_MOVABLE
and also consider memory blocks that were onlined to ZONE_MOVABLE when
unplugging memory. While unplugged memory blocks are, in general,
unmovable, they can be skipped when offlining memory.

virtio-mem only unplugs fairly big chunks (in the megabyte range) and
rather tries to shrink the memory region than randomly choosing memory. In
theory, if all other pages in the movable zone would be movable, virtio-mem
would only shrink that zone and not create any kind of fragmentation.

In the future, we might want to remember the zone again and use the
information when (un)plugging memory. For now, let's keep it simple.

Note: Support for defragmentation is planned, to deal with fragmentation
after unplug due to memory chunks within memory blocks that could not
get unplugged before (e.g., somebody pinning pages within ZONE_MOVABLE
for a longer time).

Cc: Andrew Morton 
Cc: Michal Hocko 
Cc: Michael S. Tsirkin 
Cc: Jason Wang 
Cc: Mike Kravetz 
Cc: Pankaj Gupta 
Cc: Baoquan He 
Signed-off-by: David Hildenbrand 
---
 drivers/virtio/virtio_mem.c | 47 +++--
 1 file changed, 8 insertions(+), 39 deletions(-)

diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c
index f26f5f64ae822..2ddfc4a0e2ee0 100644
--- a/drivers/virtio/virtio_mem.c
+++ b/drivers/virtio/virtio_mem.c
@@ -36,18 +36,10 @@ enum virtio_mem_mb_state {
VIRTIO_MEM_MB_STATE_OFFLINE,
/* Partially plugged, fully added to Linux, offline. */
VIRTIO_MEM_MB_STATE_OFFLINE_PARTIAL,
-   /* Fully plugged, fully added to Linux, online (!ZONE_MOVABLE). */
+   /* Fully plugged, fully added to Linux, online. */
VIRTIO_MEM_MB_STATE_ONLINE,
-   /* Partially plugged, fully added to Linux, online (!ZONE_MOVABLE). */
+   /* Partially plugged, fully added to Linux, online. */
VIRTIO_MEM_MB_STATE_ONLINE_PARTIAL,
-   /*
-* Fully plugged, fully added to Linux, online (ZONE_MOVABLE).
-* We are not allowed to allocate (unplug) parts of this block that
-* are not movable (similar to gigantic pages). We will never allow
-* to online OFFLINE_PARTIAL to ZONE_MOVABLE (as they would contain
-* unmovable parts).
-*/
-   VIRTIO_MEM_MB_STATE_ONLINE_MOVABLE,
VIRTIO_MEM_MB_STATE_COUNT
 };
 
@@ -526,21 +518,10 @@ static bool virtio_mem_owned_mb(struct virtio_mem *vm, 
unsigned long mb_id)
 }
 
 static int virtio_mem_notify_going_online(struct virtio_mem *vm,
- unsigned long mb_id,
- enum zone_type zone)
+ unsigned long mb_id)
 {
switch (virtio_mem_mb_get_state(vm, mb_id)) {
case VIRTIO_MEM_MB_STATE_OFFLINE_PARTIAL:
-   /*
-* We won't allow to online a partially plugged memory block
-* to the MOVABLE zone - it would contain unmovable parts.
-*/
-   if (zone == ZONE_MOVABLE) {
-   dev_warn_ratelimited(&vm->vdev->dev,
-"memory block has holes, MOVABLE 
not supported\n");
-   return NOTIFY_BAD;
-   }
-   return NOTIFY_OK;
case VIRTIO_MEM_MB_STATE_OFFLINE:
return NOTIFY_OK;
default:
@@ -560,7 +541,6 @@ static void virtio_mem_notify_offline(struct virtio_mem *vm,
VIRTIO_MEM_MB_STATE_OFFLINE_PARTIAL);
break;
case VIRTIO_MEM_MB_STATE_ONLINE:
-   case VIRTIO_MEM_MB_STATE_ONLINE_MOVABLE:
virtio_mem_mb_set_state(vm, mb_id,
VIRTIO_MEM_MB_STATE_OFFLINE);
break;
@@ -579,24 +559,17 @@ static void virtio_mem_notify_offline(struct virtio_mem 
*vm,
virtio_mem_retry(vm);
 }
 
-static void virtio_mem_notify_online(struct virtio_mem *vm, unsigned long 
mb_id,
-enum zone_type zone)
+static void virtio_mem_notify_online(struct virtio_mem *vm, unsigned long 
mb_id)
 {
unsigned long nb_offline;
 
switch (virtio_mem_mb_get_state(vm, mb_id)) {
case VIRTIO_MEM_MB_STATE_OFFLINE_PARTIAL:
-   BUG_ON(zone == ZONE_MOVABLE);
virtio_mem_mb_set_state(vm, mb_id,
VIRTIO_MEM_MB_STATE_ONLINE_PARTIAL);
break;
case VIRTIO_MEM_MB_STATE_OFFLINE:
-   if (zone == ZONE_MOVABLE)
-   virtio_mem_mb_set_state(vm, mb_id,
-   VIRTIO_MEM_MB_STATE_ONLINE_MOVABLE);
-   else
-   virtio_mem_mb_set_state(vm, mb_id,
-   VIRTIO_MEM_MB_STATE_ONLINE);
+   virtio_mem_mb_set_state(vm, mb_id, VIRTIO_MEM_MB_STATE_ONLINE);
 

[PATCH v3 3/6] mm/page_isolation: drop WARN_ON_ONCE() in set_migratetype_isolate()

2020-08-04 Thread David Hildenbrand
Inside has_unmovable_pages(), we have a comment describing how unmovable
data could end up in ZONE_MOVABLE - via "movable_core". Also, besides
checking if the first page in the pageblock is reserved, we don't
perform any further checks in case of ZONE_MOVABLE.

In case of memory offlining, we set REPORT_FAILURE, properly
dump_page() the page and handle the error gracefully.
alloc_contig_pages() users currently never allocate from ZONE_MOVABLE.
E.g., hugetlb uses alloc_contig_pages() for the allocation of gigantic
pages only, which will never end up on the MOVABLE zone
(see htlb_alloc_mask()).

Reviewed-by: Baoquan He 
Cc: Andrew Morton 
Cc: Michal Hocko 
Cc: Michael S. Tsirkin 
Cc: Mike Kravetz 
Cc: Pankaj Gupta 
Signed-off-by: David Hildenbrand 
---
 mm/page_isolation.c | 15 ++-
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/mm/page_isolation.c b/mm/page_isolation.c
index 7d7d263ce7f4b..d099aac479601 100644
--- a/mm/page_isolation.c
+++ b/mm/page_isolation.c
@@ -57,15 +57,12 @@ static int set_migratetype_isolate(struct page *page, int 
migratetype, int isol_
spin_unlock_irqrestore(&zone->lock, flags);
if (!ret) {
drain_all_pages(zone);
-   } else {
-   WARN_ON_ONCE(zone_idx(zone) == ZONE_MOVABLE);
-
-   if ((isol_flags & REPORT_FAILURE) && unmovable)
-   /*
-* printk() with zone->lock held will likely trigger a
-* lockdep splat, so defer it here.
-*/
-   dump_page(unmovable, "unmovable page");
+   } else if ((isol_flags & REPORT_FAILURE) && unmovable) {
+   /*
+* printk() with zone->lock held will likely trigger a
+* lockdep splat, so defer it here.
+*/
+   dump_page(unmovable, "unmovable page");
}
 
return ret;
-- 
2.26.2



Re: [PATCH 4/5] PCI: aardvark: Implement driver 'remove' function and allow to build it as module

2020-08-04 Thread Pali Rohár
On Monday 03 August 2020 14:00:37 Rob Herring wrote:
> On Mon, Aug 3, 2020 at 8:46 AM Pali Rohár  wrote:
> >
> > On Wednesday 29 July 2020 12:48:09 Rob Herring wrote:
> > > On Wed, Jul 15, 2020 at 04:25:56PM +0200, Marek Behún wrote:
> > > > From: Pali Rohár 
> > > >
> > > > Providing driver's 'remove' function allows kernel to bind and unbind 
> > > > devices
> > > > from aardvark driver. It also allows to build aardvark driver as a 
> > > > module.
> > > >
> > > > Compiling aardvark as a module simplifies development and debugging of
> > > > this driver as it can be reloaded at runtime without the need to reboot
> > > > to new kernel.
> > > >
> > > > Signed-off-by: Pali Rohár 
> > > > Reviewed-by: Marek Behún 
> > > > ---
> > > >  drivers/pci/controller/Kconfig|  2 +-
> > > >  drivers/pci/controller/pci-aardvark.c | 25 ++---
> > > >  2 files changed, 23 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/drivers/pci/controller/Kconfig 
> > > > b/drivers/pci/controller/Kconfig
> > > > index adddf21fa381..f9da5ff2c517 100644
> > > > --- a/drivers/pci/controller/Kconfig
> > > > +++ b/drivers/pci/controller/Kconfig
> > > > @@ -12,7 +12,7 @@ config PCI_MVEBU
> > > > select PCI_BRIDGE_EMUL
> > > >
> > > >  config PCI_AARDVARK
> > > > -   bool "Aardvark PCIe controller"
> > > > +   tristate "Aardvark PCIe controller"
> > > > depends on (ARCH_MVEBU && ARM64) || COMPILE_TEST
> > > > depends on OF
> > > > depends on PCI_MSI_IRQ_DOMAIN
> > > > diff --git a/drivers/pci/controller/pci-aardvark.c 
> > > > b/drivers/pci/controller/pci-aardvark.c
> > > > index d5f58684d962..0a5aa6d77f5d 100644
> > > > --- a/drivers/pci/controller/pci-aardvark.c
> > > > +++ b/drivers/pci/controller/pci-aardvark.c
> > > > @@ -14,6 +14,7 @@
> > > >  #include 
> > > >  #include 
> > > >  #include 
> > > > +#include 
> > > >  #include 
> > > >  #include 
> > > >  #include 
> > > > @@ -1114,6 +1115,7 @@ static int advk_pcie_probe(struct platform_device 
> > > > *pdev)
> > > >
> > > > pcie = pci_host_bridge_priv(bridge);
> > > > pcie->pdev = pdev;
> > > > +   platform_set_drvdata(pdev, pcie);
> > > >
> > > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > > > pcie->base = devm_ioremap_resource(dev, res);
> > > > @@ -1204,18 +1206,35 @@ static int advk_pcie_probe(struct 
> > > > platform_device *pdev)
> > > > return 0;
> > > >  }
> > > >
> > > > +static int advk_pcie_remove(struct platform_device *pdev)
> > > > +{
> > > > +   struct advk_pcie *pcie = platform_get_drvdata(pdev);
> > > > +   struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie);
> > > > +
> > > > +   pci_stop_root_bus(bridge->bus);
> > > > +   pci_remove_root_bus(bridge->bus);
> > >
> > > Based on pci_host_common_remove() implementation, doesn't this need a
> > > lock around it (pci_lock_rescan_remove)?
> >
> > Well, I'm not sure. I looked into other pci drivers and none of
> > following drivers pci-tegra.c, pcie-altera.c, pcie-brcmstb.c,
> > pcie-iproc.c, pcie-mediatek.c, pcie-rockchip-host.c calls
> > pci_lock_rescan_remove() and pci_unlock_rescan_remove().
> 
> The mutex protects the bus->devices list, so yes I believe it is needed.
> 
> Rob

Thank you Rob! It means that all above pci drivers should be fixed too.

I will prepare a new version of aardvark patches with protecting pci
stop/remove functions. And later I can look at some common bridge remove
function for fixing those other pci drivers.


[PATCH v3 6/6] mm: document semantics of ZONE_MOVABLE

2020-08-04 Thread David Hildenbrand
Let's document what ZONE_MOVABLE means, how it's used, and which special
cases we have regarding unmovable pages (memory offlining vs. migration /
allocations).

Cc: Andrew Morton 
Cc: Michal Hocko 
Cc: Michael S. Tsirkin 
Cc: Mike Kravetz 
Cc: Mike Rapoport 
Cc: Pankaj Gupta 
Cc: Baoquan He 
Signed-off-by: David Hildenbrand 
---
 include/linux/mmzone.h | 34 ++
 1 file changed, 34 insertions(+)

diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index f6f884970511d..600d449e7d9e9 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -372,6 +372,40 @@ enum zone_type {
 */
ZONE_HIGHMEM,
 #endif
+   /*
+* ZONE_MOVABLE is similar to ZONE_NORMAL, except that it *primarily*
+* only contains movable pages. Main use cases are to make memory
+* offlining more likely to succeed, and to locally limit unmovable
+* allocations - e.g., to increase the number of THP/huge pages.
+* Notable special cases are:
+*
+* 1. Pinned pages: (Long-term) pinning of movable pages might
+*essentially turn such pages unmovable. Memory offlining might
+*retry a long time.
+* 2. memblock allocations: kernelcore/movablecore setups might create
+*situations where ZONE_MOVABLE contains unmovable allocations
+*after boot. Memory offlining and allocations fail early.
+* 3. Memory holes: Such pages cannot be allocated. Applies only to
+*boot memory, not hotplugged memory. Memory offlining and
+*allocations fail early.
+* 4. PG_hwpoison pages: While poisoned pages can be skipped during
+*memory offlining, such pages cannot be allocated.
+* 5. Unmovable PG_offline pages: In paravirtualized environments,
+*hotplugged memory blocks might only partially be managed by the
+*buddy (e.g., via XEN-balloon, Hyper-V balloon, virtio-mem). The
+*parts not manged by the buddy are unmovable PG_offline pages. In
+*some cases (virtio-mem), such pages can be skipped during
+*memory offlining, however, cannot be moved/allocated. These
+*techniques might use alloc_contig_range() to hide previously
+*exposed pages from the buddy again (e.g., to implement some sort
+*of memory unplug in virtio-mem).
+*
+* In general, no unmovable allocations that degrade memory offlining
+* should end up in ZONE_MOVABLE. Allocators (like alloc_contig_range())
+* have to expect that migrating pages in ZONE_MOVABLE can fail (even
+* if has_unmovable_pages() states that there are no unmovable pages,
+* there can be false negatives).
+*/
ZONE_MOVABLE,
 #ifdef CONFIG_ZONE_DEVICE
ZONE_DEVICE,
-- 
2.26.2



[PATCH v3 0/6] mm / virtio-mem: support ZONE_MOVABLE

2020-08-04 Thread David Hildenbrand
@Andrew can we give this a churn and consider it for v5.9 in case there
are no more comments?

Patch #1-#4 have RB's, patch #5 is virtio-mem stuff maintained by me,
patch #6 is just a doc update.

---

Currently, virtio-mem does not really support ZONE_MOVABLE. While it allows
to online fully plugged memory blocks to ZONE_MOVABLE, it does not allow
to online partially-plugged memory blocks to ZONE_MOVABLE and will never
consider such memory blocks when unplugging memory. This might be
surprising for users (especially, if onlining suddenly fails).

Let's support partially plugged memory blocks in ZONE_MOVABLE, allowing
partially plugged memory blocks to be online to ZONE_MOVABLE and also
unplugging from such memory blocks.

This is especially helpful for testing, but also paves the way for
virtio-mem optimizations, allowing more memory to get reliably unplugged.

Cleanup has_unmovable_pages() and set_migratetype_isolate(), providing
better documentation of how ZONE_MOVABLE interacts with different kind of
unmovable pages (memory offlining vs. alloc_contig_range()).

v2 -> v3:
- "mm: document semantics of ZONE_MOVABLE"
-- Fix a typo

v1 -> v2:
- "mm/page_isolation: don't dump_page(NULL) in set_migratetype_isolate()"
-- Move to position 1, add Fixes: tag
-- Drop unused "out:" label
- "mm/page_isolation: drop WARN_ON_ONCE() in set_migratetype_isolate()"
-- Keep curly braces on "else" case
- Replace "[PATCH v1 5/6] mm/page_alloc: restrict ZONE_MOVABLE optimization
   in has_unmovable_pages() to memory offlining"
  by "mm: document semantics of ZONE_MOVABLE"
-- Brain dump of what I know about ZONE_MOVABLE

David Hildenbrand (6):
  mm/page_isolation: don't dump_page(NULL) in set_migratetype_isolate()
  mm/page_alloc: tweak comments in has_unmovable_pages()
  mm/page_isolation: drop WARN_ON_ONCE() in set_migratetype_isolate()
  mm/page_isolation: cleanup set_migratetype_isolate()
  virtio-mem: don't special-case ZONE_MOVABLE
  mm: document semantics of ZONE_MOVABLE

 drivers/virtio/virtio_mem.c | 47 +++--
 include/linux/mmzone.h  | 34 +++
 mm/page_alloc.c | 22 +
 mm/page_isolation.c | 39 ++
 4 files changed, 65 insertions(+), 77 deletions(-)

-- 
2.26.2



Re: [PATCH v5 03/15] iio: sx9310: Fix irq handling

2020-08-04 Thread Andy Shevchenko
On Tue, Aug 4, 2020 at 2:58 AM Daniel Campello  wrote:
>
> Fixes enable/disable irq handling at various points. The driver needs to
> only enable/disable irqs if there is an actual irq handler installed.

Reviewed-by: Andy Shevchenko 

> Signed-off-by: Daniel Campello 
> Reviewed-by: Stephen Boyd 
> ---
>
> Changes in v5: None
> Changes in v4:
>  - Reverted condition check logic on enable/disable_irq methods.
>
> Changes in v3:
>  - Moved irq presence check down to lower methods
>
> Changes in v2:
>  - Reordered error handling on sx9310_resume()
>
>  drivers/iio/proximity/sx9310.c | 11 ---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/proximity/sx9310.c b/drivers/iio/proximity/sx9310.c
> index d7c77fc661ba86..dafee85018aa6d 100644
> --- a/drivers/iio/proximity/sx9310.c
> +++ b/drivers/iio/proximity/sx9310.c
> @@ -323,11 +323,15 @@ static int sx9310_put_event_channel(struct sx9310_data 
> *data, int channel)
>
>  static int sx9310_enable_irq(struct sx9310_data *data, unsigned int irq)
>  {
> +   if (!data->client->irq)
> +   return 0;
> return regmap_update_bits(data->regmap, SX9310_REG_IRQ_MSK, irq, irq);
>  }
>
>  static int sx9310_disable_irq(struct sx9310_data *data, unsigned int irq)
>  {
> +   if (!data->client->irq)
> +   return 0;
> return regmap_update_bits(data->regmap, SX9310_REG_IRQ_MSK, irq, 0);
>  }
>
> @@ -381,7 +385,7 @@ static int sx9310_read_proximity(struct sx9310_data *data,
>
> mutex_unlock(&data->mutex);
>
> -   if (data->client->irq > 0) {
> +   if (data->client->irq) {
> ret = wait_for_completion_interruptible(&data->completion);
> reinit_completion(&data->completion);
> } else {
> @@ -1010,10 +1014,11 @@ static int __maybe_unused sx9310_resume(struct device 
> *dev)
>
>  out:
> mutex_unlock(&data->mutex);
> +   if (ret)
> +   return ret;
>
> enable_irq(data->client->irq);
> -
> -   return ret;
> +   return 0;
>  }
>
>  static const struct dev_pm_ops sx9310_pm_ops = {
> --
> 2.28.0.163.g6104cc2f0b6-goog
>


-- 
With Best Regards,
Andy Shevchenko


[PATCH] ALSA: hda/hdmi: Add pins with jack detection support

2020-08-04 Thread Kai-Heng Feng
HDMI on some platforms doesn't enable audio support because its Port
Connectivity [31:30] is set to AC_JACK_PORT_NONE:
Node 0x05 [Pin Complex] wcaps 0x40778d: 8-Channels Digital Amp-Out CP
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x0b94: OUT Detect HBR HDMI DP
  Pin Default 0x58560010: [N/A] Digital Out at Int HDMI
Conn = Digital, Color = Unknown
DefAssociation = 0x1, Sequence = 0x0
  Pin-ctls: 0x40: OUT
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Devices: 0
  Connection: 3
 0x02 0x03* 0x04

Those pins were filtered out by commit 116dcde63806 ("ALSA: HDA: Remove
unconnected PCM devices for Intel HDMI"). However, jacks that support
detection won't have the issues the commit addresses.

So still add the pin if it supports jack detection.

Signed-off-by: Kai-Heng Feng 
---
 sound/pci/hda/patch_hdmi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index cd46247988e4..db3a5148bd40 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1701,7 +1701,8 @@ static int hdmi_add_pin(struct hda_codec *codec, 
hda_nid_t pin_nid)
 * all device entries on the same pin
 */
config = snd_hda_codec_get_pincfg(codec, pin_nid);
-   if (get_defcfg_connect(config) == AC_JACK_PORT_NONE)
+   if ((get_defcfg_connect(config) == AC_JACK_PORT_NONE) &&
+   !(caps & AC_PINCAP_PRES_DETECT))
return 0;
 
/*
-- 
2.17.1



[PATCH 5.4 00/91] 5.4.56-rc2 review

2020-08-04 Thread Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.56 release.
There are 91 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Thu, 06 Aug 2020 07:23:45 +.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:

https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.56-rc2.gz
or in the git tree and branch at:

git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
linux-5.4.y
and the diffstat can be found below.

thanks,

greg k-h

-
Pseudo-Shortlog of commits:

Greg Kroah-Hartman 
Linux 5.4.56-rc2

Linus Torvalds 
random32: move the pseudo-random 32-bit definitions to prandom.h

Arnaldo Carvalho de Melo 
perf bench: Share some global variables to fix build with gcc 10

Arnaldo Carvalho de Melo 
perf env: Do not return pointers to local variables

Arnaldo Carvalho de Melo 
perf tests bp_account: Make global variable static

Thomas Gleixner 
x86/i8259: Use printk_deferred() to prevent deadlock

Wanpeng Li 
KVM: LAPIC: Prevent setting the tscdeadline timer if the lapic is hw 
disabled

Will Deacon 
KVM: arm64: Don't inherit exec permission across page-table levels

Xie He 
drivers/net/wan: lapb: Corrected the usage of skb_cow

Atish Patra 
RISC-V: Set maximum number of mapped pages correctly

Andrea Righi 
xen-netfront: fix potential deadlock in xennet_remove()

Navid Emamdoost 
cxgb4: add missing release on skb in uld_send()

Josh Poimboeuf 
x86/stacktrace: Fix reliable check for empty user task stacks

Josh Poimboeuf 
x86/unwind/orc: Fix ORC for newly forked tasks

Raviteja Narayanam 
Revert "i2c: cadence: Fix the hold bit setting"

Yoshihiro Shimoda 
net: ethernet: ravb: exit if re-initialization fails in tx timeout

Liam Beguin 
parisc: add support for cmpxchg on u8 pointers

Ming Lei 
scsi: core: Run queue in case of I/O resource contention failure

Navid Emamdoost 
nfc: s3fwrn5: add missing release on skb in s3fwrn5_recv_frame

Paolo Pisati 
selftests: net: ip_defrag: modprobe missing nf_defrag_ipv6 support

Laurence Oberman 
qed: Disable "MFW indication via attention" SPAM every 5 minutes

Paolo Pisati 
selftests: fib_nexthop_multiprefix: fix cleanup() netns deletion

Geert Uytterhoeven 
usb: hso: Fix debug compile warning on sparc32

Taehee Yoo 
vxlan: fix memleak of fdb

Wei Li 
perf tools: Fix record failure when mixed with ARM SPE event

Xin Xiong 
net/mlx5e: fix bpf_prog reference count leaks in mlx5e_alloc_rq

Wang Hai 
net: gemini: Fix missing clk_disable_unprepare() in error path of 
gemini_ethernet_port_probe()

Lu Wei 
net: nixge: fix potential memory leak in nixge_probe()

Alain Michaud 
Bluetooth: fix kernel oops in store_pending_adv_report

Robin Murphy 
arm64: csum: Fix handling of bad packets

Sami Tolvanen 
arm64/alternatives: move length validation inside the subsection

Remi Pommarel 
mac80211: mesh: Free pending skb when destroying a mpath

Remi Pommarel 
mac80211: mesh: Free ie data when leaving mesh

Andrii Nakryiko 
bpf: Fix map leak in HASH_OF_MAPS map

Thomas Falcon 
ibmvnic: Fix IRQ mapping disposal in error path

Ido Schimmel 
mlxsw: core: Free EMAD transactions using kfree_rcu()

Ido Schimmel 
mlxsw: core: Increase scope of RCU read-side critical section

Jakub Kicinski 
mlx4: disable device on shutdown

Herbert Xu 
rhashtable: Fix unprotected RCU dereference in __rht_ptr

Johan Hovold 
net: lan78xx: fix transfer-buffer memory leak

Johan Hovold 
net: lan78xx: add missing endpoint sanity check

Alaa Hleihel 
net/mlx5e: Fix kernel crash when setting vf VLANID on a VF dev

Ron Diskin 
net/mlx5e: Modify uplink state on interface up/down

Eran Ben Elisha 
net/mlx5: Verify Hardware supports requested ptp function on a given pin

Aya Levin 
net/mlx5e: Fix error path of device attach

Parav Pandit 
net/mlx5: E-switch, Destroy TSAR when fail to enable the mode

Guojia Liao 
net: hns3: fix aRFS FD rules leftover after add a user FD rule

Yonglong Liu 
net: hns3: fix a TX timeout issue

Michael Karcher 
sh: Fix validation of system call number

Peter Zijlstra 
sh/tlb: Fix PGTABLE_LEVELS > 2

Tanner Love 
selftests/net: so_txtime: fix clang issues for target arch PowerPC

Tanner Love 
selftests/net: psock_fanout: fix clang issues for target arch PowerPC

Tanner Love 
selftests/net: rxtimestamp: fix clang issues for target arch PowerPC

Sagi Grimberg 
nvme-tcp: fix possible hang waiting for icresp response

Russell King 
ARM: dts: armada-38x: fix NETA lockup when repeatedly switching speeds

Steffen Klassert 
xfrm: Fix crash when the hold queue is used.

Maxime Ripard 
ARM: dts sunxi: Relax a bit the CMA pool allocation rang

[PATCH 4.14 00/52] 4.14.192-rc2 review

2020-08-04 Thread Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.192 release.
There are 52 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Thu, 06 Aug 2020 07:23:45 +.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:

https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.192-rc2.gz
or in the git tree and branch at:

git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
linux-4.14.y
and the diffstat can be found below.

thanks,

greg k-h

-
Pseudo-Shortlog of commits:

Greg Kroah-Hartman 
Linux 4.14.192-rc2

Linus Torvalds 
random32: move the pseudo-random 32-bit definitions to prandom.h

Thomas Gleixner 
x86/i8259: Use printk_deferred() to prevent deadlock

Wanpeng Li 
KVM: LAPIC: Prevent setting the tscdeadline timer if the lapic is hw 
disabled

Andrea Righi 
xen-netfront: fix potential deadlock in xennet_remove()

Navid Emamdoost 
cxgb4: add missing release on skb in uld_send()

Josh Poimboeuf 
x86/unwind/orc: Fix ORC for newly forked tasks

Raviteja Narayanam 
Revert "i2c: cadence: Fix the hold bit setting"

Yoshihiro Shimoda 
net: ethernet: ravb: exit if re-initialization fails in tx timeout

Liam Beguin 
parisc: add support for cmpxchg on u8 pointers

Navid Emamdoost 
nfc: s3fwrn5: add missing release on skb in s3fwrn5_recv_frame

Laurence Oberman 
qed: Disable "MFW indication via attention" SPAM every 5 minutes

Geert Uytterhoeven 
usb: hso: Fix debug compile warning on sparc32

Robin Murphy 
arm64: csum: Fix handling of bad packets

Sami Tolvanen 
arm64/alternatives: move length validation inside the subsection

Remi Pommarel 
mac80211: mesh: Free pending skb when destroying a mpath

Remi Pommarel 
mac80211: mesh: Free ie data when leaving mesh

Andrii Nakryiko 
bpf: Fix map leak in HASH_OF_MAPS map

Thomas Falcon 
ibmvnic: Fix IRQ mapping disposal in error path

Ido Schimmel 
mlxsw: core: Free EMAD transactions using kfree_rcu()

Ido Schimmel 
mlxsw: core: Increase scope of RCU read-side critical section

Jakub Kicinski 
mlx4: disable device on shutdown

Johan Hovold 
net: lan78xx: fix transfer-buffer memory leak

Johan Hovold 
net: lan78xx: add missing endpoint sanity check

Michael Karcher 
sh: Fix validation of system call number

Tanner Love 
selftests/net: rxtimestamp: fix clang issues for target arch PowerPC

YueHaibing 
net/x25: Fix null-ptr-deref in x25_disconnect

Xiyu Yang 
net/x25: Fix x25_neigh refcnt leak when x25 disconnect

Rik van Riel 
xfs: fix missed wakeup on l_flush_wait

Peilin Ye 
rds: Prevent kernel-infoleak in rds_notify_queue_get()

Joerg Roedel 
x86, vmlinux.lds: Page-align end of ..page_aligned sections

Sami Tolvanen 
x86/build/lto: Fix truncated .bss with -fdata-sections

Wang Hai 
9p/trans_fd: Fix concurrency del of req_list in p9_fd_cancelled/p9_read_work

Dominique Martinet 
9p/trans_fd: abort p9_read_work if req status changed

Linus Torvalds 
random32: remove net_rand_state from the latent entropy gcc plugin

Willy Tarreau 
random: fix circular include dependency on arm64 after addition of percpu.h

Sheng Yong 
f2fs: check if file namelen exceeds max value

Jaegeuk Kim 
f2fs: check memory boundary by insane namelen

Steve Cohen 
drm: hold gem reference until object is no longer accessed

Peilin Ye 
drm/amdgpu: Prevent kernel-infoleak in amdgpu_info_ioctl()

Grygorii Strashko 
ARM: percpu.h: fix build error

Willy Tarreau 
random32: update the net random state on interrupt and activity

Will Deacon 
ARM: 8986/1: hw_breakpoint: Don't invoke overflow handler on uaccess 
watchpoints

Pi-Hsun Shih 
wireless: Use offsetof instead of custom macro.

Robert Hancock 
PCI/ASPM: Disable ASPM on ASMedia ASM1083/1085 PCIe-to-PCI bridge

Sasha Levin 
x86/kvm: Be careful not to clear KVM_VCPU_FLUSH_TLB bit

Navid Emamdoost 
ath9k: release allocated buffer if timed out

Navid Emamdoost 
ath9k_htc: release allocated buffer if timed out

Sasha Levin 
iio: imu: adis16400: fix memory leak

Navid Emamdoost 
media: rc: prevent memory leak in cx23888_ir_probe

Navid Emamdoost 
crypto: ccp - Release all allocated memory if sha type is invalid

Wei Yongjun 
net: phy: mdio-bcm-unimac: fix potential NULL dereference in 
unimac_mdio_probe()

Jason Yan 
scsi: libsas: direct call probe and destruct


-

Diffstat:

 Makefile   |  4 +-
 arch/arm/include/asm/percpu.h  |  2 +
 arch/arm/kernel/hw_breakpoint.c| 27 ++--
 arch/arm64/include/asm/alternative.h   |  4 +-
 arch/arm64/include/asm/checksum.h  |  5 +-
 arch/parisc/include/asm

[PATCH 4.19 00/57] 4.19.137-rc2 review

2020-08-04 Thread Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.137 release.
There are 57 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Thu, 06 Aug 2020 07:23:45 +.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:

https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.137-rc2.gz
or in the git tree and branch at:

git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
linux-4.19.y
and the diffstat can be found below.

thanks,

greg k-h

-
Pseudo-Shortlog of commits:

Greg Kroah-Hartman 
Linux 4.19.137-rc2

Linus Torvalds 
random32: move the pseudo-random 32-bit definitions to prandom.h

Thomas Gleixner 
x86/i8259: Use printk_deferred() to prevent deadlock

Wanpeng Li 
KVM: LAPIC: Prevent setting the tscdeadline timer if the lapic is hw 
disabled

Andrea Righi 
xen-netfront: fix potential deadlock in xennet_remove()

Navid Emamdoost 
cxgb4: add missing release on skb in uld_send()

Josh Poimboeuf 
x86/unwind/orc: Fix ORC for newly forked tasks

Raviteja Narayanam 
Revert "i2c: cadence: Fix the hold bit setting"

Yoshihiro Shimoda 
net: ethernet: ravb: exit if re-initialization fails in tx timeout

Liam Beguin 
parisc: add support for cmpxchg on u8 pointers

Navid Emamdoost 
nfc: s3fwrn5: add missing release on skb in s3fwrn5_recv_frame

Laurence Oberman 
qed: Disable "MFW indication via attention" SPAM every 5 minutes

Geert Uytterhoeven 
usb: hso: Fix debug compile warning on sparc32

Xin Xiong 
net/mlx5e: fix bpf_prog reference count leaks in mlx5e_alloc_rq

Wang Hai 
net: gemini: Fix missing clk_disable_unprepare() in error path of 
gemini_ethernet_port_probe()

Alain Michaud 
Bluetooth: fix kernel oops in store_pending_adv_report

Robin Murphy 
arm64: csum: Fix handling of bad packets

Sami Tolvanen 
arm64/alternatives: move length validation inside the subsection

Remi Pommarel 
mac80211: mesh: Free pending skb when destroying a mpath

Remi Pommarel 
mac80211: mesh: Free ie data when leaving mesh

Andrii Nakryiko 
bpf: Fix map leak in HASH_OF_MAPS map

Thomas Falcon 
ibmvnic: Fix IRQ mapping disposal in error path

Ido Schimmel 
mlxsw: core: Free EMAD transactions using kfree_rcu()

Ido Schimmel 
mlxsw: core: Increase scope of RCU read-side critical section

Jakub Kicinski 
mlx4: disable device on shutdown

Johan Hovold 
net: lan78xx: fix transfer-buffer memory leak

Johan Hovold 
net: lan78xx: add missing endpoint sanity check

Eran Ben Elisha 
net/mlx5: Verify Hardware supports requested ptp function on a given pin

Michael Karcher 
sh: Fix validation of system call number

Tanner Love 
selftests/net: psock_fanout: fix clang issues for target arch PowerPC

Tanner Love 
selftests/net: rxtimestamp: fix clang issues for target arch PowerPC

Steffen Klassert 
xfrm: Fix crash when the hold queue is used.

YueHaibing 
net/x25: Fix null-ptr-deref in x25_disconnect

Xiyu Yang 
net/x25: Fix x25_neigh refcnt leak when x25 disconnect

Rik van Riel 
xfs: fix missed wakeup on l_flush_wait

Peilin Ye 
rds: Prevent kernel-infoleak in rds_notify_queue_get()

Linus Torvalds 
random32: remove net_rand_state from the latent entropy gcc plugin

Willy Tarreau 
random: fix circular include dependency on arm64 after addition of percpu.h

Steve Cohen 
drm: hold gem reference until object is no longer accessed

Peilin Ye 
drm/amdgpu: Prevent kernel-infoleak in amdgpu_info_ioctl()

Alex Deucher 
Revert "drm/amdgpu: Fix NULL dereference in dpm sysfs handlers"

Grygorii Strashko 
ARM: percpu.h: fix build error

Willy Tarreau 
random32: update the net random state on interrupt and activity

Will Deacon 
ARM: 8986/1: hw_breakpoint: Don't invoke overflow handler on uaccess 
watchpoints

Pi-Hsun Shih 
wireless: Use offsetof instead of custom macro.

Wang Hai 
9p/trans_fd: Fix concurrency del of req_list in p9_fd_cancelled/p9_read_work

Robert Hancock 
PCI/ASPM: Disable ASPM on ASMedia ASM1083/1085 PCIe-to-PCI bridge

Filipe Manana 
Btrfs: fix selftests failure due to uninitialized i_mode in test inodes

Xin Long 
sctp: implement memory accounting on tx path

Qu Wenruo 
btrfs: inode: Verify inode mode to avoid NULL pointer dereference

Navid Emamdoost 
drm/amd/display: prevent memory leak

Navid Emamdoost 
ath9k: release allocated buffer if timed out

Navid Emamdoost 
ath9k_htc: release allocated buffer if timed out

Navid Emamdoost 
tracing: Have error path in predicate_parse() free its allocated memory

Navid Emamdoost 
drm/amdgpu: fix multiple memory leaks in acp_hw_init

Sasha Levin 
iio: imu: adis16400: fix memory leak

Navid Emamdoost 
media: rc: prevent memory lea

[PATCH 5.7 000/121] 5.7.13-rc2 review

2020-08-04 Thread Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.7.13 release.
There are 121 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Thu, 06 Aug 2020 07:23:45 +.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:

https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.7.13-rc2.gz
or in the git tree and branch at:

git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
linux-5.7.y
and the diffstat can be found below.

thanks,

greg k-h

-
Pseudo-Shortlog of commits:

Greg Kroah-Hartman 
Linux 5.7.13-rc2

Linus Torvalds 
random32: move the pseudo-random 32-bit definitions to prandom.h

Thomas Gleixner 
x86/i8259: Use printk_deferred() to prevent deadlock

Wanpeng Li 
KVM: SVM: Fix disable pause loop exit/pause filtering capability on SVM

Wanpeng Li 
KVM: LAPIC: Prevent setting the tscdeadline timer if the lapic is hw 
disabled

Will Deacon 
KVM: arm64: Don't inherit exec permission across page-table levels

Atish Patra 
riscv: Parse all memory blocks to remove unusable memory

Xie He 
drivers/net/wan: lapb: Corrected the usage of skb_cow

Atish Patra 
RISC-V: Set maximum number of mapped pages correctly

Andrea Righi 
xen-netfront: fix potential deadlock in xennet_remove()

Navid Emamdoost 
cxgb4: add missing release on skb in uld_send()

Josh Poimboeuf 
x86/stacktrace: Fix reliable check for empty user task stacks

Josh Poimboeuf 
x86/unwind/orc: Fix ORC for newly forked tasks

Raviteja Narayanam 
i2c: cadence: Clear HOLD bit at correct time in Rx path

Raviteja Narayanam 
Revert "i2c: cadence: Fix the hold bit setting"

Paolo Pisati 
selftest: txtimestamp: fix net ns entry logic

Yoshihiro Shimoda 
net: ethernet: ravb: exit if re-initialization fails in tx timeout

Liam Beguin 
parisc: add support for cmpxchg on u8 pointers

Vincent Chen 
riscv: kasan: use local_tlb_flush_all() to avoid uninitialized __sbi_rfence

Ming Lei 
scsi: core: Run queue in case of I/O resource contention failure

Navid Emamdoost 
nfc: s3fwrn5: add missing release on skb in s3fwrn5_recv_frame

Oded Gabbay 
habanalabs: prevent possible out-of-bounds array access

Daniele Albano 
io_uring: always allow drain/link/hardlink/async sqe flags

Paolo Pisati 
selftests: net: ip_defrag: modprobe missing nf_defrag_ipv6 support

Laurence Oberman 
qed: Disable "MFW indication via attention" SPAM every 5 minutes

Paolo Pisati 
selftests: fib_nexthop_multiprefix: fix cleanup() netns deletion

Geert Uytterhoeven 
usb: hso: Fix debug compile warning on sparc32

Jiri Slaby 
iwlwifi: fix crash in iwl_dbg_tlv_alloc_trigger

Lorenzo Bianconi 
mt76: mt7615: fix lmac queue debugsfs entry

Taehee Yoo 
vxlan: fix memleak of fdb

Wei Li 
perf tools: Fix record failure when mixed with ARM SPE event

Xin Xiong 
net/mlx5e: fix bpf_prog reference count leaks in mlx5e_alloc_rq

Jianbo Liu 
net/mlx5e: E-Switch, Add misc bit when misc fields changed for mirroring

Wang Hai 
net: gemini: Fix missing clk_disable_unprepare() in error path of 
gemini_ethernet_port_probe()

Shannon Nelson 
ionic: unlock queue mutex in error path

Landen Chao 
net: ethernet: mtk_eth_soc: fix MTU warnings

Lu Wei 
net: nixge: fix potential memory leak in nixge_probe()

Hangbin Liu 
selftests/bpf: fix netdevsim trap_flow_action_cookie read

Alain Michaud 
Bluetooth: fix kernel oops in store_pending_adv_report

Robin Murphy 
arm64: csum: Fix handling of bad packets

Sami Tolvanen 
arm64/alternatives: move length validation inside the subsection

Leon Romanovsky 
RDMA/core: Free DIM memory in error unwind

Leon Romanovsky 
RDMA/core: Stop DIM before destroying CQ

Remi Pommarel 
mac80211: mesh: Free pending skb when destroying a mpath

Remi Pommarel 
mac80211: mesh: Free ie data when leaving mesh

Sabrina Dubroca 
espintcp: handle short messages instead of breaking the encap socket

Andrii Nakryiko 
bpf: Fix map leak in HASH_OF_MAPS map

Thomas Falcon 
ibmvnic: Fix IRQ mapping disposal in error path

Amit Cohen 
selftests: ethtool: Fix test when only two speeds are supported

Ido Schimmel 
mlxsw: spectrum_router: Fix use-after-free in router init / de-init

Ido Schimmel 
mlxsw: core: Free EMAD transactions using kfree_rcu()

Ido Schimmel 
mlxsw: core: Increase scope of RCU read-side critical section

Christoph Hellwig 
nvme: add a Identify Namespace Identification Descriptor list quirk

Guillaume Nault 
bareudp: forbid mixing IP and MPLS in multiproto mode

Subbaraya Sundeep 
octeontx2-pf: Unregister netdev at driver remove

Subbaraya Sundeep 
octeontx2-pf: cancel reset_task work

Subbaraya Sundeep 
octeontx2-pf: Fix reset_task bu

Re: [GIT PULL 3/5] ARM: SoC changes for v5.9

2020-08-04 Thread Andy Shevchenko
On Tue, Aug 4, 2020 at 10:02 AM Joel Stanley  wrote:
>
> On Mon, 3 Aug 2020 at 21:49, Arnd Bergmann  wrote:
> > ARM: SoC changes for v5.9
>
> > Andy Shevchenko (1):
> >   ARM: orion/gpio: Make use of for_each_requested_gpio()
>
> This change broke the arm build (I noticed it when building 
> multi_v5_defconfig):
>
> ../arch/arm/plat-orion/gpio.c:457:2: error: implicit declaration of
> function ‘for_each_requested_gpio’
> [-Werror=implicit-function-declaration]
>   457 |  for_each_requested_gpio(chip, i, label) {
>   |  ^~~
>
> for_each_requested_gpio isn't in Linus (Torvalds) tree yet. It will be
> fixed when he pulls Linus Walleij's GPIO tree which has the commit:
>
>  b3337eb24831 gpiolib: Introduce for_each_requested_gpio_in_range() macro

Linus W. specifically created an immutable branch [1] for this.
And I think I commented somewhere that entire branch should be pulled.

[1]: 
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/log/?h=ib-for-each-requested


-- 
With Best Regards,
Andy Shevchenko


linux-next: build warnings after merge of the fsinfo tree

2020-08-04 Thread Stephen Rothwell
Hi all,

After merging the fsinfo tree, today's linux-next build (powerpc
allyesconfig) produced these warnings:

samples/vfs/test-mntinfo.c: In function 'display_mount':
samples/vfs/test-mntinfo.c:146:19: warning: format '%llx' expects argument of 
type 'long long unsigned int', but argument 3 has type '__u64' {aka 'long 
unsigned int'} [-Wformat=]
  146 |  printf("%10u %8llx %2x %x %5s %s",
  |   ^
  |   |
  |   long long unsigned int
  |   %8lx
  147 | info.mnt_id,
  148 | (info.mnt_attr_changes +
  | 
  149 |   info.mnt_topology_changes +
  |   ~~~
  | |
  | __u64 {aka long unsigned int}
  150 |   info.mnt_subtree_notifications),
  |   ~~~
samples/vfs/test-fsinfo.c: In function 'dump_fsinfo_generic_mount_all':
samples/vfs/test-fsinfo.c:384:30: warning: format '%llu' expects argument of 
type 'long long unsigned int', but argument 5 has type '__u64' {aka 'long 
unsigned int'} [-Wformat=]
  384 |  printf("%5x %5x %12llx %10llu %s\n",
  | ~^
  |  |
  |  long long unsigned int
  | %10lu
  385 | r->mnt_id, r->parent_id, (unsigned long long)r->mnt_unique_id,
  386 | r->mnt_notify_sum, mp);
  | ~ 
  |  |
  |  __u64 {aka long unsigned int}

-- 
Cheers,
Stephen Rothwell


pgprfzn9rIDu1.pgp
Description: OpenPGP digital signature


Re: [PATCH] mm/memcg: remove useless check on page->mem_cgroup

2020-08-04 Thread Alex Shi



在 2020/8/3 下午4:18, Michal Hocko 写道:
> On Sat 01-08-20 11:58:41, Alex Shi wrote:
>>
>>
>> 在 2020/7/31 下午11:16, Johannes Weiner 写道:
if (!entry.val) {
memcg_memory_event(memcg, MEMCG_SWAP_FAIL);
>>> Uncharged readahead pages are gone, but I'm not 100% sure uncharged
>>> pages in general are gone. ISTR that the !page->mem_cgroup check in
>>> mem_cgroup_uncharge() prevented a crash - although that is of course a
>>> much broader interface, whereas the ones you change should only apply
>>> to LRU pages (which are hopefully all charged).
>>>
>>> Nevertheless, to avoid unnecessary crashes if we discover that we've
>>> been wrong, how about leaving the branches for now, but adding a (new)
>>> VM_WARN_ON_ONCE_PAGE() to them?
> 
> Agreed!
> 
>> Right, let's see if other unexcepted things happens, and then do actions.
>> So it's the patch:
>>
>> >From 28893cf8e55b98665cce58c0ba6d54aeafb63a62 Mon Sep 17 00:00:00 2001
>> From: Alex Shi 
>> Date: Sat, 1 Aug 2020 10:43:55 +0800
>> Subject: [PATCH] mm/memcg: warning on !memcg after readahead page charged
>>
>> Since readahead page is charged on memcg too, in theory we don't have to
>> check this exception now. Before safely remove them all, add a warning
>> for the unexpected !memcg.
> 
> I would find it useful to mention since when this assumption holds.> 
>> Signed-off-by: Alex Shi 
>> Cc: Johannes Weiner 
>> Cc: Michal Hocko 
>> Cc: Vladimir Davydov 
>> Cc: Andrew Morton 
>> Cc: cgro...@vger.kernel.org
>> Cc: linux...@kvack.org
>> Cc: linux-kernel@vger.kernel.org
>> ---
>>  include/linux/mmdebug.h |  8 
>>  mm/memcontrol.c | 15 ---
>>  2 files changed, 16 insertions(+), 7 deletions(-)
>>
>> diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
>> index 2ad72d2c8cc5..639e98a3384e 100644
>> --- a/include/linux/mmdebug.h
>> +++ b/include/linux/mmdebug.h
>> @@ -37,6 +37,13 @@
>>  BUG();  \
>>  }   \
>>  } while (0)
>> +#define VM_WARN_ON_ONCE_PAGE(cond, page)\
>> +do {\
>> +if (unlikely(cond)) {   \
>> +dump_page(page, "VM_WARN_ON_ONCE_PAGE(" 
>> __stringify(cond)")");\
>> +WARN_ON_ONCE(cond); \
>> +}   \
> 
> This is a bit strange behavior. You dump page for each occasion but warn
> only once. I would expect either "once" semantic for any output or just
> dump on each occasion because if the whole point is to reduce to amount
> of output then the above doesn't serve the purpose.
> 

Yes, left more dump_page may ommited by users. for reduce dmesg purpose, warn 
once
is better.

Thanks for comment!
Alex 
--
>From 3cee031d50625733a64b58240d0e6f8151e5299c Mon Sep 17 00:00:00 2001
From: Alex Shi 
Date: Sat, 1 Aug 2020 10:43:55 +0800
Subject: [PATCH v2] mm/memcg: warning on !memcg after readahead page charged

Since readahead page is charged on memcg too, in theory we don't have to
check this exception now. Before safely remove them all, add a warning
for the unexpected !memcg.

Signed-off-by: Alex Shi 
Cc: Johannes Weiner 
Cc: Michal Hocko 
Cc: Vladimir Davydov 
Cc: Andrew Morton 
Cc: cgro...@vger.kernel.org
Cc: linux...@kvack.org
Cc: linux-kernel@vger.kernel.org
---
 include/linux/mmdebug.h | 13 +
 mm/memcontrol.c | 15 ---
 2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
index 2ad72d2c8cc5..698eaf56f89f 100644
--- a/include/linux/mmdebug.h
+++ b/include/linux/mmdebug.h
@@ -37,6 +37,18 @@
BUG();  \
}   \
} while (0)
+#define VM_WARN_ON_ONCE_PAGE(condition, page)  ({  \
+   static bool __section(.data.once) __warned; \
+   int __ret_warn_once = !!(condition);\
+   \
+   if (unlikely(__ret_warn_once && !__warned)) {   \
+   dump_page(page, "VM_WARN_ON_ONCE_PAGE(" __stringify(cond)")");\
+   __warned = true;\
+   WARN_ON(1); \
+   }   \
+   unlikely(__ret_warn_once);  \
+})
+
 #define VM_WARN_ON(cond) (void)WARN_ON(cond)
 #define VM_WARN_ON_ONCE(cond) (void)WARN_ON_ONCE(cond)
 #define VM_WARN_ONCE(cond, format...) (void)WARN_ONCE(cond, format)
@@ -48,6 +60,7 @@
 #define VM_BUG_ON_MM(cond, mm) VM_BUG_ON(cond)
 #defin

Re: [PATCH v3] arm64: dts: qcom: Add support for Xiaomi Poco F1 (Beryllium)

2020-08-04 Thread Amit Pundir
On Tue, 4 Aug 2020 at 11:46, Bjorn Andersson  wrote:
>
> On Sat 01 Aug 08:55 PDT 2020, Amit Pundir wrote:
>
> > Add initial dts support for Xiaomi Poco F1 (Beryllium).
> >
> > This initial support is based on upstream Dragonboard 845c
> > (sdm845) device. With this dts, Beryllium boots AOSP up to
> > ADB shell over USB-C.
> >
> > Supported functionality includes UFS, USB-C (peripheral),
> > microSD card and Vol+/Vol-/power keys. Bluetooth should work
> > too but couldn't be verified from adb command line, it is
> > verified when enabled from UI with few WIP display patches.
> >
> > Just like initial db845c support, initializing the SMMU is
> > clearing the mapping used for the splash screen framebuffer,
> > which causes the device to hang during boot and recovery
> > needs a hard power reset. This can be worked around using:
> >
> > fastboot oem select-display-panel none
> >
> > To switch ON the display back run:
> >
> > fastboot oem select-display-panel
> >
> > But this only works on Beryllium devices running bootloader
> > version BOOT.XF.2.0-00369-SDM845LZB-1 that shipped with
> > Android-9 based release. Newer bootloader version do not
> > support switching OFF the display panel at all. So we need
> > a few additional smmu patches (under review) from here to
> > boot to shell:
> > https://github.com/pundiramit/linux/commits/beryllium-mainline
> >
> > Signed-off-by: Amit Pundir 
> > ---
> > v3: Added a reserved-memory region from downstream kernel to fix
> > a boot regression with recent dma-pool changes in v5.8-rc6.
> > v2: Updated machine compatible string for seemingly inevitable
> > future quirks.
> >
> >  arch/arm64/boot/dts/qcom/Makefile |   1 +
> >  arch/arm64/boot/dts/qcom/sdm845-beryllium.dts | 331 
> > ++
> >  2 files changed, 332 insertions(+)
> >  create mode 100644 arch/arm64/boot/dts/qcom/sdm845-beryllium.dts
> >
> > diff --git a/arch/arm64/boot/dts/qcom/Makefile 
> > b/arch/arm64/boot/dts/qcom/Makefile
> > index 0f2c33d611df..3ef1b48bc0cb 100644
> > --- a/arch/arm64/boot/dts/qcom/Makefile
> > +++ b/arch/arm64/boot/dts/qcom/Makefile
> > @@ -21,6 +21,7 @@ dtb-$(CONFIG_ARCH_QCOM) += sdm845-cheza-r1.dtb
> >  dtb-$(CONFIG_ARCH_QCOM)  += sdm845-cheza-r2.dtb
> >  dtb-$(CONFIG_ARCH_QCOM)  += sdm845-cheza-r3.dtb
> >  dtb-$(CONFIG_ARCH_QCOM)  += sdm845-db845c.dtb
> > +dtb-$(CONFIG_ARCH_QCOM)  += sdm845-beryllium.dtb
> >  dtb-$(CONFIG_ARCH_QCOM)  += sdm845-mtp.dtb
> >  dtb-$(CONFIG_ARCH_QCOM)  += sdm850-lenovo-yoga-c630.dtb
> >  dtb-$(CONFIG_ARCH_QCOM)  += sm8150-mtp.dtb
> > diff --git a/arch/arm64/boot/dts/qcom/sdm845-beryllium.dts 
> > b/arch/arm64/boot/dts/qcom/sdm845-beryllium.dts
> > new file mode 100644
> > index ..af66459712fe
> > --- /dev/null
> > +++ b/arch/arm64/boot/dts/qcom/sdm845-beryllium.dts
> > @@ -0,0 +1,331 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +
> > +/dts-v1/;
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include "sdm845.dtsi"
> > +#include "pm8998.dtsi"
> > +#include "pmi8998.dtsi"
> > +
> > +/ {
> > + model = "Xiaomi Technologies Inc. Beryllium";
> > + compatible = "xiaomi,beryllium", "qcom,sdm845";
> > +
> > + /* required for bootloader to select correct board */
> > + qcom,board-id = <69 0>;
> > + qcom,msm-id = <321 0x20001>;
> > +
> > + aliases {
> > + hsuart0 = &uart6;
> > + };
> > +
> > + dc12v: dc12v-regulator {
>
> This is a phone, it doesn't have a 12V DC jack. So while I don't know
> the exact power grid for this device, this node shouldn't be here.

Ack. Will remove it in next version.

>
> > + compatible = "regulator-fixed";
> > + regulator-name = "DC12V";
> > + regulator-min-microvolt = <1200>;
> > + regulator-max-microvolt = <1200>;
> > + regulator-always-on;
> > + };
> > +
> > + gpio_keys {
>
> y/_/-/

Ack.

>
> > + compatible = "gpio-keys";
> > + autorepeat;
> > +
> > + pinctrl-names = "default";
> > + pinctrl-0 = <&vol_up_pin_a>;
> > +
> > + vol-up {
> > + label = "Volume Up";
> > + linux,code = ;
> > + gpios = <&pm8998_gpio 6 GPIO_ACTIVE_LOW>;
> > + };
> > + };
> > +
> > + vbat: vbat-regulator {
> > + compatible = "regulator-fixed";
> > + regulator-name = "VBAT";
> > +
> > + vin-supply = <&dc12v>;
> > + regulator-min-microvolt = <420>;
> > + regulator-max-microvolt = <420>;
> > + regulator-always-on;
> > + };
> > +
> > + vbat_som: vbat-som-regulator {
>
> This is specific to db845c, with its power grid split between the main
> board and the SOM. Please omit.

Ack.

>
> > + compatible = "regulator-fixed";
> > + regulator-name = "VBAT_SOM";
> > +
> > + vin-supply = <&dc12v

Re: [PATCH] vgacon: fix out of bounds write to the scrollback buffer

2020-08-04 Thread Greg KH
On Mon, Aug 03, 2020 at 10:08:43AM +0200, Jiri Slaby wrote:
> Hi,
> 
> On 31. 07. 20, 7:22, 张云海 wrote:
> > Remove whitespace at EOL
> 
> I am fine with the patch. However it should be sent properly (inline
> mail, having a PATCH subject etc. -- see
> Documentation/process/submitting-patches.rst). git send-email after git
> format-patch handles most of it.

I'll go fix this all up now "by hand" :(



Re: [PATCH 4.19 31/56] net/mlx5: Verify Hardware supports requested ptp function on a given pin

2020-08-04 Thread Pavel Machek
Hi!

> [ Upstream commit 071995c877a8646209d55ff8e2b054e7424c ]
> 
> Fix a bug where driver did not verify Hardware pin capabilities for
> PTP functions.
> 
> Fixes: ee7f12205abc ("net/mlx5e: Implement 1PPS support")
> Signed-off-by: Eran Ben Elisha 
> Reviewed-by: Ariel Levkovich 
> Signed-off-by: Saeed Mahameed 
> Signed-off-by: Sasha Levin 

> +
>  static int mlx5_ptp_verify(struct ptp_clock_info *ptp, unsigned int pin,
>  enum ptp_pin_function func, unsigned int chan)
>  {
> - return (func == PTP_PF_PHYSYNC) ? -EOPNOTSUPP : 0;
> + struct mlx5_clock *clock = container_of(ptp, struct mlx5_clock,
> + ptp_info);
> +
> + switch (func) {
> + case PTP_PF_NONE:
> + return 0;
> + case PTP_PF_EXTTS:
> + return !(clock->pps_info.pin_caps[pin] &
> +  MLX5_MTPPS_REG_CAP_PIN_X_MODE_SUPPORT_PPS_IN);
> + case PTP_PF_PEROUT:
> + return !(clock->pps_info.pin_caps[pin] &
> +  MLX5_MTPPS_REG_CAP_PIN_X_MODE_SUPPORT_PPS_OUT);
> + default:
> + return -EOPNOTSUPP;
> + }
> +
> + return -EOPNOTSUPP;
>  }

The last return statement is unreachable code. I'm not sure if it will
provoke any warnings, but it looks ugly.

Signed-off-by: Pavel Machek (CIP) 

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c 
b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
index 2d55b7c22c03..a804f92ccf23 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
@@ -431,8 +431,6 @@ static int mlx5_ptp_verify(struct ptp_clock_info *ptp, 
unsigned int pin,
default:
return -EOPNOTSUPP;
}
-
-   return -EOPNOTSUPP;
 }
 
 static const struct ptp_clock_info mlx5_ptp_clock_info = {


-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


signature.asc
Description: PGP signature


Re: [GIT PULL 3/5] ARM: SoC changes for v5.9

2020-08-04 Thread Andy Shevchenko
On Tue, Aug 4, 2020 at 10:33 AM Andy Shevchenko
 wrote:
>
> On Tue, Aug 4, 2020 at 10:02 AM Joel Stanley  wrote:
> >
> > On Mon, 3 Aug 2020 at 21:49, Arnd Bergmann  wrote:
> > > ARM: SoC changes for v5.9
> >
> > > Andy Shevchenko (1):
> > >   ARM: orion/gpio: Make use of for_each_requested_gpio()
> >
> > This change broke the arm build (I noticed it when building 
> > multi_v5_defconfig):
> >
> > ../arch/arm/plat-orion/gpio.c:457:2: error: implicit declaration of
> > function ‘for_each_requested_gpio’
> > [-Werror=implicit-function-declaration]
> >   457 |  for_each_requested_gpio(chip, i, label) {
> >   |  ^~~
> >
> > for_each_requested_gpio isn't in Linus (Torvalds) tree yet. It will be
> > fixed when he pulls Linus Walleij's GPIO tree which has the commit:
> >
> >  b3337eb24831 gpiolib: Introduce for_each_requested_gpio_in_range() macro
>
> Linus W. specifically created an immutable branch [1] for this.
> And I think I commented somewhere that entire branch should be pulled.

https://www.spinics.net/lists/linux-gpio/msg51186.html

Sorry if that message wasn't clear.

> [1]: 
> https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/log/?h=ib-for-each-requested

-- 
With Best Regards,
Andy Shevchenko


[PATCH] seg6: using DSCP of inner IPv4 packets

2020-08-04 Thread Ahmed Abdelsalam
This patch allows copying the DSCP from inner IPv4 header to the
outer IPv6 header, when doing SRv6 Encapsulation.

This allows forwarding packet across the SRv6 fabric based on their
original traffic class.

Signed-off-by: Ahmed Abdelsalam 
---
 net/ipv6/seg6_iptunnel.c | 36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c
index e0e9f48ab14f..12fb32ca64f7 100644
--- a/net/ipv6/seg6_iptunnel.c
+++ b/net/ipv6/seg6_iptunnel.c
@@ -87,8 +87,7 @@ static void set_tun_src(struct net *net, struct net_device 
*dev,
 }
 
 /* Compute flowlabel for outer IPv6 header */
-static __be32 seg6_make_flowlabel(struct net *net, struct sk_buff *skb,
- struct ipv6hdr *inner_hdr)
+static __be32 seg6_make_flowlabel(struct net *net, struct sk_buff *skb)
 {
int do_flowlabel = net->ipv6.sysctl.seg6_flowlabel;
__be32 flowlabel = 0;
@@ -99,7 +98,7 @@ static __be32 seg6_make_flowlabel(struct net *net, struct 
sk_buff *skb,
hash = rol32(hash, 16);
flowlabel = (__force __be32)hash & IPV6_FLOWLABEL_MASK;
} else if (!do_flowlabel && skb->protocol == htons(ETH_P_IPV6)) {
-   flowlabel = ip6_flowlabel(inner_hdr);
+   flowlabel = ip6_flowlabel(ipv6_hdr(skb));
}
return flowlabel;
 }
@@ -109,10 +108,11 @@ int seg6_do_srh_encap(struct sk_buff *skb, struct 
ipv6_sr_hdr *osrh, int proto)
 {
struct dst_entry *dst = skb_dst(skb);
struct net *net = dev_net(dst->dev);
-   struct ipv6hdr *hdr, *inner_hdr;
struct ipv6_sr_hdr *isrh;
int hdrlen, tot_len, err;
+   struct ipv6hdr *hdr;
__be32 flowlabel;
+   u8 tos = 0;
 
hdrlen = (osrh->hdrlen + 1) << 3;
tot_len = hdrlen + sizeof(*hdr);
@@ -121,31 +121,31 @@ int seg6_do_srh_encap(struct sk_buff *skb, struct 
ipv6_sr_hdr *osrh, int proto)
if (unlikely(err))
return err;
 
-   inner_hdr = ipv6_hdr(skb);
-   flowlabel = seg6_make_flowlabel(net, skb, inner_hdr);
-
-   skb_push(skb, tot_len);
-   skb_reset_network_header(skb);
-   skb_mac_header_rebuild(skb);
-   hdr = ipv6_hdr(skb);
-
/* inherit tc, flowlabel and hlim
 * hlim will be decremented in ip6_forward() afterwards and
 * decapsulation will overwrite inner hlim with outer hlim
 */
 
+   flowlabel = seg6_make_flowlabel(net, skb);
+
if (skb->protocol == htons(ETH_P_IPV6)) {
-   ip6_flow_hdr(hdr, ip6_tclass(ip6_flowinfo(inner_hdr)),
-flowlabel);
-   hdr->hop_limit = inner_hdr->hop_limit;
+   tos = ip6_tclass(ip6_flowinfo(ipv6_hdr(skb)));
+   } else if (skb->protocol == htons(ETH_P_IP)) {
+   tos = ip_hdr(skb)->tos;
+   memset(IP6CB(skb), 0, sizeof(*IP6CB(skb)));
} else {
-   ip6_flow_hdr(hdr, 0, flowlabel);
-   hdr->hop_limit = ip6_dst_hoplimit(skb_dst(skb));
-
memset(IP6CB(skb), 0, sizeof(*IP6CB(skb)));
}
 
+   skb_push(skb, tot_len);
+   skb_reset_network_header(skb);
+   skb_mac_header_rebuild(skb);
+   hdr = ipv6_hdr(skb);
+
+   ip6_flow_hdr(hdr, tos, flowlabel);
+
hdr->nexthdr = NEXTHDR_ROUTING;
+   hdr->hop_limit = ip6_dst_hoplimit(skb_dst(skb));
 
isrh = (void *)hdr + sizeof(*hdr);
memcpy(isrh, osrh, hdrlen);
-- 
2.17.1



Re: [PATCH v5 2/2] iio: light: as73211: New driver

2020-08-04 Thread Christian Eggers
On Sunday, 2 August 2020, 20:02:35 CEST, Andy Shevchenko wrote:
> Thanks for an update, my comments below.

Thanks for the review. Please see below for my questions.

Best regards
Christian

> On Sun, Aug 2, 2020 at 7:40 PM Christian Eggers  wrote:
> > Datasheet:
> > https://ams.com/documents/20143/36005/AS73211_DS000556_3-01.pdf/a65474c0-
> > b302-c2fd-e30a-c98df87616df
> Do we need the UUID after the document file name?
I have send AMS an inquiry. Not sure whether I will get an answer. I will wait
a few days until sending v6.

> > +#define AS73211_OFFSET_TEMP (-66.9)
> > +#define AS73211_SCALE_TEMP  0.05
> 
> In the kernel we don't do float arithmetic. How these are being used?
Does this restriction also apply for compile time constants? I am quite 
sure that all calculations using these defines will be evaluated at compile
time. If found a number of other places where probably the same is done:

find . -name '*.c' | xargs grep "#define.*[0-9]\.[0-9]" | grep -v '"' | grep -v 
"\/\*.*[0-9]\.[0-9]"

> > +   *val2 = (AS73211_OFFSET_TEMP - (int)AS73211_OFFSET_TEMP) *
> > 100;
> > 
> > +   *val2 = (AS73211_SCALE_TEMP -
> > (int)AS73211_SCALE_TEMP) * 100;
> Magic 100 multiplier.
I think that in the context of IIO_VAL_INT_PLUS_MICRO this isn't quite magic. 
Using
100 directly seems quite usual:

find drivers/iio/ -type f | xargs grep "val2 = .*100"

> I think here you got them always 0. And to fix that you need to
> redefine (with also units included in the name) above constants like
> #define ..._OFFSET_TEMP_mC 66500
> ... _SCALE_TEMP_?? 50
a scale factor has no unit

> 
> Consider to use definitions from
> https://elixir.bootlin.com/linux/latest/source/include/linux/units.h
There are only definition for milli celsius. For IIO_VAL_INT_PLUS_MICRO I would
require micro celsius.

If I have the freedom, I would keep it as it is. Else I would suggest the 
following:
#define AS73211_OFFSET_TEMP_INT (-66)
#define AS73211_OFFSET_TEMP_MICRO 90
#define AS73211_SCALE_TEMP_INT 0
#define AS73211_SCALE_TEMP_MICRO 5

> > +   }}
> > +
> > +   return -EINVAL;
> 
> Make it default case.
changed. Is there any benefit? My IDE's syntax checker now complains
"No return, in a function returning non-void". But gcc is happy with this.

> > +   ret = devm_iio_device_register(dev, indio_dev);
> > +   if (ret < 0)
> > +   return ret;
> > +
> > +   return 0;
> 
>   return devm_iio_device_register();
changed. I prefer the original pattern as it would produce less changed lines
if something needs to inserted later.





Re: [net-next v2] seg6: using DSCP of inner IPv4 packets

2020-08-04 Thread Ahmed Abdelsalam

The problem was the declaration of tos.
Fixed and new patch is sent.

On 03/08/2020 21:48, Jakub Kicinski wrote:

On Mon,  3 Aug 2020 18:14:17 + Ahmed Abdelsalam wrote:

This patch allows copying the DSCP from inner IPv4 header to the
outer IPv6 header, when doing SRv6 Encapsulation.

This allows forwarding packet across the SRv6 fabric based on their
original traffic class.

Signed-off-by: Ahmed Abdelsalam 


Please make sure it builds cleanly with W=1 C=1:

net/ipv6/seg6_iptunnel.c:131:21: warning: incorrect type in assignment 
(different base types)
net/ipv6/seg6_iptunnel.c:131:21:expected restricted __be32 [usertype] tos
net/ipv6/seg6_iptunnel.c:131:21:got unsigned char
net/ipv6/seg6_iptunnel.c:133:21: warning: incorrect type in assignment 
(different base types)
net/ipv6/seg6_iptunnel.c:133:21:expected restricted __be32 [usertype] tos
net/ipv6/seg6_iptunnel.c:133:21:got unsigned char [usertype] tos
net/ipv6/seg6_iptunnel.c:144:27: warning: incorrect type in argument 2 
(different base types)
net/ipv6/seg6_iptunnel.c:144:27:expected unsigned int tclass
net/ipv6/seg6_iptunnel.c:144:27:got restricted __be32 [usertype] tos



arm64: make dtbs broken - socfpga_agilex.dtsi:313.15-16 syntax error FATAL ERROR: Unable to parse input tree

2020-08-04 Thread Naresh Kamboju
Linux mainline master build breaks on arm64 while building dtbs.

make -sk KBUILD_BUILD_USER=TuxBuild -C/linux ARCH=arm64
CROSS_COMPILE=aarch64-linux-gnu- HOSTCC=gcc CC="sccache
aarch64-linux-gnu-gcc" O=build dtbs
#
../arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14:
Warning (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges"
property but its #address-cells (1) differs from / (2)
../arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14:
Warning (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges"
property but its #size-cells (1) differs from / (2)
../arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14:
Warning (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges"
property but its #address-cells (1) differs from / (2)
../arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14:
Warning (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges"
property but its #size-cells (1) differs from / (2)
../arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14:
Warning (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges"
property but its #address-cells (1) differs from / (2)
../arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14:
Warning (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges"
property but its #size-cells (1) differs from / (2)
Error: ../arch/arm64/boot/dts/intel/socfpga_agilex.dtsi:313.15-16 syntax error
FATAL ERROR: Unable to parse input tree
make[3]: *** [scripts/Makefile.lib:314:
arch/arm64/boot/dts/intel/socfpga_agilex_socdk.dtb] Error 1
Error: ../arch/arm64/boot/dts/intel/socfpga_agilex.dtsi:313.15-16 syntax error
FATAL ERROR: Unable to parse input tree
make[3]: *** [scripts/Makefile.lib:314:
arch/arm64/boot/dts/intel/socfpga_agilex_socdk_nand.dtb] Error 1
make[3]: Target '__build' not remade because of errors.
make[2]: *** [../scripts/Makefile.build:497: arch/arm64/boot/dts/intel] Error 2
../arch/arm64/boot/dts/qcom/ipq6018.dtsi:127.3-14: Warning
(dma_ranges_format): /soc:dma-ranges: empty "dma-ranges" property but
its #address-cells (1) differs from / (2)
../arch/arm64/boot/dts/qcom/ipq6018.dtsi:127.3-14: Warning
(dma_ranges_format): /soc:dma-ranges: empty "dma-ranges" property but
its #size-cells (1) differs from / (2)
make[2]: Target '__build' not remade because of errors.
make[1]: *** [/linux/Makefile:1307: dtbs] Error 2
make: *** [Makefile:185: __sub-make] Error 2

build url:
https://gitlab.com/Linaro/lkft/kernel-runs/-/jobs/669607311

git log --oneline arch/arm64/boot/dts/intel/ | head

60176e6be0bb arm64: dts: agilex: add status to qspi dts node
fd0d094531db arm64: dts: agilex: correct service layer driver's compatible value
8d6b6bbe6dde arm64: dts: agilex: correct FPGA manager driver's compatible value
854e80bcfdaf Merge tag 'arm-dt-5.7' of
git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
80f132d73709 arm64: dts: increase the QSPI reg address for Stratix10 and Agilex
8c867387160e arm64: dts: socfpga: agilex: Fix gmac compatible
1afa9c3b7c9b Merge tag 'armsoc-dt' of
git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
210de0e996ae arm64: dts: agilex/stratix10: fix pmu interrupt numbers
2f804ba7aa9e arm64: dts: agilex: Add SysMgr to Ethernet nodes
a6706bd60be7 arm64: dts: agilex: Add SysMgr compatible


-- 
Linaro LKFT
https://lkft.linaro.org


Re: [PATCH 4.19 00/56] 4.19.137-rc1 review

2020-08-04 Thread Pavel Machek
Hi!

> This is the start of the stable review cycle for the 4.19.137 release.
> There are 56 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Wed, 05 Aug 2020 12:18:33 +.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
>   
> https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.137-rc1.gz
> or in the git tree and branch at:
>   
> git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
> linux-4.19.y
> and the diffstat can be found below.

CIP test farm does not see any problems...

https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/pipelines/173700523

...except that one of the targets is unavailable.

Chris, could we get distinction between "we ran a test and it failed"
and "we could not run a test because mice ate the cables"?

Best regards,
Pavel


-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


signature.asc
Description: PGP signature


[PATCH -next] sysctl: fix memleak in proc_sys_call_handler()

2020-08-04 Thread Yang Yingliang
I got a memleak report when doing some fuzz test:

BUG: memory leak
unreferenced object 0x888103f3da00 (size 64):
comm "syz-executor.0", pid 2270, jiffies 4295404698 (age 46.593s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
backtrace:
[<4f2c0607>] kmalloc include/linux/slab.h:559 [inline]
[<4f2c0607>] kzalloc include/linux/slab.h:666 [inline]
[<4f2c0607>] proc_sys_call_handler+0x1d4/0x480 fs/proc/proc_sysctl.c:574
[<5ec6a16b>] call_write_iter include/linux/fs.h:1876 [inline]
[<5ec6a16b>] new_sync_write+0x3c5/0x5b0 fs/read_write.c:515
[] vfs_write+0x4e8/0x670 fs/read_write.c:595
[<9d967c93>] ksys_write+0x10c/0x220 fs/read_write.c:648
[<139f6002>] do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46
[] entry_SYSCALL_64_after_hwframe+0x44/0xa9

Go to free buff when copy_from_iter_full() is failed.

Fixes: 1dea05cbc0d7 ("sysctl: Convert to iter interfaces")
Reported-by: Hulk Robot 
Signed-off-by: Yang Yingliang 
---
 fs/proc/proc_sysctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 9f6b9c3e3fda..a4a3122f8a58 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -578,7 +578,7 @@ static ssize_t proc_sys_call_handler(struct kiocb *iocb, 
struct iov_iter *iter,
if (write) {
error = -EFAULT;
if (!copy_from_iter_full(kbuf, count, iter))
-   goto out;
+   goto out_free_buf;
kbuf[count] = '\0';
}
 
-- 
2.25.1



Re: [PATCH v3] Provide USF for the portable equipment.

2020-08-04 Thread Greg KH
A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

On Tue, Aug 04, 2020 at 03:34:25PM +0800, Dongdong Yang wrote:
> Appreciate Viresh for your help. I thought Peter's NAK was only for the
> initial version. I am going to upload the verified version 4. Could you
> please kindly help to further review?
> 
> 1. Motivation
> =
> 
> The power consumption and UI response are more cared for by the portable
> equipment users.

That's not true, everyone cares about this.

> USF(User Sensitive Feedback factor) auxiliary cpufreq
> governor
> is providing more utils adjustment settings to the high level by scenario
> identification.

Odd line-wrapping :(

And what do you mean by "more utils adjustment settings to the high
level by scenario identification"?  I can not parse that at all.

> 2. Introduction
> ===
> 
> The USF auxiliary scheduling is based on FrameBuffer and schdeutil cpufreq
> governor to adjust utils by the identificated scenario from User Space.

What is "adjust utils"?

And why is "User Space" in caps?

> It is for portable equipment which "screen off" status stands for no request
> from the user, however, the kernel is still expected to notify the user for
> UI in
> time on modem, network or powerkey events occur. In order to save power, the
> sysfs inode nonux is provided to set the utils down level on userspace
> tasks.

Having custom sysfs apis is almost never a good idea.  Do other cpufreq
governers do this?

> In addition, the portable equipment users usually heavily interact with
> devices
> by touch, and other peripherals. On "screen on" status, The boost preemptive
> counts are marking the load requirement urgent, vice versa. USF provides up
> and
> down sysfs inodes to adjust utils according to such feedback factor and the
> level setting from the user space identified scenario.
> 
> adjust_task_pred_set is as the switch to enable or disable the adjustment.
> If no USF sysfs inodes is set and no screen on or off event be received,
> adjust_task_pred_demand shall not be executed.
> 
> 3. System wide settings
> ===
> 
> sched_usf_non_ux_r:
> The ratio of utils is cut down on screen off. The default value is
> 0,

The line-wrapping makes it almost impossible to read here, can you fix
that up?

> which no util be adjusted on sugov calculating utils to select

"sugov"?

> cpufreq.
> Its range is [-100 , 0]. If its value falls into [-50, 0), the half
> of
> utils, which calculates cpufreq, shall be  cut down. If its value
> falls
> into [-100, -50), only a quarter of utils be left to continue to
> calculates cpufreq.
> It is expected to be set [-100, 0) once enter into the identificated
> scenario, such as listen to music on screen off, and recover to 0 on
> out of the scenario, such as screen on.

sysfs files are "one value per file", please do not parse such complex
things in the kernel.

> 
> sched_usf_up_l0_r:
> The ratio of utils is boosted up on screen on. The default value is
> 0,
> which no util be adjusted on sugov calculates utils to select
> cpufreq.
> Its range is [0 , 100]. If its value falls into (0, 50], a quarter
> of
> extra utils, which calculates cpufreq, shall be added. If its value
> falls into (50, 100], the half of extra utils be added to continue
> to
> calculates cpufreq.
> It is expected to be set (0, 100] once enter into the identificated
> scenario, such as browsing videolet on screen on, and recover to 0
> on
> out of the scenario, such as screen off or videolet into background.
> 
> sched_usf_down_r:
> The ratio of utils is cut down on screen on. The default value is 0,
> which no util be adjusted on sugov calculating utils to select
> cpufreq.
> Its range is [-100 , 0]. If its value falls into [-50, 0), the half
> of
> utils, which calculates cpufreq, shall be  cut down. If its value
> falls
> into [-100, -50), only a quarter of utils be left to continue to
> calculates cpufreq.
> It is expected to be set [-100, 0) once enter into the identificated
> scenario, such as browsing videolet on screen on, and recover to 0
> on
> out of the scenario, such as screen off or vidolet into background.

Why can't all of these work automatically?  Why do you need userspace
interaction here?

thanks,

greg k-h


Re: PATCH: rtsx_pci driver - don't disable the rts5229 card reader on Intel NUC boxes

2020-08-04 Thread gre...@linuxfoundation.org
On Tue, Aug 04, 2020 at 02:44:41AM +, 吳昊澄 Ricky wrote:
> Hi Chris,
> 
> rtsx_pci_write_register(pcr, FPDTL, OC_POWER_DOWN, OC_POWER_DOWN);
> This register operation saved power under 1mA, so if do not care the 1mA 
> power we can have a patch to remove it, make compatible with NUC6
> We tested others our card reader that remove it, we did not see any side 
> effect 
> 
> Hi Greg k-h,
> 
> Do you have any comments? 

comments on what?  I don't know what you are responding to here, sorry.

greg k-h


[PATCH] ext4: delete invalid ac_b_extent backup inside ext4_mb_use_best_found()

2020-08-04 Thread brookxu
Delete invalid ac_b_extent backup inside ext4_mb_use_best_found(),
we have done this operation in ext4_mb_new_group_pa() and
ext4_mb_new_inode_pa().

Signed-off-by: Chunguang Xu 
---
 fs/ext4/mballoc.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 9b1c3ad..fb63e9f 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -1704,10 +1704,6 @@ static void ext4_mb_use_best_found(struct 
ext4_allocation_context *ac,
 ac->ac_b_ex.fe_logical = ac->ac_g_ex.fe_logical;
 ret = mb_mark_used(e4b, &ac->ac_b_ex);
 
-    /* preallocation can change ac_b_ex, thus we store actually
-     * allocated blocks for history */
-    ac->ac_f_ex = ac->ac_b_ex;
-
 ac->ac_status = AC_STATUS_FOUND;
 ac->ac_tail = ret & 0x;
 ac->ac_buddy = ret >> 16;
@@ -1726,8 +1722,8 @@ static void ext4_mb_use_best_found(struct 
ext4_allocation_context *ac,
 /* store last allocated for subsequent stream allocation */
 if (ac->ac_flags & EXT4_MB_STREAM_ALLOC) {
     spin_lock(&sbi->s_md_lock);
-        sbi->s_mb_last_group = ac->ac_f_ex.fe_group;
-        sbi->s_mb_last_start = ac->ac_f_ex.fe_start;
+        sbi->s_mb_last_group = ac->ac_b_ex.fe_group;
+        sbi->s_mb_last_start = ac->ac_b_ex.fe_start;
     spin_unlock(&sbi->s_md_lock);
 }
 /*
-- 
1.8.3.1



Re: [PATCH v3] coccinelle: api: add kvmalloc script

2020-08-04 Thread Julia Lawall



On Tue, 4 Aug 2020, Markus Elfring wrote:

> > Changes in v3:
> > - kvfree rules added
>
> I find it interesting to you found such an addition needed for this SmPL 
> script.
> I imagine that it can be helpful to support such a source code search by
> a separate script for the semantic patch language.
>
> I am curious if my patch review comments for the second version got also a bit
> of your software development attention.
>
> Another implementation detail is relevant for further clarification.
> The SmPL rules for patch generation differ in search functionality
> which is provided for other operation modes.
> Can these deviations influence the confidence level?

I see no useful information in this review, nor in the v2 review.

julia


Re: [PATCH v4 1/4] power: supply: core: add quick charge type property

2020-08-04 Thread Greg KH
On Tue, Aug 04, 2020 at 10:11:19AM +0800, ivan wrote:
> On Mon, Aug 3, 2020 at 7:57 PM Greg KH  wrote:
> >
> > On Mon, Aug 03, 2020 at 01:49:50PM +0200, Sebastian Reichel wrote:
> > > More importantely I prefer not to merge new APIs without any users
> > > (i.e. a driver making use of those values). Having a reference
> > > driver means, that there is an example how to use the values
> > > correctly and proves it is actually needed upstream. Right now
> > > this looks like "let's modify the upstream kernel, so that we can
> > > easily maintain our out of tree driver".
> >
> > Agreed.  Qiwu, can you also submit your driver so we can see these
> > values be used?
> 
> Our driver is based on qualcomm's driver secondary development.
> 
> The driver code is for mi 10.
> 
> https://github.com/MiCode/Xiaomi_Kernel_OpenSource/blob/umi-q-oss/drivers/power/supply/qcom/qpnp-smb5.c#L1434
> 
> + case POWER_SUPPLY_PROP_QUICK_CHARGE_TYPE:
> + val->intval = smblib_get_quick_charge_type(chg);
> + break;
> 
> https://github.com/MiCode/Xiaomi_Kernel_OpenSource/blob/umi-q-oss/drivers/power/supply/qcom/smb5-lib.c#L7713



Great, can you submit these drivers as patches as part of this series?
That's the best way for all of this to be integrated.

thanks,

greg k-h


[PATCH v4] Provide USF for the portable equipment.

2020-08-04 Thread Dongdong Yang
From: Dongdong Yang 

This patch provides USF(User Sensitive Feedback factor) auxiliary
cpufreq governor to support high level layer sysfs inodes setting
for utils adjustment purpose from the identified scenario on portable
equipment. Because the power consumption and UI response are more cared
for by portable equipment users. And the "screen off" status stands for
no request from the user, however, the kernel is still expected to
notify the user in time on modem, network or powerkey events occur. USF
provides "sched_usf_non_ux_r" sysfs inode to cut down the utils from
user space tasks according to high level scenario. In addition, it
usually hints more cpufreq demand that the preemptive counts of the
tasks on the cpu burst and over the user expecting completed time such
as the ratio sysctl_sched_latency to sysctl_sched_min_granularity on
"screen on" status, which more likely with more UI. The sysfs inodes
"sched_usf_up_l0_r" and "sched_usf_down_r" have been provided to adjust
the utils according to high level identified scenario to alloc the
cpufreq in time.

Changes in v4
Based on comments from Greg, Randy and Viresh
  - Add USF sysfs to ABI
  - Remove kobj field from usf.
  - Clean Kconfig left at staging.

Changes in v3
Based on comments from Greg, Dietmar, Christoph and Randy
  - Move usf.c to kernel/sched from staging.
  - Remove trace_printk and debugfs.
  - Add document draft.
  - Update comments.

Changes in v2
Based on comments from Steven, Greg, Peter and Dan:
  - Add adjust_task_pred_set switch.
  - Move adjust_task_pred_demand declaration into sched.h
  - Update comments.
  - Clean usf structure.

Changes in v1
Initial USF 

Dongdong Yang (1):
  sched: Provide USF for the portable equipment.

 Documentation/ABI/testing/sysfs-devices-system-cpu |  48 
 drivers/cpufreq/Kconfig|  11 +
 include/trace/events/sched.h   |  35 +++
 kernel/sched/Makefile  |   1 +
 kernel/sched/cpufreq_schedutil.c   |   3 +
 kernel/sched/sched.h   |  10 +
 kernel/sched/usf.c | 294 +
 7 files changed, 402 insertions(+)
 create mode 100644 kernel/sched/usf.c

-- 
2.7.4



Re: [PATCH] ASoC: fsl_sai: Clean code for synchronize mode

2020-08-04 Thread Shengjiu Wang
On Tue, Aug 4, 2020 at 3:04 PM Nicolin Chen  wrote:
>
> On Tue, Aug 04, 2020 at 12:22:53PM +0800, Shengjiu Wang wrote:
>
> > > > Btw, do we need similar change for TRIGGER_STOP?
> > >
> > > This is a good question. It is better to do change for STOP,
> > > but I am afraid that there is no much test to guarantee the result.
>
> > Maybe we can do this change for STOP.
>
> The idea looks good to me...(check inline comments)
>
> > diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
> > index 1c0e06bb3783..6e4be398eaee 100644
> > --- a/sound/soc/fsl/fsl_sai.c
> > +++ b/sound/soc/fsl/fsl_sai.c
> > @@ -517,6 +517,37 @@ static int fsl_sai_hw_free(struct
> > snd_pcm_substream *substream,
> > return 0;
> >  }
> >
> > +static void fsl_sai_config_disable(struct fsl_sai *sai, bool tx)
> > +{
> > +   unsigned int ofs = sai->soc_data->reg_offset;
> > +   u32 xcsr, count = 100;
> > +
> > +   regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx, ofs),
> > +  FSL_SAI_CSR_TERE, 0);
> > +
> > +   /* TERE will remain set till the end of current frame */
> > +   do {
> > +   udelay(10);
> > +   regmap_read(sai->regmap, FSL_SAI_xCSR(tx, ofs), &xcsr);
> > +   } while (--count && xcsr & FSL_SAI_CSR_TERE);
> > +
> > +   regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx, ofs),
> > +  FSL_SAI_CSR_FR, FSL_SAI_CSR_FR);
> > +
> > +   /*
> > +* For sai master mode, after several open/close sai,
> > +* there will be no frame clock, and can't recover
> > +* anymore. Add software reset to fix this issue.
> > +* This is a hardware bug, and will be fix in the
> > +* next sai version.
> > +*/
> > +   if (!sai->is_slave_mode) {
> > +   /* Software Reset for both Tx and Rx */
>
> Remove "for both Tx and Rx"
>
> > /* Check if the opposite FRDE is also disabled */
> > regmap_read(sai->regmap, FSL_SAI_xCSR(!tx, ofs), &xcsr);
> > +   if (sai->synchronous[tx] && !sai->synchronous[!tx] && 
> > !(xcsr & FSL_SAI_CSR_FRDE))
> > +   fsl_sai_config_disable(sai, !tx);
>
> > +   if (sai->synchronous[tx] || !sai->synchronous[!tx] || 
> > !(xcsr & FSL_SAI_CSR_FRDE))
> > +   fsl_sai_config_disable(sai, tx);
>
> The first "||" should probably be "&&".

No. it is !(!sai->synchronous[tx] && sai->synchronous[!tx] && (xcsr &
FSL_SAI_CSR_FRDE))
so then convert to
(sai->synchronous[tx] || !sai->synchronous[!tx] || !(xcsr & FSL_SAI_CSR_FRDE))

if change to &&, then it won't work for:
sai->synchronous[tx] = false, sai->synchronous[!tx]=false.
or
sai->synchronous[tx] = true, sai->synchronous[!tx]=true.
(even we don't have such a case).

>
> The trigger() logic is way more complicated than a simple cleanup
> in my opinion. Would suggest to split RMR part out of this change.
>
> And for conditions like "sync[tx] && !sync[!tx]", it'd be better
> to have a helper function to improve readability:
>
> /**
>  * fsl_sai_dir_is_synced - Check if stream is synced by the opposite stream
>  *
>  * SAI supports synchronous mode using bit/frame clocks of either 
> Transmitter's
>  * or Receiver's for both streams. This function is used to check if clocks of
>  * current stream's are synced by the opposite stream.
>  *
>  * @sai: SAI context
>  * @dir: direction of current stream
>  */
> static inline bool fsl_sai_dir_is_synced(struct fsl_sai *sai, int dir)
> {
> int adir = (dir == TX) ? RX : TX;
>
> /* current dir in async mode while opposite dir in sync mode */
> return !sai->synchronous[dir] && sai->synchronous[adir];
> }
>
> Then add more comments in trigger:
>
> static ...trigger()
> {
> bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
> int adir = tx ? RX : TX;
> int dir = tx ? TX : RX;
>
> // 
> {
> // ...
>
> /* Check if the opposite FRDE is also disabled */
> regmap_read(sai->regmap, FSL_SAI_xCSR(!tx, ofs), &xcsr);
>
> /*
>  * If opposite stream provides clocks for synchronous mode and
>  * it is inactive, disable it before disabling the current one
>  */
> if (fsl_sai_dir_is_synced(adir) && !(xcsr & FSL_SAI_CSR_FRDE))
> fsl_sai_config_disable(sai, adir);
>
> /*
>  * Disable current stream if either of:
>  * 1. current stream doesn't provide clocks for synchronous 
> mode
>  * 2. current stream provides clocks for synchronous mode but 
> no
>  *more stream is active.
>  */
> if (!fsl_sai_dir_is_synced(dir) || !(xcsr & FSL_SAI_CSR_FRDE))
> fsl_sai_config_disable(sai, dir);
>
> // ...
> }
> // 
> }
>
> Note, in

[PATCH v4] sched: Provide USF for the portable equipment.

2020-08-04 Thread Dongdong Yang
From: Dongdong Yang 

The power consumption and UI response are more cared for by the portable
equipment users. USF(User Sensitive Feedback factor) auxiliary cpufreq
governor is providing more utils adjustment settings to the high level
by scenario identification.

>From the view of portable equipment, screen off status usually stands
for no request from the user, however, the kernel is still expected to
notify the user in time on modem, network or powerkey events occur. In
some scenarios, such as listening to music, low power processors, such
as DSP, take more actions and CPU load requirements cut down.  It would
bring more power consumption benefit if high level have interfaces to
adjust utils according to the current scenario and load.

In addition, the portable equipment user usually heavily interact with
devices by touch, and other peripherals. The boost preemptive counts
are marking the load requirement urgent, vice versa. If such feedback
factor could be set to high level according to the scenario, it would
contribute to the power consumption and UI response.

If no USF sysfs inode is set, and no screen on or off event,
adjust_task_pred_demand shall not be invoked. Once sched_usf_up_l0_r
sched_usf_down_r or sched_usf_non_ux_r be set, adjust_task_pred_demand
shall be called back to update settings according to high level
scenario identification.

We can get about 17% mean power consumption save at listening to music
with speaker on "screen off" scenario, as below statistical data from
7766 XiaoMi devices for two weeks with sched_usf_non_ux_r be set:

day1 day2 day3 day4
count   7766.00  7766.00  7766.00  7766.00
mean88.03552585.50028283.82930586.054997
std 111.049980   108.258834   107.562583   108.558240
min 0.099000 0.037000 0.067000 0.045000
25% 34.76550034.02175034.10150034.423000
50% 54.9555.28650054.18950054.248500
75% 95.95400093.94200091.73800094.0592500
80% 114.675000   107.43   106.378000   108.673000
85% 137.851000   129.511000   127.156500   131.750750
90% 179.669000   170.208500   164.027000   172.348000
95% 272.395000   257.845500   247.750500   263.275750
98% 399.034500   412.170400   391.484000   402.835600

day5 day6day7 day8
count   7766.00  7766.0  7766.00  7766.00
mean82.53267779.2192377.61138081.075081
std 104.870079   101.34819   103.140037   97.506221
min 0.051000 0.02900 0.007000 0.068000
25% 32.87300033.4440031.96550033.863500
50% 52.18050051.5655050.80650053.08
75% 90.90575086.8262583.85925089.973000
80% 105.455000   99.6470097.271000104.225000
85% 128.30   118.47825   116.570250   126.648250
90% 166.647500   149.18000   150.649500   161.087000
95% 247.208500   224.36050   226.38   245.291250
98% 393.002000   347.92060   369.791800   378.778600

day9 day10day11day12
count   7766.00  7766.00  7766.00  7766.00
mean79.98917083.85941778.03293077.060542
std 104.226122   108.893043   102.561715   99.844276
min 0.118000 0.017000 0.028000 0.039000
25% 32.05625033.45450031.17625030.897750
50% 51.50600054.05600048.96950049.069000
75% 88.51350092.95350083.50675084.096000
80% 102.876000   107.845000   97.71700098.073000
85% 124.363000   128.288000   118.366500   116.869250
90% 160.557000   167.084000   154.342500   148.187500
95% 231.149000   242.925750   236.759000   228.131250
98% 367.206600   388.619100   385.269100   376.541600

day13day14
count   7766.00  7766.00
mean75.52803673.702878
std 90.75059486.796016
min 0.066000 0.054000
25% 31.17050031.608500
50% 48.75850049.215000
75% 84.52275083.053000
80% 97.87900094.875000
85% 116.680250   113.573750
90% 149.083500   144.089500
95% 226.177750   211.488750
98% 347.011100   331.317100

Signed-off-by: Dongdong Yang 
Co-developed-by: Jun Tao 
Co-developed-by: Qiwu Huang 
Co-developed-by: Peng Wang 
---
 Documentation/ABI/testing/sysfs-devices-system-cpu |  48 
 drivers/cpufreq/Kconfig|  11 +
 include/trace/events/sched.h   |  35 +++
 kernel/sched/Makefile  |   1 +
 kernel/sched/cpufreq_schedutil.c   |   3 +
 kernel/sched/sched.h   |  10 +
 kernel/sched/usf.c | 294 +
 7 files changed, 402 insertions(+)
 create mode 100644 kernel/sched/usf.c

diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu 
b/Documentation/ABI/testing/sysfs-devices-system-cpu
index b555df8..e299418 100644
--- a/D

Re: [GIT PULL 3/5] ARM: SoC changes for v5.9

2020-08-04 Thread Linus Walleij
On Tue, Aug 4, 2020 at 9:34 AM Andy Shevchenko
 wrote:
> On Tue, Aug 4, 2020 at 10:02 AM Joel Stanley  wrote:
> >
> > On Mon, 3 Aug 2020 at 21:49, Arnd Bergmann  wrote:
> > > ARM: SoC changes for v5.9
> >
> > > Andy Shevchenko (1):
> > >   ARM: orion/gpio: Make use of for_each_requested_gpio()
> >
> > This change broke the arm build (I noticed it when building 
> > multi_v5_defconfig):
> >
> > ../arch/arm/plat-orion/gpio.c:457:2: error: implicit declaration of
> > function ‘for_each_requested_gpio’
> > [-Werror=implicit-function-declaration]
> >   457 |  for_each_requested_gpio(chip, i, label) {
> >   |  ^~~
> >
> > for_each_requested_gpio isn't in Linus (Torvalds) tree yet. It will be
> > fixed when he pulls Linus Walleij's GPIO tree which has the commit:
> >
> >  b3337eb24831 gpiolib: Introduce for_each_requested_gpio_in_range() macro
>
> Linus W. specifically created an immutable branch [1] for this.
> And I think I commented somewhere that entire branch should be pulled.

OK let's fix it by firing off the GPIO pull request ASAP.

Yours,
Linus Walleij


Re: [f2fs-dev] [PATCH] f2fs: fix deadlock between quota writes and checkpoint

2020-08-04 Thread Chao Yu

On 2020/8/4 11:54, Jaegeuk Kim wrote:

On 08/04, Chao Yu wrote:

On 2020/7/29 15:02, Jaegeuk Kim wrote:

f2fs_write_data_pages(quota_mapping)
   __f2fs_write_data_pages f2fs_write_checkpoint
* blk_start_plug(&plug);
* add bio in write_io[DATA]
- block_operations
- skip syncing quota by
  
>DEFAULT_RETRY_QUOTA_FLUSH_COUNT
- down_write(&sbi->node_write);


f2fs_flush_merged_writes() will be called after block_operations(), why this 
doesn't
help?


Well, I think bio can be added after f2fs_flush_merged_writes() as well.


- down_read(node_write)
- f2fs_do_write_data_page
 - f2fs_trylock_op
  - f2fs_outplace_write_data
 - f2fs_submit_page_write

bio only be added under node_write lock? during f2fs_flush_merged_writes(), 
node_write
should have been held by checkpoint() avoiding quota data writeback & bio 
submission.






- f2fs_write_single_data_page
  - f2fs_do_write_data_page
- f2fs_outplace_write_data
  - do_write_page
 - f2fs_allocate_data_block
  - down_write(node_write)
- 
f2fs_wait_on_all_pages(F2FS_WB_CP_DATA);

Signed-off-by: Daeho Jeong 
Signed-off-by: Jaegeuk Kim 
---
   fs/f2fs/checkpoint.c | 2 ++
   1 file changed, 2 insertions(+)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 8c782d3f324f0..99c8061da55b9 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -1269,6 +1269,8 @@ void f2fs_wait_on_all_pages(struct f2fs_sb_info *sbi, int 
type)
if (type == F2FS_DIRTY_META)
f2fs_sync_meta_pages(sbi, META, LONG_MAX,
FS_CP_META_IO);
+   else if (type == F2FS_WB_CP_DATA)
+   f2fs_submit_merged_write(sbi, DATA);
io_schedule_timeout(DEFAULT_IO_TIMEOUT);
}
finish_wait(&sbi->cp_wait, &wait);


.



Re: [PATCH] iio:temperature:mlx90632: Reduce number of equal calulcations

2020-08-04 Thread Crt Mori
Hi Andy,
Thanks for the comments. This is indeed a cut-out section of what I
wanted to submit next.

On Mon, 3 Aug 2020 at 18:35, Andy Shevchenko  wrote:
>
> On Mon, Aug 3, 2020 at 6:17 PM Crt Mori  wrote:
> >
> > TAdut4 was calculated each iteration although it did not change. In light
> > of near future additions of the Extended range DSP calculations, this
> > function refactoring will help reduce unrelated changes in that series as
> > well as reduce the number of new functions needed.
>
> Okay!
>
> > Also converted shifts in this function of signed integers to divisions as
> > that is less implementation-defined behavior.
>
> This is what I'm wondering about. Why?
>
> ...

The reason for this is that whenever something is wrong with the
calculation I am looking into the shifts which are
implementation-defined and might not keep the signed bit. Division
however would.

>
> > -   Ha_customer = ((s64)Ha * 100LL) >> 14ULL;
> > -   Hb_customer = ((s64)Hb * 100) >> 10ULL;
> > +   Ha_customer = div64_s64((s64)Ha * 100LL, 16384);
> > +   Hb_customer = div64_s64((s64)Hb * 100, 1024);
>
> Have you checked the code on 32-bit machines?
> As far as I can see the div64_*64() do not have power of two divisor
> optimizations. I bet it will generate a bulk of unneeded code.
>
> ...
>
> > -   calcedKsTO = ((s64)((s64)Ga * (prev_object_temp - 25 * 1000LL)
> > -* 1000LL)) >> 36LL;
> > -   calcedKsTA = ((s64)(Fb * (TAdut - 25 * 100LL))) >> 36LL;
> > -   Alpha_corr = div64_s64s64)(Fa * 100LL) >> 46LL)
> > -   * Ha_customer), 1000LL);
>
> > +   calcedKsTO = div64_s64((s64)((s64)Ga * (prev_object_temp - 25 * 
> > 1000LL)
> > +* 1000LL), 68719476736);
> > +   calcedKsTA = div64_s64((s64)(Fb * (TAdut - 25 * 100LL)), 
> > 68719476736);
> > +   Alpha_corr = div64_s64(div64_s64((s64)(Fa * 100LL), 
> > 70368744177664)
> > +  * Ha_customer, 1000LL);
>
> This is less readable and full of magic numbers in comparison to the
> above (however, also full of magics, but at least gives better hint).
>
> ...

These are coefficients so there is not much to unmagic. I can keep the
shifts, if you think that is more readable or add comments after lines
with 2^46 or something?
>
> > +   TAdut4 = (div64_s64(TAdut, 1LL) + 27315) *
> > +   (div64_s64(TAdut, 1LL) + 27315) *
> > +   (div64_s64(TAdut, 1LL)  + 27315) *
> > +   (div64_s64(TAdut, 1LL) + 27315);
>
> Shouldn't you switch to definitions from units.h? (perhaps as a separate 
> change)
>
> --
> With Best Regards,
> Andy Shevchenko


Re: [PATCH v2 12/24] virtio_iommu: correct tags for config space fields

2020-08-04 Thread Jean-Philippe Brucker
On Mon, Aug 03, 2020 at 04:59:27PM -0400, Michael S. Tsirkin wrote:
> Since this is a modern-only device,
> tag config space fields as having little endian-ness.
> 
> Signed-off-by: Michael S. Tsirkin 

Reviewed-by: Jean-Philippe Brucker 

And tested with the latest sparse

> ---
>  include/uapi/linux/virtio_iommu.h | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/include/uapi/linux/virtio_iommu.h 
> b/include/uapi/linux/virtio_iommu.h
> index 48e3c29223b5..237e36a280cb 100644
> --- a/include/uapi/linux/virtio_iommu.h
> +++ b/include/uapi/linux/virtio_iommu.h
> @@ -18,24 +18,24 @@
>  #define VIRTIO_IOMMU_F_MMIO  5
>  
>  struct virtio_iommu_range_64 {
> - __u64   start;
> - __u64   end;
> + __le64  start;
> + __le64  end;
>  };
>  
>  struct virtio_iommu_range_32 {
> - __u32   start;
> - __u32   end;
> + __le32  start;
> + __le32  end;
>  };
>  
>  struct virtio_iommu_config {
>   /* Supported page sizes */
> - __u64   page_size_mask;
> + __le64  page_size_mask;
>   /* Supported IOVA range */
>   struct virtio_iommu_range_64input_range;
>   /* Max domain ID size */
>   struct virtio_iommu_range_32domain_range;
>   /* Probe buffer size */
> - __u32   probe_size;
> + __le32  probe_size;
>  };
>  
>  /* Request types */
> -- 
> MST
> 


Re: [GIT PULL] thermal for v5.9-rc1

2020-08-04 Thread Daniel Lezcano
On 04/08/2020 08:32, Zhang Rui wrote:

[ ... ]

> There must be something wrong here, Daniel and I are following a strict
> process to make sure that we don't lose any history.
> 
> For this PR, I'm not quite sure what happened, he probably did
> something by mistake when generating it.

Yes, I did something wrong, not sure yet what happened. I'll investigate
before sending a new PR.

Sorry for that.

  -- Daniel


-- 
 Linaro.org │ Open source software for ARM SoCs

Follow Linaro:   Facebook |
 Twitter |
 Blog


Re: [PATCH v4] sched: Provide USF for the portable equipment.

2020-08-04 Thread Greg KH
On Tue, Aug 04, 2020 at 03:50:35PM +0800, Dongdong Yang wrote:

Comments on code stuff only, not if this is actually a valid thing to be
doing at all:

> --- /dev/null
> +++ b/kernel/sched/usf.c
> @@ -0,0 +1,294 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (C) 2020 XiaoMi Inc.
> + * Author: Yang Dongdong 
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> + * See http://www.gnu.org/licenses/gpl-2.0.html for more details.

No need for the two paragraph "boiler plate" license text now that you
have a SPDX line, please remove them.

> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include "sched.h"
> +
> +#define BOOST_MIN_V -100
> +#define BOOST_MAX_V 100
> +#define LEVEL_TOP 3
> +
> +#define USF_TAG  "[usf_sched]"

Please pr_fmt instead.

> +
> +DEFINE_PER_CPU(unsigned long[PID_MAX_DEFAULT], task_hist_nivcsw);
> +
> +static struct {
> + bool is_sched_usf_enabled;
> + bool is_screen_on;
> + int sysctl_sched_usf_up_l0;
> + int sysctl_sched_usf_down;
> + int sysctl_sched_usf_non_ux;
> + int usf_up_l0;
> + int usf_down;
> + int usf_non_ux;
> +} usf_vdev;
> +
> +void adjust_task_pred_demand(int cpuid,
> +  unsigned long *util,
> +  struct rq *rq)
> +{
> + /* sysctl_sched_latency/sysctl_sched_min_granularity */
> + u32 bl_sw_num = 3;
> +
> + if (!usf_vdev.is_sched_usf_enabled || !rq || !rq->curr ||
> + (rq->curr->pid >= PID_MAX_DEFAULT))
> + return;
> +
> + if (usf_vdev.is_screen_on) {
> + if (rq->curr->nivcsw >
> + (per_cpu(task_hist_nivcsw, cpuid)[rq->curr->pid]
> +  + bl_sw_num + 1)) {
> + (*util) += (*util) >> usf_vdev.usf_up_l0;
> + } else if (rq->curr->nivcsw <
> +(per_cpu(task_hist_nivcsw, cpuid)[rq->curr->pid]
> + + bl_sw_num - 1) && (rq->nr_running < bl_sw_num)) {
> + (*util) >>= usf_vdev.usf_down;
> + }
> + per_cpu(task_hist_nivcsw, cpuid)[rq->curr->pid] =
> + rq->curr->nivcsw;
> + } else if (rq->curr->mm) {
> + (*util) >>= usf_vdev.usf_non_ux;
> + }
> +
> + trace_sched_usf_adjust_utils(cpuid, usf_vdev.usf_up_l0,
> +  usf_vdev.usf_down,
> +  usf_vdev.usf_non_ux, *util);
> +}
> +
> +static int usf_lcd_notifier(struct notifier_block *nb,
> + unsigned long val, void *data)
> +{
> + struct fb_event *evdata = data;
> + unsigned int blank;
> +
> + if (!evdata)
> + return 0;
> +
> + if (val != FB_EVENT_BLANK)
> + return 0;
> +
> + if (evdata->data && val == FB_EVENT_BLANK) {
> + blank = *(int *)(evdata->data);
> +
> + switch (blank) {
> + case FB_BLANK_POWERDOWN:
> + usf_vdev.is_screen_on = false;
> + if (usf_vdev.sysctl_sched_usf_non_ux != 0)
> + static_branch_enable(&adjust_task_pred_set);
> + else
> + static_branch_disable(&adjust_task_pred_set);
> +
> + break;
> +
> + case FB_BLANK_UNBLANK:
> + usf_vdev.is_screen_on = true;
> + if (usf_vdev.sysctl_sched_usf_up_l0 != 0 ||
> + usf_vdev.sysctl_sched_usf_down != 0)
> + static_branch_enable(&adjust_task_pred_set);
> + else
> + static_branch_disable(&adjust_task_pred_set);
> + break;
> + default:
> + break;
> + }
> +
> + usf_vdev.is_sched_usf_enabled = true;
> + pr_info("%s : usf_vdev.is_screen_on:%b\n",
> +  __func__, usf_vdev.is_screen_on);
> + }
> + return NOTIFY_OK;
> +}
> +
> +static struct notifier_block usf_lcd_nb = {
> + .notifier_call = usf_lcd_notifier,
> + .priority = INT_MAX,
> +};
> +
> +static ssize_t store_sched_usf_up_l0_r(struct kobject *kobj,
> +struct kobj_attribute *attr,
> +const char *buf, size_t count)
> +{
> + int val = 0;
> + int ret = 0;
> +
> + ret = kstrtoint(buf, 0, &val);
> + if (ret)
> + return ret;
> +
> +

Re: [PATCH v2] media: rcar-vin: Add support to select data pins for YCbCr422-8bit input

2020-08-04 Thread Lad, Prabhakar
Hi Niklas,

On Mon, Aug 3, 2020 at 8:28 PM Niklas  wrote:
>
> Hi Lad,
>
> On 2020-08-03 20:17:54 +0100, Lad, Prabhakar wrote:
> > Hi Niklas,
> >
> > Thank you for the review.
> >
> > On Mon, Aug 3, 2020 at 7:06 PM Niklas  wrote:
> > >
> > > Hi Lad,
> > >
> > > Thanks for your work.
> > >
> > > On 2020-08-03 17:02:53 +0100, Lad Prabhakar wrote:
> > > > Select the data pins for YCbCr422-8bit input format depending on
> > > > bus_width and data_shift passed as part of DT.
> > > >
> > > > Signed-off-by: Lad Prabhakar 
> > > > Reviewed-by: Biju Das 
> > > > ---
> > > > Changes for v2:
> > > > * Dropped DT binding documentation patch
> > > > * Select the data pins depending on bus-width and data-shift
> > >
> > > I like this v2 much better then v1, nice work!
> > >
> > > >
> > > > v1 -
> > > > https://patchwork.kernel.org/project/linux-renesas-soc/list/?series=323799
> > > > ---
> > > >  drivers/media/platform/rcar-vin/rcar-core.c | 5 +
> > > >  drivers/media/platform/rcar-vin/rcar-dma.c  | 7 +++
> > > >  drivers/media/platform/rcar-vin/rcar-vin.h  | 5 +
> > > >  3 files changed, 17 insertions(+)
> > > >
> > > > diff --git a/drivers/media/platform/rcar-vin/rcar-core.c 
> > > > b/drivers/media/platform/rcar-vin/rcar-core.c
> > > > index 7440c8965d27..55005d86928d 100644
> > > > --- a/drivers/media/platform/rcar-vin/rcar-core.c
> > > > +++ b/drivers/media/platform/rcar-vin/rcar-core.c
> > > > @@ -624,6 +624,11 @@ static int rvin_parallel_parse_v4l2(struct device 
> > > > *dev,
> > > >   vin->parallel = rvpe;
> > > >   vin->parallel->mbus_type = vep->bus_type;
> > > >
> > > > + /* select VInDATA[15:8] pins for YCbCr422-8bit format */
> > > > + if (vep->bus.parallel.bus_width == BUS_WIDTH_8 &&
> > > > + vep->bus.parallel.data_shift == DATA_SHIFT_8)
> > > > + vin->parallel->ycbcr_8b_g = true;
> > > > +
> > >
> > > I would store the bus_width and bus_shift values in the struct
> > > rvin_parallel_entity and evaluate them in place rater then create a flag
> > > for this specific use-case..
> > >
> > Ok will do that.
> >
> > > Also according to the documentation is the check correct? Do we not wish
> > > to use the new mode when bus_width == 16 and bus_shift == 8. The check
> > > you have here seems to describe a 8 lane bus where 0 lanes are used.
> > >
> > bus-width is the actual data lines used, so bus_width == 16 and
> > bus_shift == 8 would mean use lines 23:8, so just check for bus_width
> > == 8 and bus_shift == 8 should be sufficient.
>
> As you and Geert points out I was wrong, they should indeed both be 8.
>
> >
> > > I think you should also verify that bus_shift is either 0 or 8 as that
> > > is all the driver supports.
> > >
> > Not sure if thats correct.In that case this patch wont make sense, I
> > believed we agreed upon we determine the YDS depending on both
> > bus-width and bus-shift.
>
> I'm sorry I think I lost you :-) The driver is not capable of supporting
> bus_width = 8 and bus_shift = 2 right? Maybe we are talking about
> different things.
>
> What I tried to say (updated with the knowledge of that bus_width should
> indeed be 8 and not 16) was that would it make sens to with bus_width=8
> allow for a bus_shift value other then 0 or 8? What for example would
> the driver do if the value was 2?
>
I think this should be possible but I am not sure how this will work.
For example on iWave G21D-Q7 platform with 16-bit wired bus say we
connect a 8-bit camera as below:

bus-width = 8 and bus-shift = 2
VI1_G0_B-> Not connected
VI1_G1_B-> Not connected
VI1_G2_B_16-> Connected
VI1_G3_B-> Connected
VI1_G4_B-> Connected
VI1_G5_B-> Connected
VI1_G6_B-> Connected
VI1_G7_B-> Connected
VI1_DATA7_B/VI1_B7_B_16-> Connected
VI1_DATA6_B/VI1_B6_B_16-> Connected
VI1_DATA5_B/VI1_B5_B_16-> Not connected
VI1_DATA4_B/VI1_B4_B_16-> Not connected
VI1_DATA3_B/VI1_B3_B_16-> Not connected
VI1_DATA2_B/VI1_B2_B_16-> Not connected
VI1_DATA1_B/VI1_B1_B_16-> Not connected
VI1_DATA0_B/VI1_B0_B_16-> Not connected

So in this case for 8-bit YCbCr422 format should YDS be set I am not
sure. Or is this not a valid case at all ?

Cheers,
Prabhakar

> >
> > On iWave G21D-Q7 for VI2 interface VI2_G* pins are connected to SoC
> > and for VIN3 interface Vi3_DATA* pins are connected. So in this case
> > the capture only works for VIN2 only if YDS bit is set for 8-bit 422,
> > and for VIN3 capture only works if YDS is 0
> >
> > &vin2 {
> > status = "okay";
> > pinctrl-0 = <&vin2_pins>;
> > pinctrl-names = "default";
> >
> > port {
> > #address-cells = <1>;
> > #size-cells = <0>;
> >
> > vin2ep: endpoint {
> > remote-endpoint = <&ov7725_2>;
> > bus-width = <8>;
> > data-shift = <8>;
> > };
> > };
> > };
> >
> > &vin3 {
> > status = "okay";
> > pinctrl-0 = <&vin3_pins>;
> > pinctrl-names = "default";
> >
> 

Re: [PATCH v2 2/2] memory: samsung: exynos5422-dmc: Add module param to control IRQ mode

2020-08-04 Thread Lukasz Luba

Hi Marek,

On 8/3/20 4:35 PM, Marek Szyprowski wrote:

Hi All,

On 03.08.2020 17:30, Marek Szyprowski wrote:

On 10.07.2020 21:11, Lukasz Luba wrote:

The driver can operate in two modes relaying on devfreq monitoring
mechanism which periodically checks the device status or it can use
interrupts when they are provided by loaded Device Tree. The newly
introduced module parameter can be used to choose between devfreq
monitoring and internal interrupts without modifying the Device Tree.
It also sets devfreq monitoring as default when the parameter is not set
(also the case for default when the driver is not built as a module).

Reported-by: Willy Wolff 
Signed-off-by: Lukasz Luba 


I've got back from my holidays and noticed that in meantime this
commit got merged as commit 4fc9a0470d2d. It revealed that there is a
race between registering exynos5422-dmc driver and exynos-ppmu driver,
which can be observed sometimes as the following message and freeze on
Odroid XU3 with multi_v7_defconfig:

[    8.767708] exynos5-dmc 10c2.memory-controller: couldn't probe
performance counters

I will check this later why the EPROBE_DEFER error is not properly
propagated and why it causes a freeze.


It looks that simply propagating return value from
exynos5_counters_get() in exynos5_dmc_get_status() fixes the boot:

# dmesg | grep dmc
[    8.838754] exynos-ppmu: new PPMU device registered 10d0.ppmu
(ppmu-event3-dmc0_0)
[    8.861344] exynos-ppmu: new PPMU device registered 10d1.ppmu
(ppmu-event3-dmc0_1)
[    8.868488] exynos5-dmc 10c2.memory-controller: couldn't probe
performance counters
[    8.874417] exynos-ppmu: new PPMU device registered 10d6.ppmu
(ppmu-event3-dmc1_0)
[    8.886612] exynos-ppmu: new PPMU device registered 10d7.ppmu
(ppmu-event3-dmc1_1)
[    9.396769] exynos5-dmc 10c2.memory-controller: DMC initialized,
in irq mode: 0

I'm still curious why it freezes if getting performance counters is not
possible.

Best regards



Thank you for investigating this issue. Indeed, it's odd why it freezes.
I've seen you patch with the fix.

Regards,
Lukasz


[PATCH v5 03/12] ASoC: qcom: lpass-platform: Replace card->dev with component->dev

2020-08-04 Thread Rohit kumar
From: Ajit Pandey 

We are allocating dma memory for component->dev but trying to mmap
such memory for substream->pcm->card->dev. Replace device argument
in mmap with component->dev to fix this.

Signed-off-by: Ajit Pandey 
Signed-off-by: Rohit kumar 
Reviewed-by: Srinivas Kandagatla 
---
 sound/soc/qcom/lpass-platform.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 01179bc..3697f4e 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -400,9 +400,8 @@ static int lpass_platform_pcmops_mmap(struct 
snd_soc_component *component,
 {
struct snd_pcm_runtime *runtime = substream->runtime;
 
-   return dma_mmap_coherent(substream->pcm->card->dev, vma,
-   runtime->dma_area, runtime->dma_addr,
-   runtime->dma_bytes);
+   return dma_mmap_coherent(component->dev, vma, runtime->dma_area,
+runtime->dma_addr, runtime->dma_bytes);
 }
 
 static irqreturn_t lpass_dma_interrupt_handler(
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v5 01/12] ASoC: qcom: Add common array to initialize soc based core clocks

2020-08-04 Thread Rohit kumar
From: Ajit Pandey 

LPASS variants have their own soc specific clocks that needs to be
enabled for MI2S audio support. Added a common variable in drvdata to
initialize such clocks using bulk clk api. Such clock names is
defined in variants specific data and needs to fetched during init.

Signed-off-by: Ajit Pandey 
Signed-off-by: Rohit kumar 
Reviewed-by: Srinivas Kandagatla 
---
 sound/soc/qcom/lpass-apq8016.c | 39 +++
 sound/soc/qcom/lpass.h | 10 +++---
 2 files changed, 26 insertions(+), 23 deletions(-)

diff --git a/sound/soc/qcom/lpass-apq8016.c b/sound/soc/qcom/lpass-apq8016.c
index b3610d0..8210e37 100644
--- a/sound/soc/qcom/lpass-apq8016.c
+++ b/sound/soc/qcom/lpass-apq8016.c
@@ -161,32 +161,27 @@ static int apq8016_lpass_free_dma_channel(struct 
lpass_data *drvdata, int chan)
 static int apq8016_lpass_init(struct platform_device *pdev)
 {
struct lpass_data *drvdata = platform_get_drvdata(pdev);
+   struct lpass_variant *variant = drvdata->variant;
struct device *dev = &pdev->dev;
-   int ret;
+   int ret, i;
 
-   drvdata->pcnoc_mport_clk = devm_clk_get(dev, "pcnoc-mport-clk");
-   if (IS_ERR(drvdata->pcnoc_mport_clk)) {
-   dev_err(dev, "error getting pcnoc-mport-clk: %ld\n",
-   PTR_ERR(drvdata->pcnoc_mport_clk));
-   return PTR_ERR(drvdata->pcnoc_mport_clk);
-   }
 
-   ret = clk_prepare_enable(drvdata->pcnoc_mport_clk);
+   drvdata->clks = devm_kcalloc(dev, variant->num_clks,
+sizeof(*drvdata->clks), GFP_KERNEL);
+   drvdata->num_clks = variant->num_clks;
+
+   for (i = 0; i < drvdata->num_clks; i++)
+   drvdata->clks[i].id = variant->clk_name[i];
+
+   ret = devm_clk_bulk_get(dev, drvdata->num_clks, drvdata->clks);
if (ret) {
-   dev_err(dev, "Error enabling pcnoc-mport-clk: %d\n", ret);
+   dev_err(dev, "Failed to get clocks %d\n", ret);
return ret;
}
 
-   drvdata->pcnoc_sway_clk = devm_clk_get(dev, "pcnoc-sway-clk");
-   if (IS_ERR(drvdata->pcnoc_sway_clk)) {
-   dev_err(dev, "error getting pcnoc-sway-clk: %ld\n",
-   PTR_ERR(drvdata->pcnoc_sway_clk));
-   return PTR_ERR(drvdata->pcnoc_sway_clk);
-   }
-
-   ret = clk_prepare_enable(drvdata->pcnoc_sway_clk);
+   ret = clk_bulk_prepare_enable(drvdata->num_clks, drvdata->clks);
if (ret) {
-   dev_err(dev, "Error enabling pcnoc_sway_clk: %d\n", ret);
+   dev_err(dev, "apq8016 clk_enable failed\n");
return ret;
}
 
@@ -197,8 +192,7 @@ static int apq8016_lpass_exit(struct platform_device *pdev)
 {
struct lpass_data *drvdata = platform_get_drvdata(pdev);
 
-   clk_disable_unprepare(drvdata->pcnoc_mport_clk);
-   clk_disable_unprepare(drvdata->pcnoc_sway_clk);
+   clk_bulk_disable_unprepare(drvdata->num_clks, drvdata->clks);
 
return 0;
 }
@@ -219,6 +213,11 @@ static struct lpass_variant apq8016_data = {
.wrdma_reg_stride   = 0x1000,
.wrdma_channel_start= 5,
.wrdma_channels = 2,
+   .clk_name   = (const char*[]) {
+  "pcnoc-mport-clk",
+  "pcnoc-sway-clk",
+ },
+   .num_clks   = 2,
.dai_driver = apq8016_lpass_cpu_dai_driver,
.num_dai= ARRAY_SIZE(apq8016_lpass_cpu_dai_driver),
.dai_osr_clk_names  = (const char *[]) {
diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h
index bd19ec5..450020e 100644
--- a/sound/soc/qcom/lpass.h
+++ b/sound/soc/qcom/lpass.h
@@ -51,9 +51,9 @@ struct lpass_data {
/* used it for handling interrupt per dma channel */
struct snd_pcm_substream *substream[LPASS_MAX_DMA_CHANNELS];
 
-   /* 8016 specific */
-   struct clk *pcnoc_mport_clk;
-   struct clk *pcnoc_sway_clk;
+   /* SOC specific clock list */
+   struct clk_bulk_data *clks;
+   int num_clks;
 
 };
 
@@ -89,6 +89,10 @@ struct lpass_variant {
int num_dai;
const char * const *dai_osr_clk_names;
const char * const *dai_bit_clk_names;
+
+   /* SOC specific clocks configuration */
+   const char **clk_name;
+   int num_clks;
 };
 
 /* register the platform driver from the CPU DAI driver */
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v5 02/12] ASoC: qcom: lpass-cpu: Move ahbix clk to platform specific function

2020-08-04 Thread Rohit kumar
Ahbix clock is optional clock and not needed for all platforms.
Move it to lpass-apq8016/ipq806x as it is not needed for sc7180.

Signed-off-by: Rohit kumar 
Reviewed-by: Srinivas Kandagatla 
---
 sound/soc/qcom/lpass-apq8016.c | 27 ++
 sound/soc/qcom/lpass-cpu.c | 40 ++-
 sound/soc/qcom/lpass-ipq806x.c | 43 ++
 3 files changed, 80 insertions(+), 30 deletions(-)

diff --git a/sound/soc/qcom/lpass-apq8016.c b/sound/soc/qcom/lpass-apq8016.c
index 8210e37..fe4c258 100644
--- a/sound/soc/qcom/lpass-apq8016.c
+++ b/sound/soc/qcom/lpass-apq8016.c
@@ -185,7 +185,33 @@ static int apq8016_lpass_init(struct platform_device *pdev)
return ret;
}
 
+   drvdata->ahbix_clk = devm_clk_get(dev, "ahbix-clk");
+   if (IS_ERR(drvdata->ahbix_clk)) {
+   dev_err(dev, "error getting ahbix-clk: %ld\n",
+   PTR_ERR(drvdata->ahbix_clk));
+   ret = PTR_ERR(drvdata->ahbix_clk);
+   goto err_ahbix_clk;
+   }
+
+   ret = clk_set_rate(drvdata->ahbix_clk, LPASS_AHBIX_CLOCK_FREQUENCY);
+   if (ret) {
+   dev_err(dev, "error setting rate on ahbix_clk: %d\n", ret);
+   goto err_ahbix_clk;
+   }
+   dev_dbg(dev, "set ahbix_clk rate to %lu\n",
+   clk_get_rate(drvdata->ahbix_clk));
+
+   ret = clk_prepare_enable(drvdata->ahbix_clk);
+   if (ret) {
+   dev_err(dev, "error enabling ahbix_clk: %d\n", ret);
+   goto err_ahbix_clk;
+   }
+
return 0;
+
+err_ahbix_clk:
+   clk_bulk_disable_unprepare(drvdata->num_clks, drvdata->clks);
+   return ret;
 }
 
 static int apq8016_lpass_exit(struct platform_device *pdev)
@@ -193,6 +219,7 @@ static int apq8016_lpass_exit(struct platform_device *pdev)
struct lpass_data *drvdata = platform_get_drvdata(pdev);
 
clk_bulk_disable_unprepare(drvdata->num_clks, drvdata->clks);
+   clk_disable_unprepare(drvdata->ahbix_clk);
 
return 0;
 }
diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index e00a4af..f0c7e93 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -566,8 +566,13 @@ int asoc_qcom_lpass_cpu_platform_probe(struct 
platform_device *pdev)
return PTR_ERR(drvdata->lpaif_map);
}
 
-   if (variant->init)
-   variant->init(pdev);
+   if (variant->init) {
+   ret = variant->init(pdev);
+   if (ret) {
+   dev_err(dev, "error initializing variant: %d\n", ret);
+   return ret;
+   }
+   }
 
for (i = 0; i < variant->num_dai; i++) {
dai_id = variant->dai_driver[i].id;
@@ -594,46 +599,22 @@ int asoc_qcom_lpass_cpu_platform_probe(struct 
platform_device *pdev)
}
}
 
-   drvdata->ahbix_clk = devm_clk_get(dev, "ahbix-clk");
-   if (IS_ERR(drvdata->ahbix_clk)) {
-   dev_err(dev, "error getting ahbix-clk: %ld\n",
-   PTR_ERR(drvdata->ahbix_clk));
-   return PTR_ERR(drvdata->ahbix_clk);
-   }
-
-   ret = clk_set_rate(drvdata->ahbix_clk, LPASS_AHBIX_CLOCK_FREQUENCY);
-   if (ret) {
-   dev_err(dev, "error setting rate on ahbix_clk: %d\n", ret);
-   return ret;
-   }
-   dev_dbg(dev, "set ahbix_clk rate to %lu\n",
-   clk_get_rate(drvdata->ahbix_clk));
-
-   ret = clk_prepare_enable(drvdata->ahbix_clk);
-   if (ret) {
-   dev_err(dev, "error enabling ahbix_clk: %d\n", ret);
-   return ret;
-   }
-
ret = devm_snd_soc_register_component(dev,
  &lpass_cpu_comp_driver,
  variant->dai_driver,
  variant->num_dai);
if (ret) {
dev_err(dev, "error registering cpu driver: %d\n", ret);
-   goto err_clk;
+   goto err;
}
 
ret = asoc_qcom_lpass_platform_register(pdev);
if (ret) {
dev_err(dev, "error registering platform driver: %d\n", ret);
-   goto err_clk;
+   goto err;
}
 
-   return 0;
-
-err_clk:
-   clk_disable_unprepare(drvdata->ahbix_clk);
+err:
return ret;
 }
 EXPORT_SYMBOL_GPL(asoc_qcom_lpass_cpu_platform_probe);
@@ -645,7 +626,6 @@ int asoc_qcom_lpass_cpu_platform_remove(struct 
platform_device *pdev)
if (drvdata->variant->exit)
drvdata->variant->exit(pdev);
 
-   clk_disable_unprepare(drvdata->ahbix_clk);
 
return 0;
 }
diff --git a/sound/soc/qcom/lpass-ipq806x.c b/sound/soc/qcom/lpass-ipq806x.c
index 1987605..b7c0586 100644
--- a/sound/soc/qcom/lpass-ipq806x.c
+++ b/sound/soc/qcom/lpass-ipq806x.c
@@ -55,6 +55,47 @@ static struct sn

[PATCH v5 00/12] ASoC: qcom: Add support for SC7180 lpass variant

2020-08-04 Thread Rohit kumar
This patch chain add audio support for SC7180 soc by doing the required
modification in existing common lpass-cpu/lpass-platform driver.
This also fixes some concurrency issue.

This patch series is already tested by Srinivas on Dragon Board 410c.
Changes since v4:
- Updated compatible string for sc7180 lpass cpu as suggested by Rob
- Addressed comments by Rob in yaml Documentation.

Ajit Pandey (4):
  ASoC: qcom: Add common array to initialize soc based core clocks
  ASoC: qcom: lpass-platform: Replace card->dev with component->dev
  include: dt-bindings: sound: Add sc7180-lpass bindings header
  ASoC: qcom: lpass-sc7180: Add platform driver for lpass audio

Rohit kumar (8):
  ASoC: qcom: lpass-cpu: Move ahbix clk to platform specific function
  ASoC: qcom: lpass-platform: fix memory leak
  ASoC: qcom: lpass: Use regmap_field for i2sctl and dmactl registers
  ASoC: qcom: lpass-cpu: fix concurrency issue
  dt-bindings: sound: lpass-cpu: Add sc7180 lpass cpu node
  ASoC: qcom: lpass-cpu: Use platform_get_resource
  ASoC: qcom: lpass-platform: Use platform_get_irq
  dt-bindings: sound: lpass-cpu: Move to yaml format

 .../devicetree/bindings/sound/qcom,lpass-cpu.txt   |  79 
 .../devicetree/bindings/sound/qcom,lpass-cpu.yaml  | 179 +
 include/dt-bindings/sound/sc7180-lpass.h   |  10 +
 sound/soc/qcom/Kconfig |   5 +
 sound/soc/qcom/Makefile|   2 +
 sound/soc/qcom/lpass-apq8016.c |  86 ++--
 sound/soc/qcom/lpass-cpu.c | 204 ++-
 sound/soc/qcom/lpass-ipq806x.c |  67 +++
 sound/soc/qcom/lpass-lpaif-reg.h   | 157 ---
 sound/soc/qcom/lpass-platform.c| 155 +++
 sound/soc/qcom/lpass-sc7180.c  | 216 +
 sound/soc/qcom/lpass.h |  63 +-
 12 files changed, 924 insertions(+), 299 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sound/qcom,lpass-cpu.txt
 create mode 100644 Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml
 create mode 100644 include/dt-bindings/sound/sc7180-lpass.h
 create mode 100644 sound/soc/qcom/lpass-sc7180.c

-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



RE: PATCH: rtsx_pci driver - don't disable the rts5229 card reader on Intel NUC boxes

2020-08-04 Thread 吳昊澄 Ricky
> -Original Message-
> From: gre...@linuxfoundation.org [mailto:gre...@linuxfoundation.org]
> Sent: Tuesday, August 04, 2020 3:49 PM
> To: 吳昊澄 Ricky
> Cc: Chris Clayton; LKML; rdun...@infradead.org; philqua...@gmail.com; Arnd
> Bergmann
> Subject: Re: PATCH: rtsx_pci driver - don't disable the rts5229 card reader on
> Intel NUC boxes
> 
> On Tue, Aug 04, 2020 at 02:44:41AM +, 吳昊澄 Ricky wrote:
> > Hi Chris,
> >
> > rtsx_pci_write_register(pcr, FPDTL, OC_POWER_DOWN, OC_POWER_DOWN);
> > This register operation saved power under 1mA, so if do not care the 1mA
> power we can have a patch to remove it, make compatible with NUC6
> > We tested others our card reader that remove it, we did not see any side 
> > effect
> >
> > Hi Greg k-h,
> >
> > Do you have any comments?
> 
> comments on what?  I don't know what you are responding to here, sorry.
> 
Can we have a patch to kernel for NUC6? It may cause more power(1mA) but it 
will have more compatibility

> greg k-h
> 
> --Please consider the environment before printing this e-mail.


[PATCH v5 07/12] dt-bindings: sound: lpass-cpu: Add sc7180 lpass cpu node

2020-08-04 Thread Rohit kumar
Add dt-bindings to support "qcom,lpass-cpu-sc7180" node.

Signed-off-by: Rohit kumar 
---
 .../devicetree/bindings/sound/qcom,lpass-cpu.txt   | 55 +-
 1 file changed, 53 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.txt 
b/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.txt
index 32c2cdb..c07202c 100644
--- a/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.txt
+++ b/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.txt
@@ -4,7 +4,8 @@ This node models the Qualcomm Technologies Low-Power Audio 
SubSystem (LPASS).
 
 Required properties:
 
-- compatible   : "qcom,lpass-cpu" or "qcom,apq8016-lpass-cpu"
+- compatible   : "qcom,lpass-cpu" or "qcom,apq8016-lpass-cpu" or
+ "qcom,sc7180-lpass-cpu"
 - clocks   : Must contain an entry for each entry in clock-names.
 - clock-names  : A list which must include the following entries:
* "ahbix-clk"
@@ -18,6 +19,13 @@ Required properties:
* "mi2s-bit-clk3"
* "pcnoc-mport-clk"
* "pcnoc-sway-clk"
+   : required clocks for "qcom,lpass-cpu-sc7180"
+   * "audio-core"
+   * "mclk0"
+   * "mi2s-bit-clk0"
+   * "mi2s-bit-clk1"
+   * "pcnoc-sway-clk"
+   * "pcnoc-mport-clk"
 
 - interrupts   : Must contain an entry for each entry in
  interrupt-names.
@@ -53,7 +61,8 @@ Required properties for each DAI (represented by a subnode):
 Note that adding a subnode changes the default to "no lines configured",
 so both playback and capture lines should be configured when a subnode is 
added.
 
-Example:
+Examples:
+1)
 
 lpass@2810 {
compatible = "qcom,lpass-cpu";
@@ -77,3 +86,45 @@ lpass@2810 {
qcom,playback-sd-lines = <0 1>;
};
 };
+
+2)
+
+#include 
+
+lpass_cpu: lpass {
+   compatible = "qcom,sc7180-lpass-cpu";
+
+   reg = <0 0x62F0 0 0x29000>;
+
+   iommus = <&apps_smmu 0x1020 0>;
+
+   power-domains = <&lpass_hm LPASS_CORE_HM_GDSCR>;
+   clocks = <&gcc GCC_LPASS_CFG_NOC_SWAY_CLK>,
+   <&lpasscorecc LPASS_AUDIO_CORE_CORE_CLK>,
+   <&lpasscorecc LPASS_AUDIO_CORE_EXT_MCLK0_CLK>,
+   <&lpasscorecc LPASS_AUDIO_CORE_SYSNOC_MPORT_CORE_CLK>,
+   <&lpasscorecc LPASS_AUDIO_CORE_LPAIF_PRI_IBIT_CLK>,
+   <&lpasscorecc LPASS_AUDIO_CORE_LPAIF_SEC_IBIT_CLK>;
+   clock-names = "pcnoc-sway-clk", "audio-core",
+   "mclk0", "pcnoc-mport-clk",
+   "mi2s-bit-clk0", "mi2s-bit-clk1";
+   interrupts = <0 160 IRQ_TYPE_LEVEL_HIGH>;
+   interrupt-names = "lpass-irq-lpaif";
+
+
+   #sound-dai-cells = <1>;
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   mi2s-primary@0 {
+   reg = ;
+   qcom,playback-sd-lines = <1>;
+   qcom,capture-sd-lines = <0>;
+   };
+
+   mi2s-secondary@1 {
+   reg = ;
+   qcom,playback-sd-lines = <0>;
+   };
+};
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v5 04/12] ASoC: qcom: lpass-platform: fix memory leak

2020-08-04 Thread Rohit kumar
lpass_pcm_data is never freed. Free it in close
ops to avoid memory leak.

Fixes: 022d00ee0b55 ("ASoC: lpass-platform: Fix broken pcm data usage")
Signed-off-by: Rohit kumar 
Reviewed-by: Srinivas Kandagatla 
---
 sound/soc/qcom/lpass-platform.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 3697f4e..315feda 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -61,7 +61,7 @@ static int lpass_platform_pcmops_open(struct 
snd_soc_component *component,
int ret, dma_ch, dir = substream->stream;
struct lpass_pcm_data *data;
 
-   data = devm_kzalloc(soc_runtime->dev, sizeof(*data), GFP_KERNEL);
+   data = kzalloc(sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;
 
@@ -118,6 +118,7 @@ static int lpass_platform_pcmops_close(struct 
snd_soc_component *component,
if (v->free_dma_channel)
v->free_dma_channel(drvdata, data->dma_ch);
 
+   kfree(data);
return 0;
 }
 
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v5 05/12] ASoC: qcom: lpass: Use regmap_field for i2sctl and dmactl registers

2020-08-04 Thread Rohit kumar
I2SCTL and DMACTL registers has different bits alignment for newer
LPASS variants of SC7180 soc. Use REG_FIELD_ID() to define the
reg_fields in platform specific file and removed shifts and mask
macros for such registers from header file.

Signed-off-by: Rohit kumar 
---
 sound/soc/qcom/lpass-apq8016.c   |  24 ++
 sound/soc/qcom/lpass-cpu.c   | 156 ++
 sound/soc/qcom/lpass-ipq806x.c   |  24 ++
 sound/soc/qcom/lpass-lpaif-reg.h | 157 +--
 sound/soc/qcom/lpass-platform.c  | 145 
 sound/soc/qcom/lpass.h   |  53 +
 6 files changed, 407 insertions(+), 152 deletions(-)

diff --git a/sound/soc/qcom/lpass-apq8016.c b/sound/soc/qcom/lpass-apq8016.c
index fe4c258..dd9e3dd 100644
--- a/sound/soc/qcom/lpass-apq8016.c
+++ b/sound/soc/qcom/lpass-apq8016.c
@@ -240,6 +240,30 @@ static struct lpass_variant apq8016_data = {
.wrdma_reg_stride   = 0x1000,
.wrdma_channel_start= 5,
.wrdma_channels = 2,
+   .loopback   = REG_FIELD_ID(0x1000, 15, 15, 4, 0x1000),
+   .spken  = REG_FIELD_ID(0x1000, 14, 14, 4, 0x1000),
+   .spkmode= REG_FIELD_ID(0x1000, 10, 13, 4, 0x1000),
+   .spkmono= REG_FIELD_ID(0x1000, 9, 9, 4, 0x1000),
+   .micen  = REG_FIELD_ID(0x1000, 8, 8, 4, 0x1000),
+   .micmode= REG_FIELD_ID(0x1000, 4, 7, 4, 0x1000),
+   .micmono= REG_FIELD_ID(0x1000, 3, 3, 4, 0x1000),
+   .wssrc  = REG_FIELD_ID(0x1000, 2, 2, 4, 0x1000),
+   .bitwidth   = REG_FIELD_ID(0x1000, 0, 0, 4, 0x1000),
+
+   .rdma_dyncclk   = REG_FIELD_ID(0x8400, 12, 12, 2, 0x1000),
+   .rdma_bursten   = REG_FIELD_ID(0x8400, 11, 11, 2, 0x1000),
+   .rdma_wpscnt= REG_FIELD_ID(0x8400, 8, 10, 2, 0x1000),
+   .rdma_intf  = REG_FIELD_ID(0x8400, 4, 7, 2, 0x1000),
+   .rdma_fifowm= REG_FIELD_ID(0x8400, 1, 3, 2, 0x1000),
+   .rdma_enable= REG_FIELD_ID(0x8400, 0, 0, 2, 0x1000),
+
+   .wrdma_dyncclk  = REG_FIELD_ID(0xB000, 12, 12, 2, 0x1000),
+   .wrdma_bursten  = REG_FIELD_ID(0xB000, 11, 11, 2, 0x1000),
+   .wrdma_wpscnt   = REG_FIELD_ID(0xB000, 8, 10, 2, 0x1000),
+   .wrdma_intf = REG_FIELD_ID(0xB000, 4, 7, 2, 0x1000),
+   .wrdma_fifowm   = REG_FIELD_ID(0xB000, 1, 3, 2, 0x1000),
+   .wrdma_enable   = REG_FIELD_ID(0xB000, 0, 0, 2, 0x1000),
+
.clk_name   = (const char*[]) {
   "pcnoc-mport-clk",
   "pcnoc-sway-clk",
diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index f0c7e93..6b86f16 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -29,6 +29,32 @@
 #define LPASS_CPU_I2S_SD0_1_2_MASK GENMASK(2, 0)
 #define LPASS_CPU_I2S_SD0_1_2_3_MASK   GENMASK(3, 0)
 
+static int lpass_cpu_init_i2sctl_bitfields(struct device *dev,
+   struct lpaif_i2sctl *i2sctl, struct regmap *map)
+{
+   struct lpass_data *drvdata = dev_get_drvdata(dev);
+   struct lpass_variant *v = drvdata->variant;
+
+   i2sctl->loopback = devm_regmap_field_alloc(dev, map, v->loopback);
+   i2sctl->spken = devm_regmap_field_alloc(dev, map, v->spken);
+   i2sctl->spkmode = devm_regmap_field_alloc(dev, map, v->spkmode);
+   i2sctl->spkmono = devm_regmap_field_alloc(dev, map, v->spkmono);
+   i2sctl->micen = devm_regmap_field_alloc(dev, map, v->micen);
+   i2sctl->micmode = devm_regmap_field_alloc(dev, map, v->micmode);
+   i2sctl->micmono = devm_regmap_field_alloc(dev, map, v->micmono);
+   i2sctl->wssrc = devm_regmap_field_alloc(dev, map, v->wssrc);
+   i2sctl->bitwidth = devm_regmap_field_alloc(dev, map, v->bitwidth);
+
+   if (IS_ERR(i2sctl->loopback) || IS_ERR(i2sctl->spken) ||
+   IS_ERR(i2sctl->spkmode) || IS_ERR(i2sctl->spkmono) ||
+   IS_ERR(i2sctl->micen) || IS_ERR(i2sctl->micmode) ||
+   IS_ERR(i2sctl->micmono) || IS_ERR(i2sctl->wssrc) ||
+   IS_ERR(i2sctl->bitwidth))
+   return -EINVAL;
+
+   return 0;
+}
+
 static int lpass_cpu_daiops_set_sysclk(struct snd_soc_dai *dai, int clk_id,
unsigned int freq, int dir)
 {
@@ -79,6 +105,8 @@ static int lpass_cpu_daiops_hw_params(struct 
snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
 {
struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai);
+   struct lpaif_i2sctl *i2sctl = drvdata->i2sctl;
+   unsigned int id = dai->driver->id;
snd_pcm_format_t format = params_format(params);
unsigned int channels = params_channels(params);
unsigned int rate = params_rate(params);
@@ -92,28 +120,45 @@ static int lp

[PATCH v5 12/12] dt-bindings: sound: lpass-cpu: Move to yaml format

2020-08-04 Thread Rohit kumar
Update lpass-cpu binding with yaml formats.

Signed-off-by: Rohit kumar 
---
 .../devicetree/bindings/sound/qcom,lpass-cpu.txt   | 130 ---
 .../devicetree/bindings/sound/qcom,lpass-cpu.yaml  | 179 +
 2 files changed, 179 insertions(+), 130 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sound/qcom,lpass-cpu.txt
 create mode 100644 Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml

diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.txt 
b/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.txt
deleted file mode 100644
index c07202c..
--- a/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.txt
+++ /dev/null
@@ -1,130 +0,0 @@
-* Qualcomm Technologies LPASS CPU DAI
-
-This node models the Qualcomm Technologies Low-Power Audio SubSystem (LPASS).
-
-Required properties:
-
-- compatible   : "qcom,lpass-cpu" or "qcom,apq8016-lpass-cpu" or
- "qcom,sc7180-lpass-cpu"
-- clocks   : Must contain an entry for each entry in clock-names.
-- clock-names  : A list which must include the following entries:
-   * "ahbix-clk"
-   * "mi2s-osr-clk"
-   * "mi2s-bit-clk"
-   : required clocks for "qcom,lpass-cpu-apq8016"
-   * "ahbix-clk"
-   * "mi2s-bit-clk0"
-   * "mi2s-bit-clk1"
-   * "mi2s-bit-clk2"
-   * "mi2s-bit-clk3"
-   * "pcnoc-mport-clk"
-   * "pcnoc-sway-clk"
-   : required clocks for "qcom,lpass-cpu-sc7180"
-   * "audio-core"
-   * "mclk0"
-   * "mi2s-bit-clk0"
-   * "mi2s-bit-clk1"
-   * "pcnoc-sway-clk"
-   * "pcnoc-mport-clk"
-
-- interrupts   : Must contain an entry for each entry in
- interrupt-names.
-- interrupt-names  : A list which must include the following entries:
-   * "lpass-irq-lpaif"
-- pinctrl-N: One property must exist for each entry in
- pinctrl-names.  See ../pinctrl/pinctrl-bindings.txt
- for details of the property values.
-- pinctrl-names: Must contain a "default" entry.
-- reg  : Must contain an address for each entry in reg-names.
-- reg-names: A list which must include the following entries:
-   * "lpass-lpaif"
-- #address-cells   : Must be 1
-- #size-cells  : Must be 0
-
-
-
-Optional properties:
-
-- qcom,adsp: Phandle for the audio DSP node
-
-By default, the driver uses up to 4 MI2S SD lines, for a total of 8 channels.
-The SD lines to use can be configured by adding subnodes for each of the DAIs.
-
-Required properties for each DAI (represented by a subnode):
-- reg  : Must be one of the DAI IDs
- (usually part of dt-bindings header)
-- qcom,playback-sd-lines: List of serial data lines to use for playback
- Each SD line should be represented by a number from 
0-3.
-- qcom,capture-sd-lines: List of serial data lines to use for capture
- Each SD line should be represented by a number from 
0-3.
-
-Note that adding a subnode changes the default to "no lines configured",
-so both playback and capture lines should be configured when a subnode is 
added.
-
-Examples:
-1)
-
-lpass@2810 {
-   compatible = "qcom,lpass-cpu";
-   clocks = <&lcc AHBIX_CLK>, <&lcc MI2S_OSR_CLK>, <&lcc MI2S_BIT_CLK>;
-   clock-names = "ahbix-clk", "mi2s-osr-clk", "mi2s-bit-clk";
-   interrupts = <0 85 1>;
-   interrupt-names = "lpass-irq-lpaif";
-   pinctrl-names = "default", "idle";
-   pinctrl-0 = <&mi2s_default>;
-   pinctrl-1 = <&mi2s_idle>;
-   reg = <0x2810 0x1>;
-   reg-names = "lpass-lpaif";
-   qcom,adsp = <&adsp>;
-
-   #address-cells = <1>;
-   #size-cells = <0>;
-
-   /* Optional to set different MI2S SD lines */
-   dai@3 {
-   reg = ;
-   qcom,playback-sd-lines = <0 1>;
-   };
-};
-
-2)
-
-#include 
-
-lpass_cpu: lpass {
-   compatible = "qcom,sc7180-lpass-cpu";
-
-   reg = <0 0x62F0 0 0x29000>;
-
-   iommus = <&apps_smmu 0x1020 0>;
-
-   power-domains = <&lpass_hm LPASS_CORE_HM_GDSCR>;
-   clocks = <&gcc GCC_LPASS_CFG_NOC_SWAY_CLK>,
-   <&lpasscorecc LPASS_AUDIO_CORE_CORE_CLK>,
-   <&lpasscorecc LPASS_AUDIO_CORE_EXT_MCLK0_CLK>,
-   <&lpasscorecc LPASS_AUDIO_CORE_SYSNOC_MPORT_CORE_CLK>,
-   <&lpasscorecc

[PATCH v5 06/12] ASoC: qcom: lpass-cpu: fix concurrency issue

2020-08-04 Thread Rohit kumar
i2sctl register value is set to 0 during hw_free(). This
impacts any ongoing concurrent session on the same i2s
port. As trigger() stop already resets enable bit to 0,
there is no need of explicit hw_free. Removing it to
fix the issue.

Fixes: 80beab8e1d86 ("ASoC: qcom: Add LPASS CPU DAI driver")
Signed-off-by: Rohit kumar 
Reviewed-by: Srinivas Kandagatla 
---
 sound/soc/qcom/lpass-cpu.c | 16 
 1 file changed, 16 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 6b86f16..5d84f63 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -266,21 +266,6 @@ static int lpass_cpu_daiops_hw_params(struct 
snd_pcm_substream *substream,
return 0;
 }
 
-static int lpass_cpu_daiops_hw_free(struct snd_pcm_substream *substream,
-   struct snd_soc_dai *dai)
-{
-   struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai);
-   int ret;
-
-   ret = regmap_write(drvdata->lpaif_map,
-  LPAIF_I2SCTL_REG(drvdata->variant, dai->driver->id),
-  0);
-   if (ret)
-   dev_err(dai->dev, "error writing to i2sctl reg: %d\n", ret);
-
-   return ret;
-}
-
 static int lpass_cpu_daiops_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
 {
@@ -350,7 +335,6 @@ const struct snd_soc_dai_ops asoc_qcom_lpass_cpu_dai_ops = {
.startup= lpass_cpu_daiops_startup,
.shutdown   = lpass_cpu_daiops_shutdown,
.hw_params  = lpass_cpu_daiops_hw_params,
-   .hw_free= lpass_cpu_daiops_hw_free,
.prepare= lpass_cpu_daiops_prepare,
.trigger= lpass_cpu_daiops_trigger,
 };
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v5 11/12] ASoC: qcom: lpass-platform: Use platform_get_irq

2020-08-04 Thread Rohit kumar
platform_get_irq_byname() is used when there is list
of interrupts in the device node. As lpass-platform
has only one interrupt entry, use platform_get_irq()
instead.

Signed-off-by: Rohit kumar 
---
 sound/soc/qcom/lpass-platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 35aead1..df692ed 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -638,7 +638,7 @@ int asoc_qcom_lpass_platform_register(struct 
platform_device *pdev)
struct lpass_variant *v = drvdata->variant;
int ret;
 
-   drvdata->lpaif_irq = platform_get_irq_byname(pdev, "lpass-irq-lpaif");
+   drvdata->lpaif_irq = platform_get_irq(pdev, 0);
if (drvdata->lpaif_irq < 0)
return -ENODEV;
 
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v5 10/12] ASoC: qcom: lpass-cpu: Use platform_get_resource

2020-08-04 Thread Rohit kumar
platform_get_resource_byname() is used when there
is list of reg entries. As lpass-cpu node has only
one reg entry, use platform_get_resource() instead.

Signed-off-by: Rohit kumar 
Reviewed-by: Srinivas Kandagatla 
---
 sound/soc/qcom/lpass-cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 5d84f63..1ee6d8b 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -575,7 +575,7 @@ int asoc_qcom_lpass_cpu_platform_probe(struct 
platform_device *pdev)
 
of_lpass_cpu_parse_dai_data(dev, drvdata);
 
-   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpass-lpaif");
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
drvdata->lpaif = devm_ioremap_resource(dev, res);
if (IS_ERR((void const __force *)drvdata->lpaif)) {
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v5 09/12] ASoC: qcom: lpass-sc7180: Add platform driver for lpass audio

2020-08-04 Thread Rohit kumar
From: Ajit Pandey 

Add platform driver for configuring sc7180 lpass core I2S and
DMA configuration to support playback & capture to external codecs
connected over primary & secondary MI2S interfaces.

Signed-off-by: Ajit Pandey 
Signed-off-by: Rohit kumar 
Reviewed-by: Srinivas Kandagatla 
---
 sound/soc/qcom/Kconfig|   5 +
 sound/soc/qcom/Makefile   |   2 +
 sound/soc/qcom/lpass-sc7180.c | 216 ++
 3 files changed, 223 insertions(+)
 create mode 100644 sound/soc/qcom/lpass-sc7180.c

diff --git a/sound/soc/qcom/Kconfig b/sound/soc/qcom/Kconfig
index 5d6b246..b47d2bdd 100644
--- a/sound/soc/qcom/Kconfig
+++ b/sound/soc/qcom/Kconfig
@@ -24,6 +24,11 @@ config SND_SOC_LPASS_APQ8016
select SND_SOC_LPASS_CPU
select SND_SOC_LPASS_PLATFORM
 
+config SND_SOC_LPASS_SC7180
+   tristate
+   select SND_SOC_LPASS_CPU
+   select SND_SOC_LPASS_PLATFORM
+
 config SND_SOC_STORM
tristate "ASoC I2S support for Storm boards"
depends on SND_SOC_QCOM
diff --git a/sound/soc/qcom/Makefile b/sound/soc/qcom/Makefile
index 41b2c7a..7972c94 100644
--- a/sound/soc/qcom/Makefile
+++ b/sound/soc/qcom/Makefile
@@ -4,11 +4,13 @@ snd-soc-lpass-cpu-objs := lpass-cpu.o
 snd-soc-lpass-platform-objs := lpass-platform.o
 snd-soc-lpass-ipq806x-objs := lpass-ipq806x.o
 snd-soc-lpass-apq8016-objs := lpass-apq8016.o
+snd-soc-lpass-sc7180-objs := lpass-sc7180.o
 
 obj-$(CONFIG_SND_SOC_LPASS_CPU) += snd-soc-lpass-cpu.o
 obj-$(CONFIG_SND_SOC_LPASS_PLATFORM) += snd-soc-lpass-platform.o
 obj-$(CONFIG_SND_SOC_LPASS_IPQ806X) += snd-soc-lpass-ipq806x.o
 obj-$(CONFIG_SND_SOC_LPASS_APQ8016) += snd-soc-lpass-apq8016.o
+obj-$(CONFIG_SND_SOC_LPASS_SC7180) += snd-soc-lpass-sc7180.o
 
 # Machine
 snd-soc-storm-objs := storm.o
diff --git a/sound/soc/qcom/lpass-sc7180.c b/sound/soc/qcom/lpass-sc7180.c
new file mode 100644
index ..b4c6a04
--- /dev/null
+++ b/sound/soc/qcom/lpass-sc7180.c
@@ -0,0 +1,216 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ *
+ * lpass-sc7180.c -- ALSA SoC platform-machine driver for QTi LPASS
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "lpass-lpaif-reg.h"
+#include "lpass.h"
+
+static struct snd_soc_dai_driver sc7180_lpass_cpu_dai_driver[] = {
+   [MI2S_PRIMARY] = {
+   .id = MI2S_PRIMARY,
+   .name = "Primary MI2S",
+   .playback = {
+   .stream_name = "Primary Playback",
+   .formats= SNDRV_PCM_FMTBIT_S16,
+   .rates = SNDRV_PCM_RATE_48000,
+   .rate_min   = 48000,
+   .rate_max   = 48000,
+   .channels_min   = 2,
+   .channels_max   = 2,
+   },
+   .capture = {
+   .stream_name = "Primary Capture",
+   .formats = SNDRV_PCM_FMTBIT_S16,
+   .rates = SNDRV_PCM_RATE_48000,
+   .rate_min   = 48000,
+   .rate_max   = 48000,
+   .channels_min   = 2,
+   .channels_max   = 2,
+   },
+   .probe  = &asoc_qcom_lpass_cpu_dai_probe,
+   .ops= &asoc_qcom_lpass_cpu_dai_ops,
+   },
+
+   [MI2S_SECONDARY] = {
+   .id = MI2S_SECONDARY,
+   .name = "Secondary MI2S",
+   .playback = {
+   .stream_name = "Secondary Playback",
+   .formats= SNDRV_PCM_FMTBIT_S16,
+   .rates = SNDRV_PCM_RATE_48000,
+   .rate_min   = 48000,
+   .rate_max   = 48000,
+   .channels_min   = 2,
+   .channels_max   = 2,
+   },
+   .probe  = &asoc_qcom_lpass_cpu_dai_probe,
+   .ops= &asoc_qcom_lpass_cpu_dai_ops,
+   },
+};
+
+static int sc7180_lpass_alloc_dma_channel(struct lpass_data *drvdata,
+  int direction)
+{
+   struct lpass_variant *v = drvdata->variant;
+   int chan = 0;
+
+   if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+   chan = find_first_zero_bit(&drvdata->dma_ch_bit_map,
+   v->rdma_channels);
+
+   if (chan >= v->rdma_channels)
+   return -EBUSY;
+   } else {
+   chan = find_next_zero_bit(&drvdata->dma_ch_bit_map,
+   v->wrdma_channel_start +
+   v->wrdma_channels,
+   v->wrdma_channel_start);
+
+   if (chan >=  v->wrdma_channel_start + v->wrdma_channels)
+   return -EBUSY;
+   }
+
+   

[PATCH v5 08/12] include: dt-bindings: sound: Add sc7180-lpass bindings header

2020-08-04 Thread Rohit kumar
From: Ajit Pandey 

Add header defining dai-id and mclk id for SC7180 lpass soc.

Signed-off-by: Ajit Pandey 
Signed-off-by: Rohit kumar 
Acked-by: Rob Herring 
---
 include/dt-bindings/sound/sc7180-lpass.h | 10 ++
 1 file changed, 10 insertions(+)
 create mode 100644 include/dt-bindings/sound/sc7180-lpass.h

diff --git a/include/dt-bindings/sound/sc7180-lpass.h 
b/include/dt-bindings/sound/sc7180-lpass.h
new file mode 100644
index ..7d988f6
--- /dev/null
+++ b/include/dt-bindings/sound/sc7180-lpass.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __DT_SC7180_LPASS_H
+#define __DT_SC7180_LPASS_H
+
+#define MI2S_PRIMARY   0
+#define MI2S_SECONDARY 1
+
+#define LPASS_MCLK00
+
+#endif /* __DT_APQ8016_LPASS_H */
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



Re: linux-next: build warnings after merge of the fsinfo tree

2020-08-04 Thread David Howells
Stephen Rothwell  wrote:

> After merging the fsinfo tree, today's linux-next build (powerpc
> allyesconfig) produced these warnings:
> 
> samples/vfs/test-mntinfo.c: In function 'display_mount':
> samples/vfs/test-mntinfo.c:146:19: warning: format '%llx' expects argument of 
> type 'long long unsigned int', but argument 3 has type '__u64' {aka 'long 
> unsigned int'} [-Wformat=]
...

I've appended a patch for that.

David



Re: [PATCH] staging: Add Mediatek High Frequency Manager Framework

2020-08-04 Thread Greg Kroah-Hartman
On Tue, Aug 04, 2020 at 03:52:49PM +0800, hongxu.zhao wrote:
> Add a new sensor framework into linux kernel which can support multi client 
> request sensor data.
> There are the following features:
> 1.Ringbuffer between manager and client;
> 2.Kernel space user interface;
> 3.User space user interface with syscall;
> 4.Each client hang detect mechanism;
> 5.Polling timer management in framework no need driver concern;
> 6.Polling kthread work intergrated into a single kthread
>   worker to save system resources in framework no need driver concern;
> 7.Proc file system to show manager device and client details;
> 8.Compitable with android and widely used in many mediatek platform 
> products;
> 
> Change-Id: I6361cdc2d51de50f66eede7df099c4575e7ec473

Did you not run checkpatch.pl on this?  :)

No need for change-id here.

But, most importantly, why is this in drivers/staging?  What keeps it
from being in the "real" part of the kernel?  I need a TODO file in the
directory of the driver listing what remains to be done and who is
responsible for doing this work and reviewing patches.

Can you resend this with that file added and the Change-id removed?

Also, why not just use the IIO interface, why are you creating
yet-another api for sensors?  We already have 2, making a third seems
like something that guarantees this will never be mergable to the
correct part of the kernel.

And finally, /proc/ is not for devices, that is what sysfs is for,
please use that.

thanks,

greg k-h


Re: [PATCH v5 00/16] HWPOISON: soft offline rework

2020-08-04 Thread osalvador

On 2020-08-04 03:49, Qian Cai wrote:


Well, each iteration will mmap/munmap, so there should be no leaking.

https://gitlab.com/cailca/linux-mm/-/blob/master/random.c#L376

It also seem to me madvise(MADV_SOFT_OFFLINE) does start to fragment 
memory
somehow, because after this "madvise: Cannot allocate memory" happened, 
I
immediately checked /proc/meminfo and then found no hugepage usage at 
all.


Unfortunately I will be off for a week, but out of curiosity, could you 
try out with below tree [1] and see if you still see those issues?


Thanks for your time

[1] https://github.com/leberus/linux-mm-1/tree/hwpoison





Re: [PATCH] ASoC: fsl_sai: Clean code for synchronize mode

2020-08-04 Thread Nicolin Chen
On Tue, Aug 04, 2020 at 03:53:51PM +0800, Shengjiu Wang wrote:

> > > /* Check if the opposite FRDE is also disabled */
> > > regmap_read(sai->regmap, FSL_SAI_xCSR(!tx, ofs), &xcsr);
> > > +   if (sai->synchronous[tx] && !sai->synchronous[!tx] && 
> > > !(xcsr & FSL_SAI_CSR_FRDE))
> > > +   fsl_sai_config_disable(sai, !tx);
> >
> > > +   if (sai->synchronous[tx] || !sai->synchronous[!tx] || 
> > > !(xcsr & FSL_SAI_CSR_FRDE))
> > > +   fsl_sai_config_disable(sai, tx);
> >
> > The first "||" should probably be "&&".
> 
> No. it is !(!sai->synchronous[tx] && sai->synchronous[!tx] && (xcsr &
> FSL_SAI_CSR_FRDE))
> so then convert to
> (sai->synchronous[tx] || !sai->synchronous[!tx] || !(xcsr & FSL_SAI_CSR_FRDE))
> 
> if change to &&, then it won't work for:
> sai->synchronous[tx] = false, sai->synchronous[!tx]=false.

Ahh..probably should be
if (!(sync[dir] && !sync[adir]) || !frde)

I have a (seemingly) correct version in my sample code.

And...please untangle the logic using the given example -- adding
helper function(s) and comments. And, though the driver does have
places using array[tx] and array[!tx], better not to use any more
boolean type variable as an array index, as it's hard to read.


Re: PATCH: rtsx_pci driver - don't disable the rts5229 card reader on Intel NUC boxes

2020-08-04 Thread gre...@linuxfoundation.org
On Tue, Aug 04, 2020 at 08:08:10AM +, 吳昊澄 Ricky wrote:
> > -Original Message-
> > From: gre...@linuxfoundation.org [mailto:gre...@linuxfoundation.org]
> > Sent: Tuesday, August 04, 2020 3:49 PM
> > To: 吳昊澄 Ricky
> > Cc: Chris Clayton; LKML; rdun...@infradead.org; philqua...@gmail.com; Arnd
> > Bergmann
> > Subject: Re: PATCH: rtsx_pci driver - don't disable the rts5229 card reader 
> > on
> > Intel NUC boxes
> > 
> > On Tue, Aug 04, 2020 at 02:44:41AM +, 吳昊澄 Ricky wrote:
> > > Hi Chris,
> > >
> > > rtsx_pci_write_register(pcr, FPDTL, OC_POWER_DOWN, OC_POWER_DOWN);
> > > This register operation saved power under 1mA, so if do not care the 1mA
> > power we can have a patch to remove it, make compatible with NUC6
> > > We tested others our card reader that remove it, we did not see any side 
> > > effect
> > >
> > > Hi Greg k-h,
> > >
> > > Do you have any comments?
> > 
> > comments on what?  I don't know what you are responding to here, sorry.
> > 
> Can we have a patch to kernel for NUC6? It may cause more power(1mA)
> but it will have more compatibility

I do not understand at all, sorry.

greg k-h


RE: [EXT] Re: [PATCH v4 2/2] net: dsa: ocelot: Add support for QinQ Operation

2020-08-04 Thread Hongbo Wang
> > This featue can be test using network test tools
> 
> mispelled: feature, can be used to test network test tools? or can be used to
> exercise network test tool?

when testing this feature, I need network tool to send packet with VLAN tag(pcp 
proto and vid), I will change it to avoid ambiguity.

> 
> >   struct ocelot *ocelot = ds->priv;
> > + struct ocelot_port *ocelot_port = ocelot->ports[port];
> >   u16 vid;
> >   int err;
> >
> > + if (vlan->proto == ETH_P_8021AD) {
> > + ocelot->enable_qinq = false;
> > + ocelot_port->qinq_mode = false;
> > + }
> 
> You need the delete part to be reference counted, otherwise the first 802.1AD
> VLAN delete request that comes in, regardless of whether other 802.1AD VLAN
> entries are installed will disable qinq_mode and enable_qinq for the entire
> port and switch, that does not sound like what you want.

I will add reference count in next version.
maybe I can disable qinq_mode and enable_qinq only when deleting pvid 1, I will 
test and change it.

> 
> Is not ocelot->enable_qinq the logical or of all ocelo_port instances's
> qinq_mode as well?

enable_qinq is flag of switch, and qinq_mode is flag of single port,
if switch is in working in QinQ mode, some ports that linked to ISP networking 
should enable qinq_mode,
other ports that linked to customer networking don't need set qinq_mode. these 
two types of port have different action.

> >   else
> >   /* Tag all frames */
> >   val = REW_TAG_CFG_TAG_CFG(3);
> > +
> > + if (ocelot_port->qinq_mode)
> > + tag_tpid = REW_TAG_CFG_TAG_TPID_CFG(1);
> > + else
> > + tag_tpid = REW_TAG_CFG_TAG_TPID_CFG(0);
> >   } else {
> > - /* Port tagging disabled. */
> > - val = REW_TAG_CFG_TAG_CFG(0);
> > + if (ocelot_port->qinq_mode) {
> > + if (ocelot_port->vid)
> > + val = REW_TAG_CFG_TAG_CFG(1);
> > + else
> > + val = REW_TAG_CFG_TAG_CFG(3);
> > +> +  tag_tpid = REW_TAG_CFG_TAG_TPID_CFG(1);
> 
> This is nearly the same branch as the one above, can you merge the conditions
> vlan_aware || qinq_mode and just set an appropriate TAG_CFG() register value
> based on either booleans?

this feature needs vlan_filter=1, so the branch if (vlan_filter == 0 && 
qinq_mode) can be deleted now.
I will optimize the related code.

> 
> Are you also not possibly missing a if (untaged || qinq_mode) check in
> ocelot_vlan_add() to call into ocelot_port_set_native_vlan()?

The qinq_mode action can be triggered by ocelot_port_vlan_filtering, so don't 
need if (untagged || qinq_mode).

Thanks!
Hongbo



Re: [v2,3/6] dt-binding: reset-controller: ti: add generic-reset to compatible

2020-08-04 Thread Philipp Zabel
On Mon, 2020-08-03 at 14:15 +0800, Crystal Guo wrote:
> The TI syscon reset controller provides a common reset management,
> and should be suitable for other SOCs. Add compatible "generic-reset",
> which denotes to use a common reset-controller driver.
> 
> Signed-off-by: Crystal Guo 
> ---
>  Documentation/devicetree/bindings/reset/ti-syscon-reset.txt | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/reset/ti-syscon-reset.txt 
> b/Documentation/devicetree/bindings/reset/ti-syscon-reset.txt
> index d551161ae785..e36d3631eab2 100644
> --- a/Documentation/devicetree/bindings/reset/ti-syscon-reset.txt
> +++ b/Documentation/devicetree/bindings/reset/ti-syscon-reset.txt
> @@ -25,6 +25,7 @@ Required properties:
>   "ti,k2l-pscrst"
>   "ti,k2hk-pscrst"
>   "ti,syscon-reset"
> + "generic-reset", "ti,syscon-reset"
>   - #reset-cells  : Should be 1. Please see the reset consumer 
> node below
> for usage details
>   - ti,reset-bits : Contains the reset control register information
> -- 
> 2.18.0

My understanding is that it would be better to add a mtk specific
compatible instead of adding this "generic-reset", especially since we
can't guarantee this binding will be considered generic in the future.
I think there is nothing wrong with specifying
compatible = "mtk,your-compatible", "ti,syscon-reset";
in your device tree if your hardware is indeed compatible with the
specified "ti,syscon-reset" binding, but I may be wrong: Therefore,
please add devicet...@vger.kernel.org to Cc: for binding changes.

regards
Philipp


Re: [PATCH v2 1/4] dt-bindings: media: i2c: ov5640: Document bus-type property

2020-08-04 Thread Sakari Ailus
Hi Prabhakar,

Thanks for the update.

On Mon, Aug 03, 2020 at 03:31:44PM +0100, Lad Prabhakar wrote:
> Document the possible bus-type's supported by the OV5640 sensor driver.
> 
> Also add the bus-type in example node.
> 
> Signed-off-by: Lad Prabhakar 
> ---
>  Documentation/devicetree/bindings/media/i2c/ov5640.txt | 9 -
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/media/i2c/ov5640.txt 
> b/Documentation/devicetree/bindings/media/i2c/ov5640.txt
> index c97c2f2da12d..00131dbb147e 100644
> --- a/Documentation/devicetree/bindings/media/i2c/ov5640.txt
> +++ b/Documentation/devicetree/bindings/media/i2c/ov5640.txt
> @@ -36,9 +36,15 @@ Endpoint node required properties for parallel connection 
> are:
>  - data-shift: shall be set to <2> for 8 bits parallel bus
> (lines 9:2 are used) or <0> for 10 bits parallel bus
>  - hsync-active: active state of the HSYNC signal, 0/1 for LOW/HIGH 
> respectively.
> + (Required for bus-type 5)
>  - vsync-active: active state of the VSYNC signal, 0/1 for LOW/HIGH 
> respectively.
> + (Required for bus-type 5)
>  - pclk-sample: sample data on rising (1) or falling (0) edge of the pixel 
> clock
> -signal.
> +signal. (Required for bus-type 5)
> +- bus-type: data bus type. Possible values are:
> + 4 - MIPI CSI-2 D-PHY
> + 5 - Parallel
> + 6 - Bt.656

This is under required parallel properties. You could document value 4
under CSI-2 related properties.

>  
>  Examples:
>  
> @@ -86,6 +92,7 @@ Examples:
>   hsync-active = <0>;
>   vsync-active = <0>;
>   pclk-sample = <1>;
> + bus-type = <5>;
>   };
>   };
>   };

-- 
Regards,

Sakari Ailus


Re: [PATCH 5.7 000/121] 5.7.13-rc2 review

2020-08-04 Thread Naresh Kamboju
On Tue, 4 Aug 2020 at 13:03, Greg Kroah-Hartman
 wrote:
>
> This is the start of the stable review cycle for the 5.7.13 release.
> There are 121 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
>
> Responses should be made by Thu, 06 Aug 2020 07:23:45 +.
> Anything received after that time might be too late.
>
> The whole patch series can be found in one patch at:
> 
> https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.7.13-rc2.gz
> or in the git tree and branch at:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
> linux-5.7.y
> and the diffstat can be found below.
>
> thanks,
>
> greg k-h

arm64 build broken.

make -sk KBUILD_BUILD_USER=TuxBuild -C/linux -j16 ARCH=arm64
CROSS_COMPILE=aarch64-linux-gnu- HOSTCC=gcc CC="sccache
aarch64-linux-gnu-gcc" O=build Image
#
In file included from ../include/linux/smp.h:67,
 from ../include/linux/percpu.h:7,
 from ../include/linux/prandom.h:12,
 from ../include/linux/random.h:118,
 from ../arch/arm64/include/asm/pointer_auth.h:6,
 from ../arch/arm64/include/asm/processor.h:39,
 from ../include/linux/mutex.h:19,
 from ../include/linux/kernfs.h:12,
 from ../include/linux/sysfs.h:16,
 from ../include/linux/kobject.h:20,
 from ../include/linux/of.h:17,
 from ../include/linux/irqdomain.h:35,
 from ../include/linux/acpi.h:13,
 from ../include/acpi/apei.h:9,
 from ../include/acpi/ghes.h:5,
 from ../include/linux/arm_sdei.h:8,
 from ../arch/arm64/kernel/asm-offsets.c:10:
../arch/arm64/include/asm/smp.h:100:29: error: field ‘ptrauth_key’ has
incomplete type
  100 |  struct ptrauth_keys_kernel ptrauth_key;
  | ^~~
make[2]: *** [../scripts/Makefile.build:100:
arch/arm64/kernel/asm-offsets.s] Error 1

-- 
Linaro LKFT
https://lkft.linaro.org


Re: [PATCH v2 4/4] media: i2c: ov5640: Fallback to parallel mode

2020-08-04 Thread Sakari Ailus
Hi Prabhakar,

On Mon, Aug 03, 2020 at 03:31:47PM +0100, Lad Prabhakar wrote:
> Fallback to parallel mode if bus_type doesn't match the supported
> interfaces by the driver.
> 
> Signed-off-by: Lad Prabhakar 
> ---
>  drivers/media/i2c/ov5640.c | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
> index 08c67250042f..4e88b0540740 100644
> --- a/drivers/media/i2c/ov5640.c
> +++ b/drivers/media/i2c/ov5640.c
> @@ -3074,6 +3074,12 @@ static int ov5640_probe(struct i2c_client *client)
>   return ret;
>   }
>  
> + /* fallback to parallel mode */
> + if (sensor->ep.bus_type != V4L2_MBUS_PARALLEL &&
> + sensor->ep.bus_type != V4L2_MBUS_CSI2_DPHY &&
> + sensor->ep.bus_type != V4L2_MBUS_BT656)
> + sensor->ep.bus_type = V4L2_MBUS_PARALLEL;

You basically need the type from the v4l2_fwnode_endpoint_parse(), and if
you don't have any of the above bus types, probe should fail. The old
bindings were documented in a way that either parallel or CSI-2 bus will be
used, and there were no defaults. So all should be well.

-- 
Sakari Ailus


[PATCH] memory: jz4780-nemc: Fix return value check in jz4780_nemc_probe()

2020-08-04 Thread Wei Yongjun
In case of error, the function devm_ioremap() returns NULL pointer not
ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.

Fixes: f046e4a3f0b9 ("memory: jz4780_nemc: Only request IO memory the driver 
will use")
Reported-by: Hulk Robot 
Signed-off-by: Wei Yongjun 
---
 drivers/memory/jz4780-nemc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/memory/jz4780-nemc.c b/drivers/memory/jz4780-nemc.c
index 3ec5cb0fce1e..608ae925e641 100644
--- a/drivers/memory/jz4780-nemc.c
+++ b/drivers/memory/jz4780-nemc.c
@@ -304,9 +304,9 @@ static int jz4780_nemc_probe(struct platform_device *pdev)
}
 
nemc->base = devm_ioremap(dev, res->start, NEMC_REG_LEN);
-   if (IS_ERR(nemc->base)) {
+   if (!nemc->base) {
dev_err(dev, "failed to get I/O memory\n");
-   return PTR_ERR(nemc->base);
+   return -ENOMEM;
}
 
writel(0, nemc->base + NEMC_NFCSR);





Re: [PATCH 5.7 000/121] 5.7.13-rc2 review

2020-08-04 Thread Greg Kroah-Hartman
On Tue, Aug 04, 2020 at 01:46:31PM +0530, Naresh Kamboju wrote:
> On Tue, 4 Aug 2020 at 13:03, Greg Kroah-Hartman
>  wrote:
> >
> > This is the start of the stable review cycle for the 5.7.13 release.
> > There are 121 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> >
> > Responses should be made by Thu, 06 Aug 2020 07:23:45 +.
> > Anything received after that time might be too late.
> >
> > The whole patch series can be found in one patch at:
> > 
> > https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.7.13-rc2.gz
> > or in the git tree and branch at:
> > 
> > git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
> > linux-5.7.y
> > and the diffstat can be found below.
> >
> > thanks,
> >
> > greg k-h
> 
> arm64 build broken.
> 
> make -sk KBUILD_BUILD_USER=TuxBuild -C/linux -j16 ARCH=arm64
> CROSS_COMPILE=aarch64-linux-gnu- HOSTCC=gcc CC="sccache
> aarch64-linux-gnu-gcc" O=build Image
> #
> In file included from ../include/linux/smp.h:67,
>  from ../include/linux/percpu.h:7,
>  from ../include/linux/prandom.h:12,
>  from ../include/linux/random.h:118,
>  from ../arch/arm64/include/asm/pointer_auth.h:6,
>  from ../arch/arm64/include/asm/processor.h:39,
>  from ../include/linux/mutex.h:19,
>  from ../include/linux/kernfs.h:12,
>  from ../include/linux/sysfs.h:16,
>  from ../include/linux/kobject.h:20,
>  from ../include/linux/of.h:17,
>  from ../include/linux/irqdomain.h:35,
>  from ../include/linux/acpi.h:13,
>  from ../include/acpi/apei.h:9,
>  from ../include/acpi/ghes.h:5,
>  from ../include/linux/arm_sdei.h:8,
>  from ../arch/arm64/kernel/asm-offsets.c:10:
> ../arch/arm64/include/asm/smp.h:100:29: error: field ‘ptrauth_key’ has
> incomplete type
>   100 |  struct ptrauth_keys_kernel ptrauth_key;
>   | ^~~
> make[2]: *** [../scripts/Makefile.build:100:
> arch/arm64/kernel/asm-offsets.s] Error 1

Wow that was fast :(

So Linus's tree is also broken here.  I think it's time I just removed
all of these patches from now until we get this all fixed up properly...

thanks,

greg k-h


Re: [PATCH v5 2/2] iio: light: as73211: New driver

2020-08-04 Thread Andy Shevchenko
On Tue, Aug 4, 2020 at 10:42 AM Christian Eggers  wrote:
> On Sunday, 2 August 2020, 20:02:35 CEST, Andy Shevchenko wrote:
> > On Sun, Aug 2, 2020 at 7:40 PM Christian Eggers  wrote:

...

> > > Datasheet:
> > > https://ams.com/documents/20143/36005/AS73211_DS000556_3-01.pdf/a65474c0-
> > > b302-c2fd-e30a-c98df87616df
> > Do we need the UUID after the document file name?
> I have send AMS an inquiry. Not sure whether I will get an answer. I will wait
> a few days until sending v6.

I have successfully opened a document w/o additional UUID at the end of URI.
I think you may drop it.

...

> > > +#define AS73211_OFFSET_TEMP (-66.9)
> > > +#define AS73211_SCALE_TEMP  0.05
> >
> > In the kernel we don't do float arithmetic. How these are being used?
> Does this restriction also apply for compile time constants? I am quite
> sure that all calculations using these defines will be evaluated at compile
> time. If found a number of other places where probably the same is done:
>
> find . -name '*.c' | xargs grep "#define.*[0-9]\.[0-9]" | grep -v '"' | grep 
> -v "\/\*.*[0-9]\.[0-9]"

Side note: `git grep ...` is much faster and better.
% git grep -n -w '#define[^"/]\+[0-9]\+\.[0-9]\+' -- drivers/ include/
arch/ | wc -l
47

+ DRM, yes.

In any case...

> > > +   *val2 = (AS73211_OFFSET_TEMP - (int)AS73211_OFFSET_TEMP) *
> > > 100;
> > >
> > > +   *val2 = (AS73211_SCALE_TEMP -
> > > (int)AS73211_SCALE_TEMP) * 100;
> > Magic 100 multiplier.
> I think that in the context of IIO_VAL_INT_PLUS_MICRO this isn't quite magic. 
> Using
> 100 directly seems quite usual:
>
> find drivers/iio/ -type f | xargs grep "val2 = .*100"

Hmm... Okay.

> > I think here you got them always 0. And to fix that you need to
> > redefine (with also units included in the name) above constants like
> > #define ..._OFFSET_TEMP_mC 66500
> > ... _SCALE_TEMP_?? 50
> a scale factor has no unit
>
> >
> > Consider to use definitions from
> > https://elixir.bootlin.com/linux/latest/source/include/linux/units.h
> There are only definition for milli celsius. For IIO_VAL_INT_PLUS_MICRO I 
> would
> require micro celsius.
>
> If I have the freedom, I would keep it as it is. Else I would suggest the 
> following:
> #define AS73211_OFFSET_TEMP_INT (-66)
> #define AS73211_OFFSET_TEMP_MICRO 90
> #define AS73211_SCALE_TEMP_INT 0
> #define AS73211_SCALE_TEMP_MICRO 5

...somewhat like above would be better. But your freedom is defined by
maintainers (not by me), so wait for their comments.

...

> > > +   }}
> > > +
> > > +   return -EINVAL;
> >
> > Make it default case.
> changed. Is there any benefit? My IDE's syntax checker now complains
> "No return, in a function returning non-void". But gcc is happy with this.

Your IDE is buggy :-)
Yes, there is a benefit of doing this, at some point compiler
complains about switches that don't cover all cases.

...

> > > +   ret = devm_iio_device_register(dev, indio_dev);
> > > +   if (ret < 0)
> > > +   return ret;
> > > +
> > > +   return 0;
> >
> >   return devm_iio_device_register();
> changed. I prefer the original pattern as it would produce less changed lines
> if something needs to inserted later.

But if not, it will be a bulk of several lines of code which is the
bait for all kinds of janitors and clean up scripts (I saw that IRL,
so it's not unrealistic). In that case it will be twice the churn.

-- 
With Best Regards,
Andy Shevchenko


[GIT pull] core/entry for v5.9

2020-08-04 Thread Thomas Gleixner
Linus,

please pull the latest core/entry branch from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
core-entry-2020-08-04

up to:  3135f5b73592: entry: Correct __secure_computing() stub

Generic implementation of common syscall, interrupt and exception
entry/exit functionality based on the recent X86 effort to ensure
correctness of entry/exit vs. RCU and instrumentation.

As this functionality and the required entry/exit sequences are not
architecture specific, sharing them allows other architectures to benefit
instead of copying the same code over and over again.

This branch was kept standalone to allow others to work on it. The
conversion of x86 comes in a seperate pull request which obviously is based
on this branch.

Thanks,

tglx

-->
Ingo Molnar (1):
  entry: Correct 'noinstr' attributes

Thomas Gleixner (6):
  seccomp: Provide stub for __secure_computing()
  entry: Provide generic syscall entry functionality
  entry: Provide generic syscall exit function
  entry: Provide generic interrupt entry/exit code
  entry: Provide infrastructure for work before transitioning to guest mode
  entry: Correct __secure_computing() stub


 arch/Kconfig |   3 +
 include/linux/entry-common.h | 372 ++
 include/linux/entry-kvm.h|  80 +
 include/linux/kvm_host.h |   8 +
 include/linux/seccomp.h  |   2 +
 kernel/Makefile  |   1 +
 kernel/entry/Makefile|  13 ++
 kernel/entry/common.c| 374 +++
 kernel/entry/kvm.c   |  51 ++
 virt/kvm/Kconfig |   3 +
 10 files changed, 907 insertions(+)
 create mode 100644 include/linux/entry-common.h
 create mode 100644 include/linux/entry-kvm.h
 create mode 100644 kernel/entry/Makefile
 create mode 100644 kernel/entry/common.c
 create mode 100644 kernel/entry/kvm.c

diff --git a/arch/Kconfig b/arch/Kconfig
index 8cc35dc556c7..852a527f418f 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -27,6 +27,9 @@ config HAVE_IMA_KEXEC
 config HOTPLUG_SMT
bool
 
+config GENERIC_ENTRY
+   bool
+
 config OPROFILE
tristate "OProfile system profiling"
depends on PROFILING
diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h
new file mode 100644
index ..efebbffcd5cc
--- /dev/null
+++ b/include/linux/entry-common.h
@@ -0,0 +1,372 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __LINUX_ENTRYCOMMON_H
+#define __LINUX_ENTRYCOMMON_H
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+/*
+ * Define dummy _TIF work flags if not defined by the architecture or for
+ * disabled functionality.
+ */
+#ifndef _TIF_SYSCALL_EMU
+# define _TIF_SYSCALL_EMU  (0)
+#endif
+
+#ifndef _TIF_SYSCALL_TRACEPOINT
+# define _TIF_SYSCALL_TRACEPOINT   (0)
+#endif
+
+#ifndef _TIF_SECCOMP
+# define _TIF_SECCOMP  (0)
+#endif
+
+#ifndef _TIF_SYSCALL_AUDIT
+# define _TIF_SYSCALL_AUDIT(0)
+#endif
+
+#ifndef _TIF_PATCH_PENDING
+# define _TIF_PATCH_PENDING(0)
+#endif
+
+#ifndef _TIF_UPROBE
+# define _TIF_UPROBE   (0)
+#endif
+
+/*
+ * TIF flags handled in syscall_enter_from_usermode()
+ */
+#ifndef ARCH_SYSCALL_ENTER_WORK
+# define ARCH_SYSCALL_ENTER_WORK   (0)
+#endif
+
+#define SYSCALL_ENTER_WORK \
+   (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SECCOMP |   \
+_TIF_SYSCALL_TRACEPOINT | _TIF_SYSCALL_EMU |   \
+ARCH_SYSCALL_ENTER_WORK)
+
+/*
+ * TIF flags handled in syscall_exit_to_user_mode()
+ */
+#ifndef ARCH_SYSCALL_EXIT_WORK
+# define ARCH_SYSCALL_EXIT_WORK(0)
+#endif
+
+#define SYSCALL_EXIT_WORK  \
+   (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT |  \
+_TIF_SYSCALL_TRACEPOINT | ARCH_SYSCALL_EXIT_WORK)
+
+/*
+ * TIF flags handled in exit_to_user_mode_loop()
+ */
+#ifndef ARCH_EXIT_TO_USER_MODE_WORK
+# define ARCH_EXIT_TO_USER_MODE_WORK   (0)
+#endif
+
+#define EXIT_TO_USER_MODE_WORK \
+   (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_UPROBE |   \
+_TIF_NEED_RESCHED | _TIF_PATCH_PENDING |   \
+ARCH_EXIT_TO_USER_MODE_WORK)
+
+/**
+ * arch_check_user_regs - Architecture specific sanity check for user mode regs
+ * @regs:  Pointer to currents pt_regs
+ *
+ * Defaults to an empty implementation. Can be replaced by architecture
+ * specific code.
+ *
+ * Invoked from syscall_enter_from_user_mode() in the non-instrumentable
+ * section. Use __always_inline so the compiler cannot push it out of line
+ * and make it instrumentable.
+ */
+static __always_inline void arch_check_user_regs(struct pt_regs *regs);
+
+#ifndef arch_check_user_regs
+static __always_inline void arch_check_user_regs(struct p

[GIT pull] irq/core for v5.9

2020-08-04 Thread Thomas Gleixner
Linus,

please pull the latest irq/core branch from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq-core-2020-08-04

up to:  3d5128c1deb5: Merge tag 'irqchip-5.9' of 
git://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms into irq/core

The usual boring updates from the interrupt subsystem:

 - Infrastructure to allow building irqchip drivers as modules
 
 - Consolidation of irqchip ACPI probing

 - Removal of the EOI-preflow interrupt handler which was required for
   SPARC support and became obsolete after SPARC was converted to
   use sparse interrupts.

 - Cleanups, fixes and improvements all over the place

Thanks,

tglx

P.S.: This time there is really no new driver. Just the minimal updates to
  existing drivers to support newer chip variants.

-->
Alexandre Torgue (1):
  irqchip/stm32-exti: Map direct event to irq parent

Bartosz Golaszewski (1):
  irqchip/irq-mtk-sysirq: Replace spinlock with raw_spinlock

Claudiu Beznea (1):
  irqchip/atmel-aic5: Add support for sam9x60 rtt fixup

Fabien Dessenne (1):
  irqchip/stm32-exti: Use the hwspin_lock_timeout_in_atomic() API

Florian Fainelli (5):
  dt-bindings: interrupt-controller: Document Broadcom STB HIF L2
  dt-bindings: interrupt-controller: Document UPG auxiliary L2
  irqchip/brcmstb-l2: Match UPG_AUX_AON_INTR2 compatible
  irqchip/irq-bcm7038-l1: Allow building on ARM 32-bit
  irqchip/irq-bcm7038-l1: Guard uses of cpu_logical_map

Gustavo A. R. Silva (1):
  irqchip/imx-intmux: Use struct_size() helper in devm_kzalloc()

Huacai Chen (4):
  dt-bindings: interrupt-controller: Update Loongson HTVEC description
  irqchip/loongson-liointc: Fix misuse of gc->mask_cache
  irqchip/loongson-htvec: Support 8 groups of HT vectors
  irqchip/loongson-pch-pic: Fix the misused irq flow handler

Joakim Zhang (1):
  irqchip/imx-intmux: Implement intmux runtime power management

John Stultz (3):
  irqdomain: Export irq_domain_update_bus_token
  genirq: Export irq_chip_retrigger_hierarchy and 
irq_chip_set_vcpu_affinity_parent
  irqchip/qcom-pdc: Allow QCOM_PDC to be loadable as a permanent module

Justin Chen (2):
  irqchip/bcm7120-l2: Set controller as wake-up source
  irqchip/brcmstb-l2: Set controller as wake-up source

Kamal Dasu (1):
  irqchip/brcmstb-l2: Match HIF_SPI_INTR2 compatible

Linus Walleij (2):
  irqchip/vic: Drop cascaded intialization call
  irqchip/vic: Cut down the external API

Marc Zyngier (1):
  irqchip: Fix IRQCHIP_PLATFORM_DRIVER_* compilation by including module.h

Masahiro Yamada (1):
  irqchip/ativic32: Constify irq_domain_ops

Oscar Carter (3):
  drivers/acpi: Add new macro ACPI_DECLARE_SUBTABLE_PROBE_ENTRY
  drivers/irqchip: Use new macro ACPI_DECLARE_SUBTABLE_PROBE_ENTRY
  drivers/acpi: Remove function cast

Randy Dunlap (1):
  irqchip: irq-bcm2836.h: drop a duplicated word

Saravana Kannan (4):
  irqchip: Add IRQCHIP_PLATFORM_DRIVER_BEGIN/END and IRQCHIP_MATCH helper 
macros
  irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
  irqchip/mtk-sysirq: Convert to a platform driver
  irqchip/mtk-cirq: Convert to a platform driver

Tiezhu Yang (10):
  irqchip/ti-sci-inta: Remove dead code in ti_sci_inta_set_type()
  irqchip/ti-sci-inta: Fix return value about devm_ioremap_resource()
  irqchip/ti-sci-inta: Fix typo about MODULE_AUTHOR
  irqchip/loongson-htpic: Remove redundant kfree operation
  irqchip/loongson-htpic: Remove unneeded select of I8259
  irqchip/loongson-htvec: Fix potential resource leak
  irqchip/loongson-htvec: Check return value of 
irq_domain_translate_onecell()
  irqchip/loongson-pch-pic: Check return value of 
irq_domain_translate_twocell()
  irqchip/loongson-pch-msi: Remove unneeded variable
  irqchip/loongson-liointc: Fix potential dead lock

Valentin Schneider (2):
  sparc64: Deselect IRQ_PREFLOW_FASTEOI
  genirq: Remove preflow handler support

Wei Yongjun (2):
  irqchip/mips-gic: Make local symbols static
  irqchip/imx-intmux: Fix irqdata regs save in imx_intmux_runtime_suspend()

Zenghui Yu (4):
  genirq/irqdomain: Remove redundant NULL pointer check on fwnode
  irqchip/gic-v3: Remove unused register definition
  irqchip/gic-v4.1: Ensure accessing the correct RD when writing INVALLR
  irqchip/gic-v4.1: Use GFP_ATOMIC flag in allocate_vpe_l1_table()


 .../bindings/interrupt-controller/brcm,l2-intc.txt |   5 +-
 .../interrupt-controller/loongson,htvec.yaml   |   4 +-
 arch/sparc/Kconfig |   1 -
 drivers/irqchip/Kconfig|   3 +-
 drivers/irqchip/irq-ativic32.c |   2 +-
 drivers/irqchip/irq-atmel-aic5.c   |   8 +-
 drivers/irqchip/irq-bcm7038-l1.c   |  11 ++
 drivers/irqchip/irq-bcm7120-l2.c   |   8 +-
 drivers/i

[GIT pull] timers/core for v5.9

2020-08-04 Thread Thomas Gleixner
Linus,

please pull the latest timers/core branch from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
timers-core-2020-08-04

up to:  31cd0e119d50: timers: Recalculate next timer interrupt only when 
necessary

Time, timers and related driver updates:

 - Prevent unnecessary timer softirq invocations by extending the tracking
   of the next expiring timer in the timer wheel beyond the existing NOHZ
   functionality. The tracking overhead at enqueue time is within the
   noise, but on sensitive workloads the avoidance of the soft interrupt
   invocation is a measurable improvement.

 - The obligatory new clocksource driver for Ingenic X100 OST

 - The usual fixes, improvements, cleanups and extensions for newer chip
   variants all over the driver space.

Thanks,

tglx

-->
Alexander A. Klimov (1):
  clocksource/drivers: Replace HTTP links with HTTPS ones

Alexandre Belloni (8):
  dt-bindings: atmel-tcb: convert bindings to json-schema
  dt-bindings: microchip: atmel,at91rm9200-tcb: add sama5d2 compatible
  ARM: dts: at91: sama5d2: add TCB GCLK
  clocksource/drivers/timer-atmel-tcb: Rework 32khz clock selection
  clocksource/drivers/timer-atmel-tcb: Fill tcb_config
  clocksource/drivers/timer-atmel-tcb: Stop using the 32kHz for clockevents
  clocksource/drivers/timer-atmel-tcb: Allow selecting first divider
  clocksource/drivers/timer-atmel-tcb: Add sama5d2 support

Anna-Maria Behnsen (1):
  timers: Use only bucket expiry for base->next_expiry value

Anson Huang (1):
  clocksource/drivers/imx: Add support for i.MX TPM driver with ARM64

Frederic Weisbecker (11):
  timers: Preserve higher bits of expiration on index calculation
  timers: Move trigger_dyntick_cpu() to enqueue_timer()
  timers: Add comments about calc_index() ceiling work
  timers: Optimize _next_timer_interrupt() level iteration
  timers: Always keep track of next expiry
  timers: Reuse next expiry cache after nohz exit
  timers: Expand clk forward logic beyond nohz
  timers: Spare timer softirq until next expiry
  timers: Remove must_forward_clk
  timers: Lower base clock forwarding threshold
  timers: Recalculate next timer interrupt only when necessary

Geert Uytterhoeven (1):
  clocksource/drivers/sh_cmt: Use "kHz" for kilohertz

Kamel Bouhara (1):
  ARM: at91: add atmel tcb capabilities

Linus Walleij (1):
  clocksource/drivers/nomadik-mtu: Handle 32kHz clock

周琰杰 (Zhou Yanjie) (3):
  clocksource/drivers/ingenic: Add high resolution timer support for 
SMP/SMT.
  dt-bindings: timer: Add Ingenic X1000 OST bindings.
  clocksource/drivers/ingenic: Add support for the Ingenic X1000 OST.


 .../devicetree/bindings/mfd/atmel-tcb.txt  |  56 ---
 .../soc/microchip/atmel,at91rm9200-tcb.yaml| 155 ++
 .../devicetree/bindings/timer/ingenic,sysost.yaml  |  63 +++
 .../bindings/timer/ti,keystone-timer.txt   |   2 +-
 arch/arm/boot/dts/sama5d2.dtsi |  12 +-
 drivers/clocksource/Kconfig|  15 +-
 drivers/clocksource/Makefile   |   1 +
 drivers/clocksource/ingenic-sysost.c   | 539 +
 drivers/clocksource/ingenic-timer.c| 182 ---
 drivers/clocksource/nomadik-mtu.c  |  11 +-
 drivers/clocksource/sh_cmt.c   |   2 +-
 drivers/clocksource/timer-atmel-tcb.c  | 103 ++--
 drivers/clocksource/timer-ti-32k.c |   2 +-
 drivers/clocksource/timer-ti-dm.c  |   2 +-
 include/dt-bindings/clock/ingenic,sysost.h |  12 +
 include/soc/at91/atmel_tcb.h   |   5 +
 kernel/time/timer.c| 253 +-
 17 files changed, 1098 insertions(+), 317 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/mfd/atmel-tcb.txt
 create mode 100644 
Documentation/devicetree/bindings/soc/microchip/atmel,at91rm9200-tcb.yaml
 create mode 100644 Documentation/devicetree/bindings/timer/ingenic,sysost.yaml
 create mode 100644 drivers/clocksource/ingenic-sysost.c
 create mode 100644 include/dt-bindings/clock/ingenic,sysost.h

diff --git a/Documentation/devicetree/bindings/mfd/atmel-tcb.txt 
b/Documentation/devicetree/bindings/mfd/atmel-tcb.txt
deleted file mode 100644
index c4a83e364cb6..
--- a/Documentation/devicetree/bindings/mfd/atmel-tcb.txt
+++ /dev/null
@@ -1,56 +0,0 @@
-* Device tree bindings for Atmel Timer Counter Blocks
-- compatible: Should be "atmel,-tcb", "simple-mfd", "syscon".
-   can be "at91rm9200" or "at91sam9x5"
-- reg: Should contain registers location and length
-- #address-cells: has to be 1
-- #size-cells: has to be 0
-- interrupts: Should contain all interrupts for the TC block
-  Note that you can specify several interrupt cells if the TC
-  block has one interrupt per channel.
-- clock-names: tuple listing input clock names

[GIT pull] x86/fsgsbase for v5.9

2020-08-04 Thread Thomas Gleixner
Linus,

please pull the latest x86/fsgsbase branch from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
x86-fsgsbase-2020-08-04

up to:  d029bff60aa6: x86/fsgsbase: Fix Xen PV support

Support for FSGSBASE. Almost 5 years after the first RFC to support it,
this has been brought into a shape which is maintainable and actually
works.

This final version was done by Sasha Levin who took it up after Intel
dropped the ball. Sasha discovered that the SGX (sic!) offerings out there
ship rogue kernel modules enabling FSGSBASE behind the kernels back which
opens an instantanious unpriviledged root hole.

The FSGSBASE instructions provide a considerable speedup of the context
switch path and enable user space to write GSBASE without kernel
interaction. This enablement requires careful handling of the exception
entries which go through the paranoid entry path as they cannot longer rely
on the assumption that user GSBASE is positive (as enforced via prctl() on
non FSGSBASE enabled systemn). All other entries (syscalls, interrupts and
exceptions) can still just utilize SWAPGS unconditionally when the entry
comes from user space. Converting these entries to use FSGSBASE has no
benefit as SWAPGS is only marginally slower than WRGSBASE and locating and
retrieving the kernel GSBASE value is not a free operation either. The real
benefit of RD/WRGSBASE is the avoidance of the MSR reads and writes.

The changes come with appropriate selftests and have held up in field
testing against the (sanitized) Graphene-SGX driver.

Thanks,

tglx

-->
Andi Kleen (2):
  x86/fsgsbase/64: Add intrinsics for FSGSBASE instructions
  x86/elf: Enumerate kernel FSGSBASE capability in AT_HWCAP2

Andy Lutomirski (8):
  x86/cpu: Add 'unsafe_fsgsbase' to enable CR4.FSGSBASE
  x86/process/64: Use FSBSBASE in switch_to() if available
  x86/cpu: Enable FSGSBASE on 64bit by default and add a chicken bit
  selftests/x86: Add a syscall_arg_fault_64 test for negative GSBASE
  selftests/x86/fsgsbase: Fix a comment in the ptrace_write_gsbase test
  selftests/x86/fsgsbase: Add a missing memory constraint
  x86/ptrace: Fix 32-bit PTRACE_SETREGS vs fsbase and gsbase
  x86/fsgsbase: Fix Xen PV support

Chang S. Bae (8):
  x86/ptrace: Prevent ptrace from clearing the FS/GS selector
  x86/fsgsbase/64: Enable FSGSBASE instructions in helper functions
  x86/process/64: Use FSGSBASE instructions on thread copy and ptrace
  x86/entry/64: Switch CR3 before SWAPGS in paranoid entry
  x86/entry/64: Introduce the FIND_PERCPU_BASE macro
  x86/entry/64: Handle FSGSBASE enabled paranoid entry/exit
  selftests/x86/fsgsbase: Test GS selector on ptracer-induced GS base write
  selftests/x86/fsgsbase: Test ptracer-induced GS base write with FSGSBASE

Thomas Gleixner (2):
  x86/process/64: Make save_fsgs_for_kvm() ready for FSGSBASE
  Documentation/x86/64: Add documentation for GS/FS addressing mode

Tony Luck (1):
  x86/speculation/swapgs: Check FSGSBASE in enabling SWAPGS mitigation


 Documentation/admin-guide/kernel-parameters.txt |   2 +
 Documentation/x86/x86_64/fsgs.rst   | 199 +++
 Documentation/x86/x86_64/index.rst  |   1 +
 arch/x86/entry/calling.h|  40 
 arch/x86/entry/entry_64.S   | 139 ++
 arch/x86/include/asm/fsgsbase.h |  47 -
 arch/x86/include/asm/inst.h |  15 ++
 arch/x86/include/asm/processor.h|   6 +-
 arch/x86/include/uapi/asm/hwcap2.h  |   3 +
 arch/x86/kernel/cpu/bugs.c  |   6 +-
 arch/x86/kernel/cpu/common.c|  22 +++
 arch/x86/kernel/process.c   |  10 +-
 arch/x86/kernel/process_64.c| 139 --
 arch/x86/kernel/ptrace.c|  60 +++---
 arch/x86/kvm/vmx/vmx.c  |   2 +-
 tools/testing/selftests/x86/Makefile|   2 +-
 tools/testing/selftests/x86/fsgsbase.c  |  28 ++-
 tools/testing/selftests/x86/fsgsbase_restore.c  | 245 
 tools/testing/selftests/x86/syscall_arg_fault.c |  26 +++
 19 files changed, 888 insertions(+), 104 deletions(-)
 create mode 100644 Documentation/x86/x86_64/fsgs.rst
 create mode 100644 tools/testing/selftests/x86/fsgsbase_restore.c

diff --git a/Documentation/admin-guide/kernel-parameters.txt 
b/Documentation/admin-guide/kernel-parameters.txt
index fb95fad81c79..8c0d045f1dc7 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -3079,6 +3079,8 @@
no5lvl  [X86-64] Disable 5-level paging mode. Forces
kernel to use 4-level paging instead.
 
+   nofsgsbase  [X86] Disables FSGSBASE instructions.
+
no_console_suspend
[HW] Never suspend the cons

[GIT pull] x86/entry for v5.9

2020-08-04 Thread Thomas Gleixner
Linus,

please pull the latest x86/entry branch from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
x86-entry-2020-08-04

up to:  adb334d17858: Merge branch 'WIP.x86/entry' into x86/entry, to merge the 
latest generic code and resolve conflicts

The conversion of X86 syscall, interrupt and exception entry/exit handling
to the generic code. Pretty much a straight forward 1:1 conversion plus the
consolidation of the KVM handling of pending work before entering guest
mode.

Contains the core/entry branch (previous pull request) and has the already
merged locking/core changes which caused conflicts integrated.

Thanks,

tglx

-->
Andy Lutomirski (1):
  x86/entry: Rename idtentry_enter/exit_cond_rcu() to idtentry_enter/exit()

Herbert Xu (1):
  lockdep: Split header file into lockdep and lockdep_types

Ingo Molnar (1):
  entry: Correct 'noinstr' attributes

Ira Weiny (1):
  x86: Correct noinstr qualifiers

Marco Elver (1):
  kcsan: Make KCSAN compatible with new IRQ state tracking

Peter Zijlstra (2):
  lockdep: Prepare for NMI IRQ state tracking
  x86/entry: Fix NMI vs IRQ state tracking

Thomas Gleixner (18):
  x86/idtentry: Remove stale comment
  seccomp: Provide stub for __secure_computing()
  entry: Provide generic syscall entry functionality
  entry: Provide generic syscall exit function
  entry: Provide generic interrupt entry/exit code
  entry: Provide infrastructure for work before transitioning to guest mode
  x86/entry: Consolidate check_user_regs()
  x86/entry: Consolidate 32/64 bit syscall entry
  x86/entry: Move user return notifier out of loop
  x86/ptrace: Provide pt_regs helper for entry/exit
  x86/entry: Use generic syscall entry function
  x86/entry: Use generic syscall exit functionality
  x86/entry: Cleanup idtentry_entry/exit_user
  x86/entry: Use generic interrupt entry/exit code
  x86/entry: Cleanup idtentry_enter/exit
  x86/kvm: Use generic xfer to guest work function
  entry: Correct __secure_computing() stub
  x86/kvm: Use __xfer_to_guest_mode_work_pending() in kvm_run_vcpu()


 arch/Kconfig|   3 +
 arch/x86/Kconfig|   1 +
 arch/x86/entry/common.c | 638 
 arch/x86/entry/entry_32.S   |   2 +-
 arch/x86/entry/entry_64.S   |   2 +-
 arch/x86/include/asm/entry-common.h |  76 +
 arch/x86/include/asm/idtentry.h |  42 ++-
 arch/x86/include/asm/ptrace.h   |   5 +
 arch/x86/include/asm/signal.h   |   1 -
 arch/x86/include/asm/thread_info.h  |   5 -
 arch/x86/kernel/alternative.c   |   2 +-
 arch/x86/kernel/cpu/mce/core.c  |   6 +-
 arch/x86/kernel/kvm.c   |   6 +-
 arch/x86/kernel/nmi.c   |   9 +-
 arch/x86/kernel/signal.c|   3 +-
 arch/x86/kernel/traps.c |  41 +--
 arch/x86/kvm/Kconfig|   1 +
 arch/x86/kvm/vmx/vmx.c  |  11 +-
 arch/x86/kvm/x86.c  |  15 +-
 arch/x86/mm/fault.c |   6 +-
 include/linux/entry-common.h| 372 +
 include/linux/entry-kvm.h   |  80 +
 include/linux/hardirq.h |  28 +-
 include/linux/kvm_host.h|   8 +
 include/linux/lockdep.h | 178 +-
 include/linux/lockdep_types.h   | 196 +++
 include/linux/seccomp.h |   2 +
 include/linux/spinlock.h|   1 +
 include/linux/spinlock_types.h  |   2 +-
 kernel/Makefile |   1 +
 kernel/entry/Makefile   |  13 +
 kernel/entry/common.c   | 374 +
 kernel/entry/kvm.c  |  51 +++
 kernel/kcsan/core.c |   5 +-
 kernel/kcsan/report.c   |   9 +-
 kernel/locking/lockdep.c|  46 ++-
 virt/kvm/Kconfig|   3 +
 37 files changed, 1384 insertions(+), 860 deletions(-)
 create mode 100644 arch/x86/include/asm/entry-common.h
 create mode 100644 include/linux/entry-common.h
 create mode 100644 include/linux/entry-kvm.h
 create mode 100644 include/linux/lockdep_types.h
 create mode 100644 kernel/entry/Makefile
 create mode 100644 kernel/entry/common.c
 create mode 100644 kernel/entry/kvm.c

diff --git a/arch/Kconfig b/arch/Kconfig
index 8cc35dc556c7..852a527f418f 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -27,6 +27,9 @@ config HAVE_IMA_KEXEC
 config HOTPLUG_SMT
bool
 
+config GENERIC_ENTRY
+   bool
+
 config OPROFILE
tristate "OProfile system profiling"
depends on PROFILING
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 883da0abf779..ccf02e6c144c 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -115,6 +115,7 @@ config X86
select GENERIC_CPU_AUTOPROBE
select GENERIC_CPU_VULNERABILITIES
select GENERIC_EARLY_IOREMAP
+   select GENERIC_ENTRY
select GENE

Re: [PATCH v1] tcpm: Honour pSnkStdby requirement during negotiation

2020-08-04 Thread kernel test robot
Hi Badhri,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on usb/usb-testing]
[also build test WARNING on next-20200803]
[cannot apply to v5.8]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:
https://github.com/0day-ci/linux/commits/Badhri-Jagan-Sridharan/tcpm-Honour-pSnkStdby-requirement-during-negotiation/20200804-145301
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git 
usb-testing
config: nios2-allyesconfig (attached as .config)
compiler: nios2-linux-gcc (GCC) 9.3.0
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
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross 
ARCH=nios2 

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

All warnings (new ones prefixed by >>):

   drivers/usb/typec/tcpm/tcpm.c: In function 'run_state_machine':
>> drivers/usb/typec/tcpm/tcpm.c:3339:6: warning: this statement may fall 
>> through [-Wimplicit-fallthrough=]
3339 |   if (port->psnkstdby_after_accept)
 |  ^
   drivers/usb/typec/tcpm/tcpm.c:3343:2: note: here
3343 |  case SNK_TRANSITION_SINK_VBUS:
 |  ^~~~
   At top level:
   drivers/usb/typec/tcpm/tcpm.c:1614:39: warning: 'tcpm_altmode_ops' defined 
but not used [-Wunused-const-variable=]
1614 | static const struct typec_altmode_ops tcpm_altmode_ops = {
 |   ^~~~

vim +3339 drivers/usb/typec/tcpm/tcpm.c

  2943  
  2944  static void run_state_machine(struct tcpm_port *port)
  2945  {
  2946  int ret;
  2947  enum typec_pwr_opmode opmode;
  2948  unsigned int msecs;
  2949  
  2950  port->enter_state = port->state;
  2951  switch (port->state) {
  2952  case TOGGLING:
  2953  break;
  2954  /* SRC states */
  2955  case SRC_UNATTACHED:
  2956  if (!port->non_pd_role_swap)
  2957  tcpm_swap_complete(port, -ENOTCONN);
  2958  tcpm_src_detach(port);
  2959  if (tcpm_start_toggling(port, tcpm_rp_cc(port))) {
  2960  tcpm_set_state(port, TOGGLING, 0);
  2961  break;
  2962  }
  2963  tcpm_set_cc(port, tcpm_rp_cc(port));
  2964  if (port->port_type == TYPEC_PORT_DRP)
  2965  tcpm_set_state(port, SNK_UNATTACHED, 
PD_T_DRP_SNK);
  2966  break;
  2967  case SRC_ATTACH_WAIT:
  2968  if (tcpm_port_is_debug(port))
  2969  tcpm_set_state(port, DEBUG_ACC_ATTACHED,
  2970 PD_T_CC_DEBOUNCE);
  2971  else if (tcpm_port_is_audio(port))
  2972  tcpm_set_state(port, AUDIO_ACC_ATTACHED,
  2973 PD_T_CC_DEBOUNCE);
  2974  else if (tcpm_port_is_source(port))
  2975  tcpm_set_state(port,
  2976 tcpm_try_snk(port) ? SNK_TRY
  2977: 
SRC_ATTACHED,
  2978 PD_T_CC_DEBOUNCE);
  2979  break;
  2980  
  2981  case SNK_TRY:
  2982  port->try_snk_count++;
  2983  /*
  2984   * Requirements:
  2985   * - Do not drive vconn or vbus
  2986   * - Terminate CC pins (both) to Rd
  2987   * Action:
  2988   * - Wait for tDRPTry (PD_T_DRP_TRY).
  2989   *   Until then, ignore any state changes.
  2990   */
  2991  tcpm_set_cc(port, TYPEC_CC_RD);
  2992  tcpm_set_state(port, SNK_TRY_WAIT, PD_T_DRP_TRY);
  2993  break;
  2994  case SNK_TRY_WAIT:
  2995  if (tcpm_port_is_sink(port)) {
  2996  tcpm_set_state(port, SNK_TRY_WAIT_DEBOUNCE, 0);
  2997  } else {
  2998  tcpm_set_state(port, SRC_TRYWAIT, 0);
  2999  port->max_wait = 0;
  3000  }
  3001  break;
  3002  case SNK_TRY_WAIT_DEBOUNCE:
  3003  tcpm_set_state(port, SNK_TRY_WAIT_DEBOUNCE_CHECK_VBUS,
  3004 PD_T_PD_DEBOUNCE);
  3005  break;
  3006  case SNK_TRY_WAIT_DEBOUNCE_CHECK_VBUS:
  3007 

Re: [PATCH] memory: jz4780-nemc: Fix return value check in jz4780_nemc_probe()

2020-08-04 Thread Krzysztof Kozlowski
On Tue, Aug 04, 2020 at 08:24:03AM +, Wei Yongjun wrote:
> In case of error, the function devm_ioremap() returns NULL pointer not
> ERR_PTR(). The IS_ERR() test in the return value check should be
> replaced with NULL test.
> 
> Fixes: f046e4a3f0b9 ("memory: jz4780_nemc: Only request IO memory the driver 
> will use")
> Reported-by: Hulk Robot 
> Signed-off-by: Wei Yongjun 
> ---
>  drivers/memory/jz4780-nemc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Thanks for the patch. The fix was already posted by Dan:
https://lore.kernel.org/lkml/20200803143607.GC346925@mwanda/

Best regards,
Krzysztof


Re: [PATCH] lz4: Fix kernel decompression speed

2020-08-04 Thread Pavel Machek
Hi!

> >> I've measured the kernel decompression speed using QEMU before and after
> >> this patch for the x86_64 and i386 architectures. The speed-up is about
> >> 10x as shown below.
> >> 
> >> Code   ArchKernel Size TimeSpeed
> >> v5.8   x86_64  11504832 B  148 ms   79 MB/s
> >> patch  x86_64  11503872 B   13 ms  885 MB/s
> >> v5.8   i386 9621216 B   91 ms  106 MB/s
> >> patch  i386 9620224 B   10 ms  962 MB/s
> >> 
> >> I also measured the time to decompress the initramfs on x86_64, i386,
> >> and arm. All three show the same decompression speed before and after,
> >> as expected.
> >> 
> >> [1] https://github.com/lz4/lz4/pull/890
> >> 
> > 
> > Hi Nick, would you be able to test the below patch's performance to
> > verify it gives the same speedup? It removes the #undef in misc.c which
> > causes the decompressors to not use the builtin version. It should be
> > equivalent to yours except for applying it to all the decompressors.
> > 
> > Thanks.
> 
> I will measure it. I would expect it to provide the same speed up. It would 
> be great to fix
> the problem for x86/i386 in general.
> 
> But, I believe that this is also a problem for ARM, though I have a hard time 
> measuring
> because I can’t get pre-boot print statements in QEMU. I will attempt to take 
> a look at the
> assembly, because I’m fairly certain that memcpy() isn’t inlined in master.
> 
> Even if we fix all the architectures, I would still like to merge the LZ4 
> patch. It seems like it
> is pretty easy to merge a patch that is a boot speed regression, because 
> people aren’t
> actively measuring it. So I prefer a layered defense.


Layered defense against performance-only problem, happening on
emulation-only?

IMO that's a bit of overkill.

Best regards,
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


signature.asc
Description: PGP signature


Re: [PATCH v2 1/3] lib/vsprintf: Replace hidden BUILD_BUG_ON() with static_assert()

2020-08-04 Thread Petr Mladek
On Sat 2020-08-01 13:46:20, Sergey Senozhatsky wrote:
> On (20/07/31 21:08), Andy Shevchenko wrote:
> > First of all, there is no compile time check for the SMALL
> > to be ' ' (0x20, i.e. space). Second, for ZEROPAD the check
> > is hidden in the code.
> > 
> > For better maintenance replace BUILD_BUG_ON() with static_assert()
> > for ZEROPAD and move it closer to the definition. While at it,
> > introduce check for SMALL.
> > 
> > Signed-off-by: Andy Shevchenko 
> > Reviewed-by: Steven Rostedt (VMware) 

Just for record, for the entire series:

Reviewed-by: Petr Mladek 

> The series was applied to for-5.9

There is no need to rebase the git repository. I just want to inform you
that the changes look fine to me.

Thanks a lot for the fixes and their handling.

Best Regards,
Petr


  1   2   3   4   5   6   7   8   9   10   >