RE: [PATCH] megaraid:Make functions static in the file megaraid_sas_base.c

2015-06-23 Thread Sumit Saxena
-Original Message-
From: Nicholas Krause [mailto:xerofo...@gmail.com]
Sent: Wednesday, June 24, 2015 5:43 AM
To: kashyap.de...@avagotech.com
Cc: sumit.sax...@avagotech.com; uday.ling...@avagotech.com;
jbottom...@odin.com; megaraidlinux@avagotech.com;
linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: [PATCH] megaraid:Make functions static in the file
megaraid_sas_base.c

This makes various functions that have no external callers outside their
definition/declaration in the file megaraid_sas_base.c to be declared as
static now.

Signed-off-by: Nicholas Krause 
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
b/drivers/scsi/megaraid/megaraid_sas_base.c
index 4c3fc0e..dad2393 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -190,7 +190,7 @@ static int megasas_get_ld_vf_affiliation(struct
megasas_instance *instance,  int megasas_check_mpio_paths(struct
megasas_instance *instance,
 struct scsi_cmnd *scmd);

-void
+static void
 megasas_issue_dcmd(struct megasas_instance *instance, struct megasas_cmd
*cmd)  {
instance->instancet->fire_cmd(instance,
@@ -1698,7 +1698,7 @@ static int megasas_slave_alloc(struct scsi_device
*sdev)
 * @instance:   Adapter soft state
 *
 */
-void megasas_complete_outstanding_ioctls(struct megasas_instance
*instance)
+static void megasas_complete_outstanding_ioctls(struct megasas_instance
+*instance)
 {
int i;
struct megasas_cmd *cmd_mfi;
@@ -1856,7 +1856,7 @@ megasas_internal_reset_defer_cmds(struct
megasas_instance *instance);  static void
process_fw_state_change_wq(struct work_struct *work);

-void megasas_do_ocr(struct megasas_instance *instance)
+static void megasas_do_ocr(struct megasas_instance *instance)
 {
if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS1064R) ||
(instance->pdev->device == PCI_DEVICE_ID_DELL_PERC5) ||

Acked-by: Sumit Saxena 

--
2.1.4
--
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 v6 0/9] Add simple NVMEM Framework via regmap.

2015-06-23 Thread Sanchayan Maity
Hello,

On 15-06-23 21:47:34, Stefan Wahren wrote:
> Hi Srinivas,
> 
> > Srinivas Kandagatla  hat am 23. Juni 2015 um
> > 01:07 geschrieben:
> >
> >
> > [...]
> >
> > Device Tree:
> >
> > /* Provider */
> > qfprom: qfprom@0070 {
> > ...
> >
> > /* Data cells */
> > tsens_calibration: calib@404 {
> > reg = <0x404 0x10>;
> > };
> >
> > tsens_calibration_bckp: calib_bckp@504 {
> > reg = <0x504 0x11>;
> > bit-offset = 6;
> > nbits = 128;
> > };
> >
> > pvs_version: pvs-version@6 {
> > reg = <0x6 0x2>
> > bit-offset = 7;
> > nbits = 2;
> > };
> >
> > speed_bin: speed-bin@c{
> > reg = <0xc 0x1>;
> > bit-offset = 2;
> > nbits = 3;
> >
> > };
> > ...
> > };
> >
> > userspace interface: binary file in /sys/class/nvmem/*/nvmem
> >
> > ex:
> > hexdump /sys/class/nvmem/qfprom0/nvmem
> >
> > 000        
> > *
> > 0a0 db10 2240  e000 0c00 0c00  0c00
> > 000        
> > ...
> > *
> > 0001000
> >
> 
> i want to port OCOTP driver for MXS, which hasn't MMIO. From my understanding
> hexdump would readout the complete register range defined in provider DT node.
> 
> How can i achieve that hexdump only reads the data area within the register
> range?

I also had a similar question in my mind.

- Sanchayan.
--
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] virtio-pci: alloc only resources actually used.

2015-06-23 Thread Gerd Hoffmann
Move resource allocation from common code to legacy and modern code.
Only request resources actually used, i.e. bar0 in legacy mode and
the bar(s) specified by capabilities in modern mode.

Signed-off-by: Gerd Hoffmann 
---
 drivers/virtio/virtio_pci_common.c |  7 ---
 drivers/virtio/virtio_pci_common.h |  2 ++
 drivers/virtio/virtio_pci_legacy.c | 13 -
 drivers/virtio/virtio_pci_modern.c | 24 ++--
 4 files changed, 32 insertions(+), 14 deletions(-)

diff --git a/drivers/virtio/virtio_pci_common.c 
b/drivers/virtio/virtio_pci_common.c
index eba1b7a..327a121 100644
--- a/drivers/virtio/virtio_pci_common.c
+++ b/drivers/virtio/virtio_pci_common.c
@@ -510,10 +510,6 @@ static int virtio_pci_probe(struct pci_dev *pci_dev,
if (rc)
goto err_enable_device;
 
-   rc = pci_request_regions(pci_dev, "virtio-pci");
-   if (rc)
-   goto err_request_regions;
-
if (force_legacy) {
rc = virtio_pci_legacy_probe(vp_dev);
/* Also try modern mode if we can't map BAR0 (no IO space). */
@@ -543,8 +539,6 @@ err_register:
else
 virtio_pci_modern_remove(vp_dev);
 err_probe:
-   pci_release_regions(pci_dev);
-err_request_regions:
pci_disable_device(pci_dev);
 err_enable_device:
kfree(vp_dev);
@@ -562,7 +556,6 @@ static void virtio_pci_remove(struct pci_dev *pci_dev)
else
virtio_pci_modern_remove(vp_dev);
 
-   pci_release_regions(pci_dev);
pci_disable_device(pci_dev);
 }
 
diff --git a/drivers/virtio/virtio_pci_common.h 
b/drivers/virtio/virtio_pci_common.h
index 28ee4e5..b976d96 100644
--- a/drivers/virtio/virtio_pci_common.h
+++ b/drivers/virtio/virtio_pci_common.h
@@ -75,6 +75,8 @@ struct virtio_pci_device {
/* Multiply queue_notify_off by this value. (non-legacy mode). */
u32 notify_offset_multiplier;
 
+   int modern_bars;
+
/* Legacy only field */
/* the IO mapping for the PCI config space */
void __iomem *ioaddr;
diff --git a/drivers/virtio/virtio_pci_legacy.c 
b/drivers/virtio/virtio_pci_legacy.c
index 256a527..48bc979 100644
--- a/drivers/virtio/virtio_pci_legacy.c
+++ b/drivers/virtio/virtio_pci_legacy.c
@@ -215,6 +215,7 @@ static const struct virtio_config_ops virtio_pci_config_ops 
= {
 int virtio_pci_legacy_probe(struct virtio_pci_device *vp_dev)
 {
struct pci_dev *pci_dev = vp_dev->pci_dev;
+   int rc;
 
/* We only own devices >= 0x1000 and <= 0x103f: leave the rest. */
if (pci_dev->device < 0x1000 || pci_dev->device > 0x103f)
@@ -226,9 +227,14 @@ int virtio_pci_legacy_probe(struct virtio_pci_device 
*vp_dev)
return -ENODEV;
}
 
+   rc = pci_request_region(pci_dev, 0, "virtio-pci-legacy");
+   if (rc)
+   return rc;
+
+   rc = -ENOMEM;
vp_dev->ioaddr = pci_iomap(pci_dev, 0, 0);
if (!vp_dev->ioaddr)
-   return -ENOMEM;
+   goto err_iomap;
 
vp_dev->isr = vp_dev->ioaddr + VIRTIO_PCI_ISR;
 
@@ -246,6 +252,10 @@ int virtio_pci_legacy_probe(struct virtio_pci_device 
*vp_dev)
vp_dev->del_vq = del_vq;
 
return 0;
+
+err_iomap:
+   pci_release_region(pci_dev, 0);
+   return rc;
 }
 
 void virtio_pci_legacy_remove(struct virtio_pci_device *vp_dev)
@@ -253,4 +263,5 @@ void virtio_pci_legacy_remove(struct virtio_pci_device 
*vp_dev)
struct pci_dev *pci_dev = vp_dev->pci_dev;
 
pci_iounmap(pci_dev, vp_dev->ioaddr);
+   pci_release_region(pci_dev, 0);
 }
diff --git a/drivers/virtio/virtio_pci_modern.c 
b/drivers/virtio/virtio_pci_modern.c
index e88e099..8e5cf19 100644
--- a/drivers/virtio/virtio_pci_modern.c
+++ b/drivers/virtio/virtio_pci_modern.c
@@ -499,7 +499,7 @@ static const struct virtio_config_ops virtio_pci_config_ops 
= {
  * Returns offset of the capability, or 0.
  */
 static inline int virtio_pci_find_capability(struct pci_dev *dev, u8 cfg_type,
-u32 ioresource_types)
+u32 ioresource_types, int *bars)
 {
int pos;
 
@@ -520,8 +520,10 @@ static inline int virtio_pci_find_capability(struct 
pci_dev *dev, u8 cfg_type,
 
if (type == cfg_type) {
if (pci_resource_len(dev, bar) &&
-   pci_resource_flags(dev, bar) & ioresource_types)
+   pci_resource_flags(dev, bar) & ioresource_types) {
+   *bars |= (1 << bar);
return pos;
+   }
}
}
return 0;
@@ -617,7 +619,8 @@ int virtio_pci_modern_probe(struct virtio_pci_device 
*vp_dev)
 
/* check for a common config: if not, use legacy mode (bar 0). */
common = virtio_pci_find_capability(pci_dev, VIRTIO_PCI_CAP_COMMON_CFG,
-   IORESOURCE_IO | 

Re: [PATCH 6/6] [media] s5c73m3: Remove redundant spi driver bus initialization

2015-06-23 Thread Andrzej Hajda
On 06/23/2015 04:53 PM, Antonio Borneo wrote:
> In ancient times it was necessary to manually initialize the bus
> field of an spi_driver to spi_bus_type. These days this is done in
> spi_register_driver(), so we can drop the manual assignment.
>
> Signed-off-by: Antonio Borneo 
> To: Mauro Carvalho Chehab 
> To: Kyungmin Park 
> To: Andrzej Hajda 
> To: linux-me...@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org

Reviewed-by: Andrzej Hajda 

Regards
Andrzej
> ---
>  drivers/media/i2c/s5c73m3/s5c73m3-spi.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-spi.c 
> b/drivers/media/i2c/s5c73m3/s5c73m3-spi.c
> index 63eb190..fa4a5eb 100644
> --- a/drivers/media/i2c/s5c73m3/s5c73m3-spi.c
> +++ b/drivers/media/i2c/s5c73m3/s5c73m3-spi.c
> @@ -149,7 +149,6 @@ int s5c73m3_register_spi_driver(struct s5c73m3 *state)
>   spidrv->remove = s5c73m3_spi_remove;
>   spidrv->probe = s5c73m3_spi_probe;
>   spidrv->driver.name = S5C73M3_SPI_DRV_NAME;
> - spidrv->driver.bus = _bus_type;
>   spidrv->driver.owner = THIS_MODULE;
>   spidrv->driver.of_match_table = s5c73m3_spi_ids;
>  

--
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 11/28] ARCv2: extable: Enable sorting at build time

2015-06-23 Thread Vineet Gupta
Hi David,

On Tuesday 09 June 2015 05:18 PM, Vineet Gupta wrote:
> Signed-off-by: Vineet Gupta 
> ---
>  scripts/sortextable.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/scripts/sortextable.c b/scripts/sortextable.c
> index 1052d4834a44..c2423d913b46 100644
> --- a/scripts/sortextable.c
> +++ b/scripts/sortextable.c
> @@ -47,6 +47,10 @@
>  #define EM_MICROBLAZE189
>  #endif
>  
> +#ifndef EM_ARCV2
> +#define EM_ARCV2 195
> +#endif
> +
>  static int fd_map;   /* File descriptor for file being modified. */
>  static int mmap_failed; /* Boolean flag. */
>  static void *ehdr_curr; /* current ElfXX_Ehdr *  for resource cleanup */
> @@ -281,6 +285,7 @@ do_file(char const *const fname)
>   custom_sort = sort_relative_table;
>   break;
>   case EM_ARCOMPACT:
> + case EM_ARCV2:
>   case EM_ARM:
>   case EM_AARCH64:
>   case EM_MICROBLAZE:
> 

Sorry for missing you in the CC in orig post of this patch. Can I get your Ack 
on
this one !

-Vineet
--
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: [v4 01/16] KVM: Extend struct pi_desc for VT-d Posted-Interrupts

2015-06-23 Thread Wu, Feng


> -Original Message-
> From: Paolo Bonzini [mailto:pbonz...@redhat.com]
> Sent: Tuesday, June 23, 2015 11:50 PM
> To: Wu, Feng; k...@vger.kernel.org; linux-kernel@vger.kernel.org
> Cc: mtosa...@redhat.com; alex.william...@redhat.com;
> eric.au...@linaro.org
> Subject: Re: [v4 01/16] KVM: Extend struct pi_desc for VT-d Posted-Interrupts
> 
> 
> 
> On 11/06/2015 12:51, Feng Wu wrote:
> > +   union {
> > +   struct {
> > +   /* bit 256 - Outstanding Notification */
> > +   u64 on  : 1,
> > +   /* bit 257 - Suppress Notification */
> > +   sn  : 1,
> > +   /* bit 271:258 - Reserved */
> > +   rsvd_1  : 14,
> > +   /* bit 279:272 - Notification Vector */
> > +   nv  : 8,
> > +   /* bit 287:280 - Reserved */
> > +   rsvd_2  : 8,
> > +   /* bit 319:288 - Notification Destination */
> > +   ndst: 32;
> 
> Please do not use bitfields, Linus doesn't like them.  Use static
> inlines instead to extract or set the fields from the control field.

Do you mean we don't use bitfields at all, or the following format is
acceptable, in which, we use bitfileds as less as possible?

union {
struct
{
u16 on : 1,  /* bit 256 - Outstanding Notification */
sn : 1,  /* bit 257 - Suppress Notification */
rsvd_1 : 14; /* bit 271:258 - Reserved */
u8  nv;  /* bit 279:272 - Notification Vector */
u8  rsvd_2;  /* bit 287:280 - Reserved */
u32 ndst;/* bit 319:288 - Notification Destination */
};
u64 control;
};

Thanks,
Feng

> 
> Paolo
> 
> > +   };
> > +   u64 control;
> > +   };
> > +   u32 rsvd[6];
--
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: [alsa-devel] [V2 PATCH] ALSA: hda - Enable mute/mic-mute LEDs for more Thinkpads with Conexant codec

2015-06-23 Thread Jan Kiszka
On 2015-05-23 18:22, Jan Kiszka wrote:
> On 2015-05-23 18:06, Raymond Yau wrote:
>> 2015-5-23 下午4:50 於 "Jan Kiszka"  寫道:
>>>
>> Most Thinkpad Edge series laptops use conexant codec, so far
>> although
 
>>> Is there anything I can debug or any information I can collect
>>> from my
>>> box to examine this?
>> What is the linux distribution on your machine? And use showkey to
>> catch
>> the keycode of that button.
> I'm running OpenSUSE 13.1. The reported keycode of the power
> button is
> 116.
 It seems the keycode is correct, it is power keycode rather the mute
 keycode.

 Could you please do some debug, let us find which line of code is
>> the
 root cause for this problem. for example:

 after running the line, the problem shows up:

 1. if (ACPI_SUCCESS(acpi_get_devices("LEN0068", acpi_check_cb,
 , NULL)) && found) // in the sound/pci/hda/thinkpad_helper.c,
 is_thinkpad()
>>> This evaluates to true
>>>
 2. return ACPI_SUCCESS(acpi_get_devices("IBM0068",
>> acpi_check_cb,
 , NULL)) && found; // same as above

 3. if (led_set_func(TPACPI_LED_MUTE, false) >= 0) { //in the
 sound/pci/hda/thinkpad_helper.c, hda_fixup_thinkpad_acpi()
>>> ...and this
>>>
 4. if (led_set_func(TPACPI_LED_MICMUTE, false) >= 0) { // same as
 above

>>> ...and this as well. spec->num_adc_nids is 1.
>>
>> If we change the code like below, does the power button can work well?
>>
>> in the thinkpad_helper.c, hda_fixup_thinkpad_acpi()
>>
>>
>>  if (led_set_func(TPACPI_LED_MUTE, false) >= 0) {
>>  /*
>>  old_vmaster_hook = spec->vmaster_mute.hook;
>>  spec->vmaster_mute.hook = update_tpacpi_mute_led;
>>  removefunc = false;
>> */
> Disabling only this block resolves the issue.

 So Below two lines make the power button change to the reset button.

 drivers/platform/x86/thinkpad_acpi.c  mute_led_on_off():

 acpi_get_handle(hkey_handle, "SSMS", );
 acpi_evalf(hkey_handle, , "SSMS", "dd", 1);


 @alexhung,
 Do you have any idea why this can affect the power button behavior?

>>>
>>> I think we all lost track of this issue, but it unfortunately still
>>> exists in the latest kernel, requiring custom builds here. How can we
>>> proceed?
>>
>> http://mailman.alsa-project.org/pipermail/alsa-devel/2015-May/091561.html
>>
>> If you cannot find "SSMS" in  your T520 ACPI dump, this mean mute LED
>> cannot be turn on/off similar to T510
> 
> There is an entry (see attached disassembly), but this device has at
> least no physical LED to drive.
> 
> Jan
> 

Ping...

Jan
--
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 v2] staging: rtl8192u: bool tests don't need comparisons

2015-06-23 Thread Sudip Mukherjee
On Tue, Jun 23, 2015 at 03:10:56PM +0200, Luis de Bethencourt wrote:
> Remove explicit true/false comparations to bool variables.
> 
> Signed-off-by: Luis de Bethencourt 
> ---

> diff --git a/drivers/staging/rtl8192u/r8192U_dm.c 
> b/drivers/staging/rtl8192u/r8192U_dm.c
> index 12dd19e..9946615 100644
> --- a/drivers/staging/rtl8192u/r8192U_dm.c
> +++ b/drivers/staging/rtl8192u/r8192U_dm.c
> @@ -438,7 +438,7 @@ static void dm_bandwidth_autoswitch(struct net_device 
> *dev)
>  
>   if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 || 
> !priv->ieee80211->bandwidth_auto_switch.bautoswitch_enable)
>   return;
> - if (priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false) { 
> /* If send packets in 40 Mhz in 20/40 */
> + if (!priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz) { /* If 
> send packets in 40 Mhz in 20/40 */
>   if (priv->undecorated_smoothed_pwdb <= 
> priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz)
>   priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz 
> = true;
>   } else { /* in force send packets in 20 Mhz in 20/40 */
> @@ -563,7 +563,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct 
> net_device *dev)
>   break;
>   }
>   }
> - if (viviflag == true) {
> + if (viviflag) {
I think you need to refresh your tree. This change has already been done by:
c40753b5c7ee ("staging: rtl8192u: Removed redundant bool comparisons in 
r8192U_dm.c")

regards
sudip
--
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: [RFC PATCH v6 2/2] nvmem: Add Vybrid OCOTP and OCROM support

2015-06-23 Thread maitysanchayan
Hello Srinivas,

On 15-06-23 20:03:31, Srinivas Kandagatla wrote:
> Hi Sanchayan,
> 
> 
> On 23/06/15 14:44, Sanchayan Maity wrote:
> >The patch adds support for the On Chip One Time Programmable Peripheral
> >(OCOTP) and On Chip ROM (OCROM) support.
> >
> >On Vybrid OCOTP contain data like SoC ID, MAC address and OCROM has the
> >revision ID.
> >
> >Signed-off-by: Sanchayan Maity 
> >---
> >  drivers/nvmem/Kconfig   | 11 +
> >  drivers/nvmem/Makefile  |  2 ++
> >  drivers/nvmem/vf610-ocotp.c | 60 
> > +
> >  3 files changed, 73 insertions(+)
> >  create mode 100644 drivers/nvmem/vf610-ocotp.c
> >
> 
> Fantastic! diff is already looking good, when compared to v5 patches,
> "drivers/soc/fsl/soc-vf610.c | 166
> +++"

Yes :)

> 
> I think, We could even do a better job by moving qfprom and this driver to a
> simple-mmio-nvmem provider, see below comments.
> 
> >diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig
> >index 17f1a57..557c1e0 100644
> >--- a/drivers/nvmem/Kconfig
> >+++ b/drivers/nvmem/Kconfig
> >@@ -33,4 +33,15 @@ config NVMEM_SUNXI_SID
> >   This driver can also be built as a module. If so, the module
> >   will be called eeprom-sunxi-sid.
> >
> >+config NVMEM_VF610_OCOTP
> >+tristate "VF610 SoCs OCOTP support"
> >+depends on SOC_VF610
> >+select REGMAP_MMIO
> >+help
> >+  This is a driver for the 'OCOTP' available on various Vybrid
> >+  devices.
> >+
> >+  This driver can also be built as a module. If so, the module
> >+  will be called nvmem-vf610-ocotp.
> >+
> >  endif
> >diff --git a/drivers/nvmem/Makefile b/drivers/nvmem/Makefile
> >index cc46791..a9ed113 100644
> >--- a/drivers/nvmem/Makefile
> >+++ b/drivers/nvmem/Makefile
> >@@ -11,3 +11,5 @@ obj-$(CONFIG_QCOM_QFPROM)  += nvmem_qfprom.o
> >  nvmem_qfprom-y := qfprom.o
> >  obj-$(CONFIG_NVMEM_SUNXI_SID)  += nvmem-sunxi-sid.o
> >  nvmem-sunxi-sid-y  := sunxi-sid.o
> >+obj-$(CONFIG_NVMEM_VF610_OCOTP) += nvmem-vf610-ocotp.o
> >+nvmem-vf610-ocotp-y := vf610-ocotp.o
> >diff --git a/drivers/nvmem/vf610-ocotp.c b/drivers/nvmem/vf610-ocotp.c
> >new file mode 100644
> >index 000..d98772d
> >--- /dev/null
> >+++ b/drivers/nvmem/vf610-ocotp.c
> >@@ -0,0 +1,60 @@
> >+/*
> >+ * Copyright (C) 2015 Sanchayan Maity 
> >+ *
> >+ * This program is free software; you can redistribute it and/or modify
> >+ * it under the terms of the GNU General Public License version 2 and
> >+ * only 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.
> >+ */
> >+
> >+#include 
> >+#include 
> >+#include "nvmem-mmio.h"
> >+
> >+static struct regmap_config regmap_config = {
> >+.reg_bits = 32,
> >+.val_bits = 32,
> >+.reg_stride = 4,
> 
> Any particular reason why it cant support byte reads?
> 
> This driver looks exactly same as qcom,qfprom driver, except the
> regmap_config.

It does support byte reads. This works as well

static struct regmap_config regmap_config = {
   .reg_bits = 32,
   .val_bits = 8,
   .reg_stride = 1,
};
}

Hmm can't recall why I went with that. Yes it is more or less the
same as qcom,qfprom driver, that's what I referred.

> 
> >+};
> >+
> >+static struct nvmem_config ocotp_config = {
> >+.name = "soc_id",
> >+};
> >+
> >+static struct nvmem_config rom_config = {
> >+.name = "rom_rev",
> >+};
> >+
> >+static struct nvmem_mmio_data ocotp_data = {
> >+.nvmem_config = _config,
> >+.regmap_config = _config,
> >+};
> >+
> >+static struct nvmem_mmio_data rom_data = {
> >+.nvmem_config = _config,
> >+.regmap_config = _config,
> >+};
> >+
> >+static const struct of_device_id ocotp_of_match[] = {
> >+{ .compatible = "fsl,vf610-ocotp", .data = _data},
> >+{ .compatible = "fsl,vf610-ocrom", .data = _data},
> >+{/* sentinel */},
> >+};
> >+MODULE_DEVICE_TABLE(of, ocotp_of_match);
> >+
> >+static struct platform_driver vf610_ocotp_driver = {
> >+.probe = nvmem_mmio_probe,
> >+.remove = nvmem_mmio_remove,
> >+.driver = {
> >+.name = "vf610-nvmem",
> >+.of_match_table = ocotp_of_match,
> >+},
> >+};
> >+module_platform_driver(vf610_ocotp_driver);
> >+MODULE_AUTHOR("Sanchayan Maity ");
> >+MODULE_DESCRIPTION("Vybrid NVMEM driver");
> >+MODULE_LICENSE("GPL v2");
> >
> 
> 
> I moved the nvmem_mmio to qfprom as I did not any other user for that in v6
> patches.
> 
> Now that Vybrid can be another user I should probably put it back, or may be
> I should create a simple-mmio-nvmem driver which both qcom,qfprom and Vybrid
> can use.

Nice, then that would simplify things further from what I 

[PATCH 2/4] ocfs2: sysfile interfaces for online file check

2015-06-23 Thread Gang He
Implement online file check sysfile interfaces, e.g.
how to create the related sysfile according to device name,
how to display/handle file check request from the sysfile.

Signed-off-by: Gang He 
Reviewed-by: Goldwyn Rodrigues 
---
 fs/ocfs2/Makefile|   3 +-
 fs/ocfs2/filecheck.c | 569 +++
 fs/ocfs2/filecheck.h |  48 +
 fs/ocfs2/inode.h |   3 +
 4 files changed, 622 insertions(+), 1 deletion(-)
 create mode 100644 fs/ocfs2/filecheck.c
 create mode 100644 fs/ocfs2/filecheck.h

diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
index ce210d4..e27e652 100644
--- a/fs/ocfs2/Makefile
+++ b/fs/ocfs2/Makefile
@@ -41,7 +41,8 @@ ocfs2-objs := \
quota_local.o   \
quota_global.o  \
xattr.o \
-   acl.o
+   acl.o   \
+   filecheck.o
 
 ocfs2_stackglue-objs := stackglue.o
 ocfs2_stack_o2cb-objs := stack_o2cb.o
diff --git a/fs/ocfs2/filecheck.c b/fs/ocfs2/filecheck.c
new file mode 100644
index 000..3e68112
--- /dev/null
+++ b/fs/ocfs2/filecheck.c
@@ -0,0 +1,569 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * filecheck.c
+ *
+ * Code which implements online file check.
+ *
+ * Copyright (C) 2007, 2009 Oracle.  All rights reserved.
+ *
+ * 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, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "ocfs2.h"
+#include "ocfs2_fs.h"
+#include "stackglue.h"
+#include "inode.h"
+
+#include "filecheck.h"
+
+
+/* File check error strings,
+ * must correspond with error number in header file.
+ */
+static const char * const ocfs2_filecheck_errs[] = {
+   "SUCCESS",
+   "FAILED",
+   "INPROGRESS",
+   "READONLY",
+   "INVALIDINO",
+   "BLOCKECC",
+   "BLOCKNO",
+   "VALIDFLAG",
+   "GENERATION",
+   "UNSUPPORTED"
+};
+
+static DEFINE_SPINLOCK(ocfs2_filecheck_sysfs_lock);
+static LIST_HEAD(ocfs2_filecheck_sysfs_list);
+
+struct ocfs2_filecheck {
+   struct list_head fc_head;   /* File check entry list head */
+   spinlock_t fc_lock;
+   unsigned int fc_max;/* Maximum number of entry in list */
+   unsigned int fc_size;   /* Current entry count in list */
+   unsigned int fc_done;   /* File check entries are done in list */
+};
+
+struct ocfs2_filecheck_sysfs_entry {
+   struct list_head fs_list;
+   atomic_t fs_count;
+   struct super_block *fs_sb;
+   struct kset *fs_kset;
+   struct ocfs2_filecheck *fs_fcheck;
+};
+
+#define OCFS2_FILECHECK_MAXSIZE100
+#define OCFS2_FILECHECK_MINSIZE10
+
+/* File check operation type */
+enum {
+   OCFS2_FILECHECK_TYPE_CHK = 0,   /* Check a file */
+   OCFS2_FILECHECK_TYPE_FIX,   /* Fix a file */
+   OCFS2_FILECHECK_TYPE_SET = 100  /* Set file check options */
+};
+
+struct ocfs2_filecheck_entry {
+   struct list_head fe_list;
+   unsigned long fe_ino;
+   unsigned int fe_type;
+   unsigned short fe_done:1;
+   unsigned short fe_status:15;
+};
+
+struct ocfs2_filecheck_args {
+   unsigned int fa_type;
+   union {
+   unsigned long fa_ino;
+   unsigned int fa_len;
+   };
+};
+
+static const char *
+ocfs2_filecheck_error(int errno)
+{
+   if (!errno)
+   return ocfs2_filecheck_errs[errno];
+
+   BUG_ON(errno < OCFS2_FILECHECK_ERR_START ||
+   errno > OCFS2_FILECHECK_ERR_END);
+   return ocfs2_filecheck_errs[errno - OCFS2_FILECHECK_ERR_START + 1];
+}
+
+static ssize_t ocfs2_filecheck_show(struct kobject *kobj,
+   struct kobj_attribute *attr,
+   char *buf);
+static ssize_t ocfs2_filecheck_store(struct kobject *kobj,
+   struct kobj_attribute *attr,
+   const char *buf, size_t count);
+static struct kobj_attribute ocfs2_attr_filecheck =
+   __ATTR(filecheck, S_IRUSR | S_IWUSR,
+   ocfs2_filecheck_show,
+   ocfs2_filecheck_store);
+
+static int ocfs2_filecheck_sysfs_wait(atomic_t *p)
+{
+   schedule();
+   return 0;
+}
+
+static void
+ocfs2_filecheck_sysfs_free(struct ocfs2_filecheck_sysfs_entry *entry)
+{
+   struct ocfs2_filecheck_entry *p;
+
+   if (!atomic_dec_and_test(>fs_count))
+   wait_on_atomic_t(>fs_count, 

[PATCH 4/4] ocfs2: check/fix inode block for online file check

2015-06-23 Thread Gang He
Implement online check or fix inode block during
reading a inode block to memory.

Signed-off-by: Gang He 
Reviewed-by: Goldwyn Rodrigues 
---
 fs/ocfs2/inode.c   | 196 +++--
 fs/ocfs2/ocfs2_trace.h |   2 +
 2 files changed, 192 insertions(+), 6 deletions(-)

diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index b254416..d811698 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -53,6 +53,7 @@
 #include "xattr.h"
 #include "refcounttree.h"
 #include "ocfs2_trace.h"
+#include "filecheck.h"
 
 #include "buffer_head_io.h"
 
@@ -74,6 +75,13 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb,
struct inode *inode,
struct buffer_head *fe_bh);
 
+static int ocfs2_filecheck_read_inode_block_full(struct inode *inode,
+   struct buffer_head **bh, int flags, int type);
+static int ocfs2_filecheck_validate_inode_block(struct super_block *sb,
+   struct buffer_head *bh);
+static int ocfs2_filecheck_repair_inode_block(struct super_block *sb,
+   struct buffer_head *bh);
+
 void ocfs2_set_inode_flags(struct inode *inode)
 {
unsigned int flags = OCFS2_I(inode)->ip_attr;
@@ -127,6 +135,7 @@ struct inode *ocfs2_ilookup(struct super_block *sb, u64 
blkno)
 struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, unsigned flags,
 int sysfile_type)
 {
+   int rc = 0;
struct inode *inode = NULL;
struct super_block *sb = osb->sb;
struct ocfs2_find_inode_args args;
@@ -161,12 +170,17 @@ struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 
blkno, unsigned flags,
}
trace_ocfs2_iget5_locked(inode->i_state);
if (inode->i_state & I_NEW) {
-   ocfs2_read_locked_inode(inode, );
+   rc = ocfs2_read_locked_inode(inode, );
unlock_new_inode(inode);
}
if (is_bad_inode(inode)) {
iput(inode);
-   inode = ERR_PTR(-ESTALE);
+   if ((flags & OCFS2_FI_FLAG_FILECHECK_CHK) ||
+   (flags & OCFS2_FI_FLAG_FILECHECK_FIX))
+   /* Return OCFS2_FILECHECK_ERR_XXX related errno */
+   inode = ERR_PTR(rc);
+   else
+   inode = ERR_PTR(-ESTALE);
goto bail;
}
 
@@ -494,16 +508,32 @@ static int ocfs2_read_locked_inode(struct inode *inode,
}
 
if (can_lock) {
-   status = ocfs2_read_inode_block_full(inode, ,
-OCFS2_BH_IGNORE_CACHE);
+   if (args->fi_flags & OCFS2_FI_FLAG_FILECHECK_CHK)
+   status = ocfs2_filecheck_read_inode_block_full(inode,
+   , OCFS2_BH_IGNORE_CACHE, 0);
+   else if (args->fi_flags & OCFS2_FI_FLAG_FILECHECK_FIX)
+   status = ocfs2_filecheck_read_inode_block_full(inode,
+   , OCFS2_BH_IGNORE_CACHE, 1);
+   else
+   status = ocfs2_read_inode_block_full(inode,
+   , OCFS2_BH_IGNORE_CACHE);
} else {
status = ocfs2_read_blocks_sync(osb, args->fi_blkno, 1, );
/*
 * If buffer is in jbd, then its checksum may not have been
 * computed as yet.
 */
-   if (!status && !buffer_jbd(bh))
-   status = ocfs2_validate_inode_block(osb->sb, bh);
+   if (!status && !buffer_jbd(bh)) {
+   if (args->fi_flags & OCFS2_FI_FLAG_FILECHECK_CHK)
+   status = ocfs2_filecheck_validate_inode_block(
+   osb->sb, bh);
+   else if (args->fi_flags & OCFS2_FI_FLAG_FILECHECK_FIX)
+   status = ocfs2_filecheck_repair_inode_block(
+   osb->sb, bh);
+   else
+   status = ocfs2_validate_inode_block(
+   osb->sb, bh);
+   }
}
if (status < 0) {
mlog_errno(status);
@@ -531,6 +561,14 @@ static int ocfs2_read_locked_inode(struct inode *inode,
 
BUG_ON(args->fi_blkno != le64_to_cpu(fe->i_blkno));
 
+   if (buffer_dirty(bh)) {
+   status = ocfs2_write_block(osb, bh, INODE_CACHE(inode));
+   if (status < 0) {
+   mlog_errno(status);
+   goto bail;
+   }
+   }
+
status = 0;
 
 bail:
@@ -1385,6 +1423,152 @@ bail:
return rc;
 }
 
+static int ocfs2_filecheck_validate_inode_block(struct super_block *sb,
+

[PATCH 3/4] ocfs2: create/remove sysfile for online file check

2015-06-23 Thread Gang He
Create online file check sysfile when ocfs2 mount,
remove the related sysfile when ocfs2 umount.

Signed-off-by: Gang He 
Reviewed-by: Goldwyn Rodrigues 
---
 fs/ocfs2/super.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 403c566..7213a94 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -74,6 +74,7 @@
 #include "suballoc.h"
 
 #include "buffer_head_io.h"
+#include "filecheck.h"
 
 static struct kmem_cache *ocfs2_inode_cachep;
 struct kmem_cache *ocfs2_dquot_cachep;
@@ -1202,6 +1203,9 @@ static int ocfs2_fill_super(struct super_block *sb, void 
*data, int silent)
/* Start this when the mount is almost sure of being successful */
ocfs2_orphan_scan_start(osb);
 
+   /* Create filecheck sysfile /sys/fs/ocfs2//filecheck */
+   ocfs2_filecheck_create_sysfs(sb);
+
return status;
 
 read_super_error:
@@ -1658,6 +1662,7 @@ static void ocfs2_put_super(struct super_block *sb)
 
ocfs2_sync_blockdev(sb);
ocfs2_dismount_volume(sb, 0);
+   ocfs2_filecheck_remove_sysfs(sb);
 }
 
 static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf)
-- 
2.1.2

--
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] ocfs2: export ocfs2_kset for online file check

2015-06-23 Thread Gang He
Export ocfs2_kset object from ocfs2_stackglue kernel module,
then online file check code will create the related sysfiles
under ocfs2_kset object.

Signed-off-by: Gang He 
Reviewed-by: Goldwyn Rodrigues 
---
 fs/ocfs2/stackglue.c | 3 ++-
 fs/ocfs2/stackglue.h | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c
index 5d965e8..13219ed 100644
--- a/fs/ocfs2/stackglue.c
+++ b/fs/ocfs2/stackglue.c
@@ -629,7 +629,8 @@ static struct attribute_group ocfs2_attr_group = {
.attrs = ocfs2_attrs,
 };
 
-static struct kset *ocfs2_kset;
+struct kset *ocfs2_kset;
+EXPORT_SYMBOL_GPL(ocfs2_kset);
 
 static void ocfs2_sysfs_exit(void)
 {
diff --git a/fs/ocfs2/stackglue.h b/fs/ocfs2/stackglue.h
index 66334a3..f2dce10 100644
--- a/fs/ocfs2/stackglue.h
+++ b/fs/ocfs2/stackglue.h
@@ -298,4 +298,6 @@ void ocfs2_stack_glue_set_max_proto_version(struct 
ocfs2_protocol_version *max_p
 int ocfs2_stack_glue_register(struct ocfs2_stack_plugin *plugin);
 void ocfs2_stack_glue_unregister(struct ocfs2_stack_plugin *plugin);
 
+extern struct kset *ocfs2_kset;
+
 #endif  /* STACKGLUE_H */
-- 
2.1.2

--
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 0/4] ocfs2: add online file check feature

2015-06-23 Thread Gang He
When there are errors in the ocfs2 filesystem,
they are usually accompanied by the inode number which caused the error.
This inode number would be the input to fixing the file.
One of these options could be considered:
A file in the sys filesytem which would accept inode numbers.
This could be used to communication back what has to be fixed or is fixed.
You could write:
$# echo "CHECK " > /sys/fs/ocfs2/devname/filecheck
or
$# echo "FIX " > /sys/fs/ocfs2/devname/filecheck

Gang He (4):
  ocfs2: export ocfs2_kset for online file check
  ocfs2: sysfile interfaces for online file check
  ocfs2: create/remove sysfile for online file check
  ocfs2: check/fix inode block for online file check

 fs/ocfs2/Makefile  |   3 +-
 fs/ocfs2/filecheck.c   | 569 +
 fs/ocfs2/filecheck.h   |  48 +
 fs/ocfs2/inode.c   | 196 -
 fs/ocfs2/inode.h   |   3 +
 fs/ocfs2/ocfs2_trace.h |   2 +
 fs/ocfs2/stackglue.c   |   3 +-
 fs/ocfs2/stackglue.h   |   2 +
 fs/ocfs2/super.c   |   5 +
 9 files changed, 823 insertions(+), 8 deletions(-)
 create mode 100644 fs/ocfs2/filecheck.c
 create mode 100644 fs/ocfs2/filecheck.h

-- 
2.1.2

--
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] staging: rtl8188eu: don't duplicate ieee80211 WLAN_EID_* constants

2015-06-23 Thread Jakub Sitnicki
linux/ieee80211.h already defines constants for information element IDs.
Include it where needed, resolve discrepancies in naming, and remove the
duplicated definitions.

While at it, wrap a line that was too long and remove extra parentheses
in an expression that mixes only equality and logical operators.

Signed-off-by: Jakub Sitnicki 
---

This patch depends on commit 04fbf979b39b ("rtl8188eu: don't duplicate
ieee80211 constants for status/reason") in staging-next branch.

 drivers/staging/rtl8188eu/core/rtw_ieee80211.c |  4 ++-
 drivers/staging/rtl8188eu/include/ieee80211.h  | 38 --
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c |  3 +-
 3 files changed, 5 insertions(+), 40 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c 
b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
index 11b780d..c3c5828 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
@@ -19,6 +19,8 @@
  
**/
 #define _IEEE80211_C
 
+#include 
+
 #include 
 #include 
 #include 
@@ -1042,7 +1044,7 @@ enum parse_res rtw_ieee802_11_parse_elems(u8 *start, uint 
len,
elems->timeout_int = pos;
elems->timeout_int_len = elen;
break;
-   case WLAN_EID_HT_CAP:
+   case WLAN_EID_HT_CAPABILITY:
elems->ht_capabilities = pos;
elems->ht_capabilities_len = elen;
break;
diff --git a/drivers/staging/rtl8188eu/include/ieee80211.h 
b/drivers/staging/rtl8188eu/include/ieee80211.h
index b129ad1..611877c 100644
--- a/drivers/staging/rtl8188eu/include/ieee80211.h
+++ b/drivers/staging/rtl8188eu/include/ieee80211.h
@@ -496,44 +496,6 @@ struct ieee80211_snap_hdr {
 /* Non standard?  Not in  */
 #define WLAN_REASON_EXPIRATION_CHK 65535
 
-/* Information Element IDs */
-#define WLAN_EID_SSID 0
-#define WLAN_EID_SUPP_RATES 1
-#define WLAN_EID_FH_PARAMS 2
-#define WLAN_EID_DS_PARAMS 3
-#define WLAN_EID_CF_PARAMS 4
-#define WLAN_EID_TIM 5
-#define WLAN_EID_IBSS_PARAMS 6
-#define WLAN_EID_CHALLENGE 16
-/* EIDs defined by IEEE 802.11h - START */
-#define WLAN_EID_PWR_CONSTRAINT 32
-#define WLAN_EID_PWR_CAPABILITY 33
-#define WLAN_EID_TPC_REQUEST 34
-#define WLAN_EID_TPC_REPORT 35
-#define WLAN_EID_SUPPORTED_CHANNELS 36
-#define WLAN_EID_CHANNEL_SWITCH 37
-#define WLAN_EID_MEASURE_REQUEST 38
-#define WLAN_EID_MEASURE_REPORT 39
-#define WLAN_EID_QUITE 40
-#define WLAN_EID_IBSS_DFS 41
-/* EIDs defined by IEEE 802.11h - END */
-#define WLAN_EID_ERP_INFO 42
-#define WLAN_EID_HT_CAP 45
-#define WLAN_EID_RSN 48
-#define WLAN_EID_EXT_SUPP_RATES 50
-#define WLAN_EID_MOBILITY_DOMAIN 54
-#define WLAN_EID_FAST_BSS_TRANSITION 55
-#define WLAN_EID_TIMEOUT_INTERVAL 56
-#define WLAN_EID_RIC_DATA 57
-#define WLAN_EID_HT_OPERATION 61
-#define WLAN_EID_SECONDARY_CHANNEL_OFFSET 62
-#define WLAN_EID_20_40_BSS_COEXISTENCE 72
-#define WLAN_EID_20_40_BSS_INTOLERANT 73
-#define WLAN_EID_OVERLAPPING_BSS_SCAN_PARAMS 74
-#define WLAN_EID_MMIE 76
-#define WLAN_EID_VENDOR_SPECIFIC 221
-#define WLAN_EID_GENERIC (WLAN_EID_VENDOR_SPECIFIC)
-
 #define IEEE80211_MGMT_HDR_LEN 24
 #define IEEE80211_DATA_HDR3_LEN 24
 #define IEEE80211_DATA_HDR4_LEN 30
diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
index 0bde2887..3aeb00a 100644
--- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
@@ -2666,7 +2666,8 @@ static int rtw_get_sta_wpaie(struct net_device *dev, 
struct ieee_param *param)
 
psta = rtw_get_stainfo(pstapriv, param->sta_addr);
if (psta) {
-   if ((psta->wpa_ie[0] == WLAN_EID_RSN) || (psta->wpa_ie[0] == 
WLAN_EID_GENERIC)) {
+   if (psta->wpa_ie[0] == WLAN_EID_RSN ||
+   psta->wpa_ie[0] == WLAN_EID_VENDOR_SPECIFIC) {
int wpa_ie_len;
int copy_len;
 
-- 
2.1.0

--
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] staging: speakup: replace simple_strtoul() with kstrtoint()

2015-06-23 Thread Sudip Mukherjee
On Wed, Jun 24, 2015 at 12:15:52AM +0100, Luis de Bethencourt wrote:
> On Wed, Jun 24, 2015 at 01:53:33AM +0300, Dan Carpenter wrote:
> > Nope.  Your patch is totally wrong (buggy).  Please be more careful in
> > the future.
> > 
> > regards,
> > dan carpenter
> > 
> 
> I saw other commits replace the obsolete simple_strtoul() this way and the
> documentation makes it look like it is a 1 to 1 replacement.
> 
> Sorry about this. I will investigate further to understand why this is buggy
> and be more careful in the future.
simple_strtoul returns unsigned long and kstrtoint gives int.
documentation says to use kstrtoul.

regards
sudip
--
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: [RFC PATCH v6 2/2] nvmem: Add Vybrid OCOTP and OCROM support

2015-06-23 Thread maitysanchayan
On 15-06-23 21:31:41, Stefan Wahren wrote:
> Hi Sanchayan,
> 
> > Sanchayan Maity  hat am 23. Juni 2015 um 15:44
> > geschrieben:
> >
> >
> > The patch adds support for the On Chip One Time Programmable Peripheral
> > (OCOTP) and On Chip ROM (OCROM) support.
> >
> > On Vybrid OCOTP contain data like SoC ID, MAC address and OCROM has the
> > revision ID.
> >
> > Signed-off-by: Sanchayan Maity 
> > ---
> > drivers/nvmem/Kconfig | 11 +
> > drivers/nvmem/Makefile | 2 ++
> > drivers/nvmem/vf610-ocotp.c | 60 
> > +
> > 3 files changed, 73 insertions(+)
> > create mode 100644 drivers/nvmem/vf610-ocotp.c
> >
> > diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig
> > index 17f1a57..557c1e0 100644
> > --- a/drivers/nvmem/Kconfig
> > +++ b/drivers/nvmem/Kconfig
> > @@ -33,4 +33,15 @@ config NVMEM_SUNXI_SID
> > This driver can also be built as a module. If so, the module
> > will be called eeprom-sunxi-sid.
> >
> > +config NVMEM_VF610_OCOTP
> > + tristate "VF610 SoCs OCOTP support"
> > + depends on SOC_VF610
> > + select REGMAP_MMIO
> 
> how do you come to the conclusion that Vybrid On-Chip OTP is accessable via
> MMIO?

Frankly speaking I just changed the naming conventions and followed the qfrom
and sunxi sid examples in Srinivas's patches.

I just tested it without the "select REGMAP_MMIO" and it works just fine.

- Sanchayan.
--
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/


SMB3 very fast file copy over the network with FSCTL_DUPLICATE_EXTENTS

2015-06-23 Thread Steve French
I tried file copies similar to "cp --reflink" over the network (from
cifs.ko client) with the new SMB3.11 dialect and
FSCTL_DUPLICATE_EXTENTS.   As expected - spectacularly faster than
regular cp. Target file system was REFS in my tests at the SMB3 test
event this week.
Now that Samba is also adding SMB3.11 dialect support, looking forward
to when we
get this in Samba server too - it is a huge performance boost for
large file copy.

(The patch to cifs.ko is
https://git.samba.org/?p=sfrench/cifs-2.6.git;a=commit;h=8295c91bcb9d19f8fbb8885d135321ab6d18a781)

root@ubuntu:~/cifs-2.6# time cp /mnt/100MBfile /mnt/copy1

real0m1.712s
user0m0.002s
sys0m0.840s
root@ubuntu:~/cifs-2.6# time cp --reflink /mnt/100MBfile /mnt/copy2

real0m0.026s
user0m0.001s
sys0m0.013s
root@ubuntu:~/cifs-2.6# time cp --reflink /mnt/100MBfile /mnt/copy3

real0m0.016s
user0m0.001s
sys0m0.005s


-- 
Thanks,

Steve
--
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-v2 3/3] mfd: devicetree: bindings: Add new 88pm800 mfd binding

2015-06-23 Thread Vaibhav Hiremath



On Wednesday 24 June 2015 05:59 AM, Krzysztof Kozlowski wrote:

2015-06-18 3:58 GMT+09:00 Vaibhav Hiremath :

With addition of DT support to 88pm800 mfd driver, this patch
adds new DT binding documentation along with respective properties.

Signed-off-by: Vaibhav Hiremath 
---
  Documentation/devicetree/bindings/mfd/88pm800.txt | 60 +++
  1 file changed, 60 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/mfd/88pm800.txt

diff --git a/Documentation/devicetree/bindings/mfd/88pm800.txt 
b/Documentation/devicetree/bindings/mfd/88pm800.txt
new file mode 100644
index 000..b8e72df
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/88pm800.txt
@@ -0,0 +1,60 @@
+* Marvell 88PM8xx Power Management IC
+
+Required parent device properties:
+- compatible : "marvell,88pm800", "marvell,88pm805", "marvell,88pm860"
+- reg : the I2C slave address for the 88pm8xx chip
+- interrupts : IRQ line for the 88pm8xx chip
+- interrupt-controller: describes the 88pm8xx as an interrupt controller
+- #interrupt-cells : should be 1.
+   - The cell is the 88pm8xx local IRQ number
+
+Optional parent device properties:
+- marvell,irq-clr-on-write: indicates whether interrupt status is cleared
+  by write or read.
+  If enabled, interrupt is cleared by write else just read would do.
+
+88pm8xx family of devices consists of varied group of sub-devices:
+
+Device Supply Names Description
+--  ---
+88pm80x-onkey  :   : On key
+88pm80x-rtc:   : RTC
+88pm80x-regulator  :   : Regulators
+
+Note: More device list will follow
+
+Example:
+
+   pmic: 88pm800@30 {
+   compatible = "marvell,88pm800";
+   reg = <0x30>;
+   interrupts = ;
+   interrupt-parent = <>;
+   interrupt-controller;
+   #interrupt-cells = <1>;
+
+   marvell,irq-clr-on-write;
+
+   regulators {
+   compatible = "marvell,88pm80x-regulator";
+
+   buck1a: BUCK1A {
+   regulator-compatible = "88PM800-BUCK1A";


That's a deprecated property.
Documentation/devicetree/bindings/regulator/regulator.txt



Yes,

Will replace with regulator-name and resubmit shortly with Rob's
Acked-by.



Thanks,
Vaibhav
--
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 6/9] arm: twr-k70f120m: clock source drivers for Kinetis SoC

2015-06-23 Thread Paul Osmialowski

Hi Stephen,

Thanks for the valuable input - all of those points are now on my 
checklist for the work on the second iteration of this patchset.


On Tue, 23 Jun 2015, Stephen Boyd wrote:


On 06/23/2015 02:19 PM, Paul Osmialowski wrote:


diff --git a/drivers/clk/clk-kinetis.c b/drivers/clk/clk-kinetis.c
new file mode 100644
index 000..dea1054
--- /dev/null
+++ b/drivers/clk/clk-kinetis.c
@@ -0,0 +1,226 @@
+/*
+ * clk-kinetis.c - Clock driver for Kinetis K70 MCG
+ *
+ * Based on legacy pre-OF code by Alexander Potashev 
+ *
+ * Copyright (C) 2015 Paul Osmialowski 
+ *
+ * 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.
+ */
+
+#include 


Is this using the consumer API? Please remove this include.


+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 


It would be nice if we didn't need these mach includes so that this
driver can be easily build tested.


+
+#include 

[..]

+}
+
+CLK_OF_DECLARE(kinetis_mcg, "fsl,kinetis-cmu", kinetis_mcg_init);


A clocksource isn't the same as a clk provider. Please split this patch
into two, one for the clk provider (drivers/clk) and one for the
clocksource driver (drivers/clocksource).


diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 0f1c77e..1d2ecde 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -106,6 +106,11 @@ config CLKSRC_EFM32
  Support to use the timers of EFM32 SoCs as clock source and clock
  event device.

+config CLKSRC_KINETIS
+   bool "Clocksource for Kinetis SoCs"
+   depends on OF && ARM && ARCH_KINETIS


Doesn't ARCH_KINETIS imply ARM? Seems that we can drop the ARM
dependency here.


+   select CLKSRC_OF


diff --git a/drivers/clocksource/timer-kinetis.c 
b/drivers/clocksource/timer-kinetis.c
new file mode 100644
index 000..634f365
--- /dev/null
+++ b/drivers/clocksource/timer-kinetis.c

[..]

+
+/*
+ * Clock event device set mode function
+ */
+static void kinetis_clockevent_tmr_set_mode(
+   enum clock_event_mode mode, struct clock_event_device *clk)


s/clk/evt/ ?


+{
+   struct kinetis_clock_event_ddata *pit =
+   container_of(clk, struct kinetis_clock_event_ddata, evtdev);
+
+   switch (mode) {
+   case CLOCK_EVT_MODE_PERIODIC:
+   kinetis_pit_enable(pit->base, 1);
+   break;
+   case CLOCK_EVT_MODE_ONESHOT:
+   case CLOCK_EVT_MODE_UNUSED:
+   case CLOCK_EVT_MODE_SHUTDOWN:
+   default:
+   kinetis_pit_enable(pit->base, 0);
+   }
+}
+
+/*
+ * Configure the timer to generate an interrupt in the specified amount of 
ticks
+ */
+static int kinetis_clockevent_tmr_set_next_event(
+   unsigned long delta, struct clock_event_device *c)
+{
+   struct kinetis_clock_event_ddata *pit =
+   container_of(c, struct kinetis_clock_event_ddata, evtdev);
+   unsigned long flags;
+
+   raw_local_irq_save(flags);


What is this protecting against?


+   kinetis_pit_init(pit->base, delta);
+   kinetis_pit_enable(pit->base, 1);
+   raw_local_irq_restore(flags);
+
+   return 0;
+}
+
+static struct kinetis_clock_event_ddata
+   kinetis_clockevent_tmrs[KINETIS_PIT_CHANNELS] = {
+   {
+   .evtdev = {
+   .name   = "fsl,kinetis-pit-timer0",
+   .rating = 200,
+   .features   =
+   CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
+   .set_mode   = kinetis_clockevent_tmr_set_mode,
+   .set_next_event = kinetis_clockevent_tmr_set_next_event,
+   },
+   },
+   {
+   .evtdev = {
+   .name   = "fsl,kinetis-pit-timer1",
+   },
+   },
+   {
+   .evtdev = {
+   .name   = "fsl,kinetis-pit-timer2",
+   },
+   },
+   {
+   .evtdev = {
+   .name   = "fsl,kinetis-pit-timer3",
+   },
+   },
+};
+
+/*
+ * Timer IRQ handler
+ */
+static irqreturn_t kinetis_clockevent_tmr_irq_handler(int irq, void *dev_id)
+{
+   struct kinetis_clock_event_ddata *tmr = dev_id;
+
+   KINETIS_PIT_WR(tmr->base, tflg, KINETIS_PIT_TFLG_TIF_MSK);
+
+   tmr->evtdev.event_handler(&(tmr->evtdev));


Unnecessary parentheses, please remove them.


+
+   return IRQ_HANDLED;
+}
+
+/*
+ * System timer IRQ action
+ */
+static struct irqaction kinetis_clockevent_irqaction[KINETIS_PIT_CHANNELS] = {
+   {
+   .name = "Kinetis Kernel Time Tick (pit0)",
+   .flags = IRQF_TIMER | IRQF_IRQPOLL,
+   .dev_id = _clockevent_tmrs[0],
+   .handler = kinetis_clockevent_tmr_irq_handler,
+   }, {
+ 

Re: [PATCHv5 2/2] mailbox: Adding driver for Xilinx LogiCORE IP mailbox.

2015-06-23 Thread Michal Simek
On 06/23/2015 08:00 PM, Moritz Fischer wrote:
> The Xilinx LogiCORE IP mailbox is a FPGA core that allows for
> interprocessor communication via AXI4 memory mapped / AXI4 stream
> interfaces.
> 
> It is single channel per core and allows for transmit and receive.
> 
> Changes from v4:
> - Have separate mbox_ops structs for polling / irq mode
> - Moved clk handling to startup / shutdown
> - Embedded struct mbox_chan in struct xilinx_mbox
> - Misc stylistic issues
> 
> Changes from v3:
> - Stylistic
> 
> Changes from v2:
> - Fixed error handling for IRQ from >= 0 to > 0
> - Fixed error handling for clock enabling
> - Addressed Michal's stylistic comments
> 
> Changes from v1:
> - Added common clock framework support
> - Deal with IRQs that happend before driver load,
>   since HW will not let us know about them when we enable IRQs
> 
> Changes from v0:
> - Several stylistic issues
> - Dropped superfluous intr_mode member
> - Really masking the IRQs on mailbox_shutdown
> - No longer using polling by accident in non-IRQ mode
> - Swapped doc and driver commits

BTW: These change logs shouldn't be the part of commit.

Thanks,
Michal
--
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/9] arm: select different compiler flags for ARM CortexM3

2015-06-23 Thread Paul Osmialowski

Hi Russell,

Thanks for the input. Seems like I trusted get_maintainer.pl blindly and 
wasn't selective - it resulted in recipient list much too long.


As for this patch, I think I went too far with adding it. The board boots 
without it properly, and since it covers more general Cortex-M related 
problems I guess it should be excluded from next iteration of the whole 
patchset.


The problems it adresses may still required further discussion, but I 
think it should not block the whole thing.


On Tue, 23 Jun 2015, Russell King - ARM Linux wrote:


On Tue, Jun 23, 2015 at 11:19:39PM +0200, Paul Osmialowski wrote:

This one is inspired by two commits published on Emcraft git repo:

https://github.com/EmcraftSystems/linux-emcraft.git

1) 6302b692f570ff9d5645a6e72c11f87b0c1aa409
 RT #62654. Fixed kernel crashes while running httpd by enabling
 "-mfix-cortex-m3-ldrd" compiler option, which prevents compiler from
 generating code like 'ldrd Ra, Rb, [Ra, #Imm]' - according to the 602117
 Cortex-M3 Errata it may result in incorrect base register when interrupted
 or faulted.

by: Yuri Tikhonov 

2) 359d3cda84c01c0f3fae1a519b97a31f318f57ab
 RT #62654. Removed "--march=..." leaving only "-mcpu=cortex-m3" to make
 sure only the correct instructions will be generated.

by: Sergei Poselenov 

I reworked these patches to make them less intrusive.

Signed-off-by: Paul Osmialowski 


NAK.

The EFM32 code already added core support for Cortex-M3 cores, under
the symbol CPU_V7M.  Rather than implementing a whole new set of
Cortex-M3 support alongside the existing code, please work with the
EFM32 maintainer (Uwe Kleine-König) to come up with a common set of
core changes that you can all agree on for Cortex-M3.

Please also try to be a little smarter with whom you're sending your
patches to, the Cc list looks to be excessively long - having soo many
recipients on your message is a good way to get your message rejected
by mailing lists as spam.

--
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.


Re: [GIT PULL] power supply changes for 4.2

2015-06-23 Thread Sebastian Reichel
Hi,

On Tue, Jun 23, 2015 at 04:13:34PM -0700, Linus Torvalds wrote:
> On Mon, Jun 22, 2015 at 5:53 PM, Sebastian Reichel  wrote:
> >
> >   git://git.infradead.org/battery-2.6.git tags/for-4.2
> 
> So I started wondering. Why do you use infradead for one of your
> trees, but git.kernel.org for the other (the HSI one)?
>
> That just looks odd to me.

Since I simply took over the existing repository for the power
supply subsystem (commit ad8464a2f31a54560b17d5fc6b1cca5fa68de83d).
This was not possible for the HSI subsystem, so I used
git.kernel.org infrastructure.

> Also, something in your HSI pull request made gmail unhappy, and
> it marked it as spam. Do you send the emails differently too?

No, both mails were sent in the same way.

-- Sebastian


signature.asc
Description: Digital signature


Re: [PATCH 0/7] soc: brcmstb: add system suspend support for STB SoCs

2015-06-23 Thread Florian Fainelli
Le 06/22/15 12:47, Brian Norris a écrit :
> + others
> 
> On Thu, Jun 18, 2015 at 05:11:29PM -0700, Brian Norris wrote:
>> Hi,
>>
>> This patch set introduces system suspend/resume support for Broadcom STB 
>> SoCs.
>> There are two suspend modes (S2 and S3) as well as a related low-power 
>> shutdown
>> mode (S5).
>>
>> Along with the core PM support, include a driver for the wakeup-timer, which
>> allows for simple testing of suspend/resume wakeup cycles.
>>
>> Brian
> 
> Somehow I completely missed out on sending this to a few of the right
> places, like linux-pm and the PM maintainers. I guess I just trusted
> get_maintainer.pl (which doesn't know what to do with drivers/soc/) too
> much, and forgot to turn my brain on...
> 
> Anyway, if y'all can track down the patches via archives, feel free. Or
> I will resend this shortly as a v2, with a few suggested fixes and with
> a more complete CC list.

Works for me, thanks for getting this out:

Reviewed-by: Florian Fainelli 

I would like some comments on the Device Tree binding portion so I can
take these patches and submit them for our next Broadcom arm-soc pull
requests, thanks!

> 
> Regards,
> Brian
> 
>> Brian Norris (7):
>>   Documentation: dt: brcmstb: add system PM bindings
>>   Documentation: dt: brcmstb: add waketimer documentation
>>   soc: add stubs for brcmstb SoC's
>>   soc: brcmstb: add PM suspend/resume support (S2/S3/S5)
>>   soc: brcmstb: add wake-timer driver
>>   ARM: brcmstb: mask GIC IRQs on suspend
>>   ARM: dts: brcmstb: add BCM7445 system PM DT nodes
>>
>>  .../ABI/testing/sysfs-driver-wktmr-brcmstb |  12 +
>>  .../devicetree/bindings/arm/bcm/brcm,brcmstb.txt   | 142 +-
>>  .../soc/brcmstb/brcm,brcmstb-waketimer.txt |  20 +
>>  arch/arm/boot/dts/bcm7445.dtsi | 102 
>>  arch/arm/mach-bcm/Kconfig  |   1 +
>>  arch/arm/mach-bcm/brcmstb.c|  10 +
>>  drivers/soc/Kconfig|   1 +
>>  drivers/soc/Makefile   |   1 +
>>  drivers/soc/brcmstb/Kconfig|  22 +
>>  drivers/soc/brcmstb/Makefile   |   4 +
>>  drivers/soc/brcmstb/common.c   |  33 ++
>>  drivers/soc/brcmstb/pm/Makefile|   1 +
>>  drivers/soc/brcmstb/pm/aon_defs.h  |  85 
>>  drivers/soc/brcmstb/pm/pm.c| 512 
>> +
>>  drivers/soc/brcmstb/pm/pm.h|  40 ++
>>  drivers/soc/brcmstb/pm/s2.S|  73 +++
>>  drivers/soc/brcmstb/wktmr.c| 242 ++
>>  include/soc/brcmstb/common.h   |  15 +
>>  18 files changed, 1314 insertions(+), 2 deletions(-)
>>  create mode 100644 Documentation/ABI/testing/sysfs-driver-wktmr-brcmstb
>>  create mode 100644 
>> Documentation/devicetree/bindings/soc/brcmstb/brcm,brcmstb-waketimer.txt
>>  create mode 100644 drivers/soc/brcmstb/Kconfig
>>  create mode 100644 drivers/soc/brcmstb/Makefile
>>  create mode 100644 drivers/soc/brcmstb/common.c
>>  create mode 100644 drivers/soc/brcmstb/pm/Makefile
>>  create mode 100644 drivers/soc/brcmstb/pm/aon_defs.h
>>  create mode 100644 drivers/soc/brcmstb/pm/pm.c
>>  create mode 100644 drivers/soc/brcmstb/pm/pm.h
>>  create mode 100644 drivers/soc/brcmstb/pm/s2.S
>>  create mode 100644 drivers/soc/brcmstb/wktmr.c
>>  create mode 100644 include/soc/brcmstb/common.h
>>
>> -- 
>> 1.9.1
>>


-- 
Florian
--
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 5/9] arm: twr-k70f120m: basic support for Kinetis TWR-K70F120M

2015-06-23 Thread Paul Osmialowski

Hi Arnd,

Thanks for all of your input. Your comments will all be considered during 
my works on the second iteration of this patchset.


On Wed, 24 Jun 2015, Arnd Bergmann wrote:


On Tuesday 23 June 2015 23:19:43 Paul Osmialowski wrote:

@@ -1740,7 +1752,7 @@ source "mm/Kconfig"
 config FORCE_MAX_ZONEORDER
int "Maximum zone order" if ARCH_SHMOBILE_LEGACY
range 11 64 if ARCH_SHMOBILE_LEGACY
-   default "12" if SOC_AM33XX
+   default "12" if SOC_AM33XX || ARCH_KINETIS
default "9" if SA || ARCH_EFM32
default "11"
help


Put it in the defconfig?


+#
+
+obj-$(CONFIG_MACH_KINETIS) += kinetis_platform.o


just use

obj-y   += kinetis.o


diff --git a/arch/arm/mach-kinetis/include/mach/idle.h 
b/arch/arm/mach-kinetis/include/mach/idle.h
new file mode 100644
index 000..0aafefd
--- /dev/null
+++ b/arch/arm/mach-kinetis/include/mach/idle.h


No mach/*.h files please.


+/*
+ * This Kinetis port assumes that the CPU works in little-endian mode.
+ * Switching to big-endian will require different bit offsets in peripheral
+ * devices' registers. Also, some bit groups may lay on byte edges, so issue
+ * with big-endian cannot be fixed only by defining bit offsets differently
+ * for the big-endian mode.
+ */
+#ifndef __LITTLE_ENDIAN
+#error This Kinetis port assumes that the CPU works in little-endian mode
+#endif


Fix the drivers instead?


+/*
+ * Peripheral memory map
+ */
+#define KINETIS_AIPS0PERIPH_BASE   0x4000
+#define KINETIS_AIPS1PERIPH_BASE   0x4008


Move it into DT


+/*
+ * System Integration Module (SIM) register map
+ *
+ * This map actually covers two hardware modules:
+ * 1. SIM low-power logic, at 0x40047000
+ * 2. System integration module (SIM), at 0x40048000
+ */
+struct kinetis_sim_regs {
+   u32 sopt1;  /* System Options Register 1 */
+   u32 rsv0[1024];
+   u32 sopt2;  /* System Options Register 2 */
+   u32 rsv1;
+   u32 sopt4;  /* System Options Register 4 */
+   u32 sopt5;  /* System Options Register 5 */
+   u32 sopt6;  /* System Options Register 6 */
+   u32 sopt7;  /* System Options Register 7 */
+   u32 rsv2[2];
+   u32 sdid;   /* System Device Identification Register */
+   u32 scgc[KINETIS_SIM_CG_NUMREGS];   /* Clock Gating Regs 1...7 */
+   u32 clkdiv1;/* System Clock Divider Register 1 */
+   u32 clkdiv2;/* System Clock Divider Register 2 */
+   u32 fcfg1;  /* Flash Configuration Register 1 */
+   u32 fcfg2;  /* Flash Configuration Register 2 */
+   u32 uidh;   /* Unique Identification Register High */
+   u32 uidmh;  /* Unique Identification Register Mid-High */
+   u32 uidml;  /* Unique Identification Register Mid Low */
+   u32 uidl;   /* Unique Identification Register Low */
+   u32 clkdiv3;/* System Clock Divider Register 3 */
+   u32 clkdiv4;/* System Clock Divider Register 4 */
+   u32 mcr;/* Misc Control Register */
+};


Move it into the driver that uses these.


+/*
+ * SIM registers base
+ */
+#define KINETIS_SIM_BASE   (KINETIS_AIPS0PERIPH_BASE + 0x00047000)
+#define KINETIS_SIM_PTR(reg) \
+   (&(((struct kinetis_sim_regs *)(KINETIS_SIM_BASE))->reg))
+#define KINETIS_SIM_RD(reg) readl_relaxed(KINETIS_SIM_PTR(reg))
+#define KINETIS_SIM_WR(reg, val) writel_relaxed((val), KINETIS_SIM_PTR(reg))
+#define KINETIS_SIM_SET(reg, mask) \
+   KINETIS_SIM_WR(reg, (KINETIS_SIM_RD(reg)) | (mask))
+#define KINETIS_SIM_RESET(reg, mask) \
+   KINETIS_SIM_WR(reg, (KINETIS_SIM_RD(reg)) & (~(mask)))
+#define KINETIS_SIM_ISSET(reg, mask) \
+   (KINETIS_SIM_RD(reg) & (mask))
+
+/*
+ * SIM registers
+ */
+/*
+ * System Options Register 2
+ */
+/* USB HS clock source select */
+#define KINETIS_SIM_SOPT2_USBHSRC_BITS 2
+#define KINETIS_SIM_SOPT2_USBHSRC_MSK  (3 << KINETIS_SIM_SOPT2_USBHSRC_BITS)
+#define KINETIS_SIM_SOPT2_USBHSRC_PLL0 (1 << KINETIS_SIM_SOPT2_USBHSRC_BITS)
+#define KINETIS_SIM_SOPT2_USBHSRC_PLL1 (2 << KINETIS_SIM_SOPT2_USBHSRC_BITS)
+
+/* USB FS clock source select */
+#define KINETIS_SIM_SOPT2_USBFSRC_BITS 22
+#define KINETIS_SIM_SOPT2_USBFSRC_MSK  (3 << KINETIS_SIM_SOPT2_USBFSRC_BITS)
+#define KINETIS_SIM_SOPT2_USBFSRC_PLL0 (1 << KINETIS_SIM_SOPT2_USBFSRC_BITS)
+#define KINETIS_SIM_SOPT2_USBFSRC_PLL1 (2 << KINETIS_SIM_SOPT2_USBFSRC_BITS)
+#define KINETIS_SIM_SOPT2_USBF_CLKSEL  (1 << 18)
+


remove all these here.


+/*
+ * Map required regions.
+ * This being the no-MMU Linux, I am not mapping anything
+ * since all I/O registers are available at their physical addresses.
+ */
+static void __init kinetis_map_io(void)
+{
+}


Not needed, remove.


+/*
+ * Freescale Kinetis platform initialization
+ */
+static void __init kinetis_init(void)
+{
+   of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}


same here.


diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types

Re: problem with checkpatch

2015-06-23 Thread Sudip Mukherjee
On Tue, Jun 23, 2015 at 10:31:46AM -0700, Joe Perches wrote:
> On Tue, 2015-06-23 at 18:06 +0530, Sudip Mukherjee wrote:
> > Hi Joe,
> > while checking patches I usually check them using mutt pipe to checkpatch.
> > while in mutt, press '|' and then scripts/checkpatch.pl -
> > and the patch will be checked by checkpatch without having to save it.
> > 
> > Now 700152391c3d ("checkpatch: add --showfile to allow input via pipe to 
> > show filenames")
> > is adding $filename ne '-' and because of that if the patch has any
> > error in Signed-off-by , it is not detecting anymore.
> 
> Any error in signature format should still be found,
> but a missing sign-off line would not.
yes, the patch with which i noticed this was not having the Signed-off

regards
sudip
--
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 v2] IB/srpt: Convert use of __constant_cpu_to_beXX to cpu_to_beXX

2015-06-23 Thread Vaishali Thakkar
In little endian cases, the macro cpu_to_be{16,32,64} unfolds to
__swab{16,32,64} which provides special case for constants. In
big endian cases, __constant_cpu_to_be{16,32,64} and
cpu_to_be{16,32,64} expand directly to the same expression. So,
replace __constant_cpu_to_be{16,32,64} with cpu_to_be{16,32,64}
with the goal of getting rid of the definitions of
__constant_cpu_to_be{16,32,64} completely.

The Coccinelle semantic patch that performs this transformation
is as follows:

@@expression x;@@

(
- __constant_cpu_to_be16(x)
+ cpu_to_be16(x)
|
- __constant_cpu_to_be32(x)
+ cpu_to_be32(x)
|
- __constant_cpu_to_be64(x)
+ cpu_to_be64(x)
)

Signed-off-by: Vaishali Thakkar 
---
Changes since v1:
- Shorten lines to 80 characters
---
 drivers/infiniband/ulp/srpt/ib_srpt.c | 71 +--
 1 file changed, 35 insertions(+), 36 deletions(-)

diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c 
b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 9b84b4c..ea651ba 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -303,7 +303,7 @@ static void srpt_get_iou(struct ib_dm_mad *mad)
int i;
 
ioui = (struct ib_dm_iou_info *)mad->data;
-   ioui->change_id = __constant_cpu_to_be16(1);
+   ioui->change_id = cpu_to_be16(1);
ioui->max_controllers = 16;
 
/* set present for slot 1 and empty for the rest */
@@ -331,13 +331,13 @@ static void srpt_get_ioc(struct srpt_port *sport, u32 
slot,
 
if (!slot || slot > 16) {
mad->mad_hdr.status
-   = __constant_cpu_to_be16(DM_MAD_STATUS_INVALID_FIELD);
+   = cpu_to_be16(DM_MAD_STATUS_INVALID_FIELD);
return;
}
 
if (slot > 2) {
mad->mad_hdr.status
-   = __constant_cpu_to_be16(DM_MAD_STATUS_NO_IOC);
+   = cpu_to_be16(DM_MAD_STATUS_NO_IOC);
return;
}
 
@@ -349,10 +349,10 @@ static void srpt_get_ioc(struct srpt_port *sport, u32 
slot,
iocp->device_version = cpu_to_be16(sdev->dev_attr.hw_ver);
iocp->subsys_vendor_id = cpu_to_be32(sdev->dev_attr.vendor_id);
iocp->subsys_device_id = 0x0;
-   iocp->io_class = __constant_cpu_to_be16(SRP_REV16A_IB_IO_CLASS);
-   iocp->io_subclass = __constant_cpu_to_be16(SRP_IO_SUBCLASS);
-   iocp->protocol = __constant_cpu_to_be16(SRP_PROTOCOL);
-   iocp->protocol_version = __constant_cpu_to_be16(SRP_PROTOCOL_VERSION);
+   iocp->io_class = cpu_to_be16(SRP_REV16A_IB_IO_CLASS);
+   iocp->io_subclass = cpu_to_be16(SRP_IO_SUBCLASS);
+   iocp->protocol = cpu_to_be16(SRP_PROTOCOL);
+   iocp->protocol_version = cpu_to_be16(SRP_PROTOCOL_VERSION);
iocp->send_queue_depth = cpu_to_be16(sdev->srq_size);
iocp->rdma_read_depth = 4;
iocp->send_size = cpu_to_be32(srp_max_req_size);
@@ -380,13 +380,13 @@ static void srpt_get_svc_entries(u64 ioc_guid,
 
if (!slot || slot > 16) {
mad->mad_hdr.status
-   = __constant_cpu_to_be16(DM_MAD_STATUS_INVALID_FIELD);
+   = cpu_to_be16(DM_MAD_STATUS_INVALID_FIELD);
return;
}
 
if (slot > 2 || lo > hi || hi > 1) {
mad->mad_hdr.status
-   = __constant_cpu_to_be16(DM_MAD_STATUS_NO_IOC);
+   = cpu_to_be16(DM_MAD_STATUS_NO_IOC);
return;
}
 
@@ -437,7 +437,7 @@ static void srpt_mgmt_method_get(struct srpt_port *sp, 
struct ib_mad *rq_mad,
break;
default:
rsp_mad->mad_hdr.status =
-   __constant_cpu_to_be16(DM_MAD_STATUS_UNSUP_METHOD_ATTR);
+   cpu_to_be16(DM_MAD_STATUS_UNSUP_METHOD_ATTR);
break;
}
 }
@@ -493,11 +493,11 @@ static void srpt_mad_recv_handler(struct ib_mad_agent 
*mad_agent,
break;
case IB_MGMT_METHOD_SET:
dm_mad->mad_hdr.status =
-   __constant_cpu_to_be16(DM_MAD_STATUS_UNSUP_METHOD_ATTR);
+   cpu_to_be16(DM_MAD_STATUS_UNSUP_METHOD_ATTR);
break;
default:
dm_mad->mad_hdr.status =
-   __constant_cpu_to_be16(DM_MAD_STATUS_UNSUP_METHOD);
+   cpu_to_be16(DM_MAD_STATUS_UNSUP_METHOD);
break;
}
 
@@ -1539,7 +1539,7 @@ static int srpt_build_cmd_rsp(struct srpt_rdma_ch *ch,
memset(srp_rsp, 0, sizeof *srp_rsp);
srp_rsp->opcode = SRP_RSP;
srp_rsp->req_lim_delta =
-   __constant_cpu_to_be32(1 + atomic_xchg(>req_lim_delta, 0));
+   cpu_to_be32(1 + atomic_xchg(>req_lim_delta, 0));
srp_rsp->tag = tag;
srp_rsp->status = status;
 
@@ -1589,8 +1589,8 @@ static int srpt_build_tskmgmt_rsp(struct srpt_rdma_ch *ch,
memset(srp_rsp, 0, sizeof *srp_rsp);
 
srp_rsp->opcode = SRP_RSP;
- 

Re: [PATCH 1/2] Move the pt_regs_offset struct definition from arch to common include file

2015-06-23 Thread Michael Ellerman
On Tue, 2015-06-23 at 09:48 -0400, David Long wrote:
> On 06/22/15 23:32, Michael Ellerman wrote:
> > On Fri, 2015-06-19 at 10:12 -0400, David Long wrote:
> >> On 06/19/15 00:19, Michael Ellerman wrote:
> >>> On Mon, 2015-06-15 at 12:42 -0400, David Long wrote:
>  From: "David A. Long" 
> 
>  The pt_regs_offset structure is used for HAVE_REGS_AND_STACK_ACCESS_API
> feature and has identical definitions in four different arch ptrace.h
>  include files. It seems unlikely that definition would ever need to be
>  changed regardless of architecture so lets move it into
>  include/linux/ptrace.h.
> 
>  Signed-off-by: David A. Long 
>  ---
> arch/powerpc/kernel/ptrace.c | 5 -
> >>>
> >>> Built and booted on powerpc, but is there an easy way to actually test 
> >>> the code
> >>> paths in question?
> >>
> >> There is an easy way to "smoke test" it on all archiectures that also
> >> implement kprobes (which powerpc does).  If I'm understanding the
> >> powerpc code correctly (WRT register naming conventions) just do the
> >> following:
> >>
> >> cd /sys/kernel/debug/tracing
> >> echo 'p do_fork %gpr0' > kprobe_events
> >> echo 1 > events/kprobes/enable
> >> ls
> >> cat trace
> >> echo 0 > events/kprobes/enable
> >>
> >> Every fork() call done on the system between those two echo commands
> >> (hence the "ls") should append a line to the trace file.  For a more
> >> exhaustive test one could repeat this sequence for every register in the
> >> architecture.
> >
> > OK, so I went the whole hog and did:
> >
> > $ echo 'p do_fork %gpr0 %gpr1 %gpr2 %gpr3 %gpr4 %gpr5 %gpr6 %gpr7 %gpr8 
> > %gpr9 %gpr10 %gpr11 %gpr12 %gpr13 %gpr14 %gpr15 %gpr16 %gpr17 %gpr18 %gpr19 
> > %gpr20 %gpr21 %gpr22 %gpr23 %gpr24 %gpr25 %gpr26 %gpr27 %gpr28 %gpr29 
> > %gpr30 %gpr31 %nip %msr %ctr %link %xer %ccr %softe %trap %dar %dsisr' > 
> > kprobe_events
> >
> > And I get:
> >
> >  bash-2057  [001] d...   535.433941: p_do_fork_0: 
> > (do_fork+0x8/0x490) arg1=0xc00094d0 arg2=0xc001fbe9be30 
> > arg3=0xc1133bb8 arg4=0x1200011 arg5=0x0 arg6=0x0 arg7=0x0 
> > arg8=0x3fff7c885940 arg9=0x1 arg10=0xc001fbe9bea0 arg11=0x0 arg12=0xc01 
> > arg13=0xc00094c8 arg14=0xcfdc0480 arg15=0x0 
> > arg16=0x2200 arg17=0x1016d6e8 arg18=0x0 arg19=0x4400 arg20=0x0 
> > arg21=0x10037c82208 arg22=0x1017b008 arg23=0x10143d18 arg24=0x10178854 
> > arg25=0x10144f90 arg26=0x10037c821e8 arg27=0x0 arg28=0x0 arg29=0x0 
> > arg30=0x0 arg31=0x809 arg32=0x3788c010 arg33=0xc00a7fe8 
> > arg34=0x80029033 arg35=0xc00094c8 arg36=0xc00094d0 
> > arg37=0x0 arg38=0x4844 arg39=0x1 arg40=0x700 arg41=0xc001fbe9bd50 
> > arg42=0xc001fbe9bd30
> >
> > Which is ugly as hell, but appears unchanged since before your patch.
> >
> 
> Excellent.  Many thanks.

No worries.

Did I already send you an ack? Have another one in case:

Acked-by: Michael Ellerman 


> > I take it it's expected that the names are not decoded in the output?
>
> Yes.

In fact I don't see anywhere that uses the reverse decoding, ie.
regs_query_register_name().

cheers


--
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] regulator: s2mps11: Fix GPIO suspend enable shift wrapping bug

2015-06-23 Thread Krzysztof Kozlowski
2015-05-28 23:44 GMT+09:00 Mark Brown :
> On Wed, May 27, 2015 at 12:22:08PM +0900, Krzysztof Kozlowski wrote:
>> Status of enabling suspend mode for regulator was stored in bitmap-like
>> long integer.
>
> Applied, thanks.

Mark, what happened with this patch? I can't find it in your tree.
--
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: powerpc,numa: Memory hotplug to memory-less nodes ?

2015-06-23 Thread Bharata B Rao
So will it be correct to say that memory hotplug to memory-less node
isn't supported by PowerPC kernel ? Should I enforce the same in QEMU
for PowerKVM ?

On Mon, Jun 22, 2015 at 10:18 AM, Bharata B Rao  wrote:
> Hi,
>
> While developing memory hotplug support in QEMU for PoweKVM, I
> realized that guest kernel has specific checks to prevent hot addition
> of memory to a memory-less node.
>
> I am referring to arch/powerpc/mm/numa.c:hot_add_scn_to_nid() which
> has explicit checks to ensure that it returns a nid that has some some
> memory (NODE_DATA(nid)->node_spanned_pages) even when user wants to
> hotplug to a node that currently has zero memory.
>
> Is this limitation by design ?
>
> Regards,
> Bharata.
> --
> http://raobharata.wordpress.com/



-- 
http://raobharata.wordpress.com/
--
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 v2 6/7]powerpc/powernv: generic nest pmu event functions

2015-06-23 Thread Madhavan Srinivasan


On Tuesday 23 June 2015 07:19 AM, Sukadev Bhattiprolu wrote:
> Madhavan Srinivasan [ma...@linux.vnet.ibm.com] wrote:
> | From: Madhavan Srinivasan 
> | Subject: [PATCH v2 6/7]powerpc/powernv: generic nest pmu event functions
> | 
> | Add generic format attribute and set of generic nest pmu related
> | event functions to be used by each nest pmu. Add code to register nest pmus.
> | 
> | Cc: Michael Ellerman 
> | Cc: Benjamin Herrenschmidt 
> | Cc: Paul Mackerras 
> | Cc: Anton Blanchard 
> | Cc: Sukadev Bhattiprolu 
> | Cc: Anshuman Khandual 
> | Cc: Stephane Eranian 
> | Signed-off-by: Madhavan Srinivasan 
> | ---
> |  arch/powerpc/perf/nest-pmu.c | 109 
> +++
> |  1 file changed, 109 insertions(+)
> | 
> | diff --git a/arch/powerpc/perf/nest-pmu.c b/arch/powerpc/perf/nest-pmu.c
> | index 8fad2d9..a662c14 100644
> | --- a/arch/powerpc/perf/nest-pmu.c
> | +++ b/arch/powerpc/perf/nest-pmu.c
> | @@ -13,6 +13,108 @@
> |  static struct perchip_nest_info p8_perchip_nest_info[P8_MAX_CHIP];
> |  static struct nest_pmu *per_nest_pmu_arr[P8_MAX_NEST_PMUS];
> | 
> | +PMU_FORMAT_ATTR(event, "config:0-20");
> | +struct attribute *p8_nest_format_attrs[] = {
> | +   _attr_event.attr,
> | +   NULL,
> | +};
> | +
> | +struct attribute_group p8_nest_format_group = {
> | +   .name = "format",
> | +   .attrs = p8_nest_format_attrs,
> | +};
>
> Could this be included in previous/separate patch? That way,
> this patch could focus on just registering the nest-pmu.

Yes. Will move it.

> | +
> | +static int p8_nest_event_init(struct perf_event *event)
> | +{
> | +   int chip_id;
> | +
> | +   if (event->attr.type != event->pmu->type)
> | +   return -ENOENT;
> | +
> | +   /* Sampling not supported yet */
> | +   if (event->hw.sample_period)
> | +   return -EINVAL;
> | +
> | +   /* unsupported modes and filters */
> | +   if (event->attr.exclude_user   ||
> | +   event->attr.exclude_kernel ||
> | +   event->attr.exclude_hv ||
> | +   event->attr.exclude_idle   ||
> | +   event->attr.exclude_host   ||
> | +   event->attr.exclude_guest)
> | +   return -EINVAL;
> | +
> | +   if (event->cpu < 0)
> | +   return -EINVAL;
> | +
> | +   chip_id = topology_physical_package_id(event->cpu);
> | +   event->hw.event_base = event->attr.config +
> | +   p8_perchip_nest_info[chip_id].vbase;
> | +
> | +   return 0;
> | +}
> | +
> | +static void p8_nest_read_counter(struct perf_event *event)
> | +{
> | +   u64 *addr;
> | 
>
> Define as uint64_t so we can eliminate one cast below? Would also
> be consistent with p8_nest_perf_event_update().
Yes make sense.

> | 
> | +   u64 data = 0;
> | +
> | +   addr = (u64 *)event->hw.event_base;
> | +   data = __be64_to_cpu((uint64_t)*addr);
> | +   local64_set(>hw.prev_count, data);
> | +}
> | +
> | +static void p8_nest_perf_event_update(struct perf_event *event)
> | +{
> | +   u64 counter_prev, counter_new, final_count;
> | +   uint64_t *addr;
> | +
> | +   addr = (u64 *)event->hw.event_base;
>
> uint64_t *?
My bad.  will change it.

> | +   counter_prev = local64_read(>hw.prev_count);
> | +   counter_new = __be64_to_cpu((uint64_t)*addr);
>
> Redundant cast? addr is already uint64_t *?

Nice catch. Will remove it.
> | +   final_count = counter_new - counter_prev;
> | +
> | +   local64_set(>hw.prev_count, counter_new);
> | +   local64_add(final_count, >count);
> | +}
> | +
> | +static void p8_nest_event_start(struct perf_event *event, int flags)
> | +{
>
> Check PERF_EF_RELOAD before reloading?
>
> | +   event->hw.state = 0;
> | +   p8_nest_read_counter(event);
> | +}
> | +
> | +static void p8_nest_event_stop(struct perf_event *event, int flags)
> | +{
>
> Check PERF_EF_UPDATE when stopping?
>
> | +   p8_nest_perf_event_update(event);
> | +}
> | +
> | +static int p8_nest_event_add(struct perf_event *event, int flags)
> | +{
>
> Check PERF_EF_START flags before starting the counter on an ->add()?
Will add the flags.

> | +   p8_nest_event_start(event, flags);
> | +   return 0;
> | +}
> | +
> | +/*
> | + * Populate pmu ops in the structure
> | + */
> | +static int update_pmu_ops(struct nest_pmu *pmu)
> | +{
> | +   if (!pmu)
> | +   return -EINVAL;
> | +
> | +   pmu->pmu.task_ctx_nr = perf_invalid_context;
> | +   pmu->pmu.event_init = p8_nest_event_init;
> | +   pmu->pmu.add = p8_nest_event_add;
> | +   pmu->pmu.del = p8_nest_event_stop;
> | +   pmu->pmu.start = p8_nest_event_start;
> | +   pmu->pmu.stop = p8_nest_event_stop;
> | +   pmu->pmu.read = p8_nest_perf_event_update;
> | +   pmu->pmu.attr_groups = pmu->attr_groups;
> | +
> | +   return 0;
> | +}
> | +
> |  /*
> |   * Populate event name and string in attribute
> |   */
> | @@ -106,6 +208,7 @@ static int nest_pmu_create(struct device_node *dev, int 
> pmu_index)
> | /* Save the name to register the PMU with it */
> | sprintf(buf, "Nest_%s", (char *)pp->value);
> | 

[PATCH v2] ARM: Fix build if CLKDEV_LOOKUP is not configured

2015-06-23 Thread Guenter Roeck
mips:allmodconfig fails to build with

drivers/clocksource/timer-sp804.c:
In function '__sp804_clocksource_and_sched_clock_init':
drivers/clocksource/timer-sp804.c:88:3: error:
implicit declaration of function 'clk_get_sys'

because CLKDEV_LOOKUP is not configured and the driver depends on it.

Fixes: 0b7402dce445 ("ARM: 8366/1: move Dual-Timer SP804 driver to
drivers/clocksource")
Cc: Sudeep Holla 
Acked-by: Sudeep Holla 
Signed-off-by: Guenter Roeck 
---
v2: Added Ack
Send to ARM mailing list and maintainer

 drivers/clocksource/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 60d7d3d204d3..d2a26f1f30e9 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -144,7 +144,7 @@ config ARM_GLOBAL_TIMER
 
 config ARM_TIMER_SP804
bool "Support for Dual Timer SP804 module"
-   depends on GENERIC_SCHED_CLOCK
+   depends on GENERIC_SCHED_CLOCK && CLKDEV_LOOKUP
select CLKSRC_MMIO
select CLKSRC_OF if OF
 
-- 
2.1.0

--
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 v7] NET: Add ezchip ethernet driver

2015-06-23 Thread Paul Gortmaker
On Tue, Jun 23, 2015 at 4:43 AM, Noam Camus  wrote:
> From: Noam Camus 
>
> Simple LAN device for debug or management purposes.
> Device supports interrupts for RX and TX(completion).
> Device does not have DMA ability.
>
> Signed-off-by: Noam Camus 
> Signed-off-by: Tal Zilcer 
> Acked-by: Alexey Brodkin 
> ---
> Change log for v7
>
> 1) Update nps_enet_open() comment header. (Rami Rosen)
> 2) fix return value of nps_enet_probe() when register_netdev() fails. (Rami 
> Rosen)
> 3) Fix Kconfig Help and add dependencies. (Paul Gortmaker)

Hi Noam,

Thanks for making the changes I suggested.  But in the future, if you
get review comments from bob.sm...@somewhere.com on version
N of your patchset, then add bob.sm...@somewhere.com to the v(N+1)
send of the revised patch set.  There is a lot of mail traffic and if the
above does not happen, then your updates may not be seen.

Thanks,
P.
--

>
> NOTE: with new dependencies,OF && OF_NET need to be in your configuration.
> Otherwise the driver will not be chosen and built.
> ---
>  .../devicetree/bindings/net/ezchip_enet.txt|   15 +
>  drivers/net/ethernet/Kconfig   |1 +
>  drivers/net/ethernet/Makefile  |1 +
>  drivers/net/ethernet/ezchip/Kconfig|   26 +
>  drivers/net/ethernet/ezchip/Makefile   |1 +
>  drivers/net/ethernet/ezchip/nps_enet.c |  658 
> 
>  drivers/net/ethernet/ezchip/nps_enet.h |  336 ++
>  7 files changed, 1038 insertions(+), 0 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/net/ezchip_enet.txt
>  create mode 100644 drivers/net/ethernet/ezchip/Kconfig
>  create mode 100644 drivers/net/ethernet/ezchip/Makefile
>  create mode 100644 drivers/net/ethernet/ezchip/nps_enet.c
>  create mode 100644 drivers/net/ethernet/ezchip/nps_enet.h
>
> diff --git a/Documentation/devicetree/bindings/net/ezchip_enet.txt 
> b/Documentation/devicetree/bindings/net/ezchip_enet.txt
> new file mode 100644
> index 000..4e29b2b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/ezchip_enet.txt
> @@ -0,0 +1,15 @@
> +* EZchip NPS Management Ethernet port driver
> +
> +Required properties:
> +- compatible: Should be "ezchip,nps-mgt-enet"
> +- reg: Address and length of the register set for the device
> +- interrupts: Should contain the ENET interrupt
> +
> +Examples:
> +
> +   ethernet@f0003000 {
> +   compatible = "ezchip,nps-mgt-enet";
> +   reg = <0xf0003000 0x44>;
> +   interrupts = <7>;
> +   mac-address = [ 00 11 22 33 44 55 ];
> +   };
> diff --git a/drivers/net/ethernet/Kconfig b/drivers/net/ethernet/Kconfig
> index eadcb05..1a6b1ba 100644
> --- a/drivers/net/ethernet/Kconfig
> +++ b/drivers/net/ethernet/Kconfig
> @@ -66,6 +66,7 @@ config DNET
>  source "drivers/net/ethernet/dec/Kconfig"
>  source "drivers/net/ethernet/dlink/Kconfig"
>  source "drivers/net/ethernet/emulex/Kconfig"
> +source "drivers/net/ethernet/ezchip/Kconfig"
>  source "drivers/net/ethernet/neterion/Kconfig"
>  source "drivers/net/ethernet/faraday/Kconfig"
>  source "drivers/net/ethernet/freescale/Kconfig"
> diff --git a/drivers/net/ethernet/Makefile b/drivers/net/ethernet/Makefile
> index 1367afc..489f9cc 100644
> --- a/drivers/net/ethernet/Makefile
> +++ b/drivers/net/ethernet/Makefile
> @@ -29,6 +29,7 @@ obj-$(CONFIG_DNET) += dnet.o
>  obj-$(CONFIG_NET_VENDOR_DEC) += dec/
>  obj-$(CONFIG_NET_VENDOR_DLINK) += dlink/
>  obj-$(CONFIG_NET_VENDOR_EMULEX) += emulex/
> +obj-$(CONFIG_NET_VENDOR_EZCHIP) += ezchip/
>  obj-$(CONFIG_NET_VENDOR_EXAR) += neterion/
>  obj-$(CONFIG_NET_VENDOR_FARADAY) += faraday/
>  obj-$(CONFIG_NET_VENDOR_FREESCALE) += freescale/
> diff --git a/drivers/net/ethernet/ezchip/Kconfig 
> b/drivers/net/ethernet/ezchip/Kconfig
> new file mode 100644
> index 000..48ecbc8
> --- /dev/null
> +++ b/drivers/net/ethernet/ezchip/Kconfig
> @@ -0,0 +1,26 @@
> +#
> +# EZchip network device configuration
> +#
> +
> +config NET_VENDOR_EZCHIP
> +   bool "EZchip devices"
> +   default y
> +   ---help---
> + If you have a network (Ethernet) device belonging to this class, 
> say Y.
> +
> + Note that the answer to this question doesn't directly affect the
> + kernel: saying N will just cause the configurator to skip all
> + the questions about EZchip devices. If you say Y, you will be asked 
> for
> + your specific device in the following questions.
> +
> +if NET_VENDOR_EZCHIP
> +
> +config EZCHIP_NPS_MANAGEMENT_ENET
> +   tristate "EZchip NPS management enet support"
> +   depends on OF_IRQ && OF_NET
> +   ---help---
> + Simple LAN device for debug or management purposes.
> + Device supports interrupts for RX and TX(completion).
> + Device does not have DMA ability.
> +
> +endif
> diff --git a/drivers/net/ethernet/ezchip/Makefile 
> b/drivers/net/ethernet/ezchip/Makefile
> new file 

[PATCH][SCSI] hptiop: Support HighPoint RR36xx HBAs and Support SAS tape and SAS media changer

2015-06-23 Thread linux
Support HighPoint RR36xx HBAs which are based on Marvell Frey.
Support SAS tape and SAS media changer.

Signed-off-by: HighPoint Linux Team 

 drivers/scsi/hptiop.c |  104
+++
 drivers/scsi/hptiop.h |6 +--
 2 files changed, 69 insertions(+), 41 deletions(-)

diff -urN linux.git/drivers/scsi/hptiop.c linux/drivers/scsi/hptiop.c
--- linux.git/drivers/scsi/hptiop.c 2015-06-08 01:48:38.09375 -0400
+++ linux/drivers/scsi/hptiop.c 2015-06-08 02:45:33.234375000 -0400
@@ -1,6 +1,6 @@
 /*
  * HighPoint RR3xxx/4xxx controller driver for Linux
- * Copyright (C) 2006-2012 HighPoint Technologies, Inc. All Rights
Reserved.
+ * Copyright (C) 2006-2015 HighPoint Technologies, Inc. All Rights
Reserved.
  *
  * 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
@@ -42,7 +42,7 @@
 
 static char driver_name[] = "hptiop";
 static const char driver_name_long[] = "RocketRAID 3xxx/4xxx Controller
driver";
-static const char driver_ver[] = "v1.8";
+static const char driver_ver[] = "v1.10.0";
 
 static int iop_send_sync_msg(struct hptiop_hba *hba, u32 msg, u32
millisec);
 static void hptiop_finish_scsi_req(struct hptiop_hba *hba, u32 tag,
@@ -764,9 +764,7 @@
scsi_set_resid(scp,
scsi_bufflen(scp) -
le32_to_cpu(req->dataxfer_length));
scp->result = SAM_STAT_CHECK_CONDITION;
-   memcpy(scp->sense_buffer, >sg_list,
-   min_t(size_t, SCSI_SENSE_BUFFERSIZE,
-   le32_to_cpu(req->dataxfer_length)));
+   memcpy(scp->sense_buffer, >sg_list,
SCSI_SENSE_BUFFERSIZE);
goto skip_resid;
break;
 
@@ -1036,9 +1034,10 @@
_req->index, _req->req_virt);
 
scp->result = 0;
-
-   if (scp->device->channel || scp->device->lun ||
-   scp->device->id > hba->max_devices) {
+   
+   if (scp->device->channel ||
+   (scp->device->id > hba->max_devices) ||
+   ((scp->device->id == (hba->max_devices-1)) &&
scp->device->lun)) {
scp->result = DID_BAD_TARGET << 16;
free_req(hba, _req);
goto cmd_done;
@@ -1168,6 +1167,14 @@
NULL
 };
 
+static int hptiop_slave_config(struct scsi_device *sdev)
+{
+   if (sdev->type == TYPE_TAPE)
+   blk_queue_max_hw_sectors(sdev->request_queue, 8192);
+
+   return 0;
+}
+
 static struct scsi_host_template driver_template = {
.module = THIS_MODULE,
.name   = driver_name,
@@ -1179,6 +1186,7 @@
.use_clustering = ENABLE_CLUSTERING,
.proc_name  = driver_name,
.shost_attrs= hptiop_attrs,
+   .slave_configure= hptiop_slave_config,
.this_id= -1,
.change_queue_depth = hptiop_adjust_disk_queue_depth,
 };
@@ -1323,7 +1331,8 @@
}
 
hba = (struct hptiop_hba *)host->hostdata;
-
+   memset(hba, 0, sizeof(struct hptiop_hba));
+   
hba->ops = iop_ops;
hba->pcidev = pcidev;
hba->host = host;
@@ -1336,7 +1345,7 @@
init_waitqueue_head(>reset_wq);
init_waitqueue_head(>ioctl_wq);
 
-   host->max_lun = 1;
+   host->max_lun = 128;
host->max_channel = 0;
host->io_port = 0;
host->n_io_port = 0;
@@ -1428,34 +1437,33 @@
dprintk("req_size=%d, max_requests=%d\n", req_size,
hba->max_requests);
 
hba->req_size = req_size;
-   start_virt = dma_alloc_coherent(>dev,
-   hba->req_size*hba->max_requests + 0x20,
-   _phy, GFP_KERNEL);
-
-   if (!start_virt) {
-   printk(KERN_ERR "scsi%d: fail to alloc request mem\n",
-   hba->host->host_no);
-   goto free_request_irq;
-   }
-
-   hba->dma_coherent = start_virt;
-   hba->dma_coherent_handle = start_phy;
-
-   if ((start_phy & 0x1f) != 0) {
-   offset = ((start_phy + 0x1f) & ~0x1f) - start_phy;
-   start_phy += offset;
-   start_virt += offset;
-   }
-
hba->req_list = NULL;
+   
for (i = 0; i < hba->max_requests; i++) {
+   start_virt = dma_alloc_coherent(>dev,
+   hba->req_size + 0x20,
+   _phy, GFP_KERNEL);
+
+   if (!start_virt) {
+   printk(KERN_ERR "scsi%d: fail to alloc request
mem\n",
+   hba->host->host_no);
+   goto free_request_mem;
+   }
+
+   hba->dma_coherent[i] = start_virt;
+   

linux-next: manual merge of the dt-rh tree with the arm-soc tree

2015-06-23 Thread Stephen Rothwell
Hi Rob,

Today's linux-next merge of the dt-rh tree got a conflict in:

  Documentation/devicetree/bindings/vendor-prefixes.txt

between commit:

  d5553cb05a04 ("ARM: dts: zx: add an initial zx296702 dts and doc")

from the arm-soc tree and commit:

  72d942e23cda ("of: Add vendor prefix for Zodiac Inflight Innovations")

from the dt-rh tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc Documentation/devicetree/bindings/vendor-prefixes.txt
index a0aa80bb3480,c400c95abc67..
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@@ -225,4 -211,4 +225,5 @@@ xillybus   Xillybus Ltd
  xlnx  Xilinx
  zyxel ZyXEL Communications Corp.
  zarlink   Zarlink Semiconductor
+ zii   Zodiac Inflight Innovations
 +zte   ZTE Corp.


pgp1bvpwGtDm4.pgp
Description: OpenPGP digital signature


Re: [PATCH V2 04/10] Drivers: hv: vmbus: add special kexec handler

2015-06-23 Thread Greg KH
On Tue, Jun 23, 2015 at 06:28:36PM +0200, Vitaly Kuznetsov wrote:
> Olaf Hering  writes:
> 
> > On Thu, Jun 04, K. Y. Srinivasan wrote:
> >
> >> +++ b/arch/x86/kernel/cpu/mshyperv.c
> >> @@ -18,6 +18,9 @@
> >>  #include 
> >>  #include 
> >>  #include 
> >> +#ifdef CONFIG_KEXEC
> >> +#include 
> >> +#endif
> >
> > Is this #ifdef required?
> >
> 
> No, it's not, but other parts of the same patch do (e.g. there is no
> kexec_in_progress without CONFIG_KEXEC). We can probably omit #ifdef
> here but I'm not sure it makes sense.

No #ifdef should be in a .c file if at all possible, so please remove
them all if you can.  If not, then work to fix up the .h file properly
so that you can.

thanks,

greg k-h
--
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 v2 12/28] ACPICA: Add dragon_fly support to unix file mapping file.

2015-06-23 Thread Lv Zheng
From: Sascha Wildner 

ACPICA commit 795b215d6fd062386f0a1c23dff9ffa244683c4f

ACPICA BZ 1130

This patch doesn't affect Linux kernel.

Link: https://bugs.acpica.org/show_bug.cgi?id=1130
Link: https://github.com/acpica/acpica/commit/795b215d
Signed-off-by: Sascha Wildner 
Signed-off-by: Bob Moore 
Signed-off-by: Lv Zheng 
---
 tools/power/acpi/os_specific/service_layers/osunixmap.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/power/acpi/os_specific/service_layers/osunixmap.c 
b/tools/power/acpi/os_specific/service_layers/osunixmap.c
index 0b1fa29..44ad488 100644
--- a/tools/power/acpi/os_specific/service_layers/osunixmap.c
+++ b/tools/power/acpi/os_specific/service_layers/osunixmap.c
@@ -54,7 +54,7 @@ ACPI_MODULE_NAME("osunixmap")
 #ifndef O_BINARY
 #define O_BINARY 0
 #endif
-#ifdef _free_BSD
+#if defined(_dragon_fly) || defined(_free_BSD)
 #define MMAP_FLAGS  MAP_SHARED
 #else
 #define MMAP_FLAGS  MAP_PRIVATE
-- 
1.7.10

--
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 v2 04/28] ACPICA: Tables: Enable both 32-bit and 64-bit FACS.

2015-06-23 Thread Lv Zheng
ACPICA commit f7b86f35416e3d1f71c3d816ff5075ddd33ed486

The following commit is reported to have broken s2ram on some platforms:
 Commit: 0249ed2444d65d65fc3f3f64f398f1ad0b7e54cd
 ACPICA: Add option to favor 32-bit FADT addresses.
The platform reports 2 FACS tables (which is not allowed by ACPI
specification) and the new 32-bit address favor rule forces OSPMs to use
the FACS table reported via FADT's X_FIRMWARE_CTRL field.

The root cause of the reported bug might be one of the followings:
1. BIOS may favor the 64-bit firmware waking vector address when the
   version of the FACS is greater than 0 and Linux currently only supports
   resuming from the real mode, so the 64-bit firmware waking vector has
   never been set and might be invalid to BIOS while the commit enables
   higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the
   FADT while the commit doesn't set the firmware waking vector address of
   the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking
   vector address of the FACS reported by "X_FIRMWARE_CTRL".

This patch excludes the cases that can trigger the bugs caused by the root
cause 2.

There is no handshaking mechanism can be used by OSPM to tell BIOS which
FACS is currently used. Thus the FACS reported by "FIRMWARE_CTRL" may still
be used by BIOS and the 0 value of the 32-bit firmware waking vector might
trigger such failure.

This patch tries to favor 32bit FACS address in another way where both the
FACS reported by "FIRMWARE_CTRL" and the FACS reported by "X_FIRMWARE_CTRL"
are loaded so that further commit can set firmware waking vector in the
both tables to ensure we can exclude the cases that trigger the bugs caused
by the root cause 2. The exclusion is split into 2 commits as this commit
is also useful for dumping more ACPI tables, it won't get reverted when
such exclusion is no longer necessary. Lv Zheng.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=74021
Link: https://github.com/acpica/acpica/commit/f7b86f35
Cc: 3.14.1+  # 3.14.1+
Reported-and-tested-by: Oswald Buddenhagen 
Signed-off-by: Lv Zheng 
Signed-off-by: Bob Moore 
---
 drivers/acpi/acpica/aclocal.h  |1 +
 drivers/acpi/acpica/tbfadt.c   |   21 +
 drivers/acpi/acpica/tbutils.c  |   37 ++---
 drivers/acpi/acpica/tbxfload.c |3 ++-
 include/acpi/acpixf.h  |9 +
 5 files changed, 51 insertions(+), 20 deletions(-)

diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index ffdb956..bc60096 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -213,6 +213,7 @@ struct acpi_table_list {
 
 #define ACPI_TABLE_INDEX_DSDT   (0)
 #define ACPI_TABLE_INDEX_FACS   (1)
+#define ACPI_TABLE_INDEX_X_FACS (2)
 
 struct acpi_find_context {
char *search_for;
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c
index 7d24860..05be59c 100644
--- a/drivers/acpi/acpica/tbfadt.c
+++ b/drivers/acpi/acpica/tbfadt.c
@@ -350,9 +350,18 @@ void acpi_tb_parse_fadt(u32 table_index)
/* If Hardware Reduced flag is set, there is no FACS */
 
if (!acpi_gbl_reduced_hardware) {
-   acpi_tb_install_fixed_table((acpi_physical_address)
-   acpi_gbl_FADT.Xfacs, ACPI_SIG_FACS,
-   ACPI_TABLE_INDEX_FACS);
+   if (acpi_gbl_FADT.facs) {
+   acpi_tb_install_fixed_table((acpi_physical_address)
+   acpi_gbl_FADT.facs,
+   ACPI_SIG_FACS,
+   ACPI_TABLE_INDEX_FACS);
+   }
+   if (acpi_gbl_FADT.Xfacs) {
+   acpi_tb_install_fixed_table((acpi_physical_address)
+   acpi_gbl_FADT.Xfacs,
+   ACPI_SIG_FACS,
+   ACPI_TABLE_INDEX_X_FACS);
+   }
}
 }
 
@@ -491,13 +500,9 @@ static void acpi_tb_convert_fadt(void)
acpi_gbl_FADT.header.length = sizeof(struct acpi_table_fadt);
 
/*
-* Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary.
+* Expand the 32-bit DSDT addresses to 64-bit as necessary.
 * Later ACPICA code will always use the X 64-bit field.
 */
-   acpi_gbl_FADT.Xfacs = acpi_tb_select_address("FACS",
-acpi_gbl_FADT.facs,
-acpi_gbl_FADT.Xfacs);
-
acpi_gbl_FADT.Xdsdt = acpi_tb_select_address("DSDT",
 acpi_gbl_FADT.dsdt,
 acpi_gbl_FADT.Xdsdt);
diff --git a/drivers/acpi/acpica/tbutils.c 

[PATCH v2 07/28] ACPICA: Tables: Fix an issue that FACS initialization is performed twice.

2015-06-23 Thread Lv Zheng
ACPICA commit 90f5332a15e9d9ba83831ca700b2b9f708274658

This patch adds a new FACS initialization flag for acpi_tb_initialize().
acpi_enable_subsystem() might be invoked several times in OS bootup process,
and we don't want FACS initialization to be invoked twice. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/90f5332a
Cc: All applicable  # All applicable
Signed-off-by: Lv Zheng 
Signed-off-by: Bob Moore 
---
 drivers/acpi/acpica/utxfinit.c |   10 ++
 include/acpi/actypes.h |1 +
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/acpica/utxfinit.c b/drivers/acpi/acpica/utxfinit.c
index 083a768..42a32a6 100644
--- a/drivers/acpi/acpica/utxfinit.c
+++ b/drivers/acpi/acpica/utxfinit.c
@@ -179,10 +179,12 @@ acpi_status __init acpi_enable_subsystem(u32 flags)
 * Obtain a permanent mapping for the FACS. This is required for the
 * Global Lock and the Firmware Waking Vector
 */
-   status = acpi_tb_initialize_facs();
-   if (ACPI_FAILURE(status)) {
-   ACPI_WARNING((AE_INFO, "Could not map the FACS table"));
-   return_ACPI_STATUS(status);
+   if (!(flags & ACPI_NO_FACS_INIT)) {
+   status = acpi_tb_initialize_facs();
+   if (ACPI_FAILURE(status)) {
+   ACPI_WARNING((AE_INFO, "Could not map the FACS table"));
+   return_ACPI_STATUS(status);
+   }
}
 #endif /* !ACPI_REDUCED_HARDWARE */
 
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 63fd7f5..ff0b53e 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -568,6 +568,7 @@ typedef u64 acpi_integer;
 #define ACPI_NO_ACPI_ENABLE 0x10
 #define ACPI_NO_DEVICE_INIT 0x20
 #define ACPI_NO_OBJECT_INIT 0x40
+#define ACPI_NO_FACS_INIT   0x80
 
 /*
  * Initialization state
-- 
1.7.10

--
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 v2 18/28] ACPICA: Update for acpi_install_table memory types.

2015-06-23 Thread Lv Zheng
From: Zhang Rui 

ACPICA commit 3f78b7fb3f98f35d62f532c1891deb748ad196c9

Physical/virtual address flags were reversed.

Link: https://github.com/acpica/acpica/commit/3f78b7fb
Signed-off-by: Zhang Rui 
Signed-off-by: Lv Zheng 
Signed-off-by: Bob Moore 
---
 drivers/acpi/acpica/tbxfload.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c
index 960bd99..cf56e18 100644
--- a/drivers/acpi/acpica/tbxfload.c
+++ b/drivers/acpi/acpica/tbxfload.c
@@ -224,9 +224,9 @@ acpi_install_table(acpi_physical_address address, u8 
physical)
ACPI_FUNCTION_TRACE(acpi_install_table);
 
if (physical) {
-   flags = ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL;
-   } else {
flags = ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL;
+   } else {
+   flags = ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL;
}
 
status = acpi_tb_install_standard_table(address, flags,
-- 
1.7.10

--
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 v2 13/28] ACPICA: Utilities: Add _CLS processing

2015-06-23 Thread Lv Zheng
From: Suravee Suthikulpanit 

ACPICA commit 9a2b638acb3a7215209432e070c6bd0312374229

ACPI Device object often contains a _CLS object to supply PCI-defined class
code for the device. This patch introduces logic to process the _CLS
object. Suravee Suthikulpanit, Lv Zheng.

Link: https://github.com/acpica/acpica/commit/9a2b638a
Acked-by: Mika Westerberg 
Reviewed-by: Hanjun Guo 
Signed-off-by: Suravee Suthikulpanit 
Signed-off-by: Lv Zheng 
Signed-off-by: Bob Moore 
---
 drivers/acpi/acpica/acinterp.h |2 +
 drivers/acpi/acpica/acutils.h  |4 ++
 drivers/acpi/acpica/exutils.c  |   32 ++
 drivers/acpi/acpica/nsxfname.c |   23 --
 drivers/acpi/acpica/utids.c|   91 +++-
 include/acpi/acnames.h |1 +
 include/acpi/actypes.h |   24 +++
 7 files changed, 164 insertions(+), 13 deletions(-)

diff --git a/drivers/acpi/acpica/acinterp.h b/drivers/acpi/acpica/acinterp.h
index 1886bde..7ac9800 100644
--- a/drivers/acpi/acpica/acinterp.h
+++ b/drivers/acpi/acpica/acinterp.h
@@ -468,6 +468,8 @@ void acpi_ex_eisa_id_to_string(char *dest, u64 
compressed_id);
 
 void acpi_ex_integer_to_string(char *dest, u64 value);
 
+void acpi_ex_pci_cls_to_string(char *dest, u8 class_code[3]);
+
 u8 acpi_is_valid_space_id(u8 space_id);
 
 /*
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h
index d49f5c7..6391c97 100644
--- a/drivers/acpi/acpica/acutils.h
+++ b/drivers/acpi/acpica/acutils.h
@@ -430,6 +430,10 @@ acpi_status
 acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
struct acpi_pnp_device_id_list ** return_cid_list);
 
+acpi_status
+acpi_ut_execute_CLS(struct acpi_namespace_node *device_node,
+   struct acpi_pnp_device_id **return_id);
+
 /*
  * utlock - reader/writer locks
  */
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c
index 3f4225e..30c3f46 100644
--- a/drivers/acpi/acpica/exutils.c
+++ b/drivers/acpi/acpica/exutils.c
@@ -380,6 +380,38 @@ void acpi_ex_integer_to_string(char *out_string, u64 value)
 
 
/***
  *
+ * FUNCTION:acpi_ex_pci_cls_to_string
+ *
+ * PARAMETERS:  out_string  - Where to put the converted string (7 bytes)
+ * PARAMETERS:  class_code  - PCI class code to be converted (3 bytes)
+ *
+ * RETURN:  None
+ *
+ * DESCRIPTION: Convert 3-bytes PCI class code to string representation.
+ *  Return buffer must be large enough to hold the string. The
+ *  string returned is always exactly of length
+ *  ACPI_PCICLS_STRING_SIZE (includes null terminator).
+ *
+ 
**/
+
+void acpi_ex_pci_cls_to_string(char *out_string, u8 class_code[3])
+{
+
+   ACPI_FUNCTION_ENTRY();
+
+   /* All 3 bytes are hexadecimal */
+
+   out_string[0] = acpi_ut_hex_to_ascii_char((u64)class_code[0], 4);
+   out_string[1] = acpi_ut_hex_to_ascii_char((u64)class_code[0], 0);
+   out_string[2] = acpi_ut_hex_to_ascii_char((u64)class_code[1], 4);
+   out_string[3] = acpi_ut_hex_to_ascii_char((u64)class_code[1], 0);
+   out_string[4] = acpi_ut_hex_to_ascii_char((u64)class_code[2], 4);
+   out_string[5] = acpi_ut_hex_to_ascii_char((u64)class_code[2], 0);
+   out_string[6] = 0;
+}
+
+/***
+ *
  * FUNCTION:acpi_is_valid_space_id
  *
  * PARAMETERS:  space_id- ID to be validated
diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c
index d66c326..dc0836a 100644
--- a/drivers/acpi/acpica/nsxfname.c
+++ b/drivers/acpi/acpica/nsxfname.c
@@ -260,7 +260,7 @@ static char *acpi_ns_copy_device_id(struct 
acpi_pnp_device_id *dest,
  *  control methods (Such as in the case of a device.)
  *
  * For Device and Processor objects, run the Device _HID, _UID, _CID, _SUB,
- * _STA, _ADR, _sx_w, and _sx_d methods.
+ * _CLS, _STA, _ADR, _sx_w, and _sx_d methods.
  *
  * Note: Allocates the return buffer, must be freed by the caller.
  *
@@ -276,11 +276,12 @@ acpi_get_object_info(acpi_handle handle,
struct acpi_pnp_device_id *hid = NULL;
struct acpi_pnp_device_id *uid = NULL;
struct acpi_pnp_device_id *sub = NULL;
+   struct acpi_pnp_device_id *cls = NULL;
char *next_id_string;
acpi_object_type type;
acpi_name name;
u8 param_count = 0;
-   u8 valid = 0;
+   u16 valid = 0;
u32 info_size;
u32 i;
acpi_status status;
@@ -320,7 +321,7 @@ acpi_get_object_info(acpi_handle handle,
if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) {
/*
 * Get extra info for ACPI Device/Processor objects only:
-* Run the Device _HID, _UID, _SUB, and _CID methods.
+* Run the 

[PATCH v2 17/28] ACPICA: Namespace: Change namespace override to avoid node deletion.

2015-06-23 Thread Lv Zheng
From: Bob Moore 

ACPICA commit c0ce529e1fbb8ec47d2522a3aa10f3ab77e16e41

There is no reference counting implemented for struct acpi_namespace_node, so it
is currently not removable during runtime.
This patch changes the namespace override code to keep the old
struct acpi_namespace_node undeleted so that the override mechanism can happen
during runtime. Bob Moore.

Link: https://github.com/acpica/acpica/commit/c0ce529e
Signed-off-by: Lv Zheng 
Signed-off-by: Bob Moore 
---
 drivers/acpi/acpica/nssearch.c |   23 +++
 include/acpi/acpixf.h  |5 +
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/acpica/nssearch.c b/drivers/acpi/acpica/nssearch.c
index 47fbe5b..d739040 100644
--- a/drivers/acpi/acpica/nssearch.c
+++ b/drivers/acpi/acpica/nssearch.c
@@ -331,13 +331,28 @@ acpi_ns_search_and_enter(u32 target_name,
 
/*
 * If the namespace override feature is enabled for 
this node,
-* delete any existing node. This can only happen 
during the
-* boot stage, thus it is safe to remove the node here.
+* delete any existing attached sub-object and make the 
node
+* look like a new node that is owned by the override 
table.
 */
if (flags & ACPI_NS_OVERRIDE_IF_FOUND) {
+   ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+ "Namespace override: %4.4s 
pass %u type %X Owner %X\n",
+ ACPI_CAST_PTR(char,
+   _name),
+ interpreter_mode,
+ (*return_node)->type,
+ walk_state->owner_id));
+
acpi_ns_delete_children(*return_node);
-   acpi_ns_remove_node(*return_node);
-   *return_node = ACPI_ENTRY_NOT_FOUND;
+   if (acpi_gbl_runtime_namespace_override) {
+   
acpi_ut_remove_reference((*return_node)->object);
+   (*return_node)->object = NULL;
+   (*return_node)->owner_id =
+   walk_state->owner_id;
+   } else {
+   acpi_ns_remove_node(*return_node);
+   *return_node = ACPI_ENTRY_NOT_FOUND;
+   }
}
 
/* Return an error if we don't expect to find the 
object */
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 00daa3c..33b4675 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -229,6 +229,11 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_auto_repair, FALSE);
 ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_ssdt_table_install, FALSE);
 
 /*
+ * Optionally enable runtime namespace override.
+ */
+ACPI_INIT_GLOBAL(u8, acpi_gbl_runtime_namespace_override, TRUE);
+
+/*
  * We keep track of the latest version of Windows that has been requested by
  * the BIOS. ACPI 5.0.
  */
-- 
1.7.10

--
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 v2 23/28] ACPICA: De-macroize calls to standard C library functions.

2015-06-23 Thread Lv Zheng
From: Bob Moore 

ACPICA commit 3b1026e0bdd3c32eb6d5d313f3ba0b1fee7597b4
ACPICA commit 00f0dc83f5cfca53b27a3213ae0d7719b88c2d6b
ACPICA commit 47d22a738d0e19fd241ffe4e3e9d4e198e4afc69

Across all of ACPICA. Replace C library macros such as ACPI_STRLEN with the
standard names such as strlen. The original purpose for these macros is
long since obsolete.
Also cast various invocations as necessary. Bob Moore, Jung-uk Kim, Lv Zheng.

Link: https://github.com/acpica/acpica/commit/3b1026e0
Link: https://github.com/acpica/acpica/commit/00f0dc83
Link: https://github.com/acpica/acpica/commit/47d22a73
Signed-off-by: Bob Moore 
Signed-off-by: Jung-uk Kim 
Signed-off-by: Lv Zheng 
---
 drivers/acpi/acpica/acutils.h  |   46 +
 drivers/acpi/acpica/dsfield.c  |2 +-
 drivers/acpi/acpica/dsinit.c   |2 +-
 drivers/acpi/acpica/dsobject.c |7 ++-
 drivers/acpi/acpica/dsutils.c  |4 +-
 drivers/acpi/acpica/evgpeinit.c|2 +-
 drivers/acpi/acpica/exconfig.c |2 +-
 drivers/acpi/acpica/exconvrt.c |9 ++--
 drivers/acpi/acpica/exfield.c  |2 +-
 drivers/acpi/acpica/exfldio.c  |   52 ++--
 drivers/acpi/acpica/exmisc.c   |   36 +++---
 drivers/acpi/acpica/exnames.c  |2 +-
 drivers/acpi/acpica/exoparg2.c |4 +-
 drivers/acpi/acpica/exoparg3.c |4 +-
 drivers/acpi/acpica/exregion.c |9 ++--
 drivers/acpi/acpica/exstorob.c |   18 +++
 drivers/acpi/acpica/nsaccess.c |6 +--
 drivers/acpi/acpica/nsconvert.c|   10 ++--
 drivers/acpi/acpica/nsdump.c   |2 +-
 drivers/acpi/acpica/nseval.c   |2 +-
 drivers/acpi/acpica/nsinit.c   |4 +-
 drivers/acpi/acpica/nsrepair2.c|2 +-
 drivers/acpi/acpica/nsutils.c  |3 +-
 drivers/acpi/acpica/nsxfeval.c |5 +-
 drivers/acpi/acpica/nsxfname.c |6 +--
 drivers/acpi/acpica/psutils.c  |7 ++-
 drivers/acpi/acpica/rscreate.c |6 +--
 drivers/acpi/acpica/rsmisc.c   |8 +--
 drivers/acpi/acpica/rsutils.c  |   11 ++---
 drivers/acpi/acpica/rsxface.c  |8 +--
 drivers/acpi/acpica/tbdata.c   |8 +--
 drivers/acpi/acpica/tbfadt.c   |6 +--
 drivers/acpi/acpica/tbfind.c   |   21 
 drivers/acpi/acpica/tbinstal.c |7 ++-
 drivers/acpi/acpica/tbprint.c  |   10 ++--
 drivers/acpi/acpica/tbutils.c  |2 +-
 drivers/acpi/acpica/tbxface.c  |   16 +++---
 drivers/acpi/acpica/tbxfload.c |4 +-
 drivers/acpi/acpica/utalloc.c  |6 +--
 drivers/acpi/acpica/utbuffer.c |4 +-
 drivers/acpi/acpica/utcache.c  |6 +--
 drivers/acpi/acpica/utcopy.c   |   42 
 drivers/acpi/acpica/utids.c|9 ++--
 drivers/acpi/acpica/utmisc.c   |6 +--
 drivers/acpi/acpica/utosi.c|9 ++--
 drivers/acpi/acpica/utpredef.c |4 +-
 drivers/acpi/acpica/utprint.c  |6 +--
 drivers/acpi/acpica/utstring.c |   33 ++---
 drivers/acpi/acpica/uttrack.c  |8 +--
 drivers/acpi/acpica/utxface.c  |8 +--
 include/acpi/actypes.h |8 +--
 include/acpi/platform/acenv.h  |   38 --
 tools/power/acpi/common/getopt.c   |4 +-
 .../acpi/os_specific/service_layers/oslinuxtbl.c   |6 +--
 tools/power/acpi/tools/acpidump/apdump.c   |8 +--
 tools/power/acpi/tools/acpidump/apfiles.c  |   12 ++---
 56 files changed, 260 insertions(+), 312 deletions(-)

diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h
index 6391c97..ef1e51d 100644
--- a/drivers/acpi/acpica/acutils.h
+++ b/drivers/acpi/acpica/acutils.h
@@ -210,37 +210,35 @@ void acpi_ut_subsystem_shutdown(void);
  */
 #ifndef ACPI_USE_SYSTEM_CLIBRARY
 
-acpi_size acpi_ut_strlen(const char *string);
+acpi_size strlen(const char *string);
 
-char *acpi_ut_strchr(const char *string, int ch);
+char *strchr(const char *string, int ch);
 
-char *acpi_ut_strcpy(char *dst_string, const char *src_string);
+char *strcpy(char *dst_string, const char *src_string);
 
-char *acpi_ut_strncpy(char *dst_string,
- const 

[PATCH v2 26/28] ACPICA: Update TPM2 ACPI table.

2015-06-23 Thread Lv Zheng
From: Bob Moore 

ACPICA commit 254bf77e7ca01cb27e026fa5737f7df8dae03f2c

- Add constans for the start_method.
- Remove the control structure, not part of ACPI, not defined in the current
TCG spec.

Link: https://github.com/acpica/acpica/commit/254bf77e
Reported-by: Jarkko Sakkinen 
Signed-off-by: Bob Moore 
Signed-off-by: Lv Zheng 
---
 include/acpi/actbl2.h |   18 ++
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 2a9dcc1..a948fc5 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -1251,19 +1251,13 @@ struct acpi_table_tpm2 {
/* Platform-specific data follows */
 };
 
-/* Control area structure (not part of table, pointed to by control_address) */
+/* Values for start_method above */
 
-struct acpi_tpm2_control {
-   u32 reserved;
-   u32 error;
-   u32 cancel;
-   u32 start;
-   u64 interrupt_control;
-   u32 command_size;
-   u64 command_address;
-   u32 response_size;
-   u64 response_address;
-};
+#define ACPI_TPM2_NOT_ALLOWED   0
+#define ACPI_TPM2_START_METHOD  2
+#define ACPI_TPM2_MEMORY_MAPPED 6
+#define ACPI_TPM2_COMMAND_BUFFER7
+#define ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD  8
 
 
/***
  *
-- 
1.7.10

--
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 v2 22/28] ACPI / acpidump: Update acpidump manual.

2015-06-23 Thread Lv Zheng
This patch updates acpidump manual according to the recent changes.

Signed-off-by: Lv Zheng 
---
 tools/power/acpi/man/acpidump.8 |   17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/tools/power/acpi/man/acpidump.8 b/tools/power/acpi/man/acpidump.8
index 38f095d..79e2d1d 100644
--- a/tools/power/acpi/man/acpidump.8
+++ b/tools/power/acpi/man/acpidump.8
@@ -22,9 +22,6 @@ acpidump options are as follow:
 .B \-b
 Dump tables to binary files
 .TP
-.B \-c
-Dump customized tables
-.TP
 .B \-h \-?
 This help message
 .TP
@@ -48,15 +45,25 @@ Verbose mode
 .B \-a 
 Get table via a physical address
 .TP
+.B \-c 
+Turning on/off customized table dumping
+.TP
 .B \-f 
 Get table via a binary file
 .TP
 .B \-n 
 Get table via a name/signature
 .TP
-Invocation without parameters dumps all available tables
+.B \-x
+Do not use but dump XSDT
+.TP
+.B \-x \-x
+Do not use or dump XSDT
+.TP
+.fi
+Invocation without parameters dumps all available tables.
 .TP
-Multiple mixed instances of -a, -f, and -n are supported
+Multiple mixed instances of -a, -f, and -n are supported.
 
 .SH EXAMPLES
 
-- 
1.7.10

--
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 v2 25/28] ACPICA: Update definitions for the TCPA and TPM2 ACPI tables.

2015-06-23 Thread Lv Zheng
From: Bob Moore 

ACPICA commit 33140b4498666337dd33a00cf3c4797a53981a7b

Changes for a new version of the 3rd party spec for these tables,
the "TCG ACPI Specification", December 14, 2014. Also, moved the
definition of TPM2 to actbl2.h, next to TCPA, since both should
be together.

Update the table compiler/disassembler code for the tables.
However, the "Server" TCPA table is not supported at this time.

Link: https://github.com/acpica/acpica/commit/33140b44
Reported-by: Jarkko Sakkinen 
Signed-off-by: Bob Moore 
Signed-off-by: Lv Zheng 
---
 include/acpi/actbl2.h |   86 +
 include/acpi/actbl3.h |   34 ++-
 2 files changed, 81 insertions(+), 39 deletions(-)

diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 370d69d..2a9dcc1 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -51,8 +51,8 @@
  * These tables are not consumed directly by the ACPICA subsystem, but are
  * included here to support device drivers and the AML disassembler.
  *
- * The tables in this file are defined by third-party specifications, and are
- * not defined directly by the ACPI specification itself.
+ * Generally, the tables in this file are defined by third-party 
specifications,
+ * and are not defined directly by the ACPI specification itself.
  *
  
**/
 
@@ -80,6 +80,7 @@
 #define ACPI_SIG_SPCR   "SPCR" /* Serial Port Console Redirection 
table */
 #define ACPI_SIG_SPMI   "SPMI" /* Server Platform Management Interface 
table */
 #define ACPI_SIG_TCPA   "TCPA" /* Trusted Computing Platform Alliance 
table */
+#define ACPI_SIG_TPM2   "TPM2" /* Trusted Platform Module 2.0 H/W 
interface table */
 #define ACPI_SIG_UEFI   "UEFI" /* Uefi Boot Optimization Table */
 #define ACPI_SIG_VRTC   "VRTC" /* Virtual Real Time Clock Table */
 #define ACPI_SIG_WAET   "WAET" /* Windows ACPI Emulated devices Table 
*/
@@ -1179,18 +1180,89 @@ enum acpi_spmi_interface_types {
 
/***
  *
  * TCPA - Trusted Computing Platform Alliance table
- *Version 1
+ *Version 2
+ *
+ * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0",
+ * December 19, 2014
  *
- * Conforms to "TCG PC Specific Implementation Specification",
- * Version 1.1, August 18, 2003
+ * NOTE: There are two versions of the table with the same signature --
+ * the client version and the server version.
  *
  
**/
 
-struct acpi_table_tcpa {
+struct acpi_table_tcpa_client {
+   struct acpi_table_header header;/* Common ACPI table header */
+   u16 platform_class;
+   u32 minimum_log_length; /* Minimum length for the event log area */
+   u64 log_address;/* Address of the event log area */
+};
+
+struct acpi_table_tcpa_server {
struct acpi_table_header header;/* Common ACPI table header */
+   u16 platform_class;
u16 reserved;
-   u32 max_log_length; /* Maximum length for the event log area */
+   u64 minimum_log_length; /* Minimum length for the event log area */
u64 log_address;/* Address of the event log area */
+   u16 spec_revision;
+   u8 device_flags;
+   u8 interrupt_flags;
+   u8 gpe_number;
+   u8 reserved2[3];
+   u32 global_interrupt;
+   struct acpi_generic_address address;
+   u32 reserved3;
+   struct acpi_generic_address config_address;
+   u8 group;
+   u8 bus; /* PCI Bus/Segment/Function numbers */
+   u8 device;
+   u8 function;
+};
+
+/* Values for device_flags above */
+
+#define ACPI_TCPA_PCI_DEVICE(1)
+#define ACPI_TCPA_BUS_PNP   (1<<1)
+#define ACPI_TCPA_ADDRESS_VALID (1<<2)
+
+/* Values for interrupt_flags above */
+
+#define ACPI_TCPA_INTERRUPT_MODE(1)
+#define ACPI_TCPA_INTERRUPT_POLARITY(1<<1)
+#define ACPI_TCPA_SCI_VIA_GPE   (1<<2)
+#define ACPI_TCPA_GLOBAL_INTERRUPT  (1<<3)
+
+/***
+ *
+ * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table
+ *Version 4
+ *
+ * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0",
+ * December 19, 2014
+ *
+ 
**/
+
+struct acpi_table_tpm2 {
+   struct acpi_table_header header;/* Common ACPI table header */
+   u16 platform_class;
+   u16 reserved;
+   u64 control_address;
+   u32 start_method;
+
+   /* Platform-specific data follows */
+};
+
+/* Control area structure (not part of table, pointed to by control_address) */
+
+struct acpi_tpm2_control {
+   u32 reserved;
+   u32 error;
+   u32 cancel;
+   u32 

[PATCH v2 27/28] ACPICA: Comment update, no functional change.

2015-06-23 Thread Lv Zheng
From: gongzg 

ACPICA commit 1a8ec7b83d55c7b957247d685bd1c73f6a012f1e

Remove redundant comment in nseval.c

Link: https://github.com/acpica/acpica/commit/1a8ec7b8
Signed-off-by: gongzg 
Signed-off-by: Bob Moore 
Signed-off-by: Lv Zheng 
---
 drivers/acpi/acpica/nseval.c |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/acpica/nseval.c b/drivers/acpi/acpica/nseval.c
index a725d88..80670cb 100644
--- a/drivers/acpi/acpica/nseval.c
+++ b/drivers/acpi/acpica/nseval.c
@@ -59,15 +59,14 @@ acpi_ns_exec_module_code(union acpi_operand_object 
*method_obj,
  *
  * FUNCTION:acpi_ns_evaluate
  *
- * PARAMETERS:  info- Evaluation info block, contains:
+ * PARAMETERS:  info- Evaluation info block, contains these fields
+ *and more:
  *  prefix_node - Prefix or Method/Object Node to execute
  *  relative_path   - Name of method to execute, If NULL, the
  *Node is the object to execute
  *  parameters  - List of parameters to pass to the method,
  *terminated by NULL. Params itself may be
  *NULL if no parameters are being passed.
- *  return_object   - Where to put method's return value (if
- *any). If NULL, no value is returned.
  *  parameter_type  - Type of Parameter list
  *  return_object   - Where to put method's return value (if
  *any). If NULL, no value is returned.
-- 
1.7.10

--
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 v2 24/28] ACPICA: Split C library prototypes to new header.

2015-06-23 Thread Lv Zheng
From: Bob Moore 

ACPICA commit f51bf8497889a94046820639537165bbd7ccdee6

Adds acclib.h

This patch doesn't affect Linux kernel.

Link: https://github.com/acpica/acpica/commit/f51bf849
Signed-off-by: Bob Moore 
Signed-off-by: Lv Zheng 
---
 drivers/acpi/acpica/accommon.h |3 +++
 drivers/acpi/acpica/acutils.h  |   58 
 2 files changed, 3 insertions(+), 58 deletions(-)

diff --git a/drivers/acpi/acpica/accommon.h b/drivers/acpi/acpica/accommon.h
index 853aa2d..a8d8092 100644
--- a/drivers/acpi/acpica/accommon.h
+++ b/drivers/acpi/acpica/accommon.h
@@ -59,5 +59,8 @@
 #include "acglobal.h"  /* All global variables */
 #include "achware.h"   /* Hardware defines and interfaces */
 #include "acutils.h"   /* Utility interfaces */
+#ifndef ACPI_USE_SYSTEM_CLIBRARY
+#include "acclib.h"/* C library interfaces */
+#endif /* !ACPI_USE_SYSTEM_CLIBRARY */
 
 #endif /* __ACCOMMON_H__ */
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h
index ef1e51d..6de0d35 100644
--- a/drivers/acpi/acpica/acutils.h
+++ b/drivers/acpi/acpica/acutils.h
@@ -205,64 +205,6 @@ acpi_status acpi_ut_hardware_initialize(void);
 
 void acpi_ut_subsystem_shutdown(void);
 
-/*
- * utclib - Local implementations of C library functions
- */
-#ifndef ACPI_USE_SYSTEM_CLIBRARY
-
-acpi_size strlen(const char *string);
-
-char *strchr(const char *string, int ch);
-
-char *strcpy(char *dst_string, const char *src_string);
-
-char *strncpy(char *dst_string, const char *src_string, acpi_size count);
-
-int strncmp(const char *string1, const char *string2, acpi_size count);
-
-int strcmp(const char *string1, const char *string2);
-
-char *strcat(char *dst_string, const char *src_string);
-
-char *strncat(char *dst_string, const char *src_string, acpi_size count);
-
-u32 strtoul(const char *string, char **terminator, u32 base);
-
-char *strstr(char *string1, char *string2);
-
-int memcmp(void *buffer1, void *buffer2, acpi_size count);
-
-void *memcpy(void *dest, const void *src, acpi_size count);
-
-void *memset(void *dest, int value, acpi_size count);
-
-int toupper(int c);
-
-int tolower(int c);
-
-extern const u8 _acpi_ctype[];
-
-#define _ACPI_XA 0x00  /* extra alphabetic - not supported */
-#define _ACPI_XS 0x40  /* extra space */
-#define _ACPI_BB 0x00  /* BEL, BS, etc. - not supported */
-#define _ACPI_CN 0x20  /* CR, FF, HT, NL, VT */
-#define _ACPI_DI 0x04  /* '0'-'9' */
-#define _ACPI_LO 0x02  /* 'a'-'z' */
-#define _ACPI_PU 0x10  /* punctuation */
-#define _ACPI_SP 0x08  /* space, tab, CR, LF, VT, FF */
-#define _ACPI_UP 0x01  /* 'A'-'Z' */
-#define _ACPI_XD 0x80  /* '0'-'9', 'A'-'F', 'a'-'f' */
-
-#define isdigit(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
-#define isspace(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
-#define isxdigit(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
-#define isupper(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
-#define islower(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
-#define isprint(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | 
_ACPI_DI | _ACPI_XS | _ACPI_PU))
-#define isalpha(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
-
-#endif /* !ACPI_USE_SYSTEM_CLIBRARY */
-
 #define ACPI_IS_ASCII(c)  ((c) < 0x80)
 
 /*
-- 
1.7.10

--
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 v2 28/28] ACPICA: Update version to 20150619.

2015-06-23 Thread Lv Zheng
From: Bob Moore 

ACPICA commit 2fcf4f4c95e6a4875f39a929f8f92ef50cc53bb5
ACPICA commit d7a940bb308d001b5d2b196174fee36c7daa61d6

Version 20150619.

Link: https://github.com/acpica/acpica/commit/2fcf4f4c
Link: https://github.com/acpica/acpica/commit/d7a940bb
Signed-off-by: Bob Moore 
Signed-off-by: Lv Zheng 
---
 include/acpi/acpixf.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 33b4675..c1e9578 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -46,7 +46,7 @@
 
 /* Current ACPICA subsystem version in MMDD format */
 
-#define ACPI_CA_VERSION 0x20150515
+#define ACPI_CA_VERSION 0x20150619
 
 #include 
 #include 
-- 
1.7.10

--
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 v2 19/28] ACPICA: Cleanup output for the ASL Debug object.

2015-06-23 Thread Lv Zheng
From: Bob Moore 

ACPICA commit d4a53a396fe5d384425251b0257f8d125bbed617

Especially for use of the Index operator. For buffers and strings,
only output the actual byte pointed to by the index. For packages,
only print the package element decoded by the index.

Link: https://github.com/acpica/acpica/commit/d4a53a39
Signed-off-by: Bob Moore 
Signed-off-by: Lv Zheng 
---
 drivers/acpi/acpica/acobject.h |1 +
 drivers/acpi/acpica/exdebug.c  |   42 ++--
 drivers/acpi/acpica/exdump.c   |9 +
 drivers/acpi/acpica/exoparg2.c |4 
 4 files changed, 50 insertions(+), 6 deletions(-)

diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h
index 3e9720e..c81d98d 100644
--- a/drivers/acpi/acpica/acobject.h
+++ b/drivers/acpi/acpica/acobject.h
@@ -335,6 +335,7 @@ struct acpi_object_reference {
void *object;   /* name_op=>HANDLE to obj, index_op=>union 
acpi_operand_object */
struct acpi_namespace_node *node;   /* ref_of or Namepath */
union acpi_operand_object **where;  /* Target of Index */
+   u8 *index_pointer;  /* Used for Buffers and Strings */
u32 value;  /* Used for Local/Arg/Index/ddb_handle */
 };
 
diff --git a/drivers/acpi/acpica/exdebug.c b/drivers/acpi/acpica/exdebug.c
index e67d0ac..815442b 100644
--- a/drivers/acpi/acpica/exdebug.c
+++ b/drivers/acpi/acpica/exdebug.c
@@ -76,6 +76,8 @@ acpi_ex_do_debug_object(union acpi_operand_object 
*source_desc,
 {
u32 i;
u32 timer;
+   union acpi_operand_object *object_desc;
+   u32 value;
 
ACPI_FUNCTION_TRACE_PTR(ex_do_debug_object, source_desc);
 
@@ -254,8 +256,44 @@ acpi_ex_do_debug_object(union acpi_operand_object 
*source_desc,
 object)->object,
level + 4, 0);
} else {
-   acpi_ex_do_debug_object(source_desc->reference.
-   object, level + 4, 0);
+   object_desc = source_desc->reference.object;
+   value = source_desc->reference.value;
+
+   switch (object_desc->common.type) {
+   case ACPI_TYPE_BUFFER:
+
+   acpi_os_printf("Buffer[%u] = 0x%2.2X\n",
+  value,
+  *source_desc->reference.
+  index_pointer);
+   break;
+
+   case ACPI_TYPE_STRING:
+
+   acpi_os_printf
+   ("String[%u] = \"%c\" (0x%2.2X)\n",
+value,
+*source_desc->reference.
+index_pointer,
+*source_desc->reference.
+index_pointer);
+   break;
+
+   case ACPI_TYPE_PACKAGE:
+
+   acpi_os_printf("Package[%u] = ", value);
+   acpi_ex_do_debug_object(*source_desc->
+   reference.where,
+   level + 4, 0);
+   break;
+
+   default:
+
+   acpi_os_printf
+   ("Unknown Reference object type 
%X\n",
+object_desc->common.type);
+   break;
+   }
}
}
break;
diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c
index 1da52be..401e7ed 100644
--- a/drivers/acpi/acpica/exdump.c
+++ b/drivers/acpi/acpica/exdump.c
@@ -224,7 +224,7 @@ static struct acpi_exdump_info acpi_ex_dump_index_field[5] 
= {
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(index_field.data_obj), "Data Object"}
 };
 
