Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp321447pxf; Thu, 1 Apr 2021 01:56:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCrTswg4XK7Bp5cdrbSmRcH3hapPSf6p76MyoNHRQnj918dq8vw5j08rPrtwVgfIChLY+c X-Received: by 2002:a05:6402:1d39:: with SMTP id dh25mr8913024edb.282.1617267401574; Thu, 01 Apr 2021 01:56:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617267401; cv=none; d=google.com; s=arc-20160816; b=PCv+3nIkPusM3BusU7K7Ia6GxZP/t1vLWZPoU+CTC4pEMW6UzyakuGBNVrAKm83J7Z MN3opl3pGlfxN8oYY/v8Li3CEfc+vJiZ+3PCUoJBfUbznGn6sGm3RGZQjov3gWFKv4RX lhd/qYmGYGQNBB14Z5X0IikunCvzKHTCTGzpfN43tgITFY0OllfeoVYFXxeweTYTrNCD uRAXHgojkCW5IJPv8mymfBy9LzT4/H5lr9uYlrRdatpY6p+dGJWD83VBbra76+/sBpkX x/ClejHVfz2sJeadVFfJJwLa30xZ9GgIdUULn2jzdOWFzie+9E6JhCy76zRfj2Mvr1jE fC2w== 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=nPqLtWXi6oUl4VT/EiwUC9B4rzKqCc5vKl7lO4px/gM=; b=pUZAH6cN1I0jpcROfOk1C9O0ZeN67+Qi3bxoOrlBE87NV8KLlYR+uK9XKY7SPPzl7k CVSwbNRgynPAkPqwK8yOU5sq1onLRJ4aSjX+wQPKXFluWiDWCKt97b/2V7pr3lRluclo cI4Nvp7HOzfxKBQ4g+4oK5n55sfg+xkl6Z9oC8njFRITdnIh6+iL+H6jyNiW1Wx6kbWA SEEuZ1/0s/uP8CqoAQaVr8zhxk6uybr1ZS4UBig1LGUYfZcKhmtcVUSif6YnlA9GZdK5 rvx4XauAMd2Z7GUtHLkln8BoCpyrjy767rWHH0iVOXgvey4LmmJpKVI+yqFpa3hiNgEo ovuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=L4PQs4Ml; 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 i13si3619025ejy.93.2021.04.01.01.56.17; Thu, 01 Apr 2021 01:56:41 -0700 (PDT) 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=L4PQs4Ml; 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 S233816AbhDAIxZ (ORCPT + 99 others); Thu, 1 Apr 2021 04:53:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:32783 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233580AbhDAIxE (ORCPT ); Thu, 1 Apr 2021 04:53:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617267184; 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=nPqLtWXi6oUl4VT/EiwUC9B4rzKqCc5vKl7lO4px/gM=; b=L4PQs4Mliz//XAH8G75g8zHZUCo3QMG4SwhAjAf5Rp6k5GPmvL8vBw819HiN0Rp5lVDA3o e6HQuR7GStXg834fpqDZp5pn87VdSh8AdTqcNpketyXtQBSPNEp8k4mHYSBYnj4qFBHpk5 IE4uTlSorT7CBtj8HRS94wNYtRfu824= 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-16-WT1BgprrO46lK8sWO7OaYw-1; Thu, 01 Apr 2021 04:53:02 -0400 X-MC-Unique: WT1BgprrO46lK8sWO7OaYw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 713E118C89C4; Thu, 1 Apr 2021 08:53:01 +0000 (UTC) Received: from laptop.redhat.com (ovpn-112-13.ams2.redhat.com [10.36.112.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA67E5D9CC; Thu, 1 Apr 2021 08:52:58 +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, alexandru.elisei@arm.com Cc: james.morse@arm.com, suzuki.poulose@arm.com, shuah@kernel.org, pbonzini@redhat.com Subject: [PATCH v4 6/8] KVM: arm64: Simplify argument passing to vgic_uaccess_[read|write] Date: Thu, 1 Apr 2021 10:52:36 +0200 Message-Id: <20210401085238.477270-7-eric.auger@redhat.com> In-Reply-To: <20210401085238.477270-1-eric.auger@redhat.com> References: <20210401085238.477270-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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 b2d73fc0d1ef4..48c6067fc5ecb 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.26.3