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 X-Spam-Level: X-Spam-Status: No, score=-8.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 252D3C4338F for ; Mon, 9 Aug 2021 10:23:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0C7B261078 for ; Mon, 9 Aug 2021 10:23:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234782AbhHIKXu (ORCPT ); Mon, 9 Aug 2021 06:23:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:33998 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234717AbhHIKXq (ORCPT ); Mon, 9 Aug 2021 06:23:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628504605; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lBMgmsHqw0YdLKVpdWLFV60bEE3X7POBff7kY81z7+0=; b=NhlXYLePc588orL/szPFEExZ9i7+Pshae1FCaohyK8yBodDc3nu5qbWGLUSefMte5AOn0H 58CHccqgoN1hmB39/7jJ7443v8n1PkJLH2L70S5NUv3rNhT01hJBG5yNa0AovJvUw1tptP 509QgW/zCjl0LQOCrAXFu0ozgBzmbBc= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-320-L5MAZnY9PK2tEHK1qezajg-1; Mon, 09 Aug 2021 06:23:24 -0400 X-MC-Unique: L5MAZnY9PK2tEHK1qezajg-1 Received: by mail-ej1-f70.google.com with SMTP id ne21-20020a1709077b95b029057eb61c6fdfso4356879ejc.22 for ; Mon, 09 Aug 2021 03:23:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=lBMgmsHqw0YdLKVpdWLFV60bEE3X7POBff7kY81z7+0=; b=bXF5hgqWrPsMd0+5gzxve5hTnvx5sGwu/jTgPq2bceAARacqR/48OGV1jJKd6fC5DO W+Ox2fD+iMOIT38WWCe1LLHyf9ZDSas3mN3kJGz1QBlAswI7EkQ0YJCRpOMeU6tEgtp0 wvl/vosyaDhtn4ocDZCc2xPztV2AVvS7g5HFHZ04kYTMCyitSVj8/JqbZolsSIVwYye7 /2pRx4rT8QQZiF8WHLcuaSsz9lJgNLvzrwFN+2UPrJZfEknzOn43f+8gT7VyPwzjDtPz VpTklhcJfk0Ah9CUzw2fKMN4STbzoIUG2igvC1u16EkSbo5Gl7T/U0AYGkgmbX0aenvH N/DA== X-Gm-Message-State: AOAM530P0g1PvLTvcjs2FiPV5zNwvFpmq0l4dzmWlfzmk36VUBw8aySq 5xopQqFL0ycUMLC89t/c0Ja4twM1nhu7KhUiTpVvbR7TJ2mKorI9rp5kNK5jArPTalqpnbxMOof C93Lk2YsjIxJdxsOZCnZiJgRc X-Received: by 2002:aa7:c647:: with SMTP id z7mr28762252edr.52.1628504603585; Mon, 09 Aug 2021 03:23:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxu4/FLaxiABAh3xlH1zEltzZAqe/JpBP91yZt7peMzpTB2Jakv6WmDhskp7f5QhwHz26t4Ug== X-Received: by 2002:aa7:c647:: with SMTP id z7mr28762236edr.52.1628504603409; Mon, 09 Aug 2021 03:23:23 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e? ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id l9sm7953930edt.55.2021.08.09.03.23.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 09 Aug 2021 03:23:22 -0700 (PDT) To: Joao Martins , Maxim Levitsky Cc: stable@vger.kernel.org, David Matlack , linux-kernel@vger.kernel.org, kvm@vger.kernel.org References: <20210805105423.412878-1-pbonzini@redhat.com> <4b530fb6-81cc-be36-aa68-92ec01c65775@oracle.com> <5f3c13be-f65d-1793-bd91-7491d3e149b0@redhat.com> From: Paolo Bonzini Subject: Re: [PATCH] selftests: KVM: avoid failures due to reserved HyperTransport region Message-ID: Date: Mon, 9 Aug 2021 12:23:21 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/08/21 12:00, Joao Martins wrote: > [0]https://developer.amd.com/wp-content/resources/56323-PUB_0.78.pdf > > 1286 Spurious #GP May Occur When Hypervisor Running on > Another Hypervisor > > Description > > The processor may incorrectly generate a #GP fault if a hypervisor running on a hypervisor > attempts to access the following secure memory areas: > > • The reserved memory address region starting at FFFD_0000_0000h and extending up to > FFFF_FFFF_FFFFh. > • ASEG and TSEG memory regions for SMM (System Management Mode) > • MMIO APIC Space This errata took a few months to debug so we're quite familiar with it :) but I only knew about the ASEG/TSEG/APIC cases. So this HyperTransport region is not related to this issue, but the errata does point out that FFFD_0000_0000h and upwards is special in guests. The Xen folks also had to deal with it only a couple months ago (https://yhbt.net/lore/all/1eb16baa-6b1b-3b18-c712-4459bd83e1aa@citrix.com/): From "Open-Source Register Reference for AMD Family 17h Processors (PUB)": https://developer.amd.com/wp-content/resources/56255_3_03.PDF "The processor defines a reserved memory address region starting at FFFD_0000_0000h and extending up to FFFF_FFFF_FFFFh." It's still doesn't say that it's at the top of physical address space although I understand that's how it's now implemented. The official document doesn't confirm it will move along with physical address space extension. [...] 1) On parts with <40 bits, its fully hidden from software 2) Before Fam17h, it was always 12G just below 1T, even if there was more RAM above this location 3) On Fam17h and later, it is variable based on SME, and is either just below 2^48 (no encryption) or 2^43 (encryption) > It's > interesting that fn8000_000A EDX[28] is part of the reserved bits from that CPUID leaf. It's only been defined after AMD deemed that the errata was not fixable in current generation processors); it's X86_FEATURE_SVME_ADDR_CHK now. I'll update the patch based on the findings from the Xen team. Paolo