Re: [PATCH 1/4] add generic builtin command line

2021-02-17 Thread Andrew Morton
On Mon, 15 Feb 2021 11:32:01 -0800 Daniel Gimpelevich 
 wrote:

> On Thu, 2019-03-21 at 15:15 -0700, Andrew Morton wrote:
> > On Thu, 21 Mar 2019 08:13:08 -0700 Daniel Walker  wrote:
> > > On Wed, Mar 20, 2019 at 08:14:33PM -0700, Andrew Morton wrote:
> > > > The patches (or some version of them) are already in linux-next,
> > > > which messes me up.  I'll disable them for now.
> > >  
> > > Those are from my tree, but I remove them when you picked up the series. 
> > > The
> > > next linux-next should not have them.
> > 
> > Yup, thanks, all looks good now.
> 
> This patchset is currently neither in mainline nor in -next. May I ask
> what happened to it? Thanks.

Seems that I didn't bring them back after the confict with the powerpc
tree resolved itself.

Please resend everything for -rc1 and let's await the reviewer
feedback,



Re: [PATCH 1/4] add generic builtin command line

2021-02-16 Thread Daniel Gimpelevich
On Tue, 2021-02-16 at 18:42 +0100, Christophe Leroy wrote:
> I'd suggest also to find the good arguments to convince us that this  
> series has a real added value, not just "cisco use it in its kernels  
> so it is good".

Well, IIRC, this series was endorsed by the device tree maintainers as
the preferred alternative to this:

https://lore.kernel.org/linux-devicetree/1565020400-25679-1-git-send-email-dan...@gimpelevich.san-francisco.ca.us/T/#u

The now-defunct patchwork.linux-mips.org link in that thread pointed to:

https://lore.kernel.org/linux-mips/1510796793.16864.25.camel@chimera/T/#u

When running modern kernels from ancient vendor bootloaders, it is
sometimes necessary to pick and choose bits and pieces of the info they
pass without taking it verbatim.



Re: [PATCH 1/4] add generic builtin command line

2021-02-16 Thread Daniel Walker
On Mon, Feb 15, 2021 at 11:32:01AM -0800, Daniel Gimpelevich wrote:
> On Thu, 2019-03-21 at 15:15 -0700, Andrew Morton wrote:
> > On Thu, 21 Mar 2019 08:13:08 -0700 Daniel Walker  wrote:
> > > On Wed, Mar 20, 2019 at 08:14:33PM -0700, Andrew Morton wrote:
> > > > The patches (or some version of them) are already in linux-next,
> > > > which messes me up.  I'll disable them for now.
> > >  
> > > Those are from my tree, but I remove them when you picked up the series. 
> > > The
> > > next linux-next should not have them.
> > 
> > Yup, thanks, all looks good now.
> 
> This patchset is currently neither in mainline nor in -next. May I ask
> what happened to it? Thanks.
> 

It was dropped silently by Andrew at some point. I wasn't watching -next closely
to know when. I have no idea why he dropped it.

We still use this series extensively in Cisco, and have extended it beyond this
current series.

We can re-submit.

Daniel


Re: [PATCH 1/4] add generic builtin command line

2021-02-16 Thread Christophe Leroy

Daniel Gimpelevich  a écrit :


On Thu, 2019-03-21 at 15:15 -0700, Andrew Morton wrote:

On Thu, 21 Mar 2019 08:13:08 -0700 Daniel Walker  wrote:
> On Wed, Mar 20, 2019 at 08:14:33PM -0700, Andrew Morton wrote:
> > The patches (or some version of them) are already in linux-next,
> > which messes me up.  I'll disable them for now.
>
> Those are from my tree, but I remove them when you picked up the  
series. The

> next linux-next should not have them.

Yup, thanks, all looks good now.


This patchset is currently neither in mainline nor in -next. May I ask
what happened to it? Thanks.


As far as I remember, there has been a lot of discussion around this series.

As of today, it doesn't apply cleanly anymore and would require rebasing.

I'd suggest also to find the good arguments to convince us that this  
series has a real added value, not just "cisco use it in its kernels  
so it is good".


I proposed an alternative at  
https://patchwork.ozlabs.org/project/linuxppc-dev/cover/cover.1554195798.git.christophe.le...@c-s.fr/ but never got any feedback so I gave  
up.


If you submit a new series, don't forget to copy ppclinux-dev and  
linux-arch lists.


Christophe




Re: [PATCH 1/4] add generic builtin command line

2021-02-15 Thread Daniel Gimpelevich
On Thu, 2019-03-21 at 15:15 -0700, Andrew Morton wrote:
> On Thu, 21 Mar 2019 08:13:08 -0700 Daniel Walker  wrote:
> > On Wed, Mar 20, 2019 at 08:14:33PM -0700, Andrew Morton wrote:
> > > The patches (or some version of them) are already in linux-next,
> > > which messes me up.  I'll disable them for now.
> >  
> > Those are from my tree, but I remove them when you picked up the series. The
> > next linux-next should not have them.
> 
> Yup, thanks, all looks good now.

This patchset is currently neither in mainline nor in -next. May I ask
what happened to it? Thanks.



Re: [RFC PATCH 1/4] Add a RPMSG driver for the APU in the mt8183

2020-10-15 Thread Mathieu Poirier
On Wed, Oct 14, 2020 at 04:55:34PM -0600, Mathieu Poirier wrote:
> Hi Alexandre,
> 
> On Wed, Sep 30, 2020 at 01:53:47PM +0200, Alexandre Bailon wrote:
> > This adds a driver to communicate with the APU available
> > in the mt8183. The driver is generic and could be used for other APU.
> > It mostly provides a userspace interface to send messages and
> > and share big buffers with the APU.
> > 
> > Signed-off-by: Alexandre Bailon 
> > ---
> >  drivers/rpmsg/Kconfig  |   9 +
> >  drivers/rpmsg/Makefile |   1 +
> >  drivers/rpmsg/apu_rpmsg.c  | 606 +
> >  drivers/rpmsg/apu_rpmsg.h  |  52 +++
> >  include/uapi/linux/apu_rpmsg.h |  36 ++
> >  5 files changed, 704 insertions(+)
> >  create mode 100644 drivers/rpmsg/apu_rpmsg.c
> >  create mode 100644 drivers/rpmsg/apu_rpmsg.h
> >  create mode 100644 include/uapi/linux/apu_rpmsg.h
> > 
> > diff --git a/drivers/rpmsg/Kconfig b/drivers/rpmsg/Kconfig
> > index f96716893c2a..3437c6fc8647 100644
> > --- a/drivers/rpmsg/Kconfig
> > +++ b/drivers/rpmsg/Kconfig
> > @@ -64,4 +64,13 @@ config RPMSG_VIRTIO
> > select RPMSG
> > select VIRTIO
> >  
> > +config RPMSG_APU
> > +   tristate "APU RPMSG driver"
> > +   help
> > + This provides a RPMSG driver that provides some facilities to
> > + communicate with an accelerated processing unit (APU).
> > + This creates one or more char files that could be used by userspace
> > + to send a message to an APU. In addition, this also take care of
> > + sharing the memory buffer with the APU.
> > +
> >  endmenu
> > diff --git a/drivers/rpmsg/Makefile b/drivers/rpmsg/Makefile
> > index ffe932ef6050..93e0f3de99c9 100644
> > --- a/drivers/rpmsg/Makefile
> > +++ b/drivers/rpmsg/Makefile
> > @@ -8,3 +8,4 @@ obj-$(CONFIG_RPMSG_QCOM_GLINK_RPM) += qcom_glink_rpm.o
> >  obj-$(CONFIG_RPMSG_QCOM_GLINK_SMEM) += qcom_glink_smem.o
> >  obj-$(CONFIG_RPMSG_QCOM_SMD)   += qcom_smd.o
> >  obj-$(CONFIG_RPMSG_VIRTIO) += virtio_rpmsg_bus.o
> > +obj-$(CONFIG_RPMSG_APU)+= apu_rpmsg.o
> > diff --git a/drivers/rpmsg/apu_rpmsg.c b/drivers/rpmsg/apu_rpmsg.c
> > new file mode 100644
> > index ..5131b8b8e1f2
> > --- /dev/null
> > +++ b/drivers/rpmsg/apu_rpmsg.c
> > @@ -0,0 +1,606 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +//
> > +// Copyright 2020 BayLibre SAS
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include "rpmsg_internal.h"
> > +
> > +#include 
> > +
> > +#include "apu_rpmsg.h"
> > +
> > +/* Maximum of APU devices supported */
> > +#define APU_DEV_MAX 2
> > +
> > +#define dev_to_apu(dev) container_of(dev, struct rpmsg_apu, dev)
> > +#define cdev_to_apu(i_cdev) container_of(i_cdev, struct rpmsg_apu, cdev)
> > +
> > +struct rpmsg_apu {
> > +   struct rpmsg_device *rpdev;
> > +   struct cdev cdev;
> > +   struct device dev;
> > +
> > +   struct rproc *rproc;
> > +   struct iommu_domain *domain;
> > +   struct iova_domain *iovad;
> > +   int iova_limit_pfn;
> > +};
> > +
> > +struct rpmsg_request {
> > +   struct completion completion;
> > +   struct list_head node;
> > +   void *req;
> > +};
> > +
> > +struct apu_buffer {
> > +   int fd;
> > +   struct dma_buf *dma_buf;
> > +   struct dma_buf_attachment *attachment;
> > +   struct sg_table *sg_table;
> > +   u32 iova;
> > +};
> > +
> > +/*
> > + * Shared IOVA domain.
> > + * The MT8183 has two VP6 core but they are sharing the IOVA.
> > + * They could be used alone, or together. In order to avoid conflict,
> > + * create an IOVA domain that could be shared by those two core.
> > + * @iovad: The IOVA domain to share between the APU cores
> > + * @refcount: Allow to automatically release the IOVA domain once all the 
> > APU
> > + *cores has been stopped
> > + */
> > +struct apu_iova_domain {
> > +   struct iova_domain iovad;
> > +   struct kref refcount;
> > +};
> > +
> > +static dev_t rpmsg_major;
> > +static DEFINE_IDA(rpmsg_ctrl_ida);
> > +static DEFINE_IDA(rpmsg_minor_ida);
> > +static DEFINE_IDA(req_ida);
> > +static LIST_HEAD(requests);
> > +static struct apu_iova_domain *apu_iovad;
> > +
> > +static int apu_rpmsg_callback(struct rpmsg_device *dev, void *data, int 
> > count,
> > + void *priv, u32 addr)
> > +{
> > +   struct rpmsg_request *rpmsg_req;
> > +   struct apu_dev_request *hdr = data;
> > +
> > +   list_for_each_entry(rpmsg_req, , node) {
> > +   struct apu_dev_request *tmp_hdr = rpmsg_req->req;
> > +
> > +   if (hdr->id == tmp_hdr->id) {
> > +   memcpy(rpmsg_req->req, data, count);
> > +   complete(_req->completion);
> > +
> > +   return 0;
> > +   }
> > +   }
> > +
> > +   return 0;
> > +}
> > +
> > +static int apu_device_memory_map(struct rpmsg_apu *apu,
> > +struct apu_buffer *buffer)
> > +{
> > +   struct 

Re: [RFC PATCH 1/4] Add a RPMSG driver for the APU in the mt8183

2020-10-14 Thread Mathieu Poirier
Hi Alexandre,

On Wed, Sep 30, 2020 at 01:53:47PM +0200, Alexandre Bailon wrote:
> This adds a driver to communicate with the APU available
> in the mt8183. The driver is generic and could be used for other APU.
> It mostly provides a userspace interface to send messages and
> and share big buffers with the APU.
> 
> Signed-off-by: Alexandre Bailon 
> ---
>  drivers/rpmsg/Kconfig  |   9 +
>  drivers/rpmsg/Makefile |   1 +
>  drivers/rpmsg/apu_rpmsg.c  | 606 +
>  drivers/rpmsg/apu_rpmsg.h  |  52 +++
>  include/uapi/linux/apu_rpmsg.h |  36 ++
>  5 files changed, 704 insertions(+)
>  create mode 100644 drivers/rpmsg/apu_rpmsg.c
>  create mode 100644 drivers/rpmsg/apu_rpmsg.h
>  create mode 100644 include/uapi/linux/apu_rpmsg.h
> 
> diff --git a/drivers/rpmsg/Kconfig b/drivers/rpmsg/Kconfig
> index f96716893c2a..3437c6fc8647 100644
> --- a/drivers/rpmsg/Kconfig
> +++ b/drivers/rpmsg/Kconfig
> @@ -64,4 +64,13 @@ config RPMSG_VIRTIO
>   select RPMSG
>   select VIRTIO
>  
> +config RPMSG_APU
> + tristate "APU RPMSG driver"
> + help
> +   This provides a RPMSG driver that provides some facilities to
> +   communicate with an accelerated processing unit (APU).
> +   This creates one or more char files that could be used by userspace
> +   to send a message to an APU. In addition, this also take care of
> +   sharing the memory buffer with the APU.
> +
>  endmenu
> diff --git a/drivers/rpmsg/Makefile b/drivers/rpmsg/Makefile
> index ffe932ef6050..93e0f3de99c9 100644
> --- a/drivers/rpmsg/Makefile
> +++ b/drivers/rpmsg/Makefile
> @@ -8,3 +8,4 @@ obj-$(CONFIG_RPMSG_QCOM_GLINK_RPM) += qcom_glink_rpm.o
>  obj-$(CONFIG_RPMSG_QCOM_GLINK_SMEM) += qcom_glink_smem.o
>  obj-$(CONFIG_RPMSG_QCOM_SMD) += qcom_smd.o
>  obj-$(CONFIG_RPMSG_VIRTIO)   += virtio_rpmsg_bus.o
> +obj-$(CONFIG_RPMSG_APU)  += apu_rpmsg.o
> diff --git a/drivers/rpmsg/apu_rpmsg.c b/drivers/rpmsg/apu_rpmsg.c
> new file mode 100644
> index ..5131b8b8e1f2
> --- /dev/null
> +++ b/drivers/rpmsg/apu_rpmsg.c
> @@ -0,0 +1,606 @@
> +// SPDX-License-Identifier: GPL-2.0
> +//
> +// Copyright 2020 BayLibre SAS
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include "rpmsg_internal.h"
> +
> +#include 
> +
> +#include "apu_rpmsg.h"
> +
> +/* Maximum of APU devices supported */
> +#define APU_DEV_MAX 2
> +
> +#define dev_to_apu(dev) container_of(dev, struct rpmsg_apu, dev)
> +#define cdev_to_apu(i_cdev) container_of(i_cdev, struct rpmsg_apu, cdev)
> +
> +struct rpmsg_apu {
> + struct rpmsg_device *rpdev;
> + struct cdev cdev;
> + struct device dev;
> +
> + struct rproc *rproc;
> + struct iommu_domain *domain;
> + struct iova_domain *iovad;
> + int iova_limit_pfn;
> +};
> +
> +struct rpmsg_request {
> + struct completion completion;
> + struct list_head node;
> + void *req;
> +};
> +
> +struct apu_buffer {
> + int fd;
> + struct dma_buf *dma_buf;
> + struct dma_buf_attachment *attachment;
> + struct sg_table *sg_table;
> + u32 iova;
> +};
> +
> +/*
> + * Shared IOVA domain.
> + * The MT8183 has two VP6 core but they are sharing the IOVA.
> + * They could be used alone, or together. In order to avoid conflict,
> + * create an IOVA domain that could be shared by those two core.
> + * @iovad: The IOVA domain to share between the APU cores
> + * @refcount: Allow to automatically release the IOVA domain once all the APU
> + *cores has been stopped
> + */
> +struct apu_iova_domain {
> + struct iova_domain iovad;
> + struct kref refcount;
> +};
> +
> +static dev_t rpmsg_major;
> +static DEFINE_IDA(rpmsg_ctrl_ida);
> +static DEFINE_IDA(rpmsg_minor_ida);
> +static DEFINE_IDA(req_ida);
> +static LIST_HEAD(requests);
> +static struct apu_iova_domain *apu_iovad;
> +
> +static int apu_rpmsg_callback(struct rpmsg_device *dev, void *data, int 
> count,
> +   void *priv, u32 addr)
> +{
> + struct rpmsg_request *rpmsg_req;
> + struct apu_dev_request *hdr = data;
> +
> + list_for_each_entry(rpmsg_req, , node) {
> + struct apu_dev_request *tmp_hdr = rpmsg_req->req;
> +
> + if (hdr->id == tmp_hdr->id) {
> + memcpy(rpmsg_req->req, data, count);
> + complete(_req->completion);
> +
> + return 0;
> + }
> + }
> +
> + return 0;
> +}
> +
> +static int apu_device_memory_map(struct rpmsg_apu *apu,
> +  struct apu_buffer *buffer)
> +{
> + struct rpmsg_device *rpdev = apu->rpdev;
> + phys_addr_t phys;
> + int total_buf_space;
> + int iova_pfn;
> + int ret;
> +
> + if (!buffer->fd)
> + return 0;
> +
> + buffer->dma_buf = dma_buf_get(buffer->fd);
> + if (IS_ERR(buffer->dma_buf)) {
> + 

[RFC PATCH 1/4] Add a RPMSG driver for the APU in the mt8183

2020-09-30 Thread Alexandre Bailon
This adds a driver to communicate with the APU available
in the mt8183. The driver is generic and could be used for other APU.
It mostly provides a userspace interface to send messages and
and share big buffers with the APU.

Signed-off-by: Alexandre Bailon 
---
 drivers/rpmsg/Kconfig  |   9 +
 drivers/rpmsg/Makefile |   1 +
 drivers/rpmsg/apu_rpmsg.c  | 606 +
 drivers/rpmsg/apu_rpmsg.h  |  52 +++
 include/uapi/linux/apu_rpmsg.h |  36 ++
 5 files changed, 704 insertions(+)
 create mode 100644 drivers/rpmsg/apu_rpmsg.c
 create mode 100644 drivers/rpmsg/apu_rpmsg.h
 create mode 100644 include/uapi/linux/apu_rpmsg.h

diff --git a/drivers/rpmsg/Kconfig b/drivers/rpmsg/Kconfig
index f96716893c2a..3437c6fc8647 100644
--- a/drivers/rpmsg/Kconfig
+++ b/drivers/rpmsg/Kconfig
@@ -64,4 +64,13 @@ config RPMSG_VIRTIO
select RPMSG
select VIRTIO
 
+config RPMSG_APU
+   tristate "APU RPMSG driver"
+   help
+ This provides a RPMSG driver that provides some facilities to
+ communicate with an accelerated processing unit (APU).
+ This creates one or more char files that could be used by userspace
+ to send a message to an APU. In addition, this also take care of
+ sharing the memory buffer with the APU.
+
 endmenu
diff --git a/drivers/rpmsg/Makefile b/drivers/rpmsg/Makefile
index ffe932ef6050..93e0f3de99c9 100644
--- a/drivers/rpmsg/Makefile
+++ b/drivers/rpmsg/Makefile
@@ -8,3 +8,4 @@ obj-$(CONFIG_RPMSG_QCOM_GLINK_RPM) += qcom_glink_rpm.o
 obj-$(CONFIG_RPMSG_QCOM_GLINK_SMEM) += qcom_glink_smem.o
 obj-$(CONFIG_RPMSG_QCOM_SMD)   += qcom_smd.o
 obj-$(CONFIG_RPMSG_VIRTIO) += virtio_rpmsg_bus.o
+obj-$(CONFIG_RPMSG_APU)+= apu_rpmsg.o
diff --git a/drivers/rpmsg/apu_rpmsg.c b/drivers/rpmsg/apu_rpmsg.c
new file mode 100644
index ..5131b8b8e1f2
--- /dev/null
+++ b/drivers/rpmsg/apu_rpmsg.c
@@ -0,0 +1,606 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2020 BayLibre SAS
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "rpmsg_internal.h"
+
+#include 
+
+#include "apu_rpmsg.h"
+
+/* Maximum of APU devices supported */
+#define APU_DEV_MAX 2
+
+#define dev_to_apu(dev) container_of(dev, struct rpmsg_apu, dev)
+#define cdev_to_apu(i_cdev) container_of(i_cdev, struct rpmsg_apu, cdev)
+
+struct rpmsg_apu {
+   struct rpmsg_device *rpdev;
+   struct cdev cdev;
+   struct device dev;
+
+   struct rproc *rproc;
+   struct iommu_domain *domain;
+   struct iova_domain *iovad;
+   int iova_limit_pfn;
+};
+
+struct rpmsg_request {
+   struct completion completion;
+   struct list_head node;
+   void *req;
+};
+
+struct apu_buffer {
+   int fd;
+   struct dma_buf *dma_buf;
+   struct dma_buf_attachment *attachment;
+   struct sg_table *sg_table;
+   u32 iova;
+};
+
+/*
+ * Shared IOVA domain.
+ * The MT8183 has two VP6 core but they are sharing the IOVA.
+ * They could be used alone, or together. In order to avoid conflict,
+ * create an IOVA domain that could be shared by those two core.
+ * @iovad: The IOVA domain to share between the APU cores
+ * @refcount: Allow to automatically release the IOVA domain once all the APU
+ *cores has been stopped
+ */
+struct apu_iova_domain {
+   struct iova_domain iovad;
+   struct kref refcount;
+};
+
+static dev_t rpmsg_major;
+static DEFINE_IDA(rpmsg_ctrl_ida);
+static DEFINE_IDA(rpmsg_minor_ida);
+static DEFINE_IDA(req_ida);
+static LIST_HEAD(requests);
+static struct apu_iova_domain *apu_iovad;
+
+static int apu_rpmsg_callback(struct rpmsg_device *dev, void *data, int count,
+ void *priv, u32 addr)
+{
+   struct rpmsg_request *rpmsg_req;
+   struct apu_dev_request *hdr = data;
+
+   list_for_each_entry(rpmsg_req, , node) {
+   struct apu_dev_request *tmp_hdr = rpmsg_req->req;
+
+   if (hdr->id == tmp_hdr->id) {
+   memcpy(rpmsg_req->req, data, count);
+   complete(_req->completion);
+
+   return 0;
+   }
+   }
+
+   return 0;
+}
+
+static int apu_device_memory_map(struct rpmsg_apu *apu,
+struct apu_buffer *buffer)
+{
+   struct rpmsg_device *rpdev = apu->rpdev;
+   phys_addr_t phys;
+   int total_buf_space;
+   int iova_pfn;
+   int ret;
+
+   if (!buffer->fd)
+   return 0;
+
+   buffer->dma_buf = dma_buf_get(buffer->fd);
+   if (IS_ERR(buffer->dma_buf)) {
+   dev_err(>dev, "Failed to get dma_buf from fd: %ld\n",
+   PTR_ERR(buffer->dma_buf));
+   return PTR_ERR(buffer->dma_buf);
+   }
+
+   buffer->attachment = dma_buf_attach(buffer->dma_buf, >dev);
+   if (IS_ERR(buffer->attachment)) {
+   

Re: [PATCH 1/4] add dts node for drm panel driver ili9341 add dts i2c3 for stmpe touch add dts spi5 for gyro & ili9341

2020-05-02 Thread Sam Ravnborg
Hi dillon min

> > okay, thanks alexandre, i will go through these docs. currently i'm on may
> day holiday,  will be back at  next wensday.
> after go back to work. i will separate this patch to five part with 9
> patchs , should be more clear
> 
> dts releated
> 1,  ARM: dts: stm32: Add i2c3 node for stm32f429
> 2,  ARM: dts: stm32: Add drm panel ili9341 nodes connect to ldtc
> support for stm32f429-disco board
> 3,  ARM: dts: stm32: Add stmpe811 touch screen support for
> stm32f429-disco board
> 4,  ARM: dts: stm32: Add l3gd20 gyroscope sensor support for
> stm32f429-disco board
> 
> clk releated
> 1, clk: stm32: Fix ltdc loading hang in set clk rate, pll_hw set to
> clks[PLL_VCO_SAI] but not clks[PLL_SAI]
> 2, clk: stm32: Add CLK_IGNORE_UNUSED flags for ltdc, make sure ltdc clk
> not be released after system startup
> 
> spi releated
> 1, spi: stm32: Add transfer mode SPI_SIMPLE_RX, SPI_3WIRE_RX support
> for stm32f4
> 
> drm releated
> 1, drm/panel: Add panel driver ilitek-ili9341
> 
> doc releated
>  1, dt-bindings: display: panel: Add binding document for Ilitek Ili9341

Patch separation looks good.
Please cc: me on both the binding and the panel patches.
The binding must be in DT Schema format (.yaml).
See a lot of examples in drm-misc-next for inspiration.

Looks forward to see/review your submission.

Sam


Re: [PATCH 1/4] add dts node for drm panel driver ili9341 add dts i2c3 for stmpe touch add dts spi5 for gyro & ili9341

2020-04-30 Thread Philippe Schenker
On Thu, 2020-04-30 at 17:43 +0800, dillon.min...@gmail.com wrote:
> From: dillon min 
> 
> Signed-off-by: dillon min 
> ---
>  .../bindings/display/panel/ilitek,ili9341.txt  | 42 +++
>  arch/arm/boot/dts/stm32f4-pinctrl.dtsi | 79
> +++
>  arch/arm/boot/dts/stm32f429-disco.dts  | 88
> ++
>  arch/arm/boot/dts/stm32f429.dtsi   | 12 +++
>  4 files changed, 221 insertions(+)
>  create mode 100644
> Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt
> 
> diff --git
> a/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt
> b/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt
> new file mode 100644
> index 000..f5a4e55
> --- /dev/null
> +++
> b/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt
> @@ -0,0 +1,42 @@
> +Ilitek ILI9341 TFT panel driver with SPI control bus
> +
> +This is a driver for 240x320 TFT panels, accepting a rgb input
> +streams that get adapted and scaled to the panel.
> +
> +Required properties:
> +  - compatible: "stm32f429-disco,ltdc-panel", "ilitek,ili9341"
> +(full system-specific compatible is always required to look up
> configuration)
> +  - reg: address of the panel on the SPI bus
> +
> +Optional properties:
> +  - reset-gpios: a GPIO spec for the reset pin, see gpio/gpio.txt
> +  - dc-gpios: a GPIO spec for the dc pin, see gpio/gpio.txt
> +
> +  The following optional properties only apply to RGB input mode:
> +
> +  - pixelclk-active: see display/panel/display-timing.txt
> +  - de-active: see display/panel/display-timing.txt
> +  - hsync-active: see display/panel/display-timing.txt
> +  - vsync-active: see display/panel/display-timing.txt
> +
> +The panel must obey the rules for a SPI slave device as specified in
> +spi/spi-bus.txt
> +
> +The device node can contain one 'port' child node with one child
> +'endpoint' node, according to the bindings defined in
> +media/video-interfaces.txt. This node should describe panel's video
> bus.
> +
> +Example:
> +
> +panel: display@0 {
> + compatible = "stm32f429-disco,ltdc-panel", "ilitek,ili9341";
> + reg = <0>;
> + spi-3wire;
> + spi-max-frequency = <1000>;
> + dc-gpios = < 13 0>;
> + port {
> + panel_in: endpoint {
> + remote-endpoint = <_out>;
> + };
> + };
> +};
> diff --git a/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
> b/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
> index 392fa14..45b68f4 100644
> --- a/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
> +++ b/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
> @@ -316,6 +316,85 @@
>   };
>   };
>  
> + ltdc_pins_f429_disco: ltdc-1 {
> + pins {
> + pinmux =  6,  AF14)>,
> + /* LCD_HSYNC */
> +   4,  AF14)>,
> +  /* LCD_VSYNC */
> +   7,  AF14)>,
> +  /* LCD_CLK */
> +   AF14)>,
> +  /* LCD_R2 */
> +   0,  AF9)>,
> +  /* LCD_R3 */
> +   AF14)>,
> +  /* LCD_R4 */
> +   AF14)>,
> +  /* LCD_R5 */
> +   1,  AF9)>,
> +  /* LCD_R6*/
> +   6,  AF14)>,
> +  /* LCD_R7 */
> +   6,  AF14)>,
> +  /* LCD_G2 */
> +   AF9)>,
> +  /* LCD_G3 */
> +   AF14)>,
> +  /* LCD_G4 */
> +   6,  AF14)>,
> +  /* LCD_B2 */
> +   AF14)>,
> +  /* LCD_B3*/
> +   AF14)>,
> +  /* LCD_G5 */
> +   7,  AF14)>,
> +  /* LCD_G6 */
> +   3,  AF14)>,
> +  /* LCD_G7 */
> +   AF9)>,
> +  

Re: [PATCH 1/4] add dts node for drm panel driver ili9341 add dts i2c3 for stmpe touch add dts spi5 for gyro & ili9341

2020-04-30 Thread Alexandre Torgue




On 4/30/20 12:26 PM, dillon min wrote:

Hi Alexandre,

Alexandre Torgue > 于2020年4月30日周四 下午5:57写道:


Hi

On 4/30/20 11:43 AM, dillon.min...@gmail.com
 wrote:
 > From: dillon min mailto:dillon.min...@gmail.com>>
 >
 > Signed-off-by: dillon min mailto:dillon.min...@gmail.com>>

Commit title should be ARM: dts: stm32: bla bla on stm32f429 and please
a commit message.


*okay, thanks for your quicky response, this is my first kernel pull 
request, i will resubmit all patchsets following the history submits 
style who was did.*


ok no pb. In general way you have to execute ./scripts/checkpatch.pl to 
check some style errors before sending. Use ./scripts/get_maintainer.pl 
to see to who you have to send the patch. When you have several patches 
in a series, you need to have a cover-letter which explains the aim of 
your series. To have an idea of commit format just use git log on the 
file changed to see how previous accepted commi have been written.


More details here: Documentation/process/submitting-patches.rst



 > ---
 >   .../bindings/display/panel/ilitek,ili9341.txt      | 42 +++
 >   arch/arm/boot/dts/stm32f4-pinctrl.dtsi             | 79
+++
 >   arch/arm/boot/dts/stm32f429-disco.dts              | 88
++
 >   arch/arm/boot/dts/stm32f429.dtsi                   | 12 +++
 >   4 files changed, 221 insertions(+)
 >   create mode 100644
Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt
 >
 > diff --git
a/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt
b/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt

This binding description should be in a separate patch and you have to
write in YAML format.

*okay, will do it later. *


 > new file mode 100644
 > index 000..f5a4e55
 > --- /dev/null
 > +++
b/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt
 > @@ -0,0 +1,42 @@
 > +Ilitek ILI9341 TFT panel driver with SPI control bus
 > +
 > +This is a driver for 240x320 TFT panels, accepting a rgb input
 > +streams that get adapted and scaled to the panel.
 > +
 > +Required properties:
 > +  - compatible: "stm32f429-disco,ltdc-panel", "ilitek,ili9341"
 > +    (full system-specific compatible is always required to look
up configuration)
 > +  - reg: address of the panel on the SPI bus
 > +
 > +Optional properties:
 > +  - reset-gpios: a GPIO spec for the reset pin, see gpio/gpio.txt
 > +  - dc-gpios: a GPIO spec for the dc pin, see gpio/gpio.txt
 > +
 > +  The following optional properties only apply to RGB input mode:
 > +
 > +  - pixelclk-active: see display/panel/display-timing.txt
 > +  - de-active: see display/panel/display-timing.txt
 > +  - hsync-active: see display/panel/display-timing.txt
 > +  - vsync-active: see display/panel/display-timing.txt
 > +
 > +The panel must obey the rules for a SPI slave device as specified in
 > +spi/spi-bus.txt
 > +
 > +The device node can contain one 'port' child node with one child
 > +'endpoint' node, according to the bindings defined in
 > +media/video-interfaces.txt. This node should describe panel's
