From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============7449968310596597262==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: Re: [RFC 2/2] i2c: designware: Add AMD PSP I2C bus support Date: Thu, 23 Dec 2021 01:46:49 +0800 Message-ID: <202112230116.Z8RNaMCY-lkp@intel.com> In-Reply-To: <20211222094558.2098791-3-jsd@semihalf.com> List-Id: --===============7449968310596597262== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Jan, [FYI, it's a private test report for your RFC patch.] [auto build test WARNING on wsa/i2c/for-next] [also build test WARNING on linux/master rafael-pm/linux-next linus/master = v5.16-rc6 next-20211222] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Jan-Dabros/i2c-designware-= Add-support-for-AMD-PSP-semaphore/20211222-174729 base: https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/f= or-next config: ia64-allyesconfig (https://download.01.org/0day-ci/archive/20211223= /202112230116.Z8RNaMCY-lkp(a)intel.com/config) compiler: ia64-linux-gcc (GCC) 11.2.0 reproduce (this is a W=3D1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/= make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/d0789fea89a6cfb42f237fd64= 068a7fbc9c7c283 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Jan-Dabros/i2c-designware-Add-supp= ort-for-AMD-PSP-semaphore/20211222-174729 git checkout d0789fea89a6cfb42f237fd64068a7fbc9c7c283 # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dgcc-11.2.0 make.cross= O=3Dbuild_dir ARCH=3Dia64 SHELL=3D/bin/bash drivers/i2c/busses/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): drivers/i2c/busses/i2c-designware-amdpsp.c: In function 'psp_get_mbox_ad= dr': drivers/i2c/busses/i2c-designware-amdpsp.c:65:13: error: implicit declar= ation of function 'rdmsrl_safe' [-Werror=3Dimplicit-function-declaration] 65 | if (rdmsrl_safe(MSR_AMD_PSP_ADDR, &psp_mmio)) | ^~~~~~~~~~~ drivers/i2c/busses/i2c-designware-amdpsp.c: In function 'psp_wait_cmd': >> drivers/i2c/busses/i2c-designware-amdpsp.c:98:32: warning: variable 'and= _mask' set but not used [-Wunused-but-set-variable] 98 | union psp_mbox_cmd_reg and_mask =3D { .val =3D ~0 }; | ^~~~~~~~ In file included from include/linux/printk.h:559, from include/linux/kernel.h:20, from include/linux/kernfs.h:9, from include/linux/sysfs.h:16, from include/linux/kobject.h:20, from include/linux/of.h:17, from include/linux/irqdomain.h:35, from include/linux/acpi.h:13, from include/linux/i2c.h:13, from drivers/i2c/busses/i2c-designware-amdpsp.c:3: drivers/i2c/busses/i2c-designware-amdpsp.c: In function 'psp_send_i2c_re= q': >> drivers/i2c/busses/i2c-designware-amdpsp.c:188:46: warning: too many arg= uments for format [-Wformat-extra-args] 188 | dev_dbg(psp_i2c_dev, "Request accepted b= y PSP after %ums\n", | ^~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~~~~~~~~~~ include/linux/dynamic_debug.h:134:29: note: in definition of macro '__dy= namic_func_call' 134 | func(&id, ##__VA_ARGS__); \ | ^~~~~~~~~~~ include/linux/dynamic_debug.h:166:9: note: in expansion of macro '_dynam= ic_func_call' 166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \ | ^~~~~~~~~~~~~~~~~~ include/linux/dev_printk.h:155:9: note: in expansion of macro 'dynamic_d= ev_dbg' 155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__) | ^~~~~~~~~~~~~~~ include/linux/dev_printk.h:155:30: note: in expansion of macro 'dev_fmt' 155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__) | ^~~~~~~ drivers/i2c/busses/i2c-designware-amdpsp.c:188:25: note: in expansion of= macro 'dev_dbg' 188 | dev_dbg(psp_i2c_dev, "Request accepted b= y PSP after %ums\n", | ^~~~~~~ cc1: some warnings being treated as errors vim +/and_mask +98 drivers/i2c/busses/i2c-designware-amdpsp.c 95 = 96 static int psp_wait_cmd(struct psp_mbox *mbox) 97 { > 98 union psp_mbox_cmd_reg and_mask =3D { .val =3D ~0 }; 99 union psp_mbox_cmd_reg expected =3D { .val =3D 0 }; 100 u32 tmp; 101 = 102 /* Expect mbox_cmd to be cleared and ready bit to be set by PSP */ 103 and_mask.fields.mbox_cmd =3D 0; 104 and_mask.fields.ready =3D 0; 105 expected.fields.ready =3D 1; 106 = 107 return readl_poll_timeout(&mbox->fields.val, tmp, (tmp =3D=3D expec= ted.val), 108 0, 1000 * PSP_CMD_TIMEOUT_MS); 109 } 110 = 111 /* Status equal to 0 means that PSP succeed processing command */ 112 static int psp_check_mbox_sts(struct psp_mbox *mbox) 113 { 114 union psp_mbox_cmd_reg cmd_reg =3D {0}; 115 = 116 cmd_reg.val =3D readl(&mbox->fields.val); 117 return cmd_reg.fields.mbox_status; 118 } 119 = 120 static int psp_send_cmd(struct psp_i2c_req *req) 121 { 122 struct psp_mbox *mbox =3D (struct psp_mbox *)mbox_iomem; 123 union psp_mbox_cmd_reg cmd_reg =3D {0}; 124 = 125 if (psp_check_mbox_recovery(mbox)) 126 return -EIO; 127 = 128 if (psp_wait_cmd(mbox)) 129 return -EBUSY; 130 = 131 /* Fill address of command-response buffer */ 132 writeq((uintptr_t)__psp_pa((void *)req), &mbox->i2c_req_addr); 133 = 134 /* Write command register to trigger processing */ 135 cmd_reg.fields.mbox_cmd =3D PSP_I2C_REQ_BUS_CMD; 136 writel(cmd_reg.val, &mbox->fields.val); 137 = 138 if (psp_wait_cmd(mbox)) 139 return -ETIMEDOUT; 140 = 141 if (psp_check_mbox_sts(mbox)) 142 return -EIO; 143 = 144 return 0; 145 } 146 = 147 /* Helper to verify status returned by PSP */ 148 static int check_i2c_req_sts(struct psp_i2c_req *req) 149 { 150 int status; 151 = 152 status =3D readl(&req->hdr.status); 153 = 154 switch (status) { 155 case PSP_I2C_REQ_STS_OK: 156 return 0; 157 case PSP_I2C_REQ_STS_BUS_BUSY: 158 return -EBUSY; 159 case PSP_I2C_REQ_STS_INV_PARAM: 160 default: 161 return -EIO; 162 }; 163 } 164 = 165 static int psp_send_i2c_req(enum psp_i2c_req_type i2c_req_type) 166 { 167 int status, ret, retry_cnt =3D PSP_I2C_REQ_RETRY_CNT; 168 struct psp_i2c_req *req; 169 unsigned long start; 170 = 171 /* Allocate command-response buffer */ 172 req =3D kzalloc(sizeof(*req), GFP_KERNEL); 173 if (!req) 174 return -ENOMEM; 175 = 176 req->hdr.total_size =3D sizeof(*req); 177 req->type =3D i2c_req_type; 178 = 179 start =3D jiffies; 180 do { 181 if (psp_send_cmd(req)) { 182 ret =3D -EIO; 183 goto cleanup; 184 } 185 = 186 status =3D check_i2c_req_sts(req); 187 if (!status) { > 188 dev_dbg(psp_i2c_dev, "Request accepted by PSP after %ums\n", 189 i2c_req_type, jiffies_to_msecs(jiffies - start)); 190 ret =3D 0; 191 goto cleanup; 192 } else if (status =3D=3D -EBUSY) { 193 retry_cnt--; 194 } else { 195 ret =3D -EIO; 196 goto cleanup; 197 }; 198 = 199 /* IF EBUSY, give PSP time to finish its i2c activities */ 200 mdelay(PSP_I2C_REQ_RETRY_DELAY_MSEC); 201 } while (retry_cnt); 202 = 203 = 204 ret =3D -ETIMEDOUT; 205 = 206 cleanup: 207 kfree(req); 208 return ret; 209 } 210 = --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============7449968310596597262==--