Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp29115pxf; Wed, 17 Mar 2021 14:24:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBO01flOT0+xNX/YQHr0FusY1JbdNNqQZLjkQozApqBqNY/xWyp6k9C3i1by6mMOyd4qRm X-Received: by 2002:a05:6402:518d:: with SMTP id q13mr44755231edd.313.1616016289918; Wed, 17 Mar 2021 14:24:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616016289; cv=none; d=google.com; s=arc-20160816; b=jzLY8d8J6YusqCetnBm9Mfrt1KLrWuzn7AqmiSKNUF93gYMhaakB5JXoUTbqYEB6xv HZ6TPRsCM24FHTEVQhCzudAohjWaLuCXW4wyrmS/eKb0LwyIY7cad03xVyxEzyAPv9Ux 2ja7MnNnMGoTA51eHS6lBGLkidHfWoSQJ1mXZLJcky3bV2Ju3aMW1GAu20CKTjMzknkg 8O7USro2e80S2U8OykDstz8d4+DywDEkQ4wQrc9xvj+Acsfzvcr1fqzLwAPjzQLTy9eN vWDirm4j1Ybbmc4x0S0tjaV/0kVvSZgHjLsuVFIsFM/PjOsC09Rt5NmOeUuAknlDG8kY TPhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=HchjgJn3AgnpDc5+oGAmJzvgBR7qMdT7ZxA9Rjp655E=; b=ypTYY/Ic/VaZgN2IBBlH4vHhc3CmgBaqAFaNb3yePAhx+lLUxNIgB0RqEZ8aZf2++g B8ZbFpFGlfUAfxyq95KJGOas4IRREfsY9+HnVkFiVtBxJkdushDteKyLJ4sVc/vz698x 1I12hJNmXGguqBwHdHHXrm+r613Tc99HLRzcdE3/JNrQkd3l+Cob3zKGs/FfzUkhklMS Y730hIKcELdQo3rF5AhFiOeok05v67aLeyPOEYjZssKs0KTo/jtRYTaTToZy6Jwy+bqC Yhn4mGgJcwzOTjO1BcvIbVPAEMymyZwL8DFGC5Mt7dO1elwRUqzxcFdKsfG4VKiTnKlt WeOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=f56nEazf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a5si24963ejj.325.2021.03.17.14.24.27; Wed, 17 Mar 2021 14:24:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=f56nEazf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230391AbhCQRMQ (ORCPT + 99 others); Wed, 17 Mar 2021 13:12:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230414AbhCQRMJ (ORCPT ); Wed, 17 Mar 2021 13:12:09 -0400 Received: from mail-ot1-x333.google.com (mail-ot1-x333.google.com [IPv6:2607:f8b0:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A97DC06175F for ; Wed, 17 Mar 2021 10:12:09 -0700 (PDT) Received: by mail-ot1-x333.google.com with SMTP id l23-20020a05683004b7b02901b529d1a2fdso2484041otd.8 for ; Wed, 17 Mar 2021 10:12:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=HchjgJn3AgnpDc5+oGAmJzvgBR7qMdT7ZxA9Rjp655E=; b=f56nEazfE3s/D1h9atyavfjqZb/lAtSQgpQ7AZ65oHJJjDdmycjgaAOLupbKLr5N+a RKOI2al//Yv4/SV6kU/wHdwOW6fy5g9l6FjEC9b6oZve3BXgfocq+DpJw90HRaevzaqV DXUTYY2L882l9a58bhfMUjoKzLJa7to5bY5hADt5J3zBf7m7G54EtA0KJsSiRb+H1n2/ lS+i2prvUmBRY/7aOOEVDlq6K1/4fvMR1vu5k+I/JywooIZ+O4z2JVhbnRhSwg+2JaGy 9tJq9mM6V9BjVWFZhyWOfGByOmWj/+qVuiOJqpfQp8a6wZF7qh0ht5TcZFc7BOurK/WG QxQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=HchjgJn3AgnpDc5+oGAmJzvgBR7qMdT7ZxA9Rjp655E=; b=iJpDmqZNamQxyQhEakowA1p6V0YPsrs2j2iycGGJv0+TJSWMLp2cpA2fj1nCjFhwLR Wr6ZtgYlGDaz5McZ/on2/B2pHCPCtWChjX4S6aXeeOKcOZd+5vW2g+Do6PiZ/NzqmyaW U6dSTvLNwMVVU3qCNrAitunBesR7vaQzjnOlfz0GSY16ZJmjem8bAFPIjPEdQSmXSjy2 I2jAcqtCowq0Mkb3aU1bbua9f23unoqRh8mwzy2JlIttEtVrTtFmsjssVW6ksxUeudq8 dbaI85m/PruFAQOj8YUf84S1ow8LXKrBeWODcamzQLcdn2wVrrCWxUrZISCSAkCY55r4 5TUw== X-Gm-Message-State: AOAM532bhXPA8s3Pg0bNHk76aordohPvG0by6UKae5Cdh4G7PUBZT1sq AlU1dYDzTja/Ox+gknQsBn9cUvK7JVETh5H7Md/kQw== X-Received: by 2002:a05:6830:1644:: with SMTP id h4mr4171335otr.349.1616001128576; Wed, 17 Mar 2021 10:12:08 -0700 (PDT) MIME-Version: 1.0 References: <20210316193905.1673600-1-jollys@google.com> <3a0626ae-327b-146f-5b2d-c58074c421a5@huawei.com> In-Reply-To: <3a0626ae-327b-146f-5b2d-c58074c421a5@huawei.com> From: Jolly Shah Date: Wed, 17 Mar 2021 10:11:57 -0700 Message-ID: Subject: Re: [PATCH] scsi: libsas: Reset num_scatter if libata mark qc as NODATA To: Jason Yan Cc: jejb@linux.ibm.com, martin.petersen@oracle.com, john.garry@huawei.com, a.darwish@linutronix.de, luojiaxing@huawei.com, dan.carpenter@oracle.com, b.zolnierkie@samsung.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jason, Thanks for the review. On Tue, Mar 16, 2021 at 6:50 PM Jason Yan wrote: > > > =E5=9C=A8 2021/3/17 3:39, Jolly Shah =E5=86=99=E9=81=93: > > When the cache_type for the scsi device is changed, the scsi layer > > issues a MODE_SELECT command. The caching mode details are communicated > > via a request buffer associated with the scsi command with data > > direction set as DMA_TO_DEVICE (scsi_mode_select). When this command > > reaches the libata layer, as a part of generic initial setup, libata > > layer sets up the scatterlist for the command using the scsi command > > (ata_scsi_qc_new). This command is then translated by the libata layer > > into ATA_CMD_SET_FEATURES (ata_scsi_mode_select_xlat). The libata layer > > treats this as a non data command (ata_mselect_caching), since it only > > needs an ata taskfile to pass the caching on/off information to the > > device. It does not need the scatterlist that has been setup, so it doe= s > > not perform dma_map_sg on the scatterlist (ata_qc_issue). Unfortunately= , > > when this command reaches the libsas layer(sas_ata_qc_issue), libsas > > layer sees it as a non data command with a scatterlist. It cannot > > extract the correct dma length, since the scatterlist has not been > > mapped with dma_map_sg for a DMA operation. When this partially > > constructed SAS task reaches pm80xx LLDD, it results in below warning. > > > > "pm80xx_chip_sata_req 6058: The sg list address > > start_addr=3D0x0000000000000000 data_len=3D0x0end_addr_high=3D0xfffffff= f > > end_addr_low=3D0xffffffff has crossed 4G boundary" > > > > This patch assigns appropriate value to num_sectors for ata non data > > commands. > > > > Signed-off-by: Jolly Shah > > --- > > drivers/scsi/libsas/sas_ata.c | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_at= a.c > > index 024e5a550759..94ec08cebbaa 100644 > > --- a/drivers/scsi/libsas/sas_ata.c > > +++ b/drivers/scsi/libsas/sas_ata.c > > @@ -209,10 +209,12 @@ static unsigned int sas_ata_qc_issue(struct ata_q= ueued_cmd *qc) > > task->num_scatter =3D si; > > } > > > > - if (qc->tf.protocol =3D=3D ATA_PROT_NODATA) > > + if (qc->tf.protocol =3D=3D ATA_PROT_NODATA) { > > task->data_dir =3D DMA_NONE; > > - else > > + task->num_scatter =3D 0; > > + } else { > > task->data_dir =3D qc->dma_dir; > > + } > > task->scatter =3D qc->sg; > > task->ata_task.retry_count =3D 1; > > task->task_state_flags =3D SAS_TASK_STATE_PENDING; > > > > Thanks for the patch. Except the warning, any functional errors? > No functional errors observed. Thanks, Jolly Shah > The code looks good to me, > > Reviewed-by: Jason Yan