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=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 458F9C8300A for ; Thu, 30 Apr 2020 11:25:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2DB3A20838 for ; Thu, 30 Apr 2020 11:25:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726844AbgD3LZI (ORCPT ); Thu, 30 Apr 2020 07:25:08 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:3784 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726413AbgD3LZH (ORCPT ); Thu, 30 Apr 2020 07:25:07 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id B6CDFD5C09F13723E425; Thu, 30 Apr 2020 19:25:03 +0800 (CST) Received: from [127.0.0.1] (10.173.222.27) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.487.0; Thu, 30 Apr 2020 19:24:55 +0800 Subject: Re: [PATCH] KVM: arm64: vgic-v4: Initialize GICv4.1 even in the absence of a virtual ITS To: Marc Zyngier , , , CC: James Morse , Julien Thierry , Suzuki K Poulose , Eric Auger References: <20200425094426.162962-1-maz@kernel.org> From: Zenghui Yu Message-ID: <5b23b938-f71f-5523-6d7e-027bcca98dd4@huawei.com> Date: Thu, 30 Apr 2020 19:24:53 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <20200425094426.162962-1-maz@kernel.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.173.222.27] X-CFilter-Loop: Reflected Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Hi Marc, On 2020/4/25 17:44, Marc Zyngier wrote: > KVM now expects to be able to use HW-accelerated delivery of vSGIs > as soon as the guest has enabled thm. Unfortunately, we only them > initialize the GICv4 context if we have a virtual ITS exposed to > the guest. > > Fix it by always initializing the GICv4.1 context if it is > available on the host. > > Fixes: 2291ff2f2a56 ("KVM: arm64: GICv4.1: Plumb SGI implementation selection in the distributor") > Signed-off-by: Marc Zyngier > --- > virt/kvm/arm/vgic/vgic-init.c | 9 ++++++++- > virt/kvm/arm/vgic/vgic-mmio-v3.c | 3 ++- > 2 files changed, 10 insertions(+), 2 deletions(-) > > diff --git a/virt/kvm/arm/vgic/vgic-init.c b/virt/kvm/arm/vgic/vgic-init.c > index a963b9d766b73..8e6f350c3bcd1 100644 > --- a/virt/kvm/arm/vgic/vgic-init.c > +++ b/virt/kvm/arm/vgic/vgic-init.c > @@ -294,8 +294,15 @@ int vgic_init(struct kvm *kvm) > } > } > > - if (vgic_has_its(kvm)) { > + if (vgic_has_its(kvm)) > vgic_lpi_translation_cache_init(kvm); > + > + /* > + * If we have GICv4.1 enabled, unconditionnaly request enable the > + * v4 support so that we get HW-accelerated vSGIs. Otherwise, only > + * enable it if we present a virtual ITS to the guest. > + */ > + if (vgic_supports_direct_msis(kvm)) { > ret = vgic_v4_init(kvm); > if (ret) > goto out; > diff --git a/virt/kvm/arm/vgic/vgic-mmio-v3.c b/virt/kvm/arm/vgic/vgic-mmio-v3.c > index e72dcc4542475..26b11dcd45524 100644 > --- a/virt/kvm/arm/vgic/vgic-mmio-v3.c > +++ b/virt/kvm/arm/vgic/vgic-mmio-v3.c > @@ -50,7 +50,8 @@ bool vgic_has_its(struct kvm *kvm) > > bool vgic_supports_direct_msis(struct kvm *kvm) > { > - return kvm_vgic_global_state.has_gicv4 && vgic_has_its(kvm); > + return (kvm_vgic_global_state.has_gicv4_1 || > + (kvm_vgic_global_state.has_gicv4 && vgic_has_its(kvm))); > } Not related to this patch, but I think that the function name can be improved a bit after this change. It now indicates whether the vGIC supports direct MSIs injection *or* direct SGIs injection, not just MSIs. And if vgic_has_its() is false, we don't even support MSIs. The fix itself looks correct to me, Reviewed-by: Zenghui Yu Thanks. 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=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 94DDEC8300B for ; Thu, 30 Apr 2020 11:25:11 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 29C1620774 for ; Thu, 30 Apr 2020 11:25:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 29C1620774 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 98C8C4B3A3; Thu, 30 Apr 2020 07:25:10 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IUCpXASsPTAy; Thu, 30 Apr 2020 07:25:09 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 7A2864B3A4; Thu, 30 Apr 2020 07:25:09 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 57CEB4B373 for ; Thu, 30 Apr 2020 07:25:08 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id p0ZJ+F7ZA3EJ for ; Thu, 30 Apr 2020 07:25:07 -0400 (EDT) Received: from huawei.com (szxga05-in.huawei.com [45.249.212.191]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id E8C7E4B30E for ; Thu, 30 Apr 2020 07:25:06 -0400 (EDT) Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id B6CDFD5C09F13723E425; Thu, 30 Apr 2020 19:25:03 +0800 (CST) Received: from [127.0.0.1] (10.173.222.27) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.487.0; Thu, 30 Apr 2020 19:24:55 +0800 Subject: Re: [PATCH] KVM: arm64: vgic-v4: Initialize GICv4.1 even in the absence of a virtual ITS To: Marc Zyngier , , , References: <20200425094426.162962-1-maz@kernel.org> From: Zenghui Yu Message-ID: <5b23b938-f71f-5523-6d7e-027bcca98dd4@huawei.com> Date: Thu, 30 Apr 2020 19:24:53 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <20200425094426.162962-1-maz@kernel.org> Content-Language: en-US X-Originating-IP: [10.173.222.27] X-CFilter-Loop: Reflected X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu Hi Marc, On 2020/4/25 17:44, Marc Zyngier wrote: > KVM now expects to be able to use HW-accelerated delivery of vSGIs > as soon as the guest has enabled thm. Unfortunately, we only them > initialize the GICv4 context if we have a virtual ITS exposed to > the guest. > > Fix it by always initializing the GICv4.1 context if it is > available on the host. > > Fixes: 2291ff2f2a56 ("KVM: arm64: GICv4.1: Plumb SGI implementation selection in the distributor") > Signed-off-by: Marc Zyngier > --- > virt/kvm/arm/vgic/vgic-init.c | 9 ++++++++- > virt/kvm/arm/vgic/vgic-mmio-v3.c | 3 ++- > 2 files changed, 10 insertions(+), 2 deletions(-) > > diff --git a/virt/kvm/arm/vgic/vgic-init.c b/virt/kvm/arm/vgic/vgic-init.c > index a963b9d766b73..8e6f350c3bcd1 100644 > --- a/virt/kvm/arm/vgic/vgic-init.c > +++ b/virt/kvm/arm/vgic/vgic-init.c > @@ -294,8 +294,15 @@ int vgic_init(struct kvm *kvm) > } > } > > - if (vgic_has_its(kvm)) { > + if (vgic_has_its(kvm)) > vgic_lpi_translation_cache_init(kvm); > + > + /* > + * If we have GICv4.1 enabled, unconditionnaly request enable the > + * v4 support so that we get HW-accelerated vSGIs. Otherwise, only > + * enable it if we present a virtual ITS to the guest. > + */ > + if (vgic_supports_direct_msis(kvm)) { > ret = vgic_v4_init(kvm); > if (ret) > goto out; > diff --git a/virt/kvm/arm/vgic/vgic-mmio-v3.c b/virt/kvm/arm/vgic/vgic-mmio-v3.c > index e72dcc4542475..26b11dcd45524 100644 > --- a/virt/kvm/arm/vgic/vgic-mmio-v3.c > +++ b/virt/kvm/arm/vgic/vgic-mmio-v3.c > @@ -50,7 +50,8 @@ bool vgic_has_its(struct kvm *kvm) > > bool vgic_supports_direct_msis(struct kvm *kvm) > { > - return kvm_vgic_global_state.has_gicv4 && vgic_has_its(kvm); > + return (kvm_vgic_global_state.has_gicv4_1 || > + (kvm_vgic_global_state.has_gicv4 && vgic_has_its(kvm))); > } Not related to this patch, but I think that the function name can be improved a bit after this change. It now indicates whether the vGIC supports direct MSIs injection *or* direct SGIs injection, not just MSIs. And if vgic_has_its() is false, we don't even support MSIs. The fix itself looks correct to me, Reviewed-by: Zenghui Yu Thanks. _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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=-8.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 13B7CC8300A for ; Thu, 30 Apr 2020 11:25:31 +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 D59C820774 for ; Thu, 30 Apr 2020 11:25:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ZgRT79MW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D59C820774 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com 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:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Q6LvSM44VwKgfocx2BQTi7kVceGaulhTCcYyjXllc14=; b=ZgRT79MWcBGqroVWqmMjiG0gN TPmoFrdjKvbcr5lLsBjoslviPgcHpdKhyWSq8VdeApGAfu4z+p24Vfqy7UajUNGfSaz/cE2kZY7Ti s2ESl7bL6aiGIstRslaKyIcKPvNShCPGX96atG7qCglFHsVh5PlLAjONg7q60Aykse7xWJLgZVVZO 9zjyc0nuvGk+ykZPOA/lWh45BXSbpR8hZG0coK3J8GrfR1i3pfS9BRvB2nYk1WsMcAOY8uLGU4laX +H59WDssi3uSwZz3cg+coqQTmkvPkeAkSTPijhPbo3WHjY0WM38PiY3QQsPKaq6/pDClIJi39mlZB d+M2d3XBw==; 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 1jU7Jl-0008J2-Ca; Thu, 30 Apr 2020 11:25:25 +0000 Received: from szxga05-in.huawei.com ([45.249.212.191] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jU7Jh-0007WH-T0 for linux-arm-kernel@lists.infradead.org; Thu, 30 Apr 2020 11:25:23 +0000 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id B6CDFD5C09F13723E425; Thu, 30 Apr 2020 19:25:03 +0800 (CST) Received: from [127.0.0.1] (10.173.222.27) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.487.0; Thu, 30 Apr 2020 19:24:55 +0800 Subject: Re: [PATCH] KVM: arm64: vgic-v4: Initialize GICv4.1 even in the absence of a virtual ITS To: Marc Zyngier , , , References: <20200425094426.162962-1-maz@kernel.org> From: Zenghui Yu Message-ID: <5b23b938-f71f-5523-6d7e-027bcca98dd4@huawei.com> Date: Thu, 30 Apr 2020 19:24:53 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <20200425094426.162962-1-maz@kernel.org> Content-Language: en-US X-Originating-IP: [10.173.222.27] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200430_042522_095104_5B03C075 X-CRM114-Status: GOOD ( 19.21 ) 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: Eric Auger , James Morse , Julien Thierry , Suzuki K Poulose 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 Marc, On 2020/4/25 17:44, Marc Zyngier wrote: > KVM now expects to be able to use HW-accelerated delivery of vSGIs > as soon as the guest has enabled thm. Unfortunately, we only them > initialize the GICv4 context if we have a virtual ITS exposed to > the guest. > > Fix it by always initializing the GICv4.1 context if it is > available on the host. > > Fixes: 2291ff2f2a56 ("KVM: arm64: GICv4.1: Plumb SGI implementation selection in the distributor") > Signed-off-by: Marc Zyngier > --- > virt/kvm/arm/vgic/vgic-init.c | 9 ++++++++- > virt/kvm/arm/vgic/vgic-mmio-v3.c | 3 ++- > 2 files changed, 10 insertions(+), 2 deletions(-) > > diff --git a/virt/kvm/arm/vgic/vgic-init.c b/virt/kvm/arm/vgic/vgic-init.c > index a963b9d766b73..8e6f350c3bcd1 100644 > --- a/virt/kvm/arm/vgic/vgic-init.c > +++ b/virt/kvm/arm/vgic/vgic-init.c > @@ -294,8 +294,15 @@ int vgic_init(struct kvm *kvm) > } > } > > - if (vgic_has_its(kvm)) { > + if (vgic_has_its(kvm)) > vgic_lpi_translation_cache_init(kvm); > + > + /* > + * If we have GICv4.1 enabled, unconditionnaly request enable the > + * v4 support so that we get HW-accelerated vSGIs. Otherwise, only > + * enable it if we present a virtual ITS to the guest. > + */ > + if (vgic_supports_direct_msis(kvm)) { > ret = vgic_v4_init(kvm); > if (ret) > goto out; > diff --git a/virt/kvm/arm/vgic/vgic-mmio-v3.c b/virt/kvm/arm/vgic/vgic-mmio-v3.c > index e72dcc4542475..26b11dcd45524 100644 > --- a/virt/kvm/arm/vgic/vgic-mmio-v3.c > +++ b/virt/kvm/arm/vgic/vgic-mmio-v3.c > @@ -50,7 +50,8 @@ bool vgic_has_its(struct kvm *kvm) > > bool vgic_supports_direct_msis(struct kvm *kvm) > { > - return kvm_vgic_global_state.has_gicv4 && vgic_has_its(kvm); > + return (kvm_vgic_global_state.has_gicv4_1 || > + (kvm_vgic_global_state.has_gicv4 && vgic_has_its(kvm))); > } Not related to this patch, but I think that the function name can be improved a bit after this change. It now indicates whether the vGIC supports direct MSIs injection *or* direct SGIs injection, not just MSIs. And if vgic_has_its() is false, we don't even support MSIs. The fix itself looks correct to me, Reviewed-by: Zenghui Yu Thanks. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel