Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp18404lql; Fri, 12 Apr 2024 02:08:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVx4cEC9AeROghUYOGqFIOBnYaKj8knnomr5FaHX7lg4K6XI4+KuKJQ7LJsZDQm+Y6WyKe6PbAH8AuptFnHP5FBFs5XvqTZUtORW8Qa4w== X-Google-Smtp-Source: AGHT+IG0gIUVxY89LHBpXXMAXJ4lCbd76vtRfLrHHzghW3ylJ49ZyrieE8rnOa6F1i/aBM1hE/za X-Received: by 2002:a17:902:7613:b0:1e4:3c7f:c060 with SMTP id k19-20020a170902761300b001e43c7fc060mr1650603pll.66.1712912896870; Fri, 12 Apr 2024 02:08:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712912896; cv=pass; d=google.com; s=arc-20160816; b=bmAInrscXUY6DAjdHAUcRzdMS8mDEgZzk78wqbPOX1XUQOIPItjLMBUMtlvYBGKqki SvMBgytCGAl9sXd3Dwag8XZNlq7k3MU4WwJYMGHOSwm9uuswL0uJX5Es66vDaVDCtXp0 pwtG2+d2yfaGfufkMdYdo4xaVmpcu+nssknuRFBxzVt5mOVMQCjg2qXZngLEsByBuZ33 REUBwfdm4CSpb1FhJuyYFiWsgn5VPRARxG5zKX0WPxHiHjQKK6/+LIaz16Lu0IWoklJ9 x+M+YTu0N5ZqQLpVB2r0TmGJFm+p0YUfaISlI3oCkIh7fr8709RyL5D5x53t+tlIXpYb nCYA== 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=3juCo8W8qig4MqlDKWT0fDuvvp2UmaI2JLvmAujpuSQ=; fh=jZlwjFebu20NcQxJoBNXk9wYQkz+p/PzXpXKor2I3KE=; b=Ps6AUNoYVUSpUSihMjNjgO/vxgbqqBQV3xoqFqqYmJA7iPoyhZ8XGyKZfKQIDm4Ygu OYsj5GK285aDhtvrCJNE3guUvkTNQu4puhq4qnws1tzmMed4atzL2KlwCnYi5Npx7XUl XqeeKCH2ji3HP6HUdpE+4yz3a115gGNUfL6zh5dJ7aZbPoAVYpHVbqQZomf/iOn8oZXI WxhC/vj376G537bLVAL6wej1yUTo0woUItbHPfn3eIMP7CjbZK6fd0K5WUhsW2LRgsGD dHdJx7nATsvegVktcD+WsO13Y4P7FZR/JKhi7v1+JOR5rMfUJk1Fhrxtmvukpuw7bDTS T5Zg==; 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-142298-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142298-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k4-20020a170902760400b001e2881eed3fsi2770407pll.138.2024.04.12.02.08.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 02:08:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142298-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; 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-142298-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142298-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 7027028B986 for ; Fri, 12 Apr 2024 08:56:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 394BC127E14; Fri, 12 Apr 2024 08:44:26 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8530554919; Fri, 12 Apr 2024 08:44:24 +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=1712911465; cv=none; b=QDM+yrqtTJNIbivzRcLRhuhU3kFDvcwpYKUWQjiJTnOB40bkydMCh/7H5Tdw59fhsVr4fGBAIYQMHDyoW4MaWIMHlYph8A5br6iw/HO5LxJXReaxf0nKvl59MBrLF3ZiZ59CCE1Njh56pmu++S6PX7yxwXzaLs98PLykIhTx/A0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712911465; c=relaxed/simple; bh=VLPO//f8iiRAMFU63YIgd04F7MJMw7wgmtrqbH6xF48=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SJbM3VdC/Gv93ihXeYgVIDGztZYG3LbKoEV1wH6lhgKr1+8mbvLCj+cvy0u8K6fZaQUi69iq6bb2UtLTuqCBPVXAsvEsD3t/tUnRM9HVzp7pimPwTcaml4uCpaOBNsmhBOWA8Sk8kmVZ8ucLEDi6yQerrWxx9UggbXQlsLCIosE= 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 79C0F14BF; Fri, 12 Apr 2024 01:44:53 -0700 (PDT) Received: from e112269-lin.cambridge.arm.com (e112269-lin.cambridge.arm.com [10.1.194.51]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1DE8C3F6C4; Fri, 12 Apr 2024 01:44:22 -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 v2 28/43] arm64: rme: support RSI_HOST_CALL Date: Fri, 12 Apr 2024 09:42:54 +0100 Message-Id: <20240412084309.1733783-29-steven.price@arm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240412084309.1733783-1-steven.price@arm.com> References: <20240412084056.1733704-1-steven.price@arm.com> <20240412084309.1733783-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 2ddaec09cc98..b442e9a00d07 100644 --- a/arch/arm64/kvm/rme-exit.c +++ b/arch/arm64/kvm/rme-exit.c @@ -116,6 +116,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->entry.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; @@ -177,6 +200,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