From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB561C4332B for ; Thu, 19 Mar 2020 19:53:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7E953206D7 for ; Thu, 19 Mar 2020 19:53:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="iMx4zPjl"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="qkSTKb4u" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7E953206D7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:To:From: Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NJHl3XkQWidx7WglYft1z8Tj7ybEYB1PVsmbdU7uqGI=; b=iMx4zPjlE7+lGas6weiBOXpoq ZjG6eR5wzVF26fJtj5/IzSWEf2gyGO4wvjNj9uBDr9S/KH8iFhieSYO0sVYf51lHXSIqyjYpNUrHx PcJUmSaAmCh4QMhuM2y2bXzEVnn8E6eAop81lKRPbycj3uztmgKUNoHv0TZMLsx6U/ZpruRrvPyI6 aOvzHw1QVE3QUEz+HZuuPRSDUQ1NVqMn0ohFIMlzSHWh5HVlrwt2aeyEfOQL8EZsEzny7UGBmPjXt j7vaVugANvSCbBqDfxmtPat+z9cuu1LrrLNLp5YLkat0voiXwyHRHuYAmC97IluC+4P8mjEdKrU9d Rwb7AGq+Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jF1ER-0004KL-Oy; Thu, 19 Mar 2020 19:53:31 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jF1Dh-0003bM-7t for linux-arm-kernel@lists.infradead.org; Thu, 19 Mar 2020 19:52:49 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 19B8A206D7; Thu, 19 Mar 2020 19:52:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584647564; bh=UMFRuMeWN29pb4882uOYxANHVABCplgj+koAb1z+2dE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=qkSTKb4utIarMQd8CDJcC0r66jjv4E6Grgajl0GaZ2NsWZFpgnSsxvNw5d1trhyVf m/hfAowH8zpNjr3UjCBAXtljDdoHJ8gci0Db/rlJFpoF62Ej37wABUnI3eg2J6bWh9 n0uwur1NEU7m4GqQdTUpOURPTJro6MWBSuqnHrzk= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jF1Dd-00E46F-Ts; Thu, 19 Mar 2020 19:52:42 +0000 MIME-Version: 1.0 Date: Thu, 19 Mar 2020 19:52:41 +0000 From: Marc Zyngier To: Auger Eric Subject: Re: [PATCH v5 19/23] KVM: arm64: GICv4.1: Allow SGIs to switch between HW and SW interrupts In-Reply-To: <8a6cf87a-7eee-5502-3b54-093ea0ab5e2d@redhat.com> References: <20200304203330.4967-1-maz@kernel.org> <20200304203330.4967-20-maz@kernel.org> <8a6cf87a-7eee-5502-3b54-093ea0ab5e2d@redhat.com> Message-ID: <877ba4711c6b9456314ea580b9c4718c@kernel.org> X-Sender: maz@kernel.org User-Agent: Roundcube Webmail/1.3.10 X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: eric.auger@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, lorenzo.pieralisi@arm.com, jason@lakedaemon.net, rrichter@marvell.com, tglx@linutronix.de, yuzenghui@huawei.com, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200319_125245_353685_9E4882BF X-CRM114-Status: GOOD ( 15.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lorenzo Pieralisi , Jason Cooper , kvm@vger.kernel.org, Suzuki K Poulose , linux-kernel@vger.kernel.org, Robert Richter , James Morse , Julien Thierry , Zenghui Yu , Thomas Gleixner , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Eric, On 2020-03-19 16:16, Auger Eric wrote: > Hi Marc, > > On 3/4/20 9:33 PM, Marc Zyngier wrote: >> In order to let a guest buy in the new, active-less SGIs, we >> need to be able to switch between the two modes. >> >> Handle this by stopping all guest activity, transfer the state >> from one mode to the other, and resume the guest. Nothing calls >> this code so far, but a later patch will plug it into the MMIO >> emulation. >> >> Signed-off-by: Marc Zyngier >> --- >> include/kvm/arm_vgic.h | 3 ++ >> virt/kvm/arm/vgic/vgic-v4.c | 94 >> +++++++++++++++++++++++++++++++++++++ >> virt/kvm/arm/vgic/vgic.h | 1 + >> 3 files changed, 98 insertions(+) >> >> diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h >> index 63457908c9c4..69f4164d6477 100644 >> --- a/include/kvm/arm_vgic.h >> +++ b/include/kvm/arm_vgic.h >> @@ -231,6 +231,9 @@ struct vgic_dist { >> /* distributor enabled */ >> bool enabled; >> >> + /* Wants SGIs without active state */ >> + bool nassgireq; >> + >> struct vgic_irq *spis; >> >> struct vgic_io_device dist_iodev; >> diff --git a/virt/kvm/arm/vgic/vgic-v4.c b/virt/kvm/arm/vgic/vgic-v4.c >> index c2fcde104ea2..a65dc1c85363 100644 >> --- a/virt/kvm/arm/vgic/vgic-v4.c >> +++ b/virt/kvm/arm/vgic/vgic-v4.c >> @@ -97,6 +97,100 @@ static irqreturn_t vgic_v4_doorbell_handler(int >> irq, void *info) >> return IRQ_HANDLED; >> } >> >> +static void vgic_v4_sync_sgi_config(struct its_vpe *vpe, struct >> vgic_irq *irq) >> +{ >> + vpe->sgi_config[irq->intid].enabled = irq->enabled; >> + vpe->sgi_config[irq->intid].group = irq->group; >> + vpe->sgi_config[irq->intid].priority = irq->priority; >> +} >> + >> +static void vgic_v4_enable_vsgis(struct kvm_vcpu *vcpu) >> +{ >> + struct its_vpe *vpe = &vcpu->arch.vgic_cpu.vgic_v3.its_vpe; >> + int i; >> + >> + /* >> + * With GICv4.1, every virtual SGI can be directly injected. So >> + * let's pretend that they are HW interrupts, tied to a host >> + * IRQ. The SGI code will do its magic. >> + */ >> + for (i = 0; i < VGIC_NR_SGIS; i++) { >> + struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, i); >> + struct irq_desc *desc; >> + int ret; > Is is safe without holding the irq->irq_lock? The assumption here is that we're coming vgic_v4_configure_vsgis(), which starts by stopping the whole guest. My guess is that it should be safe enough, but maybe you are thinking of something else? Thanks, M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel