From patchwork Mon Oct 15 15:32:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Long X-Patchwork-Id: 148865 Delivered-To: patches@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp3933968lji; Mon, 15 Oct 2018 08:32:37 -0700 (PDT) X-Received: by 2002:ac8:7153:: with SMTP id h19-v6mr16995356qtp.361.1539617557596; Mon, 15 Oct 2018 08:32:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539617557; cv=none; d=google.com; s=arc-20160816; b=VTe1J+DltMVJzaIgxQWUCIYMKg5b5HfbHWGIIpYC27ZjZR2mCTyxJoJ6dmPTb8N9Rj RSde2Jpq749WtGDgmv7RQoT7s9g88rzaIm/x6pLJclcZjeoHPeYUkiSw+47W1EBcCC+r VpJbdajcVjEHGiuKfHPNkJW2OXJnLAI3zT4JKiFgcazZhqnglmGt5CWLnzz07ogMgrPe pSxBEM3A3vMmKW9uS1aTV4zcF1L1ohZ9kffM3WlcMX3iV8HIXzfJjA1AACwrCgQzyJ0w ZyR8g8nBuYsfZqnF/A+DT8r7fit5gAVzqtYKIRyPXsddGEuTXIWagWi4d3PoDRwiCHLn wjUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3Fm5Jvq4FwOjNNyTxRV0dOHGMHYMUmlG6M5JCHvD4V0=; b=Pd18ZZ4iPcq4IHaQlMDcFVo8/7MSjA/44WGlCllM5kfUDLvM7T11yipLa6Td46/Rcx Lux0dVRBGSzeZke8xzwOzkuf9ldT+JihhWsAxqpToXS54pXGvnczE5d4uptadz+V1zIu oxd8KfHTNZLudC1kSRF8PLuFiO26a/R/rcQsoxDRKFlm22d+rhi2uu527/f78AKiRQql 3LHzhxM+HdfHP9QXHPhwT8+3TBJ9EY33+adE3e0UfRBoULytLp29YvwtFAesJWcz4xIo rYjFSeO6lIjiTDmNlvwn5CPIqzIV7VY50LhDkT4UWDz7mT2/jl7scEgI0P7XY/dw4dk0 iSJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KI2tZEuf; spf=pass (google.com: domain of dave.long@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=dave.long@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id o12-v6sor12538500qtb.68.2018.10.15.08.32.37 for (Google Transport Security); Mon, 15 Oct 2018 08:32:37 -0700 (PDT) Received-SPF: pass (google.com: domain of dave.long@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KI2tZEuf; spf=pass (google.com: domain of dave.long@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=dave.long@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3Fm5Jvq4FwOjNNyTxRV0dOHGMHYMUmlG6M5JCHvD4V0=; b=KI2tZEufut/6UHBkxnspwhA2/gu4zTs1dQ6egPJkGC2KVoeEBm6XAnDda+DWDQZbRv 1a8oa0JxS/iT0S+76eHBmcQ3d8NWYwpKYHTLlkDdosirUFlQhdDVXiKjXmwe948l9Sxa 3CQdTZEbgHJSNAlY0Q5QNvf8CXbQj0sjgwJrA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3Fm5Jvq4FwOjNNyTxRV0dOHGMHYMUmlG6M5JCHvD4V0=; b=mIiKzlTbsY1RvPCYjwu+EGLtpv8ZXYCHZNZphOsmNfPaMZ9K/AY5ZfetfZG47H3acG xJXKqSJ+2agQgZrEYvDFzjsQVvRXS88YkN7rAwrqLVJ++9cVPZH4dFDb/xcyXYQbz8fj +z1OV7YqhzCy1CnyHPs46w1c23ZbkxK5UTHoto+cMXNRdGTjbSNhaDMO9iO4vWkF0t5S cBcPq/9dBLFaxlaIzcnJMsHcLb+Ck+7S4A7iWYgf8jyECR2/5I6pcvnsyYKpYmTiCQ4y T5U0PO9ZRH8QVh7T1+Etdiw7ROmv0EE/+URdHBbphfSba+ETH6SB6wge6LDQObhSecOR HPQg== X-Gm-Message-State: ABuFfogFNvP8xwFwngIvY9mXf+1lY3dwPFwRDAIrmMgHl+rKJtyuKRxC 56kMO8cnE3yIzWiKne/i1yQ32jAk X-Google-Smtp-Source: ACcGV61ODYhkBH5tTGRMnFRrAzBUjkDiSseTtb9BLjsbQERXGv6KBZ17LW671cTwGonRdApbazFD7g== X-Received: by 2002:ac8:6b07:: with SMTP id w7-v6mr15958595qts.287.1539617557220; Mon, 15 Oct 2018 08:32:37 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([72.71.243.63]) by smtp.googlemail.com with ESMTPSA id g82-v6sm10087768qkh.24.2018.10.15.08.32.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Oct 2018 08:32:36 -0700 (PDT) From: David Long To: , Russell King - ARM Linux , Florian Fainelli , Tony Lindgren , Marc Zyngier , Mark Rutland Cc: Greg KH , Mark Brown Subject: [PATCH 4.14 15/24] ARM: KVM: report support for SMCCC_ARCH_WORKAROUND_1 Date: Mon, 15 Oct 2018 11:32:09 -0400 Message-Id: <1539617538-22328-16-git-send-email-dave.long@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1539617538-22328-1-git-send-email-dave.long@linaro.org> References: <1539617538-22328-1-git-send-email-dave.long@linaro.org> From: Russell King Commit add5609877c6785cc002c6ed7e008b1d61064439 upstream. Report support for SMCCC_ARCH_WORKAROUND_1 to KVM guests for affected CPUs. Signed-off-by: Russell King Boot-tested-by: Tony Lindgren Reviewed-by: Tony Lindgren Reviewed-by: Marc Zyngier Signed-off-by: David A. Long --- arch/arm/include/asm/kvm_host.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) -- 2.5.0 diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h index 65572e1..b602326 100644 --- a/arch/arm/include/asm/kvm_host.h +++ b/arch/arm/include/asm/kvm_host.h @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -298,8 +299,17 @@ int kvm_arm_vcpu_arch_has_attr(struct kvm_vcpu *vcpu, static inline bool kvm_arm_harden_branch_predictor(void) { - /* No way to detect it yet, pretend it is not there. */ - return false; + switch(read_cpuid_part()) { +#ifdef CONFIG_HARDEN_BRANCH_PREDICTOR + case ARM_CPU_PART_BRAHMA_B15: + case ARM_CPU_PART_CORTEX_A12: + case ARM_CPU_PART_CORTEX_A15: + case ARM_CPU_PART_CORTEX_A17: + return true; +#endif + default: + return false; + } } #define KVM_SSBD_UNKNOWN -1