From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) (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 CFFD36AD4 for ; Fri, 22 Jul 2022 19:04:30 +0000 (UTC) Received: by mail-pg1-f177.google.com with SMTP id bh13so5143423pgb.4 for ; Fri, 22 Jul 2022 12:04:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=PY64yvYmGtR5KBgIEH0kskaa/Mhm9isORQuQT/+qOTg=; b=B2Av3DaoGRaE0kFsKvMfcCX99AkXfypknaWDXFb9SFwhHEv5JLdnDSAkfaX11dJGqo 38jEKQz554GRe3APlFdff074TrX3y2o35LNMi0grD5vMsxZBSdK8XPybeBXqrlkLioaF 6dFZxQQc7eoqXr6kzGWGceR/t4+aNbOPCNPgCd2lRG+Lahkdc1kih3rCqlEs45lXTpOh Z0Cq8DQqwON7l2Qh/AaLS8smpDrui6seUrMpJBw93tUooNboZt18afPmk4fle6cJ+lIW 7UDCjbm12Ec/v9+695QP6sQLn8d6aYLp3cOOPmBGmXKyuKSpihx4qvYz3VBRIr2q1/la F6LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=PY64yvYmGtR5KBgIEH0kskaa/Mhm9isORQuQT/+qOTg=; b=NF8x+BZ9CbSeACCguq+T8FeblXhEmD3x33qbNDQOemEji+9opKYMwwyczjNEas/qF1 YEjXCxqobT0nzm+EDqRnXjGhFENgCwN+RbmpVzfiXO04apIQ6mHIhIZGDiPmbruN2zD8 pAKQZRWtCJ+GRjR9Q5BB0VegNFw66wLAASh/6pNyaAC5rIPpClwa+lXuLYX0V4fXvx0Y F2Qj7h/uzDA84U0POis3e+Mg2YP9zuNK8RKWLsJct17rc3DphPnEbjSLpUwjLzu/exsN WAHHLx2b8ighvm7zAcBTjl9kxThWTG5ufo94GqJWpmID78umWcKDnkesGQGhfiUxhhcs v3kA== X-Gm-Message-State: AJIora9TK1NYVQTtFXZzCScCW+kOa0E90kgLF8/+g7+QH4EwpeJzBub5 53ZtGZN123VLQ3BN9nIx8lDw/w== X-Google-Smtp-Source: AGRyM1tXJ6+8d199UVPj6kD7+qncEimaUl/b0ptp5tdmerCUqKDRy2ff6UYP5+QOI8loO5mEiiiOrQ== X-Received: by 2002:a05:6a00:e8f:b0:528:a1c7:3d00 with SMTP id bo15-20020a056a000e8f00b00528a1c73d00mr1329285pfb.25.1658516670031; Fri, 22 Jul 2022 12:04:30 -0700 (PDT) Received: from google.com (123.65.230.35.bc.googleusercontent.com. [35.230.65.123]) by smtp.gmail.com with ESMTPSA id 186-20020a6215c3000000b0052536c695c0sm4365547pfv.170.2022.07.22.12.04.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jul 2022 12:04:28 -0700 (PDT) Date: Fri, 22 Jul 2022 19:04:23 +0000 From: Sean Christopherson To: Borislav Petkov Cc: "Kalra, Ashish" , Dave Hansen , "x86@kernel.org" , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "linux-coco@lists.linux.dev" , "linux-mm@kvack.org" , "linux-crypto@vger.kernel.org" , "tglx@linutronix.de" , "mingo@redhat.com" , "jroedel@suse.de" , "Lendacky, Thomas" , "hpa@zytor.com" , "ardb@kernel.org" , "pbonzini@redhat.com" , "vkuznets@redhat.com" , "jmattson@google.com" , "luto@kernel.org" , "dave.hansen@linux.intel.com" , "slp@redhat.com" , "pgonda@google.com" , "peterz@infradead.org" , "srinivas.pandruvada@linux.intel.com" , "rientjes@google.com" , "dovmurik@linux.ibm.com" , "tobin@ibm.com" , "Roth, Michael" , "vbabka@suse.cz" , "kirill@shutemov.name" , "ak@linux.intel.com" , "tony.luck@intel.com" , "marcorr@google.com" , "sathyanarayanan.kuppuswamy@linux.intel.com" , "alpergun@google.com" , "dgilbert@redhat.com" , "jarkko@kernel.org" Subject: Re: [PATCH Part2 v6 05/49] x86/sev: Add RMP entry lookup helpers Message-ID: References: <681e4e45-eff1-600c-9b81-1fa9bdf24232@intel.com> <99d72d58-a9bb-d75c-93af-79d497dfe176@intel.com> <5db37cc2-4fb1-7a73-c39a-3531260414d0@intel.com> Precedence: bulk X-Mailing-List: linux-coco@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: On Fri, Jul 22, 2022, Borislav Petkov wrote: > On Thu, Jun 23, 2022 at 10:43:40PM +0000, Kalra, Ashish wrote: > > Yes, that's a nice way to hide it from the rest of the kernel which > > does not require access to this structure anyway, in essence, it > > becomes a private structure. > > So this whole discussion whether there should be a model check or not > in case a new RMP format gets added in the future is moot - when a new > model format comes along, *then* the distinction should be done and > added in code - not earlier. I disagree. Running an old kernel on new hardware with a different RMP layout should refuse to use SNP, not read/write garbage and likely corrupt the RMP and/or host memory. And IMO, hiding the non-architectural RMP format in SNP-specific code so that we don't have to churn a bunch of call sites that don't _need_ access to the raw RMP format is a good idea regardless of whether we want to be optimistic or pessimistic about future formats. > This is nothing else but normal CPU enablement work - it should be done > when it is really needed. > > Because the opposite can happen: you can add a model check which > excludes future model X, future model X comes along but does *not* > change the RMP format and then you're going to have to relax that model > check again to fix SNP on the new model X. > > So pls add the model checks only when really needed. > > Thx. > > -- > Regards/Gruss, > Boris. > > https://people.kernel.org/tglx/notes-about-netiquette