From patchwork Wed Dec 6 15:55:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Leeder X-Patchwork-Id: 10096385 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 075D160210 for ; Wed, 6 Dec 2017 15:56:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC3861FF29 for ; Wed, 6 Dec 2017 15:56:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0A7A2969C; Wed, 6 Dec 2017 15:56:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 561E01FF29 for ; Wed, 6 Dec 2017 15:56:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=Hwb5m6zCYfOudpID+7IkdfLoMYHktKqbBz23IylR5TQ=; b=iNo 36p63tV6NyW3b3m60uMMfaUjx8MrMbLt0Fa4JKDbXXnDaCEMaFLHH1BeDDfTfCuWCEe+USmzHS25q fYCG5REGxXJ36ZsywdX3Qxmu3E9M2rhPC7RWiED3TNyNrvz6vVLuE/E/Tjmlw/Hoq0lmp6rCckwQZ 3jLwzP1yMdo/5kl6huZRorE7jD1lJPiJT6x4uujc6a5fKdU8qZNLfHSn4c3hphgp9U9dFjetrr9LX O/fZGg0lvwLhPbnjR4vXMlv+ENDuOq7qi4OCZNmfVhopmTrRiws/TthXhYHYwYvaUoZyuKTJQuxlm Yt+MZNTroNI//ns4lfJFv2LF5mjg2Vg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eMc3L-0004Ck-WA; Wed, 06 Dec 2017 15:56:08 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eMc3J-000452-88 for linux-arm-kernel@lists.infradead.org; Wed, 06 Dec 2017 15:56:06 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id B1BEC607F4; Wed, 6 Dec 2017 15:55:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1512575744; bh=9vn7XX8MB9dBUPOmlbIQqxtoxhNgJ5lpLyYDmKdMn5E=; h=From:To:Cc:Subject:Date:From; b=h4xaV2jpaORnXIUdeELQAtXWYVow+8Zg9xL84OkZNWSIrNomteCh2RT4eb0VBbKfZ DWvLC/1+VL4G0NdevizIdaEqzgTUUKW/b2xkWp0R2l5lzQ+N2XDEQodGfk6T6ZHXeR 1Z7fRGdnjEm1fvG5K4k1qtYpCduDiOY4af3RNe/Q= Received: from codeaurora.org (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: nleeder@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 1C7BA60398; Wed, 6 Dec 2017 15:55:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1512575744; bh=9vn7XX8MB9dBUPOmlbIQqxtoxhNgJ5lpLyYDmKdMn5E=; h=From:To:Cc:Subject:Date:From; b=h4xaV2jpaORnXIUdeELQAtXWYVow+8Zg9xL84OkZNWSIrNomteCh2RT4eb0VBbKfZ DWvLC/1+VL4G0NdevizIdaEqzgTUUKW/b2xkWp0R2l5lzQ+N2XDEQodGfk6T6ZHXeR 1Z7fRGdnjEm1fvG5K4k1qtYpCduDiOY4af3RNe/Q= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1C7BA60398 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=nleeder@codeaurora.org From: Neil Leeder To: Will Deacon , Mark Rutland Subject: [PATCH] perf: qcom_l2_pmu: don't allow guest access Date: Wed, 6 Dec 2017 10:55:33 -0500 Message-Id: <1512575733-923-1-git-send-email-nleeder@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171206_075605_363111_E118C081 X-CRM114-Status: GOOD ( 10.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Langsdorf , Jon Masters , Timur Tabi , linux-kernel@vger.kernel.org, Mark Brown , Mark Salter , nleeder@codeaurora.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Guests cannot access IMPDEF system registers, which are used by this driver. Disable the driver if it's running in a guest VM. Signed-off-by: Neil Leeder --- drivers/perf/qcom_l2_pmu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/perf/qcom_l2_pmu.c b/drivers/perf/qcom_l2_pmu.c index 4fdc848..49dc954 100644 --- a/drivers/perf/qcom_l2_pmu.c +++ b/drivers/perf/qcom_l2_pmu.c @@ -1057,6 +1057,10 @@ static int __init register_l2_cache_pmu_driver(void) { int err; + /* Don't enable driver if running as guest */ + if (!is_hyp_mode_available()) + return 0; + err = cpuhp_setup_state_multi(CPUHP_AP_PERF_ARM_QCOM_L2_ONLINE, "AP_PERF_ARM_QCOM_L2_ONLINE", l2cache_pmu_online_cpu,