From patchwork Fri Feb 9 14:38:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 127832 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp679729ljc; Fri, 9 Feb 2018 06:42:06 -0800 (PST) X-Google-Smtp-Source: AH8x224DDSolLgYIEIrsQj6GQYTbGRi0mHL7kiLgTt//p+y+4pIeAyVrOAsN+iJM7ghPpPFDRhbw X-Received: by 10.36.239.130 with SMTP id i124mr3753691ith.27.1518187326669; Fri, 09 Feb 2018 06:42:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518187326; cv=none; d=google.com; s=arc-20160816; b=q6D2vtnLeDa2niDpGjt98WSmK1Ew+kNyFTTr0T3AXApiRccyVT6mQDk41dXE0oDa+k J/1TfC8vR68iOTo/ahiWTMcPdCrKVwdp+KbICIjUq9Bi+kdhEyPGPPgAUMR93zn1w5xp PF5YBBLaSuRZW+j+RdNIq73i1FI/JJZ6LPm8aHTyc54k5tcEqyDuclC1HOV0uJzdDVd9 qe+VwrJ34edja9/t+yoJtot9lxR+UYA6LWcyh2rtxBtt/LqlcYY1amXKdzHzkFAyKHvx XokBqdCfliqIv7gnC7kSvoA6thXRtevc9+0DWJUkQ9MEvTnvwfX7z7eb9e30FVFZ9eaR izAA== 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=/gEd8uW/E6HdpLQpYd/lQHuGPYBcS3bv4cMEQ6V/aCk=; b=llFwItX5uN8JKFfzuwjtkOpjVf697ANbD/OE4+VHgL9u9yQy4LMqUfxoZJJQIkO0LE AHi0VPI5J+IwqDUtzJ+wU26E9jvFRBpWyQ0CNhOAUX+O4UaHF7dJKAUdZPEHKeOG+sS+ 3v1VZh+EXSnoARTCkwKyJXH70Aj7ah77SiDhoR7IlBd2ZnhiwiSCK7ADh6wtqpHc2B9q PeMAkq2XeAQ6wr9MIWV81iDLmikDAW1XhNzOoEvB9fKq6dwdplfXzjGpJFHlQjLUNeXv zQY++4OwMrUQh0xCh/44eBxciimd/F6HOkthg9oDWLX4Uhf4mAuLLkjLv8alxQwOkkGG OnLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Nn+1/VoR; 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 r62si1692697itg.15.2018.02.09.06.42.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Feb 2018 06:42:06 -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=Nn+1/VoR; 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 1ek9qH-00087N-Na; Fri, 09 Feb 2018 14:39:57 +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 1ek9qG-000864-LM for xen-devel@lists.xenproject.org; Fri, 09 Feb 2018 14:39:56 +0000 X-Inumbo-ID: 06c3a1ba-0da7-11e8-ba59-bc764e045a96 Received: from mail-wm0-x242.google.com (unknown [2a00:1450:400c:c09::242]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 06c3a1ba-0da7-11e8-ba59-bc764e045a96; Fri, 09 Feb 2018 15:39:26 +0100 (CET) Received: by mail-wm0-x242.google.com with SMTP id j21so4254185wmh.1 for ; Fri, 09 Feb 2018 06:39:54 -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=10UzZqlloXvFRKvdN34GlHq24IyIJ4sCuOb9ATx7vvc=; b=Nn+1/VoRXIdL8p9E2/yPzQXPOVULKfR0XZrvFfLcY8GKHlDYqRBJ1kjtGzlvPY/YAz CJC+Im0RXzmYkMYPOW7T+ihRyujvcAumMucMEfbuu6UlgYy9Wospy/zrfUbirJrlKSwt wMHfNPwLjsjwAFxYW4iyfnvwRIFHz6AQ/sgCI= 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=10UzZqlloXvFRKvdN34GlHq24IyIJ4sCuOb9ATx7vvc=; b=tawA8S4cbuNwQ+26H7Gv0bEftXlO+VnX7c/CHHmyOKicR4ESSaRnfmfR+BF87nG6E6 j6hLMPSkvS6Lqs/VRyeXa5P3yG7L9XbV02TujX4wBjHwjrMRyM2nZO+UHd7y302c3UYz 7wrr2LuBRavm65QL+3QgDLv/6pxDUKoUPl61HcwfSLiv8ubt6x99QgQufN5coALEj4HI +Sphr0S9iuDzfMqT+FQl0XT/3v9V5o3hQWZW9SLRGGk1hY+M653/Umslb1FTt6ICyko6 SLmC37F+rPqGiTtuJdn8YGlXRBRQ/ipeYKCBRYJoIrq133bNauGhJhmp+Sr5UKzU0+O8 oRlg== X-Gm-Message-State: APf1xPCIAetvMNGw115wlRCH+a5wlYQsNO/j7dWUlLYZaGBUttDk79kk wMqeScmsV3Jtq0M3ON23Y3XDGQ== X-Received: by 10.28.105.214 with SMTP id z83mr2344890wmh.77.1518187193704; Fri, 09 Feb 2018 06:39:53 -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.39.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Feb 2018 06:39:53 -0800 (PST) From: Andre Przywara To: Stefano Stabellini , Julien Grall , xen-devel@lists.xenproject.org Date: Fri, 9 Feb 2018 14:38:56 +0000 Message-Id: <20180209143937.28866-9-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 08/49] ARM: VGIC: move max_vcpus VGIC limit to struct arch_domain 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 VGIC model used for a domain (GICv2 or GICv3) determines the maximum number of VCPUs for that guest, as GICv2 can only handle 8 processors. In the moment we carry this per-VGIC-model limit in the vgic_ops, alongside the model specific functions. That makes some sense, but exposes some current VGIC implementation details to generic Xen code. Add a new arch specific field in our domain structure to hold this vcpu limit, and initialize it when we set the ops. This allows us to plug in the new VGIC later without also needing to carry some ops structure. Signed-off-by: Andre Przywara --- xen/arch/arm/domain.c | 5 ++--- xen/arch/arm/vgic.c | 3 ++- xen/include/asm-arm/domain.h | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index a010443bfd..9ad4cd0a6e 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -975,11 +975,10 @@ unsigned int domain_max_vcpus(const struct domain *d) * allocation when the vgic_ops haven't been initialised yet, * we return MAX_VIRT_CPUS if d->arch.vgic.handler is null. */ - if ( !d->arch.vgic.handler ) + if ( !d->arch.max_vcpus ) return MAX_VIRT_CPUS; else - return min_t(unsigned int, MAX_VIRT_CPUS, - d->arch.vgic.handler->max_vcpus); + return d->arch.max_vcpus; } /* diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c index 9921769b15..5f47aa84a9 100644 --- a/xen/arch/arm/vgic.c +++ b/xen/arch/arm/vgic.c @@ -166,7 +166,8 @@ int domain_vgic_init(struct domain *d, unsigned int nr_spis) void register_vgic_ops(struct domain *d, const struct vgic_ops *ops) { - d->arch.vgic.handler = ops; + d->arch.vgic.handler = ops; + d->arch.max_vcpus = ops->max_vcpus; } void domain_vgic_free(struct domain *d) diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h index 1dd9683d25..2fef32eaee 100644 --- a/xen/include/asm-arm/domain.h +++ b/xen/include/asm-arm/domain.h @@ -149,6 +149,7 @@ struct arch_domain #ifdef CONFIG_SBSA_VUART_CONSOLE struct vpl011 vpl011; #endif + unsigned int max_vcpus; } __cacheline_aligned;