public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@amd.com>
To: Stefan Herbrechtsmeier
	<stefan.herbrechtsmeier-oss@weidmueller.com>,
	u-boot@lists.denx.de
Cc: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>,
	Ashok Reddy Soma <ashok.reddy.soma@amd.com>,
	Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Subject: Re: [PATCH v3 2/2] firmware: zynqmp: Move config object permission check
Date: Tue, 16 May 2023 13:43:27 +0200	[thread overview]
Message-ID: <03e36898-6144-9552-cce0-e5c4e9629adf@amd.com> (raw)
In-Reply-To: <46205a5c-f7dd-21c2-c5b4-246da76aeed5@weidmueller.com>



On 5/16/23 13:23, Stefan Herbrechtsmeier wrote:
> Hi,
> 
> Am 16.05.2023 um 10:26 schrieb Michal Simek:
> 
>> Hi,
>>
>> first of all sorry for delay.
>>
>> On 4/27/23 12:31, Stefan Herbrechtsmeier wrote:
>>> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
>>>
>>> Move the check of the permission to change a config object from
>>> zynqmp_pmufw_node function to zynqmp_pmufw_load_config_object function
>>> to simplify the code and check the permission only if required.
>>>
>>> Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
>>>
>>> ---
>>>
>>> Changes in v3:
>>> - Added
>>>
>>>   drivers/firmware/firmware-zynqmp.c | 32 +++++++++++++++---------------
>>>   1 file changed, 16 insertions(+), 16 deletions(-)
>>>
>>> diff --git a/drivers/firmware/firmware-zynqmp.c 
>>> b/drivers/firmware/firmware-zynqmp.c
>>> index 2b1ad5d2c3..d12159fa78 100644
>>> --- a/drivers/firmware/firmware-zynqmp.c
>>> +++ b/drivers/firmware/firmware-zynqmp.c
>>> @@ -70,20 +70,11 @@ int zynqmp_pmufw_config_close(void)
>>>     int zynqmp_pmufw_node(u32 id)
>>>   {
>>> -    static bool skip_config;
>>> -    int ret;
>>> -
>>> -    if (skip_config)
>>> -        return 0;
>>> -
>>>       /* Record power domain id */
>>>       xpm_configobject[NODE_ID_LOCATION] = id;
>>>   -    ret = zynqmp_pmufw_load_config_object(xpm_configobject,
>>> -                          sizeof(xpm_configobject));
>>> -
>>> -    if (ret == -EACCES && id == NODE_OCM_BANK_0)
>>> -        skip_config = true;
>>> +    zynqmp_pmufw_load_config_object(xpm_configobject,
>>> +                    sizeof(xpm_configobject));
>>
>> This is not right.
>> It should be
>> return zynqmp_pmufw_load... for error propagation.
> 
> At the moment the zynqmp_pmufw_node and zynqmp_pmufw_config_close doesn't return 
> an error. Should the zynqmp_pmufw_load_config_object return 0 or -EACCES if it 
> is skipped?

In context zynqmp_pmufw_node and it's dependency on returning EACESS for failure 
case which your code depends on here

+		if (zynqmp_pmufw_node(NODE_OCM_BANK_0) == -EACCES) {
+			printf("PMUFW:  No permission to change config object\n");
+			skip = true;
+		}


And for second part around skip and return code. I would say what you have is 
fine. It means returning -EACCES is appropriate here.

And as I see do_zynqmp_pmufw should also return that value. That command will 
simply fail if there is no permission.

And for close part I would say the same. Error should be propagated.
I expect current command behavior when you call "pmufw node close" on regular 
system will just pass but it should just fail because command wasn't successful.

Thanks,
Michal









      reply	other threads:[~2023-05-16 11:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-27 10:31 [PATCH v3 1/2] firmware: zynqmp: Remove extraordinary return value Stefan Herbrechtsmeier
2023-04-27 10:31 ` [PATCH v3 2/2] firmware: zynqmp: Move config object permission check Stefan Herbrechtsmeier
2023-05-16  8:26   ` Michal Simek
2023-05-16 11:23     ` Stefan Herbrechtsmeier
2023-05-16 11:43       ` Michal Simek [this message]

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=03e36898-6144-9552-cce0-e5c4e9629adf@amd.com \
    --to=michal.simek@amd.com \
    --cc=ashok.reddy.soma@amd.com \
    --cc=jay.buddhabhatti@amd.com \
    --cc=stefan.herbrechtsmeier-oss@weidmueller.com \
    --cc=stefan.herbrechtsmeier@weidmueller.com \
    --cc=u-boot@lists.denx.de \
    /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