Message ID | 156140452950.116890.8616947153652273997.stgit@sosrh3.amd.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Herbert Xu |
Headers | show |
Series | Add module parameters to control CCP activation | expand |
On 6/24/19 2:28 PM, Hook, Gary wrote: > Make module parameters readable in DebugFS. Not sure why you have this... you can access the module parameters in /sys/module/ccp/parameters. You can then get/set them based on the value in the module_param() definition. Thanks, Tom > > Signed-off-by: Gary R Hook <gary.hook@amd.com> > --- > drivers/crypto/ccp/ccp-debugfs.c | 2 ++ > drivers/crypto/ccp/sp-pci.c | 22 ++++++++++++++++++++++ > 2 files changed, 24 insertions(+) > > diff --git a/drivers/crypto/ccp/ccp-debugfs.c b/drivers/crypto/ccp/ccp-debugfs.c > index 4bd26af7098d..c4cc0e60fd50 100644 > --- a/drivers/crypto/ccp/ccp-debugfs.c > +++ b/drivers/crypto/ccp/ccp-debugfs.c > @@ -317,6 +317,8 @@ void ccp5_debugfs_setup(struct ccp_device *ccp) > &ccp_debugfs_queue_ops); > } > > + ccp_debugfs_register_modparams(ccp_debugfs_dir); > + > return; > } > > diff --git a/drivers/crypto/ccp/sp-pci.c b/drivers/crypto/ccp/sp-pci.c > index 3fab79585f72..c167c4671f45 100644 > --- a/drivers/crypto/ccp/sp-pci.c > +++ b/drivers/crypto/ccp/sp-pci.c > @@ -26,6 +26,10 @@ > #include <linux/delay.h> > #include <linux/ccp.h> > > +#ifdef CONFIG_CRYPTO_DEV_CCP_DEBUGFS > +#include <linux/debugfs.h> > +#endif > + > #include "ccp-dev.h" > #include "psp-dev.h" > > @@ -36,6 +40,24 @@ static unsigned int nqueues = MAX_HW_QUEUES; > module_param(nqueues, uint, 0444); > MODULE_PARM_DESC(nqueues, "Number of queues per CCP (default: 5)"); > > +#ifdef CONFIG_CRYPTO_DEV_CCP_DEBUGFS > +modparam_t moduleparameters[] = { > + {"nqueues", &nqueues, S_IRUSR}, > + {NULL, NULL, 0}, > +}; > + > +void ccp_debugfs_register_modparams(struct dentry *parentdir) > +{ > + int j; > + > + for (j = 0; moduleparameters[j].paramname; j++) > + debugfs_create_u32(moduleparameters[j].paramname, > + moduleparameters[j].parammode, parentdir, > + moduleparameters[j].param); > +} > + > +#endif > + > unsigned int ccp_get_nqueues_param(void) { > return nqueues; > } >
On 6/24/19 4:59 PM, Lendacky, Thomas wrote: > On 6/24/19 2:28 PM, Hook, Gary wrote: >> Make module parameters readable in DebugFS. > > Not sure why you have this... you can access the module parameters in > /sys/module/ccp/parameters. You can then get/set them based on the > value in the module_param() definition. I'll take "who's an idiot" for $200, Alex. There'll be v2 patchset a-comin'. grh > > Thanks, > Tom > >> >> Signed-off-by: Gary R Hook <gary.hook@amd.com> >> --- >> drivers/crypto/ccp/ccp-debugfs.c | 2 ++ >> drivers/crypto/ccp/sp-pci.c | 22 ++++++++++++++++++++++ >> 2 files changed, 24 insertions(+) >> >> diff --git a/drivers/crypto/ccp/ccp-debugfs.c b/drivers/crypto/ccp/ccp-debugfs.c >> index 4bd26af7098d..c4cc0e60fd50 100644 >> --- a/drivers/crypto/ccp/ccp-debugfs.c >> +++ b/drivers/crypto/ccp/ccp-debugfs.c >> @@ -317,6 +317,8 @@ void ccp5_debugfs_setup(struct ccp_device *ccp) >> &ccp_debugfs_queue_ops); >> } >> >> + ccp_debugfs_register_modparams(ccp_debugfs_dir); >> + >> return; >> } >> >> diff --git a/drivers/crypto/ccp/sp-pci.c b/drivers/crypto/ccp/sp-pci.c >> index 3fab79585f72..c167c4671f45 100644 >> --- a/drivers/crypto/ccp/sp-pci.c >> +++ b/drivers/crypto/ccp/sp-pci.c >> @@ -26,6 +26,10 @@ >> #include <linux/delay.h> >> #include <linux/ccp.h> >> >> +#ifdef CONFIG_CRYPTO_DEV_CCP_DEBUGFS >> +#include <linux/debugfs.h> >> +#endif >> + >> #include "ccp-dev.h" >> #include "psp-dev.h" >> >> @@ -36,6 +40,24 @@ static unsigned int nqueues = MAX_HW_QUEUES; >> module_param(nqueues, uint, 0444); >> MODULE_PARM_DESC(nqueues, "Number of queues per CCP (default: 5)"); >> >> +#ifdef CONFIG_CRYPTO_DEV_CCP_DEBUGFS >> +modparam_t moduleparameters[] = { >> + {"nqueues", &nqueues, S_IRUSR}, >> + {NULL, NULL, 0}, >> +}; >> + >> +void ccp_debugfs_register_modparams(struct dentry *parentdir) >> +{ >> + int j; >> + >> + for (j = 0; moduleparameters[j].paramname; j++) >> + debugfs_create_u32(moduleparameters[j].paramname, >> + moduleparameters[j].parammode, parentdir, >> + moduleparameters[j].param); >> +} >> + >> +#endif >> + >> unsigned int ccp_get_nqueues_param(void) { >> return nqueues; >> } >>
diff --git a/drivers/crypto/ccp/ccp-debugfs.c b/drivers/crypto/ccp/ccp-debugfs.c index 4bd26af7098d..c4cc0e60fd50 100644 --- a/drivers/crypto/ccp/ccp-debugfs.c +++ b/drivers/crypto/ccp/ccp-debugfs.c @@ -317,6 +317,8 @@ void ccp5_debugfs_setup(struct ccp_device *ccp) &ccp_debugfs_queue_ops); } + ccp_debugfs_register_modparams(ccp_debugfs_dir); + return; } diff --git a/drivers/crypto/ccp/sp-pci.c b/drivers/crypto/ccp/sp-pci.c index 3fab79585f72..c167c4671f45 100644 --- a/drivers/crypto/ccp/sp-pci.c +++ b/drivers/crypto/ccp/sp-pci.c @@ -26,6 +26,10 @@ #include <linux/delay.h> #include <linux/ccp.h> +#ifdef CONFIG_CRYPTO_DEV_CCP_DEBUGFS +#include <linux/debugfs.h> +#endif + #include "ccp-dev.h" #include "psp-dev.h" @@ -36,6 +40,24 @@ static unsigned int nqueues = MAX_HW_QUEUES; module_param(nqueues, uint, 0444); MODULE_PARM_DESC(nqueues, "Number of queues per CCP (default: 5)"); +#ifdef CONFIG_CRYPTO_DEV_CCP_DEBUGFS +modparam_t moduleparameters[] = { + {"nqueues", &nqueues, S_IRUSR}, + {NULL, NULL, 0}, +}; + +void ccp_debugfs_register_modparams(struct dentry *parentdir) +{ + int j; + + for (j = 0; moduleparameters[j].paramname; j++) + debugfs_create_u32(moduleparameters[j].paramname, + moduleparameters[j].parammode, parentdir, + moduleparameters[j].param); +} + +#endif + unsigned int ccp_get_nqueues_param(void) { return nqueues; }
Make module parameters readable in DebugFS. Signed-off-by: Gary R Hook <gary.hook@amd.com> --- drivers/crypto/ccp/ccp-debugfs.c | 2 ++ drivers/crypto/ccp/sp-pci.c | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+)