Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp902961imi; Fri, 22 Jul 2022 12:09:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uSZmRRlqg3nw4ce7opr7OcTi3JO7w5YNZw3nxaBH+yWVNnSh9oJL/Wska2xW4DEG32ClmA X-Received: by 2002:a17:906:8a4a:b0:72b:5b23:3065 with SMTP id gx10-20020a1709068a4a00b0072b5b233065mr1016959ejc.557.1658516962722; Fri, 22 Jul 2022 12:09:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658516962; cv=none; d=google.com; s=arc-20160816; b=Ilo9ukEQxKNBJ6I87B15qEMNh1pqxN3USMhkUkm+3moitm/9396X5cG40JzQPcX9Ka dkefKa+8+zzN5xBbBwkWtNqi+lE6yl7MJkrx2GhcBoC92OKib4IFF5ljU2xHiQy1iD2o JrNRveg4amGkgdMqKgKnigaGfPiVvZ41V+rIbXJF1Ypm0o2lGi6lydpzzlvIFCr/FSMh Is4bnFTyqSFGLZW6lQS/miElOycOeQBHCWbYJZYPlUXAsRl+jaRp0+FLvSrDQrmGNRY5 UleBjvpqpgUAiST2N/oONGjXonTuBcxm3yepEcyFPF2XnAYIVhKqWLsbSNwCSIacy6CU VhOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=PY64yvYmGtR5KBgIEH0kskaa/Mhm9isORQuQT/+qOTg=; b=Qa5plfRuyY+r0BuS2TWFw5s2zTMViBfbXirdhByqmOZvD544JoCULedoHOBzyF6OY6 2I3kmJ4KQmNGLCKERezlmj6uqYijAjDwjdXW/bPptzxVcYmJbC4dAelnpIJ/Vug8QtME BO6IQ2PzmEmF/BVAXERtIOCRafBOsRihosYkHMcsdDA5B1MV49dslNke0G23VMFT+yn5 wYOs1YP2vqeNvJ8zyhMl5F19mRls/R/T0rhDxx62cEA6sKJSs23Zv7BX7a3cvzH3PlB9 XNWQVt0dm8Ntwx1Bbg1LeSLhXVV02KA0QLZokhDL870xOP1R9qL2MRB6tZCPQb7j6Zlw LV+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=B2Av3Dao; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h7-20020a05640250c700b0043a9e920c24si7330596edb.3.2022.07.22.12.08.43; Fri, 22 Jul 2022 12:09:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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; dkim=pass header.i=@google.com header.s=20210112 header.b=B2Av3Dao; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234270AbiGVTEc (ORCPT + 99 others); Fri, 22 Jul 2022 15:04:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231304AbiGVTEb (ORCPT ); Fri, 22 Jul 2022 15:04:31 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA29AA7204 for ; Fri, 22 Jul 2022 12:04:30 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id w205so1868367pfc.8 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=No3a8+/p/vF74dYU2SPtzU21xBNGOsbhBHVSC7FVxjpPUJLhULBeCvjLgab6g7PEFR e3ZqrOoRvPAtbp6PCosjNS7emDLOjVHKE990X6wrFVk/6mopZ/3z1ugMWl9P1O7f69vC lwti8IwLVGbPnu0Yk4J23CeLPAbvvgecI80AbaofhZUdF/FHVhwt64p0bc2bZTgGseZI +kbfoJX/aDYOIbSHasHBgI7WC97ZOti95rcHszQi18R7RC7aaTlZ7FpMRGu5Gb9LmjfL UldxlDvezlo2owIB/99YXofuBM2czOQ1HrJqkaY8qcOUo/7ZrqmYfVTeFtI2MLUzS4RV T+LQ== X-Gm-Message-State: AJIora/4Izb4AQJO05ZDOm+g11Bfg9cqgkRp2Or1i17NkRu4nWlwGdD6 NC8PqWeN0sVskL2syPCQac0C/w== 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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-crypto@vger.kernel.org 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