Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp402667imm; Wed, 11 Jul 2018 04:39:55 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdt5EJ+6Dk3HQEiJ5UioyAu/ymqLzHsGK4GVO2ImMf6K0azY7+iPF6VT/W9gHbcKtIJuVqV X-Received: by 2002:a63:8341:: with SMTP id h62-v6mr25632219pge.298.1531309194941; Wed, 11 Jul 2018 04:39:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531309194; cv=none; d=google.com; s=arc-20160816; b=iytmOgYfkZpoGbVyT6wjW8lqfUy/YnXK3UG39hwE7QKiMtiqJY3LNZ3nYyqcFU21GZ VMqqfR1R8Ke1mVIPGA857SlRDIK/43758V82KABS7vYfO264BjXp/UmL/b2vx/Zxq+tp G+6xBGVUeXEJnH/8rxMpAQB7D2j2pRxbbYQHo5GURq1/08Zz5gT1tKlg2Ja8PQ6mu2Qs KbsRQ5cz7NKXc8JN8qboOOfTtfzonhX3dh4KRrevb4xd9n9jBaQOZuM97KAmx6HZv01y EFaSbSl5TVQMvyDg8lKDA5qHIAJ239V3Qi1WWxOesTS90gsR6Jvwo4nwsEJ7zZCyd16E kq/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=tLLGgBGDGfhIKCSoHxXtiZpksHyCXwes474qm1r75Ts=; b=aHahX6bWpp80Uyrx5yI2FHuvvYf+gBe1PmbXzkO59iLSk/3b25W5xoSsRb5ajJME5F QwsDz8A+ggdmi07EaWpZEDlFU61ZRypcxYZE6Q9QyT/mRxIQ45b7HXM2Hzk3O//AeS5B xYKlqP2E3dP9g4g/G6wTUT4rhdEhvL4mVqjydFjalGmFzztVvK9WcFCZoud9Gt3dx5AB /YsP9zP9QsK6DbzyI3t3A1TPrVpnuMS23NLTf+FSuYsfKLeumEepuyIGuKpFrgeFdvtf dI1DGZuk7QeyJPM6Y1JPiVnafkyP+DMbWCor5k6iLxM7rLPbAKVVOYzWngSp3J04upZl Pbgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jaZCfUTZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o15-v6si10956070pgq.236.2018.07.11.04.39.39; Wed, 11 Jul 2018 04:39:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jaZCfUTZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726639AbeGKKDd (ORCPT + 99 others); Wed, 11 Jul 2018 06:03:33 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:41747 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726397AbeGKKDd (ORCPT ); Wed, 11 Jul 2018 06:03:33 -0400 Received: by mail-io0-f193.google.com with SMTP id q9-v6so23068674ioj.8 for ; Wed, 11 Jul 2018 03:00:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=tLLGgBGDGfhIKCSoHxXtiZpksHyCXwes474qm1r75Ts=; b=jaZCfUTZ+G80NCIxG3ZeL8mOsB2hbtiRgfIDurGsujshZ2u/xoAQJlPNLmYcYtIxbK 5z/P4V04hRjQbNrYK/q/A0wTQBLbHuDDYzXn0dqwdcoWzh23GJI3J/9zNGmOfrxUTEqI YU4PFMKvddRMCxB9eUaRjg8K/O+hrNmYmFeYI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=tLLGgBGDGfhIKCSoHxXtiZpksHyCXwes474qm1r75Ts=; b=XYiwz8LEdHczVgnpp9AfeHQOK0EakWy6AVwwmulLkLB06euPa7SGKN467TmWECLg6a w5n68CZ9dtsZECi4V0Airgh1m1OYfkGDOLhzYoLKYAFtpIEtfogQA+uTEMxufivk85oN WV5m75RLMkl/RFCNDKQRZRbOM0Lq+OU9RNxB0XqK5eUgoRjj4VDBXVtpZA6pW26rkn2Q DTTcTKWr+qBzM2tZRSVMG4kFirL5BIuK40aJ/AGheqVFgOeo9NB1k4gsVsV+wWG5YU4J C3dG70LiqKBKR4OaOm5Ue9G8wTraA0xb7yw6bJEuKdP5FX8vPHj9s4YWXJrv4tt/BTWz Et4A== X-Gm-Message-State: AOUpUlFHKWRnqJaHNg2SmYKjPzO+WXOxvWvPw5YIiur468NrM8lODIY2 xjwbZpt+kaiXbRlz7CTQsMFBnhz4I2DGwFId7ZF+bQ== X-Received: by 2002:a6b:5d1a:: with SMTP id r26-v6mr15801816iob.170.1531303201247; Wed, 11 Jul 2018 03:00:01 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:bbc7:0:0:0:0:0 with HTTP; Wed, 11 Jul 2018 03:00:00 -0700 (PDT) In-Reply-To: <1530624720-32004-1-git-send-email-brijesh.singh@amd.com> References: <1530624720-32004-1-git-send-email-brijesh.singh@amd.com> From: Ard Biesheuvel Date: Wed, 11 Jul 2018 12:00:00 +0200 Message-ID: Subject: Re: [PATCH] x86/efi: Access EFI MMIO data as unencrypted when SEV is active To: Brijesh Singh Cc: "the arch/x86 maintainers" , linux-efi , Linux Kernel Mailing List , Tom Lendacky , Thomas Gleixner , Borislav Petkov , KVM devel mailing list , Matt Fleming , Andy Lutomirski , "# 4 . 15 . x" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3 July 2018 at 15:32, Brijesh Singh wrote: > SEV guest fails to update the UEFI runtime variables stored in the > flash. commit 1379edd59673 ("x86/efi: Access EFI data as encrypted > when SEV is active") unconditionally maps all the UEFI runtime data > as 'encrypted' (C=1). When SEV is active the UEFI runtime data marked > as EFI_MEMORY_MAPPED_IO should be mapped as 'unencrypted' so that both > guest and hypervisor can access the data. > > Fixes: 1379edd59673 (x86/efi: Access EFI data as encrypted ...) > Cc: Tom Lendacky > Cc: Thomas Gleixner > Cc: Borislav Petkov > Cc: linux-efi@vger.kernel.org > Cc: kvm@vger.kernel.org > Cc: Ard Biesheuvel > Cc: Matt Fleming > Cc: Andy Lutomirski > Cc: # 4.15.x > Signed-off-by: Brijesh Singh > --- > arch/x86/platform/efi/efi_64.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c > index 77873ce..5f2eb32 100644 > --- a/arch/x86/platform/efi/efi_64.c > +++ b/arch/x86/platform/efi/efi_64.c > @@ -417,7 +417,7 @@ static void __init __map_region(efi_memory_desc_t *md, u64 va) > if (!(md->attribute & EFI_MEMORY_WB)) > flags |= _PAGE_PCD; > > - if (sev_active()) > + if (sev_active() && md->type != EFI_MEMORY_MAPPED_IO) > flags |= _PAGE_ENC; > > pfn = md->phys_addr >> PAGE_SHIFT; Is it safe to only update this occurrence and not the one in efi_runtime_update_mappings() ?