Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2527946imm; Wed, 16 May 2018 14:31:36 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoiumcimNdKaj3U0buN+tYI3411HsuozyucuhsZuf7xPnsnooIHBoNB148dQlOs01ovUptm X-Received: by 2002:a62:74b:: with SMTP id b72-v6mr2584539pfd.133.1526506296488; Wed, 16 May 2018 14:31:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526506296; cv=none; d=google.com; s=arc-20160816; b=Gg+DffV1S5lIGSl4n3HdMYBMZ6BWuDTuxv2MB0PIeQ4l8ammozx2utjNkP994U0n3h OlLxSbip0/L6xdXp9RgV5/7Ajro7xjspZvCOw1z3DuYz0Riz6EPRrxiyP6qvX9ic47df QzB4T0Y3tf/aJv977ty3OJ4E8n5Hgle/jZ43VPsoQZWOe4veQTylu8GJC52Cez2L7kg3 jCgjV/qRNeD1Ombm1AvD4ngRjTxBUdX4iKBoPUmMb8lzrtHl6JPjd6+nqN1hwH0p+WWK +ROFqSGAjwkXBQ/mow2TBkW5sAVUk1SxfT4itSZAnFFYlfEqSKl1tsD5WOdOdCJs+63P F70Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=lG3remIVKt+7vCAZbabgHuP3hUss2pGLIqNi03IUS/0=; b=Lylj8ZoWKjbIhBL6yAbSBK3rYTuWd9Y4fXXcOXlyaVhlXFYndVql2GBfUNsCQuD2jB KTJGhj5eAUhsLwauW1vGYCnPqx6lxgES3n/4qDmF/psmUnhc24ExilyMUl+PJ3w8o21Y doUxmPgljotXbsqtcvR+DJ9kE3QO1iAHAGB5CPnLN1IutlvWZB1erV8PiAh4QGg3nNg0 70a+lmaBBR24jzTH56/9b3uBi5wcra8ux6Ao6R7npqCH7+J/LXMKm7dcThFxDxKoRC93 AGxLxgZEbPvakmpNCC9mtx//y/VgIGUJg/dyF/QDnpwO6SLPoorQOnDNfZ7U9V4wBJcP 1q+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=kqcHkli5; dkim=pass header.i=@codeaurora.org header.s=default header.b=MwKaifXt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c1-v6si3219478pld.103.2018.05.16.14.31.21; Wed, 16 May 2018 14:31:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=kqcHkli5; dkim=pass header.i=@codeaurora.org header.s=default header.b=MwKaifXt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751406AbeEPVbK (ORCPT + 99 others); Wed, 16 May 2018 17:31:10 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:39582 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751150AbeEPVbI (ORCPT ); Wed, 16 May 2018 17:31:08 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 7A2CB60209; Wed, 16 May 2018 21:31:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526506267; bh=JbIxUtMj4bw7muxOvx+1TqJ4UX2b8rjLQuz7210Y0V8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=kqcHkli5agwVyOSxL0SeAnk/X1UtKoHTRcND7N4R/25aYhLpu+05Lu09kX90yCKwO EyhtKX4HeZE3FUT0jGB1flp7JH4fHa/fL8aUCKG+2XaE2OKi+DEVBRwl85x8svTX2y UlHab36fAo297Jai7ZGr7H0m3MmFMKKi8FRxqBX8= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 343CA605FD; Wed, 16 May 2018 21:31:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526506266; bh=JbIxUtMj4bw7muxOvx+1TqJ4UX2b8rjLQuz7210Y0V8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=MwKaifXtOmVibVGYiKAbRbqYKhJjr5CxhTkmry/m/pGPnz/WP18B4Z9VBGnUT+WK0 Ok4xCCBj+tlb47LLd7a/2OHW89g2AhJIHtLfcT+VRRaBp1Wxwnwi4SaYsIqX/scDqJ lFJSVftK7ddnnd4LrNiy3DzAH+xwbBziuZY82Jvw= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 16 May 2018 14:31:06 -0700 From: Subhash Jadavani To: Alim Akhtar Cc: Alim Akhtar , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, vinayak holikatti , devicetree@vger.kernel.org, Shaik Ameer Basha Subject: Re: [RFC PATCH V2] scsi: ufs: Add specific callback for setting DMA mask In-Reply-To: References: <1520507013-2410-1-git-send-email-alim.akhtar@samsung.com> Message-ID: <1f7df8bfbc161243956233eac80f2cee@codeaurora.org> X-Sender: subhashj@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-05-15 21:31, Alim Akhtar wrote: > Ping !!! > > On Thu, Mar 8, 2018 at 4:33 PM, Alim Akhtar > wrote: >> Currently DMA mask for UFS HCI is set by reading CAP register's >> [64AS] bit. Some HCI controller like Exynos support 36-bit bus >> address. >> This works perfectly fine with DMA mask set as 64 in case there is no >> IOMMU attached to HCI. >> In case if HCI is behind an IOMMU, setting DMA mask as 64 bit won't >> work as HCI has only 36bit addressing and SMMU has created mapping of >> 64 bit and as the device truncates the address, its mapping will not >> be found by iommu. >> To resolve such issues, let the variant driver sets its own DMA mask. >> >> Signed-off-by: Alim Akhtar >> --- >> drivers/scsi/ufs/ufshcd.c | 3 +++ >> drivers/scsi/ufs/ufshcd.h | 2 ++ >> 2 files changed, 5 insertions(+) >> >> I am not sure if there are other ways available to handle such cases. >> The IOMMU I am talking about is arm-smmu and it DT binding does not >> give much idea about handling such cases. >> Have tested this patch with HCI controller with IOMMU attached. >> >> Changes Since V1: >> - Fixed build issue as reported by Kbuild test robot. >> >> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c >> index a355d98..9a1374e 100644 >> --- a/drivers/scsi/ufs/ufshcd.c >> +++ b/drivers/scsi/ufs/ufshcd.c >> @@ -7781,6 +7781,9 @@ EXPORT_SYMBOL_GPL(ufshcd_dealloc_host); >> */ >> static int ufshcd_set_dma_mask(struct ufs_hba *hba) >> { >> + if (hba->vops && hba->vops->set_dma_mask) >> + return hba->vops->set_dma_mask(hba); >> + >> if (hba->capabilities & MASK_64_ADDRESSING_SUPPORT) { >> if (!dma_set_mask_and_coherent(hba->dev, >> DMA_BIT_MASK(64))) >> return 0; >> diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h >> index 1332e54..89c6dae 100644 >> --- a/drivers/scsi/ufs/ufshcd.h >> +++ b/drivers/scsi/ufs/ufshcd.h >> @@ -297,6 +297,7 @@ struct ufs_pwr_mode_info { >> * @resume: called during host controller PM callback >> * @dbg_register_dump: used to dump controller debug information >> * @phy_initialization: used to initialize phys >> + * @set_dma_mask: used to set variant specific DMA mask >> */ >> struct ufs_hba_variant_ops { >> const char *name; >> @@ -325,6 +326,7 @@ struct ufs_hba_variant_ops { >> int (*resume)(struct ufs_hba *, enum ufs_pm_op); >> void (*dbg_register_dump)(struct ufs_hba *hba); >> int (*phy_initialization)(struct ufs_hba *); >> + int (*set_dma_mask)(struct ufs_hba *hba); >> }; >> >> /* clock gating state */ >> -- >> 2.7.4 >> Looks reasonable to me, you may try posting non-RFC version. -- The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project