From patchwork Tue Sep 13 09:44:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Upton X-Patchwork-Id: 12974647 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 1A58BC54EE9 for ; Tue, 13 Sep 2022 09:48:36 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ttg+rAGdZawjkC78AlcC9gvy9uzryKUC0sCT8zeQNWU=; b=oDh/Sv5KhN8WSl UQxzmDA4zl24No9YfChVP7PMLXxJPdyX4cKiuOldC+3qDN6YLpErwbWcnjTpi1cqgyzGtg5wqJd1u SnanA8OYZBfDBUs6nfIBt88dOuEFG1k5ElnqEE8xky1DljVdoJRmLuaapyQAL43+2hRGqJFhZH1L3 j6e3WpmEMFmf5rD+/cihisknAW8ZkbOSwd8NS8E4hnnHq2IYl6JtyV6k7Qi2+M+9Ae+DQZp55GFZQ HGpuppkoa/EkwYrDNdlROFk3RpihOQOzVfYXeFnqCvxJsBhAQBWGXB7HoVq7weZengQvEM5Zjoqjc JrvUZ5kdbIzkNlGb/qUw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oY2Vt-005Z08-GF; Tue, 13 Sep 2022 09:47:29 +0000 Received: from out0.migadu.com ([94.23.1.103]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oY2TY-005RCQ-Qw for linux-arm-kernel@lists.infradead.org; Tue, 13 Sep 2022 09:45:06 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1663062303; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z1HCozkzwfIh/WZyb+NtoFOxgqJRCNjqWxITkulBgAA=; b=pk7e10ybcoZrRzQTGxR3QDGPtHgnvSHBeBRinW5NVM/ySvbnetK1XSxL9PjQQBkmNm9Lg6 BdtL3hUprSN3mgtYaGp5HlnrmTPrN96sgeIk4xMCCGZw8OgsRIBb59V/QD6An71MyJfb3e CgGNo4E2AaqzCmc8KwjGZGDkogbnYHY= From: Oliver Upton To: Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , Oliver Upton , Catalin Marinas , Will Deacon Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Reiji Watanabe , Andrew Jones , linux-kernel@vger.kernel.org Subject: [PATCH v3 4/7] KVM: arm64: Spin off helper for calling visibility hook Date: Tue, 13 Sep 2022 09:44:37 +0000 Message-Id: <20220913094441.3957645-5-oliver.upton@linux.dev> In-Reply-To: <20220913094441.3957645-1-oliver.upton@linux.dev> References: <20220913094441.3957645-1-oliver.upton@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220913_024505_050092_F8F2E745 X-CRM114-Status: UNSURE ( 9.53 ) X-CRM114-Notice: Please train this message. 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 No functional change intended. Reviewed-by: Reiji Watanabe Signed-off-by: Oliver Upton --- arch/arm64/kvm/sys_regs.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/arch/arm64/kvm/sys_regs.h b/arch/arm64/kvm/sys_regs.h index a8c4cc32eb9a..e78b51059622 100644 --- a/arch/arm64/kvm/sys_regs.h +++ b/arch/arm64/kvm/sys_regs.h @@ -136,22 +136,25 @@ static inline void reset_val(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r __vcpu_sys_reg(vcpu, r->reg) = r->val; } -static inline bool sysreg_hidden(const struct kvm_vcpu *vcpu, - const struct sys_reg_desc *r) +static inline unsigned int sysreg_visibility(const struct kvm_vcpu *vcpu, + const struct sys_reg_desc *r) { if (likely(!r->visibility)) - return false; + return 0; - return r->visibility(vcpu, r) & REG_HIDDEN; + return r->visibility(vcpu, r); +} + +static inline bool sysreg_hidden(const struct kvm_vcpu *vcpu, + const struct sys_reg_desc *r) +{ + return sysreg_visibility(vcpu, r) & REG_HIDDEN; } static inline bool sysreg_visible_as_raz(const struct kvm_vcpu *vcpu, const struct sys_reg_desc *r) { - if (likely(!r->visibility)) - return false; - - return r->visibility(vcpu, r) & REG_RAZ; + return sysreg_visibility(vcpu, r) & REG_RAZ; } static inline int cmp_sys_reg(const struct sys_reg_desc *i1,