Re: [PATCH] ASoC: fsl_ssi: fix AC'97 mode

2015-06-28 Thread Maciej S. Szmigiero
W dniu 28.06.2015 06:27, Timur Tabi pisze:
 Maciej S. Szmigiero wrote:
 +if (newbinding  fsl_ssi_is_ac97(ssi_private)) {
 
 Is the newbinding necessary?  I thought only the original PowerPC device 
 trees were the only one that have the old binding, and they never supported 
 AC97.

If there isn't going to be new platforms added with old bindings then this 
won't be needed - I'll remove it.

Best regards,
Maciej Szmigiero

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

RE: [v2,8/9] fsl/fman: Add FMan Port Support

2015-06-28 Thread Liberman Igal
Hi Paul,
All those exported functions are used by DPAA ETH driver, which was submitted 
by Bucur Madalin (only fm_port_get_buffer_time_stamp() is not used currently, 
I'll remove it).

Regards,
Igal Liberman.

 -Original Message-
 From: Paul Bolle [mailto:pebo...@tiscali.nl]
 Sent: Friday, June 26, 2015 2:29 AM
 To: Liberman Igal-B31950; net...@vger.kernel.org
 Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Bucur Madalin-
 Cristian-B32716
 Subject: Re: [v2,8/9] fsl/fman: Add FMan Port Support
 
 On Wed, 2015-06-24 at 22:37 +0300, igal.liber...@freescale.com wrote:
  --- a/drivers/net/ethernet/freescale/fman/fm_drv.c
  +++ b/drivers/net/ethernet/freescale/fman/fm_drv.c
 
  +struct fm_port_t *fm_port_drv_handle(const struct fm_port_drv_t
  +*port) {
  +   return port-fm_port;
  +}
  +EXPORT_SYMBOL(fm_port_drv_handle);
 
 I couldn't find any users of this function.
 
  +void fm_port_get_buff_layout_ext_params(struct fm_port_drv_t *port,
  +  struct fm_port_params *params)
 
 (Evolution 3.16 is a piece of ...).
 
  +{
  +   params-data_align = 0;
  +}
  +EXPORT_SYMBOL(fm_port_get_buff_layout_ext_params);
 
 Ditto.
 
  +int fm_get_tx_port_channel(struct fm_port_drv_t *port) {
  +   return port-tx_ch;
  +}
  +EXPORT_SYMBOL(fm_get_tx_port_channel);
 
 Ditto.
 
  --- /dev/null
  +++ b/drivers/net/ethernet/freescale/fman/fm_port_drv.c
 
  +void fm_set_rx_port_params(struct fm_port_drv_t *port,
  +  struct fm_port_params *params)
  +{
 + [...]
  +}
  +EXPORT_SYMBOL(fm_set_rx_port_params);
 
 Ditto.
 
 (If you hear about my arrest for randomly attacking innocent people:
 blame evolution 3.16!)
 
  +void fm_set_tx_port_params(struct fm_port_drv_t *port,
  +  struct fm_port_params *params)
  +{
  +   [...]
  +}
  +EXPORT_SYMBOL(fm_set_tx_port_params);
 
 Ditto.
 
  --- /dev/null
  +++ b/drivers/net/ethernet/freescale/fman/port/fm_port.c
 
  +u64 *fm_port_get_buffer_time_stamp(const struct fm_port_t
 *p_fm_port,
  +  char *p_data)
  +{
  +   [...]
  +}
  +EXPORT_SYMBOL(fm_port_get_buffer_time_stamp);
 
 Ditto.
 
  +int fm_port_disable(struct fm_port_t *p_fm_port) {
  +   [...]
  +}
  +EXPORT_SYMBOL(fm_port_disable);
 
 This exports a function that I think is only used inside this file.
 
  +int fm_port_enable(struct fm_port_t *p_fm_port) {
  +   [...]
  +}
  +EXPORT_SYMBOL(fm_port_enable);
 
 And here I could again find no users of this function.
 
 Thanks,
 
 
 Paul Bolle
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [v2,8/9] fsl/fman: Add FMan Port Support

2015-06-28 Thread Scott Wood
Why are these two parts being submitted separately?  Worse, the CC list seems 
to be different for each part as I'm not seeing the DPAA ETH driver.

-Scott

On Sun, 2015-06-28 at 03:06 -0500, Liberman Igal-B31950 wrote:
 Hi Paul,
 All those exported functions are used by DPAA ETH driver, which was 
 submitted by Bucur Madalin (only fm_port_get_buffer_time_stamp() is not 
 used currently, I'll remove it).
 
 Regards,
 Igal Liberman.
 
  -Original Message-
  From: Paul Bolle [mailto:pebo...@tiscali.nl]
  Sent: Friday, June 26, 2015 2:29 AM
  To: Liberman Igal-B31950; net...@vger.kernel.org
  Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Bucur Madalin-
  Cristian-B32716
  Subject: Re: [v2,8/9] fsl/fman: Add FMan Port Support
  
  On Wed, 2015-06-24 at 22:37 +0300,  igal.liberman@freescale.comwrote:
   --- a/drivers/net/ethernet/freescale/fman/fm_drv.c
   +++ b/drivers/net/ethernet/freescale/fman/fm_drv.c
  
   +struct fm_port_t *fm_port_drv_handle(const struct fm_port_drv_t
   +*port) {
   + return port-fm_port;
   +}
   +EXPORT_SYMBOL(fm_port_drv_handle);
  
  I couldn't find any users of this function.
  
   +void fm_port_get_buff_layout_ext_params(struct fm_port_drv_t *port,
   +struct fm_port_params *params)
  
  (Evolution 3.16 is a piece of ...).
  
   +{
   + params-data_align = 0;
   +}
   +EXPORT_SYMBOL(fm_port_get_buff_layout_ext_params);
  
  Ditto.
  
   +int fm_get_tx_port_channel(struct fm_port_drv_t *port) {
   + return port-tx_ch;
   +}
   +EXPORT_SYMBOL(fm_get_tx_port_channel);
  
  Ditto.
  
   --- /dev/null
   +++ b/drivers/net/ethernet/freescale/fman/fm_port_drv.c
  
   +void fm_set_rx_port_params(struct fm_port_drv_t *port,
   +struct fm_port_params *params)
   +{
  +   [...]
   +}
   +EXPORT_SYMBOL(fm_set_rx_port_params);
  
  Ditto.
  
  (If you hear about my arrest for randomly attacking innocent people:
  blame evolution 3.16!)
  
   +void fm_set_tx_port_params(struct fm_port_drv_t *port,
   +struct fm_port_params *params)
   +{
   + [...]
   +}
   +EXPORT_SYMBOL(fm_set_tx_port_params);
  
  Ditto.
  
   --- /dev/null
   +++ b/drivers/net/ethernet/freescale/fman/port/fm_port.c
  
   +u64 *fm_port_get_buffer_time_stamp(const struct fm_port_t
  *p_fm_port,
   +char *p_data)
   +{
   + [...]
   +}
   +EXPORT_SYMBOL(fm_port_get_buffer_time_stamp);
  
  Ditto.
  
   +int fm_port_disable(struct fm_port_t *p_fm_port) {
   + [...]
   +}
   +EXPORT_SYMBOL(fm_port_disable);
  
  This exports a function that I think is only used inside this file.
  
   +int fm_port_enable(struct fm_port_t *p_fm_port) {
   + [...]
   +}
   +EXPORT_SYMBOL(fm_port_enable);
  
  And here I could again find no users of this function.
  
  Thanks,
  
  
  Paul Bolle
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH] ASoC: fsl_ssi: fix AC'97 mode

2015-06-28 Thread Timur Tabi

Maciej S. Szmigiero wrote:

If there isn't going to be new platforms added with old bindings then this 
won't be needed - I'll remove it.


I would love it if someone would port those original device trees to the 
new binding, so that we can get rid of the old one.  But we should 
definitely not allow new device trees with the old binding.

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 1/6] ASoC: fsl_ssi: enable IPG clock during AC'97 reg access

2015-06-28 Thread Maciej S. Szmigiero
IPG clock have to be enabled during AC'97 CODEC register
access in fsl_ssi driver.

Signed-off-by: Maciej Szmigiero m...@maciej.szmigiero.name
---
 sound/soc/fsl/fsl_ssi.c |   19 +++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index c7647e0..9c46c7d 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -1127,10 +1127,17 @@ static void fsl_ssi_ac97_write(struct snd_ac97 *ac97, 
unsigned short reg,
struct regmap *regs = fsl_ac97_data-regs;
unsigned int lreg;
unsigned int lval;
+   int ret;
 
if (reg  0x7f)
return;
 
+   ret = clk_prepare_enable(fsl_ac97_data-clk);
+   if (ret) {
+   pr_err(ac97 write clk_prepare_enable failed: %d\n,
+   ret);
+   return;
+   }
 
lreg = reg   12;
regmap_write(regs, CCSR_SSI_SACADD, lreg);
@@ -1141,6 +1148,8 @@ static void fsl_ssi_ac97_write(struct snd_ac97 *ac97, 
unsigned short reg,
regmap_update_bits(regs, CCSR_SSI_SACNT, CCSR_SSI_SACNT_RDWR_MASK,
CCSR_SSI_SACNT_WR);
udelay(100);
+
+   clk_disable_unprepare(fsl_ac97_data-clk);
 }
 
 static unsigned short fsl_ssi_ac97_read(struct snd_ac97 *ac97,
@@ -1151,6 +1160,14 @@ static unsigned short fsl_ssi_ac97_read(struct snd_ac97 
*ac97,
unsigned short val = -1;
u32 reg_val;
unsigned int lreg;
+   int ret;
+
+   ret = clk_prepare_enable(fsl_ac97_data-clk);
+   if (ret) {
+   pr_err(ac97 read clk_prepare_enable failed: %d\n,
+   ret);
+   return -1;
+   }
 
lreg = (reg  0x7f)   12;
regmap_write(regs, CCSR_SSI_SACADD, lreg);
@@ -1162,6 +1179,8 @@ static unsigned short fsl_ssi_ac97_read(struct snd_ac97 
*ac97,
regmap_read(regs, CCSR_SSI_SACDAT, reg_val);
val = (reg_val  4)  0x;
 
+   clk_disable_unprepare(fsl_ac97_data-clk);
+
return val;
 }
 

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 3/6] ASoC: fsl_ssi: enable AC'97 asymmetric rates

2015-06-28 Thread Maciej S. Szmigiero
AC'97 bus can support asymmetric playback/capture rates
so enable them in this case in fsl_ssi driver.

Signed-off-by: Maciej Szmigiero m...@maciej.szmigiero.name
---
 sound/soc/fsl/fsl_ssi.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 2ce9e1d..f3034b9 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -1377,7 +1377,9 @@ static int fsl_ssi_probe(struct platform_device *pdev)
 
/* Are the RX and the TX clocks locked? */
if (!of_find_property(np, fsl,ssi-asynchronous, NULL)) {
-   ssi_private-cpu_dai_drv.symmetric_rates = 1;
+   if (!fsl_ssi_is_ac97(ssi_private))
+   ssi_private-cpu_dai_drv.symmetric_rates = 1;
+
ssi_private-cpu_dai_drv.symmetric_channels = 1;
ssi_private-cpu_dai_drv.symmetric_samplebits = 1;
}

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 2/6] ASoC: fsl_ssi: AC'97 DAI driver needs probe method too

2015-06-28 Thread Maciej S. Szmigiero
AC'97 DAI driver struct need the same probe method as
I2S one to setup DMA params in fsl_ssi driver.

Signed-off-by: Maciej Szmigiero m...@maciej.szmigiero.name
---
 sound/soc/fsl/fsl_ssi.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 9c46c7d..2ce9e1d 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -1101,6 +1101,7 @@ static const struct snd_soc_component_driver 
fsl_ssi_component = {
 
 static struct snd_soc_dai_driver fsl_ssi_ac97_dai = {
.bus_control = true,
+   .probe = fsl_ssi_dai_probe,
.playback = {
.stream_name = AC97 Playback,
.channels_min = 2,

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 3/6] ASoC: fsl_ssi: enable AC'97 asymmetric rates

2015-06-28 Thread Timur Tabi

Maciej S. Szmigiero wrote:

/* Are the RX and the TX clocks locked? */
if (!of_find_property(np, fsl,ssi-asynchronous, NULL)) {
-   ssi_private-cpu_dai_drv.symmetric_rates = 1;
+   if (!fsl_ssi_is_ac97(ssi_private))
+   ssi_private-cpu_dai_drv.symmetric_rates = 1;
+


Is this necessary?  Why not just add fsl,ssi-asynchronous to the AC97 
device tree node?

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 6/6] ASoC: fsl_ssi: adjust set DAI format in AC'97 mode

2015-06-28 Thread Maciej S. Szmigiero
Adjust set DAI format function in fsl_ssi driver so it
doesn't fail and clears RXDIR in AC'97 mode.

Signed-off-by: Maciej Szmigiero m...@maciej.szmigiero.name
---
 sound/soc/fsl/fsl_ssi.c |8 +---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index e79dc16..d043c7c 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -900,14 +900,16 @@ static int _fsl_ssi_set_dai_fmt(struct device *dev,
scr = ~CCSR_SSI_SCR_SYS_CLK_EN;
break;
default:
-   return -EINVAL;
+   if (!fsl_ssi_is_ac97(ssi_private))
+   return -EINVAL;
}
 
stcr |= strcr;
srcr |= strcr;
 
-   if (ssi_private-cpu_dai_drv.symmetric_rates) {
-   /* Need to clear RXDIR when using SYNC mode */
+   if (ssi_private-cpu_dai_drv.symmetric_rates
+   || fsl_ssi_is_ac97(ssi_private)) {
+   /* Need to clear RXDIR when using SYNC or AC97 mode */
srcr = ~CCSR_SSI_SRCR_RXDIR;
scr |= CCSR_SSI_SCR_SYN;
}

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 5/6] ASoC: fsl_ssi: instantiate AC'97 CODEC

2015-06-28 Thread Maciej S. Szmigiero
Instantiate AC'97 CODEC in fsl_ssi driver AC'97 mode.

Signed-off-by: Maciej Szmigiero m...@maciej.szmigiero.name
---
 sound/soc/fsl/fsl_ssi.c |   21 +
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 0b4fcd9..e79dc16 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -1460,6 +1460,27 @@ done:
_fsl_ssi_set_dai_fmt(pdev-dev, ssi_private,
 ssi_private-dai_fmt);
 
+   if (fsl_ssi_is_ac97(ssi_private)) {
+   u32 ssi_idx;
+
+   ret = of_property_read_u32(np, cell-index, ssi_idx);
+   if (ret) {
+   dev_err(pdev-dev, cannot get SSI index property\n);
+   goto error_sound_card;
+   }
+
+   ssi_private-pdev =
+   platform_device_register_data(NULL,
+   ac97-codec, ssi_idx, NULL, 0);
+   if (IS_ERR(ssi_private-pdev)) {
+   ret = PTR_ERR(ssi_private-pdev);
+   dev_err(pdev-dev,
+   failed to register AC97 codec platform: %d\n,
+   ret);
+   goto error_sound_card;
+   }
+   }
+
return 0;
 
 error_sound_card:

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 4/6] ASoC: fsl_ssi: add AC'97 ops setting check and cleanup

2015-06-28 Thread Maciej S. Szmigiero
Check whether setting AC'97 ops succeeded and clean them
on removal so the fsl_ssi driver can be reloaded.

Signed-off-by: Maciej Szmigiero m...@maciej.szmigiero.name
---
 sound/soc/fsl/fsl_ssi.c |9 -
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index f3034b9..0b4fcd9 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -1340,7 +1340,11 @@ static int fsl_ssi_probe(struct platform_device *pdev)
 
fsl_ac97_data = ssi_private;
 
-   snd_soc_set_ac97_ops_of_reset(fsl_ssi_ac97_ops, pdev);
+   ret = snd_soc_set_ac97_ops_of_reset(fsl_ssi_ac97_ops, pdev);
+   if (ret) {
+   dev_err(pdev-dev, could not set AC'97 ops\n);
+   return ret;
+   }
} else {
/* Initialize this copy of the CPU DAI driver structure */
memcpy(ssi_private-cpu_dai_drv, fsl_ssi_dai_template,
@@ -1480,6 +1484,9 @@ static int fsl_ssi_remove(struct platform_device *pdev)
if (ssi_private-soc-imx)
fsl_ssi_imx_clean(pdev, ssi_private);
 
+   if (fsl_ssi_is_ac97(ssi_private))
+   snd_soc_set_ac97_ops(NULL);
+
return 0;
 }
 

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 3/6] ASoC: fsl_ssi: enable AC'97 asymmetric rates

2015-06-28 Thread Maciej S. Szmigiero
W dniu 28.06.2015 16:01, Timur Tabi pisze:
 Maciej S. Szmigiero wrote:
   /* Are the RX and the TX clocks locked? */
   if (!of_find_property(np, fsl,ssi-asynchronous, NULL)) {
 -ssi_private-cpu_dai_drv.symmetric_rates = 1;
 +if (!fsl_ssi_is_ac97(ssi_private))
 +ssi_private-cpu_dai_drv.symmetric_rates = 1;
 +
 
 Is this necessary?  Why not just add fsl,ssi-asynchronous to the AC97 device 
 tree node?

Because in the AC'97 mode the driver supports only one channel config and one 
sample format
anyway the remaining settings controlled by this property don't do anything.

Since it should be safe to enable asymmetric rates with any AC'97 CODEC I think 
it is good
to do it in driver than to add fsl,ssi-asynchronous to every AC'97 DT node.

Also the description of this property in fsl,ssi.txt looks like that it only 
makes sense in
non-AC'97 mode.

Best regards,
Maciej Szmigiero

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [v2,9/9] fsl/fman: Add FMan MAC driver

2015-06-28 Thread Michael Ellerman
On Thu, 2015-06-25 at 21:25 -0500, Scott Wood wrote:
 On Fri, 2015-06-26 at 12:21 +1000, Michael Ellerman wrote:
  On Thu, 2015-06-25 at 19:59 -0500, Scott Wood wrote:
   On Fri, 2015-06-26 at 01:06 +0200, Paul Bolle wrote:
(Evolution 3.16 is basically unbearable for replying to patches. 
Anyone
else running into this?) 
   
   If you mean the crazy lag when selecting moderate-to-large amounts of 
   text (for snipping), yes.
  
  I recommend the external editor plugin with vim.
 
 I tried the external editor plugin (not with vim) and it failed to bring the 
 externally made edits back into the evolution compose window.  It then 
 started spastically respawning the external editor without my doing anything.

I guess it only works with vim ;)

cheers


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[RESEND PATCH] powerpc/powernv: Fix vma page prot flags in opal-prd driver

2015-06-28 Thread Vaidyanathan Srinivasan
opal-prd driver will mmap() firmware code/data area as private
mapping to prd user space daemon.  Write to this page will
trigger COW faults.  The new COW pages are normal kernel RAM
pages accounted by the kernel and are not special.

vma-vm_page_prot value will be used at page fault time
for the new COW pages, while pgprot_t value passed in
remap_pfn_range() is used for the initial page table entry.

Hence:
* Do not add _PAGE_SPECIAL in vma, but only for remap_pfn_range()
* Also remap_pfn_range() will add the _PAGE_SPECIAL flag using
  pte_mkspecial() call, hence no need to specify in the driver

This fix resolves the page accounting warning shown below:
BUG: Bad rss-counter state mm:c007d34ac600 idx:1 val:19

The above warning is triggered since _PAGE_SPECIAL was incorrectly
being set for the normal kernel COW pages.

Signed-off-by: Vaidyanathan Srinivasan sva...@linux.vnet.ibm.com
---
 arch/powerpc/platforms/powernv/opal-prd.c |9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

Resending the patch for inclusion until we have a working solution
without PAGE_SPECIAL.

Kindly queue this patch to fix the mmap issue in opal-prd driver.
The next version/fix with vm_insert_page() will replace this code.
There is no API change on the driver side and hence no side effects of
including this fix until a better solution is available.

diff --git a/arch/powerpc/platforms/powernv/opal-prd.c 
b/arch/powerpc/platforms/powernv/opal-prd.c
index 46cb3fe..4ece8e4 100644
--- a/arch/powerpc/platforms/powernv/opal-prd.c
+++ b/arch/powerpc/platforms/powernv/opal-prd.c
@@ -112,6 +112,7 @@ static int opal_prd_open(struct inode *inode, struct file 
*file)
 static int opal_prd_mmap(struct file *file, struct vm_area_struct *vma)
 {
size_t addr, size;
+   pgprot_t page_prot;
int rc;
 
pr_devel(opal_prd_mmap(0x%016lx, 0x%016lx, 0x%lx, 0x%lx)\n,
@@ -125,13 +126,11 @@ static int opal_prd_mmap(struct file *file, struct 
vm_area_struct *vma)
if (!opal_prd_range_is_valid(addr, size))
return -EINVAL;
 
-   vma-vm_page_prot = __pgprot(pgprot_val(phys_mem_access_prot(file,
-   vma-vm_pgoff,
-size, vma-vm_page_prot))
-   | _PAGE_SPECIAL);
+   page_prot = phys_mem_access_prot(file, vma-vm_pgoff,
+size, vma-vm_page_prot);
 
rc = remap_pfn_range(vma, vma-vm_start, vma-vm_pgoff, size,
-   vma-vm_page_prot);
+   page_prot);
 
return rc;
 }

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [RESEND PATCH] powerpc/powernv: Fix vma page prot flags in opal-prd driver

2015-06-28 Thread Jeremy Kerr
Hi Vaidy,

 opal-prd driver will mmap() firmware code/data area as private
 mapping to prd user space daemon.  Write to this page will
 trigger COW faults.  The new COW pages are normal kernel RAM
 pages accounted by the kernel and are not special.
 
 vma-vm_page_prot value will be used at page fault time
 for the new COW pages, while pgprot_t value passed in
 remap_pfn_range() is used for the initial page table entry.
 
 Hence:
 * Do not add _PAGE_SPECIAL in vma, but only for remap_pfn_range()
 * Also remap_pfn_range() will add the _PAGE_SPECIAL flag using
   pte_mkspecial() call, hence no need to specify in the driver
 
 This fix resolves the page accounting warning shown below:
 BUG: Bad rss-counter state mm:c007d34ac600 idx:1 val:19
 
 The above warning is triggered since _PAGE_SPECIAL was incorrectly
 being set for the normal kernel COW pages.
 
 Signed-off-by: Vaidyanathan Srinivasan sva...@linux.vnet.ibm.com

Acked-by: Jeremy Kerr j...@ozlabs.org

Cheers,


Jeremy

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev