tree:
https://github.com/sbates130272/linux-p2pmem.git nvmet_passthru_v12
head: 6e5c1590cbbd48ad09139769e9802df2b689a87d
commit: 24d39a9a1bd9f0d351adfff1b852170e2793d74b [7/9] nvmet-passthru: Add passthru code
to process commands
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-181-g83789bbc-dirty
git checkout 24d39a9a1bd9f0d351adfff1b852170e2793d74b
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
> drivers/nvme/target/passthru.c:240:18: sparse: sparse: invalid
assignment: &=
> drivers/nvme/target/passthru.c:240:18: sparse: left side has type restricted
__le16
> drivers/nvme/target/passthru.c:240:18: sparse: right side has type restricted
__le32
vim +240 drivers/nvme/target/passthru.c
159
160 static u16 nvmet_passthru_override_id_ctrl(struct nvmet_req *req)
161 {
162 struct nvmet_ctrl *ctrl = req->sq->ctrl;
163 struct nvme_ctrl *pctrl = ctrl->subsys->passthru_ctrl;
164 u16 status = NVME_SC_SUCCESS;
165 struct nvme_id_ctrl *id;
166 u32 max_hw_sectors;
167 int page_shift;
168
169 id = kzalloc(sizeof(*id), GFP_KERNEL);
170 if (!id)
171 return NVME_SC_INTERNAL;
172
173 status = nvmet_copy_from_sgl(req, 0, id, sizeof(*id));
174 if (status)
175 goto out_free;
176
177 id->cntlid = cpu_to_le16(ctrl->cntlid);
178 id->ver = cpu_to_le32(ctrl->subsys->ver);
179
180 /*
181 * The passthru NVMe driver may have a limit on the number of segments
182 * which depends on the host's memory fragementation. To solve this,
183 * ensure mdts is limitted to the pages equal to the number of
184 * segments.
185 */
186 max_hw_sectors = min_not_zero(pctrl->max_segments << (PAGE_SHIFT - 9),
187 pctrl->max_hw_sectors);
188
189 page_shift = NVME_CAP_MPSMIN(ctrl->cap) + 12;
190
191 id->mdts = ilog2(max_hw_sectors) + 9 - page_shift;
192
193 id->acl = 3;
194 /*
195 * We export aerl limit for the fabrics controller, update this when
196 * passthru based aerl support is added.
197 */
198 id->aerl = NVMET_ASYNC_EVENTS - 1;
199
200 /* emulate kas as most of the PCIe ctrl don't have a support for kas */
201 id->kas = cpu_to_le16(NVMET_KAS);
202
203 /* don't support host memory buffer */
204 id->hmpre = 0;
205 id->hmmin = 0;
206
207 id->sqes = min_t(__u8, ((0x6 << 4) | 0x6), id->sqes);
208 id->cqes = min_t(__u8, ((0x4 << 4) | 0x4), id->cqes);
209 id->maxcmd = cpu_to_le16(NVMET_MAX_CMD);
210
211 /* don't support fuse commands */
212 id->fuses = 0;
213
214 id->sgls = cpu_to_le32(1 << 0); /* we always support SGLs */
215 if (ctrl->ops->has_keyed_sgls)
216 id->sgls |= cpu_to_le32(1 << 2);
217 if (req->port->inline_data_size)
218 id->sgls |= cpu_to_le32(1 << 20);
219
220 /*
221 * When passsthru controller is setup using nvme-loop transport it will
222 * export the passthru ctrl subsysnqn (PCIe NVMe ctrl) and will fail in
223 * the nvme/host/core.c in the nvme_init_subsystem()->nvme_active_ctrl()
224 * code path with duplicate ctr subsynqn. In order to prevent that we
225 * mask the passthru-ctrl subsysnqn with the target ctrl subsysnqn.
226 */
227 memcpy(id->subnqn, ctrl->subsysnqn, sizeof(id->subnqn));
228
229 /* use fabric id-ctrl values */
230 id->ioccsz = cpu_to_le32((sizeof(struct nvme_command) +
231 req->port->inline_data_size) / 16);
232 id->iorcsz = cpu_to_le32(sizeof(struct nvme_completion) / 16);
233
234 id->msdbd = ctrl->ops->msdbd;
235
236 /* Support multipath connections with fabrics */
237 id->cmic |= 1 << 1;
238
239 /* Disable reservations, see nvmet_parse_passthru_io_cmd() */
240 id->oncs &= cpu_to_le32(~NVME_CTRL_ONCS_RESERVATIONS);
241
242 status = nvmet_copy_to_sgl(req, 0, id, sizeof(struct nvme_id_ctrl));
243
244 out_free:
245 kfree(id);
246 return status;
247 }
248
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org