From patchwork Thu Apr 11 18:47:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Murphy X-Patchwork-Id: 10896687 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 90A271515 for ; Thu, 11 Apr 2019 18:50:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 776B628D31 for ; Thu, 11 Apr 2019 18:50:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B82328DB9; Thu, 11 Apr 2019 18:50:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1D7D828D31 for ; Thu, 11 Apr 2019 18:50:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=p91NT/xIlilinPDf0UOH4MYp4EZv7RgtJbBwUBdVoPE=; b=uTBvD6mioqYUx13pm+PKUlCmR8 /WQJD7AZ77Rwv8dN5xefN2BPgMQ8Xw+8BzYN6i5KcaNF6xJSHe22H3uLtlE+buIgcKTYZBjsRJAMT CJAHNqbPzNC1+L4fW794WLBXR3/pCY+bf+eksXoUhHS7LtjzlQmt7bDcmEwdzTKQ+2iWYVzEcZ5VA 4lRMMaE0CvX/E8hPIy3Tj3tw6GOzV/jyFJotf7RwLAfLDldZpPEwnFXcGQO1MOHo4wYdUDWp4EAuP 3Ia1GFPN0bryy7VGk5RAgO607xo0mwGvBNL3Jvy5wCpvCVLvuZS+G1rvD4EnoXbiNTRRbASJD10Md AxJvTYaw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEem9-0004nk-CG; Thu, 11 Apr 2019 18:50:17 +0000 Received: from mail-ed1-x544.google.com ([2a00:1450:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEel2-0002NJ-DA for linux-arm-kernel@lists.infradead.org; Thu, 11 Apr 2019 18:49:29 +0000 Received: by mail-ed1-x544.google.com with SMTP id o26so6112859edv.12 for ; Thu, 11 Apr 2019 11:49:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=googlenew; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0ptM0TW5MEf0wZjhcNVg+kVepdW4r8Z6tyROfJJShQo=; b=Kz0209+sKNZfmB0yWwNPjjrMA+GYb4rsz3YQ+7qzCBKV0K8VKU+rELf+Zl1rDwGfGG UDqhVf2LzXA6K1Mp+V7RE4dqFrJsHX5w+JbTNVOgDNMqnsvq1/Svzxa1O30Nwx4bNza7 xhOejAKAbe35ytPwR0TZVkNIacGaIechwtfh4zN2DCFIKQ4M9BguB3dgKppQ9rukI4fk jwu4Kh6E1Kp4KE4cvVyzWTm9dLB+7BauhZN2nsIMnKgsjVX0U/GpqN2Ak+4MJtwQ7Rct vag21Of0Bv8JJEz+PXrI7LQkFSMnYl4wWcIJZDQCt3rzHh/G7O3Wjvfv8J/dr1KSZ6iE ULLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0ptM0TW5MEf0wZjhcNVg+kVepdW4r8Z6tyROfJJShQo=; b=IWaLoS9+r0KHjOn1TJyPDlFEO6H8mcj9t4JKPEpRsz+B18is/pCjw9SuqdYA0+YA2Q 52/ajmr8EC4ErwOxrB1Dc1QHBIBTsvbrSEFB++6emvOcZZL8SFSckPQMxiT4omGsmqFV Gnibeih4XdqkRQe2jDLrr4JasBNsCTg3lKk75ypCi0qD+kdJAWeQ/Ko4/pzaA0AtaDcn /+tkACPAJW1ioyBCfLMPNhbkZ318bQk8fqXKPxz44iu7QcmbQZ96MpfVPhb3TPobuk8c WP4Zzdx6IofOaPHQkH9mkU9XGLITf1h59ryAaDVYi3lm5m7m9KawPDR6Wj7iXu5JEvz/ AKPg== X-Gm-Message-State: APjAAAVFN/ThsjbMtvIHeslBSJ8hcbowhueCP3s9nS4Z0Gok6sKBXgyq pKn2Nu0+B9fgyb2QlHHdbCpuVA== X-Google-Smtp-Source: APXvYqxPgBo+MMzWroNLnpmi2H77XJDBCOGidMozjjYD68K8alQvz4uZiMPtc7ZU8Kl0PrPPn+MeYg== X-Received: by 2002:a05:6402:558:: with SMTP id i24mr26522920edx.51.1555008547040; Thu, 11 Apr 2019 11:49:07 -0700 (PDT) Received: from localhost.localdomain ([80.233.32.123]) by smtp.gmail.com with ESMTPSA id b10sm1285130edi.28.2019.04.11.11.49.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Apr 2019 11:49:06 -0700 (PDT) From: Tom Murphy To: iommu@lists.linux-foundation.org Subject: [PATCH 5/9] iommu/amd: Implement .flush_np_cache Date: Thu, 11 Apr 2019 19:47:34 +0100 Message-Id: <20190411184741.27540-6-tmurphy@arista.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190411184741.27540-1-tmurphy@arista.com> References: <20190411184741.27540-1-tmurphy@arista.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190411_114908_787529_E883572E X-CRM114-Status: GOOD ( 14.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , jamessewart@arista.com, Will Deacon , David Brown , Marek Szyprowski , linux-samsung-soc@vger.kernel.org, dima@arista.com, Joerg Roedel , Krzysztof Kozlowski , linux-rockchip@lists.infradead.org, Kukjin Kim , Andy Gross , Marc Zyngier , linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org, Matthias Brugger , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Tom Murphy , linux-kernel@vger.kernel.org, murphyt7@tcd.ie, Rob Clark , Robin Murphy MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Implement flush_np_cache for the AMD iommu driver. This allows the amd iommu non present cache to be flushed if amd_iommu_np_cache is set. Signed-off-by: Tom Murphy --- drivers/iommu/amd_iommu.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index b319e51c379b..2d4ee10626b4 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@ -1319,6 +1319,18 @@ static void domain_flush_devices(struct protection_domain *domain) device_flush_dte(dev_data); } +static void amd_iommu_flush_np_cache(struct iommu_domain *domain, + unsigned long iova, size_t size) +{ + struct protection_domain *dom = to_pdomain(domain); + + if (unlikely(amd_iommu_np_cache)) { + domain_flush_pages(dom, iova, size); + domain_flush_complete(dom); + } +} + + /**************************************************************************** * * The functions below are used the create the page table mappings for @@ -3263,6 +3275,7 @@ const struct iommu_ops amd_iommu_ops = { .flush_iotlb_all = amd_iommu_flush_iotlb_all, .iotlb_range_add = amd_iommu_iotlb_range_add, .iotlb_sync = amd_iommu_flush_iotlb_all, + .flush_np_cache = amd_iommu_flush_np_cache, }; /*****************************************************************************