Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2943563rdb; Tue, 6 Feb 2024 02:28:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IFNNw62N9GE02TOQw6CJWG0/J7eyw1efIf9Sj3rJZwx6sg2/zxSOc/j8HRnRW3HKhdr2KPX X-Received: by 2002:a81:4507:0:b0:603:de7f:1b95 with SMTP id s7-20020a814507000000b00603de7f1b95mr1386225ywa.7.1707215327128; Tue, 06 Feb 2024 02:28:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707215327; cv=pass; d=google.com; s=arc-20160816; b=hJK+E/xmJp27uAWVB/ZIkcjEU/bDITg3n+3ivEtGj2n1VUcaDuaKxER+Z8jRAqFdgK u7awV8f25S7vMCYEjGmYBGL21gLLJ4ZXyijHiCHWi/KAwOy0BIl8+s7owUIkbSmvnQJs pAw5p1AK0fEnPmJBKkBbpMjSpcazYjsMPt95+nMioye1a3L+2rRnbljd5fzZ6kri93/X cczcuBsL5431Lyl7TmTGCkAKKxcMCFuKgrZ8hjsFzeLdeOSRy7YzTnuqH4obDG7IPWWh TJW24LbP2Dy2zWFbZ3aqkSW7M0XxmHJPoeIkOEH3Gu2fOFQ/R6MOC6Bze2VWgShH+vcr f/mA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:dkim-signature:date; bh=UH4qnyV5AlPKuzyHE4nU37Hkz+CAr8GksiGngTSrZn0=; fh=D3D37tadsTuegBivaBlQxeJDW32Nxx86456k81ibsBE=; b=v+Effo55huU4rrTS5BRGnRMnp6RFkqtslVKhNLDg7lD1MicEU647SqJPMG8E3lsOIZ zd491k+TGiRehm2HJlNlFoZKLCx/vs8psrRYjjRVsamr41hIINzmWMMAlO0O5JrlxjUZ sUa0BMdpUftrWLIknNxp4/0No+J5zGWrF5WJhnmhR1BUBekehTCSlfFUUrMSKdnWxd7Q 3uvGuDlGLfYNRL5sXtu3wRnXUH7XDxLjvOfnTqaW5Bejqeqg5Ns930Q1Kt7CrGTKWJTs z7wxniXRkcvp2Z8I8grRuT96NfxoWqhT0ZeKUqkDu5xQWuFlHaWgEsadQ+lW4xoyUVi3 AFig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=sC+ynBUj; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-54687-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54687-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev X-Forwarded-Encrypted: i=1; AJvYcCWSq3Ex4bqyixqF6opqHA7ETgUobvIHV0eTo41rBjz7Ot1uLs10HF3Dtw+LoTv2P5IqSLWvidPdDDu+EHiEKuBqp1+BCGhbgdJTd1z3mQ== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id x13-20020a05622a000d00b0042ab5900084si2178498qtw.21.2024.02.06.02.28.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 02:28:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54687-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=sC+ynBUj; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-54687-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54687-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id DD7FA1C23849 for ; Tue, 6 Feb 2024 10:28:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B321E12E1F1; Tue, 6 Feb 2024 10:28:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="sC+ynBUj" Received: from out-181.mta1.migadu.com (out-181.mta1.migadu.com [95.215.58.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E672612E1D9 for ; Tue, 6 Feb 2024 10:28:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707215320; cv=none; b=orfFi99QxTrVX+9KLaupKWkawWaao084TnVy8q+S661O+4H9J7WagNSeS0Qn5SOKFwlcBISbrLyCHk1TClJQllQuJf6tnuwXQnQnQsRiRj+CfqlDme10tLH29+7Wop/o5OZUHzRH1qLfYcfGXDgRRsIuIVS2dN1vll8nk7hBi4Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707215320; c=relaxed/simple; bh=12ljC+gaSJ1gkfLRkLsG39AQOSWyWJvCPPJpVFot1CE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bk6g/61Lbw/39cKKwg6WUEEEzIdaA4qT6ZYINhkyVGNW92YAXXj6YWJFKuBoO7FM/imw5Qbn7OnCN/ZGoBgpmMAyt+MaKhHu6981FpssSbT/TXn3SGW0epaCWWBuIBxGVK27VtvydqSoMMk6HE8RS70z1Duru2Xa0oTGofoeIRs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=sC+ynBUj; arc=none smtp.client-ip=95.215.58.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240205184326.78814-1-sauravsc@amazon.com> X-Migadu-Flow: FLOW_OUT 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