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=-20.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 D34ECC4320A for ; Fri, 30 Jul 2021 22:42:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B6AE260524 for ; Fri, 30 Jul 2021 22:42:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233559AbhG3Wmo (ORCPT ); Fri, 30 Jul 2021 18:42:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231189AbhG3Wml (ORCPT ); Fri, 30 Jul 2021 18:42:41 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D97D1C06175F for ; Fri, 30 Jul 2021 15:42:35 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id mt6so17321874pjb.1 for ; Fri, 30 Jul 2021 15:42:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=m4d9ZD9p7GoqrvGaiugJJi1dtX5ER6dFXKneRi0unZQ=; b=UD+a7OHG6R6O1/v3XLdigN6MDc2FUkFXi8AJqiXtL/E14oNXaLlRshONH4ZEV3U+2l O+FzXhy3YiQv+j4no8ejXyA6qCG/BbE0OuzfWVYJOTMwDIotwWFqUQUQbBd3T5DPGMSF 5iPGQsZVmTereOWIZlj3lJLfB/t9OU1fBzXXyuzxnV5O4y5+GR2wmZ824olLGhYcqMkt E93R50vJJPqYgYn7QQLQWVtvwHr9P+fVXsYDY1SeyAqQ9+CWTTX/I6WqGr0+IR6ZayAB b3TfGwNivuG/xRxTkOXgXhJ1+wvMpC744swkcitnGwK5utnhKiWijfQde9qagLVzSfIq ULgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=m4d9ZD9p7GoqrvGaiugJJi1dtX5ER6dFXKneRi0unZQ=; b=gNSHvs/ZTfXsyCnvCRN/mWfonKUcZUHF7CbuJgpCvex8Grg66KVu+UTxaQ/k5Ad9bs 2oBhDkPzpRPRNlHBtyYxdOYmM9Wl0UcNbti2AiVbwKrNFnHGTy56xCPAPP1WcIQyK2tr HEqQl3WrAttvZGNYnHWVGg4xdL9ZEYefE0rCVpn/S18HvGChPjgsc/whDETDzT+SjNHf +/Mo51FE9wy4Ko3KeDAxelBpKR6jlOJBJK6cy2zjwBEnTGOPWMA+YbcE/cOfFufIL+EL KzeLh+zgv8CH5spne119D2DqlP4i0Qe7xkFHy7kmKx3Iz6l0NkKhpaI8jzTafYyKllpn nDhw== X-Gm-Message-State: AOAM532YH94qv6NKX3XWgqHSm7pPtDNuQdIN344YF2Q+mSmAtxnW2TQ8 cAXpKxjj9kRfv+5etwi2h+WGgQ== X-Google-Smtp-Source: ABdhPJxk7W+2sIVLDSmSMOXUC11qCNLIDPGNOd/xxKNg/QQ+ueW+7XNXlkhxJYUWIL4woVvOFDCobg== X-Received: by 2002:a62:bd15:0:b029:31c:a584:5f97 with SMTP id a21-20020a62bd150000b029031ca5845f97mr4921999pff.33.1627684955184; Fri, 30 Jul 2021 15:42:35 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id n23sm3926800pgv.76.2021.07.30.15.42.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jul 2021 15:42:34 -0700 (PDT) Date: Fri, 30 Jul 2021 22:42:30 +0000 From: Sean Christopherson To: Joerg Roedel Cc: x86@kernel.org, Eric Biederman , kexec@lists.infradead.org, Joerg Roedel , hpa@zytor.com, Andy Lutomirski , Dave Hansen , Peter Zijlstra , Jiri Slaby , Dan Williams , Tom Lendacky , Juergen Gross , Kees Cook , David Rientjes , Cfir Cohen , Erdem Aktas , Masami Hiramatsu , Mike Stunes , Martin Radev , Arvind Sankar , linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH 11/12] x86/sev: Handle CLFLUSH MMIO events Message-ID: References: <20210721142015.1401-1-joro@8bytes.org> <20210721142015.1401-12-joro@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210721142015.1401-12-joro@8bytes.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 21, 2021, Joerg Roedel wrote: > From: Joerg Roedel > > Handle CLFLUSH instruction to MMIO memory in the #VC handler. The ^ |- emulated > instruction is ignored by the handler, as the Hypervisor is > responsible for cache management of emulated MMIO memory. > > Signed-off-by: Joerg Roedel > --- > arch/x86/kernel/sev-shared.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/arch/x86/kernel/sev-shared.c b/arch/x86/kernel/sev-shared.c > index a7a0793c4f98..682fa202444f 100644 > --- a/arch/x86/kernel/sev-shared.c > +++ b/arch/x86/kernel/sev-shared.c > @@ -632,6 +632,15 @@ static enum es_result vc_handle_mmio_twobyte_ops(struct ghcb *ghcb, > long *reg_data; > > switch (insn->opcode.bytes[1]) { > + /* CLFLUSH */ > + case 0xae: > + /* > + * Ignore CLFLUSHes - those go to emulated MMIO anyway and the > + * hypervisor is responsible for cache management. This wording can be misread as "the hypervisor is responsible for _all_ cache management". Maybe just: /* * Ignore CLFLUSHes - the hyperivsor is responsible for cache * management of emulated MMIO. */ Side topic, out of curisoity, what's mapping/accessing emulated MMIO as non-UC? > + */ > + ret = ES_OK; > + break; > + > /* MMIO Read w/ zero-extension */ > case 0xb6: > bytes = 1; > -- > 2.31.1 >