LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Shivang Upadhyay <shivangu@linux.ibm.com>
To: Sourabh Jain <sourabhjain@linux.ibm.com>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Cc: maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com,
	chleroy@kernel.org, thuth@redhat.com,
	Aditya Gupta <adityag@linux.ibm.com>,
	Mahesh J Salgaonkar	 <mahesh@linux.ibm.com>
Subject: Re: [PATCH] powerpc/powernv: Cache OPAL check_token() results
Date: Mon, 22 Jun 2026 11:09:55 +0530	[thread overview]
Message-ID: <009aa525aaa33d5f64d291c53adf51bba55b4e16.camel@linux.ibm.com> (raw)
In-Reply-To: <31904199-2635-4c0d-a725-53665185fff8@linux.ibm.com>

Hi Sourabh,
Thanks for reviewing.

On Wed, 2026-06-03 at 09:22 +0530, Sourabh Jain wrote:
> Yes, it is a good idea to avoid making repetitive calls to check
> whether
> an OPAL call is supported by the firmware.
> 
> But it feels like it would have been better if skiboot itself
> advertised
> support for OPAL calls via the FDT, similar to how RTAS does.
> 
That's a good suggestion. I can take that up as future scope of
improvements.
> The current approach to finding supported OPAL calls is:
> 
> - Discover all supported OPAL calls during the first
> opal_check_token() 
> call.
> - From the second call onward, check whether discovery has already
> been
>    done, and then test the token in opal_token_cache.
> 
> The approach looks reasonable, but how about doing it this way
> instead:
> 
> Maintain a tri-state value for each OPAL call:
> 0 - Status needs to be check
> 1 - Supported
> -1 - Not supported
> 
this tri-state implementation, maybe would get little hard to
implement, along with how currently i've designed the test_token call. 

So currently on the first call it caches all the results. and then just
returns the output. But as per your suggestion, first one would have to
set all to -1, then set the result in the token that is being checked.

IMO, the current implementation is slightly more clean.

as per your concern with opal_token_cache_initialized, I think we can
instead look at jump_labels to solve this. First lookup is same, but
then we asm_patch the next lookup with nops. I think that would be best
of both worlds.

> 
> 
> >   
> > +/**
> > + * opal_token_cache_init - Initialize the OPAL token cache
> > + *
> > + * Called during opal_init() to populate the token cache by
> > querying
> > + * OPAL firmware for all tokens in the supported range.
> 
> Seems like the above comment is not correct. I don't see below
> function
> invoked from opal_init().
> 
yeah, I missed this. this was my first implementation. But turns out
alot of opal_calls actually happend before opal_init(). So i moved to 
opal_token_cache_initialized method.				     

Regards
~Shivang.


      reply	other threads:[~2026-06-22  5:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-01 11:25 [PATCH] powerpc/powernv: Cache OPAL check_token() results Shivang Upadhyay
2026-06-03  3:52 ` Sourabh Jain
2026-06-22  5:39   ` Shivang Upadhyay [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=009aa525aaa33d5f64d291c53adf51bba55b4e16.camel@linux.ibm.com \
    --to=shivangu@linux.ibm.com \
    --cc=adityag@linux.ibm.com \
    --cc=chleroy@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mahesh@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=sourabhjain@linux.ibm.com \
    --cc=thuth@redhat.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