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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 064BBC433EF for ; Fri, 1 Oct 2021 13:12:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C93E861440 for ; Fri, 1 Oct 2021 13:12:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231454AbhJANOG (ORCPT ); Fri, 1 Oct 2021 09:14:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:36684 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231416AbhJANOF (ORCPT ); Fri, 1 Oct 2021 09:14:05 -0400 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 2461461054; Fri, 1 Oct 2021 13:12:20 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mWIKo-00ECVR-4D; Fri, 01 Oct 2021 14:12:18 +0100 Date: Fri, 01 Oct 2021 14:12:17 +0100 Message-ID: <87k0iwsxce.wl-maz@kernel.org> From: Marc Zyngier To: Ricardo Koller Cc: Eric Auger , kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, drjones@redhat.com, alexandru.elisei@arm.com, Paolo Bonzini , oupton@google.com, james.morse@arm.com, suzuki.poulose@arm.com, shuah@kernel.org, jingzhangos@google.com, pshier@google.com, rananta@google.com, reijiw@google.com Subject: Re: [PATCH v3 01/10] kvm: arm64: vgic: Introduce vgic_check_iorange In-Reply-To: References: <20210928184803.2496885-1-ricarkol@google.com> <20210928184803.2496885-2-ricarkol@google.com> <4ab60884-e006-723a-c026-b3e8c0ccb349@redhat.com> <1613b54f-2c4b-a57a-d4ba-92e866c5ff1f@redhat.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: ricarkol@google.com, eric.auger@redhat.com, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, drjones@redhat.com, alexandru.elisei@arm.com, pbonzini@redhat.com, oupton@google.com, james.morse@arm.com, suzuki.poulose@arm.com, shuah@kernel.org, jingzhangos@google.com, pshier@google.com, rananta@google.com, reijiw@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Thu, 30 Sep 2021 22:19:16 +0100, Ricardo Koller wrote: > > On Thu, Sep 30, 2021 at 09:02:12AM +0200, Eric Auger wrote: > > Hi, > > > > On 9/29/21 11:17 PM, Ricardo Koller wrote: > > > On Wed, Sep 29, 2021 at 06:29:21PM +0200, Eric Auger wrote: > > >> Hi Ricardo, > > >> > > >> On 9/28/21 8:47 PM, Ricardo Koller wrote: > > >>> Add the new vgic_check_iorange helper that checks that an iorange is > > >>> sane: the start address and size have valid alignments, the range is > > >>> within the addressable PA range, start+size doesn't overflow, and the > > >>> start wasn't already defined. > > >>> > > >>> No functional change. > > >>> > > >>> Signed-off-by: Ricardo Koller > > >>> --- > > >>> arch/arm64/kvm/vgic/vgic-kvm-device.c | 22 ++++++++++++++++++++++ > > >>> arch/arm64/kvm/vgic/vgic.h | 4 ++++ > > >>> 2 files changed, 26 insertions(+) > > >>> > > >>> diff --git a/arch/arm64/kvm/vgic/vgic-kvm-device.c b/arch/arm64/kvm/vgic/vgic-kvm-device.c > > >>> index 7740995de982..f714aded67b2 100644 > > >>> --- a/arch/arm64/kvm/vgic/vgic-kvm-device.c > > >>> +++ b/arch/arm64/kvm/vgic/vgic-kvm-device.c > > >>> @@ -29,6 +29,28 @@ int vgic_check_ioaddr(struct kvm *kvm, phys_addr_t *ioaddr, > > >>> return 0; > > >>> } > > >>> > > >>> +int vgic_check_iorange(struct kvm *kvm, phys_addr_t *ioaddr, > > >>> + phys_addr_t addr, phys_addr_t alignment, > > >>> + phys_addr_t size) > > >>> +{ > > >>> + int ret; > > >>> + > > >>> + ret = vgic_check_ioaddr(kvm, ioaddr, addr, alignment); > > >> nit: not related to this patch but I am just wondering why we are > > >> passing phys_addr_t *ioaddr downto vgic_check_ioaddr and thus to > > >> > > >> vgic_check_iorange()? This must be a leftover of some old code? > > >> > > > It's used to check that the base of a region is not already set. > > > kvm_vgic_addr() uses it to make that check; > > > vgic_v3_alloc_redist_region() does not: > > > > > > rdreg->base = VGIC_ADDR_UNDEF; // so the "not already defined" check passes > > > ret = vgic_check_ioaddr(kvm, &rdreg->base, base, SZ_64K); > > Yes but I meant why a pointer? > > I can't think of any good reason. It must be some leftover as you said. It definitely is. Please have a patch to fix that. Also, it doesn't look like vgic_check_ioaddr() has any other user at the end of the series. Worth getting rid of. M. -- Without deviation from the norm, progress is not possible. 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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8684BC433F5 for ; Fri, 1 Oct 2021 13:12:28 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id EDCB461440 for ; Fri, 1 Oct 2021 13:12:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EDCB461440 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 761464B0D7; Fri, 1 Oct 2021 09:12:27 -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 i-gFTFtUgysX; Fri, 1 Oct 2021 09:12:26 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 5CFBC4B099; Fri, 1 Oct 2021 09:12:26 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id C79B04B08E for ; Fri, 1 Oct 2021 09:12:24 -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 QqzBqyuoCTci for ; Fri, 1 Oct 2021 09:12:21 -0400 (EDT) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 3A19F49DE3 for ; Fri, 1 Oct 2021 09:12:21 -0400 (EDT) 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 2461461054; Fri, 1 Oct 2021 13:12:20 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mWIKo-00ECVR-4D; Fri, 01 Oct 2021 14:12:18 +0100 Date: Fri, 01 Oct 2021 14:12:17 +0100 Message-ID: <87k0iwsxce.wl-maz@kernel.org> From: Marc Zyngier To: Ricardo Koller Subject: Re: [PATCH v3 01/10] kvm: arm64: vgic: Introduce vgic_check_iorange In-Reply-To: References: <20210928184803.2496885-1-ricarkol@google.com> <20210928184803.2496885-2-ricarkol@google.com> <4ab60884-e006-723a-c026-b3e8c0ccb349@redhat.com> <1613b54f-2c4b-a57a-d4ba-92e866c5ff1f@redhat.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: ricarkol@google.com, eric.auger@redhat.com, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, drjones@redhat.com, alexandru.elisei@arm.com, pbonzini@redhat.com, oupton@google.com, james.morse@arm.com, suzuki.poulose@arm.com, shuah@kernel.org, jingzhangos@google.com, pshier@google.com, rananta@google.com, reijiw@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Cc: kvm@vger.kernel.org, shuah@kernel.org, pshier@google.com, Paolo Bonzini , kvmarm@lists.cs.columbia.edu 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Thu, 30 Sep 2021 22:19:16 +0100, Ricardo Koller wrote: > > On Thu, Sep 30, 2021 at 09:02:12AM +0200, Eric Auger wrote: > > Hi, > > > > On 9/29/21 11:17 PM, Ricardo Koller wrote: > > > On Wed, Sep 29, 2021 at 06:29:21PM +0200, Eric Auger wrote: > > >> Hi Ricardo, > > >> > > >> On 9/28/21 8:47 PM, Ricardo Koller wrote: > > >>> Add the new vgic_check_iorange helper that checks that an iorange is > > >>> sane: the start address and size have valid alignments, the range is > > >>> within the addressable PA range, start+size doesn't overflow, and the > > >>> start wasn't already defined. > > >>> > > >>> No functional change. > > >>> > > >>> Signed-off-by: Ricardo Koller > > >>> --- > > >>> arch/arm64/kvm/vgic/vgic-kvm-device.c | 22 ++++++++++++++++++++++ > > >>> arch/arm64/kvm/vgic/vgic.h | 4 ++++ > > >>> 2 files changed, 26 insertions(+) > > >>> > > >>> diff --git a/arch/arm64/kvm/vgic/vgic-kvm-device.c b/arch/arm64/kvm/vgic/vgic-kvm-device.c > > >>> index 7740995de982..f714aded67b2 100644 > > >>> --- a/arch/arm64/kvm/vgic/vgic-kvm-device.c > > >>> +++ b/arch/arm64/kvm/vgic/vgic-kvm-device.c > > >>> @@ -29,6 +29,28 @@ int vgic_check_ioaddr(struct kvm *kvm, phys_addr_t *ioaddr, > > >>> return 0; > > >>> } > > >>> > > >>> +int vgic_check_iorange(struct kvm *kvm, phys_addr_t *ioaddr, > > >>> + phys_addr_t addr, phys_addr_t alignment, > > >>> + phys_addr_t size) > > >>> +{ > > >>> + int ret; > > >>> + > > >>> + ret = vgic_check_ioaddr(kvm, ioaddr, addr, alignment); > > >> nit: not related to this patch but I am just wondering why we are > > >> passing phys_addr_t *ioaddr downto vgic_check_ioaddr and thus to > > >> > > >> vgic_check_iorange()? This must be a leftover of some old code? > > >> > > > It's used to check that the base of a region is not already set. > > > kvm_vgic_addr() uses it to make that check; > > > vgic_v3_alloc_redist_region() does not: > > > > > > rdreg->base = VGIC_ADDR_UNDEF; // so the "not already defined" check passes > > > ret = vgic_check_ioaddr(kvm, &rdreg->base, base, SZ_64K); > > Yes but I meant why a pointer? > > I can't think of any good reason. It must be some leftover as you said. It definitely is. Please have a patch to fix that. Also, it doesn't look like vgic_check_ioaddr() has any other user at the end of the series. Worth getting rid of. M. -- Without deviation from the norm, progress is not possible. _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm