From patchwork Fri Jun 20 13:35:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 32283 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3D8C92061E for ; Fri, 20 Jun 2014 13:38:18 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id n16sf23948337oag.10 for ; Fri, 20 Jun 2014 06:38:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id :mime-version:cc:subject:precedence:list-id:list-unsubscribe :list-post:list-help:list-subscribe:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :list-archive:content-type:content-transfer-encoding; bh=0GB+bHBKVAx2SprOfOV17H7svHX5IwUFbepHvGHCFtw=; b=iHszrsSqyngXECfC8zz7bknwFxrveiy4oALys2r0QPAzHwbMLPjoXoc5opQUar6qef S176+qmAEV1rQop7rFLSkbJtJs26hlVpvhiHAtR88RisUf7sfjOHIA6CCfSFLBtWwv/e y6hU52HvH1Qd4W3N65gN8/jI/vrZgezFXh6Hznz4U7MMTkHy7qpJ1amobWtNldcOnitj dSya7PVvaXtsIvwZFpbHQqbecL6QfVtCInmzmd5QphU4MR6vbrq0Gq2kZyqb7KoX+ltq DWT1SEK3nYEi0587Rgt2YwvA9UamTJ0V2p7zJnoBVOYoEH0wsA3e8hKp4bWRyAi3mgpQ PKEQ== X-Gm-Message-State: ALoCoQmC89jR19vYLKYGxTTV6wWeZvDRNX0MVdP4ZxbAtE/hbOOSyNa2NqdYTQPhPxNVxcf0Wyds X-Received: by 10.182.197.172 with SMTP id iv12mr1286277obc.1.1403271497703; Fri, 20 Jun 2014 06:38:17 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.16.173 with SMTP id 42ls970736qgb.62.gmail; Fri, 20 Jun 2014 06:38:17 -0700 (PDT) X-Received: by 10.58.220.230 with SMTP id pz6mr3139529vec.9.1403271497485; Fri, 20 Jun 2014 06:38:17 -0700 (PDT) Received: from mail-ve0-f176.google.com (mail-ve0-f176.google.com [209.85.128.176]) by mx.google.com with ESMTPS id dj5si4028340vcb.21.2014.06.20.06.38.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 20 Jun 2014 06:38:17 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.176 as permitted sender) client-ip=209.85.128.176; Received: by mail-ve0-f176.google.com with SMTP id db12so3529140veb.7 for ; Fri, 20 Jun 2014 06:38:17 -0700 (PDT) X-Received: by 10.58.29.234 with SMTP id n10mr3152609veh.16.1403271497405; Fri, 20 Jun 2014 06:38:17 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp22993vcb; Fri, 20 Jun 2014 06:38:17 -0700 (PDT) X-Received: by 10.224.28.65 with SMTP id l1mr5053532qac.81.1403271496889; Fri, 20 Jun 2014 06:38:16 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id h7si10814441qan.34.2014.06.20.06.38.16 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 20 Jun 2014 06:38:16 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Wxyys-0002hD-Uf; Fri, 20 Jun 2014 13:35:50 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Wxyyr-0002h8-JP for xen-devel@lists.xensource.com; Fri, 20 Jun 2014 13:35:49 +0000 Received: from [85.158.137.68:55998] by server-3.bemta-3.messagelabs.com id 3F/39-12895-4B834A35; Fri, 20 Jun 2014 13:35:48 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-16.tower-31.messagelabs.com!1403271345!11360315!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 10428 invoked from network); 20 Jun 2014 13:35:47 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-16.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 20 Jun 2014 13:35:47 -0000 X-IronPort-AV: E=Sophos;i="5.01,514,1400025600"; d="scan'208";a="145440009" Received: from accessns.citrite.net (HELO FTLPEX01CL03.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 20 Jun 2014 13:35:44 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.80) with Microsoft SMTP Server id 14.3.181.6; Fri, 20 Jun 2014 09:35:43 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1Wxyym-00039U-2F; Fri, 20 Jun 2014 14:35:44 +0100 From: Stefano Stabellini To: Date: Fri, 20 Jun 2014 14:35:16 +0100 Message-ID: <1403271316-21635-1-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-DLP: MIA2 Cc: apatel@apm.com, Ian.Campbell@citrix.com, psawargaonkar@apm.com, stefano.stabellini@eu.citrix.com Subject: [Xen-devel] [PATCH] xen/arm: introduce platform_need_explicit_eoi X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: stefano.stabellini@eu.citrix.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: GICH_LR_HW doesn't work as expected on X-Gene: request maintenance interrupts and perform EOIs in the hypervisor as a workaround. Trigger this behaviour with a per platform option. No need to find the pcpu that needs to write to GICC_DIR, because after "physical irq follow virtual irq" we always inject the virtual irq on the vcpu that is running on the pcpu that received the interrupt. Signed-off-by: Stefano Stabellini CC: psawargaonkar@apm.com CC: apatel@apm.com --- xen/arch/arm/gic.c | 13 ++++++++++++- xen/arch/arm/platforms/xgene-storm.c | 2 +- xen/include/asm-arm/platform.h | 5 +++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index 58233cc..8695078 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -577,7 +577,9 @@ static inline void gic_set_lr(int lr, struct pending_irq *p, lr_val = state | (GIC_PRI_TO_GUEST(p->priority) << GICH_LR_PRIORITY_SHIFT) | ((p->irq & GICH_LR_VIRTUAL_MASK) << GICH_LR_VIRTUAL_SHIFT); - if ( p->desc != NULL ) + if ( platform_has_quirk(PLATFORM_QUIRK_NEED_EOI) ) + lr_val |= GICH_LR_MAINTENANCE_IRQ; + else if ( p->desc != NULL ) lr_val |= GICH_LR_HW | (p->desc->irq << GICH_LR_PHYSICAL_SHIFT); GICH[GICH_LR + lr] = lr_val; @@ -656,6 +658,11 @@ void gic_raise_guest_irq(struct vcpu *v, unsigned int virtual_irq, gic_add_to_lr_pending(v, irq_to_pending(v, virtual_irq)); } +static void gic_irq_eoi(int irq) +{ + GICC[GICC_DIR] = irq; +} + static void gic_update_one_lr(struct vcpu *v, int i) { struct pending_irq *p; @@ -692,7 +699,11 @@ static void gic_update_one_lr(struct vcpu *v, int i) clear_bit(i, &this_cpu(lr_mask)); if ( p->desc != NULL ) + { p->desc->status &= ~IRQ_INPROGRESS; + if ( platform_has_quirk(PLATFORM_QUIRK_NEED_EOI) ) + gic_irq_eoi(p->irq); + } clear_bit(GIC_IRQ_GUEST_VISIBLE, &p->status); clear_bit(GIC_IRQ_GUEST_ACTIVE, &p->status); p->lr = GIC_INVALID_LR; diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c index c9dd63c..5396c46 100644 --- a/xen/arch/arm/platforms/xgene-storm.c +++ b/xen/arch/arm/platforms/xgene-storm.c @@ -37,7 +37,7 @@ static bool reset_vals_valid = false; static uint32_t xgene_storm_quirks(void) { - return PLATFORM_QUIRK_GIC_64K_STRIDE; + return PLATFORM_QUIRK_GIC_64K_STRIDE|PLATFORM_QUIRK_NEED_EOI; } static int map_one_mmio(struct domain *d, const char *what, diff --git a/xen/include/asm-arm/platform.h b/xen/include/asm-arm/platform.h index bcd2097..572f5b1 100644 --- a/xen/include/asm-arm/platform.h +++ b/xen/include/asm-arm/platform.h @@ -55,6 +55,11 @@ struct platform_desc { */ #define PLATFORM_QUIRK_GIC_64K_STRIDE (1 << 0) +/* + * Quirk for platforms where GICH_LR_HW does not work as expected. + */ +#define PLATFORM_QUIRK_NEED_EOI (1 << 1) + void __init platform_init(void); int __init platform_init_time(void); int __init platform_specific_mapping(struct domain *d);