Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4240307ybe; Mon, 16 Sep 2019 08:53:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzTKw60gY54n0hkUW+ZVTz535AfPwkKXz+4jfhN8W8L2TOUSWb3In8h97LZLUgO9+D/ndvA X-Received: by 2002:aa7:d40c:: with SMTP id z12mr12609edq.30.1568649223035; Mon, 16 Sep 2019 08:53:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568649223; cv=none; d=google.com; s=arc-20160816; b=fy0GrQj1XfK5b4x1yaDeux1ssSfK8PmeJ+7oZ5K1lFauepWTXtlHuk8/SLrR4d/2uT rpPdqiQytWi38FM+d82bZLDW6IxKZQ0mlxwcBKdIZyySPnGquZGYavifE2Ymfd+az6yR 6OFBJdHBnYicLstbdkiFUKOsCAUBJK7oo862HmLjrHv709Ohk+eh4/nHuB3zcjsJSssH heotrw9w3VS6/fHGl8CY8dHaIYsHlSa4p8OPai2n1EkqasKz+BpfcS0EOBaFXSi895Jj dyXQh96DBAP5ipCU9r+rZ/GRq3sR9u9z3cpprGdd1q4fdOsYphyWFlcebApMEO8dLbYK Gqog== 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; bh=jj2eSlP0d5IXkvwBQpsUZwCL6mLDMFgkftj/HkjLBKo=; b=JqwtzCA6aGHfVWKOCeV00ivYkEp3kdaosfmfBwxUGfIhaPnOiPFlOpTOMtOBo+gdmD UXqV9OWttVd9no0591m4Ro57T6b2l96HfYVSYcwc9vV21d29kyfjn070D1uDNlMCZYHB Dak00rURDb+4nd9W0HD4N/1gsibhuhaCYcSZ7Gskhq34rtYi2IS4RBVDiuj7p+P/6xPK oF0aSej6MTMnfuDJEOvOtkYFLgvSSf4TCsc2Bg6oECzJhmHQ/x7l0N+UxhVIOJ47ckC+ o/8jWzIEtz9hW81kQZuTZBsYowQk1Il+m+DvbxLnXUIW943XERsH9iKkuzPprdXfLLR4 nLBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=LdS0fsqB; dkim=pass header.i=@codeaurora.org header.s=default header.b=duPxUEPS; 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 by16si4679724edb.30.2019.09.16.08.53.19; Mon, 16 Sep 2019 08:53:43 -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=LdS0fsqB; dkim=pass header.i=@codeaurora.org header.s=default header.b=duPxUEPS; 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 S1729634AbfIPJq0 (ORCPT + 99 others); Mon, 16 Sep 2019 05:46:26 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:50986 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729615AbfIPJq0 (ORCPT ); Mon, 16 Sep 2019 05:46:26 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id B5A2B61214; Mon, 16 Sep 2019 09:46:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1568627185; bh=ml5rnkJTMHmPAf4IGrPXykOFxktm7Cfyo+9yeKBWpwo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=LdS0fsqBFhuJaY3Oq2v0QUY/Ab8EC/yJ+/hWwy1nG3VKjRFzp721DIW53xkNkzNEi oxb5+2DigygmFang4ThnXW4Inp4IcE9YebR1WOdmcvfgDVLrNQCUZXuQ7cJ3LMQ+T9 kS0JXrIy+AiTupW2rAegmw+sRQcaC9fNRfNMwbsk= 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.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED 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 5706A61214; Mon, 16 Sep 2019 09:46:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1568627181; bh=ml5rnkJTMHmPAf4IGrPXykOFxktm7Cfyo+9yeKBWpwo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=duPxUEPSEzsjcd7nUgQV8fgJSXBkiT6J8pqvO54GDG/emEJ+jVACz8NLsJMWGlR9+ y+ADWRpCf3SPpOFfmxcpB7CASL6Ke+6SfUrKjmSubwc6x7ResMTm/M4kh4iqYKhVQZ UiMCWrafX6sUll0VyrqcEmuFM4EN8/SB6egdgZwM= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 16 Sep 2019 15:16:21 +0530 From: Sai Prakash Ranjan To: Robin Murphy Cc: Vivek Gautam , joro@8bytes.org, agross@kernel.org, will.deacon@arm.com, iommu@lists.linux-foundation.org, bjorn.andersson@linaro.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm-owner@vger.kernel.org Subject: Re: [PATCH v4 3/3] iommu: arm-smmu-impl: Add sdm845 implementation hook In-Reply-To: <9fb7d18c-e292-cbc9-aa6d-d85465ea249e@arm.com> References: <20190823063248.13295-1-vivek.gautam@codeaurora.org> <20190823063248.13295-4-vivek.gautam@codeaurora.org> <9fb7d18c-e292-cbc9-aa6d-d85465ea249e@arm.com> Message-ID: X-Sender: saiprakash.ranjan@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 Hi Robin, On 2019-09-10 18:56, Robin Murphy wrote: > On 23/08/2019 07:32, Vivek Gautam wrote: >> Add reset hook for sdm845 based platforms to turn off >> the wait-for-safe sequence. >> >> Understanding how wait-for-safe logic affects USB and UFS performance >> on MTP845 and DB845 boards: >> >> Qcom's implementation of arm,mmu-500 adds a WAIT-FOR-SAFE logic >> to address under-performance issues in real-time clients, such as >> Display, and Camera. >> On receiving an invalidation requests, the SMMU forwards SAFE request >> to these clients and waits for SAFE ack signal from real-time clients. >> The SAFE signal from such clients is used to qualify the start of >> invalidation. >> This logic is controlled by chicken bits, one for each - MDP >> (display), >> IFE0, and IFE1 (camera), that can be accessed only from secure >> software >> on sdm845. >> >> This configuration, however, degrades the performance of non-real time >> clients, such as USB, and UFS etc. This happens because, with >> wait-for-safe >> logic enabled the hardware tries to throttle non-real time clients >> while >> waiting for SAFE ack signals from real-time clients. >> >> On mtp845 and db845 devices, with wait-for-safe logic enabled by the >> bootloaders we see degraded performance of USB and UFS when kernel >> enables the smmu stage-1 translations for these clients. >> Turn off this wait-for-safe logic from the kernel gets us back the >> perf >> of USB and UFS devices until we re-visit this when we start seeing >> perf >> issues on display/camera on upstream supported SDM845 platforms. >> The bootloaders on these boards implement secure monitor callbacks to >> handle a specific command - QCOM_SCM_SVC_SMMU_PROGRAM with which the >> logic can be toggled. >> >> There are other boards such as cheza whose bootloaders don't enable >> this >> logic. Such boards don't implement callbacks to handle the specific >> SCM >> call so disabling this logic for such boards will be a no-op. >> >> This change is inspired by the downstream change from Patrick Daly >> to address performance issues with display and camera by handling >> this wait-for-safe within separte io-pagetable ops to do TLB >> maintenance. So a big thanks to him for the change and for all the >> offline discussions. >> >> Without this change the UFS reads are pretty slow: >> $ time dd if=/dev/sda of=/dev/zero bs=1048576 count=10 conv=sync >> 10+0 records in >> 10+0 records out >> 10485760 bytes (10.0MB) copied, 22.394903 seconds, 457.2KB/s >> real 0m 22.39s >> user 0m 0.00s >> sys 0m 0.01s >> >> With this change they are back to rock! >> $ time dd if=/dev/sda of=/dev/zero bs=1048576 count=300 conv=sync >> 300+0 records in >> 300+0 records out >> 314572800 bytes (300.0MB) copied, 1.030541 seconds, 291.1MB/s >> real 0m 1.03s >> user 0m 0.00s >> sys 0m 0.54s >> >> Signed-off-by: Vivek Gautam >> --- >> drivers/iommu/arm-smmu-impl.c | 27 ++++++++++++++++++++++++++- > > I'd be inclined to introduce the inevitable arm-smmu-qcom.c from the > start, and save worrying about moving this out later. Other than that, > though, the general self-contained shape of it all is every bit as > beautiful as I'd hoped :D > Have posted v5 with your suggestion. Thanks, Sai -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation