From patchwork Wed May 26 16:19:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 12282439 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=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 1E31EC47088 for ; Wed, 26 May 2021 17:28:56 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 D04B8613C3 for ; Wed, 26 May 2021 17:28:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D04B8613C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=qsUu2qdFDm+ERvsbt0W3lwtj2H99E2aJw7FerZvS6PQ=; b=whjLHAxik+DdxE IcHSFogbrM31PcWlDeeozw/RA/f5MBt3JWy/UICWvD0MI2LGagqWhMTDtiFHDli+CLyRRzywuTSHA Sq8j4DaSzlXmUJSjFXW51GPeB9Mn+8pvLmPlYVOBcQWwNr07opt1Te3lqz2/RCeE7tTbMIl4z1X/s D+mcAF9Ve8/aFZ+jIhVjmdxJKH+M4Kbpp4CfIWLsfPe2A8vww0VHuP2w9stC74vV2gCKRo04wEolL n1Dfy6Zs4gkBBLxtQ1njplBZThQYse9/KNQm59GyBF1gL2Km+4YInlv+QSXrI0TCi8BUtf+WLXaJ9 w0q1zXe7rXiRxj3nr9ng==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1llxId-00G6al-40; Wed, 26 May 2021 17:26:32 +0000 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1llwHp-00Fh3y-Jj for linux-arm-kernel@lists.infradead.org; Wed, 26 May 2021 16:21:39 +0000 Received: by mail-ej1-x631.google.com with SMTP id c20so3384717ejm.3 for ; Wed, 26 May 2021 09:21:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Ny/LVTZ9NhT7pAThv8EZzNISFLoNH72249Lr1FcP2cI=; b=DiMkylxvByFm8pw9ICWMTsxJtAVMkIc1v+qhXw8MlH8NYoOQHZDzPwYhMKyf4zehcU 9BNQZFb9m83eA/WivtK5JIiBd4CBiLu6jsxruJCx2FxqUBSHWfYIswDrkBbj34h8J23B lqaFT3E/HC7lRmeBzk+WxMIEH79wtIqeoj081sGiC3xbeyMQdgoLwp/s+UAvdIwYunwf wTgcqQL/RzXf19RnNXhRFRjvlFUb0SxOfGYi82FD8Wnwe3w584+pU+UxuUZaku/pGTrn C313eJUpAnO9OUiQrzvBZLWbGuT/2fXE9gNwjeJ7hJRd+C0onv7py91r2R+Mao66KI7F cjnQ== 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:mime-version :content-transfer-encoding; bh=Ny/LVTZ9NhT7pAThv8EZzNISFLoNH72249Lr1FcP2cI=; b=JyYu6geb9t2GExAX71gQdQlJQUt234dB44iC4b8sFUPdToyle0OnHyD1LmjWYx2hq6 1XDA4S6Qj81J2d/pZQWjKW4wrdJMLdb/tnfcP8102u1lb2Y7KQHfyQbDmMcpsqyrQj5r kbYEnx7YJMEfv/sNqVL5vAsoEFVEurwhKA1cmygjXbVSRjklwaRPmMa44I/UmSOKzji+ idZr7OGcbngWUbYKBXdT+0HSQ2pXguHOlYq1JwyPa0NwzvHfwwywzZdfxaH0ZDBMZtj2 xVZ0ugl8UP1DQyxM6Zm4U/efJdVExtQha+g1zcMrEEMZR9vuOu7EhQIFIgdQRHS9gFPB 665Q== X-Gm-Message-State: AOAM530OtZFl+yjo0nqY2sAuh01lX9jZPMi0EKWsalK13bwPeRJkhqH2 Rsszihqjxlz3oqludoaXXxITbA== X-Google-Smtp-Source: ABdhPJyqzgF1RD6CdwvK48ZfcwVE7vT+A0zVtv0WtiBKRWJwPQ1T58Q1HOYoySz9zdFZA/kfZFQwvw== X-Received: by 2002:a17:906:a0a:: with SMTP id w10mr34330704ejf.416.1622046093908; Wed, 26 May 2021 09:21:33 -0700 (PDT) Received: from localhost.localdomain (adsl-84-226-106-126.adslplus.ch. [84.226.106.126]) by smtp.gmail.com with ESMTPSA id e6sm10497145ejd.31.2021.05.26.09.21.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 09:21:33 -0700 (PDT) From: Jean-Philippe Brucker To: joro@8bytes.org, will@kernel.org Cc: robh+dt@kernel.org, lorenzo.pieralisi@arm.com, guohanjun@huawei.com, sudeep.holla@arm.com, rjw@rjwysocki.net, lenb@kernel.org, robin.murphy@arm.com, Jonathan.Cameron@huawei.com, eric.auger@redhat.com, zhangfei.gao@linaro.org, wangzhou1@hisilicon.com, iommu@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jean-Philippe Brucker Subject: [PATCH v15 0/3] iommu/arm-smmu-v3: Add stall support Date: Wed, 26 May 2021 18:19:25 +0200 Message-Id: <20210526161927.24268-1-jean-philippe@linaro.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210526_092137_693876_900A5A7F X-CRM114-Status: GOOD ( 12.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add stall support for SMMUv3, enabling I/O page faults and SVA for compatible devices. No change since last version [1], but I'd still like this to be considered for upstream, because there exists hardware and applications. Stall is implemented by the Kunpeng 920 processor for its compression and crypto accelerators, with which I tested the SVA infrastructure. Using the userspace accelerator API [2], a program can obtain a queue from one of these devices and submit compression or encryption work within the program's address space. UADK [3] provides a library to do this, and there is an openssl plugin [4] to use it. That's probably as far as we can go in terms of real users of SVA at the moment, since userspace won't progress much further without upstream kernel support - these three patches. Stall is only enabled if the firmware declares that the device supports stalling (explicit flags from patches 1 and 2) or, in the case of the Kunpeng 920, with a quirk [5]. If that property is not set, stall will still be disabled in the STE and CD, and this series should not have any negative impact on existing systems. [1] https://lore.kernel.org/linux-iommu/20210401154718.307519-1-jean-philippe@linaro.org/ [2] Documentation/misc-devices/uacce.rst [3] https://github.com/Linaro/uadk [4] https://github.com/Linaro/openssl-uadk [5] https://lore.kernel.org/linux-pci/1615258837-12189-1-git-send-email-zhangfei.gao@linaro.org/ FWIW future devices should implement PRI: https://lore.kernel.org/linux-pci/5FD9EE6E.1040505@hisilicon.com/ Jean-Philippe Brucker (3): dt-bindings: document stall property for IOMMU masters ACPI/IORT: Enable stall support for platform devices iommu/arm-smmu-v3: Add stall support for platform devices .../devicetree/bindings/iommu/iommu.txt | 18 ++ drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 43 ++++ drivers/acpi/arm64/iort.c | 4 +- .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 59 +++++- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 196 +++++++++++++++++- 5 files changed, 304 insertions(+), 16 deletions(-)