From patchwork Wed Jan 24 18:10:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 125694 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp581001ljf; Wed, 24 Jan 2018 10:13:38 -0800 (PST) X-Google-Smtp-Source: AH8x224EEIW6JqUUxJ4UBgjL9h1lJzexOse9xBSv55wBZq8+pbko6KSCfX8QtMkcyh4VaMufni6n X-Received: by 10.107.141.147 with SMTP id p141mr9274675iod.79.1516817618771; Wed, 24 Jan 2018 10:13:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516817618; cv=none; d=google.com; s=arc-20160816; b=UyWIDfzvK2fitWBqiaxdQBAdsWCJFuPWYkWj9lYpxEhhTdQNwKv0vkFSzGWyibceqO PcHYm0YsoYlQlSHDbPbhqCdZ7G3WV4GHzN4IY/NiZJHtI+iA9NsKONt1i9oIviTDHary DyuQt11Onklb8f92JrH4sxuTjqle3gCAZMeFbKJ97GiQRPZX10Z2gNYskwPpjx3XIndB jAaNkCBWoUjn8y5SdYrniph01R3LJ9OvKFtLeakNVY1e6AK4o2gzf5ZCQlg4TKemoTs7 Hd+jfFOUZDyl3eIDgI/IOM2ZiqEPJPVaS3jUuGs1ReNb4ymM0K2UNesBG58qf8jof5Ap UTSQ== 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=Iw7ZJwLR8SXwlxYevOn56fwm6VskNwGcSXdGiO6lxOU=; b=FuEF2tsrvuR4M6AisILxoEnwUTzj2ReX9/lgS1RXIUVzTb0XscCwzEsKwi6Mffhfhx lqAFHDVi6bUaHY36NnkHD4PONftbOLGS959QcGfDDjf73czcW1i7rQyBUqzFtCD5XhRk 1q1AuXURuZOx8Z36xR+WEzXNkkZ9LAIjWPCFQWXlM7125HPwLu/tFYHXdns6NqIoPdiT jd5MBWEIgf6xP8of9ZlpJbdgl+JeBxg3V440wiwFUYKQIlZuA6l9598yOhY1RTZJGExO EBVNROxNgXtHE1KwhREOQac3YMSzxI959rXQaoujfpihsqil3LHhmRlXZDfMENi0i/Vd Z1WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=jGf+3dek; 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 d8si577597itf.75.2018.01.24.10.13.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 10:13:38 -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=jGf+3dek; 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 1eePVp-0007CK-Ib; Wed, 24 Jan 2018 18:11:05 +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 1eePVn-00079Y-MB for xen-devel@lists.xenproject.org; Wed, 24 Jan 2018 18:11:03 +0000 X-Inumbo-ID: ece01aa2-0131-11e8-ba59-bc764e045a96 Received: from mail-wm0-x243.google.com (unknown [2a00:1450:400c:c09::243]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id ece01aa2-0131-11e8-ba59-bc764e045a96; Wed, 24 Jan 2018 19:10:58 +0100 (CET) Received: by mail-wm0-x243.google.com with SMTP id b21so10334497wme.4 for ; Wed, 24 Jan 2018 10:11:01 -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=XrzoBWhEO8SlVbF/xWU3vS3L51EgwRn3dLIO9safdRo=; b=jGf+3dekRA0s93Zh2euEz/mx0cz6NYpOQQ7HuA4vddDrERnudQ5DvcHTGSNVikfnwN aauQnPDAQBwNAKycZrUdq26BleyN0uwhA0soTaaDIQ+D/eCqLcsKBGvnCpW3YQnB97JS TTseG625yRGVgQzmZtOmDJrljHoa495eK7df8= 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=XrzoBWhEO8SlVbF/xWU3vS3L51EgwRn3dLIO9safdRo=; b=kFWAM7zNulG9STvsl9lSW6b0UqAKv2/VCp6zApmFYVq9D5RpihYNxogia5LUD8Du6G htFluMMfoD5Z0aqqIY1QtfAAp93oeAbKMfw9WZwQH+Y7dro3FGAtRbF+fPVrcp9HoXne peXIByhNCVv4y/BK09FyQe9aPcGmPAsy3+O1VcG+aT+WgE8LfBf+FFcyLHqKg/3DL4S2 oza9Du11sT0Vcv6abp51wwHP5cyT8QCTrO483gnCqoHKp5daXC58xjB/23U6M/J4RVAv xW0NKRfsAj6YYORomOpzNyPfOWzdXfqnQqUCfzXYuYaH7h4QCBJYhtza893LjUbj8msJ fRCQ== X-Gm-Message-State: AKwxytfYOVQFPnCSS1f2nTwlATig0mfzWD2acu6TICKKJctCESwrHoBY 8R+UjGfb97KTZdU09Ia+hTIBCg== X-Received: by 10.28.14.10 with SMTP id 10mr6129987wmo.2.1516817460715; Wed, 24 Jan 2018 10:11:00 -0800 (PST) Received: from e104803-lin.lan (mail.andrep.de. [217.160.17.100]) by smtp.gmail.com with ESMTPSA id r68sm899379wmd.47.2018.01.24.10.10.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Jan 2018 10:11:00 -0800 (PST) From: Andre Przywara To: Julien Grall , Stefano Stabellini Date: Wed, 24 Jan 2018 18:10:57 +0000 Message-Id: <20180124181058.6157-8-andre.przywara@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180124181058.6157-1-andre.przywara@linaro.org> References: <20180124181058.6157-1-andre.przywara@linaro.org> Cc: xen-devel@lists.xenproject.org Subject: [Xen-devel] [PATCH v3 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 a0d290b55c..9ecb62b113 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 3ad98dcd3a..319617babe 100644 --- a/xen/arch/arm/gic-vgic.c +++ b/xen/arch/arm/gic-vgic.c @@ -52,7 +52,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 b51b485c20..30e62c37ec 100644 --- a/xen/include/asm-arm/gic.h +++ b/xen/include/asm-arm/gic.h @@ -342,8 +342,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