From patchwork Mon Mar 5 16:03:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 130656 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp2853578lja; Mon, 5 Mar 2018 08:07:00 -0800 (PST) X-Google-Smtp-Source: AG47ELtZFH1g5Xv7Vf7BAUs8CzbpqWjEXvxDJpA4k/7NpITGXMlcbBeiBqJnTIl+kBmJG09aUDWi X-Received: by 10.107.55.68 with SMTP id e65mr18220841ioa.252.1520266020721; Mon, 05 Mar 2018 08:07:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520266020; cv=none; d=google.com; s=arc-20160816; b=cFXRGbyUsSwDGT5JKIWsyNm8SQL+2ZEhy2cwXw+Xb6AGdWt67OtfAvzTbH3sBQDKl2 SvkH3ZqvD81idCK/lg0a/uLffm+KZdF5lgnqlptey3n/nBTNDEZ0Gq4SvETZn0DzlS4x FlPszxglcJyB/YH/4rsIxCHKsPyuH8J18GusLd72ozATKG9dJOEnCe0FEu7Sz3wz7vcm XmB865agkXoeYdBbgeLy2qhEOZ9SXDAaPQSF7daPafOz2/+iFrKD1brlPnbUrj5AUgOz VXq5e177rcThFWhjEsO7qln+hTGsEIKKKy04Zy2oUEJXaEfbd5Uji5BmK5uqMnMms0zp rHAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=ZNdfovqBdo6m8CMtOrbY0rr8azxb7dlJlndlpxgnhSs=; b=D9GTsRiDdY5Ew1hVK9LtCnaBs0ukvYEHNEmMuY4f7Ea5YVr1LFlkTWlP9bqoL569VI btdygbMew5HjQ05yVg/km8FESvQM9XCt3L1Ke8LCa6es5J9ci1NasywXG4qY8/U9U0Jp gKyvO8YTlFHyeWst1NCeMHs1GqJAoLElyz+VJ0l0+iBtLIYJdK/Py46PceVSQ8QK4rtm omTXmgBTrNN0/sBQKxsC2yADsqaR7ZuFa1nXppyRoBPhVVHUB54AFS3QitzpPv8YtSJb YnxH5b9k9pvZ1pCIn+j8m6e73hst/EllCV8C38oKFMZSUcSplQjfuZXQuL1gp46t90Fe Tfxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hB/ggfP3; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id t6si8026870iod.23.2018.03.05.08.07.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 08:07:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hB/ggfP3; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1essbS-0007QE-Kx; Mon, 05 Mar 2018 16:04:42 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1essbR-0007Nj-OT for xen-devel@lists.xenproject.org; Mon, 05 Mar 2018 16:04:41 +0000 X-Inumbo-ID: c1698c4e-208e-11e8-ba59-bc764e045a96 Received: from mail-wr0-x242.google.com (unknown [2a00:1450:400c:c0c::242]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id c1698c4e-208e-11e8-ba59-bc764e045a96; Mon, 05 Mar 2018 17:03:34 +0100 (CET) Received: by mail-wr0-x242.google.com with SMTP id u49so17814955wrc.10 for ; Mon, 05 Mar 2018 08:04:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gvMQ5llFD+K3QFEn3+fu9+xQCOeD0U7QJodBfp066x4=; b=hB/ggfP3C9NosvKWs3+QdO/sDdOH5KakRsBjQI72TQqOPiWVGUZpB1MiNmWNGh7NmJ WbvkratbBsvERYy5vICbdnLbWs1JQysM/F0YM9yHiX7kepwleR++YiBgPTygGfvK3eXl KkAdf2xzQSNNuXAKirkymGS7DLCj5swPTQl5c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gvMQ5llFD+K3QFEn3+fu9+xQCOeD0U7QJodBfp066x4=; b=TwanbBSVN+9P815aeDHJ3d+gIWApECpZ7SCNhdpINmuxVE8e//+whQCXPNanwcwKBo oEfFPfmnycPyHbsmD1RRr0J6/nAlvACLhim4ktuZW1e1oY5r6iuMhj9O2yvqfe/4mBaF oTtDLtfPMx9to8vbeSuE5yqAaLBEyPgCYgS7MLvySEhGSSSF50az4GEnfx4mKxklqZHq agdIzcamhlMUoUYgaYQpPkGqofqFGBDKP+ms4WzzWIfEDgHHDIWpz9ZPqCQTSyEXoo6f zpr5mbyeApqrBCtO3YMgRsg9tRmrLdsZkZpHMKgfDp6/2OKl9wlRvlp9KnwR4qABc26O Y3qg== X-Gm-Message-State: APf1xPArXwtWm/CbEolXLjncClr4eAHZcS9W+OHwUUuXWLX3zYWBS3ki lbHkN1bpjqi7f9trExOn0tNTDg== X-Received: by 10.223.177.132 with SMTP id q4mr12644022wra.27.1520265878900; Mon, 05 Mar 2018 08:04:38 -0800 (PST) Received: from e104803-lin.lan (mail.andrep.de. [217.160.17.100]) by smtp.gmail.com with ESMTPSA id y6sm6574381wmy.14.2018.03.05.08.04.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Mar 2018 08:04:38 -0800 (PST) From: Andre Przywara To: Julien Grall , Stefano Stabellini Date: Mon, 5 Mar 2018 16:03:34 +0000 Message-Id: <20180305160415.16760-17-andre.przywara@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180305160415.16760-1-andre.przywara@linaro.org> References: <20180305160415.16760-1-andre.przywara@linaro.org> Cc: xen-devel@lists.xenproject.org Subject: [Xen-devel] [PATCH 16/57] ARM: GICv3: rename HYP interface definitions to use ICH_ prefix X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On a GICv3 in non-compat mode the hypervisor interface is always accessed via system registers. Those register names have a "ICH_" prefix in the manual, to differentiate them from the MMIO registers. Also those registers are mostly 64-bit (compared to the 32-bit GICv2 registers) and use different bit assignments. To make this obvious and to avoid clashes with double definitions using the same names for actually different bits, lets change all GICv3 hypervisor interface registers to use the "ICH_" prefix from the manual. This renames the definitions in gic_v3_defs.h and their usage in gic-v3.c and is needed to allow co-existence of the GICv2 and GICv3 definitions in the same file. Signed-off-by: Andre Przywara Acked-by: Julien Grall --- Changelog RFC ... v1: - new patch xen/arch/arm/gic-v3.c | 48 +++++++++++++++++++------------------- xen/include/asm-arm/gic_v3_defs.h | 49 +++++++++++++++++++-------------------- 2 files changed, 48 insertions(+), 49 deletions(-) diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index ea14ab4028..3e381d031b 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -830,14 +830,14 @@ static void gicv3_hyp_init(void) uint32_t vtr; vtr = READ_SYSREG32(ICH_VTR_EL2); - gicv3_info.nr_lrs = (vtr & GICH_VTR_NRLRGS) + 1; - gicv3.nr_priorities = ((vtr >> GICH_VTR_PRIBITS_SHIFT) & - GICH_VTR_PRIBITS_MASK) + 1; + gicv3_info.nr_lrs = (vtr & ICH_VTR_NRLRGS) + 1; + gicv3.nr_priorities = ((vtr >> ICH_VTR_PRIBITS_SHIFT) & + ICH_VTR_PRIBITS_MASK) + 1; if ( !((gicv3.nr_priorities > 4) && (gicv3.nr_priorities < 8)) ) panic("GICv3: Invalid number of priority bits\n"); - WRITE_SYSREG32(GICH_VMCR_EOI | GICH_VMCR_VENG1, ICH_VMCR_EL2); + WRITE_SYSREG32(ICH_VMCR_EOI | ICH_VMCR_VENG1, ICH_VMCR_EL2); WRITE_SYSREG32(GICH_HCR_EN, ICH_HCR_EL2); } @@ -976,21 +976,21 @@ static void gicv3_update_lr(int lr, unsigned int virq, uint8_t priority, BUG_ON(lr >= gicv3_info.nr_lrs); BUG_ON(lr < 0); - val = (((uint64_t)state & 0x3) << GICH_LR_STATE_SHIFT); + val = (((uint64_t)state & 0x3) << ICH_LR_STATE_SHIFT); /* * When the guest is GICv3, all guest IRQs are Group 1, as Group0 * would result in a FIQ in the guest, which it wouldn't expect */ if ( current->domain->arch.vgic.version == GIC_V3 ) - val |= GICH_LR_GRP1; + val |= ICH_LR_GRP1; - val |= (uint64_t)priority << GICH_LR_PRIORITY_SHIFT; - val |= ((uint64_t)virq & GICH_LR_VIRTUAL_MASK) << GICH_LR_VIRTUAL_SHIFT; + val |= (uint64_t)priority << ICH_LR_PRIORITY_SHIFT; + val |= ((uint64_t)virq & ICH_LR_VIRTUAL_MASK) << ICH_LR_VIRTUAL_SHIFT; if ( hw_irq != INVALID_IRQ ) - val |= GICH_LR_HW | (((uint64_t)hw_irq & GICH_LR_PHYSICAL_MASK) - << GICH_LR_PHYSICAL_SHIFT); + val |= ICH_LR_HW | (((uint64_t)hw_irq & ICH_LR_PHYSICAL_MASK) + << ICH_LR_PHYSICAL_SHIFT); gicv3_ich_write_lr(lr, val); } @@ -1006,25 +1006,25 @@ static void gicv3_read_lr(int lr, struct gic_lr *lr_reg) lrv = gicv3_ich_read_lr(lr); - lr_reg->pirq = (lrv >> GICH_LR_PHYSICAL_SHIFT) & GICH_LR_PHYSICAL_MASK; - lr_reg->virq = (lrv >> GICH_LR_VIRTUAL_SHIFT) & GICH_LR_VIRTUAL_MASK; + lr_reg->pirq = (lrv >> ICH_LR_PHYSICAL_SHIFT) & ICH_LR_PHYSICAL_MASK; + lr_reg->virq = (lrv >> ICH_LR_VIRTUAL_SHIFT) & ICH_LR_VIRTUAL_MASK; - lr_reg->priority = (lrv >> GICH_LR_PRIORITY_SHIFT) & GICH_LR_PRIORITY_MASK; - lr_reg->state = (lrv >> GICH_LR_STATE_SHIFT) & GICH_LR_STATE_MASK; - lr_reg->hw_status = (lrv >> GICH_LR_HW_SHIFT) & GICH_LR_HW_MASK; - lr_reg->grp = (lrv >> GICH_LR_GRP_SHIFT) & GICH_LR_GRP_MASK; + lr_reg->priority = (lrv >> ICH_LR_PRIORITY_SHIFT) & ICH_LR_PRIORITY_MASK; + lr_reg->state = (lrv >> ICH_LR_STATE_SHIFT) & ICH_LR_STATE_MASK; + lr_reg->hw_status = (lrv >> ICH_LR_HW_SHIFT) & ICH_LR_HW_MASK; + lr_reg->grp = (lrv >> ICH_LR_GRP_SHIFT) & ICH_LR_GRP_MASK; } static void gicv3_write_lr(int lr_reg, const struct gic_lr *lr) { uint64_t lrv = 0; - lrv = ( ((u64)(lr->pirq & GICH_LR_PHYSICAL_MASK) << GICH_LR_PHYSICAL_SHIFT)| - ((u64)(lr->virq & GICH_LR_VIRTUAL_MASK) << GICH_LR_VIRTUAL_SHIFT) | - ((u64)(lr->priority & GICH_LR_PRIORITY_MASK) << GICH_LR_PRIORITY_SHIFT)| - ((u64)(lr->state & GICH_LR_STATE_MASK) << GICH_LR_STATE_SHIFT) | - ((u64)(lr->hw_status & GICH_LR_HW_MASK) << GICH_LR_HW_SHIFT) | - ((u64)(lr->grp & GICH_LR_GRP_MASK) << GICH_LR_GRP_SHIFT) ); + lrv = ( ((u64)(lr->pirq & ICH_LR_PHYSICAL_MASK) << ICH_LR_PHYSICAL_SHIFT)| + ((u64)(lr->virq & ICH_LR_VIRTUAL_MASK) << ICH_LR_VIRTUAL_SHIFT) | + ((u64)(lr->priority & ICH_LR_PRIORITY_MASK) << ICH_LR_PRIORITY_SHIFT)| + ((u64)(lr->state & ICH_LR_STATE_MASK) << ICH_LR_STATE_SHIFT) | + ((u64)(lr->hw_status & ICH_LR_HW_MASK) << ICH_LR_HW_SHIFT) | + ((u64)(lr->grp & ICH_LR_GRP_MASK) << ICH_LR_GRP_SHIFT) ); gicv3_ich_write_lr(lr_reg, lrv); } @@ -1043,8 +1043,8 @@ static void gicv3_hcr_status(uint32_t flag, bool status) static unsigned int gicv3_read_vmcr_priority(void) { - return ((READ_SYSREG32(ICH_VMCR_EL2) >> GICH_VMCR_PRIORITY_SHIFT) & - GICH_VMCR_PRIORITY_MASK); + return ((READ_SYSREG32(ICH_VMCR_EL2) >> ICH_VMCR_PRIORITY_SHIFT) & + ICH_VMCR_PRIORITY_MASK); } /* Only support reading GRP1 APRn registers */ diff --git a/xen/include/asm-arm/gic_v3_defs.h b/xen/include/asm-arm/gic_v3_defs.h index 412e41afed..947de5162d 100644 --- a/xen/include/asm-arm/gic_v3_defs.h +++ b/xen/include/asm-arm/gic_v3_defs.h @@ -160,31 +160,30 @@ #define LPI_PROP_RES1 (1 << 1) #define LPI_PROP_ENABLED (1 << 0) -#define GICH_VMCR_EOI (1 << 9) -#define GICH_VMCR_VENG1 (1 << 1) - -#define GICH_LR_VIRTUAL_MASK 0xffff -#define GICH_LR_VIRTUAL_SHIFT 0 -#define GICH_LR_PHYSICAL_MASK 0x3ff -#define GICH_LR_PHYSICAL_SHIFT 32 -#define GICH_LR_STATE_MASK 0x3 -#define GICH_LR_STATE_SHIFT 62 -#define GICH_LR_PRIORITY_MASK 0xff -#define GICH_LR_PRIORITY_SHIFT 48 -#define GICH_LR_HW_MASK 0x1 -#define GICH_LR_HW_SHIFT 61 -#define GICH_LR_GRP_MASK 0x1 -#define GICH_LR_GRP_SHIFT 60 -#define GICH_LR_MAINTENANCE_IRQ (1UL<<41) -#define GICH_LR_GRP1 (1UL<<60) -#define GICH_LR_HW (1UL<<61) - -#define GICH_VTR_NRLRGS 0x3f -#define GICH_VTR_PRIBITS_MASK 0x7 -#define GICH_VTR_PRIBITS_SHIFT 29 - -#define GICH_VMCR_PRIORITY_MASK 0xff -#define GICH_VMCR_PRIORITY_SHIFT 24 +#define ICH_VMCR_EOI (1 << 9) +#define ICH_VMCR_VENG1 (1 << 1) +#define ICH_VMCR_PRIORITY_MASK 0xff +#define ICH_VMCR_PRIORITY_SHIFT 24 + +#define ICH_LR_VIRTUAL_MASK 0xffff +#define ICH_LR_VIRTUAL_SHIFT 0 +#define ICH_LR_PHYSICAL_MASK 0x3ff +#define ICH_LR_PHYSICAL_SHIFT 32 +#define ICH_LR_STATE_MASK 0x3 +#define ICH_LR_STATE_SHIFT 62 +#define ICH_LR_PRIORITY_MASK 0xff +#define ICH_LR_PRIORITY_SHIFT 48 +#define ICH_LR_HW_MASK 0x1 +#define ICH_LR_HW_SHIFT 61 +#define ICH_LR_GRP_MASK 0x1 +#define ICH_LR_GRP_SHIFT 60 +#define ICH_LR_MAINTENANCE_IRQ (1UL<<41) +#define ICH_LR_GRP1 (1UL<<60) +#define ICH_LR_HW (1UL<<61) + +#define ICH_VTR_NRLRGS 0x3f +#define ICH_VTR_PRIBITS_MASK 0x7 +#define ICH_VTR_PRIBITS_SHIFT 29 #define ICH_SGI_IRQMODE_SHIFT 40 #define ICH_SGI_IRQMODE_MASK 0x1