Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7497461ybl; Tue, 24 Dec 2019 03:44:06 -0800 (PST) X-Google-Smtp-Source: APXvYqyyT5P20weTd9TBUxIQG9cpWCPBWnCUlNUHwAUF7xhtxvNVIqATeKMMHky/ugeY3up7IyS4 X-Received: by 2002:a9d:7b4a:: with SMTP id f10mr39848477oto.4.1577187846526; Tue, 24 Dec 2019 03:44:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577187846; cv=none; d=google.com; s=arc-20160816; b=HctVD4Db4M3t4eAhBTvRcpXHf6jC0Fsx7WLBQhOXqQMy7zWD5XatnDB9ejOUyf9Syf nmluGMJRrLywiID6ZoPe4xTEOyUuJOwFqipNNJqaXZuQMTT2G/JHzhD6OFHQIHSGVpGV 2SD5pNrLOR65IzUD8Y9dEmOivaamRZRP92kLXUMwkq79fesre9Ybz207CPyxYsFZlD+V hMXYDiR6uLBHcDD93J6v6OR5ginM7RAW60CFArQ6u8GD+/6iHplrN1SOeeHQS9nXK/Zb 2yYNZNoWVrailtern4IqYMYIijCf+u4q5p6euwNEcjgBKrOeu3N8PsLn+rVo+IZ4NSsC YoKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=j0SfhyoipcALT6qTKu4H07Q06YXu2vqsJnHECL8oPhA=; b=tkTECjFue6+j8ykEleTMzBWPU7XrqTzzptA/gH8wipmqGnT2Cr1CLb3ebT85U3AzxL UGIR9azU1acdxsYaIJJv9Z8e78CCXJWPXd8GES/+FIeCpE6FP7DHzzJZix8JmSw2Ufkp VdSD658b+elKK+QwKlh7BjwW4PuArnAtxpJuD/S5xaUA02SVEw1AP0VVb8aScyksO0Hx guVZIDx21wLgHI33XMcrpZbuFThNe7JzDUuNCxJcV1MqxFEnJlsvQLq+165yJcO/57+1 setNS3hz7kbLlMwhH0urxENDP5K6jf/sexqOcv/+YSCId8/L65SmfPXkxglJZgHNEKh6 3mCQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n11si11691418otk.290.2019.12.24.03.43.55; Tue, 24 Dec 2019 03:44:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727138AbfLXLnO (ORCPT + 99 others); Tue, 24 Dec 2019 06:43:14 -0500 Received: from inca-roads.misterjones.org ([213.251.177.50]:45794 "EHLO inca-roads.misterjones.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726206AbfLXLnO (ORCPT ); Tue, 24 Dec 2019 06:43:14 -0500 Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why.lan) by cheepnis.misterjones.org with esmtpsa (TLSv1.2:DHE-RSA-AES128-GCM-SHA256:128) (Exim 4.80) (envelope-from ) id 1iji6H-000169-3U; Tue, 24 Dec 2019 12:11:42 +0100 From: Marc Zyngier To: kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org Cc: Eric Auger , James Morse , Julien Thierry , Suzuki K Poulose , Thomas Gleixner , Jason Cooper , Lorenzo Pieralisi , Andrew Murray , Zenghui Yu , Robert Richter Subject: [PATCH v3 31/32] KVM: arm64: GICv4.1: Reload VLPI configuration on distributor enable/disable Date: Tue, 24 Dec 2019 11:10:54 +0000 Message-Id: <20191224111055.11836-32-maz@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191224111055.11836-1-maz@kernel.org> References: <20191224111055.11836-1-maz@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, eric.auger@redhat.com, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, tglx@linutronix.de, jason@lakedaemon.net, lorenzo.pieralisi@arm.com, Andrew.Murray@arm.com, yuzenghui@huawei.com, rrichter@marvell.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on cheepnis.misterjones.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Each time a Group-enable bit gets flipped, the state of these bits needs to be forwarded to the hardware. This is a pretty heavy handed operation, requiring all vcpus to reload their GICv4 configuration. It is thus implemented as a new request type. Of course, we only support Group-1 for now... Signed-off-by: Marc Zyngier --- arch/arm64/include/asm/kvm_host.h | 1 + virt/kvm/arm/arm.c | 8 ++++++++ virt/kvm/arm/vgic/vgic-mmio-v3.c | 5 ++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index c61260cf63c5..4aeff0cc4ecf 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -45,6 +45,7 @@ #define KVM_REQ_IRQ_PENDING KVM_ARCH_REQ(1) #define KVM_REQ_VCPU_RESET KVM_ARCH_REQ(2) #define KVM_REQ_RECORD_STEAL KVM_ARCH_REQ(3) +#define KVM_REQ_RELOAD_GICv4 KVM_ARCH_REQ(4) DECLARE_STATIC_KEY_FALSE(userspace_irqchip_in_use); diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c index 12e0280291ce..a398dd449880 100644 --- a/virt/kvm/arm/arm.c +++ b/virt/kvm/arm/arm.c @@ -682,6 +682,14 @@ static void check_vcpu_requests(struct kvm_vcpu *vcpu) if (kvm_check_request(KVM_REQ_RECORD_STEAL, vcpu)) kvm_update_stolen_time(vcpu); + + if (kvm_check_request(KVM_REQ_RELOAD_GICv4, vcpu)) { + /* The distributor enable bits were changed */ + preempt_disable(); + vgic_v4_put(vcpu, false); + vgic_v4_load(vcpu); + preempt_enable(); + } } } diff --git a/virt/kvm/arm/vgic/vgic-mmio-v3.c b/virt/kvm/arm/vgic/vgic-mmio-v3.c index 31ff8c7e09b0..4e72fc08a973 100644 --- a/virt/kvm/arm/vgic/vgic-mmio-v3.c +++ b/virt/kvm/arm/vgic/vgic-mmio-v3.c @@ -132,7 +132,10 @@ static void vgic_mmio_write_v3_misc(struct kvm_vcpu *vcpu, if (is_hwsgi != dist->nassgireq) vgic_v4_configure_vsgis(vcpu->kvm); - if (!was_enabled && dist->enabled) + if (kvm_vgic_global_state.has_gicv4_1 && + was_enabled != dist->enabled) + kvm_make_all_cpus_request(vcpu->kvm, KVM_REQ_RELOAD_GICv4); + else if (!was_enabled && dist->enabled) vgic_kick_vcpus(vcpu->kvm); mutex_unlock(&vcpu->kvm->lock); -- 2.20.1