linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Jolly Shah <JOLLYS@xilinx.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: "keescook@chromium.org" <keescook@chromium.org>,
	"ard.biesheuvel@linaro.org" <ard.biesheuvel@linaro.org>,
	"matt@codeblueprint.co.uk" <matt@codeblueprint.co.uk>,
	"dmitry.torokhov@gmail.com" <dmitry.torokhov@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Rajan Vaja <RAJANV@xilinx.com>, Michal Simek <michals@xilinx.com>,
	"sudeep.holla@arm.com" <sudeep.holla@arm.com>,
	"mingo@kernel.org" <mingo@kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"hkallweit1@gmail.com" <hkallweit1@gmail.com>
Subject: Re: [PATCH v2 1/4] firmware: xilinx: Add sysfs interface
Date: Thu, 30 Jan 2020 23:59:03 +0000	[thread overview]
Message-ID: <4EF659A1-2844-46B9-9ED6-5A6A20401D9D@xilinx.com> (raw)
In-Reply-To: <20200128062814.GA2097606@kroah.com>

Hi Greg,

On 1/27/20, 10:28 PM, "linux-kernel-owner@vger.kernel.org on behalf of Greg KH" <linux-kernel-owner@vger.kernel.org on behalf of gregkh@linuxfoundation.org> wrote:

    On Mon, Jan 27, 2020 at 11:01:27PM +0000, Jolly Shah wrote:
    >     > > > +	ret = kstrtol(tok, 16, &value);
    >     > > > +	if (ret) {
    >     > > > +		ret = -EFAULT;
    >     > > > +		goto err;
    >     > > > +	}
    >     > > > +
    >     > > > +	ret = eemi_ops->ioctl(0, read_ioctl, reg, 0, ret_payload);
    >     > > 
    >     > > This feels "tricky", if you tie this to the device you have your driver
    >     > > bound to, will this make it easier instead of having to go through the
    >     > > ioctl callback?
    >     > > 
    >     > 
    >     > GGS(general global storage) registers are in PMU space and linux doesn't have access to it 
    >     > Hence ioctl is used.
    >     
    >     Why not just a "real" call to the driver to make this type of reading?
    >     You don't have ioctls within the kernel for other drivers to call,
    >     that's not needed at all.
    > 
    > these registers are for users  and for special needs where users wants
    > to retain values over resets. but as they belong to PMU address space,
    > these interface APIs are provided. They don’t allow access to any
    > other registers.
    
    That's not the issue here.  The issue is you are using an "internal"
    ioctl, instead just make a "real" call.

Sorry I am not clear. Do you mean that we should use linux standard ioctl interface instead of internal ioctl by mentioning "real" ?
    
    >     > > > +int zynqmp_pm_ggs_init(struct kobject *parent_kobj)
    >     > > > +{
    >     > > > +	return sysfs_create_group(parent_kobj, zynqmp_ggs_groups[0]);
    >     > > 
    >     > > You might be racing userspace here and loosing :(
    >     > 
    >     > Prob is called before user space is notified about sysfs so racing shouldn't happen.
    >     
    >     "shouldn't"?  How do you know this?
    > 
    > Since firmware driver is always built-in (we don't provide support to
    > use as module), user space won't be available before prob is complete.
    > Correct if I am wrong.
    
    Userspace starts earlier than you think, and also, use the correct
    interfaces for this type of thing, that is why it is there.  Don't
    create purposfully-incorrect code :)

Sure. We will change it.

Thanks,
Jolly Shah

    
    >     > > > diff --git a/drivers/firmware/xilinx/zynqmp.c
    >     > > b/drivers/firmware/xilinx/zynqmp.c
    >     > > > index 75bdfaa..4c1117d 100644
    >     > > > --- a/drivers/firmware/xilinx/zynqmp.c
    >     > > > +++ b/drivers/firmware/xilinx/zynqmp.c
    >     > > > @@ -473,6 +473,10 @@ static inline int zynqmp_is_valid_ioctl(u32 ioctl_id)
    >     > > >  	case IOCTL_GET_PLL_FRAC_MODE:
    >     > > >  	case IOCTL_SET_PLL_FRAC_DATA:
    >     > > >  	case IOCTL_GET_PLL_FRAC_DATA:
    >     > > > +	case IOCTL_WRITE_GGS:
    >     > > > +	case IOCTL_READ_GGS:
    >     > > > +	case IOCTL_WRITE_PGGS:
    >     > > > +	case IOCTL_READ_PGGS:
    >     > > 
    >     > > Huh???
    >     > 
    >     > Sorry not sure about your concern here. These registers are in PMU space and hence
    >     > Ioctl is needed to let linux access them.
    >     
    >     userspace or kernelspace?
    >     
    >     You seem to be mixing them both here.
    > 
    > They are in Platform Management Unit register address space so it
    > allows only secure access. Hence for linux to access it, interface
    > APIs are provided. 
    
    Again, that's fine, but why are you creating an "internal ioctl"?  Just
    make a real function call.
    
    thanks,
    
    greg k-h
    

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

  reply	other threads:[~2020-01-30 23:59 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-08 23:54 [PATCH v2 0/4] firmware: xilinx: Add xilinx specific sysfs interface Jolly Shah
2020-01-08 23:54 ` [PATCH v2 1/4] firmware: xilinx: Add " Jolly Shah
2020-01-14 14:52   ` Greg KH
2020-01-23 23:47     ` Jolly Shah
2020-01-24  6:03       ` Greg KH
2020-01-24 11:32         ` Sudeep Holla
2020-01-27 22:46           ` Jolly Shah
2020-01-27 23:01         ` Jolly Shah
2020-01-28  6:28           ` Greg KH
2020-01-30 23:59             ` Jolly Shah [this message]
2020-01-31  6:10               ` Greg KH
2020-01-31  9:05                 ` Rajan Vaja
2020-01-31  9:36                   ` 'Greg KH'
2020-02-11  0:57                     ` Jolly Shah
2020-02-14 17:10                       ` 'Greg KH'
2020-02-15  0:37                         ` Jolly Shah
2020-02-15  0:52                           ` 'Greg KH'
2020-02-19 22:50                             ` Jolly Shah
2020-03-06 23:55                             ` Jolly Shah
2020-03-07  8:47                               ` 'Greg KH'
2020-01-08 23:54 ` [PATCH v2 2/4] firmware: xilinx: Add system shutdown API interface Jolly Shah
2020-01-08 23:54 ` [PATCH v2 3/4] firmware: xilinx: Add sysfs to set shutdown scope Jolly Shah
2020-01-08 23:54 ` [PATCH v2 4/4] firmware: xilinx: Add sysfs and IOCTL to set boot health status Jolly Shah

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=4EF659A1-2844-46B9-9ED6-5A6A20401D9D@xilinx.com \
    --to=jollys@xilinx.com \
    --cc=RAJANV@xilinx.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hkallweit1@gmail.com \
    --cc=keescook@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@codeblueprint.co.uk \
    --cc=michals@xilinx.com \
    --cc=mingo@kernel.org \
    --cc=sudeep.holla@arm.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;
as well as URLs for NNTP newsgroup(s).