[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH v1 04/12] Arm: GICv3: Emulate GICR_TYPER on AArch32


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Ayan Kumar Halder <ayankuma@xxxxxxx>
  • Date: Fri, 21 Oct 2022 16:31:20 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=d3z1fYyjNNFULchMYPGXqvwacdX9nW9qmaUMKuj/M3A=; b=MXflJ8A/mAsFIuDw3RbocJkvWeyj3ljYnRh7dEPcEtVjGN/iuwbH8UYhXamWaPIJUvsINmdx+KIKhhArJTJ9BUFT/77zT8u44UpTYA4V8FLFMiXsQ45v34TiD/KM13PzTNHVJRxcE6U06QrRojLca8Pyv8hcZmyHByXOrYw5wPXL+SJwQrCsG+xPNtDoJxyWB9YQNZyQ0VL1vBPPMeae3dxgseX5JHlmL+CKyxYo9LJxMpC2JGgeNCsMiVg6zOQv9UmjpPrHeNQ1SgOXekl6p/JdcHdp6T/RQCuRaOYrEe4vTpgl41t4M+yV3gOCOa3AzISDfDrAmzYZxJyuUhGTzA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GcHTjNjvS1jAWXNebH74PccSqFd7KGuR4XsHHqC949oyBqFmesrNeZiUILyKL0H+kJh10wu1bzOeboChKVqjLSoOqBUBrwDei9e0L6HvLDDTocAkfOOKsNRCvnh8ie/zP6nlH9ORtshnrSiLJgjVLgZiIteTgr50QZEQLDhX1dgapMEIoOPyKPlJ3QxogM7kmxNSGXsBSGK6pMbi+qrdrdMH52PRi7DMzSBJqJhOLA20s/ZzHBC9EhwU65R5YZ1/1HAnX/TgTJapTWYFU6OsyL7HGhz58ZnJ7DCxQlYemStOktCRq/MVzxc+7/8yI2vEZfJB4v3hG0S5Ht8uUsc5rA==
  • Cc: <sstabellini@xxxxxxxxxx>, <stefanos@xxxxxxxxxx>, <julien@xxxxxxx>, <Volodymyr_Babchuk@xxxxxxxx>, <bertrand.marquis@xxxxxxx>, Ayan Kumar Halder <ayankuma@xxxxxxx>
  • Delivery-date: Fri, 21 Oct 2022 15:32:15 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Refer Arm IHI 0069H ID020922,
The upper 32 bits of GICR_TYPER represent the affinity
whereas the lower 32 bits represent the other bits (eg processor
number, etc).
MPIDR_AFFINITY_LEVEL() returns a 32 bit number on aarch32. Thus, this
is appended to return GICR_TYPER register.

Signed-off-by: Ayan Kumar Halder <ayankuma@xxxxxxx>
---
 xen/arch/arm/vgic-v3.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index c31140eb20..d86b41a39f 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -190,14 +190,18 @@ static int __vgic_v3_rdistr_rd_mmio_read(struct vcpu *v, 
mmio_info_t *info,
 
     case VREG64(GICR_TYPER):
     {
-        uint64_t typer, aff;
+        uint64_t typer;
+        uint32_t aff;
 
         if ( !vgic_reg64_check_access(dabt) ) goto bad_width;
-        aff = (MPIDR_AFFINITY_LEVEL(v->arch.vmpidr, 3) << 56 |
-               MPIDR_AFFINITY_LEVEL(v->arch.vmpidr, 2) << 48 |
-               MPIDR_AFFINITY_LEVEL(v->arch.vmpidr, 1) << 40 |
-               MPIDR_AFFINITY_LEVEL(v->arch.vmpidr, 0) << 32);
+        aff = (MPIDR_AFFINITY_LEVEL(v->arch.vmpidr, 3) << 24 |
+               MPIDR_AFFINITY_LEVEL(v->arch.vmpidr, 2) << 16 |
+               MPIDR_AFFINITY_LEVEL(v->arch.vmpidr, 1) << 8 |
+               MPIDR_AFFINITY_LEVEL(v->arch.vmpidr, 0));
         typer = aff;
+
+        typer = typer << 32;
+
         /* We use the VCPU ID as the redistributor ID in bits[23:8] */
         typer |= v->vcpu_id << GICR_TYPER_PROC_NUM_SHIFT;
 
-- 
2.17.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.