From patchwork Fri Nov 6 15:50:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 11887309 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=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=no 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 86BD2C55178 for ; Fri, 6 Nov 2020 15:54:02 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 F416122202 for ; Fri, 6 Nov 2020 15:54:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="U1ICMsNg"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UPVuDTAv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F416122202 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References:List-Owner; bh=ibgZth1i+ZKpPf7dGrdCGLGZ6Sqh+r8h2+UkDw7FyUw=; b=U1ICMsNgwPGemVzOK1dbbXdz3C FPqGhyuUG/1smDgxi2LdaWHzp9y4g35iUQ4HJutMmQjnHEmspb1IGQY93IwVyu3KNDVwc5rdX1qWD OCPeWrNmupf9A0s0BUVWgOZk+omhFQ3FdxYh5uRYxpGgl30HOcYE9Snt+LtPVJnXqs6FzmHhHdwyZ 6gGsT6XvGU1rrt5bUeQsp8Yfr6CvSWqzvBX3WK0Fz3mQbDdfhVQAGM4WE1saE6V+zIi3xnDHuUpMJ oSv1MfzCbMldfT9ly1zwiGlq8YROwKFs7qNyGKxCgQhB2GJ4FMp4viRCo/D6mHRGqzt4CDGaVjUiC aI845tOQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kb43E-00070q-84; Fri, 06 Nov 2020 15:53:20 +0000 Received: from mail-ej1-x643.google.com ([2a00:1450:4864:20::643]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kb43A-0006zN-EI for linux-arm-kernel@lists.infradead.org; Fri, 06 Nov 2020 15:53:17 +0000 Received: by mail-ej1-x643.google.com with SMTP id k3so2569274ejj.10 for ; Fri, 06 Nov 2020 07:53:13 -0800 (PST) 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=dlOICaQsPy5nML/BkcJkWqgxHeuHNNOj+MkdvdIdS84=; b=UPVuDTAvgNg3i9VKNjKTA2CHerwffX6mpeQS3RmUFuKjD+s/0bdA+NCWSm9Ql0BLeC iAwFXyc/edxmTtIhQoZeSGe0gSUZa+dkpiaTmBuRw/EIYpSgndA9mBK72/aXDUpHB9pf VfeCTZERcE7Wcl7vfbGTSLX6oCO5HxdytjYP7S+WNyn3Kt3NVbPEotVs3F4hivIy8ZZm j+GpGB38SZUtBe6byM8CcjWzWfoP0cS8APt+gM9qI4pEp8N4jbut2z3yTLgedbsJrcYy FGgK5hbW2mnp8hSTK1wEPA9KVWdkbRH2x0ITNX7YOtiRphVV05A/s1BjnyJ4hW1z7+3a iJeg== 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=dlOICaQsPy5nML/BkcJkWqgxHeuHNNOj+MkdvdIdS84=; b=m+i5hpoz5qvNjLznaVZNNw8nSaXqZ437XNlZryAVZh8RG2ddYapat8g8S6q4+58EM0 fcYRPM7XY3DfFC/84hjlHFOA06Q6G8AJmCtDZ7jt198XmCrcNHuC6RFbTpeS0jHCfevb RbWxrcVnnUqNBT9PE/S+rOe1syTOjCj5oX6GMjTKQKgNC+0cDBNl/7++c5gQxYTzMw52 z4iDIqHztDOXPwWAdRH6qcUSK6uruqZvZ1Hg0/uGV9O5udCbnyXsLgbt6QfQJ4Fb7mrp b5IpCWH2k1rdK6PejEMDw28lDGZAQZ7qDmNjzj5BVihSebGcEGOX3BjrcdDfGTXNm1Yu 13KQ== X-Gm-Message-State: AOAM531tFB1suF/ByAcCdvOLQfhNV/rWtsJXmLX24ZH7SLfp2cQzeIUa x/r8PNkRRVhtzipHFPF3sEZnqw== X-Google-Smtp-Source: ABdhPJzthMMZn4rExTikxWqIiHJFu6qM2vqAT4ryS9EnUX4nBHDqfxhE6R27BnRrH6ll9DbTrcrnUw== X-Received: by 2002:a17:906:3a55:: with SMTP id a21mr2613338ejf.357.1604677993152; Fri, 06 Nov 2020 07:53:13 -0800 (PST) Received: from localhost.localdomain ([2001:1715:4e26:a7e0:116c:c27a:3e7f:5eaf]) by smtp.gmail.com with ESMTPSA id lz27sm1249262ejb.39.2020.11.06.07.53.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Nov 2020 07:53:12 -0800 (PST) From: Jean-Philippe Brucker To: iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH RESEND v10 0/4] iommu: Shared Virtual Addressing for SMMUv3 (PT sharing part) Date: Fri, 6 Nov 2020 16:50:46 +0100 Message-Id: <20201106155048.997886-1-jean-philippe@linaro.org> X-Mailer: git-send-email 2.29.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201106_105316_525937_1BBC3BD6 X-CRM114-Status: GOOD ( 12.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jean-Philippe Brucker , jacob.jun.pan@linux.intel.com, will@kernel.org, joro@8bytes.org, eric.auger@redhat.com, Jonathan.Cameron@huawei.com, zhangfei.gao@linaro.org, robin.murphy@arm.com, xuzaibo@huawei.com, baolu.lu@linux.intel.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org These are the remaining bits implementing iommu_sva_bind_device() for SMMUv3. They didn't make it into v5.10 because an Ack was missing for adding the PASID field to mm_struct. That is now upstream, in commit 52ad9bc64c74 ("mm: Add a pasid member to struct mm_struct"). No change since last posting [1], only rebased onto v5.10-rc2. Note that full SVA support for SMMUv3 still needs IOPF and DVM support, coming soon. [1] https://lore.kernel.org/linux-iommu/20200918101852.582559-1-jean-philippe@linaro.org/ Jean-Philippe Brucker (4): iommu/ioasid: Add ioasid references iommu/sva: Add PASID helpers iommu/arm-smmu-v3: Implement iommu_sva_bind/unbind() iommu/arm-smmu-v3: Hook up ATC invalidation to mm ops drivers/iommu/Kconfig | 7 + drivers/iommu/Makefile | 1 + drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 30 +++ drivers/iommu/iommu-sva-lib.h | 15 ++ include/linux/ioasid.h | 10 +- .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 244 +++++++++++++++++- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 50 +++- drivers/iommu/intel/iommu.c | 4 +- drivers/iommu/intel/svm.c | 6 +- drivers/iommu/ioasid.c | 38 ++- drivers/iommu/iommu-sva-lib.c | 86 ++++++ 11 files changed, 468 insertions(+), 23 deletions(-) create mode 100644 drivers/iommu/iommu-sva-lib.h create mode 100644 drivers/iommu/iommu-sva-lib.c