-static struct acpi_exdump_info acpi_ex_dump_reference[8] = {
+static struct acpi_exdump_info acpi_ex_dump_reference[9] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_reference), NULL},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.class), "Class"},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.target_type), "Target Type"},
@@ -232,6 +232,8 @@ static struct acpi_exdump_info acpi_ex_dump_reference[8] = {
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.object), "Object Desc"},
{ACPI_EXD_NODE, 

[PATCH v2 15/28] ACPICA: Namespace: Add support to allow overriding objects.

2015-06-23 Thread Lv Zheng
ACPICA commit 6084e34e44565c6293f446c0202b5e59b055e351

This patch adds an "NamespaceOverride" flag in struct acpi_walk_state, and 
allows
namespace objects to be overridden when this flag is set. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/6084e34e
Signed-off-by: Lv Zheng 
Signed-off-by: Bob Moore 
---
 drivers/acpi/acpica/acnamesp.h |1 +
 drivers/acpi/acpica/acstruct.h |1 +
 drivers/acpi/acpica/dswload.c  |   17 +
 drivers/acpi/acpica/nsaccess.c |   10 +-
 drivers/acpi/acpica/nssearch.c |   22 --
 5 files changed, 44 insertions(+), 7 deletions(-)

diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h
index 952fbe0..0dd0882 100644
--- a/drivers/acpi/acpica/acnamesp.h
+++ b/drivers/acpi/acpica/acnamesp.h
@@ -66,6 +66,7 @@
 #define ACPI_NS_PREFIX_IS_SCOPE 0x10
 #define ACPI_NS_EXTERNAL0x20
 #define ACPI_NS_TEMPORARY   0x40
+#define ACPI_NS_OVERRIDE_IF_FOUND   0x80
 
 /* Flags for acpi_ns_walk_namespace */
 
diff --git a/drivers/acpi/acpica/acstruct.h b/drivers/acpi/acpica/acstruct.h
index 87c7860..44997ca 100644
--- a/drivers/acpi/acpica/acstruct.h
+++ b/drivers/acpi/acpica/acstruct.h
@@ -82,6 +82,7 @@ struct acpi_walk_state {
u8 return_used;
u8 scope_depth;
u8 pass_number; /* Parse pass during table load */
+   u8 namespace_override;  /* Override existing objects */
u8 result_size; /* Total elements for the result stack */
u8 result_count;/* Current number of occupied elements of 
result stack */
u32 aml_offset;
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c
index 843942f..845ff44 100644
--- a/drivers/acpi/acpica/dswload.c
+++ b/drivers/acpi/acpica/dswload.c
@@ -315,10 +315,19 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * 
walk_state,
flags = ACPI_NS_NO_UPSEARCH;
if ((walk_state->opcode != AML_SCOPE_OP) &&
(!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) {
-   flags |= ACPI_NS_ERROR_IF_FOUND;
-   ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
- "[%s] Cannot already exist\n",
- acpi_ut_get_type_name(object_type)));
+   if (walk_state->namespace_override) {
+   flags |= ACPI_NS_OVERRIDE_IF_FOUND;
+   ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+ "[%s] Override allowed\n",
+ acpi_ut_get_type_name
+ (object_type)));
+   } else {
+   flags |= ACPI_NS_ERROR_IF_FOUND;
+   ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+ "[%s] Cannot already exist\n",
+ acpi_ut_get_type_name
+ (object_type)));
+   }
} else {
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
  "[%s] Both Find or Create allowed\n",
diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c
index 24fa19a..19ad0b5 100644
--- a/drivers/acpi/acpica/nsaccess.c
+++ b/drivers/acpi/acpica/nsaccess.c
@@ -304,7 +304,9 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
 
-   local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_SEARCH_PARENT);
+   local_flags = flags &
+   ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_OVERRIDE_IF_FOUND |
+ ACPI_NS_SEARCH_PARENT);
*return_node = ACPI_ENTRY_NOT_FOUND;
acpi_gbl_ns_lookup_count++;
 
@@ -547,6 +549,12 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
if (flags & ACPI_NS_ERROR_IF_FOUND) {
local_flags |= ACPI_NS_ERROR_IF_FOUND;
}
+
+   /* Set override flag according to caller */
+
+   if (flags & ACPI_NS_OVERRIDE_IF_FOUND) {
+   local_flags |= ACPI_NS_OVERRIDE_IF_FOUND;
+   }
}
 
/* Extract one ACPI name from the front of the pathname */
diff --git a/drivers/acpi/acpica/nssearch.c b/drivers/acpi/acpica/nssearch.c
index 4a9d4a6..47fbe5b 100644
--- a/drivers/acpi/acpica/nssearch.c
+++ b/drivers/acpi/acpica/nssearch.c
@@ -325,8 +325,26 @@ acpi_ns_search_and_enter(u32 target_name,
 * If we found it AND the request specifies that a find is an 
error,
 * return the error
 */
-   if ((status == AE_OK) && (flags & ACPI_NS_ERROR_IF_FOUND)) {
-   

[PATCH v2 16/28] ACPICA: Namespace: Add support of OSDT table.

2015-06-23 Thread Lv Zheng
From: Bob Moore 

ACPICA commit 27415c82fcecf467446f66d1007a0691cc5f3709

This patch adds OSDT (Override System Definition Table) support.
When OSDT is loaded, conflict namespace objects will be overridden
by the AML interpreter. Bob Moore, Lv Zheng.

Link: https://github.com/acpica/acpica/commit/27415c82
Signed-off-by: Lv Zheng 
Signed-off-by: Bob Moore 
---
 drivers/acpi/acpica/nsparse.c  |7 +++
 drivers/acpi/acpica/tbxfload.c |6 +-
 drivers/acpi/acpica/utmisc.c   |3 ++-
 include/acpi/actbl.h   |1 +
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/acpica/nsparse.c b/drivers/acpi/acpica/nsparse.c
index c95a119..57a4cfe 100644
--- a/drivers/acpi/acpica/nsparse.c
+++ b/drivers/acpi/acpica/nsparse.c
@@ -117,6 +117,13 @@ acpi_ns_one_complete_parse(u32 pass_number,
   (u8) pass_number);
}
 
+   /* Found OSDT table, enable the namespace override feature */
+
+   if (ACPI_COMPARE_NAME(table->signature, ACPI_SIG_OSDT) &&
+   pass_number == ACPI_IMODE_LOAD_PASS1) {
+   walk_state->namespace_override = TRUE;
+   }
+
if (ACPI_FAILURE(status)) {
acpi_ds_delete_walk_state(walk_state);
goto cleanup;
diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c
index b63e35d..960bd99 100644
--- a/drivers/acpi/acpica/tbxfload.c
+++ b/drivers/acpi/acpica/tbxfload.c
@@ -173,7 +173,11 @@ static acpi_status acpi_tb_load_namespace(void)
 &&
 !ACPI_COMPARE_NAME(&
(acpi_gbl_root_table_list.tables[i].
-signature), ACPI_SIG_PSDT))
+signature), ACPI_SIG_PSDT)
+&&
+!ACPI_COMPARE_NAME(&
+   (acpi_gbl_root_table_list.tables[i].
+signature), ACPI_SIG_OSDT))
||
ACPI_FAILURE(acpi_tb_validate_table
 (_gbl_root_table_list.tables[i]))) {
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c
index cbb7034..28099e2 100644
--- a/drivers/acpi/acpica/utmisc.c
+++ b/drivers/acpi/acpica/utmisc.c
@@ -97,7 +97,8 @@ u8 acpi_ut_is_aml_table(struct acpi_table_header *table)
 
if (ACPI_COMPARE_NAME(table->signature, ACPI_SIG_DSDT) ||
ACPI_COMPARE_NAME(table->signature, ACPI_SIG_PSDT) ||
-   ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT)) {
+   ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT) ||
+   ACPI_COMPARE_NAME(table->signature, ACPI_SIG_OSDT)) {
return (TRUE);
}
 
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index cb8a6b9..2d5faf5 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -65,6 +65,7 @@
 #define ACPI_SIG_DSDT   "DSDT" /* Differentiated System Description 
Table */
 #define ACPI_SIG_FADT   "FACP" /* Fixed ACPI Description Table */
 #define ACPI_SIG_FACS   "FACS" /* Firmware ACPI Control Structure */
+#define ACPI_SIG_OSDT   "OSDT" /* Override System Description Table */
 #define ACPI_SIG_PSDT   "PSDT" /* Persistent System Description Table 
*/
 #define ACPI_SIG_RSDP   "RSD PTR " /* Root System Description 
Pointer */
 #define ACPI_SIG_RSDT   "RSDT" /* Root System Description Table */
-- 
1.7.10

--
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 v2 09/28] ACPICA: Tables: Enable default 64-bit FADT addresses favor.

2015-06-23 Thread Lv Zheng
ACPICA commit 4da56eeae0749dfe8491285c1e1fad48f6efafd8

The following commit temporarily disables correct 64-bit FADT addresses
favor during the period the root cause of the bug is not fixed:
 Commit: 85dbd5801f62b66e2aa7826aaefcaebead44c8a6
 ACPICA: Tables: Restore old behavor to favor 32-bit FADT addresses.

With enough protections, this patch re-enables 64-bit FADT addresses by
default. If regressions are reported against such change, this patch should
be bisected and reverted.
Note that 64-bit FACS favor and 64-bit firmware waking vector favor are
excluded by this commit in order not to break OSPMs. Lv Zheng.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=74021
Link: https://github.com/acpica/acpica/commit/4da56eea
Cc: 3.15.1+  # 3.15.1+
Reported-and-tested-by: Oswald Buddenhagen 
Signed-off-by: Lv Zheng 
Signed-off-by: Bob Moore 
---
 include/acpi/acpixf.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index dec71ff..00daa3c 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -195,9 +195,9 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_use_xsdt, FALSE);
  * address. Although ACPICA adheres to the ACPI specification which
  * requires the use of the corresponding 64-bit address if it is non-zero,
  * some machines have been found to have a corrupted non-zero 64-bit
- * address. Default is TRUE, favor the 32-bit addresses.
+ * address. Default is FALSE, do not favor the 32-bit addresses.
  */
-ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, TRUE);
+ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, FALSE);
 
 /*
  * Optionally use 32-bit FACS table addresses.
-- 
1.7.10

--
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 v2 14/28] ACPICA: ACPI 6.0: Add values for MADT GIC version field.

2015-06-23 Thread Lv Zheng
From: Hanjun Guo 

ACPICA commit 4b100dc43e8baee8c8b4891b23bc7ad03eba6a28

Support for the new version field in the generic distributor
subtable. Hanjun Guo 

Link: https://github.com/acpica/acpica/commit/4b100dc4
Signed-off-by: Hanjun Guo 
Signed-off-by: Bob Moore 
Signed-off-by: Lv Zheng 
---
 include/acpi/actbl1.h |   11 +++
 1 file changed, 11 insertions(+)

diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 06b61f0..fcd5709 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -835,6 +835,17 @@ struct acpi_madt_generic_distributor {
u8 reserved2[3];/* reserved - must be zero */
 };
 
+/* Values for Version field above */
+
+enum acpi_madt_gic_version {
+   ACPI_MADT_GIC_VERSION_NONE = 0,
+   ACPI_MADT_GIC_VERSION_V1 = 1,
+   ACPI_MADT_GIC_VERSION_V2 = 2,
+   ACPI_MADT_GIC_VERSION_V3 = 3,
+   ACPI_MADT_GIC_VERSION_V4 = 4,
+   ACPI_MADT_GIC_VERSION_RESERVED = 5  /* 5 and greater are reserved */
+};
+
 /* 13: Generic MSI Frame (ACPI 5.1) */
 
 struct acpi_madt_generic_msi_frame {
-- 
1.7.10

--
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 v2 21/28] ACPICA: acpidump: Convert the default behavior to dump from /sys/firmware/acpi/tables.

2015-06-23 Thread Lv Zheng
ACPICA commit 04c3bd7e9d6aeb2b3edebe99c90dc271ae4e6353

In order to work without any additional option to dump tables when /dev/mem
doesn't exist, this patch switches the default behavior of acpidump to dump
from /sys/firmware/acpi/tables. Reported by Al Stone, Fixed by Lv Zheng.

Link: https://github.com/acpica/acpica/commit/04c3bd7e
Reported-by: Al Stone 
Signed-off-by: Lv Zheng 
Signed-off-by: Bob Moore 
---
 tools/power/acpi/tools/acpidump/acpidump.h |2 +-
 tools/power/acpi/tools/acpidump/apmain.c   |   15 ---
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/tools/power/acpi/tools/acpidump/acpidump.h 
b/tools/power/acpi/tools/acpidump/acpidump.h
index 84bdef0..eed5344 100644
--- a/tools/power/acpi/tools/acpidump/acpidump.h
+++ b/tools/power/acpi/tools/acpidump/acpidump.h
@@ -66,7 +66,7 @@
 EXTERN u8 INIT_GLOBAL(gbl_summary_mode, FALSE);
 EXTERN u8 INIT_GLOBAL(gbl_verbose_mode, FALSE);
 EXTERN u8 INIT_GLOBAL(gbl_binary_mode, FALSE);
-EXTERN u8 INIT_GLOBAL(gbl_dump_customized_tables, FALSE);
+EXTERN u8 INIT_GLOBAL(gbl_dump_customized_tables, TRUE);
 EXTERN u8 INIT_GLOBAL(gbl_do_not_dump_xsdt, FALSE);
 EXTERN ACPI_FILE INIT_GLOBAL(gbl_output_file, NULL);
 EXTERN char INIT_GLOBAL(*gbl_output_filename, NULL);
diff --git a/tools/power/acpi/tools/acpidump/apmain.c 
b/tools/power/acpi/tools/acpidump/apmain.c
index d0ba653..57620f6 100644
--- a/tools/power/acpi/tools/acpidump/apmain.c
+++ b/tools/power/acpi/tools/acpidump/apmain.c
@@ -80,7 +80,7 @@ struct ap_dump_action action_table[AP_MAX_ACTIONS];
 u32 current_action = 0;
 
 #define AP_UTILITY_NAME "ACPI Binary Table Dump Utility"
-#define AP_SUPPORTED_OPTIONS"?a:bcf:hn:o:r:svxz"
+#define AP_SUPPORTED_OPTIONS"?a:bc:f:hn:o:r:svxz"
 
 /**
  *
@@ -96,7 +96,6 @@ static void ap_display_usage(void)
ACPI_USAGE_HEADER("acpidump [options]");
 
ACPI_OPTION("-b", "Dump tables to binary files");
-   ACPI_OPTION("-c", "Dump customized tables");
ACPI_OPTION("-h -?", "This help message");
ACPI_OPTION("-o ", "Redirect output to file");
ACPI_OPTION("-r ", "Dump tables from specified RSDP");
@@ -107,6 +106,7 @@ static void ap_display_usage(void)
ACPI_USAGE_TEXT("\nTable Options:\n");
 
ACPI_OPTION("-a ", "Get table via a physical address");
+   ACPI_OPTION("-c ", "Turning on/off customized table dumping");
ACPI_OPTION("-f ", "Get table via a binary file");
ACPI_OPTION("-n ", "Get table via a name/signature");
ACPI_OPTION("-x", "Do not use but dump XSDT");
@@ -181,7 +181,16 @@ static int ap_do_options(int argc, char **argv)
 
case 'c':   /* Dump customized tables */
 
-   gbl_dump_customized_tables = TRUE;
+   if (!strcmp(acpi_gbl_optarg, "on")) {
+   gbl_dump_customized_tables = TRUE;
+   } else if (!strcmp(acpi_gbl_optarg, "off")) {
+   gbl_dump_customized_tables = FALSE;
+   } else {
+   acpi_log_error
+   ("%s: Cannot handle this switch, please use 
on|off\n",
+acpi_gbl_optarg);
+   return (-1);
+   }
continue;
 
case 'h':
-- 
1.7.10

--
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 v2 20/28] ACPICA: acpidump: Allow customized tables to be dumped without accessing /dev/mem.

2015-06-23 Thread Lv Zheng
ACPICA commit ab29013cfa2424140446aff196a70b211ab343a9

The /dev/mem can be configured out, in which case, acpidump should still
work with "-c" option as tables can be found in /sys/firmware/acpi/tables.
This patch allows acpidump to work without /dev/mem.
This patch has been tested with "acpidump -c" and "acpidump -c -n FADT".
And it worked as expected. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/ab29013c
Reported-by: Al Stone 
Signed-off-by: Lv Zheng 
Signed-off-by: Bob Moore 
---
 .../acpi/os_specific/service_layers/oslinuxtbl.c   |   89 ++--
 1 file changed, 46 insertions(+), 43 deletions(-)

diff --git a/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c 
b/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c
index db15c9d..3aff9a2 100644
--- a/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c
+++ b/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c
@@ -582,64 +582,67 @@ static acpi_status osl_table_initialize(void)
return (AE_OK);
}
 
-   /* Get RSDP from memory */
+   if (!gbl_dump_customized_tables) {
 
-   status = osl_load_rsdp();
-   if (ACPI_FAILURE(status)) {
-   return (status);
-   }
+   /* Get RSDP from memory */
+
+   status = osl_load_rsdp();
+   if (ACPI_FAILURE(status)) {
+   return (status);
+   }
 
-   /* Get XSDT from memory */
+   /* Get XSDT from memory */
 
-   if (gbl_rsdp.revision && !gbl_do_not_dump_xsdt) {
-   if (gbl_xsdt) {
-   free(gbl_xsdt);
-   gbl_xsdt = NULL;
+   if (gbl_rsdp.revision && !gbl_do_not_dump_xsdt) {
+   if (gbl_xsdt) {
+   free(gbl_xsdt);
+   gbl_xsdt = NULL;
+   }
+
+   gbl_revision = 2;
+   status = osl_get_bios_table(ACPI_SIG_XSDT, 0,
+   ACPI_CAST_PTR(struct
+ 
acpi_table_header
+ *, _xsdt),
+   );
+   if (ACPI_FAILURE(status)) {
+   return (status);
+   }
}
 
-   gbl_revision = 2;
-   status = osl_get_bios_table(ACPI_SIG_XSDT, 0,
-   ACPI_CAST_PTR(struct
- acpi_table_header *,
- _xsdt), );
-   if (ACPI_FAILURE(status)) {
-   return (status);
+   /* Get RSDT from memory */
+
+   if (gbl_rsdp.rsdt_physical_address) {
+   if (gbl_rsdt) {
+   free(gbl_rsdt);
+   gbl_rsdt = NULL;
+   }
+
+   status = osl_get_bios_table(ACPI_SIG_RSDT, 0,
+   ACPI_CAST_PTR(struct
+ 
acpi_table_header
+ *, _rsdt),
+   );
+   if (ACPI_FAILURE(status)) {
+   return (status);
+   }
}
-   }
 
-   /* Get RSDT from memory */
+   /* Get FADT from memory */
 
-   if (gbl_rsdp.rsdt_physical_address) {
-   if (gbl_rsdt) {
-   free(gbl_rsdt);
-   gbl_rsdt = NULL;
+   if (gbl_fadt) {
+   free(gbl_fadt);
+   gbl_fadt = NULL;
}
 
-   status = osl_get_bios_table(ACPI_SIG_RSDT, 0,
+   status = osl_get_bios_table(ACPI_SIG_FADT, 0,
ACPI_CAST_PTR(struct
  acpi_table_header *,
- _rsdt), );
+ _fadt),
+   _fadt_address);
if (ACPI_FAILURE(status)) {
return (status);
}
-   }
-
-   /* Get FADT from memory */
-
-   if (gbl_fadt) {
-   free(gbl_fadt);
-   gbl_fadt = NULL;
-   }
-
-   status = osl_get_bios_table(ACPI_SIG_FADT, 0,
-   ACPI_CAST_PTR(struct acpi_table_header *,
- _fadt),
-   _fadt_address);
-   if (ACPI_FAILURE(status)) {
-  

[PATCH v2 11/28] ACPICA: EFI: Add EFI interface definitions to eliminate dependency of GNU EFI.

2015-06-23 Thread Lv Zheng
ACPICA commit 5d00e67a74542d030f0a55e7a947a020ef0d9693

This patch copies EFI interface definitions to the ACPICA code base so that
the EFI utility support can be ported to other EFI implementation.

Known issues:
1. MS Builds of uefi_call_wrapper()
   The uefi_call_wrapper() in GNU EFI is implemented in a the way to work
   around the ABI difference between Unix and MS. While I don't have
   environment to test the MS builds.

In order to port the ACPICA utilities to other EFI implementation, all that
need to be done is to impelement the 64-bit division support and the
program entry point where the efi_main() is invoked. Code to impelement
these is platform specific, and ACPICA currently choose to hide such
platform specific code within the specific EFI impelementation. Lv Zheng.

This patch doesn't affect Linux kernel.

Link: https://github.com/acpica/acpica/commit/5d00e67a
Signed-off-by: Lv Zheng 
Signed-off-by: Bob Moore 
---
 include/acpi/platform/acenvex.h |6 ++
 1 file changed, 6 insertions(+)

diff --git a/include/acpi/platform/acenvex.h b/include/acpi/platform/acenvex.h
index 14dc6f6..0a7dc8e 100644
--- a/include/acpi/platform/acenvex.h
+++ b/include/acpi/platform/acenvex.h
@@ -56,6 +56,12 @@
 #if defined(_LINUX) || defined(__linux__)
 #include 
 
+#elif defined(_AED_EFI)
+#include "acefiex.h"
+
+#elif defined(_GNU_EFI)
+#include "acefiex.h"
+
 #elif defined(__DragonFly__)
 #include "acdragonflyex.h"
 
-- 
1.7.10

--
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 v2 10/28] ACPICA: MSVC6: Fix build issue for variable argument macros.

2015-06-23 Thread Lv Zheng
ACPICA commit 72f5a358f28c5d154ed613c142c7dca03192c5ee

This patch intoduces generic variable macro detection support and fixes
build breakage issue with macros using __VA_ARGS__ feature defined in
C99.

This patch fixes this build issue. Lv Zheng.

This patch doesn't affect Linux kernel.

Link: https://github.com/acpica/acpica/commit/72f5a358
Signed-off-by: Lv Zheng 
Signed-off-by: Bob Moore 
---
 include/acpi/acoutput.h   |   13 +++--
 include/acpi/platform/acgcc.h |4 
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index a8f3443..f56de8c 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -294,8 +294,12 @@
 
 /* DEBUG_PRINT functions */
 
-#define ACPI_DEBUG_PRINT(plist) ACPI_ACTUAL_DEBUG plist
-#define ACPI_DEBUG_PRINT_RAW(plist) ACPI_ACTUAL_DEBUG_RAW plist
+#ifndef COMPILER_VA_MACRO
+
+#define ACPI_DEBUG_PRINT(plist) acpi_debug_print plist
+#define ACPI_DEBUG_PRINT_RAW(plist) acpi_debug_print_raw plist
+
+#else
 
 /* Helper macros for DEBUG_PRINT */
 
@@ -315,6 +319,11 @@
ACPI_DO_DEBUG_PRINT (acpi_debug_print_raw, level, line, \
filename, modulename, component, __VA_ARGS__)
 
+#define ACPI_DEBUG_PRINT(plist) ACPI_ACTUAL_DEBUG plist
+#define ACPI_DEBUG_PRINT_RAW(plist) ACPI_ACTUAL_DEBUG_RAW plist
+
+#endif
+
 /*
  * Function entry tracing
  *
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h
index f54de0a..5457a06 100644
--- a/include/acpi/platform/acgcc.h
+++ b/include/acpi/platform/acgcc.h
@@ -75,4 +75,8 @@
 #undef strchr
 #endif
 
+/* GCC supports __VA_ARGS__ in macros */
+
+#define COMPILER_VA_MACRO   1
+
 #endif /* __ACGCC_H__ */
-- 
1.7.10

--
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 v2 08/28] ACPICA: Tables: Fix an issue that ACPI initialization is blocked due to no FACS.

2015-06-23 Thread Lv Zheng
ACPICA commit ebd544ed24c5a4faba11f265e228b7a821a729f5

This patch fixes an issue that when FACS tables do not exist, ACPI
initialization cannot proceed. ACPICA BZ 1122. Lv Zheng.

Link: https://bugs.acpica.org/show_bug.cgi?id=1122
Link: https://github.com/acpica/acpica/commit/ebd544ed
Signed-off-by: Lv Zheng 
Signed-off-by: Bob Moore 
---
 drivers/acpi/acpica/tbutils.c |   16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c
index 6a6c5be..2bb6a11 100644
--- a/drivers/acpi/acpica/tbutils.c
+++ b/drivers/acpi/acpica/tbutils.c
@@ -84,18 +84,16 @@ acpi_status acpi_tb_initialize_facs(void)
  ACPI_CAST_INDIRECT_PTR(struct
 acpi_table_header,
 _gbl_facs64));
-   if (!acpi_gbl_facs32 && !acpi_gbl_facs64) {
-   return (AE_NO_MEMORY);
-   }
 
-   if (acpi_gbl_use32_bit_facs_addresses) {
-   acpi_gbl_FACS =
-   acpi_gbl_facs32 ? acpi_gbl_facs32 : acpi_gbl_facs64;
-   } else {
-   acpi_gbl_FACS =
-   acpi_gbl_facs64 ? acpi_gbl_facs64 : acpi_gbl_facs32;
+   if (acpi_gbl_facs64
+   && (!acpi_gbl_facs32 || !acpi_gbl_use32_bit_facs_addresses)) {
+   acpi_gbl_FACS = acpi_gbl_facs64;
+   } else if (acpi_gbl_facs32) {
+   acpi_gbl_FACS = acpi_gbl_facs32;
}
 
+   /* If there is no FACS, just continue. There was already an error msg */
+
return (AE_OK);
 }
 #endif /* !ACPI_REDUCED_HARDWARE */
-- 
1.7.10

--
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 v2 06/28] ACPICA: Hardware: Cleanup the return values in acpi_set_waking_vector().

2015-06-23 Thread Lv Zheng
ACPICA commit a04dbfa308a48ab0b2d10519c54a6c533c5c8949

The return statement in acpi_set_waking_vector() is wrong and this patch
corrects it. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/a04dbfa3
Signed-off-by: Lv Zheng 
Signed-off-by: Bob Moore 
---
 drivers/acpi/acpica/hwxfsleep.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c
index e273b2e..c25fedb 100644
--- a/drivers/acpi/acpica/hwxfsleep.c
+++ b/drivers/acpi/acpica/hwxfsleep.c
@@ -161,7 +161,7 @@ acpi_set_firmware_waking_vector(acpi_physical_address 
physical_address,
/* If Hardware Reduced flag is set, there is no FACS */
 
if (acpi_gbl_reduced_hardware) {
-   return (AE_OK);
+   return_ACPI_STATUS(AE_OK);
}
 
if (acpi_gbl_facs32) {
-- 
1.7.10

--
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 v2 03/28] ACPICA: Hardware: Enable 64-bit firmware waking vector for selected FACS.

2015-06-23 Thread Lv Zheng
ACPICA commit 7aa598d711644ab0de5f70ad88f1e2de253115e4

The following commit is reported to have broken s2ram on some platforms:
 Commit: 0249ed2444d65d65fc3f3f64f398f1ad0b7e54cd
 ACPICA: Add option to favor 32-bit FADT addresses.
The platform reports 2 FACS tables (which is not allowed by ACPI
specification) and the new 32-bit address favor rule forces OSPMs to use
the FACS table reported via FADT's X_FIRMWARE_CTRL field.

The root cause of the reported bug might be one of the followings:
1. BIOS may favor the 64-bit firmware waking vector address when the
   version of the FACS is greater than 0 and Linux currently only supports
   resuming from the real mode, so the 64-bit firmware waking vector has
   never been set and might be invalid to BIOS while the commit enables
   higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the
   FADT while the commit doesn't set the firmware waking vector address of
   the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking
   vector address of the FACS reported by "X_FIRMWARE_CTRL".

This patch excludes the cases that can trigger the bugs caused by the root
cause 1.

ACPI specification says:
A. 32-bit FACS address (FIRMWARE_CTRL field in FADT):
   Physical memory address of the FACS, where OSPM and firmware exchange
   control information.
   If the X_FIRMWARE_CTRL field contains a non zero value then this field
   must be zero.
   A zero value indicates that no FACS is specified by this field.
B. 64-bit FACS address (X_FIRMWARE_CTRL field in FADT):
   64bit physical memory address of the FACS.
   This field is used when the physical address of the FACS is above 4GB.
   If the FIRMWARE_CTRL field contains a non zero value then this field
   must be zero.
   A zero value indicates that no FACS is specified by this field.
Thus the 32bit and 64bit firmware waking vector should indicate completely
different resuming environment - real mode (1MB addressable) and non real
mode (4GB+ addressable) and currently Linux only supports resuming from
real mode.

This patch enables 64-bit firmware waking vector for selected FACS via
acpi_set_firmware_waking_vector() so that it's up to OSPMs to determine which
resuming mode should be used by BIOS and ACPICA changes won't trigger the
bugs caused by the root cause 1. For example, Linux can pass
physical_address64=0 as the parameter of acpi_set_firmware_waking_vector() to
indicate no 64bit waking vector support. Lv Zheng.

This patch also updates acpi_set_firmware_waking_vector() invocations in
order to keep 32-bit firmware waking vector favor for Linux. 64-bit
firmware waking vector has never been enabled by Linux.  The
(acpi_physical_address)0 for 64-bit address can be used to force ACPICA to
set only 32-bit firmware waking vector for Linux.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=74021
Link: https://github.com/acpica/acpica/commit/7aa598d7
Cc: 3.14.1+  # 3.14.1+
Reported-and-tested-by: Oswald Buddenhagen 
Signed-off-by: Lv Zheng 
Signed-off-by: Bob Moore 
Cc: Thomas Gleixner 
Cc: Ingo Molnar 
Cc: "H. Peter Anvin" 
Cc: x...@kernel.org
Cc: Tony Luck 
Cc: Fenghua Yu 
Cc: linux-i...@vger.kernel.org
---
 arch/ia64/include/asm/acpi.h|3 +-
 arch/ia64/kernel/acpi.c |2 --
 arch/x86/include/asm/acpi.h |3 +-
 drivers/acpi/acpica/hwxfsleep.c |   61 ---
 drivers/acpi/sleep.c|8 +++--
 include/acpi/acpixf.h   |   11 +++
 6 files changed, 33 insertions(+), 55 deletions(-)

diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
index aa0fdf1..0ac4fab 100644
--- a/arch/ia64/include/asm/acpi.h
+++ b/arch/ia64/include/asm/acpi.h
@@ -79,7 +79,8 @@ int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
 /* Low-level suspend routine. */
 extern int acpi_suspend_lowlevel(void);
 
-extern unsigned long acpi_wakeup_address;
+#define acpi_wakeup_address((acpi_physical_address)0)
+#define acpi_wakeup_address64  ((acpi_physical_address)0)
 
 /*
  * Record the cpei override flag and current logical cpu. This is
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index b1698bc..1b08d6f 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -60,8 +60,6 @@ int acpi_lapic;
 unsigned int acpi_cpei_override;
 unsigned int acpi_cpei_phys_cpuid;
 
-unsigned long acpi_wakeup_address = 0;
-
 #ifdef CONFIG_IA64_GENERIC
 static unsigned long __init acpi_find_rsdp(void)
 {
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index 3a45668..fc9608d 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -72,7 +72,8 @@ static inline void acpi_disable_pci(void)
 extern int (*acpi_suspend_lowlevel)(void);
 
 /* Physical address to resume after wakeup */
-#define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start))
+#define acpi_wakeup_address
((acpi_physical_address)(real_mode_header->wakeup_start))
+#define 

mm/pcp: NULL pointer access at free_pcppages_bulk()

2015-06-23 Thread Xishi Qiu
Does someone have seen the call trace?

Linux version 3.0.101-0.46-default (geeko@buildhost) (gcc version 4.3.4 
[gcc-4_3-branch revision 152973] (SUSE Linux) ) #1 SMP Wed Dec 17 11:04:10 UTC 
2014 (8356111)
Command line: root=/dev/rootvg/rootlv resume=/dev/rootvg/swaplv splash=silent 
crashkernel=512M vga=0x31a

<1>[7241687.198999] BUG: unable to handle kernel NULL pointer dereference at
   (null)
<1>[7241687.199013] IP: [] free_pcppages_bulk+0xd8/0x430
<4>[7241687.199026] PGD 0 
<0>[7241687.199029] Oops: 0002 [#1] SMP 
<4>[7241687.199036] CPU 6 
<4>[7241687.199037] Modules linked in: mmfs26(EX) mmfslinux(EX) tracedev(EX) 
raw binfmt_misc edd dm_service_time dm_multipath bonding rdma_ucm rdma_cm iw_cm 
ib_addr ib_srp scsi_transport_srp ib_ipoib ib_cm ib_uverbs ib_umad iw_cxgb3 
cxgb3 mdio ib_mthca mperf fuse loop mlx4_ib mlx4_en ib_sa ib_mad ib_core ipv6 
ipv6_lib i2c_i801 pcspkr igb mei dca ptp pps_core i2c_core mlx4_core joydev 
sr_mod cdrom wmi sg acpi_memhotplug rtc_cmos button container ext3 jbd mbcache 
usbhid hid dm_mirror dm_region_hash dm_log linear ehci_hcd usbcore sd_mod 
usb_common crc_t10dif processor thermal_sys hwmon scsi_dh_emc scsi_dh_rdac 
scsi_dh_hp_sw scsi_dh_alua scsi_dh dm_snapshot dm_mod ahci libahci libata lpfc 
scsi_transport_fc scsi_tgt megaraid_sas scsi_mod
<4>[7241687.199112] Supported: Yes, External
<4>[7241687.199114] 
<4>[7241687.199118] Pid: 181, comm: kworker/6:1 Tainted: G   E X 
3.0.101-0.46-default #1 To be filled by O.E.M. Tecal RH5885 V3/BC61BLCA
<4>[7241687.199124] RIP: 0010:[]  [] 
free_pcppages_bulk+0xd8/0x430
<4>[7241687.199130] RSP: 0018:881fc2025cd0  EFLAGS: 00010097
<4>[7241687.199133] RAX:  RBX: ea01a1081d48 RCX: 
88207fb13aa8
<4>[7241687.199136] RDX: 88207fb13aa0 RSI: ea0194c14160 RDI: 

<4>[7241687.199139] RBP: ea01a1081d20 R08:  R09: 

<4>[7241687.199142] R10: ea0194c14138 R11: 88807ff97f80 R12: 
0001
<4>[7241687.199146] R13: 88807ff97f80 R14: 0002 R15: 
0002
<4>[7241687.199149] FS:  () GS:88207fb0() 
knlGS:
<4>[7241687.199153] CS:  0010 DS:  ES:  CR0: 8005003b
<4>[7241687.199156] CR2:  CR3: 01a09000 CR4: 
001407e0
<4>[7241687.199159] DR0:  DR1:  DR2: 

<4>[7241687.199163] DR3:  DR6: 0ff0 DR7: 
0400
<4>[7241687.199166] Process kworker/6:1 (pid: 181, threadinfo 881fc2024000, 
task 881fc2022500)
<0>[7241687.199170] Stack:
<4>[7241687.199172]  810095d5 88207fb13aa8 0030 
88807ff97fe0
<4>[7241687.199189]  88207fb13a70 0009001f 88207fb13aa0 
88207fb13a70
<4>[7241687.199196]  001f 0282 0006 
88207fb13e05
<0>[7241687.199202] Call Trace:
<4>[7241687.199215]  [] drain_zone_pages+0x3f/0x60
<4>[7241687.199225]  [] refresh_cpu_vm_stats+0x138/0x150
<4>[7241687.199233]  [] vmstat_update+0x11/0x40
<4>[7241687.199241]  [] process_one_work+0x16c/0x350
<4>[7241687.199248]  [] worker_thread+0x17a/0x410
<4>[7241687.199255]  [] kthread+0x96/0xa0
<4>[7241687.199264]  [] kernel_thread_helper+0x4/0x10
<0>[7241687.199270] Code: 08 48 89 44 24 10 48 89 4c 24 08 0f 1f 84 00 00 00 00 
00 48 8b 4c 24 08 48 8b 19 48 8d 6b d8 48 8b 45 30 48 8b 55 28 48 89 42 08 
<48>[7241687.199289]  89 10 48 b8 00 01 10 00 00 00 ad de 48 89 45 28 48 b8 00 
02 
<1>[7241687.199300] RIP  [] free_pcppages_bulk+0xd8/0x430
<4>[7241687.199305]  RSP 
<0>[7241687.199307] CR2: 

--
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 v2 01/28] ACPICA: Linuxize: Reduce divergences for 20150619 release.

2015-06-23 Thread Lv Zheng
This patch reduces source code differences between the Linux kernel and the
ACPICA upstream so that the linuxized ACPICA 20150619 release can be
applied with reduced human intervention.

Signed-off-by: Lv Zheng 
---
 drivers/acpi/acpica/dsobject.c  |2 +-
 drivers/acpi/acpica/hwxfsleep.c |2 --
 drivers/acpi/acpica/rscreate.c  |2 +-
 drivers/acpi/acpica/rsutils.c   |2 +-
 drivers/acpi/acpica/tbxface.c   |1 +
 include/acpi/platform/acenv.h   |1 -
 6 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/acpi/acpica/dsobject.c b/drivers/acpi/acpica/dsobject.c
index 8a7b07b..4a4b2f3 100644
--- a/drivers/acpi/acpica/dsobject.c
+++ b/drivers/acpi/acpica/dsobject.c
@@ -751,7 +751,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state 
*walk_state,
 
obj_desc->string.pointer = op->common.value.string;
obj_desc->string.length =
-   (u32) ACPI_STRLEN(op->common.value.string);
+   (u32)ACPI_STRLEN(op->common.value.string);
 
/*
 * The string is contained in the ACPI table, don't ever try
diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c
index 3b37676..82e310b 100644
--- a/drivers/acpi/acpica/hwxfsleep.c
+++ b/drivers/acpi/acpica/hwxfsleep.c
@@ -138,7 +138,6 @@ acpi_status acpi_set_firmware_waking_vector64(u64 
physical_address)
 {
ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector64);
 
-
/* Determine if the 64-bit vector actually exists */
 
if ((acpi_gbl_FACS->length <= 32) || (acpi_gbl_FACS->version < 1)) {
@@ -154,7 +153,6 @@ acpi_status acpi_set_firmware_waking_vector64(u64 
physical_address)
 
 ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64)
 #endif
-
 
/***
  *
  * FUNCTION:acpi_enter_sleep_state_s4bios
diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c
index 15434e4..f30f35e 100644
--- a/drivers/acpi/acpica/rscreate.c
+++ b/drivers/acpi/acpica/rscreate.c
@@ -353,7 +353,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object 
*package_object,
/* +1 to include null terminator */
 
user_prt->length +=
-   (u32) ACPI_STRLEN(user_prt->source) + 1;
+   (u32)ACPI_STRLEN(user_prt->source) + 1;
break;
 
case ACPI_TYPE_STRING:
diff --git a/drivers/acpi/acpica/rsutils.c b/drivers/acpi/acpica/rsutils.c
index ece3cd6..90417de 100644
--- a/drivers/acpi/acpica/rsutils.c
+++ b/drivers/acpi/acpica/rsutils.c
@@ -367,7 +367,7 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
(u32)
ACPI_STRLEN(ACPI_CAST_PTR(char, _resource_source[1])) +
1;
-   total_length = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(total_length);
+   total_length = (u32)ACPI_ROUND_UP_TO_NATIVE_WORD(total_length);
 
ACPI_MEMSET(resource_source->string_ptr, 0, total_length);
 
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c
index 60e94f8..54b9f79 100644
--- a/drivers/acpi/acpica/tbxface.c
+++ b/drivers/acpi/acpica/tbxface.c
@@ -242,6 +242,7 @@ acpi_get_table_header(char *signature,
if (!header) {
return (AE_NO_MEMORY);
}
+
ACPI_MEMCPY(out_table_header, header,
sizeof(struct acpi_table_header));
acpi_os_unmap_memory(header,
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index 073997d..1e84e62 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -359,7 +359,6 @@
 #define ACPI_MEMCMP(s1,s2,n)memcmp((const char *)(s1), (const char *)(s2), 
(acpi_size)(n))
 #define ACPI_MEMCPY(d,s,n)  (void) memcpy((d), (s), (acpi_size)(n))
 #define ACPI_MEMSET(d,s,n)  (void) memset((d), (s), (acpi_size)(n))
-
 #define ACPI_TOUPPER(i) toupper((int) (i))
 #define ACPI_TOLOWER(i) tolower((int) (i))
 #define ACPI_IS_XDIGIT(i)   isxdigit((int) (i))
-- 
1.7.10

--
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 v2 05/28] ACPICA: Hardware: Enable firmware waking vector for both 32-bit and 64-bit FACS.

2015-06-23 Thread Lv Zheng
ACPICA commit 368eb60778b27b6ae94d3658ddc902ca1342a963
ACPICA commit 70f62a80d65515e1285fdeeb50d94ee6f07df4bd

The following commit is reported to have broken s2ram on some platforms:
 Commit: 0249ed2444d65d65fc3f3f64f398f1ad0b7e54cd
 ACPICA: Add option to favor 32-bit FADT addresses.
The platform reports 2 FACS tables (which is not allowed by ACPI
specification) and the new 32-bit address favor rule forces OSPMs to use
the FACS table reported via FADT's X_FIRMWARE_CTRL field.

The root cause of the reported bug might be one of the followings:
1. BIOS may favor the 64-bit firmware waking vector address when the
   version of the FACS is greater than 0 and Linux currently only supports
   resuming from the real mode, so the 64-bit firmware waking vector has
   never been set and might be invalid to BIOS while the commit enables
   higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the
   FADT while the commit doesn't set the firmware waking vector address of
   the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking
   vector address of the FACS reported by "X_FIRMWARE_CTRL".

This patch excludes the cases that can trigger the bugs caused by the root
cause 2.

There is no handshaking mechanism can be used by OSPM to tell BIOS which
FACS is currently used. Thus the FACS reported by "FIRMWARE_CTRL" may still
be used by BIOS and the 0 value of the 32-bit firmware waking vector might
trigger such failure.

This patch enables the firmware waking vectors for both 32bit/64bit FACS
tables in order to ensure we can exclude the cases that trigger the bugs
caused by the root cause 2. The exclusion is split into 2 commits so that
if it turns out not to be necessary, this single commit can be reverted
without affecting the useful one. Lv Zheng, Bob Moore.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=74021
Link: https://github.com/acpica/acpica/commit/368eb607
Link: https://github.com/acpica/acpica/commit/70f62a80
Reported-and-tested-by: Oswald Buddenhagen 
Signed-off-by: Lv Zheng 
Signed-off-by: Bob Moore 
---
 drivers/acpi/acpica/acglobal.h  |2 ++
 drivers/acpi/acpica/hwxfsleep.c |   74 ---
 drivers/acpi/acpica/tbutils.c   |   14 
 3 files changed, 71 insertions(+), 19 deletions(-)

diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index a0c4787..53f96a3 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -61,6 +61,8 @@ ACPI_GLOBAL(struct acpi_table_header, 
acpi_gbl_original_dsdt_header);
 
 #if (!ACPI_REDUCED_HARDWARE)
 ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_FACS);
+ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_facs32);
+ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_facs64);
 
 #endif /* !ACPI_REDUCED_HARDWARE */
 
diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c
index c67cd32..e273b2e 100644
--- a/drivers/acpi/acpica/hwxfsleep.c
+++ b/drivers/acpi/acpica/hwxfsleep.c
@@ -50,6 +50,13 @@
 ACPI_MODULE_NAME("hwxfsleep")
 
 /* Local prototypes */
+#if (!ACPI_REDUCED_HARDWARE)
+static acpi_status
+acpi_hw_set_firmware_waking_vector(struct acpi_table_facs *facs,
+  acpi_physical_address physical_address,
+  acpi_physical_address physical_address64);
+#endif
+
 static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id);
 
 /*
@@ -79,9 +86,10 @@ static struct acpi_sleep_functions acpi_sleep_dispatch[] = {
 #if (!ACPI_REDUCED_HARDWARE)
 
/***
  *
- * FUNCTION:acpi_set_firmware_waking_vector
+ * FUNCTION:acpi_hw_set_firmware_waking_vector
  *
- * PARAMETERS:  physical_address- 32-bit physical address of ACPI real mode
+ * PARAMETERS:  facs- Pointer to FACS table
+ *  physical_address- 32-bit physical address of ACPI real mode
  *entry point
  *  physical_address64  - 64-bit physical address of ACPI protected
  *entry point
@@ -92,11 +100,12 @@ static struct acpi_sleep_functions acpi_sleep_dispatch[] = 
{
  *
  
**/
 
-acpi_status
-acpi_set_firmware_waking_vector(acpi_physical_address physical_address,
-   acpi_physical_address physical_address64)
+static acpi_status
+acpi_hw_set_firmware_waking_vector(struct acpi_table_facs *facs,
+  acpi_physical_address physical_address,
+  acpi_physical_address physical_address64)
 {
-   ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector);
+   ACPI_FUNCTION_TRACE(acpi_hw_set_firmware_waking_vector);
 
 
/*
@@ -109,25 +118,66 @@ acpi_set_firmware_waking_vector(acpi_physical_address 
physical_address,
 

[PATCH v2 02/28] ACPICA: Linuxize: Replace __FUNCTION__ with __func__.

2015-06-23 Thread Lv Zheng
ACPICA commit cb3d1c79f862cd368d749c9b8d9dced40111b0d0

__FUNCTION__ is MSVC only, in Linux, it is __func__. Lv Zheng.

In ACPICA, this is achieved by string replacement in release script and
this patch contains the source code difference between the Linux upstream
and ACPICA that is caused by the back porting.

Link: https://github.com/acpica/acpica/commit/cb3d1c79
Signed-off-by: Lv Zheng 
---
 drivers/acpi/acpica/utdebug.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c
index 4f3f888..cd02693 100644
--- a/drivers/acpi/acpica/utdebug.c
+++ b/drivers/acpi/acpica/utdebug.c
@@ -111,8 +111,8 @@ void acpi_ut_track_stack_ptr(void)
  * RETURN:  Updated pointer to the function name
  *
  * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present.
- *  This allows compiler macros such as __func__ to be used with no
- *  change to the debug output.
+ *  This allows compiler macros such as __func__ to be used
+ *  with no change to the debug output.
  *
  
**/
 
-- 
1.7.10

--
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 v2 00/28] ACPICA: 20150619 Release

2015-06-23 Thread Lv Zheng
The 20150619 ACPICA kernel-resident subsystem updates are linuxized based
on the linux-pm/linux-next branch.

The patchset has passed the following build/boot tests.
Build tests are performed as follows:
1. i386 + default + COFNIG_ACPI=y
2. i386 + allyes + CONFIG_ACPI=y
3. i386 + default + COFNIG_ACPI=n
4. i386 + allyes + CONFIG_ACPI=n
5. x86_64 + default + COFNIG_ACPI=y
6. x86_64 + allyes + CONFIG_ACPI=y
7. x86_64 + default + COFNIG_ACPI=n
8. x86_64 + allyes + CONFIG_ACPI=n
Boot tests are performed as follows:
1. i386 + default + COFNIG_ACPI=y
2. x86_64 + default + COFNIG_ACPI=y
Where:
1. i386: machine named as "Dell Inspiron Mini 1010"
2. x86_64: machine named as "HP Compaq 8200 Elite SFF PC"
3. default: kernel configuration with following items enabled:
   All hardware drivers related to the machines of i386/x86_64
   All drivers/acpi configurations
   All platform drivers

The divergences checking result:
Before applying (20150515 Release):
  565 lines
After applying (20150619 Release):
  539 lines

Bob Moore (8):
  ACPICA: Namespace: Add support of OSDT table.
  ACPICA: Namespace: Change namespace override to avoid node deletion.
  ACPICA: Cleanup output for the ASL Debug object.
  ACPICA: De-macroize calls to standard C library functions.
  ACPICA: Split C library prototypes to new header.
  ACPICA: Update definitions for the TCPA and TPM2 ACPI tables.
  ACPICA: Update TPM2 ACPI table.
  ACPICA: Update version to 20150619.

Hanjun Guo (1):
  ACPICA: ACPI 6.0: Add values for MADT GIC version field.

Lv Zheng (15):
  ACPICA: Linuxize: Reduce divergences for 20150619 release.
  ACPICA: Linuxize: Replace __FUNCTION__ with __func__.
  ACPICA: Hardware: Enable 64-bit firmware waking vector for selected
FACS.
  ACPICA: Tables: Enable both 32-bit and 64-bit FACS.
  ACPICA: Hardware: Enable firmware waking vector for both 32-bit and
64-bit FACS.
  ACPICA: Hardware: Cleanup the return values in
acpi_set_waking_vector().
  ACPICA: Tables: Fix an issue that FACS initialization is performed
twice.
  ACPICA: Tables: Fix an issue that ACPI initialization is blocked due
to no FACS.
  ACPICA: Tables: Enable default 64-bit FADT addresses favor.
  ACPICA: MSVC6: Fix build issue for variable argument macros.
  ACPICA: EFI: Add EFI interface definitions to eliminate dependency of
GNU EFI.
  ACPICA: Namespace: Add support to allow overriding objects.
  ACPICA: acpidump: Allow customized tables to be dumped without
accessing /dev/mem.
  ACPICA: acpidump: Convert the default behavior to dump from
/sys/firmware/acpi/tables.
  ACPI / acpidump: Update acpidump manual.

Sascha Wildner (1):
  ACPICA: Add dragon_fly support to unix file mapping file.

Suravee Suthikulpanit (1):
  ACPICA: Utilities: Add _CLS processing

Zhang Rui (1):
  ACPICA: Update for acpi_install_table memory types.

gongzg (1):
  ACPICA: Comment update, no functional change.

 arch/ia64/include/asm/acpi.h   |3 +-
 arch/ia64/kernel/acpi.c|2 -
 arch/x86/include/asm/acpi.h|3 +-
 drivers/acpi/acpica/accommon.h |3 +
 drivers/acpi/acpica/acglobal.h |2 +
 drivers/acpi/acpica/acinterp.h |2 +
 drivers/acpi/acpica/aclocal.h  |1 +
 drivers/acpi/acpica/acnamesp.h |1 +
 drivers/acpi/acpica/acobject.h |1 +
 drivers/acpi/acpica/acstruct.h |1 +
 drivers/acpi/acpica/acutils.h  |   64 +
 drivers/acpi/acpica/dsfield.c  |2 +-
 drivers/acpi/acpica/dsinit.c   |2 +-
 drivers/acpi/acpica/dsobject.c |7 +-
 drivers/acpi/acpica/dsutils.c  |4 +-
 drivers/acpi/acpica/dswload.c  |   17 +++-
 drivers/acpi/acpica/evgpeinit.c|2 +-
 drivers/acpi/acpica/exconfig.c |2 +-
 drivers/acpi/acpica/exconvrt.c |9 +-
 drivers/acpi/acpica/exdebug.c  |   42 +++-
 drivers/acpi/acpica/exdump.c   |9 +-
 drivers/acpi/acpica/exfield.c  |2 +-
 drivers/acpi/acpica/exfldio.c  |   52 +-
 drivers/acpi/acpica/exmisc.c   |   36 +++
 drivers/acpi/acpica/exnames.c  |2 +-
 drivers/acpi/acpica/exoparg2.c |8 +-
 drivers/acpi/acpica/exoparg3.c |4 +-
 drivers/acpi/acpica/exregion.c |9 +-
 drivers/acpi/acpica/exstorob.c |   18 ++--
 drivers/acpi/acpica/exutils.c  |   32 +++
 drivers/acpi/acpica/hwxfsleep.c|   85 +++--
 drivers/acpi/acpica/nsaccess.c |   16 +++-
 drivers/acpi/acpica/nsconvert.c|   10 

[PATCH][v2] asus-rbtn: new driver for asus radio button for Windows 8

2015-06-23 Thread Alex Hung
ASUS introduced a new approach to handle wireless hotkey
since Windows 8.  When the hotkey is pressed, BIOS generates
a notification 0x88 to a new ACPI device, ATK4001.  This
new driver not only translates the notification to KEY_RFKILL
but also toggles its LED accordingly.

Signed-off-by: Alex Hung 
---
 MAINTAINERS  |   6 +
 drivers/platform/x86/Kconfig |  11 ++
 drivers/platform/x86/Makefile|   1 +
 drivers/platform/x86/asus-rbtn.c | 240 +++
 4 files changed, 258 insertions(+)
 create mode 100644 drivers/platform/x86/asus-rbtn.c

diff --git a/MAINTAINERS b/MAINTAINERS
index d8afd29..03711ce 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1673,6 +1673,12 @@ S:   Maintained
 F: drivers/platform/x86/asus*.c
 F: drivers/platform/x86/eeepc*.c
 
+ASUS RADIO BUTTON DRIVER
+M: Alex Hung 
+L: platform-driver-...@vger.kernel.org
+S: Maintained
+F: drivers/platform/x86/asus-rbtn.c
+
 ASYNCHRONOUS TRANSFERS/TRANSFORMS (IOAT) API
 R: Dan Williams 
 W: http://sourceforge.net/projects/xscaleiop
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index f9f205c..a8ac885 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -516,6 +516,17 @@ config EEEPC_LAPTOP
  If you have an Eee PC laptop, say Y or M here. If this driver
  doesn't work on your Eee PC, try eeepc-wmi instead.
 
+config ASUS_RBTN
+   tristate "ASUS radio button"
+   depends on ACPI
+   depends on INPUT
+   help
+This driver provides supports for new ASUS radio button for Windows 8.
+On such systems the driver should load automatically (via ACPI alias).
+
+To compile this driver as a module, choose M here: the module will
+be called asus-rbtn.
+
 config ASUS_WMI
tristate "ASUS WMI Driver"
depends on ACPI_WMI
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index f82232b..6710bb3 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -3,6 +3,7 @@
 # x86 Platform-Specific Drivers
 #
 obj-$(CONFIG_ASUS_LAPTOP)  += asus-laptop.o
+obj-$(CONFIG_ASUS_RBTN)+= asus-rbtn.o
 obj-$(CONFIG_ASUS_WMI) += asus-wmi.o
 obj-$(CONFIG_ASUS_NB_WMI)  += asus-nb-wmi.o
 obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o
diff --git a/drivers/platform/x86/asus-rbtn.c b/drivers/platform/x86/asus-rbtn.c
new file mode 100644
index 000..a469881
--- /dev/null
+++ b/drivers/platform/x86/asus-rbtn.c
@@ -0,0 +1,240 @@
+/*
+ *  asus-rbtn radio button for Windows 8
+ *
+ *  Copyright (C) 2015 Alex Hung 
+ *
+ *  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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Alex Hung");
+MODULE_ALIAS("acpi*:ATK4001:*");
+
+#define ASUS_RBTN_NOTIFY   0x88
+
+static struct platform_device *asuspl_dev;
+static struct input_dev *asusrb_input_dev;
+static struct rfkill *asus_rfkill;
+static struct acpi_device *asus_rbtn_device;
+static int radio_led_state;
+
+static const struct acpi_device_id asusrb_ids[] = {
+   {"ATK4001", 0},
+   {"", 0},
+};
+
+static int asus_radio_led_set(bool blocked)
+{
+   acpi_status status;
+   union acpi_object arg0 = { ACPI_TYPE_INTEGER };
+   struct acpi_object_list args = { 1,  };
+   unsigned long long output;
+
+   arg0.integer.value = blocked;
+   status = acpi_evaluate_integer(asus_rbtn_device->handle, "HSWC",
+  , );
+   if (!ACPI_SUCCESS(status) || output == 0) {
+   pr_err("fail to change wireless LED.\n");
+   return -EINVAL;
+   }
+
+   return 0;
+}
+
+static int asus_rfkill_set(void *data, bool blocked)
+{
+   radio_led_state = blocked ? 0 : 1;
+
+   return asus_radio_led_set(radio_led_state);
+}
+
+static const struct rfkill_ops asus_rfkill_ops = {
+   .set_block = asus_rfkill_set,
+};
+
+static int asusrb_rfkill_setup(struct acpi_device *device)
+{
+   int err;
+
+   asus_rfkill = rfkill_alloc("asus_rbtn",
+  >dev,
+  RFKILL_TYPE_WLAN,
+  _rfkill_ops,
+  device);
+   if (!asus_rfkill) {
+   pr_err("unable to allocate rfkill device\n");
+   return -ENOMEM;
+   }
+
+   err = 

[PATCH v3 03/15] notifiers: Assert that RCU is watching in notify_die

2015-06-23 Thread Andy Lutomirski
Low-level arch entries often call notify_die, and it's easy for arch
code to fail to exit an RCU quiescent state first.  Assert that
we're not quiescent in notify_die.

Signed-off-by: Andy Lutomirski 
---
 kernel/notifier.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/notifier.c b/kernel/notifier.c
index ae9fc7cc360e..980e4330fb59 100644
--- a/kernel/notifier.c
+++ b/kernel/notifier.c
@@ -544,6 +544,8 @@ int notrace notify_die(enum die_val val, const char *str,
.signr  = sig,
 
};
+   rcu_lockdep_assert(rcu_is_watching(),
+  "notify_die called but RCU thinks we're quiescent");
return atomic_notifier_call_chain(_chain, val, );
 }
 NOKPROBE_SYMBOL(notify_die);
-- 
2.4.3

--
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 v3 07/15] x86/entry: Add new, comprehensible entry and exit hooks

2015-06-23 Thread Andy Lutomirski
The current entry and exit code is incomprehensible, appears to work
primary by luck, and is very difficult to incrementally improve.  Add
new code in preparation for simply deleting the old code.

prepare_exit_to_usermode is a new function that will handle all slow
path exits to user mode.  It is called with IRQs disabled and it
leaves us in a state in which it is safe to immediately return to
user mode.  IRQs must not be re-enabled at any point after
prepare_exit_to_usermode returns and user mode is actually entered.
(We can, of course, fail to enter user mode and treat that failure
as a fresh entry to kernel mode.)  All callers of do_notify_resume
will be migrated to call prepare_exit_to_usermode instead;
prepare_exit_to_usermode needs to do everything that
do_notify_resume does, but it also takes care of scheduling and
context tracking.  Unlike do_notify_resume, it does not need to be
called in a loop.

syscall_return_slowpath is exactly what it sounds like.  It will be
called on any syscall exit slow path.  It will replaces
syscall_trace_leave and it calls prepare_exit_to_usermode on the way
out.

Signed-off-by: Andy Lutomirski 
---
 arch/x86/entry/common.c | 112 +++-
 1 file changed, 111 insertions(+), 1 deletion(-)

diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
index 8a7e35af7164..82c7a67204f1 100644
--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -207,6 +207,7 @@ long syscall_trace_enter(struct pt_regs *regs)
return syscall_trace_enter_phase2(regs, arch, phase1_result);
 }
 
+/* Deprecated. */
 void syscall_trace_leave(struct pt_regs *regs)
 {
bool step;
@@ -237,8 +238,117 @@ void syscall_trace_leave(struct pt_regs *regs)
user_enter();
 }
 
+static struct thread_info *pt_regs_to_thread_info(struct pt_regs *regs)
+{
+   unsigned long top_of_stack =
+   (unsigned long)(regs + 1) + TOP_OF_KERNEL_STACK_PADDING;
+   return (struct thread_info *)(top_of_stack - THREAD_SIZE);
+}
+
+/* Called with IRQs disabled. */
+__visible void prepare_exit_to_usermode(struct pt_regs *regs)
+{
+   if (WARN_ON(!irqs_disabled()))
+   local_irq_enable();
+
+   /*
+* In order to return to user mode, we need to have IRQs off with
+* none of _TIF_SIGPENDING, _TIF_NOTIFY_RESUME, _TIF_USER_RETURN_NOTIFY,
+* _TIF_UPROBE, or _TIF_NEED_RESCHED set.  Several of these flags
+* can be set at any time on preemptable kernels if we have IRQs on,
+* so we need to loop.  Disabling preemption wouldn't help: doing the
+* work to clear some of the flags can sleep.
+*/
+   while (true) {
+   u32 cached_flags =
+   READ_ONCE(pt_regs_to_thread_info(regs)->flags);
+
+   if (!(cached_flags & (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME |
+ _TIF_UPROBE | _TIF_NEED_RESCHED)))
+   break;
+
+   /* We have work to do. */
+   local_irq_enable();
+
+   if (cached_flags & _TIF_NEED_RESCHED)
+   schedule();
+
+   if (cached_flags & _TIF_UPROBE)
+   uprobe_notify_resume(regs);
+
+   /* deal with pending signal delivery */
+   if (cached_flags & _TIF_SIGPENDING)
+   do_signal(regs);
+
+   if (cached_flags & _TIF_NOTIFY_RESUME) {
+   clear_thread_flag(TIF_NOTIFY_RESUME);
+   tracehook_notify_resume(regs);
+   }
+
+   if (cached_flags & _TIF_USER_RETURN_NOTIFY)
+   fire_user_return_notifiers();
+
+   /* Disable IRQs and retry */
+   local_irq_disable();
+   }
+
+   user_enter();
+}
+
+/*
+ * Called with IRQs on and fully valid regs.  Returns with IRQs off in a
+ * state such that we can immediately switch to user mode.
+ */
+__visible void syscall_return_slowpath(struct pt_regs *regs)
+{
+   struct thread_info *ti = pt_regs_to_thread_info(regs);
+   u32 cached_flags = READ_ONCE(ti->flags);
+   bool step;
+
+   CT_WARN_ON(ct_state() != CONTEXT_KERNEL);
+
+   if (WARN(irqs_disabled(), "syscall %ld left IRQs disabled",
+regs->orig_ax))
+   local_irq_enable();
+
+   /*
+* First do one-time work.  If these work items are enabled, we
+* want to run them exactly once per syscall exit with IRQs on.
+*/
+   if (cached_flags & (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT |
+   _TIF_SINGLESTEP | _TIF_SYSCALL_TRACEPOINT)) {
+   audit_syscall_exit(regs);
+
+   if (cached_flags & _TIF_SYSCALL_TRACEPOINT)
+   trace_sys_exit(regs, regs->ax);
+
+   /*
+* If TIF_SYSCALL_EMU is set, we only get here because of
+* TIF_SINGLESTEP (i.e. this is 

[PATCH v3 02/15] context_tracking: Add ct_state and CT_WARN_ON

2015-06-23 Thread Andy Lutomirski
This will let us sprinkle sanity checks around the kernel without
making too much of a mess.

Signed-off-by: Andy Lutomirski 
---
 include/linux/context_tracking.h   | 15 +++
 include/linux/context_tracking_state.h |  1 +
 2 files changed, 16 insertions(+)

diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
index 2821838256b4..3f5ac9b86f69 100644
--- a/include/linux/context_tracking.h
+++ b/include/linux/context_tracking.h
@@ -57,6 +57,19 @@ static inline void context_tracking_task_switch(struct 
task_struct *prev,
if (context_tracking_is_enabled())
__context_tracking_task_switch(prev, next);
 }
+
+/**
+ * ct_state() - return the current context tracking state if known
+ *
+ * Returns the current cpu's context tracking state if context tracking
+ * is enabled.  If context tracking is disabled, returns
+ * CONTEXT_DISABLED.  This should be used primarily for debugging.
+ */
+static inline enum ctx_state ct_state(void)
+{
+   return context_tracking_is_enabled() ?
+   this_cpu_read(context_tracking.state) : CONTEXT_DISABLED;
+}
 #else
 static inline void user_enter(void) { }
 static inline void user_exit(void) { }
@@ -64,8 +77,10 @@ static inline enum ctx_state exception_enter(void) { return 
0; }
 static inline void exception_exit(enum ctx_state prev_ctx) { }
 static inline void context_tracking_task_switch(struct task_struct *prev,
struct task_struct *next) { }
+static inline enum ctx_state ct_state(void) { return CONTEXT_DISABLED; }
 #endif /* !CONFIG_CONTEXT_TRACKING */
 
+#define CT_WARN_ON(cond) WARN_ON(context_tracking_is_enabled() && (cond))
 
 #ifdef CONFIG_CONTEXT_TRACKING_FORCE
 extern void context_tracking_init(void);
diff --git a/include/linux/context_tracking_state.h 
b/include/linux/context_tracking_state.h
index 6b7b96a32b75..d4aec2805849 100644
--- a/include/linux/context_tracking_state.h
+++ b/include/linux/context_tracking_state.h
@@ -13,6 +13,7 @@ struct context_tracking {
 */
bool active;
enum ctx_state {
+   CONTEXT_DISABLED = -1,  /* returned by ct_state() if unknown */
CONTEXT_KERNEL = 0,
CONTEXT_USER,
CONTEXT_GUEST,
-- 
2.4.3

--
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 v3 15/15] x86/irq: Document how IRQ context tracking works and add an assertion

2015-06-23 Thread Andy Lutomirski
Signed-off-by: Andy Lutomirski 
---
 arch/x86/kernel/irq.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index 88b366487b0e..6233de046c08 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -216,8 +216,23 @@ __visible unsigned int __irq_entry do_IRQ(struct pt_regs 
*regs)
unsigned vector = ~regs->orig_ax;
unsigned irq;
 
+   /*
+* NB: Unlike exception entries, IRQ entries do not reliably
+* handle context tracking in the low-level entry code.  This is
+* because syscall entries execute briefly with IRQs on before
+* updating context tracking state, so we can take an IRQ from
+* kernel mode with CONTEXT_USER.  The low-level entry code only
+* updates the context if we came from user mode, so we won't
+* switch to CONTEXT_KERNEL.  We'll fix that once the syscall
+* code is cleaned up enough that we can cleanly defer enabling
+* IRQs.
+*/
+
entering_irq();
 
+   /* entering_irq() tells RCU that we're not quiescent.  Check it. */
+   rcu_lockdep_assert(rcu_is_watching(), "IRQ failed to wake up RCU");
+
irq = __this_cpu_read(vector_irq[vector]);
 
if (!handle_irq(irq, regs)) {
-- 
2.4.3

--
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 v3 11/15] x86/asm/entry/64: Simplify irq stack pt_regs handling

2015-06-23 Thread Andy Lutomirski
There's no need for both rsi and rdi to point to the original stack.

Signed-off-by: Andy Lutomirski 
---
 arch/x86/entry/entry_64.S | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 3fdfd3e27918..ce2d10933c11 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -505,8 +505,6 @@ END(irq_entries_start)
SAVE_C_REGS
SAVE_EXTRA_REGS
 
-   movq%rsp,%rdi   /* arg1 for \func (pointer to pt_regs) */
-
testb   $3, CS(%rsp)
jz  1f
SWAPGS
@@ -518,14 +516,14 @@ END(irq_entries_start)
 * a little cheaper to use a separate counter in the PDA (short of
 * moving irq_enter into assembly, which would be too much work)
 */
-   movq%rsp, %rsi
+   movq%rsp, %rdi
inclPER_CPU_VAR(irq_count)
cmovzq  PER_CPU_VAR(irq_stack_ptr), %rsp
-   pushq   %rsi
+   pushq   %rdi
/* We entered an interrupt context - irqs are off: */
TRACE_IRQS_OFF
 
-   call\func
+   call\func   /* rdi points to pt_regs */
.endm
 
/*
-- 
2.4.3

--
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 v3 12/15] x86/asm/entry/64: Migrate error and interrupt exit work to C

2015-06-23 Thread Andy Lutomirski
Signed-off-by: Andy Lutomirski 
---
 arch/x86/entry/entry_64.S | 63 +--
 1 file changed, 17 insertions(+), 46 deletions(-)

diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index ce2d10933c11..e87d6259dd2c 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -507,7 +507,16 @@ END(irq_entries_start)
 
testb   $3, CS(%rsp)
jz  1f
+
+   /*
+* IRQ from user mode.  Switch to kernel gsbase and inform context
+* tracking that we're in kernel mode.
+*/
SWAPGS
+#ifdef CONFIG_CONTEXT_TRACKING
+   call enter_from_user_mode
+#endif
+
 1:
/*
 * Save previous stack pointer, optionally switch to interrupt stack.
@@ -546,26 +555,13 @@ ret_from_intr:
 
testb   $3, CS(%rsp)
jz  retint_kernel
-   /* Interrupt came from user space */
-retint_user:
-   GET_THREAD_INFO(%rcx)
 
-   /* %rcx: thread info. Interrupts are off. */
-retint_with_reschedule:
-   movl$_TIF_WORK_MASK, %edi
-retint_check:
+   /* Interrupt came from user space */
LOCKDEP_SYS_EXIT_IRQ
-   movlTI_flags(%rcx), %edx
-   andl%edi, %edx
-   jnz retint_careful
-
-retint_swapgs: /* return to user-space */
-   /*
-* The iretq could re-enable interrupts:
-*/
-   DISABLE_INTERRUPTS(CLBR_ANY)
+retint_user:
+   mov %rsp,%rdi
+   callprepare_exit_to_usermode
TRACE_IRQS_IRETQ
-
SWAPGS
jmp restore_regs_and_iret
 
@@ -643,35 +639,6 @@ native_irq_return_ldt:
popq%rax
jmp native_irq_return_iret
 #endif
-
-   /* edi: workmask, edx: work */
-retint_careful:
-   bt  $TIF_NEED_RESCHED, %edx
-   jnc retint_signal
-   TRACE_IRQS_ON
-   ENABLE_INTERRUPTS(CLBR_NONE)
-   pushq   %rdi
-   SCHEDULE_USER
-   popq%rdi
-   GET_THREAD_INFO(%rcx)
-   DISABLE_INTERRUPTS(CLBR_NONE)
-   TRACE_IRQS_OFF
-   jmp retint_check
-
-retint_signal:
-   testl   $_TIF_DO_NOTIFY_MASK, %edx
-   jz  retint_swapgs
-   TRACE_IRQS_ON
-   ENABLE_INTERRUPTS(CLBR_NONE)
-   movq$-1, ORIG_RAX(%rsp)
-   xorl%esi, %esi  /* oldset */
-   movq%rsp, %rdi  /* _regs */
-   calldo_notify_resume
-   DISABLE_INTERRUPTS(CLBR_NONE)
-   TRACE_IRQS_OFF
-   GET_THREAD_INFO(%rcx)
-   jmp retint_with_reschedule
-
 END(common_interrupt)
 
 /*
@@ -1087,6 +1054,10 @@ error_entry_from_usermode_swapgs:
SWAPGS
 
 error_entry_from_usermode_after_swapgs:
+#ifdef CONFIG_CONTEXT_TRACKING
+   call enter_from_user_mode
+#endif
+
 error_entry_done:
TRACE_IRQS_OFF
ret
-- 
2.4.3

--
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 v3 09/15] x86/entry/64: Migrate 64-bit and compat syscalls to new exit hooks

2015-06-23 Thread Andy Lutomirski
These need to be migrated together, as the compat case used to jump
into the middle of the 64-bit exit code.

Signed-off-by: Andy Lutomirski 
---
 arch/x86/entry/entry_64.S| 68 +---
 arch/x86/entry/entry_64_compat.S |  7 ++---
 2 files changed, 10 insertions(+), 65 deletions(-)

diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index b47f9686dece..0aada75cdd12 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -229,6 +229,11 @@ entry_SYSCALL_64_fastpath:
 */
USERGS_SYSRET64
 
+GLOBAL(int_ret_from_sys_call_irqs_off)
+   TRACE_IRQS_ON
+   ENABLE_INTERRUPTS(CLBR_NONE)
+   jmp int_ret_from_sys_call
+
/* Do syscall entry tracing */
 tracesys:
movq%rsp, %rdi
@@ -272,69 +277,10 @@ tracesys_phase2:
  * Has correct iret frame.
  */
 GLOBAL(int_ret_from_sys_call)
-   DISABLE_INTERRUPTS(CLBR_NONE)
-int_ret_from_sys_call_irqs_off: /* jumps come here from the irqs-off SYSRET 
path */
-   TRACE_IRQS_OFF
-   movl$_TIF_ALLWORK_MASK, %edi
-   /* edi: mask to check */
-GLOBAL(int_with_check)
-   LOCKDEP_SYS_EXIT_IRQ
-   GET_THREAD_INFO(%rcx)
-   movlTI_flags(%rcx), %edx
-   andl%edi, %edx
-   jnz int_careful
-   andl$~TS_COMPAT, TI_status(%rcx)
-   jmp syscall_return
-
-   /*
-* Either reschedule or signal or syscall exit tracking needed.
-* First do a reschedule test.
-* edx: work, edi: workmask
-*/
-int_careful:
-   bt  $TIF_NEED_RESCHED, %edx
-   jnc int_very_careful
-   TRACE_IRQS_ON
-   ENABLE_INTERRUPTS(CLBR_NONE)
-   pushq   %rdi
-   SCHEDULE_USER
-   popq%rdi
-   DISABLE_INTERRUPTS(CLBR_NONE)
-   TRACE_IRQS_OFF
-   jmp int_with_check
-
-   /* handle signals and tracing -- both require a full pt_regs */
-int_very_careful:
-   TRACE_IRQS_ON
-   ENABLE_INTERRUPTS(CLBR_NONE)
SAVE_EXTRA_REGS
-   /* Check for syscall exit trace */
-   testl   $_TIF_WORK_SYSCALL_EXIT, %edx
-   jz  int_signal
-   pushq   %rdi
-   leaq8(%rsp), %rdi   /*  -> arg1 */
-   callsyscall_trace_leave
-   popq%rdi
-   andl$~(_TIF_WORK_SYSCALL_EXIT|_TIF_SYSCALL_EMU), %edi
-   jmp int_restore_rest
-
-int_signal:
-   testl   $_TIF_DO_NOTIFY_MASK, %edx
-   jz  1f
-   movq%rsp, %rdi  /*  -> arg1 */
-   xorl%esi, %esi  /* oldset -> arg2 */
-   calldo_notify_resume
-1: movl$_TIF_WORK_MASK, %edi
-int_restore_rest:
+   movq%rsp, %rdi
+   callsyscall_return_slowpath /* returns with IRQs disabled */
RESTORE_EXTRA_REGS
-   DISABLE_INTERRUPTS(CLBR_NONE)
-   TRACE_IRQS_OFF
-   jmp int_with_check
-
-syscall_return:
-   /* The IRETQ could re-enable interrupts: */
-   DISABLE_INTERRUPTS(CLBR_ANY)
-   TRACE_IRQS_IRETQ
 
/*
 * Try to use SYSRET instead of IRET if we're returning to
diff --git a/arch/x86/entry/entry_64_compat.S b/arch/x86/entry/entry_64_compat.S
index bb187a6a877c..415afa038edf 100644
--- a/arch/x86/entry/entry_64_compat.S
+++ b/arch/x86/entry/entry_64_compat.S
@@ -209,10 +209,10 @@ sysexit_from_sys_call:
.endm
 
.macro auditsys_exit exit
-   testl   $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT), 
ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS)
-   jnz ia32_ret_from_sys_call
TRACE_IRQS_ON
ENABLE_INTERRUPTS(CLBR_NONE)
+   testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT), 
ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS)
+   jnz ia32_ret_from_sys_call
movl%eax, %esi  /* second arg, syscall return value */
cmpl$-MAX_ERRNO, %eax   /* is it an error ? */
jbe 1f
@@ -227,11 +227,10 @@ sysexit_from_sys_call:
testl   %edi, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS)
jz  \exit
xorl%eax, %eax  /* Do not leak kernel information */
-   movq%rax, R11(%rsp)
+   jmp int_ret_from_sys_call_irqs_off
movq%rax, R10(%rsp)
movq%rax, R9(%rsp)
movq%rax, R8(%rsp)
-   jmp int_with_check
.endm
 
 sysenter_auditsys:
-- 
2.4.3

--
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 v3 08/15] x86/entry/64: Really create an error-entry-from-usermode code path

2015-06-23 Thread Andy Lutomirski
In 539f51136500 ("x86/asm/entry/64: Disentangle error_entry/exit
gsbase/ebx/usermode code"), I arranged the code slightly wrong --
IRET faults would skip the code path that was intended to execute on
all error entries from user mode.  Fix it up.

This does not fix a bug, but we'll need it, and it slightly shrinks
the code.

Signed-off-by: Andy Lutomirski 
---
 arch/x86/entry/entry_64.S | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 3bb2c4302df1..b47f9686dece 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -1145,9 +1145,14 @@ ENTRY(error_entry)
testb   $3, CS+8(%rsp)
jz  error_kernelspace
 
-   /* We entered from user mode */
+error_entry_from_usermode_swapgs:
+   /*
+* We entered from user mode or we're pretending to have entered
+* from user mode due to an IRET fault.
+*/
SWAPGS
 
+error_entry_from_usermode_after_swapgs:
 error_entry_done:
TRACE_IRQS_OFF
ret
@@ -1174,8 +1179,7 @@ error_kernelspace:
 * gsbase and proceed.  We'll fix up the exception and land in
 * gs_change's error handler with kernel gsbase.
 */
-   SWAPGS
-   jmp error_entry_done
+   jmp error_entry_from_usermode_swapgs
 
 bstep_iret:
/* Fix truncated RIP */
@@ -1198,7 +1202,7 @@ error_bad_iret:
callfixup_bad_iret
mov %rax, %rsp
decl%ebx
-   jmp error_entry_done
+   jmp error_entry_from_usermode_after_swapgs
 END(error_entry)
 
 
-- 
2.4.3

--
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 v3 10/15] x86/asm/entry/64: Save all regs on interrupt entry

2015-06-23 Thread Andy Lutomirski
To prepare for the big rewrite of the error and interrupt exit
paths, we will need pt_regs completely filled in.  It's already
completely filled in when error_exit runs, so rearrange interrupt
handling to match it.  This will slow down interrupt handling very
slightly (eight instructions), but the simplification it enables
will be more than worth it.

Signed-off-by: Andy Lutomirski 
---
 arch/x86/entry/entry_64.S | 29 +
 1 file changed, 9 insertions(+), 20 deletions(-)

diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 0aada75cdd12..3fdfd3e27918 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -501,21 +501,13 @@ END(irq_entries_start)
 /* 0(%rsp): ~(interrupt number) */
.macro interrupt func
cld
-   /*
-* Since nothing in interrupt handling code touches r12...r15 members
-* of "struct pt_regs", and since interrupts can nest, we can save
-* four stack slots and simultaneously provide
-* an unwind-friendly stack layout by saving "truncated" pt_regs
-* exactly up to rbp slot, without these members.
-*/
-   ALLOC_PT_GPREGS_ON_STACK -RBP
-   SAVE_C_REGS -RBP
-   /* this goes to 0(%rsp) for unwinder, not for saving the value: */
-   SAVE_EXTRA_REGS_RBP -RBP
+   ALLOC_PT_GPREGS_ON_STACK
+   SAVE_C_REGS
+   SAVE_EXTRA_REGS
 
-   leaq-RBP(%rsp), %rdi/* arg1 for \func (pointer to 
pt_regs) */
+   movq%rsp,%rdi   /* arg1 for \func (pointer to pt_regs) */
 
-   testb   $3, CS-RBP(%rsp)
+   testb   $3, CS(%rsp)
jz  1f
SWAPGS
 1:
@@ -552,9 +544,7 @@ ret_from_intr:
declPER_CPU_VAR(irq_count)
 
/* Restore saved previous stack */
-   popq%rsi
-   /* return code expects complete pt_regs - adjust rsp accordingly: */
-   leaq-RBP(%rsi), %rsp
+   popq%rsp
 
testb   $3, CS(%rsp)
jz  retint_kernel
@@ -579,7 +569,7 @@ retint_swapgs:  /* 
return to user-space */
TRACE_IRQS_IRETQ
 
SWAPGS
-   jmp restore_c_regs_and_iret
+   jmp restore_regs_and_iret
 
 /* Returning to kernel space */
 retint_kernel:
@@ -603,6 +593,8 @@ retint_kernel:
  * At this label, code paths which return to kernel and to user,
  * which come from interrupts/exception and from syscalls, merge.
  */
+restore_regs_and_iret:
+   RESTORE_EXTRA_REGS
 restore_c_regs_and_iret:
RESTORE_C_REGS
REMOVE_PT_GPREGS_FROM_STACK 8
@@ -673,12 +665,10 @@ retint_signal:
jz  retint_swapgs
TRACE_IRQS_ON
ENABLE_INTERRUPTS(CLBR_NONE)
-   SAVE_EXTRA_REGS
movq$-1, ORIG_RAX(%rsp)
xorl%esi, %esi  /* oldset */
movq%rsp, %rdi  /* _regs */
calldo_notify_resume
-   RESTORE_EXTRA_REGS
DISABLE_INTERRUPTS(CLBR_NONE)
TRACE_IRQS_OFF
GET_THREAD_INFO(%rcx)
@@ -1159,7 +1149,6 @@ END(error_entry)
  */
 ENTRY(error_exit)
movl%ebx, %eax
-   RESTORE_EXTRA_REGS
DISABLE_INTERRUPTS(CLBR_NONE)
TRACE_IRQS_OFF
testl   %eax, %eax
-- 
2.4.3

--
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 v3 01/15] uml: Fix do_signal() prototype

2015-06-23 Thread Andy Lutomirski
From: Ingo Molnar 

Once x86 exports its do_signal(), the prototypes will clash.

Fix the clash and also improve the code a bit: remove the unnecessary
kern_do_signal() indirection. This allows interrupt_end() to share
the 'regs' parameter calculation.

Also remove the unused return code to match x86.

Minimally build and boot tested.

Cc: Richard Weinberger 
Cc: Andrew Morton 
Cc: Andy Lutomirski 
Cc: Borislav Petkov 
Cc: Brian Gerst 
Cc: Denys Vlasenko 
Cc: H. Peter Anvin 
Cc: Linus Torvalds 
Cc: Oleg Nesterov 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Signed-off-by: Ingo Molnar 
[Adjusted the commit message because I reordered the patch. --Andy]
Signed-off-by: Andy Lutomirski 
---
 arch/um/include/shared/kern_util.h | 3 ++-
 arch/um/kernel/process.c   | 6 --
 arch/um/kernel/signal.c| 8 +---
 arch/um/kernel/tlb.c   | 2 +-
 arch/um/kernel/trap.c  | 2 +-
 5 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/arch/um/include/shared/kern_util.h 
b/arch/um/include/shared/kern_util.h
index 83a91f976330..35ab97e4bb9b 100644
--- a/arch/um/include/shared/kern_util.h
+++ b/arch/um/include/shared/kern_util.h
@@ -22,7 +22,8 @@ extern int kmalloc_ok;
 extern unsigned long alloc_stack(int order, int atomic);
 extern void free_stack(unsigned long stack, int order);
 
-extern int do_signal(void);
+struct pt_regs;
+extern void do_signal(struct pt_regs *regs);
 extern void interrupt_end(void);
 extern void relay_signal(int sig, struct siginfo *si, struct uml_pt_regs 
*regs);
 
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index 68b9119841cd..a6d922672b9f 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -90,12 +90,14 @@ void *__switch_to(struct task_struct *from, struct 
task_struct *to)
 
 void interrupt_end(void)
 {
+   struct pt_regs *regs = >thread.regs;
+
if (need_resched())
schedule();
if (test_thread_flag(TIF_SIGPENDING))
-   do_signal();
+   do_signal(regs);
if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME))
-   tracehook_notify_resume(>thread.regs);
+   tracehook_notify_resume(regs);
 }
 
 void exit_thread(void)
diff --git a/arch/um/kernel/signal.c b/arch/um/kernel/signal.c
index 4f60e4aad790..57acbd67d85d 100644
--- a/arch/um/kernel/signal.c
+++ b/arch/um/kernel/signal.c
@@ -64,7 +64,7 @@ static void handle_signal(struct ksignal *ksig, struct 
pt_regs *regs)
signal_setup_done(err, ksig, singlestep);
 }
 
-static int kern_do_signal(struct pt_regs *regs)
+void do_signal(struct pt_regs *regs)
 {
struct ksignal ksig;
int handled_sig = 0;
@@ -110,10 +110,4 @@ static int kern_do_signal(struct pt_regs *regs)
 */
if (!handled_sig)
restore_saved_sigmask();
-   return handled_sig;
-}
-
-int do_signal(void)
-{
-   return kern_do_signal(>thread.regs);
 }
diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c
index f1b3eb14b855..2077248e8a72 100644
--- a/arch/um/kernel/tlb.c
+++ b/arch/um/kernel/tlb.c
@@ -291,7 +291,7 @@ void fix_range_common(struct mm_struct *mm, unsigned long 
start_addr,
/* We are under mmap_sem, release it such that current can 
terminate */
up_write(>mm->mmap_sem);
force_sig(SIGKILL, current);
-   do_signal();
+   do_signal(>thread.regs);
}
 }
 
diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c
index 8e4daf44e980..481311becb05 100644
--- a/arch/um/kernel/trap.c
+++ b/arch/um/kernel/trap.c
@@ -172,7 +172,7 @@ static void bad_segv(struct faultinfo fi, unsigned long ip)
 void fatal_sigsegv(void)
 {
force_sigsegv(SIGSEGV, current);
-   do_signal();
+   do_signal(>thread.regs);
/*
 * This is to tell gcc that we're not returning - do_signal
 * can, in general, return, but in this case, it's not, since
-- 
2.4.3

--
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 v3 14/15] x86/entry: Remove SCHEDULE_USER and asm/context-tracking.h

2015-06-23 Thread Andy Lutomirski
SCHEDULE_USER is no longer used, and asm/context-tracking.h
contained nothing else.  Remove the header entirely

Signed-off-by: Andy Lutomirski 
---
 arch/x86/entry/entry_64.S   |  1 -
 arch/x86/include/asm/context_tracking.h | 10 --
 2 files changed, 11 deletions(-)
 delete mode 100644 arch/x86/include/asm/context_tracking.h

diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index e87d6259dd2c..8068ba3264cf 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -33,7 +33,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/arch/x86/include/asm/context_tracking.h 
b/arch/x86/include/asm/context_tracking.h
deleted file mode 100644
index 1fe49704b146..
--- a/arch/x86/include/asm/context_tracking.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _ASM_X86_CONTEXT_TRACKING_H
-#define _ASM_X86_CONTEXT_TRACKING_H
-
-#ifdef CONFIG_CONTEXT_TRACKING
-# define SCHEDULE_USER call schedule_user
-#else
-# define SCHEDULE_USER call schedule
-#endif
-
-#endif
-- 
2.4.3

--
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 v3 13/15] x86/entry: Remove exception_enter from trap handlers

2015-06-23 Thread Andy Lutomirski
On 64-bit kernels, we don't need it any more: we handle context
tracking directly on entry from user mode and exit to user mode.  On
32-bit kernels, we don't support context tracking at all, so these
hooks had no effect.

Signed-off-by: Andy Lutomirski 
---
 arch/x86/include/asm/traps.h |  4 +-
 arch/x86/kernel/cpu/mcheck/mce.c |  5 +--
 arch/x86/kernel/cpu/mcheck/p5.c  |  5 +--
 arch/x86/kernel/cpu/mcheck/winchip.c |  4 +-
 arch/x86/kernel/traps.c  | 78 +---
 5 files changed, 27 insertions(+), 69 deletions(-)

diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h
index c5380bea2a36..c3496619740a 100644
--- a/arch/x86/include/asm/traps.h
+++ b/arch/x86/include/asm/traps.h
@@ -112,8 +112,8 @@ asmlinkage void smp_threshold_interrupt(void);
 asmlinkage void smp_deferred_error_interrupt(void);
 #endif
 
-extern enum ctx_state ist_enter(struct pt_regs *regs);
-extern void ist_exit(struct pt_regs *regs, enum ctx_state prev_state);
+extern void ist_enter(struct pt_regs *regs);
+extern void ist_exit(struct pt_regs *regs);
 extern void ist_begin_non_atomic(struct pt_regs *regs);
 extern void ist_end_non_atomic(void);
 
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 5b974c97e31e..29cba90eb96d 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -1026,7 +1026,6 @@ void do_machine_check(struct pt_regs *regs, long 
error_code)
 {
struct mca_config *cfg = _cfg;
struct mce m, *final;
-   enum ctx_state prev_state;
int i;
int worst = 0;
int severity;
@@ -1052,7 +1051,7 @@ void do_machine_check(struct pt_regs *regs, long 
error_code)
int flags = MF_ACTION_REQUIRED;
int lmce = 0;
 
-   prev_state = ist_enter(regs);
+   ist_enter(regs);
 
this_cpu_inc(mce_exception_count);
 
@@ -1224,7 +1223,7 @@ out:
local_irq_disable();
ist_end_non_atomic();
 done:
-   ist_exit(regs, prev_state);
+   ist_exit(regs);
 }
 EXPORT_SYMBOL_GPL(do_machine_check);
 
diff --git a/arch/x86/kernel/cpu/mcheck/p5.c b/arch/x86/kernel/cpu/mcheck/p5.c
index 737b0ad4e61a..12402e10aeff 100644
--- a/arch/x86/kernel/cpu/mcheck/p5.c
+++ b/arch/x86/kernel/cpu/mcheck/p5.c
@@ -19,10 +19,9 @@ int mce_p5_enabled __read_mostly;
 /* Machine check handler for Pentium class Intel CPUs: */
 static void pentium_machine_check(struct pt_regs *regs, long error_code)
 {
-   enum ctx_state prev_state;
u32 loaddr, hi, lotype;
 
-   prev_state = ist_enter(regs);
+   ist_enter(regs);
 
rdmsr(MSR_IA32_P5_MC_ADDR, loaddr, hi);
rdmsr(MSR_IA32_P5_MC_TYPE, lotype, hi);
@@ -39,7 +38,7 @@ static void pentium_machine_check(struct pt_regs *regs, long 
error_code)
 
add_taint(TAINT_MACHINE_CHECK, LOCKDEP_NOW_UNRELIABLE);
 
-   ist_exit(regs, prev_state);
+   ist_exit(regs);
 }
 
 /* Set up machine check reporting for processors with Intel style MCE: */
diff --git a/arch/x86/kernel/cpu/mcheck/winchip.c 
b/arch/x86/kernel/cpu/mcheck/winchip.c
index 44f138296fbe..01dd8702880b 100644
--- a/arch/x86/kernel/cpu/mcheck/winchip.c
+++ b/arch/x86/kernel/cpu/mcheck/winchip.c
@@ -15,12 +15,12 @@
 /* Machine check handler for WinChip C6: */
 static void winchip_machine_check(struct pt_regs *regs, long error_code)
 {
-   enum ctx_state prev_state = ist_enter(regs);
+   ist_enter(regs);
 
printk(KERN_EMERG "CPU0: Machine Check Exception.\n");
add_taint(TAINT_MACHINE_CHECK, LOCKDEP_NOW_UNRELIABLE);
 
-   ist_exit(regs, prev_state);
+   ist_exit(regs);
 }
 
 /* Set up machine check reporting on the Winchip C6 series */
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 3f947488c9c1..459f843e5352 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -107,13 +107,10 @@ static inline void preempt_conditional_cli(struct pt_regs 
*regs)
preempt_count_dec();
 }
 
-enum ctx_state ist_enter(struct pt_regs *regs)
+void ist_enter(struct pt_regs *regs)
 {
-   enum ctx_state prev_state;
-
if (user_mode(regs)) {
-   /* Other than that, we're just an exception. */
-   prev_state = exception_enter();
+   CT_WARN_ON(ct_state() != CONTEXT_KERNEL);
} else {
/*
 * We might have interrupted pretty much anything.  In
@@ -122,32 +119,25 @@ enum ctx_state ist_enter(struct pt_regs *regs)
 * but we need to notify RCU.
 */
rcu_nmi_enter();
-   prev_state = CONTEXT_KERNEL;  /* the value is irrelevant. */
}
 
/*
-* We are atomic because we're on the IST stack (or we're on x86_32,
-* in which case we still shouldn't schedule).
-*
-* This must be after exception_enter(), because exception_enter()
-* won't do anything if in_interrupt() returns true.
+* 

[PATCH v3 04/15] x86: Move C entry and exit code to arch/x86/entry/common.c

2015-06-23 Thread Andy Lutomirski
The entry and exit C helpers were confusingly scattered between
ptrace.c and signal.c, even though they aren't specific to ptrace or
signal handling.  Move them together in a new file.

This change just moves code around.  It doesn't change anything.

Signed-off-by: Andy Lutomirski 
---
 arch/x86/entry/Makefile   |   1 +
 arch/x86/entry/common.c   | 253 ++
 arch/x86/include/asm/signal.h |   1 +
 arch/x86/kernel/ptrace.c  | 202 +
 arch/x86/kernel/signal.c  |  28 +
 5 files changed, 257 insertions(+), 228 deletions(-)
 create mode 100644 arch/x86/entry/common.c

diff --git a/arch/x86/entry/Makefile b/arch/x86/entry/Makefile
index 7a144971db79..bd55dedd7614 100644
--- a/arch/x86/entry/Makefile
+++ b/arch/x86/entry/Makefile
@@ -2,6 +2,7 @@
 # Makefile for the x86 low level entry code
 #
 obj-y  := entry_$(BITS).o thunk_$(BITS).o 
syscall_$(BITS).o
+obj-y  += common.o
 
 obj-y  += vdso/
 obj-y  += vsyscall/
diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
new file mode 100644
index ..348465473e55
--- /dev/null
+++ b/arch/x86/entry/common.c
@@ -0,0 +1,253 @@
+/*
+ * entry.c - C code for kernel entry and exit
+ * Copyright (c) 2015 Andrew Lutomirski
+ * GPL v2
+ *
+ * Based on asm and ptrace code by many authors.  The code here originated
+ * in ptrace.c and signal.c.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#define CREATE_TRACE_POINTS
+#include 
+
+static void do_audit_syscall_entry(struct pt_regs *regs, u32 arch)
+{
+#ifdef CONFIG_X86_64
+   if (arch == AUDIT_ARCH_X86_64) {
+   audit_syscall_entry(regs->orig_ax, regs->di,
+   regs->si, regs->dx, regs->r10);
+   } else
+#endif
+   {
+   audit_syscall_entry(regs->orig_ax, regs->bx,
+   regs->cx, regs->dx, regs->si);
+   }
+}
+
+/*
+ * We can return 0 to resume the syscall or anything else to go to phase
+ * 2.  If we resume the syscall, we need to put something appropriate in
+ * regs->orig_ax.
+ *
+ * NB: We don't have full pt_regs here, but regs->orig_ax and regs->ax
+ * are fully functional.
+ *
+ * For phase 2's benefit, our return value is:
+ * 0:  resume the syscall
+ * 1:  go to phase 2; no seccomp phase 2 needed
+ * anything else:  go to phase 2; pass return value to seccomp
+ */
+unsigned long syscall_trace_enter_phase1(struct pt_regs *regs, u32 arch)
+{
+   unsigned long ret = 0;
+   u32 work;
+
+   BUG_ON(regs != task_pt_regs(current));
+
+   work = ACCESS_ONCE(current_thread_info()->flags) &
+   _TIF_WORK_SYSCALL_ENTRY;
+
+   /*
+* If TIF_NOHZ is set, we are required to call user_exit() before
+* doing anything that could touch RCU.
+*/
+   if (work & _TIF_NOHZ) {
+   user_exit();
+   work &= ~_TIF_NOHZ;
+   }
+
+#ifdef CONFIG_SECCOMP
+   /*
+* Do seccomp first -- it should minimize exposure of other
+* code, and keeping seccomp fast is probably more valuable
+* than the rest of this.
+*/
+   if (work & _TIF_SECCOMP) {
+   struct seccomp_data sd;
+
+   sd.arch = arch;
+   sd.nr = regs->orig_ax;
+   sd.instruction_pointer = regs->ip;
+#ifdef CONFIG_X86_64
+   if (arch == AUDIT_ARCH_X86_64) {
+   sd.args[0] = regs->di;
+   sd.args[1] = regs->si;
+   sd.args[2] = regs->dx;
+   sd.args[3] = regs->r10;
+   sd.args[4] = regs->r8;
+   sd.args[5] = regs->r9;
+   } else
+#endif
+   {
+   sd.args[0] = regs->bx;
+   sd.args[1] = regs->cx;
+   sd.args[2] = regs->dx;
+   sd.args[3] = regs->si;
+   sd.args[4] = regs->di;
+   sd.args[5] = regs->bp;
+   }
+
+   BUILD_BUG_ON(SECCOMP_PHASE1_OK != 0);
+   BUILD_BUG_ON(SECCOMP_PHASE1_SKIP != 1);
+
+   ret = seccomp_phase1();
+   if (ret == SECCOMP_PHASE1_SKIP) {
+   regs->orig_ax = -1;
+   ret = 0;
+   } else if (ret != SECCOMP_PHASE1_OK) {
+   return ret;  /* Go directly to phase 2 */
+   }
+
+   work &= ~_TIF_SECCOMP;
+   }
+#endif
+
+   /* Do our best to finish without phase 2. */
+   if (work == 0)
+   return ret;  /* seccomp and/or nohz only (ret == 0 here) */
+
+#ifdef CONFIG_AUDITSYSCALL
+   if 

[PATCH v3 00/15] x86: Rewrite exit-to-userspace code

2015-06-23 Thread Andy Lutomirski
This is the first big batch of x86 asm-to-C conversion patches.

The exit-to-usermode code is copied in several places and is written
in a nasty combination of asm and C.  It's not at all clear what
it's supposed to do, and the way it's structured makes it very hard
to work with.  For example, it's not even clear why syscall exit
hooks are called only once per syscall right now.  (It seems to be a
side effect of the way that rdi and rdx are handled in the asm loop,
and it seems reliable, but it's still pointlessly complicated.)  The
existing code also makes context tracking overly complicated and
hard to understand.  Finally, it's nearly impossible for anyone to
change what happens on exit to usermode, since the existing code is
so fragile.

I tried to clean it up incrementally, but I decided it was too hard.
Instead, this series just replaces the code.  It seems to work.

Context tracking in particular works very differently now.  The
low-level entry code checks that we're in CONTEXT_USER and switches
to CONTEXT_KERNEL.  The exit code does the reverse.  There is no
need to track what CONTEXT_XYZ state we came from, because we
already know.  Similarly, SCHEDULE_USER is gone, since we can
reschedule if needed by simply calling schedule() from C code.

The main things that are missing are that I haven't done the 32-bit
parts (anyone want to help?) and therefore I haven't deleted the old
C code.  I also think this may break UML for trivial reasons.

IRQ context tracking is still messy.  One the cleanup progresses
to the point that we can enter CONTEXT_KERNEL in syscalls before
enabling interrupts, we can fully clean up IRQ context tracking.

Once these land, I'll send some more :)

Changes from v2:
 - Fix an error_entry bug.  When I rearranged it to add context
   tracking, I messed up the bad_iret case in v2.
 - Remove counterproductive asmlinkage declarations from common.c.
 - The last patch is new.

Changes from v1:
 - Fix bisection failure by squashing the 64-bit native and compat syscall
   conversions together.  The intermediate state didn't built, and fixing
   it isn't worthwhile (the results will be harder to understand).
 - Replace context_tracking_assert_state with CT_WARN_ON and ct_state.
 - The last two patches are now.  I incorrectly thought that we weren't
   ready for them yet on 32-bit kernels, but I was wrong.

Andy Lutomirski (14):
  context_tracking: Add ct_state and CT_WARN_ON
  notifiers: Assert that RCU is watching in notify_die
  x86: Move C entry and exit code to arch/x86/entry/common.c
  x86/traps: Assert that we're in CONTEXT_KERNEL in exception entries
  x86/entry: Add enter_from_user_mode and use it in syscalls
  x86/entry: Add new, comprehensible entry and exit hooks
  x86/entry/64: Really create an error-entry-from-usermode code path
  x86/entry/64: Migrate 64-bit and compat syscalls to new exit hooks
  x86/asm/entry/64: Save all regs on interrupt entry
  x86/asm/entry/64: Simplify irq stack pt_regs handling
  x86/asm/entry/64: Migrate error and interrupt exit work to C
  x86/entry: Remove exception_enter from trap handlers
  x86/entry: Remove SCHEDULE_USER and asm/context-tracking.h
  x86/irq: Document how IRQ context tracking works and add an assertion

Ingo Molnar (1):
  uml: Fix do_signal() prototype

 arch/um/include/shared/kern_util.h  |   3 +-
 arch/um/kernel/process.c|   6 +-
 arch/um/kernel/signal.c |   8 +-
 arch/um/kernel/tlb.c|   2 +-
 arch/um/kernel/trap.c   |   2 +-
 arch/x86/entry/Makefile |   1 +
 arch/x86/entry/common.c | 374 
 arch/x86/entry/entry_64.S   | 179 ---
 arch/x86/entry/entry_64_compat.S|   7 +-
 arch/x86/include/asm/context_tracking.h |  10 -
 arch/x86/include/asm/signal.h   |   1 +
 arch/x86/include/asm/traps.h|   4 +-
 arch/x86/kernel/cpu/mcheck/mce.c|   5 +-
 arch/x86/kernel/cpu/mcheck/p5.c |   5 +-
 arch/x86/kernel/cpu/mcheck/winchip.c|   4 +-
 arch/x86/kernel/irq.c   |  15 ++
 arch/x86/kernel/ptrace.c| 202 +
 arch/x86/kernel/signal.c|  28 +--
 arch/x86/kernel/traps.c |  87 +++-
 include/linux/context_tracking.h|  15 ++
 include/linux/context_tracking_state.h  |   1 +
 kernel/notifier.c   |   2 +
 22 files changed, 502 insertions(+), 459 deletions(-)
 create mode 100644 arch/x86/entry/common.c
 delete mode 100644 arch/x86/include/asm/context_tracking.h

-- 
2.4.3

--
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 v3 05/15] x86/traps: Assert that we're in CONTEXT_KERNEL in exception entries

2015-06-23 Thread Andy Lutomirski
Other than the super-atomic exception entries, all exception entries
are supposed to switch our context tracking state to CONTEXT_KERNEL.
Assert that they do.  These assertions appear trivial at this point,
as exception_enter is the function responsible for switching
context, but I'm planning on reworking x86's exception context
tracking, and these assertions will help make sure that all of this
code keeps working.

Signed-off-by: Andy Lutomirski 
---
 arch/x86/kernel/traps.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index de379366f6d1..3f947488c9c1 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -291,6 +291,8 @@ static void do_error_trap(struct pt_regs *regs, long 
error_code, char *str,
enum ctx_state prev_state = exception_enter();
siginfo_t info;
 
+   CT_WARN_ON(ct_state() != CONTEXT_KERNEL);
+
if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) !=
NOTIFY_STOP) {
conditional_sti(regs);
@@ -377,6 +379,7 @@ dotraplinkage void do_bounds(struct pt_regs *regs, long 
error_code)
siginfo_t *info;
 
prev_state = exception_enter();
+   CT_WARN_ON(ct_state() != CONTEXT_KERNEL);
if (notify_die(DIE_TRAP, "bounds", regs, error_code,
X86_TRAP_BR, SIGSEGV) == NOTIFY_STOP)
goto exit;
@@ -458,6 +461,7 @@ do_general_protection(struct pt_regs *regs, long error_code)
enum ctx_state prev_state;
 
prev_state = exception_enter();
+   CT_WARN_ON(ct_state() != CONTEXT_KERNEL);
conditional_sti(regs);
 
if (v8086_mode(regs)) {
@@ -515,6 +519,7 @@ dotraplinkage void notrace do_int3(struct pt_regs *regs, 
long error_code)
return;
 
prev_state = ist_enter(regs);
+   CT_WARN_ON(ct_state() != CONTEXT_KERNEL);
 #ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
if (kgdb_ll_trap(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP,
SIGTRAP) == NOTIFY_STOP)
@@ -794,6 +799,7 @@ dotraplinkage void do_coprocessor_error(struct pt_regs 
*regs, long error_code)
enum ctx_state prev_state;
 
prev_state = exception_enter();
+   CT_WARN_ON(ct_state() != CONTEXT_KERNEL);
math_error(regs, error_code, X86_TRAP_MF);
exception_exit(prev_state);
 }
@@ -804,6 +810,7 @@ do_simd_coprocessor_error(struct pt_regs *regs, long 
error_code)
enum ctx_state prev_state;
 
prev_state = exception_enter();
+   CT_WARN_ON(ct_state() != CONTEXT_KERNEL);
math_error(regs, error_code, X86_TRAP_XF);
exception_exit(prev_state);
 }
@@ -862,6 +869,7 @@ do_device_not_available(struct pt_regs *regs, long 
error_code)
enum ctx_state prev_state;
 
prev_state = exception_enter();
+   CT_WARN_ON(ct_state() != CONTEXT_KERNEL);
BUG_ON(use_eager_fpu());
 
 #ifdef CONFIG_MATH_EMULATION
@@ -891,6 +899,7 @@ dotraplinkage void do_iret_error(struct pt_regs *regs, long 
error_code)
enum ctx_state prev_state;
 
prev_state = exception_enter();
+   CT_WARN_ON(ct_state() != CONTEXT_KERNEL);
local_irq_enable();
 
info.si_signo = SIGILL;
-- 
2.4.3

--
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 v3 06/15] x86/entry: Add enter_from_user_mode and use it in syscalls

2015-06-23 Thread Andy Lutomirski
Changing the x86 context tracking hooks is dangerous because there
are no good checks that we track our context correctly.  Add a
helper to check that we're actually in CONTEXT_USER when we enter
from user mode and wire it up for syscall entries.

Subsequent patches will wire this up for all non-NMI entries as
well.  NMIs are their own special beast and cannot currently switch
overall context tracking state.  Instead, they have their own
special RCU hooks.

This is a tiny speedup if !CONFIG_CONTEXT_TRACKING (removes a
branch) and a tiny slowdown if CONFIG_CONTEXT_TRACING (adds a layer
of indirection).  Eventually, we should fix up the core context
tracking code to supply a function that does what we want (and can
be much simpler than user_exit), which will enable us to get rid of
the extra call.

Signed-off-by: Andy Lutomirski 
---
 arch/x86/entry/common.c | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
index 348465473e55..8a7e35af7164 100644
--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -28,6 +28,15 @@
 #define CREATE_TRACE_POINTS
 #include 
 
+#ifdef CONFIG_CONTEXT_TRACKING
+/* Called on entry from user mode with IRQs off. */
+__visible void enter_from_user_mode(void)
+{
+   CT_WARN_ON(ct_state() != CONTEXT_USER);
+   user_exit();
+}
+#endif
+
 static void do_audit_syscall_entry(struct pt_regs *regs, u32 arch)
 {
 #ifdef CONFIG_X86_64
@@ -65,14 +74,16 @@ unsigned long syscall_trace_enter_phase1(struct pt_regs 
*regs, u32 arch)
work = ACCESS_ONCE(current_thread_info()->flags) &
_TIF_WORK_SYSCALL_ENTRY;
 
+#ifdef CONFIG_CONTEXT_TRACKING
/*
 * If TIF_NOHZ is set, we are required to call user_exit() before
 * doing anything that could touch RCU.
 */
if (work & _TIF_NOHZ) {
-   user_exit();
+   enter_from_user_mode();
work &= ~_TIF_NOHZ;
}
+#endif
 
 #ifdef CONFIG_SECCOMP
/*
-- 
2.4.3

--
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/7] blkcg: remove unnecessary request_list->blkg NULL test in blk_put_rl()

2015-06-23 Thread Tejun Heo
Since ec13b1d6f0a0 ("blkcg: always create the blkcg_gq for the root
blkcg"), a request_list always has its blkg associated.  Drop
unnecessary rl->blkg NULL test from blk_put_rl().

Signed-off-by: Tejun Heo 
Cc: Vivek Goyal 
---
 include/linux/blk-cgroup.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h
index 07a32b8..50d1009 100644
--- a/include/linux/blk-cgroup.h
+++ b/include/linux/blk-cgroup.h
@@ -378,8 +378,7 @@ static inline struct request_list *blk_get_rl(struct 
request_queue *q,
  */
 static inline void blk_put_rl(struct request_list *rl)
 {
-   /* root_rl may not have blkg set */
-   if (rl->blkg && rl->blkg->blkcg != _root)
+   if (rl->blkg->blkcg != _root)
blkg_put(rl->blkg);
 }
 
-- 
2.4.3

--
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/


[PATCHSET block/for-4.2/writeback] blkcg: blkcg_policy methods cleanup

2015-06-23 Thread Tejun Heo
This patchset contains assorted cleanups for blkcg_policy methods.

* alloc/free are added.  exit is dropped.

* blk-throttle's async percpu allocation is replaced with direct
  allocation.

* all methods now take blkcg_policy_data instead of blkcg_gq.

Nothing too controversial.

Jens, as we're at the beginning of the 4.2 merge window, I'll ping /
repost this patchset along with other pending patchsets once -rc1
drops.

This patchset contains the following seven patches.

 0001-blkcg-remove-unnecessary-request_list-blkg-NULL-test.patch
 0002-blkcg-use-blkg_free-in-blkcg_init_queue-failure-path.patch
 0003-blkcg-make-blkcg_activate_policy-allow-NULL-pd_init_.patch
 0004-blkcg-replace-blkcg_policy-pd_size-with-pd_alloc-fre.patch
 0005-blk-throttle-remove-asynchrnous-percpu-stats-allocat.patch
 0006-blk-throttle-clean-up-blkg_policy_data-alloc-init-ex.patch
 0007-blkcg-make-blkcg_policy-methods-take-a-pointer-to-bl.patch

0001-0003 are misc cleanups.  0004-0006 add alloc/free methods and
remove blk-throttle's async percpu allocation mechanism.  0007 makes
all methods take blkcg_policy_data.

This patchset is also available in the following git branch.

 git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git 
review-blkcg-methods-cleanup

and is on top of

[1] block/for-4.2/writeback
[2] [PATCHSET block/for-4.2/writeback] block, cgroup: make cfq charge async IOs 
to the appropriate blkcgs

diffstat follows.  Thanks.

 block/blk-cgroup.c |   53 +
 block/blk-throttle.c   |  173 +
 block/cfq-iosched.c|   37 +++--
 include/linux/blk-cgroup.h |   31 +++-
 4 files changed, 116 insertions(+), 178 deletions(-)

--
tejun

[1] 5857cd637bc0 ("bdi: fix wrong error return value in cgwb_create()").
[2] http://lkml.kernel.org/g/1433753973-23684-1-git-send-email...@kernel.org
--
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 7/7] blkcg: make blkcg_policy methods take a pointer to blkcg_policy_data

2015-06-23 Thread Tejun Heo
The newly added ->pd_alloc_fn() and ->pd_free_fn() deal with pd
(blkg_policy_data) while the older ones use blkg (blkcg_gq).  As using
blkg doesn't make sense for ->pd_alloc_fn() and after allocation pd
can always be mapped to blkg and given that these are policy-specific
methods, it makes sense to converge on pd.

This patch makes all methods deal with pd instead of blkg.  Most
conversions are trivial.  In blk-cgroup.c, a couple method invocation
sites now test whether pd exists instead of policy state for
consistency.  This shouldn't cause any behavioral differences.

Signed-off-by: Tejun Heo 
Cc: Vivek Goyal 
---
 block/blk-cgroup.c | 18 --
 block/blk-throttle.c   | 13 +++--
 block/cfq-iosched.c| 17 +
 include/linux/blk-cgroup.h |  8 
 4 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 9d434a9..15d9628b 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -229,7 +229,7 @@ static struct blkcg_gq *blkg_create(struct blkcg *blkcg,
struct blkcg_policy *pol = blkcg_policy[i];
 
if (blkg->pd[i] && pol->pd_init_fn)
-   pol->pd_init_fn(blkg);
+   pol->pd_init_fn(blkg->pd[i]);
}
 
/* insert */
@@ -243,7 +243,7 @@ static struct blkcg_gq *blkg_create(struct blkcg *blkcg,
struct blkcg_policy *pol = blkcg_policy[i];
 
if (blkg->pd[i] && pol->pd_online_fn)
-   pol->pd_online_fn(blkg);
+   pol->pd_online_fn(blkg->pd[i]);
}
}
blkg->online = true;
@@ -334,7 +334,7 @@ static void blkg_destroy(struct blkcg_gq *blkg)
struct blkcg_policy *pol = blkcg_policy[i];
 
if (blkg->pd[i] && pol->pd_offline_fn)
-   pol->pd_offline_fn(blkg);
+   pol->pd_offline_fn(blkg->pd[i]);
}
blkg->online = false;
 
@@ -468,9 +468,8 @@ static int blkcg_reset_stats(struct cgroup_subsys_state 
*css,
for (i = 0; i < BLKCG_MAX_POLS; i++) {
struct blkcg_policy *pol = blkcg_policy[i];
 
-   if (blkcg_policy_enabled(blkg->q, pol) &&
-   pol->pd_reset_stats_fn)
-   pol->pd_reset_stats_fn(blkg);
+   if (blkg->pd[i] && pol->pd_reset_stats_fn)
+   pol->pd_reset_stats_fn(blkg->pd[i]);
}
}
 
@@ -1038,7 +1037,7 @@ int blkcg_activate_policy(struct request_queue *q,
pd->blkg = blkg;
pd->plid = pol->plid;
if (pol->pd_init_fn)
-   pol->pd_init_fn(blkg);
+   pol->pd_init_fn(pd);
 
spin_unlock(>blkcg->lock);
}
@@ -1080,10 +1079,9 @@ void blkcg_deactivate_policy(struct request_queue *q,
/* grab blkcg lock too while removing @pd from @blkg */
spin_lock(>blkcg->lock);
 
-   if (pol->pd_offline_fn)
-   pol->pd_offline_fn(blkg);
-
if (blkg->pd[pol->plid]) {
+   if (pol->pd_offline_fn)
+   pol->pd_offline_fn(blkg->pd[pol->plid]);
pol->pd_free_fn(blkg->pd[pol->plid]);
blkg->pd[pol->plid] = NULL;
}
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index c3a235b..c2c7547 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -377,9 +377,10 @@ static struct blkg_policy_data *throtl_pd_alloc(gfp_t gfp, 
int node)
return >pd;
 }
 
-static void throtl_pd_init(struct blkcg_gq *blkg)
+static void throtl_pd_init(struct blkg_policy_data *pd)
 {
-   struct throtl_grp *tg = blkg_to_tg(blkg);
+   struct throtl_grp *tg = pd_to_tg(pd);
+   struct blkcg_gq *blkg = tg_to_blkg(tg);
struct throtl_data *td = blkg->q->td;
struct throtl_service_queue *sq = >service_queue;
 
@@ -417,13 +418,13 @@ static void tg_update_has_rules(struct throtl_grp *tg)
(tg->bps[rw] != -1 || tg->iops[rw] != -1);
 }
 
-static void throtl_pd_online(struct blkcg_gq *blkg)
+static void throtl_pd_online(struct blkg_policy_data *pd)
 {
/*
 * We don't want new groups to escape the limits of its ancestors.
 * Update has_rules[] after a new group is brought online.
 */
-   tg_update_has_rules(blkg_to_tg(blkg));
+   tg_update_has_rules(pd_to_tg(pd));
 }
 
 static void throtl_pd_free(struct blkg_policy_data *pd)
@@ -435,9 +436,9 @@ static void throtl_pd_free(struct blkg_policy_data *pd)
kfree(tg);
 }
 
-static void throtl_pd_reset_stats(struct blkcg_gq *blkg)
+static void throtl_pd_reset_stats(struct blkg_policy_data *pd)
 {
-   struct throtl_grp *tg = blkg_to_tg(blkg);
+ 

[PATCH 3/7] blkcg: make blkcg_activate_policy() allow NULL ->pd_init_fn

2015-06-23 Thread Tejun Heo
blkg_create() allows NULL ->pd_init_fn() but blkcg_activate_policy()
doesn't.  As both in-kernel policies implement ->pd_init_fn, it
currently doesn't break anything.  Update blkcg_activate_policy() so
that its behavior is consistent with blkg_create().

Signed-off-by: Tejun Heo 
Cc: Vivek Goyal 
---
 block/blk-cgroup.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 898f560..617a586 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1045,7 +1045,8 @@ int blkcg_activate_policy(struct request_queue *q,
blkg->pd[pol->plid] = pd;
pd->blkg = blkg;
pd->plid = pol->plid;
-   pol->pd_init_fn(blkg);
+   if (pol->pd_init_fn)
+   pol->pd_init_fn(blkg);
 
spin_unlock(>blkcg->lock);
}
-- 
2.4.3

--
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 6/7] blk-throttle: clean up blkg_policy_data alloc/init/exit/free methods

2015-06-23 Thread Tejun Heo
With the recent addition of alloc and free methods, things became
messier.  This patch reorganizes them according to the followings.

* ->pd_alloc_fn()

  Responsible for allocation and static initializations - the ones
  which can be done independent of where the pd might be attached.

* ->pd_init_fn()

  Initializations which require the knowledge of where the pd is
  attached.

* ->pd_free_fn()

  The counter part of pd_alloc_fn().  Static de-init and freeing.

This leaves ->pd_exit_fn() without any users.  Removed.

While at it, collapse an one liner function throtl_pd_exit(), which
has only one user, into its user.

Signed-off-by: Tejun Heo 
Cc: Vivek Goyal 
---
 block/blk-cgroup.c | 11 -
 block/blk-throttle.c   | 57 --
 block/cfq-iosched.c| 15 
 include/linux/blk-cgroup.h |  2 --
 4 files changed, 31 insertions(+), 54 deletions(-)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 574971a..9d434a9 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -389,15 +389,6 @@ static void blkg_destroy_all(struct request_queue *q)
 void __blkg_release_rcu(struct rcu_head *rcu_head)
 {
struct blkcg_gq *blkg = container_of(rcu_head, struct blkcg_gq, 
rcu_head);
-   int i;
-
-   /* tell policies that this one is being freed */
-   for (i = 0; i < BLKCG_MAX_POLS; i++) {
-   struct blkcg_policy *pol = blkcg_policy[i];
-
-   if (blkg->pd[i] && pol->pd_exit_fn)
-   pol->pd_exit_fn(blkg);
-   }
 
/* release the blkcg and parent blkg refs this blkg has been holding */
css_put(>blkcg->css);
@@ -1091,8 +1082,6 @@ void blkcg_deactivate_policy(struct request_queue *q,
 
if (pol->pd_offline_fn)
pol->pd_offline_fn(blkg);
-   if (pol->pd_exit_fn)
-   pol->pd_exit_fn(blkg);
 
if (blkg->pd[pol->plid]) {
pol->pd_free_fn(blkg->pd[pol->plid]);
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 3c86976..c3a235b 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -330,26 +330,19 @@ static struct bio *throtl_pop_queued(struct list_head 
*queued,
 }
 
 /* init a service_queue, assumes the caller zeroed it */
-static void throtl_service_queue_init(struct throtl_service_queue *sq,
- struct throtl_service_queue *parent_sq)
+static void throtl_service_queue_init(struct throtl_service_queue *sq)
 {
INIT_LIST_HEAD(>queued[0]);
INIT_LIST_HEAD(>queued[1]);
sq->pending_tree = RB_ROOT;
-   sq->parent_sq = parent_sq;
setup_timer(>pending_timer, throtl_pending_timer_fn,
(unsigned long)sq);
 }
 
-static void throtl_service_queue_exit(struct throtl_service_queue *sq)
-{
-   del_timer_sync(>pending_timer);
-}
-
 static struct blkg_policy_data *throtl_pd_alloc(gfp_t gfp, int node)
 {
struct throtl_grp *tg;
-   int cpu;
+   int rw, cpu;
 
tg = kzalloc_node(sizeof(*tg), gfp, node);
if (!tg)
@@ -361,6 +354,19 @@ static struct blkg_policy_data *throtl_pd_alloc(gfp_t gfp, 
int node)
return NULL;
}
 
+   throtl_service_queue_init(>service_queue);
+
+   for (rw = READ; rw <= WRITE; rw++) {
+   throtl_qnode_init(>qnode_on_self[rw], tg);
+   throtl_qnode_init(>qnode_on_parent[rw], tg);
+   }
+
+   RB_CLEAR_NODE(>rb_node);
+   tg->bps[READ] = -1;
+   tg->bps[WRITE] = -1;
+   tg->iops[READ] = -1;
+   tg->iops[WRITE] = -1;
+
for_each_possible_cpu(cpu) {
struct tg_stats_cpu *stats_cpu = per_cpu_ptr(tg->stats_cpu, 
cpu);
 
@@ -375,8 +381,7 @@ static void throtl_pd_init(struct blkcg_gq *blkg)
 {
struct throtl_grp *tg = blkg_to_tg(blkg);
struct throtl_data *td = blkg->q->td;
-   struct throtl_service_queue *parent_sq;
-   int rw;
+   struct throtl_service_queue *sq = >service_queue;
 
/*
 * If on the default hierarchy, we switch to properly hierarchical
@@ -391,25 +396,10 @@ static void throtl_pd_init(struct blkcg_gq *blkg)
 * Limits of a group don't interact with limits of other groups
 * regardless of the position of the group in the hierarchy.
 */
-   parent_sq = >service_queue;
-
+   sq->parent_sq = >service_queue;
if (cgroup_on_dfl(blkg->blkcg->css.cgroup) && blkg->parent)
-   parent_sq = _to_tg(blkg->parent)->service_queue;
-
-   throtl_service_queue_init(>service_queue, parent_sq);
-
-   for (rw = READ; rw <= WRITE; rw++) {
-   throtl_qnode_init(>qnode_on_self[rw], tg);
-   throtl_qnode_init(>qnode_on_parent[rw], tg);
-   }
-
-   RB_CLEAR_NODE(>rb_node);
+   sq->parent_sq = _to_tg(blkg->parent)->service_queue;
tg->td = td;
-
-   tg->bps[READ] = -1;
-   

[PATCH 5/7] blk-throttle: remove asynchrnous percpu stats allocation mechanism

2015-06-23 Thread Tejun Heo
Because percpu allocator couldn't do non-blocking allocations,
blk-throttle was forced to implement an ad-hoc asynchronous allocation
mechanism for its percpu stats for cases where blkg's (blkcg_gq's) are
allocated from an IO path without sleepable context.

Now that percpu allocator can handle gfp_mask and blkg_policy_data
alloc / free are handled by policy methods, the ad-hoc asynchronous
allocation mechanism can be replaced with direct allocation from
tg_stats_alloc_fn().  Rit it out.

This ensures that an active throtl_grp always has valid non-NULL
->stats_cpu.  Remove checks on it.

Signed-off-by: Tejun Heo 
Cc: Vivek Goyal 
---
 block/blk-throttle.c | 112 ---
 1 file changed, 25 insertions(+), 87 deletions(-)

diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index f1dd691..3c86976 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -144,9 +144,6 @@ struct throtl_grp {
 
/* Per cpu stats pointer */
struct tg_stats_cpu __percpu *stats_cpu;
-
-   /* List of tgs waiting for per cpu stats memory to be allocated */
-   struct list_head stats_alloc_node;
 };
 
 struct throtl_data
@@ -168,13 +165,6 @@ struct throtl_data
struct work_struct dispatch_work;
 };
 
-/* list and work item to allocate percpu group stats */
-static DEFINE_SPINLOCK(tg_stats_alloc_lock);
-static LIST_HEAD(tg_stats_alloc_list);
-
-static void tg_stats_alloc_fn(struct work_struct *);
-static DECLARE_DELAYED_WORK(tg_stats_alloc_work, tg_stats_alloc_fn);
-
 static void throtl_pending_timer_fn(unsigned long arg);
 
 static inline struct throtl_grp *pd_to_tg(struct blkg_policy_data *pd)
@@ -256,53 +246,6 @@ static struct throtl_data *sq_to_td(struct 
throtl_service_queue *sq)
}   \
 } while (0)
 
-static void tg_stats_init(struct tg_stats_cpu *tg_stats)
-{
-   blkg_rwstat_init(_stats->service_bytes);
-   blkg_rwstat_init(_stats->serviced);
-}
-
-/*
- * Worker for allocating per cpu stat for tgs. This is scheduled on the
- * system_wq once there are some groups on the alloc_list waiting for
- * allocation.
- */
-static void tg_stats_alloc_fn(struct work_struct *work)
-{
-   static struct tg_stats_cpu *stats_cpu;  /* this fn is non-reentrant */
-   struct delayed_work *dwork = to_delayed_work(work);
-   bool empty = false;
-
-alloc_stats:
-   if (!stats_cpu) {
-   int cpu;
-
-   stats_cpu = alloc_percpu(struct tg_stats_cpu);
-   if (!stats_cpu) {
-   /* allocation failed, try again after some time */
-   schedule_delayed_work(dwork, msecs_to_jiffies(10));
-   return;
-   }
-   for_each_possible_cpu(cpu)
-   tg_stats_init(per_cpu_ptr(stats_cpu, cpu));
-   }
-
-   spin_lock_irq(_stats_alloc_lock);
-
-   if (!list_empty(_stats_alloc_list)) {
-   struct throtl_grp *tg = list_first_entry(_stats_alloc_list,
-struct throtl_grp,
-stats_alloc_node);
-   swap(tg->stats_cpu, stats_cpu);
-   list_del_init(>stats_alloc_node);
-   }
-
-   empty = list_empty(_stats_alloc_list);
-   spin_unlock_irq(_stats_alloc_lock);
-   if (!empty)
-   goto alloc_stats;
-}
-
 static void throtl_qnode_init(struct throtl_qnode *qn, struct throtl_grp *tg)
 {
INIT_LIST_HEAD(>node);
@@ -405,7 +348,27 @@ static void throtl_service_queue_exit(struct 
throtl_service_queue *sq)
 
 static struct blkg_policy_data *throtl_pd_alloc(gfp_t gfp, int node)
 {
-   return kzalloc_node(sizeof(struct throtl_grp), gfp, node);
+   struct throtl_grp *tg;
+   int cpu;
+
+   tg = kzalloc_node(sizeof(*tg), gfp, node);
+   if (!tg)
+   return NULL;
+
+   tg->stats_cpu = alloc_percpu_gfp(struct tg_stats_cpu, gfp);
+   if (!tg->stats_cpu) {
+   kfree(tg);
+   return NULL;
+   }
+
+   for_each_possible_cpu(cpu) {
+   struct tg_stats_cpu *stats_cpu = per_cpu_ptr(tg->stats_cpu, 
cpu);
+
+   blkg_rwstat_init(_cpu->service_bytes);
+   blkg_rwstat_init(_cpu->serviced);
+   }
+
+   return >pd;
 }
 
 static void throtl_pd_init(struct blkcg_gq *blkg)
@@ -413,7 +376,6 @@ static void throtl_pd_init(struct blkcg_gq *blkg)
struct throtl_grp *tg = blkg_to_tg(blkg);
struct throtl_data *td = blkg->q->td;
struct throtl_service_queue *parent_sq;
-   unsigned long flags;
int rw;
 
/*
@@ -448,16 +410,6 @@ static void throtl_pd_init(struct blkcg_gq *blkg)
tg->bps[WRITE] = -1;
tg->iops[READ] = -1;
tg->iops[WRITE] = -1;
-
-   /*
-* Ugh... We need to perform per-cpu allocation for tg->stats_cpu
-* but percpu 

[PATCH 2/7] blkcg: use blkg_free() in blkcg_init_queue() failure path

2015-06-23 Thread Tejun Heo
When blkcg_init_queue() fails midway after creating a new blkg, it
performs kfree() directly; however, this doesn't free the policy data
areas.  Make it use blkg_free() instead.  In turn, blkg_free() is
updated to handle root request_list special case.

While this fixes a possible memory leak, it's on an unlikely failure
path of an already cold path and the size leaked per occurrence is
miniscule too.  I don't think it needs to be tagged for -stable.

Signed-off-by: Tejun Heo 
Cc: Vivek Goyal 
---
 block/blk-cgroup.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 1fddbbd..898f560 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -57,7 +57,8 @@ static void blkg_free(struct blkcg_gq *blkg)
for (i = 0; i < BLKCG_MAX_POLS; i++)
kfree(blkg->pd[i]);
 
-   blk_exit_rl(>rl);
+   if (blkg->blkcg != _root)
+   blk_exit_rl(>rl);
kfree(blkg);
 }
 
@@ -886,7 +887,7 @@ int blkcg_init_queue(struct request_queue *q)
radix_tree_preload_end();
 
if (IS_ERR(blkg)) {
-   kfree(new_blkg);
+   blkg_free(new_blkg);
return PTR_ERR(blkg);
}
 
-- 
2.4.3

--
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 4/7] blkcg: replace blkcg_policy->pd_size with ->pd_alloc/free_fn() methods

2015-06-23 Thread Tejun Heo
A blkg (blkcg_gq) represents the relationship between a cgroup and
request_queue.  Each active policy has a pd (blkg_policy_data) on each
blkg.  The pd's were allocated by blkcg core and each policy could
request to allocate extra space at the end by setting
blkcg_policy->pd_size larger than the size of pd.

This is a bit unusual but was done this way mostly to simplify error
handling and all the existing use cases could be handled this way;
however, this is becoming too restrictive now that percpu memory can
be allocated without blocking.

This introduces two new mandatory blkcg_policy methods - pd_alloc_fn()
and pd_free_fn() - which are used to allocate and release pd for a
given policy.  As pd allocation is now done from policy side, it can
simply allocate a larger area which embeds pd at the beginning.  This
change makes ->pd_size pointless.  Removed.

Signed-off-by: Tejun Heo 
Cc: Vivek Goyal 
---
 block/blk-cgroup.c | 18 +-
 block/blk-throttle.c   | 13 -
 block/cfq-iosched.c| 13 -
 include/linux/blk-cgroup.h | 18 +-
 4 files changed, 42 insertions(+), 20 deletions(-)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 617a586..574971a 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -55,7 +55,8 @@ static void blkg_free(struct blkcg_gq *blkg)
return;
 
for (i = 0; i < BLKCG_MAX_POLS; i++)
-   kfree(blkg->pd[i]);
+   if (blkg->pd[i])
+   blkcg_policy[i]->pd_free_fn(blkg->pd[i]);
 
if (blkg->blkcg != _root)
blk_exit_rl(>rl);
@@ -101,7 +102,7 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, 
struct request_queue *q,
continue;
 
/* alloc per-policy data and attach it to blkg */
-   pd = kzalloc_node(pol->pd_size, gfp_mask, q->node);
+   pd = pol->pd_alloc_fn(gfp_mask, q->node);
if (!pd)
goto err_free;
 
@@ -1016,7 +1017,7 @@ int blkcg_activate_policy(struct request_queue *q,
spin_unlock_irq(q->queue_lock);
 
while (cnt--) {
-   pd = kzalloc_node(pol->pd_size, GFP_KERNEL, q->node);
+   pd = pol->pd_alloc_fn(GFP_KERNEL, q->node);
if (!pd) {
ret = -ENOMEM;
goto out_free;
@@ -1058,7 +1059,7 @@ int blkcg_activate_policy(struct request_queue *q,
 out_free:
blk_queue_bypass_end(q);
list_for_each_entry_safe(pd, n, , alloc_node)
-   kfree(pd);
+   pol->pd_free_fn(pd);
return ret;
 }
 EXPORT_SYMBOL_GPL(blkcg_activate_policy);
@@ -1093,8 +1094,10 @@ void blkcg_deactivate_policy(struct request_queue *q,
if (pol->pd_exit_fn)
pol->pd_exit_fn(blkg);
 
-   kfree(blkg->pd[pol->plid]);
-   blkg->pd[pol->plid] = NULL;
+   if (blkg->pd[pol->plid]) {
+   pol->pd_free_fn(blkg->pd[pol->plid]);
+   blkg->pd[pol->plid] = NULL;
+   }
 
spin_unlock(>blkcg->lock);
}
@@ -1115,9 +1118,6 @@ int blkcg_policy_register(struct blkcg_policy *pol)
 {
int i, ret;
 
-   if (WARN_ON(pol->pd_size < sizeof(struct blkg_policy_data)))
-   return -EINVAL;
-
mutex_lock(_pol_mutex);
 
/* find an empty slot */
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index b231935..f1dd691 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -403,6 +403,11 @@ static void throtl_service_queue_exit(struct 
throtl_service_queue *sq)
del_timer_sync(>pending_timer);
 }
 
+static struct blkg_policy_data *throtl_pd_alloc(gfp_t gfp, int node)
+{
+   return kzalloc_node(sizeof(struct throtl_grp), gfp, node);
+}
+
 static void throtl_pd_init(struct blkcg_gq *blkg)
 {
struct throtl_grp *tg = blkg_to_tg(blkg);
@@ -493,6 +498,11 @@ static void throtl_pd_exit(struct blkcg_gq *blkg)
throtl_service_queue_exit(>service_queue);
 }
 
+static void throtl_pd_free(struct blkg_policy_data *pd)
+{
+   kfree(pd);
+}
+
 static void throtl_pd_reset_stats(struct blkcg_gq *blkg)
 {
struct throtl_grp *tg = blkg_to_tg(blkg);
@@ -1468,12 +1478,13 @@ static void throtl_shutdown_wq(struct request_queue *q)
 }
 
 static struct blkcg_policy blkcg_policy_throtl = {
-   .pd_size= sizeof(struct throtl_grp),
.cftypes= throtl_files,
 
+   .pd_alloc_fn= throtl_pd_alloc,
.pd_init_fn = throtl_pd_init,
.pd_online_fn   = throtl_pd_online,
.pd_exit_fn = throtl_pd_exit,
+   .pd_free_fn = throtl_pd_free,
.pd_reset_stats_fn  = throtl_pd_reset_stats,
 };
 
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index c09ef15..6b7bf94 100644
--- a/block/cfq-iosched.c
+++ 

Re: [RFC][PATCH 12/13] stop_machine: Remove lglock

2015-06-23 Thread Paul E. McKenney
On Tue, Jun 23, 2015 at 12:05:06PM -0700, Paul E. McKenney wrote:
> On Tue, Jun 23, 2015 at 11:26:26AM -0700, Paul E. McKenney wrote:
> > On Tue, Jun 23, 2015 at 08:04:11PM +0200, Peter Zijlstra wrote:
> > > On Tue, Jun 23, 2015 at 10:30:38AM -0700, Paul E. McKenney wrote:
> > > > Good, you don't need this because you can check for dynticks later.
> > > > You will need to check for offline CPUs.
> > > 
> > > get_online_cpus()
> > > for_each_online_cpus() {
> > >  ...
> > > }
> > > 
> > > is what the new code does.
> > 
> > Ah, I missed that this was not deleted.
> 
> But get_online_cpus() will re-introduce a deadlock.

And here is an untested patch that applies the gist of your approach,
the series of stop_one_cpu() calls, but without undoing the rest.
I forged your Signed-off-by, please let me know if that doesn't work
for you.  There are a number of simplifications that can be made, but
the basic approach gets a good testing first.

And I just noticed that I forgot to get rid of try_stop_cpus().
Well, there will probably be a test failure or two to handle, so
I can add that in the next version.  ;-)

Thanx, Paul



commit 1de96c34b39d840c5fe2689640345ed26f78b8f8
Author: Peter Zijlstra 
Date:   Tue Jun 23 19:03:45 2015 -0700

rcu: Switch synchronize_sched_expedited() to stop_one_cpu()

The synchronize_sched_expedited() currently invokes try_stop_cpus(),
which schedules the stopper kthreads on each online non-idle CPU,
and waits until all those kthreads are running before letting any
of them stop.  This is disastrous for real-time workloads, which
get hit with a preemption that is as long as the longest scheduling
latency on any CPU, including any non-realtime housekeeping CPUs.
This commit therefore switches to using stop_one_cpu() on each CPU
in turn.  This avoids inflicting the worst-case scheduling latency
on the worst-case CPU onto all other CPUs, and also simplifies the
code a little bit.

Follow-up commits will simplify the counter-snapshotting algorithm
and convert a number of the counters that are now protected by the
new ->expedited_mutex to non-atomic.

Signed-off-by: Peter Zijlstra 
[ paulmck: Kept stop_one_cpu(), dropped disabling of "guardrails". ]
Signed-off-by: Paul E. McKenney 

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 78d0a87ff354..a30971474134 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -103,6 +103,7 @@ struct rcu_state sname##_state = { \
.orphan_nxttail = ##_state.orphan_nxtlist, \
.orphan_donetail = ##_state.orphan_donelist, \
.barrier_mutex = __MUTEX_INITIALIZER(sname##_state.barrier_mutex), \
+   .expedited_mutex = __MUTEX_INITIALIZER(sname##_state.expedited_mutex), \
.name = RCU_STATE_NAME(sname), \
.abbr = sabbr, \
 }
@@ -3357,8 +3358,6 @@ static int synchronize_sched_expedited_cpu_stop(void 
*data)
  */
 void synchronize_sched_expedited(void)
 {
-   cpumask_var_t cm;
-   bool cma = false;
int cpu;
long firstsnap, s, snap;
int trycount = 0;
@@ -3394,28 +3393,11 @@ void synchronize_sched_expedited(void)
}
WARN_ON_ONCE(cpu_is_offline(raw_smp_processor_id()));
 
-   /* Offline CPUs, idle CPUs, and any CPU we run on are quiescent. */
-   cma = zalloc_cpumask_var(, GFP_KERNEL);
-   if (cma) {
-   cpumask_copy(cm, cpu_online_mask);
-   cpumask_clear_cpu(raw_smp_processor_id(), cm);
-   for_each_cpu(cpu, cm) {
-   struct rcu_dynticks *rdtp = _cpu(rcu_dynticks, cpu);
-
-   if (!(atomic_add_return(0, >dynticks) & 0x1))
-   cpumask_clear_cpu(cpu, cm);
-   }
-   if (cpumask_weight(cm) == 0)
-   goto all_cpus_idle;
-   }
-
/*
 * Each pass through the following loop attempts to force a
 * context switch on each CPU.
 */
-   while (try_stop_cpus(cma ? cm : cpu_online_mask,
-synchronize_sched_expedited_cpu_stop,
-NULL) == -EAGAIN) {
+   while (!mutex_trylock(>expedited_mutex)) {
put_online_cpus();
atomic_long_inc(>expedited_tryfail);
 
@@ -3425,7 +3407,6 @@ void synchronize_sched_expedited(void)
/* ensure test happens before caller kfree */
smp_mb__before_atomic(); /* ^^^ */
atomic_long_inc(>expedited_workdone1);
-   free_cpumask_var(cm);
return;
}
 
@@ -3435,7 +3416,6 @@ void synchronize_sched_expedited(void)
} else {
wait_rcu_gp(call_rcu_sched);
atomic_long_inc(>expedited_normal);
- 

Re: , [PATCH 2/2] staging : Comedi : comedi_fops : Fixed the return error, code, try_module_get fails when the reference count of the module is not, allowed to be incremented ,and hence -ENXIO is ret

2015-06-23 Thread Greg KH
On Tue, Jun 23, 2015 at 11:48:31PM +0530, Santosh wrote:
> 
> ___
> devel mailing list
> de...@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Your email did not get through properly :(
--
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] ARM: rcm-k1879xb1: Add support for K1879XB1 SoC

2015-06-23 Thread Rob Herring
On Tue, Jun 23, 2015 at 10:50 AM, Andrew Andrianov  wrote:
> This patch adds basic support for RC Module's
> K1879XB1YA SoC.
>
> K1879XB1YA is a hybrid SoC with one ARM1176JZF-S
> core running linux and one NeuroMatrix DSP core.
>
> http://www.module.ru/en/catalog/micro/mikroshema_dekodera_cifrovogo_televizionnogo_signala_sbis_k1879hb1ya/
> http://www.module.ru/en/catalog/micro/micro_pc/
>
> Signed-off-by: Andrew Andrianov 
> ---
>  arch/arm/Kconfig   |  18 +++
>  arch/arm/Kconfig.debug |   5 +-
>  arch/arm/Makefile  |   1 +
>  arch/arm/mach-rcm-k1879xb1/Kconfig |   0
>  arch/arm/mach-rcm-k1879xb1/Makefile|   2 +
>  arch/arm/mach-rcm-k1879xb1/Makefile.boot   |   4 +
>  arch/arm/mach-rcm-k1879xb1/board-dt.c  | 152 
> +
>  arch/arm/mach-rcm-k1879xb1/cpuidle.c   |  48 +++
>  arch/arm/mach-rcm-k1879xb1/include/mach/hardware.h |  75 ++
>  .../mach-rcm-k1879xb1/include/mach/uncompress.h|  54 
>  10 files changed, 358 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/mach-rcm-k1879xb1/Kconfig
>  create mode 100644 arch/arm/mach-rcm-k1879xb1/Makefile
>  create mode 100644 arch/arm/mach-rcm-k1879xb1/Makefile.boot
>  create mode 100644 arch/arm/mach-rcm-k1879xb1/board-dt.c
>  create mode 100644 arch/arm/mach-rcm-k1879xb1/cpuidle.c
>  create mode 100644 arch/arm/mach-rcm-k1879xb1/include/mach/hardware.h
>  create mode 100644 arch/arm/mach-rcm-k1879xb1/include/mach/uncompress.h
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 45df48b..2de4d2a 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -619,6 +619,24 @@ config ARCH_PXA
> help
>   Support for Intel/Marvell's PXA2xx/PXA3xx processor line.
>
> +config ARCH_RCM_K1879XB1
> +   bool "RC Module K1879XB1YA"

This config entry belongs in your mach dir and should depend on ARCH_MULTI_V6

> +   depends on MMU
> +   select CPU_V6
> +select ARM_AMBA
> +   select ARM_VIC
> +   select SPARSE_IRQ

Multi-platform will select this for you.

> +   select GENERIC_GPIO

Don't think this is needed.

> +   select COMMON_CLK

Multi-platform will select this for you.

> +   select USB_ARCH_HAS_EHCI
> +   select USB_ARCH_HAS_OHCI

Don't think these are needed anymore.

> +   select ARCH_REQUIRE_GPIOLIB
> +   select NEED_MACH_GPIO_H

Why?

> +   select GENERIC_CLOCKEVENTS

Multi-platform will select this for you.

> +   select CLKSRC_ARM_DIT
> +   help
> + Support for RC Module's K1879X SoCs
> +
>  config ARCH_SHMOBILE_LEGACY
> bool "Renesas ARM SoCs (non-multiplatform)"
> select ARCH_SHMOBILE
> diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
> index 0c12ffb..48ee54c 100644
> --- a/arch/arm/Kconfig.debug
> +++ b/arch/arm/Kconfig.debug
> @@ -1318,7 +1318,8 @@ config DEBUG_UART_8250
> (FOOTBRIDGE && !DEBUG_DC21285_PORT) || \
> ARCH_GEMINI || ARCH_IOP13XX || ARCH_IOP32X || \
> ARCH_IOP33X || ARCH_IXP4XX || \
> -   ARCH_LPC32XX || ARCH_MV78XX0 || ARCH_ORION5X || ARCH_RPC
> +   ARCH_LPC32XX || ARCH_MV78XX0 || ARCH_ORION5X || ARCH_RPC || \
> +   ARCH_RCM_K1879XB1
>
>  # Compatibility options for BCM63xx
>  config DEBUG_UART_BCM63XX
> @@ -1417,6 +1418,7 @@ config DEBUG_UART_PHYS
> default 0xfffb9800 if DEBUG_OMAP1UART3 || DEBUG_OMAP7XXUART3
> default 0xfffe8600 if DEBUG_UART_BCM63XX
> default 0xf700 if ARCH_IOP33X
> +   default 0x2002b000 if ARCH_RCM_K1879XB1

This cannot depend on ARCH_RCM_K1879XB1 once you enable multi-platform build.

> depends on ARCH_EP93XX || \
> DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \
> DEBUG_LL_UART_EFM32 || \
> @@ -1511,6 +1513,7 @@ config DEBUG_UART_VIRT
> default 0xfefff700 if ARCH_IOP33X
> default 0xff003000 if DEBUG_U300_UART
> default 0xffd01000 if DEBUG_HIP01_UART
> +   default 0xf802b000 if ARCH_RCM_K1879XB1

ditto.

> default DEBUG_UART_PHYS if !MMU
> depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \
> DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \
> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> index 985227c..9beb65f 100644
> --- a/arch/arm/Makefile
> +++ b/arch/arm/Makefile
> @@ -184,6 +184,7 @@ machine-$(CONFIG_ARCH_OMAP2PLUS)+= omap2
>  machine-$(CONFIG_ARCH_ORION5X) += orion5x
>  machine-$(CONFIG_ARCH_PICOXCELL)   += picoxcell
>  machine-$(CONFIG_ARCH_PXA) += pxa
> +machine-$(CONFIG_ARCH_RCM_K1879XB1)+= rcm-k1879xb1
>  machine-$(CONFIG_ARCH_QCOM)+= qcom
>  machine-$(CONFIG_ARCH_REALVIEW)+= realview
>  machine-$(CONFIG_ARCH_ROCKCHIP)+= rockchip
> diff --git 

Re: Crypto Update for 4.2

2015-06-23 Thread Linus Torvalds
On Mon, Jun 22, 2015 at 1:44 AM, Herbert Xu  wrote:
>
> Here is the crypto update for 4.2:

Hmm. I noticed a new annoyance:

I get this at bootup:

  [  +0.001504] alg: No test for __gcm-aes-aesni (__driver-gcm-aes-aesni)
  [  +0.002233] alg: aead: setkey failed on test 1 for
rfc4106-gcm-aesni: flags=0

in general, I'm not at all convinced that the crypto tests make sense.
I absolutely destest that horrid "testmgr.h" file that is 32
_thousand_ lines of noise. And now it's apparently complaining about a
missing test, so that nasty mess will presumably grow.

Could you not make the test infrastructure be something that gets run
in user space?

Linus
--
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: [git pull] IOMMU Updates for Linux v4.2

2015-06-23 Thread Linus Torvalds
On Tue, Jun 23, 2015 at 2:24 AM, Joerg Roedel  wrote:
>
> I attached my resolution of the conflicts to this pull-request and
> compiled and run-time tested my resolution on an Intel VT-d and an
> AMD IOMMU machine.

Hmm. My resolution doesn't look the same at all, but that could easily
be due to trivial differences. I tried to make as much sense of the
merge as possible, so I think my merge is fine, but it's also entirely
possible I screwed something up.

In general, when there are complex merges, I still tend to prefer to
do them myself, but if you *also* have a pre-merged branch, I can then
compare my merge against yours. I tend find that the maintainer has
had a broken merge more often than mine (just because I'm so used to
merging), but the reverse also does happen, and it's often very useful
to be able to compare the two merges for sanity.

And for conflicts that are trivial, don't even bother. In this case,
like you to double-check my end result. It looks sane, and it
compiles, but hey..

  Linus
--
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] intel powerclamp: support Knights Landing

2015-06-23 Thread Zhang, Rui
It has been in my  -next branch and I will send it out for 4.2-rc1.

Thanks,
rui

> -Original Message-
> From: Chandramouli, Dasaratharaman
> Sent: Wednesday, June 24, 2015 2:46 AM
> To: Rafael J. Wysocki
> Cc: Jacob Pan; Zhang, Rui; Eduardo Valentin; linux...@vger.kernel.org;
> linux-kernel@vger.kernel.org; Pan, Jacob jun; Rao, Nikhil
> Subject: Re: [PATCH] intel powerclamp: support Knights Landing
> Importance: High
> 
> On Tue, 2015-06-23 at 01:39 +0200, Rafael J. Wysocki wrote:
> > On Monday, June 22, 2015 04:51:13 PM Chandramouli, Dasaratharaman
> wrote:
> > > Can we make this patch available for 4.2
> >
> > It is included in the power management and ACPI pull request for
> > 4.1-rc1 I've just sent.
> 
> I just checked the branch pm+acpi-4.2-rc1 and i don't see the Knights Landing
> patch for the powerclamp driver in that. Kindly verify that it was added.
> 
> https://lkml.org/lkml/2015/4/17/795
> 
> >
> >
> 



[RFC] virtio_net: Adding tx_timeout function.

2015-06-23 Thread Julio Faracco
virtio_net paravirtualized driver does not have a tx_timeout() function to
guarantee that the driver will recover properly after receiving a timeout
during a transmission of a packet. This patch add this feature and throw a
timeout exception after 5 HZ. Considering some tests, this is the best
time to use here.

Signed-off-by: Julio Faracco 
Cc: Jason Wang 
---
 drivers/net/virtio_net.c |   69 +-
 1 file changed, 68 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 63c7810..75ac45c 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -135,6 +135,9 @@ struct virtnet_info {
/* Work struct for config space updates */
struct work_struct config_work;
 
+   /* Work struct for resetting the virtio-net driver. */
+   struct work_struct reset_task;
+
/* Does the affinity hint is set for virtqueues? */
bool affinity_hint_set;
 
@@ -1394,6 +1397,18 @@ static int virtnet_change_mtu(struct net_device *dev, 
int new_mtu)
return 0;
 }
 
+static void virtnet_tx_timeout(struct net_device *dev)
+{
+   struct virtnet_info *vi = netdev_priv(dev);
+
+   dev_warn(>dev, "TX Timeout exception with latency: %ld\n",
+jiffies - dev_trans_start(dev));
+
+   schedule_work(>reset_task);
+}
+
+static void virtnet_reset_task(struct work_struct *work);
+
 static const struct net_device_ops virtnet_netdev = {
.ndo_open= virtnet_open,
.ndo_stop= virtnet_close,
@@ -1405,6 +1420,7 @@ static const struct net_device_ops virtnet_netdev = {
.ndo_get_stats64 = virtnet_stats,
.ndo_vlan_rx_add_vid = virtnet_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = virtnet_vlan_rx_kill_vid,
+   .ndo_tx_timeout  = virtnet_tx_timeout,
 #ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = virtnet_netpoll,
 #endif
@@ -1750,6 +1766,7 @@ static int virtnet_probe(struct virtio_device *vdev)
dev->netdev_ops = _netdev;
dev->features = NETIF_F_HIGHDMA;
 
+   dev->watchdog_timeo = 5 * HZ;
dev->ethtool_ops = _ethtool_ops;
SET_NETDEV_DEV(dev, >dev);
 
@@ -1811,6 +1828,7 @@ static int virtnet_probe(struct virtio_device *vdev)
}
 
INIT_WORK(>config_work, virtnet_config_changed_work);
+   INIT_WORK(>reset_task, virtnet_reset_task);
 
/* If we can receive ANY GSO packets, we must allocate large ones. */
if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) ||
@@ -1891,7 +1909,7 @@ static int virtnet_probe(struct virtio_device *vdev)
netif_carrier_on(dev);
}
 
-   pr_debug("virtnet: registered device %s with %d RX and TX vq's\n",
+   pr_debug("virtio_net: registered device %s with %d RX and TX vq's\n",
 dev->name, max_queue_pairs);
 
return 0;
@@ -2001,6 +2019,55 @@ static int virtnet_restore(struct virtio_device *vdev)
 }
 #endif
 
+static void virtnet_reset_task(struct work_struct *work)
+{
+   struct virtnet_info *vi =
+   container_of(work, struct virtnet_info, reset_task);
+   struct net_device *dev = vi->dev;
+   struct virtio_device *vdev = vi->vdev;
+   int err, i;
+
+   flush_work(>config_work);
+
+   netif_device_detach(vi->dev);
+   cancel_delayed_work_sync(>refill);
+
+   if (netif_running(vi->dev)) {
+   for (i = 0; i < vi->max_queue_pairs; i++) {
+   napi_disable(>rq[i].napi);
+   napi_hash_del(>rq[i].napi);
+   netif_napi_del(>rq[i].napi);
+   }
+   }
+
+   remove_vq_common(vi);
+
+   dev->stats.tx_errors++;
+
+   err = init_vqs(vi);
+   if (err) {
+   dev_warn(>dev, "virtio_net: virtqueue initialization 
failed.\n");
+   return;
+   }
+
+   virtio_device_ready(vdev);
+
+   if (netif_running(vi->dev)) {
+   for (i = 0; i < vi->curr_queue_pairs; i++)
+   if (!try_fill_recv(vi, >rq[i], GFP_KERNEL))
+   schedule_delayed_work(>refill, 0);
+
+   for (i = 0; i < vi->max_queue_pairs; i++)
+   virtnet_napi_enable(>rq[i]);
+   }
+
+   netif_device_attach(vi->dev);
+
+   rtnl_lock();
+   virtnet_set_queues(vi, vi->curr_queue_pairs);
+   rtnl_unlock();
+}
+
 static struct virtio_device_id id_table[] = {
{ VIRTIO_ID_NET, VIRTIO_DEV_ANY_ID },
{ 0 },
-- 
1.7.10.4

--
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/


linux-next: build failure after merge of the modules tree

2015-06-23 Thread Stephen Rothwell
Hi Rusty,

After merging the modules tree, today's linux-next build (x86_64
allmodconfig) failed like this:

In file included from include/linux/linkage.h:4:0,
 from include/linux/kernel.h:6,
 from kernel/params.c:18:
kernel/params.c: In function 'param_array':
kernel/params.c:32:42: error: dereferencing pointer to incomplete type
 #define KPARAM_MUTEX(mod) ((mod) ? &(mod)->param_lock : _lock)
  ^
include/linux/compiler.h:164:42: note: in definition of macro 'unlikely'
 # define unlikely(x) __builtin_expect(!!(x), 0)
  ^
kernel/params.c:462:3: note: in expansion of macro 'BUG_ON'
   BUG_ON(!KPARAM_IS_LOCKED(mod));
   ^
kernel/params.c:33:47: note: in expansion of macro 'KPARAM_MUTEX'
 #define KPARAM_IS_LOCKED(mod) mutex_is_locked(KPARAM_MUTEX(mod))
   ^
kernel/params.c:462:11: note: in expansion of macro 'KPARAM_IS_LOCKED'
   BUG_ON(!KPARAM_IS_LOCKED(mod));
   ^
kernel/params.c: In function 'param_array_get':
kernel/params.c:32:42: error: dereferencing pointer to incomplete type
 #define KPARAM_MUTEX(mod) ((mod) ? &(mod)->param_lock : _lock)
  ^
include/linux/compiler.h:164:42: note: in definition of macro 'unlikely'
 # define unlikely(x) __builtin_expect(!!(x), 0)
  ^
kernel/params.c:499:3: note: in expansion of macro 'BUG_ON'
   BUG_ON(!KPARAM_IS_LOCKED(p.mod));
   ^
kernel/params.c:33:47: note: in expansion of macro 'KPARAM_MUTEX'
 #define KPARAM_IS_LOCKED(mod) mutex_is_locked(KPARAM_MUTEX(mod))
   ^
kernel/params.c:499:11: note: in expansion of macro 'KPARAM_IS_LOCKED'
   BUG_ON(!KPARAM_IS_LOCKED(p.mod));
   ^
In file included from include/linux/notifier.h:13:0,
 from include/linux/memory_hotplug.h:6,
 from include/linux/mmzone.h:789,
 from include/linux/gfp.h:5,
 from include/linux/kmod.h:22,
 from include/linux/module.h:13,
 from kernel/params.c:21:
kernel/params.c: In function 'kernel_param_lock':
kernel/params.c:32:42: error: dereferencing pointer to incomplete type
 #define KPARAM_MUTEX(mod) ((mod) ? &(mod)->param_lock : _lock)
  ^
include/linux/mutex.h:146:44: note: in definition of macro 'mutex_lock'
 #define mutex_lock(lock) mutex_lock_nested(lock, 0)
^
kernel/params.c:621:13: note: in expansion of macro 'KPARAM_MUTEX'
  mutex_lock(KPARAM_MUTEX(mod));
 ^
kernel/params.c: In function 'kernel_param_unlock':
kernel/params.c:32:42: error: dereferencing pointer to incomplete type
 #define KPARAM_MUTEX(mod) ((mod) ? &(mod)->param_lock : _lock)
  ^
kernel/params.c:626:15: note: in expansion of macro 'KPARAM_MUTEX'
  mutex_unlock(KPARAM_MUTEX(mod));
   ^

Caused by commit b51d23e4e9fe ("module: add per-module param_lock").

I am not exactly sure why this fails to build.  It may be an
interaction with some other change.

I have used the modules tree from next-20150623 for today.

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


pgpp2nLNEv5cL.pgp
Description: OpenPGP digital signature


[PATCH] mtip32xx: Fix accessing freed memory

2015-06-23 Thread Asai Thambi SP
>From 4e5d695dca047012bc537c991fba0f85d112c614 Mon Sep 17 00:00:00 2001
From: Selvan Mani 
Date: Mon, 22 Jun 2015 02:18:48 -0700
Subject: [PATCH] mtip32xx: Fix accessing freed memory

In mtip_pci_remove(), driver data 'dd' is accessed after freeing it. This
is a residue of SRSI code cleanup in the patch 016a41c38821 "mtip32xx: fix
crash on surprise removal of the drive". Removed the bit flags
MTIP_DDF_REMOVE_DONE_BIT and MTIP_PF_SR_CLEANUP_BIT.

Reported-by: Julia Lawall 
Signed-off-by: Vignesh Gunasekaran 
Signed-off-by: Selvan Mani 
Signed-off-by: Asai Thambi S P 
---
 drivers/block/mtip32xx/mtip32xx.c | 19 ---
 drivers/block/mtip32xx/mtip32xx.h |  2 --
 2 files changed, 21 deletions(-)

diff --git a/drivers/block/mtip32xx/mtip32xx.c 
b/drivers/block/mtip32xx/mtip32xx.c
index 144e7d9..4a2ef09 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -163,12 +163,6 @@ static bool mtip_check_surprise_removal(struct pci_dev 
*pdev)
else
dev_warn(>pdev->dev,
"%s: dd->queue is NULL\n", __func__);
-   if (dd->port) {
-   set_bit(MTIP_PF_SR_CLEANUP_BIT, >port->flags);
-   wake_up_interruptible(>port->svc_wait);
-   } else
-   dev_warn(>pdev->dev,
-   "%s: dd->port is NULL\n", __func__);
return true; /* device removed */
}
 
@@ -2938,10 +2932,6 @@ static int mtip_service_thread(void *data)
test_bit(MTIP_PF_SVC_THD_STOP_BIT, >flags))
goto st_out;
 
-   /* If I am an orphan, start self cleanup */
-   if (test_bit(MTIP_PF_SR_CLEANUP_BIT, >flags))
-   break;
-
if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT,
>dd_flag)))
goto st_out;
@@ -2995,14 +2985,6 @@ restart_eh:
}
}
 
-   /* wait for pci remove to exit */
-   while (1) {
-   if (test_bit(MTIP_DDF_REMOVE_DONE_BIT, >dd_flag))
-   break;
-   msleep_interruptible(1000);
-   if (kthread_should_stop())
-   goto st_out;
-   }
 st_out:
return 0;
 }
@@ -4486,7 +4468,6 @@ static void mtip_pci_remove(struct pci_dev *pdev)
spin_unlock_irqrestore(_lock, flags);
 
kfree(dd);
-   set_bit(MTIP_DDF_REMOVE_DONE_BIT, >dd_flag);
 
pcim_iounmap_regions(pdev, 1 << MTIP_ABAR);
pci_set_drvdata(pdev, NULL);
diff --git a/drivers/block/mtip32xx/mtip32xx.h 
b/drivers/block/mtip32xx/mtip32xx.h
index d7a5459..3274784 100644
--- a/drivers/block/mtip32xx/mtip32xx.h
+++ b/drivers/block/mtip32xx/mtip32xx.h
@@ -142,7 +142,6 @@ enum {
MTIP_PF_SVC_THD_ACTIVE_BIT  = 4,
MTIP_PF_ISSUE_CMDS_BIT  = 5,
MTIP_PF_REBUILD_BIT = 6,
-   MTIP_PF_SR_CLEANUP_BIT  = 7,
MTIP_PF_SVC_THD_STOP_BIT= 8,
 
/* below are bit numbers in 'dd_flag' defined in driver_data */
@@ -150,7 +149,6 @@ enum {
MTIP_DDF_REMOVE_PENDING_BIT = 1,
MTIP_DDF_OVER_TEMP_BIT  = 2,
MTIP_DDF_WRITE_PROTECT_BIT  = 3,
-   MTIP_DDF_REMOVE_DONE_BIT= 4,
MTIP_DDF_CLEANUP_BIT= 5,
MTIP_DDF_RESUME_BIT = 6,
MTIP_DDF_INIT_DONE_BIT  = 7,
-- 
2.0.1.537.g81e776d


--
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/


  1   2   3   4   5   6   7   8   9   10   >