cdx: Rename MCDI_LOGGING to CDX_MCDI_LOGGING
PATCH v2 1/1 cdx: Rename MCDI_LOGGING to CDX_MCDI_LOGGING
MCDI_LOGGING is too generic considering other MCDI users SFC_MCDI_LOGGING and SFC_SIENA_MCDI_LOGGING. Rename it to CDX_MCDI_LOGGING makes it more domain specific.
Also, Move CONFIG_CDX_MCDI_LOGGING to header file and make logging variable as a configurable sysfs parameter.
---
Changes v1->v2:
- Moved CONFIG_CDX_MCDI_LOGGING flag to header file
- Added sysfs entry to enable/disable mcdi logging
drivers/cdx/controller/Kconfig | 2 +- drivers/cdx/controller/cdx_controller.c | 21 ++++++++++++ drivers/cdx/controller/mcdi.c | 45 ++++++++++++------------- drivers/cdx/controller/mcdi.h | 8 +++-- 4 files changed, 49 insertions(+), 27 deletions(-)
drivers/cdx/controller/Kconfig +1 -1
@@ -18,7 +18,7 @@ config CDX_CONTROLLER If unsure, say N. -config MCDI_LOGGING +config CDX_MCDI_LOGGING bool "MCDI Logging for the CDX controller" depends on CDX_CONTROLLER help
drivers/cdx/controller/cdx_controller.c +21 -0
@@ -124,6 +124,23 @@ static struct cdx_ops cdx_ops = { .dev_configure = cdx_configure_device, }; +static ssize_t mcdi_logging_store (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) +{ +struct cdx_controller *cdx =dev_get_drvdata (dev); +bool enable; + +if (kstrtobool (buf, &enable) <0 ) +return -EINVAL ; + +if (cdx_enable_mcdi_logging (cdx->priv, enable)) +return -EINVAL ; + +return count; +} + +static DEVICE_ATTR_WO (mcdi_logging); +static int xlnx_cdx_probe (struct platform_device *pdev) {struct cdx_controller *cdx;
@@ -154,6 +171,9 @@ static int xlnx_cdx_probe(struct platform_device *pdev) cdx->priv = cdx_mcdi; cdx->ops = &cdx_ops; +if (device_create_file (&pdev->dev, &dev_attr_mcdi_logging)) +dev_warn (&pdev->dev,"Failed to create sysfs file\n" ); + ret =cdx_setup_rpmsg (pdev);if (ret) {if (ret != -EPROBE_DEFER )
@@ -181,6 +201,7 @@ static int xlnx_cdx_remove(struct platform_device *pdev)cdx_destroy_rpmsg (pdev); +device_remove_file (&pdev->dev, &dev_attr_mcdi_logging);kfree (cdx);cdx_mcdi_finish (cdx_mcdi);
drivers/cdx/controller/mcdi.c +21 -24
126 lines not on this page · raw message
drivers/cdx/controller/mcdi.h +6 -2
@@ -22,6 +22,11 @@#define CDX_WARN_ON_PARANOID (x) do {} while (0)#endif +#ifdef CONFIG_CDX_MCDI_LOGGING +#define CDX_MCDI_LOGGING 1 +#else +#define CDX_MCDI_LOGGING 0 +#endif /** * enum cdx_mcdi_mode - MCDI transaction mode * @MCDI_MODE_EVENTS: wait for an mcdi response callback.
@@ -170,10 +175,8 @@ struct cdx_mcdi_iface {enum cdx_mcdi_mode mode;u8 prev_seq;bool new_epoch; -#ifdef CONFIG_MCDI_LOGGING bool logging_enabled;char *logging_buffer; -#endif };/**
@@ -193,6 +196,7 @@ static inline struct cdx_mcdi_iface *cdx_mcdi_if(struct cdx_mcdi *cdx)int cdx_mcdi_init (struct cdx_mcdi *cdx);void cdx_mcdi_finish (struct cdx_mcdi *cdx); +int cdx_enable_mcdi_logging (struct cdx_mcdi *cdx,bool enable);void cdx_mcdi_process_cmd (struct cdx_mcdi *cdx,struct cdx_dword *outbuf,int len); int cdx_mcdi_rpc(struct cdx_mcdi *cdx, unsigned int cmd,
Signature · 1 line
2.25.1
Quoted 6 lines · Abhijit Gangurde
MCDI_LOGGINGis too generic considering other MCDI usersSFC_MCDI_LOGGINGandSFC_SIENA_MCDI_LOGGING. Rename it toCDX_MCDI_LOGGINGmakes it more domain specific.Also, Move
CONFIG_CDX_MCDI_LOGGINGto header file and make logging variable as a configurable sysfs parameter.
No, sorry, that is not allowed. Just use the normal dynamic debugging in the kernel like everyone else uses.
Also you didn't document your new sysfs file, which would have not allowed me to take this no matter what.
Quoted 56 lines
Signed-off-by Abhijit Gangurde <[email protected]>Suggested-by Geert Uytterhoeven <[email protected]>---
Changesv1->v2:
- MovedCONFIG_CDX_MCDI_LOGGINGflag to header file
- Added sysfs entry to enable/disable mcdi loggingdrivers/cdx/controller/Kconfig | 2 +- drivers/cdx/controller/cdx_controller.c | 21 ++++++++++++ drivers/cdx/controller/mcdi.c | 45 ++++++++++++------------- drivers/cdx/controller/mcdi.h | 8 +++-- 4 files changed, 49 insertions(+), 27 deletions(-)drivers/cdx/controller/Kconfig +1
-1@@ -18,7 +18,7 @@ config CDX_CONTROLLER If unsure, say N. -config MCDI_LOGGING +config CDX_MCDI_LOGGING bool "MCDI Logging for the CDX controller" depends on CDX_CONTROLLER helpdrivers/cdx/controller/cdx_controller.c +17
-0@@ -124,6 +124,23 @@ static struct cdx_ops cdx_ops = { .dev_configure = cdx_configure_device, }; +static ssize_t mcdi_logging_store (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) +{ +struct cdx_controller *cdx =dev_get_drvdata (dev); +bool enable; + +if (kstrtobool (buf, &enable) <0 ) +return -EINVAL ; + +if (cdx_enable_mcdi_logging (cdx->priv, enable)) +return -EINVAL ; + +return count; +} + +static DEVICE_ATTR_WO (mcdi_logging); +static int xlnx_cdx_probe (struct platform_device *pdev) {struct cdx_controller *cdx;
drivers/cdx/controller/cdx_controller.c static int xlnx_cdx_probe(struct platform_device *pdev) · line 175
Quoted 5 lines
drivers/cdx/controller/cdx_controller.c +2
-0@@ -154,6 +171,9 @@ static int xlnx_cdx_probe(struct platform_device *pdev) cdx->priv = cdx_mcdi; cdx->ops = &cdx_ops; +if (device_create_file (&pdev->dev, &dev_attr_mcdi_logging)) +dev_warn (&pdev->dev,"Failed to create sysfs file\n" );
You just raced with userspace and lost. Even if this feature was ok, this is not how to create sysfs files, sorry.
greg k-h
[AMD Official Use Only - General]
Quoted 7 lines · Abhijit Gangurde
Quoted 4 lines
MCDI_LOGGINGis too generic considering other MCDI usersSFC_MCDI_LOGGINGandSFC_SIENA_MCDI_LOGGING. Rename it toCDX_MCDI_LOGGINGmakes it more domain specific.
Quoted 8 lines
Quoted 2 lines
Also, Move
CONFIG_CDX_MCDI_LOGGINGto header file and make logging variable as a configurable sysfs parameter.No, sorry, that is not allowed. Just use the normal dynamic debugging in the kernel like everyone else uses.
Also you didn't document your new sysfs file, which would have not allowed me to take this no matter what.
I'll drop the sysfs changes and send v3 patch for renaming of the macro so it can be on the rc.
Also, will look onto it to be supported by dynamic debugging.
Thanks,
Abhijit