From patchwork Wed Nov 7 16:43:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Long X-Patchwork-Id: 150430 Delivered-To: patches@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5387435ljp; Wed, 7 Nov 2018 08:44:23 -0800 (PST) X-Received: by 2002:a37:3388:: with SMTP id z130mr851286qkz.51.1541609063470; Wed, 07 Nov 2018 08:44:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541609063; cv=none; d=google.com; s=arc-20160816; b=BvXK+kGq9EhDY2Ua9+YaX1MaHoYty4NTpdrDVsCGIxy+mEEm1s1e6fTE6AaVNrk1AP xqW5OoPtGaGMAXyx7rlzkUtrU0/QPBkQFRb+vuUq5ZZcJExZoov2ybxKQir0J6paYITe n5zOzrzVuix+VnJl/7KBpDQURr8/H3+LsRrQJwK4ZMICcGKeJidVDwWI5MexBr/P09V8 /KMBP2mulxDHynSzp/A5JG8IfZOT5JGLl3Xrj5MG2GP/cbD8BtD1Nj4ifd6vRliTLjvJ I1rKC9RQjcX8TgmuOcXwQrdwLo66eQV49iaDxegVPuuYTw1K4c/Xs8Rs/RF5t+Kg+TA8 1Smg== 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=Z+Qt0V/X0rp9/PYEHT57k1RKcIoA/WekeaBBdjP25ow=; b=y4Tujzd0StwrUpN/GtyqLprjjdAQksqFGCt9YHPn0GupfpAoqNFFNQrhCfgqzLKarS VIU8SY33XLaB1O5lPExxqtiK3zuN+wiTViKBe4InGn9XQ9M8NXAKp7kXZYs1CXUh1ToU 7CPMUSoHk3VwNxfpDoUBJwrzZbiiTkBCDAT1+yB97xjLZBFKNml8BlnMMPrz8hDCu5r3 VO5Z/T95NYmHGQGcqULrqBU2Dxj2opgqPmXvwsS//+2WVvGjd7Mv/syjS+2gTsiHfTHS VDnB5wC8hRQqnss6h7E3oJjFQc1y5+yTHHigwLYhbUA7iGxpSNROr+DZfS9mVWMUuO4l Teig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KRiBCX2m; 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 o21sor1215217qvf.18.2018.11.07.08.44.23 for (Google Transport Security); Wed, 07 Nov 2018 08:44:23 -0800 (PST) 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=KRiBCX2m; 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=Z+Qt0V/X0rp9/PYEHT57k1RKcIoA/WekeaBBdjP25ow=; b=KRiBCX2mswxcVGvFqCFUGvWR+LspTKDuyJ+EGdyEwAEMgY06xMuS5pQwZvH6MBlU+G E5mb+nI0n100RHalblOapwE5miZJGP/o0yFSZENrbTTfEaUx0HcVkasA6SXf0SF4sUU9 J7u4RLR6lL3E3xLzFxBAoWBLTtopr8tswNlhw= 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=Z+Qt0V/X0rp9/PYEHT57k1RKcIoA/WekeaBBdjP25ow=; b=nYMgQMtjp/t5LPfDVh1iMZ9P9Nv7tRUI9puE46L3MEiWk/MD3a5zF56sELP4+mW0uo efmFZTsBAjaD0FRbAZL682xBD7323ghyv95yPTrVKI2nQFQdxq65LwVHjzXGSjUREU7S csopTHaq42kmKinVzU4xHn8r7xrRAh5l9LRZWYL9JFD8G6A2kRzaWVSrLoR++MjZkh3q sFyW20VSsv28ijiiI1vrveHqOjtdQWX7m0hcNBJylo0hxPdX+Q8mVEJx1tSUg1aZ6npB +Vg1IcqWZQsoiDZYxZmE5V6lRHnurSp5DgYygObz54tEKXdSEH2FPc6N6hHZxCu2b6hd kYTQ== X-Gm-Message-State: AGRZ1gJP7ddbf7vkqcpVjA3BT9N9OywT5CO6ngao/G5C4OuL1QaQFXum x5O2bhT7nJYI4BLUfDQTVxt2e/y9 X-Google-Smtp-Source: AJdET5cMbkVSP03bFDjlquijtD6WDbqtsYDNUInLszzPfvT/IyewvCUhqRNzLLZRrn++GXoHLnPfLQ== X-Received: by 2002:a0c:87b7:: with SMTP id 52mr997960qvj.8.1541609062936; Wed, 07 Nov 2018 08:44:22 -0800 (PST) Return-Path: Received: from localhost.localdomain (pool-72-71-243-63.cncdnh.fast00.myfairpoint.net. [72.71.243.63]) by smtp.googlemail.com with ESMTPSA id 96-v6sm681817qtc.56.2018.11.07.08.44.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Nov 2018 08:44:22 -0800 (PST) From: David Long To: stable@vger.kernel.org, Russell King - ARM Linux , Florian Fainelli , Tony Lindgren , Marc Zyngier , Mark Rutland Cc: Greg KH , Mark Brown Subject: [PATCH 4.9 V2 15/24] ARM: KVM: report support for SMCCC_ARCH_WORKAROUND_1 Date: Wed, 7 Nov 2018 11:43:53 -0500 Message-Id: <20181107164402.9380-16-dave.long@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181107164402.9380-1-dave.long@linaro.org> References: <20181107164402.9380-1-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.17.1 diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h index 0833d8a1dbbb..2fda7e905754 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 @@ -323,8 +324,17 @@ static inline 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