Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4527474ioa; Wed, 27 Apr 2022 05:53:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCXoMkVzhe2D+RgUbVmvPO8ErYL1HBzk98pgqqO3kuqqEFJwc6OSsTBrTG9yU6MSKxd4OF X-Received: by 2002:a63:4a23:0:b0:39c:c255:11ef with SMTP id x35-20020a634a23000000b0039cc25511efmr23508983pga.569.1651064010202; Wed, 27 Apr 2022 05:53:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651064010; cv=none; d=google.com; s=arc-20160816; b=xkKgIy3N+2DQ/7xDAWLtWE7rBVg26QAL82RAF31SLGRKuoGL4sAuTa9PkWDBFIleoe 7HtzEspsTHd2z3CXc8WiBvXo+2BdYPa6zRllwKoURoO7Ea20vswvnb0q08Si+XxLv8JG m6x9mRkk3emNZmRIe02yjgbVEoDC2QytKXj47hGQiQKNlBXjybqAFDdRu7qIiPAK1KdE LcYdjHJVWvg+9SjKkk/DX5/kFqUo4JHSzMowfuynUJKaoe8A6na3mjJsuDONRlqvKCLb k0F6Qj3GYjvVhBg+AeNwmofjRAeCTpzomFDpCrBpuTCci1AIvmW09QCymv53tRWk95kK 2Q7A== 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=aKBRkdcOUK2pnp+vQSbUvbTqtIXnLKj0VJmSDmt7oC0=; b=P+ugFO4ZYYlz2m5lNyVSn1OPaP32MnwaWgy13nZFa2kWofMGQKhkyUk6kIcZwYo8vD 9ucRpV870WWjf3GMG5KCwk05PcBFVq2GmzZ08GplvkhNHlg0SSKQWnpaYFkphvYNgWM+ +CMBHKsWDPF8rv4qYfHKdemNHhx1ev2ZFHFDuUZP7Bfpo7JqSBbuaBZ925KuSyDeZwNg VNoE4x1egug9e+weCPjSrgo/cEhLGpHiCdQNlz1HciLqGdQGLYQZiQd03sABYh0yrfbd yIyjbV7MAN63IaJJMwXqRPIyaCI/32W6raaQQva/vHV/EULMU6aHBv6AS0nVhOjjLtsQ 0MEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=NHfKIFQJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id p9-20020a170902e74900b00158e93cfafesi1677221plf.132.2022.04.27.05.53.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 05:53:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=NHfKIFQJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3A9C84B415; Wed, 27 Apr 2022 05:29:02 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234010AbiD0McG (ORCPT + 99 others); Wed, 27 Apr 2022 08:32:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233952AbiD0McA (ORCPT ); Wed, 27 Apr 2022 08:32:00 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A6FA3CFE1; Wed, 27 Apr 2022 05:28:49 -0700 (PDT) Received: from zn.tnic (p5de8eeb4.dip0.t-ipconnect.de [93.232.238.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 03CBC1EC0535; Wed, 27 Apr 2022 14:28:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1651062524; h=from:from: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; bh=aKBRkdcOUK2pnp+vQSbUvbTqtIXnLKj0VJmSDmt7oC0=; b=NHfKIFQJ+SZeRMFRR7iG7AvrorZ4sGeAQW951IHLqZGiIhH8xsnL4MEoCvZdO988HVhjCs QiJ/yZkmdzpdCcjdb2XM/Jk4CwXtZtIij26TQdC9Zn+whgo9bcaGJcoQKIQwADOIUE7sTC lJ/9+OjkWEUKJjYRxqSk5MOYidSpSXw= Date: Wed, 27 Apr 2022 14:28:44 +0200 From: Borislav Petkov To: Juergen Gross , Tom Lendacky Cc: linux-kernel@vger.kernel.org, x86@kernel.org, linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, linux-hyperv@vger.kernel.org, virtualization@lists.linux-foundation.org, Arnd Bergmann , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Thomas Gleixner , Ingo Molnar , Dave Hansen , "H. Peter Anvin" , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Andy Lutomirski , Peter Zijlstra , "Michael S. Tsirkin" , Jason Wang , Christoph Hellwig , Oleksandr Tyshchenko Subject: Re: [PATCH 2/2] virtio: replace arch_has_restricted_virtio_memory_access() Message-ID: References: <20220426134021.11210-1-jgross@suse.com> <20220426134021.11210-3-jgross@suse.com> <1c1a4a7d-a273-c3b0-3683-195f6e09a027@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1c1a4a7d-a273-c3b0-3683-195f6e09a027@suse.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=no 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-kernel@vger.kernel.org On Wed, Apr 27, 2022 at 08:37:31AM +0200, Juergen Gross wrote: > On 26.04.22 19:35, Borislav Petkov wrote: > > On Tue, Apr 26, 2022 at 03:40:21PM +0200, Juergen Gross wrote: > > > /* protected virtualization */ > > > static void pv_init(void) > > > { > > > if (!is_prot_virt_guest()) > > > return; > > > + platform_set_feature(PLATFORM_VIRTIO_RESTRICTED_MEM_ACCESS); > > > > Kinda long-ish for my taste. I'll probably call it: > > > > platform_set() > > > > as it is implicit that it sets a feature bit. > > Okay, fine with me. > > > > > > diff --git a/arch/x86/mm/mem_encrypt_identity.c b/arch/x86/mm/mem_encrypt_identity.c > > > index b43bc24d2bb6..6043ba6cd17d 100644 > > > --- a/arch/x86/mm/mem_encrypt_identity.c > > > +++ b/arch/x86/mm/mem_encrypt_identity.c > > > @@ -40,6 +40,7 @@ > > > #include > > > #include > > > #include > > > +#include > > > #include > > > #include > > > @@ -566,6 +567,10 @@ void __init sme_enable(struct boot_params *bp) > > > } else { > > > /* SEV state cannot be controlled by a command line option */ > > > sme_me_mask = me_mask; > > > + > > > + /* Set restricted memory access for virtio. */ > > > + platform_set_feature(PLATFORM_VIRTIO_RESTRICTED_MEM_ACCESS); > > > > Huh, what does that have to do with SME? > > I picked the function where sev_status is being set, as this seemed to be > the correct place to set the feature bit. What I don't understand is what does restricted memory access have to do with AMD SEV and how does play together with what you guys are trying to do? The big picture pls. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette