From patchwork Mon Jul 31 10:48:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shavit X-Patchwork-Id: 13334290 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 570C3C001DF for ; Mon, 31 Jul 2023 10:49:10 +0000 (UTC) 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:Cc:To:From:Subject:Message-ID: Mime-Version:Date: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=CBbKzIFMmZBM1VHx2SkcdNJKWb6rlhVPVrCKxFlHd5g=; b=jlz IEH3MnW+iuUYFPE/1am5g9FDtC3iph6P/dsMJtl77p4hOlGYL4J4aS1lC4eNQAmWe5Vv7r7Hb9Z4u hWxuL6uRuYRXxECev5YZbNOBeq7CW1PznGsXO16v4KqGN4wkqGGljYiaVZeIAyqBV/0yPxd9vjvDk 6MgFa5Hv5FDpL8UP1emD4+bDBklsjF78pEG3+waoZyhGlH2oL0iQlnFvlJdzTxZBqV/7p/mo7GY1E R4XzFy+TDWGzpoDWm2X/Y6GGeHK8ewwmVZG0lSL5ksOVP6ie4yYFA7zmWULDVJ9dAbfFYNu5Ei9M4 F507WpEUWn5OD3ByZiwhZFwzcjNWaaw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qQQSF-00F9Bz-2R; Mon, 31 Jul 2023 10:48:47 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qQQSC-00F9Ab-16 for linux-arm-kernel@lists.infradead.org; Mon, 31 Jul 2023 10:48:45 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-d2a7ec86216so2566999276.0 for ; Mon, 31 Jul 2023 03:48:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690800522; x=1691405322; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=MYD4KNk4I+aUCQIcFZ3n5/B+CXfxdz6VfnyKCw5fMRU=; b=0Jg1PJ+2Ms0SpImThAW1EMWAb2V0CT6cMZnANaGZF2LzzafL1BQJ6iWEjbVQHZyy4L J3xsZJOY4jXTy3SLnVtdiwKFv+0OfCVLR6D+t+5Tt+WGqib+Hcvl+m9yW0mgIk/5zI01 ssSeQZGchb+HTawL1Y6Mm2dAcgXazGHrPWQs8v7nB82VonT9y8Mdh7s4A6z8boRiYvuv +IZDxY+VITXRjOeNgZxP+kAqStou6n8VgrksNelRVXISPTQyiCc6No6OHUlriiIO5Jjb VIyGQy00sBFZxEc1L30uG45g2U7cyMSwfNWMPvzZhQCJn3Hc5yVv2IdbAF6Lr1Np3I6b HnAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690800522; x=1691405322; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=MYD4KNk4I+aUCQIcFZ3n5/B+CXfxdz6VfnyKCw5fMRU=; b=ZDpvnPxOCZ0H26bryolPF6vjChBEVM7oKrW0CWwGEUBWkDFE8mA7LZwoBk49kXbo7j OqIgOK+Q+6Uz7UOZB8kihNiBSMgAkAJAiXYB7uZAtfXdZBVLADT3j5hm6KA8BWN6JXw6 bcKOD1ed4UcRHq8coFit1Aqe3TlZKtO5i4k2PiQjeY9v6sCL/Tlr3H6hiESWmwNt91iM iFB2uIAXP6psbLJ/MXCS3jyaknwGBLRhIZOG+5+oe61u56Zc4iv/hhowozNkI0+flujC CXZYAzjQztTsh66mdIvAVK4KqU89grOfGKymLyYwsrnDS6LZQyb+Svd9tZZGn3YVBuzX FezQ== X-Gm-Message-State: ABy/qLZsBptEVXtJMxvVbB4H/kYj6UREWavAHQMvlekEnE6WeS4uflU0 V/bXEnRELxG2IsjXVndFWYdsiOq5XwC6 X-Google-Smtp-Source: APBJJlET//ltWfSVaehdcwXyhhFbnIFncdpcb/9IJF01FhUX4aphRs5zX2WZ71v/0k8Wy9HtIpTSfZkGPHRc X-Received: from mshavit.ntc.corp.google.com ([2401:fa00:95:20c:affc:ad1d:5cbb:3c6a]) (user=mshavit job=sendgmr) by 2002:a25:7493:0:b0:d09:17f2:d3b0 with SMTP id p141-20020a257493000000b00d0917f2d3b0mr53114ybc.9.1690800521971; Mon, 31 Jul 2023 03:48:41 -0700 (PDT) Date: Mon, 31 Jul 2023 18:48:10 +0800 Mime-Version: 1.0 X-Mailer: git-send-email 2.41.0.585.gd2178a4bd4-goog Message-ID: <20230731104833.800114-1-mshavit@google.com> Subject: [PATCH v2 0/8] Refactor the SMMU's CD table ownership From: Michael Shavit To: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: will@kernel.org, robin.murphy@arm.com, nicolinc@nvidia.com, jgg@nvidia.com, jean-philippe@linaro.org, Michael Shavit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230731_034844_397359_23E97CC9 X-CRM114-Status: GOOD ( 12.33 ) 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 Hi all, This series refactors stage 1 domains so that they describe a single CD entry. These entries are now inserted into a CD table that is owned by the arm_smmu_master instead of the domain. This is conceptually cleaner and unblocks other features, such as attaching domains with PASID (for unmanaged/dma domains). This patch series was originally part of a larger patch series that implemented the set_dev_pasid callback for non-SVA domains but is now split into a distinct series. This patch series is also available on gerrit with Jean's SMMU test engine patches cherry-picked on top for testing: https://linux-review.googlesource.com/c/linux/kernel/git/torvalds/linux/+/24742/1 Thanks, Michael Shavit Changes in v2: - Allocate CD table when it's first needed instead of on probe. - Minor changes - Added commit to rename remaining usages of cdcfg to cd_table Changes in v1: - Replace s1_cfg with arm_smmu_ctx_desc_cfg representing the CD table - Assume that the CD table is owned by the SMMU master for most operations. This is forward-compatible with the nested patch series as these operations wouldn't be called when the installed CD table comes from nested domains. - Split off as a distinct patch series from https://lore.kernel.org/all/20230621063825.268890-1-mshavit@google.com/ Michael Shavit (8): iommu/arm-smmu-v3: Move ctx_desc out of s1_cfg iommu/arm-smmu-v3: Replace s1_cfg with cdtab_cfg iommu/arm-smmu-v3: Encapsulate ctx_desc_cfg init in alloc_cd_tables iommu/arm-smmu-v3: move stall_enabled to the cd table iommu/arm-smmu-v3: Skip cd sync if CD table isn't active iommu/arm-smmu-v3: Refactor write_ctx_desc iommu/arm-smmu-v3: Move CD table to arm_smmu_master iommu/arm-smmu-v3: Rename cdcfg to cd_table .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 35 ++- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 219 ++++++++---------- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 21 +- 3 files changed, 142 insertions(+), 133 deletions(-) base-commit: 57012c57536f8814dec92e74197ee96c3498d24e