From nobody Sat Feb 7 17:04:38 2026 Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC351E571 for ; Thu, 28 Nov 2024 00:55:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755354; cv=none; b=i3/6IK/YdrXPy3pRjUC/4t8HqR9yHX3UHYehhyzoTAZ+2Esqwm0uRCXP7QcNVj3opBrJlflq6+dB2vU8Z0fXhbsozDStdJAbUAbOXMkWX0NwQtN7keRBk6ih1WB2tnbAlPeIMj9qaMdpSvl7QUJiCA3vcCuxamK/fpj3V7lmDbw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755354; c=relaxed/simple; bh=jpG2Z0wLkJo4m6LTchsXKdavjrJbj2n+h3dPpHrcu5s=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=QnBMEEPvBU9QvHNNzAVv8bm/4bI2OUKPDD9DD0ow9WwEa59TSSwijsXYyEXm+o4dRNTGKaZCfNSIad4kkO4WB5PfEaG04R8bFD1LiC+h+DkdksGXRYeIJo7KA+cyQ/Nj+EqnYHGeBvgbdghPE9Wp3fAF+/mFJnCZnBUBQEWwgSk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=QlDAc/c2; arc=none smtp.client-ip=209.85.210.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="QlDAc/c2" Received: by mail-pf1-f201.google.com with SMTP id d2e1a72fcca58-724f7c09c58so354012b3a.3 for ; Wed, 27 Nov 2024 16:55:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1732755352; x=1733360152; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=ziTWoMDGGemt4FbzSlGzzl5MJ7+5E+c66t+aoBco/o8=; b=QlDAc/c2dz8Vac0PPavKSqLbiYEKn0APmRbTXNK9/OBPY5aypII6RaO02OENb50nUq UW60J3QHK/yI011mTxhIR2QxTcX19k3ccjzLcXJEn9WIaf5DUy1ytwUNofLTBDPLZuOf JydWLAKMSeIpPbhmRevuP3fTq5YZWtFhJ+Y2WRIuQySWF/jdHzhH7cJu+G3c47w4/lTN bt/1bbjJQSTxAm5oGzIqJkW+RYJwd6F/ybuDkwXFEg7EzbQZGtOKc4QjjD04P2bjHh1Z 9PskMITtgZzuA25DxNAtcXiKjia9cAXSUJIouOYx4Uez7J+F9cw4c/Orna4/ix+VGDm0 fw7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732755352; x=1733360152; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ziTWoMDGGemt4FbzSlGzzl5MJ7+5E+c66t+aoBco/o8=; b=HBVGrW0ioctDhfqRyyZbt6tHFBqGK4IO8yHrN9UNdf1L321A3mcJ+QgpbSmC7AxPA4 yQwoF8rA3NnYOVl9P8tJW/JyX3JlxdlvMaYUBOJdeyhbU1q52+Wa7u+e5ZpEoM90aeHv Nfm0489pEKIsusXIjDJfv/2HR7PZyGY3aB5PNPFBRhoUjEvaF1yVqgt4Bb3szp3zs65W D7BFkb+T+tGu8gDTy2thTcdlFgDLT2t/Nar9hhzI4g7xzXpLd3O1ed5yf/M4Bt/yT8Qp 9uFD5bGRkPKtjk3fKQfIFD6VQG59o8cRvB1r5ztzieWpCN0DxWsrY6YP2a5HR0lolh+V 7UbQ== X-Forwarded-Encrypted: i=1; AJvYcCUBVYWZQm60CPNBGyIYQMwncfbcFlTI1WmJp6ac5ap2bBPtyv0440vAiewk4b3ybHmTsgtQfaQIE3ULi/Y=@vger.kernel.org X-Gm-Message-State: AOJu0YyKzjH1b7N+CbqHAJ4/miCgEpUd8s5SroNA/Rs5/M863oyuM+yY bigGqzarQAOqhl/5hYt5jkakpPxMWK0crD0fnj/qGXOuKt8oGuLpHpgdvtKuUHYPCVI1mf5PiQU UQA== X-Google-Smtp-Source: AGHT+IGFU4JhoxY8Wl9h7ACp8Vt7EFu0qd1J8Nu7Xlwl+xjZW64YiOpSApDQOPp2K//2LZM+CyuzFG/tlB0= X-Received: from pjbnc6.prod.google.com ([2002:a17:90b:37c6:b0:2e2:93e2:fe46]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:2252:b0:2ea:8b06:ffcb with SMTP id 98e67ed59e1d1-2ee08eb2b91mr6443403a91.14.1732755351961; Wed, 27 Nov 2024 16:55:51 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 27 Nov 2024 16:55:32 -0800 In-Reply-To: <20241128005547.4077116-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241128005547.4077116-1-seanjc@google.com> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog Message-ID: <20241128005547.4077116-2-seanjc@google.com> Subject: [PATCH v4 01/16] KVM: Move KVM_REG_SIZE() definition to common uAPI header From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Paolo Bonzini , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Sean Christopherson Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Jones , James Houghton , Muhammad Usama Anjum Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Define KVM_REG_SIZE() in the common kvm.h header, and delete the arm64 and RISC-V versions. As evidenced by the surrounding definitions, all aspects of the register size encoding are generic, i.e. RISC-V should have moved arm64's definition to common code instead of copy+pasting. Acked-by: Anup Patel Reviewed-by: Andrew Jones Signed-off-by: Sean Christopherson Reviewed-by: Muhammad Usama Anjum --- arch/arm64/include/uapi/asm/kvm.h | 3 --- arch/riscv/include/uapi/asm/kvm.h | 3 --- include/uapi/linux/kvm.h | 4 ++++ 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/as= m/kvm.h index 66736ff04011..568bf858f319 100644 --- a/arch/arm64/include/uapi/asm/kvm.h +++ b/arch/arm64/include/uapi/asm/kvm.h @@ -43,9 +43,6 @@ #define KVM_COALESCED_MMIO_PAGE_OFFSET 1 #define KVM_DIRTY_LOG_PAGE_OFFSET 64 =20 -#define KVM_REG_SIZE(id) \ - (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT)) - struct kvm_regs { struct user_pt_regs regs; /* sp =3D sp_el0 */ =20 diff --git a/arch/riscv/include/uapi/asm/kvm.h b/arch/riscv/include/uapi/as= m/kvm.h index 3482c9a73d1b..9f60d6185077 100644 --- a/arch/riscv/include/uapi/asm/kvm.h +++ b/arch/riscv/include/uapi/asm/kvm.h @@ -211,9 +211,6 @@ struct kvm_riscv_sbi_sta { #define KVM_RISCV_TIMER_STATE_OFF 0 #define KVM_RISCV_TIMER_STATE_ON 1 =20 -#define KVM_REG_SIZE(id) \ - (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT)) - /* If you need to interpret the index values, here is the key: */ #define KVM_REG_RISCV_TYPE_MASK 0x00000000FF000000 #define KVM_REG_RISCV_TYPE_SHIFT 24 diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index 502ea63b5d2e..343de0a51797 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -1070,6 +1070,10 @@ struct kvm_dirty_tlb { =20 #define KVM_REG_SIZE_SHIFT 52 #define KVM_REG_SIZE_MASK 0x00f0000000000000ULL + +#define KVM_REG_SIZE(id) \ + (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT)) + #define KVM_REG_SIZE_U8 0x0000000000000000ULL #define KVM_REG_SIZE_U16 0x0010000000000000ULL #define KVM_REG_SIZE_U32 0x0020000000000000ULL --=20 2.47.0.338.g60cca15819-goog From nobody Sat Feb 7 17:04:38 2026 Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D63D17BA3 for ; Thu, 28 Nov 2024 00:55:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755357; cv=none; b=HUhZAk8FeECQEBEQ0XxbboXYfVj+Fl8DHt9kUXOY1bvuxRvtjgTHu5W4m98VM+OkS39IBnnxXdiP86fGRD9r6azAVeyw2z/Qa4wkufXOP26VrM8wE+6BRBYAsuJL/adhuVKRVGMMaxFDHkI1vfNbTCVRA38ftC4wAKnwLyEUsYw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755357; c=relaxed/simple; bh=KfL86aK95kABebgmXDhLxFy91wkVN7F+1/UTCVu6lS4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=M+tPiw+gTL/4N8rDYsTMu4er8Gr4DfbGMJHWqqlpVzjl4nWmzywS6P6GAAv+k1MEe8e9Tm6npuF5o080XwloM7eIwNYoFm6PH989MQys/K4KJTQTVATjAL9AwTaKH3Ikkt/LvtjjkXLJ7TcvjgZYV7oP9Ap23X4Za2fc+HJMbOE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=1WU4w3ES; arc=none smtp.client-ip=209.85.210.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="1WU4w3ES" Received: by mail-pf1-f201.google.com with SMTP id d2e1a72fcca58-724f6189a4aso397596b3a.3 for ; Wed, 27 Nov 2024 16:55:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1732755353; x=1733360153; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=hUJoIG4ooOOJeLW5gHRgPXh+a+5uli9bCgSmb43sp80=; b=1WU4w3ES0ieRJ2+HdkE++NbZ9mg1UicBy3fnnBOpSopt2734WBPVotK4mLXi8vk/nR Z4ySu0SnBj0IFXTCr1ylDM91XEg2GPp8cYrAOg4U8YJwx1C16XrGJnMrEIHHAECqlLNu bueh0zVte/X8i45sVAUkZqR8jr2kCsIDoDNsj2khndZ8wRdfJMM3Jb3ZBmNEWlxgAeHX iHGGsM86AVFaHTbKQDQRtUlr2CZ54CuPIGPyXjDTpKby4ue6B4flBI+8w6KEr8suojYO q6/03qqniTtKu1A4ijGAwsZjbClMnCa+875NJcEWm0d0KLNVAEvQtLQMB8u4QYH1VtMG sr0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732755353; x=1733360153; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hUJoIG4ooOOJeLW5gHRgPXh+a+5uli9bCgSmb43sp80=; b=nV7rLy66nbWYWwUnHhtYpx6mnbjUCv+qMjSHJy4M7AUj5gOGmb8PqTmLhxULWCyWgk EuqQ6hYqgCqNTgY4MDmCccPL0cyj8eXaF4ecGJ7a8h7XJ3qstUPc422RZA9RJNLUHCdP XZXQ0gwIn7XuzmzG8LLzxVufvCsWEh8mWFve5JZORNW5t75DUbJcHu5/cDkFEeu8BuhW hTsF+x3+N7yXkfCNLsH0sDSvIW7DchRF1VuSyMK5GjsUUxT9ZG6V2Qz7TrJV9kETC0oK 79m4R81rBDGgVbt6cGUwoFDXMhdC7S0YMEGf+0qgJUqsleX7yowDv/j5rsp35SaAQVTR 9Gdw== X-Forwarded-Encrypted: i=1; AJvYcCV5rIvpHcXsxCzpU4rzUPPWWCmuzmNjdypgu5NKq5ugnv4J2h+uccOyNpUhXb4lqC5u1KJoaGUrkGRLKj4=@vger.kernel.org X-Gm-Message-State: AOJu0YzGJRP31xDTFA5mpHsArb2x8fWT09GIkTUal+vF997yPxjUFzyK sSImU2X2XBqYOwMrzDzWSL4P4AybX01CVhXrpWIthqwqPGtcmJhk19DChdZRoPGFyUfia1TYmjU 61Q== X-Google-Smtp-Source: AGHT+IEwSysZdMmhUM8EqTms1M3Ie2OhTqGNwaHEu2mi7Uv3ln3sAAnUKV+CZE7+COND5+XmChSwuGBuoRw= X-Received: from pgcv7.prod.google.com ([2002:a05:6a02:5307:b0:7fc:2484:201b]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a20:734a:b0:1e0:d1f7:9437 with SMTP id adf61e73a8af0-1e0e0b80369mr6616207637.38.1732755353530; Wed, 27 Nov 2024 16:55:53 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 27 Nov 2024 16:55:33 -0800 In-Reply-To: <20241128005547.4077116-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241128005547.4077116-1-seanjc@google.com> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog Message-ID: <20241128005547.4077116-3-seanjc@google.com> Subject: [PATCH v4 02/16] KVM: selftests: Return a value from vcpu_get_reg() instead of using an out-param From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Paolo Bonzini , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Sean Christopherson Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Jones , James Houghton , Muhammad Usama Anjum Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Return a uint64_t from vcpu_get_reg() instead of having the caller provide a pointer to storage, as none of the vcpu_get_reg() usage in KVM selftests accesses a register larger than 64 bits, and vcpu_set_reg() only accepts a 64-bit value. If a use case comes along that needs to get a register that is larger than 64 bits, then a utility can be added to assert success and take a void pointer, but until then, forcing an out param yields ugly code and prevents feeding the output of vcpu_get_reg() into vcpu_set_reg(). Reviewed-by: Andrew Jones Signed-off-by: Sean Christopherson Acked-by: Claudio Imbrenda --- .../selftests/kvm/aarch64/aarch32_id_regs.c | 10 +-- .../selftests/kvm/aarch64/debug-exceptions.c | 4 +- .../selftests/kvm/aarch64/hypercalls.c | 6 +- .../selftests/kvm/aarch64/no-vgic-v3.c | 2 +- .../testing/selftests/kvm/aarch64/psci_test.c | 6 +- .../selftests/kvm/aarch64/set_id_regs.c | 18 ++--- .../kvm/aarch64/vpmu_counter_access.c | 19 +++--- .../testing/selftests/kvm/include/kvm_util.h | 6 +- .../selftests/kvm/lib/aarch64/processor.c | 8 +-- .../selftests/kvm/lib/riscv/processor.c | 66 +++++++++---------- .../testing/selftests/kvm/riscv/arch_timer.c | 2 +- .../testing/selftests/kvm/riscv/ebreak_test.c | 2 +- .../selftests/kvm/riscv/sbi_pmu_test.c | 2 +- tools/testing/selftests/kvm/s390x/resets.c | 2 +- tools/testing/selftests/kvm/steal_time.c | 3 +- 15 files changed, 78 insertions(+), 78 deletions(-) diff --git a/tools/testing/selftests/kvm/aarch64/aarch32_id_regs.c b/tools/= testing/selftests/kvm/aarch64/aarch32_id_regs.c index 8e5bd07a3727..447d61cae4db 100644 --- a/tools/testing/selftests/kvm/aarch64/aarch32_id_regs.c +++ b/tools/testing/selftests/kvm/aarch64/aarch32_id_regs.c @@ -97,7 +97,7 @@ static void test_user_raz_wi(struct kvm_vcpu *vcpu) uint64_t reg_id =3D raz_wi_reg_ids[i]; uint64_t val; =20 - vcpu_get_reg(vcpu, reg_id, &val); + val =3D vcpu_get_reg(vcpu, reg_id); TEST_ASSERT_EQ(val, 0); =20 /* @@ -106,7 +106,7 @@ static void test_user_raz_wi(struct kvm_vcpu *vcpu) */ vcpu_set_reg(vcpu, reg_id, BAD_ID_REG_VAL); =20 - vcpu_get_reg(vcpu, reg_id, &val); + val =3D vcpu_get_reg(vcpu, reg_id); TEST_ASSERT_EQ(val, 0); } } @@ -126,14 +126,14 @@ static void test_user_raz_invariant(struct kvm_vcpu *= vcpu) uint64_t reg_id =3D raz_invariant_reg_ids[i]; uint64_t val; =20 - vcpu_get_reg(vcpu, reg_id, &val); + val =3D vcpu_get_reg(vcpu, reg_id); TEST_ASSERT_EQ(val, 0); =20 r =3D __vcpu_set_reg(vcpu, reg_id, BAD_ID_REG_VAL); TEST_ASSERT(r < 0 && errno =3D=3D EINVAL, "unexpected KVM_SET_ONE_REG error: r=3D%d, errno=3D%d", r, errno); =20 - vcpu_get_reg(vcpu, reg_id, &val); + val =3D vcpu_get_reg(vcpu, reg_id); TEST_ASSERT_EQ(val, 0); } } @@ -144,7 +144,7 @@ static bool vcpu_aarch64_only(struct kvm_vcpu *vcpu) { uint64_t val, el0; =20 - vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_ID_AA64PFR0_EL1), &val); + val =3D vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_ID_AA64PFR0_EL1)); =20 el0 =3D FIELD_GET(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL0), val); return el0 =3D=3D ID_AA64PFR0_EL1_ELx_64BIT_ONLY; diff --git a/tools/testing/selftests/kvm/aarch64/debug-exceptions.c b/tools= /testing/selftests/kvm/aarch64/debug-exceptions.c index ff7a949fc96a..c7fb55c9135b 100644 --- a/tools/testing/selftests/kvm/aarch64/debug-exceptions.c +++ b/tools/testing/selftests/kvm/aarch64/debug-exceptions.c @@ -501,7 +501,7 @@ void test_single_step_from_userspace(int test_cnt) TEST_ASSERT(ss_enable, "Unexpected KVM_EXIT_DEBUG"); =20 /* Check if the current pc is expected. */ - vcpu_get_reg(vcpu, ARM64_CORE_REG(regs.pc), &pc); + pc =3D vcpu_get_reg(vcpu, ARM64_CORE_REG(regs.pc)); TEST_ASSERT(!test_pc || pc =3D=3D test_pc, "Unexpected pc 0x%lx (expected 0x%lx)", pc, test_pc); @@ -583,7 +583,7 @@ int main(int argc, char *argv[]) uint64_t aa64dfr0; =20 vm =3D vm_create_with_one_vcpu(&vcpu, guest_code); - vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_ID_AA64DFR0_EL1), &aa64dfr0); + aa64dfr0 =3D vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_ID_AA64DFR0_EL1)); __TEST_REQUIRE(debug_version(aa64dfr0) >=3D 6, "Armv8 debug architecture not supported."); kvm_vm_free(vm); diff --git a/tools/testing/selftests/kvm/aarch64/hypercalls.c b/tools/testi= ng/selftests/kvm/aarch64/hypercalls.c index 9d192ce0078d..ec54ec7726e9 100644 --- a/tools/testing/selftests/kvm/aarch64/hypercalls.c +++ b/tools/testing/selftests/kvm/aarch64/hypercalls.c @@ -173,7 +173,7 @@ static void test_fw_regs_before_vm_start(struct kvm_vcp= u *vcpu) const struct kvm_fw_reg_info *reg_info =3D &fw_reg_info[i]; =20 /* First 'read' should be an upper limit of the features supported */ - vcpu_get_reg(vcpu, reg_info->reg, &val); + val =3D vcpu_get_reg(vcpu, reg_info->reg); TEST_ASSERT(val =3D=3D FW_REG_ULIMIT_VAL(reg_info->max_feat_bit), "Expected all the features to be set for reg: 0x%lx; expected: 0x%lx; r= ead: 0x%lx", reg_info->reg, FW_REG_ULIMIT_VAL(reg_info->max_feat_bit), val); @@ -184,7 +184,7 @@ static void test_fw_regs_before_vm_start(struct kvm_vcp= u *vcpu) "Failed to clear all the features of reg: 0x%lx; ret: %d", reg_info->reg, errno); =20 - vcpu_get_reg(vcpu, reg_info->reg, &val); + val =3D vcpu_get_reg(vcpu, reg_info->reg); TEST_ASSERT(val =3D=3D 0, "Expected all the features to be cleared for reg: 0x%lx", reg_info->reg= ); =20 @@ -214,7 +214,7 @@ static void test_fw_regs_after_vm_start(struct kvm_vcpu= *vcpu) * Before starting the VM, the test clears all the bits. * Check if that's still the case. */ - vcpu_get_reg(vcpu, reg_info->reg, &val); + val =3D vcpu_get_reg(vcpu, reg_info->reg); TEST_ASSERT(val =3D=3D 0, "Expected all the features to be cleared for reg: 0x%lx", reg_info->reg); diff --git a/tools/testing/selftests/kvm/aarch64/no-vgic-v3.c b/tools/testi= ng/selftests/kvm/aarch64/no-vgic-v3.c index 58304bbc2036..ebd70430c89d 100644 --- a/tools/testing/selftests/kvm/aarch64/no-vgic-v3.c +++ b/tools/testing/selftests/kvm/aarch64/no-vgic-v3.c @@ -164,7 +164,7 @@ int main(int argc, char *argv[]) uint64_t pfr0; =20 vm =3D vm_create_with_one_vcpu(&vcpu, NULL); - vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_ID_AA64PFR0_EL1), &pfr0); + pfr0 =3D vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_ID_AA64PFR0_EL1)); __TEST_REQUIRE(FIELD_GET(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_GIC), pfr0), "GICv3 not supported."); kvm_vm_free(vm); diff --git a/tools/testing/selftests/kvm/aarch64/psci_test.c b/tools/testin= g/selftests/kvm/aarch64/psci_test.c index eaa7655fefc1..0ab7d5a24482 100644 --- a/tools/testing/selftests/kvm/aarch64/psci_test.c +++ b/tools/testing/selftests/kvm/aarch64/psci_test.c @@ -111,8 +111,8 @@ static void assert_vcpu_reset(struct kvm_vcpu *vcpu) { uint64_t obs_pc, obs_x0; =20 - vcpu_get_reg(vcpu, ARM64_CORE_REG(regs.pc), &obs_pc); - vcpu_get_reg(vcpu, ARM64_CORE_REG(regs.regs[0]), &obs_x0); + obs_pc =3D vcpu_get_reg(vcpu, ARM64_CORE_REG(regs.pc)); + obs_x0 =3D vcpu_get_reg(vcpu, ARM64_CORE_REG(regs.regs[0])); =20 TEST_ASSERT(obs_pc =3D=3D CPU_ON_ENTRY_ADDR, "unexpected target cpu pc: %lx (expected: %lx)", @@ -152,7 +152,7 @@ static void host_test_cpu_on(void) */ vcpu_power_off(target); =20 - vcpu_get_reg(target, KVM_ARM64_SYS_REG(SYS_MPIDR_EL1), &target_mpidr); + target_mpidr =3D vcpu_get_reg(target, KVM_ARM64_SYS_REG(SYS_MPIDR_EL1)); vcpu_args_set(source, 1, target_mpidr & MPIDR_HWID_BITMASK); enter_guest(source); =20 diff --git a/tools/testing/selftests/kvm/aarch64/set_id_regs.c b/tools/test= ing/selftests/kvm/aarch64/set_id_regs.c index a79b7f18452d..25ba7d382196 100644 --- a/tools/testing/selftests/kvm/aarch64/set_id_regs.c +++ b/tools/testing/selftests/kvm/aarch64/set_id_regs.c @@ -346,7 +346,7 @@ static uint64_t test_reg_set_success(struct kvm_vcpu *v= cpu, uint64_t reg, uint64_t mask =3D ftr_bits->mask; uint64_t val, new_val, ftr; =20 - vcpu_get_reg(vcpu, reg, &val); + val =3D vcpu_get_reg(vcpu, reg); ftr =3D (val & mask) >> shift; =20 ftr =3D get_safe_value(ftr_bits, ftr); @@ -356,7 +356,7 @@ static uint64_t test_reg_set_success(struct kvm_vcpu *v= cpu, uint64_t reg, val |=3D ftr; =20 vcpu_set_reg(vcpu, reg, val); - vcpu_get_reg(vcpu, reg, &new_val); + new_val =3D vcpu_get_reg(vcpu, reg); TEST_ASSERT_EQ(new_val, val); =20 return new_val; @@ -370,7 +370,7 @@ static void test_reg_set_fail(struct kvm_vcpu *vcpu, ui= nt64_t reg, uint64_t val, old_val, ftr; int r; =20 - vcpu_get_reg(vcpu, reg, &val); + val =3D vcpu_get_reg(vcpu, reg); ftr =3D (val & mask) >> shift; =20 ftr =3D get_invalid_value(ftr_bits, ftr); @@ -384,7 +384,7 @@ static void test_reg_set_fail(struct kvm_vcpu *vcpu, ui= nt64_t reg, TEST_ASSERT(r < 0 && errno =3D=3D EINVAL, "Unexpected KVM_SET_ONE_REG error: r=3D%d, errno=3D%d", r, errno); =20 - vcpu_get_reg(vcpu, reg, &val); + val =3D vcpu_get_reg(vcpu, reg); TEST_ASSERT_EQ(val, old_val); } =20 @@ -576,7 +576,7 @@ static void test_clidr(struct kvm_vcpu *vcpu) uint64_t clidr; int level; =20 - vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_CLIDR_EL1), &clidr); + clidr =3D vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_CLIDR_EL1)); =20 /* find the first empty level in the cache hierarchy */ for (level =3D 1; level < 7; level++) { @@ -601,7 +601,7 @@ static void test_ctr(struct kvm_vcpu *vcpu) { u64 ctr; =20 - vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_CTR_EL0), &ctr); + ctr =3D vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_CTR_EL0)); ctr &=3D ~CTR_EL0_DIC_MASK; if (ctr & CTR_EL0_IminLine_MASK) ctr--; @@ -617,7 +617,7 @@ static void test_vcpu_ftr_id_regs(struct kvm_vcpu *vcpu) test_clidr(vcpu); test_ctr(vcpu); =20 - vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_MPIDR_EL1), &val); + val =3D vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_MPIDR_EL1)); val++; vcpu_set_reg(vcpu, KVM_ARM64_SYS_REG(SYS_MPIDR_EL1), val); =20 @@ -630,7 +630,7 @@ static void test_assert_id_reg_unchanged(struct kvm_vcp= u *vcpu, uint32_t encodin size_t idx =3D encoding_to_range_idx(encoding); uint64_t observed; =20 - vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(encoding), &observed); + observed =3D vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(encoding)); TEST_ASSERT_EQ(test_reg_vals[idx], observed); } =20 @@ -665,7 +665,7 @@ int main(void) vm =3D vm_create_with_one_vcpu(&vcpu, guest_code); =20 /* Check for AARCH64 only system */ - vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_ID_AA64PFR0_EL1), &val); + val =3D vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_ID_AA64PFR0_EL1)); el0 =3D FIELD_GET(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL0), val); aarch64_only =3D (el0 =3D=3D ID_AA64PFR0_EL1_ELx_64BIT_ONLY); =20 diff --git a/tools/testing/selftests/kvm/aarch64/vpmu_counter_access.c b/to= ols/testing/selftests/kvm/aarch64/vpmu_counter_access.c index f9c0c86d7e85..f16b3b27e32e 100644 --- a/tools/testing/selftests/kvm/aarch64/vpmu_counter_access.c +++ b/tools/testing/selftests/kvm/aarch64/vpmu_counter_access.c @@ -440,8 +440,7 @@ static void create_vpmu_vm(void *guest_code) "Failed to create vgic-v3, skipping"); =20 /* Make sure that PMUv3 support is indicated in the ID register */ - vcpu_get_reg(vpmu_vm.vcpu, - KVM_ARM64_SYS_REG(SYS_ID_AA64DFR0_EL1), &dfr0); + dfr0 =3D vcpu_get_reg(vpmu_vm.vcpu, KVM_ARM64_SYS_REG(SYS_ID_AA64DFR0_EL1= )); pmuver =3D FIELD_GET(ARM64_FEATURE_MASK(ID_AA64DFR0_EL1_PMUVer), dfr0); TEST_ASSERT(pmuver !=3D ID_AA64DFR0_EL1_PMUVer_IMP_DEF && pmuver >=3D ID_AA64DFR0_EL1_PMUVer_IMP, @@ -484,7 +483,7 @@ static void test_create_vpmu_vm_with_pmcr_n(uint64_t pm= cr_n, bool expect_fail) create_vpmu_vm(guest_code); vcpu =3D vpmu_vm.vcpu; =20 - vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_PMCR_EL0), &pmcr_orig); + pmcr_orig =3D vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_PMCR_EL0)); pmcr =3D pmcr_orig; =20 /* @@ -493,7 +492,7 @@ static void test_create_vpmu_vm_with_pmcr_n(uint64_t pm= cr_n, bool expect_fail) */ set_pmcr_n(&pmcr, pmcr_n); vcpu_set_reg(vcpu, KVM_ARM64_SYS_REG(SYS_PMCR_EL0), pmcr); - vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_PMCR_EL0), &pmcr); + pmcr =3D vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_PMCR_EL0)); =20 if (expect_fail) TEST_ASSERT(pmcr_orig =3D=3D pmcr, @@ -521,7 +520,7 @@ static void run_access_test(uint64_t pmcr_n) vcpu =3D vpmu_vm.vcpu; =20 /* Save the initial sp to restore them later to run the guest again */ - vcpu_get_reg(vcpu, ARM64_CORE_REG(sp_el1), &sp); + sp =3D vcpu_get_reg(vcpu, ARM64_CORE_REG(sp_el1)); =20 run_vcpu(vcpu, pmcr_n); =20 @@ -572,12 +571,12 @@ static void run_pmregs_validity_test(uint64_t pmcr_n) * Test if the 'set' and 'clr' variants of the registers * are initialized based on the number of valid counters. */ - vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(set_reg_id), ®_val); + reg_val =3D vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(set_reg_id)); TEST_ASSERT((reg_val & (~valid_counters_mask)) =3D=3D 0, "Initial read of set_reg: 0x%llx has unimplemented counters enabled= : 0x%lx", KVM_ARM64_SYS_REG(set_reg_id), reg_val); =20 - vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(clr_reg_id), ®_val); + reg_val =3D vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(clr_reg_id)); TEST_ASSERT((reg_val & (~valid_counters_mask)) =3D=3D 0, "Initial read of clr_reg: 0x%llx has unimplemented counters enabled= : 0x%lx", KVM_ARM64_SYS_REG(clr_reg_id), reg_val); @@ -589,12 +588,12 @@ static void run_pmregs_validity_test(uint64_t pmcr_n) */ vcpu_set_reg(vcpu, KVM_ARM64_SYS_REG(set_reg_id), max_counters_mask); =20 - vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(set_reg_id), ®_val); + reg_val =3D vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(set_reg_id)); TEST_ASSERT((reg_val & (~valid_counters_mask)) =3D=3D 0, "Read of set_reg: 0x%llx has unimplemented counters enabled: 0x%lx", KVM_ARM64_SYS_REG(set_reg_id), reg_val); =20 - vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(clr_reg_id), ®_val); + reg_val =3D vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(clr_reg_id)); TEST_ASSERT((reg_val & (~valid_counters_mask)) =3D=3D 0, "Read of clr_reg: 0x%llx has unimplemented counters enabled: 0x%lx", KVM_ARM64_SYS_REG(clr_reg_id), reg_val); @@ -625,7 +624,7 @@ static uint64_t get_pmcr_n_limit(void) uint64_t pmcr; =20 create_vpmu_vm(guest_code); - vcpu_get_reg(vpmu_vm.vcpu, KVM_ARM64_SYS_REG(SYS_PMCR_EL0), &pmcr); + pmcr =3D vcpu_get_reg(vpmu_vm.vcpu, KVM_ARM64_SYS_REG(SYS_PMCR_EL0)); destroy_vpmu_vm(); return get_pmcr_n(pmcr); } diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing= /selftests/kvm/include/kvm_util.h index bc7c242480d6..287a3ec06df4 100644 --- a/tools/testing/selftests/kvm/include/kvm_util.h +++ b/tools/testing/selftests/kvm/include/kvm_util.h @@ -702,11 +702,13 @@ static inline int __vcpu_set_reg(struct kvm_vcpu *vcp= u, uint64_t id, uint64_t va =20 return __vcpu_ioctl(vcpu, KVM_SET_ONE_REG, ®); } -static inline void vcpu_get_reg(struct kvm_vcpu *vcpu, uint64_t id, void *= addr) +static inline uint64_t vcpu_get_reg(struct kvm_vcpu *vcpu, uint64_t id) { - struct kvm_one_reg reg =3D { .id =3D id, .addr =3D (uint64_t)addr }; + uint64_t val; + struct kvm_one_reg reg =3D { .id =3D id, .addr =3D (uint64_t)&val }; =20 vcpu_ioctl(vcpu, KVM_GET_ONE_REG, ®); + return val; } static inline void vcpu_set_reg(struct kvm_vcpu *vcpu, uint64_t id, uint64= _t val) { diff --git a/tools/testing/selftests/kvm/lib/aarch64/processor.c b/tools/te= sting/selftests/kvm/lib/aarch64/processor.c index 698e34f39241..7ba3aa3755f3 100644 --- a/tools/testing/selftests/kvm/lib/aarch64/processor.c +++ b/tools/testing/selftests/kvm/lib/aarch64/processor.c @@ -281,8 +281,8 @@ void aarch64_vcpu_setup(struct kvm_vcpu *vcpu, struct k= vm_vcpu_init *init) */ vcpu_set_reg(vcpu, KVM_ARM64_SYS_REG(SYS_CPACR_EL1), 3 << 20); =20 - vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_SCTLR_EL1), &sctlr_el1); - vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_TCR_EL1), &tcr_el1); + sctlr_el1 =3D vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_SCTLR_EL1)); + tcr_el1 =3D vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_TCR_EL1)); =20 /* Configure base granule size */ switch (vm->mode) { @@ -360,8 +360,8 @@ void vcpu_arch_dump(FILE *stream, struct kvm_vcpu *vcpu= , uint8_t indent) { uint64_t pstate, pc; =20 - vcpu_get_reg(vcpu, ARM64_CORE_REG(regs.pstate), &pstate); - vcpu_get_reg(vcpu, ARM64_CORE_REG(regs.pc), &pc); + pstate =3D vcpu_get_reg(vcpu, ARM64_CORE_REG(regs.pstate)); + pc =3D vcpu_get_reg(vcpu, ARM64_CORE_REG(regs.pc)); =20 fprintf(stream, "%*spstate: 0x%.16lx pc: 0x%.16lx\n", indent, "", pstate, pc); diff --git a/tools/testing/selftests/kvm/lib/riscv/processor.c b/tools/test= ing/selftests/kvm/lib/riscv/processor.c index 6ae47b3d6b25..dd663bcf0cc0 100644 --- a/tools/testing/selftests/kvm/lib/riscv/processor.c +++ b/tools/testing/selftests/kvm/lib/riscv/processor.c @@ -221,39 +221,39 @@ void vcpu_arch_dump(FILE *stream, struct kvm_vcpu *vc= pu, uint8_t indent) { struct kvm_riscv_core core; =20 - vcpu_get_reg(vcpu, RISCV_CORE_REG(mode), &core.mode); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.pc), &core.regs.pc); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.ra), &core.regs.ra); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.sp), &core.regs.sp); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.gp), &core.regs.gp); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.tp), &core.regs.tp); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.t0), &core.regs.t0); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.t1), &core.regs.t1); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.t2), &core.regs.t2); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.s0), &core.regs.s0); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.s1), &core.regs.s1); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.a0), &core.regs.a0); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.a1), &core.regs.a1); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.a2), &core.regs.a2); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.a3), &core.regs.a3); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.a4), &core.regs.a4); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.a5), &core.regs.a5); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.a6), &core.regs.a6); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.a7), &core.regs.a7); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.s2), &core.regs.s2); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.s3), &core.regs.s3); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.s4), &core.regs.s4); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.s5), &core.regs.s5); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.s6), &core.regs.s6); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.s7), &core.regs.s7); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.s8), &core.regs.s8); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.s9), &core.regs.s9); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.s10), &core.regs.s10); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.s11), &core.regs.s11); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.t3), &core.regs.t3); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.t4), &core.regs.t4); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.t5), &core.regs.t5); - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.t6), &core.regs.t6); + core.mode =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(mode)); + core.regs.pc =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.pc)); + core.regs.ra =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.ra)); + core.regs.sp =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.sp)); + core.regs.gp =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.gp)); + core.regs.tp =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.tp)); + core.regs.t0 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.t0)); + core.regs.t1 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.t1)); + core.regs.t2 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.t2)); + core.regs.s0 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.s0)); + core.regs.s1 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.s1)); + core.regs.a0 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.a0)); + core.regs.a1 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.a1)); + core.regs.a2 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.a2)); + core.regs.a3 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.a3)); + core.regs.a4 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.a4)); + core.regs.a5 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.a5)); + core.regs.a6 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.a6)); + core.regs.a7 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.a7)); + core.regs.s2 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.s2)); + core.regs.s3 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.s3)); + core.regs.s4 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.s4)); + core.regs.s5 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.s5)); + core.regs.s6 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.s6)); + core.regs.s7 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.s7)); + core.regs.s8 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.s8)); + core.regs.s9 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.s9)); + core.regs.s10 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.s10)); + core.regs.s11 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.s11)); + core.regs.t3 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.t3)); + core.regs.t4 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.t4)); + core.regs.t5 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.t5)); + core.regs.t6 =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.t6)); =20 fprintf(stream, " MODE: 0x%lx\n", core.mode); diff --git a/tools/testing/selftests/kvm/riscv/arch_timer.c b/tools/testing= /selftests/kvm/riscv/arch_timer.c index 2c792228ac0b..9e370800a6a2 100644 --- a/tools/testing/selftests/kvm/riscv/arch_timer.c +++ b/tools/testing/selftests/kvm/riscv/arch_timer.c @@ -93,7 +93,7 @@ struct kvm_vm *test_vm_create(void) vcpu_init_vector_tables(vcpus[i]); =20 /* Initialize guest timer frequency. */ - vcpu_get_reg(vcpus[0], RISCV_TIMER_REG(frequency), &timer_freq); + timer_freq =3D vcpu_get_reg(vcpus[0], RISCV_TIMER_REG(frequency)); sync_global_to_guest(vm, timer_freq); pr_debug("timer_freq: %lu\n", timer_freq); =20 diff --git a/tools/testing/selftests/kvm/riscv/ebreak_test.c b/tools/testin= g/selftests/kvm/riscv/ebreak_test.c index 0e0712854953..cfed6c727bfc 100644 --- a/tools/testing/selftests/kvm/riscv/ebreak_test.c +++ b/tools/testing/selftests/kvm/riscv/ebreak_test.c @@ -60,7 +60,7 @@ int main(void) =20 TEST_ASSERT_KVM_EXIT_REASON(vcpu, KVM_EXIT_DEBUG); =20 - vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.pc), &pc); + pc =3D vcpu_get_reg(vcpu, RISCV_CORE_REG(regs.pc)); TEST_ASSERT_EQ(pc, LABEL_ADDRESS(sw_bp_1)); =20 /* skip sw_bp_1 */ diff --git a/tools/testing/selftests/kvm/riscv/sbi_pmu_test.c b/tools/testi= ng/selftests/kvm/riscv/sbi_pmu_test.c index f299cbfd23ca..f45c0ecc902d 100644 --- a/tools/testing/selftests/kvm/riscv/sbi_pmu_test.c +++ b/tools/testing/selftests/kvm/riscv/sbi_pmu_test.c @@ -608,7 +608,7 @@ static void test_vm_events_overflow(void *guest_code) =20 vcpu_init_vector_tables(vcpu); /* Initialize guest timer frequency. */ - vcpu_get_reg(vcpu, RISCV_TIMER_REG(frequency), &timer_freq); + timer_freq =3D vcpu_get_reg(vcpu, RISCV_TIMER_REG(frequency)); sync_global_to_guest(vm, timer_freq); =20 run_vcpu(vcpu); diff --git a/tools/testing/selftests/kvm/s390x/resets.c b/tools/testing/sel= ftests/kvm/s390x/resets.c index 357943f2bea8..b58f75b381e5 100644 --- a/tools/testing/selftests/kvm/s390x/resets.c +++ b/tools/testing/selftests/kvm/s390x/resets.c @@ -61,7 +61,7 @@ static void test_one_reg(struct kvm_vcpu *vcpu, uint64_t = id, uint64_t value) { uint64_t eval_reg; =20 - vcpu_get_reg(vcpu, id, &eval_reg); + eval_reg =3D vcpu_get_reg(vcpu, id); TEST_ASSERT(eval_reg =3D=3D value, "value =3D=3D 0x%lx", value); } =20 diff --git a/tools/testing/selftests/kvm/steal_time.c b/tools/testing/selft= ests/kvm/steal_time.c index a8d3afa0b86b..cce2520af720 100644 --- a/tools/testing/selftests/kvm/steal_time.c +++ b/tools/testing/selftests/kvm/steal_time.c @@ -269,9 +269,8 @@ static void guest_code(int cpu) static bool is_steal_time_supported(struct kvm_vcpu *vcpu) { uint64_t id =3D RISCV_SBI_EXT_REG(KVM_RISCV_SBI_EXT_STA); - unsigned long enabled; + unsigned long enabled =3D vcpu_get_reg(vcpu, id); =20 - vcpu_get_reg(vcpu, id, &enabled); TEST_ASSERT(enabled =3D=3D 0 || enabled =3D=3D 1, "Expected boolean resul= t"); =20 return enabled; --=20 2.47.0.338.g60cca15819-goog From nobody Sat Feb 7 17:04:38 2026 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E851F1DFFB for ; Thu, 28 Nov 2024 00:55:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755357; cv=none; b=UTRKqoyL59Ti8qLwy5xZ7gamr8+QwJa6QhN3L2iv8i37htT827DlZ+1ah5n1zJbIuysPXBSbYBJRynYWXEMA/Gm7J+C/aH3GB8OzNc59nCJec/LM0xhgA5AY2nOhsMnQ1vvizwsy8TcF4AwJDPUEe8JAUg2w1VW7ZSgKGCXpcso= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755357; c=relaxed/simple; bh=/I1QDhTu7A4uX6aQjK9uL6OFtLwJ4Jmbm1md8fy4gPw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=oSXWecEIBh/Y2AxJJlxPuSvb+sJrxBROb2qXGsTeGPEszAFiez7WhdY//CQWRUxHmbbTVBdvBd2NFX4YXDnyDLbgPCtEF9dN9B/oE2sqT9afMgZH0jl3W0zflq7ALai4j+GdkSbWSGq39nNc1gCeY43aRiJTbK4lmRJz/1ticww= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=UgCmZ9iZ; arc=none smtp.client-ip=209.85.216.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="UgCmZ9iZ" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-2ee0f8ecd88so333965a91.1 for ; Wed, 27 Nov 2024 16:55:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1732755355; x=1733360155; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=qVBMujG2OTqdwJQgPPGju5b8tNjOmRcixGV2iZuWWwY=; b=UgCmZ9iZ4JA7nZC57i4q8YFvqd4pfMTFRWrZY5Smb0SfHVQOWhfGZHmJ8pxTdfmbmZ qIr6bKBWxZiaz8iNZblUSLnJvOw88WQD6DSJG4mWkYlTIVQ35f5wMIakY0yclU1VTdkL si3YDnSQ1C6qeDFTaS2vtiK7S45VaaJmVZUaJzEjdPytg7SP/l1mxYQUj1oxmC+UQsmh jHr3bBkLC2akZbDN7w4uKKf5xvvHdC9AnZzrLYsNydKAXWlBpaySbstWwhAkn/s5yYRe z6nPSQu4R012rvR/P8ICe2CLzXDc9LAhk61YMrwR4VYrWimvF623jQmG6mD5oSsDRXX2 W4Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732755355; x=1733360155; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qVBMujG2OTqdwJQgPPGju5b8tNjOmRcixGV2iZuWWwY=; b=h2QbEaZula7THyQkuuGHeqNR3je2kRgk3nM/KAIxLVp9HsDla4fBpLp24wxDcWUJaW v3ezvtZN6C1gNQI7xsR72c6kXopKtYhqdHP8bTc4T5NSFEAHJw0RAy6CTcxyeeK5Islw eR9RW3ch6V/jTW0AREZ2oCYJW7lPvOiWVgPUrmPkWrly8xbXidCvYcVTxlJcfQODMGS4 2XvZaxIH1hDSIwHFp/vfBALk4PALEzgNIUvw13NsTc6+ko2HMPvuztOenOckngvQHm8E CwF42V5FfMaz/KC3LELbHy8iE5nNBdN3Qap2BYGP5vN8Ef5wZLORT46MrVXc6ZE5ORKQ RRKA== X-Forwarded-Encrypted: i=1; AJvYcCWEe6PtktUi54HemdhX94VX7JNE2QHMTKiV2SmbFsK0V0E68Wl7UCId2MHhCc7KOG8eCCbmt0uY9Q9Glx8=@vger.kernel.org X-Gm-Message-State: AOJu0YxOWQUhY6MNHhw7qsQXSvejrxnj8u2B/0OJHCSeEN/P+e3qRJ+h wh7KEzhWKnpQ4tZcCrfuEqAi1C8EKGY+7w0HqknLJlYqMgfAKwNmpK+Qgg38x0zMESLg7SwOx7n rSw== X-Google-Smtp-Source: AGHT+IH+xlYFxzyyjYgkHwbv9v8SXpOlp7wHMGVgiCiV61K5VskA6YHcas7fec5b54n5jx+SjDlTSzyBffA= X-Received: from pjbmf12.prod.google.com ([2002:a17:90b:184c:b0:2d8:8d32:2ea3]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:388b:b0:2ea:7329:4d with SMTP id 98e67ed59e1d1-2ee097ca9damr5929096a91.34.1732755355263; Wed, 27 Nov 2024 16:55:55 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 27 Nov 2024 16:55:34 -0800 In-Reply-To: <20241128005547.4077116-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241128005547.4077116-1-seanjc@google.com> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog Message-ID: <20241128005547.4077116-4-seanjc@google.com> Subject: [PATCH v4 03/16] KVM: selftests: Assert that vcpu_{g,s}et_reg() won't truncate From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Paolo Bonzini , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Sean Christopherson Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Jones , James Houghton , Muhammad Usama Anjum Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Assert that the register being read/written by vcpu_{g,s}et_reg() is no larger than a uint64_t, i.e. that a selftest isn't unintentionally truncating the value being read/written. Ideally, the assert would be done at compile-time, but that would limit the checks to hardcoded accesses and/or require fancier compile-time assertion infrastructure to filter out dynamic usage. Reviewed-by: Andrew Jones Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/include/kvm_util.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing= /selftests/kvm/include/kvm_util.h index 287a3ec06df4..4c4e5a847f67 100644 --- a/tools/testing/selftests/kvm/include/kvm_util.h +++ b/tools/testing/selftests/kvm/include/kvm_util.h @@ -707,6 +707,8 @@ static inline uint64_t vcpu_get_reg(struct kvm_vcpu *vc= pu, uint64_t id) uint64_t val; struct kvm_one_reg reg =3D { .id =3D id, .addr =3D (uint64_t)&val }; =20 + TEST_ASSERT(KVM_REG_SIZE(id) <=3D sizeof(val), "Reg %lx too big", id); + vcpu_ioctl(vcpu, KVM_GET_ONE_REG, ®); return val; } @@ -714,6 +716,8 @@ static inline void vcpu_set_reg(struct kvm_vcpu *vcpu, = uint64_t id, uint64_t val { struct kvm_one_reg reg =3D { .id =3D id, .addr =3D (uint64_t)&val }; =20 + TEST_ASSERT(KVM_REG_SIZE(id) <=3D sizeof(val), "Reg %lx too big", id); + vcpu_ioctl(vcpu, KVM_SET_ONE_REG, ®); } =20 --=20 2.47.0.338.g60cca15819-goog From nobody Sat Feb 7 17:04:38 2026 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB51F2E628 for ; Thu, 28 Nov 2024 00:55:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755359; cv=none; b=GMVXYP2AxqHUUWcbwPFyCUAZ1vt1lIPhuvCMTFM4kkj7HxoYk8FY35DojSb8Eexug1oz0oBoPExIUtNuLhR6giKvwO74rk6Va4OUVuZOTOPl2Vp4s61ACMC3U0wMdNVoG93Yeod77rAfR/jHBr2y9+PgJNLDR6FA7vn3Zkt6jn4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755359; c=relaxed/simple; bh=WNgn4lu1ApV1cGqCgEdQ8UELTIdxvWrpSXPjrrKh+zU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=BLXoD7vF5BWLQRdFkuJDzd3drgPEgioahmwqzLG+zj3sqiee77mlvCrwLJJQqUr3r2pqY42GHsQ/56WhkJng/7ffzuFPcBTwr/bxXKeJQFsERwhHAVnZI+BLf2J94mursg9ABlpQvnGdYVlXN2b/EMlQojPiiyZnmxsVOBTwaP0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=RLmFgQLO; arc=none smtp.client-ip=209.85.216.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="RLmFgQLO" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-2ea4291c177so273536a91.2 for ; Wed, 27 Nov 2024 16:55:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1732755357; x=1733360157; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=VnpBHLYkUch4fOHU4hkMVn/ClZoihkAVUxnB9ZaI9Pw=; b=RLmFgQLOx1T+u6XwqgMuR4WV6xZYBL7N1RNTWPkNLK6+3EK9CbRxbQnQ7h/GbLX/g+ DFjgd+VE/Uaf/2C+DEXgI9HniueFRX0267E+uP+5Ny+WHCnzCalSu//K7PjYzSc70nE+ t6l+1SS9FiX36Xt/4JaIpcrdfEkI3LxiT4SjCDIGt4/kBSdAPuwK3n9fzQX6BzQnn+DI zZhW1oKDTepUIrAurkqLmtChy8l1M1LnFaLkvAFs0Efm1LjACQTzRNAW3+k0kmBH64Il hi4OVR6L5am0FmrYMhDiu74ILHrqjxllrxnTojspjHXxsvNdYVPq7SnL4fmqo9Ad0pis j5bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732755357; x=1733360157; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VnpBHLYkUch4fOHU4hkMVn/ClZoihkAVUxnB9ZaI9Pw=; b=fu2RCEO42JOQ+SW1Nb/h1kWOmrd0SkMRqegeoFw+9KRkqhLHAZJarFNyQtB4GGUzAq HKgGzBi78eKlm/B4N/0GT8Eanf2szLqbSlMCNQ8QH/XR1FvldzS1JlTsKwxGhmfiq7Hn 9fBo4lTmOM6zOz/hB0rQ8kOPdS5A/UQ5efUnOquNby8RJO+AR0WxPqDGKJF60fGlwYEp wo2Qb+ha2/Lw7dZTcWjrdnkNg5cfLbvaJ3Mxqi/An+3lP2pJxnAnosWmVS/woq/x5sOa 4bZulhFxrsVxrIz2hA2WOoY0rS7mZMGIsgVQTEfXZJwJp39Qv9czuzQheRAFuvqCK5mA jk7w== X-Forwarded-Encrypted: i=1; AJvYcCWJJx/Jp0XrQeFMviXjZOAQsvjUEKx5KPWlNTIrMUGGNeoF6fiOTtmtKB36pNrVg+RniQAfq4NTci+r1/4=@vger.kernel.org X-Gm-Message-State: AOJu0YztBhI1ixMy4sYRd3TMux+p7uSpBr0AAAKjcJH0uW2z2/gUcKQq GhX/AH4vUaKPWJbEuTIEs0wcKzxwAvDnnBxJ4Nkx7mGRk7806lXLkdLerS9KtBL+K50wCM3Afp8 erA== X-Google-Smtp-Source: AGHT+IGNjVu9IbM8M8x4FgAf0ptLY31wfGw0nWSewj8xLv7iHu7ExU2Pbfe7utzxkDM6gVPdI3CzS8OquPA= X-Received: from pjbsc10.prod.google.com ([2002:a17:90b:510a:b0:2ea:d2de:f7ca]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90a:fe06:b0:2ea:83a0:4798 with SMTP id 98e67ed59e1d1-2ee08e9f0f7mr7211038a91.3.1732755357079; Wed, 27 Nov 2024 16:55:57 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 27 Nov 2024 16:55:35 -0800 In-Reply-To: <20241128005547.4077116-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241128005547.4077116-1-seanjc@google.com> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog Message-ID: <20241128005547.4077116-5-seanjc@google.com> Subject: [PATCH v4 04/16] KVM: selftests: Check for a potential unhandled exception iff KVM_RUN succeeded From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Paolo Bonzini , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Sean Christopherson Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Jones , James Houghton , Muhammad Usama Anjum Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Don't check for an unhandled exception if KVM_RUN failed, e.g. if it returned errno=3DEFAULT, as reporting unhandled exceptions is done via a ucall, i.e. requires KVM_RUN to exit cleanly. Theoretically, checking for a ucall on a failed KVM_RUN could get a false positive, e.g. if there were stale data in vcpu->run from a previous exit. Reviewed-by: James Houghton Reviewed-by: Andrew Jones Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/lib/kvm_util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/sel= ftests/kvm/lib/kvm_util.c index 480e3a40d197..33fefeb3ca44 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -1648,7 +1648,8 @@ int _vcpu_run(struct kvm_vcpu *vcpu) rc =3D __vcpu_run(vcpu); } while (rc =3D=3D -1 && errno =3D=3D EINTR); =20 - assert_on_unhandled_exception(vcpu); + if (!rc) + assert_on_unhandled_exception(vcpu); =20 return rc; } --=20 2.47.0.338.g60cca15819-goog From nobody Sat Feb 7 17:04:38 2026 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 38CC04CDEC for ; Thu, 28 Nov 2024 00:55:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755360; cv=none; b=RhMP4c1tkNgGZrOCM934LS4+Vbn2xGyt3IUMRfaAdEOsqpDP2XOMF84m3nA8WUWm0cR99Egy+DScgh1XxNV8k2viX6gyAm0aRcyPL3dD0y90QXRhhGOTZeIWmwvnTSm2PQYsbXiblQ3nN3M79LcWrsqUVAkXPBx+cWSIw+Lx/vI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755360; c=relaxed/simple; bh=6/wTQsGJs8irAo/psByDX9+eFhZ+LD4ILASalomr9Cw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=t9rnTGhJlMkBUV+FRgbC4HFjqM+pju3VPrrh4r8kZcLQbaTLxqPzltgtVlSrk7k0ybpRuAjHt91uIqgO/lZFKo1gyIXYXcmHM4orgkSFCwj5Keu7TuVDVsTppxmnapFQhv9dFZgEJmfb0KptASe464wzvXLrPMxvZtEJ9kH9qnc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=IAY2caXQ; arc=none smtp.client-ip=209.85.210.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="IAY2caXQ" Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-724fc3f60c1so413444b3a.2 for ; Wed, 27 Nov 2024 16:55:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1732755359; x=1733360159; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=Qp0x5jmf6wCt1OmSFixie+OQOct6OMtePnY0hHC3FqE=; b=IAY2caXQY2aOj41whTKMWqYPhfetl6lY7LeQQOWuJtul7PCFYaT6r2l9DRvZnDG1n0 0oHEEatyuoK0VXCyyYDaMGTGohJsin6k3ZlvJqMi3DXxX7OXwMy+JPsdZYt+rsZVtSjV 2fbLZm2l1RRAzvvrcJA+kFjGGQHW+D1iEziBMhGOCsQxfPUGkk5Lstip3A8IwL8MtZcS SeWOmeGYjpzq6po3Le20nXfaDMM6LcIwIClCQmIvC3N9u2TgCrKHf5P7JroYQY0nidYo lNbcqsWSLK3aQSVyJZ4UeuSDbfF6OHVhBCqW5WyaK+E1x9LX56Mlrf8qXhYHq8UDISbK 2l2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732755359; x=1733360159; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Qp0x5jmf6wCt1OmSFixie+OQOct6OMtePnY0hHC3FqE=; b=qjlHoayGvdI8NfVOm/k+9ntL4nQmYKHs1si/3Jb7xcigc0GjHmfzHXDHmG9ZUCf/CL EbVmCENUY+lPjBXFJhKM5UME6YWj0BR1kxm1FnRJogVUqrMiypcuWggC/POna0iDXuqk MgNlDvql9HSHd1JiTJFKqvKe+9KA3PZFaSh1sx8PZe0z7yK9bayJ2wUpSa0vpDg3rFSt qeNxMZRjHRmkX1MqRdKyZF1bNXlbWp9WYmtOc40i3MSuwAhsCxJcvSqm8HS0SvPlnFoo yT+VAs7oE7MK4et7w2UVjvvsayigqe+cGwBhbiDuRRDwoopz1sf2qwiar2GwFf2DpXKU BsIQ== X-Forwarded-Encrypted: i=1; AJvYcCVtvZY9dHb4zPe67PN50FxmCZN0ZLxe9MkUyqKDiPC2RfRW/a4P7NmjUqsTnXg9E5qzwbwQ2l/1lODMJaw=@vger.kernel.org X-Gm-Message-State: AOJu0YwcmOLXdELihpwNxlL6LK2qwWpZzvcs0NVUJUHb9MrADO30je8e YBYwqWztFz0lq5l9F4SlfkCBgFaocqzQGpOTS3RQwG6SZU46n5wlpxcYZyKD1ameM/Sxq4+RZm9 WHA== X-Google-Smtp-Source: AGHT+IHRct+tg9si6FXkj3XDfvATucfZZx/pmM1rsyJ2yuaIieXkck617uTZGF3kPo5jFFwMAZ2X8QIv/Kc= X-Received: from pfbjo14.prod.google.com ([2002:a05:6a00:908e:b0:725:325e:59d5]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:1492:b0:724:f404:7101 with SMTP id d2e1a72fcca58-7252ffcbf80mr6785726b3a.1.1732755358707; Wed, 27 Nov 2024 16:55:58 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 27 Nov 2024 16:55:36 -0800 In-Reply-To: <20241128005547.4077116-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241128005547.4077116-1-seanjc@google.com> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog Message-ID: <20241128005547.4077116-6-seanjc@google.com> Subject: [PATCH v4 05/16] KVM: selftests: Rename max_guest_memory_test to mmu_stress_test From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Paolo Bonzini , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Sean Christopherson Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Jones , James Houghton , Muhammad Usama Anjum Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Rename max_guest_memory_test to mmu_stress_test so that the name isn't horribly misleading when future changes extend the test to verify things like mprotect() interactions, and because the test is useful even when its configured to populate far less than the maximum amount of guest memory. Reviewed-by: James Houghton Reviewed-by: Andrew Jones Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/Makefile | 2 +- .../kvm/{max_guest_memory_test.c =3D> mmu_stress_test.c} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename tools/testing/selftests/kvm/{max_guest_memory_test.c =3D> mmu_stres= s_test.c} (100%) diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests= /kvm/Makefile index 41593d2e7de9..4384e5f45c36 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile @@ -140,7 +140,7 @@ TEST_GEN_PROGS_x86_64 +=3D guest_print_test TEST_GEN_PROGS_x86_64 +=3D hardware_disable_test TEST_GEN_PROGS_x86_64 +=3D kvm_create_max_vcpus TEST_GEN_PROGS_x86_64 +=3D kvm_page_table_test -TEST_GEN_PROGS_x86_64 +=3D max_guest_memory_test +TEST_GEN_PROGS_x86_64 +=3D mmu_stress_test TEST_GEN_PROGS_x86_64 +=3D memslot_modification_stress_test TEST_GEN_PROGS_x86_64 +=3D memslot_perf_test TEST_GEN_PROGS_x86_64 +=3D rseq_test diff --git a/tools/testing/selftests/kvm/max_guest_memory_test.c b/tools/te= sting/selftests/kvm/mmu_stress_test.c similarity index 100% rename from tools/testing/selftests/kvm/max_guest_memory_test.c rename to tools/testing/selftests/kvm/mmu_stress_test.c --=20 2.47.0.338.g60cca15819-goog From nobody Sat Feb 7 17:04:38 2026 Received: from mail-ot1-f74.google.com (mail-ot1-f74.google.com [209.85.210.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45EE382C7E for ; Thu, 28 Nov 2024 00:56:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755363; cv=none; b=tD45rXZ+nsL8MnqIofHzwGFVjw0MjobdIhokRY5ou9z6YCd8jHdVgDTk/nGBAZ+JxS17uKD43pcSdywaj0TETiIDt4SGJYNvJKlUGkS9xKYXNT5XkdK/5Be7zcsbV1x9gGxoyDhjuC1daMU3qYRvrFQjrSg4zCK8nhHNxTmt1q0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755363; c=relaxed/simple; bh=/iq+5+KMMzm1j6WYTevg5oS1IBKtUjYGyIPBk5OQXL4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=tdSkM1CgikvGXupzAoFj2d3Y09UH9ymON1DKNMe6qUoT2dOticjlDFsyMYefj7JWqjbOf07XMEdF2R42lh2vunhDosYPv8WcNVigcHnLVrFSpQjLnXfNrtDPvlF3iCSeanfU89mFdCI/9phps4vZaPaXe+i+fZ3YSlPYdZ/DqsE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=0H7UpLYx; arc=none smtp.client-ip=209.85.210.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="0H7UpLYx" Received: by mail-ot1-f74.google.com with SMTP id 46e09a7af769-71d63a6ce62so161592a34.2 for ; Wed, 27 Nov 2024 16:56:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1732755360; x=1733360160; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=JyP1JUxR4wRqvaLFIbbuwXgM3uy7FspWl6pSel31SGs=; b=0H7UpLYx4fY+Hekf6j13QVIBtf2YVcr4dZ+UtitlAWw4sHsnzufMLk6qXCh/qn62mH cZrYBo16TITC51UJgo+QmQfwsG+z3rn6U4zrlZuNS9vdTiyinFlwV3z4HMFM1UH5DwJo pga5GzJSquNUycZHhIgeJK1PZnmu0FkozYEcBEu+0hua8fm0XtLBwB0J9VKKKkYE+8HO ynLFAfeNM4qfDnXjE6zQ+y66GP27uY1hnl3S8MQKBLSzLLTgJJMXSD4Y4KtrbsuLwrWS o/J0Lma4v6ItmpoH20NxxKQmkC+KYbE7T4ZIyzd7aloPl/mQF8s0fXFD73mCzUYChop3 mnNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732755360; x=1733360160; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JyP1JUxR4wRqvaLFIbbuwXgM3uy7FspWl6pSel31SGs=; b=bAEF1hu/o1vi8Q4NSkV9oQhHUwBhO08bEyzOveXU0+wro1fNZK08GAnc5GPzT66GoJ xQaO8Nt5txccVarM3AFIl15a7ptVPqNkVytbQIyR6TbTTelZRn5jVQqJT7G8RSCiC8F+ 9wsiCcgTHYSKShR0Je196br4BIav7tvkLNgAGClDY7lHbO6E4TOeqvNxYDgyJxTe0+dn KwUCPD/OOOSmxQQ6HXTOWaYG0dnX5WVQ+GoAz6OdkwX24WgB93aXjok6yFD1O/QeA0jT e8cH6pLGMXQobZ+MLYmxZ/ugBOvaxVadlNLYAXhqX/TEIXQZjZpROwZqdDNf9hgIvdk5 Cq+A== X-Forwarded-Encrypted: i=1; AJvYcCV+pMKNANPuDo3JUYovqqhyX/OzwOSl1ONkGRX12rCiZ0WyI3StbsrnqV0FfbMlqJsccAUaYH6Qg6Qo/mM=@vger.kernel.org X-Gm-Message-State: AOJu0YzWYbYy62zH+n1EVhzx6WzdNpv/XRkodCgdWgbZHaWXRcE9j9+G 7kGm42vC5yPVqQooQdWhFQ4SCq9NVapbiibFlf1jrsdR17+9mTOBwN7qYH3ySH8js5IHx4Kv12l 2EQ== X-Google-Smtp-Source: AGHT+IH8OsD6EvK6kpKey4op5FA84HiW/8R3R+eIuJX0ly9wWTrNA0B30UgLwfP51sElrM78pAke6fhK31g= X-Received: from pgah20.prod.google.com ([2002:a05:6a02:4e94:b0:7fc:1fef:7deb]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6830:6c14:b0:717:fdb4:c207 with SMTP id 46e09a7af769-71d65d00ddamr5604090a34.26.1732755360453; Wed, 27 Nov 2024 16:56:00 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 27 Nov 2024 16:55:37 -0800 In-Reply-To: <20241128005547.4077116-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241128005547.4077116-1-seanjc@google.com> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog Message-ID: <20241128005547.4077116-7-seanjc@google.com> Subject: [PATCH v4 06/16] KVM: selftests: Only muck with SREGS on x86 in mmu_stress_test From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Paolo Bonzini , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Sean Christopherson Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Jones , James Houghton , Muhammad Usama Anjum Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Try to get/set SREGS in mmu_stress_test only when running on x86, as the ioctls are supported only by x86 and PPC, and the latter doesn't yet support KVM selftests. Reviewed-by: James Houghton Reviewed-by: Andrew Jones Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/mmu_stress_test.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/kvm/mmu_stress_test.c b/tools/testing/= selftests/kvm/mmu_stress_test.c index 0b9678858b6d..847da23ec1b1 100644 --- a/tools/testing/selftests/kvm/mmu_stress_test.c +++ b/tools/testing/selftests/kvm/mmu_stress_test.c @@ -59,10 +59,10 @@ static void run_vcpu(struct kvm_vcpu *vcpu) =20 static void *vcpu_worker(void *data) { + struct kvm_sregs __maybe_unused sregs; struct vcpu_info *info =3D data; struct kvm_vcpu *vcpu =3D info->vcpu; struct kvm_vm *vm =3D vcpu->vm; - struct kvm_sregs sregs; =20 vcpu_args_set(vcpu, 3, info->start_gpa, info->end_gpa, vm->page_size); =20 @@ -70,12 +70,12 @@ static void *vcpu_worker(void *data) =20 run_vcpu(vcpu); rendezvous_with_boss(); +#ifdef __x86_64__ vcpu_sregs_get(vcpu, &sregs); -#ifdef __x86_64__ /* Toggle CR0.WP to trigger a MMU context reset. */ sregs.cr0 ^=3D X86_CR0_WP; -#endif vcpu_sregs_set(vcpu, &sregs); +#endif rendezvous_with_boss(); =20 run_vcpu(vcpu); --=20 2.47.0.338.g60cca15819-goog From nobody Sat Feb 7 17:04:38 2026 Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ECB542E628 for ; Thu, 28 Nov 2024 00:56:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755364; cv=none; b=QCAL+yzxmv6yn0akASzK/7GhLU5nVQxHKql25XcuH6e4scyQs+GFiIunpYiHd2UPzFY7jiqbsDzHxSqaGm4k57hmXMxxPnx+LNyz3JTSuhRp8b5iWPK540SzbSu3OftoTQIYNXvnTQmW3tRrS2rxaP59GaiQ7N4AgcboKbBiQpk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755364; c=relaxed/simple; bh=EYB3L6b74MhfJrPzvb7T9WOOU7QX9pbOjbRmtOdicCg=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=sPL0eiqUciC5U5phs/cBSTQJJSCwaV/uv/hhP/09WFBz+iBc3NBkFAp2vdtzi5HtFJ7U4ekg4aCnND811sQV5WyYEdLDCVbvyt9Cze+T0i/4cnsu1c2FX7XDdbjHO0BAx0KEz6/YxvVRfspvpkWXsLzmGjbJymGzzDOEi8MCkh0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=cwFi3Vqg; arc=none smtp.client-ip=209.85.210.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="cwFi3Vqg" Received: by mail-pf1-f201.google.com with SMTP id d2e1a72fcca58-7250da8a2a5so325344b3a.0 for ; Wed, 27 Nov 2024 16:56:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1732755362; x=1733360162; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=7/2VfJdiek5/ConUN3oh8Dq9U963aWvO6yCMgPFkp+8=; b=cwFi3VqgyVT749tieMTXYIF/Qk/99w7cG45MGFJ6SGQOGQe1tLYt/xlslTyqVNAkM3 ByhjIRaFW47AJXqt7Ez04Tf7AWTU2iKYHlQQRiEPVfrQOe8Z54dRpg/0pygVlpS+A+BN CaPGnEr+TwOqgDe/wTwAmfS2ddQ5EW81ZQImfCzQW+SwKTQQmhN9TBL6mUXg77JaeJrk 9iFxCPFxQ45sE5J9RGWBlbMzDQMA5C1IGTHjC+SAonEI9Y1ulFWAKMp7P58MCxbMfDuE GTDIfVMGlsai311I7VfLiW3L6CZFr7eAHLPTc50Ng9bpjFa292ZyMTAIutyw0mgCqDgz /cZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732755362; x=1733360162; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7/2VfJdiek5/ConUN3oh8Dq9U963aWvO6yCMgPFkp+8=; b=xT4AU4+E9wKlC1GfHwEeUtoe4mf45qaeII//5h5gWPzfSuq7QJD/obOUHwB4Af18a7 fLauw0bBNDngvRMNkDMGs7D8MwrVEIlimLVtKaQC+o8lmxhx9UZ2Pk+IbK06zv36KRA7 B2hKs0Nwv0NxmJjGYvcoy8UrN/q+dvxQ0GFeqLIVaAjUpoJmJLIankC8xPmtOTAR258v rAFn6jdxpayDITavMZ+9DMRahTXZZ4PsXCu8w3vfMJzKGK8VDENx1xU1Pj1YWlPakaCY KJDl6HrY69ti//e/c/bulSAVJG2DQs1ygRkSFStt5IQKXhIcmP/wlTZmJw/iyqYUjIu3 L+NQ== X-Forwarded-Encrypted: i=1; AJvYcCWUA8YvLaty334vi/SQrPaq4SMI0sPF+nPjxwIDQ22O5hdMNK8VFe1hsEhZ+j3FRDp358MSQCxX10/3cVo=@vger.kernel.org X-Gm-Message-State: AOJu0YwlWNJnvO6/nULW0c7m+RUhe/MUfOanXxchvEH74lhMCwyzhgu8 e//hOVqAJKF5q8pHPlg49owEzLx7ixdseTUslaG2Nl3kVZ/LY1n94kQKLHXPiajL+NEskvA7gn0 LEQ== X-Google-Smtp-Source: AGHT+IH/oCUXOezhQ0A565EEmfthxQY0rCc4VbVmqRSwagA0iA03VskT3jIu5Z1zmAcsnP7ZOJe6QkUN4cI= X-Received: from pfbeb15.prod.google.com ([2002:a05:6a00:4c8f:b0:724:e5a7:e33d]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:4654:b0:71e:6c3f:2fb6 with SMTP id d2e1a72fcca58-7252ffd753emr8477585b3a.8.1732755362168; Wed, 27 Nov 2024 16:56:02 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 27 Nov 2024 16:55:38 -0800 In-Reply-To: <20241128005547.4077116-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241128005547.4077116-1-seanjc@google.com> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog Message-ID: <20241128005547.4077116-8-seanjc@google.com> Subject: [PATCH v4 07/16] KVM: selftests: Compute number of extra pages needed in mmu_stress_test From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Paolo Bonzini , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Sean Christopherson Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Jones , James Houghton , Muhammad Usama Anjum Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Create mmu_stress_tests's VM with the correct number of extra pages needed to map all of memory in the guest. The bug hasn't been noticed before as the test currently runs only on x86, which maps guest memory with 1GiB pages, i.e. doesn't need much memory in the guest for page tables. Reviewed-by: James Houghton Reviewed-by: Andrew Jones Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/mmu_stress_test.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/mmu_stress_test.c b/tools/testing/= selftests/kvm/mmu_stress_test.c index 847da23ec1b1..5467b12f5903 100644 --- a/tools/testing/selftests/kvm/mmu_stress_test.c +++ b/tools/testing/selftests/kvm/mmu_stress_test.c @@ -209,7 +209,13 @@ int main(int argc, char *argv[]) vcpus =3D malloc(nr_vcpus * sizeof(*vcpus)); TEST_ASSERT(vcpus, "Failed to allocate vCPU array"); =20 - vm =3D vm_create_with_vcpus(nr_vcpus, guest_code, vcpus); + vm =3D __vm_create_with_vcpus(VM_SHAPE_DEFAULT, nr_vcpus, +#ifdef __x86_64__ + max_mem / SZ_1G, +#else + max_mem / vm_guest_mode_params[VM_MODE_DEFAULT].page_size, +#endif + guest_code, vcpus); =20 max_gpa =3D vm->max_gfn << vm->page_shift; TEST_ASSERT(max_gpa > (4 * slot_size), "MAXPHYADDR <4gb "); --=20 2.47.0.338.g60cca15819-goog From nobody Sat Feb 7 17:04:38 2026 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F0D013A24D for ; Thu, 28 Nov 2024 00:56:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755365; cv=none; b=hwn4NU7YxptlSfiWRT0saj8zgqWJSm5w1AC09hkqs0p+1k8TAdJbPKRfkN7RFJR7VEHGjkecE128K/+UIwSDRm6oY3AhBJ8wOTy4hY5HUMx4EvoDjINIdEs8OKjuPIxicf+dpGXj9N1YvLpP8OigkUdMeL0T17AyjPDDR5ejjcs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755365; c=relaxed/simple; bh=UOHD8P5jAo/tu9DZeP+a1DmnkO+B67XGDTnvDmQDwR8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=AfEw+zb96dbtqrvSPlTrWPbMsaxuMSXWSkK3TYZlAyA08b9VNpXOMsk5JDAAdUWrFGkXFvjUEg39Rav3+wW6Y3zPh2L+fl1Q5B93P3RqMJycmAlzEk90YAyyPVcfEKsEfqeGFQ6yV8FIJoa0W9Ks3bCpYD0c+l8F3uIjwHZ8ZJU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ren8luT0; arc=none smtp.client-ip=209.85.214.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ren8luT0" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-20d15285c87so2592375ad.3 for ; Wed, 27 Nov 2024 16:56:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1732755364; x=1733360164; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=ysvaIdmMpR/VmHKwcGzTb4HtexOKJ4Ghx7ZOeauEtvk=; b=ren8luT097x+yMTLNnr2h+Aq0eFfU7344rbVXAxh6GR3/wR6SgbXCv8upO3F9dd6Tn 1sCZD9r2wNP8gIZAspKoycsfW/GHdjyJJkK9AhQJbbKLtP75E/fQVg83mJWFu1nMMBeS l1y8rzWk5az2kpjv80rv+vJl6NfdnPxIMoDSotd+PT9nozU6BvRqcPitkCFq+1IwpMGc 2wHVLwlRmogTC6JCW0txzc/l/MLio6yiK0cp2g+xFB5mGatB5thgp9ggu2b0TgdQbuhw cWF/nba4JMvwdtK2BtqVwKDBroj9Xx5ZrTCEgbCVMu1D6j5/m2xAIOzF0r9014YToNrg eobg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732755364; x=1733360164; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ysvaIdmMpR/VmHKwcGzTb4HtexOKJ4Ghx7ZOeauEtvk=; b=Yz+XuLsrhprwHbe4mU+qazwrC9Gc1DttMo/Dq0GqxC8sm3P0wJefR/hKZAgRL3RCJO huIRSbLgHg8ZaN9w/1oeLor5Hl/x3IJoWLUyUhi0vAV8C4AayPF7lqEOjDmrUgYBtnNq R1dSG3WvCi0TWS4TTv5cGUCofjnmJa9ka7qE1/VFcV0DOPjlXzPMh/OFF+n5Iaz7A10x hsXIxjIDcUaDzgaSS7vTaWhDkYOgdKwCCEXNcuZgpO9KFJmWLK4SwRfYDwteiO3JGCtt 9lyvEvsITOL7TjoAj+9glvx+Qs5kmnHrtx6738c03f8QXGPkVcVSeHhBnjC58+OLtou4 VTjA== X-Forwarded-Encrypted: i=1; AJvYcCXzp/wdOmLIF8j1klbdhldQBs71DbFFVoNb227lTFo1hZ2hwpb0PfXbJgzuXSeq0wB/wWIPIqwBUfwtYK0=@vger.kernel.org X-Gm-Message-State: AOJu0Yypco+Qe1Mb5nfr4NL6GzyhpS4N0H9/KewEUAoQ/EPgoz0K8LoJ E+6sPKyYkMnmdEJw2MzHHTBbCLcnR9YNM/jPxlTvjRl0hw2HX5UEUi76CHcPn92fgrHW0lJqCaH q1g== X-Google-Smtp-Source: AGHT+IE+ChL1KLorT8CIkfmIr19XCryd//IzNWr5z8aQi0CF/Qf3ZQTw4qD7deHM4fsaQ6e/45gZiVf87tA= X-Received: from plbmb7.prod.google.com ([2002:a17:903:987:b0:211:b7e:ba7d]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:e84f:b0:212:618a:461f with SMTP id d9443c01a7336-21501b5aed2mr63134555ad.41.1732755363732; Wed, 27 Nov 2024 16:56:03 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 27 Nov 2024 16:55:39 -0800 In-Reply-To: <20241128005547.4077116-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241128005547.4077116-1-seanjc@google.com> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog Message-ID: <20241128005547.4077116-9-seanjc@google.com> Subject: [PATCH v4 08/16] KVM: sefltests: Explicitly include ucall_common.h in mmu_stress_test.c From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Paolo Bonzini , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Sean Christopherson Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Jones , James Houghton , Muhammad Usama Anjum Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Explicitly include ucall_common.h in the MMU stress test, as unlike arm64 and x86-64, RISC-V doesn't include ucall_common.h in its processor.h, i.e. this will allow enabling the test on RISC-V. Reported-by: Andrew Jones Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/mmu_stress_test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/kvm/mmu_stress_test.c b/tools/testing/= selftests/kvm/mmu_stress_test.c index 5467b12f5903..fbb693428a82 100644 --- a/tools/testing/selftests/kvm/mmu_stress_test.c +++ b/tools/testing/selftests/kvm/mmu_stress_test.c @@ -15,6 +15,7 @@ #include "test_util.h" #include "guest_modes.h" #include "processor.h" +#include "ucall_common.h" =20 static void guest_code(uint64_t start_gpa, uint64_t end_gpa, uint64_t stri= de) { --=20 2.47.0.338.g60cca15819-goog From nobody Sat Feb 7 17:04:38 2026 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18989143759 for ; Thu, 28 Nov 2024 00:56:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755368; cv=none; b=iZ64GpJOUt6TVo7DB4VbsbjrMKcAquoSgqi86IDvnYbyu9SNASX8ryCmAuwm0uN6DCbiUPNFIyUgCcGPNTy/y78mvdAUKdj4SaaArGQaXpB8lTpZue5nguiMrUj1RCZNnEeKzBGzYkjV995I0QhIft9IRW5qkFCT9IVD0+/jKy4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755368; c=relaxed/simple; bh=aNYWrhV3+Hlqkeo6/DSEk9PQ+DunnQgH+0LyxQ37ZvY=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=b1HzVQX71xk8Zl7wIhJIKmU2lYxzXYp6HXEVJnWMydZOm9xDGSZfsdByuwuvBkfvimLCvuXAo4fNV3ecEoXJd19Lup+q6E2aZMnYxkrc0EcXYAOU9US5alhIeKr0yB8gNndwJBQyFUpTQGP4EvKI9elQvOUWqmFzV1Zk52+iuyg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=2QCVFgUT; arc=none smtp.client-ip=209.85.216.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="2QCVFgUT" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-2ea9d209e75so301196a91.3 for ; Wed, 27 Nov 2024 16:56:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1732755365; x=1733360165; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=m3N0I2xWsrfV4i9nnr3KT1Cpmm4B4GrEhZX0cF+2Gqk=; b=2QCVFgUTqg42jrqoJJlSe69N1DGudTAzLkpZgLaDN+H94GlnnaSOsVn9F/mUxiqxnf QhbECdSFLTqECkq6YppyZZ2bkUE9YTy37KWlPEYXxzqSIwVnfghbQ9NfoZ56EPFscgQU /KUaYX7n9unHO40bBmYhF+I+ANnLCUSb9Wjfm4r15/RXgjLuJkhgyrCorrPElKj7RFFw TzpaLecjBqY5Wxd6g6iCyowrWMK57SLaIcNJ1Es0Xd16bp7VzhMQajMp75+RJfhbBgp5 EA0ohdTE49Zkn9bobsd3FVcQma3YZhlsM40rSs2kqHIyMqSzqzjLwQoUKE4NO9zsNdKl yxgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732755365; x=1733360165; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=m3N0I2xWsrfV4i9nnr3KT1Cpmm4B4GrEhZX0cF+2Gqk=; b=EM5gM9i4rA+Tt4NW2U+3S6LDkZLU7xaORKMwFci6kJ3wy1ao+keofYGG7qTB+M3lAa RVrHgAlt35t0MyoGAc4buWY/6SNG7y4TEGYy9sZfjy8dFCiEPMnJ6YFmiR6PJhTvjWqt FbwKwpH1QD9ALIXQuvnoCeLnjNx7Ltrt4Q76/idVOk6YcLKhVLKuRfhD6Hh0rGRy6FAJ k6Pui1irScSd4j9SBk6w81nRB4afBqqHUs/q5J/r1n8+IDWxLxLo0DL0aQF8APG7Nxf2 PCVQEzd3H7bxcr4gCHL94qoRGCgGR6Xoj9L6HLsH3N7zdhvh7DiVqoyPPRBDpsLUvnHl FBTw== X-Forwarded-Encrypted: i=1; AJvYcCXHx5qo0HdW56KZMjt4lQ4pN0NnxHRmnXegVnR5l6gRJDEJJUktaPjpaDqc//KAVEhRsUYsAi2dLodvc+U=@vger.kernel.org X-Gm-Message-State: AOJu0YySOlHISD+uM3jzTEH7VxJ8pb7GhfG+Df5JMYbVbjxE/5eAO1+q gOLUeesckGVPTylXrHFkJLil245ugsn1T5rVkWMl1HwxVoEC6EbJUDgD63KT4ktHwxYBBSWhZ1f 4kQ== X-Google-Smtp-Source: AGHT+IE4OA2YWpjZt4cUyGKEolrSn+wbKfMl6eazhCePp/W8mIleK1HW5p9Pm9svs3J06p9qg41Q+800XRI= X-Received: from pjbsn5.prod.google.com ([2002:a17:90b:2e85:b0:2da:5868:311c]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:28c6:b0:2ea:6f96:6504 with SMTP id 98e67ed59e1d1-2ee08e9c7a3mr6508990a91.1.1732755365479; Wed, 27 Nov 2024 16:56:05 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 27 Nov 2024 16:55:40 -0800 In-Reply-To: <20241128005547.4077116-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241128005547.4077116-1-seanjc@google.com> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog Message-ID: <20241128005547.4077116-10-seanjc@google.com> Subject: [PATCH v4 09/16] KVM: selftests: Enable mmu_stress_test on arm64 From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Paolo Bonzini , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Sean Christopherson Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Jones , James Houghton , Muhammad Usama Anjum Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Enable the mmu_stress_test on arm64. The intent was to enable the test across all architectures when it was first added, but a few goofs made it unrunnable on !x86. Now that those goofs are fixed, at least for arm64, enable the test. Cc: Oliver Upton Cc: Marc Zyngier Reviewed-by: James Houghton Reviewed-by: Andrew Jones Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests= /kvm/Makefile index 4384e5f45c36..c59a337cd4da 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile @@ -180,6 +180,7 @@ TEST_GEN_PROGS_aarch64 +=3D kvm_create_max_vcpus TEST_GEN_PROGS_aarch64 +=3D kvm_page_table_test TEST_GEN_PROGS_aarch64 +=3D memslot_modification_stress_test TEST_GEN_PROGS_aarch64 +=3D memslot_perf_test +TEST_GEN_PROGS_aarch64 +=3D mmu_stress_test TEST_GEN_PROGS_aarch64 +=3D rseq_test TEST_GEN_PROGS_aarch64 +=3D set_memory_region_test TEST_GEN_PROGS_aarch64 +=3D steal_time --=20 2.47.0.338.g60cca15819-goog From nobody Sat Feb 7 17:04:38 2026 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB857145FE8 for ; Thu, 28 Nov 2024 00:56:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755369; cv=none; b=rIt9gQzCvR6Vl2I8WosI9evBXZVIrtONR+EfUCDii9wkZDbXG09SoDU/O9rzHbdVWyeX8WbIKY5T6LU9rafXIF2QgP2D6FPLDXjE2aUtD2e7tqz6CfWMLZwY/xlUXFII2L4Qr3IGK9hVa6B8Iuf1KhFrVPfK8HTnzNsTbBD65rU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755369; c=relaxed/simple; bh=q3F91ck+dBrsVmQtOZTwjIV0fTw2GsZHZwmuMtwW+6w=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=h6Z/hASEZPA4HszmvCEqbelm/IMqxUmtkgym6VYlEdXNqgFOsPeiXe7on6gj6ZtWfb9sjBTE03BFJBt/d8NQmBXZS3EDJkdeiKy6xyzJWB+Ha99ah2H2rojJL8axb8SqYiohI/qMPqHMmzio7aJSiOcrXb+MATarflsC0CrDFIg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=giwT0Hvl; arc=none smtp.client-ip=209.85.216.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="giwT0Hvl" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-2edeef8a994so350352a91.2 for ; Wed, 27 Nov 2024 16:56:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1732755367; x=1733360167; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=Agu6M4WZdSaan2rYdaSmo6PpiQZ+ciRGpotTGWqZBGc=; b=giwT0HvluygoClj98kWmTJsdYbnLqtsiBy9cbZ94MuJk8DX1AS0H6FKsW5/jckWscG W/Mo+L8JqjD5J0tRK0VmiE4BLnvr7xsiUAuT9Ibjs48VYvFFrlfxcU3egJQpGQ8O4eAD Ra56iRulqvbZsiOKmE6E9fxaoqoIRLI2rTC8wBo7hyvuCka+aKlZVfy2VbyCDY0bcosh tzDFmf3s/IVwfSfHO0qbWPKFf9GjtrFg1cg1QTufhiOCyOyOjJ7pEL7tp8VcEjor25cC ngqn9GqQBQxrHvyKj9WpI/cYxPxmA+HoXkSOT9TDqBUVTcwJpi/9MVxk2trb6mUzG6ay swyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732755367; x=1733360167; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Agu6M4WZdSaan2rYdaSmo6PpiQZ+ciRGpotTGWqZBGc=; b=SGREJzXRmO4PLBPbHx79jyTzxdUmrHMXMlQa6s5aixCHb0LvkPQid9HaQp/ZWdOxHR bNL2uVt0dJCXxgjKiwHyTG0hwIxRttuKdUav6hEM9PboPS5o60c58Yu0rhSiT3PxQC6D 9sTOIIc01nyKEuQr74+4/KKzcTN8ENyX76q99sFVgPjZx2HEBxzByFU24JV0jeUUanAN LWIRUoh2k9I4M89d7hdi1EmGy/jydaHTzmAISV8PZr4r/oXdH+Ch8g161k3uRDyzxHUA Zko+xk6lVutKeWSLDY1KYbdlQKeBHlEHRQoflH2HEFInG5Brbc6yuaPh/vJbSFEK8pev Mvig== X-Forwarded-Encrypted: i=1; AJvYcCWrqLOmY6wkVUkkn353yG8oYH7JOnfe99A8Cs7JdzUrjoVOhSJZfreGGHAAUH8UIslqR5M+wFYmRgqbnQs=@vger.kernel.org X-Gm-Message-State: AOJu0YwR5FwmXJ31pvXbQt8tleTi/8aX6MwHwCkvKPZQ0suBn0LcKi7s Hb6LXMx/RMcb1aizala1Jv83E8JUpUHH2MEU09+zVnQgJMbbWngEYjImdstOmQAGgqa5Aa1te45 TbA== X-Google-Smtp-Source: AGHT+IHzlIPOR1Dozv2+kADz6uvilkOgvJy6Ih7MLR3sUMAMwXrp/UBNznMIvAz/TeA8dqsISkWCfiSMkjQ= X-Received: from pjbcz13.prod.google.com ([2002:a17:90a:d44d:b0:2ea:63a6:d869]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:4c04:b0:2ea:7329:43 with SMTP id 98e67ed59e1d1-2ee08e97ff9mr6674171a91.6.1732755367252; Wed, 27 Nov 2024 16:56:07 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 27 Nov 2024 16:55:41 -0800 In-Reply-To: <20241128005547.4077116-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241128005547.4077116-1-seanjc@google.com> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog Message-ID: <20241128005547.4077116-11-seanjc@google.com> Subject: [PATCH v4 10/16] KVM: selftests: Use vcpu_arch_put_guest() in mmu_stress_test From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Paolo Bonzini , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Sean Christopherson Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Jones , James Houghton , Muhammad Usama Anjum Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use vcpu_arch_put_guest() to write memory from the guest in mmu_stress_test as an easy way to provide a bit of extra coverage. Reviewed-by: James Houghton Reviewed-by: Andrew Jones Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/mmu_stress_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/mmu_stress_test.c b/tools/testing/= selftests/kvm/mmu_stress_test.c index fbb693428a82..656a837c7f49 100644 --- a/tools/testing/selftests/kvm/mmu_stress_test.c +++ b/tools/testing/selftests/kvm/mmu_stress_test.c @@ -23,7 +23,7 @@ static void guest_code(uint64_t start_gpa, uint64_t end_g= pa, uint64_t stride) =20 for (;;) { for (gpa =3D start_gpa; gpa < end_gpa; gpa +=3D stride) - *((volatile uint64_t *)gpa) =3D gpa; + vcpu_arch_put_guest(*((volatile uint64_t *)gpa), gpa); GUEST_SYNC(0); } } --=20 2.47.0.338.g60cca15819-goog From nobody Sat Feb 7 17:04:38 2026 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2137146D45 for ; Thu, 28 Nov 2024 00:56:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755372; cv=none; b=RebfcBtIo15+EN935f+kkrhEKC82Clb+Foih7iLwK6PzVzXybO+MjBEZae80FZC5QTFSFBqi9JMlmsImUhq8DdkMM8PdGQJEjoJTiI39kBU+z7zGxa7EWLv032vO4PsuOI0N4BZL7gEVnKhbKEKRXWwvr2vNWobcGKtBsOy1lfk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755372; c=relaxed/simple; bh=tB5Y/jG/Ubvw+ASTUSDw04Dbo+k1MHeniGJPuaDceRY=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=fArB75nQMspSYXaveran/SGHxSLPd95yz6OOOTOl/CEXwWi62FXWnfrECt45Y+T3bXE67Vm8up1rShSyazisAD98peZXZl+iwDTuVNVl2aKfH45sQuCz2wyU5RzLAHfuasJ9DNf1SXAEwyHSrquBkiTQnxUlsSpgBaZCbewAZww= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=WUsvA2Vk; arc=none smtp.client-ip=209.85.215.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="WUsvA2Vk" Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-7eb0a32fc5aso218415a12.2 for ; Wed, 27 Nov 2024 16:56:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1732755369; x=1733360169; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=/mFf9b1jkbcIPk1lRuUSamWoSedpUsq+XjDpJ8wT6fg=; b=WUsvA2VkOWzarWa1H4q0hM8ySVaeVtl1jM6+g1bQ8AuAedscLnGG/IpkCtuOHgNHsH 4wXDgybyuc+oLhhRLR9UmlKJIS+BZIUdRBFTOt2aUPQJT1Jn2xUXTGJEIgOHN8A2A90x qu6drytqITMSOKrJ4K5d1wxZcycSlTH+SE8ozLPAKG0h6zPm1l0SD8zD9z3ylrl/Jz8F gOSgjbkI1nidHXLpDKRP9YMxTurl0nqdOMrBknKIz7SVQhWh2lJv270hMzVVfmvcP5Hd 0ZJW4mfttQhlAfk5G+3FP8xOPBxN7bkg5YI4fXXL8ADVJWWvK5rdblEKu0C0mD4CiaMV udyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732755369; x=1733360169; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/mFf9b1jkbcIPk1lRuUSamWoSedpUsq+XjDpJ8wT6fg=; b=RLmh17kkpWTe7Ni0T6D6l9zKWLrvGho4sbanCQG7Qxn8ghTYgOxSVlWWRPnit1bPT1 1BKYRreViiVmQBUIH4naWWGtLBKpNS+jnOO4YjMrjOSZScX72diB5YVRFbQc1tJIPpqB cgPQ5rKa9uEDC0QBtfEKuX0wepN+SqV7dc8AqxX2ZU1gvCyFq1S/BTSVl65KsBt/HoIJ 8F7W13twVycvdyy4niOeTrTmLckDojkVHjr/TA1s39RVHltzvCjONZKMDjx/osr8w23B K4ZWDF6BVTl3WlchdCrSgdwSHTY6DlOU70rY+zcLrT6vXKVpWiYzeESPgHhqPIiW1Nmc uNBA== X-Forwarded-Encrypted: i=1; AJvYcCWHE5O73tMRBiYpnRXrMJFVNUThSmvW3kY1TN+Re3FWzk6J7IdfRPySqPdkV45BppoXHoaTsOFX0GxbQWA=@vger.kernel.org X-Gm-Message-State: AOJu0YxEKeAbh4hgtUgeInTPCgcDbwhiZ9o9PvNshSlt0/86rCNTKOVc HdxSaGhLrDig0/Q/e7c+XGkK2Vb3wo/ixKgvW2oNvzJhuhqek29bCLbYer7L3SMvhC/KwVny9Aq IOw== X-Google-Smtp-Source: AGHT+IH5HVAxwH71e8ybYbHuEKxtEP3yXlkNICJu49WhynVenqzqkDMIejgXVsQlKc9eCbp1lS1lKkfrLgg= X-Received: from pjbsc10.prod.google.com ([2002:a17:90b:510a:b0:2ea:d2de:f7ca]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a20:6a28:b0:1db:eecb:f7a1 with SMTP id adf61e73a8af0-1e0e0b4f376mr8089233637.17.1732755368992; Wed, 27 Nov 2024 16:56:08 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 27 Nov 2024 16:55:42 -0800 In-Reply-To: <20241128005547.4077116-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241128005547.4077116-1-seanjc@google.com> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog Message-ID: <20241128005547.4077116-12-seanjc@google.com> Subject: [PATCH v4 11/16] KVM: selftests: Precisely limit the number of guest loops in mmu_stress_test From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Paolo Bonzini , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Sean Christopherson Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Jones , James Houghton , Muhammad Usama Anjum Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Run the exact number of guest loops required in mmu_stress_test instead of looping indefinitely in anticipation of adding more stages that run different code (e.g. reads instead of writes). Reviewed-by: James Houghton Reviewed-by: Andrew Jones Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/mmu_stress_test.c | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/kvm/mmu_stress_test.c b/tools/testing/= selftests/kvm/mmu_stress_test.c index 656a837c7f49..c6bf18cb7c89 100644 --- a/tools/testing/selftests/kvm/mmu_stress_test.c +++ b/tools/testing/selftests/kvm/mmu_stress_test.c @@ -20,12 +20,15 @@ static void guest_code(uint64_t start_gpa, uint64_t end_gpa, uint64_t stri= de) { uint64_t gpa; + int i; =20 - for (;;) { + for (i =3D 0; i < 2; i++) { for (gpa =3D start_gpa; gpa < end_gpa; gpa +=3D stride) vcpu_arch_put_guest(*((volatile uint64_t *)gpa), gpa); - GUEST_SYNC(0); + GUEST_SYNC(i); } + + GUEST_ASSERT(0); } =20 struct vcpu_info { @@ -52,10 +55,18 @@ static void rendezvous_with_boss(void) } } =20 -static void run_vcpu(struct kvm_vcpu *vcpu) +static void assert_sync_stage(struct kvm_vcpu *vcpu, int stage) +{ + struct ucall uc; + + TEST_ASSERT_EQ(get_ucall(vcpu, &uc), UCALL_SYNC); + TEST_ASSERT_EQ(uc.args[1], stage); +} + +static void run_vcpu(struct kvm_vcpu *vcpu, int stage) { vcpu_run(vcpu); - TEST_ASSERT_EQ(get_ucall(vcpu, NULL), UCALL_SYNC); + assert_sync_stage(vcpu, stage); } =20 static void *vcpu_worker(void *data) @@ -69,7 +80,8 @@ static void *vcpu_worker(void *data) =20 rendezvous_with_boss(); =20 - run_vcpu(vcpu); + /* Stage 0, write all of guest memory. */ + run_vcpu(vcpu, 0); rendezvous_with_boss(); #ifdef __x86_64__ vcpu_sregs_get(vcpu, &sregs); @@ -79,7 +91,8 @@ static void *vcpu_worker(void *data) #endif rendezvous_with_boss(); =20 - run_vcpu(vcpu); + /* Stage 1, re-write all of guest memory. */ + run_vcpu(vcpu, 1); rendezvous_with_boss(); =20 return NULL; --=20 2.47.0.338.g60cca15819-goog From nobody Sat Feb 7 17:04:38 2026 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA0D914A0A8 for ; Thu, 28 Nov 2024 00:56:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755373; cv=none; b=fCrGIsLUOJSExYwTR+MZMKoHWbstvItQtgz1RhshUUQwA2JuiBotfifjYz2hMVdS9ruZmG5chKUCKzP1yYR2pjECr+FhLJJIb3KXpIIh4ssmi8bSxtEk9EgbG7gJo/YftoIn7wn2rOOwJoA5eiWN89zfxT+S2sGljMVhPU6EKFU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755373; c=relaxed/simple; bh=Pl/WDPJJFpEGoonemEpYTO8CqOvLteUalaJutLV+GEI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=juz5h5sdYeUmerYkCLngDPqRoDbVmdRetSUgCTHN+CpSAq2D4CLagBvCa0ztdzLTv+YDEhDdaElebt0bBE0W4yXf1WLeOx5g4sIDEx7E9P5NSOPIJaOu9Vrv/goVMNhZfE9UveVTyAzP1i0/1Bc6WvI3HNmcEQ7L9wDey9TXlOI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=uOTKb+Ub; arc=none smtp.client-ip=209.85.214.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="uOTKb+Ub" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-211fcbd2325so3222935ad.1 for ; Wed, 27 Nov 2024 16:56:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1732755371; x=1733360171; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=GWRtxUB7qEaUtLrlQ1xtfEnMmWvmcI3LuUmySZ8Q/Js=; b=uOTKb+UbcxVat1BTRDF5V9ggbfjlmpZ0OBVaMazd8wdph/IHUqaD65LuoEHySoEVmD 1Hc5XTV2zhKDb2W9Sz/Cw9PeFAda/JDYOIIJwiS77sjbrWaq9OLblfy5j11AItqzCtal fpEx9tRnIcoa9PvLvyl25Om6Z6SmFqvKJnTpijJGSzIsuiazlNRwSmd1G/5z9Jvr7sOC NnboAYNkvkBFwkHZqaSW0zUMmUyzVmsj+Z+v0ZexOdIwIYARvbyumwDONvNJuIS2l3PQ ekFCmtBD5mb0wLtKLBXUuDmeVzbO41PTGqvl6DsNDb8DH8ce0SLk9Qv8BnDFoGYgQLzC nGbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732755371; x=1733360171; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=GWRtxUB7qEaUtLrlQ1xtfEnMmWvmcI3LuUmySZ8Q/Js=; b=XpnJ9x4eZUABnFwxwsrOLhecQLzMuJkuKyB6f3/r2YTQLD1fvSFWBRUat9xXD47//x ppeJhsCSWunvyUviRBzeAQJUwFHrurKXvYCuhDNXJi/eH04qdPAo4KvISFgJWJTJI3tl cpK9FbtEAwx2bz0MBKXCFBq1hDjXbN7bgGU+TB5cHQJb1hmi78if3LKKED/1RaeWx7cI o7OUEH0ZVqnHtSGZm5RScm1FFane+O+HCmM/oKIby583+1mCqnsn5EVkNsdWWPRLqhlL X80yJC62gZPC6vR3gB+1iSNI11Nu3MnTB2zv25Msq3awhMpz3pp4Wjrwo1vRRb134d8D ZJmg== X-Forwarded-Encrypted: i=1; AJvYcCWr4NFYHBXhnRYAg4Kr9qX4gvJS8LP9Njt4liTwXepyIVN9KQiqd7eJagfWE1/TB7oZDyko2LOMOSjLWqA=@vger.kernel.org X-Gm-Message-State: AOJu0YyIsn2ecC1apGm6LYaZzPILSji4kW/1HxQQS9MXm4FDAxDfK8x6 Zs4kovbaNWasRS0zyNp4jWkSvRtCtD1q9M0G99d44KWHYa0A9ARnyLHyuOWHbNAq3ct36N2KgpU +mA== X-Google-Smtp-Source: AGHT+IFMaJnuqI9F/c4uFlh6+NRFxIyg9v4WX4blDwY4PB6trx1cbKx2cypM7Azi46JxvUwmbV0z2d3j/+0= X-Received: from pjbqd8.prod.google.com ([2002:a17:90b:3cc8:b0:2ea:7fd8:9dca]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:4d0d:b0:2eb:140d:f6df with SMTP id 98e67ed59e1d1-2ee08e9bd21mr6479606a91.1.1732755370916; Wed, 27 Nov 2024 16:56:10 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 27 Nov 2024 16:55:43 -0800 In-Reply-To: <20241128005547.4077116-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241128005547.4077116-1-seanjc@google.com> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog Message-ID: <20241128005547.4077116-13-seanjc@google.com> Subject: [PATCH v4 12/16] KVM: selftests: Add a read-only mprotect() phase to mmu_stress_test From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Paolo Bonzini , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Sean Christopherson Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Jones , James Houghton , Muhammad Usama Anjum Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add a third phase of mmu_stress_test to verify that mprotect()ing guest memory to make it read-only doesn't cause explosions, e.g. to verify KVM correctly handles the resulting mmu_notifier invalidations. Reviewed-by: James Houghton Reviewed-by: Andrew Jones Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/mmu_stress_test.c | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/kvm/mmu_stress_test.c b/tools/testing/= selftests/kvm/mmu_stress_test.c index c6bf18cb7c89..0918fade9267 100644 --- a/tools/testing/selftests/kvm/mmu_stress_test.c +++ b/tools/testing/selftests/kvm/mmu_stress_test.c @@ -28,6 +28,10 @@ static void guest_code(uint64_t start_gpa, uint64_t end_= gpa, uint64_t stride) GUEST_SYNC(i); } =20 + for (gpa =3D start_gpa; gpa < end_gpa; gpa +=3D stride) + *((volatile uint64_t *)gpa); + GUEST_SYNC(2); + GUEST_ASSERT(0); } =20 @@ -95,6 +99,10 @@ static void *vcpu_worker(void *data) run_vcpu(vcpu, 1); rendezvous_with_boss(); =20 + /* Stage 2, read all of guest memory, which is now read-only. */ + run_vcpu(vcpu, 2); + rendezvous_with_boss(); + return NULL; } =20 @@ -175,7 +183,7 @@ int main(int argc, char *argv[]) const uint64_t start_gpa =3D SZ_4G; const int first_slot =3D 1; =20 - struct timespec time_start, time_run1, time_reset, time_run2; + struct timespec time_start, time_run1, time_reset, time_run2, time_ro; uint64_t max_gpa, gpa, slot_size, max_mem, i; int max_slots, slot, opt, fd; bool hugepages =3D false; @@ -279,14 +287,20 @@ int main(int argc, char *argv[]) rendezvous_with_vcpus(&time_reset, "reset"); rendezvous_with_vcpus(&time_run2, "run 2"); =20 + mprotect(mem, slot_size, PROT_READ); + rendezvous_with_vcpus(&time_ro, "mprotect RO"); + + time_ro =3D timespec_sub(time_ro, time_run2); time_run2 =3D timespec_sub(time_run2, time_reset); - time_reset =3D timespec_sub(time_reset, time_run1); + time_reset =3D timespec_sub(time_reset, time_run1); time_run1 =3D timespec_sub(time_run1, time_start); =20 - pr_info("run1 =3D %ld.%.9lds, reset =3D %ld.%.9lds, run2 =3D %ld.%.9lds\= n", + pr_info("run1 =3D %ld.%.9lds, reset =3D %ld.%.9lds, run2 =3D %ld.%.9lds, " + "ro =3D %ld.%.9lds\n", time_run1.tv_sec, time_run1.tv_nsec, time_reset.tv_sec, time_reset.tv_nsec, - time_run2.tv_sec, time_run2.tv_nsec); + time_run2.tv_sec, time_run2.tv_nsec, + time_ro.tv_sec, time_ro.tv_nsec); =20 /* * Delete even numbered slots (arbitrary) and unmap the first half of --=20 2.47.0.338.g60cca15819-goog From nobody Sat Feb 7 17:04:38 2026 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3604C1BC2A for ; Thu, 28 Nov 2024 00:56:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755374; cv=none; b=sIGpeEzHqpwAHIOCK/johFzHzFcmAAqJNJboQBZz9A9M+0nNv/SBk1KQZag1jkYl8g0eGNlYIYbNecs8h4LN5lWNvfJHnVihqk0afh/RFXKnwhRhJ3UvL+DVsywRWem2NPCAhDtLPdf7hNrBGJjzjAeEHq/vFmNDZPTP6IaD+1w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755374; c=relaxed/simple; bh=rMTdRj3Vw0d1aNonE+Ipfnwdfwj/c9K2WwLz124uQAw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=o/Mq4BhkxfQoDJNGs+txYFEf5tUvKriH2tPtYAbQutQk5wLQxUrS7gJGC+7Mky5V4pBQjEEC/pScwG8i6l9Dodks21MSBOJzEhhu5LxVzUR25N4FMx4GmhWl6k9xjXDYYvtriEccPltkixGYnu29GkJppgNy6jhdmI4eaaErvCk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=XkQuy0kh; arc=none smtp.client-ip=209.85.215.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="XkQuy0kh" Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-7ea69eeb659so203647a12.0 for ; Wed, 27 Nov 2024 16:56:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1732755372; x=1733360172; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=XPdOPo1b4SKFKQSHegYD/Ajgnk0S0WQ/8A/Yy7v0mTM=; b=XkQuy0khpnuzbbo2LepyX0Ydksg4N8iRRMKaf1wELlb3TPMwZJXxRLsvdAYo2H1WeV PHFS0UgIlS1GDTSvmK7L6D9LYE1pqrWyM3qtyNSy0T5Do1UA1ugrLmX+Ux4AATMLHHT/ n02IeLgScjYlT+X44VajbvlzynV/luUFHtqIhgbB7AoyaQt+lRrC6HIB8EFS2RY6LJ8W zjcPVX1hfrJbD/6xdKB2NFfDy3+R0eZrtYcqaaTjPxrkgSwevBc8rvnzvSeu4FFaYZvO 9DmPYuieEwbnpCfcbJO8DfE++QSwRhSzpulhDHKxOkMT+bdxZKsTWdE2S/slQLhsHgoY Plgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732755372; x=1733360172; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XPdOPo1b4SKFKQSHegYD/Ajgnk0S0WQ/8A/Yy7v0mTM=; b=UEZafjgNAaAKJN9nlyiJuef7a+CNC4daWRjhXgAKe1FkvGdJ+Ge5M7HzFaeyLW+5oa 3stNytSe2jWnwBiH7YjHLTbMK0gEvmZPtG/pPNG4wL2S4vQ/s0PN8vVQaitoKdxLC3WQ LqZQZmEqbin0avGIBxu/8UCAUpzqRXJVkhbC+ZPvIVfe14IQSo+xfOQLGx6V1kSU9xna vkCC/FqhquUMvCaANzq/P41oTt1SWdA83JqUrBoXKG8S8BbsCwkCUD646v3zIE/HKnwI 61V/9S/ZV5R0aGZE5Bn6y6nuryGCwKNJQXQCxZel4DX2Q485Ypfw92p0xV+jczojzasr BGgw== X-Forwarded-Encrypted: i=1; AJvYcCXZFaRlBeb/DUAHj+KWwfshepRw3FOE01tUhsDr0OK8HUxKW+TyBwFlhCruoMyRlrnAmuHbIs6d7v1ntKs=@vger.kernel.org X-Gm-Message-State: AOJu0Yy1opY2sIK4kHGb6b33rW8khZfhgcoiUy2FBue4M3xGXAMmUg4/ KsbSP6Qf6IDQxfErR3vo5YHNmINAp1C8yXJjq+PMhQBvwPfbWNmjs2hu9GF/DduYiut1he5zWm4 6rg== X-Google-Smtp-Source: AGHT+IF9c9BZlswGZi0etgSQ5KCNJj2OyH3UwmpvQEnlX/diiMpr3XRQbr6nF80wsA0CHS1H0/HXdIsKW9o= X-Received: from pfbcj22.prod.google.com ([2002:a05:6a00:2996:b0:724:f614:656f]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:33a1:b0:1db:ddba:8795 with SMTP id adf61e73a8af0-1e0e0b7d919mr7994888637.36.1732755372410; Wed, 27 Nov 2024 16:56:12 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 27 Nov 2024 16:55:44 -0800 In-Reply-To: <20241128005547.4077116-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241128005547.4077116-1-seanjc@google.com> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog Message-ID: <20241128005547.4077116-14-seanjc@google.com> Subject: [PATCH v4 13/16] KVM: selftests: Verify KVM correctly handles mprotect(PROT_READ) From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Paolo Bonzini , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Sean Christopherson Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Jones , James Houghton , Muhammad Usama Anjum Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add two phases to mmu_stress_test to verify that KVM correctly handles guest memory that was writable, and then made read-only in the primary MMU, and then made writable again. Add bonus coverage for x86 and arm64 to verify that all of guest memory was marked read-only. Making forward progress (without making memory writable) requires arch specific code to skip over the faulting instruction, but the test can at least verify each vCPU's starting page was made read-only for other architectures. Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/mmu_stress_test.c | 104 +++++++++++++++++- 1 file changed, 101 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/kvm/mmu_stress_test.c b/tools/testing/= selftests/kvm/mmu_stress_test.c index 0918fade9267..d9c76b4c0d88 100644 --- a/tools/testing/selftests/kvm/mmu_stress_test.c +++ b/tools/testing/selftests/kvm/mmu_stress_test.c @@ -17,6 +17,8 @@ #include "processor.h" #include "ucall_common.h" =20 +static bool mprotect_ro_done; + static void guest_code(uint64_t start_gpa, uint64_t end_gpa, uint64_t stri= de) { uint64_t gpa; @@ -32,6 +34,42 @@ static void guest_code(uint64_t start_gpa, uint64_t end_= gpa, uint64_t stride) *((volatile uint64_t *)gpa); GUEST_SYNC(2); =20 + /* + * Write to the region while mprotect(PROT_READ) is underway. Keep + * looping until the memory is guaranteed to be read-only, otherwise + * vCPUs may complete their writes and advance to the next stage + * prematurely. + * + * For architectures that support skipping the faulting instruction, + * generate the store via inline assembly to ensure the exact length + * of the instruction is known and stable (vcpu_arch_put_guest() on + * fixed-length architectures should work, but the cost of paranoia + * is low in this case). For x86, hand-code the exact opcode so that + * there is no room for variability in the generated instruction. + */ + do { + for (gpa =3D start_gpa; gpa < end_gpa; gpa +=3D stride) +#ifdef __x86_64__ + asm volatile(".byte 0x48,0x89,0x00" :: "a"(gpa) : "memory"); /* mov %ra= x, (%rax) */ +#elif defined(__aarch64__) + asm volatile("str %0, [%0]" :: "r" (gpa) : "memory"); +#else + vcpu_arch_put_guest(*((volatile uint64_t *)gpa), gpa); +#endif + } while (!READ_ONCE(mprotect_ro_done)); + + /* + * Only architectures that write the entire range can explicitly sync, + * as other architectures will be stuck on the write fault. + */ +#if defined(__x86_64__) || defined(__aarch64__) + GUEST_SYNC(3); +#endif + + for (gpa =3D start_gpa; gpa < end_gpa; gpa +=3D stride) + vcpu_arch_put_guest(*((volatile uint64_t *)gpa), gpa); + GUEST_SYNC(4); + GUEST_ASSERT(0); } =20 @@ -79,6 +117,7 @@ static void *vcpu_worker(void *data) struct vcpu_info *info =3D data; struct kvm_vcpu *vcpu =3D info->vcpu; struct kvm_vm *vm =3D vcpu->vm; + int r; =20 vcpu_args_set(vcpu, 3, info->start_gpa, info->end_gpa, vm->page_size); =20 @@ -101,6 +140,57 @@ static void *vcpu_worker(void *data) =20 /* Stage 2, read all of guest memory, which is now read-only. */ run_vcpu(vcpu, 2); + + /* + * Stage 3, write guest memory and verify KVM returns -EFAULT for once + * the mprotect(PROT_READ) lands. Only architectures that support + * validating *all* of guest memory sync for this stage, as vCPUs will + * be stuck on the faulting instruction for other architectures. Go to + * stage 3 without a rendezvous + */ + do { + r =3D _vcpu_run(vcpu); + } while (!r); + TEST_ASSERT(r =3D=3D -1 && errno =3D=3D EFAULT, + "Expected EFAULT on write to RO memory, got r =3D %d, errno =3D %d",= r, errno); + +#if defined(__x86_64__) || defined(__aarch64__) + /* + * Verify *all* writes from the guest hit EFAULT due to the VMA now + * being read-only. x86 and arm64 only at this time as skipping the + * instruction that hits the EFAULT requires advancing the program + * counter, which is arch specific and relies on inline assembly. + */ +#ifdef __x86_64__ + vcpu->run->kvm_valid_regs =3D KVM_SYNC_X86_REGS; +#endif + for (;;) { + r =3D _vcpu_run(vcpu); + if (!r) + break; + TEST_ASSERT_EQ(errno, EFAULT); +#if defined(__x86_64__) + WRITE_ONCE(vcpu->run->kvm_dirty_regs, KVM_SYNC_X86_REGS); + vcpu->run->s.regs.regs.rip +=3D 3; +#elif defined(__aarch64__) + vcpu_set_reg(vcpu, ARM64_CORE_REG(regs.pc), + vcpu_get_reg(vcpu, ARM64_CORE_REG(regs.pc)) + 4); +#endif + + } + assert_sync_stage(vcpu, 3); +#endif /* __x86_64__ || __aarch64__ */ + rendezvous_with_boss(); + + /* + * Stage 4. Run to completion, waiting for mprotect(PROT_WRITE) to + * make the memory writable again. + */ + do { + r =3D _vcpu_run(vcpu); + } while (r && errno =3D=3D EFAULT); + TEST_ASSERT_EQ(r, 0); + assert_sync_stage(vcpu, 4); rendezvous_with_boss(); =20 return NULL; @@ -183,7 +273,7 @@ int main(int argc, char *argv[]) const uint64_t start_gpa =3D SZ_4G; const int first_slot =3D 1; =20 - struct timespec time_start, time_run1, time_reset, time_run2, time_ro; + struct timespec time_start, time_run1, time_reset, time_run2, time_ro, ti= me_rw; uint64_t max_gpa, gpa, slot_size, max_mem, i; int max_slots, slot, opt, fd; bool hugepages =3D false; @@ -288,19 +378,27 @@ int main(int argc, char *argv[]) rendezvous_with_vcpus(&time_run2, "run 2"); =20 mprotect(mem, slot_size, PROT_READ); + usleep(10); + mprotect_ro_done =3D true; + sync_global_to_guest(vm, mprotect_ro_done); + rendezvous_with_vcpus(&time_ro, "mprotect RO"); + mprotect(mem, slot_size, PROT_READ | PROT_WRITE); + rendezvous_with_vcpus(&time_rw, "mprotect RW"); =20 + time_rw =3D timespec_sub(time_rw, time_ro); time_ro =3D timespec_sub(time_ro, time_run2); time_run2 =3D timespec_sub(time_run2, time_reset); time_reset =3D timespec_sub(time_reset, time_run1); time_run1 =3D timespec_sub(time_run1, time_start); =20 pr_info("run1 =3D %ld.%.9lds, reset =3D %ld.%.9lds, run2 =3D %ld.%.9lds, " - "ro =3D %ld.%.9lds\n", + "ro =3D %ld.%.9lds, rw =3D %ld.%.9lds\n", time_run1.tv_sec, time_run1.tv_nsec, time_reset.tv_sec, time_reset.tv_nsec, time_run2.tv_sec, time_run2.tv_nsec, - time_ro.tv_sec, time_ro.tv_nsec); + time_ro.tv_sec, time_ro.tv_nsec, + time_rw.tv_sec, time_rw.tv_nsec); =20 /* * Delete even numbered slots (arbitrary) and unmap the first half of --=20 2.47.0.338.g60cca15819-goog From nobody Sat Feb 7 17:04:38 2026 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DDB3714E2E2 for ; Thu, 28 Nov 2024 00:56:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755378; cv=none; b=jUo23tGC1A49DkuNOMAnSPvKb0YH8DthhLqxLdX18pfBVbE4E9wpYoe8ryZe652K+hgWokJYUEzJDsetWIey3D7foSW17+ukgQHmSy3RbrPSXhZq4PknjnNyaxu7G+W67G0bKsMDZQ7j5px6jz1S4ogD2Cu2mTjBDj4dx98tVsM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755378; c=relaxed/simple; bh=Iv7I1h9r9iPMkseXi6VtXw4q5lBAEdsZOQRMlipWUW0=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=AmmwAKWb38dT3Upmp3UD6vWgI+FBCNPhfciDZVFkZHQnZOgarXtcXTJ7+kKzgstoyAwp/FhrdArsfwql/mCKsm7rtXg5gFg0e4tF0fT7wspmKUCMujw409bxxlrVopJzDXmr+mZKUcNEmbE9+0gEKnTsoEGAQkhdrwDCiA4xHV8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=rfudlgi2; arc=none smtp.client-ip=209.85.216.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rfudlgi2" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-2ee0c9962daso321865a91.2 for ; Wed, 27 Nov 2024 16:56:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1732755374; x=1733360174; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=XhuytzFJxmZiXnZr+Cx3gH9LsZh3rYTr1gj7XdrVAQ0=; b=rfudlgi2EkuqGw4rWBA67fRF+2DYNFHZ3YJ65n0gz7Jth8yGqh9enXiSZW6uxHcPmf 8+2fz0eR6ccsh4o8Mnz0HYPtBLeCuT7mL5ocES8xz+pmd+IOscAtC/7mag9NEIQ5K6Ff PjMD5hnhV9jbpcADssbI/bjm8sdnGNIjtGwvHhylcJXnZKtGBZIUEjotBKExBbNswWwp xtl3MN+sz372wM8Ybeclsh7k17hXT3NlHMRghMwDKPrz/6eoJTh9jr00dwC6yyzNjJHn 7j/0IYowxs7+aJCukYyj5QhVhXxcIofVW9vjvwJaYm18AaaezEROR11kL5rgOeZRTlOL HOhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732755374; x=1733360174; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XhuytzFJxmZiXnZr+Cx3gH9LsZh3rYTr1gj7XdrVAQ0=; b=xH0vR3S2LO0oO5Tkk/EIJ7LKgi4oeaYrhRnFUEOnYzdYczyExjOzUVWuDe/S/jIjkb 9G1MVyf0sE6OJqtHOB/ofBI+btvkRxdYsJhenK56MDp3ufIW3dq5NSYCG/2jmRKBIZpz gm7EDjRwvL8Q3T8IkMwFpo4oBt0s89t7uVcfXlhr4sT8xnuCF1u+gptqSmGf1zbx9fjd 2gxQya1EULLKjhavmNpnS2PcLyT0Pl/xEzbXEMheJVXQHgOZpki9GwSg1V54PREwc/XO 51yQ7Yn7jHMxwF3ZpmLUjizsgB8DBP/NQJgBP3U46KpxWEk43E4xdpUsuNzccVEW4Bex s1FQ== X-Forwarded-Encrypted: i=1; AJvYcCWcQ2IDaQwl4Q49UlBFs+SFRghxLxHWeuiE5wW+f2dkXy23HGjCfwNM6TxbCoMpbsrA7vJSsvUlj4LaJSs=@vger.kernel.org X-Gm-Message-State: AOJu0YxjHNcEZXtHYiqv842ogKlXxxbZzbe53ntAzckxrt3Lk7e0hFqs dkgC1AoPRgnriTsvA/jb4DK9SfWTKXbnqwlJmqrhncKc8Av6pCRH2+ew7i2acug2+wGWGukeKpJ QkQ== X-Google-Smtp-Source: AGHT+IHUy8OzdApyttdItTpAg4xwFUeu4Y/zt4zaa/RhFSwTqk6FRmwhgtP56GKbkbL+lyHu8tVo76OXOsg= X-Received: from pjbsn5.prod.google.com ([2002:a17:90b:2e85:b0:2da:5868:311c]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:3a8c:b0:2eb:12df:caab with SMTP id 98e67ed59e1d1-2ee08ecd80dmr6738243a91.17.1732755374247; Wed, 27 Nov 2024 16:56:14 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 27 Nov 2024 16:55:45 -0800 In-Reply-To: <20241128005547.4077116-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241128005547.4077116-1-seanjc@google.com> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog Message-ID: <20241128005547.4077116-15-seanjc@google.com> Subject: [PATCH v4 14/16] KVM: selftests: Provide empty 'all' and 'clean' targets for unsupported ARCHs From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Paolo Bonzini , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Sean Christopherson Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Jones , James Houghton , Muhammad Usama Anjum Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Provide empty targets for KVM selftests if the target architecture is unsupported to make it obvious which architectures are supported, and so that various side effects don't fail and/or do weird things, e.g. as is, "mkdir -p $(sort $(dir $(TEST_GEN_PROGS)))" fails due to a missing operand, and conversely, "$(shell mkdir -p $(sort $(OUTPUT)/$(ARCH_DIR) ..." will create an empty, useless directory for the unsupported architecture. Move the guts of the Makefile to Makefile.kvm so that it's easier to see that the if-statement effectively guards all of KVM selftests. Reported-by: Muhammad Usama Anjum Signed-off-by: Sean Christopherson Acked-by: Andrew Jones Acked-by: Muhammad Usama Anjum --- tools/testing/selftests/kvm/.gitignore | 1 + tools/testing/selftests/kvm/Makefile | 336 +---------------------- tools/testing/selftests/kvm/Makefile.kvm | 334 ++++++++++++++++++++++ 3 files changed, 340 insertions(+), 331 deletions(-) create mode 100644 tools/testing/selftests/kvm/Makefile.kvm diff --git a/tools/testing/selftests/kvm/.gitignore b/tools/testing/selftes= ts/kvm/.gitignore index 7f57abf936e7..1d41a046a7bf 100644 --- a/tools/testing/selftests/kvm/.gitignore +++ b/tools/testing/selftests/kvm/.gitignore @@ -9,3 +9,4 @@ !config !settings !Makefile +!Makefile.kvm \ No newline at end of file diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests= /kvm/Makefile index c59a337cd4da..7b33464bf8cc 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile @@ -1,12 +1,9 @@ # SPDX-License-Identifier: GPL-2.0-only -include ../../../build/Build.include - -all: - top_srcdir =3D ../../../.. include $(top_srcdir)/scripts/subarch.include ARCH ?=3D $(SUBARCH) =20 +ifeq ($(ARCH),$(filter $(ARCH),arm64 s390 riscv x86 x86_64)) ifeq ($(ARCH),x86) ARCH_DIR :=3D x86_64 else ifeq ($(ARCH),arm64) @@ -17,332 +14,9 @@ else ARCH_DIR :=3D $(ARCH) endif =20 -LIBKVM +=3D lib/assert.c -LIBKVM +=3D lib/elf.c -LIBKVM +=3D lib/guest_modes.c -LIBKVM +=3D lib/io.c -LIBKVM +=3D lib/kvm_util.c -LIBKVM +=3D lib/memstress.c -LIBKVM +=3D lib/guest_sprintf.c -LIBKVM +=3D lib/rbtree.c -LIBKVM +=3D lib/sparsebit.c -LIBKVM +=3D lib/test_util.c -LIBKVM +=3D lib/ucall_common.c -LIBKVM +=3D lib/userfaultfd_util.c - -LIBKVM_STRING +=3D lib/string_override.c - -LIBKVM_x86_64 +=3D lib/x86_64/apic.c -LIBKVM_x86_64 +=3D lib/x86_64/handlers.S -LIBKVM_x86_64 +=3D lib/x86_64/hyperv.c -LIBKVM_x86_64 +=3D lib/x86_64/memstress.c -LIBKVM_x86_64 +=3D lib/x86_64/pmu.c -LIBKVM_x86_64 +=3D lib/x86_64/processor.c -LIBKVM_x86_64 +=3D lib/x86_64/sev.c -LIBKVM_x86_64 +=3D lib/x86_64/svm.c -LIBKVM_x86_64 +=3D lib/x86_64/ucall.c -LIBKVM_x86_64 +=3D lib/x86_64/vmx.c - -LIBKVM_aarch64 +=3D lib/aarch64/gic.c -LIBKVM_aarch64 +=3D lib/aarch64/gic_v3.c -LIBKVM_aarch64 +=3D lib/aarch64/gic_v3_its.c -LIBKVM_aarch64 +=3D lib/aarch64/handlers.S -LIBKVM_aarch64 +=3D lib/aarch64/processor.c -LIBKVM_aarch64 +=3D lib/aarch64/spinlock.c -LIBKVM_aarch64 +=3D lib/aarch64/ucall.c -LIBKVM_aarch64 +=3D lib/aarch64/vgic.c - -LIBKVM_s390x +=3D lib/s390x/diag318_test_handler.c -LIBKVM_s390x +=3D lib/s390x/processor.c -LIBKVM_s390x +=3D lib/s390x/ucall.c -LIBKVM_s390x +=3D lib/s390x/facility.c - -LIBKVM_riscv +=3D lib/riscv/handlers.S -LIBKVM_riscv +=3D lib/riscv/processor.c -LIBKVM_riscv +=3D lib/riscv/ucall.c - -# Non-compiled test targets -TEST_PROGS_x86_64 +=3D x86_64/nx_huge_pages_test.sh - -# Compiled test targets -TEST_GEN_PROGS_x86_64 =3D x86_64/cpuid_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/cr4_cpuid_sync_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/dirty_log_page_splitting_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/feature_msrs_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/exit_on_emulation_failure_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/fix_hypercall_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/hwcr_msr_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_clock -TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_cpuid -TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_evmcs -TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_extended_hypercalls -TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_features -TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_ipi -TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_svm_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_tlb_flush -TEST_GEN_PROGS_x86_64 +=3D x86_64/kvm_clock_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/kvm_pv_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/monitor_mwait_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/nested_exceptions_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/platform_info_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/pmu_counters_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/pmu_event_filter_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/private_mem_conversions_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/private_mem_kvm_exits_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/set_boot_cpu_id -TEST_GEN_PROGS_x86_64 +=3D x86_64/set_sregs_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/smaller_maxphyaddr_emulation_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/smm_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/state_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_preemption_timer_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/svm_vmcall_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/svm_int_ctl_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/svm_nested_shutdown_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/svm_nested_soft_inject_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/tsc_scaling_sync -TEST_GEN_PROGS_x86_64 +=3D x86_64/sync_regs_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/ucna_injection_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/userspace_io_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/userspace_msr_exit_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_apic_access_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_close_while_nested_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_dirty_log_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_exception_with_invalid_guest_state -TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_msrs_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_invalid_nested_guest_state -TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_set_nested_state_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_tsc_adjust_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_nested_tsc_scaling_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/apic_bus_clock_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/xapic_ipi_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/xapic_state_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/xcr0_cpuid_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/xss_msr_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/debug_regs -TEST_GEN_PROGS_x86_64 +=3D x86_64/tsc_msrs_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_pmu_caps_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/xen_shinfo_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/xen_vmcall_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/sev_init2_tests -TEST_GEN_PROGS_x86_64 +=3D x86_64/sev_migrate_tests -TEST_GEN_PROGS_x86_64 +=3D x86_64/sev_smoke_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/amx_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/max_vcpuid_cap_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/triple_fault_event_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/recalc_apic_map_test -TEST_GEN_PROGS_x86_64 +=3D access_tracking_perf_test -TEST_GEN_PROGS_x86_64 +=3D coalesced_io_test -TEST_GEN_PROGS_x86_64 +=3D demand_paging_test -TEST_GEN_PROGS_x86_64 +=3D dirty_log_test -TEST_GEN_PROGS_x86_64 +=3D dirty_log_perf_test -TEST_GEN_PROGS_x86_64 +=3D guest_memfd_test -TEST_GEN_PROGS_x86_64 +=3D guest_print_test -TEST_GEN_PROGS_x86_64 +=3D hardware_disable_test -TEST_GEN_PROGS_x86_64 +=3D kvm_create_max_vcpus -TEST_GEN_PROGS_x86_64 +=3D kvm_page_table_test -TEST_GEN_PROGS_x86_64 +=3D mmu_stress_test -TEST_GEN_PROGS_x86_64 +=3D memslot_modification_stress_test -TEST_GEN_PROGS_x86_64 +=3D memslot_perf_test -TEST_GEN_PROGS_x86_64 +=3D rseq_test -TEST_GEN_PROGS_x86_64 +=3D set_memory_region_test -TEST_GEN_PROGS_x86_64 +=3D steal_time -TEST_GEN_PROGS_x86_64 +=3D kvm_binary_stats_test -TEST_GEN_PROGS_x86_64 +=3D system_counter_offset_test -TEST_GEN_PROGS_x86_64 +=3D pre_fault_memory_test - -# Compiled outputs used by test targets -TEST_GEN_PROGS_EXTENDED_x86_64 +=3D x86_64/nx_huge_pages_test - -TEST_GEN_PROGS_aarch64 +=3D aarch64/aarch32_id_regs -TEST_GEN_PROGS_aarch64 +=3D aarch64/arch_timer_edge_cases -TEST_GEN_PROGS_aarch64 +=3D aarch64/debug-exceptions -TEST_GEN_PROGS_aarch64 +=3D aarch64/hypercalls -TEST_GEN_PROGS_aarch64 +=3D aarch64/mmio_abort -TEST_GEN_PROGS_aarch64 +=3D aarch64/page_fault_test -TEST_GEN_PROGS_aarch64 +=3D aarch64/psci_test -TEST_GEN_PROGS_aarch64 +=3D aarch64/set_id_regs -TEST_GEN_PROGS_aarch64 +=3D aarch64/smccc_filter -TEST_GEN_PROGS_aarch64 +=3D aarch64/vcpu_width_config -TEST_GEN_PROGS_aarch64 +=3D aarch64/vgic_init -TEST_GEN_PROGS_aarch64 +=3D aarch64/vgic_irq -TEST_GEN_PROGS_aarch64 +=3D aarch64/vgic_lpi_stress -TEST_GEN_PROGS_aarch64 +=3D aarch64/vpmu_counter_access -TEST_GEN_PROGS_aarch64 +=3D aarch64/no-vgic-v3 -TEST_GEN_PROGS_aarch64 +=3D access_tracking_perf_test -TEST_GEN_PROGS_aarch64 +=3D arch_timer -TEST_GEN_PROGS_aarch64 +=3D coalesced_io_test -TEST_GEN_PROGS_aarch64 +=3D demand_paging_test -TEST_GEN_PROGS_aarch64 +=3D dirty_log_test -TEST_GEN_PROGS_aarch64 +=3D dirty_log_perf_test -TEST_GEN_PROGS_aarch64 +=3D guest_print_test -TEST_GEN_PROGS_aarch64 +=3D get-reg-list -TEST_GEN_PROGS_aarch64 +=3D kvm_create_max_vcpus -TEST_GEN_PROGS_aarch64 +=3D kvm_page_table_test -TEST_GEN_PROGS_aarch64 +=3D memslot_modification_stress_test -TEST_GEN_PROGS_aarch64 +=3D memslot_perf_test -TEST_GEN_PROGS_aarch64 +=3D mmu_stress_test -TEST_GEN_PROGS_aarch64 +=3D rseq_test -TEST_GEN_PROGS_aarch64 +=3D set_memory_region_test -TEST_GEN_PROGS_aarch64 +=3D steal_time -TEST_GEN_PROGS_aarch64 +=3D kvm_binary_stats_test - -TEST_GEN_PROGS_s390x =3D s390x/memop -TEST_GEN_PROGS_s390x +=3D s390x/resets -TEST_GEN_PROGS_s390x +=3D s390x/sync_regs_test -TEST_GEN_PROGS_s390x +=3D s390x/tprot -TEST_GEN_PROGS_s390x +=3D s390x/cmma_test -TEST_GEN_PROGS_s390x +=3D s390x/debug_test -TEST_GEN_PROGS_s390x +=3D s390x/cpumodel_subfuncs_test -TEST_GEN_PROGS_s390x +=3D s390x/shared_zeropage_test -TEST_GEN_PROGS_s390x +=3D s390x/ucontrol_test -TEST_GEN_PROGS_s390x +=3D demand_paging_test -TEST_GEN_PROGS_s390x +=3D dirty_log_test -TEST_GEN_PROGS_s390x +=3D guest_print_test -TEST_GEN_PROGS_s390x +=3D kvm_create_max_vcpus -TEST_GEN_PROGS_s390x +=3D kvm_page_table_test -TEST_GEN_PROGS_s390x +=3D rseq_test -TEST_GEN_PROGS_s390x +=3D set_memory_region_test -TEST_GEN_PROGS_s390x +=3D kvm_binary_stats_test - -TEST_GEN_PROGS_riscv +=3D riscv/sbi_pmu_test -TEST_GEN_PROGS_riscv +=3D riscv/ebreak_test -TEST_GEN_PROGS_riscv +=3D arch_timer -TEST_GEN_PROGS_riscv +=3D coalesced_io_test -TEST_GEN_PROGS_riscv +=3D demand_paging_test -TEST_GEN_PROGS_riscv +=3D dirty_log_test -TEST_GEN_PROGS_riscv +=3D get-reg-list -TEST_GEN_PROGS_riscv +=3D guest_print_test -TEST_GEN_PROGS_riscv +=3D kvm_binary_stats_test -TEST_GEN_PROGS_riscv +=3D kvm_create_max_vcpus -TEST_GEN_PROGS_riscv +=3D kvm_page_table_test -TEST_GEN_PROGS_riscv +=3D set_memory_region_test -TEST_GEN_PROGS_riscv +=3D steal_time - -SPLIT_TESTS +=3D arch_timer -SPLIT_TESTS +=3D get-reg-list - -TEST_PROGS +=3D $(TEST_PROGS_$(ARCH_DIR)) -TEST_GEN_PROGS +=3D $(TEST_GEN_PROGS_$(ARCH_DIR)) -TEST_GEN_PROGS_EXTENDED +=3D $(TEST_GEN_PROGS_EXTENDED_$(ARCH_DIR)) -LIBKVM +=3D $(LIBKVM_$(ARCH_DIR)) - -OVERRIDE_TARGETS =3D 1 - -# lib.mak defines $(OUTPUT), prepends $(OUTPUT)/ to $(TEST_GEN_PROGS), and= most -# importantly defines, i.e. overwrites, $(CC) (unless `make -e` or `make C= C=3D`, -# which causes the environment variable to override the makefile). -include ../lib.mk - -INSTALL_HDR_PATH =3D $(top_srcdir)/usr -LINUX_HDR_PATH =3D $(INSTALL_HDR_PATH)/include/ -LINUX_TOOL_INCLUDE =3D $(top_srcdir)/tools/include -ifeq ($(ARCH),x86_64) -LINUX_TOOL_ARCH_INCLUDE =3D $(top_srcdir)/tools/arch/x86/include +include Makefile.kvm else -LINUX_TOOL_ARCH_INCLUDE =3D $(top_srcdir)/tools/arch/$(ARCH)/include +# Empty targets for unsupported architectures +all: +clean: endif -CFLAGS +=3D -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=3Dgnu99 \ - -Wno-gnu-variable-sized-type-not-at-end -MD -MP -DCONFIG_64BIT \ - -fno-builtin-memcmp -fno-builtin-memcpy \ - -fno-builtin-memset -fno-builtin-strnlen \ - -fno-stack-protector -fno-PIE -fno-strict-aliasing \ - -I$(LINUX_TOOL_INCLUDE) -I$(LINUX_TOOL_ARCH_INCLUDE) \ - -I$(LINUX_HDR_PATH) -Iinclude -I$(/dev/null; echo "$$?"),0) - CFLAGS +=3D -march=3Dx86-64-v2 -endif -endif -ifeq ($(ARCH),arm64) -tools_dir :=3D $(top_srcdir)/tools -arm64_tools_dir :=3D $(tools_dir)/arch/arm64/tools/ - -ifneq ($(abs_objdir),) -arm64_hdr_outdir :=3D $(abs_objdir)/tools/ -else -arm64_hdr_outdir :=3D $(tools_dir)/ -endif - -GEN_HDRS :=3D $(arm64_hdr_outdir)arch/arm64/include/generated/ -CFLAGS +=3D -I$(GEN_HDRS) - -$(GEN_HDRS): $(wildcard $(arm64_tools_dir)/*) - $(MAKE) -C $(arm64_tools_dir) OUTPUT=3D$(arm64_hdr_outdir) -endif - -no-pie-option :=3D $(call try-run, echo 'int main(void) { return 0; }' | \ - $(CC) -Werror $(CFLAGS) -no-pie -x c - -o "$$TMP", -no-pie) - -# On s390, build the testcases KVM-enabled -pgste-option =3D $(call try-run, echo 'int main(void) { return 0; }' | \ - $(CC) -Werror -Wl$(comma)--s390-pgste -x c - -o "$$TMP",-Wl$(comma)--s390= -pgste) - -LDLIBS +=3D -ldl -LDFLAGS +=3D -pthread $(no-pie-option) $(pgste-option) - -LIBKVM_C :=3D $(filter %.c,$(LIBKVM)) -LIBKVM_S :=3D $(filter %.S,$(LIBKVM)) -LIBKVM_C_OBJ :=3D $(patsubst %.c, $(OUTPUT)/%.o, $(LIBKVM_C)) -LIBKVM_S_OBJ :=3D $(patsubst %.S, $(OUTPUT)/%.o, $(LIBKVM_S)) -LIBKVM_STRING_OBJ :=3D $(patsubst %.c, $(OUTPUT)/%.o, $(LIBKVM_STRING)) -LIBKVM_OBJS =3D $(LIBKVM_C_OBJ) $(LIBKVM_S_OBJ) $(LIBKVM_STRING_OBJ) -SPLIT_TEST_GEN_PROGS :=3D $(patsubst %, $(OUTPUT)/%, $(SPLIT_TESTS)) -SPLIT_TEST_GEN_OBJ :=3D $(patsubst %, $(OUTPUT)/$(ARCH_DIR)/%.o, $(SPLIT_T= ESTS)) - -TEST_GEN_OBJ =3D $(patsubst %, %.o, $(TEST_GEN_PROGS)) -TEST_GEN_OBJ +=3D $(patsubst %, %.o, $(TEST_GEN_PROGS_EXTENDED)) -TEST_DEP_FILES =3D $(patsubst %.o, %.d, $(TEST_GEN_OBJ)) -TEST_DEP_FILES +=3D $(patsubst %.o, %.d, $(LIBKVM_OBJS)) -TEST_DEP_FILES +=3D $(patsubst %.o, %.d, $(SPLIT_TEST_GEN_OBJ)) --include $(TEST_DEP_FILES) - -$(shell mkdir -p $(sort $(OUTPUT)/$(ARCH_DIR) $(dir $(LIBKVM_C_OBJ) $(LIBK= VM_S_OBJ)))) - -$(filter-out $(SPLIT_TEST_GEN_PROGS), $(TEST_GEN_PROGS)) \ -$(TEST_GEN_PROGS_EXTENDED): %: %.o - $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) $< $(LIBKVM_OBJS) $= (LDLIBS) -o $@ -$(TEST_GEN_OBJ): $(OUTPUT)/%.o: %.c - $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@ - -$(SPLIT_TEST_GEN_PROGS): $(OUTPUT)/%: $(OUTPUT)/%.o $(OUTPUT)/$(ARCH_DIR)/= %.o - $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) -o $@ -$(SPLIT_TEST_GEN_OBJ): $(OUTPUT)/$(ARCH_DIR)/%.o: $(ARCH_DIR)/%.c - $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@ - -EXTRA_CLEAN +=3D $(GEN_HDRS) \ - $(LIBKVM_OBJS) \ - $(SPLIT_TEST_GEN_OBJ) \ - $(TEST_DEP_FILES) \ - $(TEST_GEN_OBJ) \ - cscope.* - -$(LIBKVM_C_OBJ): $(OUTPUT)/%.o: %.c $(GEN_HDRS) - $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@ - -$(LIBKVM_S_OBJ): $(OUTPUT)/%.o: %.S $(GEN_HDRS) - $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@ - -# Compile the string overrides as freestanding to prevent the compiler from -# generating self-referential code, e.g. without "freestanding" the compil= er may -# "optimize" memcmp() by invoking memcmp(), thus causing infinite recursio= n. -$(LIBKVM_STRING_OBJ): $(OUTPUT)/%.o: %.c - $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -ffreestanding $< -o $@ - -$(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS)))) -$(SPLIT_TEST_GEN_OBJ): $(GEN_HDRS) -$(TEST_GEN_PROGS): $(LIBKVM_OBJS) -$(TEST_GEN_PROGS_EXTENDED): $(LIBKVM_OBJS) -$(TEST_GEN_OBJ): $(GEN_HDRS) - -cscope: include_paths =3D $(LINUX_TOOL_INCLUDE) $(LINUX_HDR_PATH) include = lib .. -cscope: - $(RM) cscope.* - (find $(include_paths) -name '*.h' \ - -exec realpath --relative-base=3D$(PWD) {} \;; \ - find . -name '*.c' \ - -exec realpath --relative-base=3D$(PWD) {} \;) | sort -u > cscope.files - cscope -b diff --git a/tools/testing/selftests/kvm/Makefile.kvm b/tools/testing/selft= ests/kvm/Makefile.kvm new file mode 100644 index 000000000000..e988a72f8c20 --- /dev/null +++ b/tools/testing/selftests/kvm/Makefile.kvm @@ -0,0 +1,334 @@ +# SPDX-License-Identifier: GPL-2.0-only +include ../../../build/Build.include + +all: + +LIBKVM +=3D lib/assert.c +LIBKVM +=3D lib/elf.c +LIBKVM +=3D lib/guest_modes.c +LIBKVM +=3D lib/io.c +LIBKVM +=3D lib/kvm_util.c +LIBKVM +=3D lib/memstress.c +LIBKVM +=3D lib/guest_sprintf.c +LIBKVM +=3D lib/rbtree.c +LIBKVM +=3D lib/sparsebit.c +LIBKVM +=3D lib/test_util.c +LIBKVM +=3D lib/ucall_common.c +LIBKVM +=3D lib/userfaultfd_util.c + +LIBKVM_STRING +=3D lib/string_override.c + +LIBKVM_x86_64 +=3D lib/x86_64/apic.c +LIBKVM_x86_64 +=3D lib/x86_64/handlers.S +LIBKVM_x86_64 +=3D lib/x86_64/hyperv.c +LIBKVM_x86_64 +=3D lib/x86_64/memstress.c +LIBKVM_x86_64 +=3D lib/x86_64/pmu.c +LIBKVM_x86_64 +=3D lib/x86_64/processor.c +LIBKVM_x86_64 +=3D lib/x86_64/sev.c +LIBKVM_x86_64 +=3D lib/x86_64/svm.c +LIBKVM_x86_64 +=3D lib/x86_64/ucall.c +LIBKVM_x86_64 +=3D lib/x86_64/vmx.c + +LIBKVM_aarch64 +=3D lib/aarch64/gic.c +LIBKVM_aarch64 +=3D lib/aarch64/gic_v3.c +LIBKVM_aarch64 +=3D lib/aarch64/gic_v3_its.c +LIBKVM_aarch64 +=3D lib/aarch64/handlers.S +LIBKVM_aarch64 +=3D lib/aarch64/processor.c +LIBKVM_aarch64 +=3D lib/aarch64/spinlock.c +LIBKVM_aarch64 +=3D lib/aarch64/ucall.c +LIBKVM_aarch64 +=3D lib/aarch64/vgic.c + +LIBKVM_s390x +=3D lib/s390x/diag318_test_handler.c +LIBKVM_s390x +=3D lib/s390x/processor.c +LIBKVM_s390x +=3D lib/s390x/ucall.c +LIBKVM_s390x +=3D lib/s390x/facility.c + +LIBKVM_riscv +=3D lib/riscv/handlers.S +LIBKVM_riscv +=3D lib/riscv/processor.c +LIBKVM_riscv +=3D lib/riscv/ucall.c + +# Non-compiled test targets +TEST_PROGS_x86_64 +=3D x86_64/nx_huge_pages_test.sh + +# Compiled test targets +TEST_GEN_PROGS_x86_64 =3D x86_64/cpuid_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/cr4_cpuid_sync_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/dirty_log_page_splitting_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/feature_msrs_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/exit_on_emulation_failure_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/fix_hypercall_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/hwcr_msr_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_clock +TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_cpuid +TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_evmcs +TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_extended_hypercalls +TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_features +TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_ipi +TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_svm_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_tlb_flush +TEST_GEN_PROGS_x86_64 +=3D x86_64/kvm_clock_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/kvm_pv_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/monitor_mwait_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/nested_exceptions_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/platform_info_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/pmu_counters_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/pmu_event_filter_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/private_mem_conversions_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/private_mem_kvm_exits_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/set_boot_cpu_id +TEST_GEN_PROGS_x86_64 +=3D x86_64/set_sregs_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/smaller_maxphyaddr_emulation_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/smm_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/state_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_preemption_timer_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/svm_vmcall_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/svm_int_ctl_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/svm_nested_shutdown_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/svm_nested_soft_inject_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/tsc_scaling_sync +TEST_GEN_PROGS_x86_64 +=3D x86_64/sync_regs_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/ucna_injection_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/userspace_io_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/userspace_msr_exit_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_apic_access_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_close_while_nested_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_dirty_log_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_exception_with_invalid_guest_state +TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_msrs_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_invalid_nested_guest_state +TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_set_nested_state_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_tsc_adjust_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_nested_tsc_scaling_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/apic_bus_clock_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/xapic_ipi_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/xapic_state_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/xcr0_cpuid_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/xss_msr_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/debug_regs +TEST_GEN_PROGS_x86_64 +=3D x86_64/tsc_msrs_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_pmu_caps_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/xen_shinfo_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/xen_vmcall_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/sev_init2_tests +TEST_GEN_PROGS_x86_64 +=3D x86_64/sev_migrate_tests +TEST_GEN_PROGS_x86_64 +=3D x86_64/sev_smoke_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/amx_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/max_vcpuid_cap_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/triple_fault_event_test +TEST_GEN_PROGS_x86_64 +=3D x86_64/recalc_apic_map_test +TEST_GEN_PROGS_x86_64 +=3D access_tracking_perf_test +TEST_GEN_PROGS_x86_64 +=3D coalesced_io_test +TEST_GEN_PROGS_x86_64 +=3D demand_paging_test +TEST_GEN_PROGS_x86_64 +=3D dirty_log_test +TEST_GEN_PROGS_x86_64 +=3D dirty_log_perf_test +TEST_GEN_PROGS_x86_64 +=3D guest_memfd_test +TEST_GEN_PROGS_x86_64 +=3D guest_print_test +TEST_GEN_PROGS_x86_64 +=3D hardware_disable_test +TEST_GEN_PROGS_x86_64 +=3D kvm_create_max_vcpus +TEST_GEN_PROGS_x86_64 +=3D kvm_page_table_test +TEST_GEN_PROGS_x86_64 +=3D mmu_stress_test +TEST_GEN_PROGS_x86_64 +=3D memslot_modification_stress_test +TEST_GEN_PROGS_x86_64 +=3D memslot_perf_test +TEST_GEN_PROGS_x86_64 +=3D rseq_test +TEST_GEN_PROGS_x86_64 +=3D set_memory_region_test +TEST_GEN_PROGS_x86_64 +=3D steal_time +TEST_GEN_PROGS_x86_64 +=3D kvm_binary_stats_test +TEST_GEN_PROGS_x86_64 +=3D system_counter_offset_test +TEST_GEN_PROGS_x86_64 +=3D pre_fault_memory_test + +# Compiled outputs used by test targets +TEST_GEN_PROGS_EXTENDED_x86_64 +=3D x86_64/nx_huge_pages_test + +TEST_GEN_PROGS_aarch64 +=3D aarch64/aarch32_id_regs +TEST_GEN_PROGS_aarch64 +=3D aarch64/arch_timer_edge_cases +TEST_GEN_PROGS_aarch64 +=3D aarch64/debug-exceptions +TEST_GEN_PROGS_aarch64 +=3D aarch64/hypercalls +TEST_GEN_PROGS_aarch64 +=3D aarch64/mmio_abort +TEST_GEN_PROGS_aarch64 +=3D aarch64/page_fault_test +TEST_GEN_PROGS_aarch64 +=3D aarch64/psci_test +TEST_GEN_PROGS_aarch64 +=3D aarch64/set_id_regs +TEST_GEN_PROGS_aarch64 +=3D aarch64/smccc_filter +TEST_GEN_PROGS_aarch64 +=3D aarch64/vcpu_width_config +TEST_GEN_PROGS_aarch64 +=3D aarch64/vgic_init +TEST_GEN_PROGS_aarch64 +=3D aarch64/vgic_irq +TEST_GEN_PROGS_aarch64 +=3D aarch64/vgic_lpi_stress +TEST_GEN_PROGS_aarch64 +=3D aarch64/vpmu_counter_access +TEST_GEN_PROGS_aarch64 +=3D aarch64/no-vgic-v3 +TEST_GEN_PROGS_aarch64 +=3D access_tracking_perf_test +TEST_GEN_PROGS_aarch64 +=3D arch_timer +TEST_GEN_PROGS_aarch64 +=3D coalesced_io_test +TEST_GEN_PROGS_aarch64 +=3D demand_paging_test +TEST_GEN_PROGS_aarch64 +=3D dirty_log_test +TEST_GEN_PROGS_aarch64 +=3D dirty_log_perf_test +TEST_GEN_PROGS_aarch64 +=3D guest_print_test +TEST_GEN_PROGS_aarch64 +=3D get-reg-list +TEST_GEN_PROGS_aarch64 +=3D kvm_create_max_vcpus +TEST_GEN_PROGS_aarch64 +=3D kvm_page_table_test +TEST_GEN_PROGS_aarch64 +=3D memslot_modification_stress_test +TEST_GEN_PROGS_aarch64 +=3D memslot_perf_test +TEST_GEN_PROGS_aarch64 +=3D mmu_stress_test +TEST_GEN_PROGS_aarch64 +=3D rseq_test +TEST_GEN_PROGS_aarch64 +=3D set_memory_region_test +TEST_GEN_PROGS_aarch64 +=3D steal_time +TEST_GEN_PROGS_aarch64 +=3D kvm_binary_stats_test + +TEST_GEN_PROGS_s390x =3D s390x/memop +TEST_GEN_PROGS_s390x +=3D s390x/resets +TEST_GEN_PROGS_s390x +=3D s390x/sync_regs_test +TEST_GEN_PROGS_s390x +=3D s390x/tprot +TEST_GEN_PROGS_s390x +=3D s390x/cmma_test +TEST_GEN_PROGS_s390x +=3D s390x/debug_test +TEST_GEN_PROGS_s390x +=3D s390x/cpumodel_subfuncs_test +TEST_GEN_PROGS_s390x +=3D s390x/shared_zeropage_test +TEST_GEN_PROGS_s390x +=3D s390x/ucontrol_test +TEST_GEN_PROGS_s390x +=3D demand_paging_test +TEST_GEN_PROGS_s390x +=3D dirty_log_test +TEST_GEN_PROGS_s390x +=3D guest_print_test +TEST_GEN_PROGS_s390x +=3D kvm_create_max_vcpus +TEST_GEN_PROGS_s390x +=3D kvm_page_table_test +TEST_GEN_PROGS_s390x +=3D rseq_test +TEST_GEN_PROGS_s390x +=3D set_memory_region_test +TEST_GEN_PROGS_s390x +=3D kvm_binary_stats_test + +TEST_GEN_PROGS_riscv +=3D riscv/sbi_pmu_test +TEST_GEN_PROGS_riscv +=3D riscv/ebreak_test +TEST_GEN_PROGS_riscv +=3D arch_timer +TEST_GEN_PROGS_riscv +=3D coalesced_io_test +TEST_GEN_PROGS_riscv +=3D demand_paging_test +TEST_GEN_PROGS_riscv +=3D dirty_log_test +TEST_GEN_PROGS_riscv +=3D get-reg-list +TEST_GEN_PROGS_riscv +=3D guest_print_test +TEST_GEN_PROGS_riscv +=3D kvm_binary_stats_test +TEST_GEN_PROGS_riscv +=3D kvm_create_max_vcpus +TEST_GEN_PROGS_riscv +=3D kvm_page_table_test +TEST_GEN_PROGS_riscv +=3D set_memory_region_test +TEST_GEN_PROGS_riscv +=3D steal_time + +SPLIT_TESTS +=3D arch_timer +SPLIT_TESTS +=3D get-reg-list + +TEST_PROGS +=3D $(TEST_PROGS_$(ARCH_DIR)) +TEST_GEN_PROGS +=3D $(TEST_GEN_PROGS_$(ARCH_DIR)) +TEST_GEN_PROGS_EXTENDED +=3D $(TEST_GEN_PROGS_EXTENDED_$(ARCH_DIR)) +LIBKVM +=3D $(LIBKVM_$(ARCH_DIR)) + +OVERRIDE_TARGETS =3D 1 + +# lib.mak defines $(OUTPUT), prepends $(OUTPUT)/ to $(TEST_GEN_PROGS), and= most +# importantly defines, i.e. overwrites, $(CC) (unless `make -e` or `make C= C=3D`, +# which causes the environment variable to override the makefile). +include ../lib.mk + +INSTALL_HDR_PATH =3D $(top_srcdir)/usr +LINUX_HDR_PATH =3D $(INSTALL_HDR_PATH)/include/ +LINUX_TOOL_INCLUDE =3D $(top_srcdir)/tools/include +ifeq ($(ARCH),x86_64) +LINUX_TOOL_ARCH_INCLUDE =3D $(top_srcdir)/tools/arch/x86/include +else +LINUX_TOOL_ARCH_INCLUDE =3D $(top_srcdir)/tools/arch/$(ARCH)/include +endif +CFLAGS +=3D -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=3Dgnu99 \ + -Wno-gnu-variable-sized-type-not-at-end -MD -MP -DCONFIG_64BIT \ + -fno-builtin-memcmp -fno-builtin-memcpy \ + -fno-builtin-memset -fno-builtin-strnlen \ + -fno-stack-protector -fno-PIE -fno-strict-aliasing \ + -I$(LINUX_TOOL_INCLUDE) -I$(LINUX_TOOL_ARCH_INCLUDE) \ + -I$(LINUX_HDR_PATH) -Iinclude -I$(/dev/null; echo "$$?"),0) + CFLAGS +=3D -march=3Dx86-64-v2 +endif +endif +ifeq ($(ARCH),arm64) +tools_dir :=3D $(top_srcdir)/tools +arm64_tools_dir :=3D $(tools_dir)/arch/arm64/tools/ + +ifneq ($(abs_objdir),) +arm64_hdr_outdir :=3D $(abs_objdir)/tools/ +else +arm64_hdr_outdir :=3D $(tools_dir)/ +endif + +GEN_HDRS :=3D $(arm64_hdr_outdir)arch/arm64/include/generated/ +CFLAGS +=3D -I$(GEN_HDRS) + +$(GEN_HDRS): $(wildcard $(arm64_tools_dir)/*) + $(MAKE) -C $(arm64_tools_dir) OUTPUT=3D$(arm64_hdr_outdir) +endif + +no-pie-option :=3D $(call try-run, echo 'int main(void) { return 0; }' | \ + $(CC) -Werror $(CFLAGS) -no-pie -x c - -o "$$TMP", -no-pie) + +# On s390, build the testcases KVM-enabled +pgste-option =3D $(call try-run, echo 'int main(void) { return 0; }' | \ + $(CC) -Werror -Wl$(comma)--s390-pgste -x c - -o "$$TMP",-Wl$(comma)--s390= -pgste) + +LDLIBS +=3D -ldl +LDFLAGS +=3D -pthread $(no-pie-option) $(pgste-option) + +LIBKVM_C :=3D $(filter %.c,$(LIBKVM)) +LIBKVM_S :=3D $(filter %.S,$(LIBKVM)) +LIBKVM_C_OBJ :=3D $(patsubst %.c, $(OUTPUT)/%.o, $(LIBKVM_C)) +LIBKVM_S_OBJ :=3D $(patsubst %.S, $(OUTPUT)/%.o, $(LIBKVM_S)) +LIBKVM_STRING_OBJ :=3D $(patsubst %.c, $(OUTPUT)/%.o, $(LIBKVM_STRING)) +LIBKVM_OBJS =3D $(LIBKVM_C_OBJ) $(LIBKVM_S_OBJ) $(LIBKVM_STRING_OBJ) +SPLIT_TEST_GEN_PROGS :=3D $(patsubst %, $(OUTPUT)/%, $(SPLIT_TESTS)) +SPLIT_TEST_GEN_OBJ :=3D $(patsubst %, $(OUTPUT)/$(ARCH_DIR)/%.o, $(SPLIT_T= ESTS)) + +TEST_GEN_OBJ =3D $(patsubst %, %.o, $(TEST_GEN_PROGS)) +TEST_GEN_OBJ +=3D $(patsubst %, %.o, $(TEST_GEN_PROGS_EXTENDED)) +TEST_DEP_FILES =3D $(patsubst %.o, %.d, $(TEST_GEN_OBJ)) +TEST_DEP_FILES +=3D $(patsubst %.o, %.d, $(LIBKVM_OBJS)) +TEST_DEP_FILES +=3D $(patsubst %.o, %.d, $(SPLIT_TEST_GEN_OBJ)) +-include $(TEST_DEP_FILES) + +$(shell mkdir -p $(sort $(OUTPUT)/$(ARCH_DIR) $(dir $(LIBKVM_C_OBJ) $(LIBK= VM_S_OBJ)))) + +$(filter-out $(SPLIT_TEST_GEN_PROGS), $(TEST_GEN_PROGS)) \ +$(TEST_GEN_PROGS_EXTENDED): %: %.o + $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) $< $(LIBKVM_OBJS) $= (LDLIBS) -o $@ +$(TEST_GEN_OBJ): $(OUTPUT)/%.o: %.c + $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@ + +$(SPLIT_TEST_GEN_PROGS): $(OUTPUT)/%: $(OUTPUT)/%.o $(OUTPUT)/$(ARCH_DIR)/= %.o + $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) -o $@ +$(SPLIT_TEST_GEN_OBJ): $(OUTPUT)/$(ARCH_DIR)/%.o: $(ARCH_DIR)/%.c + $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@ + +EXTRA_CLEAN +=3D $(GEN_HDRS) \ + $(LIBKVM_OBJS) \ + $(SPLIT_TEST_GEN_OBJ) \ + $(TEST_DEP_FILES) \ + $(TEST_GEN_OBJ) \ + cscope.* + +$(LIBKVM_C_OBJ): $(OUTPUT)/%.o: %.c $(GEN_HDRS) + $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@ + +$(LIBKVM_S_OBJ): $(OUTPUT)/%.o: %.S $(GEN_HDRS) + $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@ + +# Compile the string overrides as freestanding to prevent the compiler from +# generating self-referential code, e.g. without "freestanding" the compil= er may +# "optimize" memcmp() by invoking memcmp(), thus causing infinite recursio= n. +$(LIBKVM_STRING_OBJ): $(OUTPUT)/%.o: %.c + $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -ffreestanding $< -o $@ + +$(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS)))) +$(SPLIT_TEST_GEN_OBJ): $(GEN_HDRS) +$(TEST_GEN_PROGS): $(LIBKVM_OBJS) +$(TEST_GEN_PROGS_EXTENDED): $(LIBKVM_OBJS) +$(TEST_GEN_OBJ): $(GEN_HDRS) + +cscope: include_paths =3D $(LINUX_TOOL_INCLUDE) $(LINUX_HDR_PATH) include = lib .. +cscope: + $(RM) cscope.* + (find $(include_paths) -name '*.h' \ + -exec realpath --relative-base=3D$(PWD) {} \;; \ + find . -name '*.c' \ + -exec realpath --relative-base=3D$(PWD) {} \;) | sort -u > cscope.files + cscope -b --=20 2.47.0.338.g60cca15819-goog From nobody Sat Feb 7 17:04:38 2026 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 945FA1531F9 for ; Thu, 28 Nov 2024 00:56:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755380; cv=none; b=AWf/SGJLpzVz/F8oheseqE1RK9jAAPL5Zz6ycvVu1X15tM++IiBxnAawAhp9qujSxGmgRAK8UobZQI3434DPVinDBfGEuyDA5oiY9Yk5jtBqucqrYK2xVOP7kPq/MlCnRxJd/Wwfysk/zlPB89hgyh+6PgQCVIJYDOHOUbfv7+w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755380; c=relaxed/simple; bh=WeLCGJ6wdwv6mN6qETUcwZHgZo1/1azt/hSsOnWu0HQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=YIF0M6Sx1NwTeTI5rIj7L4DzW41l4+E5ohmbos9um7KlbgfSxB/IMzljkiylOnNb27UTBtgoYW5BNc571pZ0DBCwG4VL9UMQTwhUvM5bMTluzjdY+/Vy8ZjdU17D8EZUNlyiyxRxYZHySEmGXmnRVqiRzq4oCDxhGq2GQpcRtEU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=l8Xi1XLc; arc=none smtp.client-ip=209.85.216.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="l8Xi1XLc" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-2eaadc7c431so489830a91.0 for ; Wed, 27 Nov 2024 16:56:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1732755376; x=1733360176; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=jwZL+hbZN5VAiJNFcGlkmw4Zq6L4XxsJYRI0qx/w9LU=; b=l8Xi1XLcBBFQLb+MB8qTS2MeIxPqNjdKzwNGjwJetYlqzfBVdxsVnwPCsXRPUFO1wz l5J4mUDu1m9n8ZwQr1XCVIvQd9hUlAtactBeq8KjsZvoQBj8qoVVY0M3xaxuUPiBML2j jzetar3fnUxrXp0lGt/Q+kESY/q01CewNak2vEuwNTLCPm7Zp4eK+zx29C3WbI6WvDSc 38adfm6loQFgemBfTaOYfCHsfkvpDSvR0Wy0uAxKwuVajzVkf9HoR/a9Qo3Px0tJGfUa rUX953OtTpy4m6TbteSXX9VkpQ5+X7M6VEX2p1qNsEbKh4+6g8TCsDqvjQXlDTLWpWik qZ4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732755376; x=1733360176; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jwZL+hbZN5VAiJNFcGlkmw4Zq6L4XxsJYRI0qx/w9LU=; b=l3ppwpmaRVk4hkfKAqIZPA+DxeKmgoqAGR1kE4ok1KthXdjWlHgNTQjkDblOcL1J3S inKzp/6/96X0OJf9cI08OR8EY4B6V6H2n6S6Xn9jgN6ewmZvvQETxsvhWMBWs9JCEsD5 F8qXcN3WPWWbhTK2qkq+ky6vUeFmBTlJ7ol3Q5Bgn62sigDQe8tL6dpupi+9GbDGbR5r 2DXKpHP37mV5CXyLlytyAQf7mccgEFWZZMM/tUxvrqBQRANSrzW968xaR88sL8e5Z9pD ifrSiOoYbXRFeHkgzLnJ6tyn5fWxND6rHDQ9wwhR5w3yTITOWxJveMctFU2Kw36Boxqk Wolw== X-Forwarded-Encrypted: i=1; AJvYcCV2lChmPUVNZV6V7ZFt/DQMGuWoOmD7tC2A1VTjMj8ITm9GSpFwLBPxwYPab38NhjdBiBx2fwm2MUZ2+Ns=@vger.kernel.org X-Gm-Message-State: AOJu0YxkPQYArsHgaiIu47W5hzsnFmJvzNkXCEJ87V7lUEPir89iuOsu r8Ctq/HHAJgi/pKbAIdFOeSzkeOteBhK3bMdHa++LV83qM+9PQ5OBSy5SciB9RlvCxCEWBVMgmI XzA== X-Google-Smtp-Source: AGHT+IGzwbTMjDQb5Ni3FGlo0Oh34LPI8CuRxYJH3h+eD4NfW+FN5xil2icCv4U0st/bB8vMFFd4XpuAxyg= X-Received: from pjur12.prod.google.com ([2002:a17:90a:d40c:b0:2ee:2ce7:7c8d]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90a:d443:b0:2ea:a13f:f815 with SMTP id 98e67ed59e1d1-2ee097e2053mr5959769a91.32.1732755376093; Wed, 27 Nov 2024 16:56:16 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 27 Nov 2024 16:55:46 -0800 In-Reply-To: <20241128005547.4077116-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241128005547.4077116-1-seanjc@google.com> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog Message-ID: <20241128005547.4077116-16-seanjc@google.com> Subject: [PATCH v4 15/16] KVM: selftests: Use canonical $(ARCH) paths for KVM selftests directories From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Paolo Bonzini , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Sean Christopherson Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Jones , James Houghton , Muhammad Usama Anjum Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use the kernel's canonical $(ARCH) paths instead of the raw target triple for KVM selftests directories. KVM selftests are quite nearly the only place in the entire kernel that using the target triple for directories, tools/testing/selftests/drivers/s390x being the lone holdout. Using the kernel's preferred nomenclature eliminates the minor, but annoying, friction of having to translate to KVM's selftests directories, e.g. for pattern matching, opening files, running selftests, etc. Opportunsitically delete file comments that reference the full path of the file, as they are obviously prone to becoming stale, and serve no known purpose. Signed-off-by: Sean Christopherson Acked-by: Andrew Jones Acked-by: Claudio Imbrenda Reviewed-by: Muhammad Usama Anjum --- MAINTAINERS | 12 +- tools/testing/selftests/kvm/Makefile | 10 +- tools/testing/selftests/kvm/Makefile.kvm | 320 +++++++++--------- .../kvm/{aarch64 =3D> arm64}/aarch32_id_regs.c | 0 .../kvm/{aarch64 =3D> arm64}/arch_timer.c | 0 .../arch_timer_edge_cases.c | 0 .../kvm/{aarch64 =3D> arm64}/debug-exceptions.c | 0 .../kvm/{aarch64 =3D> arm64}/get-reg-list.c | 0 .../kvm/{aarch64 =3D> arm64}/hypercalls.c | 0 .../kvm/{aarch64 =3D> arm64}/mmio_abort.c | 0 .../kvm/{aarch64 =3D> arm64}/no-vgic-v3.c | 0 .../kvm/{aarch64 =3D> arm64}/page_fault_test.c | 0 .../kvm/{aarch64 =3D> arm64}/psci_test.c | 0 .../kvm/{aarch64 =3D> arm64}/set_id_regs.c | 0 .../kvm/{aarch64 =3D> arm64}/smccc_filter.c | 0 .../{aarch64 =3D> arm64}/vcpu_width_config.c | 0 .../kvm/{aarch64 =3D> arm64}/vgic_init.c | 0 .../kvm/{aarch64 =3D> arm64}/vgic_irq.c | 0 .../kvm/{aarch64 =3D> arm64}/vgic_lpi_stress.c | 0 .../{aarch64 =3D> arm64}/vpmu_counter_access.c | 0 .../selftests/kvm/dirty_log_perf_test.c | 2 +- .../include/{aarch64 =3D> arm64}/arch_timer.h | 0 .../kvm/include/{aarch64 =3D> arm64}/delay.h | 0 .../kvm/include/{aarch64 =3D> arm64}/gic.h | 0 .../kvm/include/{aarch64 =3D> arm64}/gic_v3.h | 0 .../include/{aarch64 =3D> arm64}/gic_v3_its.h | 0 .../{aarch64 =3D> arm64}/kvm_util_arch.h | 0 .../include/{aarch64 =3D> arm64}/processor.h | 0 .../kvm/include/{aarch64 =3D> arm64}/spinlock.h | 0 .../kvm/include/{aarch64 =3D> arm64}/ucall.h | 0 .../kvm/include/{aarch64 =3D> arm64}/vgic.h | 0 .../kvm/include/{s390x =3D> s390}/debug_print.h | 0 .../{s390x =3D> s390}/diag318_test_handler.h | 0 .../kvm/include/{s390x =3D> s390}/facility.h | 0 .../include/{s390x =3D> s390}/kvm_util_arch.h | 0 .../kvm/include/{s390x =3D> s390}/processor.h | 0 .../kvm/include/{s390x =3D> s390}/sie.h | 0 .../kvm/include/{s390x =3D> s390}/ucall.h | 0 .../kvm/include/{x86_64 =3D> x86}/apic.h | 2 - .../kvm/include/{x86_64 =3D> x86}/evmcs.h | 3 - .../kvm/include/{x86_64 =3D> x86}/hyperv.h | 3 - .../include/{x86_64 =3D> x86}/kvm_util_arch.h | 0 .../kvm/include/{x86_64 =3D> x86}/mce.h | 2 - .../kvm/include/{x86_64 =3D> x86}/pmu.h | 0 .../kvm/include/{x86_64 =3D> x86}/processor.h | 2 - .../kvm/include/{x86_64 =3D> x86}/sev.h | 0 .../kvm/include/{x86_64 =3D> x86}/svm.h | 6 - .../kvm/include/{x86_64 =3D> x86}/svm_util.h | 3 - .../kvm/include/{x86_64 =3D> x86}/ucall.h | 0 .../kvm/include/{x86_64 =3D> x86}/vmx.h | 2 - .../kvm/lib/{aarch64 =3D> arm64}/gic.c | 0 .../kvm/lib/{aarch64 =3D> arm64}/gic_private.h | 0 .../kvm/lib/{aarch64 =3D> arm64}/gic_v3.c | 0 .../kvm/lib/{aarch64 =3D> arm64}/gic_v3_its.c | 0 .../kvm/lib/{aarch64 =3D> arm64}/handlers.S | 0 .../kvm/lib/{aarch64 =3D> arm64}/processor.c | 0 .../kvm/lib/{aarch64 =3D> arm64}/spinlock.c | 0 .../kvm/lib/{aarch64 =3D> arm64}/ucall.c | 0 .../kvm/lib/{aarch64 =3D> arm64}/vgic.c | 0 .../{s390x =3D> s390}/diag318_test_handler.c | 0 .../kvm/lib/{s390x =3D> s390}/facility.c | 0 .../kvm/lib/{s390x =3D> s390}/processor.c | 0 .../selftests/kvm/lib/{s390x =3D> s390}/ucall.c | 0 .../selftests/kvm/lib/{x86_64 =3D> x86}/apic.c | 0 .../kvm/lib/{x86_64 =3D> x86}/handlers.S | 0 .../kvm/lib/{x86_64 =3D> x86}/hyperv.c | 0 .../kvm/lib/{x86_64 =3D> x86}/memstress.c | 2 +- .../selftests/kvm/lib/{x86_64 =3D> x86}/pmu.c | 0 .../kvm/lib/{x86_64 =3D> x86}/processor.c | 2 - .../selftests/kvm/lib/{x86_64 =3D> x86}/sev.c | 0 .../selftests/kvm/lib/{x86_64 =3D> x86}/svm.c | 1 - .../selftests/kvm/lib/{x86_64 =3D> x86}/ucall.c | 0 .../selftests/kvm/lib/{x86_64 =3D> x86}/vmx.c | 2 - .../selftests/kvm/{s390x =3D> s390}/cmma_test.c | 0 .../selftests/kvm/{s390x =3D> s390}/config | 0 .../{s390x =3D> s390}/cpumodel_subfuncs_test.c | 0 .../kvm/{s390x =3D> s390}/debug_test.c | 0 .../selftests/kvm/{s390x =3D> s390}/memop.c | 0 .../selftests/kvm/{s390x =3D> s390}/resets.c | 0 .../{s390x =3D> s390}/shared_zeropage_test.c | 0 .../kvm/{s390x =3D> s390}/sync_regs_test.c | 0 .../selftests/kvm/{s390x =3D> s390}/tprot.c | 0 .../kvm/{s390x =3D> s390}/ucontrol_test.c | 0 .../selftests/kvm/set_memory_region_test.c | 6 +- .../selftests/kvm/{x86_64 =3D> x86}/amx_test.c | 0 .../kvm/{x86_64 =3D> x86}/apic_bus_clock_test.c | 0 .../kvm/{x86_64 =3D> x86}/cpuid_test.c | 0 .../kvm/{x86_64 =3D> x86}/cr4_cpuid_sync_test.c | 0 .../kvm/{x86_64 =3D> x86}/debug_regs.c | 0 .../dirty_log_page_splitting_test.c | 0 .../exit_on_emulation_failure_test.c | 0 .../kvm/{x86_64 =3D> x86}/feature_msrs_test.c | 0 .../kvm/{x86_64 =3D> x86}/fix_hypercall_test.c | 0 .../kvm/{x86_64 =3D> x86}/flds_emulation.h | 0 .../kvm/{x86_64 =3D> x86}/hwcr_msr_test.c | 0 .../kvm/{x86_64 =3D> x86}/hyperv_clock.c | 0 .../kvm/{x86_64 =3D> x86}/hyperv_cpuid.c | 0 .../kvm/{x86_64 =3D> x86}/hyperv_evmcs.c | 0 .../hyperv_extended_hypercalls.c | 0 .../kvm/{x86_64 =3D> x86}/hyperv_features.c | 0 .../kvm/{x86_64 =3D> x86}/hyperv_ipi.c | 0 .../kvm/{x86_64 =3D> x86}/hyperv_svm_test.c | 0 .../kvm/{x86_64 =3D> x86}/hyperv_tlb_flush.c | 0 .../kvm/{x86_64 =3D> x86}/kvm_clock_test.c | 0 .../kvm/{x86_64 =3D> x86}/kvm_pv_test.c | 0 .../kvm/{x86_64 =3D> x86}/max_vcpuid_cap_test.c | 0 .../kvm/{x86_64 =3D> x86}/monitor_mwait_test.c | 0 .../{x86_64 =3D> x86}/nested_exceptions_test.c | 0 .../kvm/{x86_64 =3D> x86}/nx_huge_pages_test.c | 0 .../kvm/{x86_64 =3D> x86}/nx_huge_pages_test.sh | 0 .../kvm/{x86_64 =3D> x86}/platform_info_test.c | 0 .../kvm/{x86_64 =3D> x86}/pmu_counters_test.c | 0 .../{x86_64 =3D> x86}/pmu_event_filter_test.c | 0 .../private_mem_conversions_test.c | 0 .../private_mem_kvm_exits_test.c | 0 .../{x86_64 =3D> x86}/recalc_apic_map_test.c | 0 .../kvm/{x86_64 =3D> x86}/set_boot_cpu_id.c | 0 .../kvm/{x86_64 =3D> x86}/set_sregs_test.c | 0 .../kvm/{x86_64 =3D> x86}/sev_init2_tests.c | 0 .../kvm/{x86_64 =3D> x86}/sev_migrate_tests.c | 0 .../kvm/{x86_64 =3D> x86}/sev_smoke_test.c | 0 .../smaller_maxphyaddr_emulation_test.c | 0 .../selftests/kvm/{x86_64 =3D> x86}/smm_test.c | 0 .../kvm/{x86_64 =3D> x86}/state_test.c | 0 .../kvm/{x86_64 =3D> x86}/svm_int_ctl_test.c | 0 .../svm_nested_shutdown_test.c | 0 .../svm_nested_soft_inject_test.c | 0 .../kvm/{x86_64 =3D> x86}/svm_vmcall_test.c | 0 .../kvm/{x86_64 =3D> x86}/sync_regs_test.c | 0 .../{x86_64 =3D> x86}/triple_fault_event_test.c | 0 .../kvm/{x86_64 =3D> x86}/tsc_msrs_test.c | 0 .../kvm/{x86_64 =3D> x86}/tsc_scaling_sync.c | 0 .../kvm/{x86_64 =3D> x86}/ucna_injection_test.c | 0 .../kvm/{x86_64 =3D> x86}/userspace_io_test.c | 0 .../{x86_64 =3D> x86}/userspace_msr_exit_test.c | 0 .../{x86_64 =3D> x86}/vmx_apic_access_test.c | 0 .../vmx_close_while_nested_test.c | 0 .../kvm/{x86_64 =3D> x86}/vmx_dirty_log_test.c | 0 .../vmx_exception_with_invalid_guest_state.c | 0 .../vmx_invalid_nested_guest_state.c | 0 .../kvm/{x86_64 =3D> x86}/vmx_msrs_test.c | 0 .../vmx_nested_tsc_scaling_test.c | 0 .../kvm/{x86_64 =3D> x86}/vmx_pmu_caps_test.c | 0 .../vmx_preemption_timer_test.c | 0 .../vmx_set_nested_state_test.c | 0 .../kvm/{x86_64 =3D> x86}/vmx_tsc_adjust_test.c | 0 .../kvm/{x86_64 =3D> x86}/xapic_ipi_test.c | 0 .../kvm/{x86_64 =3D> x86}/xapic_state_test.c | 0 .../kvm/{x86_64 =3D> x86}/xcr0_cpuid_test.c | 0 .../kvm/{x86_64 =3D> x86}/xen_shinfo_test.c | 0 .../kvm/{x86_64 =3D> x86}/xen_vmcall_test.c | 0 .../kvm/{x86_64 =3D> x86}/xss_msr_test.c | 0 152 files changed, 172 insertions(+), 208 deletions(-) rename tools/testing/selftests/kvm/{aarch64 =3D> arm64}/aarch32_id_regs.c = (100%) rename tools/testing/selftests/kvm/{aarch64 =3D> arm64}/arch_timer.c (100%) rename tools/testing/selftests/kvm/{aarch64 =3D> arm64}/arch_timer_edge_ca= ses.c (100%) rename tools/testing/selftests/kvm/{aarch64 =3D> arm64}/debug-exceptions.c= (100%) rename tools/testing/selftests/kvm/{aarch64 =3D> arm64}/get-reg-list.c (10= 0%) rename tools/testing/selftests/kvm/{aarch64 =3D> arm64}/hypercalls.c (100%) rename tools/testing/selftests/kvm/{aarch64 =3D> arm64}/mmio_abort.c (100%) rename tools/testing/selftests/kvm/{aarch64 =3D> arm64}/no-vgic-v3.c (100%) rename tools/testing/selftests/kvm/{aarch64 =3D> arm64}/page_fault_test.c = (100%) rename tools/testing/selftests/kvm/{aarch64 =3D> arm64}/psci_test.c (100%) rename tools/testing/selftests/kvm/{aarch64 =3D> arm64}/set_id_regs.c (100= %) rename tools/testing/selftests/kvm/{aarch64 =3D> arm64}/smccc_filter.c (10= 0%) rename tools/testing/selftests/kvm/{aarch64 =3D> arm64}/vcpu_width_config.= c (100%) rename tools/testing/selftests/kvm/{aarch64 =3D> arm64}/vgic_init.c (100%) rename tools/testing/selftests/kvm/{aarch64 =3D> arm64}/vgic_irq.c (100%) rename tools/testing/selftests/kvm/{aarch64 =3D> arm64}/vgic_lpi_stress.c = (100%) rename tools/testing/selftests/kvm/{aarch64 =3D> arm64}/vpmu_counter_acces= s.c (100%) rename tools/testing/selftests/kvm/include/{aarch64 =3D> arm64}/arch_timer= .h (100%) rename tools/testing/selftests/kvm/include/{aarch64 =3D> arm64}/delay.h (1= 00%) rename tools/testing/selftests/kvm/include/{aarch64 =3D> arm64}/gic.h (100= %) rename tools/testing/selftests/kvm/include/{aarch64 =3D> arm64}/gic_v3.h (= 100%) rename tools/testing/selftests/kvm/include/{aarch64 =3D> arm64}/gic_v3_its= .h (100%) rename tools/testing/selftests/kvm/include/{aarch64 =3D> arm64}/kvm_util_a= rch.h (100%) rename tools/testing/selftests/kvm/include/{aarch64 =3D> arm64}/processor.= h (100%) rename tools/testing/selftests/kvm/include/{aarch64 =3D> arm64}/spinlock.h= (100%) rename tools/testing/selftests/kvm/include/{aarch64 =3D> arm64}/ucall.h (1= 00%) rename tools/testing/selftests/kvm/include/{aarch64 =3D> arm64}/vgic.h (10= 0%) rename tools/testing/selftests/kvm/include/{s390x =3D> s390}/debug_print.h= (100%) rename tools/testing/selftests/kvm/include/{s390x =3D> s390}/diag318_test_= handler.h (100%) rename tools/testing/selftests/kvm/include/{s390x =3D> s390}/facility.h (1= 00%) rename tools/testing/selftests/kvm/include/{s390x =3D> s390}/kvm_util_arch= .h (100%) rename tools/testing/selftests/kvm/include/{s390x =3D> s390}/processor.h (= 100%) rename tools/testing/selftests/kvm/include/{s390x =3D> s390}/sie.h (100%) rename tools/testing/selftests/kvm/include/{s390x =3D> s390}/ucall.h (100%) rename tools/testing/selftests/kvm/include/{x86_64 =3D> x86}/apic.h (98%) rename tools/testing/selftests/kvm/include/{x86_64 =3D> x86}/evmcs.h (99%) rename tools/testing/selftests/kvm/include/{x86_64 =3D> x86}/hyperv.h (99%) rename tools/testing/selftests/kvm/include/{x86_64 =3D> x86}/kvm_util_arch= .h (100%) rename tools/testing/selftests/kvm/include/{x86_64 =3D> x86}/mce.h (94%) rename tools/testing/selftests/kvm/include/{x86_64 =3D> x86}/pmu.h (100%) rename tools/testing/selftests/kvm/include/{x86_64 =3D> x86}/processor.h (= 99%) rename tools/testing/selftests/kvm/include/{x86_64 =3D> x86}/sev.h (100%) rename tools/testing/selftests/kvm/include/{x86_64 =3D> x86}/svm.h (98%) rename tools/testing/selftests/kvm/include/{x86_64 =3D> x86}/svm_util.h (9= 4%) rename tools/testing/selftests/kvm/include/{x86_64 =3D> x86}/ucall.h (100%) rename tools/testing/selftests/kvm/include/{x86_64 =3D> x86}/vmx.h (99%) rename tools/testing/selftests/kvm/lib/{aarch64 =3D> arm64}/gic.c (100%) rename tools/testing/selftests/kvm/lib/{aarch64 =3D> arm64}/gic_private.h = (100%) rename tools/testing/selftests/kvm/lib/{aarch64 =3D> arm64}/gic_v3.c (100%) rename tools/testing/selftests/kvm/lib/{aarch64 =3D> arm64}/gic_v3_its.c (= 100%) rename tools/testing/selftests/kvm/lib/{aarch64 =3D> arm64}/handlers.S (10= 0%) rename tools/testing/selftests/kvm/lib/{aarch64 =3D> arm64}/processor.c (1= 00%) rename tools/testing/selftests/kvm/lib/{aarch64 =3D> arm64}/spinlock.c (10= 0%) rename tools/testing/selftests/kvm/lib/{aarch64 =3D> arm64}/ucall.c (100%) rename tools/testing/selftests/kvm/lib/{aarch64 =3D> arm64}/vgic.c (100%) rename tools/testing/selftests/kvm/lib/{s390x =3D> s390}/diag318_test_hand= ler.c (100%) rename tools/testing/selftests/kvm/lib/{s390x =3D> s390}/facility.c (100%) rename tools/testing/selftests/kvm/lib/{s390x =3D> s390}/processor.c (100%) rename tools/testing/selftests/kvm/lib/{s390x =3D> s390}/ucall.c (100%) rename tools/testing/selftests/kvm/lib/{x86_64 =3D> x86}/apic.c (100%) rename tools/testing/selftests/kvm/lib/{x86_64 =3D> x86}/handlers.S (100%) rename tools/testing/selftests/kvm/lib/{x86_64 =3D> x86}/hyperv.c (100%) rename tools/testing/selftests/kvm/lib/{x86_64 =3D> x86}/memstress.c (98%) rename tools/testing/selftests/kvm/lib/{x86_64 =3D> x86}/pmu.c (100%) rename tools/testing/selftests/kvm/lib/{x86_64 =3D> x86}/processor.c (99%) rename tools/testing/selftests/kvm/lib/{x86_64 =3D> x86}/sev.c (100%) rename tools/testing/selftests/kvm/lib/{x86_64 =3D> x86}/svm.c (99%) rename tools/testing/selftests/kvm/lib/{x86_64 =3D> x86}/ucall.c (100%) rename tools/testing/selftests/kvm/lib/{x86_64 =3D> x86}/vmx.c (99%) rename tools/testing/selftests/kvm/{s390x =3D> s390}/cmma_test.c (100%) rename tools/testing/selftests/kvm/{s390x =3D> s390}/config (100%) rename tools/testing/selftests/kvm/{s390x =3D> s390}/cpumodel_subfuncs_tes= t.c (100%) rename tools/testing/selftests/kvm/{s390x =3D> s390}/debug_test.c (100%) rename tools/testing/selftests/kvm/{s390x =3D> s390}/memop.c (100%) rename tools/testing/selftests/kvm/{s390x =3D> s390}/resets.c (100%) rename tools/testing/selftests/kvm/{s390x =3D> s390}/shared_zeropage_test.= c (100%) rename tools/testing/selftests/kvm/{s390x =3D> s390}/sync_regs_test.c (100= %) rename tools/testing/selftests/kvm/{s390x =3D> s390}/tprot.c (100%) rename tools/testing/selftests/kvm/{s390x =3D> s390}/ucontrol_test.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/amx_test.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/apic_bus_clock_test.c= (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/cpuid_test.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/cr4_cpuid_sync_test.c= (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/debug_regs.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/dirty_log_page_splitt= ing_test.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/exit_on_emulation_fai= lure_test.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/feature_msrs_test.c (= 100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/fix_hypercall_test.c = (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/flds_emulation.h (100= %) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/hwcr_msr_test.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/hyperv_clock.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/hyperv_cpuid.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/hyperv_evmcs.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/hyperv_extended_hyper= calls.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/hyperv_features.c (10= 0%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/hyperv_ipi.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/hyperv_svm_test.c (10= 0%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/hyperv_tlb_flush.c (1= 00%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/kvm_clock_test.c (100= %) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/kvm_pv_test.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/max_vcpuid_cap_test.c= (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/monitor_mwait_test.c = (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/nested_exceptions_tes= t.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/nx_huge_pages_test.c = (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/nx_huge_pages_test.sh= (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/platform_info_test.c = (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/pmu_counters_test.c (= 100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/pmu_event_filter_test= .c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/private_mem_conversio= ns_test.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/private_mem_kvm_exits= _test.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/recalc_apic_map_test.= c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/set_boot_cpu_id.c (10= 0%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/set_sregs_test.c (100= %) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/sev_init2_tests.c (10= 0%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/sev_migrate_tests.c (= 100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/sev_smoke_test.c (100= %) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/smaller_maxphyaddr_em= ulation_test.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/smm_test.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/state_test.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/svm_int_ctl_test.c (1= 00%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/svm_nested_shutdown_t= est.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/svm_nested_soft_injec= t_test.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/svm_vmcall_test.c (10= 0%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/sync_regs_test.c (100= %) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/triple_fault_event_te= st.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/tsc_msrs_test.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/tsc_scaling_sync.c (1= 00%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/ucna_injection_test.c= (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/userspace_io_test.c (= 100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/userspace_msr_exit_te= st.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/vmx_apic_access_test.= c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/vmx_close_while_neste= d_test.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/vmx_dirty_log_test.c = (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/vmx_exception_with_in= valid_guest_state.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/vmx_invalid_nested_gu= est_state.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/vmx_msrs_test.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/vmx_nested_tsc_scalin= g_test.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/vmx_pmu_caps_test.c (= 100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/vmx_preemption_timer_= test.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/vmx_set_nested_state_= test.c (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/vmx_tsc_adjust_test.c= (100%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/xapic_ipi_test.c (100= %) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/xapic_state_test.c (1= 00%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/xcr0_cpuid_test.c (10= 0%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/xen_shinfo_test.c (10= 0%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/xen_vmcall_test.c (10= 0%) rename tools/testing/selftests/kvm/{x86_64 =3D> x86}/xss_msr_test.c (100%) diff --git a/MAINTAINERS b/MAINTAINERS index 21fdaa19229a..c2939c8f7ce4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -12461,8 +12461,8 @@ F: arch/arm64/include/asm/kvm* F: arch/arm64/include/uapi/asm/kvm* F: arch/arm64/kvm/ F: include/kvm/arm_* -F: tools/testing/selftests/kvm/*/aarch64/ -F: tools/testing/selftests/kvm/aarch64/ +F: tools/testing/selftests/kvm/*/arm64/ +F: tools/testing/selftests/kvm/arm64/ =20 KERNEL VIRTUAL MACHINE FOR LOONGARCH (KVM/LoongArch) M: Tianrui Zhao @@ -12533,8 +12533,8 @@ F: arch/s390/kvm/ F: arch/s390/mm/gmap.c F: drivers/s390/char/uvdevice.c F: tools/testing/selftests/drivers/s390x/uvdevice/ -F: tools/testing/selftests/kvm/*/s390x/ -F: tools/testing/selftests/kvm/s390x/ +F: tools/testing/selftests/kvm/*/s390/ +F: tools/testing/selftests/kvm/s390/ =20 KERNEL VIRTUAL MACHINE FOR X86 (KVM/x86) M: Sean Christopherson @@ -12551,8 +12551,8 @@ F: arch/x86/include/uapi/asm/svm.h F: arch/x86/include/uapi/asm/vmx.h F: arch/x86/kvm/ F: arch/x86/kvm/*/ -F: tools/testing/selftests/kvm/*/x86_64/ -F: tools/testing/selftests/kvm/x86_64/ +F: tools/testing/selftests/kvm/*/x86/ +F: tools/testing/selftests/kvm/x86/ =20 KERNFS M: Greg Kroah-Hartman diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests= /kvm/Makefile index 7b33464bf8cc..9bc2eba1af1c 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile @@ -4,16 +4,12 @@ include $(top_srcdir)/scripts/subarch.include ARCH ?=3D $(SUBARCH) =20 ifeq ($(ARCH),$(filter $(ARCH),arm64 s390 riscv x86 x86_64)) -ifeq ($(ARCH),x86) - ARCH_DIR :=3D x86_64 -else ifeq ($(ARCH),arm64) - ARCH_DIR :=3D aarch64 -else ifeq ($(ARCH),s390) - ARCH_DIR :=3D s390x +# Top-level selftests allows ARCH=3Dx86_64 :-( +ifeq ($(ARCH),x86_64) + ARCH_DIR :=3D x86 else ARCH_DIR :=3D $(ARCH) endif - include Makefile.kvm else # Empty targets for unsupported architectures diff --git a/tools/testing/selftests/kvm/Makefile.kvm b/tools/testing/selft= ests/kvm/Makefile.kvm index e988a72f8c20..9888dd6bb483 100644 --- a/tools/testing/selftests/kvm/Makefile.kvm +++ b/tools/testing/selftests/kvm/Makefile.kvm @@ -18,177 +18,177 @@ LIBKVM +=3D lib/userfaultfd_util.c =20 LIBKVM_STRING +=3D lib/string_override.c =20 -LIBKVM_x86_64 +=3D lib/x86_64/apic.c -LIBKVM_x86_64 +=3D lib/x86_64/handlers.S -LIBKVM_x86_64 +=3D lib/x86_64/hyperv.c -LIBKVM_x86_64 +=3D lib/x86_64/memstress.c -LIBKVM_x86_64 +=3D lib/x86_64/pmu.c -LIBKVM_x86_64 +=3D lib/x86_64/processor.c -LIBKVM_x86_64 +=3D lib/x86_64/sev.c -LIBKVM_x86_64 +=3D lib/x86_64/svm.c -LIBKVM_x86_64 +=3D lib/x86_64/ucall.c -LIBKVM_x86_64 +=3D lib/x86_64/vmx.c +LIBKVM_x86 +=3D lib/x86/apic.c +LIBKVM_x86 +=3D lib/x86/handlers.S +LIBKVM_x86 +=3D lib/x86/hyperv.c +LIBKVM_x86 +=3D lib/x86/memstress.c +LIBKVM_x86 +=3D lib/x86/pmu.c +LIBKVM_x86 +=3D lib/x86/processor.c +LIBKVM_x86 +=3D lib/x86/sev.c +LIBKVM_x86 +=3D lib/x86/svm.c +LIBKVM_x86 +=3D lib/x86/ucall.c +LIBKVM_x86 +=3D lib/x86/vmx.c =20 -LIBKVM_aarch64 +=3D lib/aarch64/gic.c -LIBKVM_aarch64 +=3D lib/aarch64/gic_v3.c -LIBKVM_aarch64 +=3D lib/aarch64/gic_v3_its.c -LIBKVM_aarch64 +=3D lib/aarch64/handlers.S -LIBKVM_aarch64 +=3D lib/aarch64/processor.c -LIBKVM_aarch64 +=3D lib/aarch64/spinlock.c -LIBKVM_aarch64 +=3D lib/aarch64/ucall.c -LIBKVM_aarch64 +=3D lib/aarch64/vgic.c +LIBKVM_arm64 +=3D lib/arm64/gic.c +LIBKVM_arm64 +=3D lib/arm64/gic_v3.c +LIBKVM_arm64 +=3D lib/arm64/gic_v3_its.c +LIBKVM_arm64 +=3D lib/arm64/handlers.S +LIBKVM_arm64 +=3D lib/arm64/processor.c +LIBKVM_arm64 +=3D lib/arm64/spinlock.c +LIBKVM_arm64 +=3D lib/arm64/ucall.c +LIBKVM_arm64 +=3D lib/arm64/vgic.c =20 -LIBKVM_s390x +=3D lib/s390x/diag318_test_handler.c -LIBKVM_s390x +=3D lib/s390x/processor.c -LIBKVM_s390x +=3D lib/s390x/ucall.c -LIBKVM_s390x +=3D lib/s390x/facility.c +LIBKVM_s390 +=3D lib/s390/diag318_test_handler.c +LIBKVM_s390 +=3D lib/s390/processor.c +LIBKVM_s390 +=3D lib/s390/ucall.c +LIBKVM_s390 +=3D lib/s390/facility.c =20 LIBKVM_riscv +=3D lib/riscv/handlers.S LIBKVM_riscv +=3D lib/riscv/processor.c LIBKVM_riscv +=3D lib/riscv/ucall.c =20 # Non-compiled test targets -TEST_PROGS_x86_64 +=3D x86_64/nx_huge_pages_test.sh +TEST_PROGS_x86 +=3D x86/nx_huge_pages_test.sh =20 # Compiled test targets -TEST_GEN_PROGS_x86_64 =3D x86_64/cpuid_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/cr4_cpuid_sync_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/dirty_log_page_splitting_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/feature_msrs_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/exit_on_emulation_failure_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/fix_hypercall_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/hwcr_msr_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_clock -TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_cpuid -TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_evmcs -TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_extended_hypercalls -TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_features -TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_ipi -TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_svm_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/hyperv_tlb_flush -TEST_GEN_PROGS_x86_64 +=3D x86_64/kvm_clock_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/kvm_pv_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/monitor_mwait_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/nested_exceptions_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/platform_info_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/pmu_counters_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/pmu_event_filter_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/private_mem_conversions_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/private_mem_kvm_exits_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/set_boot_cpu_id -TEST_GEN_PROGS_x86_64 +=3D x86_64/set_sregs_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/smaller_maxphyaddr_emulation_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/smm_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/state_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_preemption_timer_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/svm_vmcall_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/svm_int_ctl_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/svm_nested_shutdown_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/svm_nested_soft_inject_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/tsc_scaling_sync -TEST_GEN_PROGS_x86_64 +=3D x86_64/sync_regs_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/ucna_injection_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/userspace_io_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/userspace_msr_exit_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_apic_access_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_close_while_nested_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_dirty_log_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_exception_with_invalid_guest_state -TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_msrs_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_invalid_nested_guest_state -TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_set_nested_state_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_tsc_adjust_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_nested_tsc_scaling_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/apic_bus_clock_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/xapic_ipi_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/xapic_state_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/xcr0_cpuid_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/xss_msr_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/debug_regs -TEST_GEN_PROGS_x86_64 +=3D x86_64/tsc_msrs_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/vmx_pmu_caps_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/xen_shinfo_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/xen_vmcall_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/sev_init2_tests -TEST_GEN_PROGS_x86_64 +=3D x86_64/sev_migrate_tests -TEST_GEN_PROGS_x86_64 +=3D x86_64/sev_smoke_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/amx_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/max_vcpuid_cap_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/triple_fault_event_test -TEST_GEN_PROGS_x86_64 +=3D x86_64/recalc_apic_map_test -TEST_GEN_PROGS_x86_64 +=3D access_tracking_perf_test -TEST_GEN_PROGS_x86_64 +=3D coalesced_io_test -TEST_GEN_PROGS_x86_64 +=3D demand_paging_test -TEST_GEN_PROGS_x86_64 +=3D dirty_log_test -TEST_GEN_PROGS_x86_64 +=3D dirty_log_perf_test -TEST_GEN_PROGS_x86_64 +=3D guest_memfd_test -TEST_GEN_PROGS_x86_64 +=3D guest_print_test -TEST_GEN_PROGS_x86_64 +=3D hardware_disable_test -TEST_GEN_PROGS_x86_64 +=3D kvm_create_max_vcpus -TEST_GEN_PROGS_x86_64 +=3D kvm_page_table_test -TEST_GEN_PROGS_x86_64 +=3D mmu_stress_test -TEST_GEN_PROGS_x86_64 +=3D memslot_modification_stress_test -TEST_GEN_PROGS_x86_64 +=3D memslot_perf_test -TEST_GEN_PROGS_x86_64 +=3D rseq_test -TEST_GEN_PROGS_x86_64 +=3D set_memory_region_test -TEST_GEN_PROGS_x86_64 +=3D steal_time -TEST_GEN_PROGS_x86_64 +=3D kvm_binary_stats_test -TEST_GEN_PROGS_x86_64 +=3D system_counter_offset_test -TEST_GEN_PROGS_x86_64 +=3D pre_fault_memory_test +TEST_GEN_PROGS_x86 =3D x86/cpuid_test +TEST_GEN_PROGS_x86 +=3D x86/cr4_cpuid_sync_test +TEST_GEN_PROGS_x86 +=3D x86/dirty_log_page_splitting_test +TEST_GEN_PROGS_x86 +=3D x86/feature_msrs_test +TEST_GEN_PROGS_x86 +=3D x86/exit_on_emulation_failure_test +TEST_GEN_PROGS_x86 +=3D x86/fix_hypercall_test +TEST_GEN_PROGS_x86 +=3D x86/hwcr_msr_test +TEST_GEN_PROGS_x86 +=3D x86/hyperv_clock +TEST_GEN_PROGS_x86 +=3D x86/hyperv_cpuid +TEST_GEN_PROGS_x86 +=3D x86/hyperv_evmcs +TEST_GEN_PROGS_x86 +=3D x86/hyperv_extended_hypercalls +TEST_GEN_PROGS_x86 +=3D x86/hyperv_features +TEST_GEN_PROGS_x86 +=3D x86/hyperv_ipi +TEST_GEN_PROGS_x86 +=3D x86/hyperv_svm_test +TEST_GEN_PROGS_x86 +=3D x86/hyperv_tlb_flush +TEST_GEN_PROGS_x86 +=3D x86/kvm_clock_test +TEST_GEN_PROGS_x86 +=3D x86/kvm_pv_test +TEST_GEN_PROGS_x86 +=3D x86/monitor_mwait_test +TEST_GEN_PROGS_x86 +=3D x86/nested_exceptions_test +TEST_GEN_PROGS_x86 +=3D x86/platform_info_test +TEST_GEN_PROGS_x86 +=3D x86/pmu_counters_test +TEST_GEN_PROGS_x86 +=3D x86/pmu_event_filter_test +TEST_GEN_PROGS_x86 +=3D x86/private_mem_conversions_test +TEST_GEN_PROGS_x86 +=3D x86/private_mem_kvm_exits_test +TEST_GEN_PROGS_x86 +=3D x86/set_boot_cpu_id +TEST_GEN_PROGS_x86 +=3D x86/set_sregs_test +TEST_GEN_PROGS_x86 +=3D x86/smaller_maxphyaddr_emulation_test +TEST_GEN_PROGS_x86 +=3D x86/smm_test +TEST_GEN_PROGS_x86 +=3D x86/state_test +TEST_GEN_PROGS_x86 +=3D x86/vmx_preemption_timer_test +TEST_GEN_PROGS_x86 +=3D x86/svm_vmcall_test +TEST_GEN_PROGS_x86 +=3D x86/svm_int_ctl_test +TEST_GEN_PROGS_x86 +=3D x86/svm_nested_shutdown_test +TEST_GEN_PROGS_x86 +=3D x86/svm_nested_soft_inject_test +TEST_GEN_PROGS_x86 +=3D x86/tsc_scaling_sync +TEST_GEN_PROGS_x86 +=3D x86/sync_regs_test +TEST_GEN_PROGS_x86 +=3D x86/ucna_injection_test +TEST_GEN_PROGS_x86 +=3D x86/userspace_io_test +TEST_GEN_PROGS_x86 +=3D x86/userspace_msr_exit_test +TEST_GEN_PROGS_x86 +=3D x86/vmx_apic_access_test +TEST_GEN_PROGS_x86 +=3D x86/vmx_close_while_nested_test +TEST_GEN_PROGS_x86 +=3D x86/vmx_dirty_log_test +TEST_GEN_PROGS_x86 +=3D x86/vmx_exception_with_invalid_guest_state +TEST_GEN_PROGS_x86 +=3D x86/vmx_msrs_test +TEST_GEN_PROGS_x86 +=3D x86/vmx_invalid_nested_guest_state +TEST_GEN_PROGS_x86 +=3D x86/vmx_set_nested_state_test +TEST_GEN_PROGS_x86 +=3D x86/vmx_tsc_adjust_test +TEST_GEN_PROGS_x86 +=3D x86/vmx_nested_tsc_scaling_test +TEST_GEN_PROGS_x86 +=3D x86/apic_bus_clock_test +TEST_GEN_PROGS_x86 +=3D x86/xapic_ipi_test +TEST_GEN_PROGS_x86 +=3D x86/xapic_state_test +TEST_GEN_PROGS_x86 +=3D x86/xcr0_cpuid_test +TEST_GEN_PROGS_x86 +=3D x86/xss_msr_test +TEST_GEN_PROGS_x86 +=3D x86/debug_regs +TEST_GEN_PROGS_x86 +=3D x86/tsc_msrs_test +TEST_GEN_PROGS_x86 +=3D x86/vmx_pmu_caps_test +TEST_GEN_PROGS_x86 +=3D x86/xen_shinfo_test +TEST_GEN_PROGS_x86 +=3D x86/xen_vmcall_test +TEST_GEN_PROGS_x86 +=3D x86/sev_init2_tests +TEST_GEN_PROGS_x86 +=3D x86/sev_migrate_tests +TEST_GEN_PROGS_x86 +=3D x86/sev_smoke_test +TEST_GEN_PROGS_x86 +=3D x86/amx_test +TEST_GEN_PROGS_x86 +=3D x86/max_vcpuid_cap_test +TEST_GEN_PROGS_x86 +=3D x86/triple_fault_event_test +TEST_GEN_PROGS_x86 +=3D x86/recalc_apic_map_test +TEST_GEN_PROGS_x86 +=3D access_tracking_perf_test +TEST_GEN_PROGS_x86 +=3D coalesced_io_test +TEST_GEN_PROGS_x86 +=3D demand_paging_test +TEST_GEN_PROGS_x86 +=3D dirty_log_test +TEST_GEN_PROGS_x86 +=3D dirty_log_perf_test +TEST_GEN_PROGS_x86 +=3D guest_memfd_test +TEST_GEN_PROGS_x86 +=3D guest_print_test +TEST_GEN_PROGS_x86 +=3D hardware_disable_test +TEST_GEN_PROGS_x86 +=3D kvm_create_max_vcpus +TEST_GEN_PROGS_x86 +=3D kvm_page_table_test +TEST_GEN_PROGS_x86 +=3D memslot_modification_stress_test +TEST_GEN_PROGS_x86 +=3D memslot_perf_test +TEST_GEN_PROGS_x86 +=3D mmu_stress_test +TEST_GEN_PROGS_x86 +=3D rseq_test +TEST_GEN_PROGS_x86 +=3D set_memory_region_test +TEST_GEN_PROGS_x86 +=3D steal_time +TEST_GEN_PROGS_x86 +=3D kvm_binary_stats_test +TEST_GEN_PROGS_x86 +=3D system_counter_offset_test +TEST_GEN_PROGS_x86 +=3D pre_fault_memory_test =20 # Compiled outputs used by test targets -TEST_GEN_PROGS_EXTENDED_x86_64 +=3D x86_64/nx_huge_pages_test +TEST_GEN_PROGS_EXTENDED_x86 +=3D x86/nx_huge_pages_test =20 -TEST_GEN_PROGS_aarch64 +=3D aarch64/aarch32_id_regs -TEST_GEN_PROGS_aarch64 +=3D aarch64/arch_timer_edge_cases -TEST_GEN_PROGS_aarch64 +=3D aarch64/debug-exceptions -TEST_GEN_PROGS_aarch64 +=3D aarch64/hypercalls -TEST_GEN_PROGS_aarch64 +=3D aarch64/mmio_abort -TEST_GEN_PROGS_aarch64 +=3D aarch64/page_fault_test -TEST_GEN_PROGS_aarch64 +=3D aarch64/psci_test -TEST_GEN_PROGS_aarch64 +=3D aarch64/set_id_regs -TEST_GEN_PROGS_aarch64 +=3D aarch64/smccc_filter -TEST_GEN_PROGS_aarch64 +=3D aarch64/vcpu_width_config -TEST_GEN_PROGS_aarch64 +=3D aarch64/vgic_init -TEST_GEN_PROGS_aarch64 +=3D aarch64/vgic_irq -TEST_GEN_PROGS_aarch64 +=3D aarch64/vgic_lpi_stress -TEST_GEN_PROGS_aarch64 +=3D aarch64/vpmu_counter_access -TEST_GEN_PROGS_aarch64 +=3D aarch64/no-vgic-v3 -TEST_GEN_PROGS_aarch64 +=3D access_tracking_perf_test -TEST_GEN_PROGS_aarch64 +=3D arch_timer -TEST_GEN_PROGS_aarch64 +=3D coalesced_io_test -TEST_GEN_PROGS_aarch64 +=3D demand_paging_test -TEST_GEN_PROGS_aarch64 +=3D dirty_log_test -TEST_GEN_PROGS_aarch64 +=3D dirty_log_perf_test -TEST_GEN_PROGS_aarch64 +=3D guest_print_test -TEST_GEN_PROGS_aarch64 +=3D get-reg-list -TEST_GEN_PROGS_aarch64 +=3D kvm_create_max_vcpus -TEST_GEN_PROGS_aarch64 +=3D kvm_page_table_test -TEST_GEN_PROGS_aarch64 +=3D memslot_modification_stress_test -TEST_GEN_PROGS_aarch64 +=3D memslot_perf_test -TEST_GEN_PROGS_aarch64 +=3D mmu_stress_test -TEST_GEN_PROGS_aarch64 +=3D rseq_test -TEST_GEN_PROGS_aarch64 +=3D set_memory_region_test -TEST_GEN_PROGS_aarch64 +=3D steal_time -TEST_GEN_PROGS_aarch64 +=3D kvm_binary_stats_test +TEST_GEN_PROGS_arm64 +=3D arm64/aarch32_id_regs +TEST_GEN_PROGS_arm64 +=3D arm64/arch_timer_edge_cases +TEST_GEN_PROGS_arm64 +=3D arm64/debug-exceptions +TEST_GEN_PROGS_arm64 +=3D arm64/hypercalls +TEST_GEN_PROGS_arm64 +=3D arm64/mmio_abort +TEST_GEN_PROGS_arm64 +=3D arm64/page_fault_test +TEST_GEN_PROGS_arm64 +=3D arm64/psci_test +TEST_GEN_PROGS_arm64 +=3D arm64/set_id_regs +TEST_GEN_PROGS_arm64 +=3D arm64/smccc_filter +TEST_GEN_PROGS_arm64 +=3D arm64/vcpu_width_config +TEST_GEN_PROGS_arm64 +=3D arm64/vgic_init +TEST_GEN_PROGS_arm64 +=3D arm64/vgic_irq +TEST_GEN_PROGS_arm64 +=3D arm64/vgic_lpi_stress +TEST_GEN_PROGS_arm64 +=3D arm64/vpmu_counter_access +TEST_GEN_PROGS_arm64 +=3D arm64/no-vgic-v3 +TEST_GEN_PROGS_arm64 +=3D access_tracking_perf_test +TEST_GEN_PROGS_arm64 +=3D arch_timer +TEST_GEN_PROGS_arm64 +=3D coalesced_io_test +TEST_GEN_PROGS_arm64 +=3D demand_paging_test +TEST_GEN_PROGS_arm64 +=3D dirty_log_test +TEST_GEN_PROGS_arm64 +=3D dirty_log_perf_test +TEST_GEN_PROGS_arm64 +=3D guest_print_test +TEST_GEN_PROGS_arm64 +=3D get-reg-list +TEST_GEN_PROGS_arm64 +=3D kvm_create_max_vcpus +TEST_GEN_PROGS_arm64 +=3D kvm_page_table_test +TEST_GEN_PROGS_arm64 +=3D memslot_modification_stress_test +TEST_GEN_PROGS_arm64 +=3D memslot_perf_test +TEST_GEN_PROGS_arm64 +=3D mmu_stress_test +TEST_GEN_PROGS_arm64 +=3D rseq_test +TEST_GEN_PROGS_arm64 +=3D set_memory_region_test +TEST_GEN_PROGS_arm64 +=3D steal_time +TEST_GEN_PROGS_arm64 +=3D kvm_binary_stats_test =20 -TEST_GEN_PROGS_s390x =3D s390x/memop -TEST_GEN_PROGS_s390x +=3D s390x/resets -TEST_GEN_PROGS_s390x +=3D s390x/sync_regs_test -TEST_GEN_PROGS_s390x +=3D s390x/tprot -TEST_GEN_PROGS_s390x +=3D s390x/cmma_test -TEST_GEN_PROGS_s390x +=3D s390x/debug_test -TEST_GEN_PROGS_s390x +=3D s390x/cpumodel_subfuncs_test -TEST_GEN_PROGS_s390x +=3D s390x/shared_zeropage_test -TEST_GEN_PROGS_s390x +=3D s390x/ucontrol_test -TEST_GEN_PROGS_s390x +=3D demand_paging_test -TEST_GEN_PROGS_s390x +=3D dirty_log_test -TEST_GEN_PROGS_s390x +=3D guest_print_test -TEST_GEN_PROGS_s390x +=3D kvm_create_max_vcpus -TEST_GEN_PROGS_s390x +=3D kvm_page_table_test -TEST_GEN_PROGS_s390x +=3D rseq_test -TEST_GEN_PROGS_s390x +=3D set_memory_region_test -TEST_GEN_PROGS_s390x +=3D kvm_binary_stats_test +TEST_GEN_PROGS_s390 =3D s390/memop +TEST_GEN_PROGS_s390 +=3D s390/resets +TEST_GEN_PROGS_s390 +=3D s390/sync_regs_test +TEST_GEN_PROGS_s390 +=3D s390/tprot +TEST_GEN_PROGS_s390 +=3D s390/cmma_test +TEST_GEN_PROGS_s390 +=3D s390/debug_test +TEST_GEN_PROGS_s390 +=3D s390/cpumodel_subfuncs_test +TEST_GEN_PROGS_s390 +=3D s390/shared_zeropage_test +TEST_GEN_PROGS_s390 +=3D s390/ucontrol_test +TEST_GEN_PROGS_s390 +=3D demand_paging_test +TEST_GEN_PROGS_s390 +=3D dirty_log_test +TEST_GEN_PROGS_s390 +=3D guest_print_test +TEST_GEN_PROGS_s390 +=3D kvm_create_max_vcpus +TEST_GEN_PROGS_s390 +=3D kvm_page_table_test +TEST_GEN_PROGS_s390 +=3D rseq_test +TEST_GEN_PROGS_s390 +=3D set_memory_region_test +TEST_GEN_PROGS_s390 +=3D kvm_binary_stats_test =20 TEST_GEN_PROGS_riscv +=3D riscv/sbi_pmu_test TEST_GEN_PROGS_riscv +=3D riscv/ebreak_test @@ -222,11 +222,7 @@ include ../lib.mk INSTALL_HDR_PATH =3D $(top_srcdir)/usr LINUX_HDR_PATH =3D $(INSTALL_HDR_PATH)/include/ LINUX_TOOL_INCLUDE =3D $(top_srcdir)/tools/include -ifeq ($(ARCH),x86_64) -LINUX_TOOL_ARCH_INCLUDE =3D $(top_srcdir)/tools/arch/x86/include -else -LINUX_TOOL_ARCH_INCLUDE =3D $(top_srcdir)/tools/arch/$(ARCH)/include -endif +LINUX_TOOL_ARCH_INCLUDE =3D $(top_srcdir)/tools/arch/$(ARCH_DIR)/include CFLAGS +=3D -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=3Dgnu99 \ -Wno-gnu-variable-sized-type-not-at-end -MD -MP -DCONFIG_64BIT \ -fno-builtin-memcmp -fno-builtin-memcpy \ diff --git a/tools/testing/selftests/kvm/aarch64/aarch32_id_regs.c b/tools/= testing/selftests/kvm/arm64/aarch32_id_regs.c similarity index 100% rename from tools/testing/selftests/kvm/aarch64/aarch32_id_regs.c rename to tools/testing/selftests/kvm/arm64/aarch32_id_regs.c diff --git a/tools/testing/selftests/kvm/aarch64/arch_timer.c b/tools/testi= ng/selftests/kvm/arm64/arch_timer.c similarity index 100% rename from tools/testing/selftests/kvm/aarch64/arch_timer.c rename to tools/testing/selftests/kvm/arm64/arch_timer.c diff --git a/tools/testing/selftests/kvm/aarch64/arch_timer_edge_cases.c b/= tools/testing/selftests/kvm/arm64/arch_timer_edge_cases.c similarity index 100% rename from tools/testing/selftests/kvm/aarch64/arch_timer_edge_cases.c rename to tools/testing/selftests/kvm/arm64/arch_timer_edge_cases.c diff --git a/tools/testing/selftests/kvm/aarch64/debug-exceptions.c b/tools= /testing/selftests/kvm/arm64/debug-exceptions.c similarity index 100% rename from tools/testing/selftests/kvm/aarch64/debug-exceptions.c rename to tools/testing/selftests/kvm/arm64/debug-exceptions.c diff --git a/tools/testing/selftests/kvm/aarch64/get-reg-list.c b/tools/tes= ting/selftests/kvm/arm64/get-reg-list.c similarity index 100% rename from tools/testing/selftests/kvm/aarch64/get-reg-list.c rename to tools/testing/selftests/kvm/arm64/get-reg-list.c diff --git a/tools/testing/selftests/kvm/aarch64/hypercalls.c b/tools/testi= ng/selftests/kvm/arm64/hypercalls.c similarity index 100% rename from tools/testing/selftests/kvm/aarch64/hypercalls.c rename to tools/testing/selftests/kvm/arm64/hypercalls.c diff --git a/tools/testing/selftests/kvm/aarch64/mmio_abort.c b/tools/testi= ng/selftests/kvm/arm64/mmio_abort.c similarity index 100% rename from tools/testing/selftests/kvm/aarch64/mmio_abort.c rename to tools/testing/selftests/kvm/arm64/mmio_abort.c diff --git a/tools/testing/selftests/kvm/aarch64/no-vgic-v3.c b/tools/testi= ng/selftests/kvm/arm64/no-vgic-v3.c similarity index 100% rename from tools/testing/selftests/kvm/aarch64/no-vgic-v3.c rename to tools/testing/selftests/kvm/arm64/no-vgic-v3.c diff --git a/tools/testing/selftests/kvm/aarch64/page_fault_test.c b/tools/= testing/selftests/kvm/arm64/page_fault_test.c similarity index 100% rename from tools/testing/selftests/kvm/aarch64/page_fault_test.c rename to tools/testing/selftests/kvm/arm64/page_fault_test.c diff --git a/tools/testing/selftests/kvm/aarch64/psci_test.c b/tools/testin= g/selftests/kvm/arm64/psci_test.c similarity index 100% rename from tools/testing/selftests/kvm/aarch64/psci_test.c rename to tools/testing/selftests/kvm/arm64/psci_test.c diff --git a/tools/testing/selftests/kvm/aarch64/set_id_regs.c b/tools/test= ing/selftests/kvm/arm64/set_id_regs.c similarity index 100% rename from tools/testing/selftests/kvm/aarch64/set_id_regs.c rename to tools/testing/selftests/kvm/arm64/set_id_regs.c diff --git a/tools/testing/selftests/kvm/aarch64/smccc_filter.c b/tools/tes= ting/selftests/kvm/arm64/smccc_filter.c similarity index 100% rename from tools/testing/selftests/kvm/aarch64/smccc_filter.c rename to tools/testing/selftests/kvm/arm64/smccc_filter.c diff --git a/tools/testing/selftests/kvm/aarch64/vcpu_width_config.c b/tool= s/testing/selftests/kvm/arm64/vcpu_width_config.c similarity index 100% rename from tools/testing/selftests/kvm/aarch64/vcpu_width_config.c rename to tools/testing/selftests/kvm/arm64/vcpu_width_config.c diff --git a/tools/testing/selftests/kvm/aarch64/vgic_init.c b/tools/testin= g/selftests/kvm/arm64/vgic_init.c similarity index 100% rename from tools/testing/selftests/kvm/aarch64/vgic_init.c rename to tools/testing/selftests/kvm/arm64/vgic_init.c diff --git a/tools/testing/selftests/kvm/aarch64/vgic_irq.c b/tools/testing= /selftests/kvm/arm64/vgic_irq.c similarity index 100% rename from tools/testing/selftests/kvm/aarch64/vgic_irq.c rename to tools/testing/selftests/kvm/arm64/vgic_irq.c diff --git a/tools/testing/selftests/kvm/aarch64/vgic_lpi_stress.c b/tools/= testing/selftests/kvm/arm64/vgic_lpi_stress.c similarity index 100% rename from tools/testing/selftests/kvm/aarch64/vgic_lpi_stress.c rename to tools/testing/selftests/kvm/arm64/vgic_lpi_stress.c diff --git a/tools/testing/selftests/kvm/aarch64/vpmu_counter_access.c b/to= ols/testing/selftests/kvm/arm64/vpmu_counter_access.c similarity index 100% rename from tools/testing/selftests/kvm/aarch64/vpmu_counter_access.c rename to tools/testing/selftests/kvm/arm64/vpmu_counter_access.c diff --git a/tools/testing/selftests/kvm/dirty_log_perf_test.c b/tools/test= ing/selftests/kvm/dirty_log_perf_test.c index 9f24303acb8c..e79817bd0e29 100644 --- a/tools/testing/selftests/kvm/dirty_log_perf_test.c +++ b/tools/testing/selftests/kvm/dirty_log_perf_test.c @@ -21,7 +21,7 @@ #include "ucall_common.h" =20 #ifdef __aarch64__ -#include "aarch64/vgic.h" +#include "arm64/vgic.h" =20 static int gic_fd; =20 diff --git a/tools/testing/selftests/kvm/include/aarch64/arch_timer.h b/too= ls/testing/selftests/kvm/include/arm64/arch_timer.h similarity index 100% rename from tools/testing/selftests/kvm/include/aarch64/arch_timer.h rename to tools/testing/selftests/kvm/include/arm64/arch_timer.h diff --git a/tools/testing/selftests/kvm/include/aarch64/delay.h b/tools/te= sting/selftests/kvm/include/arm64/delay.h similarity index 100% rename from tools/testing/selftests/kvm/include/aarch64/delay.h rename to tools/testing/selftests/kvm/include/arm64/delay.h diff --git a/tools/testing/selftests/kvm/include/aarch64/gic.h b/tools/test= ing/selftests/kvm/include/arm64/gic.h similarity index 100% rename from tools/testing/selftests/kvm/include/aarch64/gic.h rename to tools/testing/selftests/kvm/include/arm64/gic.h diff --git a/tools/testing/selftests/kvm/include/aarch64/gic_v3.h b/tools/t= esting/selftests/kvm/include/arm64/gic_v3.h similarity index 100% rename from tools/testing/selftests/kvm/include/aarch64/gic_v3.h rename to tools/testing/selftests/kvm/include/arm64/gic_v3.h diff --git a/tools/testing/selftests/kvm/include/aarch64/gic_v3_its.h b/too= ls/testing/selftests/kvm/include/arm64/gic_v3_its.h similarity index 100% rename from tools/testing/selftests/kvm/include/aarch64/gic_v3_its.h rename to tools/testing/selftests/kvm/include/arm64/gic_v3_its.h diff --git a/tools/testing/selftests/kvm/include/aarch64/kvm_util_arch.h b/= tools/testing/selftests/kvm/include/arm64/kvm_util_arch.h similarity index 100% rename from tools/testing/selftests/kvm/include/aarch64/kvm_util_arch.h rename to tools/testing/selftests/kvm/include/arm64/kvm_util_arch.h diff --git a/tools/testing/selftests/kvm/include/aarch64/processor.h b/tool= s/testing/selftests/kvm/include/arm64/processor.h similarity index 100% rename from tools/testing/selftests/kvm/include/aarch64/processor.h rename to tools/testing/selftests/kvm/include/arm64/processor.h diff --git a/tools/testing/selftests/kvm/include/aarch64/spinlock.h b/tools= /testing/selftests/kvm/include/arm64/spinlock.h similarity index 100% rename from tools/testing/selftests/kvm/include/aarch64/spinlock.h rename to tools/testing/selftests/kvm/include/arm64/spinlock.h diff --git a/tools/testing/selftests/kvm/include/aarch64/ucall.h b/tools/te= sting/selftests/kvm/include/arm64/ucall.h similarity index 100% rename from tools/testing/selftests/kvm/include/aarch64/ucall.h rename to tools/testing/selftests/kvm/include/arm64/ucall.h diff --git a/tools/testing/selftests/kvm/include/aarch64/vgic.h b/tools/tes= ting/selftests/kvm/include/arm64/vgic.h similarity index 100% rename from tools/testing/selftests/kvm/include/aarch64/vgic.h rename to tools/testing/selftests/kvm/include/arm64/vgic.h diff --git a/tools/testing/selftests/kvm/include/s390x/debug_print.h b/tool= s/testing/selftests/kvm/include/s390/debug_print.h similarity index 100% rename from tools/testing/selftests/kvm/include/s390x/debug_print.h rename to tools/testing/selftests/kvm/include/s390/debug_print.h diff --git a/tools/testing/selftests/kvm/include/s390x/diag318_test_handler= .h b/tools/testing/selftests/kvm/include/s390/diag318_test_handler.h similarity index 100% rename from tools/testing/selftests/kvm/include/s390x/diag318_test_handler.h rename to tools/testing/selftests/kvm/include/s390/diag318_test_handler.h diff --git a/tools/testing/selftests/kvm/include/s390x/facility.h b/tools/t= esting/selftests/kvm/include/s390/facility.h similarity index 100% rename from tools/testing/selftests/kvm/include/s390x/facility.h rename to tools/testing/selftests/kvm/include/s390/facility.h diff --git a/tools/testing/selftests/kvm/include/s390x/kvm_util_arch.h b/to= ols/testing/selftests/kvm/include/s390/kvm_util_arch.h similarity index 100% rename from tools/testing/selftests/kvm/include/s390x/kvm_util_arch.h rename to tools/testing/selftests/kvm/include/s390/kvm_util_arch.h diff --git a/tools/testing/selftests/kvm/include/s390x/processor.h b/tools/= testing/selftests/kvm/include/s390/processor.h similarity index 100% rename from tools/testing/selftests/kvm/include/s390x/processor.h rename to tools/testing/selftests/kvm/include/s390/processor.h diff --git a/tools/testing/selftests/kvm/include/s390x/sie.h b/tools/testin= g/selftests/kvm/include/s390/sie.h similarity index 100% rename from tools/testing/selftests/kvm/include/s390x/sie.h rename to tools/testing/selftests/kvm/include/s390/sie.h diff --git a/tools/testing/selftests/kvm/include/s390x/ucall.h b/tools/test= ing/selftests/kvm/include/s390/ucall.h similarity index 100% rename from tools/testing/selftests/kvm/include/s390x/ucall.h rename to tools/testing/selftests/kvm/include/s390/ucall.h diff --git a/tools/testing/selftests/kvm/include/x86_64/apic.h b/tools/test= ing/selftests/kvm/include/x86/apic.h similarity index 98% rename from tools/testing/selftests/kvm/include/x86_64/apic.h rename to tools/testing/selftests/kvm/include/x86/apic.h index 51990094effd..80fe9f69b38d 100644 --- a/tools/testing/selftests/kvm/include/x86_64/apic.h +++ b/tools/testing/selftests/kvm/include/x86/apic.h @@ -1,7 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * tools/testing/selftests/kvm/include/x86_64/apic.h - * * Copyright (C) 2021, Google LLC. */ =20 diff --git a/tools/testing/selftests/kvm/include/x86_64/evmcs.h b/tools/tes= ting/selftests/kvm/include/x86/evmcs.h similarity index 99% rename from tools/testing/selftests/kvm/include/x86_64/evmcs.h rename to tools/testing/selftests/kvm/include/x86/evmcs.h index 901caf0e0939..5a74bb30e2f8 100644 --- a/tools/testing/selftests/kvm/include/x86_64/evmcs.h +++ b/tools/testing/selftests/kvm/include/x86/evmcs.h @@ -1,9 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* - * tools/testing/selftests/kvm/include/x86_64/evmcs.h - * * Copyright (C) 2018, Red Hat, Inc. - * */ =20 #ifndef SELFTEST_KVM_EVMCS_H diff --git a/tools/testing/selftests/kvm/include/x86_64/hyperv.h b/tools/te= sting/selftests/kvm/include/x86/hyperv.h similarity index 99% rename from tools/testing/selftests/kvm/include/x86_64/hyperv.h rename to tools/testing/selftests/kvm/include/x86/hyperv.h index 6849e2552f1b..f13e532be240 100644 --- a/tools/testing/selftests/kvm/include/x86_64/hyperv.h +++ b/tools/testing/selftests/kvm/include/x86/hyperv.h @@ -1,9 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* - * tools/testing/selftests/kvm/include/x86_64/hyperv.h - * * Copyright (C) 2021, Red Hat, Inc. - * */ =20 #ifndef SELFTEST_KVM_HYPERV_H diff --git a/tools/testing/selftests/kvm/include/x86_64/kvm_util_arch.h b/t= ools/testing/selftests/kvm/include/x86/kvm_util_arch.h similarity index 100% rename from tools/testing/selftests/kvm/include/x86_64/kvm_util_arch.h rename to tools/testing/selftests/kvm/include/x86/kvm_util_arch.h diff --git a/tools/testing/selftests/kvm/include/x86_64/mce.h b/tools/testi= ng/selftests/kvm/include/x86/mce.h similarity index 94% rename from tools/testing/selftests/kvm/include/x86_64/mce.h rename to tools/testing/selftests/kvm/include/x86/mce.h index 6119321f3f5d..295f2d554754 100644 --- a/tools/testing/selftests/kvm/include/x86_64/mce.h +++ b/tools/testing/selftests/kvm/include/x86/mce.h @@ -1,7 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * tools/testing/selftests/kvm/include/x86_64/mce.h - * * Copyright (C) 2022, Google LLC. */ =20 diff --git a/tools/testing/selftests/kvm/include/x86_64/pmu.h b/tools/testi= ng/selftests/kvm/include/x86/pmu.h similarity index 100% rename from tools/testing/selftests/kvm/include/x86_64/pmu.h rename to tools/testing/selftests/kvm/include/x86/pmu.h diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools= /testing/selftests/kvm/include/x86/processor.h similarity index 99% rename from tools/testing/selftests/kvm/include/x86_64/processor.h rename to tools/testing/selftests/kvm/include/x86/processor.h index 645200e95f89..9ec984cf8674 100644 --- a/tools/testing/selftests/kvm/include/x86_64/processor.h +++ b/tools/testing/selftests/kvm/include/x86/processor.h @@ -1,7 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * tools/testing/selftests/kvm/include/x86_64/processor.h - * * Copyright (C) 2018, Google LLC. */ =20 diff --git a/tools/testing/selftests/kvm/include/x86_64/sev.h b/tools/testi= ng/selftests/kvm/include/x86/sev.h similarity index 100% rename from tools/testing/selftests/kvm/include/x86_64/sev.h rename to tools/testing/selftests/kvm/include/x86/sev.h diff --git a/tools/testing/selftests/kvm/include/x86_64/svm.h b/tools/testi= ng/selftests/kvm/include/x86/svm.h similarity index 98% rename from tools/testing/selftests/kvm/include/x86_64/svm.h rename to tools/testing/selftests/kvm/include/x86/svm.h index 4803e1056055..29cffd0a9181 100644 --- a/tools/testing/selftests/kvm/include/x86_64/svm.h +++ b/tools/testing/selftests/kvm/include/x86/svm.h @@ -1,10 +1,4 @@ /* SPDX-License-Identifier: GPL-2.0 */ -/* - * tools/testing/selftests/kvm/include/x86_64/svm.h - * This is a copy of arch/x86/include/asm/svm.h - * - */ - #ifndef SELFTEST_KVM_SVM_H #define SELFTEST_KVM_SVM_H =20 diff --git a/tools/testing/selftests/kvm/include/x86_64/svm_util.h b/tools/= testing/selftests/kvm/include/x86/svm_util.h similarity index 94% rename from tools/testing/selftests/kvm/include/x86_64/svm_util.h rename to tools/testing/selftests/kvm/include/x86/svm_util.h index 044f0f872ba9..b74c6dcddcbd 100644 --- a/tools/testing/selftests/kvm/include/x86_64/svm_util.h +++ b/tools/testing/selftests/kvm/include/x86/svm_util.h @@ -1,8 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * tools/testing/selftests/kvm/include/x86_64/svm_utils.h - * Header for nested SVM testing - * * Copyright (C) 2020, Red Hat, Inc. */ =20 diff --git a/tools/testing/selftests/kvm/include/x86_64/ucall.h b/tools/tes= ting/selftests/kvm/include/x86/ucall.h similarity index 100% rename from tools/testing/selftests/kvm/include/x86_64/ucall.h rename to tools/testing/selftests/kvm/include/x86/ucall.h diff --git a/tools/testing/selftests/kvm/include/x86_64/vmx.h b/tools/testi= ng/selftests/kvm/include/x86/vmx.h similarity index 99% rename from tools/testing/selftests/kvm/include/x86_64/vmx.h rename to tools/testing/selftests/kvm/include/x86/vmx.h index 5f0c0a29c556..edb3c391b982 100644 --- a/tools/testing/selftests/kvm/include/x86_64/vmx.h +++ b/tools/testing/selftests/kvm/include/x86/vmx.h @@ -1,7 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * tools/testing/selftests/kvm/include/x86_64/vmx.h - * * Copyright (C) 2018, Google LLC. */ =20 diff --git a/tools/testing/selftests/kvm/lib/aarch64/gic.c b/tools/testing/= selftests/kvm/lib/arm64/gic.c similarity index 100% rename from tools/testing/selftests/kvm/lib/aarch64/gic.c rename to tools/testing/selftests/kvm/lib/arm64/gic.c diff --git a/tools/testing/selftests/kvm/lib/aarch64/gic_private.h b/tools/= testing/selftests/kvm/lib/arm64/gic_private.h similarity index 100% rename from tools/testing/selftests/kvm/lib/aarch64/gic_private.h rename to tools/testing/selftests/kvm/lib/arm64/gic_private.h diff --git a/tools/testing/selftests/kvm/lib/aarch64/gic_v3.c b/tools/testi= ng/selftests/kvm/lib/arm64/gic_v3.c similarity index 100% rename from tools/testing/selftests/kvm/lib/aarch64/gic_v3.c rename to tools/testing/selftests/kvm/lib/arm64/gic_v3.c diff --git a/tools/testing/selftests/kvm/lib/aarch64/gic_v3_its.c b/tools/t= esting/selftests/kvm/lib/arm64/gic_v3_its.c similarity index 100% rename from tools/testing/selftests/kvm/lib/aarch64/gic_v3_its.c rename to tools/testing/selftests/kvm/lib/arm64/gic_v3_its.c diff --git a/tools/testing/selftests/kvm/lib/aarch64/handlers.S b/tools/tes= ting/selftests/kvm/lib/arm64/handlers.S similarity index 100% rename from tools/testing/selftests/kvm/lib/aarch64/handlers.S rename to tools/testing/selftests/kvm/lib/arm64/handlers.S diff --git a/tools/testing/selftests/kvm/lib/aarch64/processor.c b/tools/te= sting/selftests/kvm/lib/arm64/processor.c similarity index 100% rename from tools/testing/selftests/kvm/lib/aarch64/processor.c rename to tools/testing/selftests/kvm/lib/arm64/processor.c diff --git a/tools/testing/selftests/kvm/lib/aarch64/spinlock.c b/tools/tes= ting/selftests/kvm/lib/arm64/spinlock.c similarity index 100% rename from tools/testing/selftests/kvm/lib/aarch64/spinlock.c rename to tools/testing/selftests/kvm/lib/arm64/spinlock.c diff --git a/tools/testing/selftests/kvm/lib/aarch64/ucall.c b/tools/testin= g/selftests/kvm/lib/arm64/ucall.c similarity index 100% rename from tools/testing/selftests/kvm/lib/aarch64/ucall.c rename to tools/testing/selftests/kvm/lib/arm64/ucall.c diff --git a/tools/testing/selftests/kvm/lib/aarch64/vgic.c b/tools/testing= /selftests/kvm/lib/arm64/vgic.c similarity index 100% rename from tools/testing/selftests/kvm/lib/aarch64/vgic.c rename to tools/testing/selftests/kvm/lib/arm64/vgic.c diff --git a/tools/testing/selftests/kvm/lib/s390x/diag318_test_handler.c b= /tools/testing/selftests/kvm/lib/s390/diag318_test_handler.c similarity index 100% rename from tools/testing/selftests/kvm/lib/s390x/diag318_test_handler.c rename to tools/testing/selftests/kvm/lib/s390/diag318_test_handler.c diff --git a/tools/testing/selftests/kvm/lib/s390x/facility.c b/tools/testi= ng/selftests/kvm/lib/s390/facility.c similarity index 100% rename from tools/testing/selftests/kvm/lib/s390x/facility.c rename to tools/testing/selftests/kvm/lib/s390/facility.c diff --git a/tools/testing/selftests/kvm/lib/s390x/processor.c b/tools/test= ing/selftests/kvm/lib/s390/processor.c similarity index 100% rename from tools/testing/selftests/kvm/lib/s390x/processor.c rename to tools/testing/selftests/kvm/lib/s390/processor.c diff --git a/tools/testing/selftests/kvm/lib/s390x/ucall.c b/tools/testing/= selftests/kvm/lib/s390/ucall.c similarity index 100% rename from tools/testing/selftests/kvm/lib/s390x/ucall.c rename to tools/testing/selftests/kvm/lib/s390/ucall.c diff --git a/tools/testing/selftests/kvm/lib/x86_64/apic.c b/tools/testing/= selftests/kvm/lib/x86/apic.c similarity index 100% rename from tools/testing/selftests/kvm/lib/x86_64/apic.c rename to tools/testing/selftests/kvm/lib/x86/apic.c diff --git a/tools/testing/selftests/kvm/lib/x86_64/handlers.S b/tools/test= ing/selftests/kvm/lib/x86/handlers.S similarity index 100% rename from tools/testing/selftests/kvm/lib/x86_64/handlers.S rename to tools/testing/selftests/kvm/lib/x86/handlers.S diff --git a/tools/testing/selftests/kvm/lib/x86_64/hyperv.c b/tools/testin= g/selftests/kvm/lib/x86/hyperv.c similarity index 100% rename from tools/testing/selftests/kvm/lib/x86_64/hyperv.c rename to tools/testing/selftests/kvm/lib/x86/hyperv.c diff --git a/tools/testing/selftests/kvm/lib/x86_64/memstress.c b/tools/tes= ting/selftests/kvm/lib/x86/memstress.c similarity index 98% rename from tools/testing/selftests/kvm/lib/x86_64/memstress.c rename to tools/testing/selftests/kvm/lib/x86/memstress.c index d61e623afc8c..7f5d62a65c68 100644 --- a/tools/testing/selftests/kvm/lib/x86_64/memstress.c +++ b/tools/testing/selftests/kvm/lib/x86/memstress.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * x86_64-specific extensions to memstress.c. + * x86-specific extensions to memstress.c. * * Copyright (C) 2022, Google, Inc. */ diff --git a/tools/testing/selftests/kvm/lib/x86_64/pmu.c b/tools/testing/s= elftests/kvm/lib/x86/pmu.c similarity index 100% rename from tools/testing/selftests/kvm/lib/x86_64/pmu.c rename to tools/testing/selftests/kvm/lib/x86/pmu.c diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/tes= ting/selftests/kvm/lib/x86/processor.c similarity index 99% rename from tools/testing/selftests/kvm/lib/x86_64/processor.c rename to tools/testing/selftests/kvm/lib/x86/processor.c index 636b29ba8985..bd5a802fa7a5 100644 --- a/tools/testing/selftests/kvm/lib/x86_64/processor.c +++ b/tools/testing/selftests/kvm/lib/x86/processor.c @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * tools/testing/selftests/kvm/lib/x86_64/processor.c - * * Copyright (C) 2018, Google LLC. */ =20 diff --git a/tools/testing/selftests/kvm/lib/x86_64/sev.c b/tools/testing/s= elftests/kvm/lib/x86/sev.c similarity index 100% rename from tools/testing/selftests/kvm/lib/x86_64/sev.c rename to tools/testing/selftests/kvm/lib/x86/sev.c diff --git a/tools/testing/selftests/kvm/lib/x86_64/svm.c b/tools/testing/s= elftests/kvm/lib/x86/svm.c similarity index 99% rename from tools/testing/selftests/kvm/lib/x86_64/svm.c rename to tools/testing/selftests/kvm/lib/x86/svm.c index 5495a92dfd5a..d239c2097391 100644 --- a/tools/testing/selftests/kvm/lib/x86_64/svm.c +++ b/tools/testing/selftests/kvm/lib/x86/svm.c @@ -1,6 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * tools/testing/selftests/kvm/lib/x86_64/svm.c * Helpers used for nested SVM testing * Largely inspired from KVM unit test svm.c * diff --git a/tools/testing/selftests/kvm/lib/x86_64/ucall.c b/tools/testing= /selftests/kvm/lib/x86/ucall.c similarity index 100% rename from tools/testing/selftests/kvm/lib/x86_64/ucall.c rename to tools/testing/selftests/kvm/lib/x86/ucall.c diff --git a/tools/testing/selftests/kvm/lib/x86_64/vmx.c b/tools/testing/s= elftests/kvm/lib/x86/vmx.c similarity index 99% rename from tools/testing/selftests/kvm/lib/x86_64/vmx.c rename to tools/testing/selftests/kvm/lib/x86/vmx.c index d7ac122820bf..d4d1208dd023 100644 --- a/tools/testing/selftests/kvm/lib/x86_64/vmx.c +++ b/tools/testing/selftests/kvm/lib/x86/vmx.c @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * tools/testing/selftests/kvm/lib/x86_64/vmx.c - * * Copyright (C) 2018, Google LLC. */ =20 diff --git a/tools/testing/selftests/kvm/s390x/cmma_test.c b/tools/testing/= selftests/kvm/s390/cmma_test.c similarity index 100% rename from tools/testing/selftests/kvm/s390x/cmma_test.c rename to tools/testing/selftests/kvm/s390/cmma_test.c diff --git a/tools/testing/selftests/kvm/s390x/config b/tools/testing/selft= ests/kvm/s390/config similarity index 100% rename from tools/testing/selftests/kvm/s390x/config rename to tools/testing/selftests/kvm/s390/config diff --git a/tools/testing/selftests/kvm/s390x/cpumodel_subfuncs_test.c b/t= ools/testing/selftests/kvm/s390/cpumodel_subfuncs_test.c similarity index 100% rename from tools/testing/selftests/kvm/s390x/cpumodel_subfuncs_test.c rename to tools/testing/selftests/kvm/s390/cpumodel_subfuncs_test.c diff --git a/tools/testing/selftests/kvm/s390x/debug_test.c b/tools/testing= /selftests/kvm/s390/debug_test.c similarity index 100% rename from tools/testing/selftests/kvm/s390x/debug_test.c rename to tools/testing/selftests/kvm/s390/debug_test.c diff --git a/tools/testing/selftests/kvm/s390x/memop.c b/tools/testing/self= tests/kvm/s390/memop.c similarity index 100% rename from tools/testing/selftests/kvm/s390x/memop.c rename to tools/testing/selftests/kvm/s390/memop.c diff --git a/tools/testing/selftests/kvm/s390x/resets.c b/tools/testing/sel= ftests/kvm/s390/resets.c similarity index 100% rename from tools/testing/selftests/kvm/s390x/resets.c rename to tools/testing/selftests/kvm/s390/resets.c diff --git a/tools/testing/selftests/kvm/s390x/shared_zeropage_test.c b/too= ls/testing/selftests/kvm/s390/shared_zeropage_test.c similarity index 100% rename from tools/testing/selftests/kvm/s390x/shared_zeropage_test.c rename to tools/testing/selftests/kvm/s390/shared_zeropage_test.c diff --git a/tools/testing/selftests/kvm/s390x/sync_regs_test.c b/tools/tes= ting/selftests/kvm/s390/sync_regs_test.c similarity index 100% rename from tools/testing/selftests/kvm/s390x/sync_regs_test.c rename to tools/testing/selftests/kvm/s390/sync_regs_test.c diff --git a/tools/testing/selftests/kvm/s390x/tprot.c b/tools/testing/self= tests/kvm/s390/tprot.c similarity index 100% rename from tools/testing/selftests/kvm/s390x/tprot.c rename to tools/testing/selftests/kvm/s390/tprot.c diff --git a/tools/testing/selftests/kvm/s390x/ucontrol_test.c b/tools/test= ing/selftests/kvm/s390/ucontrol_test.c similarity index 100% rename from tools/testing/selftests/kvm/s390x/ucontrol_test.c rename to tools/testing/selftests/kvm/s390/ucontrol_test.c diff --git a/tools/testing/selftests/kvm/set_memory_region_test.c b/tools/t= esting/selftests/kvm/set_memory_region_test.c index a8267628e9ed..86ee3385e860 100644 --- a/tools/testing/selftests/kvm/set_memory_region_test.c +++ b/tools/testing/selftests/kvm/set_memory_region_test.c @@ -17,9 +17,9 @@ #include =20 /* - * s390x needs at least 1MB alignment, and the x86_64 MOVE/DELETE tests ne= ed a - * 2MB sized and aligned region so that the initial region corresponds to - * exactly one large page. + * s390 needs at least 1MB alignment, and the x86 MOVE/DELETE tests need a= 2MB + * sized and aligned region so that the initial region corresponds to exac= tly + * one large page. */ #define MEM_REGION_SIZE 0x200000 =20 diff --git a/tools/testing/selftests/kvm/x86_64/amx_test.c b/tools/testing/= selftests/kvm/x86/amx_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/amx_test.c rename to tools/testing/selftests/kvm/x86/amx_test.c diff --git a/tools/testing/selftests/kvm/x86_64/apic_bus_clock_test.c b/too= ls/testing/selftests/kvm/x86/apic_bus_clock_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/apic_bus_clock_test.c rename to tools/testing/selftests/kvm/x86/apic_bus_clock_test.c diff --git a/tools/testing/selftests/kvm/x86_64/cpuid_test.c b/tools/testin= g/selftests/kvm/x86/cpuid_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/cpuid_test.c rename to tools/testing/selftests/kvm/x86/cpuid_test.c diff --git a/tools/testing/selftests/kvm/x86_64/cr4_cpuid_sync_test.c b/too= ls/testing/selftests/kvm/x86/cr4_cpuid_sync_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/cr4_cpuid_sync_test.c rename to tools/testing/selftests/kvm/x86/cr4_cpuid_sync_test.c diff --git a/tools/testing/selftests/kvm/x86_64/debug_regs.c b/tools/testin= g/selftests/kvm/x86/debug_regs.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/debug_regs.c rename to tools/testing/selftests/kvm/x86/debug_regs.c diff --git a/tools/testing/selftests/kvm/x86_64/dirty_log_page_splitting_te= st.c b/tools/testing/selftests/kvm/x86/dirty_log_page_splitting_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/dirty_log_page_splitting_tes= t.c rename to tools/testing/selftests/kvm/x86/dirty_log_page_splitting_test.c diff --git a/tools/testing/selftests/kvm/x86_64/exit_on_emulation_failure_t= est.c b/tools/testing/selftests/kvm/x86/exit_on_emulation_failure_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/exit_on_emulation_failure_te= st.c rename to tools/testing/selftests/kvm/x86/exit_on_emulation_failure_test.c diff --git a/tools/testing/selftests/kvm/x86_64/feature_msrs_test.c b/tools= /testing/selftests/kvm/x86/feature_msrs_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/feature_msrs_test.c rename to tools/testing/selftests/kvm/x86/feature_msrs_test.c diff --git a/tools/testing/selftests/kvm/x86_64/fix_hypercall_test.c b/tool= s/testing/selftests/kvm/x86/fix_hypercall_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/fix_hypercall_test.c rename to tools/testing/selftests/kvm/x86/fix_hypercall_test.c diff --git a/tools/testing/selftests/kvm/x86_64/flds_emulation.h b/tools/te= sting/selftests/kvm/x86/flds_emulation.h similarity index 100% rename from tools/testing/selftests/kvm/x86_64/flds_emulation.h rename to tools/testing/selftests/kvm/x86/flds_emulation.h diff --git a/tools/testing/selftests/kvm/x86_64/hwcr_msr_test.c b/tools/tes= ting/selftests/kvm/x86/hwcr_msr_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/hwcr_msr_test.c rename to tools/testing/selftests/kvm/x86/hwcr_msr_test.c diff --git a/tools/testing/selftests/kvm/x86_64/hyperv_clock.c b/tools/test= ing/selftests/kvm/x86/hyperv_clock.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/hyperv_clock.c rename to tools/testing/selftests/kvm/x86/hyperv_clock.c diff --git a/tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c b/tools/test= ing/selftests/kvm/x86/hyperv_cpuid.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c rename to tools/testing/selftests/kvm/x86/hyperv_cpuid.c diff --git a/tools/testing/selftests/kvm/x86_64/hyperv_evmcs.c b/tools/test= ing/selftests/kvm/x86/hyperv_evmcs.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/hyperv_evmcs.c rename to tools/testing/selftests/kvm/x86/hyperv_evmcs.c diff --git a/tools/testing/selftests/kvm/x86_64/hyperv_extended_hypercalls.= c b/tools/testing/selftests/kvm/x86/hyperv_extended_hypercalls.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/hyperv_extended_hypercalls.c rename to tools/testing/selftests/kvm/x86/hyperv_extended_hypercalls.c diff --git a/tools/testing/selftests/kvm/x86_64/hyperv_features.c b/tools/t= esting/selftests/kvm/x86/hyperv_features.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/hyperv_features.c rename to tools/testing/selftests/kvm/x86/hyperv_features.c diff --git a/tools/testing/selftests/kvm/x86_64/hyperv_ipi.c b/tools/testin= g/selftests/kvm/x86/hyperv_ipi.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/hyperv_ipi.c rename to tools/testing/selftests/kvm/x86/hyperv_ipi.c diff --git a/tools/testing/selftests/kvm/x86_64/hyperv_svm_test.c b/tools/t= esting/selftests/kvm/x86/hyperv_svm_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/hyperv_svm_test.c rename to tools/testing/selftests/kvm/x86/hyperv_svm_test.c diff --git a/tools/testing/selftests/kvm/x86_64/hyperv_tlb_flush.c b/tools/= testing/selftests/kvm/x86/hyperv_tlb_flush.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/hyperv_tlb_flush.c rename to tools/testing/selftests/kvm/x86/hyperv_tlb_flush.c diff --git a/tools/testing/selftests/kvm/x86_64/kvm_clock_test.c b/tools/te= sting/selftests/kvm/x86/kvm_clock_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/kvm_clock_test.c rename to tools/testing/selftests/kvm/x86/kvm_clock_test.c diff --git a/tools/testing/selftests/kvm/x86_64/kvm_pv_test.c b/tools/testi= ng/selftests/kvm/x86/kvm_pv_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/kvm_pv_test.c rename to tools/testing/selftests/kvm/x86/kvm_pv_test.c diff --git a/tools/testing/selftests/kvm/x86_64/max_vcpuid_cap_test.c b/too= ls/testing/selftests/kvm/x86/max_vcpuid_cap_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/max_vcpuid_cap_test.c rename to tools/testing/selftests/kvm/x86/max_vcpuid_cap_test.c diff --git a/tools/testing/selftests/kvm/x86_64/monitor_mwait_test.c b/tool= s/testing/selftests/kvm/x86/monitor_mwait_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/monitor_mwait_test.c rename to tools/testing/selftests/kvm/x86/monitor_mwait_test.c diff --git a/tools/testing/selftests/kvm/x86_64/nested_exceptions_test.c b/= tools/testing/selftests/kvm/x86/nested_exceptions_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/nested_exceptions_test.c rename to tools/testing/selftests/kvm/x86/nested_exceptions_test.c diff --git a/tools/testing/selftests/kvm/x86_64/nx_huge_pages_test.c b/tool= s/testing/selftests/kvm/x86/nx_huge_pages_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/nx_huge_pages_test.c rename to tools/testing/selftests/kvm/x86/nx_huge_pages_test.c diff --git a/tools/testing/selftests/kvm/x86_64/nx_huge_pages_test.sh b/too= ls/testing/selftests/kvm/x86/nx_huge_pages_test.sh similarity index 100% rename from tools/testing/selftests/kvm/x86_64/nx_huge_pages_test.sh rename to tools/testing/selftests/kvm/x86/nx_huge_pages_test.sh diff --git a/tools/testing/selftests/kvm/x86_64/platform_info_test.c b/tool= s/testing/selftests/kvm/x86/platform_info_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/platform_info_test.c rename to tools/testing/selftests/kvm/x86/platform_info_test.c diff --git a/tools/testing/selftests/kvm/x86_64/pmu_counters_test.c b/tools= /testing/selftests/kvm/x86/pmu_counters_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/pmu_counters_test.c rename to tools/testing/selftests/kvm/x86/pmu_counters_test.c diff --git a/tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c b/t= ools/testing/selftests/kvm/x86/pmu_event_filter_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c rename to tools/testing/selftests/kvm/x86/pmu_event_filter_test.c diff --git a/tools/testing/selftests/kvm/x86_64/private_mem_conversions_tes= t.c b/tools/testing/selftests/kvm/x86/private_mem_conversions_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/private_mem_conversions_test= .c rename to tools/testing/selftests/kvm/x86/private_mem_conversions_test.c diff --git a/tools/testing/selftests/kvm/x86_64/private_mem_kvm_exits_test.= c b/tools/testing/selftests/kvm/x86/private_mem_kvm_exits_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/private_mem_kvm_exits_test.c rename to tools/testing/selftests/kvm/x86/private_mem_kvm_exits_test.c diff --git a/tools/testing/selftests/kvm/x86_64/recalc_apic_map_test.c b/to= ols/testing/selftests/kvm/x86/recalc_apic_map_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/recalc_apic_map_test.c rename to tools/testing/selftests/kvm/x86/recalc_apic_map_test.c diff --git a/tools/testing/selftests/kvm/x86_64/set_boot_cpu_id.c b/tools/t= esting/selftests/kvm/x86/set_boot_cpu_id.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/set_boot_cpu_id.c rename to tools/testing/selftests/kvm/x86/set_boot_cpu_id.c diff --git a/tools/testing/selftests/kvm/x86_64/set_sregs_test.c b/tools/te= sting/selftests/kvm/x86/set_sregs_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/set_sregs_test.c rename to tools/testing/selftests/kvm/x86/set_sregs_test.c diff --git a/tools/testing/selftests/kvm/x86_64/sev_init2_tests.c b/tools/t= esting/selftests/kvm/x86/sev_init2_tests.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/sev_init2_tests.c rename to tools/testing/selftests/kvm/x86/sev_init2_tests.c diff --git a/tools/testing/selftests/kvm/x86_64/sev_migrate_tests.c b/tools= /testing/selftests/kvm/x86/sev_migrate_tests.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/sev_migrate_tests.c rename to tools/testing/selftests/kvm/x86/sev_migrate_tests.c diff --git a/tools/testing/selftests/kvm/x86_64/sev_smoke_test.c b/tools/te= sting/selftests/kvm/x86/sev_smoke_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/sev_smoke_test.c rename to tools/testing/selftests/kvm/x86/sev_smoke_test.c diff --git a/tools/testing/selftests/kvm/x86_64/smaller_maxphyaddr_emulatio= n_test.c b/tools/testing/selftests/kvm/x86/smaller_maxphyaddr_emulation_tes= t.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/smaller_maxphyaddr_emulation= _test.c rename to tools/testing/selftests/kvm/x86/smaller_maxphyaddr_emulation_test= .c diff --git a/tools/testing/selftests/kvm/x86_64/smm_test.c b/tools/testing/= selftests/kvm/x86/smm_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/smm_test.c rename to tools/testing/selftests/kvm/x86/smm_test.c diff --git a/tools/testing/selftests/kvm/x86_64/state_test.c b/tools/testin= g/selftests/kvm/x86/state_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/state_test.c rename to tools/testing/selftests/kvm/x86/state_test.c diff --git a/tools/testing/selftests/kvm/x86_64/svm_int_ctl_test.c b/tools/= testing/selftests/kvm/x86/svm_int_ctl_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/svm_int_ctl_test.c rename to tools/testing/selftests/kvm/x86/svm_int_ctl_test.c diff --git a/tools/testing/selftests/kvm/x86_64/svm_nested_shutdown_test.c = b/tools/testing/selftests/kvm/x86/svm_nested_shutdown_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/svm_nested_shutdown_test.c rename to tools/testing/selftests/kvm/x86/svm_nested_shutdown_test.c diff --git a/tools/testing/selftests/kvm/x86_64/svm_nested_soft_inject_test= .c b/tools/testing/selftests/kvm/x86/svm_nested_soft_inject_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/svm_nested_soft_inject_test.c rename to tools/testing/selftests/kvm/x86/svm_nested_soft_inject_test.c diff --git a/tools/testing/selftests/kvm/x86_64/svm_vmcall_test.c b/tools/t= esting/selftests/kvm/x86/svm_vmcall_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/svm_vmcall_test.c rename to tools/testing/selftests/kvm/x86/svm_vmcall_test.c diff --git a/tools/testing/selftests/kvm/x86_64/sync_regs_test.c b/tools/te= sting/selftests/kvm/x86/sync_regs_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/sync_regs_test.c rename to tools/testing/selftests/kvm/x86/sync_regs_test.c diff --git a/tools/testing/selftests/kvm/x86_64/triple_fault_event_test.c b= /tools/testing/selftests/kvm/x86/triple_fault_event_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/triple_fault_event_test.c rename to tools/testing/selftests/kvm/x86/triple_fault_event_test.c diff --git a/tools/testing/selftests/kvm/x86_64/tsc_msrs_test.c b/tools/tes= ting/selftests/kvm/x86/tsc_msrs_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/tsc_msrs_test.c rename to tools/testing/selftests/kvm/x86/tsc_msrs_test.c diff --git a/tools/testing/selftests/kvm/x86_64/tsc_scaling_sync.c b/tools/= testing/selftests/kvm/x86/tsc_scaling_sync.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/tsc_scaling_sync.c rename to tools/testing/selftests/kvm/x86/tsc_scaling_sync.c diff --git a/tools/testing/selftests/kvm/x86_64/ucna_injection_test.c b/too= ls/testing/selftests/kvm/x86/ucna_injection_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/ucna_injection_test.c rename to tools/testing/selftests/kvm/x86/ucna_injection_test.c diff --git a/tools/testing/selftests/kvm/x86_64/userspace_io_test.c b/tools= /testing/selftests/kvm/x86/userspace_io_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/userspace_io_test.c rename to tools/testing/selftests/kvm/x86/userspace_io_test.c diff --git a/tools/testing/selftests/kvm/x86_64/userspace_msr_exit_test.c b= /tools/testing/selftests/kvm/x86/userspace_msr_exit_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/userspace_msr_exit_test.c rename to tools/testing/selftests/kvm/x86/userspace_msr_exit_test.c diff --git a/tools/testing/selftests/kvm/x86_64/vmx_apic_access_test.c b/to= ols/testing/selftests/kvm/x86/vmx_apic_access_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/vmx_apic_access_test.c rename to tools/testing/selftests/kvm/x86/vmx_apic_access_test.c diff --git a/tools/testing/selftests/kvm/x86_64/vmx_close_while_nested_test= .c b/tools/testing/selftests/kvm/x86/vmx_close_while_nested_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/vmx_close_while_nested_test.c rename to tools/testing/selftests/kvm/x86/vmx_close_while_nested_test.c diff --git a/tools/testing/selftests/kvm/x86_64/vmx_dirty_log_test.c b/tool= s/testing/selftests/kvm/x86/vmx_dirty_log_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/vmx_dirty_log_test.c rename to tools/testing/selftests/kvm/x86/vmx_dirty_log_test.c diff --git a/tools/testing/selftests/kvm/x86_64/vmx_exception_with_invalid_= guest_state.c b/tools/testing/selftests/kvm/x86/vmx_exception_with_invalid_= guest_state.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/vmx_exception_with_invalid_g= uest_state.c rename to tools/testing/selftests/kvm/x86/vmx_exception_with_invalid_guest_= state.c diff --git a/tools/testing/selftests/kvm/x86_64/vmx_invalid_nested_guest_st= ate.c b/tools/testing/selftests/kvm/x86/vmx_invalid_nested_guest_state.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/vmx_invalid_nested_guest_sta= te.c rename to tools/testing/selftests/kvm/x86/vmx_invalid_nested_guest_state.c diff --git a/tools/testing/selftests/kvm/x86_64/vmx_msrs_test.c b/tools/tes= ting/selftests/kvm/x86/vmx_msrs_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/vmx_msrs_test.c rename to tools/testing/selftests/kvm/x86/vmx_msrs_test.c diff --git a/tools/testing/selftests/kvm/x86_64/vmx_nested_tsc_scaling_test= .c b/tools/testing/selftests/kvm/x86/vmx_nested_tsc_scaling_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/vmx_nested_tsc_scaling_test.c rename to tools/testing/selftests/kvm/x86/vmx_nested_tsc_scaling_test.c diff --git a/tools/testing/selftests/kvm/x86_64/vmx_pmu_caps_test.c b/tools= /testing/selftests/kvm/x86/vmx_pmu_caps_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/vmx_pmu_caps_test.c rename to tools/testing/selftests/kvm/x86/vmx_pmu_caps_test.c diff --git a/tools/testing/selftests/kvm/x86_64/vmx_preemption_timer_test.c= b/tools/testing/selftests/kvm/x86/vmx_preemption_timer_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/vmx_preemption_timer_test.c rename to tools/testing/selftests/kvm/x86/vmx_preemption_timer_test.c diff --git a/tools/testing/selftests/kvm/x86_64/vmx_set_nested_state_test.c= b/tools/testing/selftests/kvm/x86/vmx_set_nested_state_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/vmx_set_nested_state_test.c rename to tools/testing/selftests/kvm/x86/vmx_set_nested_state_test.c diff --git a/tools/testing/selftests/kvm/x86_64/vmx_tsc_adjust_test.c b/too= ls/testing/selftests/kvm/x86/vmx_tsc_adjust_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/vmx_tsc_adjust_test.c rename to tools/testing/selftests/kvm/x86/vmx_tsc_adjust_test.c diff --git a/tools/testing/selftests/kvm/x86_64/xapic_ipi_test.c b/tools/te= sting/selftests/kvm/x86/xapic_ipi_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/xapic_ipi_test.c rename to tools/testing/selftests/kvm/x86/xapic_ipi_test.c diff --git a/tools/testing/selftests/kvm/x86_64/xapic_state_test.c b/tools/= testing/selftests/kvm/x86/xapic_state_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/xapic_state_test.c rename to tools/testing/selftests/kvm/x86/xapic_state_test.c diff --git a/tools/testing/selftests/kvm/x86_64/xcr0_cpuid_test.c b/tools/t= esting/selftests/kvm/x86/xcr0_cpuid_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/xcr0_cpuid_test.c rename to tools/testing/selftests/kvm/x86/xcr0_cpuid_test.c diff --git a/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c b/tools/t= esting/selftests/kvm/x86/xen_shinfo_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c rename to tools/testing/selftests/kvm/x86/xen_shinfo_test.c diff --git a/tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c b/tools/t= esting/selftests/kvm/x86/xen_vmcall_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c rename to tools/testing/selftests/kvm/x86/xen_vmcall_test.c diff --git a/tools/testing/selftests/kvm/x86_64/xss_msr_test.c b/tools/test= ing/selftests/kvm/x86/xss_msr_test.c similarity index 100% rename from tools/testing/selftests/kvm/x86_64/xss_msr_test.c rename to tools/testing/selftests/kvm/x86/xss_msr_test.c --=20 2.47.0.338.g60cca15819-goog From nobody Sat Feb 7 17:04:38 2026 Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E473153BFC for ; Thu, 28 Nov 2024 00:56:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755380; cv=none; b=fPnDJWZfifBVBhqzYDZWMm7fJ9cScH6zOafjoG+wa16dnV4BlH92Cl1OkP0F7O5rBGfl5fOic49l7oCyPpCLpe8hsG1V6/7kHzt1jNLmls9FeQxktK3WC4nwtShMZDKH5kud2bcBzV6uZ2U80ZATsKiH/o6jhCdcbIzNLjbpWQY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755380; c=relaxed/simple; bh=vSRfrEytDpN8W4HCrYiZGYIvGxH/eHfJp4zZjiL/A9E=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=AIthwTQbJSI92HVifm+2hoF8Mv6KX6P0HNiki8xefwLYRM9ZiT7HYJNIGkFXL+55uQ7UFuBss/GStecNIPZKklHRZ+PGTvTl0CL6IiTvNRN6HnVOgpFzdRaaL01XzQM+YjIOYn69FN4yeAmy6mUo5/dm5u5P99N2YZZDnbZt/L8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=tsv2Z8/6; arc=none smtp.client-ip=209.85.215.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="tsv2Z8/6" Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-7fc2bdd115cso247438a12.0 for ; Wed, 27 Nov 2024 16:56:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1732755378; x=1733360178; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=SIrOHFdLU07PpaXHI/YgxGMl42ASMs52y5wmlleZ1JI=; b=tsv2Z8/68GsvgAC+sDcHM6nSzYGwFcJWaMD9KqfowUE5UXu7FtJTpbdsoNLPpYf3iF F7kxzQgZdM48dYrWX4F803l9E3C7Az6Ny1hcWMu3wF91AV3u+9ipAgx7JVjS1qQe4kS1 ayIMomUFUjMgJuSRjo9rjrDrkyGYjhdUnsIZq2uH7KKozxTt1osFnBUY0OMqvq5FH0ys wGn3Z971vdlFdWtrEtqldW63IuEIrX2dvpxUVomsppHc8fdt9FO+emEdw4NUUdA9VYth X6ffGMMuCrme53m9ITbdgBCxBJLZ4EjPCdouDFRthkO5znzqWjbZHCMc0gjlnhornF5e Hhng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732755378; x=1733360178; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SIrOHFdLU07PpaXHI/YgxGMl42ASMs52y5wmlleZ1JI=; b=nSOCD0uzSAUpMR6Fkv15vRj/wAwQPE6DmaadGmygwMkFLx1J8IhiEBWp8jeNPvrnVg mjWWrnIfhyuQxTWdYYDSGQonP1PaLtPIri4K9Hl46aF0ExJCdab3e2do5jzW+AnIrFOZ gLczp9JLIzGP8Sa7t9lS/GUhWuRykzQEapFcQTx7m2dMNHhsXhQzEq8XGGx8OdjhKZWD JQ2UTK/5JRKjJjIssIZySEggfz4qhLZ4WI4GsuKwVLuYItufsbHfph8EJQayx+6nMP3P MwWJ5K19waSqiH8cSymYktNBqDSgrOPYLysuxentZm/dDqTbngQvVLOxdlGOYON0dDbZ TxJg== X-Forwarded-Encrypted: i=1; AJvYcCVhTMEtPOk0hP9Mvw3DmmpCVluLqwVeqDxrquSwl/81OfYiGIbfRnBn8L32AscNeDTT4Kj3yqdJnuxk1b4=@vger.kernel.org X-Gm-Message-State: AOJu0YwldI4AUWqBBpJy9M4za7+hdqjvaxlQOW7wAT6AOC9EKsjVGAxa aBOD/JrDc19opRZjb+nbv3AJQiOaRgxQUTtlKSBn6Jbt4BJ9wQWQrjK5HyFwDZEAJI1vjRbvHv9 FPw== X-Google-Smtp-Source: AGHT+IEWNoqxkKJEuSCYYZMRl85uBIjfdRzypvum78dwg9LOBi3REl5p9HlxVwSIxD2wnWKazGYBZqWzZwk= X-Received: from pjbst14.prod.google.com ([2002:a17:90b:1fce:b0:2ea:9d23:79a0]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90a:9f93:b0:2ea:5658:9ed6 with SMTP id 98e67ed59e1d1-2ee25b38db4mr2121026a91.12.1732755377809; Wed, 27 Nov 2024 16:56:17 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 27 Nov 2024 16:55:47 -0800 In-Reply-To: <20241128005547.4077116-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241128005547.4077116-1-seanjc@google.com> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog Message-ID: <20241128005547.4077116-17-seanjc@google.com> Subject: [PATCH v4 16/16] KVM: selftests: Override ARCH for x86_64 instead of using ARCH_DIR From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Paolo Bonzini , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Sean Christopherson Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Jones , James Houghton , Muhammad Usama Anjum Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Now that KVM selftests uses the kernel's canonical arch paths, directly override ARCH to 'x86' when targeting x86_64 instead of defining ARCH_DIR to redirect to appropriate paths. ARCH_DIR was originally added to deal with KVM selftests using the target triple ARCH for directories, e.g. s390x and aarch64; keeping it around just to deal with the one-off alias from x86_64=3D>x86 is unnecessary and confusing. Note, even when selftests are built from the top-level Makefile, ARCH is scoped to KVM's makefiles, i.e. overriding ARCH won't trip up some other selftests that (somehow) expects x86_64 and can't work with x86. Signed-off-by: Sean Christopherson Reviewed-by: Muhammad Usama Anjum --- tools/testing/selftests/kvm/Makefile | 4 +--- tools/testing/selftests/kvm/Makefile.kvm | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests= /kvm/Makefile index 9bc2eba1af1c..20af35a91d6f 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile @@ -6,9 +6,7 @@ ARCH ?=3D $(SUBARCH) ifeq ($(ARCH),$(filter $(ARCH),arm64 s390 riscv x86 x86_64)) # Top-level selftests allows ARCH=3Dx86_64 :-( ifeq ($(ARCH),x86_64) - ARCH_DIR :=3D x86 -else - ARCH_DIR :=3D $(ARCH) + ARCH :=3D x86 endif include Makefile.kvm else diff --git a/tools/testing/selftests/kvm/Makefile.kvm b/tools/testing/selft= ests/kvm/Makefile.kvm index 9888dd6bb483..4277b983cace 100644 --- a/tools/testing/selftests/kvm/Makefile.kvm +++ b/tools/testing/selftests/kvm/Makefile.kvm @@ -207,10 +207,10 @@ TEST_GEN_PROGS_riscv +=3D steal_time SPLIT_TESTS +=3D arch_timer SPLIT_TESTS +=3D get-reg-list =20 -TEST_PROGS +=3D $(TEST_PROGS_$(ARCH_DIR)) -TEST_GEN_PROGS +=3D $(TEST_GEN_PROGS_$(ARCH_DIR)) -TEST_GEN_PROGS_EXTENDED +=3D $(TEST_GEN_PROGS_EXTENDED_$(ARCH_DIR)) -LIBKVM +=3D $(LIBKVM_$(ARCH_DIR)) +TEST_PROGS +=3D $(TEST_PROGS_$(ARCH)) +TEST_GEN_PROGS +=3D $(TEST_GEN_PROGS_$(ARCH)) +TEST_GEN_PROGS_EXTENDED +=3D $(TEST_GEN_PROGS_EXTENDED_$(ARCH)) +LIBKVM +=3D $(LIBKVM_$(ARCH)) =20 OVERRIDE_TARGETS =3D 1 =20 @@ -222,14 +222,14 @@ include ../lib.mk INSTALL_HDR_PATH =3D $(top_srcdir)/usr LINUX_HDR_PATH =3D $(INSTALL_HDR_PATH)/include/ LINUX_TOOL_INCLUDE =3D $(top_srcdir)/tools/include -LINUX_TOOL_ARCH_INCLUDE =3D $(top_srcdir)/tools/arch/$(ARCH_DIR)/include +LINUX_TOOL_ARCH_INCLUDE =3D $(top_srcdir)/tools/arch/$(ARCH)/include CFLAGS +=3D -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=3Dgnu99 \ -Wno-gnu-variable-sized-type-not-at-end -MD -MP -DCONFIG_64BIT \ -fno-builtin-memcmp -fno-builtin-memcpy \ -fno-builtin-memset -fno-builtin-strnlen \ -fno-stack-protector -fno-PIE -fno-strict-aliasing \ -I$(LINUX_TOOL_INCLUDE) -I$(LINUX_TOOL_ARCH_INCLUDE) \ - -I$(LINUX_HDR_PATH) -Iinclude -I$(