public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "Tomasz Maciej Nowak" <tmn505@gmail.com>,
	"Rob Herring" <robh@kernel.org>,
	"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Kishon Vijay Abraham I" <kishon@ti.com>,
	"Vinod Koul" <vkoul@kernel.org>,
	"Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Marek Behún" <marek.behun@nic.cz>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/2] phy: marvell: comphy: Convert internal SMCC firmware return codes to errno
Date: Wed, 2 Sep 2020 19:45:05 +0200	[thread overview]
Message-ID: <20200902174505.wuflkak6dv57jxw6@pali> (raw)
In-Reply-To: <20200902172029.GG3050651@lunn.ch>

On Wednesday 02 September 2020 19:20:29 Andrew Lunn wrote:
> On Wed, Sep 02, 2020 at 07:05:25PM +0200, Pali Rohár wrote:
> > On Wednesday 02 September 2020 19:00:10 Andrew Lunn wrote:
> > > > > > +	switch (ret) {
> > > > > > +	case SMCCC_RET_SUCCESS:
> > > > > > +		return 0;
> > > > > > +	case SMCCC_RET_NOT_SUPPORTED:
> > > > > > +		return -EOPNOTSUPP;
> > > > > > +	default:
> > > > > > +		return -EINVAL;
> > > > > > +	}
> > > > > >  }
> > > > > 
> > > > > Hi Pali
> > > > > 
> > > > > Maybe this should be a global helper translating SMCCC_RET_* into a
> > > > > standard errno value?
> > > > > 
> > > > > 	 Andrew
> > > > 
> > > > Hello Andrew!
> > > > 
> > > > Well, I'm not sure if some standard global helper is the correct way for
> > > > marvell comphy handler. It returns 0 for success and -1 on error when
> > > > handler is not supported.
> > > 
> > > No, i was meaning just 
> > > 
> > > switch (ret) {
> > > case SMCCC_RET_SUCCESS:
> > > 	return 0;
> > > case SMCCC_RET_NOT_SUPPORTED:
> > > 	return -EOPNOTSUPP;
> > > default:
> > > 	return -EINVAL;
> > > }
> > 
> > But this is not a complete generic helper. There are more generic SMCC
> > return codes and generic helper should define and translate all of them.
> 
> /*
>  * Return codes defined in ARM DEN 0070A
>  * ARM DEN 0070A is now merged/consolidated into ARM DEN 0028 C
>  */
> #define SMCCC_RET_SUCCESS			0
> #define SMCCC_RET_NOT_SUPPORTED			-1
> #define SMCCC_RET_NOT_REQUIRED			-2
> #define SMCCC_RET_INVALID_PARAMETER		-3

Routines can use also other custom return codes. These are IIRC just
standard defined.

> I only see problems with SMCCC_RET_NOT_REQUIRED and what value to use
> for it. Do you have any idea what is actually means? A parameter was
> passed which was not required? Or that the call itself is not
> required? Looking at the uses of it currently in the kernel, it does
> not seem to be an actual error. So maybe just return 0?

I'm not sure. That is why I wrote that larger discussion about generic
helper is needed. There are for sure people who understand SMC better
and have deep insight.

For Marvell comphy we cannot use return code -2 as success like 0.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-09-02 17:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-02 14:43 [PATCH 0/2] PCI: aardvark: Fix comphy with old ATF Pali Rohár
2020-09-02 14:43 ` [PATCH 1/2] phy: marvell: comphy: Convert internal SMCC firmware return codes to errno Pali Rohár
2020-09-02 16:13   ` Andrew Lunn
2020-09-02 16:56     ` Pali Rohár
2020-09-02 17:00       ` Andrew Lunn
2020-09-02 17:05         ` Pali Rohár
2020-09-02 17:20           ` Andrew Lunn
2020-09-02 17:45             ` Pali Rohár [this message]
2020-09-30 18:17   ` Rob Herring
2020-09-02 14:43 ` [PATCH 2/2] PCI: aardvark: Fix initialization with old Marvell's Arm Trusted Firmware Pali Rohár
2020-09-30 18:17   ` Rob Herring
2020-09-16 15:14 ` [PATCH 0/2] PCI: aardvark: Fix comphy with old ATF Tomasz Maciej Nowak
2020-09-21 13:09   ` Pali Rohár
2020-10-02 12:00 ` Pali Rohár
2020-10-02 13:37 ` Lorenzo Pieralisi
2020-10-02 14:26   ` Pali Rohár
2020-10-02 14:38     ` Lorenzo Pieralisi
2020-10-02 14:52       ` Pali Rohár
2020-10-02 15:03         ` Lorenzo Pieralisi
2020-10-02 15:07           ` Pali Rohár
2020-10-02 15:15             ` Lorenzo Pieralisi
2020-10-02 15:20               ` Pali Rohár

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=20200902174505.wuflkak6dv57jxw6@pali \
    --to=pali@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=bhelgaas@google.com \
    --cc=kishon@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=marek.behun@nic.cz \
    --cc=miquel.raynal@bootlin.com \
    --cc=robh@kernel.org \
    --cc=tmn505@gmail.com \
    --cc=vkoul@kernel.org \
    /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