Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4454261rwb; Mon, 21 Nov 2022 07:48:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf5C4+gOLI5sBxDMZ/XqjHcWI9u2Xmp1pr2FRNbVjxQ2FjWCwMZjV48LNto0rDF0hOovoal+ X-Received: by 2002:a05:6402:3807:b0:45c:a651:87f1 with SMTP id es7-20020a056402380700b0045ca65187f1mr436403edb.359.1669045682748; Mon, 21 Nov 2022 07:48:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669045682; cv=none; d=google.com; s=arc-20160816; b=PdbScFkz2JETDqEYbz3iFrLFGIJnFYavBGcC7oMbuipfn0sSh+VDzyCpdgigZPoSz7 juK3KtjOvftW4m4OK/90QZr9ax1A0785xki7vRRQfUNSB3Xjw+qt4huovTfTc5YTE7/d db/G/g0ZtsZSl+rIIYH0tkVjn+YL8BNWAJYI8vDmFaMwhLvmZplpcfIGKZhqa6uiG02E 2aVhGtInbIB+diEYHZgI9mUYAI8OVPT+oUU2XsPbJEV4XnwYLsSHzewNBJez7kI+FEfV 6/K34kyd96kz2FymKpexVJyrZT/b/oRoUc4RSX+BY4vrk/vckDSEH6qfkgbp1gGRPR/V Htww== 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=Ad0xyJQtRuj2l0HKhWgNpGUpnSMGJ0sK9iQrDE+ZQ9k=; b=ptS8KYwqCCcTqF3v4Oz0P5sxZPuydw9riv2MingyW+KA9PfWTMZMW3Mgv9fE7kYvNJ yV/L62ndjUEb9g/ZLvwToDNj977niTznBP41MYLnCttHJ/l2p6C2jcjk6RoAl9TcAuw9 KJq2ySlg/M7IXvl0zPzH50Wvtbd8otQcQZBQZGmmsrK798lW0R2CzGMcJq2fnWMh5jVq vMzbzyt58Xuup+yGceWW9avD+opxgJRW/csdGu0lAi+EoaTUKZrboK29Oh9vIudJTrtu 0hVHt9efcc1DByp+SMHy4xZUzGV8LNpwZ1lzAfT7v4FCwY63aBITZbqRVZXjiNLSaVot lA/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=UxVYoF3E; 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 cr17-20020a170906d55100b00780a882d337si10017521ejc.480.2022.11.21.07.47.31; Mon, 21 Nov 2022 07:48:02 -0800 (PST) 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=UxVYoF3E; 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 S231130AbiKUPLK (ORCPT + 92 others); Mon, 21 Nov 2022 10:11:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232053AbiKUPKx (ORCPT ); Mon, 21 Nov 2022 10:10:53 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B895CBE252; Mon, 21 Nov 2022 07:03:12 -0800 (PST) Received: from zn.tnic (p200300ea9733e725329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ea:9733:e725:329c:23ff:fea6:a903]) (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 45E7E1EC064C; Mon, 21 Nov 2022 16:03:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1669042991; 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=Ad0xyJQtRuj2l0HKhWgNpGUpnSMGJ0sK9iQrDE+ZQ9k=; b=UxVYoF3Ez3k9aL2h4PQRxGYz0bNOj11by8YRTCWsFJS4EMjNk4OCRpnme2Scpi73L/9qlf IbNFDMlblbgrdYpZBKjhcf3pXJPR5glZBVzvEMcTFrrAYXrhOqK8c7sDEXcYzkH5YxdjyL AvxLtCqL6o1513540e1ijOqmzdvqdA8= Date: Mon, 21 Nov 2022 16:03:07 +0100 From: Borislav Petkov To: Michael Kelley Cc: hpa@zytor.com, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, luto@kernel.org, peterz@infradead.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, lpieralisi@kernel.org, robh@kernel.org, kw@linux.com, bhelgaas@google.com, arnd@arndb.de, hch@infradead.org, m.szyprowski@samsung.com, robin.murphy@arm.com, thomas.lendacky@amd.com, brijesh.singh@amd.com, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, Tianyu.Lan@microsoft.com, kirill.shutemov@linux.intel.com, sathyanarayanan.kuppuswamy@linux.intel.com, ak@linux.intel.com, isaku.yamahata@intel.com, dan.j.williams@intel.com, jane.chu@oracle.com, seanjc@google.com, tony.luck@intel.com, x86@kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, netdev@vger.kernel.org, linux-pci@vger.kernel.org, linux-arch@vger.kernel.org, iommu@lists.linux.dev Subject: Re: [Patch v3 07/14] x86/hyperv: Change vTOM handling to use standard coco mechanisms Message-ID: References: <1668624097-14884-1-git-send-email-mikelley@microsoft.com> <1668624097-14884-8-git-send-email-mikelley@microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1668624097-14884-8-git-send-email-mikelley@microsoft.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 Wed, Nov 16, 2022 at 10:41:30AM -0800, Michael Kelley wrote: > Hyper-V guests on AMD SEV-SNP hardware have the option of using the > "virtual Top Of Memory" (vTOM) feature specified by the SEV-SNP > architecture. With vTOM, shared vs. private memory accesses are > controlled by splitting the guest physical address space into two > halves. vTOM is the dividing line where the uppermost bit of the > physical address space is set; e.g., with 47 bits of guest physical > address space, vTOM is 0x40000000000 (bit 46 is set). Guest phyiscal Unknown word [phyiscal] in commit message. Suggestions: ['physical', 'physically', ... ] Please introduce a spellchecker into your patch creation workflow. ... > @@ -108,6 +115,7 @@ u64 cc_mkenc(u64 val) > switch (vendor) { > case CC_VENDOR_AMD: > return val | cc_mask; > + case CC_VENDOR_HYPERV: > case CC_VENDOR_INTEL: > return val & ~cc_mask; > default: > @@ -121,6 +129,7 @@ u64 cc_mkdec(u64 val) > switch (vendor) { > case CC_VENDOR_AMD: > return val & ~cc_mask; > + case CC_VENDOR_HYPERV: > case CC_VENDOR_INTEL: > return val | cc_mask; > default: Uuuh, this needs a BIG FAT COMMENT. You're running on SNP and yet the enc/dec meaning is flipped. And that's because of vTOM. What happens if you have other types of SNP-based VMs on HyperV? The isolation VMs thing? Or is that the same? What happens when you do TDX guests with HyperV? This becomes wrong then. I think you need a more finer-grained check here in the sense of "is it a HyperV guest using a paravisor and vTOM is enabled" or so. Otherwise, I like the removal of the HyperV-specific checks ofc. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette