Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp2131008rwe; Fri, 2 Sep 2022 08:58:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR4xC3RHDFDSdVnZUAuXohZQAyoO2fgKNm1yQmTCL6cR4gN8AYmgzsU498p7XwKX5PhNHepR X-Received: by 2002:a17:907:7b94:b0:731:1b11:c241 with SMTP id ne20-20020a1709077b9400b007311b11c241mr28694459ejc.676.1662134321795; Fri, 02 Sep 2022 08:58:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662134321; cv=none; d=google.com; s=arc-20160816; b=HfrLQLx5lqt9gB4ZLo2iM0dgOJb+u0MkvbOYxo/Xv5SlknmPgessxY/1s5BaJmgSSx r0V6pHL/w6PnpSk0o8eTwHXc+Cc4JqO0YS7ME8AcqcvDfdlzIIFHhf5PwDYdNxJGDY+7 sA98ytMHUojjwq9wYCgjhRzXKED0wWPtAI4IR7ptTTWP9W9IcF+bZROo5d1DjKupyzJ8 KPEJTABIJuLCNEbhAkFASMNOVPG9FZLWf18X7JeBstklBhyXwgvQibddX1FXP0byo96u VvmJX3somoFl3HBIuJMTHyCu0unG70mWcafIJd9yLmybu6z1fZxPD4yPlZkOLTA6mm8d CHmw== 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=pnY14+gybgMuEw1qHqoL4ZC8t5Po6zL9YNHI6tqJH54=; b=CL0gffH/xpiWVvNle9CITUNzC1AizEXqXBJGMwMeoyxFlOhrSIaC5Ecxcx9NS1noHW ArN0Wy7tSom6Ltl+m66ImAJl3OG8Ml1cB4oTQT/lR4/1XQm5vKDCrwKSlZcbetD/9v99 1j8CcwRbmtOhZBOUFZtO3x25kg3cMhBixk/2hxc7jB8RvFC4N5OuBkcglX8RF518898n IV0aOLeKoE+lWXrdmZ3X3M0JklH/bHkWwtQE+9NvALTzVxhG8S6O/Pb6DQVScwpdHgfY yXQL5CqWMDcxVTyOdKvbpmQJJvT3WPvNCFC0X96EI6hjvik/6smia30rloKHAw+mO7rr MeDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=W9EdQ5D1; 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 y4-20020a056402440400b004487c209b02si795465eda.188.2022.09.02.08.58.15; Fri, 02 Sep 2022 08:58:41 -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=W9EdQ5D1; 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 S237303AbiIBPyd (ORCPT + 99 others); Fri, 2 Sep 2022 11:54:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236588AbiIBPxz (ORCPT ); Fri, 2 Sep 2022 11:53:55 -0400 Received: from out0.migadu.com (out0.migadu.com [IPv6:2001:41d0:2:267::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2C01AE86C; Fri, 2 Sep 2022 08:48:24 -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=1662133703; 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=pnY14+gybgMuEw1qHqoL4ZC8t5Po6zL9YNHI6tqJH54=; b=W9EdQ5D1J6NVuNtMam4JvSYUygffx8OYBS8/EXTlwdNB4jWq78HqBApa99QogMhwmgTvFy wmZxyuf/yG39jSkQeOaoaFrq++lJ95Ayn3ZB1twyyeaYjhuCsPDf2VT+lWaJAvLLRaFLym aZm8gnZXQhKLIzTp8Br2DLt0P+uQayQ= 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 , linux-kernel@vger.kernel.org Subject: [PATCH v2 3/7] KVM: arm64: Drop raz parameter from read_id_reg() Date: Fri, 2 Sep 2022 15:47:59 +0000 Message-Id: <20220902154804.1939819-4-oliver.upton@linux.dev> In-Reply-To: <20220902154804.1939819-1-oliver.upton@linux.dev> References: <20220902154804.1939819-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 There is no longer a need for caller-specified RAZ visibility. Hoist the call to sysreg_visible_as_raz() into read_id_reg() and drop the parameter. No functional change intended. Suggested-by: Reiji Watanabe Signed-off-by: Oliver Upton --- arch/arm64/kvm/sys_regs.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index 26210f3a0b27..0e20a311ea20 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -1063,13 +1063,12 @@ static bool access_arch_timer(struct kvm_vcpu *vcpu, } /* Read a sanitised cpufeature ID register by sys_reg_desc */ -static u64 read_id_reg(const struct kvm_vcpu *vcpu, - struct sys_reg_desc const *r, bool raz) +static u64 read_id_reg(const struct kvm_vcpu *vcpu, struct sys_reg_desc const *r) { u32 id = reg_to_encoding(r); u64 val; - if (raz) + if (sysreg_visible_as_raz(vcpu, r)) return 0; val = read_sanitised_ftr_reg(id); @@ -1157,12 +1156,10 @@ static bool access_id_reg(struct kvm_vcpu *vcpu, struct sys_reg_params *p, const struct sys_reg_desc *r) { - bool raz = sysreg_visible_as_raz(vcpu, r); - if (p->is_write) return write_to_read_only(vcpu, p, r); - p->regval = read_id_reg(vcpu, r, raz); + p->regval = read_id_reg(vcpu, r); return true; } @@ -1199,7 +1196,7 @@ static int set_id_aa64pfr0_el1(struct kvm_vcpu *vcpu, return -EINVAL; /* We can only differ with CSV[23], and anything else is an error */ - val ^= read_id_reg(vcpu, rd, false); + val ^= read_id_reg(vcpu, rd); val &= ~((0xFUL << ID_AA64PFR0_CSV2_SHIFT) | (0xFUL << ID_AA64PFR0_CSV3_SHIFT)); if (val) @@ -1221,19 +1218,15 @@ static int set_id_aa64pfr0_el1(struct kvm_vcpu *vcpu, static int get_id_reg(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, u64 *val) { - bool raz = sysreg_visible_as_raz(vcpu, rd); - - *val = read_id_reg(vcpu, rd, raz); + *val = read_id_reg(vcpu, rd); return 0; } static int set_id_reg(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, u64 val) { - bool raz = sysreg_visible_as_raz(vcpu, rd); - /* This is what we mean by invariant: you can't change it. */ - if (val != read_id_reg(vcpu, rd, raz)) + if (val != read_id_reg(vcpu, rd)) return -EINVAL; return 0; -- 2.37.2.789.g6183377224-goog