From mboxrd@z Thu Jan 1 00:00:00 1970 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=-15.6 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_SANE_2 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 B7110C432BE for ; Tue, 31 Aug 2021 16:18:18 +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 7E9CF60FE8 for ; Tue, 31 Aug 2021 16:18:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7E9CF60FE8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GEUnyxBHqz0oPYxngBg+XKpdboj9OZEoBkt8kjnQIgs=; b=O+3cvxD68gxZQS 2XmfUdOEtIDI12N2Qo1TpRRpoZjE4dbDdJBzeZ0OeLjdiDMpzB2XOerZJuBZvuzEsoIZ4ZPwwwkC2 DMGWNt118Kt5tNdVuFPb9UWdBOm0Cbzf/T2W5roWNLDO6EWiq3s3DIZE9WW85YjAdjzhAmBywX0FX zxaA00ovjk+Q1Z0mwHtlZ9UoW/xxRA5xjXKvmZevV1DTmCFaTXU+biWuf9CvXcHe+AyAcoLP+a6LF gCTDraGgHViTsUCQLK1lSv7Q5tpsrx7Z22VD8PTKX1VXESz5edS8qRTLW5ULyimlvya+b+q0ZQluq zVGdAq59BE7xeJaeK9sw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mL6Qd-002hMK-AJ; Tue, 31 Aug 2021 16:16:03 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mL6QZ-002hLZ-DQ for linux-arm-kernel@lists.infradead.org; Tue, 31 Aug 2021 16:16:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630426555; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iC/vqrnC8agefEfcK8F2l8XU9S2U0FJkOrhS5FcGFpE=; b=aSvAww/6BKbX1a9UE5sPHXFH6C8bZR9Ki4sTE2Kj0n5hCPt4ctnfF2jaE7WKVAZCRjTmaN MzoAYg1QZzSw7PBRQZnKj/FNadiOhQks4LHVGGLSSHH5SK+bwrxbn+hoOWTzVq5Mb/jeRi rYETwzx6VGCgOmfehvr9msH12IzOjec= Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-136-mEAEbeNEOdu01C_aNipNng-1; Tue, 31 Aug 2021 12:15:52 -0400 X-MC-Unique: mEAEbeNEOdu01C_aNipNng-1 Received: by mail-il1-f198.google.com with SMTP id f13-20020a056e02168d00b002244a6aa233so11651320ila.7 for ; Tue, 31 Aug 2021 09:15:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=iC/vqrnC8agefEfcK8F2l8XU9S2U0FJkOrhS5FcGFpE=; b=csLBlMrGLcuDuFHo1R7E7nSOWLnZMe24lLb5tms2TiS0FIjvuL5tM9LMcQohZZY3VT nly5WtUFY0URAdb+h3IDOxKLBWDHgikoeU34dZoQk881KeempSA6oP8U8EeuX+LJi3m5 aLwDg+XDDho5ry3cswg9qRONepgIPZgvB87Ec09y7Cfu5LEwGlrn49zPkqF4wR+jBwkG pTFUJLzKy3BebE1BtI9GRHw6/XwlQxy5at0BEW4XpQepOO3gFYpWH8k65vsK9Jr3ktJ8 ZI04lANSb+ZQPScSvgbPsJSw4joFM6TkAMAX4TiHhBNhJoEUHUpLiFycH+audzlQxHlR Vr1g== X-Gm-Message-State: AOAM531G3EhxXDMotxXqHO/2Zg9tRHFitiGSW1yG8btZb8MlenE99P7n C6yeB1GazV2ZX0vgoYx6FnR+H0q5T4YcaNYTjpuGUc0h4JGgi+8/uYzQrtMw/0/lhbm+xAjlUfc oMdm+RjV4Y+2Bu8Q4pPJO2yrVqY/CtDistes= X-Received: by 2002:a92:1306:: with SMTP id 6mr10977687ilt.183.1630426552024; Tue, 31 Aug 2021 09:15:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyU8Gm8fnWRjCaSBCl5W6DLLHCeLpBofrbxoK/jTZqCPsDHAV1I8o6zW03fTiw16wfuaHsuSQ== X-Received: by 2002:a92:1306:: with SMTP id 6mr10977660ilt.183.1630426551786; Tue, 31 Aug 2021 09:15:51 -0700 (PDT) Received: from redhat.com ([198.99.80.109]) by smtp.gmail.com with ESMTPSA id u13sm9685406iot.29.2021.08.31.09.15.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Aug 2021 09:15:51 -0700 (PDT) Date: Tue, 31 Aug 2021 10:15:49 -0600 From: Alex Williamson To: Nicolin Chen Subject: Re: [RFC][PATCH v2 00/13] iommu/arm-smmu-v3: Add NVIDIA implementation Message-ID: <20210831101549.237151fa.alex.williamson@redhat.com> In-Reply-To: <20210831025923.15812-1-nicolinc@nvidia.com> References: <20210831025923.15812-1-nicolinc@nvidia.com> Organization: Red Hat X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=alex.williamson@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210831_091559_587085_14E2FA24 X-CRM114-Status: GOOD ( 26.13 ) 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: , Cc: kvm@vger.kernel.org, linux-doc@vger.kernel.org, Jonathan.Cameron@huawei.com, thierry.reding@gmail.com, will@kernel.org, jean-philippe@linaro.org, nwatterson@nvidia.com, corbet@lwn.net, joro@8bytes.org, Jason Gunthorpe , yuzenghui@huawei.com, "Tian, Kevin" , nicoleotsuka@gmail.com, eric.auger@redhat.com, thunder.leizhen@huawei.com, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, song.bao.hua@hisilicon.com, cohuck@redhat.com, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, robin.murphy@arm.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 30 Aug 2021 19:59:10 -0700 Nicolin Chen wrote: > The SMMUv3 devices implemented in the Grace SoC support NVIDIA's custom > CMDQ-Virtualization (CMDQV) hardware. Like the new ECMDQ feature first > introduced in the ARM SMMUv3.3 specification, CMDQV adds multiple VCMDQ > interfaces to supplement the single architected SMMU_CMDQ in an effort > to reduce contention. > > This series of patches add CMDQV support with its preparational changes: > > * PATCH-1 to PATCH-8 are related to shared VMID feature: they are used > first to improve TLB utilization, second to bind a shared VMID with a > VCMDQ interface for hardware configuring requirement. The vfio changes would need to be implemented in alignment with the /dev/iommu proposals[1]. AIUI, the VMID is essentially binding multiple containers together for TLB invalidation, which I expect in the proposal below is largely already taken care of in that a single iommu-fd can support multiple I/O address spaces and it's largely expected that a hypervisor would use a single iommu-fd so this explicit connection by userspace across containers wouldn't be necessary. We're expecting to talk more about the /dev/iommu approach at Plumbers in few weeks. Thanks, Alex [1]https://lore.kernel.org/kvm/BN9PR11MB5433B1E4AE5B0480369F97178C189@BN9PR11MB5433.namprd11.prod.outlook.com/ > * PATCH-9 and PATCH-10 are to accommodate the NVIDIA implementation with > the existing arm-smmu-v3 driver. > > * PATCH-11 borrows the "implementation infrastructure" from the arm-smmu > driver so later change can build upon it. > > * PATCH-12 adds an initial NVIDIA implementation related to host feature, > and also adds implementation specific ->device_reset() and ->get_cmdq() > callback functions. > > * PATCH-13 adds virtualization features using VFIO mdev interface, which > allows user space hypervisor to map and get access to one of the VCMDQ > interfaces of CMDQV module. > > ( Thinking that reviewers can get a better view of this implementation, > I am attaching QEMU changes here for reference purpose: > https://github.com/nicolinc/qemu/commits/dev/cmdqv_v6.0.0-rc2 > The branch has all preparational changes, while I'm still integrating > device model and ARM-VIRT changes, and will push them these two days, > although they might not be in a good shape of being sent to review yet ) > > Above all, I marked RFC for this series, as I feel that we may come up > some better solution. So please kindly share your reviews and insights. > > Thank you! > > Changelog > v1->v2: > * Added mdev interface support for hypervisor and VMs. > * Added preparational changes for mdev interface implementation. > * PATCH-12 Changed ->issue_cmdlist() to ->get_cmdq() for a better > integration with recently merged ECMDQ-related changes. > > Nate Watterson (3): > iommu/arm-smmu-v3: Add implementation infrastructure > iommu/arm-smmu-v3: Add support for NVIDIA CMDQ-Virtualization hw > iommu/nvidia-smmu-v3: Add mdev interface support > > Nicolin Chen (10): > iommu: Add set_nesting_vmid/get_nesting_vmid functions > vfio: add VFIO_IOMMU_GET_VMID and VFIO_IOMMU_SET_VMID > vfio: Document VMID control for IOMMU Virtualization > vfio: add set_vmid and get_vmid for vfio_iommu_type1 > vfio/type1: Implement set_vmid and get_vmid > vfio/type1: Set/get VMID to/from iommu driver > iommu/arm-smmu-v3: Add shared VMID support for NESTING > iommu/arm-smmu-v3: Add VMID alloc/free helpers > iommu/arm-smmu-v3: Pass dev pointer to arm_smmu_detach_dev > iommu/arm-smmu-v3: Pass cmdq pointer in arm_smmu_cmdq_issue_cmdlist() > > Documentation/driver-api/vfio.rst | 34 + > MAINTAINERS | 2 + > drivers/iommu/arm/arm-smmu-v3/Makefile | 2 +- > .../iommu/arm/arm-smmu-v3/arm-smmu-v3-impl.c | 15 + > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 121 +- > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 18 + > .../iommu/arm/arm-smmu-v3/nvidia-smmu-v3.c | 1249 +++++++++++++++++ > drivers/iommu/iommu.c | 20 + > drivers/vfio/vfio.c | 25 + > drivers/vfio/vfio_iommu_type1.c | 37 + > include/linux/iommu.h | 5 + > include/linux/vfio.h | 2 + > include/uapi/linux/vfio.h | 26 + > 13 files changed, 1537 insertions(+), 19 deletions(-) > create mode 100644 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-impl.c > create mode 100644 drivers/iommu/arm/arm-smmu-v3/nvidia-smmu-v3.c > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel