All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] bus: mvebu-mbus: Provide stub function for mvebu_mbus_get_io_win_info()
@ 2016-08-29 11:04 Stefan Roese
  2016-08-29 11:04 ` [PATCH 2/2 v3] dmaengine: mv_xor: Add support for IO (PCIe) src/dst areas Stefan Roese
  2016-08-29 12:57 ` [PATCH 1/2] bus: mvebu-mbus: Provide stub function for mvebu_mbus_get_io_win_info() Andrew Lunn
  0 siblings, 2 replies; 8+ messages in thread
From: Stefan Roese @ 2016-08-29 11:04 UTC (permalink / raw)
  To: linux-arm-kernel

This patch provides a stub function for mvebu_mbus_get_io_win_info(),
which will be used for all non-Orion (ARM32 MVEBU) platforms for
compile test coverage.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Marcin Wojtas <mw@semihalf.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Vinod Koul <vinod.koul@intel.com>
---
 include/linux/mbus.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/linux/mbus.h b/include/linux/mbus.h
index d610232..a884405 100644
--- a/include/linux/mbus.h
+++ b/include/linux/mbus.h
@@ -55,6 +55,8 @@ struct mbus_dram_target_info
 #ifdef CONFIG_PLAT_ORION
 extern const struct mbus_dram_target_info *mv_mbus_dram_info(void);
 extern const struct mbus_dram_target_info *mv_mbus_dram_info_nooverlap(void);
+int mvebu_mbus_get_io_win_info(phys_addr_t phyaddr, u32 *size, u8 *target,
+			       u8 *attr);
 #else
 static inline const struct mbus_dram_target_info *mv_mbus_dram_info(void)
 {
@@ -64,14 +66,17 @@ static inline const struct mbus_dram_target_info *mv_mbus_dram_info_nooverlap(vo
 {
 	return NULL;
 }
+static inline int mvebu_mbus_get_io_win_info(phys_addr_t phyaddr, u32 *size,
+					     u8 *target, u8 *attr)
+{
+	return 0;
+}
 #endif
 
 int mvebu_mbus_save_cpu_target(u32 __iomem *store_addr);
 void mvebu_mbus_get_pcie_mem_aperture(struct resource *res);
 void mvebu_mbus_get_pcie_io_aperture(struct resource *res);
 int mvebu_mbus_get_dram_win_info(phys_addr_t phyaddr, u8 *target, u8 *attr);
-int mvebu_mbus_get_io_win_info(phys_addr_t phyaddr, u32 *size, u8 *target,
-			       u8 *attr);
 int mvebu_mbus_add_window_remap_by_id(unsigned int target,
 				      unsigned int attribute,
 				      phys_addr_t base, size_t size,
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2 v3] dmaengine: mv_xor: Add support for IO (PCIe) src/dst areas
  2016-08-29 11:04 [PATCH 1/2] bus: mvebu-mbus: Provide stub function for mvebu_mbus_get_io_win_info() Stefan Roese
@ 2016-08-29 11:04 ` Stefan Roese
  2016-08-29 12:57 ` [PATCH 1/2] bus: mvebu-mbus: Provide stub function for mvebu_mbus_get_io_win_info() Andrew Lunn
  1 sibling, 0 replies; 8+ messages in thread
From: Stefan Roese @ 2016-08-29 11:04 UTC (permalink / raw)
  To: linux-arm-kernel

To enable the access to a specific area, the MVEBU XOR controllers needs
to have this area enabled / mapped via an address window. Right now,
only the DRAM memory area is enabled via such memory windows. So
using this driver to DMA to / from a e.g. PCIe memory region is
currently not supported.

This patch now adds support for such PCIe / IO regions by checking
if the src / dst address is located in an IO memory area in contrast
to being located in DRAM. This is done by using the newly introduced
MBus function mvebu_mbus_get_io_win_info(). If the src / dst address
is located in such an IO area, a new address window is created in
the XOR DMA controller. Enabling the controller to access this area.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Marcin Wojtas <mw@semihalf.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Vinod Koul <vinod.koul@intel.com>
---
v2 -> v3:
- Included separate patch to add a stub function for mvebu_mbus_get_io_win_info()
  to this patch series
- COMPILE_TEST added again, as the stub function now allows compilation on
  all platforms

v1 -> v2:
- Removed COMPILE_TEST from Kconfig entry as this results in compilation
  errors on non-Marvell platforms because of references to MBus driver
  functions. Since this driver will never be used on non-Marvell platforms
  this should be okay.

RFC -> v1:
- Use a cache for the already mapped areas for performance reasons, as
  the MMIO registers don't need to get queried any more if the area is
  already mapped now

 drivers/dma/mv_xor.c | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 drivers/dma/mv_xor.h |  7 ++++
 2 files changed, 97 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index f4c9f98..0162750 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -470,12 +470,86 @@ static int mv_xor_alloc_chan_resources(struct dma_chan *chan)
 	return mv_chan->slots_allocated ? : -ENOMEM;
 }
 
+/*
+ * Check if source or destination is an PCIe/IO address (non-SDRAM) and add
+ * a new MBus window if necessary. Use a cache for these check so that
+ * the MMIO mapped registers don't have to be accessed for this check
+ * to speed up this process.
+ */
+static int mv_xor_add_io_win(struct mv_xor_chan *mv_chan, u32 addr)
+{
+	struct mv_xor_device *xordev = mv_chan->xordev;
+	void __iomem *base = mv_chan->mmr_high_base;
+	u32 win_enable;
+	u32 size;
+	u8 target, attr;
+	int ret;
+	int i;
+
+	/*
+	 * Loop over the cached windows to check, if the requested area
+	 * is already mapped. If this the case, nothing needs to be done
+	 * and we can return.
+	 */
+	for (i = 0; i < WINDOW_COUNT; i++) {
+		if (addr >= xordev->win_start[i] &&
+		    addr <= xordev->win_end[i]) {
+			/* Window is already mapped */
+			return 0;
+		}
+	}
+
+	/*
+	 * The window is not mapped, so we need to create the new mapping
+	 */
+
+	/* If no IO window is found that addr has to be located in SDRAM */
+	ret = mvebu_mbus_get_io_win_info(addr, &size, &target, &attr);
+	if (ret < 0)
+		return 0;
+
+	/*
+	 * Mask the base addr 'addr' according to 'size' read back from the
+	 * MBus window. Otherwise we might end up with an address located
+	 * somewhere in the middle of this area here.
+	 */
+	size -= 1;
+	addr &= ~size;
+
+	/*
+	 * Reading one of both enabled register is enough, as they are always
+	 * programmed to the identical values
+	 */
+	win_enable = readl(base + WINDOW_BAR_ENABLE(0));
+
+	/* Set 'i' to the first free window to write the new values to */
+	i = ffs(~win_enable) - 1;
+	if (i >= WINDOW_COUNT)
+		return -ENOMEM;
+
+	writel((addr & 0xffff0000) | (attr << 8) | target,
+	       base + WINDOW_BASE(i));
+	writel(size & 0xffff0000, base + WINDOW_SIZE(i));
+
+	/* Fill the caching variables for later use */
+	xordev->win_start[i] = addr;
+	xordev->win_end[i] = addr + size;
+
+	win_enable |= (1 << i);
+	win_enable |= 3 << (16 + (2 * i));
+	writel(win_enable, base + WINDOW_BAR_ENABLE(0));
+	writel(win_enable, base + WINDOW_BAR_ENABLE(1));
+
+	return 0;
+}
+
 static struct dma_async_tx_descriptor *
 mv_xor_prep_dma_xor(struct dma_chan *chan, dma_addr_t dest, dma_addr_t *src,
 		    unsigned int src_cnt, size_t len, unsigned long flags)
 {
 	struct mv_xor_chan *mv_chan = to_mv_xor_chan(chan);
 	struct mv_xor_desc_slot *sw_desc;
+	int ret;
 
 	if (unlikely(len < MV_XOR_MIN_BYTE_COUNT))
 		return NULL;
@@ -486,6 +560,11 @@ mv_xor_prep_dma_xor(struct dma_chan *chan, dma_addr_t dest, dma_addr_t *src,
 		"%s src_cnt: %d len: %zu dest %pad flags: %ld\n",
 		__func__, src_cnt, len, &dest, flags);
 
+	/* Check if a new window needs to get added for 'dest' */
+	ret = mv_xor_add_io_win(mv_chan, dest);
+	if (ret)
+		return NULL;
+
 	sw_desc = mv_chan_alloc_slot(mv_chan);
 	if (sw_desc) {
 		sw_desc->type = DMA_XOR;
@@ -493,8 +572,13 @@ mv_xor_prep_dma_xor(struct dma_chan *chan, dma_addr_t dest, dma_addr_t *src,
 		mv_desc_init(sw_desc, dest, len, flags);
 		if (mv_chan->op_in_desc == XOR_MODE_IN_DESC)
 			mv_desc_set_mode(sw_desc);
-		while (src_cnt--)
+		while (src_cnt--) {
+			/* Check if a new window needs to get added for 'src' */
+			ret = mv_xor_add_io_win(mv_chan, src[src_cnt]);
+			if (ret)
+				return NULL;
 			mv_desc_set_src_addr(sw_desc, src_cnt, src[src_cnt]);
+		}
 	}
 
 	dev_dbg(mv_chan_to_devp(mv_chan),
@@ -959,6 +1043,7 @@ mv_xor_channel_add(struct mv_xor_device *xordev,
 		mv_chan->op_in_desc = XOR_MODE_IN_DESC;
 
 	dma_dev = &mv_chan->dmadev;
+	mv_chan->xordev = xordev;
 
 	/*
 	 * These source and destination dummy buffers are used to implement
@@ -1086,6 +1171,10 @@ mv_xor_conf_mbus_windows(struct mv_xor_device *xordev,
 		       dram->mbus_dram_target_id, base + WINDOW_BASE(i));
 		writel((cs->size - 1) & 0xffff0000, base + WINDOW_SIZE(i));
 
+		/* Fill the caching variables for later use */
+		xordev->win_start[i] = cs->base;
+		xordev->win_end[i] = cs->base + cs->size - 1;
+
 		win_enable |= (1 << i);
 		win_enable |= 3 << (16 + (2 * i));
 	}
diff --git a/drivers/dma/mv_xor.h b/drivers/dma/mv_xor.h
index bf56e08..88eeab2 100644
--- a/drivers/dma/mv_xor.h
+++ b/drivers/dma/mv_xor.h
@@ -80,12 +80,17 @@
 #define WINDOW_BAR_ENABLE(chan)	(0x40 + ((chan) << 2))
 #define WINDOW_OVERRIDE_CTRL(chan)	(0xA0 + ((chan) << 2))
 
+#define WINDOW_COUNT		8
+
 struct mv_xor_device {
 	void __iomem	     *xor_base;
 	void __iomem	     *xor_high_base;
 	struct clk	     *clk;
 	struct mv_xor_chan   *channels[MV_XOR_MAX_CHANNELS];
 	int		     xor_type;
+
+	u32                  win_start[WINDOW_COUNT];
+	u32                  win_end[WINDOW_COUNT];
 };
 
 /**
@@ -127,6 +132,8 @@ struct mv_xor_chan {
 	char			dummy_dst[MV_XOR_MIN_BYTE_COUNT];
 	dma_addr_t		dummy_src_addr, dummy_dst_addr;
 	u32                     saved_config_reg, saved_int_mask_reg;
+
+	struct mv_xor_device	*xordev;
 };
 
 /**
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 1/2] bus: mvebu-mbus: Provide stub function for mvebu_mbus_get_io_win_info()
  2016-08-29 11:04 [PATCH 1/2] bus: mvebu-mbus: Provide stub function for mvebu_mbus_get_io_win_info() Stefan Roese
  2016-08-29 11:04 ` [PATCH 2/2 v3] dmaengine: mv_xor: Add support for IO (PCIe) src/dst areas Stefan Roese
@ 2016-08-29 12:57 ` Andrew Lunn
  2016-08-29 13:54   ` Stefan Roese
  2016-08-29 14:02   ` Gregory CLEMENT
  1 sibling, 2 replies; 8+ messages in thread
From: Andrew Lunn @ 2016-08-29 12:57 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Aug 29, 2016 at 01:04:55PM +0200, Stefan Roese wrote:
> This patch provides a stub function for mvebu_mbus_get_io_win_info(),
> which will be used for all non-Orion (ARM32 MVEBU) platforms for
> compile test coverage.
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Marcin Wojtas <mw@semihalf.com>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Vinod Koul <vinod.koul@intel.com>
> ---
>  include/linux/mbus.h | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/mbus.h b/include/linux/mbus.h
> index d610232..a884405 100644
> --- a/include/linux/mbus.h
> +++ b/include/linux/mbus.h
> @@ -55,6 +55,8 @@ struct mbus_dram_target_info
>  #ifdef CONFIG_PLAT_ORION
>  extern const struct mbus_dram_target_info *mv_mbus_dram_info(void);
>  extern const struct mbus_dram_target_info *mv_mbus_dram_info_nooverlap(void);
> +int mvebu_mbus_get_io_win_info(phys_addr_t phyaddr, u32 *size, u8 *target,
> +			       u8 *attr);
>  #else
>  static inline const struct mbus_dram_target_info *mv_mbus_dram_info(void)
>  {
> @@ -64,14 +66,17 @@ static inline const struct mbus_dram_target_info *mv_mbus_dram_info_nooverlap(vo
>  {
>  	return NULL;
>  }
> +static inline int mvebu_mbus_get_io_win_info(phys_addr_t phyaddr, u32 *size,
> +					     u8 *target, u8 *attr)
> +{
> +	return 0;
> +}
>  #endif

Hi Stefan

If i understand it correctly, this should never be used for real, it
is here only for compile testing?

Maybe add a WARN_ON_ONCE(1) here? And a comment, why it should never
happen.

Thanks

      Andrew

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] bus: mvebu-mbus: Provide stub function for mvebu_mbus_get_io_win_info()
  2016-08-29 12:57 ` [PATCH 1/2] bus: mvebu-mbus: Provide stub function for mvebu_mbus_get_io_win_info() Andrew Lunn
@ 2016-08-29 13:54   ` Stefan Roese
  2016-08-29 14:02   ` Gregory CLEMENT
  1 sibling, 0 replies; 8+ messages in thread
From: Stefan Roese @ 2016-08-29 13:54 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Andrew,

On 29.08.2016 14:57, Andrew Lunn wrote:
> On Mon, Aug 29, 2016 at 01:04:55PM +0200, Stefan Roese wrote:
>> This patch provides a stub function for mvebu_mbus_get_io_win_info(),
>> which will be used for all non-Orion (ARM32 MVEBU) platforms for
>> compile test coverage.
>>
>> Signed-off-by: Stefan Roese <sr@denx.de>
>> Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
>> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
>> Cc: Marcin Wojtas <mw@semihalf.com>
>> Cc: Arnd Bergmann <arnd@arndb.de>
>> Cc: Vinod Koul <vinod.koul@intel.com>
>> ---
>>  include/linux/mbus.h | 9 +++++++--
>>  1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/linux/mbus.h b/include/linux/mbus.h
>> index d610232..a884405 100644
>> --- a/include/linux/mbus.h
>> +++ b/include/linux/mbus.h
>> @@ -55,6 +55,8 @@ struct mbus_dram_target_info
>>  #ifdef CONFIG_PLAT_ORION
>>  extern const struct mbus_dram_target_info *mv_mbus_dram_info(void);
>>  extern const struct mbus_dram_target_info *mv_mbus_dram_info_nooverlap(void);
>> +int mvebu_mbus_get_io_win_info(phys_addr_t phyaddr, u32 *size, u8 *target,
>> +			       u8 *attr);
>>  #else
>>  static inline const struct mbus_dram_target_info *mv_mbus_dram_info(void)
>>  {
>> @@ -64,14 +66,17 @@ static inline const struct mbus_dram_target_info *mv_mbus_dram_info_nooverlap(vo
>>  {
>>  	return NULL;
>>  }
>> +static inline int mvebu_mbus_get_io_win_info(phys_addr_t phyaddr, u32 *size,
>> +					     u8 *target, u8 *attr)
>> +{
>> +	return 0;
>> +}
>>  #endif
>
> Hi Stefan
>
> If i understand it correctly, this should never be used for real, it
> is here only for compile testing?

Correct.

> Maybe add a WARN_ON_ONCE(1) here? And a comment, why it should never
> happen.

Yes, I could do this. I (as others too) just followed this example here:

git ID 63a9332b "ARM: Orion: Get address map from plat-orion instead
of via platform_data"

Should I add these WARN_ON_ONCE(1) macros to the other stub functions
in this header as well? Perhaps as a new 3rd patch in this series?

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] bus: mvebu-mbus: Provide stub function for mvebu_mbus_get_io_win_info()
  2016-08-29 12:57 ` [PATCH 1/2] bus: mvebu-mbus: Provide stub function for mvebu_mbus_get_io_win_info() Andrew Lunn
  2016-08-29 13:54   ` Stefan Roese
@ 2016-08-29 14:02   ` Gregory CLEMENT
  2016-08-29 14:57     ` Andrew Lunn
  2016-08-29 17:40     ` Stefan Roese
  1 sibling, 2 replies; 8+ messages in thread
From: Gregory CLEMENT @ 2016-08-29 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Andrew,
 
 On lun., ao?t 29 2016, Andrew Lunn <andrew@lunn.ch> wrote:

> On Mon, Aug 29, 2016 at 01:04:55PM +0200, Stefan Roese wrote:
>> This patch provides a stub function for mvebu_mbus_get_io_win_info(),
>> which will be used for all non-Orion (ARM32 MVEBU) platforms for
>> compile test coverage.
>> 
>> Signed-off-by: Stefan Roese <sr@denx.de>
>> Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
>> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
>> Cc: Marcin Wojtas <mw@semihalf.com>
>> Cc: Arnd Bergmann <arnd@arndb.de>
>> Cc: Vinod Koul <vinod.koul@intel.com>
>> ---
>>  include/linux/mbus.h | 9 +++++++--
>>  1 file changed, 7 insertions(+), 2 deletions(-)
>> 
>> diff --git a/include/linux/mbus.h b/include/linux/mbus.h
>> index d610232..a884405 100644
>> --- a/include/linux/mbus.h
>> +++ b/include/linux/mbus.h
>> @@ -55,6 +55,8 @@ struct mbus_dram_target_info
>>  #ifdef CONFIG_PLAT_ORION
>>  extern const struct mbus_dram_target_info *mv_mbus_dram_info(void);
>>  extern const struct mbus_dram_target_info *mv_mbus_dram_info_nooverlap(void);
>> +int mvebu_mbus_get_io_win_info(phys_addr_t phyaddr, u32 *size, u8 *target,
>> +			       u8 *attr);
>>  #else
>>  static inline const struct mbus_dram_target_info *mv_mbus_dram_info(void)
>>  {
>> @@ -64,14 +66,17 @@ static inline const struct mbus_dram_target_info *mv_mbus_dram_info_nooverlap(vo
>>  {
>>  	return NULL;
>>  }
>> +static inline int mvebu_mbus_get_io_win_info(phys_addr_t phyaddr, u32 *size,
>> +					     u8 *target, u8 *attr)
>> +{
>> +	return 0;
>> +}
>>  #endif
>
> Hi Stefan
>
> If i understand it correctly, this should never be used for real, it
> is here only for compile testing?
>
> Maybe add a WARN_ON_ONCE(1) here? And a comment, why it should never
> happen.

Actually arm64 mvebu SoC such as the Armada 3700 do not have mbus bus
but can still reuse the same driver than the other mvebu SoC. So in
this case I would prefer that the function return an error.


Thanks,

Gregory

>
> Thanks
>
>       Andrew

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] bus: mvebu-mbus: Provide stub function for mvebu_mbus_get_io_win_info()
  2016-08-29 14:02   ` Gregory CLEMENT
@ 2016-08-29 14:57     ` Andrew Lunn
  2016-08-29 17:40     ` Stefan Roese
  1 sibling, 0 replies; 8+ messages in thread
From: Andrew Lunn @ 2016-08-29 14:57 UTC (permalink / raw)
  To: linux-arm-kernel

> Actually arm64 mvebu SoC such as the Armada 3700 do not have mbus bus
> but can still reuse the same driver than the other mvebu SoC. So in
> this case I would prefer that the function return an error.

O.K. An error would be good, assuming the code actually catches it.
I think the code change in patch [2/2] did not catch the error.

  Andrew

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] bus: mvebu-mbus: Provide stub function for mvebu_mbus_get_io_win_info()
  2016-08-29 14:02   ` Gregory CLEMENT
  2016-08-29 14:57     ` Andrew Lunn
@ 2016-08-29 17:40     ` Stefan Roese
  2016-08-31 15:23       ` Gregory CLEMENT
  1 sibling, 1 reply; 8+ messages in thread
From: Stefan Roese @ 2016-08-29 17:40 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Gregory,

On 29.08.2016 16:02, Gregory CLEMENT wrote:
>  On lun., ao?t 29 2016, Andrew Lunn <andrew@lunn.ch> wrote:
>
>> On Mon, Aug 29, 2016 at 01:04:55PM +0200, Stefan Roese wrote:
>>> This patch provides a stub function for mvebu_mbus_get_io_win_info(),
>>> which will be used for all non-Orion (ARM32 MVEBU) platforms for
>>> compile test coverage.
>>>
>>> Signed-off-by: Stefan Roese <sr@denx.de>
>>> Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
>>> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
>>> Cc: Marcin Wojtas <mw@semihalf.com>
>>> Cc: Arnd Bergmann <arnd@arndb.de>
>>> Cc: Vinod Koul <vinod.koul@intel.com>
>>> ---
>>>  include/linux/mbus.h | 9 +++++++--
>>>  1 file changed, 7 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/include/linux/mbus.h b/include/linux/mbus.h
>>> index d610232..a884405 100644
>>> --- a/include/linux/mbus.h
>>> +++ b/include/linux/mbus.h
>>> @@ -55,6 +55,8 @@ struct mbus_dram_target_info
>>>  #ifdef CONFIG_PLAT_ORION
>>>  extern const struct mbus_dram_target_info *mv_mbus_dram_info(void);
>>>  extern const struct mbus_dram_target_info *mv_mbus_dram_info_nooverlap(void);
>>> +int mvebu_mbus_get_io_win_info(phys_addr_t phyaddr, u32 *size, u8 *target,
>>> +			       u8 *attr);
>>>  #else
>>>  static inline const struct mbus_dram_target_info *mv_mbus_dram_info(void)
>>>  {
>>> @@ -64,14 +66,17 @@ static inline const struct mbus_dram_target_info *mv_mbus_dram_info_nooverlap(vo
>>>  {
>>>  	return NULL;
>>>  }
>>> +static inline int mvebu_mbus_get_io_win_info(phys_addr_t phyaddr, u32 *size,
>>> +					     u8 *target, u8 *attr)
>>> +{
>>> +	return 0;
>>> +}
>>>  #endif
>>
>> Hi Stefan
>>
>> If i understand it correctly, this should never be used for real, it
>> is here only for compile testing?
>>
>> Maybe add a WARN_ON_ONCE(1) here? And a comment, why it should never
>> happen.
>
> Actually arm64 mvebu SoC such as the Armada 3700 do not have mbus bus
> but can still reuse the same driver than the other mvebu SoC. So in
> this case I would prefer that the function return an error.

I missed thinking about Armada 3700 while adding this IO (PCIe) support
to the XOR DMA driver. Most likely because the Armada 3700 support was
added after I started working on this IO (non SDRAM) DMA support for
Armada XP.

Its probably not possible to support these IO (PCIe) areas on Armada
3700 this way without any information from the MBus mapping as
possible for the other ARM32 SoCs. So its perhaps best if I just
disable this "feature" for Armada 3700 for now.

What do you think?

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] bus: mvebu-mbus: Provide stub function for mvebu_mbus_get_io_win_info()
  2016-08-29 17:40     ` Stefan Roese
@ 2016-08-31 15:23       ` Gregory CLEMENT
  0 siblings, 0 replies; 8+ messages in thread
From: Gregory CLEMENT @ 2016-08-31 15:23 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Stefan,
 
 On lun., ao?t 29 2016, Stefan Roese <sr@denx.de> wrote:

> Hi Gregory,
>
> On 29.08.2016 16:02, Gregory CLEMENT wrote:
>>  On lun., ao?t 29 2016, Andrew Lunn <andrew@lunn.ch> wrote:
>>
>>> On Mon, Aug 29, 2016 at 01:04:55PM +0200, Stefan Roese wrote:
>>>> This patch provides a stub function for mvebu_mbus_get_io_win_info(),
>>>> which will be used for all non-Orion (ARM32 MVEBU) platforms for
>>>> compile test coverage.
>>>>
>>>> Signed-off-by: Stefan Roese <sr@denx.de>
>>>> Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
>>>> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
>>>> Cc: Marcin Wojtas <mw@semihalf.com>
>>>> Cc: Arnd Bergmann <arnd@arndb.de>
>>>> Cc: Vinod Koul <vinod.koul@intel.com>
>>>> ---
>>>>  include/linux/mbus.h | 9 +++++++--
>>>>  1 file changed, 7 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/include/linux/mbus.h b/include/linux/mbus.h
>>>> index d610232..a884405 100644
>>>> --- a/include/linux/mbus.h
>>>> +++ b/include/linux/mbus.h
>>>> @@ -55,6 +55,8 @@ struct mbus_dram_target_info
>>>>  #ifdef CONFIG_PLAT_ORION
>>>>  extern const struct mbus_dram_target_info *mv_mbus_dram_info(void);
>>>>  extern const struct mbus_dram_target_info *mv_mbus_dram_info_nooverlap(void);
>>>> +int mvebu_mbus_get_io_win_info(phys_addr_t phyaddr, u32 *size, u8 *target,
>>>> +			       u8 *attr);
>>>>  #else
>>>>  static inline const struct mbus_dram_target_info *mv_mbus_dram_info(void)
>>>>  {
>>>> @@ -64,14 +66,17 @@ static inline const struct mbus_dram_target_info *mv_mbus_dram_info_nooverlap(vo
>>>>  {
>>>>  	return NULL;
>>>>  }
>>>> +static inline int mvebu_mbus_get_io_win_info(phys_addr_t phyaddr, u32 *size,
>>>> +					     u8 *target, u8 *attr)
>>>> +{
>>>> +	return 0;
>>>> +}
>>>>  #endif
>>>
>>> Hi Stefan
>>>
>>> If i understand it correctly, this should never be used for real, it
>>> is here only for compile testing?
>>>
>>> Maybe add a WARN_ON_ONCE(1) here? And a comment, why it should never
>>> happen.
>>
>> Actually arm64 mvebu SoC such as the Armada 3700 do not have mbus bus
>> but can still reuse the same driver than the other mvebu SoC. So in
>> this case I would prefer that the function return an error.
>
> I missed thinking about Armada 3700 while adding this IO (PCIe) support
> to the XOR DMA driver. Most likely because the Armada 3700 support was
> added after I started working on this IO (non SDRAM) DMA support for
> Armada XP.
>
> Its probably not possible to support these IO (PCIe) areas on Armada
> 3700 this way without any information from the MBus mapping as
> possible for the other ARM32 SoCs. So its perhaps best if I just
> disable this "feature" for Armada 3700 for now.
>
> What do you think?

My concern to return an error with mbus was not for the XOR
driver. It was the neta driver that I had in mind (which was not
converted yet).

Thanks,

Gregory

>
> Thanks,
> Stefan

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-08-31 15:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-29 11:04 [PATCH 1/2] bus: mvebu-mbus: Provide stub function for mvebu_mbus_get_io_win_info() Stefan Roese
2016-08-29 11:04 ` [PATCH 2/2 v3] dmaengine: mv_xor: Add support for IO (PCIe) src/dst areas Stefan Roese
2016-08-29 12:57 ` [PATCH 1/2] bus: mvebu-mbus: Provide stub function for mvebu_mbus_get_io_win_info() Andrew Lunn
2016-08-29 13:54   ` Stefan Roese
2016-08-29 14:02   ` Gregory CLEMENT
2016-08-29 14:57     ` Andrew Lunn
2016-08-29 17:40     ` Stefan Roese
2016-08-31 15:23       ` Gregory CLEMENT

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.