Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp910362rwn; Thu, 8 Sep 2022 10:23:49 -0700 (PDT) X-Google-Smtp-Source: AA6agR6ZoJ8NiiaTYoH2uZ+5tBYobDU+gs9KkJVXW4ruS4AjDLrjgTdOnrs0a4VRTmIthJZmzFg1 X-Received: by 2002:a05:651c:221f:b0:268:e975:be90 with SMTP id y31-20020a05651c221f00b00268e975be90mr2756574ljq.284.1662657829048; Thu, 08 Sep 2022 10:23:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662657829; cv=none; d=google.com; s=arc-20160816; b=HqvfUXv+ggYTLIV0kIrqvIJYfKEMzCfV3S7Nx7AdYsJMJ3/6soiS+Niua5dXNhmTOA 1DC28hD8VTPmtKvW4eaJy0gXS4M/FQTvXcXgLsJq0wXSLkQf3hPAVQ1kEZN0apQ84Qmc 77ImPXMB5waNYRSsr+UwJHBeX9Lt2CnK/ZYovi11LcXJJWyXD/AYkQ4NZJmLJH7TIfZQ U9PxO8riTckUj1mQ/UMKzsxBuw8qpnlRbtKyPtAnVhdgUbbGhbaxnLjBd5tSM1mXAP3p ohpfqeNcxg3WJ8mLY14dD6/cOqnk2rKkgqj5sQA22yeDZ6wfN6sdytIF4pqB1CHuE4Ml Xpeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=Tb/TR0D6+TZRh/xClS3B2006d7nEi2kvzg0PMDr41zU=; b=WwE6z2s56Aqnc5vSmvSFOzQEACYH3A7TTCQHhgdgHJaqyfFgWoxQyMdw7tv7PnmbUD 7FPptbKfsCciHK08FEtFeRSdNhAhO5tZ1fRK7i+CKPGDpIODE8QD9XKZjanm9Fa1wXaq VSCJjRTfA23T8PhTsBoZ1LWdEH6mVtj2vawP0fATU20eCOj9eWZwYUfhIqzNd3xXeYP1 4uoRAoMW0nj+lMsHDdP/n2KrQgjR92YF3E8r9rdoMmAlYXacAoeyotpZmiVCv2pT0ygr ihi6CKyH6tTuVxIIluCLmRVDaltf8Sn9SsrTqKxJmHctM0y1/GVCR0Jnx5fPQvDNsAsn pfZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="l/IF7eiy"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d4-20020a05651233c400b0049499a43f85si9566341lfg.450.2022.09.08.10.23.17; Thu, 08 Sep 2022 10:23:49 -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=@google.com header.s=20210112 header.b="l/IF7eiy"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231267AbiIHRF3 (ORCPT + 99 others); Thu, 8 Sep 2022 13:05:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230178AbiIHRF1 (ORCPT ); Thu, 8 Sep 2022 13:05:27 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9873A56BB0 for ; Thu, 8 Sep 2022 10:05:26 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-345188a7247so116360687b3.22 for ; Thu, 08 Sep 2022 10:05:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date; bh=Tb/TR0D6+TZRh/xClS3B2006d7nEi2kvzg0PMDr41zU=; b=l/IF7eiywF7DijJmWs32L+ESvrnZzL6ujSjiN4HQb8jq2jnV9CuVwrYRyvUmVouiKs dGSq7+5JV1/331c4SHuQ2axXuzASrDRiCykmau7/YAB/h6yuoUJiLQiruNz9QYPfH8s2 apumrVo03AcQF5HCpuvcGKBX/1SNMHAlDD7IV3vX5W8EA7ON01T6LZh8nicXY/7IQoKM xuWfWbi13xBh4AXn6zSGIR0w7R6RuDoAjqYWFYkloXL6cUmtKc1e4RpCXKFg2bLwmaHz XIDDK3wKIdm72pwRN+zg7whNxAZ+Y5CxkEjF3byH2rZImMcabz/7ubpQxqPOiisegwgm Qlkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date; bh=Tb/TR0D6+TZRh/xClS3B2006d7nEi2kvzg0PMDr41zU=; b=cRkYnZaDFkNLbgwLsWNRX945imt3DNRrURFKwxYj8ckIp2dfkbYf7M0ik4HmBZN4gv wePrEOpXs1qv0POiyFTkogn+d8qxwzr586HYm+KUZb8vjkjmq98CN9sdERJY/JpqLHsA G9EItDW8D6BAHBrG9YWaYD+vTWnqY/4Aa1jLl48xQVAdiwcuytdxtLfyk6LUSSapP+ZO rA0yxmZnlfd4+PodFgMicf9cKWqN1URrbij/+j7JRoUraN+FsGG3QshRP4D6leQmaIyi PonmA+Zin1OGPV+PFRvzzLvYDfq+p8Cp90VW55aRZdC9DxvMkXbuOrIVop/6Bts0RphX HTyw== X-Gm-Message-State: ACgBeo0cqcL474/hUfEdlcQ/f72lqTCof8KfoPaPlm775Rx+rW9Zopr/ nZffwHaZ2pkj6Lra98ac0rBTeSk2VJq/sQ== X-Received: from acdunlap03.bve.corp.google.com ([2620:15c:29:203:b753:a87e:9aa4:f86e]) (user=acdunlap job=sendgmr) by 2002:a05:6902:3c6:b0:694:1088:5448 with SMTP id g6-20020a05690203c600b0069410885448mr8476959ybs.410.1662656725853; Thu, 08 Sep 2022 10:05:25 -0700 (PDT) Date: Thu, 8 Sep 2022 10:04:56 -0700 In-Reply-To: <20220812183501.3555820-1-acdunlap@google.com> Mime-Version: 1.0 References: <20220812183501.3555820-1-acdunlap@google.com> X-Mailer: git-send-email 2.37.2.789.g6183377224-goog Message-ID: <20220908170456.3177635-1-acdunlap@google.com> Subject: [PATCH v2 RESEND] x86/asm: Force native_apic_mem_read to use mov From: Adam Dunlap To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Nathan Chancellor , Nick Desaulniers , Tom Rix , "Kirill A. Shutemov" , Sean Christopherson , Kuppuswamy Sathyanarayanan , Andi Kleen , Adam Dunlap , Ben Dooks , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Peter Gonda Cc: Jacob Xu , Alper Gun , Marc Orr Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL 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 Previously, when compiled with clang, native_apic_mem_read gets inlined into __xapic_wait_icr_idle and optimized to a testl instruction. When run in a VM with SEV-ES enabled, it attempts to emulate this instruction, but the emulator does not support it. Instead, use inline assembly to force native_apic_mem_read to use the mov instruction which is supported by the emulator. Signed-off-by: Adam Dunlap --- V1 -> V2: Replaced asm with readl function which does the same thing arch/x86/include/asm/apic.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index 3415321c8240..b4c9034aa073 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h @@ -12,6 +12,7 @@ #include #include #include +#include #define ARCH_APICTIMER_STOPS_ON_C3 1 @@ -109,7 +110,7 @@ static inline void native_apic_mem_write(u32 reg, u32 v) static inline u32 native_apic_mem_read(u32 reg) { - return *((volatile u32 *)(APIC_BASE + reg)); + return readl((void __iomem *)(APIC_BASE + reg)); } extern void native_apic_wait_icr_idle(void); -- 2.37.1.559.g78731f0fdb-goog