linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC] powerpc/kernel: Don't check for dev->dma_mask in fsl_set_dma_mask
@ 2018-09-02 11:30 Darren Stevens
  2018-09-03  7:04 ` Christophe LEROY
  2018-10-20 23:19 ` Scott Wood
  0 siblings, 2 replies; 3+ messages in thread
From: Darren Stevens @ 2018-09-02 11:30 UTC (permalink / raw)
  To: linuxppc-dev, Christian Zigotzky, Julian Margetson, Scott Wood

[-- Attachment #1: Type: text/plain, Size: 178 bytes --]

  AmigaOS...........: http://yam.ch/
  Unix/MacOS/Windows: http://www.mozilla.com/thunderbird/

General information about MIME can be found at:
http://en.wikipedia.org/wiki/MIME

[-- Attachment #2: Type: text/plain, Size: 1037 bytes --]

To enable use of dma to all ram on a corenet generic system, we add the
function fsl_pci_dma_set_mask, and link it into the ppc.md structure.

But this function checks for the presence of dev->dma_mask and dma_ops
at entry, and fails if one or other are missing. Powerpc's dma_set_mask 
(which it is called from) doesn't check this until after it has set the 
dma_mask for pci devs, this difference shows up on a Cyrus (AmigaOne X5000)
- a soundblaster live pci card, will works properly if memory is limited 
to <4G, but fail on probe with the following message if the memory is >=4G

[    4.646531] snd_emu10k1 1000:04:04.0: architecture does not support PCI 
busmaster DMA with mask 0x7fffffff

Remove the dev->mask tests to make the routines behave similarly. 

Signed-off-by: Darren Stevens <darren@stevens-zone.net>

---

This fix looks wrong to me, although it works. The test needs to be removed,
moving it to the end of the function doesn't work either. This needs someone
with more knowledge of what's going on to take a look.

[-- Attachment #3: dma.patch --]
[-- Type: text/plain, Size: 551 bytes --]

diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 918be81..36b3c86 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -127,9 +127,6 @@ static inline void setup_swiotlb_ops(struct pci_controller *hose) {}
 
 static int fsl_pci_dma_set_mask(struct device *dev, u64 dma_mask)
 {
-	if (!dev->dma_mask || !dma_supported(dev, dma_mask))
-		return -EIO;
-
 	/*
 	 * Fix up PCI devices that are able to DMA to the large inbound
 	 * mapping that allows addressing any RAM address from across PCI.

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

* Re: [PATCH RFC] powerpc/kernel: Don't check for dev->dma_mask in fsl_set_dma_mask
  2018-09-02 11:30 [PATCH RFC] powerpc/kernel: Don't check for dev->dma_mask in fsl_set_dma_mask Darren Stevens
@ 2018-09-03  7:04 ` Christophe LEROY
  2018-10-20 23:19 ` Scott Wood
  1 sibling, 0 replies; 3+ messages in thread
From: Christophe LEROY @ 2018-09-03  7:04 UTC (permalink / raw)
  To: Darren Stevens, linuxppc-dev, Christian Zigotzky,
	Julian Margetson, Scott Wood

Hi,

Your patch should be sent as part of the message text and not as an 
attached file.

By sending as an attached file, patchwork doesn't handle it properly 
(all compilation tests fail) https://patchwork.ozlabs.org/patch/965082/

For reference, see 
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#no-mime-no-links-no-compression-no-attachments-just-plain-text

Christophe

Le 02/09/2018 à 13:30, Darren Stevens a écrit :
> To enable use of dma to all ram on a corenet generic system, we add the
> function fsl_pci_dma_set_mask, and link it into the ppc.md structure.
> 
> But this function checks for the presence of dev->dma_mask and dma_ops
> at entry, and fails if one or other are missing. Powerpc's dma_set_mask
> (which it is called from) doesn't check this until after it has set the
> dma_mask for pci devs, this difference shows up on a Cyrus (AmigaOne X5000)
> - a soundblaster live pci card, will works properly if memory is limited
> to <4G, but fail on probe with the following message if the memory is >=4G
> 
> [    4.646531] snd_emu10k1 1000:04:04.0: architecture does not support PCI
> busmaster DMA with mask 0x7fffffff
> 
> Remove the dev->mask tests to make the routines behave similarly.
> 
> Signed-off-by: Darren Stevens <darren@stevens-zone.net>
> 
> ---
> 
> This fix looks wrong to me, although it works. The test needs to be removed,
> moving it to the end of the function doesn't work either. This needs someone
> with more knowledge of what's going on to take a look.
> 

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

* Re: [PATCH RFC] powerpc/kernel: Don't check for dev->dma_mask in fsl_set_dma_mask
  2018-09-02 11:30 [PATCH RFC] powerpc/kernel: Don't check for dev->dma_mask in fsl_set_dma_mask Darren Stevens
  2018-09-03  7:04 ` Christophe LEROY
@ 2018-10-20 23:19 ` Scott Wood
  1 sibling, 0 replies; 3+ messages in thread
From: Scott Wood @ 2018-10-20 23:19 UTC (permalink / raw)
  To: Darren Stevens, linuxppc-dev, Christian Zigotzky,
	Julian Margetson

On Sun, 2018-09-02 at 12:30 +0100, Darren Stevens wrote:
> To enable use of dma to all ram on a corenet generic system, we add the
> function fsl_pci_dma_set_mask, and link it into the ppc.md structure.
> 
> But this function checks for the presence of dev->dma_mask and dma_ops
> at entry, and fails if one or other are missing. Powerpc's dma_set_mask 
> (which it is called from) doesn't check this until after it has set the 
> dma_mask for pci devs,

It's checking whether the dma_mask pointer is valid before storing into that
pointer.  The generic ppc dma_set_mask does check this before storing into it.
   All it does before that check is to look for an alternative dma_set_mask
implementation.

Is the test failing on dma_mask or dma_supported?  If the latter, what are the
dma ops set to?

Can you check whether the problem still exists after commit
ff69279a44e9ba876466 ("powerpc: disable support for relative ksymtab
references")?

-Scott


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

end of thread, other threads:[~2018-10-20 23:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-02 11:30 [PATCH RFC] powerpc/kernel: Don't check for dev->dma_mask in fsl_set_dma_mask Darren Stevens
2018-09-03  7:04 ` Christophe LEROY
2018-10-20 23:19 ` Scott Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).