Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp6343844rwn; Tue, 13 Sep 2022 02:52:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR7slJ7xzyadD1fD+Gp/XBH9Nqbv4zZLK+PEdMoWplKRhoVK/Kyx5WBRErxUzmaeKIPXtV1z X-Received: by 2002:a05:6402:380c:b0:451:a3b1:66a2 with SMTP id es12-20020a056402380c00b00451a3b166a2mr8740139edb.387.1663062752841; Tue, 13 Sep 2022 02:52:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663062752; cv=none; d=google.com; s=arc-20160816; b=AymadV+YA3scOf7ByFK/Fk+TYrsgkoHUT68VzdHmsfFkDtRBaXLDFECR7EnD8ozcNa A6sH03ms5koLmfmnzkEtc9BRdMef/qcUO1VjNTUfyMSnyL/Zd61JnRTvGYrPazLhH3q3 iyEdsD1w5Sj6pwGCW/FnMMe/In6FbrzTB+th9fLJg059OenxyxkOIjaNRZknltc+H9z9 cSgQXTRIbvpjR3L5hSggu9A64DacQYMeJ/nQ9WiwFeDVaeb/jM3UfKhuGi6k1vSe9Woe s3J9x18yFwBumh77C/zHYFsd3urcM8P/PKk4jzR2xQXmKeMknRk7shyOp0bV6jEIf76Y pMpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=z1HCozkzwfIh/WZyb+NtoFOxgqJRCNjqWxITkulBgAA=; b=gTmObvqG8t3FzgOMBulBtJpnPsLNA6VQBLQPDL/I18pKKEIjMu9jjYltinnA1sRNbx COIcHakPVzBDqUSKO61Yc11tIH4xacZ3z58HTGxCXWRYip8mySk1SfBLnLHCPTlcMHwK HeDEVW2qa0ZOnv3BloIj0x65MdSc9RL80HXeRsDW6kbqNUJk1/0sOG9WQouiEU5Y0Z/b 7YeIG4taDotCL7GMz9BeIuyymeXGGH5m6y1TkQGc5J/pk99tZ8rmN0GajO34OedtrcDS 3PnmfYACrzoeuNHuVWJ6SPmCux4KInkyOQ+6+UouQmSg+a9HDe8sZsjDI/vbN+K9KG2f tTWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=pk7e10yb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go12-20020a1709070d8c00b0077c099a6413si7148369ejc.59.2022.09.13.02.52.07; Tue, 13 Sep 2022 02:52:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=pk7e10yb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231660AbiIMJpN (ORCPT + 99 others); Tue, 13 Sep 2022 05:45:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231778AbiIMJpG (ORCPT ); Tue, 13 Sep 2022 05:45:06 -0400 Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0776FD36; Tue, 13 Sep 2022 02:45:04 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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, -- 2.37.2.789.g6183377224-goog