From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EAF4C433EF for ; Thu, 23 Jun 2022 22:36:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9D1558E019B; Thu, 23 Jun 2022 18:36:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9815C8E0192; Thu, 23 Jun 2022 18:36:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8221D8E019B; Thu, 23 Jun 2022 18:36:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 6F5638E0192 for ; Thu, 23 Jun 2022 18:36:19 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 48258608B2 for ; Thu, 23 Jun 2022 22:36:19 +0000 (UTC) X-FDA: 79610960478.04.788BE2D Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) by imf22.hostedemail.com (Postfix) with ESMTP id D73D8C00C1 for ; Thu, 23 Jun 2022 22:36:18 +0000 (UTC) Received: by mail-pf1-f182.google.com with SMTP id bo5so921700pfb.4 for ; Thu, 23 Jun 2022 15:36:18 -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=BTIgkUt/48vjwewEjU9IxungLanIaqlKh/SLuzUnxW8=; b=RrSsDDhpkfmh/93ukUREG5c2Kn0Yg18gSfBi6eJ2rFn3uAxUl7o02Dw4httkbHRvGR N2973T3V/PSs8qlOjCzz6cLbeFspuBnx3+QcM/YctYSmryvIFy6c41h/dpKCZFGe9ywC u/V0fX5YCarOYM9/7rqJg/zcaCHolBG189q/cisNemTvGNHvJEo1MruXT9mgAgmsbjHw Jt+U64s9Zy/musXJXYahT3+jB6NS3E/ymNyu3gHzfW9a1pOXeGsVv3xwMNE5yJZ/JQwX WwRYy3RKk3fHYaGVGQ5uGWnlN0ighUxCcWPzmQYRFY3+C0pBF+2Ni3C689gWYBbt0gDZ OQyA== 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=BTIgkUt/48vjwewEjU9IxungLanIaqlKh/SLuzUnxW8=; b=CNn2DaDxpHd8aW3VmWyq1ksXZxOQs3MSOm57en5XeuCBQh/FqHq+78o5RlFT0NLVxF 50qN30Wl5B6b6HhODz0c5WugM845D3I4hQnyfCzEJhNcaF0FobjvTiQs+EBvX6xhKq6l 6R73WH2LJZKc4LzPEsu3hnUCOjeiFEi+nPF593wpBNOUmKDb4oFBLnm6xjElzrHsf5rC CbApwOz5UOW8S6MWGmbmnP5oP05KiID5F6jjp6nFEKWs2y/QriMOrzit12aq0Wf/tDUk qa6Y4lt7Omfjct2FwVphWPAk7t0lMDHdV9I4Hy827jxjgi9McjHXrnHi78MtqHFb1xHJ tg1g== X-Gm-Message-State: AJIora/6WOW9gIOzWaEDFTjsUlZA9TmVYY1MXIXIGAttvWsbfwMOQXvu N0HABOZBxjr4mo2KsldGKpL3cg== X-Google-Smtp-Source: AGRyM1u6KCaymoEQRa/9nnIjGl1gKuRl4oeOLYwzK0C4D+k0Jn2QSlDuhvvoXtdozKr/n5Lzp3xvEg== X-Received: by 2002:a63:8c47:0:b0:40d:2d4:e3a2 with SMTP id q7-20020a638c47000000b0040d02d4e3a2mr9566670pgn.2.1656023777743; Thu, 23 Jun 2022 15:36:17 -0700 (PDT) Received: from google.com (123.65.230.35.bc.googleusercontent.com. [35.230.65.123]) by smtp.gmail.com with ESMTPSA id n10-20020a170902e54a00b0016191b843e2sm285051plf.235.2022.06.23.15.36.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 15:36:17 -0700 (PDT) Date: Thu, 23 Jun 2022 22:36:13 +0000 From: Sean Christopherson To: "Kalra, Ashish" Cc: 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" , "bp@alien8.de" , "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: <25be3068-be13-a451-86d4-ff4cc12ddb23@intel.com> <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: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656023778; a=rsa-sha256; cv=none; b=ejZCC5AXnIY18Wwris1E0RF7UK8TexsbLzfbJIlSkNKKMcY71EQWk7G3aJ33Pju7KgIdcn 8O2dlroRKGLPTWYgwF3oTBvGh+upXQXQPiEJRGUke6WZkaqPR8KxyBS/DAEc3Qze/yCX3m Ztm27yTnF4pQkIba6m+jaOkcF+87xN4= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=RrSsDDhp; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf22.hostedemail.com: domain of seanjc@google.com designates 209.85.210.182 as permitted sender) smtp.mailfrom=seanjc@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656023778; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=BTIgkUt/48vjwewEjU9IxungLanIaqlKh/SLuzUnxW8=; b=kzHtITWgbtGtz+LWosyqgAaofeydXqrmJxVSwthfOZSh+8M66sLhi7N9UZNBnfgEhgCz6k 2bUAuEmV1GG7KQsPqRRNwR2vjZmb8GU4O9/HdpnXxM+z6ouuIbesELdFlbdSk8Ta/bGpU6 cx9c0vMv023QyQNKpUXOCjAVzzEy4vg= X-Rspam-User: X-Stat-Signature: ej47d1nfg5h8c6bz3y7uqauftisee79u X-Rspamd-Queue-Id: D73D8C00C1 Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=RrSsDDhp; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf22.hostedemail.com: domain of seanjc@google.com designates 209.85.210.182 as permitted sender) smtp.mailfrom=seanjc@google.com X-Rspamd-Server: rspam03 X-HE-Tag: 1656023778-954863 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Jun 22, 2022, Kalra, Ashish wrote: > On 6/22/22 12:43, Kalra, Ashish wrote: > >>> I think that needs to be fixed. It should be as simple as a > >>> model/family check, though. If someone (for example) attempts to use > >>> SNP (and thus snp_lookup_rmpentry() and dump_rmpentry()) code on a > >>> newer CPU, the kernel should refuse. > >> More specifically I am thinking of adding RMP entry field accessors so > >> that they can do this cpu model/family check and return the correct > >> field as per processor architecture. > > >That will be helpful down the road when there's more than one format. But, > >the real issue is that the kernel doesn't *support* a different RMP format. > >So, the SNP support should be disabled when encountering a model/family > >other than the known good one. > > Yes, that makes sense, will add an additional check in snp_rmptable_init(). And as I suggested in v5[*], bury the microarchitectural struct in sev.c so that nothing outside of the few bits of SNP code that absolutely need to know the layout of the struct should even be aware that there's a struct overlay for RMP entries. [*] https://lore.kernel.org/all/YPCAZaROOHNskGlO@google.com