From patchwork Tue Feb 6 17:09:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 127065 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3108043ljc; Tue, 6 Feb 2018 09:11:46 -0800 (PST) X-Google-Smtp-Source: AH8x224sTYlZBTUaqgOFAfapGieBhQJz3adpmh8eA7ku1Lljtuuusw0dmV9xNWutgZjp74vCnW5s X-Received: by 10.36.204.139 with SMTP id x133mr4157715itf.75.1517937106652; Tue, 06 Feb 2018 09:11:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517937106; cv=none; d=google.com; s=arc-20160816; b=HqqN77ZAxH/w7X+bdyU7jEkQJ8T+aw7sUwB7fGbXOAJ5UY3EU9jd9mDcFe2MdPNuzK D+5RxD+P9c79kB95Mlj5Vgwx7DfV18Mo9XWev/UKJox5KGE1DcIojGB8rZrubUUJc5lB QUu+i8gFJB7VkgoBSXAVpZXTWomwvRlWYScPUDyygg9xB0b6wFknOZ/5xfkRW74Iv/a+ vOmxqnHdypvAoz9NBfMHb5n9ACaDBDggOmUDRnY/Ll3v6Ss2OMts3LA4i+W+LXQYCBfr 7lvTBzo5WKHpMu8egxJiM16dl+kdpLtug8lx1mtiw2oH1wKGHIMdR6QX+x7geExjMFpL m7Yw== 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=fXze6vPPR48+AlFThPaLFqzyamrN3SROqxW0w99++OU=; b=vYZzLIF/1MQWpo1R49p5EclWLDxt6PyQ5grsrwJKzTBKHTfDb0+p/DsvZDmpYl9DcX /54QcokxL1X1uaHbm/9NWXmrOhp6EJjk67V6mtndHOybQFYizvP0pHs5WCHQgqJxkt+5 O+UOisPMqdF9b7e6maRrmC6Boxnprugn2M/WPEZFsg5OhEh35yVYFtXqgoodmIh+RG3F EcyUiRAeLiXc20H5GUzH1oqVNHIZtQPsWpwbdQ0LtsCvpTUB8B/Agy8mXadQaBdVmIGm NjBK8LsR0ho6NPiNnNtlP5zRh+Vnvm7RsciEFpIyCcnufYorBrRs+U3htsi6MikzjTCy JSyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=gO9do563; 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 o67si1985892ioi.92.2018.02.06.09.11.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Feb 2018 09:11:46 -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=gO9do563; 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 1ej6kD-0003ug-68; Tue, 06 Feb 2018 17:09:21 +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 1ej6kB-0003sj-CG for xen-devel@lists.xenproject.org; Tue, 06 Feb 2018 17:09:19 +0000 X-Inumbo-ID: 688fd247-0b60-11e8-ba59-bc764e045a96 Received: from mail-wr0-x244.google.com (unknown [2a00:1450:400c:c0c::244]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 688fd247-0b60-11e8-ba59-bc764e045a96; Tue, 06 Feb 2018 18:08:54 +0100 (CET) Received: by mail-wr0-x244.google.com with SMTP id v31so2714949wrc.11 for ; Tue, 06 Feb 2018 09:09:17 -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=nahXZdCwTbcSbsWgjSmpvBq6e991IKDSluycsjLCMtQ=; b=gO9do563/jXkT3G8q8HAO9mJ1zR/DBPJy9VWtXgrxa4RnGiBUua4MmeWZVrxCplWCa IQJVE+sdVwv95lUSKC6ANtr43DAwim726G9I7/NDPHZ6DIJ9p4LSY5a2u4ruwk8e/vQx c75eH0KxxVfRnU6E5iAn3oSYkH/v8lnuZPmug= 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=nahXZdCwTbcSbsWgjSmpvBq6e991IKDSluycsjLCMtQ=; b=cGAwj0fXuWCSxIIQnCca6dpjfAUmx+bEllVzVqANTQY1XIOMYaB7gHh24w0cRnsFFU sNR374MYFCRhzh03hGnCwbemh16rdvZ+BLCvb1yZi2070Da6ruJPEh6qSXKA1JBF0ZQ0 On7TD0bazUkKtyfBRUUlHjcc5tPLC4ddMtpplSAYA7jRnyZLb0o7chaaysyd4UZ3IrHv mJ1DLsZHn9rlTJ1ftw2HzJfbZVgTGui7VJ7Kn/H3P+FyOjE5c/vi8AKQ3XRod9O6S6SA Y/Xq1roWXrk4ovKEIgVPDwJCB5uGfHJ9G28yR/OJm6ZiPbbWYLJPVaCC9ZQYtfHGaQxQ 6iIw== X-Gm-Message-State: APf1xPCrTFjZdObN4+qRTLc5eRVHcyhKyzBjRgglfPyIEcOqAN39NriY PJri3qof/nRMytw/Z0aOxmd6Hw== X-Received: by 10.223.184.28 with SMTP id h28mr2826762wrf.215.1517936956605; Tue, 06 Feb 2018 09:09:16 -0800 (PST) Received: from e104803-lin.lan (mail.andrep.de. [217.160.17.100]) by smtp.gmail.com with ESMTPSA id n2sm7885819wra.41.2018.02.06.09.09.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Feb 2018 09:09:16 -0800 (PST) From: Andre Przywara To: Julien Grall , Stefano Stabellini Date: Tue, 6 Feb 2018 17:09:02 +0000 Message-Id: <20180206170903.30637-8-andre.przywara@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180206170903.30637-1-andre.przywara@linaro.org> References: <20180206170903.30637-1-andre.przywara@linaro.org> Cc: xen-devel@lists.xenproject.org Subject: [Xen-devel] [PATCH v5 7/8] ARM: VGIC: rework gicv[23]_update_lr to not use pending_irq 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" The functions to actually populate a list register were accessing the VGIC internal pending_irq struct, although they should be abstracting from that. Break the needed information down to remove the reference to pending_irq from gic-v[23].c. Signed-off-by: Andre Przywara Reviewed-by: Stefano Stabellini --- xen/arch/arm/gic-v2.c | 14 +++++++------- xen/arch/arm/gic-v3.c | 12 ++++++------ xen/arch/arm/gic-vgic.c | 3 ++- xen/include/asm-arm/gic.h | 4 ++-- xen/include/asm-arm/irq.h | 3 +++ 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c index 511c8d7294..2b271ba322 100644 --- a/xen/arch/arm/gic-v2.c +++ b/xen/arch/arm/gic-v2.c @@ -428,8 +428,8 @@ static void gicv2_disable_interface(void) spin_unlock(&gicv2.lock); } -static void gicv2_update_lr(int lr, const struct pending_irq *p, - unsigned int state) +static void gicv2_update_lr(int lr, unsigned int virq, uint8_t priority, + unsigned int hw_irq, unsigned int state) { uint32_t lr_reg; @@ -437,12 +437,12 @@ static void gicv2_update_lr(int lr, const struct pending_irq *p, BUG_ON(lr < 0); lr_reg = (((state & GICH_V2_LR_STATE_MASK) << GICH_V2_LR_STATE_SHIFT) | - ((GIC_PRI_TO_GUEST(p->priority) & GICH_V2_LR_PRIORITY_MASK) - << GICH_V2_LR_PRIORITY_SHIFT) | - ((p->irq & GICH_V2_LR_VIRTUAL_MASK) << GICH_V2_LR_VIRTUAL_SHIFT)); + ((GIC_PRI_TO_GUEST(priority) & GICH_V2_LR_PRIORITY_MASK) + << GICH_V2_LR_PRIORITY_SHIFT) | + ((virq & GICH_V2_LR_VIRTUAL_MASK) << GICH_V2_LR_VIRTUAL_SHIFT)); - if ( p->desc != NULL ) - lr_reg |= GICH_V2_LR_HW | ((p->desc->irq & GICH_V2_LR_PHYSICAL_MASK ) + if ( hw_irq != INVALID_IRQ ) + lr_reg |= GICH_V2_LR_HW | ((hw_irq & GICH_V2_LR_PHYSICAL_MASK ) << GICH_V2_LR_PHYSICAL_SHIFT); writel_gich(lr_reg, GICH_LR + lr * 4); diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index 072345c6f9..25c30bb9ea 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -966,8 +966,8 @@ static void gicv3_disable_interface(void) spin_unlock(&gicv3.lock); } -static void gicv3_update_lr(int lr, const struct pending_irq *p, - unsigned int state) +static void gicv3_update_lr(int lr, unsigned int virq, uint8_t priority, + unsigned int hw_irq, unsigned int state) { uint64_t val = 0; @@ -983,11 +983,11 @@ static void gicv3_update_lr(int lr, const struct pending_irq *p, if ( current->domain->arch.vgic.version == GIC_V3 ) val |= GICH_LR_GRP1; - val |= ((uint64_t)p->priority & 0xff) << GICH_LR_PRIORITY_SHIFT; - val |= ((uint64_t)p->irq & GICH_LR_VIRTUAL_MASK) << GICH_LR_VIRTUAL_SHIFT; + val |= (uint64_t)priority << GICH_LR_PRIORITY_SHIFT; + val |= ((uint64_t)virq & GICH_LR_VIRTUAL_MASK) << GICH_LR_VIRTUAL_SHIFT; - if ( p->desc != NULL ) - val |= GICH_LR_HW | (((uint64_t)p->desc->irq & GICH_LR_PHYSICAL_MASK) + if ( hw_irq != INVALID_IRQ ) + val |= GICH_LR_HW | (((uint64_t)hw_irq & GICH_LR_PHYSICAL_MASK) << GICH_LR_PHYSICAL_SHIFT); gicv3_ich_write_lr(lr, val); diff --git a/xen/arch/arm/gic-vgic.c b/xen/arch/arm/gic-vgic.c index 72a904bbeb..d273863556 100644 --- a/xen/arch/arm/gic-vgic.c +++ b/xen/arch/arm/gic-vgic.c @@ -38,7 +38,8 @@ static inline void gic_set_lr(int lr, struct pending_irq *p, clear_bit(GIC_IRQ_GUEST_PRISTINE_LPI, &p->status); - gic_hw_ops->update_lr(lr, p, state); + gic_hw_ops->update_lr(lr, p->irq, p->priority, + p->desc ? p->desc->irq : INVALID_IRQ, state); set_bit(GIC_IRQ_GUEST_VISIBLE, &p->status); clear_bit(GIC_IRQ_GUEST_QUEUED, &p->status); diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h index 1a142d6e9f..497f195bc1 100644 --- a/xen/include/asm-arm/gic.h +++ b/xen/include/asm-arm/gic.h @@ -344,8 +344,8 @@ struct gic_hw_operations { /* Disable CPU physical and virtual interfaces */ void (*disable_interface)(void); /* Update LR register with state and priority */ - void (*update_lr)(int lr, const struct pending_irq *pending_irq, - unsigned int state); + void (*update_lr)(int lr, unsigned int virq, uint8_t priority, + unsigned int hw_irq, unsigned int state); /* Update HCR status register */ void (*update_hcr_status)(uint32_t flag, bool set); /* Clear LR register */ diff --git a/xen/include/asm-arm/irq.h b/xen/include/asm-arm/irq.h index abc8f06a13..0d110ecb08 100644 --- a/xen/include/asm-arm/irq.h +++ b/xen/include/asm-arm/irq.h @@ -31,6 +31,9 @@ struct arch_irq_desc { /* LPIs are always numbered starting at 8192, so 0 is a good invalid case. */ #define INVALID_LPI 0 +/* This is a spurious interrupt ID which never makes it into the GIC code. */ +#define INVALID_IRQ 1023 + extern unsigned int nr_irqs; #define nr_static_irqs NR_IRQS #define arch_hwdom_irqs(domid) NR_IRQS