Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1742829 > unrolled thread

Re: [2/2] hwmon: xgene: Support PCC shared memory in IO region

Started byGuenter Roeck <linux@roeck-us.net>
First post2017-10-01 16:40 +0200
Last post2017-10-01 21:50 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [2/2] hwmon: xgene: Support PCC shared memory in IO region Guenter Roeck <linux@roeck-us.net> - 2017-10-01 16:40 +0200
    Re: [2/2] hwmon: xgene: Support PCC shared memory in IO region Guenter Roeck <linux@roeck-us.net> - 2017-10-01 21:50 +0200

#1742829 — Re: [2/2] hwmon: xgene: Support PCC shared memory in IO region

FromGuenter Roeck <linux@roeck-us.net>
Date2017-10-01 16:40 +0200
SubjectRe: [2/2] hwmon: xgene: Support PCC shared memory in IO region
Message-ID<uvNzt-3j5-43@gated-at.bofh.it>
On Thu, Sep 21, 2017 at 10:17:10AM -0700, hotran wrote:
> As the PCC shared memory could be in IO region which doesn't
> support caching, this patch simply uses ioremap() for IO region.
> 
> Signed-off-by: Hoan Tran <hotran@apm.com>

Applied to hwmon-next.

Thanks,
Guenter

> ---
>  drivers/hwmon/xgene-hwmon.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hwmon/xgene-hwmon.c b/drivers/hwmon/xgene-hwmon.c
> index 5cd327e..2dac1ed 100644
> --- a/drivers/hwmon/xgene-hwmon.c
> +++ b/drivers/hwmon/xgene-hwmon.c
> @@ -32,6 +32,7 @@
>  #include <linux/kfifo.h>
>  #include <linux/mailbox_controller.h>
>  #include <linux/mailbox_client.h>
> +#include <linux/memblock.h>
>  #include <linux/module.h>
>  #include <linux/of.h>
>  #include <linux/platform_device.h>
> @@ -135,6 +136,14 @@ static u16 xgene_word_tst_and_clr(u16 *addr, u16 mask)
>  	return ret;
>  }
>  
> +static void __iomem *pcc_ioremap(phys_addr_t phys, size_t size)
> +{
> +	if (!memblock_is_memory(phys))
> +		return ioremap(phys, size);
> +
> +	return memremap(phys, size, MEMREMAP_WB);
> +}
> +
>  static int xgene_hwmon_pcc_rd(struct xgene_hwmon_dev *ctx, u32 *msg)
>  {
>  	struct acpi_pcct_shared_memory *generic_comm_base = ctx->pcc_comm_addr;
> @@ -690,9 +699,8 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
>  		 */
>  		ctx->comm_base_addr = cppc_ss->base_address;
>  		if (ctx->comm_base_addr) {
> -			ctx->pcc_comm_addr = memremap(ctx->comm_base_addr,
> -							cppc_ss->length,
> -							MEMREMAP_WB);
> +			ctx->pcc_comm_addr = pcc_ioremap(ctx->comm_base_addr,
> +							 cppc_ss->length);
>  		} else {
>  			dev_err(&pdev->dev, "Failed to get PCC comm region\n");
>  			rc = -ENODEV;

[toc] | [next] | [standalone]


#1742885

FromGuenter Roeck <linux@roeck-us.net>
Date2017-10-01 21:50 +0200
Message-ID<uvSps-6bk-19@gated-at.bofh.it>
In reply to#1742829
On Sun, Oct 01, 2017 at 07:31:32AM -0700, Guenter Roeck wrote:
> On Thu, Sep 21, 2017 at 10:17:10AM -0700, hotran wrote:
> > As the PCC shared memory could be in IO region which doesn't
> > support caching, this patch simply uses ioremap() for IO region.
> > 
> > Signed-off-by: Hoan Tran <hotran@apm.com>
> 
> Applied to hwmon-next.
> 
Turns out this doesn't work. memblock_is_memory() is not exported and marked
__init_memblock, and thus not qavailable for modules. Dropped.

Guenter

> Thanks,
> Guenter
> 
> > ---
> >  drivers/hwmon/xgene-hwmon.c | 14 +++++++++++---
> >  1 file changed, 11 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/hwmon/xgene-hwmon.c b/drivers/hwmon/xgene-hwmon.c
> > index 5cd327e..2dac1ed 100644
> > --- a/drivers/hwmon/xgene-hwmon.c
> > +++ b/drivers/hwmon/xgene-hwmon.c
> > @@ -32,6 +32,7 @@
> >  #include <linux/kfifo.h>
> >  #include <linux/mailbox_controller.h>
> >  #include <linux/mailbox_client.h>
> > +#include <linux/memblock.h>
> >  #include <linux/module.h>
> >  #include <linux/of.h>
> >  #include <linux/platform_device.h>
> > @@ -135,6 +136,14 @@ static u16 xgene_word_tst_and_clr(u16 *addr, u16 mask)
> >  	return ret;
> >  }
> >  
> > +static void __iomem *pcc_ioremap(phys_addr_t phys, size_t size)
> > +{
> > +	if (!memblock_is_memory(phys))
> > +		return ioremap(phys, size);
> > +
> > +	return memremap(phys, size, MEMREMAP_WB);
> > +}
> > +
> >  static int xgene_hwmon_pcc_rd(struct xgene_hwmon_dev *ctx, u32 *msg)
> >  {
> >  	struct acpi_pcct_shared_memory *generic_comm_base = ctx->pcc_comm_addr;
> > @@ -690,9 +699,8 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
> >  		 */
> >  		ctx->comm_base_addr = cppc_ss->base_address;
> >  		if (ctx->comm_base_addr) {
> > -			ctx->pcc_comm_addr = memremap(ctx->comm_base_addr,
> > -							cppc_ss->length,
> > -							MEMREMAP_WB);
> > +			ctx->pcc_comm_addr = pcc_ioremap(ctx->comm_base_addr,
> > +							 cppc_ss->length);
> >  		} else {
> >  			dev_err(&pdev->dev, "Failed to get PCC comm region\n");
> >  			rc = -ENODEV;

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web