lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230929112736.iribjiwzk5wszb4k@bogus>
Date:   Fri, 29 Sep 2023 12:27:36 +0100
From:   Sudeep Holla <sudeep.holla@....com>
To:     "lihuisong (C)" <lihuisong@...wei.com>
Cc:     rafael@...nel.org, rafael.j.wysocki@...el.com,
        xuwei5@...ilicon.com, Sudeep Holla <sudeep.holla@....com>,
        linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
        soc@...nel.org, linux-arm-kernel@...ts.infradead.org,
        liuyonglong@...wei.com
Subject: Re: [PATCH v2 2/2] soc: kunpeng_hccs: add the check for PCC subspace
 type

On Thu, Sep 21, 2023 at 10:27:36AM +0800, lihuisong (C) wrote:
> 
> 在 2023/9/20 22:11, Sudeep Holla 写道:
> > On Wed, Sep 20, 2023 at 02:47:03PM +0800, Huisong Li wrote:
> > > Currently, HCCS driver directly uses Generic Communications Channel Shared
> > > Memory Region which is used in type0/1/2 to communicate with platform,
> > > but actually doesn't support type3/4/5.
> > > So this patch adds the check for PCC subspace type.
> > > 
> > > Signed-off-by: Huisong Li <lihuisong@...wei.com>
> > > ---
> > >   drivers/soc/hisilicon/kunpeng_hccs.c | 17 +++++++++++++++++
> > >   1 file changed, 17 insertions(+)
> > > 
> > > diff --git a/drivers/soc/hisilicon/kunpeng_hccs.c b/drivers/soc/hisilicon/kunpeng_hccs.c
> > > index f3810d9d1caa..4ba3bfd45a01 100644
> > > --- a/drivers/soc/hisilicon/kunpeng_hccs.c
> > > +++ b/drivers/soc/hisilicon/kunpeng_hccs.c
> > > @@ -174,6 +174,19 @@ static int hccs_register_pcc_channel(struct hccs_dev *hdev)
> > >   	return rc;
> > >   }
> > > +static int hccs_check_pcc_info(struct hccs_dev *hdev)
> > > +{
> > > +	struct pcc_mbox_chan *pcc_chan = hdev->cl_info.pcc_chan;
> > > +
> > > +	if (pcc_chan->type >= ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE) {
> > > +		dev_err(hdev->dev, "unsupport for subspace type%u.\n",
> > > +			pcc_chan->type);
> > > +		return -EOPNOTSUPP;
> > > +	}
> > Is this the only use of the PCC type information you have or do you plan to
> > use it for something other than the validation.
> Yeah, it is just validation now. we want to plan this driver can support
> more types.

OK

> > 
> > Just for sake of argument, I can say all users of PCC must then do the
> > similar validation. I don't know where to draw the line here.
> 
> If export PCC type, it is good for the user of PCC to be more universal and
> more compatible.
>

I don't think it is a good idea to just export raw ACPI PCC type to the
client drivers. What if the driver in the future needs to work on a DT
platform as well and need to work with non-PCC mailbox channel ?

Also pushing the client PCC drivers to have more ACPI knowledge to understand
what each type means is also something I prefer to avoid. The real information
you want is whether this is an initiator(previously known master) channel or
responder(previously known as slave) channel. It boils down to unidirectional
vs bidirectional and what direction in bidirectional channels.

It would be good if mbox framework can be taught that, or atleast make an
attempt to see what people think about it. Just patching it the way you are
proposing is just going to hide real issue here.

> > 
> > Ideally I would expect the driver to make this transparent and give error
> > during transmit if not supported.
> I understand you.
> I just check this type only once during the initializing phase.
> Otherwise, every once need to verify it when send PCC command.

Agreed, but refer above for my concern on the solution proposed.

> >
> > The driver must be able to work with different PCC type to support variety
> > of platforms TBH. What is the issue exactly here ? Is this to prevent the
> Agree more with you.
> IMO, the user of PCC has the ability to support variety of platforms if they
> can get PCC type.
> In this case, to prevent type 4 is necessary if driver cannot act as a
> slave.
> on the other hand, If one driver acts as a slave, platform must supply slave
> subspace for them.
> > use of Type 4 ? I think we must do something better but I don't know what
> > that is yet.
> 
> Yes, we can try to do it better. I have a concern, like below.
>

Thanks for agreeing.

> You know that the use of PCC can use polling mode and interrupt mode to
> communicate with platform.
> I'm not sure if the obtaining of the polling mode and interrupt mode is an
> issue to prevent driver to be more universal.

Again this must be addressed at mailbox API level.

> But this driver can know if they support interrupt mode based on struct
> mbox_chan::struct mbox_controller::txdone_irq after requesting PCC channel.

Agreed, I was about to ask the same.

> Because I'm not sure it's a better way.

Again agreed.

> You know that drivers used interrupt mode need to fill the rx_callback
> function into mbx_client when register PCC channel.
> And drivers used polling mode don't do it.
> If we use this way, drivers that both support the two mode have to modify
> the rx_callback pointer after requesting PCC channel.

I am not sure if I followed all the details here. May be a rough hack helps
to understand what you are proposing ? Ofcourse not for merging, just to
understand the issue better.

--
Regards,
Sudeep

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