From patchwork Wed Jan 31 09:35:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 126321 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp553826ljc; Wed, 31 Jan 2018 01:41:24 -0800 (PST) X-Google-Smtp-Source: AH8x227NsYkgCDVMhaHlBKs5OHiZYTpWzkBdrfup5sTmXGZYOttS+Z2WOCu4DhTVma/TP8SEPP/T X-Received: by 10.98.234.19 with SMTP id t19mr18521725pfh.74.1517391684534; Wed, 31 Jan 2018 01:41:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517391684; cv=none; d=google.com; s=arc-20160816; b=V/JGVyHIqK4jiepUbgU2ashAP5nXoDQStva5i0FjvypSNQnkKAxSmaRE3Z9TK8A2bj wZlw1s9YWFftIeYpaQ+arU/r/MZZ339dxstcFIGzX3v+mw/9YF+6OJVVATTHWs23Goik r0hY/C3/wHT2l4XxCH0Ukz5UaTlU6Y+LeN1gFe5I4zCdgTXrXo69rf8/DMsoNiGYJeS2 Mpwbp4/CxF7h/WGIaJ/Qzy7z4GzLs/aWh3dSg+YhixVwTKHuxdgNa0wDtq0ws78NRbPr QbZDLQ+Z/8a0DbFLqTRz4WKMmO74S7G3AKrLX1bcJIDTlGRxza6haf7aNQu1JpA7kYdo s9yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=4TQyQwY7YHadksZSo3g0l1Kyive2Ie74s+4gibmNS/0=; b=m2wiAQx1YNnmUazcqSZbyy/asPOsShvvl89JBFe5ZQPC5EpmQpfrwSjRSsYTa3STvO 49s5ndorqCl4nb92J4R9NyDBZoof2eO7kF2oSv4yMhj8Fpd7XdpW5gsL0NcQOr4I/KLa K8ZSzRzGGoiInA2WKxaWiC5EqdO9NwnG6it0Y7+xiqGkyk0yt66FBGKxf9CEVQ/TKbeo 4jgLvq4mTdJ3HCBDuojh+vnvFav7nfDt/V1pJwXBhzxIGLzzE+w+b/qvHE+2n/lN8rUj 7zRReWgR2d0v0yIlScaq81LwBAV1UZJJT4qof6htPgZo9JXs5hDIRL8QDsXA+wnTZdkv w1oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BPdGeKzk; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y96-v6si1289437plh.454.2018.01.31.01.41.24; Wed, 31 Jan 2018 01:41:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BPdGeKzk; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752712AbeAaJkN (ORCPT + 10 others); Wed, 31 Jan 2018 04:40:13 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:37360 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753752AbeAaJfs (ORCPT ); Wed, 31 Jan 2018 04:35:48 -0500 Received: by mail-wm0-f67.google.com with SMTP id v71so6592545wmv.2 for ; Wed, 31 Jan 2018 01:35:48 -0800 (PST) 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=4TQyQwY7YHadksZSo3g0l1Kyive2Ie74s+4gibmNS/0=; b=BPdGeKzk7Oo+g7ahUjHWU/94u8VNzyz1HrSHXwEHTv0dxAKggKshRKHTaCUw8YdVJ/ wGl64HismNAQzMul7pe7sYlC8S2hvf6zvlwOtSEjU3XywMCjHF3ou1z5sMY6bgLRQMvT WhfnH5svx20NzWv2dv3FeQDrN/QCDWT4zTVck= 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=4TQyQwY7YHadksZSo3g0l1Kyive2Ie74s+4gibmNS/0=; b=M/OT9Sw4c/PZKnYFIssOM+4CQUkknnuRUY1fHYFp3mWjF1Cf4P3jEk7qcOgtuwmu7R UWySFzjmgE6XDkguVFWj7suOgksKagV46vREw8m4JWCZKzmNNJPPnMRePLIh3h76u5WP lregeRrIn4uwYEtyYWZSrj8F7p+S7yI9hXUWB4rgCrLdj/+OqLdz1WkfNPOPF/qTXxRg CBNJtDylk9U9Ik/7P+cA3r8u9v/paNDBAnPfMReYLOBqaZamIwRqU9E3424gmhVMInRh xacRZpa/W5YOF49VSdvEtraL/KjeKSAd6SAktxXvBhQ5nAVhjyEhDLY6FAw4NxykPaAi /4FQ== X-Gm-Message-State: AKwxytdWE5gTyvCViziZuAQSfRmMwAsaTFR4Y2cAVJ3My5BUPhxqQKvJ c0KT9Dxi1/JCXYLjcqflL8oVIw== X-Received: by 10.80.150.33 with SMTP id y30mr34588417eda.114.1517391347495; Wed, 31 Jan 2018 01:35:47 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id z2sm10247837edc.50.2018.01.31.01.35.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 Jan 2018 01:35:46 -0800 (PST) From: Christoffer Dall To: Paolo Bonzini , =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Marc Zyngier , James Morse , stable@vger.kernel.org, Lorenzo Pieralisi , Christoffer Dall Subject: [PULL 24/28] KVM: arm/arm64: Handle CPU_PM_ENTER_FAILED Date: Wed, 31 Jan 2018 10:35:03 +0100 Message-Id: <20180131093507.22219-25-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180131093507.22219-1-christoffer.dall@linaro.org> References: <20180131093507.22219-1-christoffer.dall@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: James Morse cpu_pm_enter() calls the pm notifier chain with CPU_PM_ENTER, then if there is a failure: CPU_PM_ENTER_FAILED. When KVM receives CPU_PM_ENTER it calls cpu_hyp_reset() which will return us to the hyp-stub. If we subsequently get a CPU_PM_ENTER_FAILED, KVM does nothing, leaving the CPU running with the hyp-stub, at odds with kvm_arm_hardware_enabled. Add CPU_PM_ENTER_FAILED as a fallthrough for CPU_PM_EXIT, this reloads KVM based on kvm_arm_hardware_enabled. This is safe even if CPU_PM_ENTER never gets as far as KVM, as cpu_hyp_reinit() calls cpu_hyp_reset() to make sure the hyp-stub is loaded before reloading KVM. Fixes: 67f691976662 ("arm64: kvm: allows kvm cpu hotplug") Cc: # v4.7+ CC: Lorenzo Pieralisi Reviewed-by: Christoffer Dall Signed-off-by: James Morse Signed-off-by: Christoffer Dall --- virt/kvm/arm/arm.c | 1 + 1 file changed, 1 insertion(+) -- 2.14.2 diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c index 59d8e04c19fa..639dca0c0560 100644 --- a/virt/kvm/arm/arm.c +++ b/virt/kvm/arm/arm.c @@ -1262,6 +1262,7 @@ static int hyp_init_cpu_pm_notifier(struct notifier_block *self, cpu_hyp_reset(); return NOTIFY_OK; + case CPU_PM_ENTER_FAILED: case CPU_PM_EXIT: if (__this_cpu_read(kvm_arm_hardware_enabled)) /* The hardware was enabled before suspend. */