Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp887474lqb; Wed, 17 Apr 2024 13:51:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXavNLSWq6MR7Tzr4aOcwnM0vBy56rrTqvCd1gEtm3QdY8g/tTXn4rZQCZSi/i6q7BIZlyr+iLVVRLhy6aJdkVfYE2xt+18FmAcc+c5Cw== X-Google-Smtp-Source: AGHT+IEmZAvrclH4FWB4rhO11MG+DrKOFoF4P8JpuMHdgb/BfDQVxQDpoXNLlmCo4iR+xZkiSstL X-Received: by 2002:a05:6a21:3985:b0:1aa:954f:d466 with SMTP id ad5-20020a056a21398500b001aa954fd466mr296642pzc.23.1713387086517; Wed, 17 Apr 2024 13:51:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713387086; cv=pass; d=google.com; s=arc-20160816; b=jw4F8ImC7i+NqyTrupdmkBKP+1nPHm1fj4fTnrxZPYK0gfUwb8sChHplqiLuT15lYY t9K/lHcNFHflOaCi4ySuQLJEnrO4AQWmlpyNQ5qGPlHGDtF/qpQyFwPowZ32TWjjbngW UcEYtj6GwTKm+8tSoBJt15bVC9ADlBA23xgx445dq+99eftdYYG1bIsp2KfBc6xnaQAp R4foaHPdl3ZSKUGLd1/FAtH2DTaEEqcXtp0Modt0uf8yhj93f8Z09tGJ6c+MwpQ8kheA +i+SettAO6VTdcoIgVTRLjennWA8h+PIHB/ik75cSTKzmapZNaYn6kjbLO8MwMYsu0Eo zjOQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=TQ8UBfLtnB0pD0hxcQ6cVxJfkeNDspNN+bEPey9C5HM=; fh=yOXSm0E/8tOfmRnhk0JfE6MKLQieMwDr2DHng9Fw+Y4=; b=emNpIxG+OrDHYvqnr4t3CEv4CI/7qeDnxH56AMj5M3U3SbyMAX4kkCjhhRZM99EDao R+DnCMUjJjA3AT9BhcPgqiS4ZIva8J6rQoJoO8Cr0SmI5w/9bXxf8RJulIfb5/uxQjtH nbp8A4qKZ51y+j/8Etfhekm94W+lK0ruC7lT3QjuBGE0xtCj3NhkFLBHf8LDKw5M2rn+ 6f+W5W4bo6N5rf48GOwcwWHStqY3FcNrD8htzxok/NbHJLZk3UetOwGonbyj9RB59cIs AYe2BAN+bgfA47ycEH/Lt9eq5tn3EnScMHgHwUljTM8ykkntap4XSG0z8MTAEopbY/AQ vtfA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=alien8.de dmarc=pass fromdomain=alien8.de); spf=pass (google.com: domain of linux-kernel+bounces-149216-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149216-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q5-20020a63d605000000b005dc894ea130si42841pgg.384.2024.04.17.13.51.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 13:51:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-149216-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=alien8.de dmarc=pass fromdomain=alien8.de); spf=pass (google.com: domain of linux-kernel+bounces-149216-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149216-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alien8.de 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id F3EE128720E for ; Wed, 17 Apr 2024 20:51:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A2780481AC; Wed, 17 Apr 2024 20:51:19 +0000 (UTC) Received: from mail.alien8.de (mail.alien8.de [65.109.113.108]) (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 776293D967 for ; Wed, 17 Apr 2024 20:51:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=65.109.113.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713387079; cv=none; b=qCY5xepV90EoVuF72U9yUywNHGpdUV0gzNR9ZX1yekGB+1MD2mbF66C5PfYJFYwkcJv1F3MFk4CoRvrltmE7tAyukfoeZj0XHKFpGaD9b9TgA4QVURq+Xao5UK4+k2+Axh1UaBLpeDrSnFAD7/vo+SaN1UbXXnJLSRq66IzFK10= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713387079; c=relaxed/simple; bh=25na2u5dqSMwdfKH+InG17crUdYa9TxiMOwoUCyo2Zg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=l+r/5A/QRmU5C4i9R+Qp1lWsxRONPHo7hDmpJyv/v7OmVReFALLTfuy0dIVAQAX2zKPOKOjpdGqpJ8Q+6XB7T/S8/egcHgfaSne/aXowf1UADh8Nb4SFuvRl3EsMYBfgmK3x03WJM86M5xs+PKqsAImMdowbMNYYjHhOGfi2aHc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de; spf=pass smtp.mailfrom=alien8.de; arc=none smtp.client-ip=65.109.113.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alien8.de Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id E478040E0177; Wed, 17 Apr 2024 20:51:14 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail.alien8.de Received: from mail.alien8.de ([127.0.0.1]) by localhost (mail.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id WjHW1JqznPJz; Wed, 17 Apr 2024 20:51:09 +0000 (UTC) Received: from zn.tnic (pd953020b.dip0.t-ipconnect.de [217.83.2.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 21AF640E00B2; Wed, 17 Apr 2024 20:50:54 +0000 (UTC) Date: Wed, 17 Apr 2024 22:50:48 +0200 From: Borislav Petkov To: Tom Lendacky Cc: linux-kernel@vger.kernel.org, x86@kernel.org, linux-coco@lists.linux.dev, svsm-devel@coconut-svsm.dev, Thomas Gleixner , Ingo Molnar , Dave Hansen , "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Dan Williams , Michael Roth , Ashish Kalra Subject: Re: [PATCH v3 02/14] x86/sev: Make the VMPL0 checking function more generic Message-ID: <20240417205048.GHZiA2KGbFFTQFyTAM@fat_crate.local> References: <1b0d8ec8e671ad957a2ad888725ce24edeedf74a.1711405593.git.thomas.lendacky@amd.com> <20240417114658.GHZh-2sk47TZgCp4Mb@fat_crate.local> <505dcf34-93ff-643c-b149-8ef9ce90c023@amd.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 In-Reply-To: <505dcf34-93ff-643c-b149-8ef9ce90c023@amd.com> On Wed, Apr 17, 2024 at 03:35:53PM -0500, Tom Lendacky wrote: > Well, it doesn't really modify any permissions that matter. It tries to > change the permission of a lesser privileged VMPL level. Potato potato. :-P > Since the kernel only runs at a single VMPL it would never be > effected. The operation performed here is to update VMPL1 permission > levels (which can only be done successfully at VMPL0) and return the > result of the operation. A success implies running at VMPL0 and > failure implies not running at VMPL0. Yap. The point is, it is calling RMPADJUST. And it does modify RMP permissions of a guest page. Thus, if you prefer, you can go all out and call the helper rmp_adjust_permissions(unsigned int tgt_vmpl, void *pa) and make it generic from the get-go. And then have the macro wrap around it in order to explain that particular use with the macro name. If it is still not clear what I mean, lemme know and I'll do a diff ontop. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette