public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: linux-arm-kernel@lists.infradead.org
Cc: Jeremy Linton <jeremy.linton@arm.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	Catalin Marinas <Catalin.Marinas@arm.com>,
	"rafael.j.wysocki@intel.com" <rafael.j.wysocki@intel.com>,
	"linux@prisktech.co.nz" <linux@prisktech.co.nz>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"stern@rowland.harvard.edu" <stern@rowland.harvard.edu>,
	"suravee.suthikulpanit@amd.com" <suravee.suthikulpanit@amd.com>
Subject: Re: [PATCH 2/3] Display a DMA error message
Date: Fri, 14 Aug 2015 23:56:46 +0200	[thread overview]
Message-ID: <3034536.ALogCXmi9A@wuerfel> (raw)
In-Reply-To: <55CE612C.4010405@arm.com>

On Friday 14 August 2015 16:44:12 Jeremy Linton wrote:
> On 08/14/2015 04:19 PM, Arnd Bergmann wrote:
> > On Wednesday 12 August 2015 16:51:29 Jeremy Linton wrote:
> >> diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
> >> index 2593def..82e396f 100644
> >> --- a/drivers/usb/host/ehci-platform.c
> >> +++ b/drivers/usb/host/ehci-platform.c
> >> @@ -162,8 +162,10 @@ static int ehci_platform_probe(struct platform_device *dev)
> >>
> >>          err = dma_coerce_mask_and_coherent(&dev->dev,
> >>                  pdata->dma_mask_64 ? DMA_BIT_MASK(64) : DMA_BIT_MASK(32));
> >> -       if (err)
> >> +       if (err) {
> >> +               dev_err(&dev->dev, "Error: DMA setup failed\n");
> >>                  return err;
> >> +       }
> >
> > We should really stop doing this: the platform should provide the
> > correct dma mask when creating the device, instead of setting a
> > bogus pdata field. Do not duplicate this bug for ACPI.
> 
> 
> I'm not sure I understand, I'm not changing the mask anywhere, all I'm 
> doing is printing a message if the mask cannot be set.

The problem is that dma_coerce_mask_and_coherent() is not a proper
interface for a driver to use, it's an annotation that tells us
that the driver is trying to do something horrible by overriding
the dma mask that was set by the platform.

> AKA if CCA is missing or set to 0 then, this line is triggered because 
> the dma_coerce_mask_and_coherent() routine returns with a failure 
> indicating there aren't any DMA ops to set a mask on. Right now what 
> happens is the device detection displays that there is an EHCI 
> controller then silently disappears with telling the user why it didn't 
> configure.

Adding a warning is fine, but the text is not right here (the driver is
not setting up the dma mask, but trying to override the one that has been
set up by the platform), and the solution should really be to not
call dma_coerce_mask_and_coherent() at all for ACPI. The main reason
that we have not removed this call here yet is that there is still a
MIPS platform that relies on it. We should probably remove it for DT
already and only do it if platform data was provided, but that requires
careful testing.

	Arnd

  reply	other threads:[~2015-08-14 21:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-12 21:51 [PATCH 0/3] Enable EHCI-platform driver for use with ACPI Jeremy Linton
2015-08-12 21:51 ` [PATCH 1/3] Honor ACPI _CCA attribute setting Jeremy Linton
2015-08-14  1:45   ` Suravee Suthikulpanit
     [not found]     ` <55CD4832.7070301-5C7GfCeVMHo@public.gmane.org>
2015-08-14 13:14       ` Catalin Marinas
2015-08-14 14:12       ` Jeremy Linton
     [not found]         ` <55CDF74C.3050703-5wv7dgnIgG8@public.gmane.org>
2015-08-18  3:36           ` Huang Shijie
     [not found] ` <1439416290-21228-1-git-send-email-jeremy.linton-5wv7dgnIgG8@public.gmane.org>
2015-08-12 21:51   ` [PATCH 2/3] Display a DMA error message Jeremy Linton
2015-08-13 11:02     ` Hanjun Guo
     [not found]     ` <1439416290-21228-3-git-send-email-jeremy.linton-5wv7dgnIgG8@public.gmane.org>
2015-08-13 14:52       ` Alan Stern
2015-08-14 21:19     ` Arnd Bergmann
2015-08-14 21:44       ` Jeremy Linton
2015-08-14 21:56         ` Arnd Bergmann [this message]
2015-08-12 21:51   ` [PATCH 3/3] Add ACPI bindings for the EHCI platform driver Jeremy Linton
2015-08-13 11:50     ` Hanjun Guo
2015-08-13 14:45       ` Jeremy Linton
     [not found]     ` <1439416290-21228-4-git-send-email-jeremy.linton-5wv7dgnIgG8@public.gmane.org>
2015-08-13 14:53       ` Alan Stern
     [not found]         ` <Pine.LNX.4.44L0.1508131049001.1277-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2015-08-13 15:13           ` Jeremy Linton
     [not found]             ` <55CCB428.1000404-5wv7dgnIgG8@public.gmane.org>
2015-08-18  3:35               ` Huang Shijie
2015-08-13  9:44   ` [PATCH 0/3] Enable EHCI-platform driver for use with ACPI Graeme Gregory

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3034536.ALogCXmi9A@wuerfel \
    --to=arnd@arndb.de \
    --cc=Catalin.Marinas@arm.com \
    --cc=jeremy.linton@arm.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@prisktech.co.nz \
    --cc=rafael.j.wysocki@intel.com \
    --cc=stern@rowland.harvard.edu \
    --cc=suravee.suthikulpanit@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox