Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp372906lqp; Mon, 10 Jun 2024 06:51:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUexusUq/FOR/lfllqzd+shNlC38u0bVmBEiJS0N/1FM15vDZBA0ZqAiGqDebvDggO3y/juv1a+aKs5XYAl0C3u4qOYRTrO+tUpTNM5Nw== X-Google-Smtp-Source: AGHT+IGckRaXRmfeiXk0tYqspbi3B89xzMJWA82JVVsUs/tuGZrUne00/pbG6n87JyOulkpb3NAq X-Received: by 2002:a17:906:2dc8:b0:a6e:fac9:af5e with SMTP id a640c23a62f3a-a6efac9afd1mr422401266b.3.1718027475413; Mon, 10 Jun 2024 06:51:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718027475; cv=pass; d=google.com; s=arc-20160816; b=bQ2W7PMO6A4e7PK5lxREftGbl9XsWoAfjlBKM8qaTA5nTzVrphBAbLlqdtQ2IxAl2T 9qfCfva+tSnBzrk9TUCnqF8tUPsYtoqvcq3D3MacZpsWmug3vdrqcTCp5FL82mJX2nNc U+Sa99SCmPoRY3cYazwmZb8tHkc9A+Ej7KBix3utIzCj4lCDhEv8qlZj+bbelDyM52l7 3hyIXMNvrHdA5hKBMJNhEJuR19kFFB1p/nm6097xV2ANS567pi+uky8umStJvuL8QjQh 3GBRuaK9Anl7QY+EI+r+AA11svmYEGz2J/EZ+5qwXZ6yS851vU+rx2n4TeAMCKpJ+PbL mq2w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=ve1J6un8zJ45wMmDW6f2wfGW4OP2us4F0EHx83u+lDE=; fh=jZlwjFebu20NcQxJoBNXk9wYQkz+p/PzXpXKor2I3KE=; b=UzaXyWQ0g3CqUjf+lP/BrJEMbR9hYmT8yV827VsW3ITgDmNjqhfqIB+K47GDIiPy5K Gl3NLwSgNulXRQcNf8/GfxRFEd3TVSRWt4la7FjIVWYFvrfziuVKxIZDNDQ5yS1dYvVp Qx8pUtMvSbEve+9bWPuJL6QVJWqSUS6TJtG3CTDweoTIGPiKuPICm2XoMpj7d4hSSa1d E4keQDC7Md2ntPZdyLd7dx9BCd5F3da4AHmiIa0GthiYnHRPxq2ANsdvyqv98Vr0wAiT pIWLNCZ2P336lns2lE3xE3ckDB0QT/1NXxM9Is/eoqHHcQUGNaiCCWJPmDlk8G5k/A6K vXZA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-208275-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208275-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6eff8673e0si241422566b.922.2024.06.10.06.51.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 06:51:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208275-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-208275-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208275-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 23D201F2382D for ; Mon, 10 Jun 2024 13:51:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8F932155C8F; Mon, 10 Jun 2024 13:43:54 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C6AC9155C81; Mon, 10 Jun 2024 13:43:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718027034; cv=none; b=ONDumAGFIBPmlo/bHxJXDY5FAN0bI/h7Mf4leLVLnE0vRo/XVzggThpreejSS1B9eP80lF58NdL8KzyMmCNb9PZNq6m4DRB0UvoGW/lxMy23Cq5/uQZ0xaN3WuRxBF+BVOkqoHtH6zujLi1a5GHPD8RZdvx+I/OYE0kTs96hiP8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718027034; c=relaxed/simple; bh=hmDkcRmffdx2dEYCxN/tyZ+CbfHY6WKH0OsV4sTvbJo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dBv7AgJImUqKkmxteglh8h92lutMfdalh4aFVPwxxY5eh8zLPWJYyepnQnFjGybSZ+LYXAE0Q0SVnPo9XRWLuUcljnU3iXgCun8P0AntlZIHzs9Nb4NcDGpBcd1proR/xjcqHfRzmfFJMgIzEUyEEBYmraePgNJ5YvYEljhBJnI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0095C1692; Mon, 10 Jun 2024 06:44:17 -0700 (PDT) Received: from e122027.cambridge.arm.com (e122027.cambridge.arm.com [10.1.35.41]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E24593F58B; Mon, 10 Jun 2024 06:43:48 -0700 (PDT) From: Steven Price To: kvm@vger.kernel.org, kvmarm@lists.linux.dev Cc: Joey Gouly , Catalin Marinas , Marc Zyngier , Will Deacon , James Morse , Oliver Upton , Suzuki K Poulose , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Alexandru Elisei , Christoffer Dall , Fuad Tabba , linux-coco@lists.linux.dev, Ganapatrao Kulkarni , Steven Price Subject: [PATCH v3 28/43] arm64: rme: support RSI_HOST_CALL Date: Mon, 10 Jun 2024 14:41:47 +0100 Message-Id: <20240610134202.54893-29-steven.price@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240610134202.54893-1-steven.price@arm.com> References: <20240610134202.54893-1-steven.price@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Joey Gouly Forward RSI_HOST_CALLS to KVM's HVC handler. Signed-off-by: Joey Gouly Signed-off-by: Steven Price --- arch/arm64/kvm/rme-exit.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/arch/arm64/kvm/rme-exit.c b/arch/arm64/kvm/rme-exit.c index 03ed147f7926..0940575b0a14 100644 --- a/arch/arm64/kvm/rme-exit.c +++ b/arch/arm64/kvm/rme-exit.c @@ -117,6 +117,29 @@ static int rec_exit_ripas_change(struct kvm_vcpu *vcpu) return 0; } +static int rec_exit_host_call(struct kvm_vcpu *vcpu) +{ + int ret, i; + struct realm_rec *rec = &vcpu->arch.rec; + + vcpu->stat.hvc_exit_stat++; + + for (i = 0; i < REC_RUN_GPRS; i++) + vcpu_set_reg(vcpu, i, rec->run->exit.gprs[i]); + + ret = kvm_smccc_call_handler(vcpu); + + if (ret < 0) { + vcpu_set_reg(vcpu, 0, ~0UL); + ret = 1; + } + + for (i = 0; i < REC_RUN_GPRS; i++) + rec->run->enter.gprs[i] = vcpu_get_reg(vcpu, i); + + return ret; +} + static void update_arch_timer_irq_lines(struct kvm_vcpu *vcpu) { struct realm_rec *rec = &vcpu->arch.rec; @@ -178,6 +201,8 @@ int handle_rme_exit(struct kvm_vcpu *vcpu, int rec_run_ret) return rec_exit_psci(vcpu); case RMI_EXIT_RIPAS_CHANGE: return rec_exit_ripas_change(vcpu); + case RMI_EXIT_HOST_CALL: + return rec_exit_host_call(vcpu); } kvm_pr_unimpl("Unsupported exit reason: %u\n", -- 2.34.1