From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B409C4741F for ; Mon, 9 Nov 2020 11:32:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4E7F921D40 for ; Mon, 9 Nov 2020 11:32:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="tKDv7a9R" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729504AbgKILcv (ORCPT ); Mon, 9 Nov 2020 06:32:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729442AbgKILcq (ORCPT ); Mon, 9 Nov 2020 06:32:46 -0500 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C80FC0613CF for ; Mon, 9 Nov 2020 03:32:45 -0800 (PST) Received: by mail-wm1-x343.google.com with SMTP id d142so7642478wmd.4 for ; Mon, 09 Nov 2020 03:32:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=f226i52yIUjNH4HBJOMzOEDrBWriDTS35aJrFSCy+Ic=; b=tKDv7a9REysuwMcfZXBWv7HtDLUfJLSTc25Wz4yG+dYB9FiY+ZSpS20+jeI7ruPf4I /fRs+zUVAIUMH1v15ddDDay1fvfPcrhZMC5kpfB1XWwITdN/8S2pMA+But30yQSNFNB8 jXgP2h4bzV7gV3d+faa8zOcxytIQ75QP4e6KxzkSUI0fLT1OOhTj4AvNRjPQ6XdKxesG ND6CsW+tx1PrW/9Sz/H3LHqnbchMyHOUycxmZIOc1N/2GLN4ul752VNg35nnWTjEXdVH EK3JO5SzqaS0OeDrJpetOM5SGKT+6ZRfLDHKcoyYlwBds01zZYnphO02pxAGc+J+wzvK hRJw== 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:mime-version:content-transfer-encoding; bh=f226i52yIUjNH4HBJOMzOEDrBWriDTS35aJrFSCy+Ic=; b=s+CM49ycF/rCAbtdUGBwpuj34E5OfUMWQ19YiDZLv2M4hvjvZo+4gQ0/c7YSfbKJFr +qeQe37NLoO4OLTx6T95mRoXXTjNaeaCMQnK7biptIu84d00Ot31VThm0TQU0k57eYRX 0p8BUoB5z+YQnu/x3bXi1/SCafmb0uK41Dtx5RdvrbEFF05lZYn9Smj4qQ6wZmxCxzmc lyQWmYGPS47NA16a3V4IySnoFKDO7UPuzRlmH9hSI8q3H866t7DAaDOdkX8dipfN5GAV NLG5MlbZ0nKFyRwVzME9funbKKA+J+miZeOJx1dwDVCLF0nia3KU0qJosFFQaF8HjV73 xBIQ== X-Gm-Message-State: AOAM531Y/nh7fUCWxEmE7g6XbKlhXeqnkg49hp3zrZGdvDA/0OFdAxyT Yidd8gieGUfi3ze+dTDb/Cz+qA== X-Google-Smtp-Source: ABdhPJwoENuVGCK5XFTaDJ8MaIk0VaZFOfs2tSaTvsARZ9sJi9l+ITqvhV3gCNpUzPG+TP47XhXsRw== X-Received: by 2002:a1c:7dc8:: with SMTP id y191mr14412755wmc.118.1604921563823; Mon, 09 Nov 2020 03:32:43 -0800 (PST) Received: from localhost ([2a01:4b00:8523:2d03:209d:10b7:c480:3e1f]) by smtp.gmail.com with ESMTPSA id h4sm12847197wrp.52.2020.11.09.03.32.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 09 Nov 2020 03:32:42 -0800 (PST) From: David Brazdil To: kvmarm@lists.cs.columbia.edu Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Marc Zyngier , James Morse , Julien Thierry , Suzuki K Poulose , Catalin Marinas , Will Deacon , Dennis Zhou , Tejun Heo , Christoph Lameter , Mark Rutland , Lorenzo Pieralisi , Quentin Perret , Andrew Scull , Andrew Walbran , kernel-team@android.com, David Brazdil Subject: [PATCH v1 02/24] psci: Accessor for configured PSCI function IDs Date: Mon, 9 Nov 2020 11:32:11 +0000 Message-Id: <20201109113233.9012-3-dbrazdil@google.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109113233.9012-1-dbrazdil@google.com> References: <20201109113233.9012-1-dbrazdil@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Function IDs used by PSCI are configurable for v0.1 via DT/APCI. If the host is using PSCI v0.1, KVM's host PSCI proxy needs to use the same IDs. Expose the array holding the information with a read-only accessor. Signed-off-by: David Brazdil --- drivers/firmware/psci/psci.c | 14 ++++++-------- include/linux/psci.h | 10 ++++++++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index bc1b2d60fdbf..b67b2ba8a084 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -65,16 +65,14 @@ typedef unsigned long (psci_fn)(unsigned long, unsigned long, unsigned long, unsigned long); static psci_fn *invoke_psci_fn; -enum psci_function { - PSCI_FN_CPU_SUSPEND, - PSCI_FN_CPU_ON, - PSCI_FN_CPU_OFF, - PSCI_FN_MIGRATE, - PSCI_FN_MAX, -}; - static u32 psci_function_id[PSCI_FN_MAX]; +u32 psci_get_function_id(enum psci_function fn) +{ + WARN_ON(fn >= PSCI_FN_MAX); + return psci_function_id[fn]; +} + #define PSCI_0_2_POWER_STATE_MASK \ (PSCI_0_2_POWER_STATE_ID_MASK | \ PSCI_0_2_POWER_STATE_TYPE_MASK | \ diff --git a/include/linux/psci.h b/include/linux/psci.h index 5b5dcf176aa6..8fe681a7b43d 100644 --- a/include/linux/psci.h +++ b/include/linux/psci.h @@ -29,6 +29,16 @@ bool psci_has_osi_support(void); */ int psci_driver_version(void); +enum psci_function { + PSCI_FN_CPU_SUSPEND, + PSCI_FN_CPU_ON, + PSCI_FN_CPU_OFF, + PSCI_FN_MIGRATE, + PSCI_FN_MAX, +}; + +u32 psci_get_function_id(enum psci_function fn); + struct psci_operations { u32 (*get_version)(void); int (*cpu_suspend)(u32 state, unsigned long entry_point); -- 2.29.2.222.g5d2a92d10f8-goog From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36EA1C56202 for ; Mon, 9 Nov 2020 11:32:49 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id B319820731 for ; Mon, 9 Nov 2020 11:32:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="tKDv7a9R" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B319820731 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 3FC7C4B757; Mon, 9 Nov 2020 06:32:48 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LVcT4IzkZqw6; Mon, 9 Nov 2020 06:32:47 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 36A7A4B76B; Mon, 9 Nov 2020 06:32:47 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 4F1E94B741 for ; Mon, 9 Nov 2020 06:32:46 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dt4YYdPktzTx for ; Mon, 9 Nov 2020 06:32:45 -0500 (EST) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 3811F4B759 for ; Mon, 9 Nov 2020 06:32:45 -0500 (EST) Received: by mail-wm1-f65.google.com with SMTP id h2so7655908wmm.0 for ; Mon, 09 Nov 2020 03:32:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=f226i52yIUjNH4HBJOMzOEDrBWriDTS35aJrFSCy+Ic=; b=tKDv7a9REysuwMcfZXBWv7HtDLUfJLSTc25Wz4yG+dYB9FiY+ZSpS20+jeI7ruPf4I /fRs+zUVAIUMH1v15ddDDay1fvfPcrhZMC5kpfB1XWwITdN/8S2pMA+But30yQSNFNB8 jXgP2h4bzV7gV3d+faa8zOcxytIQ75QP4e6KxzkSUI0fLT1OOhTj4AvNRjPQ6XdKxesG ND6CsW+tx1PrW/9Sz/H3LHqnbchMyHOUycxmZIOc1N/2GLN4ul752VNg35nnWTjEXdVH EK3JO5SzqaS0OeDrJpetOM5SGKT+6ZRfLDHKcoyYlwBds01zZYnphO02pxAGc+J+wzvK hRJw== 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:mime-version:content-transfer-encoding; bh=f226i52yIUjNH4HBJOMzOEDrBWriDTS35aJrFSCy+Ic=; b=nWjiltfYwMSNCpU3ztfuCiuLmKSeiM61isC4UUXSwKEqlQujwx3nLFkFa0J+1HQeAO Q44fYewWKP522QWVjgt0j4HGHtZyDWsPLvhcDKclULwAPjHmvL4j5aZiEnzncdCJz+Jb Ako8EgCtEQu/uDCzlshJsMMw7U2FamdCHg+drb5CMp3P5Vsf6XpK54JsWN0HREJhPcJi 2A+J1FqZ+VFOvANNbuoUFz58VisXwIDVJxkprlBFRH+Ke3pm+JFbmXpOm3d7lJeQC/Pp 1Jt0Mo2aZiroPJ/7+Ed0DQRCK6C2MtjGiwA24jtKBWapwFhXjDq5hnP+v9tw5qCn+IgF DuFw== X-Gm-Message-State: AOAM532qtmOeMqXYFv+Np7E4j75/kPLwWIZAHRDpROZ/M2Jk4ra6QOPy QvXLGXa5XwXE4gVqntqK5rKxuRz44MIJZYm3 X-Google-Smtp-Source: ABdhPJwoENuVGCK5XFTaDJ8MaIk0VaZFOfs2tSaTvsARZ9sJi9l+ITqvhV3gCNpUzPG+TP47XhXsRw== X-Received: by 2002:a1c:7dc8:: with SMTP id y191mr14412755wmc.118.1604921563823; Mon, 09 Nov 2020 03:32:43 -0800 (PST) Received: from localhost ([2a01:4b00:8523:2d03:209d:10b7:c480:3e1f]) by smtp.gmail.com with ESMTPSA id h4sm12847197wrp.52.2020.11.09.03.32.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 09 Nov 2020 03:32:42 -0800 (PST) From: David Brazdil To: kvmarm@lists.cs.columbia.edu Subject: [PATCH v1 02/24] psci: Accessor for configured PSCI function IDs Date: Mon, 9 Nov 2020 11:32:11 +0000 Message-Id: <20201109113233.9012-3-dbrazdil@google.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109113233.9012-1-dbrazdil@google.com> References: <20201109113233.9012-1-dbrazdil@google.com> MIME-Version: 1.0 Cc: kernel-team@android.com, Lorenzo Pieralisi , Andrew Walbran , Marc Zyngier , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Catalin Marinas , Tejun Heo , Dennis Zhou , Christoph Lameter , Will Deacon X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu Function IDs used by PSCI are configurable for v0.1 via DT/APCI. If the host is using PSCI v0.1, KVM's host PSCI proxy needs to use the same IDs. Expose the array holding the information with a read-only accessor. Signed-off-by: David Brazdil --- drivers/firmware/psci/psci.c | 14 ++++++-------- include/linux/psci.h | 10 ++++++++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index bc1b2d60fdbf..b67b2ba8a084 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -65,16 +65,14 @@ typedef unsigned long (psci_fn)(unsigned long, unsigned long, unsigned long, unsigned long); static psci_fn *invoke_psci_fn; -enum psci_function { - PSCI_FN_CPU_SUSPEND, - PSCI_FN_CPU_ON, - PSCI_FN_CPU_OFF, - PSCI_FN_MIGRATE, - PSCI_FN_MAX, -}; - static u32 psci_function_id[PSCI_FN_MAX]; +u32 psci_get_function_id(enum psci_function fn) +{ + WARN_ON(fn >= PSCI_FN_MAX); + return psci_function_id[fn]; +} + #define PSCI_0_2_POWER_STATE_MASK \ (PSCI_0_2_POWER_STATE_ID_MASK | \ PSCI_0_2_POWER_STATE_TYPE_MASK | \ diff --git a/include/linux/psci.h b/include/linux/psci.h index 5b5dcf176aa6..8fe681a7b43d 100644 --- a/include/linux/psci.h +++ b/include/linux/psci.h @@ -29,6 +29,16 @@ bool psci_has_osi_support(void); */ int psci_driver_version(void); +enum psci_function { + PSCI_FN_CPU_SUSPEND, + PSCI_FN_CPU_ON, + PSCI_FN_CPU_OFF, + PSCI_FN_MIGRATE, + PSCI_FN_MAX, +}; + +u32 psci_get_function_id(enum psci_function fn); + struct psci_operations { u32 (*get_version)(void); int (*cpu_suspend)(u32 state, unsigned long entry_point); -- 2.29.2.222.g5d2a92d10f8-goog _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70089C388F7 for ; Mon, 9 Nov 2020 11:33:30 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EA6AA206A4 for ; Mon, 9 Nov 2020 11:33:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="YXV5w+5Q"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="tKDv7a9R" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EA6AA206A4 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: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:List-Owner; bh=Wppy5R74ZPCGuo9c45v1y1PgX9DeG3mSPFsRBoMEhNc=; b=YXV5w+5QHF7nfgc14CIF0xnvP E64yt3k9dBK0ien1tWQe6Vir5Ntv9Ypv1NjTE4ZFoybnYrMFr9kGi/kzeNb6H8CDiOmm4S7K20v2M 6B9U/sNkRWh5dfhfuslv6pzIbJiET1cqadHaqLEIbjUZVWS7A9u2YpJJd0mhLoyzzm68m2Tu20//7 TxF31ZxfLGGUvtBo3nJpZL94j1tbsv305AYnyWf+4IPqMB4aqBNhuRIJJTZwGzSXMzwmW0StqvGZy 7bs+4yLIn8GoxcuJII4XI7YKcVcnc3bs6NR+ZmdRPSJu+fnK6//8cKRGaLQ9l03KcZu/0nkBSBJrw 4uYmB6GlA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kc5Ps-0004OJ-Gg; Mon, 09 Nov 2020 11:32:56 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kc5Ph-0004Kt-1a for linux-arm-kernel@lists.infradead.org; Mon, 09 Nov 2020 11:32:45 +0000 Received: by mail-wm1-x344.google.com with SMTP id h2so7655895wmm.0 for ; Mon, 09 Nov 2020 03:32:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=f226i52yIUjNH4HBJOMzOEDrBWriDTS35aJrFSCy+Ic=; b=tKDv7a9REysuwMcfZXBWv7HtDLUfJLSTc25Wz4yG+dYB9FiY+ZSpS20+jeI7ruPf4I /fRs+zUVAIUMH1v15ddDDay1fvfPcrhZMC5kpfB1XWwITdN/8S2pMA+But30yQSNFNB8 jXgP2h4bzV7gV3d+faa8zOcxytIQ75QP4e6KxzkSUI0fLT1OOhTj4AvNRjPQ6XdKxesG ND6CsW+tx1PrW/9Sz/H3LHqnbchMyHOUycxmZIOc1N/2GLN4ul752VNg35nnWTjEXdVH EK3JO5SzqaS0OeDrJpetOM5SGKT+6ZRfLDHKcoyYlwBds01zZYnphO02pxAGc+J+wzvK hRJw== 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:mime-version:content-transfer-encoding; bh=f226i52yIUjNH4HBJOMzOEDrBWriDTS35aJrFSCy+Ic=; b=X8YjSFqHvxvPCZYEvvEm7keKh+rbwxz6Ied5a8QX4wN7uKLyUF0ML/jFxhjgfadDHz x6BvuXKeYtLdITPj4FmCJ2DVflUVfrbxoLEqdDXdR1iZsY902ujeMUYheN+ripcGhC9g CoohTgErH7l25d9hFbKNNGddWlr/gD+M72X6qNaJdiK+8Wy8rQNFcg4e3co8ccMPmSCO 1XZkHsGFjhu6xswBqHSRQnT7rFI9EFApRv+dKkiMpTK7+QA0bB/JDr1XBkcJZcgg+vdi FcM0bArofvqLqtImYfhKUoEbTuZYqqcGcOI/x525tXpDN+GYqbgbEiI6jOmry3jAqc7s Ko1A== X-Gm-Message-State: AOAM532x3i5ZcIbVN0BQJKU+gigYPB6dlwcmX2LPPvqIY/3I/NsqHqLT UzwsZ4YleZDrrnuw9YrKangCntLkos4fLoXt X-Google-Smtp-Source: ABdhPJwoENuVGCK5XFTaDJ8MaIk0VaZFOfs2tSaTvsARZ9sJi9l+ITqvhV3gCNpUzPG+TP47XhXsRw== X-Received: by 2002:a1c:7dc8:: with SMTP id y191mr14412755wmc.118.1604921563823; Mon, 09 Nov 2020 03:32:43 -0800 (PST) Received: from localhost ([2a01:4b00:8523:2d03:209d:10b7:c480:3e1f]) by smtp.gmail.com with ESMTPSA id h4sm12847197wrp.52.2020.11.09.03.32.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 09 Nov 2020 03:32:42 -0800 (PST) From: David Brazdil To: kvmarm@lists.cs.columbia.edu Subject: [PATCH v1 02/24] psci: Accessor for configured PSCI function IDs Date: Mon, 9 Nov 2020 11:32:11 +0000 Message-Id: <20201109113233.9012-3-dbrazdil@google.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109113233.9012-1-dbrazdil@google.com> References: <20201109113233.9012-1-dbrazdil@google.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201109_063245_157737_56641F2B X-CRM114-Status: GOOD ( 15.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , kernel-team@android.com, Lorenzo Pieralisi , Andrew Walbran , Suzuki K Poulose , Marc Zyngier , Quentin Perret , linux-kernel@vger.kernel.org, James Morse , linux-arm-kernel@lists.infradead.org, Catalin Marinas , Tejun Heo , Dennis Zhou , Christoph Lameter , David Brazdil , Will Deacon , Julien Thierry , Andrew Scull Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Function IDs used by PSCI are configurable for v0.1 via DT/APCI. If the host is using PSCI v0.1, KVM's host PSCI proxy needs to use the same IDs. Expose the array holding the information with a read-only accessor. Signed-off-by: David Brazdil --- drivers/firmware/psci/psci.c | 14 ++++++-------- include/linux/psci.h | 10 ++++++++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index bc1b2d60fdbf..b67b2ba8a084 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -65,16 +65,14 @@ typedef unsigned long (psci_fn)(unsigned long, unsigned long, unsigned long, unsigned long); static psci_fn *invoke_psci_fn; -enum psci_function { - PSCI_FN_CPU_SUSPEND, - PSCI_FN_CPU_ON, - PSCI_FN_CPU_OFF, - PSCI_FN_MIGRATE, - PSCI_FN_MAX, -}; - static u32 psci_function_id[PSCI_FN_MAX]; +u32 psci_get_function_id(enum psci_function fn) +{ + WARN_ON(fn >= PSCI_FN_MAX); + return psci_function_id[fn]; +} + #define PSCI_0_2_POWER_STATE_MASK \ (PSCI_0_2_POWER_STATE_ID_MASK | \ PSCI_0_2_POWER_STATE_TYPE_MASK | \ diff --git a/include/linux/psci.h b/include/linux/psci.h index 5b5dcf176aa6..8fe681a7b43d 100644 --- a/include/linux/psci.h +++ b/include/linux/psci.h @@ -29,6 +29,16 @@ bool psci_has_osi_support(void); */ int psci_driver_version(void); +enum psci_function { + PSCI_FN_CPU_SUSPEND, + PSCI_FN_CPU_ON, + PSCI_FN_CPU_OFF, + PSCI_FN_MIGRATE, + PSCI_FN_MAX, +}; + +u32 psci_get_function_id(enum psci_function fn); + struct psci_operations { u32 (*get_version)(void); int (*cpu_suspend)(u32 state, unsigned long entry_point); -- 2.29.2.222.g5d2a92d10f8-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel