From patchwork Mon Jan 22 18:22:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 125457 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1300858ljf; Mon, 22 Jan 2018 10:25:20 -0800 (PST) X-Google-Smtp-Source: AH8x225gSOE8Jl4Cf7vZ2IvtMFGWrUTPc3L3m0/pgXGJEvlYlKqK3ztWlrdffdGm7YBwAZxz8KZ7 X-Received: by 10.107.38.21 with SMTP id m21mr9479512iom.69.1516645520517; Mon, 22 Jan 2018 10:25:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516645520; cv=none; d=google.com; s=arc-20160816; b=HbK1XzmCWcFs9wUV+M4DWWupRxdxVULJxOzfODYGNd2BGVSjNXvb+TaaR5SYDFhIbF LtJB+e3Irvx9Y42pbZbheSwt6hHb5TKM+HsOwclhs5WYXqLXtrXvEen1VFDpAD/8BdA4 HT+WJEd1V5kEG0d9HWOANbQ03xaaalHcdpdFFrGZ6zQyIOuN5ZvcjPzo3DukUGfhSH6u heorV8ICYQLbjU8S5k6ETslrFernfz36Q228KZtL6lYGPUkpoFMhp0ksrl+4o7Y9Zt7V 6TeBRHjo/7J5QFcRRFaAsCtqFvup5d2VKbrnLx+NRojzTQ9EH+6KnouTEhv96N+X8byq gRZA== 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=mNPRdi2yUQKZphuDd+1fEtKgjQDP4h53lc2lrUs+LSc=; b=miQdhakW5ilYClQUfDfIiP70YBJgLqUnXVDY2NpGyfu3A1KswDd08fFQk2eExaT5GM hKNQwAu4H7FM1KHVxrdmlprPUItl0zwgEyW+O1hvqKCabIA8iEwbwePvD2b70hUA6nnx 3eD0WM3HSb7zjJFaWpBWXbLlNDuSAfGx7dujNnS8FitgV71Rgbo1iHLLmqZ7/Lb9JMvg kT8lFeA8j6wlZ8paA1GFMNFwbmdlsKB7UszK+PI8ivnFljhGsvISjexBp1gcIOZUlifU 6pzIk5ZzYQ6/Le5zTyf2oF4qbi43ypVX6d6m8TnfUmb3pQzblwm6+MgozV4Ev8JAHgB3 3+eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Bt7LmILW; 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 m63si6345298ite.48.2018.01.22.10.25.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jan 2018 10:25:20 -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=Bt7LmILW; 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 1edgkG-00060J-IR; Mon, 22 Jan 2018 18:23:00 +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 1edgkF-0005zp-F2 for xen-devel@lists.xenproject.org; Mon, 22 Jan 2018 18:22:59 +0000 X-Inumbo-ID: 44412bbd-ffa1-11e7-ba59-bc764e045a96 Received: from mail-wm0-x244.google.com (unknown [2a00:1450:400c:c09::244]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 44412bbd-ffa1-11e7-ba59-bc764e045a96; Mon, 22 Jan 2018 19:22:56 +0100 (CET) Received: by mail-wm0-x244.google.com with SMTP id i186so18080538wmi.4 for ; Mon, 22 Jan 2018 10:22:57 -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=SC1ODd2piaPVFoA2NWp9Lv1i+Q4B3ZL8zlYKeOQWLvc=; b=Bt7LmILWyKRzvaf1+myQtuX8Z9q7YAF19ZyFPmSBLq9t81SLDAcusNGe7jkA1lln1O 4V0H1UoxisrKSW5FYClogczTYgGc5RVF1kkhQcgIoIeeh22Dz5vl1p7j0HKWPaqHFZpm WvXOM8qFEG/PutgxIb6BqJfSB/C6ddt6EIWzs= 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=SC1ODd2piaPVFoA2NWp9Lv1i+Q4B3ZL8zlYKeOQWLvc=; b=hqHvWhWceFeWdQeN1zr90A2eBSpUAxlJnDqn3WJi2r/kC2p/ZWM8HPixtq66fS5o9m rNcTLim5yj1TVk9Kxo/eb4bSNAc2D9KBaHIZFSbHT3CVJ+8qCtBZyI2QquumuV/6bict pKJSd6ulPN9rWOv8GEL/eu1OS2jpPnY0LLwVWrBwYqJHnR+JLvh/CqhsVjX5ewYdXLJd /tWHKZsWA4fZyhCHc7hHwP0USKWx3IPVJgStENF4hJ24722icQ/cBolkNSHxhPrwDkJi l0URT2YU+vBtoeg6bKDBLc2UHykrcT1OGBQhOHZrrGCpStJHRNXG9o6eV14+4q81OQAT MO4w== X-Gm-Message-State: AKwxytf6mSwhMZAiuIVBCf5aUyIEUpPljnmDZWKaXD0oh+xcNDxfLFCE BEKucSeuKDxcd+9zIp+/HQBjw5eyous= X-Received: by 10.28.23.205 with SMTP id 196mr5969839wmx.132.1516645375791; Mon, 22 Jan 2018 10:22:55 -0800 (PST) Received: from e108454-lin.cambridge.arm.com ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id v22sm4812277wra.58.2018.01.22.10.22.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jan 2018 10:22:55 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Jan 2018 18:22:46 +0000 Message-Id: <20180122182247.18490-2-julien.grall@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180122182247.18490-1-julien.grall@linaro.org> References: <20180122182247.18490-1-julien.grall@linaro.org> Cc: sstabellini@kernel.org, Julien Grall , andre.przywara@linaro.org Subject: [Xen-devel] [PATCH 1/2] xen/arm: GICv3: Parse ITS information from the firmware tables later on 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" There are Device Tree (e.g for the Foundation Model) out that describes the ITS but LPIs is not supported by the platform. Booting with such DT will result to an early Data Abort. The same DT is booting fine with a baremetal Linux because ITS will be initialized only when LPIs is supported. While this is a bug in the DT, I think Xen should be boot with the same hardware level support (e.g ITS will not be used) as with a baremetal Linux. The slight problem is Xen is relying on gicv3_its_host_has_its() to know if ITS can be used. The list is populated by gicv3_its_{dt,acpi}_init(). It would theoritical be possible to gate those with a check of GICD_TYPER.LPIS because we don't know yet whether the HW is an actual GICv3/GICv4. Looking at the callers of gicv3_its_host_has_its(), they will only be done after gicv3_its_init() is called. Therefore move the parsing of ITS information from firmware tables later on. Note that gicv3_its_init() has been moved at the end of the file to avoid forward declaration. Signed-off-by: Julien Grall --- I can move the code movement in a separate patch if necessary. It was small enough that I thought it would not be worth. --- xen/arch/arm/gic-v3-its.c | 47 +++++++++++++++++++++++++--------------- xen/arch/arm/gic-v3.c | 5 ----- xen/include/asm-arm/gic_v3_its.h | 12 ---------- 3 files changed, 30 insertions(+), 34 deletions(-) diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c index e57ae05771..b01a0d9eb5 100644 --- a/xen/arch/arm/gic-v3-its.c +++ b/xen/arch/arm/gic-v3-its.c @@ -515,21 +515,6 @@ static int gicv3_its_init_single_its(struct host_its *hw_its) return 0; } -int gicv3_its_init(void) -{ - struct host_its *hw_its; - int ret; - - list_for_each_entry(hw_its, &host_its_list, entry) - { - ret = gicv3_its_init_single_its(hw_its); - if ( ret ) - return ret; - } - - return 0; -} - /* * TODO: Investigate the interaction when a guest removes a device while * some LPIs are still in flight. @@ -1019,7 +1004,7 @@ static void add_to_host_its_list(paddr_t addr, paddr_t size, } /* Scan the DT for any ITS nodes and create a list of host ITSes out of it. */ -void gicv3_its_dt_init(const struct dt_device_node *node) +static void gicv3_its_dt_init(const struct dt_device_node *node) { const struct dt_device_node *its = NULL; @@ -1056,7 +1041,7 @@ static int gicv3_its_acpi_probe(struct acpi_subtable_header *header, return 0; } -void gicv3_its_acpi_init(void) +static void gicv3_its_acpi_init(void) { /* Parse ITS information */ acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR, @@ -1081,8 +1066,36 @@ unsigned long gicv3_its_make_hwdom_madt(const struct domain *d, void *base_ptr) return sizeof(struct acpi_madt_generic_translator) * vgic_v3_its_count(d); } +#else /* !CONFIG_ACPI */ + +static void gicv3_its_acpi_init(void) +{ + ASSERT_UNREACHABLE(); +} + #endif +int gicv3_its_init(void) +{ + struct host_its *hw_its; + int ret; + + if ( acpi_disabled ) + gicv3_its_dt_init(); + else + gicv3_its_acpi_init(); + + list_for_each_entry(hw_its, &host_its_list, entry) + { + ret = gicv3_its_init_single_its(hw_its); + if ( ret ) + return ret; + } + + return 0; +} + + /* * Local variables: * mode: C diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index a0d290b55c..9f9cf59f82 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -1314,9 +1314,6 @@ static void __init gicv3_dt_init(void) if ( !res ) dt_device_get_address(node, 1 + gicv3.rdist_count + 2, &vbase, &vsize); - - /* Check for ITS child nodes and build the host ITS list accordingly. */ - gicv3_its_dt_init(node); } static int gicv3_iomem_deny_access(const struct domain *d) @@ -1608,8 +1605,6 @@ static void __init gicv3_acpi_init(void) gicv3.rdist_stride = 0; - gicv3_its_acpi_init(); - /* * In ACPI, 0 is considered as the invalid address. However the rest * of the initialization rely on the invalid address to be diff --git a/xen/include/asm-arm/gic_v3_its.h b/xen/include/asm-arm/gic_v3_its.h index 40dffdc0fa..78a9bb14de 100644 --- a/xen/include/asm-arm/gic_v3_its.h +++ b/xen/include/asm-arm/gic_v3_its.h @@ -133,11 +133,7 @@ struct host_its { extern struct list_head host_its_list; -/* Parse the host DT and pick up all host ITSes. */ -void gicv3_its_dt_init(const struct dt_device_node *node); - #ifdef CONFIG_ACPI -void gicv3_its_acpi_init(void); unsigned long gicv3_its_make_hwdom_madt(const struct domain *d, void *base_ptr); #endif @@ -202,15 +198,7 @@ void gicv3_lpi_update_host_entry(uint32_t host_lpi, int domain_id, #else -static inline void gicv3_its_dt_init(const struct dt_device_node *node) -{ -} - #ifdef CONFIG_ACPI -static inline void gicv3_its_acpi_init(void) -{ -} - static inline unsigned long gicv3_its_make_hwdom_madt(const struct domain *d, void *base_ptr) {