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 X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1DD2C433DF for ; Tue, 7 Jul 2020 13:06:06 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BFEB42075B for ; Tue, 7 Jul 2020 13:06:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="24bPOLIt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BFEB42075B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lU+qyg8svJ3vU4QBoP15aSdkaXTlsr/ccJsq8pBAUCY=; b=24bPOLItXbfmMkPAP4TY19BmE V4jeTnjgGp7T434Rzc11CP/8uiNZzyuvlS8ki//6+KnqIg6uj+qHIZdbRn9/ea28NkjMpQj9+eIod sMh4OvKYatesic6uhkGyMAMWxmHImbTba4Gtt4BI/CsOr5ZY1BUpvM66uqqVoYgnNxa7cmqsaLTuI nBzEvECLD2uw+yWXFtnXOZ/GbHwLottTxXSjy9yMq1C+IV0O7JJ6D1MhiM2ffCXnJddOGkzKN6lpY Fr9b9/AX7rRih7oIBtJU9ickmngTevAn7gvnNFZa0swdslLBFpN194ODABTyRVJhqlZZDbC2GEysO Z4tSJhZWw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jsnHA-0000Jg-VT; Tue, 07 Jul 2020 13:04:45 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jsnH7-0000IS-S4 for linux-arm-kernel@lists.infradead.org; Tue, 07 Jul 2020 13:04:42 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 079AAC0A; Tue, 7 Jul 2020 06:04:41 -0700 (PDT) Received: from [192.168.0.110] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D7D873F71E; Tue, 7 Jul 2020 06:04:38 -0700 (PDT) Subject: Re: [PATCH v3 09/17] KVM: arm64: pauth: Use ctxt_sys_reg() instead of raw sys_regs access To: Marc Zyngier , Catalin Marinas , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org References: <20200706125425.1671020-1-maz@kernel.org> <20200706125425.1671020-10-maz@kernel.org> From: Alexandru Elisei Message-ID: <9689172f-a6c2-dd5b-6b0d-bbc1700cdb31@arm.com> Date: Tue, 7 Jul 2020 14:05:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200706125425.1671020-10-maz@kernel.org> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200707_090442_041083_9BFA4B94 X-CRM114-Status: GOOD ( 16.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , kernel-team@android.com, Suzuki K Poulose , Andre Przywara , Christoffer Dall , Dave Martin , George Cherian , James Morse , Andrew Scull , "Zengtao \(B\)" , Will Deacon , Jintack Lim , Julien Thierry 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 Hi, On 7/6/20 1:54 PM, Marc Zyngier wrote: > Now that we have a wrapper for the sysreg accesses, let's use that > consistently. > > Signed-off-by: Marc Zyngier > --- > arch/arm64/kvm/hyp/include/hyp/switch.h | 23 +++++++++++++---------- > 1 file changed, 13 insertions(+), 10 deletions(-) > > diff --git a/arch/arm64/kvm/hyp/include/hyp/switch.h b/arch/arm64/kvm/hyp/include/hyp/switch.h > index 7cf14e4f9f77..70367699d69a 100644 > --- a/arch/arm64/kvm/hyp/include/hyp/switch.h > +++ b/arch/arm64/kvm/hyp/include/hyp/switch.h > @@ -364,11 +364,14 @@ static inline bool esr_is_ptrauth_trap(u32 esr) > return false; > } > > -#define __ptrauth_save_key(regs, key) \ > -({ \ > - regs[key ## KEYLO_EL1] = read_sysreg_s(SYS_ ## key ## KEYLO_EL1); \ > - regs[key ## KEYHI_EL1] = read_sysreg_s(SYS_ ## key ## KEYHI_EL1); \ > -}) > +#define __ptrauth_save_key(ctxt, key) \ > + do { \ Nitpick: the indentation for the do instruction doesn't match the indentation for while(0). > + u64 __val; \ > + __val = read_sysreg_s(SYS_ ## key ## KEYLO_EL1); \ > + ctxt_sys_reg(ctxt, key ## KEYLO_EL1) = __val; \ > + __val = read_sysreg_s(SYS_ ## key ## KEYHI_EL1); \ > + ctxt_sys_reg(ctxt, key ## KEYHI_EL1) = __val; \ > +} while(0) > > static inline bool __hyp_handle_ptrauth(struct kvm_vcpu *vcpu) > { > @@ -380,11 +383,11 @@ static inline bool __hyp_handle_ptrauth(struct kvm_vcpu *vcpu) > return false; > > ctxt = &__hyp_this_cpu_ptr(kvm_host_data)->host_ctxt; > - __ptrauth_save_key(ctxt->sys_regs, APIA); > - __ptrauth_save_key(ctxt->sys_regs, APIB); > - __ptrauth_save_key(ctxt->sys_regs, APDA); > - __ptrauth_save_key(ctxt->sys_regs, APDB); > - __ptrauth_save_key(ctxt->sys_regs, APGA); > + __ptrauth_save_key(ctxt, APIA); > + __ptrauth_save_key(ctxt, APIB); > + __ptrauth_save_key(ctxt, APDA); > + __ptrauth_save_key(ctxt, APDB); > + __ptrauth_save_key(ctxt, APGA); > > vcpu_ptrauth_enable(vcpu); > Looks good to me. I also grep'ed for sys_regs at the top level of the sources and I didn't find any instances that we could replace with the accessors: Reviewed-by: Alexandru Elisei Thanks, Alex _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel