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 B8327C4828D for ; Tue, 6 Feb 2024 10:28:52 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Omh2GVWUY2tKoFCbJPWscw6hu/T+0gHQ6xsjASCIcRQ=; b=UZJ2CDpSyvtfuM TkF5a+V9xnN2gyYNwjaahxHhGBNSE6HkfFWgBU/zfzw36Muuv+1gA1/fVhSpAU3DYiPPwqnVi16is RKExWTC08anR1Zz2ge65/fjG8A0p3SgpPZj+fWPK7YZx3GHa4653DODTKKUDwOybRb3Jq9HpOgqAG ew2y4VMKIFbEbF1mLXUJdy3S5ew8JtYvn09kxCIZu6JFpfLGK5wbitotzvb41sKeCDbJHY2RT1m4m WlzGZAPfuIcbBSVa++zsl8hOLZa1eAgFnCMoQycTjMuxbbsXE5nwFg9yfj+SXfjKabXPXqHylBNQt Y6r55My1EDqbICE3wpsg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXIh1-000000072Bk-2bzG; Tue, 06 Feb 2024 10:28:43 +0000 Received: from out-172.mta1.migadu.com ([2001:41d0:203:375::ac]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXIgy-0000000727I-2mYU for linux-arm-kernel@lists.infradead.org; Tue, 06 Feb 2024 10:28:42 +0000 Date: Tue, 6 Feb 2024 10:28:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1707215316; 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=UH4qnyV5AlPKuzyHE4nU37Hkz+CAr8GksiGngTSrZn0=; b=sC+ynBUjP2HdG1anTszZxl9OkpuQhhXiL+XqX9h1SsafTSnJQaWBtEA/1X4NVwjU4mAgrj FDC2SjZo1erNoQrKFmiJEVJKovL9V9OLMFyI4sZdaMLBSIoP7TkY+vG2k1d1PcvoMoaSu7 Ud1L6lkEXjRKG6SfDrs0QxCo8xf9xpE= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Saurav Sachidanand Cc: Marc Zyngier , James Morse , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] [RFC] KVM: arm64/vgic: Populate GICR_TYPER with Aff3 Message-ID: References: <20240205184326.78814-1-sauravsc@amazon.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240205184326.78814-1-sauravsc@amazon.com> X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240206_022840_882281_85F6E6E1 X-CRM114-Status: GOOD ( 10.35 ) 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 Hi Saurav, On Mon, Feb 05, 2024 at 06:43:26PM +0000, Saurav Sachidanand wrote: [...] > diff --git a/arch/arm64/kvm/vgic/vgic-mmio-v3.c b/arch/arm64/kvm/vgic/vgic-mmio-v3.c > index c15ee1df036a..26bc838ce14c 100644 > --- a/arch/arm64/kvm/vgic/vgic-mmio-v3.c > +++ b/arch/arm64/kvm/vgic/vgic-mmio-v3.c > @@ -324,6 +324,7 @@ static unsigned long vgic_mmio_read_v3r_typer(struct kvm_vcpu *vcpu, > u64 value; > > value = (u64)(mpidr & GENMASK(23, 0)) << 32; > + value |= (u64)((mpidr >> 32) & GENMASK(7, 0)) << 56; This looks suspiciously similar to what MPIDR_AFFINITY_LEVEL() accomplishes. I think we can tolerate a few extra lines of code to make the entire thing more self-documenting, like: value = ((u64)MPIDR_AFFINITY_LEVEL(mpidr, 3) << 56 | MPIDR_AFFINITY_LEVEL(mpidr, 2) << 48 | MPIDR_AFFINITY_LEVEL(mpidr, 1) << 40 | MPIDR_AFFINITY_LEVEL(mpidr, 0) << 32); -- Thanks, Oliver _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel