From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4BA527D3E6 for ; Thu, 8 Feb 2024 15:42:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707406935; cv=none; b=EMmm7si2ZjxdV2WbimXJ+XhGxF0E0tSurQpre30HnG/8zOazx40Txi/i1AjHqsvdjMKkCnJ/SuhVqda2Kpm9SIIYACroBjI7T0mxg2dLJZJ3x2wpsGWpwAq0WMml5FM0PrioK2U1wd7xqdvFxmj9etuZPSV73jXY2Acm7JO4EJ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707406935; c=relaxed/simple; bh=w9YAG1hrdOLKVRmU2Ju+UZHvL6wgIxI0glE9I2YcTx0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Cf13TORDcZLQXH4zUkSJY2r/YVwxbIUT3RtC+X8xl/iC+WzvEvm3RbDQW8MkskLg0ZyY6jB/bFjeiPX80Bds8uK2nKc6nFMTVVwt5K5YYLQXl2p2Jw802x2fMX4SdhYkB8Ls6uE8TZCLyMZeOh1jJdK3ng1CdNP+9c5kyZs7IfE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=WwWVdabc; arc=none smtp.client-ip=209.85.167.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="WwWVdabc" Received: by mail-oi1-f171.google.com with SMTP id 5614622812f47-3bff3c0bd33so340727b6e.0 for ; Thu, 08 Feb 2024 07:42:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1707406932; x=1708011732; darn=lists.linux.dev; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=EZJRasN3voplU9h3tHiXSxFIE9VtiGQfUESd73+6hoQ=; b=WwWVdabc62y2LPfnhysNk7upzpvozPcFf42Y7bVZZG40UK5nsOhQWpgsMGetWFSz/5 8t4xBFRRf2FmvNXzUod2Sra2eHniosrNWrwPm+Mu2mDMPYBwRn6Sscw/HV49au8I54bD jti/FVx29hBkPrkTfFSCJM2tYiuoprHHRxo38RoWnJ5E3+ZpLSwQ3mZfDpiTVH6WN2uF v9LVT5JG3cogmLGRWiKdkUhv2DFZJPIbtoxRdhBrOa+882VTu1KHoytwwRJ7y7aSUx8c 5t7w2xUIoRfSJmPk0kRuMvWv5YBuz8rmSHENV9JG242YcUxu9lpp6sCvV+LRQ50tzlga xPdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707406932; x=1708011732; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=EZJRasN3voplU9h3tHiXSxFIE9VtiGQfUESd73+6hoQ=; b=GEnjWDUlp/L0KkB9L0WiCXUORYMBOwv38S0GGfGNOsqGPIL2V4cbB4gYBxvl8DNSdR xo8Lrv1u8Q4bPTu03fph2f2dvv9sYYVPhajaR3LxHlonBPfaatdlH6l7Hjeb8UKs8ybF Ft+lawr6QmQNPHKMHkGo3Ve3JqjF63d0MONlWeO0HNwXLOcSBwjGmE5PS07SJHmzT6Tg 2bnp78V7YzuvarTz0PbzhdtK5eDyksTScph3b13SMHQHiWkONqAvMDFweV76RApzNLD2 Fu8za7NJwV97vA4SGT8ROq/ttTsXSvGW97dT7WCFTy7RV0PuWsb0/fAzMhGT0xmRMQBs ATug== X-Forwarded-Encrypted: i=1; AJvYcCVrjDt6mVmqQxZZliT+1YSRhHg2cjQ6M+vooauzMCrT5L3z4J7/ecorcXVoqX1JQiOZEyJKUZBkPgtFLkyq2iz3wh/M2uo= X-Gm-Message-State: AOJu0YwDhm7MhnxRuERfy8KV9mgOn1qy7HrhEdCwQunJvf6zqAh2tbqa RwIrCu9NLvgOWMRGxHmJdDdU2h7icMnbYKb4z7z93Yg0GuUzpF5Q+2OHQaU44wA= X-Google-Smtp-Source: AGHT+IE3PwfxQpURBGAAKaS3krlWGtNcCQFNQCbN63NLhkJIwKeSQRRw4QXog/PeEJJ9jtMeD7pbPQ== X-Received: by 2002:a05:6870:a549:b0:219:6e95:c0b with SMTP id p9-20020a056870a54900b002196e950c0bmr9212306oal.31.1707406932405; Thu, 08 Feb 2024 07:42:12 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUJRKIjOTasKsfvjMG41fg04Gz0N8nhUWcyJoueInvQQj1iWgoAI0nY50rdIYU8xWMPhvKfmuq3c9Sby/wV8segekKILQ9yhLUq1xIoDEYUkUfJt03JzScQHC1VvH4cfiroLmGzW07CPGzqv94eX9A2WbgOLad9lAKDmF7zEXJY1tQaY+USY4MyH+ArCgX50PFUXuVoeR4yFn7EaG+60KuYq0TVz60HhXknNfm5Zz7YzZTXEzV77E4ZWRmzFmrnQtd4aaZ7Gd+ejrROXK9Eb9q4yoIx14Bomks+X8zxEI1Tq/tTWuxGys7Ysi0+nxjO296l1W6GLgmF+VxI3SQ6DYqCWr/WpchzRutRQCJFBASfcXA4Rm+P0OV7j51wkihCQFJVDS/hHzWLflTcWcpOyW5rIVSb0lB5JWUBiphnWaxKfXnfl16OLYdWaJCU Received: from ziepe.ca (hlfxns017vw-142-68-80-239.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.80.239]) by smtp.gmail.com with ESMTPSA id eg50-20020a05687098b200b00210cc6cc9eesm777401oab.33.2024.02.08.07.42.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 07:42:11 -0800 (PST) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1rY6XS-00Etmp-Pg; Thu, 08 Feb 2024 11:42:10 -0400 Date: Thu, 8 Feb 2024 11:42:10 -0400 From: Jason Gunthorpe To: Shameer Kolothum , Sean Christopherson Cc: kvmarm@lists.linux.dev, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linuxarm@huawei.com, kevin.tian@intel.com, alex.williamson@redhat.com, maz@kernel.org, oliver.upton@linux.dev, will@kernel.org, robin.murphy@arm.com, jean-philippe@linaro.org, jonathan.cameron@huawei.com Subject: Re: [RFC PATCH v2 4/7] iommufd: Associate kvm pointer to iommufd ctx Message-ID: <20240208154210.GP31743@ziepe.ca> References: <20240208151837.35068-1-shameerali.kolothum.thodi@huawei.com> <20240208151837.35068-5-shameerali.kolothum.thodi@huawei.com> Precedence: bulk X-Mailing-List: iommu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240208151837.35068-5-shameerali.kolothum.thodi@huawei.com> On Thu, Feb 08, 2024 at 03:18:34PM +0000, Shameer Kolothum wrote: > diff --git a/drivers/iommu/iommufd/iommufd_private.h b/drivers/iommu/iommufd/iommufd_private.h > index 991f864d1f9b..28ede82bb1a6 100644 > --- a/drivers/iommu/iommufd/iommufd_private.h > +++ b/drivers/iommu/iommufd/iommufd_private.h > @@ -16,6 +16,7 @@ struct iommu_domain; > struct iommu_group; > struct iommu_option; > struct iommufd_device; > +struct kvm; > > struct iommufd_ctx { > struct file *file; > @@ -27,6 +28,8 @@ struct iommufd_ctx { > /* Compatibility with VFIO no iommu */ > u8 no_iommu_mode; > struct iommufd_ioas *vfio_ioas; > + /* Associated KVM pointer */ > + struct kvm *kvm; > }; Associating the KVM with the entire iommufd is a big hammer, is this what we want to do? I know it has to be linked to domain allocation and the coming "viommu" object, and it is already linked to VFIO. It means we support one KVM per iommufd (which doesn't seem unreasonable, but also the first time we've had such a limitation) The other option would be to pass in the kvm to the individual sub objects. Kevin? Sean would you be OK with this approach considering your other series to try to make more of this private? Jason