From patchwork Fri Feb 9 14:39:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 127861 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp681167ljc; Fri, 9 Feb 2018 06:43:49 -0800 (PST) X-Google-Smtp-Source: AH8x227voMAtvFTgvnOptrnAo3k9536dPFkmioC8Ei5LQZBFHI22H1sLc4aO1IN3ZwkJykz2TAKm X-Received: by 10.36.19.5 with SMTP id 5mr3617297itz.11.1518187339229; Fri, 09 Feb 2018 06:42:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518187339; cv=none; d=google.com; s=arc-20160816; b=YzWkU+cy15pahXayKLPp0LHjQjwfvs13ETEMSgAWQ0f4PMaU75XHv/xq8dChVNJce0 OG/+kPMCGpEvubjuujj8u5KdWEGsNfpciNSV0AG6vBOc9ioNuWD6dlfh2tyb0L6eGXnS 2GXQE3MSnzDIRvCxLpLrGfhnp53IkS5HbLNTGM9U5hRmVDvL6YWIXjENCcutL4o9hDhE QRkWXnjFHNbGt74R1Tui6pk5QMoQSk2dzezjsWp3ryYbeLRF53D5sUaUJfp8LaKE3zx3 6iTogSe/m3cEhh5zgagiIhmLeZ5+SrXl6YlMq43WNWLFMOHeYui0QGu2jCqvz958KPAB 7iyw== 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:references:in-reply-to:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=X/qNeRka59qF30+NPfA/+rnUImMyOjZmZ28xCCl8CCM=; b=KvS3C+pRxHtrA11egpzPC40o8R21VeI3XDWVR4w6UiTs1kVGCux6CsJwfrP0fuqdkJ dzE+HnFxBQQasB6Urvp8LE0QY3awyX11cnEOlzWQFU9DusERR8V+WCdLK9vl8L4dMQpU IJuEF14rg4YI6NmtoNJXZ4VYveua2usxR/tidt9066JEGqai6kijyPI+sPSIEgjtwYr3 Rz5Dwp/HLkTS/A1KXMfclC/tQSZrhTEE5/PQzoM91TH2EhHrulIzHxCHA/GJSrIKwN09 MKpAjNQjLnM+7eW6TGbK7AOCiMeKY8qebVT1oxTeGcjr1a6n/rdFW1Zx6hEk/z2lxrRG LSPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=M5ILwnlG; 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 d139si1666628ioe.265.2018.02.09.06.42.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Feb 2018 06:42:19 -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=M5ILwnlG; 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 1ek9qs-0001wd-Om; Fri, 09 Feb 2018 14:40:34 +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 1ek9qr-0001t1-RJ for xen-devel@lists.xenproject.org; Fri, 09 Feb 2018 14:40:33 +0000 X-Inumbo-ID: 1d49c212-0da7-11e8-ba59-bc764e045a96 Received: from mail-wr0-x241.google.com (unknown [2a00:1450:400c:c0c::241]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 1d49c212-0da7-11e8-ba59-bc764e045a96; Fri, 09 Feb 2018 15:40:04 +0100 (CET) Received: by mail-wr0-x241.google.com with SMTP id y3so8472613wrh.3 for ; Fri, 09 Feb 2018 06:40:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=3C3basq8ntsq4q1Bes19GaSMJzHML6y7PRZmI/DbMhU=; b=M5ILwnlGycsSo5B2A26FfvQc1SrRS+F1T81RuimykqU3Um74aBWcorq4hrnOPcQSM5 mV/uQ+kWfHORUP3YANAe7yVk1skZ0pNA6V7DVqurK1j05RA4ptzwzywiNfQrxbgLtv+m 0LHnExmrbpPGMHP8pvfeO38DK/8FCLks+d1KI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=3C3basq8ntsq4q1Bes19GaSMJzHML6y7PRZmI/DbMhU=; b=DZR3ZZsi4NHh8u/cAdarQUni/nvg9z/xQw7dNdVTxV+pVA0+Cp241kCgMl1kDgAaN8 dyXZkP/XLr8ofDcq8wBHcQyqGPNHBooZeoHR+6pRbfWk9WgQIesIs3xhjuNhg8Hl1qL1 nkvNXcPmowWub0321BIu/gjKLqXMOHgdygqI+sqSdI6VvkkQhmoCHIHq6HxOjdgW2jdu gdmBXImSl81XOD7Rj9fK9wr1TSmWdJKkmeudsu5TYUjFiJEaAwOj+bClkXcAeYDuXdHh hvAqtIJYVWmLLVn+92Wp64/Ta1MabUCeMTYZ8DsF8MLGAffUeWAuSFq0E8bh3eng7vXf avsg== X-Gm-Message-State: APf1xPAawITX+0KgGsWq/cFeEpjy2xW63R4eA66pqHT7ZEy+KpusG5ve RniFVuKUivtKfiOweUmhp718rP+w3iw= X-Received: by 10.223.199.207 with SMTP id y15mr2827814wrg.158.1518187231495; Fri, 09 Feb 2018 06:40:31 -0800 (PST) Received: from e104803-lin.lan (mail.andrep.de. [217.160.17.100]) by smtp.gmail.com with ESMTPSA id b35sm2552229wra.13.2018.02.09.06.40.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Feb 2018 06:40:31 -0800 (PST) From: Andre Przywara To: Stefano Stabellini , Julien Grall , xen-devel@lists.xenproject.org Date: Fri, 9 Feb 2018 14:39:32 +0000 Message-Id: <20180209143937.28866-45-andre.przywara@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180209143937.28866-1-andre.przywara@linaro.org> References: <20180209143937.28866-1-andre.przywara@linaro.org> Subject: [Xen-devel] [RFC PATCH 44/49] ARM: new VGIC: vgic-init: register VGIC 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" This patch implements the function which is called by Xen when it wants to register the virtual GIC. Signed-off-by: Andre Przywara --- xen/arch/arm/vgic/vgic-init.c | 62 +++++++++++++++++++++++++++++++++++++++++++ xen/arch/arm/vgic/vgic.h | 3 +++ 2 files changed, 65 insertions(+) create mode 100644 xen/arch/arm/vgic/vgic-init.c diff --git a/xen/arch/arm/vgic/vgic-init.c b/xen/arch/arm/vgic/vgic-init.c new file mode 100644 index 0000000000..b5f1183a50 --- /dev/null +++ b/xen/arch/arm/vgic/vgic-init.c @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2015, 2016 ARM Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include + +#include "vgic.h" + +/* CREATION */ + +/** + * domain_vgic_register: create a virtual GIC + * @d: domain pointer + * @mmio_count: pointer to add number of required MMIO regions + * + * was: kvm_vgic_create + */ +int domain_vgic_register(struct domain *d, int *mmio_count) +{ + switch ( d->arch.vgic.version ) + { +#ifdef CONFIG_HAS_GICV3 + case GIC_V3: + d->arch.max_vcpus = VGIC_V3_MAX_CPUS; + break; +#endif + case GIC_V2: + d->arch.max_vcpus = VGIC_V2_MAX_CPUS; + break; + } + + if ( d->max_vcpus > d->arch.max_vcpus ) + return -E2BIG; + + d->arch.vgic.vgic_dist_base = VGIC_ADDR_UNDEF; + d->arch.vgic.vgic_cpu_base = VGIC_ADDR_UNDEF; + d->arch.vgic.vgic_redist_base = VGIC_ADDR_UNDEF; + + return 0; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/arch/arm/vgic/vgic.h b/xen/arch/arm/vgic/vgic.h index b104f8e964..205ce10ffa 100644 --- a/xen/arch/arm/vgic/vgic.h +++ b/xen/arch/arm/vgic/vgic.h @@ -20,6 +20,9 @@ #define PRODUCT_ID_KVM 0x4b /* ASCII code K */ #define IMPLEMENTER_ARM 0x43b +#define VGIC_ADDR_UNDEF (-1) +#define IS_VGIC_ADDR_UNDEF(_x) ((_x) == VGIC_ADDR_UNDEF) + #define VGIC_PRI_BITS 5 #define vgic_irq_is_sgi(intid) ((intid) < VGIC_NR_SGIS)