Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp3964576ioa; Tue, 26 Apr 2022 13:33:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytVVosI3LwrdAq8C/hoAii+T35yOZ90rtEZmUDqm5Ve4OvF1GHu+RSOru3at1gb4p8C2BP X-Received: by 2002:a05:6402:330b:b0:425:eded:7cfe with SMTP id e11-20020a056402330b00b00425eded7cfemr11287146eda.357.1651005220098; Tue, 26 Apr 2022 13:33:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651005220; cv=none; d=google.com; s=arc-20160816; b=NI3iBj0xFCPt+pjY1rdLbhxmyfPrL/E9tLLx0AmO2O83hm4tscHXUbDQ2TElZrqeel gdjdGA1HWKv0A89jYEyQid4huYOZEmpreKEmnv65kWXjKeXxA/66DfL2C6IHG4g/uzB4 zgqKQkPa/+niYLC/RPX1t7nRfpu1brnGTuskOIRbDnkF6jXj5tclodRC9I0j2VxoqdH/ fbDQt/QVkaKW3l+69jzMUXY/9ytGXT6aNDyubRzWQHDDYWGMJtA55R05B+i5GzZIQMhA vkMxkukrUWWXXVtNd1tKRC7uMuCBxZ4rR5EjKnsclOH4JX8NeBI3oYyOm0ye/UKtmXn8 HIWA== 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=h+bc84mRmYRlYNbxmWNU0GwQyvZuKeQeEnipPuIp9GY=; b=05HjektIdzi/GX5J1avzgRh5IeuQMHgG2l64t48v+/nLyr2Tm9uh4eT1xZBJDDc0k4 xPggRctI83uAggEJHFeSsQo3NQQGa4QXBzgyK3I8mzweVxhJMSgNL9+tFg5P3C5yCOi4 ClNWi7wzZKPCkd8k0LBKUjTtE5249eBzKEowsQRvTz4bc3h0eiCWY8XEl2viErbN7Fyy Pv3z3Y5o12nfnlyFD/Ikw/oEmtLk0Aied7me2W2e1dz28aOOcVP00UyXdovb9jo8Dfrj FdreckM1sbo6TfRcJCzO+viDoO6NtOQCVIblfkk7bTOxBapvMgPXUjoGyu6DWA/0Hj5K HvqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=bUC3SbU1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r12-20020a170906364c00b006e839d9ca07si5194973ejb.156.2022.04.26.13.33.16; Tue, 26 Apr 2022 13:33:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@alien8.de header.s=dkim header.b=bUC3SbU1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352707AbiDZRi6 (ORCPT + 99 others); Tue, 26 Apr 2022 13:38:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241270AbiDZRiz (ORCPT ); Tue, 26 Apr 2022 13:38:55 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95BAD9D063; Tue, 26 Apr 2022 10:35:47 -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 1D31D1EC050D; Tue, 26 Apr 2022 19:35:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1650994542; 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=h+bc84mRmYRlYNbxmWNU0GwQyvZuKeQeEnipPuIp9GY=; b=bUC3SbU1q4pkL2uYn0yuJJLWaQB1dPeKFe3YcCb2d+b+rGdZway0GApfdJsF+GFvWp4Bj1 8pm/GYgfk3K2FF6ySF3bfX7GCq8d008K1RGQoWf9QXTN9xxEQTdoXNao334y+MzbGq84vQ ijLlvo+/qXx/BKqSIrdApscoK7UgrHI= Date: Tue, 26 Apr 2022 19:35:43 +0200 From: Borislav Petkov To: Juergen Gross 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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220426134021.11210-3-jgross@suse.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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-kernel@vger.kernel.org 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. > 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? In any case, yeah, looks ok at a quick glance. It would obviously need for more people to look at it and say whether it makes sense to them and whether that's fine to have in generic code but so far, the experience with cc_platform_* says that it seems to work ok in generic code. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette