Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2086855rwb; Fri, 12 Aug 2022 11:45:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR6NGondL9573shg+RrTCeNDuUA7xiyPij4DkceWF5c8L2BpyWHS6C7L7C0hZj0BpLKM42t0 X-Received: by 2002:a05:6402:5110:b0:440:4cb1:c137 with SMTP id m16-20020a056402511000b004404cb1c137mr4808788edd.262.1660329953926; Fri, 12 Aug 2022 11:45:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660329953; cv=none; d=google.com; s=arc-20160816; b=XbezcYn13QoRj3nahjj+YpKyjigjILp7AZAEhOzTimNXSMVyxjzN/hj8TpRxSBNnK/ TEv54iyo1e2uZJR5VFXtrXgSgXweV0DVH/VkC738S+vQGGZWfUhZm+cNWdVGaHZorDus z9mfPh8RxKl9xGRi3kzenPdSZqFuCu1+v5V5sOaPylWZRKxrBX0k+A5xQ2ox/T9r94E6 HgjxrSNpTDMxGIArZtQpzMlvROTl3LIb825uDPSjnx/b2ODt+pw5HnLn+YWzFFs4JTz3 To7JFal5a4Zwde8i9NxzooZzmQ0L+JIL4uQVx+a3C7QfFw3rCYfvr9xvZhioaUhVVMGJ h8oQ== 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:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=Tb/TR0D6+TZRh/xClS3B2006d7nEi2kvzg0PMDr41zU=; b=XNpfveZ/e6DoIrVnvjaAnzuY+vWallcars3T/vDz9N0GyI4jarELG6tIYqWHGt04qw wfphy5zHO36rue2HkU3b6CEAfqIiqFZMXsLK7KPd5NBS2xHXmzSJGpsQtKpk2hGZIspr +QNy+BgRBmaTIhRSjJdQb8m92jfUit9E7qDdi45x/nwLWEwOcJ/Rbe1NlDfHibN984OF EgTTuuPVNzrQ4UFZEeM8ljCZTicOfi9zX4NUlsBVVJNtdJwB7nDyyZPpv8DyUWffzPT5 yano2w9pt05DM7msjQ7+Lbo8RB8U4esqdkUnQfA84eJUPEwgV2CqTZckpD0znDIHe5ET 45cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=KIghjEhy; 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 cr14-20020a170906d54e00b00730aa17d032si2967340ejc.337.2022.08.12.11.45.27; Fri, 12 Aug 2022 11:45:53 -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=KIghjEhy; 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 S239307AbiHLSfb (ORCPT + 99 others); Fri, 12 Aug 2022 14:35:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239289AbiHLSf2 (ORCPT ); Fri, 12 Aug 2022 14:35:28 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0276631345 for ; Fri, 12 Aug 2022 11:35:27 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id s15-20020a5b044f000000b00680c4eb89f1so1316456ybp.7 for ; Fri, 12 Aug 2022 11:35:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc; bh=Tb/TR0D6+TZRh/xClS3B2006d7nEi2kvzg0PMDr41zU=; b=KIghjEhyq/uIEoA7hzxjHhXLoqudiVh4T6m4iV1J2c3fc55bZphi7EKB/TpFkXOqXQ faOb1XHILmMqgqAmbtc8yyI/hQowyxK+dKydpikpEZycSxHUryf7rXRSujoIWYiQEZGU mjwcT3XbvILiUetjMLaSrR7jioVy+UEsVk3wtFtdEgyUo7gceVjULI0IkP5sSXvkzvsI ZSEXjbbFjpbWw5UyRn7RPqXWfq0V+FX1js0+oghrkMoyer5wm195HOxfdIW1poBoeiVg 1qRxbN4wyrI3125UQZfUJD0aMsn7Z6Cn4SBGKpiKS5DEt3lQoTP+t06zvMX5F2octugZ +8lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc; bh=Tb/TR0D6+TZRh/xClS3B2006d7nEi2kvzg0PMDr41zU=; b=Jn8RsMVr+YHhE8FiFOHJf07VhbgHX1Pq861Yh2a1RMSAkGXQg72TEy/hCBCW6t0ZrU fRudzqXynVNSkdI9NfYLLNAXss2rOFxu3MlaYOgH1wSmTDJJFgVZflfoE9TaKtqEZqiu 0mwoa43+BojeinsLGBNj1/9jBGHRQY4lScB81uHprxJc3HRCgQcdiXl7KfYJAX7VP6TC NQ5HLHGqvvP5wSw6gTqGcGd69DPwCN1tbHr1eQTvfahAo6gL+2HYi5j7aUYKHlDr54vF iZL0HzxgU51nTGAfVXp34pjC65LQMzKKYL4p8X7AOzgh9IDtCM/R+/zxP3gYQ32IQwKD HWhw== X-Gm-Message-State: ACgBeo3+f83364qlNipg3FBXLeGR7SE42S5zVjeJIwC2DjKCKDeK/IR6 k3qOhwFjoqpkZ5Epx8kUDEp92PoCOEuC6g== X-Received: from acdunlap03.bve.corp.google.com ([2620:15c:29:203:1024:e472:db0f:a5f3]) (user=acdunlap job=sendgmr) by 2002:a25:408a:0:b0:677:3543:ca4e with SMTP id n132-20020a25408a000000b006773543ca4emr4642131yba.164.1660329326241; Fri, 12 Aug 2022 11:35:26 -0700 (PDT) Date: Fri, 12 Aug 2022 11:35:01 -0700 In-Reply-To: Message-Id: <20220812183501.3555820-1-acdunlap@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.37.1.595.g718a3a8f04-goog Subject: [PATCH v2] 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 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