From patchwork Mon Apr 25 23:53:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Upton X-Patchwork-Id: 12826356 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 73AC9C433F5 for ; Mon, 25 Apr 2022 23:55:24 +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:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=DUYoxYNvZzhmka9qUmKdm7B1RCBhulzeRS/XoYhPCgc=; b=wpSkdZrOWp/7WXKMoTSoHa+NI5 yqaoc51vSSa9ga5fAhqzA0nRrZHIwf2Uaq7SZ2kXhOjva42J6CTxuKiHD+lElABNPKLOreaOGYRFp lGIX0vhboOVA4sJsgKVDDfqeqShwm09JNav+J2Mi9BlGqn54up/qIriE8lJ0L+PP5CTKYIipnoaSM M6cBaQNIealBagV8TfKmmpkz9BaCeaIjzH9faazAnYnSaToe0ZhS5t1/O5ubXdcK9Od6TQhQOkJy2 5JpAajQxwqytHS1iqhK9fbz7MaPxEZL39ziutHn4ygxGxCJsTLX0h4cmgw6EZhaY1fYATifWrGHB9 zRMkZ9CA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nj8Wn-00Bkvt-B3; Mon, 25 Apr 2022 23:54:01 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nj8Wa-00Bkpb-IU for linux-arm-kernel@lists.infradead.org; Mon, 25 Apr 2022 23:53:49 +0000 Received: by mail-yb1-xb49.google.com with SMTP id o64-20020a257343000000b006483069a28aso6091063ybc.3 for ; Mon, 25 Apr 2022 16:53:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=7I/ymirdAiT7TDA2OEpHDGEYZgcTkJFO31W7cy5XbpM=; b=GIEXDRW1lPHYxJDlewu1cQeA6Q+QhOYQG/Xg8+PRoE5TU9K+EszCSi+GS/y1yYdqKQ k/hrOFfkpq5XjEnBTx1gg0IKP9CD+wqs+KYV8IBKykKdf6qgUHxeHd55YceasrVFn9mw o9HKcPVnYwI3o4aMI2OPjArD2rckzGSvUFmrO9xNvkgk8klD1nMq/kohI2CdazTjq5Jf Ak0UhNEI4w4AqZKNdd5wNvgAXTUDy724YE2e5d8zmzpUkKbcZxng8IF+DponlhaL7c8x LL6EDVRikFw7s5dE77bM9YkXLHYb5Nfbwh93Bes5BL+1D2/4yHIP4wXj4e8Sme3DIay7 twfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=7I/ymirdAiT7TDA2OEpHDGEYZgcTkJFO31W7cy5XbpM=; b=xz7nBPtT6fxUhifF0uFaACO7p7+o9/5Bnn30y9EyPoludUiXfV/Lq1IjUEy7BGCueR G8+uph40PxZ8dA6KsyOAHaVoPgte+O0aleCPsgEEh9+DXw5fj1Pspm4gFAoY6bP7mxcc tZTVTNZbG904ORWFNuBYxZ1BhtPnhV/oVKR9ssNb7GahksCy+AgPasBKE8xjDdgoBscq xbEYeRdEU2LgENsGFgpBgFcxJBOCPQZO4U8AK3tfxMCItxWd+IJsbbdlFz7URQCcbluk +HC61kHdqi/IGOx4D8M1EDS/+SdTjdKEoD3mPAqGSeFz47vogFdtDWu4TC2+f9aCtTX2 Uc+A== X-Gm-Message-State: AOAM532lhLDLrl0Kb3NBfBKrZIU3ZAjNdLqQwcJRSrA7mbHVYwXR/s7G c+NtnMaACryvhe+RO4V8Px6jTJV+WnU= X-Google-Smtp-Source: ABdhPJyjGc04tDLhhnCLskCP5jrH+A6ez9JfIN9/o5bxHFb6wiRVScPynPJ1gA3GO95ctuwxRLPE7a7ohO0= X-Received: from oupton3.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:21eb]) (user=oupton job=sendgmr) by 2002:a25:240c:0:b0:645:d54e:830f with SMTP id k12-20020a25240c000000b00645d54e830fmr16918344ybk.34.1650930826367; Mon, 25 Apr 2022 16:53:46 -0700 (PDT) Date: Mon, 25 Apr 2022 23:53:38 +0000 In-Reply-To: <20220425235342.3210912-1-oupton@google.com> Message-Id: <20220425235342.3210912-2-oupton@google.com> Mime-Version: 1.0 References: <20220425235342.3210912-1-oupton@google.com> X-Mailer: git-send-email 2.36.0.rc2.479.g8af0fa9b8e-goog Subject: [PATCH v3 1/5] KVM: arm64: Return a bool from emulate_cp() From: Oliver Upton To: kvmarm@lists.cs.columbia.edu Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, maz@kernel.org, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, reijiw@google.com, ricarkol@google.com, Oliver Upton X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220425_165348_645522_F94248EF X-CRM114-Status: GOOD ( 15.73 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org KVM indicates success/failure in several ways, but generally an integer is used when conditionally bouncing to userspace is involved. That is not the case from emulate_cp(); just use a bool instead. No functional change intended. Signed-off-by: Oliver Upton --- arch/arm64/kvm/sys_regs.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index 7b45c040cc27..36895c163eae 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -2246,27 +2246,27 @@ static void perform_access(struct kvm_vcpu *vcpu, * @table: array of trap descriptors * @num: size of the trap descriptor array * - * Return 0 if the access has been handled, and -1 if not. + * Return true if the access has been handled, false if not. */ -static int emulate_cp(struct kvm_vcpu *vcpu, - struct sys_reg_params *params, - const struct sys_reg_desc *table, - size_t num) +static bool emulate_cp(struct kvm_vcpu *vcpu, + struct sys_reg_params *params, + const struct sys_reg_desc *table, + size_t num) { const struct sys_reg_desc *r; if (!table) - return -1; /* Not handled */ + return false; /* Not handled */ r = find_reg(params, table, num); if (r) { perform_access(vcpu, params, r); - return 0; + return true; } /* Not handled */ - return -1; + return false; } static void unhandled_cp_access(struct kvm_vcpu *vcpu, @@ -2330,7 +2330,7 @@ static int kvm_handle_cp_64(struct kvm_vcpu *vcpu, * potential register operation in the case of a read and return * with success. */ - if (!emulate_cp(vcpu, ¶ms, global, nr_global)) { + if (emulate_cp(vcpu, ¶ms, global, nr_global)) { /* Split up the value between registers for the read side */ if (!params.is_write) { vcpu_set_reg(vcpu, Rt, lower_32_bits(params.regval)); @@ -2365,7 +2365,7 @@ static int kvm_handle_cp_32(struct kvm_vcpu *vcpu, params.Op1 = (esr >> 14) & 0x7; params.Op2 = (esr >> 17) & 0x7; - if (!emulate_cp(vcpu, ¶ms, global, nr_global)) { + if (emulate_cp(vcpu, ¶ms, global, nr_global)) { if (!params.is_write) vcpu_set_reg(vcpu, Rt, params.regval); return 1;