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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 85DFBC433F5 for ; Tue, 30 Nov 2021 00:58:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EZqLX7GiaI2ED7QFU92MgMagxDwzr/xUcmsMR/cVxlE=; b=QuX0zrN6L9al29 j8PdzS8IReejspmb+DP7PbNM3tDQnxnV5dtcM0A8Lubb9Zvi12flNCsiLcrWS/OLaqu441KbyvT9I pZisfLHIcdkvubCHMWtVp+hbH5cBruZXnW7MEhIXeqqXcX/6EDgZ7yGOyK6DShzODilOkbNNMHRSz e6gok1uSDhGiVWAApEtu/Mr6P4ZkU94xf8v3d21kX5N7rD5IxPdCv5QifHhzRUqB4QZa+b247FGGp 77H+LUxHOj78MFs0T2bxlNw4LHFddDAYaGGkzhpUIEQhKhAAA06ENw58tbPcfWMw0cIX6ie+588vK 0wnmvHPwGo+zjhQFh0Pg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mrrSR-003E4j-7s; Tue, 30 Nov 2021 00:57:19 +0000 Received: from mail-yb1-xb34.google.com ([2607:f8b0:4864:20::b34]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mrrSN-003E3e-DM for linux-arm-kernel@lists.infradead.org; Tue, 30 Nov 2021 00:57:16 +0000 Received: by mail-yb1-xb34.google.com with SMTP id v203so47522819ybe.6 for ; Mon, 29 Nov 2021 16:57:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=esRLWzH6dw+Ce7phJ2ONogztplO8dpDdVUer7uLYFyE=; b=U5aJzHs/FlOo0fNLHNpFTCG7aV5AVGzHjOwJv+ZRQZ2UYblO/Xoq68Mh+LgMAMEAwG gwa4zJ90Q4Vp3p//JZbIjVpEVxN22f3h+4+7sxeGO3sWwSmqmkrdz9jnHCSb8YiN2upS D5/Ndr10UjtHbiuh4FI5cWeoCkqsB0aTL44awIBISsM9N3zTXpwRLBVNjjFjIWCBIAR2 CqaFqQtCrMACvIkUHE15giu+ir9UH3UZ8bOr0YqtuXy0pXWMKyxt97pf5dNW50HQAd3P Xq4aMkwtelVEamSaY/KLEzVzDqoYGw++6mQuJua5WoTXkJxRUXI/ALyHcOXeHdQOkQOB T1FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=esRLWzH6dw+Ce7phJ2ONogztplO8dpDdVUer7uLYFyE=; b=hHiNn5dV2TK9lUlzsmRJjZLD15kk1sLGLtmcOaotq/c+WsSuRUjFZ2rSLNMNmMrclw 3v2YphXgTp5Piu9ifg4BXGxPm0EMrYMTB/COMtnX5v8kU8V4E0By4t5oRfH3M5dDA236 cjJFZx6oeTfacDme5OrqDQplcMmDveRWdCR4Ca6BgkkaYttZLS2Gvv8G8GU6ra43f37c p214AGyyI+XY0oBryluyaNo3KI6FKSKF1f4xCyVzU5Oq3yDC2LqmLfvBBaEI5NX1ebwV Uo31dOKtPU4CmDDyWLdj6CuYxukf4QkXImRULTEwe+2ueyOMhsJpIO23fxrgY60oK3Uj 18ww== X-Gm-Message-State: AOAM532ALV50vZXk8W0wx2o8svIAErmk6yJb1rEQef3AddZcFpLUWKYe Jp8y9+kDRKAeX/hZOcAr3ZZ1T84JlHY7+wuQIIL51Q== X-Google-Smtp-Source: ABdhPJxBtrnBwZDK0SfMN9ZP26BpdgE0OykhJRvFEkCn6qO1fburjBb59wkMhZpu1UbE5WIus+YADqwKUV0GYHNYlNY= X-Received: by 2002:a25:d003:: with SMTP id h3mr33831953ybg.184.1638233834133; Mon, 29 Nov 2021 16:57:14 -0800 (PST) MIME-Version: 1.0 References: <20211113012234.1443009-1-rananta@google.com> <20211113012234.1443009-2-rananta@google.com> <20211127131628.iihianybqbeyjdbg@gator.home> In-Reply-To: <20211127131628.iihianybqbeyjdbg@gator.home> From: Raghavendra Rao Ananta Date: Mon, 29 Nov 2021 16:57:03 -0800 Message-ID: Subject: Re: [RFC PATCH v2 01/11] KVM: arm64: Factor out firmware register handling from psci.c To: Andrew Jones Cc: Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , Paolo Bonzini , Catalin Marinas , Will Deacon , Peter Shier , Ricardo Koller , Oliver Upton , Reiji Watanabe , Jing Zhang , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, kvm@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211129_165715_474754_4AB5C2E2 X-CRM114-Status: GOOD ( 27.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 On Sat, Nov 27, 2021 at 5:16 AM Andrew Jones wrote: > > On Sat, Nov 13, 2021 at 01:22:24AM +0000, Raghavendra Rao Ananta wrote: > > Common hypercall firmware register handing is currently employed > > by psci.c. Since the upcoming patches add more of these registers, > > it's better to move the generic handling to hypercall.c for a > > cleaner presentation. > > > > While we are at it, collect all the firmware registers under > > fw_reg_ids[] to help implement kvm_arm_get_fw_num_regs() and > > kvm_arm_copy_fw_reg_indices() in a generic way. > > > > No functional change intended. > > > > Signed-off-by: Raghavendra Rao Ananta > > --- > > arch/arm64/kvm/guest.c | 2 +- > > arch/arm64/kvm/hypercalls.c | 170 +++++++++++++++++++++++++++++++++++ > > arch/arm64/kvm/psci.c | 166 ---------------------------------- > > include/kvm/arm_hypercalls.h | 7 ++ > > include/kvm/arm_psci.h | 7 -- > > 5 files changed, 178 insertions(+), 174 deletions(-) > > > > diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c > > index 5ce26bedf23c..625f97f7b304 100644 > > --- a/arch/arm64/kvm/guest.c > > +++ b/arch/arm64/kvm/guest.c > > @@ -18,7 +18,7 @@ > > #include > > #include > > #include > > -#include > > +#include > > #include > > #include > > #include > > diff --git a/arch/arm64/kvm/hypercalls.c b/arch/arm64/kvm/hypercalls.c > > index 30da78f72b3b..9e136d91b470 100644 > > --- a/arch/arm64/kvm/hypercalls.c > > +++ b/arch/arm64/kvm/hypercalls.c > > @@ -146,3 +146,173 @@ int kvm_hvc_call_handler(struct kvm_vcpu *vcpu) > > smccc_set_retval(vcpu, val[0], val[1], val[2], val[3]); > > return 1; > > } > > + > > +static const u64 fw_reg_ids[] = { > > + KVM_REG_ARM_PSCI_VERSION, > > + KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1, > > + KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2, > > +}; > > + > > +int kvm_arm_get_fw_num_regs(struct kvm_vcpu *vcpu) > > +{ > > + return ARRAY_SIZE(fw_reg_ids); > > +} > > + > > +int kvm_arm_copy_fw_reg_indices(struct kvm_vcpu *vcpu, u64 __user *uindices) > > +{ > > + int i; > > + > > + for (i = 0; i < ARRAY_SIZE(fw_reg_ids); i++) { > > + if (put_user(fw_reg_ids[i], uindices)) > > This is missing the ++ on uindices, so it just writes the same offset > three times. > Thanks for catching this! I believe I realized this later and corrected it in patch-04/11 of the series and missed it here. I'll fix it here as well. > > + return -EFAULT; > > + } > > + > > + return 0; > > +} > > I assume the rest of the patch is just a cut+paste move of code. > That's right. Regards, Raghavendra > Thanks, > drew > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel