Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp4760900rwb; Tue, 17 Jan 2023 05:17:56 -0800 (PST) X-Google-Smtp-Source: AMrXdXuC1bCc5sHrD2eNBg4tqCF3LzMF71BePXG2nrglYFContz21gQ4wCcgAXv5xq3JsJQ/Pmou X-Received: by 2002:a05:6402:4284:b0:499:b672:ee30 with SMTP id g4-20020a056402428400b00499b672ee30mr3723453edc.11.1673961476111; Tue, 17 Jan 2023 05:17:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673961476; cv=none; d=google.com; s=arc-20160816; b=ZFcsqiLEFTZS3K2B1y92p7ZviALXG19i7xuP/UN/OS4KZ3X/CVjn9L0qrK9aj6Wf5H tYloX5HiwMh2e4GF1bwP3U10qMVwthkTVrp3honcWkC7Dggn3YK5GTb5VmrFo2ExlgtI ixz2fGKsdpl/Paa5ix+mFfj96zn8V7QbNGNvBMVozdtkl0Kp3QHkhuQM7o+4D282BNkW oRM8MIGvrrRj1tL0FYcyrYesrKAb/FvXzt8LK7rC9SDorLNvVHWFXAyM+HYjE+etOm72 iFYGWycjZV++YPg9etBtfJhPKIICsv/7Q9syBIeSkhpz9dBIvjcRk8jtOygE/FCcNY8N NlQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=w4EAPgYd0bItuwjKqf/LtE4eI6/OLa+Yhu1tCFKUlW8=; b=fxd5wF+CBFoyPPjHlJiBk+cw3bxXBR1Pc0JtP8rKsjHrrh1AgGoTr1K68JIHcWmtEp ugFl7WxIBq6TPZBzFgv+Km9HDTZ80Z/N6+n/sTCn9wR+UWqFkN4iXpJZDtzo4azC4r8h VttYibPEiYx/f1X2nZJqaesBLfufMhCjZJS1VxX5GLx+6YaPf96AgLJrb1wmJWuRp/V7 0xhdf1imwwLDQ4cGlbXNia+FpUnK+Dpoi2LqdcdCv+8rOQnf+I0kjcHVmEOQRHpNY/ZH O1/OuOploE+XYHnPf/1lZWSmble8v5b6s3WEuuPq6HHIwwF0q7H2EBUoxwWG8TpZUTcY jNJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q31-20020a056402249f00b00499cfd87fc0si23191466eda.71.2023.01.17.05.17.44; Tue, 17 Jan 2023 05:17:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237015AbjAQMwR (ORCPT + 48 others); Tue, 17 Jan 2023 07:52:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236959AbjAQMvt (ORCPT ); Tue, 17 Jan 2023 07:51:49 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 048B738EB2 for ; Tue, 17 Jan 2023 04:51:12 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F0875C14; Tue, 17 Jan 2023 04:51:53 -0800 (PST) Received: from [10.57.75.222] (unknown [10.57.75.222]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8D9763F67D; Tue, 17 Jan 2023 04:51:10 -0800 (PST) Message-ID: Date: Tue, 17 Jan 2023 12:51:03 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH 3/4] iommu: Introduce IOMMU call-back for processing struct KVM assigned to VFIO Content-Language: en-GB To: "Suthikulpanit, Suravee" , linux-kernel@vger.kernel.org, iommu@lists.linux.dev Cc: joro@8bytes.org, ashish.kalra@amd.com, thomas.lendacky@amd.com, vasant.hegde@amd.com, jon.grimm@amd.com References: <20230110143137.54517-1-suravee.suthikulpanit@amd.com> <20230110143137.54517-4-suravee.suthikulpanit@amd.com> <04dc1bc9-05ed-f6ed-f01f-7d28600fc0ce@amd.com> From: Robin Murphy In-Reply-To: <04dc1bc9-05ed-f6ed-f01f-7d28600fc0ce@amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023-01-17 04:20, Suthikulpanit, Suravee wrote: > Hi Robin, > > On 1/10/2023 10:11 PM, Robin Murphy wrote: >> On 2023-01-10 14:31, Suravee Suthikulpanit wrote: >>> Currently, VFIO provide an kvm_vfio_file_set_kvm() interface for >>> assigning >>> a KVM structure to a VFIO group. The information in struct KVM is also >>> useful for IOMMU drivers when setting up VFIO domain. >>> >>> Introduce struct iommu_domain_ops.set_kvm call-back function to allow >>> IOMMU drivers to provide call-back to process the struct KVM assigned. >> >> Hmm, it sounds like this has quite some overlap of intent with the >> existing "enable_nesting" op, and my gut feeling is that it's not >> great to have two completely different "this is a VFIO domain" >> mechanisms... :/ >> >> Robin. > > Actually, the intention is to communicate KVM information, which is > already available to the VFIO down to the AMD IOMMU driver layer. I am > not sure if the enable_nesting() has enough information or the same > intention since that only communicates VFIO domain information. Sure, but from the high level view, we have on the one hand an API for "I want to use this domain in a VM (with nested paging)" and on other an API for "I want to use nested paging in this domain (for a VM)", so clearly it would be most sensible to converge on a single API for what is ultimately one single overarching use-case. I'm not claiming that the existing enable_nesting op is anywhere near the right design either; in fact I'm pretty sure it isn't, if the Arm SMMU drivers ever want to contemplate sharing stage 2 pagetables with KVM also. Cheers, Robin.