From patchwork Thu Aug 17 18:16:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shavit X-Patchwork-Id: 13356862 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 6FDD9C2FC0F for ; Thu, 17 Aug 2023 18:21:46 +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=+mEcfsFoRGFbHDePxRP0pYxH3HieISlwMqgJr6SdEng=; b=cna Deg5W/sbtDIo1HpqbyHcMXuas4YQTSxr2ajZbG7vWaYXcQW1zXNiWGLTsRsLYdwJXHmYuGFWzutdz xgYcyZ10qodnj/qd8TXPIpGFgwUjoxPKNuI6e7E2z1vTo3KEv963KDS1k8Ac7SWYGpugIZfXwURlp g7hCACLP5pQS9Ja89U5cw9OCYzMgQ3A67mYuoLgtd2QYRcvk6BrhL8lq7PpMj7aDhFB30oiddwmtx A9FP0zeqHwdzDFyTqeP9Kgx0e8DE6NhY6IsOmrVqAD99Xc+gDvHnilBoCLYn3dmf7hVuBE7cVKMsL +JNymNlhhtK3e6qEvmTsFClq6WjNdiQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWhcS-006xId-0f; Thu, 17 Aug 2023 18:21:16 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qWhcP-006xGQ-1P for linux-arm-kernel@lists.infradead.org; Thu, 17 Aug 2023 18:21:14 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-58d799aa369so1590017b3.0 for ; Thu, 17 Aug 2023 11:21:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1692296468; x=1692901268; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=P1Ja32sydfixX+83wX7h07TiF6qtFK7RLvIEmQEzvNQ=; b=EGY/X/6YVNMl9wzbAPSer6AbPxtT5SVrmVIrLiBJ4HefEC6GJnzjLMx63wS78W8BZH ZO9oTY/H9wO9usAxg5l79kKbNGet0y3WIkBtpAWsgCn7Hj+1NdW7fQhkCVSJxyVPT5yu dlfwCrhLlEsovyvOhNMR7htDif1TP5vOX/VCy9+XPNJ0juLdtELvNQ45X4zZWNK6557O 1wW1MKBqJp+8NGvevNI48itGw+hQJj3lyhNkBQRxNx05/MvfElFUN4v24zbJ9cOiBaNr IyfMdlMTbRNI8c5EpG4lObiBkYhELtMefggRYEu1hh/UywHXvZge7lz5/bxxYOP+3Ara bOeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692296468; x=1692901268; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=P1Ja32sydfixX+83wX7h07TiF6qtFK7RLvIEmQEzvNQ=; b=Gw71tBJ4fvYNNqC7OjxYYrG6hY5NCr81RsjigrlriqF+4BifrJ0uzSzX0TxqxJZwHV L3K+kY4zQki7isA28+yA17j2oBtfA8CYGOMlbIAc7EEv3pI4UbCnyxoff3PjxfrjvNUk UCLjhnvtapxggpPDto/qt9u3b15xYEj9pqF5TFxvVxVV0S+Lo/jk4kCESia6x+LGSAXJ nOExKJA/jblDgKfYXcLcSGTutity5ByqoxbMQ9NibntD2LB0MmZ5lLHiQbnkaW5CQEBC /VCflZnmJU7tZbyNDPyvhjyFuZndB+vMgsMuAHXWDWKxjyBc1z9GLAFu+dMJliePwRJH zmIQ== X-Gm-Message-State: AOJu0YxxImNrMkQ691fBU/pHOjL741InTHdrgO8x2tiqP2W4GQFN2mkS kHoMAespEObgJZncGqWnMZ3c2BJuy/AG X-Google-Smtp-Source: AGHT+IG5oEIYVufYiNHO2XFMNMZIFA74NFPMUaOU4Q20FHYiA1poZhFU8Xuk/H5EktVEHQ/iC3xspN6l8hDZ X-Received: from mshavit.ntc.corp.google.com ([2401:fa00:95:20c:4a77:fd20:7069:bdf9]) (user=mshavit job=sendgmr) by 2002:a81:4304:0:b0:581:3939:59a2 with SMTP id q4-20020a814304000000b00581393959a2mr2498ywa.3.1692296468378; Thu, 17 Aug 2023 11:21:08 -0700 (PDT) Date: Fri, 18 Aug 2023 02:16:22 +0800 Mime-Version: 1.0 X-Mailer: git-send-email 2.42.0.rc1.204.g551eb34607-goog Message-ID: <20230817182055.1770180-1-mshavit@google.com> Subject: [RFC PATCH v1 0/8] Install domain onto multiple smmus From: Michael Shavit To: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: will@kernel.org, jgg@nvidia.com, nicolinc@nvidia.com, tina.zhang@intel.com, jean-philippe@linaro.org, robin.murphy@arm.com, Michael Shavit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230817_112113_476357_BBEBEB56 X-CRM114-Status: UNSURE ( 9.91 ) X-CRM114-Notice: Please train this message. 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 the arm-smmu-v3 driver to support attaching domains onto masters belonging to different smmu devices. The main objective of this series is allow further refactorings of arm-smmu-v3-sva. Specifically, we'd like to reach the state where: 1. A single SVA domain is allocated per MM/ASID 2. arm-smmu-v3-sva's set_dev_pasid implementation directly attaches that SVA domain to different masters, regardless of whether those masters belong to different smmus. If armm-smmu-v3-sva is handed iommu_domains that have a 1:1 relationship with an MM struct, then it won't have to share a CD with multiple domains (or arm_smmu_mmu_notifiers). But to get there, the arm-smmu-v3 driver must first support domains installed on multiple SMMU devices. This series depends on the CD table ownership refactor: https://lore.kernel.org/all/20230816131925.2521220-1-mshavit@google.com/ as well as the VMID IDA patch: https://lore.kernel.org/all/169087904450.1290857.11726985177314533259.b4-ty@kernel.org/#r This series is also available on gerrit: https://linux-review.googlesource.com/c/linux/kernel/git/torvalds/linux/+/24829/6 Thanks, Michael Shavit Michael Shavit (8): iommu/arm-smmu-v3: Add list of installed_smmus iommu/arm-smmu-v3: Perform invalidations over installed_smmus iommu/arm-smmu-v3-sva: Allocate new ASID from installed_smmus iommu/arm-smmu-v3: check smmu compatibility on attach iommu/arm-smmu-v3: Add arm_smmu_device as a parameter to domain_finalise iommu/arm-smmu-v3: Free VMID when uninstalling domain from SMMU iommu/arm-smmu-v3: check for domain initialization using pgtbl_ops iommu/arm-smmu-v3: allow multi-SMMU domain installs. .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 62 +++- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 348 +++++++++++++----- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 21 +- 3 files changed, 320 insertions(+), 111 deletions(-) base-commit: 6eaae198076080886b9e7d57f4ae06fa782f90ef prerequisite-patch-id: f701e5ac2cce085366342edff287a35d1cb82b9c prerequisite-patch-id: c8d21ff19c2c1dd18799a6b83f483add654d187e prerequisite-patch-id: 6ebba95cb12a723645843b4bd1bc45c94779d853 prerequisite-patch-id: 3f767e1c37d2996323c4f6d2a2d1912ab75281f7 prerequisite-patch-id: 5a4109fa3e22e2399ad064951c2ca1aeba4a68f7 prerequisite-patch-id: c4b3bd34b8be7afebd3e44bc4ec218d74753ce77 prerequisite-patch-id: 6d89e53518d25ac983ac99786950ee1a558c271f prerequisite-patch-id: 447219e565cadc34b03db05dad58d8e5c4b5a382 prerequisite-patch-id: 63adb2c3f97d4948d96a0d5960184f5ac814d7f7 prerequisite-patch-id: e71195fcf1aa56d8ef9d7403b9e4492c17b8fb84 prerequisite-patch-id: ba82add44850bf8fb271292020edb746aef93a65