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=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 01DBBC388F9 for ; Wed, 11 Nov 2020 06:02:50 +0000 (UTC) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 49C012075A for ; Wed, 11 Nov 2020 06:02:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="ALo/se9t" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 49C012075A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id C1EA78665E; Wed, 11 Nov 2020 06:02:48 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RmBKVUAEIm0v; Wed, 11 Nov 2020 06:02:48 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 3B36886451; Wed, 11 Nov 2020 06:02:48 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2C7B8C088B; Wed, 11 Nov 2020 06:02:48 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3BFE7C016F for ; Wed, 11 Nov 2020 06:02:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 2E7788677D for ; Wed, 11 Nov 2020 06:02:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7DKSGNR95tld for ; Wed, 11 Nov 2020 06:02:45 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from m42-4.mailgun.net (m42-4.mailgun.net [69.72.42.4]) by whitealder.osuosl.org (Postfix) with ESMTPS id 0E83E86769 for ; Wed, 11 Nov 2020 06:02:44 +0000 (UTC) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1605074564; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=19xKhDfznvGCGW+VmHaRPVkvoli1tFBpBhhWtoq6cRk=; b=ALo/se9tQXBYWSMfaGcIakFMJEt51lwHBT5mFJ9rSXSXWzZk4bIK6eFOifKdSOx1CYJbEq8b ECvV0hNZK4UQ8eTW3qNvdctxliRmZNzhpDJ49TZ9Sy6hlqU7KGBWyA5MUr1U+fGxKiOFYZqz cmpEgTE1FmZuUBvmKjrggp5vTpQ= X-Mailgun-Sending-Ip: 69.72.42.4 X-Mailgun-Sid: WyI3NDkwMCIsICJpb21tdUBsaXN0cy5saW51eC1mb3VuZGF0aW9uLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n07.prod.us-east-1.postgun.com with SMTP id 5fab7e8436968cecaf715e8d (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Wed, 11 Nov 2020 06:02:44 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 3FC1FC4339C; Wed, 11 Nov 2020 06:02:43 +0000 (UTC) Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: saiprakash.ranjan) by smtp.codeaurora.org (Postfix) with ESMTPSA id 1B6CAC433F0; Wed, 11 Nov 2020 06:02:42 +0000 (UTC) MIME-Version: 1.0 Date: Wed, 11 Nov 2020 11:32:42 +0530 From: Sai Prakash Ranjan To: Will Deacon Subject: Re: [PATCHv7 1/7] iommu/io-pgtable-arm: Add support to use system cache In-Reply-To: <20201110121855.GD16239@willie-the-truck> References: <1d4979c0dcf649c5717605c598067b4b225ab9de.1604048969.git.saiprakash.ranjan@codeaurora.org> <20201110121855.GD16239@willie-the-truck> Message-ID: <329542c0c09054a46fa8d6d8f92ad739@codeaurora.org> X-Sender: saiprakash.ranjan@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Cc: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Akhil P Oommen , dri-devel@lists.freedesktop.org, "Kristian H . Kristensen" , Robin Murphy , linux-arm-kernel@lists.infradead.org X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On 2020-11-10 17:48, Will Deacon wrote: > On Fri, Oct 30, 2020 at 02:53:08PM +0530, Sai Prakash Ranjan wrote: >> Add a quirk IO_PGTABLE_QUIRK_SYS_CACHE to override the >> attributes set in TCR for the page table walker when >> using system cache. >> >> Signed-off-by: Sai Prakash Ranjan >> --- >> drivers/iommu/io-pgtable-arm.c | 7 ++++++- >> include/linux/io-pgtable.h | 4 ++++ >> 2 files changed, 10 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/iommu/io-pgtable-arm.c >> b/drivers/iommu/io-pgtable-arm.c >> index a7a9bc08dcd1..a356caf1683a 100644 >> --- a/drivers/iommu/io-pgtable-arm.c >> +++ b/drivers/iommu/io-pgtable-arm.c >> @@ -761,7 +761,8 @@ arm_64_lpae_alloc_pgtable_s1(struct io_pgtable_cfg >> *cfg, void *cookie) >> >> if (cfg->quirks & ~(IO_PGTABLE_QUIRK_ARM_NS | >> IO_PGTABLE_QUIRK_NON_STRICT | >> - IO_PGTABLE_QUIRK_ARM_TTBR1)) >> + IO_PGTABLE_QUIRK_ARM_TTBR1 | >> + IO_PGTABLE_QUIRK_SYS_CACHE)) >> return NULL; >> >> data = arm_lpae_alloc_pgtable(cfg); >> @@ -773,6 +774,10 @@ arm_64_lpae_alloc_pgtable_s1(struct >> io_pgtable_cfg *cfg, void *cookie) >> tcr->sh = ARM_LPAE_TCR_SH_IS; >> tcr->irgn = ARM_LPAE_TCR_RGN_WBWA; >> tcr->orgn = ARM_LPAE_TCR_RGN_WBWA; >> + } else if (cfg->quirks & IO_PGTABLE_QUIRK_SYS_CACHE) { >> + tcr->sh = ARM_LPAE_TCR_SH_OS; >> + tcr->irgn = ARM_LPAE_TCR_RGN_NC; >> + tcr->orgn = ARM_LPAE_TCR_RGN_WBWA; > > Given that this only applies in the case where then page-table walker > is > non-coherent, I think we'd be better off renaming the quirk to > something > like IO_PGTABLE_QUIRK_ARM_OUTER_WBWA and then rejecting it in the > non-coherent case. > Do you mean like below? diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c index a7a9bc08dcd1..94de1f71db42 100644 --- a/drivers/iommu/io-pgtable-arm.c +++ b/drivers/iommu/io-pgtable-arm.c @@ -776,7 +776,10 @@ arm_64_lpae_alloc_pgtable_s1(struct io_pgtable_cfg *cfg, void *cookie) } else { tcr->sh = ARM_LPAE_TCR_SH_OS; tcr->irgn = ARM_LPAE_TCR_RGN_NC; - tcr->orgn = ARM_LPAE_TCR_RGN_NC; + if (!(cfg->quirks & IO_PGTABLE_QUIRK_ARM_OUTER_WBWA)) + tcr->orgn = ARM_LPAE_TCR_RGN_NC; + else + tcr->orgn = ARM_LPAE_TCR_RGN_WBWA; } tg1 = cfg->quirks & IO_PGTABLE_QUIRK_ARM_TTBR1; Thanks, Sai -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu