Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1468301rbb; Mon, 26 Feb 2024 10:07:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWsmQI4P4uWPEBAg8yol7fAFE+OAxUm69af5va4NvnRjmbShT2XpLHftBm8Q+3NBlYVvLtnbWIklrd9xn/PoBypqpAbmoKRscZiTZAfRA== X-Google-Smtp-Source: AGHT+IHqCL9QBXKmVnU0JEGj3NFBliz3EKL/s84piWRrvchJezKQ8yTEAkVsFDBrbWpatEqmqxtG X-Received: by 2002:a9d:4b02:0:b0:6e4:8a2b:40e8 with SMTP id q2-20020a9d4b02000000b006e48a2b40e8mr7176451otf.32.1708970844184; Mon, 26 Feb 2024 10:07:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708970844; cv=pass; d=google.com; s=arc-20160816; b=JfQACoY6lVhmbCPc7kIH2K7J84mwl41pkngUM5KYsoGSNuIbLZEEAoNHkKaWRykBPk a9k9fpbVXZ82/zHS7lKXhM7+vQ0Fu+rqWxwf9yfUrOVFCsL0ByljX2CsjyB2rA2FGx83 syDt1mwgueuJUafrEL9uXxxP+gTL1bavxZyvb4o+VJ1Adf1oowYyfFBtKblxth2JGbSe 6EchwpihI19aoy9H6+orEFXfWzrEdpKDECCYduazDtd+MjiV8PnWiEzCUW1DSSTi7BbJ eRGB7IVFb24YLk8h+rjXw9vX/v52Qfnw0nkFsWq0rZO6YWRCdB2JTKv6G9IIFY1IilE2 WdYg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=IaM7wZc4XAIVeA2SqAhr6CIwg6pCtQktHJ/ff7hLmaY=; fh=yVF269ls2b2edeHc2bqflDQlQlVFa7Hf1Kqb2tXeh9E=; b=PzzdHHFQLtiqUTQzFCiw3BGNx2MeDaM/lFOW/MDxQqIyBCCEq6iA08gBEG42L7Vdng hJkLyyTi7gve2mZozBQ7lqstP/cO5ZvjpL6rumtFTKCwmftvuvy9jcyYXVvzllRJ/JGL RYfLdmOUxR3iY+8nas7ASlTp7N+ct62bjHdJk0KBqI1oiTo5ULGeoP6OelBoLIS+2J2q ygmrtNfpfGDtlkxB/Md9854vyhPZ2dGM3oWjjdTCON7O32g5sGt2ueAhfSnEZzLnKgJ5 DmSndK/E4dKkEKjo3q3cBxIxJJkPK1stbBIJf1Fobr3WeXFopiBT5YTHjG2IlaYJArgj e7NQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fvBEiuVT; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-82121-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82121-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y13-20020a05622a164d00b0042e67d89c64si5917356qtj.123.2024.02.26.10.07.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 10:07:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82121-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fvBEiuVT; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-82121-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82121-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E8C7F1C2BCC4 for ; Mon, 26 Feb 2024 18:07:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AD8D012EBF8; Mon, 26 Feb 2024 18:07:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fvBEiuVT" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9FEFE1292FF; Mon, 26 Feb 2024 18:07:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708970835; cv=none; b=ssG1FU8VXYO8nP6NbJzAPOZIwbU5Zwa2/OFiUt437aKKNze/QMWr/jNjfWHbRBv2w+nUWSFyftPf5Bd7l9MHWGxqxEV7KBE15A4mXcRcMxdnpFfdxwSXT5nAIYTV2TNJGctvddLdkAQ/MsOEZEgeeFxKVtTd4jb4c9ZVFZr4R6U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708970835; c=relaxed/simple; bh=Ah4K95o9NohIieqV9hLq8pAEFQiM8C/l4p3fKUsB1Ts=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PP5+zTXmkXmFWh5mByxaIY5g2X8KwSUKVEW9Y+AJh87zklXupN4kqp+Wag0xH/NDwscAb6B/ednLqi/H0p+1beqKqFBQNCdiFvljv5GsThZrX74735e3o4CCg1oIuAH1Ct9GK2PRircGI7Y+BbD+LHZUT8twiUJwd9pVCXh+SIA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=fvBEiuVT; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708970834; x=1740506834; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=Ah4K95o9NohIieqV9hLq8pAEFQiM8C/l4p3fKUsB1Ts=; b=fvBEiuVTXYhlQ4UzO7+DIUYX2N1EPXi/fg9jANJxGv7ZFemOT7pBdE+N vi30mvW4qSI5f/M8vQdsZHJ5Eb6dLdKrCDY7+6KjRRlPONDqPCViPjT/r 5fIbGSs58u8nv0BNjuiDsF4WjpxmFiQLqUrNUmGssdTc1qsztZYNpIW5m 0dLZJmUrgmJSNUb1/PBBGy8HK6z6vJIXOmNuyVxStAbrt+RT8FJbCNlYN 9U3BirY+XmkqJd6zFSFghLCpQwtn+lgE7KQfTcimGZ6zB8VXZfiniMuTV DX66uUqh6FZMnFyMH2fAng6odZPl74Johx19xXUPw8hfL3I2++WH4mjtl w==; X-IronPort-AV: E=McAfee;i="6600,9927,10996"; a="13913522" X-IronPort-AV: E=Sophos;i="6.06,186,1705392000"; d="scan'208";a="13913522" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 10:07:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,186,1705392000"; d="scan'208";a="29927118" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 10:07:12 -0800 Date: Mon, 26 Feb 2024 10:07:12 -0800 From: Isaku Yamahata To: David Matlack Cc: Sean Christopherson , isaku.yamahata@intel.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, isaku.yamahata@gmail.com, Paolo Bonzini , erdemaktas@google.com, Sagi Shahar , Kai Huang , chen.bo@intel.com, hang.yuan@intel.com, tina.zhang@intel.com, gkirkpatrick@google.com, Vipin Sharma , isaku.yamahata@linux.intel.com Subject: Re: [PATCH v18 064/121] KVM: TDX: Create initial guest memory Message-ID: <20240226180712.GF177224@ls.amr.corp.intel.com> References: <97bb1f2996d8a7b828cd9e3309380d1a86ca681b.1705965635.git.isaku.yamahata@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Thu, Feb 01, 2024 at 03:06:46PM -0800, David Matlack wrote: > +Vipin Sharma > > On Wed, Jan 31, 2024 at 4:21 PM Sean Christopherson wrote: > > On Mon, Jan 22, 2024, isaku.yamahata@intel.com wrote: > > > > The real reason for this drive-by pseudo-review is that I am hoping/wishing we > > can turn this into a generic KVM ioctl() to allow userspace to pre-map guest > > memory[*]. > > > > If we're going to carry non-trivial code, we might as well squeeze as much use > > out of it as we can. > > > > Beyond wanting to shove this into KVM_MEMORY_ENCRYPT_OP, is there any reason why > > this is a VM ioctl() and not a vCPU ioctl()? Very roughly, couldn't we use a > > struct like this as input to a vCPU ioctl() that maps memory, and optionally > > initializes memory from @source? > > > > struct kvm_memory_mapping { > > __u64 base_gfn; > > __u64 nr_pages; > > __u64 flags; > > __u64 source; > > } > > > > TDX would need to do special things for copying the source, but beyond that most > > of the code in this function is generic. > > > > [*] https://lore.kernel.org/all/65262e67-7885-971a-896d-ad9c0a760907@polito.it > > We would also be interested in such an API to reduce the guest > performance impact of intra-host migration. I introduce KVM_MEMORY_MAPPING and KVM_CAP_MEMORY_MAPPING with v19. We can continue the discussion there. -- Isaku Yamahata