Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp3185587pxb; Tue, 12 Jan 2021 08:20:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJwbe88gCAeCJFe/T4UDKyH9Vfw2j/qi+JokHgZIogi+6yRJcN0OtruuzGpnA2QdqOZjdXOD X-Received: by 2002:a50:fe0e:: with SMTP id f14mr4106303edt.159.1610468457452; Tue, 12 Jan 2021 08:20:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610468457; cv=none; d=google.com; s=arc-20160816; b=hYm2bBxkYZH1+vqtICmpqZi0cdgjFgCk26jUGF1/CoOdAs7sVpAiZ0oPwvA1DfTOKI u8dW0kWLQ7mFwPzgEzrSPpF+B1w5iVMP3VcT741tW6aYiwIz7UYyuF8kYGilgrbLgCfd lYKaAdv4GEahg7wta2ianM+6U1s6+PIl36SRcf1PPDrwjRHms11oPpaPlGzeEvGizADP tp8+xl1r1MBRpFwK331C5QoNOjYq4n6N8AfQlk1w4sC9rJ4lYDw+kFKoHtWy5uTDngSC pvaX8qrq/nkBekZJRrbUWN++yYUAYuVs60eyRXMboums04XAeMhXzC7fEc8GmaEABuc0 9fCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:from:subject; bh=4GBOId6KKxkVMHGISq8gJ6TXqFgPcaJad/I9bRljcOA=; b=jje41J499sIRNcKuFn7+PbupITQdLdD5gST1FzlKo79AifVTZZgqGHkRFQDo3olNxs 7ARljqu+/50TWk9Ijep+OpC6dRlvmiYh+EeKon6b+xZZoOtB/My3NLqy7u63fsRIU7sJ skGKzrZ/41eeV0RgpnhrFw2fGZDSL+j+qwdJ3UQl5c+cEnVPcF6NxrtdzWfRHfI4Ahi7 IBk1ZzYDw5bZMdKcLIelY2TJpOYjdsKYR1onj6EtvquXTxE1cqIgaFNKFxsq6NqAz1He jhj+GfPEwsMfIghx5w7d7Md/ywHq/Slh68i7TzpYcHj/yr/c3soHvxcNKFtb5gLobU8+ WEJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mh12si1382980ejb.48.2021.01.12.08.20.33; Tue, 12 Jan 2021 08:20:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406362AbhALQRZ (ORCPT + 99 others); Tue, 12 Jan 2021 11:17:25 -0500 Received: from foss.arm.com ([217.140.110.172]:49142 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406333AbhALQRW (ORCPT ); Tue, 12 Jan 2021 11:17:22 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 470681FB; Tue, 12 Jan 2021 08:16:36 -0800 (PST) Received: from [192.168.0.110] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0FA2D3F719; Tue, 12 Jan 2021 08:16:34 -0800 (PST) Subject: Re: [PATCH 7/9] KVM: arm64: Simplify argument passing to vgic_uaccess_[read|write] From: Alexandru Elisei To: Eric Auger , eric.auger.pro@gmail.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, maz@kernel.org, drjones@redhat.com Cc: shuah@kernel.org, pbonzini@redhat.com References: <20201212185010.26579-1-eric.auger@redhat.com> <20201212185010.26579-8-eric.auger@redhat.com> Message-ID: Date: Tue, 12 Jan 2021 16:16:40 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Eric, On 1/12/21 4:04 PM, Alexandru Elisei wrote: > Hi Eric, > > On 12/12/20 6:50 PM, Eric Auger wrote: >> Instead of converting the vgic_io_device handle to a kvm_io_device >> handled and then do the oppositive, pass a vgic_io_device pointer all >> along the call chain. > To me, it looks like the commit message describes what the patch does instead of > why it does it. > > What are "vgic_io_device handle" and "kvm_io_device handled"? Sorry, I think I got it now. You were referring to the argument types struct vgic_io_device and struct kvm_io_device. The patch looks like a very good cleanup. How changing to commit message to sound something like this (feel free to ignore/change it if you think of something else): vgic_uaccess() takes a struct vgic_io_device argument, converts it to a struct kvm_io_device and passes it to the read/write accessor functions, which convert it back to a struct vgic_io_device. Avoid the indirection by passing the struct vgic_io_device argument directly to vgic_uaccess_{read,write). Thanks, Alex > > Thanks, > Alex >> Signed-off-by: Eric Auger >> --- >> arch/arm64/kvm/vgic/vgic-mmio.c | 10 ++++------ >> 1 file changed, 4 insertions(+), 6 deletions(-) >> >> diff --git a/arch/arm64/kvm/vgic/vgic-mmio.c b/arch/arm64/kvm/vgic/vgic-mmio.c >> index b2d73fc0d1ef..48c6067fc5ec 100644 >> --- a/arch/arm64/kvm/vgic/vgic-mmio.c >> +++ b/arch/arm64/kvm/vgic/vgic-mmio.c >> @@ -938,10 +938,9 @@ vgic_get_mmio_region(struct kvm_vcpu *vcpu, struct vgic_io_device *iodev, >> return region; >> } >> >> -static int vgic_uaccess_read(struct kvm_vcpu *vcpu, struct kvm_io_device *dev, >> +static int vgic_uaccess_read(struct kvm_vcpu *vcpu, struct vgic_io_device *iodev, >> gpa_t addr, u32 *val) >> { >> - struct vgic_io_device *iodev = kvm_to_vgic_iodev(dev); >> const struct vgic_register_region *region; >> struct kvm_vcpu *r_vcpu; >> >> @@ -960,10 +959,9 @@ static int vgic_uaccess_read(struct kvm_vcpu *vcpu, struct kvm_io_device *dev, >> return 0; >> } >> >> -static int vgic_uaccess_write(struct kvm_vcpu *vcpu, struct kvm_io_device *dev, >> +static int vgic_uaccess_write(struct kvm_vcpu *vcpu, struct vgic_io_device *iodev, >> gpa_t addr, const u32 *val) >> { >> - struct vgic_io_device *iodev = kvm_to_vgic_iodev(dev); >> const struct vgic_register_region *region; >> struct kvm_vcpu *r_vcpu; >> >> @@ -986,9 +984,9 @@ int vgic_uaccess(struct kvm_vcpu *vcpu, struct vgic_io_device *dev, >> bool is_write, int offset, u32 *val) >> { >> if (is_write) >> - return vgic_uaccess_write(vcpu, &dev->dev, offset, val); >> + return vgic_uaccess_write(vcpu, dev, offset, val); >> else >> - return vgic_uaccess_read(vcpu, &dev->dev, offset, val); >> + return vgic_uaccess_read(vcpu, dev, offset, val); >> } >> >> static int dispatch_mmio_read(struct kvm_vcpu *vcpu, struct kvm_io_device *dev, > _______________________________________________ > kvmarm mailing list > kvmarm@lists.cs.columbia.edu > https://lists.cs.columbia.edu/mailman/listinfo/kvmarm