From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-21.5 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 689C5C4167B for ; Tue, 8 Dec 2020 23:46:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3AC8C238EE for ; Tue, 8 Dec 2020 23:46:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730366AbgLHXqn (ORCPT ); Tue, 8 Dec 2020 18:46:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730312AbgLHXqn (ORCPT ); Tue, 8 Dec 2020 18:46:43 -0500 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41637C0613CF for ; Tue, 8 Dec 2020 15:46:03 -0800 (PST) Received: by mail-pf1-x443.google.com with SMTP id t7so190741pfh.7 for ; Tue, 08 Dec 2020 15:46:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=4yKNxCl+vQDHfatyg/GcsY0hnIkoBzf+/9KfiXssTbk=; b=j3cf3covSKiEEgqlptY0VhDHLRYGHGX9Rccbg6vafc+TS1yoTZDylFNBgVeGm5CpEq QA1vi/34q9BSpQrH+Vy2eP/Dqse2qrDAd7HxQ7GsdDYxPPFCYH9HYesNAaVsawl9Fk2s OBWYBDDPBWKTqvL64Wlz2AaWL//qdrpUq+sFSQpTWtBzDvhqw4hhtizgvGXd0WOtiYlx Mjd93cLFHgt8ILpIY20BdoA1LTDGQm8/WYdPvXxl92lgL64EyDwM7Va32QKArcaWIxZY HrAob+eVigI2Uz3yGRCe6NjbcH7oWvRes+TIKhfwbIkB4ZDJ3ZGK5gP2VDhi5vS15ORr F6QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=4yKNxCl+vQDHfatyg/GcsY0hnIkoBzf+/9KfiXssTbk=; b=AADrnkXiwquG17EbipRm3keUhV1A9xmF/A9GNrLZsAjjrUVWoStp9FlTmCHYPNIVQf pehxfDZ2g+DRaCRG1n2krr03uCDgIwSM0wPYmHlq5QdyzaGrxEMjPUPWApj2B5PtrCn+ b5l5oQClGtCWDSfhccPnDLX8Y86Ih8wwwMDCOI2bXIUQPB0t7A56cmVT7pivD+O1Zjgk uktNiwz5v7/NSiflZhLgjgn/ErVVKLX37lvJvt/vCoNGxcnzK+GsjpkWUUg8nziq8LOQ NWYYmdln5mH/nympUny275aDZU9Q0SA/EGENhwHLOxDw1pqE4SNhZBy3bYYwHrGXogWp vMJg== X-Gm-Message-State: AOAM532cGWij2opiaXnHwuXUIMG2ZZnU4Y0eGJkklDF/3Z9DLQg9/jXX ZQeE/aL3ouqTLGpZ44YUA2E3bQ== X-Google-Smtp-Source: ABdhPJyI/vseLuf6fqn0RbssnJqSnhSx2Zt0Y1bE1VF6+Ho9YPaIoTKi8qTqmMHsuVmheP/0V9yFcQ== X-Received: by 2002:a17:90a:e386:: with SMTP id b6mr164919pjz.134.1607471162567; Tue, 08 Dec 2020 15:46:02 -0800 (PST) Received: from google.com (154.137.233.35.bc.googleusercontent.com. [35.233.137.154]) by smtp.gmail.com with ESMTPSA id x6sm82407pgr.20.2020.12.08.15.46.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Dec 2020 15:46:01 -0800 (PST) Date: Tue, 8 Dec 2020 23:45:58 +0000 From: Satya Tangirala To: Eric Biggers Cc: linux-mmc@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-fscrypt@vger.kernel.org, Ulf Hansson , Andy Gross , Bjorn Andersson , Adrian Hunter , Asutosh Das , Rob Herring , Neeraj Soni , Barani Muthukumaran , Peng Zhou , Stanley Chu , Konrad Dybcio Subject: Re: [PATCH v2 3/9] mmc: cqhci: initialize upper 64 bits of 128-bit task descriptors Message-ID: References: <20201203020516.225701-1-ebiggers@kernel.org> <20201203020516.225701-4-ebiggers@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201203020516.225701-4-ebiggers@kernel.org> Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Wed, Dec 02, 2020 at 06:05:10PM -0800, Eric Biggers wrote: > From: Eric Biggers > > Move the task descriptor initialization into cqhci_prep_task_desc(), and > make it initialize all 128 bits of the task descriptor if the host > controller is using 128-bit task descriptors. > > This is needed to prepare for CQHCI inline encryption support, which > requires 128-bit task descriptors and uses the upper 64 bits. > > Note: since some host controllers already enable 128-bit task > descriptors, it's unclear why the previous code worked when it wasn't > initializing the upper 64 bits. One possibility is that the bits are > being ignored because the features that use them aren't enabled yet. > In any case, setting them to 0 won't hurt. > > Signed-off-by: Eric Biggers > --- > drivers/mmc/host/cqhci-core.c | 30 ++++++++++++++++++++---------- > 1 file changed, 20 insertions(+), 10 deletions(-) > > diff --git a/drivers/mmc/host/cqhci-core.c b/drivers/mmc/host/cqhci-core.c > index 697fe40756bf2..ad7c9acff1728 100644 > --- a/drivers/mmc/host/cqhci-core.c > +++ b/drivers/mmc/host/cqhci-core.c > @@ -408,13 +408,15 @@ static void cqhci_disable(struct mmc_host *mmc) > } > > static void cqhci_prep_task_desc(struct mmc_request *mrq, > - u64 *data, bool intr) > + struct cqhci_host *cq_host, int tag) > { > + __le64 *task_desc = (__le64 __force *)get_desc(cq_host, tag); > u32 req_flags = mrq->data->flags; > + u64 desc0; > > - *data = CQHCI_VALID(1) | > + desc0 = CQHCI_VALID(1) | > CQHCI_END(1) | > - CQHCI_INT(intr) | > + CQHCI_INT(1) | > CQHCI_ACT(0x5) | > CQHCI_FORCED_PROG(!!(req_flags & MMC_DATA_FORCED_PRG)) | > CQHCI_DATA_TAG(!!(req_flags & MMC_DATA_DAT_TAG)) | > @@ -425,8 +427,19 @@ static void cqhci_prep_task_desc(struct mmc_request *mrq, > CQHCI_BLK_COUNT(mrq->data->blocks) | > CQHCI_BLK_ADDR((u64)mrq->data->blk_addr); > > - pr_debug("%s: cqhci: tag %d task descriptor 0x%016llx\n", > - mmc_hostname(mrq->host), mrq->tag, (unsigned long long)*data); > + task_desc[0] = cpu_to_le64(desc0); > + > + if (cq_host->caps & CQHCI_TASK_DESC_SZ_128) { > + u64 desc1 = 0; > + > + task_desc[1] = cpu_to_le64(desc1); > + > + pr_debug("%s: cqhci: tag %d task descriptor 0x%016llx%016llx\n", > + mmc_hostname(mrq->host), mrq->tag, desc1, desc0); > + } else { > + pr_debug("%s: cqhci: tag %d task descriptor 0x%016llx\n", > + mmc_hostname(mrq->host), mrq->tag, desc0); > + } > } > > static int cqhci_dma_map(struct mmc_host *host, struct mmc_request *mrq) > @@ -567,8 +580,6 @@ static inline int cqhci_tag(struct mmc_request *mrq) > static int cqhci_request(struct mmc_host *mmc, struct mmc_request *mrq) > { > int err = 0; > - u64 data = 0; > - u64 *task_desc = NULL; > int tag = cqhci_tag(mrq); > struct cqhci_host *cq_host = mmc->cqe_private; > unsigned long flags; > @@ -598,9 +609,8 @@ static int cqhci_request(struct mmc_host *mmc, struct mmc_request *mrq) > } > > if (mrq->data) { > - task_desc = (__le64 __force *)get_desc(cq_host, tag); > - cqhci_prep_task_desc(mrq, &data, 1); > - *task_desc = cpu_to_le64(data); > + cqhci_prep_task_desc(mrq, cq_host, tag); > + > err = cqhci_prep_tran_desc(mrq, cq_host, tag); > if (err) { > pr_err("%s: cqhci: failed to setup tx desc: %d\n", > -- > 2.29.2 > Looks good to me. Please feel free to add Reviewed-by: Satya Tangirala