Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp162916pxb; Thu, 14 Jan 2021 02:41:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJzZjn2NjxwkXZeG8bA6aZhNnSHB6v8FsuvCmaH5GqDZsxv+7Ept0ihdpmzQq65nQeP0JBSz X-Received: by 2002:a05:6402:784:: with SMTP id d4mr1104642edy.20.1610620898630; Thu, 14 Jan 2021 02:41:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610620898; cv=none; d=google.com; s=arc-20160816; b=YQNAm5ez9sbYuwl2OthQ6Evl98vyXyX7O9ERBWKXZT1L2Q3J5SoSNO067LlGSD87in RnbVGS9B0T7ciCU1U8gNyg+x0AVcx62QvC4iCSktRj9OvwsxMlrkaJCg2/sFj7Kkapm8 Va/VKet2ZFI0+IaJX+/f3aacrps6mpfnbajGK/DbDN2f9I2C3TIWWru8Acv7hSe6w41S gyKbbgXaRMXRgJf/rNzRo+dq2TM8Mdwz3kntFE/Dur/6KZm1srLbCnxN0QXeO74D7W08 Av5fwLcYgGDOqeO69MZXslTub+NdtH/V/qTlLKCYjlW1+rzXLkljvOS9dkPuMcwxaBeT h+6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=W1VhNL+LcOCt2GTdnGt+y0NRR3dOMq/QykWmNiUu9QY=; b=rnT98ZZ6qSf6zzj8Jp1j2KCl71OdBLv8z+A1NyZ8RJqY9zYPfoPzs0SFUhMJVzJe54 aXt1bXOLMBKTDWtvYrCgMUy+vhBNjj64NaNdCu/ApK7U07QoXpDpX7mTnkVyc5Qi+HGj gH4EbFdSCb0C+h1hUtHAlK2iAOfUt3/OAGV49qAb5XnILigneTZHZxYXSzd9j6sLkllG mCclZiAEp88+oX9jL9VYb0YGT2F59PpnEkxQjTVaWRjQIGxHewsI/EI2LEG0OFdDhZEW sj9saR5G4SBskQ7R6rY/D5mjd7bEmO508SSi0bEjnz5guPSpga6LtZ6ye0d5Bm1Bc0zy D+pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eRCzBEpH; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l14si2495559edb.407.2021.01.14.02.41.13; Thu, 14 Jan 2021 02:41:38 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eRCzBEpH; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728768AbhANKjO (ORCPT + 99 others); Thu, 14 Jan 2021 05:39:14 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:20048 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728760AbhANKjN (ORCPT ); Thu, 14 Jan 2021 05:39:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610620668; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W1VhNL+LcOCt2GTdnGt+y0NRR3dOMq/QykWmNiUu9QY=; b=eRCzBEpHoi3p7BHr/XbYcSVq7GeUQvym3Ph0337GOuAVIhFRbFylbAOhcZ/A5MJoJ79J7k Amnl28iYwTP/IJ5MxC8zcxDnef0UB18ArnltXhVuSqP48g1KsaOgoMpwiLe5SDps6Dgnjt pxRvK3kAvt6QQ+0HezpSAAuXHT9eJyc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-570-sFZm2qP2M_qjKOIUCLiErA-1; Thu, 14 Jan 2021 05:37:46 -0500 X-MC-Unique: sFZm2qP2M_qjKOIUCLiErA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E718E19251A2; Thu, 14 Jan 2021 10:37:44 +0000 (UTC) Received: from laptop.redhat.com (ovpn-114-165.ams2.redhat.com [10.36.114.165]) by smtp.corp.redhat.com (Postfix) with ESMTP id 19F3E12D7E; Thu, 14 Jan 2021 10:37:41 +0000 (UTC) From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, maz@kernel.org, drjones@redhat.com Cc: alexandru.elisei@arm.com, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, shuah@kernel.org, pbonzini@redhat.com Subject: [PATCH v2 7/9] KVM: arm64: Simplify argument passing to vgic_uaccess_[read|write] Date: Thu, 14 Jan 2021 11:37:06 +0100 Message-Id: <20210114103708.26763-8-eric.auger@redhat.com> In-Reply-To: <20210114103708.26763-1-eric.auger@redhat.com> References: <20210114103708.26763-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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}. Signed-off-by: Eric Auger --- v1 -> v2: - reworded the commit message as suggested by Alexandru --- 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, -- 2.21.3