From patchwork Tue Jan 9 19:38:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliot Berman X-Patchwork-Id: 13515296 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B30BC4706C for ; Tue, 9 Jan 2024 19:39:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B352E6B0080; Tue, 9 Jan 2024 14:38:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AE55A6B0099; Tue, 9 Jan 2024 14:38:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 899C66B00A4; Tue, 9 Jan 2024 14:38:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 745796B0080 for ; Tue, 9 Jan 2024 14:38:20 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 459B34097E for ; Tue, 9 Jan 2024 19:38:20 +0000 (UTC) X-FDA: 81660783960.07.D5C89A2 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by imf07.hostedemail.com (Postfix) with ESMTP id E7C2340011 for ; Tue, 9 Jan 2024 19:38:17 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=V6m8c9Mx; dmarc=pass (policy=none) header.from=quicinc.com; spf=pass (imf07.hostedemail.com: domain of quic_eberman@quicinc.com designates 205.220.168.131 as permitted sender) smtp.mailfrom=quic_eberman@quicinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1704829098; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=mISjbqlRqJVm6RisqWAuRaAGWyV18zAgZkFAhzyIWvs=; b=ZdER4YJE5PyW1LznX5IXSKO3QZnLvH1Ge5ZUqlzBDsQ4Jw6+0hNevGXlYf0mw7f4BH8+6F 2QSwB2NKUP8js9CuYPQs4M8yJf1GA6fvXD11TsBn1DH77hi/K8DuPMePw1MNRgWJo5QGQD 7LbMAyIODhzqAt5R5+L2GRyckxISoMA= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=V6m8c9Mx; dmarc=pass (policy=none) header.from=quicinc.com; spf=pass (imf07.hostedemail.com: domain of quic_eberman@quicinc.com designates 205.220.168.131 as permitted sender) smtp.mailfrom=quic_eberman@quicinc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704829098; a=rsa-sha256; cv=none; b=XmXUB2mQSagSUYr9iW/yYaJxKlf4SAFCGXRuY5h+hvoHcN9gZnjLaTQ0C9wy/TwouMMNgl 45nL63rjBnEv4N55WlXKtgkv0MQLjitwLtbpgH5wOl6MtPbdUQgl41+bSYhPNFHZQheMcq a7RYqpS6HQtundNSC2vvLJCprONkoDA= Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 409GCAMK032177; Tue, 9 Jan 2024 19:38:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:date:subject:mime-version:content-type :content-transfer-encoding:message-id:references:in-reply-to:to :cc; s=qcppdkim1; bh=mISjbqlRqJVm6RisqWAuRaAGWyV18zAgZkFAhzyIWvs =; b=V6m8c9Mx2eyhux4dK8665TNsA6fyLrEUnpaGhJjGuHQgzO7Lm3gMbmtsEvB p1+f/99M2SM60MlmAYF2aIwBieGY9fCV4fq8/7k1qFfgMHti6yXBaQ4i11l1jbqf /11POm1l8TiBS18saLUGLiLpx4HfPlfA00X6tjJ+BeeOtSvOwbTxfaUAHd9KDj+j n2sn/MhCcsMTHrnwmRhNxP4V74e56MMiud81kqYLVqnqPAmjuruwEC5WRVdTjPpy 5JIpj9TCPATFZQdrclnLzGsyRbbvtv3mRO60GNmLZ3U2UHZLYngVlpeC6M2ZeFjy TuRx2FGqJIBSRny8G6ObJLaUlgA== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3vh9evrfhy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Jan 2024 19:38:08 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 409Jc72b012055 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 9 Jan 2024 19:38:07 GMT Received: from hu-eberman-lv.qualcomm.com (10.49.16.6) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Tue, 9 Jan 2024 11:38:06 -0800 From: Elliot Berman Date: Tue, 9 Jan 2024 11:38:06 -0800 Subject: [PATCH v16 28/34] gunyah: rsc_mgr: Add RPC to set VM boot context MIME-Version: 1.0 Message-ID: <20240109-gunyah-v16-28-634904bf4ce9@quicinc.com> References: <20240109-gunyah-v16-0-634904bf4ce9@quicinc.com> In-Reply-To: <20240109-gunyah-v16-0-634904bf4ce9@quicinc.com> To: Alex Elder , Srinivas Kandagatla , Murali Nalajal , Trilok Soni , Srivatsa Vaddagiri , Carl van Schaik , Philip Derrin , Prakruthi Deepak Heragu , Jonathan Corbet , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Catalin Marinas , Will Deacon , Konrad Dybcio , Bjorn Andersson , Dmitry Baryshkov , "Fuad Tabba" , Sean Christopherson , "Andrew Morton" CC: , , , , , , Elliot Berman X-Mailer: b4 0.13-dev X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01c.na.qualcomm.com (10.47.97.35) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: eLF8qTS-lSW6WCS6nT_JzEqTWuhHD0yL X-Proofpoint-ORIG-GUID: eLF8qTS-lSW6WCS6nT_JzEqTWuhHD0yL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_01,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 mlxlogscore=999 lowpriorityscore=0 mlxscore=0 priorityscore=1501 adultscore=0 suspectscore=0 clxscore=1015 spamscore=0 phishscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2401090158 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: E7C2340011 X-Stat-Signature: s5jh4c1mcjotm1hh7tejoipqcmanzqk1 X-HE-Tag: 1704829097-820653 X-HE-Meta: U2FsdGVkX1/4pl+0aCaRP/DeEHroblXm81MX1F038G3AnWe927nOULwxq/g9xQ/Uvq9kcYrmw0cMDQG9OZR9shz1tqak0Ge58ZQ6n0Q8ibiEgMD+gzOSj3frcAMcL5C+Bx72YhagExF+X//7ZX5ok0F8ziZFJHSoxxNlWiqP5zSGFUWsdkdwKTLEo/+BZlYzlLpyYHzg/IMas2qM8I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KE/Fy8xouMAPntD8AGNdcpH6yNqPCLUcvnglzraGMwe8zrfWjJYvg7IpaVzq7qUvHNPm6l6PJIZ6TIWy0Ptg4hJot7tN/gBrwBysn2tGG+Otp9ZgUyNFfWjMdn3f9iJ4zLdoipZKVEkQ= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The initial context of a the primary vCPU can be initialized by performing RM RPC calls. Signed-off-by: Elliot Berman --- drivers/virt/gunyah/rsc_mgr.h | 2 ++ drivers/virt/gunyah/rsc_mgr_rpc.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/drivers/virt/gunyah/rsc_mgr.h b/drivers/virt/gunyah/rsc_mgr.h index 99c2db18579c..2acaf8dff365 100644 --- a/drivers/virt/gunyah/rsc_mgr.h +++ b/drivers/virt/gunyah/rsc_mgr.h @@ -84,6 +84,8 @@ int gunyah_rm_vm_configure(struct gunyah_rm *rm, u16 vmid, u32 mem_handle, u64 image_offset, u64 image_size, u64 dtb_offset, u64 dtb_size); int gunyah_rm_vm_init(struct gunyah_rm *rm, u16 vmid); +int gunyah_rm_vm_set_boot_context(struct gunyah_rm *rm, u16 vmid, u8 reg_set, + u8 reg_index, u64 value); struct gunyah_rm_hyp_resource { u8 type; diff --git a/drivers/virt/gunyah/rsc_mgr_rpc.c b/drivers/virt/gunyah/rsc_mgr_rpc.c index f4e396fd0d47..bbdae0b05cd4 100644 --- a/drivers/virt/gunyah/rsc_mgr_rpc.c +++ b/drivers/virt/gunyah/rsc_mgr_rpc.c @@ -20,6 +20,7 @@ #define GUNYAH_RM_RPC_VM_RESET 0x56000006 #define GUNYAH_RM_RPC_VM_CONFIG_IMAGE 0x56000009 #define GUNYAH_RM_RPC_VM_INIT 0x5600000B +#define GUNYAH_RM_RPC_VM_SET_BOOT_CONTEXT 0x5600000C #define GUNYAH_RM_RPC_VM_GET_HYP_RESOURCES 0x56000020 #define GUNYAH_RM_RPC_VM_GET_VMID 0x56000024 #define GUNYAH_RM_RPC_VM_SET_DEMAND_PAGING 0x56000033 @@ -102,6 +103,15 @@ struct gunyah_rm_vm_config_image_req { __le64 dtb_size; } __packed; +/* Call: VM_SET_BOOT_CONTEXT */ +struct gunyah_rm_vm_set_boot_context_req { + __le16 vmid; + u8 reg_set; + u8 reg_index; + __le32 _padding; + __le64 value; +} __packed; + /* Call: VM_SET_DEMAND_PAGING */ struct gunyah_rm_vm_set_demand_paging_req { __le16 vmid; @@ -435,6 +445,28 @@ int gunyah_rm_vm_init(struct gunyah_rm *rm, u16 vmid) return gunyah_rm_common_vmid_call(rm, GUNYAH_RM_RPC_VM_INIT, vmid); } +/** + * gunyah_rm_vm_set_boot_context() - set the initial boot context of the primary vCPU + * @rm: Handle to a Gunyah resource manager + * @vmid: VM identifier + * @reg_set: See &enum gunyah_vm_boot_context_reg + * @reg_index: Which register to set; must be 0 for REG_SET_PC + * @value: Value to set in the register + */ +int gunyah_rm_vm_set_boot_context(struct gunyah_rm *rm, u16 vmid, u8 reg_set, + u8 reg_index, u64 value) +{ + struct gunyah_rm_vm_set_boot_context_req req_payload = { + .vmid = cpu_to_le16(vmid), + .reg_set = reg_set, + .reg_index = reg_index, + .value = cpu_to_le64(value), + }; + + return gunyah_rm_call(rm, GUNYAH_RM_RPC_VM_SET_BOOT_CONTEXT, + &req_payload, sizeof(req_payload), NULL, NULL); +} + /** * gunyah_rm_get_hyp_resources() - Retrieve hypervisor resources (capabilities) associated with a VM * @rm: Handle to a Gunyah resource manager