Re: [PATCH 1/2] drivers: remoteproc: xlnx: add attach detach support

From: kernel test robot
Date: Sun May 05 2024 - 18:45:12 EST


Hi Tanmay,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 0496190c4d42965acb31b9da1b6dac3509791062]

url: https://github.com/intel-lab-lkp/linux/commits/Tanmay-Shah/drivers-remoteproc-xlnx-add-attach-detach-support/20240503-071225
base: 0496190c4d42965acb31b9da1b6dac3509791062
patch link: https://lore.kernel.org/r/20240502231021.370047-2-tanmay.shah%40amd.com
patch subject: [PATCH 1/2] drivers: remoteproc: xlnx: add attach detach support
config: arm64-randconfig-r113-20240506 (https://download.01.org/0day-ci/archive/20240506/202405060611.jBQBF7iB-lkp@xxxxxxxxx/config)
compiler: aarch64-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20240506/202405060611.jBQBF7iB-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405060611.jBQBF7iB-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
drivers/remoteproc/xlnx_r5_remoteproc.c:404:20: sparse: sparse: cast removes address space '__iomem' of expression
drivers/remoteproc/xlnx_r5_remoteproc.c:522:20: sparse: sparse: cast removes address space '__iomem' of expression
>> drivers/remoteproc/xlnx_r5_remoteproc.c:731:21: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct rsc_tbl_data *rsc_data_va @@ got void [noderef] __iomem * @@
drivers/remoteproc/xlnx_r5_remoteproc.c:731:21: sparse: expected struct rsc_tbl_data *rsc_data_va
drivers/remoteproc/xlnx_r5_remoteproc.c:731:21: sparse: got void [noderef] __iomem *
>> drivers/remoteproc/xlnx_r5_remoteproc.c:748:18: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct resource_table *rsc_addr @@ got void [noderef] __iomem * @@
drivers/remoteproc/xlnx_r5_remoteproc.c:748:18: sparse: expected struct resource_table *rsc_addr
drivers/remoteproc/xlnx_r5_remoteproc.c:748:18: sparse: got void [noderef] __iomem *
>> drivers/remoteproc/xlnx_r5_remoteproc.c:802:24: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got struct resource_table *rsc_tbl_va @@
drivers/remoteproc/xlnx_r5_remoteproc.c:802:24: sparse: expected void volatile [noderef] __iomem *addr
drivers/remoteproc/xlnx_r5_remoteproc.c:802:24: sparse: got struct resource_table *rsc_tbl_va

vim +731 drivers/remoteproc/xlnx_r5_remoteproc.c

702
703 static int zynqmp_r5_get_rsc_table_va(struct zynqmp_r5_core *r5_core)
704 {
705 struct device *dev = r5_core->dev;
706 struct rsc_tbl_data *rsc_data_va;
707 struct resource_table *rsc_addr;
708 struct resource res_mem;
709 struct device_node *np;
710 int ret;
711
712 /**
713 * It is expected from remote processor firmware to provide resource
714 * table address via struct rsc_tbl_data data structure.
715 * Start address of first entry under "memory-region" property list
716 * contains that data structure which holds resource table address, size
717 * and some magic number to validate correct resource table entry.
718 */
719 np = of_parse_phandle(r5_core->np, "memory-region", 0);
720 if (!np) {
721 dev_err(dev, "failed to get memory region dev node\n");
722 return -EINVAL;
723 }
724
725 ret = of_address_to_resource(np, 0, &res_mem);
726 if (ret) {
727 dev_err(dev, "failed to get memory-region resource addr\n");
728 return -EINVAL;
729 }
730
> 731 rsc_data_va = devm_ioremap_wc(dev, res_mem.start,
732 sizeof(struct rsc_tbl_data));
733 if (!rsc_data_va) {
734 dev_err(dev, "failed to map resource table data address\n");
735 return -EIO;
736 }
737
738 /**
739 * If RSC_TBL_XLNX_MAGIC number and its complement isn't found then
740 * do not consider resource table address valid and don't attach
741 */
742 if (rsc_data_va->magic_num != RSC_TBL_XLNX_MAGIC ||
743 rsc_data_va->comp_magic_num != ~RSC_TBL_XLNX_MAGIC) {
744 dev_dbg(dev, "invalid magic number, won't attach\n");
745 return -EINVAL;
746 }
747
> 748 rsc_addr = ioremap_wc(rsc_data_va->rsc_tbl,
749 rsc_data_va->rsc_tbl_size);
750 if (!rsc_addr) {
751 dev_err(dev, "failed to get rsc_addr\n");
752 return -EINVAL;
753 }
754
755 /**
756 * As of now resource table version 1 is expected. Don't fail to attach
757 * but warn users about it.
758 */
759 if (rsc_addr->ver != 1)
760 dev_warn(dev, "unexpected resource table version %d\n",
761 rsc_addr->ver);
762
763 r5_core->rsc_tbl_size = rsc_data_va->rsc_tbl_size;
764 r5_core->rsc_tbl_va = rsc_addr;
765
766 return 0;
767 }
768
769 static int zynqmp_r5_attach(struct rproc *rproc)
770 {
771 struct zynqmp_r5_core *r5_core = rproc->priv;
772 int i, pm_domain_id, ret;
773
774 /*
775 * Firmware is loaded in TCM. Request TCM power domains to notify
776 * platform management controller that TCM is in use. This will be
777 * released during unprepare callback.
778 */
779 for (i = 0; i < r5_core->tcm_bank_count; i++) {
780 pm_domain_id = r5_core->tcm_banks[i]->pm_domain_id;
781 ret = zynqmp_pm_request_node(pm_domain_id,
782 ZYNQMP_PM_CAPABILITY_ACCESS, 0,
783 ZYNQMP_PM_REQUEST_ACK_BLOCKING);
784 if (ret < 0)
785 pr_warn("TCM %d can't be requested\n", i);
786 }
787
788 return 0;
789 }
790
791 static int zynqmp_r5_detach(struct rproc *rproc)
792 {
793 struct zynqmp_r5_core *r5_core = rproc->priv;
794
795 /*
796 * Generate last notification to remote after clearing virtio flag.
797 * Remote can avoid polling on virtio reset flag if kick is generated
798 * during detach by host and check virtio reset flag on kick interrupt.
799 */
800 zynqmp_r5_rproc_kick(rproc, 0);
801
> 802 iounmap(r5_core->rsc_tbl_va);
803 r5_core->rsc_tbl_va = NULL;
804
805 return 0;
806 }
807

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki