Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1962248rwb; Thu, 8 Dec 2022 18:08:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf4u7GrFidmhlZ1h6HkQcSC0mvKW/wDuHYpeWvKL6THK/hwVDwwwZWJ9c0tRPy63iCTUiCNS X-Received: by 2002:a17:907:8e92:b0:7ad:b286:8d48 with SMTP id tx18-20020a1709078e9200b007adb2868d48mr3441096ejc.9.1670551710147; Thu, 08 Dec 2022 18:08:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670551710; cv=none; d=google.com; s=arc-20160816; b=twglavUJm6LOhDWL6vcBMaesRDhYocpK4u/2jHXdIta28VgF30UjPfQeKhAcHFQhPP YJqR9e/icto847+2V/FPjaW4lCQ+bZZg2sMU4p17eBOJsmYnakdqKvlWTPE7gD9t2O2O FgDxBFB2AsP65ZtBZUKFWLj3jEAnhGK/yLH5b11sidSEMCpENdvyO/G5J9ZZ1BrtW3fX 7cthi7wahrBw1cQjVXVVeKAYkrA47N+wqEuDQFkgHtRl4tqpMWhQF6OG4RebAYhdlDrh vGaVu5a+7ByLx0/r1lGIQchStCTi5AN3SYDR2XXYnk0UgEPTwyKYWljN6G3Y8NrU93Jk 5zMA== 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; bh=iNaQ8cVFg6rq2AduHYUK2UWrWd1BcZJaAQrRI7/Dw7A=; b=UZmTfLWsQezFhJbX+dnHD9xrikMJMpfKD+LKC/UHxesWM0lUN7FOsmi6L5Ls1eNdxh 8tU41bnvqfDIKLs2Qre3f2sfS4YHUZDM1+Mok2sYZtyydaSxgRMiQhac7fk1zyiTDyLl bkYDvkw/lz18lUMNRdst3DQWLtrcfIqZ56yGie7oOJmfyojFBlFLgX92oT+kZjuZadrI +8EZpT7Ri7v2qAMHJmotkEr1ST953O/IeV9IMynpr4nqOr8Pmjloe/T2EYbPdZRzmcRG 2/S32HcS0BEPhy1T0dB7AmyafcZV4MmQDp0XmaihXKRFVdGkpJUHRYMHve+iz0Jtz445 3ACQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp19-20020a170906c15300b007c0b71da0e2si44559ejc.814.2022.12.08.18.08.12; Thu, 08 Dec 2022 18:08:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229997AbiLIBxk (ORCPT + 73 others); Thu, 8 Dec 2022 20:53:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229813AbiLIBxe (ORCPT ); Thu, 8 Dec 2022 20:53:34 -0500 Received: from out-233.mta0.migadu.com (out-233.mta0.migadu.com [IPv6:2001:41d0:1004:224b::e9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A441D941AB for ; Thu, 8 Dec 2022 17:53:32 -0800 (PST) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , Oliver Upton , Paolo Bonzini , Shuah Khan Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, kvmarm@lists.linux.dev, Ricardo Koller , Sean Christopherson , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/7] KVM: selftests: Setup ucall after loading program into guest memory Date: Fri, 9 Dec 2022 01:53:01 +0000 Message-Id: <20221209015307.1781352-3-oliver.upton@linux.dev> In-Reply-To: <20221209015307.1781352-1-oliver.upton@linux.dev> References: <20221209015307.1781352-1-oliver.upton@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The new ucall infrastructure needs to update a couple of guest globals to pass through the ucall MMIO addr and pool of ucall structs. A precondition of writing to the guest's program image is to have it already loaded into guest memory. Call ucall_init() after kvm_vm_elf_load(). Continue to park the ucall MMIO addr after MEM_REGION_TEST_DATA. Signed-off-by: Oliver Upton --- tools/testing/selftests/kvm/aarch64/page_fault_test.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/aarch64/page_fault_test.c b/tools/testing/selftests/kvm/aarch64/page_fault_test.c index 92d3a91153b6..95d22cfb7b41 100644 --- a/tools/testing/selftests/kvm/aarch64/page_fault_test.c +++ b/tools/testing/selftests/kvm/aarch64/page_fault_test.c @@ -609,8 +609,13 @@ static void setup_memslots(struct kvm_vm *vm, struct test_params *p) data_size / guest_page_size, p->test_desc->data_memslot_flags); vm->memslots[MEM_REGION_TEST_DATA] = TEST_DATA_MEMSLOT; +} + +static void setup_ucall(struct kvm_vm *vm) +{ + struct userspace_mem_region *region = vm_get_mem_region(vm, MEM_REGION_TEST_DATA); - ucall_init(vm, data_gpa + data_size); + ucall_init(vm, region->region.guest_phys_addr + region->region.memory_size); } static void setup_default_handlers(struct test_desc *test) @@ -702,6 +707,7 @@ static void run_test(enum vm_guest_mode mode, void *arg) vm = ____vm_create(mode); setup_memslots(vm, p); kvm_vm_elf_load(vm, program_invocation_name); + setup_ucall(vm); vcpu = vm_vcpu_add(vm, 0, guest_code); setup_gva_maps(vm); -- 2.39.0.rc1.256.g54fd8350bd-goog