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 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 CED34C77B7F for ; Tue, 16 May 2023 10:28:50 +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:Message-ID:Date:References :In-Reply-To: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=m2E2lDjnco2jcTn6n/1kA1xsxmRUPLfPG36iaKHnulg=; b=q3StbDXhhc4HOv x/sLFVSaFF1qZGixIascWB2t5bprTcDm8EcUhTMkny5wHkrYQUEThq8IAsBCWX5INTTMiFEIczJWm jFBRyE0pB6knGuBjwJpnYkiu+7J9/a7oS799OmiQkGc8znTJjwDoxH86NcsQdUmvbHJzyDw7qMmlT BEXDrtrOcgmufzVh9XOV7lIYM3o6fPfzbb2KW5jd8KCWAzDk9AdDQ31yWZQTOYFugrRAaLD4CLRC8 fFVljZfcEFT81+UVaxJ3XWos9A62Gxoy3vzL2Qatq/EG1yKiNGTD8XVl8iaNcR7dfhPp0mMTcHxRp tJEKZnbFXPzSmJNJikjw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pyruq-005GU6-0f; Tue, 16 May 2023 10:28:24 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pyrun-005GSV-1S for linux-arm-kernel@lists.infradead.org; Tue, 16 May 2023 10:28:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684232898; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=A8RPDB5oCUZPol53GuFRKa1PDnfifaD9ISAfpPJWqOU=; b=crx+5JjPkIjChjUneiGRHEItYAZZxa+OgNYHXRCBX6qCjPF/EyaRUJUtgB9ji9bWVjMyFG 4EapiA3VDVcuJxUoL++TwzGTkAnx3JKK/SZdM2mkEZoIISb+g5gt0C/u8f1SvVH/ZRigjw aUXkBUemf1GjrbhPGXizzfivAjTiPZE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-108-M7Zkyq0vMxez3ve1Zok7Lw-1; Tue, 16 May 2023 06:26:13 -0400 X-MC-Unique: M7Zkyq0vMxez3ve1Zok7Lw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B31E785A5B1; Tue, 16 May 2023 10:26:12 +0000 (UTC) Received: from localhost (dhcp-192-239.str.redhat.com [10.33.192.239]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 70AA740C206F; Tue, 16 May 2023 10:26:12 +0000 (UTC) From: Cornelia Huck To: Jing Zhang , KVM , KVMARM , ARMLinux , Marc Zyngier , Oliver Upton Cc: Will Deacon , Paolo Bonzini , James Morse , Alexandru Elisei , Suzuki K Poulose , Fuad Tabba , Reiji Watanabe , Raghavendra Rao Ananta , Jing Zhang Subject: Re: [PATCH v8 5/6] KVM: arm64: Reuse fields of sys_reg_desc for idreg In-Reply-To: <20230503171618.2020461-6-jingzhangos@google.com> Organization: Red Hat GmbH References: <20230503171618.2020461-1-jingzhangos@google.com> <20230503171618.2020461-6-jingzhangos@google.com> User-Agent: Notmuch/0.37 (https://notmuchmail.org) Date: Tue, 16 May 2023 12:26:11 +0200 Message-ID: <87ilcsh8sc.fsf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230516_032821_678893_EBB5D109 X-CRM114-Status: GOOD ( 18.42 ) 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: , 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 On Wed, May 03 2023, Jing Zhang wrote: > Since reset() and val are not used for idreg in sys_reg_desc, they would > be used with other purposes for idregs. > The callback reset() would be used to return KVM sanitised id register > values. The u64 val would be used as mask for writable fields in idregs. > Only bits with 1 in val are writable from userspace. > > Signed-off-by: Jing Zhang > --- > arch/arm64/kvm/id_regs.c | 44 +++++++++++++++++++---------- > arch/arm64/kvm/sys_regs.c | 59 +++++++++++++++++++++++++++------------ > arch/arm64/kvm/sys_regs.h | 10 ++++--- > 3 files changed, 77 insertions(+), 36 deletions(-) > (...) > diff --git a/arch/arm64/kvm/sys_regs.h b/arch/arm64/kvm/sys_regs.h > index e88fd77309b2..21869319f6e1 100644 > --- a/arch/arm64/kvm/sys_regs.h > +++ b/arch/arm64/kvm/sys_regs.h > @@ -65,12 +65,12 @@ struct sys_reg_desc { > const struct sys_reg_desc *); > > /* Initialization for vcpu. */ Maybe be a bit more verbose here? /* Initialization for vcpu. Return initialized value, or KVM sanitized value for id registers. */ > - void (*reset)(struct kvm_vcpu *, const struct sys_reg_desc *); > + u64 (*reset)(struct kvm_vcpu *, const struct sys_reg_desc *); > > /* Index into sys_reg[], or 0 if we don't need to save it. */ > int reg; > > - /* Value (usually reset value) */ > + /* Value (usually reset value), or write mask for idregs */ > u64 val; > > /* Custom get/set_user functions, fallback to generic if NULL */ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel