Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1444768pxf; Fri, 12 Mar 2021 09:37:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJzR8IHOaWdSugHHMC0whekN9RPNmHIcuz9PEyqaB517bT5ekIwAelhjX1/w3qjv2yYnNTWB X-Received: by 2002:a17:906:95d1:: with SMTP id n17mr9532988ejy.394.1615570628847; Fri, 12 Mar 2021 09:37:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615570628; cv=none; d=google.com; s=arc-20160816; b=vbSJe8AimtBzZr6z5GZjk6ws+E8VCD9av+po4biUUPWSsS807B64ZUZB0F8xPP+dCk jtaGw4VVy2wGAF+BnmswyZ2FA9+tMOsN8tA1i6/3q1n6L1o3/E0vCTmTCpibPENwKZ6H 2GTHmv3QqR0dd/VeltWM+AFh5WlglldN9hBN7WPNql4niUPxu7YXweL+DLWoBDVg7QhB nDP5QcB2tWKefPtLKiLpLRFd1WHovQQKDzUBrzWW82ZIqfr8wPHxV/QQSLM4bwmBibHd DxYCDEpLMXRQvSqaX2jrKbHHlZIcY+eTVF2wXYEankkDDAvQZZL9seXjn23J+4ANnw3+ xD3A== 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=TfSxCMSqz+hjS9nhZYK1vsZAwrwIVNpKaR9ZlqBQD3E=; b=h2G38xp7x13OxTbjY+y1t23fAzTtz6qJ3EUinU/wbhxMZrE67URHXf2PIQMmvb6f4m f6j99zyLpSR/OuoB6sXChacIPIA0f3t/jH1aQYp/8Nj9v1vQEEJeCq9ZCoPmYPCKuJuM cDyRJi5NYVwPUFJU3x2sSGycpEreqYrALgbZ+VepQCyEm0FjX6wdqi5OPszOhvpINM0a FT7oHGa4fZS4ENaQJxfW5H/BETdpqOIyQNhZx3bG1f9fyHyX50NFhUp7uxBZ/+ownx+b /Rq3HME64ow8lPkU/tLtFuEy+hMM5dZHBdiJycFRfeTAgWBF/gTakuGbUNGa4DsxDB8j faRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=S26uMpWy; 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 l12si4785478edi.290.2021.03.12.09.36.45; Fri, 12 Mar 2021 09:37:08 -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=S26uMpWy; 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 S233105AbhCLRdN (ORCPT + 99 others); Fri, 12 Mar 2021 12:33:13 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:36259 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232984AbhCLRcx (ORCPT ); Fri, 12 Mar 2021 12:32:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615570372; 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=TfSxCMSqz+hjS9nhZYK1vsZAwrwIVNpKaR9ZlqBQD3E=; b=S26uMpWyMRWXl0a7IIxyomQcg5z7MQMqfvb7lO2AzP1xlyW4uqFq4pQJRwiJ7hiEEdvTMO kYjMU40V5VP7rl3EFdr2BT9UYPJXigEj7xq3HMueyr0x/cUQFfe/U/ou5DJUHyXEcLg61G pBpzofmrdwqlYdwH2Ij1TZVKyMI72Lc= 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-564-Zjafp0eiPTqpYmo4ITY7EQ-1; Fri, 12 Mar 2021 12:32:50 -0500 X-MC-Unique: Zjafp0eiPTqpYmo4ITY7EQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6138693929; Fri, 12 Mar 2021 17:32:48 +0000 (UTC) Received: from laptop.redhat.com (ovpn-112-254.ams2.redhat.com [10.36.112.254]) by smtp.corp.redhat.com (Postfix) with ESMTP id 12DD41002EE6; Fri, 12 Mar 2021 17:32:44 +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, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, shuah@kernel.org, pbonzini@redhat.com Subject: [PATCH v3 6/8] KVM: arm64: Simplify argument passing to vgic_uaccess_[read|write] Date: Fri, 12 Mar 2021 18:32:00 +0100 Message-Id: <20210312173202.89576-7-eric.auger@redhat.com> In-Reply-To: <20210312173202.89576-1-eric.auger@redhat.com> References: <20210312173202.89576-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.26.2