video bus.
 > +
 > +Example:
 > +
 > +panel: display@0 {
 > +     compatible = "stm32f429-disco,ltdc-panel", "ilitek,ili9341";
 > +     reg = <0>;
 > +     spi-3wire;
 > +     spi-max-frequency = <1000>;
 > +     dc-gpios = < 13 0>;
 > +     port {
 > +             panel_in: endpoint {
 > +                     remote-endpoint = <_out>;
 > +             };
 > +     };
 > +};
 > diff --git a/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
b/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
 > index 392fa14..45b68f4 100644
 > --- a/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
 > +++ b/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
 > @@ -316,6 +316,85 @@
 >                               };
 >                       };
 >
 > +                     ltdc_pins_f429_disco: ltdc-1 {
 > +                             pins {
 > +                                     pinmux = ,
 > +                                             /* LCD_HSYNC */
 > +                                              ,
 > +                                              /* LCD_VSYNC */
 > +                                              ,
 > +                                              /* LCD_CLK */
 > +                                              ,
 > +                                              /* LCD_R2 */
 > +                                              ,
 > +                                              /* LCD_R3 */
 > +                                              ,
 > +           

Re: [PATCH 1/4] add dts node for drm panel driver ili9341 add dts i2c3 for stmpe touch add dts spi5 for gyro & ili9341

2020-04-30 Thread Alexandre Torgue

Hi

On 4/30/20 11:43 AM, dillon.min...@gmail.com wrote:

From: dillon min 

Signed-off-by: dillon min 


Commit title should be ARM: dts: stm32: bla bla on stm32f429 and please 
a commit message.



---
  .../bindings/display/panel/ilitek,ili9341.txt  | 42 +++
  arch/arm/boot/dts/stm32f4-pinctrl.dtsi | 79 +++
  arch/arm/boot/dts/stm32f429-disco.dts  | 88 ++
  arch/arm/boot/dts/stm32f429.dtsi   | 12 +++
  4 files changed, 221 insertions(+)
  create mode 100644 
Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt

diff --git a/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt 
b/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt


This binding description should be in a separate patch and you have to 
write in YAML format.




new file mode 100644
index 000..f5a4e55
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt
@@ -0,0 +1,42 @@
+Ilitek ILI9341 TFT panel driver with SPI control bus
+
+This is a driver for 240x320 TFT panels, accepting a rgb input
+streams that get adapted and scaled to the panel.
+
+Required properties:
+  - compatible: "stm32f429-disco,ltdc-panel", "ilitek,ili9341"
+(full system-specific compatible is always required to look up 
configuration)
+  - reg: address of the panel on the SPI bus
+
+Optional properties:
+  - reset-gpios: a GPIO spec for the reset pin, see gpio/gpio.txt
+  - dc-gpios: a GPIO spec for the dc pin, see gpio/gpio.txt
+
+  The following optional properties only apply to RGB input mode:
+
+  - pixelclk-active: see display/panel/display-timing.txt
+  - de-active: see display/panel/display-timing.txt
+  - hsync-active: see display/panel/display-timing.txt
+  - vsync-active: see display/panel/display-timing.txt
+
+The panel must obey the rules for a SPI slave device as specified in
+spi/spi-bus.txt
+
+The device node can contain one 'port' child node with one child
+'endpoint' node, according to the bindings defined in
+media/video-interfaces.txt. This node should describe panel's video bus.
+
+Example:
+
+panel: display@0 {
+   compatible = "stm32f429-disco,ltdc-panel", "ilitek,ili9341";
+   reg = <0>;
+   spi-3wire;
+   spi-max-frequency = <1000>;
+   dc-gpios = < 13 0>;
+   port {
+   panel_in: endpoint {
+   remote-endpoint = <_out>;
+   };
+   };
+};
diff --git a/arch/arm/boot/dts/stm32f4-pinctrl.dtsi 
b/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
index 392fa14..45b68f4 100644
--- a/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
+++ b/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
@@ -316,6 +316,85 @@
};
};
  
+			ltdc_pins_f429_disco: ltdc-1 {

+   pins {
+   pinmux = ,
+   /* LCD_HSYNC */
+,
+/* LCD_VSYNC */
+,
+/* LCD_CLK */
+,
+/* LCD_R2 */
+,
+/* LCD_R3 */
+,
+/* LCD_R4 */
+,
+/* LCD_R5 */
+,
+/* LCD_R6*/
+,
+/* LCD_R7 */
+,
+/* LCD_G2 */
+,
+/* LCD_G3 */
+,
+/* LCD_G4 */
+,
+/* LCD_B2 */
+,
+/* LCD_B3*/
+,
+/* LCD_G5 */
+,
+/* LCD_G6 */
+,
+/* LCD_G7 */
+,
+/* LCD_B4 */
+,
+   

[PATCH 1/4] add dts node for drm panel driver ili9341 add dts i2c3 for stmpe touch add dts spi5 for gyro & ili9341

2020-04-30 Thread dillon . minfei
From: dillon min 

Signed-off-by: dillon min 
---
 .../bindings/display/panel/ilitek,ili9341.txt  | 42 +++
 arch/arm/boot/dts/stm32f4-pinctrl.dtsi | 79 +++
 arch/arm/boot/dts/stm32f429-disco.dts  | 88 ++
 arch/arm/boot/dts/stm32f429.dtsi   | 12 +++
 4 files changed, 221 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt

diff --git a/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt 
b/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt
new file mode 100644
index 000..f5a4e55
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt
@@ -0,0 +1,42 @@
+Ilitek ILI9341 TFT panel driver with SPI control bus
+
+This is a driver for 240x320 TFT panels, accepting a rgb input
+streams that get adapted and scaled to the panel.
+
+Required properties:
+  - compatible: "stm32f429-disco,ltdc-panel", "ilitek,ili9341"
+(full system-specific compatible is always required to look up 
configuration)
+  - reg: address of the panel on the SPI bus
+
+Optional properties:
+  - reset-gpios: a GPIO spec for the reset pin, see gpio/gpio.txt
+  - dc-gpios: a GPIO spec for the dc pin, see gpio/gpio.txt
+
+  The following optional properties only apply to RGB input mode:
+
+  - pixelclk-active: see display/panel/display-timing.txt
+  - de-active: see display/panel/display-timing.txt
+  - hsync-active: see display/panel/display-timing.txt
+  - vsync-active: see display/panel/display-timing.txt
+
+The panel must obey the rules for a SPI slave device as specified in
+spi/spi-bus.txt
+
+The device node can contain one 'port' child node with one child
+'endpoint' node, according to the bindings defined in
+media/video-interfaces.txt. This node should describe panel's video bus.
+
+Example:
+
+panel: display@0 {
+   compatible = "stm32f429-disco,ltdc-panel", "ilitek,ili9341";
+   reg = <0>;
+   spi-3wire;
+   spi-max-frequency = <1000>;
+   dc-gpios = < 13 0>;
+   port {
+   panel_in: endpoint {
+   remote-endpoint = <_out>;
+   };
+   };
+};
diff --git a/arch/arm/boot/dts/stm32f4-pinctrl.dtsi 
b/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
index 392fa14..45b68f4 100644
--- a/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
+++ b/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
@@ -316,6 +316,85 @@
};
};
 
+   ltdc_pins_f429_disco: ltdc-1 {
+   pins {
+   pinmux = ,
+   /* LCD_HSYNC */
+,
+/* LCD_VSYNC */
+,
+/* LCD_CLK */
+,
+/* LCD_R2 */
+,
+/* LCD_R3 */
+,
+/* LCD_R4 */
+,
+/* LCD_R5 */
+,
+/* LCD_R6*/
+,
+/* LCD_R7 */
+,
+/* LCD_G2 */
+,
+/* LCD_G3 */
+,
+/* LCD_G4 */
+,
+/* LCD_B2 */
+,
+/* LCD_B3*/
+,
+/* LCD_G5 */
+,
+/* LCD_G6 */
+,
+/* LCD_G7 */
+,
+/* LCD_B4 */
+,
+/* LCD_B5 */
+,
+/* LCD_B6 */
+,
+/* LCD_B7 */
+ 

[PATCH 1/4] Add SPDX headers for files in arch/um/drivers

2019-08-25 Thread Alex Dewar
Convert files to use SPDX header. All files are licensed under the GPLv2.

Signed-off-by: Alex Dewar 
---
 arch/um/drivers/Makefile| 2 +-
 arch/um/drivers/chan.h  | 2 +-
 arch/um/drivers/chan_kern.c | 2 +-
 arch/um/drivers/chan_user.c | 2 +-
 arch/um/drivers/chan_user.h | 2 +-
 arch/um/drivers/cow_user.c  | 2 +-
 arch/um/drivers/daemon.h| 2 +-
 arch/um/drivers/daemon_kern.c   | 2 +-
 arch/um/drivers/daemon_user.c   | 2 +-
 arch/um/drivers/fd.c| 2 +-
 arch/um/drivers/harddog_user.c  | 2 +-
 arch/um/drivers/hostaudio_kern.c| 2 +-
 arch/um/drivers/line.c  | 2 +-
 arch/um/drivers/line.h  | 2 +-
 arch/um/drivers/mconsole.h  | 2 +-
 arch/um/drivers/mconsole_kern.c | 2 +-
 arch/um/drivers/mconsole_kern.h | 2 +-
 arch/um/drivers/mconsole_user.c | 2 +-
 arch/um/drivers/net_kern.c  | 2 +-
 arch/um/drivers/net_user.c  | 2 +-
 arch/um/drivers/null.c  | 2 +-
 arch/um/drivers/pcap_kern.c | 2 +-
 arch/um/drivers/pcap_user.c | 2 +-
 arch/um/drivers/pcap_user.h | 2 +-
 arch/um/drivers/port.h  | 2 +-
 arch/um/drivers/port_kern.c | 2 +-
 arch/um/drivers/port_user.c | 2 +-
 arch/um/drivers/pty.c   | 2 +-
 arch/um/drivers/slip_kern.c | 2 +-
 arch/um/drivers/slip_user.c | 2 +-
 arch/um/drivers/slirp_kern.c| 2 +-
 arch/um/drivers/slirp_user.c| 2 +-
 arch/um/drivers/ssl.c   | 2 +-
 arch/um/drivers/stdio_console.c | 2 +-
 arch/um/drivers/stdio_console.h | 2 +-
 arch/um/drivers/tty.c   | 2 +-
 arch/um/drivers/ubd.h   | 2 +-
 arch/um/drivers/ubd_kern.c  | 2 +-
 arch/um/drivers/ubd_user.c  | 2 +-
 arch/um/drivers/umcast.h| 2 +-
 arch/um/drivers/umcast_kern.c   | 2 +-
 arch/um/drivers/umcast_user.c   | 2 +-
 arch/um/drivers/vde.h   | 2 +-
 arch/um/drivers/vde_kern.c  | 2 +-
 arch/um/drivers/vde_user.c  | 2 +-
 arch/um/drivers/vector_kern.c   | 2 +-
 arch/um/drivers/vector_kern.h   | 2 +-
 arch/um/drivers/vector_transports.c | 2 +-
 arch/um/drivers/vector_user.c   | 2 +-
 arch/um/drivers/vector_user.h   | 2 +-
 arch/um/drivers/xterm.c | 2 +-
 arch/um/drivers/xterm.h | 2 +-
 arch/um/drivers/xterm_kern.c| 2 +-
 53 files changed, 53 insertions(+), 53 deletions(-)

diff --git a/arch/um/drivers/Makefile b/arch/um/drivers/Makefile
index 693319839f69..84d6f6e42c3a 100644
--- a/arch/um/drivers/Makefile
+++ b/arch/um/drivers/Makefile
@@ -1,6 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0
 #
 # Copyright (C) 2000, 2002, 2003 Jeff Dike (jd...@karaya.com)
-# Licensed under the GPL
 #

 # pcap is broken in 2.5 because kbuild doesn't allow pcap.a to be linked
diff --git a/arch/um/drivers/chan.h b/arch/um/drivers/chan.h
index c512b0306dd4..c37cc4f26f91 100644
--- a/arch/um/drivers/chan.h
+++ b/arch/um/drivers/chan.h
@@ -1,6 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Copyright (C) 2000, 2001 Jeff Dike (jd...@karaya.com)
- * Licensed under the GPL
  */

 #ifndef __CHAN_KERN_H__
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
index 749d2bf59599..62997055c454 100644
--- a/arch/um/drivers/chan_kern.c
+++ b/arch/um/drivers/chan_kern.c
@@ -1,6 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com)
- * Licensed under the GPL
  */

 #include 
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c
index 3fd7c3efdb18..4d80526a4236 100644
--- a/arch/um/drivers/chan_user.c
+++ b/arch/um/drivers/chan_user.c
@@ -1,6 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com)
- * Licensed under the GPL
  */

 #include 
diff --git a/arch/um/drivers/chan_user.h b/arch/um/drivers/chan_user.h
index 03f1b565c5f9..7bb036f5 100644
--- a/arch/um/drivers/chan_user.h
+++ b/arch/um/drivers/chan_user.h
@@ -1,6 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Copyright (C) 2000, 2001 Jeff Dike (jd...@karaya.com)
- * Licensed under the GPL
  */

 #ifndef __CHAN_USER_H__
diff --git a/arch/um/drivers/cow_user.c b/arch/um/drivers/cow_user.c
index 0ee9cc6cc4c7..74b0c2686c95 100644
--- a/arch/um/drivers/cow_user.c
+++ b/arch/um/drivers/cow_user.c
@@ -1,6 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (C) 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com)
- * Licensed under the GPL
  */

 /*
diff --git a/arch/um/drivers/daemon.h b/arch/um/drivers/daemon.h
index c2dd1951559f..1509cc7eb907 100644
--- a/arch/um/drivers/daemon.h
+++ b/arch/um/drivers/daemon.h
@@ -1,6 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
- * Licensed under the GPL
  */

 #ifndef __DAEMON_H__
diff --git 

Re: [PATCH 1/4] Add support for SUNIX Multi-I/O board

2019-04-05 Thread Enrico Weigelt, metux IT consult
On 02.04.19 08:19, Lee Jones wrote:

> Please use `git format-patch` and `git send-email` to create and
> submit your patches.  Use the following flags; --annotate, --compose
> and --thread to ensure the patches are sent a) pinned to each other so
> they do not become spread throughout people's inboxes and b) a cover
> letter is provided which should contain a summary of what you are
> trying to achieve.

here's a little script which helps w/ that: it automatically picks
the corresponding maintainers/maillists, you can also pass the usual
git-send-email flags.


--mtx

-- 
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
i...@metux.net -- +49-151-27565287
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

[ -x "$GIT" ]   || export GIT=git
[ -d "$KERNELSRC" ] || export KERNELSRC=.

LKML="linux-kernel@vger.kernel.org"

check_ksrc() {
if [ -d $KERNELSRC/arch ] && \
   [ -d $KERNELSRC/block ] && \
   [ -d $KERNELSRC/init ] && \
   [ -d $KERNELSRC/kernel ] && \
   [ -d $KERNELSRC/sound ] && \
   [ -d $KERNELSRC/drivers ] && \
   [ -d $KERNELSRC/net ] && \
   [ -d $KERNELSRC/include ] && \
   [ -f $KERNELSRC/COPYING ] && \
   [ -f $KERNELSRC/MAINTAINERS ] && \
   [ -f $KERNELSRC/CREDITS ] && \
   [ -f $KERNELSRC/Kconfig ] && \
   [ -f $KERNELSRC/Makefile ]; then
return 0
else
echo "$0: cant find the kernel source tree. please call me from the 
topdir" >&2
exit 1
fi
}

check_ksrc

get_files() {
$GIT diff --name-only "$REF"
}

get_maintainers() {
$KERNELSRC/scripts/get_maintainer.pl --m --l --remove-duplicates 
`get_files` |
grep -v "$LKML" | \
grep -E "(maintainer|reviewer|open list)" | \
grep -o '[[:alnum:]+\.\_\-]*@[[:alnum:]+\.\_\-]*'
}

construct_params() {
echo -n "--to=$LKML "
for a in $MAINTAINERS; do
echo -n "--cc=$a "
done
}

if [ ! "$1" ]; then
echo "$0: missing git revision to send out" >&2
echo "" >&2
echo "for example: 'HEAD^' for sending just the last patch" >&2
echo >&2
echo "$0  []"
exit 1
fi

REF="$1"
shift

echo "scanning for maintainers ..." >&2
MAINTAINERS=`get_maintainers`

echo "sending mail ..." >&2
$GIT send-email `construct_params` "$REF" "$@"


Re: [PATCH 1/4] Add support for SUNIX Multi-I/O board

2019-04-02 Thread Lee Jones
On Tue, 19 Mar 2019, Morris Ku wrote:

> Add Kconfig and Makefile entry.
> 
> Signed-off-by: Morris Ku 
> ---
>  mfd/Kconfig  | 5 +
>  mfd/Makefile | 2 ++
>  2 files changed, 7 insertions(+)

Can you send this set again please.  There are some basic issues with
it, which would make reviewing difficult.

Please use `git format-patch` and `git send-email` to create and
submit your patches.  Use the following flags; --annotate, --compose
and --thread to ensure the patches are sent a) pinned to each other so
they do not become spread throughout people's inboxes and b) a cover
letter is provided which should contain a summary of what you are
trying to achieve.

The diff should be based from the root directory, not 'drivers', such
that the diff should read "drivers/mfd/*".

> diff --git a/mfd/Kconfig b/mfd/Kconfig
> index 76f9909c..efbb3ef1 100644
> --- a/mfd/Kconfig
> +++ b/mfd/Kconfig
> @@ -1916,5 +1916,10 @@ config RAVE_SP_CORE
> Select this to get support for the Supervisory Processor
> device found on several devices in RAVE line of hardware.
>  
> +config SUNIX
> + tristate "SUNIX Multi-I/O Board Driver"
> + help
> +   Support for SUNIX Multi-I/O controller.
> +
>  endmenu
>  endif
> diff --git a/mfd/Makefile b/mfd/Makefile
> index 12980a4a..b70f44de 100644
> --- a/mfd/Makefile
> +++ b/mfd/Makefile
> @@ -241,4 +241,6 @@ obj-$(CONFIG_MFD_MXS_LRADC) += mxs-lradc.o
>  obj-$(CONFIG_MFD_SC27XX_PMIC)+= sprd-sc27xx-spi.o
>  obj-$(CONFIG_RAVE_SP_CORE)   += rave-sp.o
>  obj-$(CONFIG_MFD_ROHM_BD718XX)   += rohm-bd718x7.o
> +obj-$(CONFIG_SUNIX)  += sunix/
> +
>  

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog


Re: [PATCH 1/4] Add support for SUNIX Multi-I/O card

2019-03-27 Thread Greg KH
On Fri, Mar 08, 2019 at 08:33:22PM +0800, Morris Ku wrote:
> Add Kconfig and Makefile entry.
> 
> Signed-off-by: Morris Ku 
> ---
>  Kconfig  | 2 ++
>  Makefile | 1 +
>  2 files changed, 3 insertions(+)
> 
> diff --git a/Kconfig b/Kconfig
> index 4f9f9905..645dcc85 100644
> --- a/Kconfig
> +++ b/Kconfig
> @@ -228,4 +228,6 @@ source "drivers/siox/Kconfig"
>  
>  source "drivers/slimbus/Kconfig"
>  
> +source "drivers/char/snx/Kconfig"
> +

And now the kernel build just broke :(

Please always test-build your patches in the order you have them.

Please fix up this series and resend, it needs a lot of work.

greg k-h


[PATCH 1/4] Add support for SUNIX Multi-I/O board

2019-03-19 Thread Morris Ku
Add Kconfig and Makefile entry.

Signed-off-by: Morris Ku 
---
 mfd/Kconfig  | 5 +
 mfd/Makefile | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/mfd/Kconfig b/mfd/Kconfig
index 76f9909c..efbb3ef1 100644
--- a/mfd/Kconfig
+++ b/mfd/Kconfig
@@ -1916,5 +1916,10 @@ config RAVE_SP_CORE
  Select this to get support for the Supervisory Processor
  device found on several devices in RAVE line of hardware.
 
+config SUNIX
+   tristate "SUNIX Multi-I/O Board Driver"
+   help
+ Support for SUNIX Multi-I/O controller.
+
 endmenu
 endif
diff --git a/mfd/Makefile b/mfd/Makefile
index 12980a4a..b70f44de 100644
--- a/mfd/Makefile
+++ b/mfd/Makefile
@@ -241,4 +241,6 @@ obj-$(CONFIG_MFD_MXS_LRADC) += mxs-lradc.o
 obj-$(CONFIG_MFD_SC27XX_PMIC)  += sprd-sc27xx-spi.o
 obj-$(CONFIG_RAVE_SP_CORE) += rave-sp.o
 obj-$(CONFIG_MFD_ROHM_BD718XX) += rohm-bd718x7.o
+obj-$(CONFIG_SUNIX)+= sunix/
+
 
-- 
2.17.1



[PATCH 1/4] Add support for SUNIX Multi-I/O card

2019-03-08 Thread Morris Ku
Add Kconfig and Makefile entry.

Signed-off-by: Morris Ku 
---
 Kconfig  | 2 ++
 Makefile | 1 +
 2 files changed, 3 insertions(+)

diff --git a/Kconfig b/Kconfig
index 4f9f9905..645dcc85 100644
--- a/Kconfig
+++ b/Kconfig
@@ -228,4 +228,6 @@ source "drivers/siox/Kconfig"
 
 source "drivers/slimbus/Kconfig"
 
+source "drivers/char/snx/Kconfig"
+
 endmenu
diff --git a/Makefile b/Makefile
index e1ce029d..c9393c75 100644
--- a/Makefile
+++ b/Makefile
@@ -186,3 +186,4 @@ obj-$(CONFIG_MULTIPLEXER)   += mux/
 obj-$(CONFIG_UNISYS_VISORBUS)  += visorbus/
 obj-$(CONFIG_SIOX) += siox/
 obj-$(CONFIG_GNSS) += gnss/
+obj-$(CONFIG_SNX)  += snx/
--
2.17.1



[PATCH 1/4] Add path resolution flag LOOKUP_NEVER_FOLLOW

2019-02-12 Thread demiobenour
From: "Demi M. Obenour" 

This adds the flag LOOKUP_NEVER_FOLLOW to path resolution, which tells
the code in fs/namei.c to never follow symlinks.  This flag overrides
LOOKUP_FOLLOW, since this makes internal APIs simpler: code can set the
flag without needing to also clear LOOKUP_FOLLOW, which is often set by
default.

This is a prerequisite to adding O_PATHSTATIC, but is also useful for
kernel-internal use.
---
 fs/namei.c| 4 +++-
 include/linux/namei.h | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/namei.c b/fs/namei.c
index 914178cdbe94..54fbd2c7ba82 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1720,7 +1720,9 @@ static int pick_link(struct nameidata *nd, struct path 
*link,
 {
int error;
struct saved *last;
-   if (unlikely(nd->total_link_count++ >= MAXSYMLINKS)) {
+   const int max_symlinks = (nd->flags & LOOKUP_NEVER_FOLLOW) ?
+   0 : MAXSYMLINKS;
+   if (unlikely(nd->total_link_count++ >= max_symlinks)) {
path_to_nameidata(link, nd);
return -ELOOP;
}
diff --git a/include/linux/namei.h b/include/linux/namei.h
index a78606e8e3df..f065502a653d 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -24,10 +24,12 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, 
LAST_BIND};
  *  - internal "there are more path components" flag
  *  - dentry cache is untrusted; force a real lookup
  *  - suppress terminal automount
+ *  - never follow symbolic links, even internally
  */
 #define LOOKUP_FOLLOW  0x0001
 #define LOOKUP_DIRECTORY   0x0002
 #define LOOKUP_AUTOMOUNT   0x0004
+#define LOOKUP_NEVER_FOLLOW0x0008
 
 #define LOOKUP_PARENT  0x0010
 #define LOOKUP_REVAL   0x0020
-- 
2.20.1



[Qemu-devel][PATCH 1/4] Add CET xsaves/xrstors related macros and structures.

2018-12-26 Thread Yang Weijiang
CET protection in user mode and kernel mode relies on
specific MSRs, these MSRs' contents are automatically
saved/restored by xsaves/xrstors instructions.

Signed-off-by: Zhang Yi 
Signed-off-by: Yang Weijiang 
---
 target/i386/cpu.h | 36 +++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 9c52d0cbeb..f3f724d8e6 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -469,6 +469,9 @@ typedef enum X86Seg {
 #define XSTATE_ZMM_Hi256_BIT6
 #define XSTATE_Hi16_ZMM_BIT 7
 #define XSTATE_PKRU_BIT 9
+#define XSTATE_RESERVED_BIT 10
+#define XSTATE_CET_U_BIT11
+#define XSTATE_CET_S_BIT12
 
 #define XSTATE_FP_MASK  (1ULL << XSTATE_FP_BIT)
 #define XSTATE_SSE_MASK (1ULL << XSTATE_SSE_BIT)
@@ -479,6 +482,19 @@ typedef enum X86Seg {
 #define XSTATE_ZMM_Hi256_MASK   (1ULL << XSTATE_ZMM_Hi256_BIT)
 #define XSTATE_Hi16_ZMM_MASK(1ULL << XSTATE_Hi16_ZMM_BIT)
 #define XSTATE_PKRU_MASK(1ULL << XSTATE_PKRU_BIT)
+#define XSTATE_RESERVED_MASK(1ULL << XSTATE_RESERVED_BIT)
+#define XSTATE_CET_U_MASK   (1ULL << XSTATE_CET_U_BIT)
+#define XSTATE_CET_S_MASK   (1ULL << XSTATE_CET_S_BIT)
+
+/* CPUID feature bits available in XCR0 */
+#define CPUID_XSTATE_USER_MASK  (XSTATE_FP_MASK | XSTATE_SSE_MASK \
+| XSTATE_YMM_MASK | XSTATE_BNDREGS_MASK \
+| XSTATE_BNDCSR_MASK | XSTATE_OPMASK_MASK \
+| XSTATE_ZMM_Hi256_MASK \
+| XSTATE_Hi16_ZMM_MASK | XSTATE_PKRU_MASK)
+
+/* CPUID feature bits available in XSS */
+#define CPUID_XSTATE_KERNEL_MASK(XSTATE_CET_U_MASK | XSTATE_CET_S_MASK)
 
 /* CPUID feature words */
 typedef enum FeatureWord {
@@ -503,6 +519,8 @@ typedef enum FeatureWord {
 FEAT_XSAVE_COMP_LO, /* CPUID[EAX=0xd,ECX=0].EAX */
 FEAT_XSAVE_COMP_HI, /* CPUID[EAX=0xd,ECX=0].EDX */
 FEAT_ARCH_CAPABILITIES,
+FEAT_XSAVE_SV_LO,   /* CPUID[EAX=0xd,ECX=1].ECX */
+FEAT_XSAVE_SV_HI,   /* CPUID[EAX=0xd,ECX=1].EDX */
 FEATURE_WORDS,
 } FeatureWord;
 
@@ -687,7 +705,7 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS];
 #define CPUID_7_0_ECX_LA57 (1U << 16)
 #define CPUID_7_0_ECX_RDPID(1U << 22)
 #define CPUID_7_0_ECX_CLDEMOTE (1U << 25)  /* CLDEMOTE Instruction */
-
+#define CPUID_7_0_ECX_CET_SHSTK (1U << 7)  /* CET SHSTK feature bit */
 #define CPUID_7_0_EDX_AVX512_4VNNIW (1U << 2) /* AVX512 Neural Network 
Instructions */
 #define CPUID_7_0_EDX_AVX512_4FMAPS (1U << 3) /* AVX512 Multiply Accumulation 
Single Precision */
 #define CPUID_7_0_EDX_PCONFIG (1U << 18)   /* Platform Configuration */
@@ -1021,6 +1039,19 @@ typedef struct XSavePKRU {
 uint32_t padding;
 } XSavePKRU;
 
+/* Ext. save area 11: User mode CET state */
+typedef struct XSaveCETU {
+uint64_t u_cet;
+uint64_t user_ssp;
+} XSaveCETU;
+
+/* Ext. save area 12: Supervisor mode CET state */
+typedef struct XSaveCETS {
+uint64_t kernel_ssp;
+uint64_t pl1_ssp;
+uint64_t pl2_ssp;
+} XSaveCETS;
+
 typedef struct X86XSaveArea {
 X86LegacyXSaveArea legacy;
 X86XSaveHeader header;
@@ -1039,6 +1070,9 @@ typedef struct X86XSaveArea {
 XSaveHi16_ZMM hi16_zmm_state;
 /* PKRU State: */
 XSavePKRU pkru_state;
+/* CET State: */
+XSaveCETU cet_u;
+XSaveCETS cet_s;
 } X86XSaveArea;
 
 QEMU_BUILD_BUG_ON(offsetof(X86XSaveArea, avx_state) != 0x240);
-- 
2.17.1



[PATCH 1/4] add infrastructure for tagging functions as error injectable

2017-11-17 Thread Josef Bacik
From: Josef Bacik 

Using BPF we can override kprob'ed functions and return arbitrary
values.  Obviously this can be a bit unsafe, so make this feature opt-in
for functions.  Simply tag a function with KPROBE_ERROR_INJECT_SYMBOL in
order to give BPF access to that function for error injection purposes.

Signed-off-by: Josef Bacik 
---
 arch/x86/include/asm/asm.h|   6 ++
 include/asm-generic/kprobes.h |   9 +++
 include/asm-generic/vmlinux.lds.h |  10 +++
 include/linux/kprobes.h   |   1 +
 include/linux/module.h|   5 ++
 kernel/kprobes.c  | 163 ++
 kernel/module.c   |   6 +-
 7 files changed, 199 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h
index b0dc91f4bedc..340f4cc43255 100644
--- a/arch/x86/include/asm/asm.h
+++ b/arch/x86/include/asm/asm.h
@@ -85,6 +85,12 @@
_ASM_PTR (entry);   \
.popsection
 
+# define _ASM_KPROBE_ERROR_INJECT(entry)   \
+   .pushsection "_kprobe_error_inject_list","aw" ; \
+   _ASM_ALIGN ;\
+   _ASM_PTR (entry);   \
+   .popseciton
+
 .macro ALIGN_DESTINATION
/* check for bad alignment of destination */
movl %edi,%ecx
diff --git a/include/asm-generic/kprobes.h b/include/asm-generic/kprobes.h
index 57af9f21d148..f96c4de5d7b0 100644
--- a/include/asm-generic/kprobes.h
+++ b/include/asm-generic/kprobes.h
@@ -22,4 +22,13 @@ static unsigned long __used  
\
 #endif
 #endif /* defined(__KERNEL__) && !defined(__ASSEMBLY__) */
 
+#ifdef CONFIG_BPF_KPROBE_OVERRIDE
+#define BPF_ALLOW_ERROR_INJECTION(fname)   \
+static unsigned long __used\
+   __attribute__((__section__("_kprobe_error_inject_list")))   \
+   _eil_addr_##fname = (unsigned long)fname;
+#else
+#define BPF_ALLOW_ERROR_INJECTION(fname)
+#endif
+
 #endif /* _ASM_GENERIC_KPROBES_H */
diff --git a/include/asm-generic/vmlinux.lds.h 
b/include/asm-generic/vmlinux.lds.h
index 8acfc1e099e1..85822804861e 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -136,6 +136,15 @@
 #define KPROBE_BLACKLIST()
 #endif
 
+#ifdef CONFIG_BPF_KPROBE_OVERRIDE
+#define ERROR_INJECT_LIST(). = ALIGN(8);   
\
+   
VMLINUX_SYMBOL(__start_kprobe_error_inject_list) = .;   \
+   KEEP(*(_kprobe_error_inject_list))  
\
+   VMLINUX_SYMBOL(__stop_kprobe_error_inject_list) 
= .;
+#else
+#define ERROR_INJECT_LIST()
+#endif
+
 #ifdef CONFIG_EVENT_TRACING
 #define FTRACE_EVENTS(). = ALIGN(8);   
\
VMLINUX_SYMBOL(__start_ftrace_events) = .;  \
@@ -560,6 +569,7 @@
FTRACE_EVENTS() \
TRACE_SYSCALLS()\
KPROBE_BLACKLIST()  \
+   ERROR_INJECT_LIST() \
MEM_DISCARD(init.rodata)\
CLK_OF_TABLES() \
RESERVEDMEM_OF_TABLES() \
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index bd2684700b74..4f501cb73aec 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -271,6 +271,7 @@ extern bool arch_kprobe_on_func_entry(unsigned long offset);
 extern bool kprobe_on_func_entry(kprobe_opcode_t *addr, const char *sym, 
unsigned long offset);
 
 extern bool within_kprobe_blacklist(unsigned long addr);
+extern bool within_kprobe_error_injection_list(unsigned long addr);
 
 struct kprobe_insn_cache {
struct mutex mutex;
diff --git a/include/linux/module.h b/include/linux/module.h
index fe5aa3736707..7bb1a9b9a322 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -475,6 +475,11 @@ struct module {
ctor_fn_t *ctors;
unsigned int num_ctors;
 #endif
+
+#ifdef CONFIG_BPF_KPROBE_OVERRIDE
+   unsigned int num_kprobe_ei_funcs;
+   unsigned long *kprobe_ei_funcs;
+#endif
 } cacheline_aligned __randomize_layout;
 #ifndef MODULE_ARCH_INIT
 #define MODULE_ARCH_INIT {}
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index a1606a4224e1..7afadf07b34e 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -83,6 +83,16 @@ static raw_spinlock_t *kretprobe_table_lock_ptr(unsigned 
long hash)
return &(kretprobe_table_locks[hash].lock);
 }
 
+/* List of symbols that can be overriden for error injection. */
+static 

[PATCH 1/4] add infrastructure for tagging functions as error injectable

2017-11-17 Thread Josef Bacik
From: Josef Bacik 

Using BPF we can override kprob'ed functions and return arbitrary
values.  Obviously this can be a bit unsafe, so make this feature opt-in
for functions.  Simply tag a function with KPROBE_ERROR_INJECT_SYMBOL in
order to give BPF access to that function for error injection purposes.

Signed-off-by: Josef Bacik 
---
 arch/x86/include/asm/asm.h|   6 ++
 include/asm-generic/kprobes.h |   9 +++
 include/asm-generic/vmlinux.lds.h |  10 +++
 include/linux/kprobes.h   |   1 +
 include/linux/module.h|   5 ++
 kernel/kprobes.c  | 163 ++
 kernel/module.c   |   6 +-
 7 files changed, 199 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h
index b0dc91f4bedc..340f4cc43255 100644
--- a/arch/x86/include/asm/asm.h
+++ b/arch/x86/include/asm/asm.h
@@ -85,6 +85,12 @@
_ASM_PTR (entry);   \
.popsection
 
+# define _ASM_KPROBE_ERROR_INJECT(entry)   \
+   .pushsection "_kprobe_error_inject_list","aw" ; \
+   _ASM_ALIGN ;\
+   _ASM_PTR (entry);   \
+   .popseciton
+
 .macro ALIGN_DESTINATION
/* check for bad alignment of destination */
movl %edi,%ecx
diff --git a/include/asm-generic/kprobes.h b/include/asm-generic/kprobes.h
index 57af9f21d148..f96c4de5d7b0 100644
--- a/include/asm-generic/kprobes.h
+++ b/include/asm-generic/kprobes.h
@@ -22,4 +22,13 @@ static unsigned long __used  
\
 #endif
 #endif /* defined(__KERNEL__) && !defined(__ASSEMBLY__) */
 
+#ifdef CONFIG_BPF_KPROBE_OVERRIDE
+#define BPF_ALLOW_ERROR_INJECTION(fname)   \
+static unsigned long __used\
+   __attribute__((__section__("_kprobe_error_inject_list")))   \
+   _eil_addr_##fname = (unsigned long)fname;
+#else
+#define BPF_ALLOW_ERROR_INJECTION(fname)
+#endif
+
 #endif /* _ASM_GENERIC_KPROBES_H */
diff --git a/include/asm-generic/vmlinux.lds.h 
b/include/asm-generic/vmlinux.lds.h
index 8acfc1e099e1..85822804861e 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -136,6 +136,15 @@
 #define KPROBE_BLACKLIST()
 #endif
 
+#ifdef CONFIG_BPF_KPROBE_OVERRIDE
+#define ERROR_INJECT_LIST(). = ALIGN(8);   
\
+   
VMLINUX_SYMBOL(__start_kprobe_error_inject_list) = .;   \
+   KEEP(*(_kprobe_error_inject_list))  
\
+   VMLINUX_SYMBOL(__stop_kprobe_error_inject_list) 
= .;
+#else
+#define ERROR_INJECT_LIST()
+#endif
+
 #ifdef CONFIG_EVENT_TRACING
 #define FTRACE_EVENTS(). = ALIGN(8);   
\
VMLINUX_SYMBOL(__start_ftrace_events) = .;  \
@@ -560,6 +569,7 @@
FTRACE_EVENTS() \
TRACE_SYSCALLS()\
KPROBE_BLACKLIST()  \
+   ERROR_INJECT_LIST() \
MEM_DISCARD(init.rodata)\
CLK_OF_TABLES() \
RESERVEDMEM_OF_TABLES() \
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index bd2684700b74..4f501cb73aec 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -271,6 +271,7 @@ extern bool arch_kprobe_on_func_entry(unsigned long offset);
 extern bool kprobe_on_func_entry(kprobe_opcode_t *addr, const char *sym, 
unsigned long offset);
 
 extern bool within_kprobe_blacklist(unsigned long addr);
+extern bool within_kprobe_error_injection_list(unsigned long addr);
 
 struct kprobe_insn_cache {
struct mutex mutex;
diff --git a/include/linux/module.h b/include/linux/module.h
index fe5aa3736707..7bb1a9b9a322 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -475,6 +475,11 @@ struct module {
ctor_fn_t *ctors;
unsigned int num_ctors;
 #endif
+
+#ifdef CONFIG_BPF_KPROBE_OVERRIDE
+   unsigned int num_kprobe_ei_funcs;
+   unsigned long *kprobe_ei_funcs;
+#endif
 } cacheline_aligned __randomize_layout;
 #ifndef MODULE_ARCH_INIT
 #define MODULE_ARCH_INIT {}
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index a1606a4224e1..7afadf07b34e 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -83,6 +83,16 @@ static raw_spinlock_t *kretprobe_table_lock_ptr(unsigned 
long hash)
return &(kretprobe_table_locks[hash].lock);
 }
 
+/* List of symbols that can be overriden for error injection. */
+static LIST_HEAD(kprobe_error_injection_list);
+static 

Re: [PATCH 1/4] Add a function to start/reduce a timer

2017-11-08 Thread Thomas Gleixner
On Mon, 30 Oct 2017, David Howells wrote:

> Add a function, similar to mod_timer(), that will start a timer it isn't
> running and will modify it if it is running and has an expiry time longer
> than the new time.  If the timer is running with an expiry time that's the
> same or sooner, no change is made.
> 
> The function looks like:
> 
>   int reduce_timer(struct timer_list *timer, unsigned long expires);

It seems you missed to address any comment I made in:

http://lkml.kernel.org/r/alpine.DEB.2.20.1710201359480.2908@nanos

Thanks,

tglx


Re: [PATCH 1/4] Add a function to start/reduce a timer

2017-11-08 Thread Thomas Gleixner
On Mon, 30 Oct 2017, David Howells wrote:

> Add a function, similar to mod_timer(), that will start a timer it isn't
> running and will modify it if it is running and has an expiry time longer
> than the new time.  If the timer is running with an expiry time that's the
> same or sooner, no change is made.
> 
> The function looks like:
> 
>   int reduce_timer(struct timer_list *timer, unsigned long expires);

It seems you missed to address any comment I made in:

http://lkml.kernel.org/r/alpine.DEB.2.20.1710201359480.2908@nanos

Thanks,

tglx


[PATCH 1/4] Add a function to start/reduce a timer

2017-10-30 Thread David Howells
Add a function, similar to mod_timer(), that will start a timer it isn't
running and will modify it if it is running and has an expiry time longer
than the new time.  If the timer is running with an expiry time that's the
same or sooner, no change is made.

The function looks like:

int reduce_timer(struct timer_list *timer, unsigned long expires);

Signed-off-by: David Howells 
cc: Thomas Gleixner 
---

 include/linux/timer.h |1 +
 kernel/time/timer.c   |   49 +
 2 files changed, 42 insertions(+), 8 deletions(-)

diff --git a/include/linux/timer.h b/include/linux/timer.h
index e6789b8757d5..6ec5d897606d 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -187,6 +187,7 @@ extern void add_timer_on(struct timer_list *timer, int cpu);
 extern int del_timer(struct timer_list * timer);
 extern int mod_timer(struct timer_list *timer, unsigned long expires);
 extern int mod_timer_pending(struct timer_list *timer, unsigned long expires);
+extern int reduce_timer(struct timer_list *timer, unsigned long expires);
 
 /*
  * The jiffies value which is added to now, when there is no timer
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index f2674a056c26..bd9369d7225e 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -929,8 +929,11 @@ static struct timer_base *lock_timer_base(struct 
timer_list *timer,
}
 }
 
+#define MOD_TIMER_PENDING_ONLY 0x01
+#define MOD_TIMER_REDUCE   0x02
+
 static inline int
-__mod_timer(struct timer_list *timer, unsigned long expires, bool pending_only)
+__mod_timer(struct timer_list *timer, unsigned long expires, unsigned int 
options)
 {
struct timer_base *base, *new_base;
unsigned int idx = UINT_MAX;
@@ -950,8 +953,13 @@ __mod_timer(struct timer_list *timer, unsigned long 
expires, bool pending_only)
 * larger granularity than you would get from adding a new
 * timer with this expiry.
 */
-   if (timer->expires == expires)
-   return 1;
+   if (options & MOD_TIMER_REDUCE) {
+   if (time_before_eq(timer->expires, expires))
+   return 1;
+   } else {
+   if (timer->expires == expires)
+   return 1;
+   }
 
/*
 * We lock timer base and calculate the bucket index right
@@ -962,6 +970,13 @@ __mod_timer(struct timer_list *timer, unsigned long 
expires, bool pending_only)
base = lock_timer_base(timer, );
forward_timer_base(base);
 
+   if (timer_pending(timer) &&
+   options & MOD_TIMER_REDUCE &&
+   time_before_eq(timer->expires, expires)) {
+   ret = 1;
+   goto out_unlock;
+   }
+
clk = base->clk;
idx = calc_wheel_index(expires, clk);
 
@@ -971,7 +986,10 @@ __mod_timer(struct timer_list *timer, unsigned long 
expires, bool pending_only)
 * subsequent call will exit in the expires check above.
 */
if (idx == timer_get_idx(timer)) {
-   timer->expires = expires;
+   if (!(options & MOD_TIMER_REDUCE))
+   timer->expires = expires;
+   else if (time_after(timer->expires, expires))
+   timer->expires = expires;
ret = 1;
goto out_unlock;
}
@@ -981,7 +999,7 @@ __mod_timer(struct timer_list *timer, unsigned long 
expires, bool pending_only)
}
 
ret = detach_if_pending(timer, base, false);
-   if (!ret && pending_only)
+   if (!ret && options & MOD_TIMER_PENDING_ONLY)
goto out_unlock;
 
debug_activate(timer, expires);
@@ -1042,7 +1060,7 @@ __mod_timer(struct timer_list *timer, unsigned long 
expires, bool pending_only)
  */
 int mod_timer_pending(struct timer_list *timer, unsigned long expires)
 {
-   return __mod_timer(timer, expires, true);
+   return __mod_timer(timer, expires, MOD_TIMER_PENDING_ONLY);
 }
 EXPORT_SYMBOL(mod_timer_pending);
 
@@ -1068,11 +1086,26 @@ EXPORT_SYMBOL(mod_timer_pending);
  */
 int mod_timer(struct timer_list *timer, unsigned long expires)
 {
-   return __mod_timer(timer, expires, false);
+   return __mod_timer(timer, expires, 0);
 }
 EXPORT_SYMBOL(mod_timer);
 
 /**
+ * reduce_timer - modify a timer's timeout if it would reduce the timeout
+ * @timer: the timer to be modified
+ * @expires: new timeout in jiffies
+ *
+ * reduce_timer() is very similar to mod_timer(), except that it will only
+ * modify a running timer if that would reduce the expiration time (it will
+ * start a timer that isn't running).
+ */
+int 

[PATCH 1/4] Add a function to start/reduce a timer

2017-10-30 Thread David Howells
Add a function, similar to mod_timer(), that will start a timer it isn't
running and will modify it if it is running and has an expiry time longer
than the new time.  If the timer is running with an expiry time that's the
same or sooner, no change is made.

The function looks like:

int reduce_timer(struct timer_list *timer, unsigned long expires);

Signed-off-by: David Howells 
cc: Thomas Gleixner 
---

 include/linux/timer.h |1 +
 kernel/time/timer.c   |   49 +
 2 files changed, 42 insertions(+), 8 deletions(-)

diff --git a/include/linux/timer.h b/include/linux/timer.h
index e6789b8757d5..6ec5d897606d 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -187,6 +187,7 @@ extern void add_timer_on(struct timer_list *timer, int cpu);
 extern int del_timer(struct timer_list * timer);
 extern int mod_timer(struct timer_list *timer, unsigned long expires);
 extern int mod_timer_pending(struct timer_list *timer, unsigned long expires);
+extern int reduce_timer(struct timer_list *timer, unsigned long expires);
 
 /*
  * The jiffies value which is added to now, when there is no timer
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index f2674a056c26..bd9369d7225e 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -929,8 +929,11 @@ static struct timer_base *lock_timer_base(struct 
timer_list *timer,
}
 }
 
+#define MOD_TIMER_PENDING_ONLY 0x01
+#define MOD_TIMER_REDUCE   0x02
+
 static inline int
-__mod_timer(struct timer_list *timer, unsigned long expires, bool pending_only)
+__mod_timer(struct timer_list *timer, unsigned long expires, unsigned int 
options)
 {
struct timer_base *base, *new_base;
unsigned int idx = UINT_MAX;
@@ -950,8 +953,13 @@ __mod_timer(struct timer_list *timer, unsigned long 
expires, bool pending_only)
 * larger granularity than you would get from adding a new
 * timer with this expiry.
 */
-   if (timer->expires == expires)
-   return 1;
+   if (options & MOD_TIMER_REDUCE) {
+   if (time_before_eq(timer->expires, expires))
+   return 1;
+   } else {
+   if (timer->expires == expires)
+   return 1;
+   }
 
/*
 * We lock timer base and calculate the bucket index right
@@ -962,6 +970,13 @@ __mod_timer(struct timer_list *timer, unsigned long 
expires, bool pending_only)
base = lock_timer_base(timer, );
forward_timer_base(base);
 
+   if (timer_pending(timer) &&
+   options & MOD_TIMER_REDUCE &&
+   time_before_eq(timer->expires, expires)) {
+   ret = 1;
+   goto out_unlock;
+   }
+
clk = base->clk;
idx = calc_wheel_index(expires, clk);
 
@@ -971,7 +986,10 @@ __mod_timer(struct timer_list *timer, unsigned long 
expires, bool pending_only)
 * subsequent call will exit in the expires check above.
 */
if (idx == timer_get_idx(timer)) {
-   timer->expires = expires;
+   if (!(options & MOD_TIMER_REDUCE))
+   timer->expires = expires;
+   else if (time_after(timer->expires, expires))
+   timer->expires = expires;
ret = 1;
goto out_unlock;
}
@@ -981,7 +999,7 @@ __mod_timer(struct timer_list *timer, unsigned long 
expires, bool pending_only)
}
 
ret = detach_if_pending(timer, base, false);
-   if (!ret && pending_only)
+   if (!ret && options & MOD_TIMER_PENDING_ONLY)
goto out_unlock;
 
debug_activate(timer, expires);
@@ -1042,7 +1060,7 @@ __mod_timer(struct timer_list *timer, unsigned long 
expires, bool pending_only)
  */
 int mod_timer_pending(struct timer_list *timer, unsigned long expires)
 {
-   return __mod_timer(timer, expires, true);
+   return __mod_timer(timer, expires, MOD_TIMER_PENDING_ONLY);
 }
 EXPORT_SYMBOL(mod_timer_pending);
 
@@ -1068,11 +1086,26 @@ EXPORT_SYMBOL(mod_timer_pending);
  */
 int mod_timer(struct timer_list *timer, unsigned long expires)
 {
-   return __mod_timer(timer, expires, false);
+   return __mod_timer(timer, expires, 0);
 }
 EXPORT_SYMBOL(mod_timer);
 
 /**
+ * reduce_timer - modify a timer's timeout if it would reduce the timeout
+ * @timer: the timer to be modified
+ * @expires: new timeout in jiffies
+ *
+ * reduce_timer() is very similar to mod_timer(), except that it will only
+ * modify a running timer if that would reduce the expiration time (it will
+ * start a timer that isn't running).
+ */
+int reduce_timer(struct timer_list *timer, unsigned long 

Re: [PATCH 1/4] Add a new element for the struct perf_tool, and add the --per-event-dump option for perf script

2017-09-22 Thread Jiri Olsa
On Mon, Sep 18, 2017 at 01:55:19PM +0800, yuzhoujian wrote:
> Signed-off-by: yuzhoujian 
> ---
>  tools/perf/builtin-script.c | 11 ++-
>  tools/perf/util/tool.h  |  1 +
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index 378f76c..91b5225 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -57,6 +57,7 @@
>  static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
>  static struct perf_stat_config   stat_config;
>  static int   max_blocks;
> +static FILE  *per_event_dump_file;

why is this added in this patch?

jirka

>  
>  unsigned int scripting_max_stack = PERF_MAX_STACK_DEPTH;
>  
> @@ -2690,6 +2691,7 @@ int cmd_script(int argc, const char **argv)
>   .cpu_map = process_cpu_map_event,
>   .ordered_events  = true,
>   .ordering_requires_timestamps = true,
> + .per_event_dump = false,
>   },
>   };
>   struct perf_data_file file = {
> @@ -2760,6 +2762,8 @@ int cmd_script(int argc, const char **argv)
>   "Show context switch events (if recorded)"),
>   OPT_BOOLEAN('\0', "show-namespace-events", 
> _namespace_events,
>   "Show namespace events (if recorded)"),
> + OPT_BOOLEAN('\0', "per-event-dump", _event_dump,
> + "print trace output to files named by the monitored 
> events"),
>   OPT_BOOLEAN('f', "force", _conf.force, "don't complain, do it"),
>   OPT_INTEGER(0, "max-blocks", _blocks,
>   "Maximum number of code blocks to dump with brstackinsn"),
> @@ -2797,7 +2801,12 @@ int cmd_script(int argc, const char **argv)
>  
>   file.path = input_name;
>   file.force = symbol_conf.force;
> -
> + for (i = 1; argv[i] != NULL; i++) {
> + if (strcmp(argv[i], "--per-event-dump") == 0) {
> + script.tool.per_event_dump = true;
> + break;
> + }
> + }
>   if (argc > 1 && !strncmp(argv[0], "rec", strlen("rec"))) {
>   rec_script_path = get_script_path(argv[1], RECORD_SUFFIX);
>   if (!rec_script_path)
> diff --git a/tools/perf/util/tool.h b/tools/perf/util/tool.h
> index d549e50..ad40931 100644
> --- a/tools/perf/util/tool.h
> +++ b/tools/perf/util/tool.h
> @@ -75,6 +75,7 @@ struct perf_tool {
>   boolordered_events;
>   boolordering_requires_timestamps;
>   boolnamespace_events;
> + boolper_event_dump;
>   enum show_feature_header show_feat_hdr;
>  };
>  
> -- 
> 1.8.3.1
> 


Re: [PATCH 1/4] Add a new element for the struct perf_tool, and add the --per-event-dump option for perf script

2017-09-22 Thread Jiri Olsa
On Mon, Sep 18, 2017 at 01:55:19PM +0800, yuzhoujian wrote:
> Signed-off-by: yuzhoujian 
> ---
>  tools/perf/builtin-script.c | 11 ++-
>  tools/perf/util/tool.h  |  1 +
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index 378f76c..91b5225 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -57,6 +57,7 @@
>  static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
>  static struct perf_stat_config   stat_config;
>  static int   max_blocks;
> +static FILE  *per_event_dump_file;

why is this added in this patch?

jirka

>  
>  unsigned int scripting_max_stack = PERF_MAX_STACK_DEPTH;
>  
> @@ -2690,6 +2691,7 @@ int cmd_script(int argc, const char **argv)
>   .cpu_map = process_cpu_map_event,
>   .ordered_events  = true,
>   .ordering_requires_timestamps = true,
> + .per_event_dump = false,
>   },
>   };
>   struct perf_data_file file = {
> @@ -2760,6 +2762,8 @@ int cmd_script(int argc, const char **argv)
>   "Show context switch events (if recorded)"),
>   OPT_BOOLEAN('\0', "show-namespace-events", 
> _namespace_events,
>   "Show namespace events (if recorded)"),
> + OPT_BOOLEAN('\0', "per-event-dump", _event_dump,
> + "print trace output to files named by the monitored 
> events"),
>   OPT_BOOLEAN('f', "force", _conf.force, "don't complain, do it"),
>   OPT_INTEGER(0, "max-blocks", _blocks,
>   "Maximum number of code blocks to dump with brstackinsn"),
> @@ -2797,7 +2801,12 @@ int cmd_script(int argc, const char **argv)
>  
>   file.path = input_name;
>   file.force = symbol_conf.force;
> -
> + for (i = 1; argv[i] != NULL; i++) {
> + if (strcmp(argv[i], "--per-event-dump") == 0) {
> + script.tool.per_event_dump = true;
> + break;
> + }
> + }
>   if (argc > 1 && !strncmp(argv[0], "rec", strlen("rec"))) {
>   rec_script_path = get_script_path(argv[1], RECORD_SUFFIX);
>   if (!rec_script_path)
> diff --git a/tools/perf/util/tool.h b/tools/perf/util/tool.h
> index d549e50..ad40931 100644
> --- a/tools/perf/util/tool.h
> +++ b/tools/perf/util/tool.h
> @@ -75,6 +75,7 @@ struct perf_tool {
>   boolordered_events;
>   boolordering_requires_timestamps;
>   boolnamespace_events;
> + boolper_event_dump;
>   enum show_feature_header show_feat_hdr;
>  };
>  
> -- 
> 1.8.3.1
> 


Re: [PATCH 1/4] Add a new element for the struct perf_tool, and add the --per-event-dump option for perf script

2017-09-22 Thread Jiri Olsa
On Mon, Sep 18, 2017 at 01:55:19PM +0800, yuzhoujian wrote:
> Signed-off-by: yuzhoujian 
> ---
>  tools/perf/builtin-script.c | 11 ++-
>  tools/perf/util/tool.h  |  1 +
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index 378f76c..91b5225 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -57,6 +57,7 @@
>  static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
>  static struct perf_stat_config   stat_config;
>  static int   max_blocks;
> +static FILE  *per_event_dump_file;
>  
>  unsigned int scripting_max_stack = PERF_MAX_STACK_DEPTH;
>  
> @@ -2690,6 +2691,7 @@ int cmd_script(int argc, const char **argv)
>   .cpu_map = process_cpu_map_event,
>   .ordered_events  = true,
>   .ordering_requires_timestamps = true,
> + .per_event_dump = false,
>   },
>   };
>   struct perf_data_file file = {
> @@ -2760,6 +2762,8 @@ int cmd_script(int argc, const char **argv)
>   "Show context switch events (if recorded)"),
>   OPT_BOOLEAN('\0', "show-namespace-events", 
> _namespace_events,
>   "Show namespace events (if recorded)"),
> + OPT_BOOLEAN('\0', "per-event-dump", _event_dump,
> + "print trace output to files named by the monitored 
> events"),
>   OPT_BOOLEAN('f', "force", _conf.force, "don't complain, do it"),
>   OPT_INTEGER(0, "max-blocks", _blocks,
>   "Maximum number of code blocks to dump with brstackinsn"),
> @@ -2797,7 +2801,12 @@ int cmd_script(int argc, const char **argv)
>  
>   file.path = input_name;
>   file.force = symbol_conf.force;
> -
> + for (i = 1; argv[i] != NULL; i++) {
> + if (strcmp(argv[i], "--per-event-dump") == 0) {
> + script.tool.per_event_dump = true;
> + break;
> + }

why do you need this? OPT_BOOLEAN loads the per_event_dump

jirka

> + }
>   if (argc > 1 && !strncmp(argv[0], "rec", strlen("rec"))) {
>   rec_script_path = get_script_path(argv[1], RECORD_SUFFIX);
>   if (!rec_script_path)
> diff --git a/tools/perf/util/tool.h b/tools/perf/util/tool.h
> index d549e50..ad40931 100644
> --- a/tools/perf/util/tool.h
> +++ b/tools/perf/util/tool.h
> @@ -75,6 +75,7 @@ struct perf_tool {
>   boolordered_events;
>   boolordering_requires_timestamps;
>   boolnamespace_events;
> + boolper_event_dump;
>   enum show_feature_header show_feat_hdr;
>  };
>  
> -- 
> 1.8.3.1
> 


Re: [PATCH 1/4] Add a new element for the struct perf_tool, and add the --per-event-dump option for perf script

2017-09-22 Thread Jiri Olsa
On Mon, Sep 18, 2017 at 01:55:19PM +0800, yuzhoujian wrote:
> Signed-off-by: yuzhoujian 

missing changelog

jirka

> ---
>  tools/perf/builtin-script.c | 11 ++-
>  tools/perf/util/tool.h  |  1 +
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index 378f76c..91b5225 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -57,6 +57,7 @@
>  static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
>  static struct perf_stat_config   stat_config;
>  static int   max_blocks;
> +static FILE  *per_event_dump_file;
>  
>  unsigned int scripting_max_stack = PERF_MAX_STACK_DEPTH;
>  
> @@ -2690,6 +2691,7 @@ int cmd_script(int argc, const char **argv)
>   .cpu_map = process_cpu_map_event,
>   .ordered_events  = true,
>   .ordering_requires_timestamps = true,
> + .per_event_dump = false,
>   },
>   };
>   struct perf_data_file file = {
> @@ -2760,6 +2762,8 @@ int cmd_script(int argc, const char **argv)
>   "Show context switch events (if recorded)"),
>   OPT_BOOLEAN('\0', "show-namespace-events", 
> _namespace_events,
>   "Show namespace events (if recorded)"),
> + OPT_BOOLEAN('\0', "per-event-dump", _event_dump,
> + "print trace output to files named by the monitored 
> events"),
>   OPT_BOOLEAN('f', "force", _conf.force, "don't complain, do it"),
>   OPT_INTEGER(0, "max-blocks", _blocks,
>   "Maximum number of code blocks to dump with brstackinsn"),
> @@ -2797,7 +2801,12 @@ int cmd_script(int argc, const char **argv)
>  
>   file.path = input_name;
>   file.force = symbol_conf.force;
> -
> + for (i = 1; argv[i] != NULL; i++) {
> + if (strcmp(argv[i], "--per-event-dump") == 0) {
> + script.tool.per_event_dump = true;
> + break;
> + }
> + }
>   if (argc > 1 && !strncmp(argv[0], "rec", strlen("rec"))) {
>   rec_script_path = get_script_path(argv[1], RECORD_SUFFIX);
>   if (!rec_script_path)
> diff --git a/tools/perf/util/tool.h b/tools/perf/util/tool.h
> index d549e50..ad40931 100644
> --- a/tools/perf/util/tool.h
> +++ b/tools/perf/util/tool.h
> @@ -75,6 +75,7 @@ struct perf_tool {
>   boolordered_events;
>   boolordering_requires_timestamps;
>   boolnamespace_events;
> + boolper_event_dump;
>   enum show_feature_header show_feat_hdr;
>  };
>  
> -- 
> 1.8.3.1
> 


Re: [PATCH 1/4] Add a new element for the struct perf_tool, and add the --per-event-dump option for perf script

2017-09-22 Thread Jiri Olsa
On Mon, Sep 18, 2017 at 01:55:19PM +0800, yuzhoujian wrote:
> Signed-off-by: yuzhoujian 
> ---
>  tools/perf/builtin-script.c | 11 ++-
>  tools/perf/util/tool.h  |  1 +
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index 378f76c..91b5225 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -57,6 +57,7 @@
>  static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
>  static struct perf_stat_config   stat_config;
>  static int   max_blocks;
> +static FILE  *per_event_dump_file;
>  
>  unsigned int scripting_max_stack = PERF_MAX_STACK_DEPTH;
>  
> @@ -2690,6 +2691,7 @@ int cmd_script(int argc, const char **argv)
>   .cpu_map = process_cpu_map_event,
>   .ordered_events  = true,
>   .ordering_requires_timestamps = true,
> + .per_event_dump = false,
>   },
>   };
>   struct perf_data_file file = {
> @@ -2760,6 +2762,8 @@ int cmd_script(int argc, const char **argv)
>   "Show context switch events (if recorded)"),
>   OPT_BOOLEAN('\0', "show-namespace-events", 
> _namespace_events,
>   "Show namespace events (if recorded)"),
> + OPT_BOOLEAN('\0', "per-event-dump", _event_dump,
> + "print trace output to files named by the monitored 
> events"),
>   OPT_BOOLEAN('f', "force", _conf.force, "don't complain, do it"),
>   OPT_INTEGER(0, "max-blocks", _blocks,
>   "Maximum number of code blocks to dump with brstackinsn"),
> @@ -2797,7 +2801,12 @@ int cmd_script(int argc, const char **argv)
>  
>   file.path = input_name;
>   file.force = symbol_conf.force;
> -
> + for (i = 1; argv[i] != NULL; i++) {
> + if (strcmp(argv[i], "--per-event-dump") == 0) {
> + script.tool.per_event_dump = true;
> + break;
> + }

why do you need this? OPT_BOOLEAN loads the per_event_dump

jirka

> + }
>   if (argc > 1 && !strncmp(argv[0], "rec", strlen("rec"))) {
>   rec_script_path = get_script_path(argv[1], RECORD_SUFFIX);
>   if (!rec_script_path)
> diff --git a/tools/perf/util/tool.h b/tools/perf/util/tool.h
> index d549e50..ad40931 100644
> --- a/tools/perf/util/tool.h
> +++ b/tools/perf/util/tool.h
> @@ -75,6 +75,7 @@ struct perf_tool {
>   boolordered_events;
>   boolordering_requires_timestamps;
>   boolnamespace_events;
> + boolper_event_dump;
>   enum show_feature_header show_feat_hdr;
>  };
>  
> -- 
> 1.8.3.1
> 


Re: [PATCH 1/4] Add a new element for the struct perf_tool, and add the --per-event-dump option for perf script

2017-09-22 Thread Jiri Olsa
On Mon, Sep 18, 2017 at 01:55:19PM +0800, yuzhoujian wrote:
> Signed-off-by: yuzhoujian 

missing changelog

jirka

> ---
>  tools/perf/builtin-script.c | 11 ++-
>  tools/perf/util/tool.h  |  1 +
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index 378f76c..91b5225 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -57,6 +57,7 @@
>  static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
>  static struct perf_stat_config   stat_config;
>  static int   max_blocks;
> +static FILE  *per_event_dump_file;
>  
>  unsigned int scripting_max_stack = PERF_MAX_STACK_DEPTH;
>  
> @@ -2690,6 +2691,7 @@ int cmd_script(int argc, const char **argv)
>   .cpu_map = process_cpu_map_event,
>   .ordered_events  = true,
>   .ordering_requires_timestamps = true,
> + .per_event_dump = false,
>   },
>   };
>   struct perf_data_file file = {
> @@ -2760,6 +2762,8 @@ int cmd_script(int argc, const char **argv)
>   "Show context switch events (if recorded)"),
>   OPT_BOOLEAN('\0', "show-namespace-events", 
> _namespace_events,
>   "Show namespace events (if recorded)"),
> + OPT_BOOLEAN('\0', "per-event-dump", _event_dump,
> + "print trace output to files named by the monitored 
> events"),
>   OPT_BOOLEAN('f', "force", _conf.force, "don't complain, do it"),
>   OPT_INTEGER(0, "max-blocks", _blocks,
>   "Maximum number of code blocks to dump with brstackinsn"),
> @@ -2797,7 +2801,12 @@ int cmd_script(int argc, const char **argv)
>  
>   file.path = input_name;
>   file.force = symbol_conf.force;
> -
> + for (i = 1; argv[i] != NULL; i++) {
> + if (strcmp(argv[i], "--per-event-dump") == 0) {
> + script.tool.per_event_dump = true;
> + break;
> + }
> + }
>   if (argc > 1 && !strncmp(argv[0], "rec", strlen("rec"))) {
>   rec_script_path = get_script_path(argv[1], RECORD_SUFFIX);
>   if (!rec_script_path)
> diff --git a/tools/perf/util/tool.h b/tools/perf/util/tool.h
> index d549e50..ad40931 100644
> --- a/tools/perf/util/tool.h
> +++ b/tools/perf/util/tool.h
> @@ -75,6 +75,7 @@ struct perf_tool {
>   boolordered_events;
>   boolordering_requires_timestamps;
>   boolnamespace_events;
> + boolper_event_dump;
>   enum show_feature_header show_feat_hdr;
>  };
>  
> -- 
> 1.8.3.1
> 


[PATCH 1/4] Add a new element for the struct perf_tool, and add the --per-event-dump option for perf script

2017-09-17 Thread yuzhoujian
Signed-off-by: yuzhoujian 
---
 tools/perf/builtin-script.c | 11 ++-
 tools/perf/util/tool.h  |  1 +
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 378f76c..91b5225 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -57,6 +57,7 @@
 static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
 static struct perf_stat_config stat_config;
 static int max_blocks;
+static FILE*per_event_dump_file;
 
 unsigned int scripting_max_stack = PERF_MAX_STACK_DEPTH;
 
@@ -2690,6 +2691,7 @@ int cmd_script(int argc, const char **argv)
.cpu_map = process_cpu_map_event,
.ordered_events  = true,
.ordering_requires_timestamps = true,
+   .per_event_dump = false,
},
};
struct perf_data_file file = {
@@ -2760,6 +2762,8 @@ int cmd_script(int argc, const char **argv)
"Show context switch events (if recorded)"),
OPT_BOOLEAN('\0', "show-namespace-events", 
_namespace_events,
"Show namespace events (if recorded)"),
+   OPT_BOOLEAN('\0', "per-event-dump", _event_dump,
+   "print trace output to files named by the monitored 
events"),
OPT_BOOLEAN('f', "force", _conf.force, "don't complain, do it"),
OPT_INTEGER(0, "max-blocks", _blocks,
"Maximum number of code blocks to dump with brstackinsn"),
@@ -2797,7 +2801,12 @@ int cmd_script(int argc, const char **argv)
 
file.path = input_name;
file.force = symbol_conf.force;
-
+   for (i = 1; argv[i] != NULL; i++) {
+   if (strcmp(argv[i], "--per-event-dump") == 0) {
+   script.tool.per_event_dump = true;
+   break;
+   }
+   }
if (argc > 1 && !strncmp(argv[0], "rec", strlen("rec"))) {
rec_script_path = get_script_path(argv[1], RECORD_SUFFIX);
if (!rec_script_path)
diff --git a/tools/perf/util/tool.h b/tools/perf/util/tool.h
index d549e50..ad40931 100644
--- a/tools/perf/util/tool.h
+++ b/tools/perf/util/tool.h
@@ -75,6 +75,7 @@ struct perf_tool {
boolordered_events;
boolordering_requires_timestamps;
boolnamespace_events;
+   boolper_event_dump;
enum show_feature_header show_feat_hdr;
 };
 
-- 
1.8.3.1



[PATCH 1/4] Add a new element for the struct perf_tool, and add the --per-event-dump option for perf script

2017-09-17 Thread yuzhoujian
Signed-off-by: yuzhoujian 
---
 tools/perf/builtin-script.c | 11 ++-
 tools/perf/util/tool.h  |  1 +
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 378f76c..91b5225 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -57,6 +57,7 @@
 static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
 static struct perf_stat_config stat_config;
 static int max_blocks;
+static FILE*per_event_dump_file;
 
 unsigned int scripting_max_stack = PERF_MAX_STACK_DEPTH;
 
@@ -2690,6 +2691,7 @@ int cmd_script(int argc, const char **argv)
.cpu_map = process_cpu_map_event,
.ordered_events  = true,
.ordering_requires_timestamps = true,
+   .per_event_dump = false,
},
};
struct perf_data_file file = {
@@ -2760,6 +2762,8 @@ int cmd_script(int argc, const char **argv)
"Show context switch events (if recorded)"),
OPT_BOOLEAN('\0', "show-namespace-events", 
_namespace_events,
"Show namespace events (if recorded)"),
+   OPT_BOOLEAN('\0', "per-event-dump", _event_dump,
+   "print trace output to files named by the monitored 
events"),
OPT_BOOLEAN('f', "force", _conf.force, "don't complain, do it"),
OPT_INTEGER(0, "max-blocks", _blocks,
"Maximum number of code blocks to dump with brstackinsn"),
@@ -2797,7 +2801,12 @@ int cmd_script(int argc, const char **argv)
 
file.path = input_name;
file.force = symbol_conf.force;
-
+   for (i = 1; argv[i] != NULL; i++) {
+   if (strcmp(argv[i], "--per-event-dump") == 0) {
+   script.tool.per_event_dump = true;
+   break;
+   }
+   }
if (argc > 1 && !strncmp(argv[0], "rec", strlen("rec"))) {
rec_script_path = get_script_path(argv[1], RECORD_SUFFIX);
if (!rec_script_path)
diff --git a/tools/perf/util/tool.h b/tools/perf/util/tool.h
index d549e50..ad40931 100644
--- a/tools/perf/util/tool.h
+++ b/tools/perf/util/tool.h
@@ -75,6 +75,7 @@ struct perf_tool {
boolordered_events;
boolordering_requires_timestamps;
boolnamespace_events;
+   boolper_event_dump;
enum show_feature_header show_feat_hdr;
 };
 
-- 
1.8.3.1



Re: [PATCH 1/4] Add BUG_XX() debugging options

2016-02-01 Thread Jeffrey Merkey
On 2/1/16, Jeffrey Merkey  wrote:
> On 2/1/16, kbuild test robot  wrote:
>> Hi Jeffrey,
>>
>> [auto build test WARNING on v4.5-rc2]
>> [also build test WARNING on next-20160201]
>> [cannot apply to tip/x86/core]
>> [if your patch is applied to the wrong git tree, please drop us a note to
>> help improving the system]
>>
>> url:
>> https://github.com/0day-ci/linux/commits/Jeffrey-Merkey/Add-BUG_XX-debugging-options/20160202-040506
>> config: x86_64-randconfig-x012-201605 (attached as .config)
>> reproduce:
>> # save the attached .config to linux build tree
>> make ARCH=x86_64
>>
>> All warnings (new ones prefixed by >>):
>>
>>In file included from include/linux/bug.h:4:0,
>> from include/linux/page-flags.h:9,
>> from kernel/bounds.c:9:
 arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not
 defined [-Wundef]
>> #if CONFIG_DEBUG_BUG
>> ^
>> --
>>In file included from include/linux/bug.h:4:0,
>> from include/linux/page-flags.h:9,
>> from kernel/bounds.c:9:
 arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not
 defined [-Wundef]
>> #if CONFIG_DEBUG_BUG
>> ^
>>In file included from include/linux/bug.h:4:0,
>> from include/linux/crypto.h:23,
>> from arch/x86/kernel/asm-offsets.c:8:
 arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not
 defined [-Wundef]
>> #if CONFIG_DEBUG_BUG
>> ^
>>
>> vim +/CONFIG_DEBUG_BUG +14 arch/x86/include/asm/bug.h
>>
>>  1   #ifndef _ASM_X86_BUG_H
>>  2   #define _ASM_X86_BUG_H
>>  3   
>>  4   #define HAVE_ARCH_BUG
>>  5   
>>  6   #ifdef CONFIG_DEBUG_BUGVERBOSE
>>  7   
>>  8   #ifdef CONFIG_X86_32
>>  9   # define __BUG_C0   "2:\t.long 1b, %c0\n"
>> 10   #else
>> 11   # define __BUG_C0   "2:\t.long 1b - 2b, %c0 - 2b\n"
>> 12   #endif
>> 13   
>>   > 14   #if CONFIG_DEBUG_BUG
>> 15   #define BUG()   
>> \
>> 16   do {
>> \
>> 17   asm volatile("int3");   
>> \
>> 18   unreachable();  
>> \
>> 19   } while (0)
>> 20   #else
>> 21   #define BUG()   
>> \
>> 22   do {
>> \
>>
>> ---
>> 0-DAY kernel test infrastructureOpen Source Technology
>> Center
>> https://lists.01.org/pipermail/kbuild-all   Intel
>> Corporation
>>
>
>
> I am looking at this one, but I'm not sure what the point is of
> running a test to build something where the defines are ignored.  Is
> this file off limits to use CONFIG options in the build?
>
> Jeff
>

Never mind.  I just found it.  LOL

:-)

Jeff


Re: [PATCH 1/4] Add BUG_XX() debugging options

2016-02-01 Thread Jeffrey Merkey
On 2/1/16, kbuild test robot  wrote:
> Hi Jeffrey,
>
> [auto build test WARNING on v4.5-rc2]
> [also build test WARNING on next-20160201]
> [cannot apply to tip/x86/core]
> [if your patch is applied to the wrong git tree, please drop us a note to
> help improving the system]
>
> url:
> https://github.com/0day-ci/linux/commits/Jeffrey-Merkey/Add-BUG_XX-debugging-options/20160202-040506
> config: x86_64-randconfig-x012-201605 (attached as .config)
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=x86_64
>
> All warnings (new ones prefixed by >>):
>
>In file included from include/linux/bug.h:4:0,
> from include/linux/page-flags.h:9,
> from kernel/bounds.c:9:
>>> arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not
>>> defined [-Wundef]
> #if CONFIG_DEBUG_BUG
> ^
> --
>In file included from include/linux/bug.h:4:0,
> from include/linux/page-flags.h:9,
> from kernel/bounds.c:9:
>>> arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not
>>> defined [-Wundef]
> #if CONFIG_DEBUG_BUG
> ^
>In file included from include/linux/bug.h:4:0,
> from include/linux/crypto.h:23,
> from arch/x86/kernel/asm-offsets.c:8:
>>> arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not
>>> defined [-Wundef]
> #if CONFIG_DEBUG_BUG
> ^
>
> vim +/CONFIG_DEBUG_BUG +14 arch/x86/include/asm/bug.h
>
>  1#ifndef _ASM_X86_BUG_H
>  2#define _ASM_X86_BUG_H
>  3
>  4#define HAVE_ARCH_BUG
>  5
>  6#ifdef CONFIG_DEBUG_BUGVERBOSE
>  7
>  8#ifdef CONFIG_X86_32
>  9# define __BUG_C0   "2:\t.long 1b, %c0\n"
> 10#else
> 11# define __BUG_C0   "2:\t.long 1b - 2b, %c0 - 2b\n"
> 12#endif
> 13
>   > 14#if CONFIG_DEBUG_BUG
> 15#define BUG()   
> \
> 16do {
> \
> 17asm volatile("int3");   
> \
> 18unreachable();  
> \
> 19} while (0)
> 20#else
> 21#define BUG()   
> \
> 22do {
> \
>
> ---
> 0-DAY kernel test infrastructureOpen Source Technology
> Center
> https://lists.01.org/pipermail/kbuild-all   Intel
> Corporation
>


I am looking at this one, but I'm not sure what the point is of
running a test to build something where the defines are ignored.  Is
this file off limits to use CONFIG options in the build?

Jeff


Re: [PATCH 1/4] Add BUG_XX() debugging options

2016-02-01 Thread kbuild test robot
Hi Jeffrey,

[auto build test WARNING on v4.5-rc2]
[also build test WARNING on next-20160201]
[cannot apply to tip/x86/core]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improving the system]

url:
https://github.com/0day-ci/linux/commits/Jeffrey-Merkey/Add-BUG_XX-debugging-options/20160202-040506
config: x86_64-randconfig-x012-201605 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from include/linux/bug.h:4:0,
from include/linux/page-flags.h:9,
from kernel/bounds.c:9:
>> arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not defined 
>> [-Wundef]
#if CONFIG_DEBUG_BUG
^
--
   In file included from include/linux/bug.h:4:0,
from include/linux/page-flags.h:9,
from kernel/bounds.c:9:
>> arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not defined 
>> [-Wundef]
#if CONFIG_DEBUG_BUG
^
   In file included from include/linux/bug.h:4:0,
from include/linux/crypto.h:23,
from arch/x86/kernel/asm-offsets.c:8:
>> arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not defined 
>> [-Wundef]
#if CONFIG_DEBUG_BUG
^

vim +/CONFIG_DEBUG_BUG +14 arch/x86/include/asm/bug.h

 1  #ifndef _ASM_X86_BUG_H
 2  #define _ASM_X86_BUG_H
 3  
 4  #define HAVE_ARCH_BUG
 5  
 6  #ifdef CONFIG_DEBUG_BUGVERBOSE
 7  
 8  #ifdef CONFIG_X86_32
 9  # define __BUG_C0   "2:\t.long 1b, %c0\n"
10  #else
11  # define __BUG_C0   "2:\t.long 1b - 2b, %c0 - 2b\n"
12  #endif
13  
  > 14  #if CONFIG_DEBUG_BUG
15  #define BUG()   \
16  do {\
17  asm volatile("int3");   \
18  unreachable();  \
19  } while (0)
20  #else
21  #define BUG()   \
22  do {\

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


[PATCH 1/4] Add BUG_XX() debugging options

2016-02-01 Thread Jeffrey Merkey
This patch series adds config options which can be set during compile to
direct the compiler to output a breakpoint instruction anywhere a BUG()
or WARN() macro has been placed in the kernel to trigger the system to
enter a debugger if a bug is detected by the system.  Use of this
compile time option also allows conditional breakpoints to be set in the
kernel with these currently used macros.

This addition is extremely useful for debugging hard and soft lockups
real time and quickly from a console debugger, and other areas of the
kernel.

Signed-off-by: Jeffrey Merkey 
---
 arch/x86/include/asm/bug.h | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h
index ba38ebb..debbbfd 100644
--- a/arch/x86/include/asm/bug.h
+++ b/arch/x86/include/asm/bug.h
@@ -11,6 +11,13 @@
 # define __BUG_C0  "2:\t.long 1b - 2b, %c0 - 2b\n"
 #endif
 
+#if CONFIG_DEBUG_BUG
+#define BUG()  \
+do {   \
+   asm volatile("int3");   \
+   unreachable();  \
+} while (0)
+#else
 #define BUG()  \
 do {   \
asm volatile("1:\tud2\n"\
@@ -23,7 +30,14 @@ do { 
\
 "i" (sizeof(struct bug_entry)));   \
unreachable();  \
 } while (0)
-
+#endif
+#else
+#if CONFIG_DEBUG_BUG
+#define BUG()  \
+do {   \
+   asm volatile("int3");   \
+   unreachable();  \
+} while (0)
 #else
 #define BUG()  \
 do {   \
@@ -31,6 +45,7 @@ do {  
\
unreachable();  \
 } while (0)
 #endif
+#endif
 
 #include 
 
-- 
1.8.3.1



Re: [PATCH 1/4] Add BUG_XX() debugging options

2016-02-01 Thread Jeffrey Merkey
On 2/1/16, Jeffrey Merkey  wrote:
> On 2/1/16, kbuild test robot  wrote:
>> Hi Jeffrey,
>>
>> [auto build test WARNING on v4.5-rc2]
>> [also build test WARNING on next-20160201]
>> [cannot apply to tip/x86/core]
>> [if your patch is applied to the wrong git tree, please drop us a note to
>> help improving the system]
>>
>> url:
>> https://github.com/0day-ci/linux/commits/Jeffrey-Merkey/Add-BUG_XX-debugging-options/20160202-040506
>> config: x86_64-randconfig-x012-201605 (attached as .config)
>> reproduce:
>> # save the attached .config to linux build tree
>> make ARCH=x86_64
>>
>> All warnings (new ones prefixed by >>):
>>
>>In file included from include/linux/bug.h:4:0,
>> from include/linux/page-flags.h:9,
>> from kernel/bounds.c:9:
 arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not
 defined [-Wundef]
>> #if CONFIG_DEBUG_BUG
>> ^
>> --
>>In file included from include/linux/bug.h:4:0,
>> from include/linux/page-flags.h:9,
>> from kernel/bounds.c:9:
 arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not
 defined [-Wundef]
>> #if CONFIG_DEBUG_BUG
>> ^
>>In file included from include/linux/bug.h:4:0,
>> from include/linux/crypto.h:23,
>> from arch/x86/kernel/asm-offsets.c:8:
 arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not
 defined [-Wundef]
>> #if CONFIG_DEBUG_BUG
>> ^
>>
>> vim +/CONFIG_DEBUG_BUG +14 arch/x86/include/asm/bug.h
>>
>>  1   #ifndef _ASM_X86_BUG_H
>>  2   #define _ASM_X86_BUG_H
>>  3   
>>  4   #define HAVE_ARCH_BUG
>>  5   
>>  6   #ifdef CONFIG_DEBUG_BUGVERBOSE
>>  7   
>>  8   #ifdef CONFIG_X86_32
>>  9   # define __BUG_C0   "2:\t.long 1b, %c0\n"
>> 10   #else
>> 11   # define __BUG_C0   "2:\t.long 1b - 2b, %c0 - 2b\n"
>> 12   #endif
>> 13   
>>   > 14   #if CONFIG_DEBUG_BUG
>> 15   #define BUG()   
>> \
>> 16   do {
>> \
>> 17   asm volatile("int3");   
>> \
>> 18   unreachable();  
>> \
>> 19   } while (0)
>> 20   #else
>> 21   #define BUG()   
>> \
>> 22   do {
>> \
>>
>> ---
>> 0-DAY kernel test infrastructureOpen Source Technology
>> Center
>> https://lists.01.org/pipermail/kbuild-all   Intel
>> Corporation
>>
>
>
> I am looking at this one, but I'm not sure what the point is of
> running a test to build something where the defines are ignored.  Is
> this file off limits to use CONFIG options in the build?
>
> Jeff
>

Never mind.  I just found it.  LOL

:-)

Jeff


[PATCH 1/4] Add BUG_XX() debugging options

2016-02-01 Thread Jeffrey Merkey
This patch series adds config options which can be set during compile to
direct the compiler to output a breakpoint instruction anywhere a BUG()
or WARN() macro has been placed in the kernel to trigger the system to
enter a debugger if a bug is detected by the system.  Use of this
compile time option also allows conditional breakpoints to be set in the
kernel with these currently used macros.

This addition is extremely useful for debugging hard and soft lockups
real time and quickly from a console debugger, and other areas of the
kernel.

Signed-off-by: Jeffrey Merkey 
---
 arch/x86/include/asm/bug.h | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h
index ba38ebb..debbbfd 100644
--- a/arch/x86/include/asm/bug.h
+++ b/arch/x86/include/asm/bug.h
@@ -11,6 +11,13 @@
 # define __BUG_C0  "2:\t.long 1b - 2b, %c0 - 2b\n"
 #endif
 
+#if CONFIG_DEBUG_BUG
+#define BUG()  \
+do {   \
+   asm volatile("int3");   \
+   unreachable();  \
+} while (0)
+#else
 #define BUG()  \
 do {   \
asm volatile("1:\tud2\n"\
@@ -23,7 +30,14 @@ do { 
\
 "i" (sizeof(struct bug_entry)));   \
unreachable();  \
 } while (0)
-
+#endif
+#else
+#if CONFIG_DEBUG_BUG
+#define BUG()  \
+do {   \
+   asm volatile("int3");   \
+   unreachable();  \
+} while (0)
 #else
 #define BUG()  \
 do {   \
@@ -31,6 +45,7 @@ do {  
\
unreachable();  \
 } while (0)
 #endif
+#endif
 
 #include 
 
-- 
1.8.3.1



Re: [PATCH 1/4] Add BUG_XX() debugging options

2016-02-01 Thread Jeffrey Merkey
On 2/1/16, kbuild test robot  wrote:
> Hi Jeffrey,
>
> [auto build test WARNING on v4.5-rc2]
> [also build test WARNING on next-20160201]
> [cannot apply to tip/x86/core]
> [if your patch is applied to the wrong git tree, please drop us a note to
> help improving the system]
>
> url:
> https://github.com/0day-ci/linux/commits/Jeffrey-Merkey/Add-BUG_XX-debugging-options/20160202-040506
> config: x86_64-randconfig-x012-201605 (attached as .config)
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=x86_64
>
> All warnings (new ones prefixed by >>):
>
>In file included from include/linux/bug.h:4:0,
> from include/linux/page-flags.h:9,
> from kernel/bounds.c:9:
>>> arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not
>>> defined [-Wundef]
> #if CONFIG_DEBUG_BUG
> ^
> --
>In file included from include/linux/bug.h:4:0,
> from include/linux/page-flags.h:9,
> from kernel/bounds.c:9:
>>> arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not
>>> defined [-Wundef]
> #if CONFIG_DEBUG_BUG
> ^
>In file included from include/linux/bug.h:4:0,
> from include/linux/crypto.h:23,
> from arch/x86/kernel/asm-offsets.c:8:
>>> arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not
>>> defined [-Wundef]
> #if CONFIG_DEBUG_BUG
> ^
>
> vim +/CONFIG_DEBUG_BUG +14 arch/x86/include/asm/bug.h
>
>  1#ifndef _ASM_X86_BUG_H
>  2#define _ASM_X86_BUG_H
>  3
>  4#define HAVE_ARCH_BUG
>  5
>  6#ifdef CONFIG_DEBUG_BUGVERBOSE
>  7
>  8#ifdef CONFIG_X86_32
>  9# define __BUG_C0   "2:\t.long 1b, %c0\n"
> 10#else
> 11# define __BUG_C0   "2:\t.long 1b - 2b, %c0 - 2b\n"
> 12#endif
> 13
>   > 14#if CONFIG_DEBUG_BUG
> 15#define BUG()   
> \
> 16do {
> \
> 17asm volatile("int3");   
> \
> 18unreachable();  
> \
> 19} while (0)
> 20#else
> 21#define BUG()   
> \
> 22do {
> \
>
> ---
> 0-DAY kernel test infrastructureOpen Source Technology
> Center
> https://lists.01.org/pipermail/kbuild-all   Intel
> Corporation
>


I am looking at this one, but I'm not sure what the point is of
running a test to build something where the defines are ignored.  Is
this file off limits to use CONFIG options in the build?

Jeff


Re: [PATCH 1/4] Add BUG_XX() debugging options

2016-02-01 Thread kbuild test robot
Hi Jeffrey,

[auto build test WARNING on v4.5-rc2]
[also build test WARNING on next-20160201]
[cannot apply to tip/x86/core]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improving the system]

url:
https://github.com/0day-ci/linux/commits/Jeffrey-Merkey/Add-BUG_XX-debugging-options/20160202-040506
config: x86_64-randconfig-x012-201605 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from include/linux/bug.h:4:0,
from include/linux/page-flags.h:9,
from kernel/bounds.c:9:
>> arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not defined 
>> [-Wundef]
#if CONFIG_DEBUG_BUG
^
--
   In file included from include/linux/bug.h:4:0,
from include/linux/page-flags.h:9,
from kernel/bounds.c:9:
>> arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not defined 
>> [-Wundef]
#if CONFIG_DEBUG_BUG
^
   In file included from include/linux/bug.h:4:0,
from include/linux/crypto.h:23,
from arch/x86/kernel/asm-offsets.c:8:
>> arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not defined 
>> [-Wundef]
#if CONFIG_DEBUG_BUG
^

vim +/CONFIG_DEBUG_BUG +14 arch/x86/include/asm/bug.h

 1  #ifndef _ASM_X86_BUG_H
 2  #define _ASM_X86_BUG_H
 3  
 4  #define HAVE_ARCH_BUG
 5  
 6  #ifdef CONFIG_DEBUG_BUGVERBOSE
 7  
 8  #ifdef CONFIG_X86_32
 9  # define __BUG_C0   "2:\t.long 1b, %c0\n"
10  #else
11  # define __BUG_C0   "2:\t.long 1b - 2b, %c0 - 2b\n"
12  #endif
13  
  > 14  #if CONFIG_DEBUG_BUG
15  #define BUG()   \
16  do {\
17  asm volatile("int3");   \
18  unreachable();  \
19  } while (0)
20  #else
21  #define BUG()   \
22  do {\

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [PATCH 1/4] Add support for new platform, X51-R3

2016-01-30 Thread Darren Hart
On Thu, Jan 21, 2016 at 06:04:57PM -0600, Mario Limonciello wrote:

Hi Mario,

Thank you for patch submission.

Please remember to always include a commit message body describing your patch in
more detail than the single line subject. It should provide enough detail to get
someone unfamiliar with these changes to understand why they were needed  and
how you intended to go about fixing it. This is the context needed to review the
patch.

In addition to adding X51 R3 as a separate platform from the previous X51 Family
(no R1 R2), this patch also appears to introduce various whitespace changes. Any
change made within the patch should read back to some comment in the changelog.

> Signed-off-by: Mario Limonciello 
> ---
>  drivers/platform/x86/alienware-wmi.c | 44 
> 
>  1 file changed, 29 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/platform/x86/alienware-wmi.c 
> b/drivers/platform/x86/alienware-wmi.c
> index 1e1e594..dcd4f81 100644
> --- a/drivers/platform/x86/alienware-wmi.c
> +++ b/drivers/platform/x86/alienware-wmi.c
> @@ -69,11 +69,16 @@ static struct quirk_entry quirk_unknown = {
>   .hdmi_mux = 0,
>  };
>  
> -static struct quirk_entry quirk_x51_family = {
> +static struct quirk_entry quirk_x51_r1_r2 = {
>   .num_zones = 3,
>   .hdmi_mux = 0.
>  };
>  
> +static struct quirk_entry quirk_x51_r3 = {
> + .num_zones = 4,
> + .hdmi_mux = 0,
> +};
> +
>  static struct quirk_entry quirk_asm100 = {
>   .num_zones = 2,
>   .hdmi_mux = 1,
> @@ -88,12 +93,12 @@ static int __init dmi_matched(const struct dmi_system_id 
> *dmi)
>  static const struct dmi_system_id alienware_quirks[] __initconst = {
>   {
>.callback = dmi_matched,
> -  .ident = "Alienware X51 R1",
> +  .ident = "Alienware X51 R3",
>.matches = {
>DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
> -  DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51"),
> +  DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51 R3"),
>},
> -  .driver_data = _x51_family,
> +  .driver_data = _x51_r3,
>},
>   {
>.callback = dmi_matched,
> @@ -102,17 +107,26 @@ static const struct dmi_system_id alienware_quirks[] 
> __initconst = {
>DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
>DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51 R2"),
>},
> -  .driver_data = _x51_family,
> +  .driver_data = _x51_r1_r2,
> +  },
> + {
> +  .callback = dmi_matched,
> +  .ident = "Alienware X51 R1",
> +  .matches = {
> +  DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
> +  DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51"),
> +  },
> +  .driver_data = _x51_r1_r2,
>},
>   {
> - .callback = dmi_matched,
> - .ident = "Alienware ASM100",
> - .matches = {
> - DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
> - DMI_MATCH(DMI_PRODUCT_NAME, "ASM100"),
> - },
> - .driver_data = _asm100,
> - },
> +  .callback = dmi_matched,
> +  .ident = "Alienware ASM100",
> +  .matches = {
> +  DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
> +  DMI_MATCH(DMI_PRODUCT_NAME, "ASM100"),
> +  },
> +  .driver_data = _asm100,
> +  },
>   {}
>  };
>  
> @@ -477,7 +491,7 @@ static ssize_t show_hdmi_cable(struct device *dev,
>   };
>   status =
>   alienware_hdmi_command(_args, WMAX_METHOD_HDMI_CABLE,
> -(u32 *) _data);
> +(u32 *) & out_data);
>   if (ACPI_SUCCESS(status)) {
>   if (out_data == 0)
>   return scnprintf(buf, PAGE_SIZE,
> @@ -500,7 +514,7 @@ static ssize_t show_hdmi_source(struct device *dev,
>   };
>   status =
>   alienware_hdmi_command(_args, WMAX_METHOD_HDMI_STATUS,
> -(u32 *) _data);
> +(u32 *) & out_data);
>  
>   if (ACPI_SUCCESS(status)) {
>   if (out_data == 1)
> -- 
> 1.9.1
> 
> 

-- 
Darren Hart
Intel Open Source Technology Center


Re: [PATCH 1/4] Add support for new platform, X51-R3

2016-01-30 Thread Darren Hart
On Thu, Jan 21, 2016 at 06:04:57PM -0600, Mario Limonciello wrote:

Hi Mario,

Thank you for patch submission.

Please remember to always include a commit message body describing your patch in
more detail than the single line subject. It should provide enough detail to get
someone unfamiliar with these changes to understand why they were needed  and
how you intended to go about fixing it. This is the context needed to review the
patch.

In addition to adding X51 R3 as a separate platform from the previous X51 Family
(no R1 R2), this patch also appears to introduce various whitespace changes. Any
change made within the patch should read back to some comment in the changelog.

> Signed-off-by: Mario Limonciello 
> ---
>  drivers/platform/x86/alienware-wmi.c | 44 
> 
>  1 file changed, 29 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/platform/x86/alienware-wmi.c 
> b/drivers/platform/x86/alienware-wmi.c
> index 1e1e594..dcd4f81 100644
> --- a/drivers/platform/x86/alienware-wmi.c
> +++ b/drivers/platform/x86/alienware-wmi.c
> @@ -69,11 +69,16 @@ static struct quirk_entry quirk_unknown = {
>   .hdmi_mux = 0,
>  };
>  
> -static struct quirk_entry quirk_x51_family = {
> +static struct quirk_entry quirk_x51_r1_r2 = {
>   .num_zones = 3,
>   .hdmi_mux = 0.
>  };
>  
> +static struct quirk_entry quirk_x51_r3 = {
> + .num_zones = 4,
> + .hdmi_mux = 0,
> +};
> +
>  static struct quirk_entry quirk_asm100 = {
>   .num_zones = 2,
>   .hdmi_mux = 1,
> @@ -88,12 +93,12 @@ static int __init dmi_matched(const struct dmi_system_id 
> *dmi)
>  static const struct dmi_system_id alienware_quirks[] __initconst = {
>   {
>.callback = dmi_matched,
> -  .ident = "Alienware X51 R1",
> +  .ident = "Alienware X51 R3",
>.matches = {
>DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
> -  DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51"),
> +  DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51 R3"),
>},
> -  .driver_data = _x51_family,
> +  .driver_data = _x51_r3,
>},
>   {
>.callback = dmi_matched,
> @@ -102,17 +107,26 @@ static const struct dmi_system_id alienware_quirks[] 
> __initconst = {
>DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
>DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51 R2"),
>},
> -  .driver_data = _x51_family,
> +  .driver_data = _x51_r1_r2,
> +  },
> + {
> +  .callback = dmi_matched,
> +  .ident = "Alienware X51 R1",
> +  .matches = {
> +  DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
> +  DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51"),
> +  },
> +  .driver_data = _x51_r1_r2,
>},
>   {
> - .callback = dmi_matched,
> - .ident = "Alienware ASM100",
> - .matches = {
> - DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
> - DMI_MATCH(DMI_PRODUCT_NAME, "ASM100"),
> - },
> - .driver_data = _asm100,
> - },
> +  .callback = dmi_matched,
> +  .ident = "Alienware ASM100",
> +  .matches = {
> +  DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
> +  DMI_MATCH(DMI_PRODUCT_NAME, "ASM100"),
> +  },
> +  .driver_data = _asm100,
> +  },
>   {}
>  };
>  
> @@ -477,7 +491,7 @@ static ssize_t show_hdmi_cable(struct device *dev,
>   };
>   status =
>   alienware_hdmi_command(_args, WMAX_METHOD_HDMI_CABLE,
> -(u32 *) _data);
> +(u32 *) & out_data);
>   if (ACPI_SUCCESS(status)) {
>   if (out_data == 0)
>   return scnprintf(buf, PAGE_SIZE,
> @@ -500,7 +514,7 @@ static ssize_t show_hdmi_source(struct device *dev,
>   };
>   status =
>   alienware_hdmi_command(_args, WMAX_METHOD_HDMI_STATUS,
> -(u32 *) _data);
> +(u32 *) & out_data);
>  
>   if (ACPI_SUCCESS(status)) {
>   if (out_data == 1)
> -- 
> 1.9.1
> 
> 

-- 
Darren Hart
Intel Open Source Technology Center


[PATCH 1/4] Add BUG() debugger entry points

2016-01-29 Thread Jeffrey Merkey
This patch series adds a config option which can be set during compile to
direct the compiler to output a breakpoint instruction anywhere a BUG()
macro has been placed in the kernel to trigger the system to enter a
debugger if a bug is detected by the system.  Use of this compile time
option also allows conditional breakpoints to be set anywhere in the
kernel.

This addition is extremely useful for debugging hard and soft lockups
real time and quickly from a console debugger, and other areas of the
kernel.

Signed-off-by: Jeffrey Merkey 
---
 kernel/watchdog.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index b3ace6e..6de9263 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -358,6 +358,9 @@ static void watchdog_overflow_callback(struct perf_event 
*event,
else
dump_stack();
 
+#ifdef CONFIG_DEBUG_BREAK
+   BUG();
+#endif
/*
 * Perform all-CPU dump only once to avoid multiple hardlockups
 * generating interleaving traces
@@ -478,6 +481,9 @@ static enum hrtimer_restart watchdog_timer_fn(struct 
hrtimer *hrtimer)
else
dump_stack();
 
+#ifdef CONFIG_DEBUG_BREAK
+   BUG();
+#endif
if (softlockup_all_cpu_backtrace) {
/* Avoid generating two back traces for current
 * given that one is already made above
-- 
1.8.3.1



[PATCH 1/4] Add BUG() debugger entry points

2016-01-29 Thread Jeffrey Merkey
This patch series adds a config option which can be set during compile to
direct the compiler to output a breakpoint instruction anywhere a BUG()
macro has been placed in the kernel to trigger the system to enter a
debugger if a bug is detected by the system.  Use of this compile time
option also allows conditional breakpoints to be set anywhere in the
kernel.

This addition is extremely useful for debugging hard and soft lockups
real time and quickly from a console debugger, and other areas of the
kernel.

Signed-off-by: Jeffrey Merkey 
---
 kernel/watchdog.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index b3ace6e..6de9263 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -358,6 +358,9 @@ static void watchdog_overflow_callback(struct perf_event 
*event,
else
dump_stack();
 
+#ifdef CONFIG_DEBUG_BREAK
+   BUG();
+#endif
/*
 * Perform all-CPU dump only once to avoid multiple hardlockups
 * generating interleaving traces
@@ -478,6 +481,9 @@ static enum hrtimer_restart watchdog_timer_fn(struct 
hrtimer *hrtimer)
else
dump_stack();
 
+#ifdef CONFIG_DEBUG_BREAK
+   BUG();
+#endif
if (softlockup_all_cpu_backtrace) {
/* Avoid generating two back traces for current
 * given that one is already made above
-- 
1.8.3.1



[PATCH 1/4] Add support for new platform, X51-R3

2016-01-21 Thread Mario Limonciello
Signed-off-by: Mario Limonciello 
---
 drivers/platform/x86/alienware-wmi.c | 44 
 1 file changed, 29 insertions(+), 15 deletions(-)

diff --git a/drivers/platform/x86/alienware-wmi.c 
b/drivers/platform/x86/alienware-wmi.c
index 1e1e594..dcd4f81 100644
--- a/drivers/platform/x86/alienware-wmi.c
+++ b/drivers/platform/x86/alienware-wmi.c
@@ -69,11 +69,16 @@ static struct quirk_entry quirk_unknown = {
.hdmi_mux = 0,
 };
 
-static struct quirk_entry quirk_x51_family = {
+static struct quirk_entry quirk_x51_r1_r2 = {
.num_zones = 3,
.hdmi_mux = 0.
 };
 
+static struct quirk_entry quirk_x51_r3 = {
+   .num_zones = 4,
+   .hdmi_mux = 0,
+};
+
 static struct quirk_entry quirk_asm100 = {
.num_zones = 2,
.hdmi_mux = 1,
@@ -88,12 +93,12 @@ static int __init dmi_matched(const struct dmi_system_id 
*dmi)
 static const struct dmi_system_id alienware_quirks[] __initconst = {
{
 .callback = dmi_matched,
-.ident = "Alienware X51 R1",
+.ident = "Alienware X51 R3",
 .matches = {
 DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
-DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51"),
+DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51 R3"),
 },
-.driver_data = _x51_family,
+.driver_data = _x51_r3,
 },
{
 .callback = dmi_matched,
@@ -102,17 +107,26 @@ static const struct dmi_system_id alienware_quirks[] 
__initconst = {
 DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
 DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51 R2"),
 },
-.driver_data = _x51_family,
+.driver_data = _x51_r1_r2,
+},
+   {
+.callback = dmi_matched,
+.ident = "Alienware X51 R1",
+.matches = {
+DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
+DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51"),
+},
+.driver_data = _x51_r1_r2,
 },
{
-   .callback = dmi_matched,
-   .ident = "Alienware ASM100",
-   .matches = {
-   DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
-   DMI_MATCH(DMI_PRODUCT_NAME, "ASM100"),
-   },
-   .driver_data = _asm100,
-   },
+.callback = dmi_matched,
+.ident = "Alienware ASM100",
+.matches = {
+DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
+DMI_MATCH(DMI_PRODUCT_NAME, "ASM100"),
+},
+.driver_data = _asm100,
+},
{}
 };
 
@@ -477,7 +491,7 @@ static ssize_t show_hdmi_cable(struct device *dev,
};
status =
alienware_hdmi_command(_args, WMAX_METHOD_HDMI_CABLE,
-  (u32 *) _data);
+  (u32 *) & out_data);
if (ACPI_SUCCESS(status)) {
if (out_data == 0)
return scnprintf(buf, PAGE_SIZE,
@@ -500,7 +514,7 @@ static ssize_t show_hdmi_source(struct device *dev,
};
status =
alienware_hdmi_command(_args, WMAX_METHOD_HDMI_STATUS,
-  (u32 *) _data);
+  (u32 *) & out_data);
 
if (ACPI_SUCCESS(status)) {
if (out_data == 1)
-- 
1.9.1



[PATCH 1/4] Add support for new platform, X51-R3

2016-01-21 Thread Mario Limonciello
Signed-off-by: Mario Limonciello 
---
 drivers/platform/x86/alienware-wmi.c | 44 
 1 file changed, 29 insertions(+), 15 deletions(-)

diff --git a/drivers/platform/x86/alienware-wmi.c 
b/drivers/platform/x86/alienware-wmi.c
index 1e1e594..dcd4f81 100644
--- a/drivers/platform/x86/alienware-wmi.c
+++ b/drivers/platform/x86/alienware-wmi.c
@@ -69,11 +69,16 @@ static struct quirk_entry quirk_unknown = {
.hdmi_mux = 0,
 };
 
-static struct quirk_entry quirk_x51_family = {
+static struct quirk_entry quirk_x51_r1_r2 = {
.num_zones = 3,
.hdmi_mux = 0.
 };
 
+static struct quirk_entry quirk_x51_r3 = {
+   .num_zones = 4,
+   .hdmi_mux = 0,
+};
+
 static struct quirk_entry quirk_asm100 = {
.num_zones = 2,
.hdmi_mux = 1,
@@ -88,12 +93,12 @@ static int __init dmi_matched(const struct dmi_system_id 
*dmi)
 static const struct dmi_system_id alienware_quirks[] __initconst = {
{
 .callback = dmi_matched,
-.ident = "Alienware X51 R1",
+.ident = "Alienware X51 R3",
 .matches = {
 DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
-DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51"),
+DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51 R3"),
 },
-.driver_data = _x51_family,
+.driver_data = _x51_r3,
 },
{
 .callback = dmi_matched,
@@ -102,17 +107,26 @@ static const struct dmi_system_id alienware_quirks[] 
__initconst = {
 DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
 DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51 R2"),
 },
-.driver_data = _x51_family,
+.driver_data = _x51_r1_r2,
+},
+   {
+.callback = dmi_matched,
+.ident = "Alienware X51 R1",
+.matches = {
+DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
+DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51"),
+},
+.driver_data = _x51_r1_r2,
 },
{
-   .callback = dmi_matched,
-   .ident = "Alienware ASM100",
-   .matches = {
-   DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
-   DMI_MATCH(DMI_PRODUCT_NAME, "ASM100"),
-   },
-   .driver_data = _asm100,
-   },
+.callback = dmi_matched,
+.ident = "Alienware ASM100",
+.matches = {
+DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
+DMI_MATCH(DMI_PRODUCT_NAME, "ASM100"),
+},
+.driver_data = _asm100,
+},
{}
 };
 
@@ -477,7 +491,7 @@ static ssize_t show_hdmi_cable(struct device *dev,
};
status =
alienware_hdmi_command(_args, WMAX_METHOD_HDMI_CABLE,
-  (u32 *) _data);
+  (u32 *) & out_data);
if (ACPI_SUCCESS(status)) {
if (out_data == 0)
return scnprintf(buf, PAGE_SIZE,
@@ -500,7 +514,7 @@ static ssize_t show_hdmi_source(struct device *dev,
};
status =
alienware_hdmi_command(_args, WMAX_METHOD_HDMI_STATUS,
-  (u32 *) _data);
+  (u32 *) & out_data);
 
if (ACPI_SUCCESS(status)) {
if (out_data == 1)
-- 
1.9.1



Re: [PATCH 1/4]:Add mbigen driver to support mbigen interrupt controller

2015-06-01 Thread Paul Bolle
On Mon, 2015-06-01 at 09:50 +0100, Marc Zyngier wrote:
> On 30/05/15 04:19, majun (F) wrote:
> > This patch contains the mbigen device driver.
> > 
> > To support Mbigen device, irq-mbigen.c and mbi.h are added.
> > 
> > As a MSI interrupt controller, the mbigen is used as a child domain of
> > MSI domain just like PCI devices.
> > 
> > Change log:
> > --irq-mbigen.c: the driver of mbigen device.The mbigen irq domain is 
> > created here
> >as child domain of MSI.
> > --Add CONFIG_MBIGEN_IRQ_DOMAIN enable this driver

Changelog below the "---" marker, please, so git will remove it when
applying the patch.
 
> > Signed-off-by: Yun Wu 
> > Signed-off-by: Ma Jun 
> 
> Who is the author of this patch? If that's you, then the SOB lines are
> in the wrong order. If not, then there should be a From line at the top.

Even if you're the author of this patch a From: line is needed.
Otherwise "majun (F) " would become the author,
instead of "Ma Jun ", and "majun (F)" is probably
not your name.

Thanks,


Paul Bolle

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4]:Add mbigen driver to support mbigen interrupt controller

2015-06-01 Thread Marc Zyngier
Hi Majun,

First, please CC the irqchip maintainers (Jason and Thomas) on all
patches related to the irqchip subsystem.

On 30/05/15 04:19, majun (F) wrote:
> This patch contains the mbigen device driver.
> 
> To support Mbigen device, irq-mbigen.c and mbi.h are added.
> 
> As a MSI interrupt controller, the mbigen is used as a child domain of
> MSI domain just like PCI devices.
> 
> Change log:
> --irq-mbigen.c: the driver of mbigen device.The mbigen irq domain is created 
> here
>as child domain of MSI.
> --Add CONFIG_MBIGEN_IRQ_DOMAIN enable this driver
> 
> Signed-off-by: Yun Wu 
> Signed-off-by: Ma Jun 

Who is the author of this patch? If that's you, then the SOB lines are
in the wrong order. If not, then there should be a From line at the top.

> ---
>  drivers/irqchip/Kconfig  |4 +
>  drivers/irqchip/Makefile |1 +
>  drivers/irqchip/irq-mbigen.c |  562 
> ++
>  include/linux/mbi.h  |   77 ++
>  4 files changed, 644 insertions(+), 0 deletions(-)
>  mode change 100644 => 100755 drivers/irqchip/Kconfig
>  mode change 100644 => 100755 drivers/irqchip/Makefile
>  create mode 100755 drivers/irqchip/irq-mbigen.c
>  create mode 100644 include/linux/mbi.h
> 
> diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
> old mode 100644
> new mode 100755
> index 6de62a9..595a6eb
> --- a/drivers/irqchip/Kconfig
> +++ b/drivers/irqchip/Kconfig
> @@ -26,6 +26,10 @@ config ARM_GIC_V3
>  config ARM_GIC_V3_ITS
>   bool
>   select PCI_MSI_IRQ_DOMAIN
> + select MBIGEN_IRQ_DOMAIN
> +
> +config MBIGEN_IRQ_DOMAIN
> + bool
> 
>  config ARM_NVIC
>   bool
> diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
> old mode 100644
> new mode 100755
> index dda4927..23571c1
> --- a/drivers/irqchip/Makefile
> +++ b/drivers/irqchip/Makefile
> @@ -23,6 +23,7 @@ obj-$(CONFIG_ARM_GIC)   += irq-gic.o 
> irq-gic-common.o
>  obj-$(CONFIG_ARM_GIC_V2M)+= irq-gic-v2m.o
>  obj-$(CONFIG_ARM_GIC_V3) += irq-gic-v3.o irq-gic-common.o
>  obj-$(CONFIG_ARM_GIC_V3_ITS) += irq-gic-v3-its.o
> +obj-$(CONFIG_MBIGEN_IRQ_DOMAIN)  += irq-mbigen.o
>  obj-$(CONFIG_ARM_NVIC)   += irq-nvic.o
>  obj-$(CONFIG_ARM_VIC)+= irq-vic.o
>  obj-$(CONFIG_ATMEL_AIC_IRQ)  += irq-atmel-aic-common.o 
> irq-atmel-aic.o
> diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c
> new file mode 100755
> index 000..462f9a0
> --- /dev/null
> +++ b/drivers/irqchip/irq-mbigen.c
> @@ -0,0 +1,562 @@
> +/*
> + * Copyright (C) 2014 Hisilicon Limited, All Rights Reserved.
> + * Author: Yun Wu 
> + * Author: Jun Ma 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program.  If not, see .
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include "irqchip.h"
> +
> +/* Register offsets */
> +#define MG_IRQ_TYPE  0x0
> +#define MG_IRQ_CLEAR 0x100
> +#define MG_IRQ_STATUS0x200
> +#define MG_MSG_DATA  0x300
> +
> +/* The gap between normal and extended pin region */
> +#define MG_EXT_OFST  0x10
> +
> +/* Max number of interrupts supported */
> +#define MG_NR_IRQS   640
> +
> +/* Number of mbigens supported in one chip */
> +#define MG_NR6
> +
> +struct mbigen_node {
> + struct list_headentry;
> + struct mbigen   *mbigen;
> + struct device_node  *source;
> + unsigned intirq;
> + unsigned intnr_irqs;
> +};
> +
> +struct mbigen {
> + raw_spinlock_t  lock;
> + struct list_headentry;
> + struct mbigen_chip  *chip;
> + unsigned intnid;
> + unsigned intirqs_used;
> + struct list_headnodes;
> +};
> +
> +struct mbigen_chip {
> + raw_spinlock_t  lock;
> + struct list_headentry;
> + struct device   *dev;
> + struct device_node  *node;
> + void __iomem*base;
> + struct irq_domain   *domain;
> + struct list_headnodes;
> +};
> +
> +static LIST_HEAD(mbigen_chips);
> +static DEFINE_SPINLOCK(mbigen_lock);
> +
> +int get_mbi_offset(int virq)
> +{
> + struct irq_data *data;
> + struct mbi_desc 

Re: [PATCH 1/4]:Add mbigen driver to support mbigen interrupt controller

2015-06-01 Thread Marc Zyngier
Hi Majun,

First, please CC the irqchip maintainers (Jason and Thomas) on all
patches related to the irqchip subsystem.

On 30/05/15 04:19, majun (F) wrote:
 This patch contains the mbigen device driver.
 
 To support Mbigen device, irq-mbigen.c and mbi.h are added.
 
 As a MSI interrupt controller, the mbigen is used as a child domain of
 MSI domain just like PCI devices.
 
 Change log:
 --irq-mbigen.c: the driver of mbigen device.The mbigen irq domain is created 
 here
as child domain of MSI.
 --Add CONFIG_MBIGEN_IRQ_DOMAIN enable this driver
 
 Signed-off-by: Yun Wu wuyun...@huawei.com
 Signed-off-by: Ma Jun majun...@huawei.com

Who is the author of this patch? If that's you, then the SOB lines are
in the wrong order. If not, then there should be a From line at the top.

 ---
  drivers/irqchip/Kconfig  |4 +
  drivers/irqchip/Makefile |1 +
  drivers/irqchip/irq-mbigen.c |  562 
 ++
  include/linux/mbi.h  |   77 ++
  4 files changed, 644 insertions(+), 0 deletions(-)
  mode change 100644 = 100755 drivers/irqchip/Kconfig
  mode change 100644 = 100755 drivers/irqchip/Makefile
  create mode 100755 drivers/irqchip/irq-mbigen.c
  create mode 100644 include/linux/mbi.h
 
 diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
 old mode 100644
 new mode 100755
 index 6de62a9..595a6eb
 --- a/drivers/irqchip/Kconfig
 +++ b/drivers/irqchip/Kconfig
 @@ -26,6 +26,10 @@ config ARM_GIC_V3
  config ARM_GIC_V3_ITS
   bool
   select PCI_MSI_IRQ_DOMAIN
 + select MBIGEN_IRQ_DOMAIN
 +
 +config MBIGEN_IRQ_DOMAIN
 + bool
 
  config ARM_NVIC
   bool
 diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
 old mode 100644
 new mode 100755
 index dda4927..23571c1
 --- a/drivers/irqchip/Makefile
 +++ b/drivers/irqchip/Makefile
 @@ -23,6 +23,7 @@ obj-$(CONFIG_ARM_GIC)   += irq-gic.o 
 irq-gic-common.o
  obj-$(CONFIG_ARM_GIC_V2M)+= irq-gic-v2m.o
  obj-$(CONFIG_ARM_GIC_V3) += irq-gic-v3.o irq-gic-common.o
  obj-$(CONFIG_ARM_GIC_V3_ITS) += irq-gic-v3-its.o
 +obj-$(CONFIG_MBIGEN_IRQ_DOMAIN)  += irq-mbigen.o
  obj-$(CONFIG_ARM_NVIC)   += irq-nvic.o
  obj-$(CONFIG_ARM_VIC)+= irq-vic.o
  obj-$(CONFIG_ATMEL_AIC_IRQ)  += irq-atmel-aic-common.o 
 irq-atmel-aic.o
 diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c
 new file mode 100755
 index 000..462f9a0
 --- /dev/null
 +++ b/drivers/irqchip/irq-mbigen.c
 @@ -0,0 +1,562 @@
 +/*
 + * Copyright (C) 2014 Hisilicon Limited, All Rights Reserved.
 + * Author: Yun Wu wuyun...@huawei.com
 + * Author: Jun Ma majun...@huawei.com
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program.  If not, see http://www.gnu.org/licenses/.
 + */
 +
 +#include linux/init.h
 +#include linux/io.h
 +#include linux/slab.h
 +#include linux/interrupt.h
 +#include linux/mbi.h
 +#include linux/of_address.h
 +#include linux/of_irq.h
 +#include linux/of_platform.h
 +#include linux/kernel.h
 +#include linux/platform_device.h
 +#include linux/module.h
 +#include linux/msi.h
 +#include linux/irqchip/arm-gic-its.h
 +#include irqchip.h
 +
 +/* Register offsets */
 +#define MG_IRQ_TYPE  0x0
 +#define MG_IRQ_CLEAR 0x100
 +#define MG_IRQ_STATUS0x200
 +#define MG_MSG_DATA  0x300
 +
 +/* The gap between normal and extended pin region */
 +#define MG_EXT_OFST  0x10
 +
 +/* Max number of interrupts supported */
 +#define MG_NR_IRQS   640
 +
 +/* Number of mbigens supported in one chip */
 +#define MG_NR6
 +
 +struct mbigen_node {
 + struct list_headentry;
 + struct mbigen   *mbigen;
 + struct device_node  *source;
 + unsigned intirq;
 + unsigned intnr_irqs;
 +};
 +
 +struct mbigen {
 + raw_spinlock_t  lock;
 + struct list_headentry;
 + struct mbigen_chip  *chip;
 + unsigned intnid;
 + unsigned intirqs_used;
 + struct list_headnodes;
 +};
 +
 +struct mbigen_chip {
 + raw_spinlock_t  lock;
 + struct list_headentry;
 + struct device   *dev;
 + struct device_node  *node;
 + void __iomem*base;
 + struct irq_domain   *domain;
 + struct list_headnodes;
 +};
 +
 +static LIST_HEAD(mbigen_chips);
 +static 

Re: [PATCH 1/4]:Add mbigen driver to support mbigen interrupt controller

2015-06-01 Thread Paul Bolle
On Mon, 2015-06-01 at 09:50 +0100, Marc Zyngier wrote:
 On 30/05/15 04:19, majun (F) wrote:
  This patch contains the mbigen device driver.
  
  To support Mbigen device, irq-mbigen.c and mbi.h are added.
  
  As a MSI interrupt controller, the mbigen is used as a child domain of
  MSI domain just like PCI devices.
  
  Change log:
  --irq-mbigen.c: the driver of mbigen device.The mbigen irq domain is 
  created here
 as child domain of MSI.
  --Add CONFIG_MBIGEN_IRQ_DOMAIN enable this driver

Changelog below the --- marker, please, so git will remove it when
applying the patch.
 
  Signed-off-by: Yun Wu wuyun...@huawei.com
  Signed-off-by: Ma Jun majun...@huawei.com
 
 Who is the author of this patch? If that's you, then the SOB lines are
 in the wrong order. If not, then there should be a From line at the top.

Even if you're the author of this patch a From: line is needed.
Otherwise majun (F) majun...@huawei.com would become the author,
instead of Ma Jun majun...@huawei.com, and majun (F) is probably
not your name.

Thanks,


Paul Bolle

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4]:Add mbigen driver to support mbigen interrupt controller

2015-05-30 Thread majun (F)
Hi Joe Perches:
Thanks for you advice.
I will fixed it in next version

在 2015/5/30 13:38, Joe Perches 写道:
> On Sat, 2015-05-30 at 11:19 +0800, majun (F) wrote:
>> This patch contains the mbigen device driver.
> 
> Trivial notes:
> 
> Please use scripts/checkpatch.pl on your patches and see
> if you want to correct any of the messages it produces.
> 
>> diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c
> 
> You could add
> #define pr_fmt(fmt) "mbigen: " fmt
> before any of the #includes so that all of the
> pr_(fmt, ...) uses are prefixed with "mbigen: "
> 
>> +int mbi_parse_irqs(struct device *dev, struct mbi_ops *ops)
>> +{
>> +pr_warn("%s:this function not use now\n", __func__);
> 
> Maybe pr_warn_once()
> 
>> +return -EINVAL;
>> +}
>> +EXPORT_SYMBOL(mbi_parse_irqs);
>> +
>> +void mbi_free_irqs(struct device *dev, unsigned int virq, unsigned int nvec)
>> +{
>> +pr_warn("%s:this function not use now\n", __func__);
> 
> pr_warn_once()?
> 
>> +static struct mbigen *mbigen_get_device(struct mbigen_chip *chip,
>> +
>> unsigned int nid)
>> +{
>> +struct mbigen *tmp, *mbigen;
>> +bool found = false;
>> +
>> +if (nid >= MG_NR) {
>> +pr_warn("MBIGEN: Device ID exceeds max number!\n");
> 
> So this wouldn't need a "MBIGEN: " prefix
> 
> etc...
> 
> 
> .
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4]:Add mbigen driver to support mbigen interrupt controller

2015-05-30 Thread majun (F)
Hi Joe Perches:
Thanks for you advice.
I will fixed it in next version

在 2015/5/30 13:38, Joe Perches 写道:
 On Sat, 2015-05-30 at 11:19 +0800, majun (F) wrote:
 This patch contains the mbigen device driver.
 
 Trivial notes:
 
 Please use scripts/checkpatch.pl on your patches and see
 if you want to correct any of the messages it produces.
 
 diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c
 
 You could add
 #define pr_fmt(fmt) mbigen:  fmt
 before any of the #includes so that all of the
 pr_level(fmt, ...) uses are prefixed with mbigen: 
 
 +int mbi_parse_irqs(struct device *dev, struct mbi_ops *ops)
 +{
 +pr_warn(%s:this function not use now\n, __func__);
 
 Maybe pr_warn_once()
 
 +return -EINVAL;
 +}
 +EXPORT_SYMBOL(mbi_parse_irqs);
 +
 +void mbi_free_irqs(struct device *dev, unsigned int virq, unsigned int nvec)
 +{
 +pr_warn(%s:this function not use now\n, __func__);
 
 pr_warn_once()?
 
 +static struct mbigen *mbigen_get_device(struct mbigen_chip *chip,
 +
 unsigned int nid)
 +{
 +struct mbigen *tmp, *mbigen;
 +bool found = false;
 +
 +if (nid = MG_NR) {
 +pr_warn(MBIGEN: Device ID exceeds max number!\n);
 
 So this wouldn't need a MBIGEN:  prefix
 
 etc...
 
 
 .
 

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4]:Add mbigen driver to support mbigen interrupt controller

2015-05-29 Thread Joe Perches
On Sat, 2015-05-30 at 11:19 +0800, majun (F) wrote:
> This patch contains the mbigen device driver.

Trivial notes:

Please use scripts/checkpatch.pl on your patches and see
if you want to correct any of the messages it produces.

> diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c

You could add
#define pr_fmt(fmt) "mbigen: " fmt
before any of the #includes so that all of the
pr_(fmt, ...) uses are prefixed with "mbigen: "

> +int mbi_parse_irqs(struct device *dev, struct mbi_ops *ops)
> +{
> + pr_warn("%s:this function not use now\n", __func__);

Maybe pr_warn_once()

> + return -EINVAL;
> +}
> +EXPORT_SYMBOL(mbi_parse_irqs);
> +
> +void mbi_free_irqs(struct device *dev, unsigned int virq, unsigned int nvec)
> +{
> + pr_warn("%s:this function not use now\n", __func__);

pr_warn_once()?

> +static struct mbigen *mbigen_get_device(struct mbigen_chip *chip,
> + 
> unsigned int nid)
> +{
> + struct mbigen *tmp, *mbigen;
> + bool found = false;
> +
> + if (nid >= MG_NR) {
> + pr_warn("MBIGEN: Device ID exceeds max number!\n");

So this wouldn't need a "MBIGEN: " prefix

etc...

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4]:Add mbigen driver to support mbigen interrupt controller

2015-05-29 Thread majun (F)
This patch contains the mbigen device driver.

To support Mbigen device, irq-mbigen.c and mbi.h are added.

As a MSI interrupt controller, the mbigen is used as a child domain of
MSI domain just like PCI devices.

Change log:
--irq-mbigen.c: the driver of mbigen device.The mbigen irq domain is created 
here
   as child domain of MSI.
--Add CONFIG_MBIGEN_IRQ_DOMAIN enable this driver

Signed-off-by: Yun Wu 
Signed-off-by: Ma Jun 
---
 drivers/irqchip/Kconfig  |4 +
 drivers/irqchip/Makefile |1 +
 drivers/irqchip/irq-mbigen.c |  562 ++
 include/linux/mbi.h  |   77 ++
 4 files changed, 644 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 drivers/irqchip/Kconfig
 mode change 100644 => 100755 drivers/irqchip/Makefile
 create mode 100755 drivers/irqchip/irq-mbigen.c
 create mode 100644 include/linux/mbi.h

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
old mode 100644
new mode 100755
index 6de62a9..595a6eb
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -26,6 +26,10 @@ config ARM_GIC_V3
 config ARM_GIC_V3_ITS
bool
select PCI_MSI_IRQ_DOMAIN
+   select MBIGEN_IRQ_DOMAIN
+
+config MBIGEN_IRQ_DOMAIN
+   bool

 config ARM_NVIC
bool
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
old mode 100644
new mode 100755
index dda4927..23571c1
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -23,6 +23,7 @@ obj-$(CONFIG_ARM_GIC) += irq-gic.o 
irq-gic-common.o
 obj-$(CONFIG_ARM_GIC_V2M)  += irq-gic-v2m.o
 obj-$(CONFIG_ARM_GIC_V3)   += irq-gic-v3.o irq-gic-common.o
 obj-$(CONFIG_ARM_GIC_V3_ITS)   += irq-gic-v3-its.o
+obj-$(CONFIG_MBIGEN_IRQ_DOMAIN)+= irq-mbigen.o
 obj-$(CONFIG_ARM_NVIC) += irq-nvic.o
 obj-$(CONFIG_ARM_VIC)  += irq-vic.o
 obj-$(CONFIG_ATMEL_AIC_IRQ)+= irq-atmel-aic-common.o 
irq-atmel-aic.o
diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c
new file mode 100755
index 000..462f9a0
--- /dev/null
+++ b/drivers/irqchip/irq-mbigen.c
@@ -0,0 +1,562 @@
+/*
+ * Copyright (C) 2014 Hisilicon Limited, All Rights Reserved.
+ * Author: Yun Wu 
+ * Author: Jun Ma 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see .
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "irqchip.h"
+
+/* Register offsets */
+#define MG_IRQ_TYPE0x0
+#define MG_IRQ_CLEAR   0x100
+#define MG_IRQ_STATUS  0x200
+#define MG_MSG_DATA0x300
+
+/* The gap between normal and extended pin region */
+#define MG_EXT_OFST0x10
+
+/* Max number of interrupts supported */
+#define MG_NR_IRQS 640
+
+/* Number of mbigens supported in one chip */
+#define MG_NR  6
+
+struct mbigen_node {
+   struct list_headentry;
+   struct mbigen   *mbigen;
+   struct device_node  *source;
+   unsigned intirq;
+   unsigned intnr_irqs;
+};
+
+struct mbigen {
+   raw_spinlock_t  lock;
+   struct list_headentry;
+   struct mbigen_chip  *chip;
+   unsigned intnid;
+   unsigned intirqs_used;
+   struct list_headnodes;
+};
+
+struct mbigen_chip {
+   raw_spinlock_t  lock;
+   struct list_headentry;
+   struct device   *dev;
+   struct device_node  *node;
+   void __iomem*base;
+   struct irq_domain   *domain;
+   struct list_headnodes;
+};
+
+static LIST_HEAD(mbigen_chips);
+static DEFINE_SPINLOCK(mbigen_lock);
+
+int get_mbi_offset(int virq)
+{
+   struct irq_data *data;
+   struct mbi_desc *mbidesc;
+   int offset = 0;
+
+   data = irq_get_irq_data(virq);
+
+   mbidesc = (struct mbi_desc *)data->msi_desc;
+   offset = mbidesc->offset;
+   return offset;
+}
+
+int mbi_parse_irqs(struct device *dev, struct mbi_ops *ops)
+{
+   pr_warn("%s:this function not use now\n", __func__);
+   return -EINVAL;
+}
+EXPORT_SYMBOL(mbi_parse_irqs);
+
+void mbi_free_irqs(struct device *dev, unsigned int virq, unsigned int nvec)
+{
+   pr_warn("%s:this function not use now\n", __func__);
+}
+EXPORT_SYMBOL(mbi_free_irqs);
+
+static 

Re: [PATCH 1/4]:Add mbigen driver to support mbigen interrupt controller

2015-05-29 Thread Joe Perches
On Sat, 2015-05-30 at 11:19 +0800, majun (F) wrote:
 This patch contains the mbigen device driver.

Trivial notes:

Please use scripts/checkpatch.pl on your patches and see
if you want to correct any of the messages it produces.

 diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c

You could add
#define pr_fmt(fmt) mbigen:  fmt
before any of the #includes so that all of the
pr_level(fmt, ...) uses are prefixed with mbigen: 

 +int mbi_parse_irqs(struct device *dev, struct mbi_ops *ops)
 +{
 + pr_warn(%s:this function not use now\n, __func__);

Maybe pr_warn_once()

 + return -EINVAL;
 +}
 +EXPORT_SYMBOL(mbi_parse_irqs);
 +
 +void mbi_free_irqs(struct device *dev, unsigned int virq, unsigned int nvec)
 +{
 + pr_warn(%s:this function not use now\n, __func__);

pr_warn_once()?

 +static struct mbigen *mbigen_get_device(struct mbigen_chip *chip,
 + 
 unsigned int nid)
 +{
 + struct mbigen *tmp, *mbigen;
 + bool found = false;
 +
 + if (nid = MG_NR) {
 + pr_warn(MBIGEN: Device ID exceeds max number!\n);

So this wouldn't need a MBIGEN:  prefix

etc...

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4]:Add mbigen driver to support mbigen interrupt controller

2015-05-29 Thread majun (F)
This patch contains the mbigen device driver.

To support Mbigen device, irq-mbigen.c and mbi.h are added.

As a MSI interrupt controller, the mbigen is used as a child domain of
MSI domain just like PCI devices.

Change log:
--irq-mbigen.c: the driver of mbigen device.The mbigen irq domain is created 
here
   as child domain of MSI.
--Add CONFIG_MBIGEN_IRQ_DOMAIN enable this driver

Signed-off-by: Yun Wu wuyun...@huawei.com
Signed-off-by: Ma Jun majun...@huawei.com
---
 drivers/irqchip/Kconfig  |4 +
 drivers/irqchip/Makefile |1 +
 drivers/irqchip/irq-mbigen.c |  562 ++
 include/linux/mbi.h  |   77 ++
 4 files changed, 644 insertions(+), 0 deletions(-)
 mode change 100644 = 100755 drivers/irqchip/Kconfig
 mode change 100644 = 100755 drivers/irqchip/Makefile
 create mode 100755 drivers/irqchip/irq-mbigen.c
 create mode 100644 include/linux/mbi.h

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
old mode 100644
new mode 100755
index 6de62a9..595a6eb
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -26,6 +26,10 @@ config ARM_GIC_V3
 config ARM_GIC_V3_ITS
bool
select PCI_MSI_IRQ_DOMAIN
+   select MBIGEN_IRQ_DOMAIN
+
+config MBIGEN_IRQ_DOMAIN
+   bool

 config ARM_NVIC
bool
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
old mode 100644
new mode 100755
index dda4927..23571c1
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -23,6 +23,7 @@ obj-$(CONFIG_ARM_GIC) += irq-gic.o 
irq-gic-common.o
 obj-$(CONFIG_ARM_GIC_V2M)  += irq-gic-v2m.o
 obj-$(CONFIG_ARM_GIC_V3)   += irq-gic-v3.o irq-gic-common.o
 obj-$(CONFIG_ARM_GIC_V3_ITS)   += irq-gic-v3-its.o
+obj-$(CONFIG_MBIGEN_IRQ_DOMAIN)+= irq-mbigen.o
 obj-$(CONFIG_ARM_NVIC) += irq-nvic.o
 obj-$(CONFIG_ARM_VIC)  += irq-vic.o
 obj-$(CONFIG_ATMEL_AIC_IRQ)+= irq-atmel-aic-common.o 
irq-atmel-aic.o
diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c
new file mode 100755
index 000..462f9a0
--- /dev/null
+++ b/drivers/irqchip/irq-mbigen.c
@@ -0,0 +1,562 @@
+/*
+ * Copyright (C) 2014 Hisilicon Limited, All Rights Reserved.
+ * Author: Yun Wu wuyun...@huawei.com
+ * Author: Jun Ma majun...@huawei.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see http://www.gnu.org/licenses/.
+ */
+
+#include linux/init.h
+#include linux/io.h
+#include linux/slab.h
+#include linux/interrupt.h
+#include linux/mbi.h
+#include linux/of_address.h
+#include linux/of_irq.h
+#include linux/of_platform.h
+#include linux/kernel.h
+#include linux/platform_device.h
+#include linux/module.h
+#include linux/msi.h
+#include linux/irqchip/arm-gic-its.h
+#include irqchip.h
+
+/* Register offsets */
+#define MG_IRQ_TYPE0x0
+#define MG_IRQ_CLEAR   0x100
+#define MG_IRQ_STATUS  0x200
+#define MG_MSG_DATA0x300
+
+/* The gap between normal and extended pin region */
+#define MG_EXT_OFST0x10
+
+/* Max number of interrupts supported */
+#define MG_NR_IRQS 640
+
+/* Number of mbigens supported in one chip */
+#define MG_NR  6
+
+struct mbigen_node {
+   struct list_headentry;
+   struct mbigen   *mbigen;
+   struct device_node  *source;
+   unsigned intirq;
+   unsigned intnr_irqs;
+};
+
+struct mbigen {
+   raw_spinlock_t  lock;
+   struct list_headentry;
+   struct mbigen_chip  *chip;
+   unsigned intnid;
+   unsigned intirqs_used;
+   struct list_headnodes;
+};
+
+struct mbigen_chip {
+   raw_spinlock_t  lock;
+   struct list_headentry;
+   struct device   *dev;
+   struct device_node  *node;
+   void __iomem*base;
+   struct irq_domain   *domain;
+   struct list_headnodes;
+};
+
+static LIST_HEAD(mbigen_chips);
+static DEFINE_SPINLOCK(mbigen_lock);
+
+int get_mbi_offset(int virq)
+{
+   struct irq_data *data;
+   struct mbi_desc *mbidesc;
+   int offset = 0;
+
+   data = irq_get_irq_data(virq);
+
+   mbidesc = (struct mbi_desc *)data-msi_desc;
+   offset = mbidesc-offset;
+   return offset;
+}
+
+int mbi_parse_irqs(struct device *dev, struct mbi_ops *ops)
+{
+   pr_warn(%s:this function not 

Re: [PATCH 1/4] Add smp support for Allwinner A20(sunxi 7i).

2013-09-12 Thread cinifr
Thanks for you advice, you are right, I will reupdate the patch. :)

On 12 September 2013 22:26, Mark Rutland  wrote:
> On Thu, Sep 12, 2013 at 07:51:24AM +0100, Fan Rong wrote:
>> Signed-off-by: Fan Rong 
>> ---
>>  arch/arm/mach-sunxi/Makefile   |2 +
>>  arch/arm/mach-sunxi/headsmp.S  |   12 ++
>>  arch/arm/mach-sunxi/platform.h |  346 
>> 
>>  arch/arm/mach-sunxi/platsmp.c  |  166 +++
>>  arch/arm/mach-sunxi/sunxi.c|4 +
>>  5 files changed, 530 insertions(+)
>>  create mode 100644 arch/arm/mach-sunxi/headsmp.S
>>  create mode 100644 arch/arm/mach-sunxi/platform.h
>>  create mode 100644 arch/arm/mach-sunxi/platsmp.c
>>
>
> [...]
>
>> +static struct of_device_id sunxi_cc_ids[] = {
>> +   { .compatible = "allwinner,sun7i-cc"},
>> +   { /*sentinel*/ }
>> +};
>
> NAK - There's no binding document for this in mainline or this series.
>
>> +
>> +
>> +static void enable_aw_cpu(int cpu)
>> +{
>> +   long paddr;
>> +   u32 pwr_reg;
>> +
>> +   struct device_node *np;
>> +   np = of_find_matching_node(NULL, sunxi_cc_ids);
>> +   cc_base = of_iomap(np, 0);
>
> This seems to get called repeatedly in sunxi7i_boot_secondary, so you're
> repeatedly trying to find the cc node and mapping it, but never
> unmapping it. That's both a waste of time and a waste of address space.
>
> It would be nicer to map this once at the start. That seems simpler than
> stashing the physical address and mapping/unmapping it repeatedly.
> smp_boot_secondary.
>
>> +   pr_debug("cc_base is %x\n", (unsigned int)cc_base);
>> +   if (!cc_base) {
>
> You can use %p to print pointers, without casting to an integer type.
>
>> +   pr_debug("error map cc configure\n");
>> +   return;
>
> As this may be called repeatedly, from a function that can return
> errors, it would be nice to propagate an error code if there's a
> failure.
>
>> +   }
>> +
>> +   paddr = virt_to_phys(sun7i_secondary_startup);
>> +   writel(paddr, cc_base + AW_CPUCFG_P_REG0);
>> +/* step1: Assert nCOREPORESET LOW and hold L1RSTDISABLE LOW.
>> +   Ensure DBGPWRDUP is held LOW to prevent any external
>> +   debug access to the processor.
>> +*/
>> +/* assert cpu core reset */
>> +   writel(0, cc_base + CPUX_RESET_CTL(cpu));
>> +/* L1RSTDISABLE hold low */
>> +   pwr_reg = readl(cc_base + AW_CPUCFG_GENCTL);
>> +   pwr_reg &= ~(1<> +   writel(pwr_reg, cc_base + AW_CPUCFG_GENCTL);
>> +/* DBGPWRDUP hold low */
>> +   pwr_reg = readl(cc_base + AW_CPUCFG_DBGCTL1);
>> +   pwr_reg &= ~(1<> +   writel(pwr_reg, cc_base + AW_CPUCFG_DBGCTL1);
>> +
>> +/* step2: release power clamp */
>> +   writel(0xff, cc_base + AW_CPU1_PWR_CLAMP);
>> +   writel(0x7f, cc_base + AW_CPU1_PWR_CLAMP);
>> +   writel(0x3f, cc_base + AW_CPU1_PWR_CLAMP);
>> +   writel(0x1f, cc_base + AW_CPU1_PWR_CLAMP);
>> +   writel(0x0f, cc_base + AW_CPU1_PWR_CLAMP);
>> +   writel(0x07, cc_base + AW_CPU1_PWR_CLAMP);
>> +   writel(0x03, cc_base + AW_CPU1_PWR_CLAMP);
>> +   writel(0x01, cc_base + AW_CPU1_PWR_CLAMP);
>> +   writel(0x00, cc_base + AW_CPU1_PWR_CLAMP);
>> +   mdelay(10);
>> +
>> +/* step3: clear power-off gating */
>> +   pwr_reg = readl(cc_base + AW_CPU1_PWROFF_REG);
>> +   pwr_reg &= ~(1);
>> +   writel(pwr_reg, cc_base + AW_CPU1_PWROFF_REG);
>> +   mdelay(1);
>> +
>> +/* step4: de-assert core reset */
>> +   writel(3, cc_base + CPUX_RESET_CTL(cpu));
>> +
>> +/* step5: assert DBGPWRDUP signal */
>> +   pwr_reg = readl(cc_base + AW_CPUCFG_DBGCTL1);
>> +   pwr_reg |= (1<> +   writel(pwr_reg, cc_base + AW_CPUCFG_DBGCTL1);
>> +
>> +}
>> +
>> +
>> +
>> +static void sunxi7i_smp_init_cpus(void)
>> +{
>> +   unsigned int i, ncores;
>> +
>> +
>> +   /* HDG: we do not use scu_get_core_count() here as that does not
>> +  work on the A20 ? */
>> +
>> +   /* Read current CP15 Cache Size ID Register */
>
> Invalid comment. Judging by the encoding, this is the L2CTLR, not the
> CCSIDR.
>
>> +   asm volatile ("mrc p15, 1, %0, c9, c0, 2" : "=r" (ncores));
>> +   ncores = ((ncores >> 24) & 0x3) + 1;
>> +
>> +   pr_debug("[%s] ncores=%d\n", __func__, ncores);
>> +
>> +   for (i = 0; i < ncores; i++)
>> +   set_cpu_possible(i, true);
>> +
>> +}
>
> Even ignoring the above, as long as your dt is correct
> arm_dt_init_cpu_maps (called from stup_arch) will set the cpus as
> possible (and handles arbitrary MPIDR values as may be the case in
> multi-cluster).
>
> You don't need this function -- please remove it.
>
>> +
>> +/*
>> + * for arch/arm/kernel/smp.c:smp_prepare_cpus(unsigned int max_cpus)
>> + */
>> +static void sunxi7i_smp_prepare_cpus(unsigned int max_cpus)
>> +{
>> +   /*
>> +* HDG: we do not call scu_enable() here as the sun6i source dump has
>> +* a modified 

Re: [PATCH 1/4] Add smp support for Allwinner A20(sunxi 7i).

2013-09-12 Thread Mark Rutland
On Thu, Sep 12, 2013 at 07:51:24AM +0100, Fan Rong wrote:
> Signed-off-by: Fan Rong 
> ---
>  arch/arm/mach-sunxi/Makefile   |2 +
>  arch/arm/mach-sunxi/headsmp.S  |   12 ++
>  arch/arm/mach-sunxi/platform.h |  346 
> 
>  arch/arm/mach-sunxi/platsmp.c  |  166 +++
>  arch/arm/mach-sunxi/sunxi.c|4 +
>  5 files changed, 530 insertions(+)
>  create mode 100644 arch/arm/mach-sunxi/headsmp.S
>  create mode 100644 arch/arm/mach-sunxi/platform.h
>  create mode 100644 arch/arm/mach-sunxi/platsmp.c
> 

[...]

> +static struct of_device_id sunxi_cc_ids[] = {
> +   { .compatible = "allwinner,sun7i-cc"},
> +   { /*sentinel*/ }
> +};

NAK - There's no binding document for this in mainline or this series.

> +
> +
> +static void enable_aw_cpu(int cpu)
> +{
> +   long paddr;
> +   u32 pwr_reg;
> +
> +   struct device_node *np;
> +   np = of_find_matching_node(NULL, sunxi_cc_ids);
> +   cc_base = of_iomap(np, 0);

This seems to get called repeatedly in sunxi7i_boot_secondary, so you're
repeatedly trying to find the cc node and mapping it, but never
unmapping it. That's both a waste of time and a waste of address space.

It would be nicer to map this once at the start. That seems simpler than
stashing the physical address and mapping/unmapping it repeatedly.
smp_boot_secondary.

> +   pr_debug("cc_base is %x\n", (unsigned int)cc_base);
> +   if (!cc_base) {

You can use %p to print pointers, without casting to an integer type.

> +   pr_debug("error map cc configure\n");
> +   return;

As this may be called repeatedly, from a function that can return
errors, it would be nice to propagate an error code if there's a
failure.

> +   }
> +
> +   paddr = virt_to_phys(sun7i_secondary_startup);
> +   writel(paddr, cc_base + AW_CPUCFG_P_REG0);
> +/* step1: Assert nCOREPORESET LOW and hold L1RSTDISABLE LOW.
> +   Ensure DBGPWRDUP is held LOW to prevent any external
> +   debug access to the processor.
> +*/
> +/* assert cpu core reset */
> +   writel(0, cc_base + CPUX_RESET_CTL(cpu));
> +/* L1RSTDISABLE hold low */
> +   pwr_reg = readl(cc_base + AW_CPUCFG_GENCTL);
> +   pwr_reg &= ~(1< +   writel(pwr_reg, cc_base + AW_CPUCFG_GENCTL);
> +/* DBGPWRDUP hold low */
> +   pwr_reg = readl(cc_base + AW_CPUCFG_DBGCTL1);
> +   pwr_reg &= ~(1< +   writel(pwr_reg, cc_base + AW_CPUCFG_DBGCTL1);
> +
> +/* step2: release power clamp */
> +   writel(0xff, cc_base + AW_CPU1_PWR_CLAMP);
> +   writel(0x7f, cc_base + AW_CPU1_PWR_CLAMP);
> +   writel(0x3f, cc_base + AW_CPU1_PWR_CLAMP);
> +   writel(0x1f, cc_base + AW_CPU1_PWR_CLAMP);
> +   writel(0x0f, cc_base + AW_CPU1_PWR_CLAMP);
> +   writel(0x07, cc_base + AW_CPU1_PWR_CLAMP);
> +   writel(0x03, cc_base + AW_CPU1_PWR_CLAMP);
> +   writel(0x01, cc_base + AW_CPU1_PWR_CLAMP);
> +   writel(0x00, cc_base + AW_CPU1_PWR_CLAMP);
> +   mdelay(10);
> +
> +/* step3: clear power-off gating */
> +   pwr_reg = readl(cc_base + AW_CPU1_PWROFF_REG);
> +   pwr_reg &= ~(1);
> +   writel(pwr_reg, cc_base + AW_CPU1_PWROFF_REG);
> +   mdelay(1);
> +
> +/* step4: de-assert core reset */
> +   writel(3, cc_base + CPUX_RESET_CTL(cpu));
> +
> +/* step5: assert DBGPWRDUP signal */
> +   pwr_reg = readl(cc_base + AW_CPUCFG_DBGCTL1);
> +   pwr_reg |= (1< +   writel(pwr_reg, cc_base + AW_CPUCFG_DBGCTL1);
> +
> +}
> +
> +
> +
> +static void sunxi7i_smp_init_cpus(void)
> +{
> +   unsigned int i, ncores;
> +
> +
> +   /* HDG: we do not use scu_get_core_count() here as that does not
> +  work on the A20 ? */
> +
> +   /* Read current CP15 Cache Size ID Register */

Invalid comment. Judging by the encoding, this is the L2CTLR, not the
CCSIDR.

> +   asm volatile ("mrc p15, 1, %0, c9, c0, 2" : "=r" (ncores));
> +   ncores = ((ncores >> 24) & 0x3) + 1;
> +
> +   pr_debug("[%s] ncores=%d\n", __func__, ncores);
> +
> +   for (i = 0; i < ncores; i++)
> +   set_cpu_possible(i, true);
> +
> +}

Even ignoring the above, as long as your dt is correct
arm_dt_init_cpu_maps (called from stup_arch) will set the cpus as
possible (and handles arbitrary MPIDR values as may be the case in
multi-cluster).

You don't need this function -- please remove it.

> +
> +/*
> + * for arch/arm/kernel/smp.c:smp_prepare_cpus(unsigned int max_cpus)
> + */
> +static void sunxi7i_smp_prepare_cpus(unsigned int max_cpus)
> +{
> +   /*
> +* HDG: we do not call scu_enable() here as the sun6i source dump has
> +* a modified arch/arm/kernel/smp_scu.c, where scu_enable() is a nop.
> +   */
> +}

A look in smp.c shows smp_prepare_cpus is perfectly happy to not have a
smp_prepare_cpus callback. You don't need this function -- please remove
it.

> +
> +
> +
> +
> +
> +

Why so much space here (and 

Re: [PATCH 1/4] Add smp support for Allwinner A20(sunxi 7i).

2013-09-12 Thread Russell King - ARM Linux
Some other comments:

On Thu, Sep 12, 2013 at 02:51:24PM +0800, Fan Rong wrote:
> +/* L1RSTDISABLE hold low */
> + pwr_reg = readl(cc_base + AW_CPUCFG_GENCTL);
> + pwr_reg &= ~(1< +/* step3: clear power-off gating */
> + pwr_reg = readl(cc_base + AW_CPU1_PWROFF_REG);
> + pwr_reg &= ~(1);

You don't need the parens here.

> + pwr_reg = readl(cc_base + AW_CPUCFG_DBGCTL1);
> + pwr_reg |= (1< +static int sunxi7i_boot_secondary(unsigned int cpu, struct task_struct *idle)
> +{
> + pr_debug("[%s] enter cpu %d\n", __func__, cpu);
> + spin_lock(_lock);
> + enable_aw_cpu(cpu);
> + spin_unlock(_lock);

What exactly does this spinlock protect?  The core code already provides
the guarantee that only one CPU will be brought online or taken offline
at a time.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] Add smp support for Allwinner A20(sunxi 7i).

2013-09-12 Thread Fan Rong
Signed-off-by: Fan Rong 
---
 arch/arm/mach-sunxi/Makefile   |2 +
 arch/arm/mach-sunxi/headsmp.S  |   12 ++
 arch/arm/mach-sunxi/platform.h |  346 
 arch/arm/mach-sunxi/platsmp.c  |  166 +++
 arch/arm/mach-sunxi/sunxi.c|4 +
 5 files changed, 530 insertions(+)
 create mode 100644 arch/arm/mach-sunxi/headsmp.S
 create mode 100644 arch/arm/mach-sunxi/platform.h
 create mode 100644 arch/arm/mach-sunxi/platsmp.c

diff --git a/arch/arm/mach-sunxi/Makefile b/arch/arm/mach-sunxi/Makefile
index 93bebfc..d7f1ef4 100644
--- a/arch/arm/mach-sunxi/Makefile
+++ b/arch/arm/mach-sunxi/Makefile
@@ -1 +1,3 @@
 obj-$(CONFIG_ARCH_SUNXI) += sunxi.o
+obj-$(CONFIG_ARCH_SUNXI) += platsmp.o
+obj-$(CONFIG_ARCH_SUNXI) += headsmp.o
diff --git a/arch/arm/mach-sunxi/headsmp.S b/arch/arm/mach-sunxi/headsmp.S
new file mode 100644
index 000..b400602
--- /dev/null
+++ b/arch/arm/mach-sunxi/headsmp.S
@@ -0,0 +1,12 @@
+#include 
+#include 
+
+.section ".text.head", "ax"
+   __CPUINIT
+
+ENTRY(sun7i_secondary_startup)
+   msr cpsr_fsxc, #0xd3
+   mov r0, #0
+   ldr r1, =0x
+   b   secondary_startup
+ENDPROC(sun7i_secondary_startup)
diff --git a/arch/arm/mach-sunxi/platform.h b/arch/arm/mach-sunxi/platform.h
new file mode 100644
index 000..3f80d22
--- /dev/null
+++ b/arch/arm/mach-sunxi/platform.h
@@ -0,0 +1,346 @@
+/*
+ * arch/arm/plat-sunxi/include/plat/platform.h
+ *
+ * (C) Copyright 2007-2012
+ * Allwinner Technology Co., Ltd. 
+ * Benn Huang 
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+extern struct smp_operations sunxi7i_smp_ops;
+void sun7i_secondary_startup(void);
+
+#ifndef __SW_PLATFORM_H
+#define __SW_PLATFORM_H
+
+
+
+/* Physical Address */
+#define SW_PA_BROM_START  0x
+#define SW_PA_BROM_END0x7fff   /* 32KB */
+
+#define SW_PA_SRAM_BASE   0x
+
+/* sun7i sram addresses */
+#define SW_PA_SRAM_A1_BASE0x
+#define SW_PA_SRAM_A2_BASE0x4000
+#define SW_PA_SRAM_A3_BASE0x8000
+#define SW_PA_SRAM_A4_BASE0xb400
+#define SW_PA_SRAM_D_BASE 0x0001
+#define SW_PA_SRAM_B_BASE 0x0002
+
+#define SW_PA_SDRAM_START 0x4000
+#define SW_PA_IO_BASE 0x01c0
+#define SW_PA_SRAM_IO_BASE0x01c0   /* 4KB */
+#define SW_PA_DRAM_IO_BASE0x01c01000
+#define SW_PA_DMAC_IO_BASE0x01c02000
+#define SW_PA_NANDFLASHC_IO_BASE  0x01c03000
+#define SW_PA_TSI_IO_BASE 0x01c04000
+#define SW_PA_SPI0_IO_BASE0x01c05000
+#define SW_PA_SPI1_IO_BASE0x01c06000
+#define SW_PA_MSCC_IO_BASE0x01c07000
+#define SW_PA_TVD_IO_BASE 0x01c08000
+#define SW_PA_CSI0_IO_BASE0x01c09000
+#define SW_PA_TVE_IO_BASE 0x01c0a000
+#define SW_PA_EMAC_IO_BASE0x01c0b000
+#define SW_PA_TCON0_IO_BASE   0x01c0c000
+#define SW_PA_TCON1_IO_BASE   0x01c0d000
+#define SW_PA_VE_IO_BASE  0x01c0e000
+#define SW_PA_SDC0_IO_BASE0x01c0f000
+#define SW_PA_SDC1_IO_BASE0x01c1
+#define SW_PA_SDC2_IO_BASE0x01c11000
+#define SW_PA_SDC3_IO_BASE0x01c12000
+#define SW_PA_USB0_IO_BASE0x01c13000
+#define SW_PA_USB1_IO_BASE0x01c14000
+#define SW_PA_SSE_IO_BASE 0x01c15000
+#define SW_PA_HDMI_IO_BASE0x01c16000
+#define SW_PA_SPI2_IO_BASE0x01c17000
+#define SW_PA_SATA_IO_BASE0x01c18000
+#define SW_PA_PATA_IO_BASE0x01c19000
+#define SW_PA_ACE_IO_BASE 0x01c1a000
+#define SW_PA_TVE1_IO_BASE0x01c1b000
+#define SW_PA_USB2_IO_BASE0x01c1c000
+#define SW_PA_CSI1_IO_BASE0x01c1d000
+#define SW_PA_TZASC_IO_BASE   0x01c1e000
+#define SW_PA_SPI3_IO_BASE0x01c1f000
+#define SW_PA_CCM_IO_BASE 0x01c2
+#define SW_PA_INT_IO_BASE 0x01c20400
+#define SW_PA_PORTC_IO_BASE   

[PATCH 1/4] Add smp support for Allwinner A20(sunxi 7i).

2013-09-12 Thread Fan Rong
Signed-off-by: Fan Rong cin...@gmail.com
---
 arch/arm/mach-sunxi/Makefile   |2 +
 arch/arm/mach-sunxi/headsmp.S  |   12 ++
 arch/arm/mach-sunxi/platform.h |  346 
 arch/arm/mach-sunxi/platsmp.c  |  166 +++
 arch/arm/mach-sunxi/sunxi.c|4 +
 5 files changed, 530 insertions(+)
 create mode 100644 arch/arm/mach-sunxi/headsmp.S
 create mode 100644 arch/arm/mach-sunxi/platform.h
 create mode 100644 arch/arm/mach-sunxi/platsmp.c

diff --git a/arch/arm/mach-sunxi/Makefile b/arch/arm/mach-sunxi/Makefile
index 93bebfc..d7f1ef4 100644
--- a/arch/arm/mach-sunxi/Makefile
+++ b/arch/arm/mach-sunxi/Makefile
@@ -1 +1,3 @@
 obj-$(CONFIG_ARCH_SUNXI) += sunxi.o
+obj-$(CONFIG_ARCH_SUNXI) += platsmp.o
+obj-$(CONFIG_ARCH_SUNXI) += headsmp.o
diff --git a/arch/arm/mach-sunxi/headsmp.S b/arch/arm/mach-sunxi/headsmp.S
new file mode 100644
index 000..b400602
--- /dev/null
+++ b/arch/arm/mach-sunxi/headsmp.S
@@ -0,0 +1,12 @@
+#include linux/linkage.h
+#include linux/init.h
+
+.section .text.head, ax
+   __CPUINIT
+
+ENTRY(sun7i_secondary_startup)
+   msr cpsr_fsxc, #0xd3
+   mov r0, #0
+   ldr r1, =0x
+   b   secondary_startup
+ENDPROC(sun7i_secondary_startup)
diff --git a/arch/arm/mach-sunxi/platform.h b/arch/arm/mach-sunxi/platform.h
new file mode 100644
index 000..3f80d22
--- /dev/null
+++ b/arch/arm/mach-sunxi/platform.h
@@ -0,0 +1,346 @@
+/*
+ * arch/arm/plat-sunxi/include/plat/platform.h
+ *
+ * (C) Copyright 2007-2012
+ * Allwinner Technology Co., Ltd. www.allwinnertech.com
+ * Benn Huang b...@allwinnertech.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+extern struct smp_operations sunxi7i_smp_ops;
+void sun7i_secondary_startup(void);
+
+#ifndef __SW_PLATFORM_H
+#define __SW_PLATFORM_H
+
+
+
+/* Physical Address */
+#define SW_PA_BROM_START  0x
+#define SW_PA_BROM_END0x7fff   /* 32KB */
+
+#define SW_PA_SRAM_BASE   0x
+
+/* sun7i sram addresses */
+#define SW_PA_SRAM_A1_BASE0x
+#define SW_PA_SRAM_A2_BASE0x4000
+#define SW_PA_SRAM_A3_BASE0x8000
+#define SW_PA_SRAM_A4_BASE0xb400
+#define SW_PA_SRAM_D_BASE 0x0001
+#define SW_PA_SRAM_B_BASE 0x0002
+
+#define SW_PA_SDRAM_START 0x4000
+#define SW_PA_IO_BASE 0x01c0
+#define SW_PA_SRAM_IO_BASE0x01c0   /* 4KB */
+#define SW_PA_DRAM_IO_BASE0x01c01000
+#define SW_PA_DMAC_IO_BASE0x01c02000
+#define SW_PA_NANDFLASHC_IO_BASE  0x01c03000
+#define SW_PA_TSI_IO_BASE 0x01c04000
+#define SW_PA_SPI0_IO_BASE0x01c05000
+#define SW_PA_SPI1_IO_BASE0x01c06000
+#define SW_PA_MSCC_IO_BASE0x01c07000
+#define SW_PA_TVD_IO_BASE 0x01c08000
+#define SW_PA_CSI0_IO_BASE0x01c09000
+#define SW_PA_TVE_IO_BASE 0x01c0a000
+#define SW_PA_EMAC_IO_BASE0x01c0b000
+#define SW_PA_TCON0_IO_BASE   0x01c0c000
+#define SW_PA_TCON1_IO_BASE   0x01c0d000
+#define SW_PA_VE_IO_BASE  0x01c0e000
+#define SW_PA_SDC0_IO_BASE0x01c0f000
+#define SW_PA_SDC1_IO_BASE0x01c1
+#define SW_PA_SDC2_IO_BASE0x01c11000
+#define SW_PA_SDC3_IO_BASE0x01c12000
+#define SW_PA_USB0_IO_BASE0x01c13000
+#define SW_PA_USB1_IO_BASE0x01c14000
+#define SW_PA_SSE_IO_BASE 0x01c15000
+#define SW_PA_HDMI_IO_BASE0x01c16000
+#define SW_PA_SPI2_IO_BASE0x01c17000
+#define SW_PA_SATA_IO_BASE0x01c18000
+#define SW_PA_PATA_IO_BASE0x01c19000
+#define SW_PA_ACE_IO_BASE 0x01c1a000
+#define SW_PA_TVE1_IO_BASE0x01c1b000
+#define SW_PA_USB2_IO_BASE0x01c1c000
+#define SW_PA_CSI1_IO_BASE0x01c1d000
+#define SW_PA_TZASC_IO_BASE   0x01c1e000
+#define SW_PA_SPI3_IO_BASE0x01c1f000
+#define SW_PA_CCM_IO_BASE 0x01c2
+#define 

Re: [PATCH 1/4] Add smp support for Allwinner A20(sunxi 7i).

2013-09-12 Thread Russell King - ARM Linux
Some other comments:

On Thu, Sep 12, 2013 at 02:51:24PM +0800, Fan Rong wrote:
 +/* L1RSTDISABLE hold low */
 + pwr_reg = readl(cc_base + AW_CPUCFG_GENCTL);
 + pwr_reg = ~(1cpu);

If you pass your patch through checkpatch.pl, it will warn about some of
this.  You should have one space each side of .

 +/* step3: clear power-off gating */
 + pwr_reg = readl(cc_base + AW_CPU1_PWROFF_REG);
 + pwr_reg = ~(1);

You don't need the parens here.

 + pwr_reg = readl(cc_base + AW_CPUCFG_DBGCTL1);
 + pwr_reg |= (1cpu);

Nor here.

 +static int sunxi7i_boot_secondary(unsigned int cpu, struct task_struct *idle)
 +{
 + pr_debug([%s] enter cpu %d\n, __func__, cpu);
 + spin_lock(boot_lock);
 + enable_aw_cpu(cpu);
 + spin_unlock(boot_lock);

What exactly does this spinlock protect?  The core code already provides
the guarantee that only one CPU will be brought online or taken offline
at a time.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] Add smp support for Allwinner A20(sunxi 7i).

2013-09-12 Thread Mark Rutland
On Thu, Sep 12, 2013 at 07:51:24AM +0100, Fan Rong wrote:
 Signed-off-by: Fan Rong cin...@gmail.com
 ---
  arch/arm/mach-sunxi/Makefile   |2 +
  arch/arm/mach-sunxi/headsmp.S  |   12 ++
  arch/arm/mach-sunxi/platform.h |  346 
 
  arch/arm/mach-sunxi/platsmp.c  |  166 +++
  arch/arm/mach-sunxi/sunxi.c|4 +
  5 files changed, 530 insertions(+)
  create mode 100644 arch/arm/mach-sunxi/headsmp.S
  create mode 100644 arch/arm/mach-sunxi/platform.h
  create mode 100644 arch/arm/mach-sunxi/platsmp.c
 

[...]

 +static struct of_device_id sunxi_cc_ids[] = {
 +   { .compatible = allwinner,sun7i-cc},
 +   { /*sentinel*/ }
 +};

NAK - There's no binding document for this in mainline or this series.

 +
 +
 +static void enable_aw_cpu(int cpu)
 +{
 +   long paddr;
 +   u32 pwr_reg;
 +
 +   struct device_node *np;
 +   np = of_find_matching_node(NULL, sunxi_cc_ids);
 +   cc_base = of_iomap(np, 0);

This seems to get called repeatedly in sunxi7i_boot_secondary, so you're
repeatedly trying to find the cc node and mapping it, but never
unmapping it. That's both a waste of time and a waste of address space.

It would be nicer to map this once at the start. That seems simpler than
stashing the physical address and mapping/unmapping it repeatedly.
smp_boot_secondary.

 +   pr_debug(cc_base is %x\n, (unsigned int)cc_base);
 +   if (!cc_base) {

You can use %p to print pointers, without casting to an integer type.

 +   pr_debug(error map cc configure\n);
 +   return;

As this may be called repeatedly, from a function that can return
errors, it would be nice to propagate an error code if there's a
failure.

 +   }
 +
 +   paddr = virt_to_phys(sun7i_secondary_startup);
 +   writel(paddr, cc_base + AW_CPUCFG_P_REG0);
 +/* step1: Assert nCOREPORESET LOW and hold L1RSTDISABLE LOW.
 +   Ensure DBGPWRDUP is held LOW to prevent any external
 +   debug access to the processor.
 +*/
 +/* assert cpu core reset */
 +   writel(0, cc_base + CPUX_RESET_CTL(cpu));
 +/* L1RSTDISABLE hold low */
 +   pwr_reg = readl(cc_base + AW_CPUCFG_GENCTL);
 +   pwr_reg = ~(1cpu);
 +   writel(pwr_reg, cc_base + AW_CPUCFG_GENCTL);
 +/* DBGPWRDUP hold low */
 +   pwr_reg = readl(cc_base + AW_CPUCFG_DBGCTL1);
 +   pwr_reg = ~(1cpu);
 +   writel(pwr_reg, cc_base + AW_CPUCFG_DBGCTL1);
 +
 +/* step2: release power clamp */
 +   writel(0xff, cc_base + AW_CPU1_PWR_CLAMP);
 +   writel(0x7f, cc_base + AW_CPU1_PWR_CLAMP);
 +   writel(0x3f, cc_base + AW_CPU1_PWR_CLAMP);
 +   writel(0x1f, cc_base + AW_CPU1_PWR_CLAMP);
 +   writel(0x0f, cc_base + AW_CPU1_PWR_CLAMP);
 +   writel(0x07, cc_base + AW_CPU1_PWR_CLAMP);
 +   writel(0x03, cc_base + AW_CPU1_PWR_CLAMP);
 +   writel(0x01, cc_base + AW_CPU1_PWR_CLAMP);
 +   writel(0x00, cc_base + AW_CPU1_PWR_CLAMP);
 +   mdelay(10);
 +
 +/* step3: clear power-off gating */
 +   pwr_reg = readl(cc_base + AW_CPU1_PWROFF_REG);
 +   pwr_reg = ~(1);
 +   writel(pwr_reg, cc_base + AW_CPU1_PWROFF_REG);
 +   mdelay(1);
 +
 +/* step4: de-assert core reset */
 +   writel(3, cc_base + CPUX_RESET_CTL(cpu));
 +
 +/* step5: assert DBGPWRDUP signal */
 +   pwr_reg = readl(cc_base + AW_CPUCFG_DBGCTL1);
 +   pwr_reg |= (1cpu);
 +   writel(pwr_reg, cc_base + AW_CPUCFG_DBGCTL1);
 +
 +}
 +
 +
 +
 +static void sunxi7i_smp_init_cpus(void)
 +{
 +   unsigned int i, ncores;
 +
 +
 +   /* HDG: we do not use scu_get_core_count() here as that does not
 +  work on the A20 ? */
 +
 +   /* Read current CP15 Cache Size ID Register */

Invalid comment. Judging by the encoding, this is the L2CTLR, not the
CCSIDR.

 +   asm volatile (mrc p15, 1, %0, c9, c0, 2 : =r (ncores));
 +   ncores = ((ncores  24)  0x3) + 1;
 +
 +   pr_debug([%s] ncores=%d\n, __func__, ncores);
 +
 +   for (i = 0; i  ncores; i++)
 +   set_cpu_possible(i, true);
 +
 +}

Even ignoring the above, as long as your dt is correct
arm_dt_init_cpu_maps (called from stup_arch) will set the cpus as
possible (and handles arbitrary MPIDR values as may be the case in
multi-cluster).

You don't need this function -- please remove it.

 +
 +/*
 + * for arch/arm/kernel/smp.c:smp_prepare_cpus(unsigned int max_cpus)
 + */
 +static void sunxi7i_smp_prepare_cpus(unsigned int max_cpus)
 +{
 +   /*
 +* HDG: we do not call scu_enable() here as the sun6i source dump has
 +* a modified arch/arm/kernel/smp_scu.c, where scu_enable() is a nop.
 +   */
 +}

A look in smp.c shows smp_prepare_cpus is perfectly happy to not have a
smp_prepare_cpus callback. You don't need this function -- please remove
it.

 +
 +
 +
 +
 +
 +

Why so much space here (and elsewhere)?

 +/*
 + * for linux/arch/arm/kernel/smp.c:__cpu_up(..)
 + */
 +static int 

Re: [PATCH 1/4] Add smp support for Allwinner A20(sunxi 7i).

2013-09-12 Thread cinifr
Thanks for you advice, you are right, I will reupdate the patch. :)

On 12 September 2013 22:26, Mark Rutland mark.rutl...@arm.com wrote:
 On Thu, Sep 12, 2013 at 07:51:24AM +0100, Fan Rong wrote:
 Signed-off-by: Fan Rong cin...@gmail.com
 ---
  arch/arm/mach-sunxi/Makefile   |2 +
  arch/arm/mach-sunxi/headsmp.S  |   12 ++
  arch/arm/mach-sunxi/platform.h |  346 
 
  arch/arm/mach-sunxi/platsmp.c  |  166 +++
  arch/arm/mach-sunxi/sunxi.c|4 +
  5 files changed, 530 insertions(+)
  create mode 100644 arch/arm/mach-sunxi/headsmp.S
  create mode 100644 arch/arm/mach-sunxi/platform.h
  create mode 100644 arch/arm/mach-sunxi/platsmp.c


 [...]

 +static struct of_device_id sunxi_cc_ids[] = {
 +   { .compatible = allwinner,sun7i-cc},
 +   { /*sentinel*/ }
 +};

 NAK - There's no binding document for this in mainline or this series.

 +
 +
 +static void enable_aw_cpu(int cpu)
 +{
 +   long paddr;
 +   u32 pwr_reg;
 +
 +   struct device_node *np;
 +   np = of_find_matching_node(NULL, sunxi_cc_ids);
 +   cc_base = of_iomap(np, 0);

 This seems to get called repeatedly in sunxi7i_boot_secondary, so you're
 repeatedly trying to find the cc node and mapping it, but never
 unmapping it. That's both a waste of time and a waste of address space.

 It would be nicer to map this once at the start. That seems simpler than
 stashing the physical address and mapping/unmapping it repeatedly.
 smp_boot_secondary.

 +   pr_debug(cc_base is %x\n, (unsigned int)cc_base);
 +   if (!cc_base) {

 You can use %p to print pointers, without casting to an integer type.

 +   pr_debug(error map cc configure\n);
 +   return;

 As this may be called repeatedly, from a function that can return
 errors, it would be nice to propagate an error code if there's a
 failure.

 +   }
 +
 +   paddr = virt_to_phys(sun7i_secondary_startup);
 +   writel(paddr, cc_base + AW_CPUCFG_P_REG0);
 +/* step1: Assert nCOREPORESET LOW and hold L1RSTDISABLE LOW.
 +   Ensure DBGPWRDUP is held LOW to prevent any external
 +   debug access to the processor.
 +*/
 +/* assert cpu core reset */
 +   writel(0, cc_base + CPUX_RESET_CTL(cpu));
 +/* L1RSTDISABLE hold low */
 +   pwr_reg = readl(cc_base + AW_CPUCFG_GENCTL);
 +   pwr_reg = ~(1cpu);
 +   writel(pwr_reg, cc_base + AW_CPUCFG_GENCTL);
 +/* DBGPWRDUP hold low */
 +   pwr_reg = readl(cc_base + AW_CPUCFG_DBGCTL1);
 +   pwr_reg = ~(1cpu);
 +   writel(pwr_reg, cc_base + AW_CPUCFG_DBGCTL1);
 +
 +/* step2: release power clamp */
 +   writel(0xff, cc_base + AW_CPU1_PWR_CLAMP);
 +   writel(0x7f, cc_base + AW_CPU1_PWR_CLAMP);
 +   writel(0x3f, cc_base + AW_CPU1_PWR_CLAMP);
 +   writel(0x1f, cc_base + AW_CPU1_PWR_CLAMP);
 +   writel(0x0f, cc_base + AW_CPU1_PWR_CLAMP);
 +   writel(0x07, cc_base + AW_CPU1_PWR_CLAMP);
 +   writel(0x03, cc_base + AW_CPU1_PWR_CLAMP);
 +   writel(0x01, cc_base + AW_CPU1_PWR_CLAMP);
 +   writel(0x00, cc_base + AW_CPU1_PWR_CLAMP);
 +   mdelay(10);
 +
 +/* step3: clear power-off gating */
 +   pwr_reg = readl(cc_base + AW_CPU1_PWROFF_REG);
 +   pwr_reg = ~(1);
 +   writel(pwr_reg, cc_base + AW_CPU1_PWROFF_REG);
 +   mdelay(1);
 +
 +/* step4: de-assert core reset */
 +   writel(3, cc_base + CPUX_RESET_CTL(cpu));
 +
 +/* step5: assert DBGPWRDUP signal */
 +   pwr_reg = readl(cc_base + AW_CPUCFG_DBGCTL1);
 +   pwr_reg |= (1cpu);
 +   writel(pwr_reg, cc_base + AW_CPUCFG_DBGCTL1);
 +
 +}
 +
 +
 +
 +static void sunxi7i_smp_init_cpus(void)
 +{
 +   unsigned int i, ncores;
 +
 +
 +   /* HDG: we do not use scu_get_core_count() here as that does not
 +  work on the A20 ? */
 +
 +   /* Read current CP15 Cache Size ID Register */

 Invalid comment. Judging by the encoding, this is the L2CTLR, not the
 CCSIDR.

 +   asm volatile (mrc p15, 1, %0, c9, c0, 2 : =r (ncores));
 +   ncores = ((ncores  24)  0x3) + 1;
 +
 +   pr_debug([%s] ncores=%d\n, __func__, ncores);
 +
 +   for (i = 0; i  ncores; i++)
 +   set_cpu_possible(i, true);
 +
 +}

 Even ignoring the above, as long as your dt is correct
 arm_dt_init_cpu_maps (called from stup_arch) will set the cpus as
 possible (and handles arbitrary MPIDR values as may be the case in
 multi-cluster).

 You don't need this function -- please remove it.

 +
 +/*
 + * for arch/arm/kernel/smp.c:smp_prepare_cpus(unsigned int max_cpus)
 + */
 +static void sunxi7i_smp_prepare_cpus(unsigned int max_cpus)
 +{
 +   /*
 +* HDG: we do not call scu_enable() here as the sun6i source dump has
 +* a modified arch/arm/kernel/smp_scu.c, where scu_enable() is a nop.
 +   */
 +}

 A look in smp.c shows smp_prepare_cpus is perfectly happy to not have a
 smp_prepare_cpus callback. You don't need this function -- please remove
 

[PATCH 1/4] Add a lock that will be needed by the next patch

2012-08-31 Thread Mikulas Patocka
Add a lock that will be needed by the next patch.

I am submitting this as a separate patch, because the act of adding an
extra field to "struct block_device" affects performance significantly.

So that performance change from adding the lock field can be
differentiated from the performance change of locking.

Signed-off-by: Mikulas Patocka 

---
 drivers/char/raw.c |2 -
 fs/block_dev.c |   60 +++--
 include/linux/fs.h |4 +++
 3 files changed, 63 insertions(+), 3 deletions(-)

Index: linux-3.5-rc6-devel/include/linux/fs.h
===
--- linux-3.5-rc6-devel.orig/include/linux/fs.h 2012-07-16 20:20:12.0 
+0200
+++ linux-3.5-rc6-devel/include/linux/fs.h  2012-07-16 01:29:21.0 
+0200
@@ -713,6 +713,8 @@ struct block_device {
int bd_fsfreeze_count;
/* Mutex for freeze */
struct mutexbd_fsfreeze_mutex;
+   /* A semaphore that prevents I/O while block size is being changed */
+   struct rw_semaphore bd_block_size_semaphore;
 };
 
 /*

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] Add a lock that will be needed by the next patch

2012-08-31 Thread Mikulas Patocka
Add a lock that will be needed by the next patch.

I am submitting this as a separate patch, because the act of adding an
extra field to struct block_device affects performance significantly.

So that performance change from adding the lock field can be
differentiated from the performance change of locking.

Signed-off-by: Mikulas Patocka mpato...@redhat.com

---
 drivers/char/raw.c |2 -
 fs/block_dev.c |   60 +++--
 include/linux/fs.h |4 +++
 3 files changed, 63 insertions(+), 3 deletions(-)

Index: linux-3.5-rc6-devel/include/linux/fs.h
===
--- linux-3.5-rc6-devel.orig/include/linux/fs.h 2012-07-16 20:20:12.0 
+0200
+++ linux-3.5-rc6-devel/include/linux/fs.h  2012-07-16 01:29:21.0 
+0200
@@ -713,6 +713,8 @@ struct block_device {
int bd_fsfreeze_count;
/* Mutex for freeze */
struct mutexbd_fsfreeze_mutex;
+   /* A semaphore that prevents I/O while block size is being changed */
+   struct rw_semaphore bd_block_size_semaphore;
 };
 
 /*

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] add task handling notifier: base definitions

2008-01-23 Thread Matt Helsley

On Wed, 2008-01-09 at 09:46 +, Jan Beulich wrote:
> >> +BLOCKING_NOTIFIER_HEAD(task_notifier_list);
> >> +EXPORT_SYMBOL_GPL(task_notifier_list);
> >> +ATOMIC_NOTIFIER_HEAD(atomic_task_notifier_list);
> >> +EXPORT_SYMBOL_GPL(atomic_task_notifier_list);
> >> +
> >
> >When these global notifier lists were proposed years ago folks at SGI
> >loudly objected with concerns over anticipated cache line bouncing on
> >512+ cpu machines. Is that no longer a concern?
> 
> I can't see an alternative, since the serialization is unavoidable.

There are definitely alternatives. Naturally they are all much more
complex than using a single notifier chain. You could do per-cpu chains
for example (ugly, I know..).

> >> @@ -121,6 +127,9 @@ void __put_task_struct(struct task_struc
> >>WARN_ON(atomic_read(>usage));
> >>WARN_ON(tsk == current);
> >> 
> >> +  atomic_notifier_call_chain(_task_notifier_list,
> >> + TASK_DELETE, tsk);
> >> +
> >>security_task_free(tsk);
> >>free_uid(tsk->user);
> >>put_group_info(tsk->group_info);
> >
> >Would the atomic notifier call chain be necessary if you hooked into an
> >earlier section of do_exit() instead?
> 
> I'm afraid it is, as I was told that sleeping in the do_exit() path is not
> generally possible.
> 
> Jan

Odd. Last I checked I thought I saw a bunch of calls in do_exit() that
could sleep. Only in certain sections and at the end did it appear to
prevent sleeping.

Sorry for the late reply.

Cheers,
-Matt Helsley

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] add task handling notifier: base definitions

2008-01-23 Thread Matt Helsley

On Wed, 2008-01-09 at 09:46 +, Jan Beulich wrote:
  +BLOCKING_NOTIFIER_HEAD(task_notifier_list);
  +EXPORT_SYMBOL_GPL(task_notifier_list);
  +ATOMIC_NOTIFIER_HEAD(atomic_task_notifier_list);
  +EXPORT_SYMBOL_GPL(atomic_task_notifier_list);
  +
 
 When these global notifier lists were proposed years ago folks at SGI
 loudly objected with concerns over anticipated cache line bouncing on
 512+ cpu machines. Is that no longer a concern?
 
 I can't see an alternative, since the serialization is unavoidable.

There are definitely alternatives. Naturally they are all much more
complex than using a single notifier chain. You could do per-cpu chains
for example (ugly, I know..).

  @@ -121,6 +127,9 @@ void __put_task_struct(struct task_struc
 WARN_ON(atomic_read(tsk-usage));
 WARN_ON(tsk == current);
  
  +  atomic_notifier_call_chain(atomic_task_notifier_list,
  + TASK_DELETE, tsk);
  +
 security_task_free(tsk);
 free_uid(tsk-user);
 put_group_info(tsk-group_info);
 
 Would the atomic notifier call chain be necessary if you hooked into an
 earlier section of do_exit() instead?
 
 I'm afraid it is, as I was told that sleeping in the do_exit() path is not
 generally possible.
 
 Jan

Odd. Last I checked I thought I saw a bunch of calls in do_exit() that
could sleep. Only in certain sections and at the end did it appear to
prevent sleeping.

Sorry for the late reply.

Cheers,
-Matt Helsley

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] Add missing semicolon to SWAPGS macro

2008-01-21 Thread Eduardo Habkost
Trivial compile fix.

Signed-off-by: Eduardo Habkost <[EMAIL PROTECTED]>
---
 include/asm-x86/paravirt.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
index 52bcd9d..62cecb7 100644
--- a/include/asm-x86/paravirt.h
+++ b/include/asm-x86/paravirt.h
@@ -1329,7 +1329,7 @@ static inline unsigned long __raw_local_irq_save(void)
 #else
 #define SWAPGS \
PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), CLBR_NONE, \
- PV_SAVE_REGS  \
+ PV_SAVE_REGS; \
  call *pv_cpu_ops+PV_CPU_swapgs;   \
  PV_RESTORE_REGS   \
 )
-- 
1.5.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] Add missing semicolon to SWAPGS macro

2008-01-21 Thread Eduardo Habkost
Trivial compile fix.

Signed-off-by: Eduardo Habkost [EMAIL PROTECTED]
---
 include/asm-x86/paravirt.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
index 52bcd9d..62cecb7 100644
--- a/include/asm-x86/paravirt.h
+++ b/include/asm-x86/paravirt.h
@@ -1329,7 +1329,7 @@ static inline unsigned long __raw_local_irq_save(void)
 #else
 #define SWAPGS \
PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), CLBR_NONE, \
- PV_SAVE_REGS  \
+ PV_SAVE_REGS; \
  call *pv_cpu_ops+PV_CPU_swapgs;   \
  PV_RESTORE_REGS   \
 )
-- 
1.5.3.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] add task handling notifier: base definitions

2008-01-09 Thread Jan Beulich
>> +BLOCKING_NOTIFIER_HEAD(task_notifier_list);
>> +EXPORT_SYMBOL_GPL(task_notifier_list);
>> +ATOMIC_NOTIFIER_HEAD(atomic_task_notifier_list);
>> +EXPORT_SYMBOL_GPL(atomic_task_notifier_list);
>> +
>
>When these global notifier lists were proposed years ago folks at SGI
>loudly objected with concerns over anticipated cache line bouncing on
>512+ cpu machines. Is that no longer a concern?

I can't see an alternative, since the serialization is unavoidable.

>> @@ -121,6 +127,9 @@ void __put_task_struct(struct task_struc
>>  WARN_ON(atomic_read(>usage));
>>  WARN_ON(tsk == current);
>> 
>> +atomic_notifier_call_chain(_task_notifier_list,
>> +   TASK_DELETE, tsk);
>> +
>>  security_task_free(tsk);
>>  free_uid(tsk->user);
>>  put_group_info(tsk->group_info);
>
>Would the atomic notifier call chain be necessary if you hooked into an
>earlier section of do_exit() instead?

I'm afraid it is, as I was told that sleeping in the do_exit() path is not
generally possible.

Jan

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] add task handling notifier: base definitions

2008-01-09 Thread Jan Beulich
 +BLOCKING_NOTIFIER_HEAD(task_notifier_list);
 +EXPORT_SYMBOL_GPL(task_notifier_list);
 +ATOMIC_NOTIFIER_HEAD(atomic_task_notifier_list);
 +EXPORT_SYMBOL_GPL(atomic_task_notifier_list);
 +

When these global notifier lists were proposed years ago folks at SGI
loudly objected with concerns over anticipated cache line bouncing on
512+ cpu machines. Is that no longer a concern?

I can't see an alternative, since the serialization is unavoidable.

 @@ -121,6 +127,9 @@ void __put_task_struct(struct task_struc
  WARN_ON(atomic_read(tsk-usage));
  WARN_ON(tsk == current);
 
 +atomic_notifier_call_chain(atomic_task_notifier_list,
 +   TASK_DELETE, tsk);
 +
  security_task_free(tsk);
  free_uid(tsk-user);
  put_group_info(tsk-group_info);

Would the atomic notifier call chain be necessary if you hooked into an
earlier section of do_exit() instead?

I'm afraid it is, as I was told that sleeping in the do_exit() path is not
generally possible.

Jan

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] add task handling notifier: base definitions

2008-01-08 Thread Matthew Helsley
On Thu, 2007-12-20 at 13:12 +, Jan Beulich wrote:
> This is the base patch, adding notification for task creation and
> deletion.
> 
> Signed-off-by: Jan Beulich <[EMAIL PROTECTED]>
> ---
>  include/linux/sched.h |8 +++-
>  kernel/fork.c |   11 +++
>  2 files changed, 18 insertions(+), 1 deletion(-)
> 
> --- 2.6.24-rc5-notify-task.orig/include/linux/sched.h
> +++ 2.6.24-rc5-notify-task/include/linux/sched.h
> @@ -80,7 +80,7 @@ struct sched_param {
>  #include 
>  #include 
>  #include 
> -
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -1700,6 +1700,12 @@ extern int do_execve(char *, char __user
>  extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned 
> long, int __user *, int __user *);
>  struct task_struct *fork_idle(int);
> 
> +#define TASK_NEW 1
> +#define TASK_DELETE 2
> +
> +extern struct blocking_notifier_head task_notifier_list;
> +extern struct atomic_notifier_head atomic_task_notifier_list;
> +
>  extern void set_task_comm(struct task_struct *tsk, char *from);
>  extern void get_task_comm(char *to, struct task_struct *tsk);
> 
> --- 2.6.24-rc5-notify-task.orig/kernel/fork.c
> +++ 2.6.24-rc5-notify-task/kernel/fork.c
> @@ -46,6 +46,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -71,6 +72,11 @@ DEFINE_PER_CPU(unsigned long, process_co
> 
>  __cacheline_aligned DEFINE_RWLOCK(tasklist_lock);  /* outer */
> 
> +BLOCKING_NOTIFIER_HEAD(task_notifier_list);
> +EXPORT_SYMBOL_GPL(task_notifier_list);
> +ATOMIC_NOTIFIER_HEAD(atomic_task_notifier_list);
> +EXPORT_SYMBOL_GPL(atomic_task_notifier_list);
> +

When these global notifier lists were proposed years ago folks at SGI
loudly objected with concerns over anticipated cache line bouncing on
512+ cpu machines. Is that no longer a concern?

>  int nr_processes(void)
>  {
>   int cpu;
> @@ -121,6 +127,9 @@ void __put_task_struct(struct task_struc
>   WARN_ON(atomic_read(>usage));
>   WARN_ON(tsk == current);
> 
> + atomic_notifier_call_chain(_task_notifier_list,
> +TASK_DELETE, tsk);
> +
>   security_task_free(tsk);
>   free_uid(tsk->user);
>   put_group_info(tsk->group_info);

Would the atomic notifier call chain be necessary if you hooked into an
earlier section of do_exit() instead?

Cheers,
-Matt Helsley

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] add task handling notifier: base definitions

2008-01-08 Thread Matthew Helsley
On Thu, 2007-12-20 at 13:12 +, Jan Beulich wrote:
 This is the base patch, adding notification for task creation and
 deletion.
 
 Signed-off-by: Jan Beulich [EMAIL PROTECTED]
 ---
  include/linux/sched.h |8 +++-
  kernel/fork.c |   11 +++
  2 files changed, 18 insertions(+), 1 deletion(-)
 
 --- 2.6.24-rc5-notify-task.orig/include/linux/sched.h
 +++ 2.6.24-rc5-notify-task/include/linux/sched.h
 @@ -80,7 +80,7 @@ struct sched_param {
  #include linux/rcupdate.h
  #include linux/futex.h
  #include linux/rtmutex.h
 -
 +#include linux/notifier.h
  #include linux/time.h
  #include linux/param.h
  #include linux/resource.h
 @@ -1700,6 +1700,12 @@ extern int do_execve(char *, char __user
  extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned 
 long, int __user *, int __user *);
  struct task_struct *fork_idle(int);
 
 +#define TASK_NEW 1
 +#define TASK_DELETE 2
 +
 +extern struct blocking_notifier_head task_notifier_list;
 +extern struct atomic_notifier_head atomic_task_notifier_list;
 +
  extern void set_task_comm(struct task_struct *tsk, char *from);
  extern void get_task_comm(char *to, struct task_struct *tsk);
 
 --- 2.6.24-rc5-notify-task.orig/kernel/fork.c
 +++ 2.6.24-rc5-notify-task/kernel/fork.c
 @@ -46,6 +46,7 @@
  #include linux/tsacct_kern.h
  #include linux/cn_proc.h
  #include linux/freezer.h
 +#include linux/notifier.h
  #include linux/delayacct.h
  #include linux/taskstats_kern.h
  #include linux/random.h
 @@ -71,6 +72,11 @@ DEFINE_PER_CPU(unsigned long, process_co
 
  __cacheline_aligned DEFINE_RWLOCK(tasklist_lock);  /* outer */
 
 +BLOCKING_NOTIFIER_HEAD(task_notifier_list);
 +EXPORT_SYMBOL_GPL(task_notifier_list);
 +ATOMIC_NOTIFIER_HEAD(atomic_task_notifier_list);
 +EXPORT_SYMBOL_GPL(atomic_task_notifier_list);
 +

When these global notifier lists were proposed years ago folks at SGI
loudly objected with concerns over anticipated cache line bouncing on
512+ cpu machines. Is that no longer a concern?

  int nr_processes(void)
  {
   int cpu;
 @@ -121,6 +127,9 @@ void __put_task_struct(struct task_struc
   WARN_ON(atomic_read(tsk-usage));
   WARN_ON(tsk == current);
 
 + atomic_notifier_call_chain(atomic_task_notifier_list,
 +TASK_DELETE, tsk);
 +
   security_task_free(tsk);
   free_uid(tsk-user);
   put_group_info(tsk-group_info);

Would the atomic notifier call chain be necessary if you hooked into an
earlier section of do_exit() instead?

Cheers,
-Matt Helsley

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] add task handling notifier: base definitions

2007-12-21 Thread Andi Kleen
"Jan Beulich" <[EMAIL PROTECTED]> writes:

> This is the base patch, adding notification for task creation and
> deletion.

I like the basic concept. At some point I suspect we'll even need
a per task dynamic data allocator, that would remove even
more cruft.

Could you change the block notifier calls first to not take their lock
when there is nothing in the list (the common case)? It is 
weird that they don't already do this, but they should definitely
here.

I think the use of the blocking/atomic notifiers needs some comment.
I think I understand why you did it -- exit atomic because sleeping
in exit can be illegal and blocking for fork to allow GFP_KERNEL
allocations -- but that should be documented somewhere.

-Andi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] add task handling notifier: base definitions

2007-12-21 Thread Andi Kleen
Jan Beulich [EMAIL PROTECTED] writes:

 This is the base patch, adding notification for task creation and
 deletion.

I like the basic concept. At some point I suspect we'll even need
a per task dynamic data allocator, that would remove even
more cruft.

Could you change the block notifier calls first to not take their lock
when there is nothing in the list (the common case)? It is 
weird that they don't already do this, but they should definitely
here.

I think the use of the blocking/atomic notifiers needs some comment.
I think I understand why you did it -- exit atomic because sleeping
in exit can be illegal and blocking for fork to allow GFP_KERNEL
allocations -- but that should be documented somewhere.

-Andi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] add task handling notifier: base definitions

2007-12-20 Thread Jan Beulich
This is the base patch, adding notification for task creation and
deletion.

Signed-off-by: Jan Beulich <[EMAIL PROTECTED]>
---
 include/linux/sched.h |8 +++-
 kernel/fork.c |   11 +++
 2 files changed, 18 insertions(+), 1 deletion(-)

--- 2.6.24-rc5-notify-task.orig/include/linux/sched.h
+++ 2.6.24-rc5-notify-task/include/linux/sched.h
@@ -80,7 +80,7 @@ struct sched_param {
 #include 
 #include 
 #include 
-
+#include 
 #include 
 #include 
 #include 
@@ -1700,6 +1700,12 @@ extern int do_execve(char *, char __user
 extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned 
long, int __user *, int __user *);
 struct task_struct *fork_idle(int);
 
+#define TASK_NEW 1
+#define TASK_DELETE 2
+
+extern struct blocking_notifier_head task_notifier_list;
+extern struct atomic_notifier_head atomic_task_notifier_list;
+
 extern void set_task_comm(struct task_struct *tsk, char *from);
 extern void get_task_comm(char *to, struct task_struct *tsk);
 
--- 2.6.24-rc5-notify-task.orig/kernel/fork.c
+++ 2.6.24-rc5-notify-task/kernel/fork.c
@@ -46,6 +46,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -71,6 +72,11 @@ DEFINE_PER_CPU(unsigned long, process_co
 
 __cacheline_aligned DEFINE_RWLOCK(tasklist_lock);  /* outer */
 
+BLOCKING_NOTIFIER_HEAD(task_notifier_list);
+EXPORT_SYMBOL_GPL(task_notifier_list);
+ATOMIC_NOTIFIER_HEAD(atomic_task_notifier_list);
+EXPORT_SYMBOL_GPL(atomic_task_notifier_list);
+
 int nr_processes(void)
 {
int cpu;
@@ -121,6 +127,9 @@ void __put_task_struct(struct task_struc
WARN_ON(atomic_read(>usage));
WARN_ON(tsk == current);
 
+   atomic_notifier_call_chain(_task_notifier_list,
+  TASK_DELETE, tsk);
+
security_task_free(tsk);
free_uid(tsk->user);
put_group_info(tsk->group_info);
@@ -1450,6 +1459,8 @@ long do_fork(unsigned long clone_flags,
set_tsk_thread_flag(p, TIF_SIGPENDING);
}
 
+   blocking_notifier_call_chain(_notifier_list, TASK_NEW, p);
+
if (!(clone_flags & CLONE_STOPPED))
wake_up_new_task(p, clone_flags);
else



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] add task handling notifier: base definitions

2007-12-20 Thread Jan Beulich
This is the base patch, adding notification for task creation and
deletion.

Signed-off-by: Jan Beulich [EMAIL PROTECTED]
---
 include/linux/sched.h |8 +++-
 kernel/fork.c |   11 +++
 2 files changed, 18 insertions(+), 1 deletion(-)

--- 2.6.24-rc5-notify-task.orig/include/linux/sched.h
+++ 2.6.24-rc5-notify-task/include/linux/sched.h
@@ -80,7 +80,7 @@ struct sched_param {
 #include linux/rcupdate.h
 #include linux/futex.h
 #include linux/rtmutex.h
-
+#include linux/notifier.h
 #include linux/time.h
 #include linux/param.h
 #include linux/resource.h
@@ -1700,6 +1700,12 @@ extern int do_execve(char *, char __user
 extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned 
long, int __user *, int __user *);
 struct task_struct *fork_idle(int);
 
+#define TASK_NEW 1
+#define TASK_DELETE 2
+
+extern struct blocking_notifier_head task_notifier_list;
+extern struct atomic_notifier_head atomic_task_notifier_list;
+
 extern void set_task_comm(struct task_struct *tsk, char *from);
 extern void get_task_comm(char *to, struct task_struct *tsk);
 
--- 2.6.24-rc5-notify-task.orig/kernel/fork.c
+++ 2.6.24-rc5-notify-task/kernel/fork.c
@@ -46,6 +46,7 @@
 #include linux/tsacct_kern.h
 #include linux/cn_proc.h
 #include linux/freezer.h
+#include linux/notifier.h
 #include linux/delayacct.h
 #include linux/taskstats_kern.h
 #include linux/random.h
@@ -71,6 +72,11 @@ DEFINE_PER_CPU(unsigned long, process_co
 
 __cacheline_aligned DEFINE_RWLOCK(tasklist_lock);  /* outer */
 
+BLOCKING_NOTIFIER_HEAD(task_notifier_list);
+EXPORT_SYMBOL_GPL(task_notifier_list);
+ATOMIC_NOTIFIER_HEAD(atomic_task_notifier_list);
+EXPORT_SYMBOL_GPL(atomic_task_notifier_list);
+
 int nr_processes(void)
 {
int cpu;
@@ -121,6 +127,9 @@ void __put_task_struct(struct task_struc
WARN_ON(atomic_read(tsk-usage));
WARN_ON(tsk == current);
 
+   atomic_notifier_call_chain(atomic_task_notifier_list,
+  TASK_DELETE, tsk);
+
security_task_free(tsk);
free_uid(tsk-user);
put_group_info(tsk-group_info);
@@ -1450,6 +1459,8 @@ long do_fork(unsigned long clone_flags,
set_tsk_thread_flag(p, TIF_SIGPENDING);
}
 
+   blocking_notifier_call_chain(task_notifier_list, TASK_NEW, p);
+
if (!(clone_flags  CLONE_STOPPED))
wake_up_new_task(p, clone_flags);
else



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] Add ETHTOOL_[GS]FLAGS sub-ioctls

2007-08-15 Thread David Miller
From: Jeff Garzik <[EMAIL PROTECTED]>
Date: Fri, 10 Aug 2007 16:56:17 -0400

> All this is currently checked into the 'eflags' branch of
> git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git
> 
> But when everybody is happy with it, IMO we should get it into 
> net-2.6.24.git, as it enables LRO.

I've backed out the ETHTOOL LRO stuff from Auke, and applied your
patches to net-2.6.24

We can get rid of that NETIF_F_LRO thing, since as you observed
it is indeed superfluous.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] Add ETHTOOL_[GS]FLAGS sub-ioctls

2007-08-15 Thread David Miller
From: Jeff Garzik [EMAIL PROTECTED]
Date: Fri, 10 Aug 2007 16:56:17 -0400

 All this is currently checked into the 'eflags' branch of
 git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git
 
 But when everybody is happy with it, IMO we should get it into 
 net-2.6.24.git, as it enables LRO.

I've backed out the ETHTOOL LRO stuff from Auke, and applied your
patches to net-2.6.24

We can get rid of that NETIF_F_LRO thing, since as you observed
it is indeed superfluous.

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] Add ETHTOOL_[GS]FLAGS sub-ioctls

2007-08-14 Thread Kok, Auke

Rick Jones wrote:

David Miller wrote:

From: Ben Greear <[EMAIL PROTECTED]>
Date: Fri, 10 Aug 2007 15:40:02 -0700



For GSO on output, is there a generic fallback for any driver that
does not specifically implement GSO?


Absolutely, in fact that's mainly what it's there for.

I don't think there is any issue.  The knob is there via
ethtool for people who really want to disable it.


Just to be paranoid (who me?) we are then at a point where what happened 
a couple months ago with forwarding between 10G and IPoIB won't happen 
again - where things failed because a 10G NIC had LRO enabled by default?


we still have the NETIF_F_LRO flag which Jeff will keep around. Perhaps the 
IPoIB code can force this to _off_ when setting it up? (or at least warn about it).


Auke
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] Add ETHTOOL_[GS]FLAGS sub-ioctls

2007-08-14 Thread Kok, Auke

Rick Jones wrote:

David Miller wrote:

From: Ben Greear [EMAIL PROTECTED]
Date: Fri, 10 Aug 2007 15:40:02 -0700



For GSO on output, is there a generic fallback for any driver that
does not specifically implement GSO?


Absolutely, in fact that's mainly what it's there for.

I don't think there is any issue.  The knob is there via
ethtool for people who really want to disable it.


Just to be paranoid (who me?) we are then at a point where what happened 
a couple months ago with forwarding between 10G and IPoIB won't happen 
again - where things failed because a 10G NIC had LRO enabled by default?


we still have the NETIF_F_LRO flag which Jeff will keep around. Perhaps the 
IPoIB code can force this to _off_ when setting it up? (or at least warn about it).


Auke
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] Add ETHTOOL_[GS]FLAGS sub-ioctls

2007-08-10 Thread Rick Jones

David Miller wrote:

From: Ben Greear <[EMAIL PROTECTED]>
Date: Fri, 10 Aug 2007 15:40:02 -0700



For GSO on output, is there a generic fallback for any driver that
does not specifically implement GSO?



Absolutely, in fact that's mainly what it's there for.

I don't think there is any issue.  The knob is there via
ethtool for people who really want to disable it.


Just to be paranoid (who me?) we are then at a point where what happened 
a couple months ago with forwarding between 10G and IPoIB won't happen 
again - where things failed because a 10G NIC had LRO enabled by default?


rick jones
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] Add ETHTOOL_[GS]FLAGS sub-ioctls

2007-08-10 Thread David Miller
From: Ben Greear <[EMAIL PROTECTED]>
Date: Fri, 10 Aug 2007 15:40:02 -0700

> For GSO on output, is there a generic fallback for any driver that
> does not specifically implement GSO?

Absolutely, in fact that's mainly what it's there for.

I don't think there is any issue.  The knob is there via
ethtool for people who really want to disable it.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] Add ETHTOOL_[GS]FLAGS sub-ioctls

2007-08-10 Thread Ben Greear

David Miller wrote:

From: Ben Greear <[EMAIL PROTECTED]>



I believe LRO is going to have to be disabled for routing/bridging,
so the stack will probably need to become aware of it at some point...


The packet will be GSO'd on output I believe, so it won't
break anything.

Alternatively, we could make the driver only LRO accumulate if the
packet is unicast and matches one of the MAC's programmed into the
chip.


I think even this would fail if you are doing something clever with
NAT or other iptables stuff.  Probably we're going to have to put this
in the hands of the users..who hopefully can determine whether they
can allow LRO or not...

For GSO on output, is there a generic fallback for any driver that
does not specifically implement GSO?

Thanks,
Ben

--
Ben Greear <[EMAIL PROTECTED]>
Candela Technologies Inc  http://www.candelatech.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] Add ETHTOOL_[GS]FLAGS sub-ioctls

2007-08-10 Thread David Miller
From: Ben Greear <[EMAIL PROTECTED]>
Date: Fri, 10 Aug 2007 14:11:24 -0700

> Jeff Garzik wrote:
> 
> > This patch copies Auke in adding NETIF_F_LRO.  Is that just for 
> > temporary merging, or does the net core really not touch it at all?
> > 
> > Because, logically, if NETIF_F_LRO exists nowhere else but this patch, 
> > we should not add it to dev->features.  LRO knowledge can be contained 
> > entirely within the driver, if the net core never tests NETIF_F_LRO.
> > 
> > I haven't reviewed the other NETIF_F_XXX flags, but, that logic can be 
> > applied to any other NETIF_F_XXX flag:  if the net stack isn't using it, 
> > it's a piece of information specific to that driver.
> 
> I believe LRO is going to have to be disabled for routing/bridging,
> so the stack will probably need to become aware of it at some point...

The packet will be GSO'd on output I believe, so it won't
break anything.

Alternatively, we could make the driver only LRO accumulate if the
packet is unicast and matches one of the MAC's programmed into the
chip.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] Add ETHTOOL_[GS]FLAGS sub-ioctls

2007-08-10 Thread Ben Greear

Jeff Garzik wrote:

This patch copies Auke in adding NETIF_F_LRO.  Is that just for 
temporary merging, or does the net core really not touch it at all?


Because, logically, if NETIF_F_LRO exists nowhere else but this patch, 
we should not add it to dev->features.  LRO knowledge can be contained 
entirely within the driver, if the net core never tests NETIF_F_LRO.


I haven't reviewed the other NETIF_F_XXX flags, but, that logic can be 
applied to any other NETIF_F_XXX flag:  if the net stack isn't using it, 
it's a piece of information specific to that driver.


I believe LRO is going to have to be disabled for routing/bridging,
so the stack will probably need to become aware of it at some point...

Thanks,
Ben


--
Ben Greear <[EMAIL PROTECTED]>
Candela Technologies Inc  http://www.candelatech.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] Add ETHTOOL_[GS]FLAGS sub-ioctls

2007-08-10 Thread Jeff Garzik

Jeff Garzik wrote:

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 4a616d7..559a4dc 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -341,6 +341,7 @@ struct net_device
 #define NETIF_F_GSO2048/* Enable software GSO. */
 #define NETIF_F_LLTX   4096/* LockLess TX */
 #define NETIF_F_MULTI_QUEUE16384   /* Has multiple TX/RX queues */
+#define NETIF_F_LRO32768   /* large receive offload */
 
 	/* Segmentation offload features */

 #define NETIF_F_GSO_SHIFT  16
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 2ab0a60..6e8563e 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -109,6 +109,32 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data)
return 0;
 }
 
+/* the following list of flags are the same as their associated

+ * NETIF_F_xxx values in include/linux/netdevice.h
+ */
+static const u32 flags_dup_features =
+   ETH_FLAG_LRO;
+
+u32 ethtool_op_get_flags(struct net_device *dev)
+{
+   /* in the future, this function will probably contain additional
+* handling for flags which are not so easily handled
+* by a simple masking operation
+*/
+   
+   return dev->features & flags_dup_features;
+}
+
+int ethtool_op_set_flags(struct net_device *dev, u32 data)
+{
+   if (data & ETH_FLAG_LRO)
+   dev->features |= NETIF_F_LRO;
+   else
+   dev->features &= ~NETIF_F_LRO;
+


And, a side discussion:

This patch copies Auke in adding NETIF_F_LRO.  Is that just for 
temporary merging, or does the net core really not touch it at all?


Because, logically, if NETIF_F_LRO exists nowhere else but this patch, 
we should not add it to dev->features.  LRO knowledge can be contained 
entirely within the driver, if the net core never tests NETIF_F_LRO.


I haven't reviewed the other NETIF_F_XXX flags, but, that logic can be 
applied to any other NETIF_F_XXX flag:  if the net stack isn't using it, 
it's a piece of information specific to that driver.


Jeff


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] Add ETHTOOL_[GS]FLAGS sub-ioctls

2007-08-10 Thread Jeff Garzik

All this is currently checked into the 'eflags' branch of
git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git

But when everybody is happy with it, IMO we should get it into 
net-2.6.24.git, as it enables LRO.


Jeff


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] Add ETHTOOL_[GS]FLAGS sub-ioctls

2007-08-10 Thread Jeff Garzik

Also, adds support for the first flag, LRO.

Earlier version of this patch posted about 12 hours ago.


commit 84bf82f38dacde0fa86986e23c061728e819810e
Author: Jeff Garzik <[EMAIL PROTECTED]>
Date:   Fri Aug 10 05:27:23 2007 -0400

[ETHTOOL] Add ETHTOOL_[GS]FLAGS sub-ioctls

Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>

 include/linux/ethtool.h   |   21 +++
 include/linux/netdevice.h |1 
 net/core/ethtool.c|   61 ++
 3 files changed, 83 insertions(+)

84bf82f38dacde0fa86986e23c061728e819810e
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 23ccea8..0e5de2f 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -256,6 +256,19 @@ struct ethtool_perm_addr {
__u8data[0];
 };
 
+/* boolean flags controlling per-interface behavior characteristics.
+ * When reading, the flag indicates whether or not a certain behavior
+ * is enabled/present.  When writing, the flag indicates whether
+ * or not the driver should turn on (set) or off (clear) a behavior.
+ *
+ * Some behaviors may read-only (unconditionally absent or present).
+ * If such is the case, return EINVAL in the set-flags operation if the
+ * flag differs from the read-only value.
+ */
+enum ethtool_flags {
+   ETH_FLAG_LRO= (1 << 15),/* LRO is enabled */
+};
+
 #ifdef __KERNEL__
 
 struct net_device;
@@ -272,6 +285,8 @@ u32 ethtool_op_get_tso(struct net_device *dev);
 int ethtool_op_set_tso(struct net_device *dev, u32 data);
 u32 ethtool_op_get_ufo(struct net_device *dev);
 int ethtool_op_set_ufo(struct net_device *dev, u32 data);
+u32 ethtool_op_get_flags(struct net_device *dev);
+int ethtool_op_set_flags(struct net_device *dev, u32 data);
 
 /**
  * _ops - Alter and report network device settings
@@ -307,6 +322,8 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data);
  * get_strings: Return a set of strings that describe the requested objects 
  * phys_id: Identify the device
  * get_stats: Return statistics about the device
+ * get_flags: get 32-bit flags bitmap
+ * set_flags: set 32-bit flags bitmap
  * 
  * Description:
  *
@@ -369,6 +386,8 @@ struct ethtool_ops {
void(*complete)(struct net_device *);
u32 (*get_ufo)(struct net_device *);
int (*set_ufo)(struct net_device *, u32);
+   u32 (*get_flags)(struct net_device *);
+   int (*set_flags)(struct net_device *, u32);
 };
 #endif /* __KERNEL__ */
 
@@ -410,6 +429,8 @@ struct ethtool_ops {
 #define ETHTOOL_SUFO   0x0022 /* Set UFO enable (ethtool_value) */
 #define ETHTOOL_GGSO   0x0023 /* Get GSO enable (ethtool_value) */
 #define ETHTOOL_SGSO   0x0024 /* Set GSO enable (ethtool_value) */
+#define ETHTOOL_GFLAGS 0x0025 /* Get flags bitmap(ethtool_value) */
+#define ETHTOOL_SFLAGS 0x0026 /* Set flags bitmap(ethtool_value) */
 
 /* compatibility with older code */
 #define SPARC_ETH_GSET ETHTOOL_GSET
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 4a616d7..559a4dc 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -341,6 +341,7 @@ struct net_device
 #define NETIF_F_GSO2048/* Enable software GSO. */
 #define NETIF_F_LLTX   4096/* LockLess TX */
 #define NETIF_F_MULTI_QUEUE16384   /* Has multiple TX/RX queues */
+#define NETIF_F_LRO32768   /* large receive offload */
 
/* Segmentation offload features */
 #define NETIF_F_GSO_SHIFT  16
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 2ab0a60..6e8563e 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -109,6 +109,32 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data)
return 0;
 }
 
+/* the following list of flags are the same as their associated
+ * NETIF_F_xxx values in include/linux/netdevice.h
+ */
+static const u32 flags_dup_features =
+   ETH_FLAG_LRO;
+
+u32 ethtool_op_get_flags(struct net_device *dev)
+{
+   /* in the future, this function will probably contain additional
+* handling for flags which are not so easily handled
+* by a simple masking operation
+*/
+   
+   return dev->features & flags_dup_features;
+}
+
+int ethtool_op_set_flags(struct net_device *dev, u32 data)
+{
+   if (data & ETH_FLAG_LRO)
+   dev->features |= NETIF_F_LRO;
+   else
+   dev->features &= ~NETIF_F_LRO;
+
+   return 0;
+}
+
 /* Handlers for each ethtool command */
 
 static int ethtool_get_settings(struct net_device *dev, void __user *useraddr)
@@ -783,6 +809,33 @@ static int ethtool_get_perm_addr(struct net_device *dev, 
void __user *useraddr)
return 0;
 }
 
+static int ethtool_get_flags(struct net_device *dev, char __user *useraddr)
+{
+   struct ethtool_value edata = { ETHTOOL_GFLAGS };
+
+   if (!dev->ethtool_ops->get_flags)
+   return -EOPNOTSUPP;
+
+

Re: [PATCH 1/4] Add ETHTOOL_[GS]FLAGS sub-ioctls

2007-08-10 Thread Jeff Garzik

All this is currently checked into the 'eflags' branch of
git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git

But when everybody is happy with it, IMO we should get it into 
net-2.6.24.git, as it enables LRO.


Jeff


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] Add ETHTOOL_[GS]FLAGS sub-ioctls

2007-08-10 Thread Ben Greear

Jeff Garzik wrote:

This patch copies Auke in adding NETIF_F_LRO.  Is that just for 
temporary merging, or does the net core really not touch it at all?


Because, logically, if NETIF_F_LRO exists nowhere else but this patch, 
we should not add it to dev-features.  LRO knowledge can be contained 
entirely within the driver, if the net core never tests NETIF_F_LRO.


I haven't reviewed the other NETIF_F_XXX flags, but, that logic can be 
applied to any other NETIF_F_XXX flag:  if the net stack isn't using it, 
it's a piece of information specific to that driver.


I believe LRO is going to have to be disabled for routing/bridging,
so the stack will probably need to become aware of it at some point...

Thanks,
Ben


--
Ben Greear [EMAIL PROTECTED]
Candela Technologies Inc  http://www.candelatech.com

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] Add ETHTOOL_[GS]FLAGS sub-ioctls

2007-08-10 Thread Jeff Garzik

Jeff Garzik wrote:

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 4a616d7..559a4dc 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -341,6 +341,7 @@ struct net_device
 #define NETIF_F_GSO2048/* Enable software GSO. */
 #define NETIF_F_LLTX   4096/* LockLess TX */
 #define NETIF_F_MULTI_QUEUE16384   /* Has multiple TX/RX queues */
+#define NETIF_F_LRO32768   /* large receive offload */
 
 	/* Segmentation offload features */

 #define NETIF_F_GSO_SHIFT  16
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 2ab0a60..6e8563e 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -109,6 +109,32 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data)
return 0;
 }
 
+/* the following list of flags are the same as their associated

+ * NETIF_F_xxx values in include/linux/netdevice.h
+ */
+static const u32 flags_dup_features =
+   ETH_FLAG_LRO;
+
+u32 ethtool_op_get_flags(struct net_device *dev)
+{
+   /* in the future, this function will probably contain additional
+* handling for flags which are not so easily handled
+* by a simple masking operation
+*/
+   
+   return dev-features  flags_dup_features;
+}
+
+int ethtool_op_set_flags(struct net_device *dev, u32 data)
+{
+   if (data  ETH_FLAG_LRO)
+   dev-features |= NETIF_F_LRO;
+   else
+   dev-features = ~NETIF_F_LRO;
+


And, a side discussion:

This patch copies Auke in adding NETIF_F_LRO.  Is that just for 
temporary merging, or does the net core really not touch it at all?


Because, logically, if NETIF_F_LRO exists nowhere else but this patch, 
we should not add it to dev-features.  LRO knowledge can be contained 
entirely within the driver, if the net core never tests NETIF_F_LRO.


I haven't reviewed the other NETIF_F_XXX flags, but, that logic can be 
applied to any other NETIF_F_XXX flag:  if the net stack isn't using it, 
it's a piece of information specific to that driver.


Jeff


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] Add ETHTOOL_[GS]FLAGS sub-ioctls

2007-08-10 Thread Jeff Garzik

Also, adds support for the first flag, LRO.

Earlier version of this patch posted about 12 hours ago.


commit 84bf82f38dacde0fa86986e23c061728e819810e
Author: Jeff Garzik [EMAIL PROTECTED]
Date:   Fri Aug 10 05:27:23 2007 -0400

[ETHTOOL] Add ETHTOOL_[GS]FLAGS sub-ioctls

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]

 include/linux/ethtool.h   |   21 +++
 include/linux/netdevice.h |1 
 net/core/ethtool.c|   61 ++
 3 files changed, 83 insertions(+)

84bf82f38dacde0fa86986e23c061728e819810e
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 23ccea8..0e5de2f 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -256,6 +256,19 @@ struct ethtool_perm_addr {
__u8data[0];
 };
 
+/* boolean flags controlling per-interface behavior characteristics.
+ * When reading, the flag indicates whether or not a certain behavior
+ * is enabled/present.  When writing, the flag indicates whether
+ * or not the driver should turn on (set) or off (clear) a behavior.
+ *
+ * Some behaviors may read-only (unconditionally absent or present).
+ * If such is the case, return EINVAL in the set-flags operation if the
+ * flag differs from the read-only value.
+ */
+enum ethtool_flags {
+   ETH_FLAG_LRO= (1  15),/* LRO is enabled */
+};
+
 #ifdef __KERNEL__
 
 struct net_device;
@@ -272,6 +285,8 @@ u32 ethtool_op_get_tso(struct net_device *dev);
 int ethtool_op_set_tso(struct net_device *dev, u32 data);
 u32 ethtool_op_get_ufo(struct net_device *dev);
 int ethtool_op_set_ufo(struct net_device *dev, u32 data);
+u32 ethtool_op_get_flags(struct net_device *dev);
+int ethtool_op_set_flags(struct net_device *dev, u32 data);
 
 /**
  * ethtool_ops - Alter and report network device settings
@@ -307,6 +322,8 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data);
  * get_strings: Return a set of strings that describe the requested objects 
  * phys_id: Identify the device
  * get_stats: Return statistics about the device
+ * get_flags: get 32-bit flags bitmap
+ * set_flags: set 32-bit flags bitmap
  * 
  * Description:
  *
@@ -369,6 +386,8 @@ struct ethtool_ops {
void(*complete)(struct net_device *);
u32 (*get_ufo)(struct net_device *);
int (*set_ufo)(struct net_device *, u32);
+   u32 (*get_flags)(struct net_device *);
+   int (*set_flags)(struct net_device *, u32);
 };
 #endif /* __KERNEL__ */
 
@@ -410,6 +429,8 @@ struct ethtool_ops {
 #define ETHTOOL_SUFO   0x0022 /* Set UFO enable (ethtool_value) */
 #define ETHTOOL_GGSO   0x0023 /* Get GSO enable (ethtool_value) */
 #define ETHTOOL_SGSO   0x0024 /* Set GSO enable (ethtool_value) */
+#define ETHTOOL_GFLAGS 0x0025 /* Get flags bitmap(ethtool_value) */
+#define ETHTOOL_SFLAGS 0x0026 /* Set flags bitmap(ethtool_value) */
 
 /* compatibility with older code */
 #define SPARC_ETH_GSET ETHTOOL_GSET
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 4a616d7..559a4dc 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -341,6 +341,7 @@ struct net_device
 #define NETIF_F_GSO2048/* Enable software GSO. */
 #define NETIF_F_LLTX   4096/* LockLess TX */
 #define NETIF_F_MULTI_QUEUE16384   /* Has multiple TX/RX queues */
+#define NETIF_F_LRO32768   /* large receive offload */
 
/* Segmentation offload features */
 #define NETIF_F_GSO_SHIFT  16
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 2ab0a60..6e8563e 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -109,6 +109,32 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data)
return 0;
 }
 
+/* the following list of flags are the same as their associated
+ * NETIF_F_xxx values in include/linux/netdevice.h
+ */
+static const u32 flags_dup_features =
+   ETH_FLAG_LRO;
+
+u32 ethtool_op_get_flags(struct net_device *dev)
+{
+   /* in the future, this function will probably contain additional
+* handling for flags which are not so easily handled
+* by a simple masking operation
+*/
+   
+   return dev-features  flags_dup_features;
+}
+
+int ethtool_op_set_flags(struct net_device *dev, u32 data)
+{
+   if (data  ETH_FLAG_LRO)
+   dev-features |= NETIF_F_LRO;
+   else
+   dev-features = ~NETIF_F_LRO;
+
+   return 0;
+}
+
 /* Handlers for each ethtool command */
 
 static int ethtool_get_settings(struct net_device *dev, void __user *useraddr)
@@ -783,6 +809,33 @@ static int ethtool_get_perm_addr(struct net_device *dev, 
void __user *useraddr)
return 0;
 }
 
+static int ethtool_get_flags(struct net_device *dev, char __user *useraddr)
+{
+   struct ethtool_value edata = { ETHTOOL_GFLAGS };
+
+   if (!dev-ethtool_ops-get_flags)
+   return -EOPNOTSUPP;
+
+   

Re: [PATCH 1/4] Add ETHTOOL_[GS]FLAGS sub-ioctls

2007-08-10 Thread David Miller
From: Ben Greear [EMAIL PROTECTED]
Date: Fri, 10 Aug 2007 14:11:24 -0700

 Jeff Garzik wrote:
 
  This patch copies Auke in adding NETIF_F_LRO.  Is that just for 
  temporary merging, or does the net core really not touch it at all?
  
  Because, logically, if NETIF_F_LRO exists nowhere else but this patch, 
  we should not add it to dev-features.  LRO knowledge can be contained 
  entirely within the driver, if the net core never tests NETIF_F_LRO.
  
  I haven't reviewed the other NETIF_F_XXX flags, but, that logic can be 
  applied to any other NETIF_F_XXX flag:  if the net stack isn't using it, 
  it's a piece of information specific to that driver.
 
 I believe LRO is going to have to be disabled for routing/bridging,
 so the stack will probably need to become aware of it at some point...

The packet will be GSO'd on output I believe, so it won't
break anything.

Alternatively, we could make the driver only LRO accumulate if the
packet is unicast and matches one of the MAC's programmed into the
chip.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] Add ETHTOOL_[GS]FLAGS sub-ioctls

2007-08-10 Thread Ben Greear

David Miller wrote:

From: Ben Greear [EMAIL PROTECTED]



I believe LRO is going to have to be disabled for routing/bridging,
so the stack will probably need to become aware of it at some point...


The packet will be GSO'd on output I believe, so it won't
break anything.

Alternatively, we could make the driver only LRO accumulate if the
packet is unicast and matches one of the MAC's programmed into the
chip.


I think even this would fail if you are doing something clever with
NAT or other iptables stuff.  Probably we're going to have to put this
in the hands of the users..who hopefully can determine whether they
can allow LRO or not...

For GSO on output, is there a generic fallback for any driver that
does not specifically implement GSO?

Thanks,
Ben

--
Ben Greear [EMAIL PROTECTED]
Candela Technologies Inc  http://www.candelatech.com

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] Add ETHTOOL_[GS]FLAGS sub-ioctls

2007-08-10 Thread David Miller
From: Ben Greear [EMAIL PROTECTED]
Date: Fri, 10 Aug 2007 15:40:02 -0700

 For GSO on output, is there a generic fallback for any driver that
 does not specifically implement GSO?

Absolutely, in fact that's mainly what it's there for.

I don't think there is any issue.  The knob is there via
ethtool for people who really want to disable it.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   >