Re: [PATCH v3 4/5] iio: srf08: add sensor type srf10

2017-08-18 Thread Jonathan Cameron
On Wed, 16 Aug 2017 21:34:23 +0200
Andreas Klinger  wrote:

> Ultrasonic sensor srf10 is quite similar to srf08 and now also supported by
> the driver as device tree compatible string.
> 
> It was necessary to prepare the source for supplementary sensors. This is
> done by enum srf08_sensor_type.
> 
> The most significiant difference between srf08 and srf10 is another range
> and values of register gain (in the driver it's call sensitivity).
> Therefore the array of it is extended and dependent of the sensor type.

Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

Thanks,

Jonathan
> 
> Signed-off-by: Andreas Klinger 
> ---
>  drivers/iio/proximity/Kconfig |  4 +-
>  drivers/iio/proximity/srf08.c | 90 
> +++
>  2 files changed, 77 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/iio/proximity/Kconfig b/drivers/iio/proximity/Kconfig
> index 5b81a8c9d438..df33ccc0d035 100644
> --- a/drivers/iio/proximity/Kconfig
> +++ b/drivers/iio/proximity/Kconfig
> @@ -57,10 +57,10 @@ config SX9500
> module will be called sx9500.
>  
>  config SRF08
> - tristate "Devantech SRF08 ultrasonic ranger sensor"
> + tristate "Devantech SRF08/SRF10 ultrasonic ranger sensor"
>   depends on I2C
>   help
> -   Say Y here to build a driver for Devantech SRF08 ultrasonic
> +   Say Y here to build a driver for Devantech SRF08/SRF10 ultrasonic
> ranger sensor. This driver can be used to measure the distance
> of objects.
>  
> diff --git a/drivers/iio/proximity/srf08.c b/drivers/iio/proximity/srf08.c
> index de699d67310a..1f9b03944da4 100644
> --- a/drivers/iio/proximity/srf08.c
> +++ b/drivers/iio/proximity/srf08.c
> @@ -1,5 +1,7 @@
>  /*
> - * srf08.c - Support for Devantech SRF08 ultrasonic ranger
> + * srf08.c - Support for Devantech SRFxx ultrasonic ranger
> + *   with i2c interface
> + * actually supported are srf08, srf10
>   *
>   * Copyright (c) 2016 Andreas Klinger 
>   *
> @@ -9,6 +11,7 @@
>   *
>   * For details about the device see:
>   * http://www.robot-electronics.co.uk/htm/srf08tech.html
> + * http://www.robot-electronics.co.uk/htm/srf10tech.htm
>   */
>  
>  #include 
> @@ -33,9 +36,20 @@
>  
>  #define SRF08_CMD_RANGING_CM 0x51/* Ranging Mode - Result in cm */
>  
> -#define SRF08_DEFAULT_GAIN   1025/* default analogue value of Gain */
>  #define SRF08_DEFAULT_RANGE  6020/* default value of Range in mm */
>  
> +enum srf08_sensor_type {
> + SRF08,
> + SRF10,
> + SRF_MAX_TYPE
> +};
> +
> +struct srf08_chip_info {
> + const int   *sensitivity_avail;
> + int num_sensitivity_avail;
> + int sensitivity_default;
> +};
> +
>  struct srf08_data {
>   struct i2c_client   *client;
>  
> @@ -54,6 +68,12 @@ struct srf08_data {
>* 1x16-bit channel + 3x16 padding + 4x16 timestamp
>*/
>   s16 buffer[8];
> +
> + /* Sensor-Type */
> + enum srf08_sensor_type  sensor_type;
> +
> + /* Chip-specific information */
> + const struct srf08_chip_info*chip_info;
>  };
>  
>  /*
> @@ -63,11 +83,30 @@ struct srf08_data {
>   * But with ADC's this term is already used differently and that's why it
>   * is called "Sensitivity" here.
>   */
> -static const int srf08_sensitivity[] = {
> +static const int srf08_sensitivity_avail[] = {
>94,  97, 100, 103, 107, 110, 114, 118,
>   123, 128, 133, 139, 145, 152, 159, 168,
>   177, 187, 199, 212, 227, 245, 265, 288,
> - 317, 352, 395, 450, 524, 626, 777, 1025 };
> + 317, 352, 395, 450, 524, 626, 777, 1025
> + };
> +
> +static const struct srf08_chip_info srf08_chip_info = {
> + .sensitivity_avail  = srf08_sensitivity_avail,
> + .num_sensitivity_avail  = ARRAY_SIZE(srf08_sensitivity_avail),
> + .sensitivity_default= 1025,
> +};
> +
> +static const int srf10_sensitivity_avail[] = {
> +  40,  40,  50,  60,  70,  80, 100, 120,
> + 140, 200, 250, 300, 350, 400, 500, 600,
> + 700,
> + };
> +
> +static const struct srf08_chip_info srf10_chip_info = {
> + .sensitivity_avail  = srf10_sensitivity_avail,
> + .num_sensitivity_avail  = ARRAY_SIZE(srf10_sensitivity_avail),
> + .sensitivity_default= 700,
> +};
>  
>  static int srf08_read_ranging(struct srf08_data *data)
>  {
> @@ -264,9 +303,13 @@ static ssize_t srf08_show_sensitivity_available(struct 
> device *dev,
>   struct device_attribute *attr, char *buf)
>  {
>   int i, len = 0;
> + struct iio_dev *indio_dev = dev_to_iio_dev(dev);
> + struct srf08_data *data = iio_priv(indio_dev);
>  
> - for (i = 0; i < ARRAY_SIZE(srf08_sensitivity); i++)
> - len += sprintf(buf + len, "%d ", srf08_sensitivity[i]);
> + for (i = 0; i < data->chip_info->num_sensitivity_avail; i++)
> + if (data->chip_info->sensitivity_a

Re: [PATCH v3 2/5] iio: srf08: add device tree table

2017-08-18 Thread Jonathan Cameron
On Wed, 16 Aug 2017 21:33:47 +0200
Andreas Klinger  wrote:

> Added MODULE_DEVICE_TABLE for device tree bindings.
> 
> It used to work without it by using the i2c_device_id table, but adding the
> table makes everything clear and documented.
> 
> Signed-off-by: Andreas Klinger 
Applied to the togreg branch of iio.git and pushed out as testing.

Thanks,

Jonathan
> ---
>  drivers/iio/proximity/srf08.c | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/iio/proximity/srf08.c b/drivers/iio/proximity/srf08.c
> index 49316cbf7c60..3f19536f215f 100644
> --- a/drivers/iio/proximity/srf08.c
> +++ b/drivers/iio/proximity/srf08.c
> @@ -378,6 +378,13 @@ static int srf08_probe(struct i2c_client *client,
>   return devm_iio_device_register(&client->dev, indio_dev);
>  }
>  
> +static const struct of_device_id of_srf08_match[] = {
> + { .compatible = "devantech,srf08", 0},
> + {},
> +};
> +
> +MODULE_DEVICE_TABLE(of, of_srf08_match);
> +
>  static const struct i2c_device_id srf08_id[] = {
>   { "srf08", 0 },
>   { }
> @@ -387,6 +394,7 @@ MODULE_DEVICE_TABLE(i2c, srf08_id);
>  static struct i2c_driver srf08_driver = {
>   .driver = {
>   .name   = "srf08",
> + .of_match_table = of_srf08_match,
>   },
>   .probe = srf08_probe,
>   .id_table = srf08_id,



Re: [PATCH v3 3/5] iio: srf08: add triggered buffer support

2017-08-18 Thread Jonathan Cameron
On Fri, 18 Aug 2017 07:56:05 +0100
Jonathan Cameron  wrote:

> On Wed, 16 Aug 2017 21:34:06 +0200
> Andreas Klinger  wrote:
> 
> > Add support for triggered buffers.
> > 
> > Data format is quite simple:
> >   distance 16 Bit
> >   alignment48 Bit
> >   timestamp64 Bit
> > 
> > Signed-off-by: Andreas Klinger   
> 
> One little improvement I noticed inline that an additional unlocked
> reading function would tidy up.

Let us treat this as a suggestion for a follow up patch.
It isn't substantial enough to prevent me takin the patch in it's
current state.

Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

Thanks,

Jonathan
> 
> Thanks,
> 
> Jonathan
> > ---
> >  drivers/iio/proximity/srf08.c | 60 
> > ---
> >  1 file changed, 57 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/iio/proximity/srf08.c b/drivers/iio/proximity/srf08.c
> > index 3f19536f215f..de699d67310a 100644
> > --- a/drivers/iio/proximity/srf08.c
> > +++ b/drivers/iio/proximity/srf08.c
> > @@ -18,6 +18,9 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> > +#include 
> > +#include 
> >  
> >  /* registers of SRF08 device */
> >  #define SRF08_WRITE_COMMAND0x00/* Command Register */
> > @@ -35,9 +38,22 @@
> >  
> >  struct srf08_data {
> > struct i2c_client   *client;
> > -   int sensitivity;/* Gain */
> > -   int range_mm;   /* max. Range in mm */
> > +
> > +   /*
> > +* Gain in the datasheet is called sensitivity here to distinct it
> > +* from the gain used with amplifiers of adc's
> > +*/
> > +   int sensitivity;
> > +
> > +   /* max. Range in mm */
> > +   int range_mm;
> > struct mutexlock;
> > +
> > +   /*
> > +* triggered buffer
> > +* 1x16-bit channel + 3x16 padding + 4x16 timestamp
> > +*/
> > +   s16 buffer[8];
> >  };
> >  
> >  /*
> > @@ -110,6 +126,29 @@ static int srf08_read_ranging(struct srf08_data *data)
> > return ret;
> >  }
> >  
> > +static irqreturn_t srf08_trigger_handler(int irq, void *p)
> > +{
> > +   struct iio_poll_func *pf = p;
> > +   struct iio_dev *indio_dev = pf->indio_dev;
> > +   struct srf08_data *data = iio_priv(indio_dev);
> > +   s16 sensor_data;
> > +  
> 
> There is a bit of lock bouncing going on here where you take the lock
> inside srf08_read_ranging drop it at the end and immediately
> retake it.  
> 
> Introduce an unlocked version of read_ranging and hold the lock over
> the whole cycle.
> > +   sensor_data = srf08_read_ranging(data);
> > +   if (sensor_data < 0)
> > +   goto err;
> > +
> > +   mutex_lock(&data->lock);
> > +
> > +   data->buffer[0] = sensor_data;
> > +   iio_push_to_buffers_with_timestamp(indio_dev,
> > +   data->buffer, pf->timestamp);
> > +
> > +   mutex_unlock(&data->lock);
> > +err:
> > +   iio_trigger_notify_done(indio_dev->trig);
> > +   return IRQ_HANDLED;
> > +}
> > +
> >  static int srf08_read_raw(struct iio_dev *indio_dev,
> > struct iio_chan_spec const *channel, int *val,
> > int *val2, long mask)
> > @@ -323,7 +362,15 @@ static const struct iio_chan_spec srf08_channels[] = {
> > .info_mask_separate =
> > BIT(IIO_CHAN_INFO_RAW) |
> > BIT(IIO_CHAN_INFO_SCALE),
> > +   .scan_index = 0,
> > +   .scan_type = {
> > +   .sign = 's',
> > +   .realbits = 16,
> > +   .storagebits = 16,
> > +   .endianness = IIO_CPU,
> > +   },
> > },
> > +   IIO_CHAN_SOFT_TIMESTAMP(1),
> >  };
> >  
> >  static const struct iio_info srf08_info = {
> > @@ -362,6 +409,13 @@ static int srf08_probe(struct i2c_client *client,
> >  
> > mutex_init(&data->lock);
> >  
> > +   ret = devm_iio_triggered_buffer_setup(&client->dev, indio_dev,
> > +   iio_pollfunc_store_time, srf08_trigger_handler, NULL);
> > +   if (ret < 0) {
> > +   dev_err(&client->dev, "setup of iio triggered buffer failed\n");
> > +   return ret;
> > +   }
> > +
> > /*
> >  * set default values of device here
> >  * these register values cannot be read from the hardware
> > @@ -402,5 +456,5 @@ static struct i2c_driver srf08_driver = {
> >  module_i2c_driver(srf08_driver);
> >  
> >  MODULE_AUTHOR("Andreas Klinger ");
> > -MODULE_DESCRIPTION("Devantech SRF08 ultrasonic ranger driver");
> > +MODULE_DESCRIPTION("Devantech SRF08/SRF10 ultrasonic ranger driver");
> >  MODULE_LICENSE("GPL");  
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



Re: [PATCH v2 09/22] fpga: intel: pcie: adds fpga_for_each_port callback for fme device

2017-08-18 Thread Wu Hao
On Thu, Aug 17, 2017 at 04:31:56PM -0500, Alan Tull wrote:
> On Sun, Jun 25, 2017 at 8:52 PM, Wu Hao  wrote:
> 
> Hi Hao,
> 
> > For FPGA Management Engine (FME), it requires fpga_for_each_port callback
> > for actions on ports, so export this function from PCIe driver by adding
> > the callback to the platform data.
> >
> > Signed-off-by: Tim Whisonant 
> > Signed-off-by: Enno Luebbers 
> > Signed-off-by: Shiva Rao 
> > Signed-off-by: Christopher Rauer 
> > Signed-off-by: Xiao Guangrong 
> > Signed-off-by: Wu Hao 
> > ---
> > v2: rebased
> > ---
> >  drivers/fpga/intel-feature-dev.h |  9 +
> >  drivers/fpga/intel-pcie.c| 24 
> >  2 files changed, 33 insertions(+)
> >
> > diff --git a/drivers/fpga/intel-feature-dev.h 
> > b/drivers/fpga/intel-feature-dev.h
> > index d64a51e..06b3fb6 100644
> > --- a/drivers/fpga/intel-feature-dev.h
> > +++ b/drivers/fpga/intel-feature-dev.h
> > @@ -235,6 +235,9 @@ struct feature_platform_data {
> > struct platform_device *dev;
> > unsigned int disable_count; /* count for port disable */
> >
> > +   struct platform_device *(*fpga_for_each_port)(struct 
> > platform_device *,
> > +   void *, int (*match)(struct platform_device *, void 
> > *));
> > +
> > int num;/* number of features */
> > struct feature features[0];
> >  };
> > @@ -354,4 +357,10 @@ static inline int fpga_port_reset(struct 
> > platform_device *pdev)
> >
> > return pdata->features[index].ioaddr;
> >  }
> > +
> > +static inline struct device *
> > +fpga_feature_dev_to_pcidev(struct platform_device *dev)
> > +{
> > +   return dev->dev.parent->parent;
> > +}
> >  #endif
> > diff --git a/drivers/fpga/intel-pcie.c b/drivers/fpga/intel-pcie.c
> > index 54c0e3a..86ea5c7 100644
> > --- a/drivers/fpga/intel-pcie.c
> > +++ b/drivers/fpga/intel-pcie.c
> > @@ -209,6 +209,27 @@ static int parse_switch_to(struct 
> > build_feature_devs_info *binfo, int bar)
> > return parse_start_from(binfo, bar);
> >  }
> >
> > +static struct platform_device *fpga_for_each_port(struct platform_device 
> > *pdev,
> 
> Regarding the name of this function, isn't this more of a 'find'
> function like class_find_device() than a 'for_each' function?
> 
> Also please document that the caller will need to put_device().

Yes, agree, fpga_find_port() should be a better name.
I will fix this and add comments for this function.

Thanks for your comments.
Hao

> 
> Thanks,
> Alan
> 
> > +void *data, int (*match)(struct platform_device *, 
> > void *))
> > +{
> > +   struct device *pci_dev = fpga_feature_dev_to_pcidev(pdev);
> > +   struct cci_drvdata *drvdata = dev_get_drvdata(pci_dev);
> > +   struct feature_platform_data *pdata;
> > +   struct platform_device *port_dev;
> > +
> > +   mutex_lock(&drvdata->lock);
> > +   list_for_each_entry(pdata, &drvdata->port_dev_list, node) {
> > +   port_dev = pdata->dev;
> > +
> > +   if (match(port_dev, data) && get_device(&port_dev->dev))
> > +   goto exit;
> > +   }
> > +   port_dev = NULL;
> > +exit:
> > +   mutex_unlock(&drvdata->lock);
> > +   return port_dev;
> > +}
> > +
> >  static struct build_feature_devs_info *
> >  build_info_alloc_and_init(struct pci_dev *pdev)
> >  {
> > @@ -310,6 +331,9 @@ static int build_info_commit_dev(struct 
> > build_feature_devs_info *binfo)
> > if (!pdata)
> > return -ENOMEM;
> >
> > +   if (type == FME_ID)
> > +   pdata->fpga_for_each_port = fpga_for_each_port;
> > +
> > /*
> >  * the count should be initialized to 0 to make sure
> >  *__fpga_port_enable() following __fpga_port_disable()
> > --
> > 1.8.3.1
> >


Re: [PATCH RESEND1 00/12] ALSA: vsnd: Add Xen para-virtualized frontend driver

2017-08-18 Thread Takashi Sakamoto

On Aug 18 2017 14:56, Oleksandr Andrushchenko wrote:
Taking into account the fact that the backend we have is a user-space 
application

running on top of ALSA/PulseAudio we cannot get HW pointers from actual
hardware by any means (PulseAudio use-case is the most tough thing in 
equation)


You mean that any alsa-lib or libpulse applications run on Dom0 as a
backend driver for the frontend driver on DomU?


Regards

Takashi Sakamoto


[PATCH v1] [media] uvcvideo: mark buffer error where overflow

2017-08-18 Thread Baoyou Xie
Some cameras post inaccurate frame where next frame data overlap
it. this results in screen flicker, and it need to be prevented.

So this patch marks the buffer error to discard the frame where
buffer overflow.

Signed-off-by: Baoyou Xie 
---
 drivers/media/usb/uvc/uvc_video.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/usb/uvc/uvc_video.c 
b/drivers/media/usb/uvc/uvc_video.c
index fb86d6a..81a3530 100644
--- a/drivers/media/usb/uvc/uvc_video.c
+++ b/drivers/media/usb/uvc/uvc_video.c
@@ -1077,6 +1077,7 @@ static void uvc_video_decode_data(struct uvc_streaming 
*stream,
/* Complete the current frame if the buffer size was exceeded. */
if (len > maxlen) {
uvc_trace(UVC_TRACE_FRAME, "Frame complete (overflow).\n");
+   buf->error = 1;
buf->state = UVC_BUF_STATE_READY;
}
 }
-- 
2.7.4



Re: [PATCH v4 0/5] iio: srf08: add support for similar devices and triggered buffers

2017-08-18 Thread Jonathan Cameron
On Fri, 18 Aug 2017 00:08:29 +0200
Andreas Klinger  wrote:

For some reason my laptop hadn't picked up this posting until just now.
Too many random wifi hotspots I guess.

Anyhow given the rebase was trivial I'll stick with V3 for everything.
Wolfram can pickup patch 1 whenever he likes.

Jonathan

> This patch series adds support for:
> - triggered buffer
> - ultrasonic devices srf02 and srf10
> 
> Changes in v4:
> - rebase to recent git repository with trivial-devices.txt now under
>   devicetree/bindings
> 
> Changes in v3:
> - introduce struct chip_info for device specific features
> - remove locking error in srf08_trigger_handler()
> 
> Changes in v2:
> - removed unnecessary patch "[PATCH 6/7] iio: srf08: add buffered to device 
> mode"
> - incorporated patch "[PATCH 7/7] iio: srf08: change text in Kconfig" where 
> suitable
> - changed order of patches to improve logical flow of changes
> - improved distinction of sensor types
> 
> Andreas Klinger (5):
>   iio: srf08: add device tree binding for srf02 and srf10
>   iio: srf08: add device tree table
>   iio: srf08: add triggered buffer support
>   iio: srf08: add sensor type srf10
>   iio: srf08: add support for srf02 in i2c mode
> 
>  .../devicetree/bindings/trivial-devices.txt|   2 +
>  drivers/iio/proximity/Kconfig  |   8 +-
>  drivers/iio/proximity/srf08.c  | 227 
> ++---
>  3 files changed, 203 insertions(+), 34 deletions(-)
> 



Re: [PATCH v7 1/2] sched/deadline: Add support for SD_PREFER_SIBLING on find_later_rq()

2017-08-18 Thread Joel Fernandes (Google)
Hi Byungchul,

On Thu, Aug 17, 2017 at 11:05 PM, Byungchul Park  wrote:
> It would be better to avoid pushing tasks to other cpu within
> a SD_PREFER_SIBLING domain, instead, get more chances to check other
> siblings.
>
> Signed-off-by: Byungchul Park 
> ---
>  kernel/sched/deadline.c | 55 
> ++---
>  1 file changed, 52 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index 0223694..8f69a37 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -1319,12 +1319,35 @@ static struct task_struct 
> *pick_earliest_pushable_dl_task(struct rq *rq, int cpu
>
>  static DEFINE_PER_CPU(cpumask_var_t, local_cpu_mask_dl);
>
> +/*
> + * Find the first cpu in: mask & sd & ~prefer
> + */
> +static int find_cpu(const struct cpumask *mask,
> +   const struct sched_domain *sd,
> +   const struct sched_domain *prefer)
> +{
> +   const struct cpumask *sds = sched_domain_span(sd);
> +   const struct cpumask *ps  = prefer ? sched_domain_span(prefer) : NULL;
> +   int cpu = -1;
> +
> +   while ((cpu = cpumask_next(cpu, mask)) < nr_cpu_ids) {

This can be simplified to for_each_cpu(cpu, mask) ?


thanks,

-Joel


Re: [PATCH RESEND1 00/12] ALSA: vsnd: Add Xen para-virtualized frontend driver

2017-08-18 Thread Oleksandr Andrushchenko


On 08/18/2017 10:17 AM, Takashi Sakamoto wrote:

On Aug 18 2017 14:56, Oleksandr Andrushchenko wrote:
Taking into account the fact that the backend we have is a user-space 
application

running on top of ALSA/PulseAudio we cannot get HW pointers from actual
hardware by any means (PulseAudio use-case is the most tough thing in 
equation)


You mean that any alsa-lib or libpulse applications run on Dom0 as a
backend driver for the frontend driver on DomU?

No, the sound backend [1] is a user-space application (ALSA/PulseAudio 
client)

which runs as a Xen para-virtual backend in Dom0 and serves all the
frontends running in DomU(s).
Other ALSA/PulseAudio clients in Dom0 are also allowed to run at the
same time.


Regards

Takashi Sakamoto

Thank you,
Oleksandr

[1] https://github.com/xen-troops/snd_be


Re: [PATCH] usb: xhci: Renesas uPD720202 needs short TX quirk

2017-08-18 Thread Felipe Balbi

hi,

Kai-Heng Feng  writes:
> When plugging Logitech C920 webcam, warning messages filled up dmesg:
> [77117.655018] xhci_hcd :0c:00.0: WARN Successful completion on short TX: 
> needs XHCI_TRUST_TX_LENGTH quirk?
> [77117.659018] xhci_hcd :0c:00.0: WARN Successful completion on short TX: 
> needs XHCI_TRUST_TX_LENGTH quirk?

have you confirmed this is needed for this controller? Anybody from
Renesas has confirmed it? Do you have an errata document to refer to?

> [77122.622952] handle_tx_event: 541 callbacks suppressed
>
> No more warning messages with XHCI_TRUST_TX_LENGTH applied.
>
> BugLink: https://bugs.launchpad.net/bugs/1710548
> Signed-off-by: Kai-Heng Feng 
> ---
>  drivers/usb/host/xhci-pci.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
> index 8071c8fdd15e..8566b43e19ba 100644
> --- a/drivers/usb/host/xhci-pci.c
> +++ b/drivers/usb/host/xhci-pci.c
> @@ -202,8 +202,10 @@ static void xhci_pci_quirks(struct device *dev, struct 
> xhci_hcd *xhci)
>   xhci->quirks |= XHCI_BROKEN_STREAMS;
>   }
>   if (pdev->vendor == PCI_VENDOR_ID_RENESAS &&
> - pdev->device == 0x0015)
> + pdev->device == 0x0015) {

unnecessary

>   xhci->quirks |= XHCI_RESET_ON_RESUME;
> + xhci->quirks |= XHCI_TRUST_TX_LENGTH;

xhci->quirks |= XHCI_RESET_ON_RESUME |
XHCI_TRUST_TX_LENGTH;

> + }

unnecessary

-- 
balbi


signature.asc
Description: PGP signature


Re: [RFC PATCH v2 1/3] PCI: rockchip: Add support for pcie wake irq

2017-08-18 Thread Shawn Lin

Hi Jeffy

On 2017/8/17 20:04, Jeffy Chen wrote:

Add support for PCIE_WAKE pin in rockchip pcie driver.

Signed-off-by: Jeffy Chen 
---

Changes in v2:
Use dev_pm_set_dedicated_wake_irq
 -- Suggested by Brian Norris 

  drivers/pci/host/pcie-rockchip.c | 13 -
  1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
index 7bb9870f6d8c..c2b973c738fe 100644
--- a/drivers/pci/host/pcie-rockchip.c
+++ b/drivers/pci/host/pcie-rockchip.c
@@ -36,6 +36,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  #include 
  
@@ -853,7 +854,6 @@ static void rockchip_pcie_legacy_int_handler(struct irq_desc *desc)

chained_irq_exit(chip, desc);
  }
  
-

  /**
   * rockchip_pcie_parse_dt - Parse Device Tree
   * @rockchip: PCIe port information
@@ -1018,6 +1018,14 @@ static int rockchip_pcie_parse_dt(struct rockchip_pcie 
*rockchip)
return err;
}
  
+	device_init_wakeup(dev, true);

+   irq = platform_get_irq_byname(pdev, "wake");
+   if (irq >= 0) {
+   err = dev_pm_set_dedicated_wake_irq(dev, irq);
+   if (err)
+   dev_err(dev, "failed to setup PCIe wake IRQ\n");
+   }
+
rockchip->vpcie3v3 = devm_regulator_get_optional(dev, "vpcie3v3");
if (IS_ERR(rockchip->vpcie3v3)) {
if (PTR_ERR(rockchip->vpcie3v3) == -EPROBE_DEFER)
@@ -1524,6 +1532,9 @@ static int rockchip_pcie_remove(struct platform_device 
*pdev)
struct device *dev = &pdev->dev;
struct rockchip_pcie *rockchip = dev_get_drvdata(dev);
  
+	dev_pm_clear_wake_irq(dev);

+   device_init_wakeup(dev, false);
+


Looks good overall but I think we need this on the
error handling path of rockchip_pcie_probe as well?


pci_stop_root_bus(rockchip->root_bus);
pci_remove_root_bus(rockchip->root_bus);
pci_unmap_iospace(rockchip->io);





[PATCH v9 0/3] Add support for IPQ8074 PCIe phy and controller

2017-08-18 Thread Varadarajan Narayanan
v9:
  Incorporate Stanimir's feedback for
PCI: dwc: qcom: Add support for IPQ8074 PCIe controller

  Add Stanimir's Ack for
PCI: dwc: qcom: Use block IP version for operations
PCI: dwc: qcom: Add support for IPQ8074 PCIe controller

  Add Rob's Ack for
dt-bindings: pci: qcom: Add support for IPQ8074

v8:
  Incorporate Stanimir's feedback for
PCI: dwc: qcom: Add support for IPQ8074 PCIe controller

v7:
  Skip PHY patches as they are already included by Kishon

  Incorporate Stanimir's feedback for the below patches
PCI: dwc: qcom: Use block IP version for operations
PCI: dwc: qcom: Add support for IPQ8074 PCIe controller

v6:
  Added 'Reviewed-by: Vivek Gautam ' and fixed
  white space issues as mentioned by Vivek.
phy: qcom-qmp: Fix phy pipe clock name
dt-bindings: phy: qmp: Add support for QMP phy in IPQ8074

v5:
  dt-bindings: phy: qmp: Add support for QMP phy in IPQ8074
Renamed phy_phy clock as common clock

  phy: qcom-qmp: Fix phy pipe clock name
Moved the DT get into the registering function

  phy: qcom-qmp: Add support for IPQ8074
Place the IPQ8074 related structs similar to existing SoC.
Renamed phy_phy clock as common clock
v4:
  phy: qcom-qmp: Fix phy pipe clock name
Based on Vivek's comments, return failure only for
PCI/USB type of phys.
Removed Ack.

  phy: qcom-qmp: Handle unavailable registers
Removed this patch.
Incorrectly used a block of code that is not applicable
to IPQ8074, hence had to avoid an "unavailable" register.
Since that is addressed using 'has_phy_com_ctrl' this
patch is not needed.

  phy: qcom-qmp: Add support for IPQ8074
Set 'has_phy_com_ctrl' to false
Remove ipq8074_pciephy_regs_layout

v3:
  PCI: dwc: qcom: Add support for IPQ8074 PCIe controller
Incoporate Stan's feedback:-
 - Add SoC Wrapper and Synopsys Core IP versions

v2:
  dt-bindings: phy: qmp: Add output-clock-names
Added Rob H's Ack

  dt-bindings: phy: qmp: Add support for QMP phy in IPQ8074
Removed example
Added IPQ8074 specific details

  phy: qcom-qmp: Fix phy pipe clock name
Added Vivek's Ack

  phy: qcom-qmp: Handle unavailable registers
No changes

  phy: qcom-qmp: Add support for IPQ8074
No changes

  PCI: dwc: qcom: Use block IP version for operations
Added new patch to use block IP version instead of v1, v2...

  dt-bindings: pci: qcom: Add support for IPQ8074
Removed example
Added IPQ8074 specific details

  PCI: dwc: qcom: Add support for IPQ8074 PCIe controller
Incorporated Bjorn's feedback:-
 - Removed reset names, helper function to assert/deassert, helper
   function to R/M/W register.
 - Renamed sys_noc clock as iface clock
 - Added deinit if phy power on fails

v1:
Add definitions required to enable QMP phy support for IPQ8074.

Add support for the IPQ8074 PCIe controller.  IPQ8074 supports
Gen 1/2, one lane, two PCIe root complex with support for MSI and
legacy interrupts, and it conforms to PCI Express Base 2.1
specification.

Varadarajan Narayanan (3):
  PCI: dwc: qcom: Use block IP version for operations
  dt-bindings: pci: qcom: Add support for IPQ8074
  PCI: dwc: qcom: Add support for IPQ8074 PCIe controller

 .../devicetree/bindings/pci/qcom,pcie.txt  |  23 ++
 drivers/pci/dwc/pcie-qcom.c| 346 +
 2 files changed, 302 insertions(+), 67 deletions(-)

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



[PATCH v9 1/3] PCI: dwc: qcom: Use block IP version for operations

2017-08-18 Thread Varadarajan Narayanan
Presently, when support for a new SoC is added, the driver ops
structures and functions are versioned with plain 1, 2, 3 etc.
Instead use the block IP version number.

Acked-by: Stanimir Varbanov 
Signed-off-by: Varadarajan Narayanan 
---
 drivers/pci/dwc/pcie-qcom.c | 138 +++-
 1 file changed, 71 insertions(+), 67 deletions(-)

diff --git a/drivers/pci/dwc/pcie-qcom.c b/drivers/pci/dwc/pcie-qcom.c
index 871e7d9..4ec5cd9 100644
--- a/drivers/pci/dwc/pcie-qcom.c
+++ b/drivers/pci/dwc/pcie-qcom.c
@@ -61,7 +61,7 @@
 
 #define PERST_DELAY_US 1000
 
-struct qcom_pcie_resources_v0 {
+struct qcom_pcie_resources_2_1_0 {
struct clk *iface_clk;
struct clk *core_clk;
struct clk *phy_clk;
@@ -75,7 +75,7 @@ struct qcom_pcie_resources_v0 {
struct regulator *vdda_refclk;
 };
 
-struct qcom_pcie_resources_v1 {
+struct qcom_pcie_resources_1_0_0 {
struct clk *iface;
struct clk *aux;
struct clk *master_bus;
@@ -84,7 +84,7 @@ struct qcom_pcie_resources_v1 {
struct regulator *vdda;
 };
 
-struct qcom_pcie_resources_v2 {
+struct qcom_pcie_resources_2_3_2 {
struct clk *aux_clk;
struct clk *master_clk;
struct clk *slave_clk;
@@ -92,7 +92,7 @@ struct qcom_pcie_resources_v2 {
struct clk *pipe_clk;
 };
 
-struct qcom_pcie_resources_v3 {
+struct qcom_pcie_resources_2_4_0 {
struct clk *aux_clk;
struct clk *master_clk;
struct clk *slave_clk;
@@ -111,10 +111,10 @@ struct qcom_pcie_resources_v3 {
 };
 
 union qcom_pcie_resources {
-   struct qcom_pcie_resources_v0 v0;
-   struct qcom_pcie_resources_v1 v1;
-   struct qcom_pcie_resources_v2 v2;
-   struct qcom_pcie_resources_v3 v3;
+   struct qcom_pcie_resources_1_0_0 v1_0_0;
+   struct qcom_pcie_resources_2_1_0 v2_1_0;
+   struct qcom_pcie_resources_2_3_2 v2_3_2;
+   struct qcom_pcie_resources_2_4_0 v2_4_0;
 };
 
 struct qcom_pcie;
@@ -173,7 +173,7 @@ static int qcom_pcie_establish_link(struct qcom_pcie *pcie)
return dw_pcie_wait_for_link(pci);
 }
 
-static void qcom_pcie_v0_v1_ltssm_enable(struct qcom_pcie *pcie)
+static void qcom_pcie_2_1_0_ltssm_enable(struct qcom_pcie *pcie)
 {
u32 val;
 
@@ -183,9 +183,9 @@ static void qcom_pcie_v0_v1_ltssm_enable(struct qcom_pcie 
*pcie)
writel(val, pcie->elbi + PCIE20_ELBI_SYS_CTRL);
 }
 
-static int qcom_pcie_get_resources_v0(struct qcom_pcie *pcie)
+static int qcom_pcie_get_resources_2_1_0(struct qcom_pcie *pcie)
 {
-   struct qcom_pcie_resources_v0 *res = &pcie->res.v0;
+   struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0;
struct dw_pcie *pci = pcie->pci;
struct device *dev = pci->dev;
 
@@ -233,9 +233,9 @@ static int qcom_pcie_get_resources_v0(struct qcom_pcie 
*pcie)
return PTR_ERR_OR_ZERO(res->phy_reset);
 }
 
-static void qcom_pcie_deinit_v0(struct qcom_pcie *pcie)
+static void qcom_pcie_deinit_2_1_0(struct qcom_pcie *pcie)
 {
-   struct qcom_pcie_resources_v0 *res = &pcie->res.v0;
+   struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0;
 
reset_control_assert(res->pci_reset);
reset_control_assert(res->axi_reset);
@@ -250,9 +250,9 @@ static void qcom_pcie_deinit_v0(struct qcom_pcie *pcie)
regulator_disable(res->vdda_refclk);
 }
 
-static int qcom_pcie_init_v0(struct qcom_pcie *pcie)
+static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie)
 {
-   struct qcom_pcie_resources_v0 *res = &pcie->res.v0;
+   struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0;
struct dw_pcie *pci = pcie->pci;
struct device *dev = pci->dev;
u32 val;
@@ -368,9 +368,9 @@ static int qcom_pcie_init_v0(struct qcom_pcie *pcie)
return ret;
 }
 
-static int qcom_pcie_get_resources_v1(struct qcom_pcie *pcie)
+static int qcom_pcie_get_resources_1_0_0(struct qcom_pcie *pcie)
 {
-   struct qcom_pcie_resources_v1 *res = &pcie->res.v1;
+   struct qcom_pcie_resources_1_0_0 *res = &pcie->res.v1_0_0;
struct dw_pcie *pci = pcie->pci;
struct device *dev = pci->dev;
 
@@ -398,9 +398,9 @@ static int qcom_pcie_get_resources_v1(struct qcom_pcie 
*pcie)
return PTR_ERR_OR_ZERO(res->core);
 }
 
-static void qcom_pcie_deinit_v1(struct qcom_pcie *pcie)
+static void qcom_pcie_deinit_1_0_0(struct qcom_pcie *pcie)
 {
-   struct qcom_pcie_resources_v1 *res = &pcie->res.v1;
+   struct qcom_pcie_resources_1_0_0 *res = &pcie->res.v1_0_0;
 
reset_control_assert(res->core);
clk_disable_unprepare(res->slave_bus);
@@ -410,9 +410,9 @@ static void qcom_pcie_deinit_v1(struct qcom_pcie *pcie)
regulator_disable(res->vdda);
 }
 
-static int qcom_pcie_init_v1(struct qcom_pcie *pcie)
+static int qcom_pcie_init_1_0_0(struct qcom_pcie *pcie)
 {
-   struct qcom_pcie_resources_v1 *res = &pcie->res.v1;
+   struct qcom_pcie_resources_1_0_0 *res = &pcie->res.v1_0_0;
struct dw_pcie *p

[PATCH v9 3/3] PCI: dwc: qcom: Add support for IPQ8074 PCIe controller

2017-08-18 Thread Varadarajan Narayanan
Add support for the IPQ8074 PCIe controller.  IPQ8074 supports
Gen 1/2, one lane, two PCIe root complex with support for MSI and
legacy interrupts, and it conforms to PCI Express Base 2.1
specification.

The core init is the similar to the existing SoC, however the
clocks and reset lines differ.

Acked-by: Stanimir Varbanov 
Signed-off-by: smuthayy 
Signed-off-by: Varadarajan Narayanan 
---
 drivers/pci/dwc/pcie-qcom.c | 210 +++-
 1 file changed, 209 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/dwc/pcie-qcom.c b/drivers/pci/dwc/pcie-qcom.c
index 4ec5cd9..6f6dbde 100644
--- a/drivers/pci/dwc/pcie-qcom.c
+++ b/drivers/pci/dwc/pcie-qcom.c
@@ -37,6 +37,20 @@
 #include "pcie-designware.h"
 
 #define PCIE20_PARF_SYS_CTRL   0x00
+#define MST_WAKEUP_EN  BIT(13)
+#define SLV_WAKEUP_EN  BIT(12)
+#define MSTR_ACLK_CGC_DIS  BIT(10)
+#define SLV_ACLK_CGC_DIS   BIT(9)
+#define CORE_CLK_CGC_DIS   BIT(6)
+#define AUX_PWR_DETBIT(4)
+#define L23_CLK_RMV_DISBIT(2)
+#define L1_CLK_RMV_DIS BIT(1)
+
+#define PCIE20_COMMAND_STATUS  0x04
+#define CMD_BME_VAL0x4
+#define PCIE20_DEVICE_CONTROL2_STATUS2 0x98
+#define PCIE_CAP_CPL_TIMEOUT_DISABLE   0x10
+
 #define PCIE20_PARF_PHY_CTRL   0x40
 #define PCIE20_PARF_PHY_REFCLK 0x4C
 #define PCIE20_PARF_DBI_BASE_ADDR  0x168
@@ -58,9 +72,21 @@
 #define CFG_BRIDGE_SB_INIT BIT(0)
 
 #define PCIE20_CAP 0x70
+#define PCIE20_CAP_LINK_CAPABILITIES   (PCIE20_CAP + 0xc)
+#define PCIE20_CAP_ACTIVE_STATE_LINK_PM_SUPPORT(BIT(10) | BIT(11))
+#define PCIE20_CAP_LINK_1  (PCIE20_CAP + 0x14)
+#define PCIE_CAP_LINK1_VAL 0x2fd7f
+
+#define PCIE20_PARF_Q2A_FLUSH  0x1ac
+
+#define PCIE20_MISC_CONTROL_1_REG  0x8bc
+#define DBI_RO_WR_EN   1
 
 #define PERST_DELAY_US 1000
 
+#define PCIE20_v3_PARF_SLV_ADDR_SPACE_SIZE 0x358
+#define SLV_ADDR_SPACE_SZ  0x1000
+
 struct qcom_pcie_resources_2_1_0 {
struct clk *iface_clk;
struct clk *core_clk;
@@ -110,10 +136,20 @@ struct qcom_pcie_resources_2_4_0 {
struct reset_control *phy_ahb_reset;
 };
 
+struct qcom_pcie_resources_2_3_3 {
+   struct clk *iface;
+   struct clk *axi_m_clk;
+   struct clk *axi_s_clk;
+   struct clk *ahb_clk;
+   struct clk *aux_clk;
+   struct reset_control *rst[7];
+};
+
 union qcom_pcie_resources {
struct qcom_pcie_resources_1_0_0 v1_0_0;
struct qcom_pcie_resources_2_1_0 v2_1_0;
struct qcom_pcie_resources_2_3_2 v2_3_2;
+   struct qcom_pcie_resources_2_3_3 v2_3_3;
struct qcom_pcie_resources_2_4_0 v2_4_0;
 };
 
@@ -895,6 +931,169 @@ static int qcom_pcie_init_2_4_0(struct qcom_pcie *pcie)
return ret;
 }
 
+static int qcom_pcie_get_resources_2_3_3(struct qcom_pcie *pcie)
+{
+   struct qcom_pcie_resources_2_3_3 *res = &pcie->res.v2_3_3;
+   struct dw_pcie *pci = pcie->pci;
+   struct device *dev = pci->dev;
+   int i;
+   const char *rst_names[] = { "axi_m", "axi_s", "pipe",
+   "axi_m_sticky", "sticky",
+   "ahb", "sleep", };
+
+   res->iface = devm_clk_get(dev, "iface");
+   if (IS_ERR(res->iface))
+   return PTR_ERR(res->iface);
+
+   res->axi_m_clk = devm_clk_get(dev, "axi_m");
+   if (IS_ERR(res->axi_m_clk))
+   return PTR_ERR(res->axi_m_clk);
+
+   res->axi_s_clk = devm_clk_get(dev, "axi_s");
+   if (IS_ERR(res->axi_s_clk))
+   return PTR_ERR(res->axi_s_clk);
+
+   res->ahb_clk = devm_clk_get(dev, "ahb");
+   if (IS_ERR(res->ahb_clk))
+   return PTR_ERR(res->ahb_clk);
+
+   res->aux_clk = devm_clk_get(dev, "aux");
+   if (IS_ERR(res->aux_clk))
+   return PTR_ERR(res->aux_clk);
+
+   for (i = 0; i < ARRAY_SIZE(rst_names); i++) {
+   res->rst[i] = devm_reset_control_get(dev, rst_names[i]);
+   if (IS_ERR(res->rst[i]))
+   return PTR_ERR(res->rst[i]);
+   }
+
+   return 0;
+}
+
+static void qcom_pcie_deinit_2_3_3(struct qcom_pcie *pcie)
+{
+   struct qcom_pcie_resources_2_3_3 *res = &pcie->res.v2_3_3;
+
+   clk_disable_unprepare(res->iface);
+   clk_disable_unprepare(res->axi_m_clk);
+   clk_disable_unprepare(res->axi_s_clk);
+   clk_disable_unprepare(res->ahb_clk);
+   clk_disable_unprepare(res->aux_clk);
+}
+
+static int qcom_pcie_init_2_3_3(struct qcom_pcie *pcie)
+{
+   struct qcom_pcie_resources_2_3_3 *res = &pcie->res.v2_3_3;
+   

[PATCH v9 2/3] dt-bindings: pci: qcom: Add support for IPQ8074

2017-08-18 Thread Varadarajan Narayanan
Add support for the IPQ8074 PCIe controller.  IPQ8074 supports Gen 1/2, one
lane, two PCIe root complex with support for MSI and legacy interrupts, and
it conforms to PCI Express Base 2.1 specification.

Acked-by: Rob Herring 
Signed-off-by: Varadarajan Narayanan 
---
 .../devicetree/bindings/pci/qcom,pcie.txt  | 23 ++
 1 file changed, 23 insertions(+)

diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie.txt 
b/Documentation/devicetree/bindings/pci/qcom,pcie.txt
index 9d418b7..b3e36ef 100644
--- a/Documentation/devicetree/bindings/pci/qcom,pcie.txt
+++ b/Documentation/devicetree/bindings/pci/qcom,pcie.txt
@@ -9,6 +9,7 @@
- "qcom,pcie-apq8084" for apq8084
- "qcom,pcie-msm8996" for msm8996 or apq8096
- "qcom,pcie-ipq4019" for ipq4019
+   - "qcom,pcie-ipq8074" for ipq8074
 
 - reg:
Usage: required
@@ -105,6 +106,16 @@
- "bus_master"  Master AXI clock
- "bus_slave"   Slave AXI clock
 
+- clock-names:
+   Usage: required for ipq8074
+   Value type: 
+   Definition: Should contain the following entries
+   - "iface"   PCIe to SysNOC BIU clock
+   - "axi_m"   AXI Master clock
+   - "axi_s"   AXI Slave clock
+   - "ahb" AHB clock
+   - "aux" Auxiliary clock
+
 - resets:
Usage: required
Value type: 
@@ -144,6 +155,18 @@
- "ahb" AHB reset
- "phy_ahb" PHY AHB reset
 
+- reset-names:
+   Usage: required for ipq8074
+   Value type: 
+   Definition: Should contain the following entries
+   - "pipe"PIPE reset
+   - "sleep"   Sleep reset
+   - "sticky"  Core Sticky reset
+   - "axi_m"   AXI Master reset
+   - "axi_s"   AXI Slave reset
+   - "ahb" AHB Reset
+   - "axi_m_sticky"AXI Master Sticky reset
+
 - power-domains:
Usage: required for apq8084 and msm8996/apq8096
Value type: 
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of 
Code Aurora Forum, hosted by The Linux Foundation



[GIT PULL] a dma-mapping for 4.13-rc

2017-08-18 Thread Christoph Hellwig
The following changes since commit ef954844c7ace62f773f4f23e28d2d915adc419f:

  Linux 4.13-rc5 (2017-08-13 16:01:32 -0700)

are available in the git repository at:

  git://git.infradead.org/users/hch/dma-mapping.git tags/dma-mapping-4.13-3

for you to fetch changes up to ee7b1f31200d9f3cc45e1bd22e962bd6b1d4d611:

  of: fix DMA mask generation (2017-08-17 10:23:45 +0200)


Another dma-mapping regression fix.


Robin Murphy (1):
  of: fix DMA mask generation

 drivers/of/device.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)


Re: [PATCH v14 3/5] virtio-balloon: VIRTIO_BALLOON_F_SG

2017-08-18 Thread Wei Wang

On 08/18/2017 10:22 AM, Michael S. Tsirkin wrote:

+static void send_balloon_page_sg(struct virtio_balloon *vb,
+struct virtqueue *vq,
+void *addr,
+uint32_t size)
+{
+   unsigned int len;
+   int ret;
+
+   do {
+   ret = add_one_sg(vq, addr, size);
+   virtqueue_kick(vq);
+   wait_event(vb->acked, virtqueue_get_buf(vq, &len));
+   /*
+* It is uncommon to see the vq is full, because the sg is sent
+* one by one and the device is able to handle it in time. But
+* if that happens, we go back to retry after an entry gets
+* released.
+*/
Why send one by one though? Why not batch some s/gs and wait for all
of them to be completed? If memory if fragmented, waiting every time is
worse than what we have now (VIRTIO_BALLOON_ARRAY_PFNS_MAX at a time).



OK, I'll do batching in some fashion.


Best,
Wei





[PATCH 02/13] ALSA: arm: constify snd_pcm_ops structures

2017-08-18 Thread Arvind Yadav
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by  work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav 
---
 sound/arm/aaci.c   | 4 ++--
 sound/arm/pxa2xx-pcm.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index 4140b1b..e93b327 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -635,7 +635,7 @@ static int aaci_pcm_playback_trigger(struct 
snd_pcm_substream *substream, int cm
return ret;
 }
 
-static struct snd_pcm_ops aaci_playback_ops = {
+static const struct snd_pcm_ops aaci_playback_ops = {
.open   = aaci_pcm_open,
.close  = aaci_pcm_close,
.ioctl  = snd_pcm_lib_ioctl,
@@ -738,7 +738,7 @@ static int aaci_pcm_capture_prepare(struct 
snd_pcm_substream *substream)
return 0;
 }
 
-static struct snd_pcm_ops aaci_capture_ops = {
+static const struct snd_pcm_ops aaci_capture_ops = {
.open   = aaci_pcm_open,
.close  = aaci_pcm_close,
.ioctl  = snd_pcm_lib_ioctl,
diff --git a/sound/arm/pxa2xx-pcm.c b/sound/arm/pxa2xx-pcm.c
index 83fcfac..1c6f4b4 100644
--- a/sound/arm/pxa2xx-pcm.c
+++ b/sound/arm/pxa2xx-pcm.c
@@ -68,7 +68,7 @@ static int pxa2xx_pcm_close(struct snd_pcm_substream 
*substream)
return __pxa2xx_pcm_close(substream);
 }
 
-static struct snd_pcm_ops pxa2xx_pcm_ops = {
+static const struct snd_pcm_ops pxa2xx_pcm_ops = {
.open   = pxa2xx_pcm_open,
.close  = pxa2xx_pcm_close,
.ioctl  = snd_pcm_lib_ioctl,
-- 
1.9.1



[PATCH 00/13] constify alsa snd_pcm_ops structures

2017-08-18 Thread Arvind Yadav
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by  work with
const snd_pcm_ops. So mark the non-const structs as const.

Arvind Yadav (13):
  [PATCH 01/13] ALSA: aoa: constify snd_pcm_ops structures
  [PATCH 02/13] ALSA: arm: constify snd_pcm_ops structures
  [PATCH 03/13] ALSA: atmel: constify snd_pcm_ops structures
  [PATCH 04/13] ALSA: drivers: constify snd_pcm_ops structures
  [PATCH 05/13] ALSA: firewire: constify snd_pcm_ops structures
  [PATCH 06/13] ALSA: mips: constify snd_pcm_ops structures
  [PATCH 07/13] ALSA: parisc: constify snd_pcm_ops structures
  [PATCH 08/13] ALSA: pcmcia: constify snd_pcm_ops structures
  [PATCH 09/13] ALSA: ppc: constify snd_pcm_ops structures
  [PATCH 10/13] ALSA: sh: constify snd_pcm_ops structures
  [PATCH 11/13] ALSA: sparc: constify snd_pcm_ops structures
  [PATCH 12/13] ALSA: spi: constify snd_pcm_ops structures
  [PATCH 13/13] ALSA: usb: constify snd_pcm_ops structures

 sound/aoa/soundbus/i2sbus/pcm.c|   4 +-
 sound/arm/aaci.c   |   4 +-
 sound/arm/pxa2xx-pcm.c |   2 +-
 sound/atmel/ac97c.c|   4 +-
 sound/drivers/aloop.c  |   4 +-
 sound/drivers/ml403-ac97cr.c   |   4 +-
 sound/firewire/isight.c|   2 +-
 sound/firewire/motu/motu-pcm.c |   4 +-
 sound/mips/hal2.c  |   4 +-
 sound/mips/sgio2audio.c|   6 +-
 sound/parisc/harmony.c |   4 +-
 sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c |   2 +-
 sound/ppc/pmac.c   |   4 +-
 sound/ppc/snd_ps3.c|   2 +-
 sound/sh/aica.c|   2 +-
 sound/sh/sh_dac_audio.c|   2 +-
 sound/sparc/amd7930.c  |   4 +-
 sound/sparc/cs4231.c   |   4 +-
 sound/sparc/dbri.c |   2 +-
 sound/spi/at73c213.c   |   2 +-
 sound/usb/6fire/pcm.c  |   2 +-
 sound/usb/caiaq/audio.c|   2 +-
 sound/usb/hiface/pcm.c |   2 +-
 sound/usb/misc/ua101.c |   4 +-
 sound/usb/pcm.c|   4 +-
 sound/usb/usx2y/usbusx2yaudio.c|   2 +-
 sound/usb/usx2y/usx2yhwdeppcm.c|   2 +-
 27 files changed, 42 insertions(+), 42 deletions(-)

-- 
1.9.1



[PATCH 05/13] ALSA: firewire: constify snd_pcm_ops structures

2017-08-18 Thread Arvind Yadav
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by  work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav 
---
 sound/firewire/isight.c| 2 +-
 sound/firewire/motu/motu-pcm.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/firewire/isight.c b/sound/firewire/isight.c
index 48d6dca..5826aa8 100644
--- a/sound/firewire/isight.c
+++ b/sound/firewire/isight.c
@@ -444,7 +444,7 @@ static snd_pcm_uframes_t isight_pointer(struct 
snd_pcm_substream *substream)
 
 static int isight_create_pcm(struct isight *isight)
 {
-   static struct snd_pcm_ops ops = {
+   static const struct snd_pcm_ops ops = {
.open  = isight_open,
.close = isight_close,
.ioctl = snd_pcm_lib_ioctl,
diff --git a/sound/firewire/motu/motu-pcm.c b/sound/firewire/motu/motu-pcm.c
index a2b50df..1466e46 100644
--- a/sound/firewire/motu/motu-pcm.c
+++ b/sound/firewire/motu/motu-pcm.c
@@ -352,7 +352,7 @@ static int playback_ack(struct snd_pcm_substream *substream)
 
 int snd_motu_create_pcm_devices(struct snd_motu *motu)
 {
-   static struct snd_pcm_ops capture_ops = {
+   static const struct snd_pcm_ops capture_ops = {
.open  = pcm_open,
.close = pcm_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -365,7 +365,7 @@ int snd_motu_create_pcm_devices(struct snd_motu *motu)
.page  = snd_pcm_lib_get_vmalloc_page,
.mmap  = snd_pcm_lib_mmap_vmalloc,
};
-   static struct snd_pcm_ops playback_ops = {
+   static const struct snd_pcm_ops playback_ops = {
.open  = pcm_open,
.close = pcm_close,
.ioctl = snd_pcm_lib_ioctl,
-- 
1.9.1



[PATCH 03/13] ALSA: atmel: constify snd_pcm_ops structures

2017-08-18 Thread Arvind Yadav
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by  work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav 
---
 sound/atmel/ac97c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c
index 52b0522..70616da 100644
--- a/sound/atmel/ac97c.c
+++ b/sound/atmel/ac97c.c
@@ -461,7 +461,7 @@ static int atmel_ac97c_capture_prepare(struct 
snd_pcm_substream *substream)
return frames;
 }
 
-static struct snd_pcm_ops atmel_ac97_playback_ops = {
+static const struct snd_pcm_ops atmel_ac97_playback_ops = {
.open   = atmel_ac97c_playback_open,
.close  = atmel_ac97c_playback_close,
.ioctl  = snd_pcm_lib_ioctl,
@@ -472,7 +472,7 @@ static int atmel_ac97c_capture_prepare(struct 
snd_pcm_substream *substream)
.pointer= atmel_ac97c_playback_pointer,
 };
 
-static struct snd_pcm_ops atmel_ac97_capture_ops = {
+static const struct snd_pcm_ops atmel_ac97_capture_ops = {
.open   = atmel_ac97c_capture_open,
.close  = atmel_ac97c_capture_close,
.ioctl  = snd_pcm_lib_ioctl,
-- 
1.9.1



[PATCH 08/13] ALSA: pcmcia: constify snd_pcm_ops structures

2017-08-18 Thread Arvind Yadav
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by  work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav 
---
 sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c 
b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
index b48aa0a..a81ec25 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
@@ -266,7 +266,7 @@ static snd_pcm_uframes_t pdacf_pcm_capture_pointer(struct 
snd_pcm_substream *sub
 /*
  * operators for PCM capture
  */
-static struct snd_pcm_ops pdacf_pcm_capture_ops = {
+static const struct snd_pcm_ops pdacf_pcm_capture_ops = {
.open = pdacf_pcm_capture_open,
.close =pdacf_pcm_capture_close,
.ioctl =snd_pcm_lib_ioctl,
-- 
1.9.1



Re: [PATCH v4 04/21] doc: media/v4l-drivers: Add Qualcomm Camera Subsystem driver document

2017-08-18 Thread Hans Verkuil
Hi Todor,

A few small comments below:

On 08/08/2017 03:30 PM, Todor Tomov wrote:
> Add a document to describe Qualcomm Camera Subsystem driver.
> 
> Signed-off-by: Todor Tomov 
> ---
>  Documentation/media/v4l-drivers/qcom_camss.rst | 124 
> +
>  1 file changed, 124 insertions(+)
>  create mode 100644 Documentation/media/v4l-drivers/qcom_camss.rst
> 
> diff --git a/Documentation/media/v4l-drivers/qcom_camss.rst 
> b/Documentation/media/v4l-drivers/qcom_camss.rst
> new file mode 100644
> index 000..4707ea7
> --- /dev/null
> +++ b/Documentation/media/v4l-drivers/qcom_camss.rst
> @@ -0,0 +1,124 @@
> +.. include:: 
> +
> +Qualcomm Camera Subsystem driver
> +
> +
> +Introduction
> +
> +
> +This file documents the Qualcomm Camera Subsystem driver located under
> +drivers/media/platform/qcom/camss-8x16.
> +
> +The current version of the driver supports the Camera Subsystem found on
> +Qualcomm MSM8916 and APQ8016 processors.
> +
> +The driver implements V4L2, Media controller and V4L2 subdev interfaces.
> +Camera sensor using V4L2 subdev interface in the kernel is supported.
> +
> +The driver is implemented using as a reference the Qualcomm Camera Subsystem
> +driver for Android as found in Code Aurora [#f1]_.
> +
> +
> +Qualcomm Camera Subsystem hardware
> +--
> +
> +The Camera Subsystem hardware found on 8x16 processors and supported by the
> +driver consists of:
> +
> +- 2 CSIPHY modules. They handle the Physical layer of the CSI2 receivers.
> +  A separate camera sensor can be connected to each of the CSIPHY module;
> +- 2 CSID (CSI Decoder) modules. They handle the Protocol and Application 
> layer
> +  of the CSI2 receivers. A CSID can decode data stream from any of the 
> CSIPHY.
> +  Each CSID also contains a TG (Test Generator) block which can generate
> +  artificial input data for test purposes;
> +- ISPIF (ISP Interface) module. Handles the routing of the data streams from
> +  the CSIDs to the inputs of the VFE;
> +- VFE (Video Front End) module. Contains a pipeline of image processing 
> hardware
> +  blocks. The VFE has different input interfaces. The PIX input interface 
> feeds
> +  the input data to the image processing pipeline. Three RDI input interfaces
> +  bypass the image processing pipeline. The VFE also contains the AXI bus
> +  interface which writes the output data to memory.

Can you explain what PIX and RDI stand for?

I would also think it is a good idea to add a comment at the top of the various
subdev sources that say a bit more than just "CSID Module".

A simple "CSID (CSI Decoder) Module" is enough. Just so the reader knows what
it is all about.

Otherwise I don't have any more comments about this series.

I don't need a v5 for this, if you can just post one patch for this 
documentation
and one patch improving the source comments as described above, then that's
fine with me.

Regards,

Hans

> +
> +
> +Supported functionality
> +---
> +
> +The current version of the driver supports:
> +
> +- input from camera sensor via CSIPHY;
> +- generation of test input data by the TG in CSID;
> +- raw dump of the input data to memory. RDI interface of VFE is supported.
> +  PIX interface (ISP processing, statistics engines, resize/crop, format
> +  conversion) is not supported in the current version;
> +- concurrent and independent usage of two data inputs - could be camera 
> sensors
> +  and/or TG.
> +
> +
> +Driver Architecture and Design
> +--
> +
> +The driver implements the V4L2 subdev interface. With the goal to model the
> +hardware links between the modules and to expose a clean, logical and usable
> +interface, the driver is split into V4L2 sub-devices as follows:
> +
> +- 2 CSIPHY sub-devices - each CSIPHY is represented by a single sub-device;
> +- 2 CSID sub-devices - each CSID is represented by a single sub-device;
> +- 2 ISPIF sub-devices - ISPIF is represented by a number of sub-devices equal
> +  to the number of CSID sub-devices;
> +- 3 VFE sub-devices - VFE is represented by a number of sub-devices equal to
> +  the number of RDI input interfaces.
> +
> +The considerations to split the driver in this particular way are as follows:
> +
> +- representing CSIPHY and CSID modules by a separate sub-device for each 
> module
> +  allows to model the hardware links between these modules;
> +- representing VFE by a separate sub-devices for each RDI input interface 
> allows
> +  to use the three RDI interfaces concurently and independently as this is
> +  supported by the hardware;
> +- representing ISPIF by a number of sub-devices equal to the number of CSID
> +  sub-devices allows to create linear media controller pipelines when using 
> two
> +  cameras simultaneously. This avoids branches in the pipelines which 
> otherwise
> +  will require a) userspace and b) media framework (e.g. power on/off
> +  operations) to 

[PATCH 07/13] ALSA: parisc: constify snd_pcm_ops structures

2017-08-18 Thread Arvind Yadav
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by  work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav 
---
 sound/parisc/harmony.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c
index 5911eb3..7bf43e9 100644
--- a/sound/parisc/harmony.c
+++ b/sound/parisc/harmony.c
@@ -596,7 +596,7 @@
return snd_pcm_lib_free_pages(ss);
 }
 
-static struct snd_pcm_ops snd_harmony_playback_ops = {
+static const struct snd_pcm_ops snd_harmony_playback_ops = {
.open = snd_harmony_playback_open,
.close = snd_harmony_playback_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -607,7 +607,7 @@
.pointer = snd_harmony_playback_pointer,
 };
 
-static struct snd_pcm_ops snd_harmony_capture_ops = {
+static const struct snd_pcm_ops snd_harmony_capture_ops = {
 .open = snd_harmony_capture_open,
 .close = snd_harmony_capture_close,
 .ioctl = snd_pcm_lib_ioctl,
-- 
1.9.1



[PATCH 10/13] ALSA: sh: constify snd_pcm_ops structures

2017-08-18 Thread Arvind Yadav
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by  work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav 
---
 sound/sh/aica.c | 2 +-
 sound/sh/sh_dac_audio.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/sh/aica.c b/sound/sh/aica.c
index ab4802d..c1635f7 100644
--- a/sound/sh/aica.c
+++ b/sound/sh/aica.c
@@ -436,7 +436,7 @@ static unsigned long snd_aicapcm_pcm_pointer(struct 
snd_pcm_substream
return readl(AICA_CONTROL_CHANNEL_SAMPLE_NUMBER);
 }
 
-static struct snd_pcm_ops snd_aicapcm_playback_ops = {
+static const struct snd_pcm_ops snd_aicapcm_playback_ops = {
.open = snd_aicapcm_pcm_open,
.close = snd_aicapcm_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
diff --git a/sound/sh/sh_dac_audio.c b/sound/sh/sh_dac_audio.c
index c1e00ed..b348be9 100644
--- a/sound/sh/sh_dac_audio.c
+++ b/sound/sh/sh_dac_audio.c
@@ -252,7 +252,7 @@ snd_pcm_uframes_t snd_sh_dac_pcm_pointer(struct 
snd_pcm_substream *substream)
 }
 
 /* pcm ops */
-static struct snd_pcm_ops snd_sh_dac_pcm_ops = {
+static const struct snd_pcm_ops snd_sh_dac_pcm_ops = {
.open   = snd_sh_dac_pcm_open,
.close  = snd_sh_dac_pcm_close,
.ioctl  = snd_pcm_lib_ioctl,
-- 
1.9.1



[PATCH 13/13] ALSA: usb: constify snd_pcm_ops structures

2017-08-18 Thread Arvind Yadav
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by  work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav 
---
 sound/usb/6fire/pcm.c   | 2 +-
 sound/usb/caiaq/audio.c | 2 +-
 sound/usb/hiface/pcm.c  | 2 +-
 sound/usb/misc/ua101.c  | 4 ++--
 sound/usb/pcm.c | 4 ++--
 sound/usb/usx2y/usbusx2yaudio.c | 2 +-
 sound/usb/usx2y/usx2yhwdeppcm.c | 2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/sound/usb/6fire/pcm.c b/sound/usb/6fire/pcm.c
index 36f4115..224a6a5 100644
--- a/sound/usb/6fire/pcm.c
+++ b/sound/usb/6fire/pcm.c
@@ -555,7 +555,7 @@ static snd_pcm_uframes_t usb6fire_pcm_pointer(
return ret;
 }
 
-static struct snd_pcm_ops pcm_ops = {
+static const struct snd_pcm_ops pcm_ops = {
.open = usb6fire_pcm_open,
.close = usb6fire_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c
index 8f66ba7..af5ad84 100644
--- a/sound/usb/caiaq/audio.c
+++ b/sound/usb/caiaq/audio.c
@@ -338,7 +338,7 @@ static int snd_usb_caiaq_pcm_trigger(struct 
snd_pcm_substream *sub, int cmd)
 }
 
 /* operators for both playback and capture */
-static struct snd_pcm_ops snd_usb_caiaq_ops = {
+static const struct snd_pcm_ops snd_usb_caiaq_ops = {
.open = snd_usb_caiaq_substream_open,
.close =snd_usb_caiaq_substream_close,
.ioctl =snd_pcm_lib_ioctl,
diff --git a/sound/usb/hiface/pcm.c b/sound/usb/hiface/pcm.c
index 33db205..175d8d6 100644
--- a/sound/usb/hiface/pcm.c
+++ b/sound/usb/hiface/pcm.c
@@ -513,7 +513,7 @@ static snd_pcm_uframes_t hiface_pcm_pointer(struct 
snd_pcm_substream *alsa_sub)
return bytes_to_frames(alsa_sub->runtime, dma_offset);
 }
 
-static struct snd_pcm_ops pcm_ops = {
+static const struct snd_pcm_ops pcm_ops = {
.open = hiface_pcm_open,
.close = hiface_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
diff --git a/sound/usb/misc/ua101.c b/sound/usb/misc/ua101.c
index c19a5dd..71a0e9e 100644
--- a/sound/usb/misc/ua101.c
+++ b/sound/usb/misc/ua101.c
@@ -890,7 +890,7 @@ static snd_pcm_uframes_t playback_pcm_pointer(struct 
snd_pcm_substream *subs)
return ua101_pcm_pointer(ua, &ua->playback);
 }
 
-static struct snd_pcm_ops capture_pcm_ops = {
+static const struct snd_pcm_ops capture_pcm_ops = {
.open = capture_pcm_open,
.close = capture_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -903,7 +903,7 @@ static snd_pcm_uframes_t playback_pcm_pointer(struct 
snd_pcm_substream *subs)
.mmap = snd_pcm_lib_mmap_vmalloc,
 };
 
-static struct snd_pcm_ops playback_pcm_ops = {
+static const struct snd_pcm_ops playback_pcm_ops = {
.open = playback_pcm_open,
.close = playback_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index 9aa5b18..f9634c9 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -1690,7 +1690,7 @@ static int snd_usb_substream_capture_trigger(struct 
snd_pcm_substream *substream
return -EINVAL;
 }
 
-static struct snd_pcm_ops snd_usb_playback_ops = {
+static const struct snd_pcm_ops snd_usb_playback_ops = {
.open = snd_usb_playback_open,
.close =snd_usb_playback_close,
.ioctl =snd_pcm_lib_ioctl,
@@ -1703,7 +1703,7 @@ static int snd_usb_substream_capture_trigger(struct 
snd_pcm_substream *substream
.mmap = snd_pcm_lib_mmap_vmalloc,
 };
 
-static struct snd_pcm_ops snd_usb_capture_ops = {
+static const struct snd_pcm_ops snd_usb_capture_ops = {
.open = snd_usb_capture_open,
.close =snd_usb_capture_close,
.ioctl =snd_pcm_lib_ioctl,
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c
index dd40ca9..f412d8b 100644
--- a/sound/usb/usx2y/usbusx2yaudio.c
+++ b/sound/usb/usx2y/usbusx2yaudio.c
@@ -907,7 +907,7 @@ static int snd_usX2Y_pcm_close(struct snd_pcm_substream 
*substream)
 }
 
 
-static struct snd_pcm_ops snd_usX2Y_pcm_ops = 
+static const struct snd_pcm_ops snd_usX2Y_pcm_ops =
 {
.open = snd_usX2Y_pcm_open,
.close =snd_usX2Y_pcm_close,
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c
index d51c7fd..0d05052 100644
--- a/sound/usb/usx2y/usx2yhwdeppcm.c
+++ b/sound/usb/usx2y/usx2yhwdeppcm.c
@@ -587,7 +587,7 @@ static int snd_usX2Y_usbpcm_close(struct snd_pcm_substream 
*substream)
 }
 
 
-static struct snd_pcm_ops snd_usX2Y_usbpcm_ops = 
+static const struct snd_pcm_ops snd_usX2Y_usbpcm_ops =
 {
.open = snd_usX2Y_usbpcm_open,
.close =snd_usX2Y_usbpcm_close,
-- 
1.9.1



[PATCH 12/13] ALSA: spi: constify snd_pcm_ops structures

2017-08-18 Thread Arvind Yadav
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by  work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav 
---
 sound/spi/at73c213.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c
index fac7e6e..1ef52ed 100644
--- a/sound/spi/at73c213.c
+++ b/sound/spi/at73c213.c
@@ -322,7 +322,7 @@ static int snd_at73c213_pcm_trigger(struct 
snd_pcm_substream *substream,
return pos;
 }
 
-static struct snd_pcm_ops at73c213_playback_ops = {
+static const struct snd_pcm_ops at73c213_playback_ops = {
.open   = snd_at73c213_pcm_open,
.close  = snd_at73c213_pcm_close,
.ioctl  = snd_pcm_lib_ioctl,
-- 
1.9.1



[PATCH 09/13] ALSA: ppc: constify snd_pcm_ops structures

2017-08-18 Thread Arvind Yadav
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by  work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav 
---
 sound/ppc/pmac.c| 4 ++--
 sound/ppc/snd_ps3.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index a5843fc..ef2ab19 100644
--- a/sound/ppc/pmac.c
+++ b/sound/ppc/pmac.c
@@ -681,7 +681,7 @@ static int snd_pmac_capture_close(struct snd_pcm_substream 
*subs)
 /*
  */
 
-static struct snd_pcm_ops snd_pmac_playback_ops = {
+static const struct snd_pcm_ops snd_pmac_playback_ops = {
.open = snd_pmac_playback_open,
.close =snd_pmac_playback_close,
.ioctl =snd_pcm_lib_ioctl,
@@ -692,7 +692,7 @@ static int snd_pmac_capture_close(struct snd_pcm_substream 
*subs)
.pointer =  snd_pmac_playback_pointer,
 };
 
-static struct snd_pcm_ops snd_pmac_capture_ops = {
+static const struct snd_pcm_ops snd_pmac_capture_ops = {
.open = snd_pmac_capture_open,
.close =snd_pmac_capture_close,
.ioctl =snd_pcm_lib_ioctl,
diff --git a/sound/ppc/snd_ps3.c b/sound/ppc/snd_ps3.c
index cdd44ab..36f34f4 100644
--- a/sound/ppc/snd_ps3.c
+++ b/sound/ppc/snd_ps3.c
@@ -772,7 +772,7 @@ static int snd_ps3_spdif_default_put(struct snd_kcontrol 
*kcontrol,
},
 };
 
-static struct snd_pcm_ops snd_ps3_pcm_spdif_ops = {
+static const struct snd_pcm_ops snd_ps3_pcm_spdif_ops = {
.open = snd_ps3_pcm_open,
.close = snd_ps3_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
-- 
1.9.1



[PATCH 11/13] ALSA: sparc: constify snd_pcm_ops structures

2017-08-18 Thread Arvind Yadav
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by  work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav 
---
 sound/sparc/amd7930.c | 4 ++--
 sound/sparc/cs4231.c  | 4 ++--
 sound/sparc/dbri.c| 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c
index 35c1f6a..2331dbf 100644
--- a/sound/sparc/amd7930.c
+++ b/sound/sparc/amd7930.c
@@ -733,7 +733,7 @@ static int snd_amd7930_hw_free(struct snd_pcm_substream 
*substream)
return snd_pcm_lib_free_pages(substream);
 }
 
-static struct snd_pcm_ops snd_amd7930_playback_ops = {
+static const struct snd_pcm_ops snd_amd7930_playback_ops = {
.open   =   snd_amd7930_playback_open,
.close  =   snd_amd7930_playback_close,
.ioctl  =   snd_pcm_lib_ioctl,
@@ -744,7 +744,7 @@ static int snd_amd7930_hw_free(struct snd_pcm_substream 
*substream)
.pointer=   snd_amd7930_playback_pointer,
 };
 
-static struct snd_pcm_ops snd_amd7930_capture_ops = {
+static const struct snd_pcm_ops snd_amd7930_capture_ops = {
.open   =   snd_amd7930_capture_open,
.close  =   snd_amd7930_capture_close,
.ioctl  =   snd_pcm_lib_ioctl,
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
index 3d7d425..3a947e0 100644
--- a/sound/sparc/cs4231.c
+++ b/sound/sparc/cs4231.c
@@ -1203,7 +1203,7 @@ static int snd_cs4231_capture_close(struct 
snd_pcm_substream *substream)
  * XXX the audio AUXIO register...
  */
 
-static struct snd_pcm_ops snd_cs4231_playback_ops = {
+static const struct snd_pcm_ops snd_cs4231_playback_ops = {
.open   =   snd_cs4231_playback_open,
.close  =   snd_cs4231_playback_close,
.ioctl  =   snd_pcm_lib_ioctl,
@@ -1214,7 +1214,7 @@ static int snd_cs4231_capture_close(struct 
snd_pcm_substream *substream)
.pointer=   snd_cs4231_playback_pointer,
 };
 
-static struct snd_pcm_ops snd_cs4231_capture_ops = {
+static const struct snd_pcm_ops snd_cs4231_capture_ops = {
.open   =   snd_cs4231_capture_open,
.close  =   snd_cs4231_capture_close,
.ioctl  =   snd_pcm_lib_ioctl,
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c
index 52063b2..87b887a 100644
--- a/sound/sparc/dbri.c
+++ b/sound/sparc/dbri.c
@@ -2213,7 +2213,7 @@ static snd_pcm_uframes_t snd_dbri_pointer(struct 
snd_pcm_substream *substream)
return ret;
 }
 
-static struct snd_pcm_ops snd_dbri_ops = {
+static const struct snd_pcm_ops snd_dbri_ops = {
.open = snd_dbri_open,
.close = snd_dbri_close,
.ioctl = snd_pcm_lib_ioctl,
-- 
1.9.1



[PATCH 06/13] ALSA: mips: constify snd_pcm_ops structures

2017-08-18 Thread Arvind Yadav
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by  work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav 
---
 sound/mips/hal2.c   | 4 ++--
 sound/mips/sgio2audio.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/mips/hal2.c b/sound/mips/hal2.c
index 3318c15..b123e16 100644
--- a/sound/mips/hal2.c
+++ b/sound/mips/hal2.c
@@ -711,7 +711,7 @@ static int hal2_capture_ack(struct snd_pcm_substream 
*substream)
 hal2_capture_transfer);
 }
 
-static struct snd_pcm_ops hal2_playback_ops = {
+static const struct snd_pcm_ops hal2_playback_ops = {
.open =hal2_playback_open,
.close =   hal2_playback_close,
.ioctl =   snd_pcm_lib_ioctl,
@@ -723,7 +723,7 @@ static int hal2_capture_ack(struct snd_pcm_substream 
*substream)
.ack = hal2_playback_ack,
 };
 
-static struct snd_pcm_ops hal2_capture_ops = {
+static const struct snd_pcm_ops hal2_capture_ops = {
.open =hal2_capture_open,
.close =   hal2_capture_close,
.ioctl =   snd_pcm_lib_ioctl,
diff --git a/sound/mips/sgio2audio.c b/sound/mips/sgio2audio.c
index 0ebc1c3..e1800c3 100644
--- a/sound/mips/sgio2audio.c
+++ b/sound/mips/sgio2audio.c
@@ -675,7 +675,7 @@ static int snd_sgio2audio_pcm_trigger(struct 
snd_pcm_substream *substream,
 }
 
 /* operators */
-static struct snd_pcm_ops snd_sgio2audio_playback1_ops = {
+static const struct snd_pcm_ops snd_sgio2audio_playback1_ops = {
.open =snd_sgio2audio_playback1_open,
.close =   snd_sgio2audio_pcm_close,
.ioctl =   snd_pcm_lib_ioctl,
@@ -688,7 +688,7 @@ static int snd_sgio2audio_pcm_trigger(struct 
snd_pcm_substream *substream,
.mmap =snd_pcm_lib_mmap_vmalloc,
 };
 
-static struct snd_pcm_ops snd_sgio2audio_playback2_ops = {
+static const struct snd_pcm_ops snd_sgio2audio_playback2_ops = {
.open =snd_sgio2audio_playback2_open,
.close =   snd_sgio2audio_pcm_close,
.ioctl =   snd_pcm_lib_ioctl,
@@ -701,7 +701,7 @@ static int snd_sgio2audio_pcm_trigger(struct 
snd_pcm_substream *substream,
.mmap =snd_pcm_lib_mmap_vmalloc,
 };
 
-static struct snd_pcm_ops snd_sgio2audio_capture_ops = {
+static const struct snd_pcm_ops snd_sgio2audio_capture_ops = {
.open =snd_sgio2audio_capture_open,
.close =   snd_sgio2audio_pcm_close,
.ioctl =   snd_pcm_lib_ioctl,
-- 
1.9.1



[PATCH 04/13] ALSA: drivers: constify snd_pcm_ops structures

2017-08-18 Thread Arvind Yadav
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by  work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav 
---
 sound/drivers/aloop.c| 4 ++--
 sound/drivers/ml403-ac97cr.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
index 54f348a..f9f0edf 100644
--- a/sound/drivers/aloop.c
+++ b/sound/drivers/aloop.c
@@ -750,7 +750,7 @@ static int loopback_close(struct snd_pcm_substream 
*substream)
return 0;
 }
 
-static struct snd_pcm_ops loopback_playback_ops = {
+static const struct snd_pcm_ops loopback_playback_ops = {
.open = loopback_open,
.close =loopback_close,
.ioctl =snd_pcm_lib_ioctl,
@@ -763,7 +763,7 @@ static int loopback_close(struct snd_pcm_substream 
*substream)
.mmap = snd_pcm_lib_mmap_vmalloc,
 };
 
-static struct snd_pcm_ops loopback_capture_ops = {
+static const struct snd_pcm_ops loopback_capture_ops = {
.open = loopback_open,
.close =loopback_close,
.ioctl =snd_pcm_lib_ioctl,
diff --git a/sound/drivers/ml403-ac97cr.c b/sound/drivers/ml403-ac97cr.c
index bdcb572..8195ae8 100644
--- a/sound/drivers/ml403-ac97cr.c
+++ b/sound/drivers/ml403-ac97cr.c
@@ -759,7 +759,7 @@ static int snd_ml403_ac97cr_capture_close(struct 
snd_pcm_substream *substream)
return 0;
 }
 
-static struct snd_pcm_ops snd_ml403_ac97cr_playback_ops = {
+static const struct snd_pcm_ops snd_ml403_ac97cr_playback_ops = {
.open = snd_ml403_ac97cr_playback_open,
.close = snd_ml403_ac97cr_playback_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -770,7 +770,7 @@ static int snd_ml403_ac97cr_capture_close(struct 
snd_pcm_substream *substream)
.pointer = snd_ml403_ac97cr_pcm_pointer,
 };
 
-static struct snd_pcm_ops snd_ml403_ac97cr_capture_ops = {
+static const struct snd_pcm_ops snd_ml403_ac97cr_capture_ops = {
.open = snd_ml403_ac97cr_capture_open,
.close = snd_ml403_ac97cr_capture_close,
.ioctl = snd_pcm_lib_ioctl,
-- 
1.9.1



[PATCH 01/13] ALSA: aoa: constify snd_pcm_ops structures

2017-08-18 Thread Arvind Yadav
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by  work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav 
---
 sound/aoa/soundbus/i2sbus/pcm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/aoa/soundbus/i2sbus/pcm.c b/sound/aoa/soundbus/i2sbus/pcm.c
index 053b09c..e618531 100644
--- a/sound/aoa/soundbus/i2sbus/pcm.c
+++ b/sound/aoa/soundbus/i2sbus/pcm.c
@@ -778,7 +778,7 @@ static snd_pcm_uframes_t i2sbus_playback_pointer(struct 
snd_pcm_substream
return i2sbus_pcm_pointer(i2sdev, 0);
 }
 
-static struct snd_pcm_ops i2sbus_playback_ops = {
+static const struct snd_pcm_ops i2sbus_playback_ops = {
.open = i2sbus_playback_open,
.close =i2sbus_playback_close,
.ioctl =snd_pcm_lib_ioctl,
@@ -848,7 +848,7 @@ static snd_pcm_uframes_t i2sbus_record_pointer(struct 
snd_pcm_substream
return i2sbus_pcm_pointer(i2sdev, 1);
 }
 
-static struct snd_pcm_ops i2sbus_record_ops = {
+static const struct snd_pcm_ops i2sbus_record_ops = {
.open = i2sbus_record_open,
.close =i2sbus_record_close,
.ioctl =snd_pcm_lib_ioctl,
-- 
1.9.1



RE: [PATCH] arm64: dts: ls1088a: Add USB support

2017-08-18 Thread Yinbo Zhu


-Original Message-
From: Shawn Guo [mailto:shawn...@kernel.org] 
Sent: Thursday, August 17, 2017 10:03 PM
To: Yinbo Zhu 
Cc: linux-de...@gforge.freescale.net; Rob Herring ; Mark 
Rutland ; Catalin Marinas ; Will 
Deacon ; Harninder Rai ; Andy Tang 
; open list: ; Ashish Kumar 
; open list ; Raghav Dogra 
; moderated list: 
Subject: Re: [PATCH] arm64: dts: ls1088a: Add USB support

On Thu, Aug 17, 2017 at 10:52:38AM +0800, yinbo@nxp.com wrote:
> From: "yinbo.zhu" 
> 
> Fix the issue that usb is not detected on ls1088ardb
> 
> Signed-off-by: yinbo.zhu 
> Signed-off-by: Ran Wang 
> ---
>  arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts |  8 
>  arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi| 18 ++
>  2 files changed, 26 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts 
> b/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts
> index e9276a5..949cd67 100644
> --- a/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts
> +++ b/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts
> @@ -145,6 +145,14 @@
>   status = "okay";
>  };
>  
> +&usb0 {
> + status = "okay";
> +};
> +
> +&usb1 {
> + status = "okay";
> +};
> +
>  &esdhc {
>   status = "okay";
>  };

Sort the labelled node alphabetically.

> diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi 
> b/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi
> index 3a3be87..0dbff29 100644
> --- a/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi
> +++ b/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi
> @@ -458,6 +458,24 @@
>   status = "disabled";
>   };
>  
> + usb0: usb3@310 {
> + compatible = "snps,dwc3";
> + reg = <0x0 0x310 0x0 0x1>;
> + interrupts = <0 80 0x4>; /* Level high type */

Use IRQ_TYPE_LEVEL_HIGH, so that you can save the comment.

> + dr_mode = "host";
> + configure-gfladj;

What is this?  I do not see it in upstream kernel.

> + snps,dis_rxdet_inp3_quirk;

You probably need a "disabled" status.

Shawn

Hi Shawn,

 About your description " You probably need a "disabled" status."
 Your meaning is that remove the property "snps,dis_rxdet_inp3_quirk;", isn't 
it?
 In fact, if remove the property , 1088ardb usb will doesn't detect.

Yinbo

> + };
> +
> + usb1: usb3@311 {
> + compatible = "snps,dwc3";
> + reg = <0x0 0x311 0x0 0x1>;
> + interrupts = <0 81 0x4>; /* Level high type */
> + dr_mode = "host";
> + configure-gfladj;
> + snps,dis_rxdet_inp3_quirk;
> + };
> +
>   sata: sata@320 {
>   compatible = "fsl,ls1088a-ahci";
>   reg = <0x0 0x320 0x0 0x1>,
> -- 
> 2.1.0.27.g96db324
> 
> 
> ___
> linux-arm-kernel mailing list
> linux-arm-ker...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


Re: [PATCH 1/3] KVM: x86: simplify ept_misconfig

2017-08-18 Thread David Hildenbrand
On 17.08.2017 18:36, Paolo Bonzini wrote:
> Calling handle_mmio_page_fault() has been unnecessary since commit
> e9ee956e311d ("KVM: x86: MMU: Move handle_mmio_page_fault() call to
> kvm_mmu_page_fault()", 2016-02-22).
> 
> handle_mmio_page_fault() can now be made static.
> 
> Signed-off-by: Paolo Bonzini 
> ---
>   v1->v2: make the function static.
> 
>  arch/x86/kvm/mmu.c | 19 ++-
>  arch/x86/kvm/mmu.h | 17 -
>  arch/x86/kvm/vmx.c | 13 +++--
>  3 files changed, 21 insertions(+), 28 deletions(-)

Reviewed-by: David Hildenbrand 


-- 

Thanks,

David


Re: [PATCH] media: venus: fix duplicated code for different branches

2017-08-18 Thread Stanimir Varbanov
Hi Gustavo,

On 08/18/2017 02:12 AM, Gustavo A. R. Silva wrote:
> Refactor code in order to avoid identical code for different branches.
> 
> This issue was detected with the help of Coccinelle.
> 
> Addresses-Coverity-ID: 1415317
> Signed-off-by: Gustavo A. R. Silva 
> ---
> This code was reported by Coverity and it was tested by compilation only.
> Please, verify if this is an actual bug.

Yes looks like copy/paste error, and yes it is a bug.

> 
>  drivers/media/platform/qcom/venus/helpers.c | 6 +-
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/venus/helpers.c 
> b/drivers/media/platform/qcom/venus/helpers.c
> index 5f4434c..8a5c467 100644
> --- a/drivers/media/platform/qcom/venus/helpers.c
> +++ b/drivers/media/platform/qcom/venus/helpers.c
> @@ -240,11 +240,7 @@ static void return_buf_error(struct venus_inst *inst,
>  {
>   struct v4l2_m2m_ctx *m2m_ctx = inst->m2m_ctx;
>  
> - if (vbuf->vb2_buf.type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
> - v4l2_m2m_src_buf_remove_by_buf(m2m_ctx, vbuf);
> - else
> - v4l2_m2m_src_buf_remove_by_buf(m2m_ctx, vbuf);

the correct fix must replace the second v4l2_m2m_src_* with v4l2_m2m_dst_*.

> -
> + v4l2_m2m_src_buf_remove_by_buf(m2m_ctx, vbuf);
>   v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_ERROR);
>  }
>  
> 

-- 
regards,
Stan


Re: [PATCH v4 04/21] doc: media/v4l-drivers: Add Qualcomm Camera Subsystem driver document

2017-08-18 Thread Todor Tomov
Hi Hans,

On 18.08.2017 10:45, Hans Verkuil wrote:
> Hi Todor,
> 
> A few small comments below:
> 
> On 08/08/2017 03:30 PM, Todor Tomov wrote:
>> Add a document to describe Qualcomm Camera Subsystem driver.
>>
>> Signed-off-by: Todor Tomov 
>> ---
>>  Documentation/media/v4l-drivers/qcom_camss.rst | 124 
>> +
>>  1 file changed, 124 insertions(+)
>>  create mode 100644 Documentation/media/v4l-drivers/qcom_camss.rst
>>
>> diff --git a/Documentation/media/v4l-drivers/qcom_camss.rst 
>> b/Documentation/media/v4l-drivers/qcom_camss.rst
>> new file mode 100644
>> index 000..4707ea7
>> --- /dev/null
>> +++ b/Documentation/media/v4l-drivers/qcom_camss.rst
>> @@ -0,0 +1,124 @@
>> +.. include:: 
>> +
>> +Qualcomm Camera Subsystem driver
>> +
>> +
>> +Introduction
>> +
>> +
>> +This file documents the Qualcomm Camera Subsystem driver located under
>> +drivers/media/platform/qcom/camss-8x16.
>> +
>> +The current version of the driver supports the Camera Subsystem found on
>> +Qualcomm MSM8916 and APQ8016 processors.
>> +
>> +The driver implements V4L2, Media controller and V4L2 subdev interfaces.
>> +Camera sensor using V4L2 subdev interface in the kernel is supported.
>> +
>> +The driver is implemented using as a reference the Qualcomm Camera Subsystem
>> +driver for Android as found in Code Aurora [#f1]_.
>> +
>> +
>> +Qualcomm Camera Subsystem hardware
>> +--
>> +
>> +The Camera Subsystem hardware found on 8x16 processors and supported by the
>> +driver consists of:
>> +
>> +- 2 CSIPHY modules. They handle the Physical layer of the CSI2 receivers.
>> +  A separate camera sensor can be connected to each of the CSIPHY module;
>> +- 2 CSID (CSI Decoder) modules. They handle the Protocol and Application 
>> layer
>> +  of the CSI2 receivers. A CSID can decode data stream from any of the 
>> CSIPHY.
>> +  Each CSID also contains a TG (Test Generator) block which can generate
>> +  artificial input data for test purposes;
>> +- ISPIF (ISP Interface) module. Handles the routing of the data streams from
>> +  the CSIDs to the inputs of the VFE;
>> +- VFE (Video Front End) module. Contains a pipeline of image processing 
>> hardware
>> +  blocks. The VFE has different input interfaces. The PIX input interface 
>> feeds
>> +  the input data to the image processing pipeline. Three RDI input 
>> interfaces
>> +  bypass the image processing pipeline. The VFE also contains the AXI bus
>> +  interface which writes the output data to memory.
> 
> Can you explain what PIX and RDI stand for?
> 
> I would also think it is a good idea to add a comment at the top of the 
> various
> subdev sources that say a bit more than just "CSID Module".
> 
> A simple "CSID (CSI Decoder) Module" is enough. Just so the reader knows what
> it is all about.
> 
> Otherwise I don't have any more comments about this series.
> 
> I don't need a v5 for this, if you can just post one patch for this 
> documentation
> and one patch improving the source comments as described above, then that's
> fine with me.

Thank you for the review again.
I'll post two additional patches to add explanations of the abbreviations.

> 
> Regards,
> 
>   Hans
> 
>> +
>> +
>> +Supported functionality
>> +---
>> +
>> +The current version of the driver supports:
>> +
>> +- input from camera sensor via CSIPHY;
>> +- generation of test input data by the TG in CSID;
>> +- raw dump of the input data to memory. RDI interface of VFE is supported.
>> +  PIX interface (ISP processing, statistics engines, resize/crop, format
>> +  conversion) is not supported in the current version;
>> +- concurrent and independent usage of two data inputs - could be camera 
>> sensors
>> +  and/or TG.
>> +
>> +
>> +Driver Architecture and Design
>> +--
>> +
>> +The driver implements the V4L2 subdev interface. With the goal to model the
>> +hardware links between the modules and to expose a clean, logical and usable
>> +interface, the driver is split into V4L2 sub-devices as follows:
>> +
>> +- 2 CSIPHY sub-devices - each CSIPHY is represented by a single sub-device;
>> +- 2 CSID sub-devices - each CSID is represented by a single sub-device;
>> +- 2 ISPIF sub-devices - ISPIF is represented by a number of sub-devices 
>> equal
>> +  to the number of CSID sub-devices;
>> +- 3 VFE sub-devices - VFE is represented by a number of sub-devices equal to
>> +  the number of RDI input interfaces.
>> +
>> +The considerations to split the driver in this particular way are as 
>> follows:
>> +
>> +- representing CSIPHY and CSID modules by a separate sub-device for each 
>> module
>> +  allows to model the hardware links between these modules;
>> +- representing VFE by a separate sub-devices for each RDI input interface 
>> allows
>> +  to use the three RDI interfaces concurently and independently as this is
>> +  supported by the hardware;
>> +- representing ISPI

Re: [PATCH v7 1/2] sched/deadline: Add support for SD_PREFER_SIBLING on find_later_rq()

2017-08-18 Thread Byungchul Park
On Fri, Aug 18, 2017 at 12:21:46AM -0700, Joel Fernandes (Google) wrote:
> Hi Byungchul,
> 
> On Thu, Aug 17, 2017 at 11:05 PM, Byungchul Park  
> wrote:
> > It would be better to avoid pushing tasks to other cpu within
> > a SD_PREFER_SIBLING domain, instead, get more chances to check other
> > siblings.
> >
> > Signed-off-by: Byungchul Park 
> > ---
> >  kernel/sched/deadline.c | 55 
> > ++---
> >  1 file changed, 52 insertions(+), 3 deletions(-)
> >
> > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> > index 0223694..8f69a37 100644
> > --- a/kernel/sched/deadline.c
> > +++ b/kernel/sched/deadline.c
> > @@ -1319,12 +1319,35 @@ static struct task_struct 
> > *pick_earliest_pushable_dl_task(struct rq *rq, int cpu
> >
> >  static DEFINE_PER_CPU(cpumask_var_t, local_cpu_mask_dl);
> >
> > +/*
> > + * Find the first cpu in: mask & sd & ~prefer
> > + */
> > +static int find_cpu(const struct cpumask *mask,
> > +   const struct sched_domain *sd,
> > +   const struct sched_domain *prefer)
> > +{
> > +   const struct cpumask *sds = sched_domain_span(sd);
> > +   const struct cpumask *ps  = prefer ? sched_domain_span(prefer) : 
> > NULL;
> > +   int cpu = -1;
> > +
> > +   while ((cpu = cpumask_next(cpu, mask)) < nr_cpu_ids) {
> 
> This can be simplified to for_each_cpu(cpu, mask) ?

Indeed, exactly.

I will use that, thank you.


Re: [PATCH 2/3] KVM: x86: Avoid guest page table walk when gpa_available is set

2017-08-18 Thread David Hildenbrand

> +++ b/arch/x86/kvm/x86.c
> @@ -4657,25 +4657,18 @@ static int emulator_read_write_onepage(unsigned long 
> addr, void *val,
>*/
>   if (vcpu->arch.gpa_available &&
>   emulator_can_use_gpa(ctxt) &&
> - vcpu_is_mmio_gpa(vcpu, addr, exception->address, write) &&
> - (addr & ~PAGE_MASK) == (exception->address & ~PAGE_MASK)) {
> - gpa = exception->address;
> - goto mmio;
> + (addr & ~PAGE_MASK) == (vcpu->arch.gpa_val & ~PAGE_MASK)) {
> + gpa = vcpu->arch.gpa_val;
> + ret = vcpu_is_mmio_gpa(vcpu, addr, gpa, write);
> + } else {
> + ret = vcpu_mmio_gva_to_gpa(vcpu, addr, &gpa, exception, write);
>   }
>  
> - ret = vcpu_mmio_gva_to_gpa(vcpu, addr, &gpa, exception, write);
> -
>   if (ret < 0)
>   return X86EMUL_PROPAGATE_FAULT;

just wondering if it makes sense to move this into the else branch (as
it logically only belongs to vcpu_mmio_gva_to_gpa)

Reviewed-by: David Hildenbrand 

-- 

Thanks,

David


Re: [PATCH] ARM: imx_v6_v7_defconfig: Add CONFIG_FW_LOADER_USER_HELPER_FALLBACK

2017-08-18 Thread Philipp Zabel
Hi Shawn,

On Thu, 2017-08-17 at 22:12 +0800, Shawn Guo wrote:
> On Thu, Aug 17, 2017 at 04:04:24PM +0200, Gary Bisson wrote:
> > Allows to load firmware files which aren't built inside the kernel.
> > 
> > Especially useful for CODA firmware (vpu_fw_imx6q.bin) which is
> > usually
> > located in the rootfs.
> > 
> > Signed-off-by: Gary Bisson 
> > ---
> > Hi Shawn,
> > 
> > I'm not sure if this patch is acceptable since I've noticed that no
> > configuration currently has that option enabled (why?).
> > 
> > As mentioned in the commit, I had to enable that in order to have
> > CODA
> > load the VPU firmware properly.
> > 
> > Another option would be to make the CODA driver a module...
> > 
> > Let me know your thoughts.
> 
> @Philipp, do you have any comments on this?
> 
> From reading of the option help text, I feel the option is not
> recommended?
> 
> config FW_LOADER_USER_HELPER_FALLBACK
> 
> This option enables / disables the invocation of user-helper
> (e.g. udev) for loading firmware files as a fallback after the
> direct file loading in kernel fails.  The user-mode helper is
> no longer required unless you have a special firmware file that
> resides in a non-standard path. Moreover, the udev support has
> been deprecated upstream.
> 
> Shawn

Building coda as a module should work fine, so I'd say this is not
necessary.

regards
Philipp


Re: [PATCH 3/3] KVM: x86: fix use of L1 MMIO areas in nested guests

2017-08-18 Thread David Hildenbrand
On 17.08.2017 18:36, Paolo Bonzini wrote:
> There is currently some confusion between nested and L1 GPAs.  The
> assignment to "direct" in kvm_mmu_page_fault tries to fix that, but
> it is not enough.  What this patch does is fence off the MMIO cache
> completely when using shadow nested page tables, since we have neither
> a GVA nor an L1 GPA to put in the cache.  This also allows some
> simplifications in kvm_mmu_page_fault and FNAME(page_fault).
> 
> The EPT misconfig likewise does not have an L1 GPA to pass to
> kvm_io_bus_write, so that must be skipped for guest mode.
> 
> Signed-off-by: Paolo Bonzini 
> ---
>   v1->v2: standardize on "nGPA" moniker, replace nested ifs with &&
> 
>  arch/x86/kvm/mmu.c | 10 +-
>  arch/x86/kvm/paging_tmpl.h |  3 +--
>  arch/x86/kvm/vmx.c |  7 ++-
>  arch/x86/kvm/x86.h |  6 +-
>  4 files changed, 21 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> index a2c592b14617..02f8c507b160 100644
> --- a/arch/x86/kvm/mmu.c
> +++ b/arch/x86/kvm/mmu.c
> @@ -3596,6 +3596,14 @@ static bool is_shadow_zero_bits_set(struct kvm_mmu 
> *mmu, u64 spte, int level)
>  
>  static bool mmio_info_in_cache(struct kvm_vcpu *vcpu, u64 addr, bool direct)
>  {
> + /*
> +  * A nested guest cannot use the MMIO cache if it is using nested
> +  * page tables, because cr2 is a nGPA while the cache stores L1's
> +  * physical addresses.

... "while the cache stores GPAs" ?

> +  */
> + if (mmu_is_nested(vcpu))
> + return false;
> +
>   if (direct)
>   return vcpu_match_mmio_gpa(vcpu, addr);
>  
> @@ -4841,7 +4849,7 @@ int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t 
> cr2, u64 error_code,
>  {
>   int r, emulation_type = EMULTYPE_RETRY;
>   enum emulation_result er;
> - bool direct = vcpu->arch.mmu.direct_map || mmu_is_nested(vcpu);
> + bool direct = vcpu->arch.mmu.direct_map;
>  
>   /* With shadow page tables, fault_address contains a GVA or nGPA.  */
>   if (vcpu->arch.mmu.direct_map) {
> diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
> index 3bb90ceeb52d..86b68dc5a649 100644
> --- a/arch/x86/kvm/paging_tmpl.h
> +++ b/arch/x86/kvm/paging_tmpl.h
> @@ -790,8 +790,7 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t 
> addr, u32 error_code,
>&map_writable))
>   return 0;
>  
> - if (handle_abnormal_pfn(vcpu, mmu_is_nested(vcpu) ? 0 : addr,
> - walker.gfn, pfn, walker.pte_access, &r))
> + if (handle_abnormal_pfn(vcpu, addr, walker.gfn, pfn, walker.pte_access, 
> &r))
>   return r;
>  
>   /*
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index e2c8b33c35d1..61389ad784e4 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -6402,8 +6402,13 @@ static int handle_ept_misconfig(struct kvm_vcpu *vcpu)
>   int ret;
>   gpa_t gpa;
>  
> + /*
> +  * A nested guest cannot optimize MMIO vmexits, because we have an
> +  * nGPA here instead of the required GPA.
> +  */
>   gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS);
> - if (!kvm_io_bus_write(vcpu, KVM_FAST_MMIO_BUS, gpa, 0, NULL)) {
> + if (!is_guest_mode(vcpu) &&
> + !kvm_io_bus_write(vcpu, KVM_FAST_MMIO_BUS, gpa, 0, NULL)) {
>   trace_kvm_fast_mmio(gpa);
>   return kvm_skip_emulated_instruction(vcpu);
>   }
> diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
> index 612067074905..113460370a7f 100644
> --- a/arch/x86/kvm/x86.h
> +++ b/arch/x86/kvm/x86.h
> @@ -90,7 +90,11 @@ static inline u32 bit(int bitno)
>  static inline void vcpu_cache_mmio_info(struct kvm_vcpu *vcpu,
>   gva_t gva, gfn_t gfn, unsigned access)
>  {
> - vcpu->arch.mmio_gva = gva & PAGE_MASK;
> + /*
> +  * If this is a shadow nested page table, the "GVA" is

s/"GVA"/GVA/ ?

> +  * actually a nGPA.
> +  */
> + vcpu->arch.mmio_gva = mmu_is_nested(vcpu) ? 0 : gva & PAGE_MASK;
>   vcpu->arch.access = access;
>   vcpu->arch.mmio_gfn = gfn;
>   vcpu->arch.mmio_gen = kvm_memslots(vcpu->kvm)->generation;
> 

Reviewed-by: David Hildenbrand 

-- 

Thanks,

David


Re: [PATCH 2/9] Implement containers as kernel objects

2017-08-18 Thread Richard Guy Briggs
On 2017-08-16 18:21, Paul Moore wrote:
> On Mon, Aug 14, 2017 at 1:47 AM, Richard Guy Briggs  wrote:
> > Hi David,
> >
> > I wanted to respond to this thread to attempt some constructive feedback,
> > better late than never.  I had a look at your fsopen/fsmount() patchset(s) 
> > to
> > support this patchset which was interesting, but doesn't directly affect my
> > work.  The primary patch of interest to the audit kernel folks (Paul Moore 
> > and
> > me) is this patch while the rest of the patchset is interesting, but not 
> > likely
> > to directly affect us.  This patch has most of what we need to solve our
> > problem.
> >
> > Paul and I agree that audit is going to have a difficult time identifying
> > containers or even namespaces without some change to the kernel.  The audit
> > subsystem in the kernel needs at least a basic clue about which container
> > caused an event to be able to report this at the appropriate level and 
> > ignore
> > it at other levels to avoid a DoS.
> 
> While there is some increased risk of "death by audit", this is really
> only an issue once we start supporting multiple audit daemons; simply
> associating auditable events with the container that triggered them
> shouldn't add any additional overhead (I hope).  For a number of use
> cases, a single auditd running outside the containers, but recording
> all their events with some type of container attribution will be
> sufficient.  This is step #1.
> 
> However, we will obviously want to go a bit further and support
> multiple audit daemons on the system to allow containers to
> record/process their own events (side note: the non-container auditd
> instance will still see all the events).  There are a number of ways
> we could tackle this, both via in-kernel and in-userspace record
> routing, each with their own pros/cons.  However, how this works is
> going to be dependent on how we identify containers and track their
> audit events: the bits from step #1.  For this reason I'm not really
> interested in worrying about the multiple auditd problem just yet;
> it's obviously important, and something to keep in mind while working
> up a solution, but it isn't something we should focus on right now.
> 
> > We also agree that there will need to be some sort of trigger from 
> > userspace to
> > indicate the creation of a container and its allocated resources and we're 
> > not
> > really picky how that is done, such as a clone flag, a syscall or a sysfs 
> > write
> > (or even a read, I suppose), but there will need to be some permission
> > restrictions, obviously.  (I'd like to see capabilities used for this by 
> > adding
> > a specific container bit to the capabilities bitmask.)
> 
> To be clear, from an audit perspective I think the only thing we would
> really care about controlling access to is the creation and assignment
> of a new audit container ID/token, not necessarily the container
> itself.  It's a small point, but an important one I think.
> 
> > I doubt we will be able to accomodate all definitions or concepts of a
> > container in a timely fashion.  We'll need to start somewhere with a minimum
> > definition so that we can get traction and actually move forward before 
> > another
> > compelling shared kernel microservice method leaves our entire community
> > behind.  I'd like to declare that a container is a full set of cloned
> > namespaces, but this is inefficient, overly constricting and unnecessary for
> > our needs.  If we could agree on a minimum definition of a container (which 
> > may
> > have only one specific cloned namespace) then we have something on which to
> > build.  I could even see a container being defined by a trigger sent from
> > userspace about a process (task) from which all its children are considered 
> > to
> > be within that container, subject to further nesting.
> 
> I really would prefer if we could avoid defining the term "container".
> Even if we manage to get it right at this particular moment, we will
> surely be made fools a year or two from now when things change.  At
> the very least lets avoid a rigid definition of container, I'll
> concede that we will probably need to have some definition simply so
> we can implement something, I just don't want the design or
> implementation to depend on a particular definition.
> 
> This comment is jumping ahead a bit, but from an audit perspective I
> think we handle this by emitting an audit record whenever a container
> ID is created which describes it as the kernel sees it; as of now that
> probably means a list of namespace IDs.  Richard mentions this in his
> email, I just wanted to make it clear that I think we should see this
> as a flexible mechanism.  At the very least we will likely see a few
> more namespaces before the world moves on from containers.
> 
> > In the simplest usable model for audit, if a container (definition implies 
> > and)
> > starts a PID namespace, then the container ID could simply be the 
> > contai

Re: [PATCH 5/5] Use __func__ instead of function name

2017-08-18 Thread Michal Suchánek

On 2017-07-29 09:24, SZ Lin wrote:

Fix following checkpatch.pl warning:
WARNING: Prefer using '"%s...", __func__' to using
the function's name, in a string

Signed-off-by: SZ Lin 
---
 drivers/char/tpm/tpm_ibmvtpm.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/char/tpm/tpm_ibmvtpm.c 
b/drivers/char/tpm/tpm_ibmvtpm.c

index e75a674b44ac..2d33acc43e25 100644
--- a/drivers/char/tpm/tpm_ibmvtpm.c
+++ b/drivers/char/tpm/tpm_ibmvtpm.c
@@ -151,7 +151,7 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip,
u8 *buf, size_t count)
rc = ibmvtpm_send_crq(ibmvtpm->vdev, be64_to_cpu(word[0]),
  be64_to_cpu(word[1]));
if (rc != H_SUCCESS) {
-   dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc);
+   dev_err(ibmvtpm->dev, "%s failed rc=%d\n", __func__, rc);


Can function name contain a %?

I would prefer dev_err(ibmvtpm->dev, __func__ " failed rc=%d\n", rc);

It's not what checkpatch advises in the above message, though.

Presumably with many messages from the same function using %s would
save space but that is not the usual case.

Thanks

Michal




Re: [PATCH] arm64: dts: ls1088a: Add USB support

2017-08-18 Thread Shawn Guo
On Fri, Aug 18, 2017 at 07:48:19AM +, Yinbo Zhu wrote:
> > diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi 
> > b/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi
> > index 3a3be87..0dbff29 100644
> > --- a/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi
> > +++ b/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi
> > @@ -458,6 +458,24 @@
> > status = "disabled";
> > };
> >  
> > +   usb0: usb3@310 {
> > +   compatible = "snps,dwc3";
> > +   reg = <0x0 0x310 0x0 0x1>;
> > +   interrupts = <0 80 0x4>; /* Level high type */
> 
> Use IRQ_TYPE_LEVEL_HIGH, so that you can save the comment.
> 
> > +   dr_mode = "host";
> > +   configure-gfladj;
> 
> What is this?  I do not see it in upstream kernel.
> 
> > +   snps,dis_rxdet_inp3_quirk;
> 
> You probably need a "disabled" status.
> 
> Shawn
> 
> Hi Shawn,
> 
>  About your description " You probably need a "disabled" status."
>  Your meaning is that remove the property "snps,dis_rxdet_inp3_quirk;", isn't 
> it?
>  In fact, if remove the property , 1088ardb usb will doesn't detect.

No, that's not what I meant.  I meant the USB device should be disabled
by default in .dtsi by having the following line.

status = "disabled";

And then if your board has the pin-out of this USB device, you have the
line below to turn on the support.

status = "okay";

Shawn


Re: [PATCH] usb: xhci: Renesas uPD720202 needs short TX quirk

2017-08-18 Thread Kai-Heng Feng
Hi,

On Fri, Aug 18, 2017 at 3:22 PM, Felipe Balbi
 wrote:
>
> hi,
>
> Kai-Heng Feng  writes:
>> When plugging Logitech C920 webcam, warning messages filled up dmesg:
>> [77117.655018] xhci_hcd :0c:00.0: WARN Successful completion on short 
>> TX: needs XHCI_TRUST_TX_LENGTH quirk?
>> [77117.659018] xhci_hcd :0c:00.0: WARN Successful completion on short 
>> TX: needs XHCI_TRUST_TX_LENGTH quirk?
>
> have you confirmed this is needed for this controller?
I just found commit d2f48f05cd2a2 ("usb: xhci: ASMedia ASM1042A
chipset need shorts TX quirk") and did the same thing for this
controller.

> Anybody from Renesas has confirmed it?
No, it's a user reported problem, please check the bug report in the link.

> Do you have an errata document to refer to?
No. Probably need Renesas guy to provide it.

>
>> [77122.622952] handle_tx_event: 541 callbacks suppressed
>>
>> No more warning messages with XHCI_TRUST_TX_LENGTH applied.
>>
>> BugLink: https://bugs.launchpad.net/bugs/1710548
>> Signed-off-by: Kai-Heng Feng 
>> ---
>>  drivers/usb/host/xhci-pci.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
>> index 8071c8fdd15e..8566b43e19ba 100644
>> --- a/drivers/usb/host/xhci-pci.c
>> +++ b/drivers/usb/host/xhci-pci.c
>> @@ -202,8 +202,10 @@ static void xhci_pci_quirks(struct device *dev, struct 
>> xhci_hcd *xhci)
>>   xhci->quirks |= XHCI_BROKEN_STREAMS;
>>   }
>>   if (pdev->vendor == PCI_VENDOR_ID_RENESAS &&
>> - pdev->device == 0x0015)
>> + pdev->device == 0x0015) {
>
> unnecessary
>
>>   xhci->quirks |= XHCI_RESET_ON_RESUME;
>> + xhci->quirks |= XHCI_TRUST_TX_LENGTH;
>
> xhci->quirks |= XHCI_RESET_ON_RESUME |
> XHCI_TRUST_TX_LENGTH;
>
>> + }
>
> unnecessary

Do you mean that this quirk just hide the warning, it doesn't fix the
root cause?

>
> --
> balbi


[PATCH v6 0/3] Add support Rockchip Soc LVDS

2017-08-18 Thread Sandy Huang
This patches add support Rockchip RK3288 LVDS support, based on patches from
Mark yao[0] and Heiko Stuebner[1].

[0]: https://github.com/RockchipOpensourceCommunity/popmetal-kernel-3.14
[1]: http://lists.infradead.org/pipermail/linux-rockchip/2015-April/002830.html

Changes:
- Update rockchip_lvds_encoder_helper_funcs to atomic API
- Add bridge function for RGB/LVDS convert to other output type
- Fix some unreasonable define
- Adapter to the latest rockchip DRM driver framework
- Add pinctrl for RGB output type
- Reseved some define for rockchip next Soc

Sandy Huang (3):
  dt-bindings: display: Add Document for Rockchip Soc LVDS
  ARM: dts: Add LVDS info for rk3288
  drm/rockchip: Add support for Rockchip Soc LVDS

 .../bindings/display/rockchip/rockchip-lvds.txt| 100 
 arch/arm/boot/dts/rk3288.dtsi  |  52 ++
 drivers/gpu/drm/rockchip/Kconfig   |   9 +
 drivers/gpu/drm/rockchip/Makefile  |   1 +
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c|   2 +
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h|   1 +
 drivers/gpu/drm/rockchip/rockchip_lvds.c   | 582 +
 drivers/gpu/drm/rockchip/rockchip_lvds.h   | 114 
 8 files changed, 861 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/rockchip/rockchip-lvds.txt
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_lvds.c
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_lvds.h

-- 
2.7.4




[PATCH v6 3/3] drm/rockchip: Add support for Rockchip Soc LVDS

2017-08-18 Thread Sandy Huang
This adds support for Rockchip soc lvds found on rk3288
Based on the patches from Mark yao and Heiko Stuebner

Signed-off-by: Sandy Huang 
Signed-off-by: Mark Yao 
Signed-off-by: Heiko Stuebner 
---
Changes:
- remove drm_bridge_detach at rockchip_lvds_unbind, because this will be
  called at drm_encoder_cleanup;
- use data-mapping instead of rockchip,data-mapping and rockchip,data-width

 drivers/gpu/drm/rockchip/Kconfig|   9 +
 drivers/gpu/drm/rockchip/Makefile   |   1 +
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c |   2 +
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h |   1 +
 drivers/gpu/drm/rockchip/rockchip_lvds.c| 582 
 drivers/gpu/drm/rockchip/rockchip_lvds.h| 114 ++
 6 files changed, 709 insertions(+)
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_lvds.c
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_lvds.h

diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig
index 50c41c0..80672f4 100644
--- a/drivers/gpu/drm/rockchip/Kconfig
+++ b/drivers/gpu/drm/rockchip/Kconfig
@@ -59,3 +59,12 @@ config ROCKCHIP_INNO_HDMI
  This selects support for Rockchip SoC specific extensions
  for the Innosilicon HDMI driver. If you want to enable
  HDMI on RK3036 based SoC, you should select this option.
+
+config ROCKCHIP_LVDS
+   bool "Rockchip LVDS support"
+   depends on DRM_ROCKCHIP
+   help
+ Choose this option to enable support for Rockchip LVDS controllers.
+ Rockchip rk3288 SoC has LVDS TX Controller can be used, and it
+ support LVDS, rgb, dual LVDS output mode. say Y to enable its
+ driver.
diff --git a/drivers/gpu/drm/rockchip/Makefile 
b/drivers/gpu/drm/rockchip/Makefile
index fa8dc9d..a881d2c 100644
--- a/drivers/gpu/drm/rockchip/Makefile
+++ b/drivers/gpu/drm/rockchip/Makefile
@@ -12,5 +12,6 @@ rockchipdrm-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp-core.o 
cdn-dp-reg.o
 rockchipdrm-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o
 rockchipdrm-$(CONFIG_ROCKCHIP_DW_MIPI_DSI) += dw-mipi-dsi.o
 rockchipdrm-$(CONFIG_ROCKCHIP_INNO_HDMI) += inno_hdmi.o
+rockchipdrm-$(CONFIG_ROCKCHIP_LVDS) += rockchip_lvds.o
 
 obj-$(CONFIG_DRM_ROCKCHIP) += rockchipdrm.o
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index c41f48a..082c251 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -445,6 +445,8 @@ static int __init rockchip_drm_init(void)
 
num_rockchip_sub_drivers = 0;
ADD_ROCKCHIP_SUB_DRIVER(vop_platform_driver, CONFIG_DRM_ROCKCHIP);
+   ADD_ROCKCHIP_SUB_DRIVER(rockchip_lvds_driver,
+   CONFIG_ROCKCHIP_LVDS);
ADD_ROCKCHIP_SUB_DRIVER(rockchip_dp_driver,
CONFIG_ROCKCHIP_ANALOGIX_DP);
ADD_ROCKCHIP_SUB_DRIVER(cdn_dp_driver, CONFIG_ROCKCHIP_CDN_DP);
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h 
b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
index c7e96b8..498dfbc 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
@@ -69,5 +69,6 @@ extern struct platform_driver dw_hdmi_rockchip_pltfm_driver;
 extern struct platform_driver dw_mipi_dsi_driver;
 extern struct platform_driver inno_hdmi_driver;
 extern struct platform_driver rockchip_dp_driver;
+extern struct platform_driver rockchip_lvds_driver;
 extern struct platform_driver vop_platform_driver;
 #endif /* _ROCKCHIP_DRM_DRV_H_ */
diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c 
b/drivers/gpu/drm/rockchip/rockchip_lvds.c
new file mode 100644
index 000..86d9a8c
--- /dev/null
+++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c
@@ -0,0 +1,582 @@
+/*
+ * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd
+ * Author:
+ *  Mark Yao 
+ *  Sandy Huang 
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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 the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "rockchip_drm_drv.h"
+#include "rockchip_drm_vop.h"
+#include "rockchip_lvds.h"
+
+#define DISPLAY_OUTPUT_RGB 0
+#define DISPLAY_OUTPUT_LVDS1
+#define DISPLAY_OUTPUT_DUAL_LVDS   2
+
+#define connector_to_lvds(c) \
+   container_of(c, struct rockchip_lvds, connector)
+
+#define encoder_to_lvds(c) \
+   container_of(c, struct rockchip_lvds, encoder)
+
+/**
+ * rockchip_lvds_soc_data - rockchip lvds Soc private data
+

Re: [PATCH v5 1/3] dt-bindings: display: Add Document for Rockchip Soc LVDS

2017-08-18 Thread Sandy Huang

Hi Rob,

在 2017/8/18 4:56, Rob Herring 写道:

On Tue, Aug 15, 2017 at 11:49:19AM +0800, Sandy Huang wrote:

This patch add Document for Rockchip Soc RK3288 LVDS,
This based on the patches from Mark yao and Heiko Stuebner.

Signed-off-by: Sandy Huang 
Signed-off-by: Mark yao 
Signed-off-by: Heiko Stuebner 
---
Changes according to Mark Yao reviews.

  .../bindings/display/rockchip/rockchip-lvds.txt| 105 +
  1 file changed, 105 insertions(+)
  create mode 100644 
Documentation/devicetree/bindings/display/rockchip/rockchip-lvds.txt

diff --git 
a/Documentation/devicetree/bindings/display/rockchip/rockchip-lvds.txt 
b/Documentation/devicetree/bindings/display/rockchip/rockchip-lvds.txt
new file mode 100644
index 000..c153411
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/rockchip/rockchip-lvds.txt
@@ -0,0 +1,105 @@
+Rockchip RK3288 LVDS interface
+
+
+Required properties:
+- compatible: matching the soc type, one of
+   - "rockchip,rk3288-lvds";
+
+- reg: physical base address of the controller and length
+   of memory mapped region.
+- clocks: must include clock specifiers corresponding to entries in the
+   clock-names property.
+- clock-names: must contain "pclk_lvds"
+
+- avdd1v0-supply: regulator phandle for 1.0V analog power
+- avdd1v8-supply: regulator phandle for 1.8V analog power
+- avdd3v3-supply: regulator phandle for 3.3V analog power
+
+- rockchip,grf: phandle to the general register files syscon
+
+Optional properties:
+- pinctrl-names: must contain a "lcdc" entry.
+- pinctrl-0: pin control group to be used for this controller.
+
+Required nodes:
+
+The lvds has two video ports as described by
+   Documentation/devicetree/bindings/media/video-interfaces.txt.
+Their connections are modeled using the OF graph bindings specified in
+   Documentation/devicetree/bindings/graph.txt.
+
+- video port 0 for the VOP inputs
+- video port 1 for either a panel or subsequent encoder
+
+the lvds panel described by
+   Documentation/devicetree/bindings/display/panel/simple-panel.txt
+
+Panel required properties:
+- rockchip,data-width : should be <18> or <24>;
+- rockchip,output: should be "rgb", "lvds" or "duallvds",
+   This describes the output face.


These either aren't needed or shouldn't be Rockchip specific. Probably
the former because no one else has them so far.

rockchip,data-width will be deleted and rockchip,output will moved to 
lvds at next version v6.



+- ports for remote LVDS output
+
+Panel optional properties:
+- rockchip,data-mapping: should be "vesa" or "jeida",
+   This describes how the color bits are laid out in the
+   serialized LVDS signal.


There's a common property for this.

I willuse data-mapping instead of rockchip,data-mapping and 
rockchip,data-width at next version.



+Example:
+
+lvds_panel: lvds-panel {
+   status = "okay";
+   compatible = "simple-panel";


Not a valid compatible. simple-panel is more a driver, than a binding.


This will be fixed next version v6;


+   enable-gpios = <&gpio7 21 GPIO_ACTIVE_HIGH>;
+   rockchip,data-mapping = "jeida";
+   rockchip,data-width = <24>;
+   rockchip,output = "rgb";
+
+   ports {
+   panel_in_lvds: endpoint {
+   remote-endpoint = <&lvds_out_panel>;
+   };
+   };
+};
+
+For Rockchip RK3288:
+
+   lvds: lvds@ff96c000 {
+   compatible = "rockchip,rk3288-lvds";
+   rockchip,grf = <&grf>;
+   reg = <0xff96c000 0x4000>;
+   clocks = <&cru PCLK_LVDS_PHY>;
+   clock-names = "pclk_lvds";
+   pinctrl-names = "lcdc";
+   pinctrl-0 = <&lcdc_ctl>;
+   avdd1v0-supply = <&vdd10_lcd>;
+   avdd1v8-supply = <&vcc18_lcd>;
+   avdd3v3-supply = <&vcca_33>;
+   rockchip,data-mapping = "jeida";
+   rockchip,data-width = <24>;
+   rockchip,output = "rgb";
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   lvds_in: port@0 {
+   reg = <0>;
+
+   lvds_in_vopb: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <&vopb_out_lvds>;
+   };
+   lvds_in_vopl: endpoint@1 {
+   reg = <1>;
+   remote-endpoint = <&vopl_out_lvds>;
+   };
+   };
+
+   lvds_out: port@1 {
+   reg = <1>;
+
+   lvds_out_panel: endpoint {
+   remote-endpoint = <&panel_in>;
+   };
+   };
+   };
+

[PATCH v6 2/3] ARM: dts: Add LVDS info for rk3288

2017-08-18 Thread Sandy Huang
add LVDS info in rk3288.dtsi for LVDS driver
This based on the patches from Mark yao and Heiko Stuebner.

Signed-off-by: Sandy Huang 
Signed-off-by: Mark yao 
Signed-off-by: Heiko Stuebner 
---
 arch/arm/boot/dts/rk3288.dtsi | 52 +++
 1 file changed, 52 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index 2484f11..c2e33b8 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -983,6 +983,11 @@
reg = <2>;
remote-endpoint = <&mipi_in_vopb>;
};
+
+   vopb_out_lvds: endpoint@3 {
+   reg = <3>;
+   remote-endpoint = <&lvds_in_vopb>;
+   };
};
};
 
@@ -1026,6 +1031,11 @@
reg = <2>;
remote-endpoint = <&mipi_in_vopl>;
};
+
+   vopl_out_lvds: endpoint@3 {
+   reg = <3>;
+   remote-endpoint = <&lvds_in_vopl>;
+   };
};
};
 
@@ -1099,6 +1109,39 @@
};
};
 
+   lvds: lvds@ff96c000 {
+   compatible = "rockchip,rk3288-lvds";
+   reg = <0xff96c000 0x4000>;
+   clocks = <&cru PCLK_LVDS_PHY>;
+   clock-names = "pclk_lvds";
+   pinctrl-names = "lcdc";
+   pinctrl-0 = <&lcdc_ctl>;
+   power-domains = <&power RK3288_PD_VIO>;
+   rockchip,grf = <&grf>;
+   status = "disabled";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   lvds_in: port@0 {
+   reg = <0>;
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   lvds_in_vopb: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <&vopb_out_lvds>;
+   };
+   lvds_in_vopl: endpoint@1 {
+   reg = <1>;
+   remote-endpoint = <&vopl_out_lvds>;
+   };
+   };
+   };
+   };
+
hdmi: hdmi@ff98 {
compatible = "rockchip,rk3288-dw-hdmi";
reg = <0xff98 0x2>;
@@ -1823,5 +1866,14 @@
rockchip,pins = ;
};
};
+
+   lcdc {
+   lcdc_ctl: lcdc-ctl {
+   rockchip,pins = <1 24 RK_FUNC_1 
&pcfg_pull_none>,
+   <1 25 RK_FUNC_1 
&pcfg_pull_none>,
+   <1 26 RK_FUNC_1 
&pcfg_pull_none>,
+   <1 27 RK_FUNC_1 
&pcfg_pull_none>;
+   };
+   };
};
 };
-- 
2.7.4




Re: [PATCH] usb: xhci: Renesas uPD720202 needs short TX quirk

2017-08-18 Thread Felipe Balbi

Hi,

Kai-Heng Feng  writes:
>>> When plugging Logitech C920 webcam, warning messages filled up dmesg:
>>> [77117.655018] xhci_hcd :0c:00.0: WARN Successful completion on short 
>>> TX: needs XHCI_TRUST_TX_LENGTH quirk?
>>> [77117.659018] xhci_hcd :0c:00.0: WARN Successful completion on short 
>>> TX: needs XHCI_TRUST_TX_LENGTH quirk?
>>
>> have you confirmed this is needed for this controller?
> I just found commit d2f48f05cd2a2 ("usb: xhci: ASMedia ASM1042A
> chipset need shorts TX quirk") and did the same thing for this
> controller.
>
>> Anybody from Renesas has confirmed it?
> No, it's a user reported problem, please check the bug report in the link.
>
>> Do you have an errata document to refer to?
> No. Probably need Renesas guy to provide it.

or confirm it. Yoshihiro, do you know if this is needed?

>>> [77122.622952] handle_tx_event: 541 callbacks suppressed
>>>
>>> No more warning messages with XHCI_TRUST_TX_LENGTH applied.
>>>
>>> BugLink: https://bugs.launchpad.net/bugs/1710548
>>> Signed-off-by: Kai-Heng Feng 
>>> ---
>>>  drivers/usb/host/xhci-pci.c | 4 +++-
>>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
>>> index 8071c8fdd15e..8566b43e19ba 100644
>>> --- a/drivers/usb/host/xhci-pci.c
>>> +++ b/drivers/usb/host/xhci-pci.c
>>> @@ -202,8 +202,10 @@ static void xhci_pci_quirks(struct device *dev, struct 
>>> xhci_hcd *xhci)
>>>   xhci->quirks |= XHCI_BROKEN_STREAMS;
>>>   }
>>>   if (pdev->vendor == PCI_VENDOR_ID_RENESAS &&
>>> - pdev->device == 0x0015)
>>> + pdev->device == 0x0015) {
>>
>> unnecessary
>>
>>>   xhci->quirks |= XHCI_RESET_ON_RESUME;
>>> + xhci->quirks |= XHCI_TRUST_TX_LENGTH;
>>
>> xhci->quirks |= XHCI_RESET_ON_RESUME |
>> XHCI_TRUST_TX_LENGTH;
>>
>>> + }
>>
>> unnecessary
>
> Do you mean that this quirk just hide the warning, it doesn't fix the
> root cause?

no, I meant that you need to add {} if you make a single statement out
of the quirks.

-- 
balbi


Re: [PATCH] ALSA: usb-audio: don't retry snd_usb_ctl_msg after timeout

2017-08-18 Thread Takashi Iwai
On Fri, 18 Aug 2017 00:17:46 +0200,
Stephen Barber wrote:
> 
> A few calls to snd_usb_ctl_msg wrap the function in a retry loop. In
> the worst case, the timeout for snd_usb_ctl_msg is 5 seconds, which when
> retried 10 times (for example, if a device is removed) could cause a
> probe to hang for ~50 seconds.
> 
> Example stack trace from 3.14 which triggered a hung task timeout:
> Call Trace:
>  [] ? inet6_set_link_af.part.35+0x12/0x12
>  [] schedule+0x6e/0x70
>  [] schedule_timeout+0xfc/0x13c
>  [] ? rcu_read_unlock_sched_notrace+0x17/0x17
>  [] __wait_for_common+0x153/0x190
>  [] ? __wait_for_common+0x153/0x190
>  [] ? wake_up_state+0x12/0x12
>  [] wait_for_completion_timeout+0x1d/0x1f
>  [] usb_start_wait_urb+0x93/0xf1
>  [] usb_control_msg+0xe1/0x11d
>  [] snd_usb_ctl_msg+0x9c/0xf1 [snd_usb_audio]
>  [] snd_usb_mixer_set_ctl_value+0x124/0xab1 [snd_usb_audio]
>  [] snd_usb_mixer_set_ctl_value+0x1c3/0xab1 [snd_usb_audio]
>  [] snd_usb_mixer_set_ctl_value+0x521/0xab1 [snd_usb_audio]
>  [] snd_usb_mixer_add_control+0x36a/0x1264 [snd_usb_audio]
>  [] snd_usb_mixer_add_control+0x805/0x1264 [snd_usb_audio]
>  [] ? usb_free_urb+0x1a/0x1c
>  [] snd_usb_mixer_add_control+0x11d9/0x1264 [snd_usb_audio]
>  [] snd_usb_create_mixer+0xbc/0x286 [snd_usb_audio]
>  [] 0xc02cac17
>  [] usb_probe_interface+0x17c/0x21c
>  [] driver_probe_device+0xae/0x1fa
>  [] __device_attach_driver+0x5f/0x66
>  [] ? driver_probe_device+0x1fa/0x1fa
>  [] bus_for_each_drv+0x87/0xaa
>  [] __device_attach+0x9d/0x101
>  [] device_initial_probe+0x13/0x15
>  [] bus_probe_device+0x33/0x96
>  [] device_add+0x328/0x547
>  [] usb_set_configuration+0x624/0x674
>  [] generic_probe+0x45/0x77
>  [] usb_probe_device+0x2d/0x40
>  [] driver_probe_device+0xae/0x1fa
>  [] __device_attach_driver+0x5f/0x66
>  [] ? driver_probe_device+0x1fa/0x1fa
>  [] bus_for_each_drv+0x87/0xaa
>  [] __device_attach+0x9d/0x101
>  [] device_initial_probe+0x13/0x15
>  [] bus_probe_device+0x33/0x96
>  [] device_add+0x328/0x547
>  [] ? add_device_randomness+0x111/0x130
>  [] usb_new_device+0x2a2/0x3c0
>  [] hub_thread+0xa3d/0xeed
>  [] ? __schedule+0x41e/0x5ac
>  [] ? finish_wait+0x62/0x62
>  [] ? usb_reset_device+0x16a/0x16a
>  [] kthread+0x108/0x110
>  [] ? __kthread_parkme+0x67/0x67
>  [] ret_from_fork+0x7c/0xb0
>  [] ? __kthread_parkme+0x67/0x67
> 
> Signed-off-by: Stephen Barber 

Applied, thanks.


Takashi


Re: [PATCH 1/6] ASoC: fsl: make snd_pcm_hardware const

2017-08-18 Thread Nicolin Chen
On Thu, Aug 17, 2017 at 03:46:07PM +0530, Bhumika Goyal wrote:
> Make these const as they are only passed as the 2nd argument to the
> function snd_soc_set_runtime_hwparams, which is const.
> Done using Coccinelle.
> 
> Signed-off-by: Bhumika Goyal 

Acked-by: Nicolin Chen 


Re: [PATCH blktests v2] loop/002: Regression testing for loop device flush

2017-08-18 Thread Omar Sandoval
On Tue, Jun 27, 2017 at 12:01:47PM +0800, James Wang wrote:
> Add a regression testing for loop device. when an unbound device
> be close that take too long time. kernel will consume serveral orders
> of magnitude more wall time than it does for a mounted device.

James, sorry I forgot about this. I ended up committing a simplified
version here:
https://github.com/osandov/blktests/commit/bbe69c4cc83ddc36e5c82114890ac071d01c8ac5
Thanks for the test!


[PATCH v2] genirq/debugfs: Triggering of interrupts from userspace

2017-08-18 Thread Marc Zyngier
When developing new (and therefore buggy) interrupt related
code, it can sometimes be useful to inject interrupts without
having to rely on a device to actually generate them.

This functionnality relies either on the irqchip driver to
expose a irq_set_irqchip_state(IRQCHIP_STATE_PENDING) callback,
or on the core code to be able to retrigger a (edge-only)
interrupt.

To use this feature:

echo -n trigger > /sys/kernel/debug/irq/irqs/IRQNUM

WARNING: This is DANGEROUS, and strictly a debug feature.
Do not use it on a production system. Your HW is likely to
catch fire, your data to be corrupted, and reporting this will
make you look an even bigger fool than the idiot who wrote
this patch.

Signed-off-by: Marc Zyngier 
---
 kernel/irq/debugfs.c | 50 +-
 1 file changed, 49 insertions(+), 1 deletion(-)

diff --git a/kernel/irq/debugfs.c b/kernel/irq/debugfs.c
index 4d384edc0c64..c3fdb36dec30 100644
--- a/kernel/irq/debugfs.c
+++ b/kernel/irq/debugfs.c
@@ -5,6 +5,7 @@
  */
 #include 
 #include 
+#include 
 
 #include "internals.h"
 
@@ -171,8 +172,55 @@ static int irq_debug_open(struct inode *inode, struct file 
*file)
return single_open(file, irq_debug_show, inode->i_private);
 }
 
+static ssize_t irq_debug_write(struct file *file, const char __user *user_buf,
+  size_t count, loff_t *ppos)
+{
+   struct irq_desc *desc = file_inode(file)->i_private;
+   char buf[8] = { 0, };
+   size_t size;
+
+   size = min(sizeof(buf) - 1, count);
+   if (copy_from_user(buf, user_buf, size))
+   return -EFAULT;
+
+   if (!strncmp(buf, "trigger", size)) {
+   unsigned long flags;
+   int err;
+
+   /* Try the HW interface first */
+   err = irq_set_irqchip_state(irq_desc_get_irq(desc),
+   IRQCHIP_STATE_PENDING, true);
+   if (!err)
+   return count;
+
+   /*
+* Otherwise, try to inject via the resend interface,
+* which may or may not succeed.
+*/
+   chip_bus_lock(desc);
+   raw_spin_lock_irqsave(&desc->lock, flags);
+
+   if (irq_settings_is_level(desc)) {
+   /* Can't do level, sorry */
+   err = -EINVAL;
+   } else {
+   desc->istate |= IRQS_PENDING;
+   check_irq_resend(desc);
+   err = 0;
+   }
+
+   raw_spin_unlock_irqrestore(&desc->lock, flags);
+   chip_bus_sync_unlock(desc);
+
+   return err ? err : count;
+   }
+
+   return count;
+}
+
 static const struct file_operations dfs_irq_ops = {
.open   = irq_debug_open,
+   .write  = irq_debug_write,
.read   = seq_read,
.llseek = seq_lseek,
.release= single_release,
@@ -186,7 +234,7 @@ void irq_add_debugfs_entry(unsigned int irq, struct 
irq_desc *desc)
return;
 
sprintf(name, "%d", irq);
-   desc->debugfs_file = debugfs_create_file(name, 0444, irq_dir, desc,
+   desc->debugfs_file = debugfs_create_file(name, 0644, irq_dir, desc,
 &dfs_irq_ops);
 }
 
-- 
2.11.0



[PATCH v6 1/3] dt-bindings: display: Add Document for Rockchip Soc LVDS

2017-08-18 Thread Sandy Huang
This patch add Document for Rockchip Soc RK3288 LVDS,
This based on the patches from Mark yao and Heiko Stuebner.

Signed-off-by: Sandy Huang 
Signed-off-by: Mark yao 
Signed-off-by: Heiko Stuebner 
---
Changes:
- use data-mapping instead of rockchip,data-mapping and rockchip,data-width
- move rockchip,output to lvds node

 .../bindings/display/rockchip/rockchip-lvds.txt| 100 +
 1 file changed, 100 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/rockchip/rockchip-lvds.txt

diff --git 
a/Documentation/devicetree/bindings/display/rockchip/rockchip-lvds.txt 
b/Documentation/devicetree/bindings/display/rockchip/rockchip-lvds.txt
new file mode 100644
index 000..a33821b
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/rockchip/rockchip-lvds.txt
@@ -0,0 +1,100 @@
+Rockchip RK3288 LVDS interface
+
+
+Required properties:
+- compatible: matching the soc type, one of
+   - "rockchip,rk3288-lvds";
+
+- reg: physical base address of the controller and length
+   of memory mapped region.
+- clocks: must include clock specifiers corresponding to entries in the
+   clock-names property.
+- clock-names: must contain "pclk_lvds"
+
+- avdd1v0-supply: regulator phandle for 1.0V analog power
+- avdd1v8-supply: regulator phandle for 1.8V analog power
+- avdd3v3-supply: regulator phandle for 3.3V analog power
+
+- rockchip,grf: phandle to the general register files syscon
+- rockchip,output: "rgb", "lvds" or "duallvds", This describes the output face.
+
+Optional properties:
+- pinctrl-names: must contain a "lcdc" entry.
+- pinctrl-0: pin control group to be used for this controller.
+
+Required nodes:
+
+The lvds has two video ports as described by
+   Documentation/devicetree/bindings/media/video-interfaces.txt.
+Their connections are modeled using the OF graph bindings specified in
+   Documentation/devicetree/bindings/graph.txt.
+
+- video port 0 for the VOP inputs
+- video port 1 for either a panel or subsequent encoder
+
+the lvds panel described by
+   Documentation/devicetree/bindings/display/panel/simple-panel.txt
+
+Panel required properties:
+- ports for remote LVDS output
+
+Panel optional properties:
+- data-mapping: should be "vesa-24","jeida-24" or "jeida-18".
+This describes decribed by:
+   Documentation/devicetree/bindings/display/panel/panel-lvds.txt
+
+Example:
+
+lvds_panel: lvds-panel {
+   status = "okay";
+   compatible = "auo,b101ean01";
+   enable-gpios = <&gpio7 21 GPIO_ACTIVE_HIGH>;
+   data-mapping = "jeida-24";
+
+   ports {
+   panel_in_lvds: endpoint {
+   remote-endpoint = <&lvds_out_panel>;
+   };
+   };
+};
+
+For Rockchip RK3288:
+
+   lvds: lvds@ff96c000 {
+   compatible = "rockchip,rk3288-lvds";
+   rockchip,grf = <&grf>;
+   reg = <0xff96c000 0x4000>;
+   clocks = <&cru PCLK_LVDS_PHY>;
+   clock-names = "pclk_lvds";
+   pinctrl-names = "lcdc";
+   pinctrl-0 = <&lcdc_ctl>;
+   avdd1v0-supply = <&vdd10_lcd>;
+   avdd1v8-supply = <&vcc18_lcd>;
+   avdd3v3-supply = <&vcca_33>;
+   rockchip,output = "rgb";
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   lvds_in: port@0 {
+   reg = <0>;
+
+   lvds_in_vopb: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <&vopb_out_lvds>;
+   };
+   lvds_in_vopl: endpoint@1 {
+   reg = <1>;
+   remote-endpoint = <&vopl_out_lvds>;
+   };
+   };
+
+   lvds_out: port@1 {
+   reg = <1>;
+
+   lvds_out_panel: endpoint {
+   remote-endpoint = <&panel_in_lvds>;
+   };
+   };
+   };
+   };
-- 
2.7.4




Re: [PATCH v2 1/4] perf annotate stdio: Support --show-nr-samples option

2017-08-18 Thread Taeung Song

Hi Arnaldo,

On 08/18/2017 12:16 AM, Arnaldo Carvalho de Melo wrote:

Em Tue, Aug 15, 2017 at 05:06:31PM -0300, Arnaldo Carvalho de Melo escreveu:

Em Wed, Aug 16, 2017 at 12:13:09AM +0900, Taeung Song escreveu:

Add --show-nr-samples option to perf-annotate
so that it corresponds with perf-report.


I'll fold the second patch (2/4) with this one, thanks.


So, I was going to do that, please do it since there is another thing
missing here, document the new option in
tools/perf/Documentation/perf-annotate.txt.

- Arnaldo
  


Yep, got it, will add the new option --show-nr-samples
into Documentation/perf-annotate.txt

Thanks,
Taeung


- Arnaldo
  

Cc: Namhyung Kim 
Cc: Milian Wolff 
Cc: Jiri Olsa 
Signed-off-by: Taeung Song 
---
  tools/perf/builtin-annotate.c | 2 ++
  tools/perf/util/annotate.c| 6 +-
  2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 658c920..acde4cc 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -445,6 +445,8 @@ int cmd_annotate(int argc, const char **argv)
"Show event group information together"),
OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period,
"Show a column with the sum of periods"),
+   OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples,
+   "Show a column with the number of samples"),
OPT_CALLBACK_DEFAULT(0, "stdio-color", NULL, "mode",
 "'always' (default), 'never' or 'auto' only applicable 
to --stdio mode",
 stdio__config_color, "always"),
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 2dab0e5..4397a8b 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1145,6 +1145,9 @@ static int disasm_line__print(struct disasm_line *dl, 
struct symbol *sym, u64 st
if (symbol_conf.show_total_period)
color_fprintf(stdout, color, " %11" PRIu64,
  sample.period);
+   else if (symbol_conf.show_nr_samples)
+   color_fprintf(stdout, color, " %7" PRIu64,
+ sample.nr_samples);
else
color_fprintf(stdout, color, " %7.2f", percent);
}
@@ -1825,7 +1828,8 @@ int symbol__annotate_printf(struct symbol *sym, struct 
map *map,
width *= evsel->nr_members;
  
  	graph_dotted_len = printf(" %-*.*s|	Source code & Disassembly of %s for %s (%" PRIu64 " samples)\n",

- width, width, symbol_conf.show_total_period ? "Event 
count" : "Percent",
+ width, width, symbol_conf.show_total_period ? 
"Period" :
+ symbol_conf.show_nr_samples ? "Samples" : 
"Percent",
  d_filename, evsel_name, h->nr_samples);
  
  	printf("%-*.*s\n",

--
2.7.4


[PATCH 2/2] media: camss: Add abbreviations explanation

2017-08-18 Thread Todor Tomov
Add abbreviations explanation at the top header blocks in source files.

Signed-off-by: Todor Tomov 
---
 drivers/media/platform/qcom/camss-8x16/camss-csid.c  | 2 +-
 drivers/media/platform/qcom/camss-8x16/camss-csid.h  | 2 +-
 drivers/media/platform/qcom/camss-8x16/camss-ispif.c | 2 +-
 drivers/media/platform/qcom/camss-8x16/camss-ispif.h | 2 +-
 drivers/media/platform/qcom/camss-8x16/camss-vfe.c   | 2 +-
 drivers/media/platform/qcom/camss-8x16/camss-vfe.h   | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/qcom/camss-8x16/camss-csid.c 
b/drivers/media/platform/qcom/camss-8x16/camss-csid.c
index 792c14a..64df828 100644
--- a/drivers/media/platform/qcom/camss-8x16/camss-csid.c
+++ b/drivers/media/platform/qcom/camss-8x16/camss-csid.c
@@ -1,7 +1,7 @@
 /*
  * camss-csid.c
  *
- * Qualcomm MSM Camera Subsystem - CSID Module
+ * Qualcomm MSM Camera Subsystem - CSID (CSI Decoder) Module
  *
  * Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
  * Copyright (C) 2015-2017 Linaro Ltd.
diff --git a/drivers/media/platform/qcom/camss-8x16/camss-csid.h 
b/drivers/media/platform/qcom/camss-8x16/camss-csid.h
index 4df7018..8682d30 100644
--- a/drivers/media/platform/qcom/camss-8x16/camss-csid.h
+++ b/drivers/media/platform/qcom/camss-8x16/camss-csid.h
@@ -1,7 +1,7 @@
 /*
  * camss-csid.h
  *
- * Qualcomm MSM Camera Subsystem - CSID Module
+ * Qualcomm MSM Camera Subsystem - CSID (CSI Decoder) Module
  *
  * Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
  * Copyright (C) 2015-2017 Linaro Ltd.
diff --git a/drivers/media/platform/qcom/camss-8x16/camss-ispif.c 
b/drivers/media/platform/qcom/camss-8x16/camss-ispif.c
index 54d1946..24da529 100644
--- a/drivers/media/platform/qcom/camss-8x16/camss-ispif.c
+++ b/drivers/media/platform/qcom/camss-8x16/camss-ispif.c
@@ -1,7 +1,7 @@
 /*
  * camss-ispif.c
  *
- * Qualcomm MSM Camera Subsystem - ISPIF Module
+ * Qualcomm MSM Camera Subsystem - ISPIF (ISP Interface) Module
  *
  * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
  * Copyright (C) 2015-2017 Linaro Ltd.
diff --git a/drivers/media/platform/qcom/camss-8x16/camss-ispif.h 
b/drivers/media/platform/qcom/camss-8x16/camss-ispif.h
index 6659020..f668306 100644
--- a/drivers/media/platform/qcom/camss-8x16/camss-ispif.h
+++ b/drivers/media/platform/qcom/camss-8x16/camss-ispif.h
@@ -1,7 +1,7 @@
 /*
  * camss-ispif.h
  *
- * Qualcomm MSM Camera Subsystem - ISPIF Module
+ * Qualcomm MSM Camera Subsystem - ISPIF (ISP Interface) Module
  *
  * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
  * Copyright (C) 2015-2017 Linaro Ltd.
diff --git a/drivers/media/platform/qcom/camss-8x16/camss-vfe.c 
b/drivers/media/platform/qcom/camss-8x16/camss-vfe.c
index 1c86b10..94d635e 100644
--- a/drivers/media/platform/qcom/camss-8x16/camss-vfe.c
+++ b/drivers/media/platform/qcom/camss-8x16/camss-vfe.c
@@ -1,7 +1,7 @@
 /*
  * camss-vfe.c
  *
- * Qualcomm MSM Camera Subsystem - VFE Module
+ * Qualcomm MSM Camera Subsystem - VFE (Video Front End) Module
  *
  * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
  * Copyright (C) 2015-2017 Linaro Ltd.
diff --git a/drivers/media/platform/qcom/camss-8x16/camss-vfe.h 
b/drivers/media/platform/qcom/camss-8x16/camss-vfe.h
index 88c29d0..53d5b66 100644
--- a/drivers/media/platform/qcom/camss-8x16/camss-vfe.h
+++ b/drivers/media/platform/qcom/camss-8x16/camss-vfe.h
@@ -1,7 +1,7 @@
 /*
  * camss-vfe.h
  *
- * Qualcomm MSM Camera Subsystem - VFE Module
+ * Qualcomm MSM Camera Subsystem - VFE (Video Front End) Module
  *
  * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
  * Copyright (C) 2015-2017 Linaro Ltd.
-- 
2.7.4



[PATCH 1/2] doc: media/v4l-drivers/qcom_camss: Add abbreviations explanation

2017-08-18 Thread Todor Tomov
Add explanations for VFE's PIX and RDI interfaces.

Signed-off-by: Todor Tomov 
---
 Documentation/media/v4l-drivers/qcom_camss.rst | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/Documentation/media/v4l-drivers/qcom_camss.rst 
b/Documentation/media/v4l-drivers/qcom_camss.rst
index 7ef632a..9e66b7b 100644
--- a/Documentation/media/v4l-drivers/qcom_camss.rst
+++ b/Documentation/media/v4l-drivers/qcom_camss.rst
@@ -34,11 +34,12 @@ driver consists of:
 - ISPIF (ISP Interface) module. Handles the routing of the data streams from
   the CSIDs to the inputs of the VFE;
 - VFE (Video Front End) module. Contains a pipeline of image processing 
hardware
-  blocks. The VFE has different input interfaces. The PIX input interface feeds
-  the input data to the image processing pipeline. The image processing 
pipeline
-  contains also a scale and crop module at the end. Three RDI input interfaces
-  bypass the image processing pipeline. The VFE also contains the AXI bus
-  interface which writes the output data to memory.
+  blocks. The VFE has different input interfaces. The PIX (Pixel) input
+  interface feeds the input data to the image processing pipeline. The image
+  processing pipeline contains also a scale and crop module at the end. Three
+  RDI (Raw Dump Interface) input interfaces bypass the image processing
+  pipeline. The VFE also contains the AXI bus interface which writes the output
+  data to memory.
 
 
 Supported functionality
-- 
2.7.4



[PATCH] f2fs: trigger normal fsync for non-atomic_write file

2017-08-18 Thread Chao Yu
If file was not opened with atomic write mode, but user uses atomic write
ioctl to fsync datas, in the flow, we should not fsync that file with
atomic write mode.

Fixes: 608514deba38 ("f2fs: set fsync mark only for the last dnode")
Signed-off-by: Chao Yu 
---
 fs/f2fs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 3fe8f2ab0222..c93cf2a00395 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1698,7 +1698,7 @@ static int f2fs_ioc_commit_atomic_write(struct file *filp)
stat_dec_atomic_write(inode);
}
} else {
-   ret = f2fs_do_sync_file(filp, 0, LLONG_MAX, 0, true);
+   ret = f2fs_do_sync_file(filp, 0, LLONG_MAX, 0, false);
}
 err_out:
inode_unlock(inode);
-- 
2.13.1.388.g69e6b9b4f4a9



[PATCH v8 2/2] sched/rt: Add support for SD_PREFER_SIBLING on find_lowest_rq()

2017-08-18 Thread Byungchul Park
It would be better to try to check other siblings first if
SD_PREFER_SIBLING is flaged when pushing tasks - migration.

Signed-off-by: Byungchul Park 
---
 kernel/sched/rt.c | 56 ---
 1 file changed, 53 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 979b734..b6d8ba9 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1618,12 +1618,35 @@ static struct task_struct 
*pick_highest_pushable_task(struct rq *rq, int cpu)
 
 static DEFINE_PER_CPU(cpumask_var_t, local_cpu_mask);
 
+/*
+ * Find the first cpu in: mask & sd & ~prefer
+ */
+static int find_cpu(const struct cpumask *mask,
+   const struct sched_domain *sd,
+   const struct sched_domain *prefer)
+{
+   const struct cpumask *sds = sched_domain_span(sd);
+   const struct cpumask *ps  = prefer ? sched_domain_span(prefer) : NULL;
+   int cpu;
+
+   for_each_cpu(cpu, mask) {
+   if (!cpumask_test_cpu(cpu, sds))
+   continue;
+   if (ps && cpumask_test_cpu(cpu, ps))
+   continue;
+   break;
+   }
+
+   return cpu;
+}
+
 static int find_lowest_rq(struct task_struct *task)
 {
-   struct sched_domain *sd;
+   struct sched_domain *sd, *prefer = NULL;
struct cpumask *lowest_mask = this_cpu_cpumask_var_ptr(local_cpu_mask);
int this_cpu = smp_processor_id();
int cpu  = task_cpu(task);
+   int fallback_cpu = -1;
 
/* Make sure the mask is initialized first */
if (unlikely(!lowest_mask))
@@ -1668,9 +1691,29 @@ static int find_lowest_rq(struct task_struct *task)
return this_cpu;
}
 
-   best_cpu = cpumask_first_and(lowest_mask,
-sched_domain_span(sd));
+   best_cpu = find_cpu(lowest_mask, sd, prefer);
+
if (best_cpu < nr_cpu_ids) {
+   /*
+* If current domain is SD_PREFER_SIBLING
+* flaged, we have to try to check other
+* siblings first.
+*/
+   if (sd->flags & SD_PREFER_SIBLING) {
+   prefer = sd;
+
+   /*
+* fallback_cpu should be one
+* in the closest domain among
+* SD_PREFER_SIBLING domains,
+* in case that more than one
+* SD_PREFER_SIBLING domains
+* exist in the hierachy.
+*/
+   if (fallback_cpu == -1)
+   fallback_cpu = best_cpu;
+   continue;
+   }
rcu_read_unlock();
return best_cpu;
}
@@ -1679,6 +1722,13 @@ static int find_lowest_rq(struct task_struct *task)
rcu_read_unlock();
 
/*
+* If fallback_cpu is valid, all our guesses failed *except* for
+* SD_PREFER_SIBLING domain. Now, we can return the fallback cpu.
+*/
+   if (fallback_cpu != -1)
+   return fallback_cpu;
+
+   /*
 * And finally, if there were no matches within the domains
 * just give the caller *something* to work with from the compatible
 * locations.
-- 
1.9.1



[PATCH v8 1/2] sched/deadline: Add support for SD_PREFER_SIBLING on find_later_rq()

2017-08-18 Thread Byungchul Park
It would be better to try to check other siblings first if
SD_PREFER_SIBLING is flaged when pushing tasks - migration.

Signed-off-by: Byungchul Park 
---
 kernel/sched/deadline.c | 55 ++---
 1 file changed, 52 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 0223694..115250b 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1319,12 +1319,35 @@ static struct task_struct 
*pick_earliest_pushable_dl_task(struct rq *rq, int cpu
 
 static DEFINE_PER_CPU(cpumask_var_t, local_cpu_mask_dl);
 
+/*
+ * Find the first cpu in: mask & sd & ~prefer
+ */
+static int find_cpu(const struct cpumask *mask,
+   const struct sched_domain *sd,
+   const struct sched_domain *prefer)
+{
+   const struct cpumask *sds = sched_domain_span(sd);
+   const struct cpumask *ps  = prefer ? sched_domain_span(prefer) : NULL;
+   int cpu;
+
+   for_each_cpu(cpu, mask) {
+   if (!cpumask_test_cpu(cpu, sds))
+   continue;
+   if (ps && cpumask_test_cpu(cpu, ps))
+   continue;
+   break;
+   }
+
+   return cpu;
+}
+
 static int find_later_rq(struct task_struct *task)
 {
-   struct sched_domain *sd;
+   struct sched_domain *sd, *prefer = NULL;
struct cpumask *later_mask = 
this_cpu_cpumask_var_ptr(local_cpu_mask_dl);
int this_cpu = smp_processor_id();
int cpu = task_cpu(task);
+   int fallback_cpu = -1;
 
/* Make sure the mask is initialized first */
if (unlikely(!later_mask))
@@ -1376,8 +1399,7 @@ static int find_later_rq(struct task_struct *task)
return this_cpu;
}
 
-   best_cpu = cpumask_first_and(later_mask,
-   sched_domain_span(sd));
+   best_cpu = find_cpu(later_mask, sd, prefer);
/*
 * Last chance: if a cpu being in both later_mask
 * and current sd span is valid, that becomes our
@@ -1385,6 +1407,26 @@ static int find_later_rq(struct task_struct *task)
 * already under consideration through later_mask.
 */
if (best_cpu < nr_cpu_ids) {
+   /*
+* If current domain is SD_PREFER_SIBLING
+* flaged, we have to try to check other
+* siblings first.
+*/
+   if (sd->flags & SD_PREFER_SIBLING) {
+   prefer = sd;
+
+   /*
+* fallback_cpu should be one
+* in the closest domain among
+* SD_PREFER_SIBLING domains,
+* in case that more than one
+* SD_PREFER_SIBLING domains
+* exist in the hierachy.
+*/
+   if (fallback_cpu == -1)
+   fallback_cpu = best_cpu;
+   continue;
+   }
rcu_read_unlock();
return best_cpu;
}
@@ -1393,6 +1435,13 @@ static int find_later_rq(struct task_struct *task)
rcu_read_unlock();
 
/*
+* If fallback_cpu is valid, all our guesses failed *except* for
+* SD_PREFER_SIBLING domain. Now, we can return the fallback cpu.
+*/
+   if (fallback_cpu != -1)
+   return fallback_cpu;
+
+   /*
 * At this point, all our guesses failed, we just return
 * 'something', and let the caller sort the things out.
 */
-- 
1.9.1



[PATCH v8 0/2] Make find_later_rq() choose a closer cpu in topology

2017-08-18 Thread Byungchul Park
Thanks to Joel, I could fix a typo and simplify code more.

-8<-

When cpudl_find() returns any among free_cpus, the cpu might not be
closer than others, considering sched domain. For example:

   this_cpu: 15
   free_cpus: 0, 1,..., 14 (== later_mask)
   best_cpu: 0

   topology:

   0 --+
   +--+
   1 --+  |
  +-- ... --+
   2 --+  | |
   +--+ |
   3 --+|

   ... ...

   12 --+   |
+--+|
   13 --+  ||
   +-- ... -+
   14 --+  |
+--+
   15 --+

In this case, it would be best to select 14 since it's a free cpu and
closest to 15(this_cpu). However, currently the code select 0(best_cpu)
even though that's just any among free_cpus. Fix it.

Change from v7
   -. fix a trivial typo
   -. modify commit messages to explain what it does more clearly
   -. simplify code with an existing macro

Change from v6
   -. add a comment about selection of fallback_cpu incase more than one exist
   -. modify a comment explaining what we do wrt PREFER_SIBLING

Change from v5
   -. exclude two patches already picked up by peterz
  (sched/deadline: Make find_later_rq() choose a closer cpu in topology)
  (sched/deadline: Change return value of cpudl_find())
   -. apply what peterz fixed for 'prefer sibling', into deadline and rt

Change from v4
   -. remove a patch that might cause huge lock contention
  (by spin lock(&cpudl.lock) in a hot path of scheduler)

Change from v3
   -. rename closest_cpu to best_cpu so that it align with rt
   -. protect referring cpudl.elements with cpudl.lock
   -. change return value of cpudl_find() to bool

Change from v2
   -. add support for SD_PREFER_SIBLING

Change from v1
   -. clean up the patch

Byungchul Park (2):
  sched/deadline: Add support for SD_PREFER_SIBLING on find_later_rq()
  sched/rt: Add support for SD_PREFER_SIBLING on find_lowest_rq()

 kernel/sched/deadline.c | 55 +---
 kernel/sched/rt.c   | 56 ++---
 2 files changed, 105 insertions(+), 6 deletions(-)

-- 
1.9.1



[PATCH -tip v3 0/2] kprobes/x86: Another way to make insn buffer RO and cleanup

2017-08-18 Thread Masami Hiramatsu
Hi,

This series modifies how to handle RO insn buffer and
cleans up addressof operators.

The 1st patch changes the RO insn buffer handling: instead
of using set_memory_ro/rw to modify the buffer, it prepares
new instructions in another buffer and write it with
text_poke() as suggested by Ingo Molnar (Thanks!).
Since the text_poke() is safely modifying code by
mapping alias pages, it can write RO pages.
This also override alloc_insn_page() so that it returns
ROX page directly.

The 2nd one is not changed. It is a cleanup patch
to remove addressof operators ("&") since
it is meaningless anymore.

V3 has just a following update:
 - [1/2] Not to just add set_memory_ro(), introduce new
   patch to change the way to handle RO pages.

Thanks,

---

Masami Hiramatsu (2):
  kprobes/x86: Make insn buffer always ROX and use text_poke
  kprobes/x86: Remove addressof operators


 arch/x86/include/asm/kprobes.h   |4 +-
 arch/x86/kernel/kprobes/common.h |6 ++-
 arch/x86/kernel/kprobes/core.c   |   61 +
 arch/x86/kernel/kprobes/opt.c|   71 +-
 kernel/kprobes.c |2 +
 5 files changed, 86 insertions(+), 58 deletions(-)

--
Masami Hiramatsu 


[PATCH -tip v3 1/2] kprobes/x86: Make insn buffer always ROX and use text_poke

2017-08-18 Thread Masami Hiramatsu
Make insn buffer always ROX and use text_poke() to write
the copied instructions instead of set_memory_*().
This makes instruction buffer stronger against other
kernel subsystems because there is no window time
to modify the buffer.

Suggested-by: Ingo Molnar 
Signed-off-by: Masami Hiramatsu 
---
 arch/x86/kernel/kprobes/common.h |6 ++--
 arch/x86/kernel/kprobes/core.c   |   61 +++-
 arch/x86/kernel/kprobes/opt.c|   65 ++
 kernel/kprobes.c |2 +
 4 files changed, 81 insertions(+), 53 deletions(-)

diff --git a/arch/x86/kernel/kprobes/common.h b/arch/x86/kernel/kprobes/common.h
index db2182d63ed0..e2c2a1970869 100644
--- a/arch/x86/kernel/kprobes/common.h
+++ b/arch/x86/kernel/kprobes/common.h
@@ -75,11 +75,11 @@ extern unsigned long 
recover_probed_instruction(kprobe_opcode_t *buf,
  * Copy an instruction and adjust the displacement if the instruction
  * uses the %rip-relative addressing mode.
  */
-extern int __copy_instruction(u8 *dest, u8 *src, struct insn *insn);
+extern int __copy_instruction(u8 *dest, u8 *src, u8 *real, struct insn *insn);
 
 /* Generate a relative-jump/call instruction */
-extern void synthesize_reljump(void *from, void *to);
-extern void synthesize_relcall(void *from, void *to);
+extern void synthesize_reljump(void *dest, void *from, void *to);
+extern void synthesize_relcall(void *dest, void *from, void *to);
 
 #ifdef CONFIG_OPTPROBES
 extern int setup_detour_execution(struct kprobe *p, struct pt_regs *regs, int 
reenter);
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index f0153714ddac..b48e0efd668e 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -119,29 +119,29 @@ struct kretprobe_blackpoint kretprobe_blacklist[] = {
 const int kretprobe_blacklist_size = ARRAY_SIZE(kretprobe_blacklist);
 
 static nokprobe_inline void
-__synthesize_relative_insn(void *from, void *to, u8 op)
+__synthesize_relative_insn(void *dest, void *from, void *to, u8 op)
 {
struct __arch_relative_insn {
u8 op;
s32 raddr;
} __packed *insn;
 
-   insn = (struct __arch_relative_insn *)from;
+   insn = (struct __arch_relative_insn *)dest;
insn->raddr = (s32)((long)(to) - ((long)(from) + 5));
insn->op = op;
 }
 
 /* Insert a jump instruction at address 'from', which jumps to address 'to'.*/
-void synthesize_reljump(void *from, void *to)
+void synthesize_reljump(void *dest, void *from, void *to)
 {
-   __synthesize_relative_insn(from, to, RELATIVEJUMP_OPCODE);
+   __synthesize_relative_insn(dest, from, to, RELATIVEJUMP_OPCODE);
 }
 NOKPROBE_SYMBOL(synthesize_reljump);
 
 /* Insert a call instruction at address 'from', which calls address 'to'.*/
-void synthesize_relcall(void *from, void *to)
+void synthesize_relcall(void *dest, void *from, void *to)
 {
-   __synthesize_relative_insn(from, to, RELATIVECALL_OPCODE);
+   __synthesize_relative_insn(dest, from, to, RELATIVECALL_OPCODE);
 }
 NOKPROBE_SYMBOL(synthesize_relcall);
 
@@ -346,10 +346,11 @@ static int is_IF_modifier(kprobe_opcode_t *insn)
 /*
  * Copy an instruction with recovering modified instruction by kprobes
  * and adjust the displacement if the instruction uses the %rip-relative
- * addressing mode.
+ * addressing mode. Note that since @real will be the final place of copied
+ * instruction, displacement must be adjust by @real, not @dest.
  * This returns the length of copied instruction, or 0 if it has an error.
  */
-int __copy_instruction(u8 *dest, u8 *src, struct insn *insn)
+int __copy_instruction(u8 *dest, u8 *src, u8 *real, struct insn *insn)
 {
kprobe_opcode_t buf[MAX_INSN_SIZE];
unsigned long recovered_insn =
@@ -387,11 +388,11 @@ int __copy_instruction(u8 *dest, u8 *src, struct insn 
*insn)
 * have given.
 */
newdisp = (u8 *) src + (s64) insn->displacement.value
- - (u8 *) dest;
+ - (u8 *) real;
if ((s64) (s32) newdisp != newdisp) {
pr_err("Kprobes error: new displacement does not fit 
into s32 (%llx)\n", newdisp);
pr_err("\tSrc: %p, Dest: %p, old disp: %x\n",
-   src, dest, insn->displacement.value);
+   src, real, insn->displacement.value);
return 0;
}
disp = (u8 *) dest + insn_offset_displacement(insn);
@@ -402,20 +403,38 @@ int __copy_instruction(u8 *dest, u8 *src, struct insn 
*insn)
 }
 
 /* Prepare reljump right after instruction to boost */
-static void prepare_boost(struct kprobe *p, struct insn *insn)
+static int prepare_boost(kprobe_opcode_t *buf, struct kprobe *p,
+ struct insn *insn)
 {
+   int len = insn->length;
+
if (can_boost(insn, p->addr) &&
-   MAX_I

[PATCH -tip v3 2/2] kprobes/x86: Remove addressof operators

2017-08-18 Thread Masami Hiramatsu
Since commit 54a7d50b9205 ("x86: mark kprobe templates as
character arrays, not single characters") changes
optprobe_template_* to arrays, we can remove addressof
operators from those symbols.

Signed-off-by: Masami Hiramatsu 
---
 arch/x86/include/asm/kprobes.h |4 ++--
 arch/x86/kernel/kprobes/opt.c  |8 
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/x86/include/asm/kprobes.h b/arch/x86/include/asm/kprobes.h
index 6cf65437b5e5..9f2e3102e0bb 100644
--- a/arch/x86/include/asm/kprobes.h
+++ b/arch/x86/include/asm/kprobes.h
@@ -58,8 +58,8 @@ extern __visible kprobe_opcode_t optprobe_template_call[];
 extern __visible kprobe_opcode_t optprobe_template_end[];
 #define MAX_OPTIMIZED_LENGTH (MAX_INSN_SIZE + RELATIVE_ADDR_SIZE)
 #define MAX_OPTINSN_SIZE   \
-   (((unsigned long)&optprobe_template_end -   \
- (unsigned long)&optprobe_template_entry) +\
+   (((unsigned long)optprobe_template_end -\
+ (unsigned long)optprobe_template_entry) + \
 MAX_OPTIMIZED_LENGTH + RELATIVEJUMP_SIZE)
 
 extern const int kretprobe_blacklist_size;
diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c
index 22e65f0b8b34..0cae7c0f32ec 100644
--- a/arch/x86/kernel/kprobes/opt.c
+++ b/arch/x86/kernel/kprobes/opt.c
@@ -142,11 +142,11 @@ void optprobe_template_func(void);
 STACK_FRAME_NON_STANDARD(optprobe_template_func);
 
 #define TMPL_MOVE_IDX \
-   ((long)&optprobe_template_val - (long)&optprobe_template_entry)
+   ((long)optprobe_template_val - (long)optprobe_template_entry)
 #define TMPL_CALL_IDX \
-   ((long)&optprobe_template_call - (long)&optprobe_template_entry)
+   ((long)optprobe_template_call - (long)optprobe_template_entry)
 #define TMPL_END_IDX \
-   ((long)&optprobe_template_end - (long)&optprobe_template_entry)
+   ((long)optprobe_template_end - (long)optprobe_template_entry)
 
 #define INT3_SIZE sizeof(kprobe_opcode_t)
 
@@ -371,7 +371,7 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe 
*op,
}
 
/* Copy arch-dep-instance from template */
-   memcpy(buf, &optprobe_template_entry, TMPL_END_IDX);
+   memcpy(buf, optprobe_template_entry, TMPL_END_IDX);
 
/* Copy instructions into the out-of-line buffer */
ret = copy_optimized_instructions(buf + TMPL_END_IDX, op->kp.addr,



Re: [PATCH 5/5] kernel: tracepoints: add support for relative references

2017-08-18 Thread Ingo Molnar

* Ard Biesheuvel  wrote:

> -static void for_each_tracepoint_range(struct tracepoint * const *begin,
> - struct tracepoint * const *end,
> +static void for_each_tracepoint_range(const void *begin, const void *end,
>   void (*fct)(struct tracepoint *tp, void *priv),
>   void *priv)
>  {
> +#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
> + const signed int *iter;
> +
> + if (!begin)
> + return;
> + for (iter = begin; iter < (signed int *)end; iter++) {
> + fct((struct tracepoint *)((unsigned long)iter + *iter), priv);
> + }

I think checkpatch is correct here to complain about the unnecessary curly 
braces 
here.

Plus why the heavy use of 'signed int' here and elsewhere in the patches - why 
not 'int' ?

Plus #2, the heavy use of type casts looks pretty ugly to begin with - is there 
no 
way to turn this into more natural code?

Thanks,

Ingo


[PATCH v3 0/4] PCI: rockchip: Move PCIE_WAKE handling into rockchip pcie driver

2017-08-18 Thread Jeffy Chen

Currently we are handling pcie wake in mrvl wifi driver. But Brian
suggests to move it into rockchip pcie driver.

Tested on my chromebook bob(with cros 4.4 kernel and mrvl wifi).


Changes in v3:
Fix error handling

Changes in v2:
Use dev_pm_set_dedicated_wake_irq
-- Suggested by Brian Norris 

Jeffy Chen (4):
  PCI: rockchip: Fix error handlings
  PCI: rockchip: Add support for pcie wake irq
  dt-bindings: PCI: rockchip: Add support for pcie wake irq
  arm64: dts: rockchip: Handle pcie wake in pcie driver for Gru

 .../devicetree/bindings/pci/rockchip-pcie.txt  |  20 ++--
 arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi   |  15 ++-
 drivers/pci/host/pcie-rockchip.c   | 122 +
 3 files changed, 96 insertions(+), 61 deletions(-)

-- 
2.11.0




Re: [PATCH 2/3] crypto: engine - find request type with cra_type

2017-08-18 Thread Herbert Xu
On Mon, Aug 14, 2017 at 03:17:24PM +0200, Corentin Labbe wrote:
> The current method for finding request type is based on crypto_tfm_alg_type.
> 
> But in case of skcipher, it is the same than ablkcipher.
> Using cra_type for this work permits to make the distinction between the two.
> 
> Signed-off-by: Corentin Labbe 

I think you misunderstood my suggestion.  I'm not saying that
you should use cra_type to distinguish all crypto types, it should
only be used to distinguish ablkcipher from skcipher.

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


[PATCH v3 1/4] PCI: rockchip: Fix error handlings

2017-08-18 Thread Jeffy Chen
Fix error handlings in probe & resume.

Signed-off-by: Jeffy Chen 
---

Changes in v3: None
Changes in v2: None

 drivers/pci/host/pcie-rockchip.c | 103 ++-
 1 file changed, 58 insertions(+), 45 deletions(-)

diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
index 7bb9870f6d8c..e9867bcff1ff 100644
--- a/drivers/pci/host/pcie-rockchip.c
+++ b/drivers/pci/host/pcie-rockchip.c
@@ -546,25 +546,25 @@ static int rockchip_pcie_init_port(struct rockchip_pcie 
*rockchip)
err = reset_control_assert(rockchip->core_rst);
if (err) {
dev_err(dev, "assert core_rst err %d\n", err);
-   return err;
+   goto err_exit_phy;
}
 
err = reset_control_assert(rockchip->mgmt_rst);
if (err) {
dev_err(dev, "assert mgmt_rst err %d\n", err);
-   return err;
+   goto err_exit_phy;
}
 
err = reset_control_assert(rockchip->mgmt_sticky_rst);
if (err) {
dev_err(dev, "assert mgmt_sticky_rst err %d\n", err);
-   return err;
+   goto err_exit_phy;
}
 
err = reset_control_assert(rockchip->pipe_rst);
if (err) {
dev_err(dev, "assert pipe_rst err %d\n", err);
-   return err;
+   goto err_exit_phy;
}
 
udelay(10);
@@ -572,19 +572,19 @@ static int rockchip_pcie_init_port(struct rockchip_pcie 
*rockchip)
err = reset_control_deassert(rockchip->pm_rst);
if (err) {
dev_err(dev, "deassert pm_rst err %d\n", err);
-   return err;
+   goto err_exit_phy;
}
 
err = reset_control_deassert(rockchip->aclk_rst);
if (err) {
dev_err(dev, "deassert aclk_rst err %d\n", err);
-   return err;
+   goto err_exit_phy;
}
 
err = reset_control_deassert(rockchip->pclk_rst);
if (err) {
dev_err(dev, "deassert pclk_rst err %d\n", err);
-   return err;
+   goto err_exit_phy;
}
 
if (rockchip->link_gen == 2)
@@ -605,7 +605,7 @@ static int rockchip_pcie_init_port(struct rockchip_pcie 
*rockchip)
err = phy_power_on(rockchip->phy);
if (err) {
dev_err(dev, "fail to power on phy, err %d\n", err);
-   return err;
+   goto err_exit_phy;
}
 
/*
@@ -615,25 +615,25 @@ static int rockchip_pcie_init_port(struct rockchip_pcie 
*rockchip)
err = reset_control_deassert(rockchip->mgmt_sticky_rst);
if (err) {
dev_err(dev, "deassert mgmt_sticky_rst err %d\n", err);
-   return err;
+   goto err_power_off_phy;
}
 
err = reset_control_deassert(rockchip->core_rst);
if (err) {
dev_err(dev, "deassert core_rst err %d\n", err);
-   return err;
+   goto err_power_off_phy;
}
 
err = reset_control_deassert(rockchip->mgmt_rst);
if (err) {
dev_err(dev, "deassert mgmt_rst err %d\n", err);
-   return err;
+   goto err_power_off_phy;
}
 
err = reset_control_deassert(rockchip->pipe_rst);
if (err) {
dev_err(dev, "deassert pipe_rst err %d\n", err);
-   return err;
+   goto err_power_off_phy;
}
 
/* Fix the transmitted FTS count desired to exit from L0s. */
@@ -666,7 +666,7 @@ static int rockchip_pcie_init_port(struct rockchip_pcie 
*rockchip)
 500 * USEC_PER_MSEC);
if (err) {
dev_err(dev, "PCIe link training gen1 timeout!\n");
-   return -ETIMEDOUT;
+   goto err_power_off_phy;
}
 
if (rockchip->link_gen == 2) {
@@ -715,6 +715,11 @@ static int rockchip_pcie_init_port(struct rockchip_pcie 
*rockchip)
rockchip_pcie_write(rockchip, status, PCIE_RC_CONFIG_DCSR);
 
return 0;
+err_power_off_phy:
+   phy_power_off(rockchip->phy);
+err_exit_phy:
+   phy_exit(rockchip->phy);
+   return err;
 }
 
 static irqreturn_t rockchip_pcie_subsys_irq_handler(int irq, void *arg)
@@ -1051,7 +1056,7 @@ static int rockchip_pcie_set_vpcie(struct rockchip_pcie 
*rockchip)
err = regulator_enable(rockchip->vpcie3v3);
if (err) {
dev_err(dev, "fail to enable vpcie3v3 regulator\n");
-   goto err_out;
+   return err;
}
}
 
@@ -1072,14 +1077,12 @@ static int rockchip_pcie_set_vpcie(struct rockchip_pcie 
*rockchip)
}
 
return 0;
-
 err_disable_1v8:
if (!IS_ERR(rockchip->vpcie1v8))
regulator_disable(rockchip->vpcie1v8);
 err_disable_3v3:
if (!IS_ERR(rockchip->vpcie3v3))
regulator_disable(rockchip->vp

[PATCH v3 2/4] PCI: rockchip: Add support for pcie wake irq

2017-08-18 Thread Jeffy Chen
Add support for PCIE_WAKE pin in rockchip pcie driver.

Signed-off-by: Jeffy Chen 
---

Changes in v3:
Fix error handling

Changes in v2:
Use dev_pm_set_dedicated_wake_irq
-- Suggested by Brian Norris 

 drivers/pci/host/pcie-rockchip.c | 21 ++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
index e9867bcff1ff..d52318458060 100644
--- a/drivers/pci/host/pcie-rockchip.c
+++ b/drivers/pci/host/pcie-rockchip.c
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -858,7 +859,6 @@ static void rockchip_pcie_legacy_int_handler(struct 
irq_desc *desc)
chained_irq_exit(chip, desc);
 }
 
-
 /**
  * rockchip_pcie_parse_dt - Parse Device Tree
  * @rockchip: PCIe port information
@@ -1023,6 +1023,14 @@ static int rockchip_pcie_parse_dt(struct rockchip_pcie 
*rockchip)
return err;
}
 
+   device_init_wakeup(dev, true);
+   irq = platform_get_irq_byname(pdev, "wake");
+   if (irq >= 0) {
+   err = dev_pm_set_dedicated_wake_irq(dev, irq);
+   if (err)
+   dev_err(dev, "failed to setup PCIe wake IRQ\n");
+   }
+
rockchip->vpcie3v3 = devm_regulator_get_optional(dev, "vpcie3v3");
if (IS_ERR(rockchip->vpcie3v3)) {
if (PTR_ERR(rockchip->vpcie3v3) == -EPROBE_DEFER)
@@ -1390,12 +1398,13 @@ static int rockchip_pcie_probe(struct platform_device 
*pdev)
 
err = rockchip_pcie_parse_dt(rockchip);
if (err)
-   return err;
+   /* It's safe to disable wake even not enabled */
+   goto err_disable_wake;
 
err = clk_prepare_enable(rockchip->aclk_pcie);
if (err) {
dev_err(dev, "unable to enable aclk_pcie clock\n");
-   return err;
+   goto err_disable_wake;
}
 
err = clk_prepare_enable(rockchip->aclk_perf_pcie);
@@ -1529,6 +1538,9 @@ static int rockchip_pcie_probe(struct platform_device 
*pdev)
clk_disable_unprepare(rockchip->aclk_perf_pcie);
 err_disable_aclk_pcie:
clk_disable_unprepare(rockchip->aclk_pcie);
+err_disable_wake:
+   dev_pm_clear_wake_irq(dev);
+   device_init_wakeup(dev, false);
return err;
 }
 
@@ -1557,6 +1569,9 @@ static int rockchip_pcie_remove(struct platform_device 
*pdev)
if (!IS_ERR(rockchip->vpcie0v9))
regulator_disable(rockchip->vpcie0v9);
 
+   dev_pm_clear_wake_irq(dev);
+   device_init_wakeup(dev, false);
+
return 0;
 }
 
-- 
2.11.0




[PATCH v3 3/4] dt-bindings: PCI: rockchip: Add support for pcie wake irq

2017-08-18 Thread Jeffy Chen
Add an optional interrupt for PCIE_WAKE pin.

Signed-off-by: Jeffy Chen 
---

Changes in v3: None
Changes in v2: None

 .../devicetree/bindings/pci/rockchip-pcie.txt| 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/pci/rockchip-pcie.txt 
b/Documentation/devicetree/bindings/pci/rockchip-pcie.txt
index 1453a734c2f5..edd779f842fa 100644
--- a/Documentation/devicetree/bindings/pci/rockchip-pcie.txt
+++ b/Documentation/devicetree/bindings/pci/rockchip-pcie.txt
@@ -22,10 +22,13 @@ Required properties:
 - phys: From PHY bindings: Phandle for the Generic PHY for PCIe.
 - phy-names:  MUST be "pcie-phy".
 - interrupts: Three interrupt entries must be specified.
-- interrupt-names: Must include the following names
-   - "sys"
-   - "legacy"
-   - "client"
+- interrupt-names: Include the following names
+   Required:
+   - "sys"
+   - "legacy"
+   - "client"
+   Optional:
+   - "wake"
 - resets: Must contain seven entries for each entry in reset-names.
   See ../reset/reset.txt for details.
 - reset-names: Must include the following names
@@ -76,10 +79,11 @@ pcie0: pcie@f800 {
clock-names = "aclk", "aclk-perf",
  "hclk", "pm";
bus-range = <0x0 0x1>;
-   interrupts = ,
-,
-;
-   interrupt-names = "sys", "legacy", "client";
+   interrupts-extended = <&gic GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH 0>,
+ <&gic GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH 0>,
+ <&gic GIC_SPI 51 IRQ_TYPE_LEVEL_HIGH 0>,
+ <&gpio0 8 IRQ_TYPE_LEVEL_LOW>;
+   interrupt-names = "sys", "legacy", "client", "wake";
assigned-clocks = <&cru SCLK_PCIEPHY_REF>;
assigned-clock-parents = <&cru SCLK_PCIEPHY_REF100M>;
assigned-clock-rates = <1>;
-- 
2.11.0




[PATCH v3 4/4] arm64: dts: rockchip: Handle pcie wake in pcie driver for Gru

2017-08-18 Thread Jeffy Chen
Currently we are handling pcie wake irq in mrvl wifi driver.
Move it to rockchip pcie driver for Gru boards.

Signed-off-by: Jeffy Chen 
---

Changes in v3: None
Changes in v2: None

 arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi 
b/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi
index d48e98b62d09..42158512e979 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi
@@ -712,7 +712,15 @@ ap_i2c_audio: &i2c8 {
 
ep-gpios = <&gpio2 27 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
-   pinctrl-0 = <&pcie_clkreqn_cpm>, <&wifi_perst_l>;
+   pinctrl-0 = <&pcie_clkreqn_cpm>, <&wlan_host_wake_l>, <&wifi_perst_l>;
+
+   interrupts-extended = <&gic GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH 0>,
+ <&gic GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH 0>,
+ <&gic GIC_SPI 51 IRQ_TYPE_LEVEL_HIGH 0>,
+ <&gpio0 8 IRQ_TYPE_LEVEL_LOW>;
+   interrupt-names = "sys", "legacy", "client", "wake";
+   /delete-property/ interrupts;
+
vpcie3v3-supply = <&pp3300_wifi_bt>;
vpcie1v8-supply = <&wlan_pd_n>; /* HACK: see &wlan_pd_n */
vpcie0v9-supply = <&pp900_pcie>;
@@ -727,11 +735,6 @@ ap_i2c_audio: &i2c8 {
compatible = "pci1b4b,2b42";
reg = <0x8301 0x0 0x 0x0 0x0010
   0x8301 0x0 0x0010 0x0 0x0010>;
-   interrupt-parent = <&gpio0>;
-   interrupts = <8 IRQ_TYPE_LEVEL_LOW>;
-   pinctrl-names = "default";
-   pinctrl-0 = <&wlan_host_wake_l>;
-   wakeup-source;
};
};
 };
-- 
2.11.0




Re: [PATCH] ceph: check negative offsets on ceph_llseek()

2017-08-18 Thread Ilya Dryomov
On Thu, Aug 17, 2017 at 8:40 PM, Luis Henriques  wrote:
> Ilya Dryomov  writes:
>
>> On Thu, Aug 17, 2017 at 3:45 PM, Luis Henriques  wrote:
>>> Luis Henriques  writes:
>>>
 When a user requests SEEK_HOLE or SEEK_DATA with a negative offset
 ceph_llseek should return -ENXIO.  Currently -EINVAL is being returned for
 SEEK_DATA and 0 for SEEK_HOLE.
>>>
>>> Ping
>>>
>>> This patch should make xfstest generic/448 happy.
>>
>> It should or it does? ;)
>>
>
> Heh, it *does* make generic/448 happy.
>
>>
>> I saw generic/448 failures on ext4 with Darrick's recent test
>>change,
>> haven't tried ceph yet.
>
> The generic/448 test currently fails with the error codes described in
> the commit log.  I didn't found it useful to include in the commit
> log, but here's the full test output:
>
> File system supports the default behavior.
> File system does not support unwritten extents.
> File system magic#: 0xc36400
> Allocation size: 4194304
> 18. Test file with negative SEEK_{HOLE,DATA} offsets
> 18.01 SEEK_HOLE expected -1 or -1, got 0. FAIL
> 18.02 SEEK_DATA expected -1 with errno -6, got -22.   FAIL
>
> seek sanity check failed!

Applied.

Thanks,

Ilya


[PATCH] arm64: dts: ls1088a: Add USB support

2017-08-18 Thread yinbo.zhu
From: "yinbo.zhu" 

Fix the issue that usb is not detected on ls1088ardb

Signed-off-by: yinbo.zhu 
Signed-off-by: Ran Wang 
---
 arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts |  8 
 arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi| 20 
 2 files changed, 28 insertions(+)

diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts 
b/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts
index 213abb7..6c3c3bc 100644
--- a/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts
+++ b/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts
@@ -118,6 +118,14 @@
status = "okay";
 };
 
+&usb0 {
+   status = "okay";
+};
+
+&usb1 {
+   status = "okay";
+};
+
 &esdhc {
status = "okay";
 };
diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi 
b/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi
index c144d06..c23fede 100644
--- a/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi
+++ b/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi
@@ -359,6 +359,26 @@
status = "disabled";
};
 
+   usb0: usb3@310 {
+   compatible = "snps,dwc3";
+   reg = <0x0 0x310 0x0 0x1>;
+   interrupts = <0 80 IRQ_TYPE_LEVEL_HIGH>;
+   dr_mode = "host";
+   snps,quirk-frame-length-adjustment = <0x20>;
+   snps,dis_rxdet_inp3_quirk;
+   status = "disabled";
+   };
+
+   usb1: usb3@311 {
+   compatible = "snps,dwc3";
+   reg = <0x0 0x311 0x0 0x1>;
+   interrupts = <0 81 IRQ_TYPE_LEVEL_HIGH>;
+   dr_mode = "host";
+   snps,quirk-frame-length-adjustment = <0x20>;
+   snps,dis_rxdet_inp3_quirk;
+   status = "disabled";
+   };
+
sata: sata@320 {
compatible = "fsl,ls1088a-ahci";
reg = <0x0 0x320 0x0 0x1>,
-- 
2.1.0.27.g96db324



Re: [RFC PATCH v2 1/3] PCI: rockchip: Add support for pcie wake irq

2017-08-18 Thread jeffy

Hi Shawn,

On 08/18/2017 03:23 PM, Shawn Lin wrote:


@@ -1524,6 +1532,9 @@ static int rockchip_pcie_remove(struct
platform_device *pdev)
  struct device *dev = &pdev->dev;
  struct rockchip_pcie *rockchip = dev_get_drvdata(dev);
+dev_pm_clear_wake_irq(dev);
+device_init_wakeup(dev, false);
+


Looks good overall but I think we need this on the
error handling path of rockchip_pcie_probe as well?


hmm, right, will fix it, thanks.

and i also notice some other missing error handling, will fix them too:)



Re: [PATCH v14 5/5] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2017-08-18 Thread Wei Wang

On 08/18/2017 10:28 AM, Michael S. Tsirkin wrote:

On Thu, Aug 17, 2017 at 11:26:56AM +0800, Wei Wang wrote:

Add a new vq to report hints of guest free pages to the host.

Signed-off-by: Wei Wang 
Signed-off-by: Liang Li 
---
  drivers/virtio/virtio_balloon.c | 167 +++-
  include/uapi/linux/virtio_balloon.h |   1 +
  2 files changed, 147 insertions(+), 21 deletions(-)

diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 72041b4..e6755bc 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -54,11 +54,12 @@ static struct vfsmount *balloon_mnt;
  
  struct virtio_balloon {

struct virtio_device *vdev;
-   struct virtqueue *inflate_vq, *deflate_vq, *stats_vq;
+   struct virtqueue *inflate_vq, *deflate_vq, *stats_vq, *free_page_vq;
  
  	/* The balloon servicing is delegated to a freezable workqueue. */

struct work_struct update_balloon_stats_work;
struct work_struct update_balloon_size_work;
+   struct work_struct report_free_page_work;
  
  	/* Prevent updating balloon when it is being canceled. */

spinlock_t stop_update_lock;
@@ -90,6 +91,13 @@ struct virtio_balloon {
/* Memory statistics */
struct virtio_balloon_stat stats[VIRTIO_BALLOON_S_NR];
  
+	/*

+* Used by the device and driver to signal each other.
+* device->driver: start the free page report.
+* driver->device: end the free page report.
+*/
+   __virtio32 report_free_page_signal;
+
/* To register callback in oom notifier call chain */
struct notifier_block nb;
  };
@@ -174,6 +182,17 @@ static void send_balloon_page_sg(struct virtio_balloon *vb,
} while (unlikely(ret == -ENOSPC));
  }
  
+static void send_free_page_sg(struct virtqueue *vq, void *addr, uint32_t size)

+{
+   unsigned int len;
+
+   add_one_sg(vq, addr, size);
+   virtqueue_kick(vq);
+   /* Release entries if there are */
+   while (virtqueue_get_buf(vq, &len))
+   ;
+}
+
  /*
   * Send balloon pages in sgs to host. The balloon pages are recorded in the
   * page xbitmap. Each bit in the bitmap corresponds to a page of PAGE_SIZE.
@@ -511,42 +530,143 @@ static void update_balloon_size_func(struct work_struct 
*work)
queue_work(system_freezable_wq, work);
  }
  
+static void virtio_balloon_send_free_pages(void *opaque, unsigned long pfn,

+  unsigned long nr_pages)
+{
+   struct virtio_balloon *vb = (struct virtio_balloon *)opaque;
+   void *addr = (void *)pfn_to_kaddr(pfn);
+   uint32_t len = nr_pages << PAGE_SHIFT;
+
+   send_free_page_sg(vb->free_page_vq, addr, len);
+}
+
+static void report_free_page_completion(struct virtio_balloon *vb)
+{
+   struct virtqueue *vq = vb->free_page_vq;
+   struct scatterlist sg;
+   unsigned int len;
+   int ret;
+
+   sg_init_one(&sg, &vb->report_free_page_signal, sizeof(__virtio32));
+retry:
+   ret = virtqueue_add_outbuf(vq, &sg, 1, vb, GFP_KERNEL);
+   virtqueue_kick(vq);
+   if (unlikely(ret == -ENOSPC)) {
+   wait_event(vb->acked, virtqueue_get_buf(vq, &len));
+   goto retry;
+   }
+}

So the annoying thing here is that once this starts going,
it will keep sending free pages from the list even if
host is no longer interested. There should be a way
for host to tell guest "stop" or "start from the beginning".


This can be achieved via two output signal buf here:
signal_buf_start: filled with VIRTIO_BALLOON_F_FREE_PAGE_REPORT_START
signal_buf_end: filled with VIRTIO_BALLOON_F_FREE_PAGE_REPORT_END

The device holds both, and can put one of them to the vq and notify.





It's the result of using same vq for guest to host and
host to guest communication, and I think it's not a great idea.
I'd reuse stats vq for host to guest requests maybe.




As we discussed before, we can't have a vq interleave the report of 
stats and free pages.
The vq will be locked when one command is in use. So, when live 
migration starts, the
periodically reported stats will be delayed. Would this be OK? Or would 
you like to have

one host to guest vq, and multiple host to guest vqs? That is,

- host to guest:
CMD_VQ

- guest to host:
STATS_REPORT_VQ
FREE_PAGE_VQ


Best,
Wei





Re: [PATCH 5/5] kernel: tracepoints: add support for relative references

2017-08-18 Thread Ard Biesheuvel
On 18 August 2017 at 09:26, Ingo Molnar  wrote:
>
> * Ard Biesheuvel  wrote:
>
>> -static void for_each_tracepoint_range(struct tracepoint * const *begin,
>> - struct tracepoint * const *end,
>> +static void for_each_tracepoint_range(const void *begin, const void *end,
>>   void (*fct)(struct tracepoint *tp, void *priv),
>>   void *priv)
>>  {
>> +#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
>> + const signed int *iter;
>> +
>> + if (!begin)
>> + return;
>> + for (iter = begin; iter < (signed int *)end; iter++) {
>> + fct((struct tracepoint *)((unsigned long)iter + *iter), priv);
>> + }
>
> I think checkpatch is correct here to complain about the unnecessary curly 
> braces
> here.
>

Fair enough. I will clean up to the extent feasible.

> Plus why the heavy use of 'signed int' here and elsewhere in the patches - why
> not 'int' ?
>

Yes, just 'int' should be sufficient. Force of habit, I suppose, given
that unqualified 'char' is ambiguous between architectures, but this
does not apply to 'int' of course.

> Plus #2, the heavy use of type casts looks pretty ugly to begin with - is 
> there no
> way to turn this into more natural code?
>

Actually, Steven requested to keep the tracepoint section markers as
they are, and cast them to (int *) in the conditionally compiled
PREL32 case. So I guess it is a matter of taste, but because the types
are fundamentally incompatible when this code is in effect (and the
size of the pointed-to type differs on 64-bit architectures), there is
always some mangling required.

The initcall patch is probably the cleanest in this regard, but
involves typedefs, which are frowned upon as well.


Re: [PATCH v14 5/5] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2017-08-18 Thread Wei Wang

On 08/18/2017 10:13 AM, Michael S. Tsirkin wrote:

On Thu, Aug 17, 2017 at 11:26:56AM +0800, Wei Wang wrote:

Add a new vq to report hints of guest free pages to the host.

Please add some text here explaining the report_free_page_signal
thing.


I also really think we need some kind of ID in the
buffer to do a handshake. whenever id changes you
add another outbuf.


Please let me introduce the current design first:
1) device put the signal buf to the vq and notify the driver (we need
a buffer because currently the device can't notify when the vq is empty);

2) the driver starts the report of free page blocks via inbuf;

3) the driver adds an the signal buf via outbuf to tell the device all 
are reported.



Could you please elaborate more on the usage of ID?


+retry:
+   ret = virtqueue_add_outbuf(vq, &sg, 1, vb, GFP_KERNEL);
+   virtqueue_kick(vq);
+   if (unlikely(ret == -ENOSPC)) {

what if there's another error?


Another error is -EIO, how about disabling the free page report feature?
(I also saw it isn't handled in many other virtio devices e.g. virtio-net)


+   wait_event(vb->acked, virtqueue_get_buf(vq, &len));
+   goto retry;
+   }

what is this trickery doing? needs more comments or
a simplification.


Just this:
if the vq is full, blocking wait till an entry gets released, then 
retry. This is the
final one, which puts the signal buf to the vq to signify the end of the 
report and

the mm lock is not held here, so it is fine to block.






+}
+
+static void report_free_page(struct work_struct *work)
+{
+   struct virtio_balloon *vb;
+
+   vb = container_of(work, struct virtio_balloon, report_free_page_work);
+   walk_free_mem_block(vb, 0, &virtio_balloon_send_free_pages);

That's a lot of work here. And system_wq documentation says:
  *
  * system_wq is the one used by schedule[_delayed]_work[_on]().
  * Multi-CPU multi-threaded.  There are users which expect relatively
  * short queue flush time.  Don't queue works which can run for too
  * long.

You might want to create your own wq, maybe even with WQ_CPU_INTENSIVE.


Thanks for the reminder. If not creating a new wq, how about 
system_unbound_wq?
The first round of live migration needs the free pages, in that way we 
can have the

pages reported to the hypervisor quicker.




+   report_free_page_completion(vb);

So first you get list of pages, then an outbuf telling you
what they are in end of.  I think it's backwards.
Add an outbuf first followed by inbufs that tell you
what they are.



If we have the signal filled with those flags like
VIRTIO_BALLOON_F_FREE_PAGE_REPORT_START,
Probably not necessary to have an inbuf followed by an outbuf, right?


Best,
Wei


Re: [PATCH 0/5] arm-smmu: performance optimization

2017-08-18 Thread Will Deacon
On Fri, Aug 18, 2017 at 11:19:00AM +0800, Leizhen (ThunderTown) wrote:
> 
> 
> On 2017/8/17 22:36, Will Deacon wrote:
> > Thunder, Nate, Robin,
> > 
> > On Mon, Jun 26, 2017 at 09:38:45PM +0800, Zhen Lei wrote:
> >> I described the optimization more detail in patch 1 and 2, and patch 3-5 
> >> are
> >> the implementation on arm-smmu/arm-smmu-v3 of patch 2.
> >>
> >> Patch 1 is v2. In v1, I directly replaced writel with writel_relaxed in
> >> queue_inc_prod. But Robin figured that it may lead SMMU consume stale
> >> memory contents. I thought more than 3 whole days and got this one.
> >>
> >> This patchset is based on Robin Murphy's [PATCH v2 0/8] io-pgtable lock 
> >> removal.
> > 
> > For the time being, I think we should focus on the new TLB flushing
> > interface posted by Joerg:
> > 
> > http://lkml.kernel.org/r/1502974596-23835-1-git-send-email-j...@8bytes.org
> > 
> > which looks like it can give us most of the benefits of this series. Once
> > we've got that, we can see what's left in the way of performance and focus
> > on the cmdq batching separately (because I'm still not convinced about it).
> OK, this is a good news.
> 
> But I have a review comment(sorry, I have not subscribed it yet, so can not 
> directly reply it):
> I don't think we should add tlb sync for map operation
> 1. at init time, all tlbs will be invalidated
> 2. when we try to map a new range, there are no related ptes bufferd in tlb, 
> because of above 1 and below 3
> 3. when we unmap the above range, make sure all related ptes bufferd in tlb 
> to be invalidated before unmap finished

Yup, you're completely correct and I raised that with Joerg, who is looking
into a way to avoid it.

Will


[PATCH v2 12/12] irqchip/xtensa-mx: Report that effective affinity is a single target

2017-08-18 Thread Marc Zyngier
The xtensa-mx driver only targets a single CPU at a time, even if
the notional affinity is wider. Let's inform the core code
about this.

Signed-off-by: Marc Zyngier 
---
 drivers/irqchip/Kconfig | 1 +
 drivers/irqchip/irq-xtensa-mx.c | 6 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index bca9a88012f0..1139de9da21a 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -223,6 +223,7 @@ config VERSATILE_FPGA_IRQ_NR
 config XTENSA_MX
bool
select IRQ_DOMAIN
+   select GENERIC_IRQ_EFFECTIVE_AFF_MASK
 
 config XILINX_INTC
bool
diff --git a/drivers/irqchip/irq-xtensa-mx.c b/drivers/irqchip/irq-xtensa-mx.c
index 72a391e01011..a15a9510c904 100644
--- a/drivers/irqchip/irq-xtensa-mx.c
+++ b/drivers/irqchip/irq-xtensa-mx.c
@@ -32,6 +32,7 @@ static int xtensa_mx_irq_map(struct irq_domain *d, unsigned 
int irq,
irq_set_status_flags(irq, IRQ_LEVEL);
return 0;
}
+   irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(irq)));
return xtensa_irq_map(d, irq, hw);
 }
 
@@ -121,9 +122,12 @@ static int xtensa_mx_irq_retrigger(struct irq_data *d)
 static int xtensa_mx_irq_set_affinity(struct irq_data *d,
const struct cpumask *dest, bool force)
 {
-   unsigned mask = 1u << cpumask_any_and(dest, cpu_online_mask);
+   int cpu = cpumask_any_and(dest, cpu_online_mask);
+   unsigned mask = 1u << cpu;
 
set_er(mask, MIROUT(d->hwirq - HW_IRQ_MX_BASE));
+   irq_data_update_effective_affinity(d, cpumask_of(cpu));
+
return 0;
 
 }
-- 
2.11.0



[PATCH v2 00/12] genirq/irqchip: Effective affinity fixups

2017-08-18 Thread Marc Zyngier
4.13 contains a number of updates to the core IRQ code to deal with
things like the effective affinity. This series attempts to fix a
number of small things that are now breaking:

1) The core code assumes that CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK
   being defined implies that *all* interrupts have an effective
   affinity, while it may not be the case (I may have compiled in an
   irqchip driver that has this property, yet none of my interrupts are
   routed through it).

2) A large number of our irqchips are effectively single target (they
   will pick one CPU in the affinity list), and yet do not update the
   effective affinity cpumask.

(1) is solved by checking that the interrupt has a non-empty effective
affinity mask when reporting it, and use the notional affinity mask
instead if the effective one is empty.

(2) is just a matter of updating the effective affinity when required,
and to mark the interrupts as "single target". I've kept them separate
so that people can directly pick the irqchip they are interested in,
but these 10 patches could as well be squashed into a single one.

I've lightly tested the ARM GIC stuff, and that's it. I'd appreciate
some feedback from the platform maintainers, specially for the more
exotic architectures such as metag and xtensa.

Thanks,

M.

* From v1:
  - Don't assume that an interrupt not being single-target means that
it doesn't use the effective affinity, and check the full mask
instead (Thomas Gleixner)
  - Fix MIPS GIC patch, where the affinity registered was the notional
one instead of the effective one (Paul Burton)

Marc Zyngier (12):
  genirq: Restrict effective affinity to interrupts actually using it
  genirq/proc: Use the the accessor to report the effective affinity
  irqchip/gic: Report that effective affinity is a single target
  irqchip/gic-v3: Report that effective affinity is a single target
  irqchip/gic-v3-its: Report that effective affinity is a single target
  irqchip/armada-370-xp: Report that effective affinity is a single
target
  irqchip/bcm-6345-l1: Report that effective affinity is a single target
  irqchip/bcm-7038-l1: Report that effective affinity is a single target
  irqchip/metag-ext: Report that effective affinity is a single target
  irqchip/hip04: Report that effective affinity is a single target
  irqchip/mips-gic: Report that effective affinity is a single target
  irqchip/xtensa-mx: Report that effective affinity is a single target

 arch/arm/mach-hisi/Kconfig  |  1 +
 arch/metag/Kconfig  |  1 +
 drivers/irqchip/Kconfig |  7 +++
 drivers/irqchip/irq-armada-370-xp.c |  3 +++
 drivers/irqchip/irq-bcm6345-l1.c|  3 +++
 drivers/irqchip/irq-bcm7038-l1.c|  3 +++
 drivers/irqchip/irq-gic-v3-its.c|  7 ++-
 drivers/irqchip/irq-gic-v3.c|  3 +++
 drivers/irqchip/irq-gic.c   |  3 +++
 drivers/irqchip/irq-hip04.c |  3 +++
 drivers/irqchip/irq-metag-ext.c |  4 
 drivers/irqchip/irq-mips-gic.c  | 10 +++---
 drivers/irqchip/irq-xtensa-mx.c |  6 +-
 include/linux/irq.h |  5 -
 kernel/irq/proc.c   |  2 +-
 15 files changed, 54 insertions(+), 7 deletions(-)

-- 
2.11.0



[PATCH v2 05/12] irqchip/gic-v3-its: Report that effective affinity is a single target

2017-08-18 Thread Marc Zyngier
The GICv3 ITS driver only targets a single CPU at a time, even if
the notional affinity is wider. Let's inform the core code
about this.

Signed-off-by: Marc Zyngier 
---
 drivers/irqchip/irq-gic-v3-its.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 68932873eebc..22e228500357 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -649,6 +649,7 @@ static int its_set_affinity(struct irq_data *d, const 
struct cpumask *mask_val,
target_col = &its_dev->its->collections[cpu];
its_send_movi(its_dev, target_col, id);
its_dev->event_map.col_map[id] = cpu;
+   irq_data_update_effective_affinity(d, cpumask_of(cpu));
}
 
return IRQ_SET_MASK_OK_DONE;
@@ -1481,6 +1482,7 @@ static int its_irq_domain_alloc(struct irq_domain 
*domain, unsigned int virq,
 
irq_domain_set_hwirq_and_chip(domain, virq + i,
  hwirq, &its_irq_chip, its_dev);
+   irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(virq + 
i)));
pr_debug("ID:%d pID:%d vID:%d\n",
 (int)(hwirq - its_dev->event_map.lpi_base),
 (int) hwirq, virq + i);
@@ -1495,13 +1497,16 @@ static void its_irq_domain_activate(struct irq_domain 
*domain,
struct its_device *its_dev = irq_data_get_irq_chip_data(d);
u32 event = its_get_event_id(d);
const struct cpumask *cpu_mask = cpu_online_mask;
+   int cpu;
 
/* get the cpu_mask of local node */
if (its_dev->its->numa_node >= 0)
cpu_mask = cpumask_of_node(its_dev->its->numa_node);
 
/* Bind the LPI to the first possible CPU */
-   its_dev->event_map.col_map[event] = cpumask_first(cpu_mask);
+   cpu = cpumask_first(cpu_mask);
+   its_dev->event_map.col_map[event] = cpu;
+   irq_data_update_effective_affinity(d, cpumask_of(cpu));
 
/* Map the GIC IRQ and event to the device */
its_send_mapti(its_dev, d->hwirq, event);
-- 
2.11.0



[PATCH v2 10/12] irqchip/hip04: Report that effective affinity is a single target

2017-08-18 Thread Marc Zyngier
The HIP04 driver only targets a single CPU at a time, even if
the notional affinity is wider. Let's inform the core code
about this.

Signed-off-by: Marc Zyngier 
---
 arch/arm/mach-hisi/Kconfig  | 1 +
 drivers/irqchip/irq-hip04.c | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/arch/arm/mach-hisi/Kconfig b/arch/arm/mach-hisi/Kconfig
index a3b091a4d344..65a048fa08ec 100644
--- a/arch/arm/mach-hisi/Kconfig
+++ b/arch/arm/mach-hisi/Kconfig
@@ -39,6 +39,7 @@ config ARCH_HIP04
select HAVE_ARM_ARCH_TIMER
select MCPM if SMP
select MCPM_QUAD_CLUSTER if SMP
+   select GENERIC_IRQ_EFFECTIVE_AFF_MASK
help
  Support for Hisilicon HiP04 SoC family
 
diff --git a/drivers/irqchip/irq-hip04.c b/drivers/irqchip/irq-hip04.c
index c1b4ee955dbe..5b4fd2f4e5f8 100644
--- a/drivers/irqchip/irq-hip04.c
+++ b/drivers/irqchip/irq-hip04.c
@@ -165,6 +165,8 @@ static int hip04_irq_set_affinity(struct irq_data *d,
writel_relaxed(val | bit, reg);
raw_spin_unlock(&irq_controller_lock);
 
+   irq_data_update_effective_affinity(d, cpumask_of(cpu));
+
return IRQ_SET_MASK_OK;
 }
 #endif
@@ -312,6 +314,7 @@ static int hip04_irq_domain_map(struct irq_domain *d, 
unsigned int irq,
irq_set_chip_and_handler(irq, &hip04_irq_chip,
 handle_fasteoi_irq);
irq_set_probe(irq);
+   irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(irq)));
}
irq_set_chip_data(irq, d->host_data);
return 0;
-- 
2.11.0



[PATCH v2 09/12] irqchip/metag-ext: Report that effective affinity is a single target

2017-08-18 Thread Marc Zyngier
The metag-ext driver only targets a single CPU at a time, even if
the notional affinity is wider. Let's inform the core code
about this.

Signed-off-by: Marc Zyngier 
---
 arch/metag/Kconfig  | 1 +
 drivers/irqchip/irq-metag-ext.c | 4 
 2 files changed, 5 insertions(+)

diff --git a/arch/metag/Kconfig b/arch/metag/Kconfig
index 5b7a45d99cfb..7d8b322e5101 100644
--- a/arch/metag/Kconfig
+++ b/arch/metag/Kconfig
@@ -26,6 +26,7 @@ config METAG
select HAVE_SYSCALL_TRACEPOINTS
select HAVE_UNDERSCORE_SYMBOL_PREFIX
select IRQ_DOMAIN
+   select GENERIC_IRQ_EFFECTIVE_AFF_MASK
select MODULES_USE_ELF_RELA
select OF
select OF_EARLY_FLATTREE
diff --git a/drivers/irqchip/irq-metag-ext.c b/drivers/irqchip/irq-metag-ext.c
index 0cdd923d1535..be7216bfb8dd 100644
--- a/drivers/irqchip/irq-metag-ext.c
+++ b/drivers/irqchip/irq-metag-ext.c
@@ -518,6 +518,8 @@ static int meta_intc_set_affinity(struct irq_data *data,
 
metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR2(thread)), vec_addr);
 
+   irq_data_update_effective_affinity(data, cpumask_of(cpu));
+
return 0;
 }
 #else
@@ -578,6 +580,8 @@ static int meta_intc_map(struct irq_domain *d, unsigned int 
irq,
else
irq_set_chip_and_handler(irq, &meta_intc_edge_chip,
 handle_edge_irq);
+
+   irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(irq)));
return 0;
 }
 
-- 
2.11.0



[PATCH v2 11/12] irqchip/mips-gic: Report that effective affinity is a single target

2017-08-18 Thread Marc Zyngier
The MIPS GIC driver only targets a single CPU at a time, even if
the notional affinity is wider. Let's inform the core code
about this.

Signed-off-by: Marc Zyngier 
---
 drivers/irqchip/Kconfig|  1 +
 drivers/irqchip/irq-mips-gic.c | 10 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 39bfa5b25b54..bca9a88012f0 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -141,6 +141,7 @@ config IRQ_MIPS_CPU
select GENERIC_IRQ_IPI if SYS_SUPPORTS_MULTITHREADING
select IRQ_DOMAIN
select IRQ_DOMAIN_HIERARCHY if GENERIC_IRQ_IPI
+   select GENERIC_IRQ_EFFECTIVE_AFF_MASK
 
 config CLPS711X_IRQCHIP
bool
diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c
index 6ab1d3afec02..6461380ff1a4 100644
--- a/drivers/irqchip/irq-mips-gic.c
+++ b/drivers/irqchip/irq-mips-gic.c
@@ -445,24 +445,27 @@ static int gic_set_affinity(struct irq_data *d, const 
struct cpumask *cpumask,
unsigned int irq = GIC_HWIRQ_TO_SHARED(d->hwirq);
cpumask_t   tmp = CPU_MASK_NONE;
unsigned long   flags;
-   int i;
+   int i, cpu;
 
cpumask_and(&tmp, cpumask, cpu_online_mask);
if (cpumask_empty(&tmp))
return -EINVAL;
 
+   cpu = cpumask_first(&tmp);
+
/* Assumption : cpumask refers to a single CPU */
spin_lock_irqsave(&gic_lock, flags);
 
/* Re-route this IRQ */
-   gic_map_to_vpe(irq, mips_cm_vp_id(cpumask_first(&tmp)));
+   gic_map_to_vpe(irq, mips_cm_vp_id(cpu));
 
/* Update the pcpu_masks */
for (i = 0; i < min(gic_vpes, NR_CPUS); i++)
clear_bit(irq, pcpu_masks[i].pcpu_mask);
-   set_bit(irq, pcpu_masks[cpumask_first(&tmp)].pcpu_mask);
+   set_bit(irq, pcpu_masks[cpu].pcpu_mask);
 
cpumask_copy(irq_data_get_affinity_mask(d), cpumask);
+   irq_data_update_effective_affinity(d, cpumask_of(cpu));
spin_unlock_irqrestore(&gic_lock, flags);
 
return IRQ_SET_MASK_OK_NOCOPY;
@@ -716,6 +719,7 @@ static int gic_irq_domain_map(struct irq_domain *d, 
unsigned int virq,
if (err)
return err;
 
+   
irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(virq)));
return gic_shared_irq_domain_map(d, virq, hwirq, 0);
}
 
-- 
2.11.0



[tip:irq/core] genirq/debugfs: Triggering of interrupts from userspace

2017-08-18 Thread tip-bot for Marc Zyngier
Commit-ID:  536e2e34bd002267384b06683f023003a830
Gitweb: http://git.kernel.org/tip/536e2e34bd002267384b06683f023003a830
Author: Marc Zyngier 
AuthorDate: Fri, 18 Aug 2017 09:11:56 +0100
Committer:  Thomas Gleixner 
CommitDate: Fri, 18 Aug 2017 10:36:24 +0200

genirq/debugfs: Triggering of interrupts from userspace

When developing new (and therefore buggy) interrupt related
code, it can sometimes be useful to inject interrupts without
having to rely on a device to actually generate them.

This functionnality relies either on the irqchip driver to
expose a irq_set_irqchip_state(IRQCHIP_STATE_PENDING) callback,
or on the core code to be able to retrigger a (edge-only)
interrupt.

To use this feature:

echo -n trigger > /sys/kernel/debug/irq/irqs/IRQNUM

WARNING: This is DANGEROUS, and strictly a debug feature.
Do not use it on a production system. Your HW is likely to
catch fire, your data to be corrupted, and reporting this will
make you look an even bigger fool than the idiot who wrote
this patch.

Signed-off-by: Marc Zyngier 
Signed-off-by: Thomas Gleixner 
Link: http://lkml.kernel.org/r/20170818081156.9264-1-marc.zyng...@arm.com

---
 kernel/irq/debugfs.c | 50 +-
 1 file changed, 49 insertions(+), 1 deletion(-)

diff --git a/kernel/irq/debugfs.c b/kernel/irq/debugfs.c
index 4d384ed..c3fdb36 100644
--- a/kernel/irq/debugfs.c
+++ b/kernel/irq/debugfs.c
@@ -5,6 +5,7 @@
  */
 #include 
 #include 
+#include 
 
 #include "internals.h"
 
@@ -171,8 +172,55 @@ static int irq_debug_open(struct inode *inode, struct file 
*file)
return single_open(file, irq_debug_show, inode->i_private);
 }
 
+static ssize_t irq_debug_write(struct file *file, const char __user *user_buf,
+  size_t count, loff_t *ppos)
+{
+   struct irq_desc *desc = file_inode(file)->i_private;
+   char buf[8] = { 0, };
+   size_t size;
+
+   size = min(sizeof(buf) - 1, count);
+   if (copy_from_user(buf, user_buf, size))
+   return -EFAULT;
+
+   if (!strncmp(buf, "trigger", size)) {
+   unsigned long flags;
+   int err;
+
+   /* Try the HW interface first */
+   err = irq_set_irqchip_state(irq_desc_get_irq(desc),
+   IRQCHIP_STATE_PENDING, true);
+   if (!err)
+   return count;
+
+   /*
+* Otherwise, try to inject via the resend interface,
+* which may or may not succeed.
+*/
+   chip_bus_lock(desc);
+   raw_spin_lock_irqsave(&desc->lock, flags);
+
+   if (irq_settings_is_level(desc)) {
+   /* Can't do level, sorry */
+   err = -EINVAL;
+   } else {
+   desc->istate |= IRQS_PENDING;
+   check_irq_resend(desc);
+   err = 0;
+   }
+
+   raw_spin_unlock_irqrestore(&desc->lock, flags);
+   chip_bus_sync_unlock(desc);
+
+   return err ? err : count;
+   }
+
+   return count;
+}
+
 static const struct file_operations dfs_irq_ops = {
.open   = irq_debug_open,
+   .write  = irq_debug_write,
.read   = seq_read,
.llseek = seq_lseek,
.release= single_release,
@@ -186,7 +234,7 @@ void irq_add_debugfs_entry(unsigned int irq, struct 
irq_desc *desc)
return;
 
sprintf(name, "%d", irq);
-   desc->debugfs_file = debugfs_create_file(name, 0444, irq_dir, desc,
+   desc->debugfs_file = debugfs_create_file(name, 0644, irq_dir, desc,
 &dfs_irq_ops);
 }
 


[PATCH v2 07/12] irqchip/bcm-6345-l1: Report that effective affinity is a single target

2017-08-18 Thread Marc Zyngier
The BCM 6345-L1 driver only targets a single CPU at a time, even if
the notional affinity is wider. Let's inform the core code
about this.

Signed-off-by: Marc Zyngier 
---
 drivers/irqchip/Kconfig  | 1 +
 drivers/irqchip/irq-bcm6345-l1.c | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index cd688777553c..b36a55d6833e 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -96,6 +96,7 @@ config BCM6345_L1_IRQ
bool
select GENERIC_IRQ_CHIP
select IRQ_DOMAIN
+   select GENERIC_IRQ_EFFECTIVE_AFF_MASK
 
 config BCM7038_L1_IRQ
bool
diff --git a/drivers/irqchip/irq-bcm6345-l1.c b/drivers/irqchip/irq-bcm6345-l1.c
index daa4ae89e466..43f8abe40878 100644
--- a/drivers/irqchip/irq-bcm6345-l1.c
+++ b/drivers/irqchip/irq-bcm6345-l1.c
@@ -231,6 +231,8 @@ static int bcm6345_l1_set_affinity(struct irq_data *d,
}
raw_spin_unlock_irqrestore(&intc->lock, flags);
 
+   irq_data_update_effective_affinity(d, cpumask_of(new_cpu));
+
return IRQ_SET_MASK_OK_NOCOPY;
 }
 
@@ -291,6 +293,7 @@ static int bcm6345_l1_map(struct irq_domain *d, unsigned 
int virq,
irq_set_chip_and_handler(virq,
&bcm6345_l1_irq_chip, handle_percpu_irq);
irq_set_chip_data(virq, d->host_data);
+   irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(virq)));
return 0;
 }
 
-- 
2.11.0



[PATCH v2 08/12] irqchip/bcm-7038-l1: Report that effective affinity is a single target

2017-08-18 Thread Marc Zyngier
The BCM 7038-L1 driver only targets a single CPU at a time, even if
the notional affinity is wider. Let's inform the core code
about this.

Signed-off-by: Marc Zyngier 
---
 drivers/irqchip/Kconfig  | 1 +
 drivers/irqchip/irq-bcm7038-l1.c | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index b36a55d6833e..39bfa5b25b54 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -102,6 +102,7 @@ config BCM7038_L1_IRQ
bool
select GENERIC_IRQ_CHIP
select IRQ_DOMAIN
+   select GENERIC_IRQ_EFFECTIVE_AFF_MASK
 
 config BCM7120_L2_IRQ
bool
diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c
index c2662a1bfdd3..55cfb986225b 100644
--- a/drivers/irqchip/irq-bcm7038-l1.c
+++ b/drivers/irqchip/irq-bcm7038-l1.c
@@ -212,6 +212,8 @@ static int bcm7038_l1_set_affinity(struct irq_data *d,
__bcm7038_l1_unmask(d, first_cpu);
 
raw_spin_unlock_irqrestore(&intc->lock, flags);
+   irq_data_update_effective_affinity(d, cpumask_of(first_cpu));
+
return 0;
 }
 
@@ -299,6 +301,7 @@ static int bcm7038_l1_map(struct irq_domain *d, unsigned 
int virq,
 {
irq_set_chip_and_handler(virq, &bcm7038_l1_irq_chip, handle_level_irq);
irq_set_chip_data(virq, d->host_data);
+   irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(virq)));
return 0;
 }
 
-- 
2.11.0



[PATCH v2 04/12] irqchip/gic-v3: Report that effective affinity is a single target

2017-08-18 Thread Marc Zyngier
The GICv3 driver only targets a single CPU at a time, even if
the notional affinity is wider. Let's inform the core code
about this.

Signed-off-by: Marc Zyngier 
---
 drivers/irqchip/Kconfig  | 1 +
 drivers/irqchip/irq-gic-v3.c | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 586929d072ca..ce99c1ee6c7d 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -35,6 +35,7 @@ config ARM_GIC_V3
select MULTI_IRQ_HANDLER
select IRQ_DOMAIN_HIERARCHY
select PARTITION_PERCPU
+   select GENERIC_IRQ_EFFECTIVE_AFF_MASK
 
 config ARM_GIC_V3_ITS
bool
diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index dbffb7ab6203..511c290c4a26 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -670,6 +670,8 @@ static int gic_set_affinity(struct irq_data *d, const 
struct cpumask *mask_val,
else
gic_dist_wait_for_rwp();
 
+   irq_data_update_effective_affinity(d, cpumask_of(cpu));
+
return IRQ_SET_MASK_OK_DONE;
 }
 #else
@@ -768,6 +770,7 @@ static int gic_irq_domain_map(struct irq_domain *d, 
unsigned int irq,
irq_domain_set_info(d, irq, hw, chip, d->host_data,
handle_fasteoi_irq, NULL, NULL);
irq_set_probe(irq);
+   irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(irq)));
}
/* LPIs */
if (hw >= 8192 && hw < GIC_ID_NR) {
-- 
2.11.0



[PATCH v2 06/12] irqchip/armada-370-xp: Report that effective affinity is a single target

2017-08-18 Thread Marc Zyngier
The Armada 370 XP driver only targets a single CPU at a time, even if
the notional affinity is wider. Let's inform the core code
about this.

Signed-off-by: Marc Zyngier 
---
 drivers/irqchip/Kconfig | 1 +
 drivers/irqchip/irq-armada-370-xp.c | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index ce99c1ee6c7d..cd688777553c 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -66,6 +66,7 @@ config ARMADA_370_XP_IRQ
bool
select GENERIC_IRQ_CHIP
select PCI_MSI if PCI
+   select GENERIC_IRQ_EFFECTIVE_AFF_MASK
 
 config ALPINE_MSI
bool
diff --git a/drivers/irqchip/irq-armada-370-xp.c 
b/drivers/irqchip/irq-armada-370-xp.c
index b207b2c3aa55..eb815676c088 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -330,6 +330,8 @@ static int armada_xp_set_affinity(struct irq_data *d,
writel(reg, main_int_base + ARMADA_370_XP_INT_SOURCE_CTL(hwirq));
raw_spin_unlock(&irq_controller_lock);
 
+   irq_data_update_effective_affinity(d, cpumask_of(cpu));
+
return IRQ_SET_MASK_OK;
 }
 #endif
@@ -363,6 +365,7 @@ static int armada_370_xp_mpic_irq_map(struct irq_domain *h,
} else {
irq_set_chip_and_handler(virq, &armada_370_xp_irq_chip,
handle_level_irq);
+   
irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(virq)));
}
irq_set_probe(virq);
 
-- 
2.11.0



[PATCH v2 02/12] genirq/proc: Use the the accessor to report the effective affinity

2017-08-18 Thread Marc Zyngier
If CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK is defined, but that the
interrupt is not single target, the effective affinity reported in
/proc/irq/x/effective_affinity will be empty, which is not the truth.

Instead, use the accessor to report the affinity, which will pick
the right mask.

Signed-off-by: Marc Zyngier 
---
 kernel/irq/proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index 7f9642a1e267..0534781724d0 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -61,7 +61,7 @@ static int show_irq_affinity(int type, struct seq_file *m)
case EFFECTIVE:
case EFFECTIVE_LIST:
 #ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK
-   mask = desc->irq_common_data.effective_affinity;
+   mask = irq_data_get_effective_affinity_mask(&desc->irq_data);
break;
 #else
return -EINVAL;
-- 
2.11.0



[PATCH v2 01/12] genirq: Restrict effective affinity to interrupts actually using it

2017-08-18 Thread Marc Zyngier
Just because CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK is selected
doesn't mean that all the interrupts are using the effective
affinity mask. For a number of them, this mask is likely to
be empty.

In order to deal with this, let's restrict the use of the
effective affinity mask to these interrupts that have a non empty
effective affinity.

Signed-off-by: Marc Zyngier 
---
 include/linux/irq.h | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/linux/irq.h b/include/linux/irq.h
index d2d543794093..dcfac6c8ba18 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -781,7 +781,10 @@ static inline struct cpumask 
*irq_data_get_affinity_mask(struct irq_data *d)
 static inline
 struct cpumask *irq_data_get_effective_affinity_mask(struct irq_data *d)
 {
-   return d->common->effective_affinity;
+   if (!cpumask_empty(d->common->effective_affinity))
+   return d->common->effective_affinity;
+
+   return d->common->affinity;
 }
 static inline void irq_data_update_effective_affinity(struct irq_data *d,
  const struct cpumask *m)
-- 
2.11.0



[PATCH v2 03/12] irqchip/gic: Report that effective affinity is a single target

2017-08-18 Thread Marc Zyngier
The GIC driver only targets a single CPU at a time, even if
the notional affinity is wider. Let's inform the core code
about this.

Signed-off-by: Marc Zyngier 
---
 drivers/irqchip/Kconfig   | 1 +
 drivers/irqchip/irq-gic.c | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index f1fd5f44d1d4..586929d072ca 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -7,6 +7,7 @@ config ARM_GIC
select IRQ_DOMAIN
select IRQ_DOMAIN_HIERARCHY
select MULTI_IRQ_HANDLER
+   select GENERIC_IRQ_EFFECTIVE_AFF_MASK
 
 config ARM_GIC_PM
bool
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index 1b1df4f770bd..20dd2ba3d603 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -344,6 +344,8 @@ static int gic_set_affinity(struct irq_data *d, const 
struct cpumask *mask_val,
writel_relaxed(val | bit, reg);
gic_unlock_irqrestore(flags);
 
+   irq_data_update_effective_affinity(d, cpumask_of(cpu));
+
return IRQ_SET_MASK_OK_DONE;
 }
 #endif
@@ -966,6 +968,7 @@ static int gic_irq_domain_map(struct irq_domain *d, 
unsigned int irq,
irq_domain_set_info(d, irq, hw, &gic->chip, d->host_data,
handle_fasteoi_irq, NULL, NULL);
irq_set_probe(irq);
+   irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(irq)));
}
return 0;
 }
-- 
2.11.0



[PATCH v3 0/5] perf annotate: Support --show-nr-samples and circulating view

2017-08-18 Thread Taeung Song
Hello,

Add --show-nr-samples option to perf-annotate
so that it corresponds with perf-report.

And support the three view based on percent,
total period and number of samples on the annotate TUI browser,
circulating them like below:

  Percent -> Period -> Samples -> Percent ...

I'd appreciate some feedback on my patchkit. :)
The code is available on 'perf/ann-nr-samples-v3' branch at

  git://github.com/taeung/linux-perf.git

Thanks,
Taeung

v3:
- Add --show-nr-samples option in documentation (Arnaldo)
- Add a missing --show-total-period in documentation

v2:
- period and nr-samples view can't be used at the same time (Arnaldo)

Taeung Song (5):
  perf annotate stdio: Support --show-nr-samples option
  perf annotate: Add a missing period option in documentation
  perf annotate: Period and samples view can't be used at the same time
  perf annotate browser: Support --show-nr-samples option
  perf annotate browser: Circulate percent, total period and samples
view

 tools/perf/Documentation/perf-annotate.txt |  6 ++
 tools/perf/builtin-annotate.c  | 10 --
 tools/perf/ui/browsers/annotate.c  | 31 --
 tools/perf/util/annotate.c |  6 +-
 4 files changed, 44 insertions(+), 9 deletions(-)

-- 
2.7.4



[PATCH v3 1/5] perf annotate stdio: Support --show-nr-samples option

2017-08-18 Thread Taeung Song
Add --show-nr-samples option to perf-annotate
so that it corresponds with perf-report.

Cc: Namhyung Kim 
Cc: Milian Wolff 
Cc: Jiri Olsa 
Signed-off-by: Taeung Song 
---
 tools/perf/Documentation/perf-annotate.txt | 4 
 tools/perf/builtin-annotate.c  | 2 ++
 tools/perf/util/annotate.c | 6 +-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Documentation/perf-annotate.txt 
b/tools/perf/Documentation/perf-annotate.txt
index a89273d..2a5975c 100644
--- a/tools/perf/Documentation/perf-annotate.txt
+++ b/tools/perf/Documentation/perf-annotate.txt
@@ -43,6 +43,10 @@ OPTIONS
 --quiet::
Do not show any message.  (Suppress -v)
 
+-n::
+--show-nr-samples::
+   Show the number of samples for each symbol
+
 -D::
 --dump-raw-trace::
 Dump raw trace in ASCII.
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 658c920..acde4cc 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -445,6 +445,8 @@ int cmd_annotate(int argc, const char **argv)
"Show event group information together"),
OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period,
"Show a column with the sum of periods"),
+   OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples,
+   "Show a column with the number of samples"),
OPT_CALLBACK_DEFAULT(0, "stdio-color", NULL, "mode",
 "'always' (default), 'never' or 'auto' only 
applicable to --stdio mode",
 stdio__config_color, "always"),
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 2dab0e5..4397a8b 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1145,6 +1145,9 @@ static int disasm_line__print(struct disasm_line *dl, 
struct symbol *sym, u64 st
if (symbol_conf.show_total_period)
color_fprintf(stdout, color, " %11" PRIu64,
  sample.period);
+   else if (symbol_conf.show_nr_samples)
+   color_fprintf(stdout, color, " %7" PRIu64,
+ sample.nr_samples);
else
color_fprintf(stdout, color, " %7.2f", percent);
}
@@ -1825,7 +1828,8 @@ int symbol__annotate_printf(struct symbol *sym, struct 
map *map,
width *= evsel->nr_members;
 
graph_dotted_len = printf(" %-*.*s| Source code & Disassembly of %s 
for %s (%" PRIu64 " samples)\n",
- width, width, symbol_conf.show_total_period ? 
"Event count" : "Percent",
+ width, width, symbol_conf.show_total_period ? 
"Period" :
+ symbol_conf.show_nr_samples ? "Samples" : 
"Percent",
  d_filename, evsel_name, h->nr_samples);
 
printf("%-*.*s\n",
-- 
2.7.4



[PATCH v3 3/5] perf annotate: Period and samples view can't be used at the same time

2017-08-18 Thread Taeung Song
If users give two options --show-total-period
and --show-nr-samples, show their proper usage because
the two options can not be used at the same time.

Cc: Namhyung Kim 
Cc: Jiri Olsa 
Signed-off-by: Taeung Song 
---
 tools/perf/builtin-annotate.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index acde4cc..9d25c27 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -403,7 +403,7 @@ int cmd_annotate(int argc, const char **argv)
struct perf_data_file file = {
.mode  = PERF_DATA_MODE_READ,
};
-   const struct option options[] = {
+   struct option options[] = {
OPT_STRING('i', "input", &input_name, "file",
"input file name"),
OPT_STRING('d', "dsos", &symbol_conf.dso_list_str, "dso[,dso...]",
@@ -452,8 +452,12 @@ int cmd_annotate(int argc, const char **argv)
 stdio__config_color, "always"),
OPT_END()
};
-   int ret = hists__init();
+   int ret;
+
+   set_option_flag(options, 0, "show-total-period", PARSE_OPT_EXCLUSIVE);
+   set_option_flag(options, 0, "show-nr-samples", PARSE_OPT_EXCLUSIVE);
 
+   ret = hists__init();
if (ret < 0)
return ret;
 
-- 
2.7.4



[PATCH v3 5/5] perf annotate browser: Circulate percent, total period and samples view

2017-08-18 Thread Taeung Song
With a existing 't' hotkey, support the three view based on percent,
total period and number of samples on the annotate TUI browser,
circulating them like below:

  Percent -> Period -> Samples -> Percent ...

Suggested-by: Namhyung Kim 
Cc: Milian Wolff 
Cc: Jiri Olsa 
Signed-off-by: Taeung Song 
---
 tools/perf/ui/browsers/annotate.c | 17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/tools/perf/ui/browsers/annotate.c 
b/tools/perf/ui/browsers/annotate.c
index faca1b9..e82e6c5 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -835,7 +835,7 @@ static int annotate_browser__run(struct annotate_browser 
*browser,
"n Search next string\n"
"o Toggle disassembler output/simplified view\n"
"s Toggle source code view\n"
-   "t Toggle total period view\n"
+   "t Circulate percent, total period, samples view\n"
"/ Search string\n"
"k Toggle line numbers\n"
"r Run available scripts\n"
@@ -912,8 +912,19 @@ static int annotate_browser__run(struct annotate_browser 
*browser,
}
continue;
case 't':
-   annotate_browser__opts.show_total_period =
- !annotate_browser__opts.show_total_period;
+   if (annotate_browser__opts.show_total_period) {
+   annotate_browser__opts.show_total_period = 
false;
+   annotate_browser__opts.show_nr_samples = true;
+   } else if (annotate_browser__opts.show_nr_samples)
+   annotate_browser__opts.show_nr_samples = false;
+   else
+   annotate_browser__opts.show_total_period = true;
+   annotate_browser__update_addr_width(browser);
+   continue;
+   case 'e':
+   annotate_browser__opts.show_total_period = false;
+   annotate_browser__opts.show_nr_samples =
+   !annotate_browser__opts.show_nr_samples;
annotate_browser__update_addr_width(browser);
continue;
case K_LEFT:
-- 
2.7.4



[PATCH v3 4/5] perf annotate browser: Support --show-nr-samples option

2017-08-18 Thread Taeung Song
Cc: Namhyung Kim 
Cc: Jiri Olsa 
Signed-off-by: Taeung Song 
---
 tools/perf/ui/browsers/annotate.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/tools/perf/ui/browsers/annotate.c 
b/tools/perf/ui/browsers/annotate.c
index 80f38da..faca1b9 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -42,6 +42,7 @@ static struct annotate_browser_opt {
 jump_arrows,
 show_linenr,
 show_nr_jumps,
+show_nr_samples,
 show_total_period;
 } annotate_browser__opts = {
.use_offset = true,
@@ -155,6 +156,9 @@ static void annotate_browser__write(struct ui_browser 
*browser, void *entry, int
if (annotate_browser__opts.show_total_period) {
ui_browser__printf(browser, "%11" PRIu64 " ",
   bdl->samples[i].he.period);
+   } else if (annotate_browser__opts.show_nr_samples) {
+   ui_browser__printf(browser, "%6" PRIu64 " ",
+  
bdl->samples[i].he.nr_samples);
} else {
ui_browser__printf(browser, "%6.2f ",
   bdl->samples[i].percent);
@@ -167,7 +171,8 @@ static void annotate_browser__write(struct ui_browser 
*browser, void *entry, int
ui_browser__write_nstring(browser, " ", pcnt_width);
else {
ui_browser__printf(browser, "%*s", pcnt_width,
-  
annotate_browser__opts.show_total_period ? "Period" : "Percent");
+  
annotate_browser__opts.show_total_period ? "Period" :
+  
annotate_browser__opts.show_nr_samples ? "Samples" : "Percent");
}
}
if (ab->have_cycles) {
@@ -931,9 +936,11 @@ static int annotate_browser__run(struct annotate_browser 
*browser,
 int map_symbol__tui_annotate(struct map_symbol *ms, struct perf_evsel *evsel,
 struct hist_browser_timer *hbt)
 {
-   /* Set default value for show_total_period.  */
+   /* Set default value for show_total_period and show_nr_samples  */
annotate_browser__opts.show_total_period =
- symbol_conf.show_total_period;
+   symbol_conf.show_total_period;
+   annotate_browser__opts.show_nr_samples =
+   symbol_conf.show_nr_samples;
 
return symbol__tui_annotate(ms->sym, ms->map, evsel, hbt);
 }
@@ -1184,6 +1191,7 @@ static struct annotate_config {
ANNOTATE_CFG(jump_arrows),
ANNOTATE_CFG(show_linenr),
ANNOTATE_CFG(show_nr_jumps),
+   ANNOTATE_CFG(show_nr_samples),
ANNOTATE_CFG(show_total_period),
ANNOTATE_CFG(use_offset),
 };
-- 
2.7.4



[PATCH v3 2/5] perf annotate: Add a missing period option in documentation

2017-08-18 Thread Taeung Song
Cc: Namhyung Kim 
Cc: Jiri Olsa 
Signed-off-by: Taeung Song 
---
 tools/perf/Documentation/perf-annotate.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/perf/Documentation/perf-annotate.txt 
b/tools/perf/Documentation/perf-annotate.txt
index 2a5975c..c635eab 100644
--- a/tools/perf/Documentation/perf-annotate.txt
+++ b/tools/perf/Documentation/perf-annotate.txt
@@ -92,6 +92,8 @@ OPTIONS
 --asm-raw::
Show raw instruction encoding of assembly instructions.
 
+--show-total-period:: Show a column with the sum of periods.
+
 --source::
Interleave source code with assembly code. Enabled by default,
disable with --no-source.
-- 
2.7.4



Re: [PATCH] kvm: VMX: do not use vm-exit instruction length for fast MMIO

2017-08-18 Thread Jason Wang



On 2017年08月16日 22:10, Michael S. Tsirkin wrote:

On Wed, Aug 16, 2017 at 03:34:54PM +0200, Paolo Bonzini wrote:

Microsoft pointed out privately to me that KVM's handling of
KVM_FAST_MMIO_BUS is invalid.  Using skip_emulation_instruction is invalid
in EPT misconfiguration vmexit handlers, because neither EPT violations
nor misconfigurations are listed in the manual among the VM exits that
set the VM-exit instruction length field.

While physical processors seem to set the field, this is not architectural
and is just a side effect of the implementation.  I couldn't convince
myself of any condition on the exit qualification where VM-exit
instruction length "has" to be defined; there are no trap-like VM-exits
that can be repurposed; and fault-like VM-exits such as descriptor-table
exits provide no decoding information.  So I don't really see any way
to keep the full speedup.

What we can do is use EMULTYPE_SKIP; it only saves 200 clock cycles
because computing the physical RIP and reading the instruction is
expensive, but at least the eventfd is signaled before entering the
emulator.  This saves on latency.  While at it, don't check breakpoints
when skipping the instruction, as presumably any side effect has been
exposed already.

Adding a hypercall or MSR write that does a fast MMIO write to a physical
address would do it, but it adds hypervisor knowledge in virtio, including
CPUID handling.  So it would be pretty ugly in the guest-side implementation,
but if somebody wants to do it and the virtio side is acceptable to the
virtio maintainers, I am okay with it.

Cc: Michael S. Tsirkin
Cc:sta...@vger.kernel.org
Fixes: 68c3b4d1676d870f0453c31d5a52e7e65c7448ae
Suggested-by: Radim Krčmář
Signed-off-by: Paolo Bonzini

Jason (cc) who worked on the original optimization said he can
work to test the performance impact.


I see regressions on both latency and cpu utilization through netperf 
TCP_RR test:


pkt_size/sessions/+transaction_rate%/+per_cpu_transaction_rate%
1/ 1/   +0%/   -5%
1/25/   -1%/   -2%
1/50/   -9%/  -10%
   64/ 1/   -3%/   -9%
   64/25/0%/   -2%
   64/50/  -10%/  -11%
  256/ 1/  -10%/  -17%
  256/25/  -11%/  -12%
  256/50/   -9%/  -11%

Thanks


Re: [patch 2/2] mm, compaction: persistently skip hugetlbfs pageblocks

2017-08-18 Thread Michal Hocko
I am getting 
mm/compaction.c: In function 'isolate_freepages_block':
mm/compaction.c:469:4: error: implicit declaration of function 
'pageblock_skip_persistent' [-Werror=implicit-function-declaration]
if (pageblock_skip_persistent(page, order)) {
^
mm/compaction.c:470:5: error: implicit declaration of function 
'set_pageblock_skip' [-Werror=implicit-function-declaration]
 set_pageblock_skip(page);

when compaction is disabled because isolate_freepages_block is defined
also when CONFIG_COMPACTION=n. I haven't checked how to fix this
properly yet.
-- 
Michal Hocko
SUSE Labs


  1   2   3   4   5   6   7   8   9   10   >